1 function activateMenu() {
4 var abootDiagram = null;
6 function cldsOpenDiagram(modelXml) {
7 cldsModelXml = modelXml;
8 console.log("cldsOpenDiagram: cldsModelXml=" + cldsModelXml);
9 $("#cldsopendiagrambtn").click();
12 function cldsGetDiagram() {
13 console.log("cldsGetDiagram: starting...");
14 $("#cldsgetdiagrambtn").click();
15 console.log("cldsGetDiagram: modelXML=" + modelXML);
19 function uploaddata(file) {
21 $("#uploadmodel").click();
25 function visibility_model() {
26 $("#openmodel").click();
29 (function e(t, n, r) {
33 var a = typeof require == "function" && require;
34 if (!u && a) return a(o, !0);
35 if (i) return i(o, !0);
36 var f = new Error("Cannot find module '" + o + "'");
37 throw f.code = "MODULE_NOT_FOUND", f
42 t[o][0].call(l.exports, function(e) {
45 }, l, l.exports, e, t, n, r)
49 var i = typeof require == "function" && require;
50 for (var o = 0; o < r.length; o++) s(r[o]);
55 "\\bpmn-js-examples-master\\modeler\\app\\index.js":
57 [function(require, module, exports) {
63 var $ = require('jquery'),
64 BpmnModeler = require('bpmn-js/lib/Modeler');
66 var container = $('#js-drop-zone');
68 var canvas = $('#js-canvas');
70 var renderer = new BpmnModeler({
73 abootDiagram = renderer;
75 var newDiagramXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bpmn2:definitions xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:bpmn2=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:di=\"http://www.omg.org/spec/DD/20100524/DI\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd\" id=\"sample-diagram\" targetNamespace=\"http://bpmn.io/schema/bpmn\">\n <bpmn2:process id=\"Process_1\" isExecutable=\"false\">\n <bpmn2:startEvent id=\"StartEvent_1\"/>\n </bpmn2:process>\n <bpmndi:BPMNDiagram id=\"BPMNDiagram_1\">\n <bpmndi:BPMNPlane id=\"BPMNPlane_1\" bpmnElement=\"Process_1\">\n <bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" bpmnElement=\"StartEvent_1\">\n <dc:Bounds height=\"36.0\" width=\"36.0\" x=\"25.0\" y=\"240.0\"/>\n </bpmndi:BPMNShape>\n </bpmndi:BPMNPlane>\n </bpmndi:BPMNDiagram>\n</bpmn2:definitions>";
77 /*file_generate_test_case.addEventListener('click', function(e) {
84 function createNewDiagram(newDiagramXML) {
85 openDiagram(newDiagramXML);
89 function openDiagram(xml) {
90 renderer.importXML(xml, function(err) {
94 .removeClass('with-diagram')
95 .addClass('with-error');
97 container.find('.error pre').text(err.message);
102 .removeClass('with-error')
103 .addClass('with-diagram');
110 function saveSVG(done) {
111 renderer.saveSVG(done);
114 function saveDiagram(done) {
118 }, function(err, xml) {
124 function registerFileDrop(container, callback) {
126 function handleFileSelect(e) {
130 var files = e.dataTransfer.files;
134 var reader = new FileReader();
136 reader.onload = function(e) {
138 var xml = e.target.result;
143 reader.readAsText(file);
146 function handleDragOver(e) {
150 e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
152 if (container.get(0)) {
153 container.get(0).addEventListener('dragover', handleDragOver, false);
154 container.get(0).addEventListener('drop', handleFileSelect, false);
159 // //// file drag / drop ///////////////////////
161 // check file api availability
162 if (!window.FileList || !window.FileReader) {
164 'Looks like you use an older browser that does not support drag and drop. ' +
165 'Try using Chrome, Firefox or the Internet Explorer > 10.');
167 registerFileDrop(container, openDiagram);
170 // bootstrap diagram functions
171 function openNewWin(linkURL) {
172 window.open("" + linkURL + "", "_self" /*, "", "scrollbars, top="+winTop+", left="+winLeft+", height="+winHeight+", width="+winWidth+""*/ );
176 $(document).on('ready', function(e) {
178 /* $('#js-create-diagram').click(function(e) {*/
182 createNewDiagram(newDiagramXML);
185 var fileInput = document.getElementById('fileInput');
186 var file_generate_test_case = document.getElementById('file_generate_test_case');
188 var downloadLink = $('#js-download-diagram');
189 var downloadSvgLink = $('#js-download-svg');
190 var readLink = $('#file_generate_test_case');
191 $('.buttons a').click(function(e) {
192 if (!$(this).is('.active')) {
197 $('#openmodel').click(function() {
199 createNewDiagram(modelXML);
203 $('#cldsgetdiagrambtn').click(function() {
204 console.log("cldsgetdiagrambtn: starting...");
206 console.log("cldsgetdiagrambtn: modelXML=" + modelXML);
208 $('#cldsopendiagrambtn').click(function() {
209 console.log("cldsopendiagrambtn: cldsModelXml=" + cldsModelXml);
210 createNewDiagram(cldsModelXml);
213 $('#uploadmodel').click(function() {
214 var file = uploadfile;
215 var textType = /text.*/;
217 var reader = new FileReader();
219 reader.onload = function(e) {
220 newDiagramXML = reader.result;
223 createNewDiagram(newDiagramXML);
227 reader.readAsText(file);
231 fileInput.addEventListener('change', function(e) {
232 var file = fileInput.files[0];
233 var textType = /text.*/;
236 var reader = new FileReader();
238 reader.onload = function(e) {
239 newDiagramXML = reader.result;
242 createNewDiagram(newDiagramXML);
246 reader.readAsText(file);
251 function setEncoded(link, name, data) {
252 var encodedData = encodeURIComponent(data);
254 var el = document.getElementById(selected_model);
255 var text = (el.innerText || el.textContent);
259 //var linkURL='data:application/bpmn20-xml;charset=UTF-8,' + encodedData;
260 link.addClass('active').attr({
261 'href': 'data:application/bpmn20-xml;charset=UTF-8,' + encodedData,
262 /*openNewWin( linkURL )*/ /*'*/
263 'download': text.trim() + '.utmxml',
268 link.removeClass('active');
272 function setReadEncoded(link, name, data) {
273 var encodedData = encodeURIComponent(data);
276 link.addClass('active').attr({
277 'href': 'data:application/bpmn20-xml;charset=UTF-8,' + encodedData,
283 link.removeClass('active');
286 var _ = require('lodash');
287 /*var model = $( "#modelName" ).val();
290 var exportArtifacts = _.debounce(function() {
292 saveSVG(function(err, svg) {
293 setEncoded(downloadSvgLink, 'diagram.svg', err ? null : svg);
296 saveDiagram(function(err, xml) {
297 setEncoded(downloadLink, "model.utmxml", err ? null : xml);
302 renderer.on('commandStack.changed', exportArtifacts);
305 "bpmn-js/lib/Modeler": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\Modeler.js",
306 "jquery": "\\bpmn-js-examples-master\\modeler\\node_modules\\jquery\\dist\\jquery.js",
307 "lodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\index.js"
309 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\Modeler.js": [function(require, module, exports) {
312 var inherits = require('inherits');
314 var IdSupport = require('bpmn-moddle/lib/id-support'),
315 Ids = require('ids');
317 var Viewer = require('./Viewer');
320 '<?xml version="1.0" encoding="UTF-8"?>' +
321 '<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
322 'xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" ' +
323 'xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" ' +
324 'xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" ' +
325 'targetNamespace="http://bpmn.io/schema/bpmn" ' +
326 'id="Definitions_1">' +
327 '<bpmn:process id="Process_1" isExecutable="false">' +
328 '<bpmn:startEvent id="StartEvent_1"/>' +
330 '<bpmndi:BPMNDiagram id="BPMNDiagram_1">' +
331 '<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">' +
332 '<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">' +
333 '<dc:Bounds height="36.0" width="36.0" x="50.0" y="102.0"/>' +
334 '</bpmndi:BPMNShape>' +
335 '</bpmndi:BPMNPlane>' +
336 '</bpmndi:BPMNDiagram>' +
337 '</bpmn:definitions>';
341 * A modeler for BPMN 2.0 diagrams.
343 * ## Extending the Modeler
345 * In order to extend the viewer pass extension modules to bootstrap via the
346 * `additionalModules` option. An extension module is an object that exposes
349 * The following example depicts the integration of a simple logging component
350 * that integrates with interaction events:
354 * // logging component function InteractionLogger(eventBus) {
355 * eventBus.on('element.hover', function(event) { console.log() }) }
357 * InteractionLogger.$inject = [ 'eventBus' ]; // minification save
358 * // extension module var extensionModule = { __init__: [ 'interactionLogger' ],
359 * interactionLogger: [ 'type', InteractionLogger ] };
360 * // extend the viewer var bpmnModeler = new Modeler({ additionalModules: [
361 * extensionModule ] }); bpmnModeler.importXML(...); ```
363 * ## Customizing / Replacing Components
365 * You can replace individual diagram components by redefining them in override
366 * modules. This works for all components, including those defined in the core.
368 * Pass in override modules via the `options.additionalModules` flag like this:
370 * ```javascript function CustomContextPadProvider(contextPad) {
372 * contextPad.registerProvider(this);
374 * this.getContextPadEntries = function(element) { // no entries, effectively
375 * disable the context pad return {}; }; }
377 * CustomContextPadProvider.$inject = [ 'contextPad' ];
379 * var overrideModule = { contextPadProvider: [ 'type', CustomContextPadProvider ] };
381 * var bpmnModeler = new Modeler({ additionalModules: [ overrideModule ]}); ```
384 * [options] configuration options to pass to the viewer
385 * @param {DOMElement}
386 * [options.container] the container to render the viewer in,
388 * @param {String|Number}
389 * [options.width] the width of the viewer
390 * @param {String|Number}
391 * [options.height] the height of the viewer
393 * [options.moddleExtensions] extension packages to provide
395 * <didi.Module>} [options.modules] a list of modules to override the
398 * <didi.Module>} [options.additionalModules] a list of modules to
399 * use with the default modules
401 function Modeler(options) {
402 Viewer.call(this, options);
405 inherits(Modeler, Viewer);
407 Modeler.prototype.createDiagram = function(done) {
408 return this.importXML(initialDiagram, done);
411 Modeler.prototype.createModdle = function() {
412 var moddle = Viewer.prototype.createModdle.call(this);
414 IdSupport.extend(moddle, new Ids([32, 36, 1]));
420 Modeler.prototype._interactionModules = [
421 // non-modeling components
422 require('./features/label-editing'),
423 require('./features/keyboard'),
424 require('diagram-js/lib/navigation/zoomscroll'),
425 require('diagram-js/lib/navigation/movecanvas'),
426 require('diagram-js/lib/navigation/touch')
429 Modeler.prototype._modelingModules = [
430 // modeling components
431 require('diagram-js/lib/features/move'),
432 require('diagram-js/lib/features/bendpoints'),
433 require('diagram-js/lib/features/resize'),
434 require('diagram-js/lib/features/space-tool'),
435 require('diagram-js/lib/features/lasso-tool'),
436 //require('./features/keyboard'),
437 require('./features/snapping'),
438 require('./features/modeling'),
439 require('./features/context-pad'),
440 require('./features/palette')
444 // modules the modeler is composed of
447 // - interaction modules
448 // - modeling modules
450 Modeler.prototype._modules = [].concat(
451 Modeler.prototype._modules,
452 Modeler.prototype._interactionModules,
453 Modeler.prototype._modelingModules);
456 module.exports = Modeler;
459 "./Viewer": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\Viewer.js",
460 "./features/context-pad": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\context-pad\\index.js",
461 "./features/keyboard": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\keyboard\\index.js",
462 "./features/label-editing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\index.js",
463 "./features/modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\index.js",
464 "./features/palette": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\palette\\index.js",
465 "./features/snapping": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\snapping\\index.js",
466 "bpmn-moddle/lib/id-support": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\id-support.js",
467 "diagram-js/lib/features/bendpoints": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\index.js",
468 "diagram-js/lib/features/lasso-tool": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\lasso-tool\\index.js",
469 "diagram-js/lib/features/move": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\index.js",
470 "diagram-js/lib/features/resize": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\index.js",
471 "diagram-js/lib/features/space-tool": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\index.js",
472 "diagram-js/lib/navigation/movecanvas": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\movecanvas\\index.js",
473 "diagram-js/lib/navigation/touch": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\touch\\index.js",
474 "diagram-js/lib/navigation/zoomscroll": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\zoomscroll\\index.js",
475 "ids": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\ids\\index.js",
476 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
478 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\Viewer.js": [function(require, module, exports) {
481 var assign = require('lodash/object/assign'),
482 omit = require('lodash/object/omit'),
483 isString = require('lodash/lang/isString'),
484 isNumber = require('lodash/lang/isNumber');
486 var domify = require('min-dom/lib/domify'),
487 domQuery = require('min-dom/lib/query'),
488 domRemove = require('min-dom/lib/remove');
490 var Diagram = require('diagram-js'),
491 BpmnModdle = require('bpmn-moddle');
493 var Importer = require('./import/Importer');
496 function initListeners(diagram, listeners) {
497 var events = diagram.get('eventBus');
499 listeners.forEach(function(l) {
500 events.on(l.event, l.handler);
504 function checkValidationError(err) {
506 // check if we can help the user by indicating wrong BPMN 2.0 xml
507 // (in case he or the exporting tool did not get that right)
509 var pattern = /unparsable content <([^>]+)> detected([\s\S]*)$/;
510 var match = pattern.exec(err.message);
514 'unparsable content <' + match[1] + '> detected; ' +
515 'this may indicate an invalid BPMN 2.0 diagram file' + match[2];
521 var DEFAULT_OPTIONS = {
524 position: 'relative',
531 * Ensure the passed argument is a proper unit (defaulting to px)
533 function ensureUnit(val) {
534 return val + (isNumber(val) ? 'px' : '');
538 * A viewer for BPMN 2.0 diagrams.
540 * Have a look at {@link NavigatedViewer} or {@link Modeler} for bundles that
541 * include additional features.
543 * ## Extending the Viewer
545 * In order to extend the viewer pass extension modules to bootstrap via the
546 * `additionalModules` option. An extension module is an object that exposes
549 * The following example depicts the integration of a simple logging component
550 * that integrates with interaction events:
554 * // logging component function InteractionLogger(eventBus) {
555 * eventBus.on('element.hover', function(event) { console.log() }) }
557 * InteractionLogger.$inject = [ 'eventBus' ]; // minification save
558 * // extension module var extensionModule = { __init__: [ 'interactionLogger' ],
559 * interactionLogger: [ 'type', InteractionLogger ] };
560 * // extend the viewer var bpmnViewer = new Viewer({ additionalModules: [
561 * extensionModule ] }); bpmnViewer.importXML(...); ```
564 * [options] configuration options to pass to the viewer
565 * @param {DOMElement}
566 * [options.container] the container to render the viewer in,
568 * @param {String|Number}
569 * [options.width] the width of the viewer
570 * @param {String|Number}
571 * [options.height] the height of the viewer
573 * [options.moddleExtensions] extension packages to provide
575 * <didi.Module>} [options.modules] a list of modules to override the
578 * <didi.Module>} [options.additionalModules] a list of modules to
579 * use with the default modules
581 function Viewer(options) {
583 this.options = options = assign({}, DEFAULT_OPTIONS, options || {});
585 var parent = options.container;
587 // support jquery element
588 // unwrap it if passed
590 parent = parent.get(0);
594 if (isString(parent)) {
595 parent = domQuery(parent);
598 var container = this.container = domify('<div class="bjs-container"></div>');
599 if (parent && parent.appendChild) {
600 parent.appendChild(container);
604 assign(container.style, {
605 width: ensureUnit(options.width),
606 height: ensureUnit(options.height),
607 position: options.position
611 * The code in the <project-logo></project-logo> area must not be changed,
612 * see http://bpmn.io/license for more information
619 // inlined ../resources/bpmnjs.png
620 var logoData = 'iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAMAAADypuvZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBQTFRFiMte9PrwldFwfcZPqtqN0+zEyOe1XLgjvuKncsJAZ70y6fXh3vDT////UrQV////G2zN+AAAABB0Uk5T////////////////////AOAjXRkAAAHDSURBVHjavJZJkoUgDEBJmAX8979tM8u3E6x20VlYJfFFMoL4vBDxATxZcakIOJTWSmxvKWVIkJ8jHvlRv1F2LFrVISCZI+tCtQx+XfewgVTfyY3plPiQEAzI3zWy+kR6NBhFBYeBuscJLOUuA2WVLpCjVIaFzrNQZArxAZKUQm6gsj37L9Cb7dnIBUKxENaaMJQqMpDXvSL+ktxdGRm2IsKgJGGPg7atwUG5CcFUEuSv+CwQqizTrvDTNXdMU2bMiDWZd8d7QIySWVRsb2vBBioxOFt4OinPBapL+neAb5KL5IJ8szOza2/DYoipUCx+CjO0Bpsv0V6mktNZ+k8rlABlWG0FrOpKYVo8DT3dBeLEjUBAj7moDogVii7nSS9QzZnFcOVBp1g2PyBQ3Vr5aIapN91VJy33HTJLC1iX2FY6F8gRdaAeIEfVONgtFCzZTmoLEdOjBDfsIOA6128gw3eu1shAajdZNAORxuQDJN5A5PbEG6gNIu24QJD5iNyRMZIr6bsHbCtCU/OaOaSvgkUyDMdDa1BXGf5HJ1To+/Ym6mCKT02Y+/Sa126ZKyd3jxhzpc1r8zVL6YM1Qy/kR4ABAFJ6iQUnivhAAAAAAElFTkSuQmCC';
625 '<a href="http://bpmn.io" ' +
627 'class="bjs-powered-by" ' +
628 'title="Powered by bpmn.io" ' +
629 'style="position: absolute; bottom: 15px; right: 15px; z-index: 100">' +
630 '<img src="data:image/png;base64,' + logoData + '">' +
632 if (container && container.appendChild) {
633 container.appendChild(domify(linkMarkup));
637 /* </project-logo> */
640 Viewer.prototype.importXML = function(xml, done) {
644 this.moddle = this.createModdle();
646 this.moddle.fromXML(xml, 'bpmn:Definitions', function(err, definitions, context) {
649 err = checkValidationError(err);
653 var parseWarnings = context.warnings;
655 self.importDefinitions(definitions, function(err, importWarnings) {
660 done(null, parseWarnings.concat(importWarnings || []));
665 Viewer.prototype.saveXML = function(options, done) {
672 var definitions = this.definitions;
675 return done(new Error('no definitions loaded'));
678 this.moddle.toXML(definitions, options, done);
682 Viewer.prototype.createModdle = function() {
683 return new BpmnModdle(this.options.moddleExtensions);
686 Viewer.prototype.saveSVG = function(options, done) {
693 var canvas = this.get('canvas');
695 var contentNode = canvas.getDefaultLayer(),
696 defsNode = canvas._svg.select('defs');
698 var contents = contentNode.innerSVG(),
699 defs = (defsNode && defsNode.outerSVG()) || '';
701 var bbox = contentNode.getBBox();
704 '<?xml version="1.0" encoding="utf-8"?>\n' +
705 '<!-- created with bpmn-js / http://bpmn.io -->\n' +
706 '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n' +
707 '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ' +
708 'width="' + bbox.width + '" height="' + bbox.height + '" ' +
709 'viewBox="' + bbox.x + ' ' + bbox.y + ' ' + bbox.width + ' ' + bbox.height + '" version="1.1">' +
716 Viewer.prototype.get = function(name) {
719 throw new Error('no diagram loaded');
722 return this.diagram.get(name);
725 Viewer.prototype.invoke = function(fn) {
728 throw new Error('no diagram loaded');
731 return this.diagram.invoke(fn);
734 Viewer.prototype.importDefinitions = function(definitions, done) {
736 // use try/catch to not swallow synchronous exceptions
737 // that may be raised during model parsing
743 this.definitions = definitions;
745 var diagram = this.diagram = this._createDiagram(this.options);
749 Importer.importBpmnDiagram(diagram, definitions, done);
755 Viewer.prototype._init = function(diagram) {
756 initListeners(diagram, this.__listeners || []);
759 Viewer.prototype._createDiagram = function(options) {
761 var modules = [].concat(options.modules || this.getModules(), options.additionalModules || []);
763 // add self as an available service
765 bpmnjs: ['value', this],
766 moddle: ['value', this.moddle]
769 options = omit(options, 'additionalModules');
771 options = assign(options, {
773 container: this.container
778 return new Diagram(options);
782 Viewer.prototype.getModules = function() {
783 return this._modules;
787 * Remove all drawn elements from the viewer.
789 * After calling this method the viewer can still be reused for opening another
792 Viewer.prototype.clear = function() {
793 var diagram = this.diagram;
801 * Destroy the viewer instance and remove all its remainders from the document
804 Viewer.prototype.destroy = function() {
805 // clear underlying diagram
809 domRemove(this.container);
813 * Register an event listener on the viewer
820 Viewer.prototype.on = function(event, handler) {
821 var diagram = this.diagram,
822 listeners = this.__listeners = this.__listeners || [];
830 diagram.get('eventBus').on(event, handler);
834 // modules the viewer is composed of
835 Viewer.prototype._modules = [
837 require('diagram-js/lib/features/selection'),
838 require('diagram-js/lib/features/overlays')
841 module.exports = Viewer;
844 "./core": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\core\\index.js",
845 "./import/Importer": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Importer.js",
846 "bpmn-moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\index.js",
847 "diagram-js": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\index.js",
848 "diagram-js/lib/features/overlays": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\index.js",
849 "diagram-js/lib/features/selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
850 "lodash/lang/isNumber": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js",
851 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
852 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
853 "lodash/object/omit": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\omit.js",
854 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\domify.js",
855 "min-dom/lib/query": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\query.js",
856 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\remove.js"
858 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\core\\index.js": [function(require, module, exports) {
866 "../draw": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\index.js",
867 "../import": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\index.js"
869 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\BpmnRenderer.js": [function(require, module, exports) {
872 var inherits = require('inherits'),
873 isArray = require('lodash/lang/isArray'),
874 isObject = require('lodash/lang/isObject'),
875 assign = require('lodash/object/assign'),
876 forEach = require('lodash/collection/forEach'),
877 every = require('lodash/collection/every'),
878 includes = require('lodash/collection/includes'),
879 some = require('lodash/collection/some');
881 var DefaultRenderer = require('diagram-js/lib/draw/Renderer'),
882 TextUtil = require('diagram-js/lib/util/Text'),
883 DiUtil = require('../util/DiUtil');
885 var createLine = DefaultRenderer.createLine;
888 function BpmnRenderer(events, styles, pathMap) {
890 DefaultRenderer.call(this, styles);
892 var TASK_BORDER_RADIUS = 10;
893 var INNER_OUTER_DIST = 3;
896 fontFamily: 'Arial, sans-serif',
900 var textUtil = new TextUtil({
909 function addMarker(id, element) {
910 markers[id] = element;
913 function marker(id) {
917 function initMarkers(svg) {
919 function createMarker(id, options) {
923 strokeLinecap: 'round',
924 strokeDasharray: 'none'
927 var ref = options.ref || {
932 var scale = options.scale || 1;
934 // fix for safari / chrome / firefox bug not correctly
935 // resetting stroke dash array
936 if (attrs.strokeDasharray === 'none') {
937 attrs.strokeDasharray = [10000, 1];
940 var marker = options.element
942 .marker(0, 0, 20, 20, ref.x, ref.y)
944 markerWidth: 20 * scale,
945 markerHeight: 20 * scale
948 return addMarker(id, marker);
952 createMarker('sequenceflow-end', {
953 element: svg.path('M 1 5 L 11 10 L 1 15 Z'),
961 createMarker('messageflow-start', {
962 element: svg.circle(6, 6, 3.5),
973 createMarker('messageflow-end', {
974 element: svg.path('m 1 5 l 0 -3 l 7 3 l -7 3 z'),
978 strokeLinecap: 'butt'
986 createMarker('data-association-end', {
987 element: svg.path('M 1 5 L 11 10 L 1 15'),
999 createMarker('conditional-flow-marker', {
1000 element: svg.path('M 0 10 L 8 6 L 16 10 L 8 14 Z'),
1012 createMarker('conditional-default-flow-marker', {
1013 element: svg.path('M 1 4 L 5 16'),
1025 function computeStyle(custom, traits, defaultStyles) {
1026 if (!isArray(traits)) {
1027 defaultStyles = traits;
1031 return styles.style(traits || [], assign(defaultStyles, custom || {}));
1034 function drawCircle(p, width, height, offset, attrs) {
1036 if (isObject(offset)) {
1041 offset = offset || 0;
1043 attrs = computeStyle(attrs, {
1052 return p.circle(cx, cy, Math.round((width + height) / 4 - offset)).attr(attrs);
1055 function drawRect(p, width, height, r, offset, attrs) {
1057 if (isObject(offset)) {
1062 offset = offset || 0;
1064 attrs = computeStyle(attrs, {
1070 return p.rect(offset, offset, width - offset * 2, height - offset * 2, r).attr(attrs);
1073 function drawDiamond(p, width, height, attrs) {
1075 var x_2 = width / 2;
1076 var y_2 = height / 2;
1078 var points = [x_2, 0, width, y_2, x_2, height, 0, y_2];
1080 attrs = computeStyle(attrs, {
1086 return p.polygon(points).attr(attrs);
1089 function drawLine(p, waypoints, attrs) {
1090 attrs = computeStyle(attrs, ['no-fill'], {
1096 return createLine(waypoints, attrs).appendTo(p);
1099 function drawPath(p, d, attrs) {
1101 attrs = computeStyle(attrs, ['no-fill'], {
1106 return p.path(d).attr(attrs);
1110 return function(p, element) {
1111 return handlers[type](p, element);
1115 function renderer(type) {
1116 return handlers[type];
1119 function renderEventContent(element, p) {
1121 var event = getSemantic(element);
1122 var isThrowing = isThrowEvent(event);
1124 if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
1125 return renderer('bpmn:MessageEventDefinition')(p, element, isThrowing);
1128 if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
1129 return renderer('bpmn:TimerEventDefinition')(p, element, isThrowing);
1132 if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
1133 return renderer('bpmn:ConditionalEventDefinition')(p, element);
1136 if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
1137 return renderer('bpmn:SignalEventDefinition')(p, element, isThrowing);
1140 if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&
1141 isTypedEvent(event, 'bpmn:TerminateEventDefinition', {
1142 parallelMultiple: false
1144 return renderer('bpmn:MultipleEventDefinition')(p, element, isThrowing);
1147 if (isTypedEvent(event, 'bpmn:CancelEventDefinition') &&
1148 isTypedEvent(event, 'bpmn:TerminateEventDefinition', {
1149 parallelMultiple: true
1151 return renderer('bpmn:ParallelMultipleEventDefinition')(p, element, isThrowing);
1154 if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
1155 return renderer('bpmn:EscalationEventDefinition')(p, element, isThrowing);
1158 if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
1159 return renderer('bpmn:LinkEventDefinition')(p, element, isThrowing);
1162 if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
1163 return renderer('bpmn:ErrorEventDefinition')(p, element, isThrowing);
1166 if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
1167 return renderer('bpmn:CancelEventDefinition')(p, element, isThrowing);
1170 if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
1171 return renderer('bpmn:CompensateEventDefinition')(p, element, isThrowing);
1174 if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
1175 return renderer('bpmn:TerminateEventDefinition')(p, element, isThrowing);
1181 function renderLabel(p, label, options) {
1182 return textUtil.createText(p, label || '', options).addClass('djs-label');
1185 function renderEmbeddedLabel(p, element, align) {
1186 var semantic = getSemantic(element);
1187 return renderLabel(p, semantic.name, {
1194 function renderExternalLabel(p, element, align) {
1195 var semantic = getSemantic(element);
1197 if (!semantic.name) {
1198 element.hidden = true;
1201 return renderLabel(p, semantic.name, {
1210 function renderLaneLabel(p, text, element) {
1211 var textBox = renderLabel(p, text, {
1214 width: element.height
1216 align: 'center-middle'
1219 var top = -1 * element.height;
1222 'translate(' + top + ',' + 0 + ')'
1226 function createPathFromConnection(connection) {
1227 var waypoints = connection.waypoints;
1229 var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
1230 for (var i = 1; i < waypoints.length; i++) {
1231 pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
1237 'bpmn:Event': function(p, element, attrs) {
1238 return drawCircle(p, element.width, element.height, attrs);
1240 'bpmn:StartEvent': function(p, element) {
1242 var semantic = getSemantic(element);
1244 if (!semantic.isInterrupting) {
1246 strokeDasharray: '6',
1247 strokeLinecap: 'round'
1251 var circle = renderer('bpmn:Event')(p, element, attrs);
1253 renderEventContent(element, p);
1258 'bpmn:MultiBranchConnector': function(p, element) {
1260 element.height = 80;
1262 var semantic = getSemantic(element);
1264 if (!semantic.isInterrupting) {
1266 strokeDasharray: '6',
1267 strokeLinecap: 'round'
1271 var circle = renderer('bpmn:Event')(p, element, attrs);
1272 var height = element.height / 2;
1273 var width = element.width / 2;
1274 var value = Math.round((height + width) / 4);
1277 y: Math.round(element.height / 2)
1280 y: Math.round(element.height / 2)
1283 x: Math.round(element.width / 2),
1286 x: Math.round(element.width / 2),
1289 renderEventContent(element, p);
1293 'bpmn:ParentReturn': function(p, element) {
1295 var semantic = getSemantic(element);
1297 if (!semantic.isInterrupting) {
1299 strokeDasharray: '6',
1300 strokeLinecap: 'round'
1304 // var circle = renderer('bpmn:Event')(p, element, attrs);
1310 y: element.height / 2
1314 y: element.height / 2
1316 x: element.width / 2,
1331 y: element.height / 2
1337 y: element.height / 2
1339 x: element.width / 2,
1343 var text2 = getSemantic(element).name;
1344 renderLabel(p, text2, {
1348 renderEventContent(element, p);
1352 'bpmn:SubProcessCall': function(p, element) {
1353 var lane = renderer('bpmn:Lane')(p, element, {
1357 var expandedPool = DiUtil.isExpanded(element);
1369 x: element.width - 20,
1372 x: element.width - 20,
1376 var text2 = getSemantic(element).name;
1377 renderLabel(p, text2, {
1379 align: 'center-middle'
1383 * var text = getSemantic(element).name; renderLaneLabel(p,
1387 // Collapsed pool draw text inline
1388 var text2 = getSemantic(element).name;
1389 renderLabel(p, text2, {
1391 align: 'center-middle'
1395 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1397 if (participantMultiplicity) {
1398 renderer('ParticipantMultiplicityMarker')(p, element);
1405 'bpmn:InitiateProcess': function(p, element) {
1406 var lane = renderer('bpmn:Lane')(p, element, {
1410 var expandedPool = DiUtil.isExpanded(element);
1411 openDiagram(newDiagramXML);
1428 var text2 = getSemantic(element).name;
1429 renderLabel(p, text2, {
1431 align: 'center-middle'
1435 // Collapsed pool draw text inline
1436 var text2 = getSemantic(element).name;
1437 renderLabel(p, text2, {
1439 align: 'center-middle'
1443 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1445 if (participantMultiplicity) {
1446 renderer('ParticipantMultiplicityMarker')(p, element);
1453 'bpmn:VesCollector': function(p, element) {
1454 var lane = renderer('bpmn:Lane')(p, element, {
1458 var expandedPool = DiUtil.isExpanded(element);
1477 textUtil.createText(p, "V", {
1482 right: element.width - 20,
1486 textUtil.createText(p, "E", {
1491 right: element.width - 20,
1495 textUtil.createText(p, "S", {
1500 right: element.width - 20,
1505 var text2 = getSemantic(element).name;
1506 if (text2 == undefined) {
1507 text2 = 'VesCollector';
1510 renderLabel(p, text2, {
1512 align: 'center-middle'
1516 // Collapsed pool draw text inline
1517 var text2 = getSemantic(element).name;
1518 renderLabel(p, text2, {
1520 align: 'center-middle'
1524 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1526 if (participantMultiplicity) {
1527 renderer('ParticipantMultiplicityMarker')(p, element);
1533 'bpmn:Holmes': function(p, element) {
1534 var lane = renderer('bpmn:Lane')(p, element, {
1538 var expandedPool = DiUtil.isExpanded(element);
1540 var instanceName = getSemantic(element).name;
1543 if (instanceName == undefined) {
1544 instanceName = 'Holmes';
1547 // add holmes 'icon'
1548 var attrs = computeStyle({}, {
1553 p.circle(15, 15, 10).attr(attrs)
1554 textUtil.createText(p, "H", {
1563 renderLabel(p, instanceName, {
1565 align: 'center-middle'
1568 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1570 if (participantMultiplicity) {
1571 renderer('ParticipantMultiplicityMarker')(p, element);
1577 'bpmn:TCA': function(p, element) {
1578 var lane = renderer('bpmn:Lane')(p, element, {
1582 var expandedPool = DiUtil.isExpanded(element);
1589 y: element.height - 20
1592 y: element.height - 20
1594 var text2 = getSemantic(element).name;
1595 if (text2 == undefined) {
1598 renderLabel(p, text2, {
1600 align: 'center-middle'
1604 // Collapsed pool draw text inline
1605 var text2 = getSemantic(element).name;
1606 renderLabel(p, text2, {
1608 align: 'center-middle'
1612 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1614 if (participantMultiplicity) {
1615 renderer('ParticipantMultiplicityMarker')(p, element);
1622 'bpmn:GOC': function(p, element) {
1623 var lane = renderer('bpmn:Lane')(p, element, {
1627 var expandedPool = DiUtil.isExpanded(element);
1634 x: element.width / 2,
1638 y: element.height / 2
1640 var text2 = getSemantic(element).name;
1641 if (text2 == undefined) {
1644 renderLabel(p, text2, {
1646 align: 'center-middle'
1650 // Collapsed pool draw text inline
1651 var text2 = getSemantic(element).name;
1652 renderLabel(p, text2, {
1654 align: 'center-middle'
1658 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1660 if (participantMultiplicity) {
1661 renderer('ParticipantMultiplicityMarker')(p, element);
1668 'bpmn:Policy': function(p, element) {
1669 var lane = renderer('bpmn:Lane')(p, element, {
1673 var expandedPool = DiUtil.isExpanded(element);
1681 y: element.height / 2
1683 x: element.width / 2,
1686 var text2 = getSemantic(element).name;
1687 if (text2 == undefined) {
1690 renderLabel(p, text2, {
1692 align: 'center-middle'
1696 // Collapsed pool draw text inline
1697 var text2 = getSemantic(element).name;
1698 renderLabel(p, text2, {
1700 align: 'center-middle'
1704 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1706 if (participantMultiplicity) {
1707 renderer('ParticipantMultiplicityMarker')(p, element);
1714 'bpmn:MessageEventDefinition': function(p, element, isThrowing) {
1715 var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
1718 containerWidth: element.width,
1719 containerHeight: element.height,
1726 var fill = isThrowing ? 'black' : 'white';
1727 var stroke = isThrowing ? 'white' : 'black';
1729 var messagePath = drawPath(p, pathData, {
1737 'bpmn:TimerEventDefinition': function(p, element) {
1739 var circle = drawCircle(p, element.width, element.height, 0.2 * element.height, {
1743 var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
1746 containerWidth: element.width,
1747 containerHeight: element.height,
1754 drawPath(p, pathData, {
1756 strokeLinecap: 'square'
1759 for (var i = 0; i < 12; i++) {
1761 var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
1764 containerWidth: element.width,
1765 containerHeight: element.height,
1772 var width = element.width / 2;
1773 var height = element.height / 2;
1775 drawPath(p, linePathData, {
1777 strokeLinecap: 'square',
1778 transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
1784 'bpmn:EscalationEventDefinition': function(p, event, isThrowing) {
1785 var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
1788 containerWidth: event.width,
1789 containerHeight: event.height,
1796 var fill = isThrowing ? 'black' : 'none';
1798 return drawPath(p, pathData, {
1803 'bpmn:ConditionalEventDefinition': function(p, event) {
1804 var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
1807 containerWidth: event.width,
1808 containerHeight: event.height,
1815 return drawPath(p, pathData, {
1819 'bpmn:LinkEventDefinition': function(p, event, isThrowing) {
1820 var pathData = pathMap.getScaledPath('EVENT_LINK', {
1823 containerWidth: event.width,
1824 containerHeight: event.height,
1831 var fill = isThrowing ? 'black' : 'none';
1833 return drawPath(p, pathData, {
1838 'bpmn:ErrorEventDefinition': function(p, event, isThrowing) {
1839 var pathData = pathMap.getScaledPath('EVENT_ERROR', {
1842 containerWidth: event.width,
1843 containerHeight: event.height,
1850 var fill = isThrowing ? 'black' : 'none';
1852 return drawPath(p, pathData, {
1857 'bpmn:CancelEventDefinition': function(p, event, isThrowing) {
1858 var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
1861 containerWidth: event.width,
1862 containerHeight: event.height,
1869 var fill = isThrowing ? 'black' : 'none';
1871 return drawPath(p, pathData, {
1874 }).transform('rotate(45)');
1876 'bpmn:CompensateEventDefinition': function(p, event, isThrowing) {
1877 var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
1880 containerWidth: event.width,
1881 containerHeight: event.height,
1888 var fill = isThrowing ? 'black' : 'none';
1890 return drawPath(p, pathData, {
1895 'bpmn:SignalEventDefinition': function(p, event, isThrowing) {
1896 var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
1899 containerWidth: event.width,
1900 containerHeight: event.height,
1907 var fill = isThrowing ? 'black' : 'none';
1909 return drawPath(p, pathData, {
1914 'bpmn:MultipleEventDefinition': function(p, event, isThrowing) {
1915 var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
1918 containerWidth: event.width,
1919 containerHeight: event.height,
1926 var fill = isThrowing ? 'black' : 'none';
1928 return drawPath(p, pathData, {
1933 'bpmn:ParallelMultipleEventDefinition': function(p, event) {
1934 var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
1937 containerWidth: event.width,
1938 containerHeight: event.height,
1945 return drawPath(p, pathData, {
1949 'bpmn:EndEvent': function(p, element) {
1950 var circle = renderer('bpmn:Event')(p, element, {
1954 renderEventContent(element, p, true);
1958 'bpmn:TerminateEventDefinition': function(p, element) {
1959 var circle = drawCircle(p, element.width, element.height, 8, {
1966 'bpmn:IntermediateEvent': function(p, element) {
1967 var outer = renderer('bpmn:Event')(p, element, {
1971 drawCircle(p, element.width, element.height, INNER_OUTER_DIST, {
1976 renderEventContent(element, p);
1980 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
1981 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
1983 'bpmn:Activity': function(p, element, attrs) {
1984 return drawRect(p, element.width, element.height, TASK_BORDER_RADIUS, attrs);
1987 'bpmn:Task': function(p, element, attrs) {
1988 var rect = renderer('bpmn:Activity')(p, element, attrs);
1989 renderEmbeddedLabel(p, element, 'center-middle');
1990 attachTaskMarkers(p, element);
1993 'bpmn:ServiceTask': function(p, element) {
1994 var task = renderer('bpmn:Task')(p, element);
1996 var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
2004 drawPath(p, pathDataBG, {
2009 var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
2017 drawPath(p, fillPathData, {
2023 var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
2031 drawPath(p, pathData, {
2038 'bpmn:UserTask': function(p, element) {
2039 var task = renderer('bpmn:Task')(p, element);
2044 var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {
2052 drawPath(p, pathData, {
2057 var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
2065 drawPath(p, pathData2, {
2070 var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
2078 drawPath(p, pathData3, {
2085 'bpmn:ManualTask': function(p, element) {
2086 var task = renderer('bpmn:Task')(p, element);
2088 var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
2096 drawPath(p, pathData, {
2104 'bpmn:SendTask': function(p, element) {
2105 var task = renderer('bpmn:Task')(p, element);
2107 var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
2111 containerHeight: 14,
2119 drawPath(p, pathData, {
2127 'bpmn:ReceiveTask': function(p, element) {
2128 var semantic = getSemantic(element);
2130 var task = renderer('bpmn:Task')(p, element);
2133 if (semantic.instantiate) {
2134 drawCircle(p, 28, 28, 20 * 0.22, {
2138 pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
2146 pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
2150 containerHeight: 14,
2159 drawPath(p, pathData, {
2165 'bpmn:ScriptTask': function(p, element) {
2166 var task = renderer('bpmn:Task')(p, element);
2168 var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
2176 drawPath(p, pathData, {
2182 'bpmn:BusinessRuleTask': function(p, element) {
2183 var task = renderer('bpmn:Task')(p, element);
2185 var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
2192 var businessHeaderPath = drawPath(p, headerPathData);
2193 businessHeaderPath.attr({
2198 var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
2205 var businessPath = drawPath(p, headerData);
2212 'bpmn:SubProcess': function(p, element, attrs) {
2213 var rect = renderer('bpmn:Activity')(p, element, attrs);
2215 var semantic = getSemantic(element);
2217 var expanded = DiUtil.isExpanded(semantic);
2219 var isEventSubProcess = !!semantic.triggeredByEvent;
2220 if (isEventSubProcess) {
2222 strokeDasharray: '1,2'
2226 renderEmbeddedLabel(p, element, expanded ? 'center-top' : 'center-middle');
2229 attachTaskMarkers(p, element);
2231 attachTaskMarkers(p, element, ['SubProcessMarker']);
2236 'bpmn:AdHocSubProcess': function(p, element) {
2237 return renderer('bpmn:SubProcess')(p, element);
2239 'bpmn:Transaction': function(p, element) {
2240 var outer = renderer('bpmn:SubProcess')(p, element);
2242 var innerAttrs = styles.style(['no-fill', 'no-events']);
2245 drawRect(p, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
2249 'bpmn:CallActivity': function(p, element) {
2250 return renderer('bpmn:Task')(p, element, {
2254 'bpmn:Participant': function(p, element) {
2256 var lane = renderer('bpmn:Lane')(p, element, {
2260 var expandedPool = DiUtil.isExpanded(element);
2270 var text = getSemantic(element).name;
2271 renderLaneLabel(p, text, element);
2273 // Collapsed pool draw text inline
2274 var text2 = getSemantic(element).name;
2275 renderLabel(p, text2, {
2277 align: 'center-middle'
2281 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
2283 if (participantMultiplicity) {
2284 renderer('ParticipantMultiplicityMarker')(p, element);
2289 'bpmn:Lane': function(p, element, attrs) {
2290 var rect = drawRect(p, element.width, element.height, 0, attrs || {
2294 var semantic = getSemantic(element);
2296 if (semantic.$type === 'bpmn:Lane') {
2297 var text = semantic.name;
2298 renderLaneLabel(p, text, element);
2303 'bpmn:InclusiveGateway': function(p, element) {
2304 var diamond = drawDiamond(p, element.width, element.height);
2307 drawCircle(p, element.width, element.height, element.height * 0.24, {
2314 'bpmn:ExclusiveGateway': function(p, element) {
2315 var diamond = drawDiamond(p, element.width, element.height);
2316 renderEmbeddedLabel(p, element, 'center-middle');
2318 var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
2321 containerWidth: element.width,
2322 containerHeight: element.height,
2329 if (!!(getDi(element).isMarkerVisible)) {
2330 drawPath(p, pathData, {
2338 'bpmn:ComplexGateway': function(p, element) {
2339 var diamond = drawDiamond(p, element.width, element.height);
2341 var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
2344 containerWidth: element.width,
2345 containerHeight: element.height,
2353 drawPath(p, pathData, {
2360 'bpmn:ParallelGateway': function(p, element) {
2361 var diamond = drawDiamond(p, element.width, element.height);
2363 var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
2366 containerWidth: element.width,
2367 containerHeight: element.height,
2375 drawPath(p, pathData, {
2382 'bpmn:EventBasedGateway': function(p, element) {
2384 var semantic = getSemantic(element);
2386 var diamond = drawDiamond(p, element.width, element.height);
2388 /* outer circle path */
2389 drawCircle(p, element.width, element.height, element.height * 0.20, {
2394 var type = semantic.eventGatewayType;
2395 var instantiate = !!semantic.instantiate;
2397 function drawEvent() {
2399 var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
2402 containerWidth: element.width,
2403 containerHeight: element.height,
2411 drawPath(p, pathData, {
2417 if (type === 'Parallel') {
2419 var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
2422 containerWidth: element.width,
2423 containerHeight: element.height,
2430 var parallelPath = drawPath(p, pathData);
2435 } else if (type === 'Exclusive') {
2438 var innerCircle = drawCircle(p, element.width, element.height, element.height * 0.26);
2451 'bpmn:Gateway': function(p, element) {
2452 var diamond = drawDiamond(p, element.width, element.height);
2453 renderEmbeddedLabel(p, element, 'center-middle');
2457 'bpmn:SequenceFlow': function(p, element) {
2458 var pathData = createPathFromConnection(element);
2459 var path = drawPath(p, pathData, {
2460 strokeLinejoin: 'round',
2461 markerEnd: marker('sequenceflow-end')
2464 var sequenceFlow = getSemantic(element);
2465 var source = element.source.businessObject;
2467 // conditional flow marker
2468 if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Task')) {
2470 markerStart: marker('conditional-flow-marker')
2475 if (source.default && source.$instanceOf('bpmn:Gateway') && source.default === sequenceFlow) {
2477 markerStart: marker('conditional-default-flow-marker')
2483 'bpmn:Association': function(p, element, attrs) {
2486 strokeDasharray: '1,6',
2487 strokeLinecap: 'round',
2488 strokeLinejoin: 'round'
2491 // TODO(nre): style according to directed state
2492 return drawLine(p, element.waypoints, attrs);
2494 'bpmn:DataInputAssociation': function(p, element) {
2495 return renderer('bpmn:Association')(p, element, {
2496 markerEnd: marker('data-association-end')
2499 'bpmn:DataOutputAssociation': function(p, element) {
2500 return renderer('bpmn:Association')(p, element, {
2501 markerEnd: marker('data-association-end')
2504 'bpmn:MessageFlow': function(p, element) {
2506 var semantic = getSemantic(element),
2507 di = getDi(element);
2509 var pathData = createPathFromConnection(element);
2510 var path = drawPath(p, pathData, {
2511 markerEnd: marker('messageflow-end'),
2512 markerStart: marker('messageflow-start'),
2513 strokeDasharray: '10, 12',
2514 strokeLinecap: 'round',
2515 strokeLinejoin: 'round',
2516 strokeWidth: '1.5px'
2519 if (semantic.messageRef) {
2520 var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
2522 var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
2529 var messageAttrs = {
2533 if (di.messageVisibleKind === 'initiating') {
2534 messageAttrs.fill = 'white';
2535 messageAttrs.stroke = 'black';
2537 messageAttrs.fill = '#888';
2538 messageAttrs.stroke = 'white';
2541 drawPath(p, markerPathData, messageAttrs);
2546 'bpmn:DataObject': function(p, element) {
2547 var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
2550 containerWidth: element.width,
2551 containerHeight: element.height,
2558 var elementObject = drawPath(p, pathData, {
2562 var semantic = getSemantic(element);
2564 if (isCollection(semantic)) {
2565 renderDataItemCollection(p, element);
2568 return elementObject;
2570 'bpmn:DataObjectReference': as('bpmn:DataObject'),
2571 'bpmn:DataInput': function(p, element) {
2573 var arrowPathData = pathMap.getRawPath('DATA_ARROW');
2576 var elementObject = renderer('bpmn:DataObject')(p, element);
2578 /* input arrow path */
2579 drawPath(p, arrowPathData, {
2583 return elementObject;
2585 'bpmn:DataOutput': function(p, element) {
2586 var arrowPathData = pathMap.getRawPath('DATA_ARROW');
2589 var elementObject = renderer('bpmn:DataObject')(p, element);
2591 /* output arrow path */
2592 drawPath(p, arrowPathData, {
2597 return elementObject;
2599 'bpmn:DataStoreReference': function(p, element) {
2600 var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
2603 containerWidth: element.width,
2604 containerHeight: element.height,
2611 var elementStore = drawPath(p, DATA_STORE_PATH, {
2616 return elementStore;
2618 'bpmn:BoundaryEvent': function(p, element) {
2620 var semantic = getSemantic(element),
2621 cancel = semantic.cancelActivity;
2624 strokeLinecap: 'round',
2629 attrs.strokeDasharray = '6';
2632 var outer = renderer('bpmn:Event')(p, element, attrs);
2634 drawCircle(p, element.width, element.height, INNER_OUTER_DIST, attrs);
2636 renderEventContent(element, p);
2640 'bpmn:Group': function(p, element) {
2641 return drawRect(p, element.width, element.height, TASK_BORDER_RADIUS, {
2643 strokeDasharray: '8,3,1,3',
2645 pointerEvents: 'none'
2648 'label': function(p, element) {
2649 return renderExternalLabel(p, element, '');
2651 'bpmn:TextAnnotation': function(p, element) {
2656 var textElement = drawRect(p, element.width, element.height, 0, 0, style);
2657 var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
2660 containerWidth: element.width,
2661 containerHeight: element.height,
2667 drawPath(p, textPathData);
2669 var text = getSemantic(element).text || '';
2670 renderLabel(p, text, {
2672 align: 'left-middle',
2678 'ParticipantMultiplicityMarker': function(p, element) {
2679 var subProcessPath = pathMap.getScaledPath('MARKER_PARALLEL', {
2682 containerWidth: element.width,
2683 containerHeight: element.height,
2685 mx: ((element.width / 2) / element.width),
2686 my: (element.height - 15) / element.height
2690 drawPath(p, subProcessPath);
2692 'SubProcessMarker': function(p, element) {
2693 var markerRect = drawRect(p, 14, 14, 0, {
2697 // Process marker is placed in the middle of the box
2698 // therefore fixed values can be used here
2699 markerRect.transform('translate(' + (element.width / 2 - 7.5) + ',' + (element.height - 20) + ')');
2701 var subProcessPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
2704 containerWidth: element.width,
2705 containerHeight: element.height,
2707 mx: (element.width / 2 - 7.5) / element.width,
2708 my: (element.height - 20) / element.height
2712 drawPath(p, subProcessPath);
2714 'ParallelMarker': function(p, element, position) {
2715 var subProcessPath = pathMap.getScaledPath('MARKER_PARALLEL', {
2718 containerWidth: element.width,
2719 containerHeight: element.height,
2721 mx: ((element.width / 2 + position.parallel) / element.width),
2722 my: (element.height - 20) / element.height
2725 drawPath(p, subProcessPath);
2727 'SequentialMarker': function(p, element, position) {
2728 var sequentialPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
2731 containerWidth: element.width,
2732 containerHeight: element.height,
2734 mx: ((element.width / 2 + position.seq) / element.width),
2735 my: (element.height - 19) / element.height
2738 drawPath(p, sequentialPath);
2740 'CompensationMarker': function(p, element, position) {
2741 var compensationPath = pathMap.getScaledPath('MARKER_COMPENSATION', {
2744 containerWidth: element.width,
2745 containerHeight: element.height,
2747 mx: ((element.width / 2 + position.compensation) / element.width),
2748 my: (element.height - 13) / element.height
2751 drawPath(p, compensationPath, {
2755 'LoopMarker': function(p, element, position) {
2756 var loopPath = pathMap.getScaledPath('MARKER_LOOP', {
2759 containerWidth: element.width,
2760 containerHeight: element.height,
2762 mx: ((element.width / 2 + position.loop) / element.width),
2763 my: (element.height - 7) / element.height
2767 drawPath(p, loopPath, {
2770 strokeLinecap: 'round',
2771 strokeMiterlimit: 0.5
2774 'AdhocMarker': function(p, element, position) {
2775 var loopPath = pathMap.getScaledPath('MARKER_ADHOC', {
2778 containerWidth: element.width,
2779 containerHeight: element.height,
2781 mx: ((element.width / 2 + position.adhoc) / element.width),
2782 my: (element.height - 15) / element.height
2786 drawPath(p, loopPath, {
2793 function attachTaskMarkers(p, element, taskMarkers) {
2794 var obj = getSemantic(element);
2796 var subprocess = includes(taskMarkers, 'SubProcessMarker');
2817 forEach(taskMarkers, function(marker) {
2818 renderer(marker)(p, element, position);
2821 if (obj.$type === 'bpmn:AdHocSubProcess') {
2822 renderer('AdhocMarker')(p, element, position);
2824 if (obj.loopCharacteristics && obj.loopCharacteristics.isSequential === undefined) {
2825 renderer('LoopMarker')(p, element, position);
2828 if (obj.loopCharacteristics &&
2829 obj.loopCharacteristics.isSequential !== undefined &&
2830 !obj.loopCharacteristics.isSequential) {
2831 renderer('ParallelMarker')(p, element, position);
2833 if (obj.loopCharacteristics && !!obj.loopCharacteristics.isSequential) {
2834 renderer('SequentialMarker')(p, element, position);
2836 if (!!obj.isForCompensation) {
2837 renderer('CompensationMarker')(p, element, position);
2841 function drawShape(parent, element) {
2842 var type = element.type;
2843 var h = handlers[type];
2847 return DefaultRenderer.prototype.drawShape.apply(this, [parent, element]);
2849 return h(parent, element);
2853 function drawConnection(parent, element) {
2854 var type = element.type;
2855 var h = handlers[type];
2859 return DefaultRenderer.prototype.drawConnection.apply(this, [parent, element]);
2861 return h(parent, element);
2865 function renderDataItemCollection(p, element) {
2867 var yPosition = (element.height - 16) / element.height;
2869 var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
2872 containerWidth: element.width,
2873 containerHeight: element.height,
2880 /* collection path */
2881 drawPath(p, pathData, {
2886 function isCollection(element, filter) {
2887 return element.isCollection ||
2888 (element.elementObjectRef && element.elementObjectRef.isCollection);
2891 function getDi(element) {
2892 return element.businessObject.di;
2895 function getSemantic(element) {
2896 return element.businessObject;
2900 * Checks if eventDefinition of the given element matches with semantic
2903 * @return {boolean} true if element is of the given semantic type
2905 function isTypedEvent(event, eventDefinitionType, filter) {
2907 function matches(definition, filter) {
2908 return every(filter, function(val, key) {
2910 // we want a == conversion here, to be able to catch
2911 // undefined == false and friends
2913 return definition[key] == val;
2917 return some(event.eventDefinitions, function(definition) {
2918 return definition.$type === eventDefinitionType && matches(event, filter);
2922 function isThrowEvent(event) {
2923 return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent');
2927 // ///// cropping path customizations /////////////////////////
2929 function componentsToPath(elements) {
2930 return elements.join(',').replace(/,?([A-z]),?/g, '$1');
2933 function getCirclePath(shape) {
2935 var cx = shape.x + shape.width / 2,
2936 cy = shape.y + shape.height / 2,
2937 radius = shape.width / 2;
2942 ['a', radius, radius, 0, 1, 1, 0, 2 * radius],
2943 ['a', radius, radius, 0, 1, 1, 0, -2 * radius],
2947 return componentsToPath(circlePath);
2950 function getRoundRectPath(shape) {
2952 var radius = TASK_BORDER_RADIUS,
2955 width = shape.width,
2956 height = shape.height;
2958 var roundRectPath = [
2959 ['M', x + radius, y],
2960 ['l', width - radius * 2, 0],
2961 ['a', radius, radius, 0, 0, 1, radius, radius],
2962 ['l', 0, height - radius * 2],
2963 ['a', radius, radius, 0, 0, 1, -radius, radius],
2964 ['l', radius * 2 - width, 0],
2965 ['a', radius, radius, 0, 0, 1, -radius, -radius],
2966 ['l', 0, radius * 2 - height],
2967 ['a', radius, radius, 0, 0, 1, radius, -radius],
2971 return componentsToPath(roundRectPath);
2974 function getDiamondPath(shape) {
2976 var width = shape.width,
2977 height = shape.height,
2980 halfWidth = width / 2,
2981 halfHeight = height / 2;
2984 ['M', x + halfWidth, y],
2985 ['l', halfWidth, halfHeight],
2986 ['l', -halfWidth, halfHeight],
2987 ['l', -halfWidth, -halfHeight],
2991 return componentsToPath(diamondPath);
2994 function getRectPath(shape) {
2997 width = shape.width,
2998 height = shape.height;
3008 return componentsToPath(rectPath);
3011 function getShapePath(element) {
3012 var obj = getSemantic(element);
3014 if (obj.$instanceOf('bpmn:Event')) {
3015 return getCirclePath(element);
3018 if (obj.$instanceOf('bpmn:Activity')) {
3019 return getRoundRectPath(element);
3022 if (obj.$instanceOf('bpmn:Gateway')) {
3023 return getDiamondPath(element);
3026 return getRectPath(element);
3030 // hook onto canvas init event to initialize
3031 // connection start/end markers on svg
3032 events.on('canvas.init', function(event) {
3033 initMarkers(event.svg);
3036 this.drawShape = drawShape;
3037 this.drawConnection = drawConnection;
3039 this.getShapePath = getShapePath;
3042 inherits(BpmnRenderer, DefaultRenderer);
3045 BpmnRenderer.$inject = ['eventBus', 'styles', 'pathMap'];
3047 module.exports = BpmnRenderer;
3050 "../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
3051 "diagram-js/lib/draw/Renderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js",
3052 "diagram-js/lib/util/Text": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Text.js",
3053 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
3054 "lodash/collection/every": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\every.js",
3055 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
3056 "lodash/collection/includes": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\includes.js",
3057 "lodash/collection/some": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\some.js",
3058 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
3059 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
3060 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
3062 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\PathMap.js": [function(require, module, exports) {
3065 var Snap = require('diagram-js/vendor/snapsvg');
3068 * Map containing SVG paths needed by BpmnRenderer.
3071 function PathMap() {
3074 * Contains a map of path elements
3076 * <h1>Path definition</h1>
3077 * A parameterized path is defined like this:
3080 * 'GATEWAY_PARALLEL': {
3081 * d: 'm {mx},{my} {e.x0},0 0,{e.x1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
3082 * '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
3085 * heightElements: [2.5, 7.5],
3086 * widthElements: [2.5, 7.5]
3091 * It's important to specify a correct <b>height and width</b> for the path
3092 * as the scaling is based on the ratio between the specified height and
3093 * width in this object and the height and width that is set as scale target
3094 * (Note x,y coordinates will be scaled with individual ratios).
3097 * The '<b>heightElements</b>' and '<b>widthElements</b>' array must
3098 * contain the values that will be scaled. The scaling is based on the
3099 * computed ratios. Coordinates on the y axis should be in the
3100 * <b>heightElement</b>'s array, they will be scaled using the computed
3101 * ratio coefficient. In the parameterized path the scaled values can be
3102 * accessed through the 'e' object in {} brackets.
3104 * <li>The values for the y axis can be accessed in the path string using
3105 * {e.y0}, {e.y1}, ....</li>
3106 * <li>The values for the x axis can be accessed in the path string using
3107 * {e.x0}, {e.x1}, ....</li>
3109 * The numbers x0, x1 respectively y0, y1, ... map to the corresponding
3115 d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',
3118 heightElements: [6, 14],
3119 widthElements: [10.5, 21]
3122 d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z',
3125 heightElements: [18],
3126 widthElements: [10, 20]
3128 'EVENT_ESCALATION': {
3129 d: 'm {mx},{my} c -{e.x1},{e.y0} -{e.x3},{e.y1} -{e.x5},{e.y4} {e.x1},-{e.y3} {e.x3},-{e.y5} {e.x5},-{e.y6} ' +
3130 '{e.x0},{e.y3} {e.x2},{e.y5} {e.x4},{e.y6} -{e.x0},-{e.y0} -{e.x2},-{e.y1} -{e.x4},-{e.y4} z',
3133 heightElements: [2.382, 4.764, 4.926, 6.589333, 7.146, 13.178667, 19.768],
3134 widthElements: [2.463, 2.808, 4.926, 5.616, 7.389, 8.424]
3136 'EVENT_CONDITIONAL': {
3137 d: 'M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z ' +
3138 'M {e.x2},{e.y3} l {e.x0},0 ' +
3139 'M {e.x2},{e.y4} l {e.x0},0 ' +
3140 'M {e.x2},{e.y5} l {e.x0},0 ' +
3141 'M {e.x2},{e.y6} l {e.x0},0 ' +
3142 'M {e.x2},{e.y7} l {e.x0},0 ' +
3143 'M {e.x2},{e.y8} l {e.x0},0 ',
3146 heightElements: [8.5, 14.5, 18, 11.5, 14.5, 17.5, 20.5, 23.5, 26.5],
3147 widthElements: [10.5, 14.5, 12.5]
3150 d: 'm {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z',
3153 heightElements: [4.4375, 6.75, 7.8125],
3154 widthElements: [9.84375, 13.5]
3157 d: 'm {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z',
3160 heightElements: [0.023, 8.737, 8.151, 16.564, 10.591, 8.714],
3161 widthElements: [0.085, 6.672, 6.97, 4.273, 5.337, 6.636]
3163 'EVENT_CANCEL_45': {
3164 d: 'm {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
3165 '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
3168 heightElements: [4.75, 8.5],
3169 widthElements: [4.75, 8.5]
3171 'EVENT_COMPENSATION': {
3172 d: 'm {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x0},0 {e.x0},-{e.y0} 0,{e.y1} z',
3175 heightElements: [5, 10],
3179 d: 'M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ',
3182 heightElements: [10, 2],
3183 widthElements: [3, 7]
3185 'EVENT_TIMER_LINE': {
3187 'm {e.x0},{e.y0} l -{e.x1},{e.y1} ',
3190 heightElements: [10, 3],
3191 widthElements: [0, 0]
3194 d: 'm {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z',
3197 heightElements: [6.28099, 12.56199],
3198 widthElements: [3.1405, 9.42149, 12.56198]
3200 'EVENT_PARALLEL_MULTIPLE': {
3201 d: 'm {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
3202 '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
3205 heightElements: [2.56228, 7.68683],
3206 widthElements: [2.56228, 7.68683]
3208 'GATEWAY_EXCLUSIVE': {
3209 d: 'm {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' +
3210 '{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' +
3211 '{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z',
3214 heightElements: [8.5, 6.5312, -6.5312, -8.5],
3215 widthElements: [6.5, -6.5, 3, -3, 5, -5]
3217 'GATEWAY_PARALLEL': {
3218 d: 'm {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
3219 '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
3222 heightElements: [5, 12.5],
3223 widthElements: [5, 12.5]
3225 'GATEWAY_EVENT_BASED': {
3226 d: 'm {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z',
3229 heightElements: [-6, 6, 12, -12],
3230 widthElements: [9, -3, -12]
3232 'GATEWAY_COMPLEX': {
3233 d: 'm {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} ' +
3234 '{e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} ' +
3235 '{e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} ' +
3236 '-{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z',
3239 heightElements: [4.875, 3.4375, 2.125, 3],
3240 widthElements: [3.4375, 2.125, 4.875, 3]
3242 'DATA_OBJECT_PATH': {
3243 d: 'm 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0',
3246 heightElements: [10, 50, 60],
3247 widthElements: [10, 40, 50, 60]
3249 'DATA_OBJECT_COLLECTION_PATH': {
3250 d: 'm {mx}, {my} ' +
3256 heightElements: [12],
3257 widthElements: [1, 6, 12, 15]
3260 d: 'm 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z',
3269 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
3271 'c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0' +
3272 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
3273 'm -{e.x2},{e.y0}' +
3274 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0' +
3275 'm -{e.x2},{e.y0}' +
3276 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0',
3279 heightElements: [7, 10, 45],
3280 widthElements: [2, 58, 60]
3282 'TEXT_ANNOTATION': {
3283 d: 'm {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0',
3286 heightElements: [30],
3289 'MARKER_SUB_PROCESS': {
3290 d: 'm{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0',
3296 'MARKER_PARALLEL': {
3297 d: 'm{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10',
3303 'MARKER_SEQUENTIAL': {
3304 d: 'm{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0',
3310 'MARKER_COMPENSATION': {
3311 d: 'm {mx},{my} 8,-5 0,10 z m 9,0 8,-5 0,10 z',
3318 d: 'm {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 ' +
3319 '-6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 ' +
3320 '0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 ' +
3321 'l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902',
3328 d: 'm {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 ' +
3329 '3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 ' +
3330 '1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 ' +
3331 '-3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 ' +
3332 '-2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z',
3339 d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',
3342 heightElements: [6, 14],
3343 widthElements: [10.5, 21]
3345 'TASK_TYPE_SCRIPT': {
3346 d: 'm {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 ' +
3347 'c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z ' +
3349 'm -4.5,3 l 4.5,0 ' +
3354 heightElements: [6, 14],
3355 widthElements: [10.5, 21]
3357 'TASK_TYPE_USER_1': {
3358 d: 'm {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 ' +
3359 '-4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 ' +
3360 '0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 ' +
3361 'h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 z' +
3362 'm -8,6 l 0,5.5 m 11,0 l 0,-5'
3364 'TASK_TYPE_USER_2': {
3365 d: 'm {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 ' +
3366 '-2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 '
3368 'TASK_TYPE_USER_3': {
3369 d: 'm {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 ' +
3370 '4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 ' +
3371 '-4.20799998,3.36699999 -4.20699998,4.34799999 z'
3373 'TASK_TYPE_MANUAL': {
3374 d: 'm {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 ' +
3375 '-0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 ' +
3376 '0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 ' +
3377 '-1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 ' +
3378 '0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 ' +
3379 '-10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 ' +
3380 '2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 ' +
3381 '-0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 ' +
3382 '-1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 ' +
3383 '-0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 ' +
3384 '0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 ' +
3385 '-5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z'
3387 'TASK_TYPE_INSTANTIATING_SEND': {
3388 d: 'm {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6'
3390 'TASK_TYPE_SERVICE': {
3391 d: 'm {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 ' +
3392 '0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 ' +
3393 '-1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 ' +
3394 'v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 ' +
3395 '-0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 ' +
3396 '-1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 ' +
3397 'h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 ' +
3398 '-0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 ' +
3399 'c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 ' +
3400 'l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 ' +
3401 '0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 ' +
3402 'c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z ' +
3403 'm 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
3404 '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
3405 '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
3407 'TASK_TYPE_SERVICE_FILL': {
3408 d: 'm {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
3409 '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
3410 '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
3412 'TASK_TYPE_BUSINESS_RULE_HEADER': {
3413 d: 'm {mx},{my} 0,4 20,0 0,-4 z'
3415 'TASK_TYPE_BUSINESS_RULE_MAIN': {
3416 d: 'm {mx},{my} 0,12 20,0 0,-12 z' +
3420 'MESSAGE_FLOW_MARKER': {
3421 d: 'm {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6'
3425 this.getRawPath = function getRawPath(pathId) {
3426 return this.pathMap[pathId].d;
3430 * Scales the path to the given height and width.
3433 * Use case is to scale the content of elements (event, gateways) based on
3434 * the element bounding box's size.
3436 * <h1>Why not transform</h1>
3438 * Scaling a path with transform() will also scale the stroke and IE does
3439 * not support the option 'non-scaling-stroke' to prevent this. Also there
3440 * are use cases where only some parts of a path should be scaled.
3444 * pathId The ID of the path.
3448 * Example param object scales the path to 60% size of the
3449 * container (data.width, data.height).
3453 * xScaleFactor : 0.6,
3454 * yScaleFactor : 0.6,
3455 * containerWidth : data.width,
3456 * containerHeight : data.height,
3465 * <li>targetpathwidth = xScaleFactor * containerWidth</li>
3466 * <li>targetpathheight = yScaleFactor * containerHeight</li>
3467 * <li>Position is used to set the starting coordinate of the
3468 * path. M is computed:
3470 * <li>position.x * containerWidth</li>
3471 * <li>position.y * containerHeight</li>
3473 * Center of the container
3482 * Upper left corner of the container
3496 this.getScaledPath = function getScaledPath(pathId, param) {
3497 var rawPath = this.pathMap[pathId];
3500 // compute the start point of the path
3503 if (!!param.abspos) {
3504 mx = param.abspos.x;
3505 my = param.abspos.y;
3507 mx = param.containerWidth * param.position.mx;
3508 my = param.containerHeight * param.position.my;
3511 var coordinates = {}; // map for the scaled coordinates
3512 if (param.position) {
3515 var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor;
3516 var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor;
3519 // Apply height ratio
3520 for (var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) {
3521 coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio;
3524 // Apply width ratio
3525 for (var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) {
3526 coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio;
3530 // Apply value to raw path
3531 var path = Snap.format(
3542 module.exports = PathMap;
3545 "diagram-js/vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js"
3547 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\index.js": [function(require, module, exports) {
3549 renderer: ['type', require('./BpmnRenderer')],
3550 pathMap: ['type', require('./PathMap')]
3553 "./BpmnRenderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\BpmnRenderer.js",
3554 "./PathMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\PathMap.js"
3556 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\context-pad\\ContextPadProvider.js": [function(require, module, exports) {
3560 var assign = require('lodash/object/assign'),
3561 forEach = require('lodash/collection/forEach');
3565 * A provider for BPMN 2.0 elements context pad
3567 function ContextPadProvider(contextPad, modeling, elementFactory,
3568 connect, create, bpmnReplace,
3571 contextPad.registerProvider(this);
3573 this._contextPad = contextPad;
3575 this._modeling = modeling;
3577 this._elementFactory = elementFactory;
3578 this._connect = connect;
3579 this._create = create;
3580 this._bpmnReplace = bpmnReplace;
3581 this._canvas = canvas;
3584 ContextPadProvider.$inject = [
3594 ContextPadProvider.prototype.getContextPadEntries = function(element) {
3596 var contextPad = this._contextPad,
3597 modeling = this._modeling,
3599 elementFactory = this._elementFactory,
3600 connect = this._connect,
3601 create = this._create,
3602 bpmnReplace = this._bpmnReplace,
3603 canvas = this._canvas;
3607 if (element.type === 'label') {
3611 var bpmnElement = element.businessObject;
3613 function startConnect(event, element, autoActivate) {
3614 connect.start(event, element, autoActivate);
3617 function removeElement(e) {
3619 if (element.waypoints) {
3620 modeling.removeConnection(element);
3622 modeling.removeShape(element);
3625 if (element.id == selected_decison_element) {
3627 invisiblepropertyExplorer();
3631 function getReplaceMenuPosition(element) {
3635 var diagramContainer = canvas.getContainer(),
3636 pad = contextPad.getPad(element).html;
3638 var diagramRect = diagramContainer.getBoundingClientRect(),
3639 padRect = pad.getBoundingClientRect();
3641 var top = padRect.top - diagramRect.top;
3642 var left = padRect.left - diagramRect.left;
3646 y: top + padRect.height + Y_OFFSET
3653 var change_color = function(par1, par2) {
3654 if (isImportSchema == true) {
3656 return par2 /*'define-schema'*/ ;
3658 return par1 /*'define-modify-schema'*/ ;
3662 function appendAction(type, className, options) {
3664 function appendListener(event, element) {
3666 var shape = elementFactory.createShape(assign({
3669 create.start(event, shape, element);
3672 var shortType = type.replace(/^bpmn\:/, '');
3676 className: className,
3677 title: 'Append ' + shortType,
3679 dragstart: appendListener,
3680 click: appendListener
3686 if (bpmnElement.$instanceOf('bpmn:Gateway') || bpmnElement.$instanceOf('bpmn:MultiBranchConnector')) {
3689 group: 'DefinePath',
3690 className: 'define-path',
3691 title: 'Define/View Path',
3693 click: function(event) {
3695 if (bpmnElement.name) {
3696 var bpmnElementID = bpmnElement.id;
3697 selected_decison_element = bpmnElementID;
3698 var bpmnElementName = bpmnElement.name;
3699 selected_element_name = bpmnElementName;
3700 var pathIdentifiers = [];
3702 if (bpmnElement.outgoing) {
3704 var check_outgoing_names = true;
3705 forEach(bpmnElement.outgoing, function(og) {
3707 if (og.name && og.name.length != 0) {
3709 pathIdentifiers.push(og.name);
3713 errorProperty(bpmnElement.name + " out going path name was not entered");
3714 check_outgoing_names = false;
3718 if (check_outgoing_names) {
3720 pathDetails(bpmnElementID, bpmnElementName, pathIdentifiers);
3726 errorProperty(bpmnElement.name + ' should atleast one output path was required');
3730 errorProperty('Enter Valid Decision Name');
3740 if (bpmnElement.$instanceOf('bpmn:InitiateProcess')) {}
3742 if (bpmnElement.$instanceOf('bpmn:StartEvent')) {}
3743 if (bpmnElement.$instanceOf('bpmn:Holmes')) {
3747 label: 'Edit Properties',
3748 className: 'clds-edit-properties',
3749 title: 'Properties',
3751 click: function(event) {
3752 lastElementSelected = bpmnElement.id
3753 HolmesWindow(bpmnElement);
3759 if (bpmnElement.$instanceOf('bpmn:TCA')) {
3763 label: 'Edit Properties',
3764 className: 'clds-edit-properties',
3765 title: 'Properties',
3767 click: function(event) {
3769 lastElementSelected = bpmnElement.id
3775 if (bpmnElement.$instanceOf('bpmn:GOC')) {
3779 label: 'Edit Properties',
3780 className: 'clds-edit-properties',
3781 title: 'Properties',
3783 click: function(event) {
3784 lastElementSelected = bpmnElement.id
3791 if (bpmnElement.$instanceOf('bpmn:Policy')) {
3795 label: 'Edit Properties',
3796 className: 'clds-edit-properties',
3797 title: 'Properties',
3799 click: function(event) {
3800 lastElementSelected = bpmnElement.id
3801 PolicyWindow(bpmnElement);
3808 if (bpmnElement.$instanceOf('bpmn:FlowNode') ||
3809 bpmnElement.$instanceOf('bpmn:InteractionNode')) {
3812 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'icon-text-annotation'),
3816 className: 'icon-connection',
3819 click: startConnect,
3820 dragstart: startConnect
3826 // Delete Element Entry
3830 className: 'icon-trash',
3833 click: removeElement,
3834 dragstart: removeElement
3845 function isEventType(eventBo, type, definition) {
3847 var isType = eventBo.$instanceOf(type);
3848 var isDefinition = false;
3850 var definitions = eventBo.eventDefinitions || [];
3851 forEach(definitions, function(def) {
3852 if (def.$type === definition) {
3853 isDefinition = true;
3857 return isType && isDefinition;
3861 module.exports = ContextPadProvider;
3864 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
3865 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
3867 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\context-pad\\index.js": [function(require, module, exports) {
3870 require('diagram-js-direct-editing'),
3871 require('diagram-js/lib/features/context-pad'),
3872 require('diagram-js/lib/features/selection'),
3873 require('diagram-js/lib/features/connect'),
3874 require('diagram-js/lib/features/create'),
3875 require('../replace')
3877 __init__: ['contextPadProvider'],
3878 contextPadProvider: ['type', require('./ContextPadProvider')]
3881 "../replace": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\index.js",
3882 "./ContextPadProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\context-pad\\ContextPadProvider.js",
3883 "diagram-js-direct-editing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\index.js",
3884 "diagram-js/lib/features/connect": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\index.js",
3885 "diagram-js/lib/features/context-pad": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\index.js",
3886 "diagram-js/lib/features/create": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\index.js",
3887 "diagram-js/lib/features/selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js"
3889 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\keyboard\\BpmnKeyBindings.js": [function(require, module, exports) {
3893 function BpmnKeyBindings(keyboard, spaceTool, lassoTool, directEditing, selection) {
3895 keyboard.addListener(function(key, modifiers) {
3897 if (keyboard.hasModifier(modifiers)) {
3901 // S -> activate space tool
3903 spaceTool.activateSelection();
3908 // L -> activate lasso tool
3910 lassoTool.activateSelection();
3915 var currentSelection = selection.get();
3917 // E -> activate direct editing
3919 if (currentSelection.length) {
3920 directEditing.activate(currentSelection[0]);
3928 BpmnKeyBindings.$inject = ['keyboard', 'spaceTool', 'lassoTool', 'directEditing', 'selection'];
3930 module.exports = BpmnKeyBindings;
3932 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\keyboard\\index.js": [function(require, module, exports) {
3935 require('diagram-js/lib/features/keyboard')
3937 __init__: ['bpmnKeyBindings'],
3938 bpmnKeyBindings: ['type', require('./BpmnKeyBindings')]
3941 "./BpmnKeyBindings": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\keyboard\\BpmnKeyBindings.js",
3942 "diagram-js/lib/features/keyboard": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\index.js"
3944 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelEditingProvider.js": [function(require, module, exports) {
3947 var UpdateLabelHandler = require('./cmd/UpdateLabelHandler');
3949 var LabelUtil = require('./LabelUtil');
3951 var is = require('../../util/ModelUtil').is,
3952 isExpanded = require('../../util/DiUtil').isExpanded;
3954 var daOriginalLabel = '';
3962 function LabelEditingProvider(eventBus, canvas, directEditing, commandStack, injector) {
3964 directEditing.registerProvider(this);
3965 commandStack.registerHandler('element.updateLabel', UpdateLabelHandler);
3967 // listen to dblclick on non-root elements
3968 eventBus.on('element.dblclick', function(event) {
3970 directEditing.activate(event.element);
3974 // complete on followup canvas operation
3975 eventBus.on(['element.mousedown', 'drag.activate', 'canvas.viewbox.changed'], function(event) {
3976 directEditing.complete();
3979 // cancel on command stack changes
3980 eventBus.on(['commandStack.changed'], function() {
3981 directEditing.cancel();
3985 // activate direct editing for activities and text annotations
3988 if ('ontouchstart' in document.documentElement) {
3989 // we deactivate automatic label editing on mobile devices
3990 // as it breaks the user interaction workflow
3992 // TODO(nre): we should temporarily focus the edited element here
3993 // and release the focused viewport after the direct edit operation is
3996 eventBus.on('create.end', 500, function(e) {
3998 var element = e.shape,
3999 canExecute = e.context.canExecute;
4005 if (is(element, 'bpmn:Task') || is(element, 'bpmn:TextAnnotation') ||
4006 (is(element, 'bpmn:SubProcess') && !isExpanded(element))) {
4008 directEditing.activate(element);
4013 this._canvas = canvas;
4014 this._commandStack = commandStack;
4017 LabelEditingProvider.$inject = ['eventBus', 'canvas', 'directEditing', 'commandStack', 'injector'];
4019 module.exports = LabelEditingProvider;
4022 LabelEditingProvider.prototype.activate = function(element) {
4024 var text = LabelUtil.getLabel(element);
4026 if (text === undefined) {
4030 daOriginalLabel = text;
4032 var bbox = this.getEditingBBox(element);
4034 // adjust for expanded pools AND lanes
4035 if ((is(element, 'bpmn:Participant') && isExpanded(element)) || is(element, 'bpmn:Lane')) {
4037 bbox.width = MIN_BOUNDS.width;
4038 bbox.height = MIN_BOUNDS.height;
4040 bbox.x = bbox.x + 10 - bbox.width / 2;
4041 bbox.y = bbox.mid.y - bbox.height / 2;
4044 // adjust for expanded sub processes
4045 if (is(element, 'bpmn:SubProcess') && isExpanded(element)) {
4047 bbox.height = MIN_BOUNDS.height;
4049 bbox.x = bbox.mid.x - bbox.width / 2;
4050 bbox.y = bbox.y + 10 - bbox.height / 2;
4060 LabelEditingProvider.prototype.getEditingBBox = function(element, maxBounds) {
4062 var target = element.label || element;
4064 var bbox = this._canvas.getAbsoluteBBox(target);
4067 x: bbox.x + bbox.width / 2,
4068 y: bbox.y + bbox.height / 2
4072 if (target.labelTarget) {
4073 bbox.width = Math.max(bbox.width, MIN_BOUNDS.width);
4074 bbox.height = Math.max(bbox.height, MIN_BOUNDS.height);
4076 bbox.x = mid.x - bbox.width / 2;
4085 LabelEditingProvider.prototype.update = function(element, newLabel) {
4086 //update conditional node
4087 if (is(element, 'bpmn:ExclusiveGateway') || is(element, 'bpmn:MultiBranchConnector')) {
4088 updateDecisionLabel(daOriginalLabel, newLabel);
4091 this._commandStack.execute('element.updateLabel', {
4097 "../../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
4098 "../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
4099 "./LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelUtil.js",
4100 "./cmd/UpdateLabelHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\cmd\\UpdateLabelHandler.js"
4102 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelUtil.js": [function(require, module, exports) {
4105 function getLabelAttr(semantic) {
4106 if (semantic.$instanceOf('bpmn:FlowElement') ||
4107 semantic.$instanceOf('bpmn:Participant') ||
4108 semantic.$instanceOf('bpmn:Lane') ||
4109 semantic.$instanceOf('bpmn:SequenceFlow') ||
4110 semantic.$instanceOf('bpmn:MessageFlow')) {
4114 if (semantic.$instanceOf('bpmn:TextAnnotation')) {
4119 module.exports.getLabel = function(element) {
4120 var semantic = element.businessObject,
4121 attr = getLabelAttr(semantic);
4124 return semantic[attr] || '';
4129 module.exports.setLabel = function(element, text) {
4130 var semantic = element.businessObject,
4131 attr = getLabelAttr(semantic);
4134 semantic[attr] = text;
4137 var label = element.label || element;
4140 label.hidden = false;
4145 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\cmd\\UpdateLabelHandler.js": [function(require, module, exports) {
4148 var LabelUtil = require('../LabelUtil');
4152 * A handler that updates the text of a BPMN element.
4157 function UpdateTextHandler(eventBus) {
4159 function setText(element, text) {
4160 var label = LabelUtil.setLabel(element, text);
4162 eventBus.fire('element.changed', {
4167 function execute(ctx) {
4168 ctx.oldLabel = LabelUtil.getLabel(ctx.element);
4169 return setText(ctx.element, ctx.newLabel);
4172 function revert(ctx) {
4173 return setText(ctx.element, ctx.oldLabel);
4177 function canExecute(ctx) {
4183 this.execute = execute;
4184 this.revert = revert;
4186 this.canExecute = canExecute;
4190 UpdateTextHandler.$inject = ['eventBus'];
4192 module.exports = UpdateTextHandler;
4194 "../LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelUtil.js"
4196 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\index.js": [function(require, module, exports) {
4199 require('diagram-js/lib/command'),
4200 require('diagram-js/lib/features/change-support'),
4201 require('diagram-js-direct-editing')
4203 __init__: ['labelEditingProvider'],
4204 labelEditingProvider: ['type', require('./LabelEditingProvider')]
4207 "./LabelEditingProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelEditingProvider.js",
4208 "diagram-js-direct-editing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\index.js",
4209 "diagram-js/lib/command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
4210 "diagram-js/lib/features/change-support": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js"
4212 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnFactory.js": [function(require, module, exports) {
4215 var map = require('lodash/collection/map'),
4216 assign = require('lodash/object/assign'),
4217 pick = require('lodash/object/pick');
4220 function BpmnFactory(moddle) {
4221 this._model = moddle;
4224 BpmnFactory.$inject = ['moddle'];
4227 BpmnFactory.prototype._needsId = function(element) {
4228 return element.$instanceOf('bpmn:RootElement') ||
4229 element.$instanceOf('bpmn:FlowElement') ||
4230 element.$instanceOf('bpmn:MessageFlow') ||
4231 element.$instanceOf('bpmn:Artifact') ||
4232 element.$instanceOf('bpmn:Participant') ||
4233 element.$instanceOf('bpmn:Process') ||
4234 element.$instanceOf('bpmn:Collaboration') ||
4235 element.$instanceOf('bpmndi:BPMNShape') ||
4236 element.$instanceOf('bpmndi:BPMNEdge') ||
4237 element.$instanceOf('bpmndi:BPMNDiagram') ||
4238 element.$instanceOf('bpmndi:BPMNPlane');
4241 BpmnFactory.prototype._ensureId = function(element) {
4243 // generate semantic ids for elements
4244 // bpmn:SequenceFlow -> SequenceFlow_ID
4245 var prefix = (element.$type || '').replace(/^[^:]*:/g, '') + '_';
4247 if (!element.id && this._needsId(element)) {
4248 element.id = this._model.ids.nextPrefixed(prefix, element);
4253 BpmnFactory.prototype.create = function(type, attrs) {
4254 var element = this._model.create(type, attrs || {});
4256 this._ensureId(element);
4262 BpmnFactory.prototype.createDiLabel = function() {
4263 return this.create('bpmndi:BPMNLabel', {
4264 bounds: this.createDiBounds()
4269 BpmnFactory.prototype.createDiShape = function(semantic, bounds, attrs) {
4271 return this.create('bpmndi:BPMNShape', assign({
4272 bpmnElement: semantic,
4273 bounds: this.createDiBounds(bounds)
4278 BpmnFactory.prototype.createDiBounds = function(bounds) {
4279 return this.create('dc:Bounds', bounds);
4283 BpmnFactory.prototype.createDiWaypoints = function(waypoints) {
4284 return map(waypoints, function(pos) {
4285 return this.createDiWaypoint(pos);
4289 BpmnFactory.prototype.createDiWaypoint = function(point) {
4290 return this.create('dc:Point', pick(point, ['x', 'y']));
4294 BpmnFactory.prototype.createDiEdge = function(semantic, waypoints, attrs) {
4295 return this.create('bpmndi:BPMNEdge', assign({
4296 bpmnElement: semantic
4300 BpmnFactory.prototype.createDiPlane = function(semantic) {
4301 return this.create('bpmndi:BPMNPlane', {
4302 bpmnElement: semantic
4306 module.exports = BpmnFactory;
4309 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js",
4310 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
4311 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
4313 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnLayouter.js": [function(require, module, exports) {
4316 var inherits = require('inherits');
4318 var assign = require('lodash/object/assign');
4320 var BaseLayouter = require('diagram-js/lib/layout/BaseLayouter'),
4321 LayoutUtil = require('diagram-js/lib/layout/LayoutUtil'),
4322 ManhattanLayout = require('diagram-js/lib/layout/ManhattanLayout');
4324 var is = require('../../util/ModelUtil').is;
4327 function BpmnLayouter() {}
4329 inherits(BpmnLayouter, BaseLayouter);
4331 module.exports = BpmnLayouter;
4334 function getAttachment(waypoints, idx, shape) {
4335 var point = waypoints && waypoints[idx];
4337 return point ? (point.original || point) : LayoutUtil.getMidPoint(shape);
4341 BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
4342 var source = connection.source,
4343 target = connection.target,
4344 waypoints = connection.waypoints,
4348 var layoutManhattan,
4351 start = getAttachment(waypoints, 0, source);
4352 end = getAttachment(waypoints, waypoints && waypoints.length - 1, target);
4354 // manhattan layout sequence / message flows
4355 if (is(connection, 'bpmn:MessageFlow')) {
4357 preferStraight: true,
4358 preferVertical: true
4362 if (is(connection, 'bpmn:SequenceFlow')) {
4363 layoutManhattan = {};
4366 if (layoutManhattan) {
4368 layoutManhattan = assign(layoutManhattan, hints);
4371 ManhattanLayout.repairConnection(
4372 source, target, start, end,
4377 return updatedWaypoints || [start, end];
4380 "../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
4381 "diagram-js/lib/layout/BaseLayouter": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\BaseLayouter.js",
4382 "diagram-js/lib/layout/LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js",
4383 "diagram-js/lib/layout/ManhattanLayout": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\ManhattanLayout.js",
4384 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
4385 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
4387 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnUpdater.js": [function(require, module, exports) {
4390 var assign = require('lodash/object/assign'),
4391 forEach = require('lodash/collection/forEach'),
4392 inherits = require('inherits');
4394 var Collections = require('diagram-js/lib/util/Collections'),
4395 Model = require('diagram-js/lib/model');
4397 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
4401 * A handler responsible for updating the underlying BPMN 2.0 XML + DI once
4402 * changes on the diagram happen
4404 function BpmnUpdater(eventBus, bpmnFactory, connectionDocking) {
4406 CommandInterceptor.call(this, eventBus);
4408 this._bpmnFactory = bpmnFactory;
4414 // //// connection cropping /////////////////////////
4416 // crop connection ends during create/update
4417 function cropConnection(e) {
4418 var context = e.context,
4421 if (!context.cropped) {
4422 connection = context.connection;
4423 connection.waypoints = connectionDocking.getCroppedWaypoints(connection);
4424 context.cropped = true;
4429 'connection.layout',
4430 'connection.create',
4431 'connection.reconnectEnd',
4432 'connection.reconnectStart'
4435 this.reverted(['connection.layout'], function(e) {
4436 delete e.context.cropped;
4441 // //// BPMN + DI update /////////////////////////
4445 function updateParent(e) {
4446 self.updateParent(e.context.shape || e.context.connection);
4449 this.executed(['shape.move',
4452 'connection.create',
4456 this.reverted(['shape.move',
4459 'connection.create',
4465 * ## Updating Parent
4467 * When morphing a Process into a Collaboration or vice-versa, make sure
4468 * that both the *semantic* and *di* parent of each element is updated.
4471 function updateRoot(event) {
4472 var context = event.context,
4473 oldRoot = context.oldRoot,
4474 children = oldRoot.children;
4476 forEach(children, function(child) {
4477 self.updateParent(child);
4481 this.executed(['canvas.updateRoot'], updateRoot);
4482 this.reverted(['canvas.updateRoot'], updateRoot);
4486 function updateBounds(e) {
4487 self.updateBounds(e.context.shape);
4490 this.executed(['shape.move', 'shape.create', 'shape.resize'], updateBounds);
4491 this.reverted(['shape.move', 'shape.create', 'shape.resize'], updateBounds);
4494 // attach / detach connection
4495 function updateConnection(e) {
4496 self.updateConnection(e.context.connection);
4500 'connection.create',
4502 'connection.delete',
4503 'connection.reconnectEnd',
4504 'connection.reconnectStart'
4505 ], updateConnection);
4508 'connection.create',
4510 'connection.delete',
4511 'connection.reconnectEnd',
4512 'connection.reconnectStart'
4513 ], updateConnection);
4517 function updateConnectionWaypoints(e) {
4518 self.updateConnectionWaypoints(e.context.connection);
4522 'connection.layout',
4524 'connection.updateWaypoints',
4525 'connection.reconnectEnd',
4526 'connection.reconnectStart'
4527 ], updateConnectionWaypoints);
4530 'connection.layout',
4532 'connection.updateWaypoints',
4533 'connection.reconnectEnd',
4534 'connection.reconnectStart'
4535 ], updateConnectionWaypoints);
4538 inherits(BpmnUpdater, CommandInterceptor);
4540 module.exports = BpmnUpdater;
4542 BpmnUpdater.$inject = ['eventBus', 'bpmnFactory', 'connectionDocking'];
4545 // ///// implementation //////////////////////////////////
4548 BpmnUpdater.prototype.updateParent = function(element) {
4550 // do not update BPMN 2.0 label parent
4551 if (element instanceof Model.Label) {
4555 var parentShape = element.parent;
4557 var businessObject = element.businessObject,
4558 parentBusinessObject = parentShape && parentShape.businessObject,
4559 parentDi = parentBusinessObject && parentBusinessObject.di;
4561 this.updateSemanticParent(businessObject, parentBusinessObject);
4563 this.updateDiParent(businessObject.di, parentDi);
4567 BpmnUpdater.prototype.updateBounds = function(shape) {
4569 var di = shape.businessObject.di;
4571 var bounds = (shape instanceof Model.Label) ? this._getLabel(di).bounds : di.bounds;
4577 height: shape.height
4582 BpmnUpdater.prototype.updateDiParent = function(di, parentDi) {
4584 if (parentDi && !parentDi.$instanceOf('bpmndi:BPMNPlane')) {
4585 parentDi = parentDi.$parent;
4588 if (di.$parent === parentDi) {
4592 var planeElements = (parentDi || di.$parent).get('planeElement');
4595 planeElements.push(di);
4596 di.$parent = parentDi;
4598 Collections.remove(planeElements, di);
4603 function getDefinitions(element) {
4604 while (element && !element.$instanceOf('bpmn:Definitions')) {
4605 element = element.$parent;
4611 BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent) {
4615 if (businessObject.$parent === newParent) {
4619 if (businessObject.$instanceOf('bpmn:FlowElement')) {
4621 if (newParent && newParent.$instanceOf('bpmn:Participant')) {
4622 newParent = newParent.processRef;
4625 containment = 'flowElements';
4629 if (businessObject.$instanceOf('bpmn:Artifact')) {
4632 !newParent.$instanceOf('bpmn:Process') &&
4633 !newParent.$instanceOf('bpmn:SubProcess') &&
4634 !newParent.$instanceOf('bpmn:Collaboration')) {
4636 if (newParent.$instanceOf('bpmn:Participant')) {
4637 newParent = newParent.processRef;
4640 newParent = newParent.$parent;
4644 containment = 'artifacts';
4647 if (businessObject.$instanceOf('bpmn:MessageFlow')) {
4648 containment = 'messageFlows';
4652 if (businessObject.$instanceOf('bpmn:Participant')) {
4653 containment = 'participants';
4655 // make sure the participants process is properly attached / detached
4656 // from the XML document
4658 var process = businessObject.processRef,
4662 definitions = getDefinitions(businessObject.$parent || newParent);
4664 if (businessObject.$parent) {
4665 Collections.remove(definitions.get('rootElements'), process);
4666 process.$parent = null;
4670 Collections.add(definitions.get('rootElements'), process);
4671 process.$parent = definitions;
4677 throw new Error('no parent for ', businessObject, newParent);
4682 if (businessObject.$parent) {
4683 // remove from old parent
4684 children = businessObject.$parent.get(containment);
4685 Collections.remove(children, businessObject);
4689 businessObject.$parent = null;
4691 // add to new parent
4692 children = newParent.get(containment);
4693 children.push(businessObject);
4694 businessObject.$parent = newParent;
4699 BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {
4701 connection.businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
4705 BpmnUpdater.prototype.updateConnection = function(connection) {
4707 var businessObject = connection.businessObject,
4708 newSource = connection.source && connection.source.businessObject,
4709 newTarget = connection.target && connection.target.businessObject;
4711 var inverseSet = businessObject.$instanceOf('bpmn:SequenceFlow');
4713 if (businessObject.sourceRef !== newSource) {
4715 Collections.remove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
4718 newSource.get('outgoing').push(businessObject);
4722 businessObject.sourceRef = newSource;
4724 if (businessObject.targetRef !== newTarget) {
4726 Collections.remove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
4729 newTarget.get('incoming').push(businessObject);
4733 businessObject.targetRef = newTarget;
4736 businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
4740 // ///// helpers /////////////////////////////////////////
4742 BpmnUpdater.prototype._getLabel = function(di) {
4744 di.label = this._bpmnFactory.createDiLabel();
4750 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
4751 "diagram-js/lib/model": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js",
4752 "diagram-js/lib/util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
4753 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
4754 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
4755 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
4757 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ElementFactory.js": [function(require, module, exports) {
4760 var assign = require('lodash/object/assign'),
4761 inherits = require('inherits');
4763 var BaseElementFactory = require('diagram-js/lib/core/ElementFactory'),
4764 LabelUtil = require('../../util/LabelUtil');
4768 * A bpmn-aware factory for diagram-js shapes
4770 function ElementFactory(bpmnFactory, moddle) {
4771 BaseElementFactory.call(this);
4773 this._bpmnFactory = bpmnFactory;
4774 this._moddle = moddle;
4777 inherits(ElementFactory, BaseElementFactory);
4780 ElementFactory.$inject = ['bpmnFactory', 'moddle'];
4782 module.exports = ElementFactory;
4784 ElementFactory.prototype.baseCreate = BaseElementFactory.prototype.create;
4786 ElementFactory.prototype.create = function(elementType, attrs) {
4788 // no special magic for labels,
4789 // we assume their businessObjects have already been created
4790 // and wired via attrs
4791 if (elementType === 'label') {
4792 return this.baseCreate(elementType, assign({
4794 }, LabelUtil.DEFAULT_LABEL_SIZE, attrs));
4797 attrs = attrs || {};
4799 var businessObject = attrs.businessObject,
4802 if (!businessObject) {
4804 throw new Error('no shape type specified');
4807 businessObject = this._bpmnFactory.create(attrs.type);
4810 if (!businessObject.di) {
4811 if (elementType === 'root') {
4812 businessObject.di = this._bpmnFactory.createDiPlane(businessObject, [], {
4813 id: businessObject.id + '_di'
4816 if (elementType === 'connection') {
4817 businessObject.di = this._bpmnFactory.createDiEdge(businessObject, [], {
4818 id: businessObject.id + '_di'
4821 businessObject.di = this._bpmnFactory.createDiShape(businessObject, {}, {
4822 id: businessObject.id + '_di'
4827 if (!!attrs.isExpanded) {
4828 businessObject.di.isExpanded = attrs.isExpanded;
4832 * if (businessObject.$instanceOf('bpmn:ExclusiveGateway')) {
4833 * businessObject.di.isMarkerVisible = true; }
4836 if (attrs._eventDefinitionType) {
4837 var eventDefinitions = businessObject.get('eventDefinitions') || [],
4838 newEventDefinition = this._moddle.create(attrs._eventDefinitionType);
4840 eventDefinitions.push(newEventDefinition);
4841 businessObject.eventDefinitions = eventDefinitions;
4844 size = this._getDefaultSize(businessObject);
4847 businessObject: businessObject,
4848 id: businessObject.id
4851 return this.baseCreate(elementType, attrs);
4855 ElementFactory.prototype._getDefaultSize = function(semantic) {
4857 if (semantic.$instanceOf('bpmn:SubProcess')) {
4858 var isExpanded = semantic.di.isExpanded === true;
4873 if (semantic.$instanceOf('bpmn:InitiateProcess')) {
4879 if (semantic.$instanceOf('bpmn:VesCollector')) {
4885 if (semantic.$instanceOf('bpmn:Holmes')) {
4891 if (semantic.$instanceOf('bpmn:TCA')) {
4898 if (semantic.$instanceOf('bpmn:Policy')) {
4905 if (semantic.$instanceOf('bpmn:GOC')) {
4911 if (semantic.$instanceOf('bpmn:ParentReturn')) {
4917 if (semantic.$instanceOf('bpmn:SubProcessCall')) {
4924 if (semantic.$instanceOf('bpmn:ExclusiveGateway')) {
4931 if (semantic.$instanceOf('bpmn:Task')) {
4938 if (semantic.$instanceOf('bpmn:Gateway')) {
4945 if (semantic.$instanceOf('bpmn:Event')) {
4952 if (semantic.$instanceOf('bpmn:Participant')) {
4966 ElementFactory.prototype.createParticipantShape = function(collapsed) {
4967 // alert("entering createParticipantShape");
4968 var participantShape = this.createShape({
4969 type: 'bpmn:Participant'
4973 participantShape.businessObject.processRef = this._bpmnFactory.create('bpmn:Process');
4976 return participantShape;
4979 "../../util/LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js",
4980 "diagram-js/lib/core/ElementFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementFactory.js",
4981 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
4982 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
4984 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\LabelSupport.js": [function(require, module, exports) {
4987 var assign = require('lodash/object/assign'),
4988 forEach = require('lodash/collection/forEach');
4990 var LabelUtil = require('../../util/LabelUtil');
4992 var hasExternalLabel = LabelUtil.hasExternalLabel,
4993 getExternalLabelMid = LabelUtil.getExternalLabelMid;
4996 function LabelSupport(eventBus, modeling, bpmnFactory) {
4998 // create external labels on shape creation
5001 'commandStack.shape.create.postExecute',
5002 'commandStack.connection.create.postExecute'
5004 var context = e.context;
5006 var element = context.shape || context.connection,
5007 businessObject = element.businessObject;
5011 if (hasExternalLabel(businessObject)) {
5012 position = getExternalLabelMid(element);
5013 modeling.createLabel(element, position, {
5014 id: businessObject.id + '_label',
5015 businessObject: businessObject
5021 //move label when connection/shape is being moved
5022 //if shape is being moved, get connection as element
5024 eventBus.on(['commandStack.connection.create.postExecute',
5025 'commandStack.connection.move.postExecute',
5026 //'commandStack.connection.delete.postExecute',
5027 'commandStack.connection.reconnectEnd.postExecute',
5028 'commandStack.connection.reconnectStart.postExecute',
5029 'commandStack.connection.updateWaypoints.postExecute',
5033 var context = e.context;
5036 if (context.allDraggedElements != null) {
5037 if (context.allDraggedElements.length > 0) {
5038 element = context.allDraggedElements[1];
5041 element = context.connection;
5044 if (element == null) {
5048 var businessObject = element.businessObject;
5050 if (businessObject.$type != 'bpmn:SequenceFlow') {
5056 if (hasExternalLabel(businessObject)) {
5057 position = getExternalLabelMid(element);
5058 modeling.removeShape(element.label);
5059 modeling.createLabel(element, position, {
5060 id: businessObject.id + '_label',
5061 businessObject: businessObject
5068 // indicate label is dragged during move
5070 // we need to add labels to the list of selected
5071 // shapes before the visuals get drawn.
5073 // Hence this awesome magic number.
5075 eventBus.on('shape.move.start', function(e) {
5077 var context = e.context,
5078 shapes = context.shapes;
5082 forEach(shapes, function(element) {
5083 var label = element.label;
5085 if (label && !label.hidden && context.shapes.indexOf(label) === -1) {
5090 forEach(labels, function(label) {
5096 // move labels with shapes
5099 'commandStack.shapes.move.postExecute'
5102 var context = e.context,
5103 closure = context.closure,
5104 enclosedElements = closure.enclosedElements;
5106 // ensure we move all labels with their respective elements
5107 // if they have not been moved already
5109 forEach(enclosedElements, function(e) {
5110 if (e.label && !enclosedElements[e.label.id]) {
5111 modeling.moveShape(e.label, context.delta, e.parent);
5117 // update di information on label movement and creation
5120 'commandStack.label.create.executed',
5121 'commandStack.shape.moved.executed'
5124 var element = e.context.shape,
5125 businessObject = element.businessObject,
5126 di = businessObject.di;
5128 // we want to trigger on real labels only
5129 if (!element.labelTarget) {
5134 di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
5135 bounds: bpmnFactory.create('dc:Bounds')
5139 assign(di.label.bounds, {
5142 width: element.width,
5143 height: element.height
5148 LabelSupport.$inject = ['eventBus', 'modeling', 'bpmnFactory'];
5150 module.exports = LabelSupport;
5153 "../../util/LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js",
5154 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
5155 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
5157 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\Modeling.js": [function(require, module, exports) {
5160 var inherits = require('inherits');
5162 var BaseModeling = require('diagram-js/lib/features/modeling/Modeling');
5164 var UpdatePropertiesHandler = require('./cmd/UpdatePropertiesHandler'),
5165 UpdateCanvasRootHandler = require('./cmd/UpdateCanvasRootHandler');
5169 * BPMN 2.0 modeling features activator
5173 * @param {ElementFactory}
5175 * @param {CommandStack}
5177 * @param {BpmnRules}
5180 function Modeling(eventBus, elementFactory, commandStack, bpmnRules) {
5181 BaseModeling.call(this, eventBus, elementFactory, commandStack);
5183 this._bpmnRules = bpmnRules;
5186 inherits(Modeling, BaseModeling);
5188 Modeling.$inject = ['eventBus', 'elementFactory', 'commandStack', 'bpmnRules'];
5190 module.exports = Modeling;
5193 Modeling.prototype.getHandlers = function() {
5194 var handlers = BaseModeling.prototype.getHandlers.call(this);
5196 handlers['element.updateProperties'] = UpdatePropertiesHandler;
5197 handlers['canvas.updateRoot'] = UpdateCanvasRootHandler;
5203 Modeling.prototype.updateLabel = function(element, newLabel) {
5204 this._commandStack.execute('element.updateLabel', {
5211 var getSharedParent = require('./ModelingUtil').getSharedParent;
5213 Modeling.prototype.connect = function(source, target, attrs) {
5215 var bpmnRules = this._bpmnRules;
5218 if (bpmnRules.canConnectMessageFlow(source, target)) {
5220 type: 'bpmn:MessageFlow'
5223 if (bpmnRules.canConnectSequenceFlow(source, target)) {
5225 type: 'bpmn:SequenceFlow'
5229 type: 'bpmn:Association'
5234 return this.createConnection(source, target, attrs, getSharedParent(source, target));
5238 Modeling.prototype.updateProperties = function(element, properties) {
5239 this._commandStack.execute('element.updateProperties', {
5241 properties: properties
5247 * Transform the current diagram into a collaboration.
5249 * @return {djs.model.Root} the new root element
5251 Modeling.prototype.makeCollaboration = function() {
5253 var collaborationElement = this._create('root', {
5254 type: 'bpmn:Collaboration'
5258 newRoot: collaborationElement
5261 this._commandStack.execute('canvas.updateRoot', context);
5263 return collaborationElement;
5267 * Transform the current diagram into a process.
5269 * @return {djs.model.Root} the new root element
5271 Modeling.prototype.makeProcess = function() {
5273 var processElement = this._create('root', {
5274 type: 'bpmn:Process'
5278 newRoot: processElement
5281 this._commandStack.execute('canvas.updateRoot', context);
5284 "./ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
5285 "./cmd/UpdateCanvasRootHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdateCanvasRootHandler.js",
5286 "./cmd/UpdatePropertiesHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdatePropertiesHandler.js",
5287 "diagram-js/lib/features/modeling/Modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\Modeling.js",
5288 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5290 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js": [function(require, module, exports) {
5293 var find = require('lodash/collection/find');
5296 function getParents(element) {
5301 element = element.parent;
5304 parents.push(element);
5311 module.exports.getParents = getParents;
5314 function getSharedParent(a, b) {
5316 var parentsA = getParents(a),
5317 parentsB = getParents(b);
5319 return find(parentsA, function(parent) {
5320 return parentsB.indexOf(parent) !== -1;
5324 module.exports.getSharedParent = getSharedParent;
5326 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js"
5328 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\AppendBehavior.js": [function(require, module, exports) {
5331 var inherits = require('inherits');
5333 var is = require('../../../util/ModelUtil').is;
5335 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5338 function AppendBehavior(eventBus, elementFactory, bpmnRules) {
5340 CommandInterceptor.call(this, eventBus);
5342 // assign correct shape position unless already set
5344 this.preExecute('shape.append', function(context) {
5346 var source = context.source,
5347 shape = context.shape;
5349 if (!context.position) {
5351 if (is(shape, 'bpmn:TextAnnotation')) {
5352 context.position = {
5353 x: source.x + source.width / 2 + 75,
5354 y: source.y - (50) - shape.height / 2
5357 context.position = {
5358 x: source.x + source.width + 80 + shape.width / 2,
5359 y: source.y + source.height / 2
5367 AppendBehavior.$inject = ['eventBus', 'elementFactory', 'bpmnRules'];
5369 inherits(AppendBehavior, CommandInterceptor);
5371 module.exports = AppendBehavior;
5373 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5374 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5375 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5377 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\CreateBehavior.js": [function(require, module, exports) {
5380 var inherits = require('inherits');
5382 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5384 var is = require('../../../util/ModelUtil').is;
5387 * BPMN specific create behavior
5389 function CreateBehavior(eventBus, modeling) {
5391 CommandInterceptor.call(this, eventBus);
5395 * morph process into collaboration before adding participant onto
5399 this.preExecute('shape.create', function(context) {
5401 var parent = context.parent,
5402 shape = context.shape,
5403 position = context.position;
5405 if (is(parent, 'bpmn:Process') && is(shape, 'bpmn:Participant')) {
5407 // this is going to detach the process root
5408 // and set the returned collaboration element
5409 // as the new root element
5410 var collaborationElement = modeling.makeCollaboration();
5412 // monkey patch the create context
5413 // so that the participant is being dropped
5414 // onto the new collaboration root instead
5415 context.position = position;
5416 context.parent = collaborationElement;
5418 context.processRoot = parent;
5422 this.execute('shape.create', function(context) {
5424 var processRoot = context.processRoot,
5425 shape = context.shape;
5428 context.oldProcessRef = shape.businessObject.processRef;
5430 // assign the participant processRef
5431 shape.businessObject.processRef = processRoot.businessObject;
5435 this.revert('shape.create', function(context) {
5436 var processRoot = context.processRoot,
5437 shape = context.shape;
5440 // assign the participant processRef
5441 shape.businessObject.processRef = context.oldProcessRef;
5445 this.postExecute('shape.create', function(context) {
5447 var processRoot = context.processRoot,
5448 shape = context.shape;
5451 // process root is already detached at this point
5452 var processChildren = processRoot.children.slice();
5453 modeling.moveShapes(processChildren, {
5458 //console.log(context.shape.id);
5459 //newElementProcessor(context.shape.id);
5460 //console.log(context)
5465 CreateBehavior.$inject = ['eventBus', 'modeling'];
5467 inherits(CreateBehavior, CommandInterceptor);
5469 module.exports = CreateBehavior;
5471 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5472 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5473 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5475 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\DropBehavior.js": [function(require, module, exports) {
5478 var forEach = require('lodash/collection/forEach'),
5479 inherits = require('inherits');
5481 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5483 var is = require('../../../util/ModelUtil').is,
5484 getSharedParent = require('../ModelingUtil').getSharedParent;
5487 function DropBehavior(eventBus, modeling, bpmnRules) {
5489 CommandInterceptor.call(this, eventBus);
5491 // remove sequence flows that should not be allowed
5492 // after a move operation
5494 this.postExecute('shapes.move', function(context) {
5496 var closure = context.closure,
5497 allConnections = closure.allConnections;
5499 forEach(allConnections, function(c) {
5501 var source = c.source,
5504 var replacementType,
5508 * Check if incoming or outgoing connections can stay or could be
5509 * substituted with an appropriate replacement.
5511 * This holds true for SequenceFlow <> MessageFlow.
5514 if (is(c, 'bpmn:SequenceFlow')) {
5515 if (!bpmnRules.canConnectSequenceFlow(source, target)) {
5519 if (bpmnRules.canConnectMessageFlow(source, target)) {
5520 replacementType = 'bpmn:MessageFlow';
5524 // transform message flows into sequence flows, if possible
5526 if (is(c, 'bpmn:MessageFlow')) {
5528 if (!bpmnRules.canConnectMessageFlow(source, target)) {
5532 if (bpmnRules.canConnectSequenceFlow(source, target)) {
5533 replacementType = 'bpmn:SequenceFlow';
5537 if (is(c, 'bpmn:Association') && !bpmnRules.canConnectAssociation(source, target)) {
5542 // remove invalid connection
5544 modeling.removeConnection(c);
5547 // replace SequenceFlow <> MessageFlow
5549 if (replacementType) {
5550 modeling.createConnection(source, target, {
5551 type: replacementType,
5552 waypoints: c.waypoints.slice()
5553 }, getSharedParent(source, target));
5559 inherits(DropBehavior, CommandInterceptor);
5561 DropBehavior.$inject = ['eventBus', 'modeling', 'bpmnRules'];
5563 module.exports = DropBehavior;
5565 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5566 "../ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
5567 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5568 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
5569 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
5571 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\ModelingFeedback.js": [function(require, module, exports) {
5574 var is = require('../../../util/ModelUtil').is;
5577 function ModelingFeedback(eventBus, tooltips) {
5579 function showError(position, message) {
5587 html: '<div>' + message + '</div>'
5591 eventBus.on(['shape.move.rejected', 'create.rejected'], function(event) {
5593 var context = event.context,
5594 shape = context.shape,
5595 target = context.target;
5597 if (is(target, 'bpmn:Collaboration') && is(shape, 'bpmn:FlowNode')) {
5598 showError(event, 'flow elements must be children of pools/participants');
5605 ModelingFeedback.$inject = ['eventBus', 'tooltips'];
5607 module.exports = ModelingFeedback;
5609 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js"
5611 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\RemoveBehavior.js": [function(require, module, exports) {
5614 var inherits = require('inherits');
5616 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5618 var is = require('../../../util/ModelUtil').is;
5622 * BPMN specific remove behavior
5624 function RemoveBehavior(eventBus, modeling) {
5626 CommandInterceptor.call(this, eventBus);
5630 * morph collaboration diagram into process diagram after the last
5631 * participant has been removed
5634 this.preExecute('shape.delete', function(context) {
5635 //delete elementMap[context.shape.id];
5636 //console.log(context.shape.id);
5637 var shape = context.shape,
5638 parent = shape.parent;
5640 // activate the behavior if the shape to be removed
5642 if (is(shape, 'bpmn:Participant')) {
5643 context.collaborationRoot = parent;
5647 this.postExecute('shape.delete', function(context) {
5649 var collaborationRoot = context.collaborationRoot;
5651 if (collaborationRoot && !collaborationRoot.businessObject.participants.length) {
5652 // replace empty collaboration with process diagram
5653 modeling.makeProcess();
5659 RemoveBehavior.$inject = ['eventBus', 'modeling'];
5661 inherits(RemoveBehavior, CommandInterceptor);
5663 module.exports = RemoveBehavior;
5665 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5666 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5667 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5669 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\index.js": [function(require, module, exports) {
5678 appendBehavior: ['type', require('./AppendBehavior')],
5679 dropBehavior: ['type', require('./DropBehavior')],
5680 createBehavior: ['type', require('./CreateBehavior')],
5681 removeBehavior: ['type', require('./RemoveBehavior')],
5682 modelingFeedback: ['type', require('./ModelingFeedback')]
5685 "./AppendBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\AppendBehavior.js",
5686 "./CreateBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\CreateBehavior.js",
5687 "./DropBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\DropBehavior.js",
5688 "./ModelingFeedback": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\ModelingFeedback.js",
5689 "./RemoveBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\RemoveBehavior.js"
5691 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdateCanvasRootHandler.js": [function(require, module, exports) {
5694 var Collections = require('diagram-js/lib/util/Collections');
5697 function UpdateCanvasRootHandler(canvas, modeling) {
5698 this._canvas = canvas;
5699 this._modeling = modeling;
5702 UpdateCanvasRootHandler.$inject = ['canvas', 'modeling'];
5704 module.exports = UpdateCanvasRootHandler;
5707 UpdateCanvasRootHandler.prototype.execute = function(context) {
5709 var canvas = this._canvas;
5711 var newRoot = context.newRoot,
5712 newRootBusinessObject = newRoot.businessObject,
5713 oldRoot = canvas.getRootElement(),
5714 oldRootBusinessObject = oldRoot.businessObject,
5715 bpmnDefinitions = oldRootBusinessObject.$parent,
5716 diPlane = oldRootBusinessObject.di;
5718 // (1) replace process old <> new root
5719 canvas.setRootElement(newRoot, true);
5721 // (2) update root elements
5722 Collections.add(bpmnDefinitions.rootElements, newRootBusinessObject);
5723 newRootBusinessObject.$parent = bpmnDefinitions;
5725 Collections.remove(bpmnDefinitions.rootElements, oldRootBusinessObject);
5726 oldRootBusinessObject.$parent = null;
5729 oldRootBusinessObject.di = null;
5731 diPlane.bpmnElement = newRootBusinessObject;
5732 newRootBusinessObject.di = diPlane;
5734 context.oldRoot = oldRoot;
5738 UpdateCanvasRootHandler.prototype.revert = function(context) {
5740 var canvas = this._canvas;
5742 var newRoot = context.newRoot,
5743 newRootBusinessObject = newRoot.businessObject,
5744 oldRoot = context.oldRoot,
5745 oldRootBusinessObject = oldRoot.businessObject,
5746 bpmnDefinitions = newRootBusinessObject.$parent,
5747 diPlane = newRootBusinessObject.di;
5749 // (1) replace process old <> new root
5750 canvas.setRootElement(oldRoot, true);
5752 // (2) update root elements
5753 Collections.remove(bpmnDefinitions.rootElements, newRootBusinessObject);
5754 newRootBusinessObject.$parent = null;
5756 Collections.add(bpmnDefinitions.rootElements, oldRootBusinessObject);
5757 oldRootBusinessObject.$parent = bpmnDefinitions;
5760 newRootBusinessObject.di = null;
5762 diPlane.bpmnElement = oldRootBusinessObject;
5763 oldRootBusinessObject.di = diPlane;
5766 "diagram-js/lib/util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js"
5768 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdatePropertiesHandler.js": [function(require, module, exports) {
5771 var assign = require('lodash/object/assign'),
5772 pick = require('lodash/object/pick'),
5773 keys = require('lodash/object/keys');
5775 var DEFAULT_FLOW = 'default',
5781 * A handler that implements a BPMN 2.0 property update.
5783 * This should be used to set simple properties on elements with an underlying
5784 * BPMN business object.
5786 * Use respective diagram-js provided handlers if you would like to perform
5787 * automated modeling.
5789 function UpdatePropertiesHandler(elementRegistry) {
5790 this._elementRegistry = elementRegistry;
5793 UpdatePropertiesHandler.$inject = ['elementRegistry'];
5795 module.exports = UpdatePropertiesHandler;
5798 // //// api /////////////////////////////////////////////
5801 * Updates a BPMN element with a list of new properties
5805 * @param {djs.model.Base}
5806 * context.element the element to update
5808 * context.properties a list of properties to set on the element's
5809 * businessObject (the BPMN model element)
5811 * @return {Array<djs.mode.Base>} the updated element
5813 UpdatePropertiesHandler.prototype.execute = function(context) {
5815 var element = context.element,
5816 changed = [element];
5819 throw new Error('element required');
5822 var elementRegistry = this._elementRegistry;
5824 var businessObject = element.businessObject,
5825 properties = context.properties,
5826 oldProperties = context.oldProperties || pick(businessObject, keys(properties));
5828 if (ID in properties) {
5829 elementRegistry.updateId(element, properties[ID]);
5832 // correctly indicate visual changes on default flow updates
5833 if (DEFAULT_FLOW in properties) {
5835 if (properties[DEFAULT_FLOW]) {
5836 changed.push(elementRegistry.get(properties[DEFAULT_FLOW].id));
5839 if (businessObject[DEFAULT_FLOW]) {
5840 changed.push(elementRegistry.get(businessObject[DEFAULT_FLOW].id));
5844 if (NAME in properties && element.label) {
5845 changed.push(element.label);
5848 // update properties
5849 assign(businessObject, properties);
5853 context.oldProperties = oldProperties;
5854 context.changed = changed;
5856 // indicate changed on objects affected by the update
5861 * Reverts the update on a BPMN elements properties.
5866 * @return {djs.mode.Base} the updated element
5868 UpdatePropertiesHandler.prototype.revert = function(context) {
5870 var element = context.element,
5871 oldProperties = context.oldProperties,
5872 businessObject = element.businessObject,
5873 elementRegistry = this._elementRegistry;
5875 assign(businessObject, context.oldProperties);
5877 if (ID in oldProperties) {
5878 elementRegistry.updateId(element, oldProperties[ID]);
5881 return context.changed;
5884 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
5885 "lodash/object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
5886 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
5888 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\index.js": [function(require, module, exports) {
5890 __init__: ['modeling', 'bpmnUpdater', 'labelSupport'],
5892 require('../label-editing'),
5894 require('./behavior'),
5895 require('diagram-js/lib/command'),
5896 require('diagram-js/lib/features/tooltips'),
5897 require('diagram-js/lib/features/change-support')
5899 bpmnFactory: ['type', require('./BpmnFactory')],
5900 bpmnUpdater: ['type', require('./BpmnUpdater')],
5901 elementFactory: ['type', require('./ElementFactory')],
5902 modeling: ['type', require('./Modeling')],
5903 labelSupport: ['type', require('./LabelSupport')],
5904 layouter: ['type', require('./BpmnLayouter')],
5905 connectionDocking: ['type', require('diagram-js/lib/layout/CroppingConnectionDocking')]
5909 "../label-editing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\index.js",
5910 "./BpmnFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnFactory.js",
5911 "./BpmnLayouter": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnLayouter.js",
5912 "./BpmnUpdater": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnUpdater.js",
5913 "./ElementFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ElementFactory.js",
5914 "./LabelSupport": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\LabelSupport.js",
5915 "./Modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\Modeling.js",
5916 "./behavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\index.js",
5917 "./rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\index.js",
5918 "diagram-js/lib/command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
5919 "diagram-js/lib/features/change-support": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js",
5920 "diagram-js/lib/features/tooltips": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\index.js",
5921 "diagram-js/lib/layout/CroppingConnectionDocking": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\CroppingConnectionDocking.js"
5923 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\BpmnRules.js": [function(require, module, exports) {
5926 var groupBy = require('lodash/collection/groupBy'),
5927 size = require('lodash/collection/size'),
5928 find = require('lodash/collection/find'),
5929 inherits = require('inherits');
5931 var getParents = require('../ModelingUtil').getParents,
5932 is = require('../../../util/ModelUtil').is,
5933 getBusinessObject = require('../../../util/ModelUtil').getBusinessObject,
5934 isExpanded = require('../../../util/DiUtil').isExpanded;
5937 var RuleProvider = require('diagram-js/lib/features/rules/RuleProvider');
5940 * BPMN specific modeling rule
5942 function BpmnRules(eventBus) {
5943 RuleProvider.call(this, eventBus);
5946 inherits(BpmnRules, RuleProvider);
5948 BpmnRules.$inject = ['eventBus'];
5950 module.exports = BpmnRules;
5952 BpmnRules.prototype.init = function() {
5954 this.addRule('connection.create', function(context) {
5955 var source = context.source,
5956 target = context.target;
5958 return canConnect(source, target);
5961 this.addRule('connection.reconnectStart', function(context) {
5963 var connection = context.connection,
5964 source = context.hover || context.source,
5965 target = connection.target;
5967 return canConnect(source, target, connection);
5970 this.addRule('connection.reconnectEnd', function(context) {
5972 var connection = context.connection,
5973 source = connection.source,
5974 target = context.hover || context.target;
5976 return canConnect(source, target, connection);
5979 this.addRule('connection.updateWaypoints', function(context) {
5980 // OK! but visually ignore
5984 this.addRule('shape.resize', function(context) {
5986 var shape = context.shape,
5987 newBounds = context.newBounds;
5989 return canResize(shape, newBounds);
5992 this.addRule('shapes.move', function(context) {
5994 var target = context.newParent,
5995 shapes = context.shapes;
5997 return canMove(shapes, target);
6000 this.addRule(['shape.create', 'shape.append'], function(context) {
6001 var target = context.parent,
6002 shape = context.shape,
6003 source = context.source;
6005 return canCreate(shape, target, source);
6010 BpmnRules.prototype.canConnectMessageFlow = canConnectMessageFlow;
6012 BpmnRules.prototype.canConnectSequenceFlow = canConnectSequenceFlow;
6014 BpmnRules.prototype.canConnectAssociation = canConnectAssociation;
6016 BpmnRules.prototype.canMove = canMove;
6018 BpmnRules.prototype.canDrop = canDrop;
6020 BpmnRules.prototype.canCreate = canCreate;
6022 BpmnRules.prototype.canConnect = canConnect;
6024 BpmnRules.prototype.canResize = canResize;
6027 * Utility functions for rule checking
6030 function nonExistantOrLabel(element) {
6031 return !element || isLabel(element);
6034 function isSame(a, b) {
6038 function getOrganizationalParent(element) {
6040 var bo = getBusinessObject(element);
6042 while (bo && !is(bo, 'bpmn:Process')) {
6043 if (is(bo, 'bpmn:Participant')) {
6044 return bo.processRef || bo;
6053 function isSameOrganization(a, b) {
6054 var parentA = getOrganizationalParent(a),
6055 parentB = getOrganizationalParent(b);
6057 return parentA === parentB;
6060 function isMessageFlowSource(element) {
6061 return is(element, 'bpmn:InteractionNode') && (!is(element, 'bpmn:Event') || (
6062 is(element, 'bpmn:ThrowEvent') &&
6063 hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')
6067 function isMessageFlowTarget(element) {
6068 return is(element, 'bpmn:InteractionNode') && (!is(element, 'bpmn:Event') || (
6069 is(element, 'bpmn:CatchEvent') &&
6070 hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')
6074 function getScopeParent(element) {
6076 var bo = getBusinessObject(element);
6078 if (is(bo, 'bpmn:Participant')) {
6085 if (is(bo, 'bpmn:FlowElementsContainer')) {
6093 function isSameScope(a, b) {
6094 var scopeParentA = getScopeParent(a),
6095 scopeParentB = getScopeParent(b);
6097 return scopeParentA && (scopeParentA === scopeParentB);
6100 function hasEventDefinition(element, eventDefinition) {
6101 var bo = getBusinessObject(element);
6103 return !!find(bo.eventDefinitions || [], function(definition) {
6104 return is(definition, eventDefinition);
6108 function hasEventDefinitionOrNone(element, eventDefinition) {
6109 var bo = getBusinessObject(element);
6111 return (bo.eventDefinitions || []).every(function(definition) {
6112 return is(definition, eventDefinition);
6116 function isSequenceFlowSource(element) {
6117 return is(element, 'bpmn:FlowNode') && !is(element, 'bpmn:EndEvent') && !(
6118 is(element, 'bpmn:IntermediateThrowEvent') &&
6119 hasEventDefinition(element, 'bpmn:LinkEventDefinition')
6123 function isSequenceFlowTarget(element) {
6124 return is(element, 'bpmn:FlowNode') && !is(element, 'bpmn:StartEvent') && !(
6125 is(element, 'bpmn:IntermediateCatchEvent') &&
6126 hasEventDefinition(element, 'bpmn:LinkEventDefinition')
6130 function isEventBasedTarget(element) {
6131 return is(element, 'bpmn:ReceiveTask') || (
6132 is(element, 'bpmn:IntermediateCatchEvent') && (
6133 hasEventDefinition(element, 'bpmn:MessageEventDefinition') ||
6134 hasEventDefinition(element, 'bpmn:TimerEventDefinition') ||
6135 hasEventDefinition(element, 'bpmn:ConditionalEventDefinition') ||
6136 hasEventDefinition(element, 'bpmn:SignalEventDefinition')
6141 function isLabel(element) {
6142 return element.labelTarget;
6145 function isConnection(element) {
6146 return element.waypoints;
6149 function isParent(possibleParent, element) {
6150 var allParents = getParents(element);
6151 return allParents.indexOf(possibleParent) !== -1;
6154 function canConnect(source, target, connection) {
6156 if (nonExistantOrLabel(source) || nonExistantOrLabel(target)) {
6160 // See https://github.com/bpmn-io/bpmn-js/issues/178
6161 // as a workround we disallow connections with same
6162 // target and source element.
6163 // This rule must be removed if a auto layout for this
6164 // connections is implemented.
6165 if (isSame(source, target)) {
6169 if (canConnectMessageFlow(source, target) ||
6170 canConnectSequenceFlow(source, target)) {
6175 if (is(connection, 'bpmn:Association')) {
6176 return canConnectAssociation(source, target);
6183 * Can an element be dropped into the target element
6187 function canDrop(element, target) {
6189 // can move labels everywhere
6190 if (isLabel(element) && !isConnection(target)) {
6194 // allow to create new participants on
6195 // on existing collaboration and process diagrams
6196 if (is(element, 'bpmn:Participant')) {
6197 return is(target, 'bpmn:Process') || is(target, 'bpmn:Collaboration');
6200 // drop flow elements onto flow element containers
6202 if (is(element, 'bpmn:FlowElement')) {
6203 if (is(target, 'bpmn:FlowElementsContainer')) {
6204 return isExpanded(target) !== false;
6207 return is(target, 'bpmn:Participant');
6210 if (is(element, 'bpmn:Artifact')) {
6211 return is(target, 'bpmn:Collaboration') ||
6212 is(target, 'bpmn:Participant') ||
6213 is(target, 'bpmn:Process');
6216 if (is(element, 'bpmn:MessageFlow')) {
6217 return is(target, 'bpmn:Collaboration');
6223 function canMove(elements, target) {
6225 // only move if they have the same parent
6226 var sameParent = size(groupBy(elements, function(s) {
6227 return s.parent && s.parent.id;
6238 return elements.every(function(element) {
6239 return canDrop(element, target);
6243 function canCreate(shape, target, source) {
6249 if (isLabel(target)) {
6253 if (isSame(source, target)) {
6257 // ensure we do not drop the element
6259 if (source && isParent(source, target)) {
6263 return canDrop(shape, target);
6266 function canResize(shape, newBounds) {
6267 if (is(shape, 'bpmn:SubProcess')) {
6268 return isExpanded(shape) && (!newBounds || (newBounds.width >= 100 && newBounds.height >= 80));
6271 if (is(shape, 'bpmn:Participant')) {
6272 return !newBounds || (newBounds.width >= 100 && newBounds.height >= 80);
6275 if (is(shape, 'bpmn:TextAnnotation')) {
6278 if (is(shape, 'bpmn:MultiBranchConnector')) {
6285 function canConnectAssociation(source, target) {
6287 // do not connect connections
6288 if (isConnection(source) || isConnection(target)) {
6292 // connect if different parent
6293 return !isParent(target, source) &&
6294 !isParent(source, target);
6297 function canConnectMessageFlow(source, target) {
6299 return isMessageFlowSource(source) &&
6300 isMessageFlowTarget(target) &&
6301 !isSameOrganization(source, target);
6304 function canConnectSequenceFlow(source, target) {
6306 return isSequenceFlowSource(source) &&
6307 isSequenceFlowTarget(target) &&
6308 isSameScope(source, target) &&
6309 !(is(source, 'bpmn:EventBasedGateway') && !isEventBasedTarget(target));
6312 "../../../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
6313 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
6314 "../ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
6315 "diagram-js/lib/features/rules/RuleProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\RuleProvider.js",
6316 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
6317 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
6318 "lodash/collection/groupBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js",
6319 "lodash/collection/size": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\size.js"
6321 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\index.js": [function(require, module, exports) {
6324 require('diagram-js/lib/features/rules')
6326 __init__: ['bpmnRules'],
6327 bpmnRules: ['type', require('./BpmnRules')]
6331 "./BpmnRules": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\BpmnRules.js",
6332 "diagram-js/lib/features/rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js"
6334 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\palette\\PaletteProvider.js": [function(require, module, exports) {
6337 var assign = require('lodash/object/assign');
6340 * A palette provider for BPMN 2.0 elements.
6342 function PaletteProvider(palette, create, elementFactory, spaceTool, lassoTool) {
6344 this._create = create;
6345 this._elementFactory = elementFactory;
6346 this._spaceTool = spaceTool;
6347 this._lassoTool = lassoTool;
6349 palette.registerProvider(this);
6352 module.exports = PaletteProvider;
6354 PaletteProvider.$inject = ['palette', 'create', 'elementFactory', 'spaceTool', 'lassoTool'];
6357 PaletteProvider.prototype.getPaletteEntries = function(element) {
6360 create = this._create,
6361 elementFactory = this._elementFactory,
6362 spaceTool = this._spaceTool,
6363 lassoTool = this._lassoTool;
6366 function createAction(type, group, className, title, options) {
6367 function createListener(event) {
6368 var shape = elementFactory.createShape(assign({
6373 shape.businessObject.di.isExpanded = options.isExpanded;
6376 create.start(event, shape);
6379 var shortType = type.replace(/^bpmn\:/, '');
6383 className: className,
6384 title: title || 'Create ' + shortType,
6386 dragstart: createListener,
6387 click: createListener
6392 function createParticipant(event, collapsed) {
6393 create.start(event, elementFactory.createParticipantShape(collapsed));
6397 'create.start-event': createAction(
6398 'bpmn:StartEvent', 'event', 'icon-start-event-none', "Start"
6400 'create.ves-collector': createAction(
6401 'bpmn:VesCollector', 'event', 'icon-ves-collector-node', 'Ves Collector'
6403 'create.holmes': createAction(
6404 'bpmn:Holmes', 'event', 'icon-holmes-node', 'Holmes'
6408 'create.TCA': createAction(
6409 'bpmn:TCA', 'event', 'icon-tca-node', 'TCA'
6411 'create.Aand-AI': createAction(
6412 'bpmn:Policy', 'event', 'icon-policy-node', 'Policy'
6414 'create.end-event': createAction(
6415 'bpmn:EndEvent', 'event', 'icon-end-event-none', "End"
6423 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
6425 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\palette\\index.js": [function(require, module, exports) {
6428 require('diagram-js/lib/features/palette'),
6429 require('diagram-js/lib/features/create')
6431 __init__: ['paletteProvider'],
6432 paletteProvider: ['type', require('./PaletteProvider')]
6436 "./PaletteProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\palette\\PaletteProvider.js",
6437 "diagram-js/lib/features/create": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\index.js",
6438 "diagram-js/lib/features/palette": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\index.js"
6440 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\BpmnReplace.js": [function(require, module, exports) {
6443 var forEach = require('lodash/collection/forEach'),
6444 filter = require('lodash/collection/filter');
6446 var REPLACE_OPTIONS = require('./ReplaceOptions');
6448 var startEventReplace = REPLACE_OPTIONS.START_EVENT,
6449 intermediateEventReplace = REPLACE_OPTIONS.INTERMEDIATE_EVENT,
6450 endEventReplace = REPLACE_OPTIONS.END_EVENT,
6451 gatewayReplace = REPLACE_OPTIONS.GATEWAY,
6452 taskReplace = REPLACE_OPTIONS.TASK;
6456 * A replace menu provider that gives users the controls to choose and replace
6457 * BPMN elements with each other.
6459 * @param {BpmnFactory}
6463 * @param {PopupMenu}
6468 function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection) {
6471 * Prepares a new business object for the replacement element and triggers
6472 * the replace operation.
6474 * @param {djs.model.Base}
6478 * @return {djs.model.Base} the newly created element
6480 function replaceElement(element, target) {
6482 var type = target.type,
6483 oldBusinessObject = element.businessObject,
6484 businessObject = bpmnFactory.create(type);
6488 businessObject: businessObject
6491 // initialize custom BPMN extensions
6493 if (target.eventDefinition) {
6494 var eventDefinitions = businessObject.get('eventDefinitions'),
6495 eventDefinition = moddle.create(target.eventDefinition);
6497 eventDefinitions.push(eventDefinition);
6500 if (target.instantiate !== undefined) {
6501 businessObject.instantiate = target.instantiate;
6504 if (target.eventGatewayType !== undefined) {
6505 businessObject.eventGatewayType = target.eventGatewayType;
6508 // copy size (for activities only)
6509 if (oldBusinessObject.$instanceOf('bpmn:Activity')) {
6511 // TODO: need also to respect min/max Size
6513 newElement.width = element.width;
6514 newElement.height = element.height;
6517 // TODO: copy other elligable properties from old business object
6518 businessObject.name = oldBusinessObject.name;
6520 newElement = replace.replaceElement(element, newElement);
6522 selection.select(newElement);
6528 function getReplaceOptions(element) {
6530 var menuEntries = [];
6531 var businessObject = element.businessObject;
6533 if (businessObject.$instanceOf('bpmn:StartEvent')) {
6534 addEntries(startEventReplace, filterEvents);
6537 if (businessObject.$instanceOf('bpmn:IntermediateCatchEvent') ||
6538 businessObject.$instanceOf('bpmn:IntermediateThrowEvent')) {
6540 addEntries(intermediateEventReplace, filterEvents);
6543 if (businessObject.$instanceOf('bpmn:EndEvent')) {
6545 addEntries(endEventReplace, filterEvents);
6548 if (businessObject.$instanceOf('bpmn:Gateway')) {
6550 addEntries(gatewayReplace, function(entry) {
6552 return entry.target.type !== businessObject.$type;
6556 if (businessObject.$instanceOf('bpmn:FlowNode')) {
6557 addEntries(taskReplace, function(entry) {
6558 return entry.target.type !== businessObject.$type;
6562 function filterEvents(entry) {
6564 var target = entry.target;
6566 var eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0].$type;
6567 var isEventDefinitionEqual = target.eventDefinition == eventDefinition;
6568 var isEventTypeEqual = businessObject.$type == target.type;
6570 return ((!isEventDefinitionEqual && isEventTypeEqual) ||
6571 !isEventTypeEqual) ||
6572 !(isEventDefinitionEqual && isEventTypeEqual);
6575 function addEntries(entries, filterFun) {
6576 // Filter selected type from the array
6577 var filteredEntries = filter(entries, filterFun);
6579 // Add entries to replace menu
6580 forEach(filteredEntries, function(definition) {
6582 var entry = addMenuEntry(definition);
6583 menuEntries.push(entry);
6587 function addMenuEntry(definition) {
6590 label: definition.label,
6591 className: definition.className,
6593 name: definition.actionName,
6594 handler: function() {
6595 replaceElement(element, definition.target);
6607 this.openChooser = function(position, element) {
6608 var entries = this.getReplaceOptions(element);
6610 popupMenu.open('replace-menu', position, entries);
6613 this.getReplaceOptions = getReplaceOptions;
6615 this.replaceElement = replaceElement;
6618 BpmnReplace.$inject = ['bpmnFactory', 'moddle', 'popupMenu', 'replace', 'selection'];
6620 module.exports = BpmnReplace;
6622 "./ReplaceOptions": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\ReplaceOptions.js",
6623 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
6624 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
6626 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\ReplaceOptions.js": [function(require, module, exports) {
6629 module.exports.START_EVENT = [{
6630 label: 'Start Event',
6631 actionName: 'replace-with-none-start',
6632 className: 'icon-start-event-none',
6634 type: 'bpmn:StartEvent'
6637 label: 'Intermediate Throw Event',
6638 actionName: 'replace-with-intermediate-throwing',
6639 className: 'icon-intermediate-event-none',
6641 type: 'bpmn:IntermediateThrowEvent'
6645 actionName: 'replace-with-message-end',
6646 className: 'icon-end-event-none',
6648 type: 'bpmn:EndEvent'
6651 label: 'Message Start Event',
6652 actionName: 'replace-with-message-start',
6653 className: 'icon-start-event-message',
6655 type: 'bpmn:StartEvent',
6656 eventDefinition: 'bpmn:MessageEventDefinition'
6659 label: 'Timer Start Event',
6660 actionName: 'replace-with-timer-start',
6661 className: 'icon-start-event-timer',
6663 type: 'bpmn:StartEvent',
6664 eventDefinition: 'bpmn:TimerEventDefinition'
6667 label: 'Conditional Start Event',
6668 actionName: 'replace-with-conditional-start',
6669 className: 'icon-start-event-condition',
6671 type: 'bpmn:StartEvent',
6672 eventDefinition: 'bpmn:ConditionalEventDefinition'
6675 label: 'Signal Start Event',
6676 actionName: 'replace-with-signal-start',
6677 className: 'icon-start-event-signal',
6679 type: 'bpmn:StartEvent',
6680 eventDefinition: 'bpmn:SignalEventDefinition'
6684 module.exports.INTERMEDIATE_EVENT = [{
6685 label: 'Start Event',
6686 actionName: 'replace-with-none-start',
6687 className: 'icon-start-event-none',
6689 type: 'bpmn:StartEvent'
6692 label: 'Intermediate Throw Event',
6693 actionName: 'replace-with-message-intermediate-throw',
6694 className: 'icon-intermediate-event-none',
6696 type: 'bpmn:IntermediateThrowEvent'
6700 actionName: 'replace-with-message-end',
6701 className: 'icon-end-event-none',
6703 type: 'bpmn:EndEvent'
6706 label: 'Message Intermediate Catch Event',
6707 actionName: 'replace-with-intermediate-catch',
6708 className: 'icon-intermediate-event-catch-message',
6710 type: 'bpmn:IntermediateCatchEvent',
6711 eventDefinition: 'bpmn:MessageEventDefinition'
6714 label: 'Message Intermediate Throw Event',
6715 actionName: 'replace-with-intermediate-throw',
6716 className: 'icon-intermediate-event-throw-message',
6718 type: 'bpmn:IntermediateThrowEvent',
6719 eventDefinition: 'bpmn:MessageEventDefinition'
6722 label: 'Timer Intermediate Catch Event',
6723 actionName: 'replace-with-timer-intermediate-catch',
6724 className: 'icon-intermediate-event-catch-timer',
6726 type: 'bpmn:IntermediateCatchEvent',
6727 eventDefinition: 'bpmn:TimerEventDefinition'
6730 label: 'Escalation Intermediate Catch Event',
6731 actionName: 'replace-with-escalation-catch',
6732 className: 'icon-intermediate-event-catch-escalation',
6734 type: 'bpmn:IntermediateCatchEvent',
6735 eventDefinition: 'bpmn:EscalationEventDefinition'
6738 label: 'Conditional Intermediate Catch Event',
6739 actionName: 'replace-with-conditional-intermediate-catch',
6740 className: 'icon-intermediate-event-catch-condition',
6742 type: 'bpmn:IntermediateCatchEvent',
6743 eventDefinition: 'bpmn:ConditionalEventDefinition'
6746 label: 'Link Intermediate Catch Event',
6747 actionName: 'replace-with-link-intermediate-catch',
6748 className: 'icon-intermediate-event-catch-link',
6750 type: 'bpmn:IntermediateCatchEvent',
6751 eventDefinition: 'bpmn:LinkEventDefinition'
6754 label: 'Link Intermediate Throw Event',
6755 actionName: 'replace-with-link-intermediate-throw',
6756 className: 'icon-intermediate-event-throw-link',
6758 type: 'bpmn:IntermediateThrowEvent',
6759 eventDefinition: 'bpmn:LinkEventDefinition'
6762 label: 'Compensation Intermediate Throw Event',
6763 actionName: 'replace-with-compensation-intermediate-throw',
6764 className: 'icon-intermediate-event-throw-compensation',
6766 type: 'bpmn:IntermediateThrowEvent',
6767 eventDefinition: 'bpmn:CompensateEventDefinition'
6770 label: 'Signal Throw Catch Event',
6771 actionName: 'replace-with-throw-intermediate-catch',
6772 className: 'icon-intermediate-event-catch-signal',
6774 type: 'bpmn:IntermediateCatchEvent',
6775 eventDefinition: 'bpmn:SignalEventDefinition'
6778 label: 'Signal Intermediate Throw Event',
6779 actionName: 'replace-with-signal-intermediate-throw',
6780 className: 'icon-intermediate-event-throw-signal',
6782 type: 'bpmn:IntermediateThrowEvent',
6783 eventDefinition: 'bpmn:SignalEventDefinition'
6787 module.exports.END_EVENT = [{
6788 label: 'Start Event',
6789 actionName: 'replace-with-none-start',
6790 className: 'icon-start-event-none',
6792 type: 'bpmn:StartEvent'
6795 label: 'Intermediate Throw Event',
6796 actionName: 'replace-with-message-intermediate-throw',
6797 className: 'icon-intermediate-event-none',
6799 type: 'bpmn:IntermediateThrowEvent'
6803 actionName: 'replace-with-none-end',
6804 className: 'icon-end-event-none',
6806 type: 'bpmn:EndEvent'
6809 label: 'Message End Event',
6810 actionName: 'replace-with-message-end',
6811 className: 'icon-end-event-message',
6813 type: 'bpmn:EndEvent',
6814 eventDefinition: 'bpmn:MessageEventDefinition'
6817 label: 'Escalation End Event',
6818 actionName: 'replace-with-escalation-end',
6819 className: 'icon-end-event-escalation',
6821 type: 'bpmn:EndEvent',
6822 eventDefinition: 'bpmn:EscalationEventDefinition'
6825 label: 'Error End Event',
6826 actionName: 'replace-with-error-end',
6827 className: 'icon-end-event-error',
6829 type: 'bpmn:EndEvent',
6830 eventDefinition: 'bpmn:ErrorEventDefinition'
6833 label: 'Cancel End Event',
6834 actionName: 'replace-with-cancel-end',
6835 className: 'icon-end-event-cancel',
6837 type: 'bpmn:EndEvent',
6838 eventDefinition: 'bpmn:CancelEventDefinition'
6841 label: 'Compensation End Event',
6842 actionName: 'replace-with-compensation-end',
6843 className: 'icon-end-event-compensation',
6845 type: 'bpmn:EndEvent',
6846 eventDefinition: 'bpmn:CompensateEventDefinition'
6849 label: 'Signal End Event',
6850 actionName: 'replace-with-signal-end',
6851 className: 'icon-end-event-signal',
6853 type: 'bpmn:EndEvent',
6854 eventDefinition: 'bpmn:SignalEventDefinition'
6857 label: 'Terminate End Event',
6858 actionName: 'replace-with-terminate-end',
6859 className: 'icon-end-event-terminate',
6861 type: 'bpmn:EndEvent',
6862 eventDefinition: 'bpmn:TerminateEventDefinition'
6866 module.exports.GATEWAY = [{
6867 label: 'Exclusive Gateway',
6868 actionName: 'replace-with-exclusive-gateway',
6869 className: 'icon-gateway-xor',
6871 type: 'bpmn:ExclusiveGateway'
6874 label: 'Parallel Gateway',
6875 actionName: 'replace-with-parallel-gateway',
6876 className: 'icon-gateway-parallel',
6878 type: 'bpmn:ParallelGateway'
6881 label: 'Inclusive Gateway',
6882 actionName: 'replace-with-inclusive-gateway',
6883 className: 'icon-gateway-or',
6885 type: 'bpmn:InclusiveGateway'
6888 label: 'Complex Gateway',
6889 actionName: 'replace-with-complex-gateway',
6890 className: 'icon-gateway-complex',
6892 type: 'bpmn:ComplexGateway'
6895 label: 'Event based Gateway',
6896 actionName: 'replace-with-event-based-gateway',
6897 className: 'icon-gateway-eventbased',
6899 type: 'bpmn:EventBasedGateway',
6901 eventGatewayType: 'Exclusive'
6904 // Gateways deactivated until https://github.com/bpmn-io/bpmn-js/issues/194
6906 // label: 'Event based instantiating Gateway',
6907 // actionName: 'replace-with-exclusive-event-based-gateway',
6908 // className: 'icon-exclusive-event-based',
6910 // type: 'bpmn:EventBasedGateway'
6913 // businessObject: { instantiate: true, eventGatewayType: 'Exclusive' }
6917 // label: 'Parallel Event based instantiating Gateway',
6918 // actionName: 'replace-with-parallel-event-based-instantiate-gateway',
6919 // className: 'icon-parallel-event-based-instantiate-gateway',
6921 // type: 'bpmn:EventBasedGateway'
6924 // businessObject: { instantiate: true, eventGatewayType: 'Parallel' }
6930 module.exports.TASK = [{
6932 actionName: 'replace-with-task',
6933 className: 'icon-task',
6939 actionName: 'replace-with-send-task',
6940 className: 'icon-send',
6942 type: 'bpmn:SendTask'
6945 label: 'Receive Task',
6946 actionName: 'replace-with-receive-task',
6947 className: 'icon-receive',
6949 type: 'bpmn:ReceiveTask'
6953 actionName: 'replace-with-user-task',
6954 className: 'icon-user',
6956 type: 'bpmn:UserTask'
6959 label: 'Manual Task',
6960 actionName: 'replace-with-manual-task',
6961 className: 'icon-manual',
6963 type: 'bpmn:ManualTask'
6966 label: 'Business Rule Task',
6967 actionName: 'replace-with-rule-task',
6968 className: 'icon-business-rule',
6970 type: 'bpmn:BusinessRuleTask'
6973 label: 'Service Task',
6974 actionName: 'replace-with-service-task',
6975 className: 'icon-service',
6977 type: 'bpmn:ServiceTask'
6980 label: 'Script Task',
6981 actionName: 'replace-with-script-task',
6982 className: 'icon-script',
6984 type: 'bpmn:ScriptTask'
6988 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\index.js": [function(require, module, exports) {
6991 require('diagram-js/lib/features/popup-menu'),
6992 require('diagram-js/lib/features/replace'),
6993 require('diagram-js/lib/features/selection')
6995 bpmnReplace: ['type', require('./BpmnReplace')]
6998 "./BpmnReplace": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\BpmnReplace.js",
6999 "diagram-js/lib/features/popup-menu": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\index.js",
7000 "diagram-js/lib/features/replace": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\index.js",
7001 "diagram-js/lib/features/selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js"
7003 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\snapping\\BpmnSnapping.js": [function(require, module, exports) {
7006 var inherits = require('inherits');
7008 var forEach = require('lodash/collection/forEach');
7010 var getBoundingBox = require('diagram-js/lib/util/Elements').getBBox;
7011 var is = require('../modeling/ModelingUtil').is;
7013 var Snapping = require('diagram-js/lib/features/snapping/Snapping'),
7014 SnapUtil = require('diagram-js/lib/features/snapping/SnapUtil');
7016 var is = require('../../util/ModelUtil').is;
7018 var mid = SnapUtil.mid,
7019 topLeft = SnapUtil.topLeft,
7020 bottomRight = SnapUtil.bottomRight;
7022 var round = Math.round;
7026 * BPMN specific snapping functionality
7027 * * snap on process elements if a pool is created inside a process diagram
7034 function BpmnSnapping(eventBus, canvas) {
7036 // instantiate super
7037 Snapping.call(this, eventBus, canvas);
7041 * Drop participant on process <> process elements snapping
7044 function initParticipantSnapping(context, shape, elements) {
7046 if (!elements.length) {
7050 var snapBox = getBoundingBox(elements.filter(function(e) {
7051 return !e.labelTarget && !e.waypoints;
7056 snapBox.width += 70;
7057 snapBox.height += 40;
7059 // adjust shape height to include bounding box
7060 shape.width = Math.max(shape.width, snapBox.width);
7061 shape.height = Math.max(shape.height, snapBox.height);
7063 context.participantSnapBox = snapBox;
7066 function snapParticipant(snapBox, shape, event) {
7068 var shapeHalfWidth = shape.width / 2 - 30,
7069 shapeHalfHeight = shape.height / 2;
7071 var currentTopLeft = {
7072 x: event.x - shapeHalfWidth - 30,
7073 y: event.y - shapeHalfHeight
7076 var currentBottomRight = {
7077 x: event.x + shapeHalfWidth + 30,
7078 y: event.y + shapeHalfHeight
7081 var snapTopLeft = snapBox,
7082 snapBottomRight = bottomRight(snapBox);
7084 if (currentTopLeft.x >= snapTopLeft.x) {
7085 event.x = snapTopLeft.x + 30 + shapeHalfWidth;
7086 event.snapped = true;
7088 if (currentBottomRight.x <= snapBottomRight.x) {
7089 event.x = snapBottomRight.x - 30 - shapeHalfWidth;
7090 event.snapped = true;
7093 if (currentTopLeft.y >= snapTopLeft.y) {
7094 event.y = snapTopLeft.y + shapeHalfHeight;
7095 event.snapped = true;
7097 if (currentBottomRight.y <= snapBottomRight.y) {
7098 event.y = snapBottomRight.y - shapeHalfHeight;
7099 event.snapped = true;
7103 eventBus.on('create.start', function(event) {
7105 var context = event.context,
7106 shape = context.shape,
7107 rootElement = canvas.getRootElement();
7109 // snap participant around existing elements (if any)
7110 if (is(shape, 'bpmn:Participant') && is(rootElement, 'bpmn:Process')) {
7112 initParticipantSnapping(context, shape, rootElement.children);
7116 eventBus.on(['create.move', 'create.end'], 1500, function(event) {
7118 var context = event.context,
7119 shape = context.shape,
7120 participantSnapBox = context.participantSnapBox;
7122 if (!event.snapped && participantSnapBox) {
7123 snapParticipant(participantSnapBox, shape, event);
7127 eventBus.on('resize.start', 1500, function(event) {
7128 var context = event.context,
7129 shape = context.shape;
7131 if (is(shape, 'bpmn:SubProcess')) {
7132 context.minDimensions = {
7138 if (is(shape, 'bpmn:Participant')) {
7139 context.minDimensions = {
7145 if (is(shape, 'bpmn:TextAnnotation')) {
7146 context.minDimensions = {
7155 inherits(BpmnSnapping, Snapping);
7157 BpmnSnapping.$inject = ['eventBus', 'canvas'];
7159 module.exports = BpmnSnapping;
7162 BpmnSnapping.prototype.initSnap = function(event) {
7164 var context = event.context,
7165 shape = context.shape,
7173 snapContext = Snapping.prototype.initSnap.call(this, event);
7175 if (is(shape, 'bpmn:Participant')) {
7176 // assign higher priority for outer snaps on participants
7177 snapContext.setSnapLocations(['top-left', 'bottom-right', 'mid']);
7183 shapeMid = mid(shape, event);
7187 height: shape.height,
7188 x: isNaN(shape.x) ? round(shapeMid.x - shape.width / 2) : shape.x,
7189 y: isNaN(shape.y) ? round(shapeMid.y - shape.height / 2) : shape.y,
7192 shapeTopLeft = topLeft(shapeBounds);
7193 shapeBottomRight = bottomRight(shapeBounds);
7195 snapContext.setSnapOrigin('top-left', {
7196 x: shapeTopLeft.x - event.x,
7197 y: shapeTopLeft.y - event.y
7200 snapContext.setSnapOrigin('bottom-right', {
7201 x: shapeBottomRight.x - event.x,
7202 y: shapeBottomRight.y - event.y
7206 forEach(shape.outgoing, function(c) {
7207 var docking = c.waypoints[0];
7209 docking = docking.original || docking;
7211 snapContext.setSnapOrigin(c.id + '-docking', {
7212 x: docking.x - event.x,
7213 y: docking.y - event.y
7217 forEach(shape.incoming, function(c) {
7218 var docking = c.waypoints[c.waypoints.length - 1];
7220 docking = docking.original || docking;
7222 snapContext.setSnapOrigin(c.id + '-docking', {
7223 x: docking.x - event.x,
7224 y: docking.y - event.y
7230 var source = context.source;
7233 snapContext.addDefaultSnap('mid', mid(source));
7238 BpmnSnapping.prototype.addTargetSnaps = function(snapPoints, shape, target) {
7240 var siblings = this.getSiblings(shape, target);
7243 forEach(siblings, function(s) {
7244 snapPoints.add('mid', mid(s));
7246 if (is(s, 'bpmn:Participant')) {
7247 snapPoints.add('top-left', topLeft(s));
7248 snapPoints.add('bottom-right', bottomRight(s));
7252 forEach(shape.incoming, function(c) {
7254 if (siblings.indexOf(c.source) === -1) {
7255 snapPoints.add('mid', mid(c.source));
7257 var docking = c.waypoints[0];
7258 snapPoints.add(c.id + '-docking', docking.original || docking);
7263 forEach(shape.outgoing, function(c) {
7265 if (siblings.indexOf(c.target) === -1) {
7266 snapPoints.add('mid', mid(c.target));
7268 var docking = c.waypoints[c.waypoints.length - 1];
7269 snapPoints.add(c.id + '-docking', docking.original || docking);
7275 "../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
7276 "../modeling/ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
7277 "diagram-js/lib/features/snapping/SnapUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js",
7278 "diagram-js/lib/features/snapping/Snapping": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\Snapping.js",
7279 "diagram-js/lib/util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
7280 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
7281 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
7283 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\snapping\\index.js": [function(require, module, exports) {
7285 __init__: ['snapping'],
7286 snapping: ['type', require('./BpmnSnapping')]
7289 "./BpmnSnapping": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\snapping\\BpmnSnapping.js"
7291 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnImporter.js": [function(require, module, exports) {
7294 var assign = require('lodash/object/assign'),
7295 map = require('lodash/collection/map');
7297 var LabelUtil = require('../util/LabelUtil');
7299 var hasExternalLabel = LabelUtil.hasExternalLabel,
7300 getExternalLabelBounds = LabelUtil.getExternalLabelBounds,
7301 isExpanded = require('../util/DiUtil').isExpanded,
7302 elementToString = require('./Util').elementToString;
7305 function elementData(semantic, attrs) {
7308 type: semantic.$type,
7309 businessObject: semantic
7313 function collectWaypoints(waypoints) {
7314 return map(waypoints, function(p) {
7324 * An importer that adds bpmn elements to the canvas
7330 * @param {ElementFactory}
7332 * @param {ElementRegistry}
7335 function BpmnImporter(eventBus, canvas, elementFactory, elementRegistry) {
7336 this._eventBus = eventBus;
7337 this._canvas = canvas;
7339 this._elementFactory = elementFactory;
7340 this._elementRegistry = elementRegistry;
7343 BpmnImporter.$inject = ['eventBus', 'canvas', 'elementFactory', 'elementRegistry'];
7345 module.exports = BpmnImporter;
7349 * Add bpmn element (semantic) to the canvas onto the specified parent shape.
7351 BpmnImporter.prototype.add = function(semantic, parentElement) {
7353 var di = semantic.di,
7357 // handle the special case that we deal with a
7358 // invisible root element (process or collaboration)
7359 if (di.$instanceOf('bpmndi:BPMNPlane')) {
7361 // add a virtual element (not being drawn)
7362 element = this._elementFactory.createRoot(elementData(semantic));
7364 this._canvas.setRootElement(element);
7368 else if (di.$instanceOf('bpmndi:BPMNShape')) {
7370 var collapsed = !isExpanded(semantic);
7371 var hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
7373 var bounds = semantic.di.bounds;
7375 element = this._elementFactory.createShape(elementData(semantic, {
7376 collapsed: collapsed,
7378 x: Math.round(bounds.x),
7379 y: Math.round(bounds.y),
7380 width: Math.round(bounds.width),
7381 height: Math.round(bounds.height)
7384 this._canvas.addShape(element, parentElement);
7388 else if (di.$instanceOf('bpmndi:BPMNEdge')) {
7390 var source = this._getSource(semantic),
7391 target = this._getTarget(semantic);
7393 element = this._elementFactory.createConnection(elementData(semantic, {
7396 waypoints: collectWaypoints(semantic.di.waypoint)
7399 this._canvas.addConnection(element, parentElement);
7401 throw new Error('unknown di ' + elementToString(di) + ' for element ' + elementToString(semantic));
7405 if (hasExternalLabel(semantic)) {
7406 this.addLabel(semantic, element);
7410 this._eventBus.fire('bpmnElement.added', {
7419 * add label for an element
7421 BpmnImporter.prototype.addLabel = function(semantic, element) {
7422 var bounds = getExternalLabelBounds(semantic, element);
7424 var label = this._elementFactory.createLabel(elementData(semantic, {
7425 id: semantic.id + '_label',
7426 labelTarget: element,
7428 hidden: element.hidden,
7429 x: Math.round(bounds.x),
7430 y: Math.round(bounds.y),
7431 width: Math.round(bounds.width),
7432 height: Math.round(bounds.height)
7435 return this._canvas.addShape(label, element.parent);
7439 * Return the drawn connection end based on the given side.
7442 * if the end is not yet drawn
7444 BpmnImporter.prototype._getEnd = function(semantic, side) {
7448 type = semantic.$type;
7450 refSemantic = semantic[side + 'Ref'];
7452 // handle mysterious isMany DataAssociation#sourceRef
7453 if (side === 'source' && type === 'bpmn:DataInputAssociation') {
7454 refSemantic = refSemantic && refSemantic[0];
7457 // fix source / target for DataInputAssociation / DataOutputAssociation
7458 if (side === 'source' && type === 'bpmn:DataOutputAssociation' ||
7459 side === 'target' && type === 'bpmn:DataInputAssociation') {
7461 refSemantic = semantic.$parent;
7464 element = refSemantic && this._getElement(refSemantic);
7472 'element ' + elementToString(refSemantic) + ' referenced by ' +
7473 elementToString(semantic) + '#' + side + 'Ref not yet drawn');
7475 throw new Error(elementToString(semantic) + '#' + side + 'Ref not specified');
7479 BpmnImporter.prototype._getSource = function(semantic) {
7480 return this._getEnd(semantic, 'source');
7483 BpmnImporter.prototype._getTarget = function(semantic) {
7484 return this._getEnd(semantic, 'target');
7488 BpmnImporter.prototype._getElement = function(semantic) {
7489 return this._elementRegistry.get(semantic.id);
7493 "../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
7494 "../util/LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js",
7495 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Util.js",
7496 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js",
7497 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
7499 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnTreeWalker.js": [function(require, module, exports) {
7502 var filter = require('lodash/collection/filter'),
7503 find = require('lodash/collection/find'),
7504 forEach = require('lodash/collection/forEach');
7506 var Refs = require('object-refs');
7508 var elementToString = require('./Util').elementToString;
7510 var diRefs = new Refs({
7511 name: 'bpmnElement',
7518 * Returns true if an element has the given meta-model type
7520 * @param {ModdleElement}
7527 function is(element, type) {
7528 return element.$instanceOf(type);
7533 * Find a suitable display candidate for definitions where the DI does not
7534 * correctly specify one.
7536 function findDisplayCandidate(definitions) {
7537 return find(definitions.rootElements, function(e) {
7538 return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration');
7543 function BpmnTreeWalker(handler) {
7545 // list of containers already walked
7546 var handledProcesses = [];
7548 // list of elements to handle deferred to ensure
7549 // prerequisites are drawn
7552 // /// Helpers /////////////////////////////////
7554 function contextual(fn, ctx) {
7555 return function(e) {
7560 function visit(element, ctx) {
7562 var gfx = element.gfx;
7564 // avoid multiple rendering of elements
7566 throw new Error('already rendered ' + elementToString(element));
7570 return handler.element(element, ctx);
7573 function visitRoot(element, diagram) {
7574 return handler.root(element, diagram);
7577 function visitIfDi(element, ctx) {
7579 return element.di && visit(element, ctx);
7581 logError(e.message, {
7586 console.error('failed to import ' + elementToString(element));
7591 function logError(message, context) {
7592 handler.error(message, context);
7595 // //// DI handling ////////////////////////////
7597 function registerDi(di) {
7598 var bpmnElement = di.bpmnElement;
7601 if (bpmnElement.di) {
7602 logError('multiple DI elements defined for ' + elementToString(bpmnElement), {
7603 element: bpmnElement
7606 diRefs.bind(bpmnElement, 'di');
7607 bpmnElement.di = di;
7610 logError('no bpmnElement referenced in ' + elementToString(di), {
7616 function handleDiagram(diagram) {
7617 handlePlane(diagram.plane);
7620 function handlePlane(plane) {
7623 forEach(plane.planeElement, handlePlaneElement);
7626 function handlePlaneElement(planeElement) {
7627 registerDi(planeElement);
7631 // //// Semantic handling //////////////////////
7633 function handleDefinitions(definitions, diagram) {
7634 // make sure we walk the correct bpmnElement
7636 var diagrams = definitions.diagrams;
7638 if (diagram && diagrams.indexOf(diagram) === -1) {
7639 throw new Error('diagram not part of bpmn:Definitions');
7642 if (!diagram && diagrams && diagrams.length) {
7643 diagram = diagrams[0];
7646 // no diagram -> nothing to import
7651 // load DI from selected diagram only
7652 handleDiagram(diagram);
7655 var plane = diagram.plane;
7658 throw new Error('no plane for ' + elementToString(diagram));
7662 var rootElement = plane.bpmnElement;
7664 // ensure we default to a suitable display candidate (process or
7666 // even if non is specified in DI
7668 rootElement = findDisplayCandidate(definitions);
7671 return logError('no process or collaboration present to display');
7674 logError('correcting missing bpmnElement on ' + elementToString(plane) + ' to ' + elementToString(rootElement));
7676 // correct DI on the fly
7677 plane.bpmnElement = rootElement;
7683 var ctx = visitRoot(rootElement, plane);
7685 if (is(rootElement, 'bpmn:Process')) {
7686 handleProcess(rootElement, ctx);
7687 } else if (is(rootElement, 'bpmn:Collaboration')) {
7688 handleCollaboration(rootElement, ctx);
7690 // force drawing of everything not yet drawn that is part of the target
7692 handleUnhandledProcesses(definitions.rootElements, ctx);
7694 throw new Error('unsupported bpmnElement for ' + elementToString(plane) + ' : ' + elementToString(rootElement));
7697 // handle all deferred elements
7698 handleDeferred(deferred);
7701 function handleDeferred(deferred) {
7702 forEach(deferred, function(d) {
7707 function handleProcess(process, context) {
7708 handleFlowElementsContainer(process, context);
7709 handleIoSpecification(process.ioSpecification, context);
7711 handleArtifacts(process.artifacts, context);
7713 // log process handled
7714 handledProcesses.push(process);
7717 function handleUnhandledProcesses(rootElements) {
7719 // walk through all processes that have not yet been drawn and draw them
7720 // if they contain lanes with DI information.
7721 // we do this to pass the free-floating lane test cases in the MIWG test
7723 var processes = filter(rootElements, function(e) {
7724 return is(e, 'bpmn:Process') && e.laneSets && handledProcesses.indexOf(e) === -1;
7727 processes.forEach(contextual(handleProcess));
7730 function handleMessageFlow(messageFlow, context) {
7731 visitIfDi(messageFlow, context);
7734 function handleMessageFlows(messageFlows, context) {
7735 forEach(messageFlows, contextual(handleMessageFlow, context));
7738 function handleDataAssociation(association, context) {
7739 visitIfDi(association, context);
7742 function handleDataInput(dataInput, context) {
7743 visitIfDi(dataInput, context);
7746 function handleDataOutput(dataOutput, context) {
7747 visitIfDi(dataOutput, context);
7750 function handleArtifact(artifact, context) {
7752 // bpmn:TextAnnotation
7756 visitIfDi(artifact, context);
7759 function handleArtifacts(artifacts, context) {
7761 forEach(artifacts, function(e) {
7762 if (is(e, 'bpmn:Association')) {
7763 deferred.push(function() {
7764 handleArtifact(e, context);
7767 handleArtifact(e, context);
7772 function handleIoSpecification(ioSpecification, context) {
7774 if (!ioSpecification) {
7778 forEach(ioSpecification.dataInputs, contextual(handleDataInput, context));
7779 forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
7782 function handleSubProcess(subProcess, context) {
7783 handleFlowElementsContainer(subProcess, context);
7784 handleArtifacts(subProcess.artifacts, context);
7787 function handleFlowNode(flowNode, context) {
7788 var childCtx = visitIfDi(flowNode, context);
7790 if (is(flowNode, 'bpmn:SubProcess')) {
7791 handleSubProcess(flowNode, childCtx || context);
7795 function handleSequenceFlow(sequenceFlow, context) {
7796 visitIfDi(sequenceFlow, context);
7799 function handleDataElement(dataObject, context) {
7800 visitIfDi(dataObject, context);
7803 function handleBoundaryEvent(dataObject, context) {
7804 visitIfDi(dataObject, context);
7807 function handleLane(lane, context) {
7808 var newContext = visitIfDi(lane, context);
7810 if (lane.childLaneSet) {
7811 handleLaneSet(lane.childLaneSet, newContext || context);
7813 var filterList = filter(lane.flowNodeRef, function(e) {
7814 return e.$type !== 'bpmn:BoundaryEvent';
7816 handleFlowElements(filterList, newContext || context);
7820 function handleLaneSet(laneSet, context) {
7821 forEach(laneSet.lanes, contextual(handleLane, context));
7824 function handleLaneSets(laneSets, context) {
7825 forEach(laneSets, contextual(handleLaneSet, context));
7828 function handleFlowElementsContainer(container, context) {
7830 if (container.laneSets) {
7831 handleLaneSets(container.laneSets, context);
7832 handleNonFlowNodes(container.flowElements);
7834 handleFlowElements(container.flowElements, context);
7838 function handleNonFlowNodes(flowElements, context) {
7839 forEach(flowElements, function(e) {
7840 if (is(e, 'bpmn:SequenceFlow')) {
7841 deferred.push(function() {
7842 handleSequenceFlow(e, context);
7844 } else if (is(e, 'bpmn:BoundaryEvent')) {
7845 deferred.unshift(function() {
7846 handleBoundaryEvent(e, context);
7848 } else if (is(e, 'bpmn:DataObject')) {
7849 // SKIP (assume correct referencing via DataObjectReference)
7850 } else if (is(e, 'bpmn:DataStoreReference')) {
7851 handleDataElement(e, context);
7852 } else if (is(e, 'bpmn:DataObjectReference')) {
7853 handleDataElement(e, context);
7858 function handleFlowElements(flowElements, context) {
7859 forEach(flowElements, function(e) {
7860 if (is(e, 'bpmn:SequenceFlow')) {
7861 deferred.push(function() {
7862 handleSequenceFlow(e, context);
7864 } else if (is(e, 'bpmn:BoundaryEvent')) {
7865 deferred.unshift(function() {
7866 handleBoundaryEvent(e, context);
7868 } else if (is(e, 'bpmn:FlowNode')) {
7869 handleFlowNode(e, context);
7871 if (is(e, 'bpmn:Activity')) {
7873 handleIoSpecification(e.ioSpecification, context);
7875 // defer handling of associations
7876 deferred.push(function() {
7877 forEach(e.dataInputAssociations, contextual(handleDataAssociation, context));
7878 forEach(e.dataOutputAssociations, contextual(handleDataAssociation, context));
7881 } else if (is(e, 'bpmn:DataObject')) {
7882 // SKIP (assume correct referencing via DataObjectReference)
7883 } else if (is(e, 'bpmn:DataStoreReference')) {
7884 handleDataElement(e, context);
7885 } else if (is(e, 'bpmn:DataObjectReference')) {
7886 handleDataElement(e, context);
7889 'unrecognized flowElement ' + elementToString(e) + ' in context ' +
7890 (context ? elementToString(context.businessObject) : null), {
7898 function handleParticipant(participant, context) {
7899 var newCtx = visitIfDi(participant, context);
7901 var process = participant.processRef;
7903 handleProcess(process, newCtx || context);
7907 function handleCollaboration(collaboration) {
7909 forEach(collaboration.participants, contextual(handleParticipant));
7911 handleArtifacts(collaboration.artifacts);
7913 // handle message flows latest in the process
7914 deferred.push(function() {
7915 handleMessageFlows(collaboration.messageFlows);
7920 // /// API ////////////////////////////////
7923 handleDefinitions: handleDefinitions
7927 module.exports = BpmnTreeWalker;
7929 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Util.js",
7930 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
7931 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
7932 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
7933 "object-refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\index.js"
7935 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Importer.js": [function(require, module, exports) {
7938 var BpmnTreeWalker = require('./BpmnTreeWalker');
7942 * Import the definitions into a diagram.
7944 * Errors and warnings are reported through the specified callback.
7948 * @param {ModdleElement}
7951 * done the callback, invoked with (err, [ warning ]) once the import
7954 function importBpmnDiagram(diagram, definitions, done) {
7956 var importer = diagram.get('bpmnImporter'),
7957 eventBus = diagram.get('eventBus');
7962 function parse(definitions) {
7966 root: function(element) {
7967 return importer.add(element);
7970 element: function(element, parentShape) {
7971 return importer.add(element, parentShape);
7974 error: function(message, context) {
7982 var walker = new BpmnTreeWalker(visitor);
7985 walker.handleDefinitions(definitions);
7988 eventBus.fire('import.start');
7996 eventBus.fire(error ? 'import.error' : 'import.success', {
8000 done(error, warnings);
8003 module.exports.importBpmnDiagram = importBpmnDiagram;
8005 "./BpmnTreeWalker": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnTreeWalker.js"
8007 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Util.js": [function(require, module, exports) {
8010 module.exports.elementToString = function(e) {
8015 return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
8018 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\index.js": [function(require, module, exports) {
8020 bpmnImporter: ['type', require('./BpmnImporter')]
8023 "./BpmnImporter": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnImporter.js"
8025 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js": [function(require, module, exports) {
8028 var is = require('./ModelUtil').is,
8029 getBusinessObject = require('./ModelUtil').getBusinessObject;
8031 module.exports.isExpanded = function(element) {
8033 if (is(element, 'bpmn:CallActivity')) {
8037 if (is(element, 'bpmn:SubProcess')) {
8038 return getBusinessObject(element).di.isExpanded;
8041 if (is(element, 'bpmn:Participant')) {
8042 return !!getBusinessObject(element).processRef;
8049 "./ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js"
8051 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js": [function(require, module, exports) {
8054 var assign = require('lodash/object/assign');
8057 var DEFAULT_LABEL_SIZE = module.exports.DEFAULT_LABEL_SIZE = {
8064 * Returns true if the given semantic has an external label
8066 * @param {BpmnElement}
8068 * @return {Boolean} true if has label
8070 module.exports.hasExternalLabel = function(semantic) {
8072 return semantic.$instanceOf('bpmn:Event') ||
8073 // semantic.$instanceOf('bpmn:Gateway') ||
8074 semantic.$instanceOf('bpmn:DataStoreReference') ||
8075 semantic.$instanceOf('bpmn:DataObjectReference') ||
8076 semantic.$instanceOf('bpmn:SequenceFlow') ||
8077 semantic.$instanceOf('bpmn:MessageFlow');
8082 * Get the middle of a number of waypoints
8085 * <Point>} waypoints
8086 * @return {Point} the mid point
8088 var getWaypointsMid = module.exports.getWaypointsMid = function(waypoints) {
8090 var mid = waypoints.length / 2 - 1;
8092 var first = waypoints[Math.floor(mid)];
8093 var second = waypoints[Math.ceil(mid + 0.01)];
8096 x: first.x + (second.x - first.x) / 2,
8097 y: first.y + (second.y - first.y) / 2
8102 var getExternalLabelMid = module.exports.getExternalLabelMid = function(element) {
8104 if (element.waypoints) {
8105 return getWaypointsMid(element.waypoints);
8108 x: element.x + element.width / 2,
8109 y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2
8115 * Returns the bounds of an elements label, parsed from the elements DI or
8116 * generated from its bounds.
8118 * @param {BpmnElement}
8120 * @param {djs.model.Base}
8123 module.exports.getExternalLabelBounds = function(semantic, element) {
8131 if (label && label.bounds) {
8132 bounds = label.bounds;
8135 width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
8136 height: bounds.height
8140 x: bounds.x + bounds.width / 2,
8141 y: bounds.y + bounds.height / 2
8145 mid = getExternalLabelMid(element);
8147 size = DEFAULT_LABEL_SIZE;
8151 x: mid.x - size.width / 2,
8152 y: mid.y - size.height / 2
8156 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
8158 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js": [function(require, module, exports) {
8162 * Is an element of the given BPMN type?
8164 * @param {djs.model.Base|ModdleElement}
8171 function is(element, type) {
8172 var bo = getBusinessObject(element);
8174 return bo && bo.$instanceOf(type);
8177 module.exports.is = is;
8181 * Return the business object for a given element.
8183 * @param {djs.model.Base|ModdleElement}
8186 * @return {ModdleElement}
8188 function getBusinessObject(element) {
8189 return (element && element.businessObject) || element;
8192 module.exports.getBusinessObject = getBusinessObject;
8195 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\index.js": [function(require, module, exports) {
8196 module.exports = require('./lib/simple');
8198 "./lib/simple": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\simple.js"
8200 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\bpmn-moddle.js": [function(require, module, exports) {
8203 var isString = require('lodash/lang/isString'),
8204 isFunction = require('lodash/lang/isFunction'),
8205 assign = require('lodash/object/assign');
8207 var Moddle = require('moddle'),
8208 XmlReader = require('moddle-xml/lib/reader'),
8209 XmlWriter = require('moddle-xml/lib/writer');
8212 * A sub class of {@link Moddle} with support for import and export of BPMN 2.0
8218 * @param {Object|Array}
8219 * packages to use for instantiating the model
8221 * [options] additional options to pass over
8223 function BpmnModdle(packages, options) {
8224 Moddle.call(this, packages, options);
8227 BpmnModdle.prototype = Object.create(Moddle.prototype);
8229 module.exports = BpmnModdle;
8233 * Instantiates a BPMN model tree from a given xml string.
8238 * [typeName='bpmn:Definitions'] name of the root element
8240 * [options] options to pass to the underlying reader
8242 * done callback that is invoked with (err, result, parseContext)
8243 * once the import completes
8245 BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options, done) {
8247 if (!isString(typeName)) {
8250 typeName = 'bpmn:Definitions';
8253 if (isFunction(options)) {
8258 var reader = new XmlReader(assign({
8262 var rootHandler = reader.handler(typeName);
8264 reader.fromXML(xmlStr, rootHandler, done);
8269 * Serializes a BPMN 2.0 object tree to XML.
8272 * element the root element, typically an instance of
8273 * `bpmn:Definitions`
8275 * [options] to pass to the underlying writer
8277 * done callback invoked with (err, xmlStr) once the import completes
8283 BpmnModdle.prototype.toXML = function(element, options, done) {
8285 if (isFunction(options)) {
8290 var writer = new XmlWriter(options);
8292 var result = writer.toXML(element);
8294 list_models[selected_model] = result;
8302 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
8303 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
8304 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
8305 "moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\index.js",
8306 "moddle-xml/lib/reader": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\reader.js",
8307 "moddle-xml/lib/writer": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\writer.js"
8309 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\id-support.js": [function(require, module, exports) {
8312 var ID_PATTERN = /^(.*:)?id$/;
8315 * Extends the bpmn instance with id support.
8321 * require('id-support').extend(moddle, ids);
8323 * moddle.ids.next(); // create a next id moddle.ids; // ids instance
8324 * // claims id as used moddle.create('foo:Bar', { id: 'fooobar1' });
8332 * @return {Moddle} the extended moddle instance
8334 module.exports.extend = function(model, ids) {
8336 var set = model.properties.set;
8338 // do not reinitialize setter
8339 // unless it is already initialized
8342 model.properties.set = function(target, property, value) {
8344 // ensure we log used ids once they are assigned
8345 // to model elements
8346 if (ID_PATTERN.test(property)) {
8348 var assigned = model.ids.assigned(value);
8349 if (assigned && assigned !== target) {
8350 throw new Error('id <' + value + '> already used');
8353 model.ids.claim(value, target);
8356 set.call(this, target, property, value);
8365 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\simple.js": [function(require, module, exports) {
8368 var assign = require('lodash/object/assign');
8370 var BpmnModdle = require('./bpmn-moddle');
8373 bpmn: require('../resources/bpmn/json/bpmn.json'),
8374 bpmndi: require('../resources/bpmn/json/bpmndi.json'),
8375 dc: require('../resources/bpmn/json/dc.json'),
8376 di: require('../resources/bpmn/json/di.json')
8379 module.exports = function(additionalPackages, options) {
8380 return new BpmnModdle(assign({}, packages, additionalPackages), options);
8383 "../resources/bpmn/json/bpmn.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmn.json",
8384 "../resources/bpmn/json/bpmndi.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmndi.json",
8385 "../resources/bpmn/json/dc.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\dc.json",
8386 "../resources/bpmn/json/di.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\di.json",
8387 "./bpmn-moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\bpmn-moddle.js",
8388 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
8390 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\common.js": [function(require, module, exports) {
8393 function capitalize(string) {
8394 return string.charAt(0).toUpperCase() + string.slice(1);
8397 function lower(string) {
8398 return string.charAt(0).toLowerCase() + string.slice(1);
8401 function hasLowerCaseAlias(pkg) {
8402 return pkg.xml && pkg.xml.tagAlias === 'lowerCase';
8406 module.exports.aliasToName = function(alias, pkg) {
8407 if (hasLowerCaseAlias(pkg)) {
8408 return capitalize(alias);
8414 module.exports.nameToAlias = function(name, pkg) {
8415 if (hasLowerCaseAlias(pkg)) {
8422 module.exports.DEFAULT_NS_MAP = {
8423 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
8426 module.exports.XSI_TYPE = 'xsi:type';
8428 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\reader.js": [function(require, module, exports) {
8431 var reduce = require('lodash/collection/reduce'),
8432 forEach = require('lodash/collection/forEach'),
8433 find = require('lodash/collection/find'),
8434 assign = require('lodash/object/assign'),
8435 defer = require('lodash/function/defer');
8437 var Stack = require('tiny-stack'),
8438 SaxParser = require('sax').parser,
8439 Moddle = require('moddle'),
8440 parseNameNs = require('moddle/lib/ns').parseName,
8441 Types = require('moddle/lib/types'),
8442 coerceType = Types.coerceType,
8443 isSimpleType = Types.isSimple,
8444 common = require('./common'),
8445 XSI_TYPE = common.XSI_TYPE,
8446 XSI_URI = common.DEFAULT_NS_MAP.xsi,
8447 aliasToName = common.aliasToName;
8449 function parseNodeAttributes(node) {
8450 var nodeAttrs = node.attributes;
8452 return reduce(nodeAttrs, function(result, v, k) {
8458 ns = parseNameNs(v.name, v.prefix);
8462 result[name] = v.value;
8467 function normalizeType(node, attr, model) {
8468 var nameNs = parseNameNs(attr.value);
8470 var uri = node.ns[nameNs.prefix || ''],
8471 localName = nameNs.localName,
8472 pkg = uri && model.getPackage(uri),
8476 typePrefix = pkg.xml && pkg.xml.typePrefix;
8478 if (typePrefix && localName.indexOf(typePrefix) === 0) {
8479 localName = localName.slice(typePrefix.length);
8482 attr.value = pkg.prefix + ':' + localName;
8487 * Normalizes namespaces for a node given an optional default namespace and a
8488 * number of mappings from uris to default prefixes.
8493 * model the model containing all registered namespaces
8497 function normalizeNamespaces(node, model, defaultNsUri) {
8500 uri = node.uri || defaultNsUri;
8503 var pkg = model.getPackage(uri);
8506 prefix = pkg.prefix;
8508 prefix = node.prefix;
8511 node.prefix = prefix;
8515 forEach(node.attributes, function(attr) {
8517 // normalize xsi:type attributes because the
8518 // assigned type may or may not be namespace prefixed
8519 if (attr.uri === XSI_URI && attr.local === 'type') {
8520 normalizeType(node, attr, model);
8523 normalizeNamespaces(attr, model, null);
8535 * @param {ElementHandler}
8536 * options.parseRoot the root handler for parsing a document
8538 * [options.lax=false] whether or not to ignore invalid elements
8540 function Context(options) {
8543 * @property {ElementHandler} parseRoot
8547 * @property {Boolean} lax
8550 assign(this, options);
8552 var elementsById = this.elementsById = {};
8553 var references = this.references = [];
8554 var warnings = this.warnings = [];
8556 this.addReference = function(reference) {
8557 references.push(reference);
8560 this.addElement = function(id, element) {
8562 if (!id || !element) {
8563 throw new Error('[xml-reader] id or ctx must not be null');
8566 elementsById[id] = element;
8569 this.addWarning = function(w) {
8574 function BaseHandler() {}
8576 BaseHandler.prototype.handleEnd = function() {};
8577 BaseHandler.prototype.handleText = function() {};
8578 BaseHandler.prototype.handleNode = function() {};
8582 * A simple pass through handler that does nothing except for ignoring all input
8585 * This is used to ignore unknown elements and attributes.
8587 function NoopHandler() {}
8589 NoopHandler.prototype = new BaseHandler();
8591 NoopHandler.prototype.handleNode = function() {
8595 function BodyHandler() {}
8597 BodyHandler.prototype = new BaseHandler();
8599 BodyHandler.prototype.handleText = function(text) {
8600 this.body = (this.body || '') + text;
8603 function ReferenceHandler(property, context) {
8604 this.property = property;
8605 this.context = context;
8608 ReferenceHandler.prototype = new BodyHandler();
8610 ReferenceHandler.prototype.handleNode = function(node) {
8613 throw new Error('expected no sub nodes');
8615 this.element = this.createReference(node);
8621 ReferenceHandler.prototype.handleEnd = function() {
8622 this.element.id = this.body;
8625 ReferenceHandler.prototype.createReference = function() {
8627 property: this.property.ns.name,
8632 function ValueHandler(propertyDesc, element) {
8633 this.element = element;
8634 this.propertyDesc = propertyDesc;
8637 ValueHandler.prototype = new BodyHandler();
8639 ValueHandler.prototype.handleEnd = function() {
8641 var value = this.body,
8642 element = this.element,
8643 propertyDesc = this.propertyDesc;
8645 value = coerceType(propertyDesc.type, value);
8647 if (propertyDesc.isMany) {
8648 element.get(propertyDesc.name).push(value);
8650 element.set(propertyDesc.name, value);
8655 function BaseElementHandler() {}
8657 BaseElementHandler.prototype = Object.create(BodyHandler.prototype);
8659 BaseElementHandler.prototype.handleNode = function(node) {
8661 element = this.element,
8665 element = this.element = this.createElement(node);
8669 this.context.addElement(id, element);
8672 parser = this.handleChild(node);
8679 * @class XMLReader.ElementHandler
8682 function ElementHandler(model, type, context) {
8684 this.type = model.getType(type);
8685 this.context = context;
8688 ElementHandler.prototype = new BaseElementHandler();
8690 ElementHandler.prototype.addReference = function(reference) {
8691 this.context.addReference(reference);
8694 ElementHandler.prototype.handleEnd = function() {
8696 var value = this.body,
8697 element = this.element,
8698 descriptor = element.$descriptor,
8699 bodyProperty = descriptor.bodyProperty;
8701 if (bodyProperty && value !== undefined) {
8702 value = coerceType(bodyProperty.type, value);
8703 element.set(bodyProperty.name, value);
8708 * Create an instance of the model from the given node.
8713 ElementHandler.prototype.createElement = function(node) {
8714 var attributes = parseNodeAttributes(node),
8716 descriptor = Type.$descriptor,
8717 context = this.context,
8718 instance = new Type({});
8720 forEach(attributes, function(value, name) {
8722 var prop = descriptor.propertiesByName[name];
8724 if (prop && prop.isReference) {
8725 context.addReference({
8727 property: prop.ns.name,
8732 value = coerceType(prop.type, value);
8735 instance.set(name, value);
8742 ElementHandler.prototype.getPropertyForNode = function(node) {
8744 var nameNs = parseNameNs(node.local, node.prefix);
8746 var type = this.type,
8748 descriptor = type.$descriptor;
8750 var propertyName = nameNs.name,
8751 property = descriptor.propertiesByName[propertyName],
8756 // search for properties by name first
8760 if (property.serialize === XSI_TYPE) {
8761 typeAnnotation = node.attributes[XSI_TYPE];
8763 // xsi type is optional, if it does not exists the
8764 // default type is assumed
8765 if (typeAnnotation) {
8767 elementTypeName = typeAnnotation.value;
8769 // TODO: extract real name from attribute
8770 elementType = model.getType(elementTypeName);
8772 return assign({}, property, {
8773 effectiveType: elementType.$descriptor.name
8778 // search for properties by name first
8783 var pkg = model.getPackage(nameNs.prefix);
8786 elementTypeName = nameNs.prefix + ':' + aliasToName(nameNs.localName, descriptor.$pkg);
8787 elementType = model.getType(elementTypeName);
8789 // search for collection members later
8790 property = find(descriptor.properties, function(p) {
8791 return !p.isVirtual && !p.isReference && !p.isAttribute && elementType.hasType(p.type);
8795 return assign({}, property, {
8796 effectiveType: elementType.$descriptor.name
8800 // parse unknown element (maybe extension)
8801 property = find(descriptor.properties, function(p) {
8802 return !p.isReference && !p.isAttribute && p.type === 'Element';
8810 throw new Error('unrecognized element <' + nameNs.name + '>');
8813 ElementHandler.prototype.toString = function() {
8814 return 'ElementDescriptor[' + this.type.$descriptor.name + ']';
8817 ElementHandler.prototype.valueHandler = function(propertyDesc, element) {
8818 return new ValueHandler(propertyDesc, element);
8821 ElementHandler.prototype.referenceHandler = function(propertyDesc) {
8822 return new ReferenceHandler(propertyDesc, this.context);
8825 ElementHandler.prototype.handler = function(type) {
8826 if (type === 'Element') {
8827 return new GenericElementHandler(this.model, type, this.context);
8829 return new ElementHandler(this.model, type, this.context);
8834 * Handle the child element parsing
8839 ElementHandler.prototype.handleChild = function(node) {
8840 var propertyDesc, type, element, childHandler;
8842 propertyDesc = this.getPropertyForNode(node);
8843 element = this.element;
8845 type = propertyDesc.effectiveType || propertyDesc.type;
8847 if (isSimpleType(type)) {
8848 return this.valueHandler(propertyDesc, element);
8851 if (propertyDesc.isReference) {
8852 childHandler = this.referenceHandler(propertyDesc).handleNode(node);
8854 childHandler = this.handler(type).handleNode(node);
8857 var newElement = childHandler.element;
8859 // child handles may decide to skip elements
8860 // by not returning anything
8861 if (newElement !== undefined) {
8863 if (propertyDesc.isMany) {
8864 element.get(propertyDesc.name).push(newElement);
8866 element.set(propertyDesc.name, newElement);
8869 if (propertyDesc.isReference) {
8870 assign(newElement, {
8874 this.context.addReference(newElement);
8876 // establish child -> parent relationship
8877 newElement.$parent = element;
8881 return childHandler;
8885 function GenericElementHandler(model, type, context) {
8887 this.context = context;
8890 GenericElementHandler.prototype = Object.create(BaseElementHandler.prototype);
8892 GenericElementHandler.prototype.createElement = function(node) {
8894 var name = node.name,
8895 prefix = node.prefix,
8896 uri = node.ns[prefix],
8897 attributes = node.attributes;
8899 return this.model.createAny(name, uri, attributes);
8902 GenericElementHandler.prototype.handleChild = function(node) {
8904 var handler = new GenericElementHandler(this.model, 'Element', this.context).handleNode(node),
8905 element = this.element;
8907 var newElement = handler.element,
8910 if (newElement !== undefined) {
8911 children = element.$children = element.$children || [];
8912 children.push(newElement);
8914 // establish child -> parent relationship
8915 newElement.$parent = element;
8921 GenericElementHandler.prototype.handleText = function(text) {
8922 this.body = this.body || '' + text;
8925 GenericElementHandler.prototype.handleEnd = function() {
8927 this.element.$body = this.body;
8932 * A reader for a meta-model
8937 * options.model used to read xml files
8939 * options.lax whether to make parse errors warnings
8941 function XMLReader(options) {
8943 if (options instanceof Moddle) {
8955 XMLReader.prototype.fromXML = function(xml, rootHandler, done) {
8957 var model = this.model,
8959 context = new Context({
8960 parseRoot: rootHandler
8963 var parser = new SaxParser(true, {
8967 stack = new Stack();
8969 rootHandler.context = context;
8971 // push root handler
8972 stack.push(rootHandler);
8975 function resolveReferences() {
8977 var elementsById = context.elementsById;
8978 var references = context.references;
8982 for (i = 0; !!(r = references[i]); i++) {
8983 var element = r.element;
8984 var reference = elementsById[r.id];
8985 var property = element.$descriptor.propertiesByName[r.property];
8988 context.addWarning({
8989 message: 'unresolved reference <' + r.id + '>',
8991 property: r.property,
8996 if (property.isMany) {
8997 var collection = element.get(property.name),
8998 idx = collection.indexOf(r);
9001 // remove unresolvable reference
9002 collection.splice(idx, 1);
9005 collection[idx] = reference;
9008 element.set(property.name, reference);
9013 function handleClose(tagName) {
9014 stack.pop().handleEnd();
9017 function handleOpen(node) {
9018 var handler = stack.peek();
9020 normalizeNamespaces(node, model);
9023 stack.push(handler.handleNode(node));
9026 var line = this.line,
9027 column = this.column;
9030 'unparsable content <' + node.name + '> detected\n\t' +
9031 'line: ' + line + '\n\t' +
9032 'column: ' + column + '\n\t' +
9033 'nested error: ' + e.message;
9036 context.addWarning({
9041 console.warn('could not parse node');
9044 stack.push(new NoopHandler());
9046 console.error('could not parse document');
9049 throw new Error(message);
9054 function handleText(text) {
9055 stack.peek().handleText(text);
9058 parser.onopentag = handleOpen;
9059 parser.oncdata = parser.ontext = handleText;
9060 parser.onclosetag = handleClose;
9061 parser.onend = resolveReferences;
9063 // deferred parse XML to make loading really ascnchronous
9064 // this ensures the execution environment (node or browser)
9065 // is kept responsive and that certain optimization strategies
9071 parser.write(xml).close();
9076 done(error, error ? undefined : rootHandler.element, context);
9080 XMLReader.prototype.handler = function(name) {
9081 return new ElementHandler(this.model, name);
9084 module.exports = XMLReader;
9085 module.exports.ElementHandler = ElementHandler;
9087 "./common": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\common.js",
9088 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
9089 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
9090 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
9091 "lodash/function/defer": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\defer.js",
9092 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
9093 "moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\index.js",
9094 "moddle/lib/ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
9095 "moddle/lib/types": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js",
9096 "sax": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\node_modules\\sax\\lib\\sax.js",
9097 "tiny-stack": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\node_modules\\tiny-stack\\lib\\tiny-stack.js"
9099 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\writer.js": [function(require, module, exports) {
9102 var map = require('lodash/collection/map'),
9103 forEach = require('lodash/collection/forEach'),
9104 isString = require('lodash/lang/isString'),
9105 filter = require('lodash/collection/filter'),
9106 assign = require('lodash/object/assign');
9108 var Types = require('moddle/lib/types'),
9109 parseNameNs = require('moddle/lib/ns').parseName,
9110 common = require('./common'),
9111 nameToAlias = common.nameToAlias;
9113 var XML_PREAMBLE = '<?xml version="1.0" encoding="UTF-8"?>\n',
9114 ESCAPE_CHARS = /(<|>|'|"|&|\n\r|\n)/g,
9115 DEFAULT_NS_MAP = common.DEFAULT_NS_MAP,
9116 XSI_TYPE = common.XSI_TYPE;
9119 function nsName(ns) {
9123 return (ns.prefix ? ns.prefix + ':' : '') + ns.localName;
9127 function getElementNs(ns, descriptor) {
9128 if (descriptor.isGeneric) {
9129 return descriptor.name;
9132 localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg)
9137 function getPropertyNs(ns, descriptor) {
9139 localName: descriptor.ns.localName
9143 function getSerializableProperties(element) {
9144 var descriptor = element.$descriptor;
9146 return filter(descriptor.properties, function(p) {
9149 // do not serialize defaults
9150 if (!element.hasOwnProperty(name)) {
9154 var value = element[name];
9156 // do not serialize default equals
9157 if (value === p.default) {
9161 return p.isMany ? value.length : true;
9176 * Escape a string attribute to not contain any bad values (line breaks, '"',
9180 * str the string to escape
9181 * @return {String} the escaped string
9183 function escapeAttr(str) {
9185 // ensure we are handling strings here
9186 str = isString(str) ? str : '' + str;
9188 return str.replace(ESCAPE_CHARS, function(str) {
9189 return '&#' + ESCAPE_MAP[str] + ';';
9193 function filterAttributes(props) {
9194 return filter(props, function(p) {
9199 function filterContained(props) {
9200 return filter(props, function(p) {
9206 function ReferenceSerializer(parent, ns) {
9210 ReferenceSerializer.prototype.build = function(element) {
9211 this.element = element;
9215 ReferenceSerializer.prototype.serializeTo = function(writer) {
9218 .append('<' + nsName(this.ns) + '>' + this.element.id + '</' + nsName(this.ns) + '>')
9222 function BodySerializer() {}
9224 BodySerializer.prototype.serializeValue = BodySerializer.prototype.serializeTo = function(writer) {
9225 var escape = this.escape;
9228 writer.append('<![CDATA[');
9231 writer.append(this.value);
9234 writer.append(']]>');
9238 BodySerializer.prototype.build = function(prop, value) {
9241 if (prop.type === 'String' && ESCAPE_CHARS.test(value)) {
9248 function ValueSerializer(ns) {
9252 ValueSerializer.prototype = new BodySerializer();
9254 ValueSerializer.prototype.serializeTo = function(writer) {
9258 .append('<' + nsName(this.ns) + '>');
9260 this.serializeValue(writer);
9263 .append('</' + nsName(this.ns) + '>')
9267 function ElementSerializer(parent, ns) {
9271 this.parent = parent;
9275 ElementSerializer.prototype.build = function(element) {
9276 this.element = element;
9278 var otherAttrs = this.parseNsAttributes(element);
9281 this.ns = this.nsTagName(element.$descriptor);
9284 if (element.$descriptor.isGeneric) {
9285 this.parseGeneric(element);
9287 var properties = getSerializableProperties(element);
9289 this.parseAttributes(filterAttributes(properties));
9290 this.parseContainments(filterContained(properties));
9292 this.parseGenericAttributes(element, otherAttrs);
9298 ElementSerializer.prototype.nsTagName = function(descriptor) {
9299 var effectiveNs = this.logNamespaceUsed(descriptor.ns);
9300 return getElementNs(effectiveNs, descriptor);
9303 ElementSerializer.prototype.nsPropertyTagName = function(descriptor) {
9304 var effectiveNs = this.logNamespaceUsed(descriptor.ns);
9305 return getPropertyNs(effectiveNs, descriptor);
9308 ElementSerializer.prototype.isLocalNs = function(ns) {
9309 return ns.uri === this.ns.uri;
9312 ElementSerializer.prototype.nsAttributeName = function(element) {
9316 if (isString(element)) {
9317 ns = parseNameNs(element);
9323 var effectiveNs = this.logNamespaceUsed(ns);
9325 // strip prefix if same namespace like parent
9326 if (this.isLocalNs(effectiveNs)) {
9328 localName: ns.localName
9332 localName: ns.localName
9337 ElementSerializer.prototype.parseGeneric = function(element) {
9343 forEach(element, function(val, key) {
9345 if (key === '$body') {
9346 body.push(new BodySerializer().build({
9350 if (key === '$children') {
9351 forEach(val, function(child) {
9352 body.push(new ElementSerializer(self).build(child));
9355 if (key.indexOf('$') !== 0) {
9358 value: escapeAttr(val)
9365 * Parse namespaces and return a list of left over generic attributes
9369 * @return {Array<Object>}
9371 ElementSerializer.prototype.parseNsAttributes = function(element) {
9374 var genericAttrs = element.$attrs;
9376 var attributes = [];
9378 // parse namespace attributes first
9379 // and log them. push non namespace attributes to a list
9380 // and process them later
9381 forEach(genericAttrs, function(value, name) {
9382 var nameNs = parseNameNs(name);
9384 if (nameNs.prefix === 'xmlns') {
9386 prefix: nameNs.localName,
9390 if (!nameNs.prefix && nameNs.localName === 'xmlns') {
9405 ElementSerializer.prototype.parseGenericAttributes = function(element, attributes) {
9409 forEach(attributes, function(attr) {
9411 // do not serialize xsi:type attribute
9412 // it is set manually based on the actual implementation type
9413 if (attr.name === XSI_TYPE) {
9418 self.addAttribute(self.nsAttributeName(attr.name), attr.value);
9420 console.warn('[writer] missing namespace information for ', attr.name, '=', attr.value, 'on', element, e);
9425 ElementSerializer.prototype.parseContainments = function(properties) {
9429 element = this.element;
9431 forEach(properties, function(p) {
9432 var value = element.get(p.name),
9433 isReference = p.isReference,
9436 var ns = self.nsPropertyTagName(p);
9443 body.push(new BodySerializer().build(p, value[0]));
9445 if (Types.isSimple(p.type)) {
9446 forEach(value, function(v) {
9447 body.push(new ValueSerializer(ns).build(p, v));
9451 forEach(value, function(v) {
9452 body.push(new ReferenceSerializer(self, ns).build(v));
9455 // allow serialization via type
9456 // rather than element name
9457 var asType = p.serialize === XSI_TYPE;
9459 forEach(value, function(v) {
9463 serializer = new TypeSerializer(self, ns);
9465 serializer = new ElementSerializer(self);
9468 body.push(serializer.build(v));
9474 ElementSerializer.prototype.getNamespaces = function() {
9476 if (!this.namespaces) {
9484 this.namespaces = this.parent.getNamespaces();
9487 return this.namespaces;
9490 ElementSerializer.prototype.logNamespace = function(ns) {
9491 var namespaces = this.getNamespaces();
9493 var existing = namespaces.uriMap[ns.uri];
9496 namespaces.uriMap[ns.uri] = ns;
9499 namespaces.prefixMap[ns.prefix] = ns.uri;
9504 ElementSerializer.prototype.logNamespaceUsed = function(ns) {
9505 var element = this.element,
9506 model = element.$model,
9507 namespaces = this.getNamespaces();
9514 var prefix = ns.prefix;
9515 var uri = ns.uri || DEFAULT_NS_MAP[prefix] ||
9516 namespaces.prefixMap[prefix] || (model ? (model.getPackage(prefix) || {}).uri : null);
9519 throw new Error('no namespace uri given for prefix <' + ns.prefix + '>');
9522 ns = namespaces.uriMap[uri];
9525 ns = this.logNamespace({
9531 if (!namespaces.used[ns.uri]) {
9532 namespaces.used[ns.uri] = ns;
9538 ElementSerializer.prototype.parseAttributes = function(properties) {
9540 element = this.element;
9542 forEach(properties, function(p) {
9543 self.logNamespaceUsed(p.ns);
9545 var value = element.get(p.name);
9547 if (p.isReference) {
9551 self.addAttribute(self.nsAttributeName(p), value);
9555 ElementSerializer.prototype.addAttribute = function(name, value) {
9556 var attrs = this.attrs;
9558 if (isString(value)) {
9559 value = escapeAttr(value);
9568 ElementSerializer.prototype.serializeAttributes = function(writer) {
9569 var attrs = this.attrs,
9570 root = !this.parent,
9571 namespaces = this.namespaces;
9573 function collectNsAttrs() {
9574 return map(namespaces.used, function(ns) {
9575 var name = 'xmlns' + (ns.prefix ? ':' + ns.prefix : '');
9584 attrs = collectNsAttrs().concat(attrs);
9587 forEach(attrs, function(a) {
9590 .append(nsName(a.name)).append('="').append(a.value).append('"');
9594 ElementSerializer.prototype.serializeTo = function(writer) {
9595 var hasBody = this.body.length,
9596 indent = !(this.body.length === 1 && this.body[0] instanceof BodySerializer);
9600 .append('<' + nsName(this.ns));
9602 this.serializeAttributes(writer);
9604 writer.append(hasBody ? '>' : ' />');
9614 forEach(this.body, function(b) {
9615 b.serializeTo(writer);
9624 writer.append('</' + nsName(this.ns) + '>');
9627 writer.appendNewLine();
9631 * A serializer for types that handles serialization of data types
9633 function TypeSerializer(parent, ns) {
9634 ElementSerializer.call(this, parent, ns);
9637 TypeSerializer.prototype = new ElementSerializer();
9639 TypeSerializer.prototype.build = function(element) {
9640 var descriptor = element.$descriptor;
9642 this.element = element;
9644 this.typeNs = this.nsTagName(descriptor);
9646 // add xsi:type attribute to represent the elements
9649 var typeNs = this.typeNs,
9650 pkg = element.$model.getPackage(typeNs.uri),
9651 typePrefix = (pkg.xml && pkg.xml.typePrefix) || '';
9653 this.addAttribute(this.nsAttributeName(XSI_TYPE), (typeNs.prefix ? typeNs.prefix + ':' : '') +
9654 typePrefix + descriptor.ns.localName);
9656 // do the usual stuff
9657 return ElementSerializer.prototype.build.call(this, element);
9660 TypeSerializer.prototype.isLocalNs = function(ns) {
9661 return ns.uri === this.typeNs.uri;
9664 function SavingWriter() {
9667 this.write = function(str) {
9672 function FormatingWriter(out, format) {
9676 this.append = function(str) {
9682 this.appendNewLine = function() {
9690 this.appendIndent = function() {
9692 out.write(indent.join(' '));
9698 this.indent = function() {
9703 this.unindent = function() {
9710 * A writer for meta-model backed document trees
9713 * options output options to pass into the writer
9715 function XMLWriter(options) {
9722 function toXML(tree, writer) {
9723 var internalWriter = writer || new SavingWriter();
9724 var formatingWriter = new FormatingWriter(internalWriter, options.format);
9726 if (options.preamble) {
9727 formatingWriter.append(XML_PREAMBLE);
9730 new ElementSerializer().build(tree).serializeTo(formatingWriter);
9733 return internalWriter.value;
9742 module.exports = XMLWriter;
9744 "./common": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\common.js",
9745 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
9746 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
9747 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js",
9748 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
9749 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
9750 "moddle/lib/ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
9751 "moddle/lib/types": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js"
9753 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\node_modules\\sax\\lib\\sax.js": [function(require, module, exports) {
9755 // wrapper for non-node envs
9759 sax.parser = function(strict, opt) {
9760 return new SAXParser(strict, opt)
9762 sax.SAXParser = SAXParser
9763 sax.SAXStream = SAXStream
9764 sax.createStream = createStream
9766 // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer
9768 // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer
9770 // since that's the earliest that a buffer overrun could occur. This way, checks
9772 // as rare as required, but as often as necessary to ensure never crossing this
9774 // Furthermore, buffers are only tested at most once per write(), so passing a
9776 // large string into write() might have undesirable effects, but this is
9778 // the caller, so it is assumed to be safe. Thus, a call to write() may, in the
9780 // edge case, result in creating at most one complete copy of the string passed
9782 // Set to Infinity to have unlimited buffers.
9783 sax.MAX_BUFFER_LENGTH = 64 * 1024
9786 "comment", "sgmlDecl", "textNode", "tagName", "doctype",
9787 "procInstName", "procInstBody", "entity", "attribName",
9788 "attribValue", "cdata", "script"
9791 sax.EVENTS = // for discoverability.
9792 ["text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "attribute", "opentag", "closetag", "opencdata", "cdata", "closecdata", "error", "end", "ready", "script", "opennamespace", "closenamespace"]
9794 function SAXParser(strict, opt) {
9795 if (!(this instanceof SAXParser)) return new SAXParser(strict, opt)
9798 clearBuffers(parser)
9799 parser.q = parser.c = ""
9800 parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
9801 parser.opt = opt || {}
9802 parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
9803 parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase"
9805 parser.closed = parser.closedRoot = parser.sawRoot = false
9806 parser.tag = parser.error = null
9807 parser.strict = !!strict
9808 parser.noscript = !!(strict || parser.opt.noscript)
9809 parser.state = S.BEGIN
9810 parser.ENTITIES = Object.create(sax.ENTITIES)
9811 parser.attribList = []
9813 // namespaces form a prototype chain.
9814 // it always points at the current tag,
9815 // which protos to its parent tag.
9816 if (parser.opt.xmlns) parser.ns = Object.create(rootNS)
9818 // mostly just for error reporting
9819 parser.trackPosition = parser.opt.position !== false
9820 if (parser.trackPosition) {
9821 parser.position = parser.line = parser.column = 0
9823 emit(parser, "onready")
9826 if (!Object.create) Object.create = function(o) {
9834 if (!Object.getPrototypeOf) Object.getPrototypeOf = function(o) {
9838 if (!Object.keys) Object.keys = function(o) {
9841 if (o.hasOwnProperty(i)) a.push(i)
9845 function checkBufferLength(parser) {
9846 var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10),
9848 for (var i = 0, l = buffers.length; i < l; i++) {
9849 var len = parser[buffers[i]].length
9850 if (len > maxAllowed) {
9851 // Text/cdata nodes can get big, and since they're buffered,
9852 // we can get here under normal conditions.
9853 // Avoid issues by emitting the text node now,
9854 // so at least it won't get any bigger.
9855 switch (buffers[i]) {
9861 emitNode(parser, "oncdata", parser.cdata)
9866 emitNode(parser, "onscript", parser.script)
9871 error(parser, "Max buffer length exceeded: " + buffers[i])
9874 maxActual = Math.max(maxActual, len)
9876 // schedule the next check for the earliest possible buffer overrun.
9877 parser.bufferCheckPosition = (sax.MAX_BUFFER_LENGTH - maxActual) + parser.position
9880 function clearBuffers(parser) {
9881 for (var i = 0, l = buffers.length; i < l; i++) {
9882 parser[buffers[i]] = ""
9886 function flushBuffers(parser) {
9888 if (parser.cdata !== "") {
9889 emitNode(parser, "oncdata", parser.cdata)
9892 if (parser.script !== "") {
9893 emitNode(parser, "onscript", parser.script)
9898 SAXParser.prototype = {
9903 resume: function() {
9908 return this.write(null)
9916 var Stream = require("stream").Stream
9918 var Stream = function() {}
9922 var streamWraps = sax.EVENTS.filter(function(ev) {
9923 return ev !== "error" && ev !== "end"
9926 function createStream(strict, opt) {
9927 return new SAXStream(strict, opt)
9930 function SAXStream(strict, opt) {
9931 if (!(this instanceof SAXStream)) return new SAXStream(strict, opt)
9935 this._parser = new SAXParser(strict, opt)
9936 this.writable = true
9937 this.readable = true
9942 this._parser.onend = function() {
9946 this._parser.onerror = function(er) {
9947 me.emit("error", er)
9949 // if didn't throw, then means error was handled.
9950 // go ahead and clear error, so we can write again.
9951 me._parser.error = null
9954 this._decoder = null;
9956 streamWraps.forEach(function(ev) {
9957 Object.defineProperty(me, "on" + ev, {
9959 return me._parser["on" + ev]
9963 me.removeAllListeners(ev)
9964 return me._parser["on" + ev] = h
9974 SAXStream.prototype = Object.create(Stream.prototype, {
9980 SAXStream.prototype.write = function(data) {
9981 if (typeof Buffer === 'function' &&
9982 typeof Buffer.isBuffer === 'function' &&
9983 Buffer.isBuffer(data)) {
9984 if (!this._decoder) {
9985 var SD = require('string_decoder').StringDecoder
9986 this._decoder = new SD('utf8')
9988 data = this._decoder.write(data);
9991 this._parser.write(data.toString())
9992 this.emit("data", data)
9996 SAXStream.prototype.end = function(chunk) {
9997 if (chunk && chunk.length) this.write(chunk)
10002 SAXStream.prototype.on = function(ev, handler) {
10004 if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
10005 me._parser["on" + ev] = function() {
10006 var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
10007 args.splice(0, 0, ev)
10008 me.emit.apply(me, args)
10012 return Stream.prototype.on.call(me, ev, handler)
10017 // character classes and tokens
10018 var whitespace = "\r\n\t "
10019 // this really needs to be replaced with character classes.
10020 // XML allows all manner of ridiculous numbers and digits.
10022 number = "0124356789",
10023 letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
10024 // (Letter | "_" | ":")
10027 entity = number + letter + "#",
10028 attribEnd = whitespace + ">",
10030 DOCTYPE = "DOCTYPE",
10031 XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace",
10032 XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/",
10034 xml: XML_NAMESPACE,
10035 xmlns: XMLNS_NAMESPACE
10038 // turn all the string character sets into character class objects.
10039 whitespace = charClass(whitespace)
10040 number = charClass(number)
10041 letter = charClass(letter)
10043 // http://www.w3.org/TR/REC-xml/#NT-NameStartChar
10044 // This implementation works on strings, a single character at a time
10045 // as such, it cannot ever support astral-plane characters (10000-EFFFF)
10046 // without a significant breaking change to either this parser, or the
10047 // JavaScript language. Implementation of an emoji-capable xml parser
10048 // is left as an exercise for the reader.
10049 var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
10051 var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/
10053 quote = charClass(quote)
10054 entity = charClass(entity)
10055 attribEnd = charClass(attribEnd)
10057 function charClass(str) {
10058 return str.split("").reduce(function(s, c) {
10064 function isRegExp(c) {
10065 return Object.prototype.toString.call(c) === '[object RegExp]'
10068 function is(charclass, c) {
10069 return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]
10072 function not(charclass, c) {
10073 return !is(charclass, c)
10079 TEXT: S++ // general stuff
10081 TEXT_ENTITY: S++ // & and such.
10083 OPEN_WAKA: S++ // <
10085 SGML_DECL: S++ // <!BLARG
10087 SGML_DECL_QUOTED: S++ // <!BLARG foo "bar
10089 DOCTYPE: S++ // <!DOCTYPE
10091 DOCTYPE_QUOTED: S++ // <!DOCTYPE "//blah
10093 DOCTYPE_DTD: S++ // <!DOCTYPE "//blah" [ ...
10095 DOCTYPE_DTD_QUOTED: S++ // <!DOCTYPE "//blah" [ "foo
10097 COMMENT_STARTING: S++ // <!-
10099 COMMENT: S++ // <!--
10101 COMMENT_ENDING: S++ // <!-- blah -
10103 COMMENT_ENDED: S++ // <!-- blah --
10105 CDATA: S++ // <![CDATA[ something
10107 CDATA_ENDING: S++ // ]
10109 CDATA_ENDING_2: S++ // ]]
10111 PROC_INST: S++ // <?hi
10113 PROC_INST_BODY: S++ // <?hi there
10115 PROC_INST_ENDING: S++ // <?hi "there" ?
10117 OPEN_TAG: S++ // <strong
10119 OPEN_TAG_SLASH: S++ // <strong /
10123 ATTRIB_NAME: S++ // <a foo
10125 ATTRIB_NAME_SAW_WHITE: S++ // <a foo _
10127 ATTRIB_VALUE: S++ // <a foo=
10129 ATTRIB_VALUE_QUOTED: S++ // <a foo="bar
10131 ATTRIB_VALUE_CLOSED: S++ // <a foo="bar"
10133 ATTRIB_VALUE_UNQUOTED: S++ // <a foo=bar
10135 ATTRIB_VALUE_ENTITY_Q: S++ // <foo bar="""
10137 ATTRIB_VALUE_ENTITY_U: S++ // <foo bar="
10139 CLOSE_TAG: S++ // </a
10141 CLOSE_TAG_SAW_WHITE: S++ // </a >
10143 SCRIPT: S++ // <script> ...
10145 SCRIPT_ENDING: S++ // <script> ... <
10404 Object.keys(sax.ENTITIES).forEach(function(key) {
10405 var e = sax.ENTITIES[key]
10406 var s = typeof e === 'number' ? String.fromCharCode(e) : e
10407 sax.ENTITIES[key] = s
10410 for (var S in sax.STATE) sax.STATE[sax.STATE[S]] = S
10415 function emit(parser, event, data) {
10416 parser[event] && parser[event](data)
10419 function emitNode(parser, nodeType, data) {
10420 if (parser.textNode) closeText(parser)
10421 emit(parser, nodeType, data)
10424 function closeText(parser) {
10425 parser.textNode = textopts(parser.opt, parser.textNode)
10426 if (parser.textNode) emit(parser, "ontext", parser.textNode)
10427 parser.textNode = ""
10430 function textopts(opt, text) {
10431 if (opt.trim) text = text.trim()
10432 if (opt.normalize) text = text.replace(/\s+/g, " ")
10436 function error(parser, er) {
10438 if (parser.trackPosition) {
10439 er += "\nLine: " + parser.line +
10440 "\nColumn: " + parser.column +
10441 "\nChar: " + parser.c
10445 emit(parser, "onerror", er)
10449 function end(parser) {
10450 if (!parser.closedRoot) strictFail(parser, "Unclosed root tag")
10451 if ((parser.state !== S.BEGIN) && (parser.state !== S.TEXT)) error(parser, "Unexpected end")
10454 parser.closed = true
10455 emit(parser, "onend")
10456 SAXParser.call(parser, parser.strict, parser.opt)
10460 function strictFail(parser, message) {
10461 if (typeof parser !== 'object' || !(parser instanceof SAXParser))
10462 throw new Error('bad call to strictFail');
10463 if (parser.strict) error(parser, message)
10466 function newTag(parser) {
10467 if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
10468 var parent = parser.tags[parser.tags.length - 1] || parser,
10469 tag = parser.tag = {
10470 name: parser.tagName,
10474 // will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
10475 if (parser.opt.xmlns) tag.ns = parent.ns
10476 parser.attribList.length = 0
10479 function qname(name, attribute) {
10480 var i = name.indexOf(":"),
10481 qualName = i < 0 ? ["", name] : name.split(":"),
10482 prefix = qualName[0],
10483 local = qualName[1]
10485 // <x "xmlns"="http://foo">
10486 if (attribute && name === "xmlns") {
10497 function attrib(parser) {
10498 if (!parser.strict) parser.attribName = parser.attribName[parser.looseCase]()
10500 if (parser.attribList.indexOf(parser.attribName) !== -1 ||
10501 parser.tag.attributes.hasOwnProperty(parser.attribName)) {
10502 return parser.attribName = parser.attribValue = ""
10505 if (parser.opt.xmlns) {
10506 var qn = qname(parser.attribName, true),
10507 prefix = qn.prefix,
10510 if (prefix === "xmlns") {
10511 // namespace binding attribute; push the binding into scope
10512 if (local === "xml" && parser.attribValue !== XML_NAMESPACE) {
10513 strictFail(parser, "xml: prefix must be bound to " + XML_NAMESPACE + "\n" + "Actual: " + parser.attribValue)
10514 } else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) {
10515 strictFail(parser, "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\n" + "Actual: " + parser.attribValue)
10517 var tag = parser.tag,
10518 parent = parser.tags[parser.tags.length - 1] || parser
10519 if (tag.ns === parent.ns) {
10520 tag.ns = Object.create(parent.ns)
10522 tag.ns[local] = parser.attribValue
10526 // defer onattribute events until all attributes have been seen
10527 // so any new bindings can take effect; preserve attribute order
10528 // so deferred events can be emitted in document order
10529 parser.attribList.push([parser.attribName, parser.attribValue])
10531 // in non-xmlns mode, we can emit the event right away
10532 parser.tag.attributes[parser.attribName] = parser.attribValue
10533 emitNode(parser, "onattribute", {
10534 name: parser.attribName,
10535 value: parser.attribValue
10539 parser.attribName = parser.attribValue = ""
10542 function openTag(parser, selfClosing) {
10543 if (parser.opt.xmlns) {
10544 // emit namespace binding events
10545 var tag = parser.tag
10547 // add namespace info to tag
10548 var qn = qname(parser.tagName)
10549 tag.prefix = qn.prefix
10550 tag.local = qn.local
10551 tag.uri = tag.ns[qn.prefix] || ""
10553 if (tag.prefix && !tag.uri) {
10554 strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName))
10555 tag.uri = qn.prefix
10558 var parent = parser.tags[parser.tags.length - 1] || parser
10559 if (tag.ns && parent.ns !== tag.ns) {
10560 Object.keys(tag.ns).forEach(function(p) {
10561 emitNode(parser, "onopennamespace", {
10568 // handle deferred onattribute events
10569 // Note: do not apply default ns to attributes:
10570 // http://www.w3.org/TR/REC-xml-names/#defaulting
10571 for (var i = 0, l = parser.attribList.length; i < l; i++) {
10572 var nv = parser.attribList[i]
10575 qualName = qname(name, true),
10576 prefix = qualName.prefix,
10577 local = qualName.local,
10578 uri = prefix == "" ? "" : (tag.ns[prefix] || ""),
10587 // if there's any attributes with an undefined namespace,
10588 // then fail on them now.
10589 if (prefix && prefix != "xmlns" && !uri) {
10590 strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix))
10593 parser.tag.attributes[name] = a
10594 emitNode(parser, "onattribute", a)
10596 parser.attribList.length = 0
10599 parser.tag.isSelfClosing = !!selfClosing
10602 parser.sawRoot = true
10603 parser.tags.push(parser.tag)
10604 emitNode(parser, "onopentag", parser.tag)
10605 if (!selfClosing) {
10606 // special case for <script> in non-strict mode.
10607 if (!parser.noscript && parser.tagName.toLowerCase() === "script") {
10608 parser.state = S.SCRIPT
10610 parser.state = S.TEXT
10613 parser.tagName = ""
10615 parser.attribName = parser.attribValue = ""
10616 parser.attribList.length = 0
10619 function closeTag(parser) {
10620 if (!parser.tagName) {
10621 strictFail(parser, "Weird empty close tag.")
10622 parser.textNode += "</>"
10623 parser.state = S.TEXT
10627 if (parser.script) {
10628 if (parser.tagName !== "script") {
10629 parser.script += "</" + parser.tagName + ">"
10630 parser.tagName = ""
10631 parser.state = S.SCRIPT
10634 emitNode(parser, "onscript", parser.script)
10638 // first make sure that the closing tag actually exists.
10639 // <a><b></c></b></a> will close everything, otherwise.
10640 var t = parser.tags.length
10641 var tagName = parser.tagName
10642 if (!parser.strict) tagName = tagName[parser.looseCase]()
10643 var closeTo = tagName
10645 var close = parser.tags[t]
10646 if (close.name !== closeTo) {
10647 // fail the first time in strict mode
10648 strictFail(parser, "Unexpected close tag")
10652 // didn't find it. we already failed for strict, so just abort.
10654 strictFail(parser, "Unmatched closing tag: " + parser.tagName)
10655 parser.textNode += "</" + parser.tagName + ">"
10656 parser.state = S.TEXT
10659 parser.tagName = tagName
10660 var s = parser.tags.length
10662 var tag = parser.tag = parser.tags.pop()
10663 parser.tagName = parser.tag.name
10664 emitNode(parser, "onclosetag", parser.tagName)
10667 for (var i in tag.ns) x[i] = tag.ns[i]
10669 var parent = parser.tags[parser.tags.length - 1] || parser
10670 if (parser.opt.xmlns && tag.ns !== parent.ns) {
10671 // remove namespace bindings introduced by tag
10672 Object.keys(tag.ns).forEach(function(p) {
10674 emitNode(parser, "onclosenamespace", {
10681 if (t === 0) parser.closedRoot = true
10682 parser.tagName = parser.attribValue = parser.attribName = ""
10683 parser.attribList.length = 0
10684 parser.state = S.TEXT
10687 function parseEntity(parser) {
10688 var entity = parser.entity,
10689 entityLC = entity.toLowerCase(),
10691 if (parser.ENTITIES[entity])
10692 return parser.ENTITIES[entity]
10693 if (parser.ENTITIES[entityLC])
10694 return parser.ENTITIES[entityLC]
10696 if (entity.charAt(0) === "#") {
10697 if (entity.charAt(1) === "x") {
10698 entity = entity.slice(2)
10699 num = parseInt(entity, 16)
10700 numStr = num.toString(16)
10702 entity = entity.slice(1)
10703 num = parseInt(entity, 10)
10704 numStr = num.toString(10)
10707 entity = entity.replace(/^0+/, "")
10708 if (numStr.toLowerCase() !== entity) {
10709 strictFail(parser, "Invalid character entity")
10710 return "&" + parser.entity + ";"
10713 return String.fromCodePoint(num)
10716 function write(chunk) {
10718 if (this.error) throw this.error
10719 if (parser.closed) return error(parser,
10720 "Cannot write after close. Assign an onready handler.")
10721 if (chunk === null) return end(parser)
10724 while (parser.c = c = chunk.charAt(i++)) {
10725 if (parser.trackPosition) {
10730 } else parser.column++
10732 switch (parser.state) {
10736 parser.state = S.OPEN_WAKA
10737 parser.startTagPosition = parser.position
10738 } else if (not(whitespace, c)) {
10739 // have to process this as a text node.
10740 // weird, but happens.
10741 strictFail(parser, "Non-whitespace before first tag.")
10742 parser.textNode = c
10743 parser.state = S.TEXT
10748 if (parser.sawRoot && !parser.closedRoot) {
10750 while (c && c !== "<" && c !== "&") {
10751 c = chunk.charAt(i++)
10752 if (c && parser.trackPosition) {
10757 } else parser.column++
10760 parser.textNode += chunk.substring(starti, i - 1)
10763 parser.state = S.OPEN_WAKA
10764 parser.startTagPosition = parser.position
10766 if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot))
10767 strictFail(parser, "Text data outside of root node.")
10768 if (c === "&") parser.state = S.TEXT_ENTITY
10769 else parser.textNode += c
10776 parser.state = S.SCRIPT_ENDING
10777 } else parser.script += c
10780 case S.SCRIPT_ENDING:
10782 parser.state = S.CLOSE_TAG
10784 parser.script += "<" + c
10785 parser.state = S.SCRIPT
10790 // either a /, ?, !, or text is coming next.
10792 parser.state = S.SGML_DECL
10793 parser.sgmlDecl = ""
10794 } else if (is(whitespace, c)) {
10796 } else if (is(nameStart, c)) {
10797 parser.state = S.OPEN_TAG
10799 } else if (c === "/") {
10800 parser.state = S.CLOSE_TAG
10801 parser.tagName = ""
10802 } else if (c === "?") {
10803 parser.state = S.PROC_INST
10804 parser.procInstName = parser.procInstBody = ""
10806 strictFail(parser, "Unencoded <")
10807 // if there was some whitespace, then add that in.
10808 if (parser.startTagPosition + 1 < parser.position) {
10809 var pad = parser.position - parser.startTagPosition
10810 c = new Array(pad).join(" ") + c
10812 parser.textNode += "<" + c
10813 parser.state = S.TEXT
10818 if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
10819 emitNode(parser, "onopencdata")
10820 parser.state = S.CDATA
10821 parser.sgmlDecl = ""
10823 } else if (parser.sgmlDecl + c === "--") {
10824 parser.state = S.COMMENT
10825 parser.comment = ""
10826 parser.sgmlDecl = ""
10827 } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
10828 parser.state = S.DOCTYPE
10829 if (parser.doctype || parser.sawRoot) strictFail(parser,
10830 "Inappropriately located doctype declaration")
10831 parser.doctype = ""
10832 parser.sgmlDecl = ""
10833 } else if (c === ">") {
10834 emitNode(parser, "onsgmldeclaration", parser.sgmlDecl)
10835 parser.sgmlDecl = ""
10836 parser.state = S.TEXT
10837 } else if (is(quote, c)) {
10838 parser.state = S.SGML_DECL_QUOTED
10839 parser.sgmlDecl += c
10840 } else parser.sgmlDecl += c
10843 case S.SGML_DECL_QUOTED:
10844 if (c === parser.q) {
10845 parser.state = S.SGML_DECL
10848 parser.sgmlDecl += c
10853 parser.state = S.TEXT
10854 emitNode(parser, "ondoctype", parser.doctype)
10855 parser.doctype = true // just remember that we saw it.
10857 parser.doctype += c
10858 if (c === "[") parser.state = S.DOCTYPE_DTD
10859 else if (is(quote, c)) {
10860 parser.state = S.DOCTYPE_QUOTED
10866 case S.DOCTYPE_QUOTED:
10867 parser.doctype += c
10868 if (c === parser.q) {
10870 parser.state = S.DOCTYPE
10874 case S.DOCTYPE_DTD:
10875 parser.doctype += c
10876 if (c === "]") parser.state = S.DOCTYPE
10877 else if (is(quote, c)) {
10878 parser.state = S.DOCTYPE_DTD_QUOTED
10883 case S.DOCTYPE_DTD_QUOTED:
10884 parser.doctype += c
10885 if (c === parser.q) {
10886 parser.state = S.DOCTYPE_DTD
10892 if (c === "-") parser.state = S.COMMENT_ENDING
10893 else parser.comment += c
10896 case S.COMMENT_ENDING:
10898 parser.state = S.COMMENT_ENDED
10899 parser.comment = textopts(parser.opt, parser.comment)
10900 if (parser.comment) emitNode(parser, "oncomment", parser.comment)
10901 parser.comment = ""
10903 parser.comment += "-" + c
10904 parser.state = S.COMMENT
10908 case S.COMMENT_ENDED:
10910 strictFail(parser, "Malformed comment")
10911 // allow <!-- blah -- bloo --> in non-strict mode,
10912 // which is a comment of " blah -- bloo "
10913 parser.comment += "--" + c
10914 parser.state = S.COMMENT
10915 } else parser.state = S.TEXT
10919 if (c === "]") parser.state = S.CDATA_ENDING
10920 else parser.cdata += c
10923 case S.CDATA_ENDING:
10924 if (c === "]") parser.state = S.CDATA_ENDING_2
10926 parser.cdata += "]" + c
10927 parser.state = S.CDATA
10931 case S.CDATA_ENDING_2:
10933 if (parser.cdata) emitNode(parser, "oncdata", parser.cdata)
10934 emitNode(parser, "onclosecdata")
10936 parser.state = S.TEXT
10937 } else if (c === "]") {
10938 parser.cdata += "]"
10940 parser.cdata += "]]" + c
10941 parser.state = S.CDATA
10946 if (c === "?") parser.state = S.PROC_INST_ENDING
10947 else if (is(whitespace, c)) parser.state = S.PROC_INST_BODY
10948 else parser.procInstName += c
10951 case S.PROC_INST_BODY:
10952 if (!parser.procInstBody && is(whitespace, c)) continue
10953 else if (c === "?") parser.state = S.PROC_INST_ENDING
10954 else parser.procInstBody += c
10957 case S.PROC_INST_ENDING:
10959 emitNode(parser, "onprocessinginstruction", {
10960 name: parser.procInstName,
10961 body: parser.procInstBody
10963 parser.procInstName = parser.procInstBody = ""
10964 parser.state = S.TEXT
10966 parser.procInstBody += "?" + c
10967 parser.state = S.PROC_INST_BODY
10972 if (is(nameBody, c)) parser.tagName += c
10975 if (c === ">") openTag(parser)
10976 else if (c === "/") parser.state = S.OPEN_TAG_SLASH
10978 if (not(whitespace, c)) strictFail(
10979 parser, "Invalid character in tag name")
10980 parser.state = S.ATTRIB
10985 case S.OPEN_TAG_SLASH:
10987 openTag(parser, true)
10990 strictFail(parser, "Forward-slash in opening tag not followed by >")
10991 parser.state = S.ATTRIB
10996 // haven't read the attribute name yet.
10997 if (is(whitespace, c)) continue
10998 else if (c === ">") openTag(parser)
10999 else if (c === "/") parser.state = S.OPEN_TAG_SLASH
11000 else if (is(nameStart, c)) {
11001 parser.attribName = c
11002 parser.attribValue = ""
11003 parser.state = S.ATTRIB_NAME
11004 } else strictFail(parser, "Invalid attribute name")
11007 case S.ATTRIB_NAME:
11008 if (c === "=") parser.state = S.ATTRIB_VALUE
11009 else if (c === ">") {
11010 strictFail(parser, "Attribute without value")
11011 parser.attribValue = parser.attribName
11014 } else if (is(whitespace, c)) parser.state = S.ATTRIB_NAME_SAW_WHITE
11015 else if (is(nameBody, c)) parser.attribName += c
11016 else strictFail(parser, "Invalid attribute name")
11019 case S.ATTRIB_NAME_SAW_WHITE:
11020 if (c === "=") parser.state = S.ATTRIB_VALUE
11021 else if (is(whitespace, c)) continue
11023 strictFail(parser, "Attribute without value")
11024 parser.tag.attributes[parser.attribName] = ""
11025 parser.attribValue = ""
11026 emitNode(parser, "onattribute", {
11027 name: parser.attribName,
11030 parser.attribName = ""
11031 if (c === ">") openTag(parser)
11032 else if (is(nameStart, c)) {
11033 parser.attribName = c
11034 parser.state = S.ATTRIB_NAME
11036 strictFail(parser, "Invalid attribute name")
11037 parser.state = S.ATTRIB
11042 case S.ATTRIB_VALUE:
11043 if (is(whitespace, c)) continue
11044 else if (is(quote, c)) {
11046 parser.state = S.ATTRIB_VALUE_QUOTED
11048 strictFail(parser, "Unquoted attribute value")
11049 parser.state = S.ATTRIB_VALUE_UNQUOTED
11050 parser.attribValue = c
11054 case S.ATTRIB_VALUE_QUOTED:
11055 if (c !== parser.q) {
11056 if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_Q
11057 else parser.attribValue += c
11062 parser.state = S.ATTRIB_VALUE_CLOSED
11065 case S.ATTRIB_VALUE_CLOSED:
11066 if (is(whitespace, c)) {
11067 parser.state = S.ATTRIB
11068 } else if (c === ">") openTag(parser)
11069 else if (c === "/") parser.state = S.OPEN_TAG_SLASH
11070 else if (is(nameStart, c)) {
11071 strictFail(parser, "No whitespace between attributes")
11072 parser.attribName = c
11073 parser.attribValue = ""
11074 parser.state = S.ATTRIB_NAME
11075 } else strictFail(parser, "Invalid attribute name")
11078 case S.ATTRIB_VALUE_UNQUOTED:
11079 if (not(attribEnd, c)) {
11080 if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_U
11081 else parser.attribValue += c
11085 if (c === ">") openTag(parser)
11086 else parser.state = S.ATTRIB
11090 if (!parser.tagName) {
11091 if (is(whitespace, c)) continue
11092 else if (not(nameStart, c)) {
11093 if (parser.script) {
11094 parser.script += "</" + c
11095 parser.state = S.SCRIPT
11097 strictFail(parser, "Invalid tagname in closing tag.")
11099 } else parser.tagName = c
11100 } else if (c === ">") closeTag(parser)
11101 else if (is(nameBody, c)) parser.tagName += c
11102 else if (parser.script) {
11103 parser.script += "</" + parser.tagName
11104 parser.tagName = ""
11105 parser.state = S.SCRIPT
11107 if (not(whitespace, c)) strictFail(parser,
11108 "Invalid tagname in closing tag")
11109 parser.state = S.CLOSE_TAG_SAW_WHITE
11113 case S.CLOSE_TAG_SAW_WHITE:
11114 if (is(whitespace, c)) continue
11115 if (c === ">") closeTag(parser)
11116 else strictFail(parser, "Invalid characters in closing tag")
11119 case S.TEXT_ENTITY:
11120 case S.ATTRIB_VALUE_ENTITY_Q:
11121 case S.ATTRIB_VALUE_ENTITY_U:
11122 switch (parser.state) {
11123 case S.TEXT_ENTITY:
11124 var returnState = S.TEXT,
11125 buffer = "textNode"
11128 case S.ATTRIB_VALUE_ENTITY_Q:
11129 var returnState = S.ATTRIB_VALUE_QUOTED,
11130 buffer = "attribValue"
11133 case S.ATTRIB_VALUE_ENTITY_U:
11134 var returnState = S.ATTRIB_VALUE_UNQUOTED,
11135 buffer = "attribValue"
11139 parser[buffer] += parseEntity(parser)
11141 parser.state = returnState
11142 } else if (is(entity, c)) parser.entity += c
11144 strictFail(parser, "Invalid character entity")
11145 parser[buffer] += "&" + parser.entity + c
11147 parser.state = returnState
11152 throw new Error(parser, "Unknown state: " + parser.state)
11155 // cdata blocks can get very big under normal conditions. emit and move on.
11156 // if (parser.state === S.CDATA && parser.cdata) {
11157 // emitNode(parser, "oncdata", parser.cdata)
11158 // parser.cdata = ""
11160 if (parser.position >= parser.bufferCheckPosition) checkBufferLength(parser)
11164 /* ! http://mths.be/fromcodepoint v0.1.0 by @mathias */
11165 if (!String.fromCodePoint) {
11167 var stringFromCharCode = String.fromCharCode;
11168 var floor = Math.floor;
11169 var fromCodePoint = function() {
11170 var MAX_SIZE = 0x4000;
11171 var codeUnits = [];
11175 var length = arguments.length;
11180 while (++index < length) {
11181 var codePoint = Number(arguments[index]);
11182 if (!isFinite(codePoint) || // `NaN`,
11186 codePoint < 0 || // not a valid
11189 codePoint > 0x10FFFF || // not a valid
11192 floor(codePoint) != codePoint // not
11196 throw RangeError('Invalid code point: ' + codePoint);
11198 if (codePoint <= 0xFFFF) { // BMP code point
11199 codeUnits.push(codePoint);
11200 } else { // Astral code point; split in
11201 // surrogate halves
11202 // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
11203 codePoint -= 0x10000;
11204 highSurrogate = (codePoint >> 10) + 0xD800;
11205 lowSurrogate = (codePoint % 0x400) + 0xDC00;
11206 codeUnits.push(highSurrogate, lowSurrogate);
11208 if (index + 1 == length || codeUnits.length > MAX_SIZE) {
11209 result += stringFromCharCode.apply(null, codeUnits);
11210 codeUnits.length = 0;
11215 if (Object.defineProperty) {
11216 Object.defineProperty(String, 'fromCodePoint', {
11217 'value': fromCodePoint,
11218 'configurable': true,
11222 String.fromCodePoint = fromCodePoint;
11227 })(typeof exports === "undefined" ? sax = {} : exports);
11229 }).call(this, undefined)
11232 "string_decoder": false
11234 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\node_modules\\tiny-stack\\lib\\tiny-stack.js": [function(require, module, exports) {
11236 * Tiny stack for browser or server
11238 * @author Jason Mulligan <jason.mulligan@avoidwork.com>
11239 * @copyright 2014 Jason Mulligan
11240 * @license BSD-3 <https://raw.github.com/avoidwork/tiny-stack/master/LICENSE>
11241 * @link http://avoidwork.github.io/tiny-stack
11242 * @module tiny-stack
11246 (function(global) {
11255 function TinyStack() {
11256 this.data = [null];
11264 * @memberOf TinyStack
11265 * @return {Object} {@link TinyStack}
11267 TinyStack.prototype.clear = function clear() {
11268 this.data = [null];
11275 * Gets the size of the stack
11278 * @memberOf TinyStack
11279 * @return {Number} Size of stack
11281 TinyStack.prototype.length = function length() {
11286 * Gets the item at the top of the stack
11289 * @memberOf TinyStack
11290 * @return {Mixed} Item at the top of the stack
11292 TinyStack.prototype.peek = function peek() {
11293 return this.data[this.top];
11297 * Gets & removes the item at the top of the stack
11300 * @memberOf TinyStack
11301 * @return {Mixed} Item at the top of the stack
11303 TinyStack.prototype.pop = function pop() {
11304 if (this.top > 0) {
11307 return this.data.pop();
11314 * Pushes an item onto the stack
11317 * @memberOf TinyStack
11318 * @return {Object} {@link TinyStack}
11320 TinyStack.prototype.push = function push(arg) {
11321 this.data[++this.top] = arg;
11327 * TinyStack factory
11330 * @return {Object} {@link TinyStack}
11332 function factory() {
11333 return new TinyStack();
11336 // Node, AMD & window supported
11337 if (typeof exports != "undefined") {
11338 module.exports = factory;
11339 } else if (typeof define == "function") {
11340 define(function() {
11344 global.stack = factory;
11349 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\index.js": [function(require, module, exports) {
11350 module.exports = require('./lib/moddle');
11352 "./lib/moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\moddle.js"
11354 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\base.js": [function(require, module, exports) {
11359 Base.prototype.get = function(name) {
11360 return this.$model.properties.get(this, name);
11363 Base.prototype.set = function(name, value) {
11364 this.$model.properties.set(this, name, value);
11368 module.exports = Base;
11370 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\descriptor-builder.js": [function(require, module, exports) {
11373 var pick = require('lodash/object/pick'),
11374 assign = require('lodash/object/assign'),
11375 forEach = require('lodash/collection/forEach');
11377 var parseNameNs = require('./ns').parseName;
11380 function DescriptorBuilder(nameNs) {
11382 this.name = nameNs.name;
11383 this.allTypes = [];
11384 this.properties = [];
11385 this.propertiesByName = {};
11388 module.exports = DescriptorBuilder;
11391 DescriptorBuilder.prototype.build = function() {
11392 return pick(this, ['ns', 'name', 'allTypes', 'properties', 'propertiesByName', 'bodyProperty']);
11395 DescriptorBuilder.prototype.addProperty = function(p, idx) {
11396 this.addNamedProperty(p, true);
11398 var properties = this.properties;
11400 if (idx !== undefined) {
11401 properties.splice(idx, 0, p);
11403 properties.push(p);
11408 DescriptorBuilder.prototype.replaceProperty = function(oldProperty, newProperty) {
11409 var oldNameNs = oldProperty.ns;
11411 var props = this.properties,
11412 propertiesByName = this.propertiesByName,
11413 rename = oldProperty.name !== newProperty.name;
11415 if (oldProperty.isBody) {
11417 if (!newProperty.isBody) {
11419 'property <' + newProperty.ns.name + '> must be body property ' +
11420 'to refine <' + oldProperty.ns.name + '>');
11423 // TODO: Check compatibility
11424 this.setBodyProperty(newProperty, false);
11427 // replacing the named property is intentional
11428 // thus, validate only if this is a "rename" operation
11429 this.addNamedProperty(newProperty, rename);
11431 // replace old property at index with new one
11432 var idx = props.indexOf(oldProperty);
11434 throw new Error('property <' + oldNameNs.name + '> not found in property list');
11437 props[idx] = newProperty;
11439 // replace propertiesByName entry with new property
11440 propertiesByName[oldNameNs.name] = propertiesByName[oldNameNs.localName] = newProperty;
11444 DescriptorBuilder.prototype.redefineProperty = function(p) {
11446 var nsPrefix = p.ns.prefix;
11447 var parts = p.redefines.split('#');
11449 var name = parseNameNs(parts[0], nsPrefix);
11450 var attrName = parseNameNs(parts[1], name.prefix).name;
11452 var redefinedProperty = this.propertiesByName[attrName];
11453 if (!redefinedProperty) {
11454 throw new Error('refined property <' + attrName + '> not found');
11456 this.replaceProperty(redefinedProperty, p);
11459 delete p.redefines;
11462 DescriptorBuilder.prototype.addNamedProperty = function(p, validate) {
11464 propsByName = this.propertiesByName;
11467 this.assertNotDefined(p, ns.name);
11468 this.assertNotDefined(p, ns.localName);
11471 propsByName[ns.name] = propsByName[ns.localName] = p;
11474 DescriptorBuilder.prototype.removeNamedProperty = function(p) {
11476 propsByName = this.propertiesByName;
11478 delete propsByName[ns.name];
11479 delete propsByName[ns.localName];
11482 DescriptorBuilder.prototype.setBodyProperty = function(p, validate) {
11484 if (validate && this.bodyProperty) {
11486 'body property defined multiple times ' +
11487 '(<' + this.bodyProperty.ns.name + '>, <' + p.ns.name + '>)');
11490 this.bodyProperty = p;
11493 DescriptorBuilder.prototype.addIdProperty = function(name) {
11494 var nameNs = parseNameNs(name, this.ns.prefix);
11497 name: nameNs.localName,
11503 // ensure that id is always the first attribute (if present)
11504 this.addProperty(p, 0);
11507 DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
11508 var propertyName = p.name,
11509 definedProperty = this.propertiesByName[propertyName];
11511 if (definedProperty) {
11513 'property <' + propertyName + '> already defined; ' +
11514 'override of <' + definedProperty.definedBy.ns.name + '#' + definedProperty.ns.name + '> by ' +
11515 '<' + p.definedBy.ns.name + '#' + p.ns.name + '> not allowed without redefines');
11519 DescriptorBuilder.prototype.hasProperty = function(name) {
11520 return this.propertiesByName[name];
11523 DescriptorBuilder.prototype.addTrait = function(t) {
11525 var allTypes = this.allTypes;
11527 if (allTypes.indexOf(t) !== -1) {
11531 forEach(t.properties, function(p) {
11533 // clone property to allow extensions
11534 p = assign({}, p, {
11535 name: p.ns.localName
11538 Object.defineProperty(p, 'definedBy', {
11542 // add redefine support
11544 this.redefineProperty(p);
11547 this.setBodyProperty(p);
11549 this.addProperty(p);
11557 "./ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
11558 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
11559 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
11560 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
11562 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\factory.js": [function(require, module, exports) {
11565 var forEach = require('lodash/collection/forEach');
11567 var Base = require('./base');
11570 function Factory(model, properties) {
11571 this.model = model;
11572 this.properties = properties;
11575 module.exports = Factory;
11578 Factory.prototype.createType = function(descriptor) {
11580 var model = this.model;
11582 var props = this.properties,
11583 prototype = Object.create(Base.prototype);
11585 // initialize default values
11586 forEach(descriptor.properties, function(p) {
11587 if (!p.isMany && p.default !== undefined) {
11588 prototype[p.name] = p.default;
11592 props.defineModel(prototype, model);
11593 props.defineDescriptor(prototype, descriptor);
11595 var name = descriptor.ns.name;
11598 * The new type constructor
11600 function ModdleElement(attrs) {
11601 props.define(this, '$type', {
11605 props.define(this, '$attrs', {
11608 props.define(this, '$parent', {
11612 forEach(attrs, function(val, key) {
11613 this.set(key, val);
11617 ModdleElement.prototype = prototype;
11619 ModdleElement.hasType = prototype.$instanceOf = this.model.hasType;
11622 props.defineModel(ModdleElement, model);
11623 props.defineDescriptor(ModdleElement, descriptor);
11625 return ModdleElement;
11628 "./base": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\base.js",
11629 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
11631 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\moddle.js": [function(require, module, exports) {
11634 var isString = require('lodash/lang/isString'),
11635 isObject = require('lodash/lang/isObject'),
11636 forEach = require('lodash/collection/forEach'),
11637 find = require('lodash/collection/find');
11640 var Factory = require('./factory'),
11641 Registry = require('./registry'),
11642 Properties = require('./properties');
11644 var parseNameNs = require('./ns').parseName;
11647 // // Moddle implementation /////////////////////////////////////////////////
11652 * A model that can be used to create elements of a specific type.
11656 * var Moddle = require('moddle');
11658 * var pkg = { name: 'mypackage', prefix: 'my', types: [ { name: 'Root' } ] };
11660 * var moddle = new Moddle([pkg]);
11663 * <Package>} packages the packages to contain
11665 * options additional options to pass to the model
11667 function Moddle(packages, options) {
11669 options = options || {};
11671 this.properties = new Properties(this);
11673 this.factory = new Factory(this, this.properties);
11674 this.registry = new Registry(packages, this.properties, options);
11676 this.typeCache = {};
11679 module.exports = Moddle;
11683 * Create an instance of the specified type.
11685 * @method Moddle#create
11689 * var foo = moddle.create('my:Foo'); var bar = moddle.create('my:Bar', { id:
11692 * @param {String|Object}
11693 * descriptor the type descriptor or name know to the model
11695 * attrs a number of attributes to initialize the model instance with
11696 * @return {Object} model instance
11698 Moddle.prototype.create = function(descriptor, attrs) {
11699 var Type = this.getType(descriptor);
11702 throw new Error('unknown type <' + descriptor + '>');
11705 return new Type(attrs);
11710 * Returns the type representing a given descriptor
11712 * @method Moddle#getType
11716 * var Foo = moddle.getType('my:Foo'); var foo = new Foo({ 'id' : 'FOO_1' });
11718 * @param {String|Object}
11719 * descriptor the type descriptor or name know to the model
11720 * @return {Object} the type representing the descriptor
11722 Moddle.prototype.getType = function(descriptor) {
11724 var cache = this.typeCache;
11726 var name = isString(descriptor) ? descriptor : descriptor.ns.name;
11728 var type = cache[name];
11731 descriptor = this.registry.getEffectiveDescriptor(name);
11732 type = cache[name] = this.factory.createType(descriptor);
11740 * Creates an any-element type to be used within model instances.
11742 * This can be used to create custom elements that lie outside the meta-model.
11743 * The created element contains all the meta-data required to serialize it as
11744 * part of meta-model elements.
11746 * @method Moddle#createAny
11750 * var foo = moddle.createAny('vendor:Foo', 'http://vendor', { value: 'bar' });
11752 * var container = moddle.create('my:Container', 'http://my', { any: [ foo ] });
11753 * // go ahead and serialize the stuff
11757 * name the name of the element
11759 * nsUri the namespace uri of the element
11761 * [properties] a map of properties to initialize the instance with
11762 * @return {Object} the any type instance
11764 Moddle.prototype.createAny = function(name, nsUri, properties) {
11766 var nameNs = parseNameNs(name);
11776 prefix: nameNs.prefix,
11777 localName: nameNs.localName,
11782 this.properties.defineDescriptor(element, descriptor);
11783 this.properties.defineModel(element, this);
11784 this.properties.define(element, '$parent', {
11789 forEach(properties, function(a, key) {
11790 if (isObject(a) && a.value !== undefined) {
11791 element[a.name] = a.value;
11801 * Returns a registered package by uri or prefix
11803 * @return {Object} the package
11805 Moddle.prototype.getPackage = function(uriOrPrefix) {
11806 return this.registry.getPackage(uriOrPrefix);
11810 * Returns a snapshot of all known packages
11812 * @return {Object} the package
11814 Moddle.prototype.getPackages = function() {
11815 return this.registry.getPackages();
11819 * Returns the descriptor for an element
11821 Moddle.prototype.getElementDescriptor = function(element) {
11822 return element.$descriptor;
11826 * Returns true if the given descriptor or instance represents the given type.
11828 * May be applied to this, if element is omitted.
11830 Moddle.prototype.hasType = function(element, type) {
11831 if (type === undefined) {
11836 var descriptor = element.$model.getElementDescriptor(element);
11838 return !!find(descriptor.allTypes, function(t) {
11839 return t.name === type;
11845 * Returns the descriptor of an elements named property
11847 Moddle.prototype.getPropertyDescriptor = function(element, property) {
11848 return this.getElementDescriptor(element).propertiesByName[property];
11852 "./factory": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\factory.js",
11853 "./ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
11854 "./properties": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\properties.js",
11855 "./registry": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\registry.js",
11856 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
11857 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
11858 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
11859 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js"
11861 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js": [function(require, module, exports) {
11865 * Parses a namespaced attribute name of the form (ns:)localName to an object,
11866 * given a default prefix to assume in case no explicit namespace is given.
11871 * [defaultPrefix] the default prefix to take, if none is present.
11873 * @return {Object} the parsed name
11875 module.exports.parseName = function(name, defaultPrefix) {
11876 var parts = name.split(/:/),
11879 // no prefix (i.e. only local name)
11880 if (parts.length === 1) {
11882 prefix = defaultPrefix;
11884 // prefix + local name
11885 if (parts.length === 2) {
11886 localName = parts[1];
11889 throw new Error('expected <prefix:localName> or <localName>, got ' + name);
11892 name = (prefix ? prefix + ':' : '') + localName;
11897 localName: localName
11901 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\properties.js": [function(require, module, exports) {
11906 * A utility that gets and sets properties of model elements.
11911 function Properties(model) {
11912 this.model = model;
11915 module.exports = Properties;
11919 * Sets a named property on the target element
11928 Properties.prototype.set = function(target, name, value) {
11930 var property = this.model.getPropertyDescriptor(target, name);
11933 target.$attrs[name] = value;
11935 Object.defineProperty(target, property.name, {
11936 enumerable: !property.isReference,
11944 * Returns the named property of the given element
11953 Properties.prototype.get = function(target, name) {
11955 var property = this.model.getPropertyDescriptor(target, name);
11958 return target.$attrs[name];
11961 var propertyName = property.name;
11963 // check if access to collection property and lazily initialize it
11964 if (!target[propertyName] && property.isMany) {
11965 Object.defineProperty(target, propertyName, {
11966 enumerable: !property.isReference,
11972 return target[propertyName];
11977 * Define a property on the target element
11986 Properties.prototype.define = function(target, name, options) {
11987 Object.defineProperty(target, name, options);
11992 * Define the descriptor for an element
11994 Properties.prototype.defineDescriptor = function(target, descriptor) {
11995 this.define(target, '$descriptor', {
12001 * Define the model for an element
12003 Properties.prototype.defineModel = function(target, model) {
12004 this.define(target, '$model', {
12009 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\registry.js": [function(require, module, exports) {
12012 var assign = require('lodash/object/assign'),
12013 forEach = require('lodash/collection/forEach');
12015 var Types = require('./types'),
12016 DescriptorBuilder = require('./descriptor-builder');
12018 var parseNameNs = require('./ns').parseName,
12019 isBuiltInType = Types.isBuiltIn;
12022 function Registry(packages, properties, options) {
12024 this.options = assign({
12028 this.packageMap = {};
12031 this.packages = [];
12033 this.properties = properties;
12035 forEach(packages, this.registerPackage, this);
12038 module.exports = Registry;
12041 Registry.prototype.getPackage = function(uriOrPrefix) {
12042 return this.packageMap[uriOrPrefix];
12045 Registry.prototype.getPackages = function() {
12046 return this.packages;
12050 Registry.prototype.registerPackage = function(pkg) {
12051 // alert("pkg :: " + pkg);
12053 pkg = assign({}, pkg);
12056 forEach(pkg.types, function(descriptor) {
12057 this.registerType(descriptor, pkg);
12060 this.packageMap[pkg.uri] = this.packageMap[pkg.prefix] = pkg;
12061 this.packages.push(pkg);
12066 * Register a type from a specific package with us
12068 Registry.prototype.registerType = function(type, pkg) {
12070 type = assign({}, type, {
12071 superClass: (type.superClass || []).slice(),
12072 extends: (type.extends || []).slice(),
12073 properties: (type.properties || []).slice()
12076 var ns = parseNameNs(type.name, pkg.prefix),
12078 propertiesByName = {};
12080 // parse properties
12081 forEach(type.properties, function(p) {
12083 // namespace property names
12084 var propertyNs = parseNameNs(p.name, ns.prefix),
12085 propertyName = propertyNs.name;
12087 // namespace property types
12088 if (!isBuiltInType(p.type)) {
12089 p.type = parseNameNs(p.type, propertyNs.prefix).name;
12097 propertiesByName[propertyName] = p;
12100 // update ns + name
12104 propertiesByName: propertiesByName
12107 forEach(type.extends, function(extendsName) {
12108 var extended = this.typeMap[extendsName];
12110 extended.traits = extended.traits || [];
12111 extended.traits.push(name);
12115 this.definePackage(type, pkg);
12118 this.typeMap[name] = type;
12123 * Traverse the type hierarchy from bottom to top.
12125 Registry.prototype.mapTypes = function(nsName, iterator) {
12127 // alert("nsName :: " + nsName.name);
12128 var type = isBuiltInType(nsName.name) ? {
12130 } : this.typeMap[nsName.name];
12131 // alert("Type :: " + type);
12136 * Traverse the selected super type or trait
12141 function traverseSuper(cls) {
12142 var parentNs = parseNameNs(cls, isBuiltInType(cls) ? '' : nsName.prefix);
12143 self.mapTypes(parentNs, iterator);
12147 throw new Error('unknown type <' + nsName.name + '>');
12150 forEach(type.superClass, traverseSuper);
12154 forEach(type.traits, traverseSuper);
12159 * Returns the effective descriptor for a type.
12162 * type the namespaced name (ns:localName) of the type
12164 * @return {Descriptor} the resulting effective descriptor
12166 Registry.prototype.getEffectiveDescriptor = function(name) {
12168 var nsName = parseNameNs(name);
12170 var builder = new DescriptorBuilder(nsName);
12172 this.mapTypes(nsName, function(type) {
12173 builder.addTrait(type);
12176 // check we have an id assigned
12177 var id = this.options.generateId;
12178 if (id && !builder.hasProperty(id)) {
12179 builder.addIdProperty(id);
12182 var descriptor = builder.build();
12184 // define package link
12185 this.definePackage(descriptor, descriptor.allTypes[descriptor.allTypes.length - 1].$pkg);
12191 Registry.prototype.definePackage = function(target, pkg) {
12192 this.properties.define(target, '$pkg', {
12197 "./descriptor-builder": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\descriptor-builder.js",
12198 "./ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
12199 "./types": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js",
12200 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
12201 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
12203 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js": [function(require, module, exports) {
12207 * Built-in moddle types
12218 * Converters for built in types from string representations
12220 var TYPE_CONVERTERS = {
12221 String: function(s) {
12224 Boolean: function(s) {
12225 return s === 'true';
12227 Integer: function(s) {
12228 return parseInt(s, 10);
12230 Real: function(s) {
12231 return parseFloat(s, 10);
12236 * Convert a type to its real representation
12238 module.exports.coerceType = function(type, value) {
12240 var converter = TYPE_CONVERTERS[type];
12243 return converter(value);
12250 * Return whether the given type is built-in
12252 module.exports.isBuiltIn = function(type) {
12253 return !!BUILTINS[type];
12257 * Return whether the given type is simple
12259 module.exports.isSimple = function(type) {
12260 return !!TYPE_CONVERTERS[type];
12263 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmn.json": [function(require, module, exports) {
12266 "uri": "http://www.omg.org/spec/BPMN/20100524/MODEL",
12267 "associations": [],
12269 "name": "Interface",
12278 "name": "operations",
12279 "type": "Operation",
12282 "name": "implementationRef",
12287 "name": "Operation",
12296 "name": "inMessageRef",
12299 "isReference": true
12301 "name": "outMessageRef",
12304 "isReference": true
12306 "name": "errorRefs",
12309 "isReference": true
12311 "name": "implementationRef",
12316 "name": "EndPoint",
12321 "name": "Auditing",
12326 "name": "GlobalTask",
12331 "name": "resources",
12332 "type": "ResourceRole",
12336 "name": "Monitoring",
12341 "name": "Performer",
12348 "FlowElementsContainer",
12352 "name": "processType",
12353 "type": "ProcessType",
12356 "name": "isClosed",
12360 "name": "auditing",
12363 "name": "monitoring",
12364 "type": "Monitoring"
12366 "name": "properties",
12367 "type": "Property",
12370 "name": "supports",
12373 "isReference": true
12375 "name": "definitionalCollaborationRef",
12376 "type": "Collaboration",
12378 "isReference": true
12380 "name": "isExecutable",
12384 "name": "resources",
12385 "type": "ResourceRole",
12388 "name": "artifacts",
12389 "type": "Artifact",
12392 "name": "correlationSubscriptions",
12393 "type": "CorrelationSubscription",
12420 "name": "childLaneSet",
12422 "serialize": "xsi:type"
12424 "name": "partitionElementRef",
12425 "type": "BaseElement",
12427 "isReference": true
12429 "name": "flowNodeRef",
12430 "type": "FlowNode",
12432 "isReference": true
12434 "name": "partitionElement",
12435 "type": "BaseElement"
12438 "name": "GlobalManualTask",
12443 "name": "ManualTask",
12448 "name": "UserTask",
12453 "name": "renderings",
12454 "type": "Rendering",
12457 "name": "implementation",
12462 "name": "Rendering",
12467 "name": "HumanPerformer",
12472 "name": "PotentialOwner",
12477 "name": "GlobalUserTask",
12482 "name": "implementation",
12486 "name": "renderings",
12487 "type": "Rendering",
12492 "isAbstract": true,
12497 "name": "gatewayDirection",
12498 "type": "GatewayDirection",
12499 "default": "Unspecified",
12503 "name": "EventBasedGateway",
12508 "name": "instantiate",
12513 "name": "eventGatewayType",
12514 "type": "EventBasedGatewayType",
12516 "default": "Exclusive"
12519 "name": "ComplexGateway",
12524 "name": "activationCondition",
12525 "type": "Expression",
12526 "serialize": "xsi:type"
12529 "type": "SequenceFlow",
12531 "isReference": true
12534 "name": "ExclusiveGateway",
12540 "type": "SequenceFlow",
12542 "isReference": true
12545 "name": "InclusiveGateway",
12551 "type": "SequenceFlow",
12553 "isReference": true
12556 "name": "ParallelGateway",
12561 "name": "RootElement",
12562 "isAbstract": true,
12567 "name": "Relationship",
12576 "name": "direction",
12577 "type": "RelationshipDirection",
12582 "isReference": true,
12587 "isReference": true,
12591 "name": "BaseElement",
12592 "isAbstract": true,
12598 "name": "documentation",
12599 "type": "Documentation",
12602 "name": "extensionDefinitions",
12603 "type": "ExtensionDefinition",
12605 "isReference": true
12607 "name": "extensionElements",
12608 "type": "ExtensionElements"
12611 "name": "Extension",
12613 "name": "mustUnderstand",
12618 "name": "definition",
12619 "type": "ExtensionDefinition"
12622 "name": "ExtensionDefinition",
12628 "name": "extensionAttributeDefinitions",
12629 "type": "ExtensionAttributeDefinition",
12633 "name": "ExtensionAttributeDefinition",
12643 "name": "isReference",
12648 "name": "extensionDefinition",
12649 "type": "ExtensionDefinition",
12651 "isReference": true
12654 "name": "ExtensionElements",
12656 "name": "valueRef",
12658 "isReference": true,
12665 "name": "extensionAttributeDefinition",
12666 "type": "ExtensionAttributeDefinition",
12668 "isReference": true
12671 "name": "Documentation",
12680 "name": "textFormat",
12681 "default": "text/plain",
12687 "isAbstract": true,
12693 "name": "properties",
12694 "type": "Property",
12698 "name": "IntermediateCatchEvent",
12703 "name": "IntermediateThrowEvent",
12708 "name": "EndEvent",
12713 "name": "StartEvent",
12718 "name": "isInterrupting",
12724 "name": "MultiBranchConnector",
12729 "name": "isInterrupting",
12735 "name": "ParentReturn",
12741 "name": "SubProcessCall",
12747 "name": "ThrowEvent",
12748 "isAbstract": true,
12753 "name": "inputSet",
12756 "name": "eventDefinitionRefs",
12757 "type": "EventDefinition",
12759 "isReference": true
12761 "name": "dataInputAssociation",
12762 "type": "DataInputAssociation",
12765 "name": "dataInputs",
12766 "type": "DataInput",
12769 "name": "eventDefinitions",
12770 "type": "EventDefinition",
12774 "name": "CatchEvent",
12775 "isAbstract": true,
12780 "name": "parallelMultiple",
12785 "name": "outputSet",
12786 "type": "OutputSet"
12788 "name": "eventDefinitionRefs",
12789 "type": "EventDefinition",
12791 "isReference": true
12793 "name": "dataOutputAssociation",
12794 "type": "DataOutputAssociation",
12797 "name": "dataOutputs",
12798 "type": "DataOutput",
12801 "name": "eventDefinitions",
12802 "type": "EventDefinition",
12806 "name": "BoundaryEvent",
12811 "name": "cancelActivity",
12816 "name": "attachedToRef",
12817 "type": "Activity",
12819 "isReference": true
12822 "name": "EventDefinition",
12823 "isAbstract": true,
12828 "name": "CancelEventDefinition",
12833 "name": "ErrorEventDefinition",
12838 "name": "errorRef",
12841 "isReference": true
12844 "name": "TerminateEventDefinition",
12849 "name": "EscalationEventDefinition",
12854 "name": "escalationRef",
12855 "type": "Escalation",
12857 "isReference": true
12860 "name": "Escalation",
12862 "name": "structureRef",
12863 "type": "ItemDefinition",
12865 "isReference": true
12871 "name": "escalationCode",
12879 "name": "CompensateEventDefinition",
12884 "name": "waitForCompletion",
12888 "name": "activityRef",
12889 "type": "Activity",
12891 "isReference": true
12894 "name": "TimerEventDefinition",
12899 "name": "timeDate",
12900 "type": "Expression",
12901 "serialize": "xsi:type"
12903 "name": "timeCycle",
12904 "type": "Expression",
12905 "serialize": "xsi:type"
12907 "name": "timeDuration",
12908 "type": "Expression",
12909 "serialize": "xsi:type"
12912 "name": "LinkEventDefinition",
12922 "type": "LinkEventDefinition",
12924 "isReference": true
12927 "type": "LinkEventDefinition",
12929 "isReference": true
12932 "name": "MessageEventDefinition",
12937 "name": "messageRef",
12940 "isReference": true
12942 "name": "operationRef",
12943 "type": "Operation",
12945 "isReference": true
12948 "name": "ConditionalEventDefinition",
12953 "name": "condition",
12954 "type": "Expression",
12955 "serialize": "xsi:type"
12958 "name": "SignalEventDefinition",
12963 "name": "signalRef",
12966 "isReference": true
12974 "name": "structureRef",
12975 "type": "ItemDefinition",
12977 "isReference": true
12984 "name": "ImplicitThrowEvent",
12989 "name": "DataState",
12999 "name": "ItemAwareElement",
13004 "name": "itemSubjectRef",
13005 "type": "ItemDefinition",
13007 "isReference": true
13009 "name": "dataState",
13010 "type": "DataState"
13013 "name": "DataAssociation",
13018 "name": "transformation",
13019 "type": "FormalExpression"
13021 "name": "assignment",
13022 "type": "Assignment",
13025 "name": "sourceRef",
13026 "type": "ItemAwareElement",
13028 "isReference": true
13030 "name": "targetRef",
13031 "type": "ItemAwareElement",
13032 "isReference": true
13035 "name": "DataInput",
13044 "name": "isCollection",
13049 "name": "inputSetRefs",
13050 "type": "InputSet",
13053 "isReference": true
13055 "name": "inputSetWithOptional",
13056 "type": "InputSet",
13059 "isReference": true
13061 "name": "inputSetWithWhileExecuting",
13062 "type": "InputSet",
13065 "isReference": true
13068 "name": "DataOutput",
13077 "name": "isCollection",
13082 "name": "outputSetRefs",
13083 "type": "OutputSet",
13086 "isReference": true
13088 "name": "outputSetWithOptional",
13089 "type": "OutputSet",
13092 "isReference": true
13094 "name": "outputSetWithWhileExecuting",
13095 "type": "OutputSet",
13098 "isReference": true
13101 "name": "InputSet",
13110 "name": "dataInputRefs",
13111 "type": "DataInput",
13113 "isReference": true
13115 "name": "optionalInputRefs",
13116 "type": "DataInput",
13118 "isReference": true
13120 "name": "whileExecutingInputRefs",
13121 "type": "DataInput",
13123 "isReference": true
13125 "name": "outputSetRefs",
13126 "type": "OutputSet",
13128 "isReference": true
13131 "name": "OutputSet",
13136 "name": "dataOutputRefs",
13137 "type": "DataOutput",
13139 "isReference": true
13145 "name": "inputSetRefs",
13146 "type": "InputSet",
13148 "isReference": true
13150 "name": "optionalOutputRefs",
13151 "type": "DataOutput",
13153 "isReference": true
13155 "name": "whileExecutingOutputRefs",
13156 "type": "DataOutput",
13158 "isReference": true
13161 "name": "Property",
13171 "name": "DataInputAssociation",
13176 "name": "DataOutputAssociation",
13181 "name": "InputOutputSpecification",
13186 "name": "inputSets",
13187 "type": "InputSet",
13190 "name": "outputSets",
13191 "type": "OutputSet",
13194 "name": "dataInputs",
13195 "type": "DataInput",
13198 "name": "dataOutputs",
13199 "type": "DataOutput",
13203 "name": "DataObject",
13209 "name": "isCollection",
13215 "name": "InputOutputBinding",
13217 "name": "inputDataRef",
13218 "type": "InputSet",
13220 "isReference": true
13222 "name": "outputDataRef",
13223 "type": "OutputSet",
13225 "isReference": true
13227 "name": "operationRef",
13228 "type": "Operation",
13230 "isReference": true
13233 "name": "Assignment",
13239 "type": "Expression",
13240 "serialize": "xsi:type"
13243 "type": "Expression",
13244 "serialize": "xsi:type"
13247 "name": "DataStore",
13257 "name": "capacity",
13261 "name": "isUnlimited",
13267 "name": "DataStoreReference",
13269 "ItemAwareElement",
13273 "name": "dataStoreRef",
13274 "type": "DataStore",
13276 "isReference": true
13279 "name": "DataObjectReference",
13281 "ItemAwareElement",
13285 "name": "dataObjectRef",
13286 "type": "DataObject",
13288 "isReference": true
13291 "name": "ConversationLink",
13296 "name": "sourceRef",
13297 "type": "InteractionNode",
13299 "isReference": true
13301 "name": "targetRef",
13302 "type": "InteractionNode",
13304 "isReference": true
13311 "name": "ConversationAssociation",
13316 "name": "innerConversationNodeRef",
13317 "type": "ConversationNode",
13319 "isReference": true
13321 "name": "outerConversationNodeRef",
13322 "type": "ConversationNode",
13324 "isReference": true
13327 "name": "CallConversation",
13332 "name": "calledCollaborationRef",
13333 "type": "Collaboration",
13335 "isReference": true
13337 "name": "participantAssociations",
13338 "type": "ParticipantAssociation",
13342 "name": "Conversation",
13347 "name": "SubConversation",
13352 "name": "conversationNodes",
13353 "type": "ConversationNode",
13357 "name": "ConversationNode",
13358 "isAbstract": true,
13368 "name": "participantRefs",
13369 "type": "Participant",
13371 "isReference": true
13373 "name": "messageFlowRefs",
13374 "type": "MessageFlow",
13376 "isReference": true
13378 "name": "correlationKeys",
13379 "type": "CorrelationKey",
13383 "name": "GlobalConversation",
13388 "name": "PartnerEntity",
13397 "name": "participantRef",
13398 "type": "Participant",
13400 "isReference": true
13403 "name": "PartnerRole",
13412 "name": "participantRef",
13413 "type": "Participant",
13415 "isReference": true
13418 "name": "CorrelationProperty",
13423 "name": "correlationPropertyRetrievalExpression",
13424 "type": "CorrelationPropertyRetrievalExpression",
13432 "type": "ItemDefinition",
13434 "isReference": true
13442 "name": "structureRef",
13443 "type": "ItemDefinition",
13445 "isReference": true
13451 "name": "errorCode",
13456 "name": "CorrelationKey",
13461 "name": "correlationPropertyRef",
13462 "type": "CorrelationProperty",
13464 "isReference": true
13471 "name": "Expression",
13477 "name": "FormalExpression",
13482 "name": "language",
13490 "name": "evaluatesToTypeRef",
13491 "type": "ItemDefinition",
13493 "isReference": true
13506 "type": "ItemDefinition",
13508 "isReference": true
13511 "name": "ItemDefinition",
13516 "name": "itemKind",
13517 "type": "ItemKind",
13520 "name": "structureRef",
13524 "name": "isCollection",
13532 "isReference": true
13535 "name": "FlowElement",
13536 "isAbstract": true,
13545 "name": "auditing",
13548 "name": "monitoring",
13549 "type": "Monitoring"
13551 "name": "categoryValueRef",
13552 "type": "CategoryValue",
13554 "isReference": true
13557 "name": "SequenceFlow",
13562 "name": "isImmediate",
13566 "name": "conditionExpression",
13567 "type": "Expression",
13568 "serialize": "xsi:type"
13570 "name": "sourceRef",
13571 "type": "FlowNode",
13573 "isReference": true
13575 "name": "targetRef",
13576 "type": "FlowNode",
13578 "isReference": true
13581 "name": "FlowElementsContainer",
13582 "isAbstract": true,
13587 "name": "laneSets",
13591 "name": "flowElements",
13592 "type": "FlowElement",
13596 "name": "CallableElement",
13597 "isAbstract": true,
13606 "name": "ioSpecification",
13607 "type": "InputOutputSpecification"
13609 "name": "supportedInterfaceRefs",
13610 "type": "Interface",
13612 "isReference": true
13614 "name": "ioBinding",
13615 "type": "InputOutputBinding",
13619 "name": "FlowNode",
13620 "isAbstract": true,
13625 "name": "incoming",
13626 "type": "SequenceFlow",
13628 "isReference": true
13630 "name": "outgoing",
13631 "type": "SequenceFlow",
13633 "isReference": true
13639 "isReference": true
13642 "name": "CorrelationPropertyRetrievalExpression",
13647 "name": "messagePath",
13648 "type": "FormalExpression"
13650 "name": "messageRef",
13653 "isReference": true
13656 "name": "CorrelationPropertyBinding",
13661 "name": "dataPath",
13662 "type": "FormalExpression"
13664 "name": "correlationPropertyRef",
13665 "type": "CorrelationProperty",
13667 "isReference": true
13670 "name": "Resource",
13679 "name": "resourceParameters",
13680 "type": "ResourceParameter",
13684 "name": "ResourceParameter",
13693 "name": "isRequired",
13698 "type": "ItemDefinition",
13700 "isReference": true
13703 "name": "CorrelationSubscription",
13708 "name": "correlationKeyRef",
13709 "type": "CorrelationKey",
13711 "isReference": true
13713 "name": "correlationPropertyBinding",
13714 "type": "CorrelationPropertyBinding",
13718 "name": "MessageFlow",
13727 "name": "sourceRef",
13728 "type": "InteractionNode",
13730 "isReference": true
13732 "name": "targetRef",
13733 "type": "InteractionNode",
13735 "isReference": true
13737 "name": "messageRef",
13740 "isReference": true
13743 "name": "MessageFlowAssociation",
13748 "name": "innerMessageFlowRef",
13749 "type": "MessageFlow",
13751 "isReference": true
13753 "name": "outerMessageFlowRef",
13754 "type": "MessageFlow",
13756 "isReference": true
13759 "name": "InteractionNode",
13760 "isAbstract": true,
13762 "name": "incomingConversationLinks",
13763 "type": "ConversationLink",
13766 "isReference": true
13768 "name": "outgoingConversationLinks",
13769 "type": "ConversationLink",
13772 "isReference": true
13775 "name": "Participant",
13785 "name": "interfaceRefs",
13786 "type": "Interface",
13788 "isReference": true
13790 "name": "participantMultiplicity",
13791 "type": "ParticipantMultiplicity"
13793 "name": "endPointRefs",
13794 "type": "EndPoint",
13796 "isReference": true
13798 "name": "processRef",
13801 "isReference": true
13804 "name": "ParticipantAssociation",
13809 "name": "innerParticipantRef",
13810 "type": "Participant",
13812 "isReference": true
13814 "name": "outerParticipantRef",
13815 "type": "Participant",
13817 "isReference": true
13820 "name": "ParticipantMultiplicity",
13833 "name": "Collaboration",
13842 "name": "isClosed",
13846 "name": "choreographyRef",
13847 "type": "Choreography",
13849 "isReference": true
13851 "name": "artifacts",
13852 "type": "Artifact",
13855 "name": "participantAssociations",
13856 "type": "ParticipantAssociation",
13859 "name": "messageFlowAssociations",
13860 "type": "MessageFlowAssociation",
13863 "name": "conversationAssociations",
13864 "type": "ConversationAssociation"
13866 "name": "participants",
13867 "type": "Participant",
13870 "name": "messageFlows",
13871 "type": "MessageFlow",
13874 "name": "correlationKeys",
13875 "type": "CorrelationKey",
13878 "name": "conversations",
13879 "type": "ConversationNode",
13882 "name": "conversationLinks",
13883 "type": "ConversationLink",
13887 "name": "ChoreographyActivity",
13888 "isAbstract": true,
13893 "name": "participantRefs",
13894 "type": "Participant",
13896 "isReference": true
13898 "name": "initiatingParticipantRef",
13899 "type": "Participant",
13901 "isReference": true
13903 "name": "correlationKeys",
13904 "type": "CorrelationKey",
13907 "name": "loopType",
13908 "type": "ChoreographyLoopType",
13913 "name": "CallChoreography",
13915 "ChoreographyActivity"
13918 "name": "calledChoreographyRef",
13919 "type": "Choreography",
13921 "isReference": true
13923 "name": "participantAssociations",
13924 "type": "ParticipantAssociation",
13928 "name": "SubChoreography",
13930 "ChoreographyActivity",
13931 "FlowElementsContainer"
13934 "name": "artifacts",
13935 "type": "Artifact",
13939 "name": "ChoreographyTask",
13941 "ChoreographyActivity"
13944 "name": "messageFlowRef",
13945 "type": "MessageFlow",
13947 "isReference": true
13950 "name": "Choreography",
13952 "FlowElementsContainer",
13956 "name": "GlobalChoreographyTask",
13961 "name": "initiatingParticipantRef",
13962 "type": "Participant",
13964 "isReference": true
13967 "name": "TextAnnotation",
13975 "name": "textFormat",
13976 "default": "text/plain",
13986 "name": "categoryValueRef",
13987 "type": "CategoryValue",
13989 "isReference": true
13992 "name": "Association",
13997 "name": "associationDirection",
13998 "type": "AssociationDirection",
14001 "name": "sourceRef",
14002 "type": "BaseElement",
14004 "isReference": true
14006 "name": "targetRef",
14007 "type": "BaseElement",
14009 "isReference": true
14012 "name": "Category",
14017 "name": "categoryValue",
14018 "type": "CategoryValue",
14026 "name": "Artifact",
14027 "isAbstract": true,
14032 "name": "CategoryValue",
14037 "name": "categorizedFlowElements",
14038 "type": "FlowElement",
14041 "isReference": true
14048 "name": "Activity",
14049 "isAbstract": true,
14054 "name": "isForCompensation",
14059 "name": "loopCharacteristics",
14060 "type": "LoopCharacteristics"
14062 "name": "resources",
14063 "type": "ResourceRole",
14067 "type": "SequenceFlow",
14069 "isReference": true
14071 "name": "properties",
14072 "type": "Property",
14075 "name": "ioSpecification",
14076 "type": "InputOutputSpecification"
14078 "name": "boundaryEventRefs",
14079 "type": "BoundaryEvent",
14081 "isReference": true
14083 "name": "dataInputAssociations",
14084 "type": "DataInputAssociation",
14087 "name": "dataOutputAssociations",
14088 "type": "DataOutputAssociation",
14091 "name": "startQuantity",
14096 "name": "completionQuantity",
14102 "name": "ServiceTask",
14107 "name": "implementation",
14111 "name": "operationRef",
14112 "type": "Operation",
14114 "isReference": true
14117 "name": "SubProcess",
14120 "FlowElementsContainer",
14124 "name": "triggeredByEvent",
14129 "name": "artifacts",
14130 "type": "Artifact",
14134 "name": "LoopCharacteristics",
14135 "isAbstract": true,
14140 "name": "MultiInstanceLoopCharacteristics",
14142 "LoopCharacteristics"
14145 "name": "isSequential",
14150 "name": "behavior",
14151 "type": "MultiInstanceBehavior",
14155 "name": "loopCardinality",
14156 "type": "Expression",
14157 "serialize": "xsi:type"
14159 "name": "loopDataInputRef",
14160 "type": "ItemAwareElement",
14162 "isReference": true
14164 "name": "loopDataOutputRef",
14165 "type": "ItemAwareElement",
14167 "isReference": true
14169 "name": "inputDataItem",
14170 "type": "DataInput"
14172 "name": "outputDataItem",
14173 "type": "DataOutput"
14175 "name": "completionCondition",
14176 "type": "Expression",
14177 "serialize": "xsi:type"
14179 "name": "complexBehaviorDefinition",
14180 "type": "ComplexBehaviorDefinition",
14183 "name": "oneBehaviorEventRef",
14184 "type": "EventDefinition",
14186 "isReference": true
14188 "name": "noneBehaviorEventRef",
14189 "type": "EventDefinition",
14191 "isReference": true
14194 "name": "StandardLoopCharacteristics",
14196 "LoopCharacteristics"
14199 "name": "testBefore",
14204 "name": "loopCondition",
14205 "type": "Expression",
14206 "serialize": "xsi:type"
14208 "name": "loopMaximum",
14209 "type": "Expression",
14210 "serialize": "xsi:type"
14213 "name": "CallActivity",
14218 "name": "calledElement",
14229 "name": "InitiateProcess",
14235 "name": "VesCollector",
14267 "name": "SendTask",
14272 "name": "implementation",
14276 "name": "operationRef",
14277 "type": "Operation",
14279 "isReference": true
14281 "name": "messageRef",
14284 "isReference": true
14287 "name": "ReceiveTask",
14292 "name": "implementation",
14296 "name": "instantiate",
14301 "name": "operationRef",
14302 "type": "Operation",
14304 "isReference": true
14306 "name": "messageRef",
14309 "isReference": true
14312 "name": "ScriptTask",
14317 "name": "scriptFormat",
14325 "name": "BusinessRuleTask",
14330 "name": "implementation",
14335 "name": "AdHocSubProcess",
14340 "name": "completionCondition",
14341 "type": "Expression",
14342 "serialize": "xsi:type"
14344 "name": "ordering",
14345 "type": "AdHocOrdering",
14348 "name": "cancelRemainingInstances",
14354 "name": "Transaction",
14359 "name": "protocol",
14368 "name": "GlobalScriptTask",
14373 "name": "scriptLanguage",
14382 "name": "GlobalBusinessRuleTask",
14387 "name": "implementation",
14392 "name": "ComplexBehaviorDefinition",
14397 "name": "condition",
14398 "type": "FormalExpression"
14401 "type": "ImplicitThrowEvent"
14404 "name": "ResourceRole",
14409 "name": "resourceRef",
14410 "type": "Resource",
14411 "isReference": true
14413 "name": "resourceParameterBindings",
14414 "type": "ResourceParameterBinding",
14417 "name": "resourceAssignmentExpression",
14418 "type": "ResourceAssignmentExpression"
14425 "name": "ResourceParameterBinding",
14427 "name": "expression",
14428 "type": "Expression",
14429 "serialize": "xsi:type"
14431 "name": "parameterRef",
14432 "type": "ResourceParameter",
14434 "isReference": true
14437 "name": "ResourceAssignmentExpression",
14439 "name": "expression",
14440 "type": "Expression",
14441 "serialize": "xsi:type"
14446 "name": "importType",
14450 "name": "location",
14454 "name": "namespace",
14459 "name": "Definitions",
14468 "name": "targetNamespace",
14472 "name": "expressionLanguage",
14473 "default": "http://www.w3.org/1999/XPath",
14477 "name": "typeLanguage",
14478 "default": "http://www.w3.org/2001/XMLSchema",
14486 "name": "extensions",
14487 "type": "Extension",
14490 "name": "rootElements",
14491 "type": "RootElement",
14494 "name": "diagrams",
14496 "type": "bpmndi:BPMNDiagram"
14498 "name": "exporter",
14502 "name": "relationships",
14503 "type": "Relationship",
14506 "name": "exporterVersion",
14513 "name": "ProcessType",
14514 "literalValues": [{
14522 "name": "GatewayDirection",
14523 "literalValues": [{
14524 "name": "Unspecified"
14526 "name": "Converging"
14528 "name": "Diverging"
14533 "name": "EventBasedGatewayType",
14534 "literalValues": [{
14537 "name": "Exclusive"
14540 "name": "RelationshipDirection",
14541 "literalValues": [{
14551 "name": "ItemKind",
14552 "literalValues": [{
14555 "name": "Information"
14558 "name": "ChoreographyLoopType",
14559 "literalValues": [{
14564 "name": "MultiInstanceSequential"
14566 "name": "MultiInstanceParallel"
14569 "name": "AssociationDirection",
14570 "literalValues": [{
14578 "name": "MultiInstanceBehavior",
14579 "literalValues": [{
14589 "name": "AdHocOrdering",
14590 "literalValues": [{
14593 "name": "Sequential"
14598 "tagAlias": "lowerCase",
14603 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmndi.json": [function(require, module, exports) {
14606 "uri": "http://www.omg.org/spec/BPMN/20100524/DI",
14608 "name": "BPMNDiagram",
14611 "type": "BPMNPlane",
14612 "redefines": "di:Diagram#rootElement"
14614 "name": "labelStyle",
14615 "type": "BPMNLabelStyle",
14622 "name": "BPMNPlane",
14624 "name": "bpmnElement",
14626 "isReference": true,
14627 "type": "bpmn:BaseElement",
14628 "redefines": "di:DiagramElement#modelElement"
14634 "name": "BPMNShape",
14636 "name": "bpmnElement",
14638 "isReference": true,
14639 "type": "bpmn:BaseElement",
14640 "redefines": "di:DiagramElement#modelElement"
14642 "name": "isHorizontal",
14646 "name": "isExpanded",
14650 "name": "isMarkerVisible",
14655 "type": "BPMNLabel"
14657 "name": "isMessageVisible",
14661 "name": "participantBandKind",
14662 "type": "ParticipantBandKind",
14665 "name": "choreographyActivityShape",
14666 "type": "BPMNShape",
14668 "isReference": true
14674 "name": "BPMNEdge",
14677 "type": "BPMNLabel"
14679 "name": "bpmnElement",
14681 "isReference": true,
14682 "type": "bpmn:BaseElement",
14683 "redefines": "di:DiagramElement#modelElement"
14685 "name": "sourceElement",
14687 "isReference": true,
14688 "type": "di:DiagramElement",
14689 "redefines": "di:Edge#source"
14691 "name": "targetElement",
14693 "isReference": true,
14694 "type": "di:DiagramElement",
14695 "redefines": "di:Edge#target"
14697 "name": "messageVisibleKind",
14698 "type": "MessageVisibleKind",
14700 "default": "initiating"
14706 "name": "BPMNLabel",
14708 "name": "labelStyle",
14709 "type": "BPMNLabelStyle",
14711 "isReference": true,
14712 "redefines": "di:DiagramElement#style"
14718 "name": "BPMNLabelStyle",
14728 "name": "ParticipantBandKind",
14729 "literalValues": [{
14730 "name": "top_initiating"
14732 "name": "middle_initiating"
14734 "name": "bottom_initiating"
14736 "name": "top_non_initiating"
14738 "name": "middle_non_initiating"
14740 "name": "bottom_non_initiating"
14743 "name": "MessageVisibleKind",
14744 "literalValues": [{
14745 "name": "initiating"
14747 "name": "non_initiating"
14750 "associations": [],
14754 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\dc.json": [function(require, module, exports) {
14757 "uri": "http://www.omg.org/spec/DD/20100524/DC",
14781 "name": "isItalic",
14785 "name": "isUnderline",
14789 "name": "isStrikeThrough",
14832 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\di.json": [function(require, module, exports) {
14835 "uri": "http://www.omg.org/spec/DD/20100524/DI",
14837 "name": "DiagramElement",
14838 "isAbstract": true,
14840 "name": "extension",
14841 "type": "Extension"
14843 "name": "owningDiagram",
14845 "isReadOnly": true,
14847 "isReference": true
14849 "name": "owningElement",
14850 "type": "DiagramElement",
14851 "isReadOnly": true,
14853 "isReference": true
14855 "name": "modelElement",
14856 "isReadOnly": true,
14858 "isReference": true,
14863 "isReadOnly": true,
14865 "isReference": true
14867 "name": "ownedElement",
14868 "type": "DiagramElement",
14869 "isReadOnly": true,
14875 "isAbstract": true,
14881 "isAbstract": true,
14887 "type": "DiagramElement",
14888 "isReadOnly": true,
14890 "isReference": true
14893 "type": "DiagramElement",
14894 "isReadOnly": true,
14896 "isReference": true
14898 "name": "waypoint",
14901 "type": "dc:Point",
14902 "serialize": "xsi:type"
14906 "isAbstract": true,
14908 "name": "rootElement",
14909 "type": "DiagramElement",
14910 "isReadOnly": true,
14917 "name": "documentation",
14921 "name": "resolution",
14925 "name": "ownedStyle",
14927 "isReadOnly": true,
14933 "isAbstract": true,
14939 "type": "dc:Bounds"
14943 "isAbstract": true,
14948 "name": "planeElement",
14949 "type": "DiagramElement",
14950 "subsettedProperty": "DiagramElement-ownedElement",
14954 "name": "LabeledEdge",
14955 "isAbstract": true,
14960 "name": "ownedLabel",
14962 "isReadOnly": true,
14963 "subsettedProperty": "DiagramElement-ownedElement",
14968 "name": "LabeledShape",
14969 "isAbstract": true,
14974 "name": "ownedLabel",
14976 "isReadOnly": true,
14977 "subsettedProperty": "DiagramElement-ownedElement",
14983 "isAbstract": true,
14989 "type": "dc:Bounds"
14995 "name": "Extension",
15002 "associations": [],
15005 "tagAlias": "lowerCase"
15009 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\index.js": [function(require, module, exports) {
15011 __depends__: [require('diagram-js/lib/features/interaction-events')],
15012 __init__: ['directEditing'],
15013 directEditing: ['type', require('./lib/DirectEditing')]
15016 "./lib/DirectEditing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\DirectEditing.js",
15017 "diagram-js/lib/features/interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js"
15019 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\DirectEditing.js": [function(require, module, exports) {
15022 var bind = require('lodash/function/bind'),
15023 find = require('lodash/collection/find');
15025 var TextBox = require('./TextBox');
15029 * A direct editing component that allows users to edit an elements text
15030 * directly in the diagram
15032 * @param {EventBus}
15033 * eventBus the event bus
15035 function DirectEditing(eventBus, canvas) {
15037 this._eventBus = eventBus;
15039 this._providers = [];
15040 this._textbox = new TextBox({
15041 container: canvas.getContainer(),
15042 keyHandler: bind(this._handleKey, this)
15046 DirectEditing.$inject = ['eventBus', 'canvas'];
15050 * Register a direct editing provider
15053 * provider the provider, must expose an #activate(element) method
15054 * that returns an activation context ({ bounds: {x, y, width, height },
15055 * text }) if direct editing is available for the given element.
15056 * Additionally the provider must expose a #update(element, value)
15057 * method to receive direct editing updates.
15059 DirectEditing.prototype.registerProvider = function(provider) {
15060 this._providers.push(provider);
15065 * Returns true if direct editing is currently active
15067 * @return {Boolean}
15069 DirectEditing.prototype.isActive = function() {
15070 return !!this._active;
15075 * Cancel direct editing, if it is currently active
15077 DirectEditing.prototype.cancel = function() {
15078 if (!this._active) {
15082 this._fire('cancel');
15087 DirectEditing.prototype._fire = function(event) {
15088 this._eventBus.fire('directEditing.' + event, {
15089 active: this._active
15093 DirectEditing.prototype.close = function() {
15094 this._textbox.destroy();
15096 this._fire('deactivate');
15098 this._active = null;
15102 DirectEditing.prototype.complete = function() {
15104 var active = this._active;
15110 var text = this.getValue();
15112 if (text !== active.context.text) {
15113 active.provider.update(active.element, text, active.context.text);
15116 this._fire('complete');
15122 DirectEditing.prototype.getValue = function() {
15123 return this._textbox.getValue();
15127 DirectEditing.prototype._handleKey = function(e) {
15130 e.stopPropagation();
15132 var key = e.keyCode || e.charCode;
15136 e.preventDefault();
15137 return this.cancel();
15141 if (key === 13 && !e.shiftKey) {
15142 e.preventDefault();
15143 return this.complete();
15149 * Activate direct editing on the given element
15152 * ElementDescriptor the descriptor for a shape or connection
15153 * @return {Boolean} true if the activation was possible
15155 DirectEditing.prototype.activate = function(element) {
15157 if (this.isActive()) {
15161 // the direct editing context
15164 var provider = find(this._providers, function(p) {
15165 return !!(context = p.activate(element)) ? p : null;
15168 // check if activation took place
15170 this._textbox.create(context.bounds, context.style, context.text);
15178 this._fire('activate');
15185 module.exports = DirectEditing;
15187 "./TextBox": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\TextBox.js",
15188 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
15189 "lodash/function/bind": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\bind.js"
15191 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\TextBox.js": [function(require, module, exports) {
15194 var assign = require('lodash/object/assign'),
15195 domEvent = require('min-dom/lib/event'),
15196 domRemove = require('min-dom/lib/remove');
15198 function stopPropagation(event) {
15199 event.stopPropagation();
15202 function TextBox(options) {
15204 this.container = options.container;
15205 this.textarea = document.createElement('textarea');
15207 this.keyHandler = options.keyHandler || function() {};
15210 module.exports = TextBox;
15213 TextBox.prototype.create = function(bounds, style, value) {
15215 var textarea = this.textarea,
15216 container = this.container;
15218 assign(textarea.style, {
15219 width: bounds.width + 'px',
15220 height: bounds.height + 'px',
15221 left: bounds.x + 'px',
15222 top: bounds.y + 'px',
15223 position: 'absolute',
15224 textAlign: 'center',
15225 boxSizing: 'border-box'
15228 textarea.value = value;
15229 textarea.title = 'Press SHIFT+Enter for line feed';
15231 domEvent.bind(textarea, 'keydown', this.keyHandler);
15232 domEvent.bind(textarea, 'mousedown', stopPropagation);
15234 container.appendChild(textarea);
15236 setTimeout(function() {
15237 if (textarea.parent) {
15244 TextBox.prototype.destroy = function() {
15245 var textarea = this.textarea;
15247 textarea.value = '';
15249 domEvent.unbind(textarea, 'keydown', this.keyHandler);
15250 domEvent.unbind(textarea, 'mousedown', stopPropagation);
15252 domRemove(textarea);
15255 TextBox.prototype.getValue = function() {
15256 return this.textarea.value;
15260 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
15261 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\event.js",
15262 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\remove.js"
15264 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\ids\\index.js": [function(require, module, exports) {
15267 var hat = require('hat');
15271 * Create a new id generator / cache instance.
15273 * You may optionally provide a seed that is used internally.
15278 function Ids(seed) {
15279 seed = seed || [128, 36, 1];
15280 this._seed = seed.length ? hat.rack(seed[0], seed[1], seed[2]) : seed;
15283 module.exports = Ids;
15286 * Generate a next id.
15289 * [element] element to bind the id to
15291 * @return {String} id
15293 Ids.prototype.next = function(element) {
15294 return this._seed(element || true);
15298 * Generate a next id with a given prefix.
15301 * [element] element to bind the id to
15303 * @return {String} id
15305 Ids.prototype.nextPrefixed = function(prefix, element) {
15309 id = prefix + this.next(true);
15310 } while (this.assigned(id));
15312 // claim {prefix}{random}
15313 this.claim(id, element);
15320 * Manually claim an existing id.
15325 * [element] element the id is claimed by
15327 Ids.prototype.claim = function(id, element) {
15328 this._seed.set(id, element || true);
15332 * Returns true if the given id has already been assigned.
15336 * @return {Boolean}
15338 Ids.prototype.assigned = function(id) {
15339 return this._seed.get(id) || false;
15342 "hat": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\ids\\node_modules\\hat\\index.js"
15344 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\ids\\node_modules\\hat\\index.js": [function(require, module, exports) {
15345 var hat = module.exports = function(bits, base) {
15346 if (!base) base = 16;
15347 if (bits === undefined) bits = 128;
15348 if (bits <= 0) return '0';
15350 var digits = Math.log(Math.pow(2, bits)) / Math.log(base);
15351 for (var i = 2; digits === Infinity; i *= 2) {
15352 digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i;
15355 var rem = digits - Math.floor(digits);
15359 for (var i = 0; i < Math.floor(digits); i++) {
15360 var x = Math.floor(Math.random() * base).toString(base);
15365 var b = Math.pow(base, rem);
15366 var x = Math.floor(Math.random() * b).toString(base);
15370 var parsed = parseInt(res, base);
15371 if (parsed !== Infinity && parsed >= Math.pow(2, bits)) {
15372 return hat(bits, base)
15376 hat.rack = function(bits, base, expandBy) {
15377 var fn = function(data) {
15380 if (iters++ > 10) {
15381 if (expandBy) bits += expandBy;
15382 else throw new Error('too many ID collisions, use more bits')
15385 var id = hat(bits, base);
15386 } while (Object.hasOwnProperty.call(hats, id));
15391 var hats = fn.hats = {};
15393 fn.get = function(id) {
15394 return fn.hats[id];
15397 fn.set = function(id, value) {
15398 fn.hats[id] = value;
15402 fn.bits = bits || 128;
15403 fn.base = base || 16;
15408 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js": [function(require, module, exports) {
15409 if (typeof Object.create === 'function') {
15410 // implementation from standard node.js 'util' module
15411 module.exports = function inherits(ctor, superCtor) {
15412 ctor.super_ = superCtor
15413 ctor.prototype = Object.create(superCtor.prototype, {
15423 // old school shim for old browsers
15424 module.exports = function inherits(ctor, superCtor) {
15425 ctor.super_ = superCtor
15426 var TempCtor = function() {}
15427 TempCtor.prototype = superCtor.prototype
15428 ctor.prototype = new TempCtor()
15429 ctor.prototype.constructor = ctor
15434 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\domify.js": [function(require, module, exports) {
15435 module.exports = require('domify');
15437 "domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\domify\\index.js"
15439 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\event.js": [function(require, module, exports) {
15440 module.exports = require('component-event');
15442 "component-event": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js"
15444 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\query.js": [function(require, module, exports) {
15445 module.exports = require('component-query');
15447 "component-query": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js"
15449 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\remove.js": [function(require, module, exports) {
15450 module.exports = function(el) {
15451 el.parentNode && el.parentNode.removeChild(el);
15454 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js": [function(require, module, exports) {
15455 var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
15456 unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
15457 prefix = bind !== 'addEventListener' ? 'on' : '';
15460 * Bind `el` event `type` to `fn`.
15466 * @param {Function}
15470 * @return {Function}
15474 exports.bind = function(el, type, fn, capture) {
15475 el[bind](prefix + type, fn, capture || false);
15480 * Unbind `el` event `type`'s callback `fn`.
15486 * @param {Function}
15490 * @return {Function}
15494 exports.unbind = function(el, type, fn, capture) {
15495 el[unbind](prefix + type, fn, capture || false);
15499 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js": [function(require, module, exports) {
15500 function one(selector, el) {
15501 return el.querySelector(selector);
15504 exports = module.exports = function(selector, el) {
15505 el = el || document;
15506 return one(selector, el);
15509 exports.all = function(selector, el) {
15510 el = el || document;
15511 return el.querySelectorAll(selector);
15514 exports.engine = function(obj) {
15515 if (!obj.one) throw new Error('.one callback required');
15516 if (!obj.all) throw new Error('.all callback required');
15518 exports.all = obj.all;
15523 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\domify\\index.js": [function(require, module, exports) {
15529 module.exports = parse;
15532 * Tests for browser support.
15535 var div = document.createElement('div');
15537 div.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
15538 // Make sure that link elements get serialized correctly by innerHTML
15539 // This requires a wrapper element in IE
15540 var innerHTMLBug = !div.getElementsByTagName('link').length;
15544 * Wrap map from jquery.
15548 legend: [1, '<fieldset>', '</fieldset>'],
15549 tr: [2, '<table><tbody>', '</tbody></table>'],
15550 col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
15551 // for script/link/style tags to work in IE6-8, you have to wrap
15552 // in a div with a non-whitespace character in front, ha!
15553 _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
15557 map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
15560 map.optgroup = [1, '<select multiple="multiple">', '</select>'];
15566 map.tfoot = [1, '<table>', '</table>'];
15576 map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
15579 * Parse `html` and return a DOM Node instance, which could be a TextNode, HTML
15580 * DOM Node of some kind (<div> for example), or a DocumentFragment instance,
15581 * depending on the contents of the `html` string.
15584 * html - HTML string to "domify"
15585 * @param {Document}
15586 * doc - The `document` instance to create the Node for
15587 * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
15591 function parse(html, doc) {
15592 if ('string' != typeof html) throw new TypeError('String expected');
15594 // default to the global `document` object
15595 if (!doc) doc = document;
15598 var m = /<([\w:]+)/.exec(html);
15599 if (!m) return doc.createTextNode(html);
15601 html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing
15607 if (tag == 'body') {
15608 var el = doc.createElement('html');
15609 el.innerHTML = html;
15610 return el.removeChild(el.lastChild);
15614 var wrap = map[tag] || map._default;
15615 var depth = wrap[0];
15616 var prefix = wrap[1];
15617 var suffix = wrap[2];
15618 var el = doc.createElement('div');
15619 el.innerHTML = prefix + html + suffix;
15620 while (depth--) el = el.lastChild;
15623 if (el.firstChild == el.lastChild) {
15624 return el.removeChild(el.firstChild);
15627 // several elements
15628 var fragment = doc.createDocumentFragment();
15629 while (el.firstChild) {
15630 fragment.appendChild(el.removeChild(el.firstChild));
15637 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\index.js": [function(require, module, exports) {
15638 module.exports = require('./lib/refs');
15640 module.exports.Collection = require('./lib/collection');
15642 "./lib/collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js",
15643 "./lib/refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\refs.js"
15645 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js": [function(require, module, exports) {
15649 * An empty collection stub. Use {@link RefsCollection.extend} to extend a
15650 * collection with ref semantics.
15652 * @classdesc A change and inverse-reference aware collection with set
15655 * @class RefsCollection
15657 function RefsCollection() {}
15660 * Extends a collection with {@link Refs} aware methods
15662 * @memberof RefsCollection
15666 * <Object>} collection
15670 * property represented by the collection
15672 * target object the collection is attached to
15674 * @return {RefsCollection<Object>} the extended array
15676 function extend(collection, refs, property, target) {
15678 var inverseProperty = property.inverse;
15681 * Removes the given element from the array and returns it.
15683 * @method RefsCollection#remove
15686 * element the element to remove
15688 collection.remove = function(element) {
15689 var idx = this.indexOf(element);
15691 this.splice(idx, 1);
15694 refs.unset(element, inverseProperty, target);
15701 * Returns true if the collection contains the given element
15703 * @method RefsCollection#contains
15706 * element the element to check for
15708 collection.contains = function(element) {
15709 return this.indexOf(element) !== -1;
15713 * Adds an element to the array, unless it exists already (set semantics).
15715 * @method RefsCollection#add
15718 * element the element to add
15720 collection.add = function(element) {
15722 if (!this.contains(element)) {
15723 this.push(element);
15726 refs.set(element, inverseProperty, target);
15734 module.exports.extend = extend;
15736 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\refs.js": [function(require, module, exports) {
15739 var Collection = require('./collection');
15741 function hasOwnProperty(e, property) {
15742 return Object.prototype.hasOwnProperty.call(e, property.name || property);
15746 function defineCollectionProperty(ref, property, target) {
15747 Object.defineProperty(target, property.name, {
15748 enumerable: property.enumerable,
15749 value: Collection.extend(target[property.name] || [], ref, property, target)
15754 function defineProperty(ref, property, target) {
15756 var inverseProperty = property.inverse;
15758 var _value = target[property.name];
15760 Object.defineProperty(target, property.name, {
15761 enumerable: property.enumerable,
15767 set: function(value) {
15769 // return if we already performed all changes
15770 if (value === _value) {
15776 // temporary set null
15780 ref.unset(old, inverseProperty, target);
15786 // set inverse value
15787 ref.set(_value, inverseProperty, target);
15794 * Creates a new references object defining two inversly related attribute
15795 * descriptors a and b.
15798 * When bound to an object using {@link Refs#bind} the references get activated
15799 * and ensure that add and remove operations are applied reversely, too.
15803 * For attributes represented as collections {@link Refs} provides the
15804 * {@link RefsCollection#add}, {@link RefsCollection#remove} and
15805 * {@link RefsCollection#contains} extensions that must be used to properly hook
15806 * into the inverse change mechanism.
15811 * @classdesc A bi-directional reference between two attributes.
15813 * @param {Refs.AttributeDescriptor}
15814 * a property descriptor
15815 * @param {Refs.AttributeDescriptor}
15816 * b property descriptor
15820 * var refs = Refs({ name: 'wheels', collection: true, enumerable: true }, {
15823 * var car = { name: 'toyota' }; var wheels = [{ pos: 'front-left' }, { pos:
15824 * 'front-right' }];
15826 * refs.bind(car, 'wheels');
15828 * car.wheels // [] car.wheels.add(wheels[0]); car.wheels.add(wheels[1]);
15830 * car.wheels // [{ pos: 'front-left' }, { pos: 'front-right' }]
15832 * wheels[0].car // { name: 'toyota' }; car.wheels.remove(wheels[0]);
15834 * wheels[0].car // undefined
15836 function Refs(a, b) {
15838 if (!(this instanceof Refs)) {
15839 return new Refs(a, b);
15847 this.props[a.name] = a;
15848 this.props[b.name] = b;
15852 * Binds one side of a bi-directional reference to a target object.
15861 Refs.prototype.bind = function(target, property) {
15862 if (typeof property === 'string') {
15863 if (!this.props[property]) {
15864 throw new Error('no property <' + property + '> in ref');
15866 property = this.props[property];
15869 if (property.collection) {
15870 defineCollectionProperty(this, property, target);
15872 defineProperty(this, property, target);
15876 Refs.prototype.ensureBound = function(target, property) {
15877 if (!hasOwnProperty(target, property)) {
15878 this.bind(target, property);
15882 Refs.prototype.unset = function(target, property, value) {
15885 this.ensureBound(target, property);
15887 if (property.collection) {
15888 target[property.name].remove(value);
15890 target[property.name] = undefined;
15895 Refs.prototype.set = function(target, property, value) {
15898 this.ensureBound(target, property);
15900 if (property.collection) {
15901 target[property.name].add(value);
15903 target[property.name] = value;
15908 module.exports = Refs;
15912 * An attribute descriptor to be used specify an attribute in a {@link Refs}
15915 * @typedef {Object} Refs.AttributeDescriptor
15916 * @property {String} name
15917 * @property {boolean} [collection=false]
15918 * @property {boolean} [enumerable=false]
15921 "./collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js"
15923 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\index.js": [function(require, module, exports) {
15924 module.exports = require('./lib/Diagram');
15926 "./lib/Diagram": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\Diagram.js"
15928 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\Diagram.js": [function(require, module, exports) {
15931 var di = require('didi');
15935 * Bootstrap an injector from a list of modules, instantiating a number of
15936 * default components
15940 * <didi.Module>} bootstrapModules
15942 * @return {didi.Injector} a injector to use to access the components
15944 function bootstrap(bootstrapModules) {
15949 function hasModule(m) {
15950 return modules.indexOf(m) >= 0;
15953 function addModule(m) {
15957 function visit(m) {
15958 if (hasModule(m)) {
15962 (m.__depends__ || []).forEach(visit);
15964 if (hasModule(m)) {
15970 (m.__init__ || []).forEach(function(c) {
15971 components.push(c);
15975 bootstrapModules.forEach(visit);
15977 var injector = new di.Injector(modules);
15979 components.forEach(function(c) {
15982 // eagerly resolve component (fn or string)
15983 injector[typeof c === 'string' ? 'get' : 'invoke'](c);
15985 console.error('Failed to instantiate component');
15986 console.error(e.stack);
15996 * Creates an injector from passed options.
16001 * @return {didi.Injector}
16003 function createInjector(options) {
16005 options = options || {};
16007 var configModule = {
16008 'config': ['value', options]
16011 var coreModule = require('./core');
16013 var modules = [configModule, coreModule].concat(options.modules || []);
16015 return bootstrap(modules);
16020 * The main diagram-js entry point that bootstraps the diagram with the given
16023 * To register extensions with the diagram, pass them as Array<didi.Module> to
16026 * @class djs.Diagram
16032 * <caption>Creating a plug-in that logs whenever a shape is added to the
16033 * canvas.</caption>
16034 * // plug-in implemenentation function MyLoggingPlugin(eventBus) {
16035 * eventBus.on('shape.added', function(event) { console.log('shape ',
16036 * event.shape, ' was added to the diagram'); }); }
16037 * // export as module module.exports = { __init__: [ 'myLoggingPlugin' ],
16038 * myLoggingPlugin: [ 'type', MyLoggingPlugin ] };
16040 * // instantiate the diagram with the new plug-in
16042 * var diagram = new Diagram({ modules: [ require('path-to-my-logging-plugin') ]
16045 * diagram.invoke([ 'canvas', function(canvas) { // add shape to drawing canvas
16046 * canvas.addShape({ x: 10, y: 10 }); });
16047 * // 'shape ... was added to the diagram' logged to console
16052 * <didi.Module>} [options.modules] external modules to instantiate
16054 * @param {didi.Injector}
16055 * [injector] an (optional) injector to bootstrap the diagram with
16057 function Diagram(options, injector) {
16059 // create injector unless explicitly specified
16060 this.injector = injector = injector || createInjector(options);
16065 * Resolves a diagram service
16067 * @method Diagram#get
16070 * name the name of the diagram service to be retrieved
16072 * [locals] a number of locals to use to resolve certain
16075 this.get = injector.get;
16078 * Executes a function into which diagram services are injected
16080 * @method Diagram#invoke
16082 * @param {Function|Object[]}
16083 * fn the function to resolve
16085 * locals a number of locals to use to resolve certain
16088 this.invoke = injector.invoke;
16092 // indicate via event
16096 * An event indicating that all plug-ins are loaded.
16098 * Use this event to fire other events to interested plug-ins
16100 * @memberOf Diagram
16102 * @event diagram.init
16106 * eventBus.on('diagram.init', function() { eventBus.fire('my-custom-event', {
16107 * foo: 'BAR' }); });
16111 this.get('eventBus').fire('diagram.init');
16114 module.exports = Diagram;
16118 * Destroys the diagram
16120 * @method Diagram#destroy
16122 Diagram.prototype.destroy = function() {
16123 this.get('eventBus').fire('diagram.destroy');
16126 "./core": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\index.js",
16127 "didi": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\index.js"
16129 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js": [function(require, module, exports) {
16132 var forEach = require('lodash/collection/forEach'),
16133 isFunction = require('lodash/lang/isFunction'),
16134 isArray = require('lodash/lang/isArray');
16138 * A utility that can be used to plug-in into the command execution for
16139 * extension and/or validation.
16141 * @param {EventBus}
16146 * var inherits = require('inherits');
16148 * var CommandInterceptor =
16149 * require('diagram-js/lib/command/CommandInterceptor');
16151 * function CommandLogger(eventBus) { CommandInterceptor.call(this, eventBus);
16153 * this.preExecute(function(event) { console.log('command pre-execute', event);
16156 * inherits(CommandLogger, CommandInterceptor);
16159 function CommandInterceptor(eventBus) {
16160 this._eventBus = eventBus;
16163 CommandInterceptor.$inject = ['eventBus'];
16165 module.exports = CommandInterceptor;
16167 function unwrapEvent(fn) {
16168 return function(event) {
16169 return fn(event.context, event.command, event);
16174 * Register an interceptor for a command execution
16176 * @param {String|Array
16177 * <String>} [events] list of commands to register on
16179 * [hook] command hook, i.e. preExecute, executed to listen on
16180 * @param {Function}
16181 * handlerFn interceptor to be invoked with (event)
16183 * unwrap if true, unwrap the event and pass (context, command,
16184 * event) to the listener instead
16186 CommandInterceptor.prototype.on = function(events, hook, handlerFn, unwrap) {
16188 if (isFunction(hook)) {
16189 unwrap = handlerFn;
16194 if (!isFunction(handlerFn)) {
16195 throw new Error('handlerFn must be a function');
16198 if (!isArray(events)) {
16202 var eventBus = this._eventBus;
16204 forEach(events, function(event) {
16205 // concat commandStack(.event)?(.hook)?
16206 var fullEvent = ['commandStack', event, hook].filter(function(e) {
16210 eventBus.on(fullEvent, unwrap ? unwrapEvent(handlerFn) : handlerFn);
16226 * Install hook shortcuts
16228 * This will generate the CommandInterceptor#(preExecute|...|reverted) methods
16229 * which will in term forward to CommandInterceptor#on.
16231 forEach(hooks, function(hook) {
16232 CommandInterceptor.prototype[hook] = function(events, fn, unwrap) {
16233 if (isFunction(events)) {
16239 this.on(events, hook, fn, unwrap);
16243 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
16244 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
16245 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js"
16247 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandStack.js": [function(require, module, exports) {
16250 var unique = require('lodash/array/unique'),
16251 isArray = require('lodash/lang/isArray'),
16252 assign = require('lodash/object/assign');
16254 var InternalEvent = require('../core/EventBus').Event;
16258 * A service that offers un- and redoable execution of commands.
16260 * The command stack is responsible for executing modeling actions in a un- and
16261 * redoable manner. To do this it delegates the actual command execution to
16262 * {@link CommandHandler}s.
16264 * Command handlers provide {@link CommandHandler#execute(ctx)} and
16265 * {@link CommandHandler#revert(ctx)} methods to un- and redo a command
16266 * identified by a command context.
16268 * ## Life-Cycle events
16270 * In the process the command stack fires a number of life-cycle events that
16271 * other components to participate in the command execution.
16272 * * preExecute * execute * executed * postExecute * revert * reverted
16274 * A special event is used for validating, whether a command can be performed
16275 * prior to its execution.
16278 * Each of the events is fired as `commandStack.{eventName}` and
16279 * `commandStack.{commandName}.{eventName}`, respectively. This gives components
16280 * fine grained control on where to hook into.
16282 * The event object fired transports `command`, the name of the command and
16283 * `context`, the command context.
16285 * ## Creating Command Handlers
16287 * Command handlers should provide the {@link CommandHandler#execute(ctx)} and
16288 * {@link CommandHandler#revert(ctx)} methods to implement redoing and undoing
16289 * of a command. They must ensure undo is performed properly in order not to
16290 * break the undo chain.
16292 * Command handlers may execute other modeling operations (and thus commands) in
16293 * their `preExecute` and `postExecute` phases. The command stack will properly
16294 * group all commands together into a logical unit that may be re- and undone
16297 * Command handlers must not execute other commands from within their core
16298 * implementation (`execute`, `revert`).
16300 * ## Change Tracking
16302 * During the execution of the CommandStack it will keep track of all elements
16303 * that have been touched during the command's execution.
16305 * At the end of the CommandStack execution it will notify interested components
16306 * via an 'elements.changed' event with all the dirty elements.
16308 * The event can be picked up by components that are interested in the fact that
16309 * elements have been changed. One use case for this is updating their graphical
16310 * representation after moving / resizing or deletion.
16313 * @param {EventBus}
16315 * @param {Injector}
16318 function CommandStack(eventBus, injector) {
16320 * A map of all registered command handlers.
16324 this._handlerMap = {};
16327 * A stack containing all re/undoable actions on the diagram
16329 * @type {Array<Object>}
16334 * The current index on the stack
16338 this._stackIdx = -1;
16341 * Current active commandStack execution
16345 this._currentExecution = {
16351 this._injector = injector;
16352 this._eventBus = eventBus;
16355 this._selectedModel = selected_model;
16357 commandStackList.push(this);
16360 CommandStack.$inject = ['eventBus', 'injector'];
16362 module.exports = CommandStack;
16366 * Execute a command
16369 * command the command to execute
16371 * context the environment to execute the command in
16373 CommandStack.prototype.execute = function(command, context) {
16375 throw new Error('command required');
16383 this._pushAction(action);
16384 this._internalExecute(action);
16385 this._popAction(action);
16390 * Ask whether a given command can be executed.
16392 * Implementors may hook into the mechanism on two ways:
16393 * * in event listeners:
16395 * Users may prevent the execution via an event listener. It must prevent the
16396 * default action for `commandStack.(<command>.)canExecute` events.
16397 * * in command handlers:
16399 * If the method {@link CommandHandler#canExecute} is implemented in a handler
16400 * it will be called to figure out whether the execution is allowed.
16403 * command the command to execute
16405 * context the environment to execute the command in
16407 * @return {Boolean} true if the command can be executed
16409 CommandStack.prototype.canExecute = function(command, context) {
16416 var handler = this._getHandler(command);
16422 var result = this._fire(command, 'canExecute', action);
16424 // handler#canExecute will only be called if no listener
16425 // decided on a result already
16426 if (result === undefined && handler.canExecute) {
16427 result = handler.canExecute(context);
16435 * Clear the command stack, erasing all undo / redo history
16437 CommandStack.prototype.clear = function() {
16438 this._stack.length = 0;
16439 this._stackIdx = -1;
16441 this._fire('changed');
16446 * Undo last command(s)
16448 CommandStack.prototype.undo = function() {
16449 var action = this._getUndoAction(),
16452 this._pushAction(action);
16455 this._internalUndo(action);
16456 next = this._getUndoAction();
16458 if (!next || next.id !== action.id) {
16471 * Redo last command(s)
16473 CommandStack.prototype.redo = function() {
16474 var action = this._getRedoAction(),
16478 this._pushAction(action);
16481 this._internalExecute(action, true);
16482 next = this._getRedoAction();
16484 if (!next || next.id !== action.id) {
16497 * Register a handler instance with the command stack
16501 * @param {CommandHandler}
16504 CommandStack.prototype.register = function(command, handler) {
16505 this._setHandler(command, handler);
16510 * Register a handler type with the command stack by instantiating it and
16511 * injecting its dependencies.
16515 * @param {Function}
16516 * a constructor for a {@link CommandHandler}
16518 CommandStack.prototype.registerHandler = function(command, handlerCls) {
16520 if (!command || !handlerCls) {
16521 throw new Error('command and handlerCls must be defined');
16524 var handler = this._injector.instantiate(handlerCls);
16525 this.register(command, handler);
16528 CommandStack.prototype.canUndo = function() {
16529 return !!this._getUndoAction();
16532 CommandStack.prototype.canRedo = function() {
16533 return !!this._getRedoAction();
16536 // //// stack access //////////////////////////////////////
16538 CommandStack.prototype._getRedoAction = function() {
16539 return this._stack[this._stackIdx + 1];
16543 CommandStack.prototype._getUndoAction = function() {
16544 return this._stack[this._stackIdx];
16548 // //// internal functionality /////////////////////////////
16550 CommandStack.prototype._internalUndo = function(action) {
16551 var command = action.command,
16552 context = action.context;
16554 var handler = this._getHandler(command);
16556 this._fire(command, 'revert', action);
16558 this._markDirty(handler.revert(context));
16560 this._revertedAction(action);
16562 this._fire(command, 'reverted', action);
16566 CommandStack.prototype._fire = function(command, qualifier, event) {
16567 if (arguments.length < 3) {
16572 var names = qualifier ? [command + '.' + qualifier, qualifier] : [command],
16575 event = assign(new InternalEvent(), event);
16577 for (i = 0; !!(name = names[i]); i++) {
16578 result = this._eventBus.fire('commandStack.' + name, event);
16580 if (event.cancelBubble) {
16588 CommandStack.prototype._createId = function() {
16589 return this._uid++;
16593 CommandStack.prototype._internalExecute = function(action, redo) {
16594 var command = action.command,
16595 context = action.context;
16597 var handler = this._getHandler(command);
16600 throw new Error('no command handler registered for <' + command + '>');
16603 this._pushAction(action);
16606 this._fire(command, 'preExecute', action);
16608 if (handler.preExecute) {
16609 handler.preExecute(context);
16613 this._fire(command, 'execute', action);
16616 this._markDirty(handler.execute(context));
16619 this._executedAction(action, redo);
16621 this._fire(command, 'executed', action);
16624 if (handler.postExecute) {
16625 handler.postExecute(context);
16628 this._fire(command, 'postExecute', action);
16631 this._popAction(action);
16635 CommandStack.prototype._pushAction = function(action) {
16637 var execution = this._currentExecution,
16638 actions = execution.actions;
16640 var baseAction = actions[0];
16643 action.id = (baseAction && baseAction.id) || this._createId();
16646 actions.push(action);
16650 CommandStack.prototype._popAction = function() {
16651 var execution = this._currentExecution,
16652 actions = execution.actions,
16653 dirty = execution.dirty;
16657 if (!actions.length) {
16658 this._eventBus.fire('elements.changed', {
16659 elements: unique(dirty)
16664 this._fire('changed');
16669 CommandStack.prototype._markDirty = function(elements) {
16670 var execution = this._currentExecution;
16676 elements = isArray(elements) ? elements : [elements];
16678 execution.dirty = execution.dirty.concat(elements);
16682 CommandStack.prototype._executedAction = function(action, redo) {
16683 var stackIdx = ++this._stackIdx;
16686 this._stack.splice(stackIdx, this._stack.length, action);
16691 CommandStack.prototype._revertedAction = function(action) {
16696 CommandStack.prototype._getHandler = function(command) {
16697 return this._handlerMap[command];
16700 CommandStack.prototype._setHandler = function(command, handler) {
16701 if (!command || !handler) {
16702 throw new Error('command and handler required');
16705 if (this._handlerMap[command]) {
16706 throw new Error('overriding handler for command <' + command + '>');
16709 this._handlerMap[command] = handler;
16713 "../core/EventBus": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js",
16714 "lodash/array/unique": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\unique.js",
16715 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
16716 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
16718 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js": [function(require, module, exports) {
16720 __depends__: [require('../core')],
16721 commandStack: ['type', require('./CommandStack')]
16724 "../core": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\index.js",
16725 "./CommandStack": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandStack.js"
16727 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\Canvas.js": [function(require, module, exports) {
16730 var isNumber = require('lodash/lang/isNumber'),
16731 assign = require('lodash/object/assign'),
16732 forEach = require('lodash/collection/forEach');
16734 var Collections = require('../util/Collections');
16736 var Snap = require('../../vendor/snapsvg');
16738 function round(number, resolution) {
16739 return Math.round(number * resolution) / resolution;
16742 function ensurePx(number) {
16743 return isNumber(number) ? number + 'px' : number;
16747 * Creates a HTML container element for a SVG element with the given
16752 * @return {HTMLElement} the container element
16754 function createContainer(options) {
16756 options = assign({}, {
16761 var container = options.container || document.body;
16763 // create a <div> around the svg element with the respective size
16764 // this way we can always get the correct container size
16765 // (this is impossible for <svg> elements at the moment)
16766 var parent = document.createElement('div');
16767 parent.setAttribute('class', 'djs-container');
16769 assign(parent.style, {
16770 position: 'relative',
16771 overflow: 'hidden',
16772 width: ensurePx(options.width),
16773 height: ensurePx(options.height)
16776 container.appendChild(parent);
16781 function createGroup(parent, cls) {
16782 return parent.group().attr({
16787 var BASE_LAYER = 'base';
16791 * The main drawing canvas.
16796 * @emits Canvas#canvas.init
16800 * @param {EventBus}
16802 * @param {GraphicsFactory}
16804 * @param {ElementRegistry}
16807 function Canvas(config, eventBus, graphicsFactory, elementRegistry) {
16808 this._eventBus = eventBus;
16809 this._elementRegistry = elementRegistry;
16810 this._graphicsFactory = graphicsFactory;
16812 this._init(config || {});
16815 Canvas.$inject = ['config.canvas', 'eventBus', 'graphicsFactory', 'elementRegistry'];
16817 module.exports = Canvas;
16820 Canvas.prototype._init = function(config) {
16822 // Creates a <svg> element that is wrapped into a <div>.
16823 // This way we are always able to correctly figure out the size of the svg
16825 // by querying the parent node.
16827 // (It is not possible to get the size of a svg element cross browser @
16830 // <div class="djs-container" style="width: {desired-width}, height:
16831 // {desired-height}">
16832 // <svg width="100%" height="100%">
16838 var eventBus = this._eventBus,
16840 container = createContainer(config),
16841 svg = Snap.createSnapAt('100%', '100%', container),
16842 viewport = createGroup(svg, 'viewport'),
16846 this._container = container;
16848 this._viewport = viewport;
16851 eventBus.on('diagram.init', function(event) {
16854 * An event indicating that the canvas is ready to be drawn on.
16858 * @event canvas.init
16861 * @property {Snap<SVGSVGElement>} svg the created svg element
16862 * @property {Snap<SVGGroup>} viewport the direct parent of diagram
16863 * elements and shapes
16865 eventBus.fire('canvas.init', {
16871 eventBus.on('diagram.destroy', function() {
16873 var parent = self._container.parentNode;
16876 parent.removeChild(container);
16879 eventBus.fire('canvas.destroy', {
16881 viewport: self._viewport
16884 self._svg.remove();
16886 self._svg = self._container = self._layers = self._viewport = null;
16892 * Returns the default layer on which all elements are drawn.
16894 * @returns {Snap<SVGGroup>}
16896 Canvas.prototype.getDefaultLayer = function() {
16897 return this.getLayer(BASE_LAYER);
16901 * Returns a layer that is used to draw elements or annotations on it.
16906 * @returns {Snap<SVGGroup>}
16908 Canvas.prototype.getLayer = function(name) {
16911 throw new Error('must specify a name');
16914 var layer = this._layers[name];
16916 layer = this._layers[name] = createGroup(this._viewport, 'layer-' + name);
16924 * Returns the html element that encloses the drawing canvas.
16926 * @return {DOMNode}
16928 Canvas.prototype.getContainer = function() {
16929 return this._container;
16933 // ///////////// markers ///////////////////////////////////
16935 Canvas.prototype._updateMarker = function(element, marker, add) {
16939 element = this._elementRegistry.get(element);
16942 // we need to access all
16943 container = this._elementRegistry._elements[element.id];
16949 forEach([container.gfx, container.secondaryGfx], function(gfx) {
16951 // invoke either addClass or removeClass based on mode
16952 gfx[add ? 'addClass' : 'removeClass'](marker);
16957 * An event indicating that a marker has been updated for an element
16959 * @event element.marker.update
16961 * @property {djs.model.Element} element the shape
16962 * @property {Object} gfx the graphical representation of the shape
16963 * @property {String} marker
16964 * @property {Boolean} add true if the marker was added, false if it got
16967 this._eventBus.fire('element.marker.update', {
16969 gfx: container.gfx,
16977 * Adds a marker to an element (basically a css class).
16979 * Fires the element.marker.update event, making it possible to integrate
16980 * extension into the marker life-cycle, too.
16982 * @example canvas.addMarker('foo', 'some-marker');
16984 * var fooGfx = canvas.getGraphics('foo');
16986 * fooGfx; // <g class="... some-marker"> ... </g>
16988 * @param {String|djs.model.Base}
16993 Canvas.prototype.addMarker = function(element, marker) {
16994 this._updateMarker(element, marker, true);
16999 * Remove a marker from an element.
17001 * Fires the element.marker.update event, making it possible to integrate
17002 * extension into the marker life-cycle, too.
17004 * @param {String|djs.model.Base}
17009 Canvas.prototype.removeMarker = function(element, marker) {
17010 this._updateMarker(element, marker, false);
17014 * Check the existence of a marker on element.
17016 * @param {String|djs.model.Base}
17021 Canvas.prototype.hasMarker = function(element, marker) {
17023 element = this._elementRegistry.get(element);
17026 var gfx = this.getGraphics(element);
17028 return gfx && gfx.hasClass(marker);
17032 * Toggles a marker on an element.
17034 * Fires the element.marker.update event, making it possible to integrate
17035 * extension into the marker life-cycle, too.
17037 * @param {String|djs.model.Base}
17042 Canvas.prototype.toggleMarker = function(element, marker) {
17043 if (this.hasMarker(element, marker)) {
17044 this.removeMarker(element, marker);
17046 this.addMarker(element, marker);
17050 Canvas.prototype.getRootElement = function() {
17051 if (!this._rootElement) {
17052 this.setRootElement({
17053 id: '__implicitroot'
17057 return this._rootElement;
17062 // ////////////// root element handling ///////////////////////////
17065 * Sets a given element as the new root element for the canvas and returns the
17066 * new root element.
17068 * @param {Object|djs.model.Root}
17071 * [override] whether to override the current root element, if any
17073 * @return {Object|djs.model.Root} new root element
17075 Canvas.prototype.setRootElement = function(element, override) {
17077 this._ensureValidId(element);
17079 var oldRoot = this._rootElement,
17080 elementRegistry = this._elementRegistry,
17081 eventBus = this._eventBus;
17085 throw new Error('rootElement already set, need to specify override');
17088 // simulate element remove event sequence
17089 eventBus.fire('root.remove', {
17092 eventBus.fire('root.removed', {
17096 elementRegistry.remove(oldRoot);
17099 var gfx = this.getDefaultLayer();
17101 // resemble element add event sequence
17102 eventBus.fire('root.add', {
17106 elementRegistry.add(element, gfx, this._svg);
17108 eventBus.fire('root.added', {
17113 this._rootElement = element;
17120 // /////////// add functionality ///////////////////////////////
17122 Canvas.prototype._ensureValidId = function(element) {
17124 throw new Error('element must have an id');
17127 if (this._elementRegistry.get(element.id)) {
17128 throw new Error('element with id ' + element.id + ' already exists');
17132 Canvas.prototype._setParent = function(element, parent) {
17133 Collections.add(parent.children, element);
17134 element.parent = parent;
17138 * Adds an element to the canvas.
17140 * This wires the parent <-> child relationship between the element and a
17141 * explicitly specified parent or an implicit root element.
17143 * During add it emits the events
17144 * * <{type}.add> (element, parent) * <{type}.added> (element, gfx)
17146 * Extensions may hook into these events to perform their magic.
17150 * @param {Object|djs.model.Base}
17152 * @param {Object|djs.model.Base}
17155 * @return {Object|djs.model.Base} the added element
17157 Canvas.prototype._addElement = function(type, element, parent) {
17159 parent = parent || this.getRootElement();
17161 var eventBus = this._eventBus,
17162 graphicsFactory = this._graphicsFactory;
17164 this._ensureValidId(element);
17166 eventBus.fire(type + '.add', {
17171 this._setParent(element, parent);
17174 var gfx = graphicsFactory.create(type, element);
17176 this._elementRegistry.add(element, gfx);
17178 // update its visual
17179 graphicsFactory.update(type, element, gfx);
17181 eventBus.fire(type + '.added', {
17190 * Adds a shape to the canvas
17192 * @param {Object|djs.model.Shape}
17193 * shape to add to the diagram
17194 * @param {djs.model.Base}
17197 * @return {djs.model.Shape} the added shape
17199 Canvas.prototype.addShape = function(shape, parent) {
17200 return this._addElement('shape', shape, parent);
17204 * Adds a connection to the canvas
17206 * @param {Object|djs.model.Connection}
17207 * connection to add to the diagram
17208 * @param {djs.model.Base}
17211 * @return {djs.model.Connection} the added connection
17213 Canvas.prototype.addConnection = function(connection, parent) {
17214 return this._addElement('connection', connection, parent);
17219 * Internal remove element
17221 Canvas.prototype._removeElement = function(element, type) {
17222 console.log(element);
17223 var elementRegistry = this._elementRegistry,
17224 graphicsFactory = this._graphicsFactory,
17225 eventBus = this._eventBus;
17227 element = elementRegistry.get(element.id || element);
17230 // element was removed already
17234 eventBus.fire(type + '.remove', {
17238 graphicsFactory.remove(element);
17240 // unset parent <-> child relationship
17241 Collections.remove(element.parent && element.parent.children, element);
17242 element.parent = null;
17244 eventBus.fire(type + '.removed', {
17248 elementRegistry.remove(element);
17255 * Removes a shape from the canvas
17257 * @param {String|djs.model.Shape}
17258 * shape or shape id to be removed
17260 * @return {djs.model.Shape} the removed shape
17262 Canvas.prototype.removeShape = function(shape) {
17265 * An event indicating that a shape is about to be removed from the canvas.
17269 * @event shape.remove
17271 * @property {djs.model.Shape} element the shape descriptor
17272 * @property {Object} gfx the graphical representation of the shape
17276 * An event indicating that a shape has been removed from the canvas.
17280 * @event shape.removed
17282 * @property {djs.model.Shape} element the shape descriptor
17283 * @property {Object} gfx the graphical representation of the shape
17285 return this._removeElement(shape, 'shape');
17290 * Removes a connection from the canvas
17292 * @param {String|djs.model.Connection}
17293 * connection or connection id to be removed
17295 * @return {djs.model.Connection} the removed connection
17297 Canvas.prototype.removeConnection = function(connection) {
17300 * An event indicating that a connection is about to be removed from the
17305 * @event connection.remove
17307 * @property {djs.model.Connection} element the connection descriptor
17308 * @property {Object} gfx the graphical representation of the connection
17312 * An event indicating that a connection has been removed from the canvas.
17316 * @event connection.removed
17318 * @property {djs.model.Connection} element the connection descriptor
17319 * @property {Object} gfx the graphical representation of the connection
17321 return this._removeElement(connection, 'connection');
17326 * Sends a shape to the front.
17328 * This method takes parent / child relationships between shapes into account
17329 * and makes sure that children are properly handled, too.
17331 * @param {djs.model.Shape}
17332 * shape descriptor of the shape to be sent to front
17334 * [bubble=true] whether to send parent shapes to front, too
17336 Canvas.prototype.sendToFront = function(shape, bubble) {
17338 if (bubble !== false) {
17342 if (bubble && shape.parent) {
17343 this.sendToFront(shape.parent);
17346 forEach(shape.children, function(child) {
17347 this.sendToFront(child, false);
17350 var gfx = this.getGraphics(shape),
17351 gfxParent = gfx.parent();
17353 gfx.remove().appendTo(gfxParent);
17358 * Return the graphical object underlaying a certain diagram element
17360 * @param {String|djs.model.Base}
17361 * element descriptor of the element
17363 * [secondary=false] whether to return the secondary connected
17366 * @return {SVGElement}
17368 Canvas.prototype.getGraphics = function(element, secondary) {
17369 return this._elementRegistry.getGraphics(element, secondary);
17373 Canvas.prototype._fireViewboxChange = function() {
17374 this._eventBus.fire('canvas.viewbox.changed', {
17375 viewbox: this.viewbox(false)
17381 * Gets or sets the view box of the canvas, i.e. the area that is currently
17385 * [box] the new view box to set
17387 * box.x the top left X coordinate of the canvas visible in view box
17389 * box.y the top left Y coordinate of the canvas visible in view box
17391 * box.width the visible width
17397 * canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })
17398 * // sets the visible area of the diagram to (100|100) -> (600|100) // and and
17399 * scales it according to the diagram width
17401 * @return {Object} the current view box
17403 Canvas.prototype.viewbox = function(box) {
17405 if (box === undefined && this._cachedViewbox) {
17406 return this._cachedViewbox;
17409 var viewport = this._viewport,
17411 outerBox = this.getSize(),
17417 // compute the inner box based on the
17418 // diagrams default layer. This allows us to exclude
17419 // external components, such as overlays
17420 innerBox = this.getDefaultLayer().getBBox(true);
17422 matrix = viewport.transform().localMatrix;
17423 scale = round(matrix.a, 1000);
17425 x = round(-matrix.e || 0, 1000);
17426 y = round(-matrix.f || 0, 1000);
17428 box = this._cachedViewbox = {
17429 x: x ? x / scale : 0,
17430 y: y ? y / scale : 0,
17431 width: outerBox.width / scale,
17432 height: outerBox.height / scale,
17435 width: innerBox.width,
17436 height: innerBox.height,
17445 scale = Math.min(outerBox.width / box.width, outerBox.height / box.height);
17447 matrix = new Snap.Matrix().scale(scale).translate(-box.x, -box.y);
17448 viewport.transform(matrix);
17450 this._fireViewboxChange();
17458 * Gets or sets the scroll of the canvas.
17461 * [delta] the new scroll to apply.
17468 Canvas.prototype.scroll = function(delta) {
17469 var node = this._viewport.node;
17470 var matrix = node.getCTM();
17478 matrix = this._svg.node.createSVGMatrix().translate(delta.dx, delta.dy).multiply(matrix);
17480 setCTM(node, matrix);
17482 this._fireViewboxChange();
17493 * Gets or sets the current zoom of the canvas, optionally zooming to the
17494 * specified position.
17496 * @param {String|Number}
17497 * [newScale] the new zoom level, either a number, i.e. 0.9, or
17498 * `fit-viewport` to adjust the size to fit the current viewport
17499 * @param {String|Point}
17500 * [center] the reference point { x: .., y: ..} to zoom to, 'auto' to
17501 * zoom into mid or null
17503 * @return {Number} the current scale
17505 Canvas.prototype.zoom = function(newScale, center) {
17507 if (newScale === 'fit-viewport') {
17508 return this._fitViewport(center);
17511 var vbox = this.viewbox();
17513 if (newScale === undefined) {
17517 var outer = vbox.outer;
17519 if (center === 'auto') {
17521 x: outer.width / 2,
17522 y: outer.height / 2
17526 var matrix = this._setZoom(newScale, center);
17528 this._fireViewboxChange();
17530 return round(matrix.a, 1000);
17533 function setCTM(node, m) {
17534 var mstr = 'matrix(' + m.a + ',' + m.b + ',' + m.c + ',' + m.d + ',' + m.e + ',' + m.f + ')';
17535 node.setAttribute('transform', mstr);
17538 Canvas.prototype._fitViewport = function(center) {
17540 var vbox = this.viewbox(),
17541 outer = vbox.outer,
17542 inner = vbox.inner,
17546 // display the complete diagram without zooming in.
17547 // instead of relying on internal zoom, we perform a
17548 // hard reset on the canvas viewbox to realize this
17550 // if diagram does not need to be zoomed in, we focus it around
17551 // the diagram origin instead
17553 if (inner.x >= 0 &&
17555 inner.x + inner.width <= outer.width &&
17556 inner.y + inner.height <= outer.height &&
17562 width: Math.max(inner.width + inner.x, outer.width),
17563 height: Math.max(inner.height + inner.y, outer.height)
17567 newScale = Math.min(1, outer.width / inner.width, outer.height / inner.height);
17569 x: inner.x + (center ? inner.width / 2 - outer.width / newScale / 2 : 0),
17570 y: inner.y + (center ? inner.height / 2 - outer.height / newScale / 2 : 0),
17571 width: outer.width / newScale,
17572 height: outer.height / newScale
17576 this.viewbox(newViewbox);
17578 return this.viewbox().scale;
17582 Canvas.prototype._setZoom = function(scale, center) {
17584 var svg = this._svg.node,
17585 viewport = this._viewport.node;
17587 var matrix = svg.createSVGMatrix();
17588 var point = svg.createSVGPoint();
17596 currentMatrix = viewport.getCTM();
17599 var currentScale = currentMatrix.a;
17602 centerPoint = assign(point, center);
17604 // revert applied viewport transformations
17605 originalPoint = centerPoint.matrixTransform(currentMatrix.inverse());
17607 // create scale matrix
17608 scaleMatrix = matrix
17609 .translate(originalPoint.x, originalPoint.y)
17610 .scale(1 / currentScale * scale)
17611 .translate(-originalPoint.x, -originalPoint.y);
17613 newMatrix = currentMatrix.multiply(scaleMatrix);
17615 newMatrix = matrix.scale(scale);
17618 setCTM(this._viewport.node, newMatrix);
17625 * Returns the size of the canvas
17627 * @return {Dimensions}
17629 Canvas.prototype.getSize = function() {
17631 width: this._container.clientWidth,
17632 height: this._container.clientHeight
17638 * Return the absolute bounding box for the given element
17640 * The absolute bounding box may be used to display overlays in the callers
17641 * (browser) coordinate system rather than the zoomed in/out canvas coordinates.
17643 * @param {ElementDescriptor}
17645 * @return {Bounds} the absolute bounding box
17647 Canvas.prototype.getAbsoluteBBox = function(element) {
17648 var vbox = this.viewbox();
17653 if (element.waypoints) {
17654 var gfx = this.getGraphics(element);
17656 var transformBBox = gfx.getBBox(true);
17657 bbox = gfx.getBBox();
17659 bbox.x -= transformBBox.x;
17660 bbox.y -= transformBBox.y;
17662 bbox.width += 2 * transformBBox.x;
17663 bbox.height += 2 * transformBBox.y;
17671 var x = bbox.x * vbox.scale - vbox.x * vbox.scale;
17672 var y = bbox.y * vbox.scale - vbox.y * vbox.scale;
17674 var width = bbox.width * vbox.scale;
17675 var height = bbox.height * vbox.scale;
17686 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
17687 "../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
17688 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
17689 "lodash/lang/isNumber": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js",
17690 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
17692 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementFactory.js": [function(require, module, exports) {
17695 var Model = require('../model');
17699 * A factory for diagram-js shapes
17701 function ElementFactory() {
17705 module.exports = ElementFactory;
17708 ElementFactory.prototype.createRoot = function(attrs) {
17709 return this.create('root', attrs);
17712 ElementFactory.prototype.createLabel = function(attrs) {
17713 return this.create('label', attrs);
17716 ElementFactory.prototype.createShape = function(attrs) {
17717 // alert("In createShape");
17718 return this.create('shape', attrs);
17721 ElementFactory.prototype.createConnection = function(attrs) {
17722 return this.create('connection', attrs);
17726 * Create a model element with the given type and a number of pre-set
17733 * @return {djs.model.Base} the newly created model instance
17735 ElementFactory.prototype.create = function(type, attrs) {
17736 // alert("In create");
17738 attrs = attrs || {};
17741 attrs.id = type + '_' + (this._uid++);
17744 return Model.create(type, attrs);
17747 "../model": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js"
17749 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementRegistry.js": [function(require, module, exports) {
17752 var ELEMENT_ID = 'data-element-id';
17758 * A registry that keeps track of all shapes in the diagram.
17760 function ElementRegistry() {
17761 this._elements = {};
17764 module.exports = ElementRegistry;
17767 * Register a pair of (element, gfx, (secondaryGfx)).
17769 * @param {djs.model.Base}
17772 * <SVGElement>} gfx
17774 * <SVGElement>} [secondaryGfx] optional other element to register,
17777 ElementRegistry.prototype.add = function(element, gfx, secondaryGfx) {
17779 var id = element.id;
17781 this._validateId(id);
17783 // associate dom node with element
17784 gfx.attr(ELEMENT_ID, id);
17786 if (secondaryGfx) {
17787 secondaryGfx.attr(ELEMENT_ID, id);
17790 this._elements[id] = {
17793 secondaryGfx: secondaryGfx
17798 * Removes an element from the registry.
17800 * @param {djs.model.Base}
17803 ElementRegistry.prototype.remove = function(element) {
17804 var elements = this._elements,
17805 id = element.id || element,
17806 container = id && elements[id];
17810 // unset element id on gfx
17811 container.gfx.attr(ELEMENT_ID, null);
17813 if (container.secondaryGfx) {
17814 container.secondaryGfx.attr(ELEMENT_ID, null);
17817 delete elements[id];
17822 * Update the id of an element
17824 * @param {djs.model.Base}
17829 ElementRegistry.prototype.updateId = function(element, newId) {
17831 this._validateId(newId);
17833 if (typeof element === 'string') {
17834 element = this.get(element);
17837 var gfx = this.getGraphics(element),
17838 secondaryGfx = this.getGraphics(element, true);
17840 this.remove(element);
17842 element.id = newId;
17844 this.add(element, gfx, secondaryGfx);
17848 * Return the model element for a given id or graphics.
17852 * elementRegistry.get('SomeElementId_1'); elementRegistry.get(gfx);
17855 * @param {String|SVGElement}
17856 * filter for selecting the element
17858 * @return {djs.model.Base}
17860 ElementRegistry.prototype.get = function(filter) {
17863 if (typeof filter === 'string') {
17866 id = filter && filter.attr(ELEMENT_ID);
17869 var container = this._elements[id];
17870 return container && container.element;
17874 * Return all elements that match a given filter function.
17876 * @param {Function}
17879 * @return {Array<djs.model.Base>}
17881 ElementRegistry.prototype.filter = function(fn) {
17885 this.forEach(function(element, gfx) {
17886 if (fn(element, gfx)) {
17887 filtered.push(element);
17895 * Iterate over all diagram elements.
17897 * @param {Function}
17900 ElementRegistry.prototype.forEach = function(fn) {
17902 var map = this._elements;
17904 Object.keys(map).forEach(function(id) {
17905 var container = map[id],
17906 element = container.element,
17907 gfx = container.gfx;
17909 return fn(element, gfx);
17914 * Return the graphical representation of an element or its id.
17916 * @example elementRegistry.getGraphics('SomeElementId_1');
17917 * elementRegistry.getGraphics(rootElement); // <g ...>
17919 * elementRegistry.getGraphics(rootElement, true); // <svg ...>
17922 * @param {String|djs.model.Base}
17925 * [secondary=false] whether to return the secondary connected
17928 * @return {SVGElement}
17930 ElementRegistry.prototype.getGraphics = function(filter, secondary) {
17931 var id = filter.id || filter;
17933 var container = this._elements[id];
17934 return container && (secondary ? container.secondaryGfx : container.gfx);
17938 * Validate the suitability of the given id and signals a problem with an
17945 * if id is empty or already assigned
17947 ElementRegistry.prototype._validateId = function(id) {
17949 throw new Error('element must have an id');
17952 if (this._elements[id]) {
17953 throw new Error('element with id ' + id + ' already added');
17957 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js": [function(require, module, exports) {
17960 var isFunction = require('lodash/lang/isFunction'),
17961 isArray = require('lodash/lang/isArray'),
17962 isNumber = require('lodash/lang/isNumber'),
17963 assign = require('lodash/object/assign');
17965 var DEFAULT_PRIORITY = 1000;
17969 * A general purpose event bus.
17971 * This component is used to communicate across a diagram instance. Other parts
17972 * of a diagram can use it to listen to and broadcast events.
17974 * ## Registering for Events
17976 * The event bus provides the {@link EventBus#on} and {@link EventBus#once}
17977 * methods to register for events. {@link EventBus#off} can be used to remove
17978 * event registrations. Listeners receive an instance of {@link Event} as the
17979 * first argument. It allows them to hook into the event execution.
17982 * // listen for event eventBus.on('foo', function(event) {
17983 * // access event type event.type; // 'foo'
17984 * // stop propagation to other listeners event.stopPropagation();
17985 * // prevent event default event.preventDefault(); });
17986 * // listen for event with custom payload eventBus.on('bar', function(event,
17987 * payload) { console.log(payload); });
17988 * // listen for event returning value eventBus.on('foobar', function(event) {
17989 * // stop event propagation + prevent default return false;
17990 * // stop event propagation + return custom result return { complex:
17991 * 'listening result' }; });
17993 * // listen with custom priority (default=1000, higher is better)
17994 * eventBus.on('priorityfoo', 1500, function(event) { console.log('invoked
17995 * first!'); }); ```
17997 * ## Emitting Events
17999 * Events can be emitted via the event bus using {@link EventBus#fire}.
18002 * // false indicates that the default action // was prevented by listeners if
18003 * (eventBus.fire('foo') === false) { console.log('default has been
18006 * // custom args + return value listener eventBus.on('sum', function(event, a,
18007 * b) { return a + b; });
18008 * // you can pass custom arguments + retrieve result values. var sum =
18009 * eventBus.fire('sum', 1, 2); console.log(sum); // 3 ```
18011 function EventBus() {
18012 this._listeners = {};
18014 // cleanup on destroy
18018 // destroy on lowest priority to allow
18019 // message passing until the bitter end
18020 this.on('diagram.destroy', 1, function() {
18021 self._listeners = null;
18025 module.exports = EventBus;
18029 * Register an event listener for events with the given name.
18031 * The callback will be invoked with `event, ...additionalArguments` that have
18032 * been passed to {@link EventBus#fire}.
18034 * Returning false from a listener will prevent the events default action (if
18035 * any is specified). To stop an event from being processed further in other
18036 * listeners execute {@link Event#stopPropagation}.
18038 * Returning anything but `undefined` from a listener will stop the listener
18041 * @param {String|Array
18044 * [priority=1000] the priority in which this listener is called,
18046 * @param {Function}
18049 EventBus.prototype.on = function(events, priority, callback) {
18051 events = isArray(events) ? events : [events];
18053 if (isFunction(priority)) {
18054 callback = priority;
18055 priority = DEFAULT_PRIORITY;
18058 if (!isNumber(priority)) {
18059 throw new Error('priority must be a number');
18064 priority: priority,
18068 events.forEach(function(e) {
18069 self._addListener(e, listener);
18075 * Register an event listener that is executed only once.
18078 * event the event name to register for
18079 * @param {Function}
18080 * callback the callback to execute
18082 EventBus.prototype.once = function(event, callback) {
18086 function wrappedCallback() {
18087 callback.apply(self, arguments);
18088 self.off(event, wrappedCallback);
18091 this.on(event, wrappedCallback);
18096 * Removes event listeners by event and callback.
18098 * If no callback is given, all listeners for a given event name are being
18103 * @param {Function}
18106 EventBus.prototype.off = function(event, callback) {
18107 var listeners = this._getListeners(event),
18112 // move through listeners from back to front
18113 // and remove matching listeners
18114 for (idx = listeners.length - 1; !!(listener = listeners[idx]); idx--) {
18115 if (listener.callback === callback) {
18116 listeners.splice(idx, 1);
18121 listeners.length = 0;
18127 * Fires a named event.
18130 * // fire event by name events.fire('foo');
18131 * // fire event object with nested type var event = { type: 'foo' };
18132 * events.fire(event);
18133 * // fire event with explicit type var event = { x: 10, y: 20 };
18134 * events.fire('element.moved', event);
18135 * // pass additional arguments to the event events.on('foo', function(event,
18136 * bar) { alert(bar); });
18138 * events.fire({ type: 'foo' }, 'I am bar!');
18141 * [name] the optional event name
18143 * [event] the event object
18144 * @param {...Object}
18145 * additional arguments to be passed to the callback functions
18147 * @return {Boolean} the events return value, if specified or false if the
18148 * default action was prevented by listeners
18150 EventBus.prototype.fire = function(type, data) {
18154 listeners, idx, listener,
18158 args = Array.prototype.slice.call(arguments);
18160 if (typeof type === 'object') {
18166 throw new Error('no event type specified');
18169 listeners = this._listeners[type];
18175 // we make sure we fire instances of our home made
18176 // events here. We wrap them only once, though
18177 if (data instanceof Event) {
18178 // we are fine, we alread have an event
18181 event = new Event();
18185 // ensure we pass the event as the first parameter
18188 // original event type (in case we delegate)
18189 originalType = event.type;
18193 // update event type before delegation
18194 if (type !== originalType) {
18198 for (idx = 0; !!(listener = listeners[idx]); idx++) {
18200 // handle stopped propagation
18201 if (event.cancelBubble) {
18206 // returning false prevents the default action
18207 returnValue = event.returnValue = listener.callback.apply(null, args);
18209 // stop propagation on return value
18210 if (returnValue !== undefined) {
18211 event.stopPropagation();
18214 // prevent default on return false
18215 if (returnValue === false) {
18216 event.preventDefault();
18219 if (!this.handleError(e)) {
18220 console.error('unhandled error in event listener');
18221 console.error(e.stack);
18228 // reset event type after delegation
18229 if (type !== originalType) {
18230 event.type = originalType;
18234 // set the return value to false if the event default
18235 // got prevented and no other return value exists
18236 if (returnValue === undefined && event.defaultPrevented) {
18237 returnValue = false;
18240 return returnValue;
18244 EventBus.prototype.handleError = function(error) {
18245 return this.fire('error', {
18252 * Add new listener with a certain priority to the list of listeners (for the
18255 * The semantics of listener registration / listener execution are first
18256 * register, first serve: New listeners will always be inserted after existing
18257 * listeners with the same priority.
18259 * Example: Inserting two listeners with priority 1000 and 1300
18260 * * before: [ 1500, 1500, 1000, 1000 ] * after: [ 1500, 1500, (new=1300),
18261 * 1000, 1000, (new=1000) ]
18263 * @param {String} event @param {Object} listener { priority, callback }
18265 EventBus.prototype._addListener = function(event, newListener) {
18267 var listeners = this._getListeners(event),
18271 // ensure we order listeners by priority from
18272 // 0 (high) to n > 0 (low)
18273 for (idx = 0; !!(existingListener = listeners[idx]); idx++) {
18274 if (existingListener.priority < newListener.priority) {
18276 // prepend newListener at before existingListener
18277 listeners.splice(idx, 0, newListener);
18282 listeners.push(newListener);
18286 EventBus.prototype._getListeners = function(name) {
18287 var listeners = this._listeners[name];
18290 this._listeners[name] = listeners = [];
18298 * A event that is emitted via the event bus.
18300 function Event() {}
18302 module.exports.Event = Event;
18304 Event.prototype.stopPropagation = function() {
18305 this.cancelBubble = true;
18308 Event.prototype.preventDefault = function() {
18309 this.defaultPrevented = true;
18312 Event.prototype.init = function(data) {
18313 assign(this, data || {});
18317 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
18318 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
18319 "lodash/lang/isNumber": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js",
18320 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
18322 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\GraphicsFactory.js": [function(require, module, exports) {
18325 var forEach = require('lodash/collection/forEach'),
18326 reduce = require('lodash/collection/reduce');
18328 var GraphicsUtil = require('../util/GraphicsUtil'),
18329 domClear = require('min-dom/lib/clear');
18332 * A factory that creates graphical elements
18334 * @param {Renderer}
18337 function GraphicsFactory(renderer, elementRegistry) {
18338 this._renderer = renderer;
18339 this._elementRegistry = elementRegistry;
18342 GraphicsFactory.$inject = ['renderer', 'elementRegistry'];
18344 module.exports = GraphicsFactory;
18347 GraphicsFactory.prototype._getChildren = function(element) {
18349 var gfx = this._elementRegistry.getGraphics(element);
18354 if (!element.parent) {
18357 childrenGfx = GraphicsUtil.getChildren(gfx);
18358 if (!childrenGfx) {
18359 childrenGfx = gfx.parent().group().attr('class', 'djs-children');
18363 return childrenGfx;
18367 * Clears the graphical representation of the element and returns the cleared
18368 * visual (the <g class="djs-visual" /> element).
18370 GraphicsFactory.prototype._clear = function(gfx) {
18371 var visual = GraphicsUtil.getVisual(gfx);
18373 domClear(visual.node);
18379 * Creates a gfx container for shapes and connections
18381 * The layout is as follows:
18383 * <g class="djs-group">
18385 * <!-- the gfx --> <g class="djs-element djs-(shape|connection)"> <g
18386 * class="djs-visual"> <!-- the renderer draws in here --> </g>
18388 * <!-- extensions (overlays, click box, ...) goes here </g>
18390 * <!-- the gfx child nodes --> <g class="djs-children"></g> </g>
18395 * type the type of the element, i.e. shape | connection
18397 GraphicsFactory.prototype._createContainer = function(type, parentGfx) {
18398 var outerGfx = parentGfx.group().attr('class', 'djs-group'),
18399 gfx = outerGfx.group().attr('class', 'djs-element djs-' + type);
18402 gfx.group().attr('class', 'djs-visual');
18407 GraphicsFactory.prototype.create = function(type, element) {
18408 var childrenGfx = this._getChildren(element.parent);
18409 return this._createContainer(type, childrenGfx);
18413 GraphicsFactory.prototype.updateContainments = function(elements) {
18416 elementRegistry = this._elementRegistry,
18420 parents = reduce(elements, function(map, e) {
18423 map[e.parent.id] = e.parent;
18429 // update all parents of changed and reorganized their children
18430 // in the correct order (as indicated in our model)
18431 forEach(parents, function(parent) {
18433 var childGfx = self._getChildren(parent),
18434 children = parent.children;
18440 forEach(children.slice().reverse(), function(c) {
18441 var gfx = elementRegistry.getGraphics(c);
18442 gfx.parent().prependTo(childGfx);
18448 GraphicsFactory.prototype.update = function(type, element, gfx) {
18450 // Do not update root element
18451 if (!element.parent) {
18455 var visual = this._clear(gfx);
18458 if (type === 'shape') {
18459 this._renderer.drawShape(visual, element);
18461 // update positioning
18462 gfx.translate(element.x, element.y);
18464 if (type === 'connection') {
18465 this._renderer.drawConnection(visual, element);
18467 throw new Error('unknown type: ' + type);
18470 gfx.attr('display', element.hidden ? 'none' : 'block');
18474 GraphicsFactory.prototype.remove = function(element) {
18475 var gfx = this._elementRegistry.getGraphics(element);
18478 gfx.parent().remove();
18482 "../util/GraphicsUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\GraphicsUtil.js",
18483 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
18484 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
18485 "min-dom/lib/clear": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js"
18487 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\index.js": [function(require, module, exports) {
18489 __depends__: [require('../draw')],
18490 __init__: ['canvas'],
18491 canvas: ['type', require('./Canvas')],
18492 elementRegistry: ['type', require('./ElementRegistry')],
18493 elementFactory: ['type', require('./ElementFactory')],
18494 eventBus: ['type', require('./EventBus')],
18495 graphicsFactory: ['type', require('./GraphicsFactory')]
18498 "../draw": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\index.js",
18499 "./Canvas": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\Canvas.js",
18500 "./ElementFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementFactory.js",
18501 "./ElementRegistry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementRegistry.js",
18502 "./EventBus": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js",
18503 "./GraphicsFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\GraphicsFactory.js"
18505 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js": [function(require, module, exports) {
18508 var Snap = require('../../vendor/snapsvg');
18512 * The default renderer used for shapes and connections.
18517 function Renderer(styles) {
18518 this.CONNECTION_STYLE = styles.style(['no-fill'], {
18522 this.SHAPE_STYLE = styles.style({
18529 module.exports = Renderer;
18531 Renderer.$inject = ['styles'];
18534 Renderer.prototype.drawShape = function drawShape(gfxGroup, data) {
18535 return gfxGroup.rect(0, 0, data.width || 0, data.height || 0).attr(this.SHAPE_STYLE);
18538 Renderer.prototype.drawConnection = function drawConnection(gfxGroup, data) {
18539 return createLine(data.waypoints, this.CONNECTION_STYLE).appendTo(gfxGroup);
18542 function componentsToPath(components) {
18543 return components.join(',').replace(/,?([A-z]),?/g, '$1');
18547 * Gets the default SVG path of a shape that represents it's visual bounds.
18549 * @param {djs.model.Shape}
18551 * @return {string} svg path
18553 Renderer.prototype.getShapePath = function getShapePath(shape) {
18557 width = shape.width,
18558 height = shape.height;
18568 return componentsToPath(shapePath);
18572 * Gets the default SVG path of a connection that represents it's visual bounds.
18574 * @param {djs.model.Connection}
18576 * @return {string} svg path
18578 Renderer.prototype.getConnectionPath = function getConnectionPath(connection) {
18579 var waypoints = connection.waypoints;
18581 var idx, point, connectionPath = [];
18583 for (idx = 0; !!(point = waypoints[idx]); idx++) {
18585 // take invisible docking into account
18586 // when creating the path
18587 point = point.original || point;
18589 connectionPath.push([idx === 0 ? 'M' : 'L', point.x, point.y]);
18592 return componentsToPath(connectionPath);
18596 function toSVGPoints(points) {
18599 for (var i = 0, p; !!(p = points[i]); i++) {
18600 result += p.x + ',' + p.y + ' ';
18606 function createLine(points, attrs) {
18607 return Snap.create('polyline', {
18608 points: toSVGPoints(points)
18609 }).attr(attrs || {});
18612 function updateLine(gfx, points) {
18614 points: toSVGPoints(points)
18618 module.exports.createLine = createLine;
18619 module.exports.updateLine = updateLine;
18621 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js"
18623 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Styles.js": [function(require, module, exports) {
18626 var isArray = require('lodash/lang/isArray'),
18627 assign = require('lodash/object/assign'),
18628 reduce = require('lodash/collection/reduce');
18632 * A component that manages shape styles
18634 function Styles() {
18636 var defaultTraits = {
18645 pointerEvents: 'none'
18650 * Builds a style definition from a className, a list of traits and an
18651 * object of additional attributes.
18660 * @return {Object} the style defintion
18662 this.cls = function(className, traits, additionalAttrs) {
18663 var attrs = this.style(traits, additionalAttrs);
18665 return assign(attrs, {
18671 * Builds a style definition from a list of traits and an object of
18672 * additional attributes.
18679 * @return {Object} the style defintion
18681 this.style = function(traits, additionalAttrs) {
18683 if (!isArray(traits) && !additionalAttrs) {
18684 additionalAttrs = traits;
18688 var attrs = reduce(traits, function(attrs, t) {
18689 return assign(attrs, defaultTraits[t] || {});
18692 return additionalAttrs ? assign(attrs, additionalAttrs) : attrs;
18696 module.exports = Styles;
18698 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
18699 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
18700 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
18702 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\index.js": [function(require, module, exports) {
18704 renderer: ['type', require('./Renderer')],
18705 styles: ['type', require('./Styles')]
18708 "./Renderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js",
18709 "./Styles": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Styles.js"
18711 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointMove.js": [function(require, module, exports) {
18714 var Geometry = require('../../util/Geometry'),
18715 Util = require('./Util');
18717 var MARKER_OK = 'connect-ok',
18718 MARKER_NOT_OK = 'connect-not-ok',
18719 MARKER_CONNECT_HOVER = 'connect-hover',
18720 MARKER_CONNECT_UPDATING = 'djs-updating';
18722 var COMMAND_BENDPOINT_UPDATE = 'connection.updateWaypoints',
18723 COMMAND_RECONNECT_START = 'connection.reconnectStart',
18724 COMMAND_RECONNECT_END = 'connection.reconnectEnd';
18726 var round = Math.round;
18730 * A component that implements moving of bendpoints
18732 function BendpointMove(injector, eventBus, canvas, dragging, graphicsFactory, rules, modeling) {
18734 var connectionDocking;
18736 // optional connection docking integration
18738 connectionDocking = injector.get('connectionDocking');
18744 this.start = function(event, connection, bendpointIndex, insert) {
18748 waypoints = connection.waypoints,
18749 gfx = canvas.getGraphics(connection);
18751 if (!insert && bendpointIndex === 0) {
18752 type = COMMAND_RECONNECT_START;
18754 if (!insert && bendpointIndex === waypoints.length - 1) {
18755 type = COMMAND_RECONNECT_END;
18757 type = COMMAND_BENDPOINT_UPDATE;
18761 connection: connection,
18762 bendpointIndex: bendpointIndex,
18767 dragging.activate(event, 'bendpoint.move', {
18769 connection: connection,
18770 connectionGfx: gfx,
18777 // DRAGGING IMPLEMENTATION
18780 function redrawConnection(data) {
18781 graphicsFactory.update('connection', data.connection, data.connectionGfx);
18784 function filterRedundantWaypoints(waypoints) {
18785 return waypoints.filter(function(r, idx) {
18786 return !Geometry.pointsOnLine(waypoints[idx - 1], waypoints[idx + 1], r);
18790 eventBus.on('bendpoint.move.start', function(e) {
18792 var context = e.context,
18793 connection = context.connection,
18794 originalWaypoints = connection.waypoints,
18795 waypoints = originalWaypoints.slice(),
18796 insert = context.insert,
18797 idx = context.bendpointIndex;
18799 context.originalWaypoints = originalWaypoints;
18802 // insert placeholder for bendpoint to-be-added
18803 waypoints.splice(idx, 0, null);
18806 connection.waypoints = waypoints;
18809 context.draggerGfx = Util.addBendpoint(canvas.getLayer('overlays'));
18810 context.draggerGfx.addClass('djs-dragging');
18812 canvas.addMarker(connection, MARKER_CONNECT_UPDATING);
18815 eventBus.on('bendpoint.move.hover', function(e) {
18816 e.context.hover = e.hover;
18818 canvas.addMarker(e.hover, MARKER_CONNECT_HOVER);
18822 'bendpoint.move.out',
18823 'bendpoint.move.cleanup'
18826 // remove connect marker
18828 var hover = e.context.hover;
18831 canvas.removeMarker(hover, MARKER_CONNECT_HOVER);
18832 canvas.removeMarker(hover, e.context.target ? MARKER_OK : MARKER_NOT_OK);
18836 eventBus.on('bendpoint.move.move', function(e) {
18838 var context = e.context,
18839 moveType = context.type,
18840 connection = e.connection,
18843 connection.waypoints[context.bendpointIndex] = {
18848 if (connectionDocking) {
18850 if (context.hover) {
18851 if (moveType === COMMAND_RECONNECT_START) {
18852 source = context.hover;
18855 if (moveType === COMMAND_RECONNECT_END) {
18856 target = context.hover;
18860 connection.waypoints = connectionDocking.getCroppedWaypoints(connection, source, target);
18863 // asks whether reconnect / bendpoint move / bendpoint add
18864 // is allowed at the given position
18865 var allowed = context.allowed = rules.allowed(context.type, context);
18869 if (context.hover) {
18870 canvas.removeMarker(context.hover, MARKER_NOT_OK);
18871 canvas.addMarker(context.hover, MARKER_OK);
18873 context.target = context.hover;
18876 if (allowed === false) {
18877 if (context.hover) {
18878 canvas.removeMarker(context.hover, MARKER_OK);
18879 canvas.addMarker(context.hover, MARKER_NOT_OK);
18881 context.target = null;
18886 context.draggerGfx.translate(e.x, e.y);
18888 redrawConnection(e);
18892 'bendpoint.move.end',
18893 'bendpoint.move.cancel'
18896 var context = e.context,
18897 connection = context.connection;
18899 // remove dragger gfx
18900 context.draggerGfx.remove();
18902 context.newWaypoints = connection.waypoints.slice();
18904 connection.waypoints = context.originalWaypoints;
18906 canvas.removeMarker(connection, MARKER_CONNECT_UPDATING);
18909 eventBus.on('bendpoint.move.end', function(e) {
18911 var context = e.context,
18912 waypoints = context.newWaypoints,
18913 bendpointIndex = context.bendpointIndex,
18914 bendpoint = waypoints[bendpointIndex],
18915 allowed = context.allowed;
18917 // ensure we have actual pixel values bendpoint
18918 // coordinates (important when zoom level was > 1 during move)
18919 bendpoint.x = round(bendpoint.x);
18920 bendpoint.y = round(bendpoint.y);
18922 if (allowed === true && context.type === COMMAND_RECONNECT_START) {
18923 modeling.reconnectStart(context.connection, context.target, bendpoint);
18925 if (allowed === true && context.type === COMMAND_RECONNECT_END) {
18926 modeling.reconnectEnd(context.connection, context.target, bendpoint);
18928 if (allowed !== false && context.type === COMMAND_BENDPOINT_UPDATE) {
18929 modeling.updateWaypoints(context.connection, filterRedundantWaypoints(waypoints));
18931 redrawConnection(e);
18937 eventBus.on('bendpoint.move.cancel', function(e) {
18938 redrawConnection(e);
18942 BendpointMove.$inject = ['injector', 'eventBus', 'canvas', 'dragging', 'graphicsFactory', 'rules', 'modeling'];
18944 module.exports = BendpointMove;
18946 "../../util/Geometry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js",
18947 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Util.js"
18949 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointSnapping.js": [function(require, module, exports) {
18952 var assign = require('lodash/object/assign'),
18953 pick = require('lodash/object/pick'),
18954 forEach = require('lodash/collection/forEach');
18956 var Snap = require('../../../vendor/snapsvg');
18958 var round = Math.round;
18961 function BendpointSnapping(eventBus) {
18963 function snapTo(candidates, point) {
18964 return Snap.snapTo(candidates, point);
18967 function toPoint(e) {
18968 return pick(e, ['x', 'y']);
18971 function mid(element) {
18972 if (element.width) {
18974 x: round(element.width / 2 + element.x),
18975 y: round(element.height / 2 + element.y)
18980 function getSnapPoints(context) {
18982 var snapPoints = context.snapPoints,
18983 waypoints = context.connection.waypoints,
18984 bendpointIndex = context.bendpointIndex,
18985 referenceWaypoints = [waypoints[bendpointIndex - 1], waypoints[bendpointIndex + 1]];
18988 context.snapPoints = snapPoints = {
18993 forEach(referenceWaypoints, function(p) {
18994 // we snap on existing bendpoints only,
18995 // not placeholders that are inserted during add
18997 p = p.original || p;
18999 snapPoints.horizontal.push(p.y);
19000 snapPoints.vertical.push(p.x);
19008 eventBus.on('bendpoint.move.start', function(event) {
19009 event.context.snapStart = toPoint(event);
19012 eventBus.on('bendpoint.move.move', 1500, function(event) {
19014 var context = event.context,
19015 snapPoints = getSnapPoints(context),
19016 start = context.snapStart,
19017 target = context.target,
19018 targetMid = target && mid(target),
19019 x = start.x + event.dx,
19020 y = start.y + event.dy,
19028 sx = snapTo(targetMid ? snapPoints.vertical.concat([targetMid.x]) : snapPoints.vertical, x);
19029 sy = snapTo(targetMid ? snapPoints.horizontal.concat([targetMid.y]) : snapPoints.horizontal, y);
19047 BendpointSnapping.$inject = ['eventBus'];
19049 module.exports = BendpointSnapping;
19051 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
19052 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
19053 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
19054 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
19056 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Bendpoints.js": [function(require, module, exports) {
19059 var domEvent = require('min-dom/lib/event'),
19060 Util = require('./Util');
19062 var BENDPOINT_CLS = Util.BENDPOINT_CLS;
19066 * A service that adds editable bendpoints to connections.
19068 function Bendpoints(injector, eventBus, canvas, interactionEvents, bendpointMove) {
19070 function getConnectionIntersection(waypoints, event) {
19071 var localPosition = Util.toCanvasCoordinates(canvas, event);
19072 return Util.getApproxIntersection(waypoints, localPosition);
19075 function activateBendpointMove(event, connection) {
19076 var waypoints = connection.waypoints,
19077 intersection = getConnectionIntersection(waypoints, event);
19079 if (!intersection) {
19083 bendpointMove.start(event, connection, intersection.index, !intersection.bendpoint);
19086 function getBendpointsContainer(element, create) {
19088 var layer = canvas.getLayer('overlays'),
19089 gfx = layer.select('.djs-bendpoints[data-element-id=' + element.id + ']');
19091 if (!gfx && create) {
19092 gfx = layer.group().addClass('djs-bendpoints').attr('data-element-id', element.id);
19094 domEvent.bind(gfx.node, 'mousedown', function(event) {
19095 activateBendpointMove(event, element);
19102 function createBendpoints(gfx, connection) {
19103 connection.waypoints.forEach(function(p, idx) {
19104 Util.addBendpoint(gfx).translate(p.x, p.y);
19107 // add floating bendpoint
19108 Util.addBendpoint(gfx).addClass('floating');
19111 function clearBendpoints(gfx) {
19112 gfx.selectAll('.' + BENDPOINT_CLS).forEach(function(s) {
19117 function addBendpoints(connection) {
19118 var gfx = getBendpointsContainer(connection);
19121 gfx = getBendpointsContainer(connection, true);
19122 createBendpoints(gfx, connection);
19128 function updateBendpoints(connection) {
19130 var gfx = getBendpointsContainer(connection);
19133 clearBendpoints(gfx);
19134 createBendpoints(gfx, connection);
19138 eventBus.on('connection.changed', function(event) {
19139 updateBendpoints(event.element);
19142 eventBus.on('connection.remove', function(event) {
19143 var gfx = getBendpointsContainer(event.element);
19149 eventBus.on('element.marker.update', function(event) {
19151 var element = event.element,
19154 if (!element.waypoints) {
19158 bendpointsGfx = addBendpoints(element);
19159 bendpointsGfx[event.add ? 'addClass' : 'removeClass'](event.marker);
19162 eventBus.on('element.mousemove', function(event) {
19164 var element = event.element,
19165 waypoints = element.waypoints,
19172 bendpointsGfx = getBendpointsContainer(element, true);
19173 floating = bendpointsGfx.select('.floating');
19179 intersection = getConnectionIntersection(waypoints, event.originalEvent);
19181 if (intersection) {
19182 floating.translate(intersection.point.x, intersection.point.y);
19187 eventBus.on('element.mousedown', function(event) {
19189 var originalEvent = event.originalEvent,
19190 element = event.element,
19191 waypoints = element.waypoints;
19197 activateBendpointMove(originalEvent, element, waypoints);
19200 eventBus.on('selection.changed', function(event) {
19201 var newSelection = event.newSelection,
19202 primary = newSelection[0];
19204 if (primary && primary.waypoints) {
19205 addBendpoints(primary);
19209 eventBus.on('element.hover', function(event) {
19210 var element = event.element;
19212 if (element.waypoints) {
19213 addBendpoints(element);
19215 interactionEvents.registerEvent(event.gfx.node, 'mousemove', 'element.mousemove');
19219 eventBus.on('element.out', function(event) {
19220 interactionEvents.unregisterEvent(event.gfx.node, 'mousemove', 'element.mousemove');
19224 Bendpoints.$inject = ['injector', 'eventBus', 'canvas', 'interactionEvents', 'bendpointMove'];
19226 module.exports = Bendpoints;
19228 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Util.js",
19229 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
19231 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Util.js": [function(require, module, exports) {
19234 var Snap = require('../../../vendor/snapsvg');
19236 var Events = require('../../util/Event'),
19237 Geometry = require('../../util/Geometry');
19239 var BENDPOINT_CLS = module.exports.BENDPOINT_CLS = 'djs-bendpoint';
19241 module.exports.toCanvasCoordinates = function(canvas, event) {
19243 var position = Events.toPoint(event),
19244 clientRect = canvas._container.getBoundingClientRect(),
19247 // canvas relative position
19250 x: clientRect.left,
19254 // update actual event payload with canvas relative measures
19256 var viewbox = canvas.viewbox();
19259 x: viewbox.x + (position.x - offset.x) / viewbox.scale,
19260 y: viewbox.y + (position.y - offset.y) / viewbox.scale
19264 module.exports.addBendpoint = function(parentGfx) {
19265 var groupGfx = parentGfx.group().addClass(BENDPOINT_CLS);
19267 groupGfx.circle(0, 0, 4).addClass('djs-visual');
19268 groupGfx.circle(0, 0, 10).addClass('djs-hit');
19274 function circlePath(center, r) {
19281 ['a', r, r, 0, 1, 1, 0, 2 * r],
19282 ['a', r, r, 0, 1, 1, 0, -2 * r],
19287 function linePath(points) {
19290 points.forEach(function(p, idx) {
19291 segments.push([idx === 0 ? 'M' : 'L', p.x, p.y]);
19298 var INTERSECTION_THRESHOLD = 10;
19300 function getBendpointIntersection(waypoints, reference) {
19304 for (i = 0; !!(w = waypoints[i]); i++) {
19306 if (Geometry.distance(w, reference) <= INTERSECTION_THRESHOLD) {
19308 point: waypoints[i],
19318 function getPathIntersection(waypoints, reference) {
19320 var intersections = Snap.path.intersection(circlePath(reference, INTERSECTION_THRESHOLD), linePath(waypoints));
19322 var a = intersections[0],
19323 b = intersections[intersections.length - 1],
19333 if (a.segment2 !== b.segment2) {
19334 // we use the bendpoint in between both segments
19335 // as the intersection point
19337 idx = Math.max(a.segment2, b.segment2) - 1;
19340 point: waypoints[idx],
19348 x: (Math.round(a.x + b.x) / 2),
19349 y: (Math.round(a.y + b.y) / 2)
19357 x: Math.round(a.x),
19365 * Returns the closest point on the connection towards a given reference point.
19368 * <Point>} waypoints
19372 * @return {Object} intersection data (segment, point)
19374 module.exports.getApproxIntersection = function(waypoints, reference) {
19375 return getBendpointIntersection(waypoints, reference) || getPathIntersection(waypoints, reference);
19378 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
19379 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
19380 "../../util/Geometry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js"
19382 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\index.js": [function(require, module, exports) {
19384 __depends__: [require('../dragging'), require('../rules')],
19385 __init__: ['bendpoints', 'bendpointSnapping'],
19386 bendpoints: ['type', require('./Bendpoints')],
19387 bendpointMove: ['type', require('./BendpointMove')],
19388 bendpointSnapping: ['type', require('./BendpointSnapping')]
19391 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
19392 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
19393 "./BendpointMove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointMove.js",
19394 "./BendpointSnapping": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointSnapping.js",
19395 "./Bendpoints": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Bendpoints.js"
19397 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\ChangeSupport.js": [function(require, module, exports) {
19401 * Adds change support to the diagram, including
19404 * <li>redrawing shapes and connections on change</li>
19407 * @param {EventBus}
19409 * @param {ElementRegistry}
19411 * @param {GraphicsFactory}
19414 function ChangeSupport(eventBus, elementRegistry, graphicsFactory) {
19416 // redraw shapes / connections on change
19418 eventBus.on('element.changed', function(event) {
19420 var element = event.element;
19423 event.gfx = elementRegistry.getGraphics(element);
19426 // shape + gfx may have been deleted
19431 if (element.waypoints) {
19432 eventBus.fire('connection.changed', event);
19434 eventBus.fire('shape.changed', event);
19438 eventBus.on('elements.changed', function(event) {
19440 var elements = event.elements;
19442 elements.forEach(function(e) {
19443 eventBus.fire('element.changed', {
19448 graphicsFactory.updateContainments(elements);
19451 eventBus.on('shape.changed', function(event) {
19452 graphicsFactory.update('shape', event.element, event.gfx);
19455 eventBus.on('connection.changed', function(event) {
19456 graphicsFactory.update('connection', event.element, event.gfx);
19460 ChangeSupport.$inject = ['eventBus', 'elementRegistry', 'graphicsFactory'];
19462 module.exports = ChangeSupport;
19465 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js": [function(require, module, exports) {
19467 __init__: ['changeSupport'],
19468 changeSupport: ['type', require('./ChangeSupport')]
19471 "./ChangeSupport": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\ChangeSupport.js"
19473 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\Connect.js": [function(require, module, exports) {
19476 var LayoutUtil = require('../../layout/LayoutUtil');
19478 var MARKER_OK = 'connect-ok',
19479 MARKER_NOT_OK = 'connect-not-ok';
19482 function Connect(eventBus, dragging, modeling, rules, canvas, renderer) {
19484 // TODO(nre): separate UI and events
19488 function canConnect(source, target) {
19489 return rules.allowed('connection.create', {
19498 function crop(start, end, source, target) {
19500 var sourcePath = renderer.getShapePath(source),
19501 targetPath = target && renderer.getShapePath(target),
19502 connectionPath = renderer.getConnectionPath({
19503 waypoints: [start, end]
19506 start = LayoutUtil.getElementLineIntersection(sourcePath, connectionPath, true) || start;
19507 end = (target && LayoutUtil.getElementLineIntersection(targetPath, connectionPath, false)) || end;
19509 return [start, end];
19515 eventBus.on('connect.move', function(event) {
19517 var context = event.context,
19518 source = context.source,
19519 target = context.target,
19520 visual = context.visual,
19521 start, end, waypoints;
19523 // update connection visuals during drag
19525 start = LayoutUtil.getMidPoint(source);
19532 waypoints = crop(start, end, source, target);
19534 visual.attr('points', [waypoints[0].x, waypoints[0].y, waypoints[1].x, waypoints[1].y]);
19537 eventBus.on('connect.hover', function(event) {
19538 var context = event.context,
19539 source = context.source,
19540 hover = event.hover,
19543 canExecute = context.canExecute = canConnect(source, hover);
19545 // simply ignore hover
19546 if (canExecute === null) {
19550 context.target = hover;
19552 canvas.addMarker(hover, canExecute ? MARKER_OK : MARKER_NOT_OK);
19555 eventBus.on(['connect.out', 'connect.cleanup'], function(event) {
19556 var context = event.context;
19558 if (context.target) {
19559 canvas.removeMarker(context.target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
19562 context.target = null;
19565 eventBus.on('connect.cleanup', function(event) {
19566 var context = event.context;
19568 if (context.visual) {
19569 context.visual.remove();
19573 eventBus.on('connect.start', function(event) {
19574 var context = event.context,
19577 visual = canvas.getDefaultLayer().polyline().attr({
19579 'strokeDasharray': [1],
19581 'pointer-events': 'none'
19584 context.visual = visual;
19587 eventBus.on('connect.end', function(event) {
19589 var context = event.context,
19590 source = context.source,
19591 target = context.target,
19592 canExecute = context.canExecute || canConnect(source, target);
19598 modeling.connect(source, target);
19604 this.start = function(event, source, autoActivate) {
19606 dragging.activate(event, 'connect', {
19607 autoActivate: autoActivate,
19618 Connect.$inject = ['eventBus', 'dragging', 'modeling', 'rules', 'canvas', 'renderer'];
19620 module.exports = Connect;
19622 "../../layout/LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js"
19624 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\index.js": [function(require, module, exports) {
19627 require('../selection'),
19628 require('../rules'),
19629 require('../dragging')
19631 connect: ['type', require('./Connect')]
19635 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
19636 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
19637 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
19638 "./Connect": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\Connect.js"
19640 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\ContextPad.js": [function(require, module, exports) {
19643 var isFunction = require('lodash/lang/isFunction'),
19644 forEach = require('lodash/collection/forEach'),
19646 domDelegate = require('min-dom/lib/delegate'),
19647 domClear = require('min-dom/lib/clear'),
19648 domEvent = require('min-dom/lib/event'),
19649 domAttr = require('min-dom/lib/attr'),
19650 domQuery = require('min-dom/lib/query'),
19651 domClasses = require('min-dom/lib/classes'),
19652 domify = require('min-dom/lib/domify');
19655 var entrySelector = '.entry';
19659 * A context pad that displays element specific, contextual actions next to a
19662 * @param {EventBus}
19664 * @param {Overlays}
19667 function ContextPad(eventBus, overlays) {
19669 this._providers = [];
19671 this._eventBus = eventBus;
19672 this._overlays = overlays;
19674 this._current = null;
19679 ContextPad.$inject = ['eventBus', 'overlays'];
19682 * Registers events needed for interaction with other components
19684 ContextPad.prototype._init = function() {
19686 var eventBus = this._eventBus;
19690 eventBus.on('selection.changed', function(e) {
19692 var selection = e.newSelection;
19694 if (selection.length === 1) {
19695 self.open(selection[0]);
19704 * Register a provider with the context pad
19706 * @param {ContextPadProvider}
19709 ContextPad.prototype.registerProvider = function(provider) {
19710 this._providers.push(provider);
19715 * Returns the context pad entries for a given element
19717 * @param {djs.element.Base}
19720 * @return {Array<ContextPadEntryDescriptor>} list of entries
19722 ContextPad.prototype.getEntries = function(element) {
19725 // loop through all providers and their entries.
19726 // group entries by id so that overriding an entry is possible
19727 forEach(this._providers, function(provider) {
19728 var e = provider.getContextPadEntries(element);
19730 forEach(e, function(entry, id) {
19731 entries[id] = entry;
19740 * Trigger an action available on the opened context pad
19747 ContextPad.prototype.trigger = function(action, event, autoActivate) {
19749 var current = this._current,
19750 element = current.element,
19751 entries = current.entries,
19755 button = event.delegateTarget || event.target;
19758 return event.preventDefault();
19761 entry = entries[domAttr(button, 'data-action')];
19762 handler = entry.action;
19764 originalEvent = event.originalEvent || event;
19766 // simple action (via callback function)
19767 if (isFunction(handler)) {
19768 if (action === 'click') {
19769 return handler(originalEvent, element, autoActivate);
19772 if (handler[action]) {
19773 return handler[action](originalEvent, element, autoActivate);
19777 // silence other actions
19778 event.preventDefault();
19783 * Open the context pad for the given element
19785 * @param {djs.model.Base}
19788 ContextPad.prototype.open = function(element) {
19790 if (this._current && this._current.open) {
19792 if (this._current.element === element) {
19793 // no change needed
19800 this._updateAndOpen(element);
19804 ContextPad.prototype._updateAndOpen = function(element) {
19806 var entries = this.getEntries(element),
19807 pad = this.getPad(element),
19812 forEach(entries, function(entry, id) {
19813 var grouping = entry.group || 'default',
19814 control = domify(entry.html || '<div class="entry" draggable="true"></div>'),
19817 domAttr(control, 'data-action', id);
19819 container = domQuery('[data-group=' + grouping + ']', html);
19821 container = domify('<div class="group" data-group="' + grouping + '"></div>');
19822 html.appendChild(container);
19825 container.appendChild(control);
19827 if (entry.className) {
19828 domClasses(control).add(entry.className);
19832 domAttr(control, 'title', entry.title);
19835 if (entry.imageUrl) {
19836 control.appendChild(domify('<img src="' + entry.imageUrl + '">'));
19840 domClasses(html).add('open');
19849 this._eventBus.fire('contextPad.open', {
19850 current: this._current
19854 ContextPad.prototype.getPad = function(element) {
19858 var overlays = this._overlays,
19859 pads = overlays.get({
19861 type: 'context-pad'
19864 // create context pad on demand if needed
19865 if (!pads.length) {
19867 var html = domify('<div class="djs-context-pad"></div>');
19869 domDelegate.bind(html, entrySelector, 'click', function(event) {
19870 self.trigger('click', event);
19873 domDelegate.bind(html, entrySelector, 'dragstart', function(event) {
19874 self.trigger('dragstart', event);
19877 // stop propagation of mouse events
19878 domEvent.bind(html, 'mousedown', function(event) {
19879 event.stopPropagation();
19883 overlays.add(element, 'context-pad', {
19891 pads = overlays.get({
19893 type: 'context-pad'
19896 this._eventBus.fire('contextPad.create', {
19907 * Close the context pad
19909 ContextPad.prototype.close = function() {
19913 if (this._current) {
19914 if (this._current.open) {
19915 html = this._current.pad.html;
19916 domClasses(html).remove('open');
19919 this._current.open = false;
19921 this._eventBus.fire('contextPad.close', {
19922 current: this._current
19929 * Return the element the context pad is currently opened for, if it is opened.
19933 * contextPad.open(shape1);
19935 * if (contextPad.isOpen()) { // yes, we are open }
19937 * @return {djs.model.Base} element
19939 ContextPad.prototype.isOpen = function() {
19940 return this._current && this._current.open;
19943 module.exports = ContextPad;
19946 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
19947 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
19948 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
19949 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
19950 "min-dom/lib/clear": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js",
19951 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js",
19952 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
19953 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
19954 "min-dom/lib/query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\query.js"
19956 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\index.js": [function(require, module, exports) {
19959 require('../interaction-events'),
19960 require('../overlays')
19962 contextPad: ['type', require('./ContextPad')]
19965 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
19966 "../overlays": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\index.js",
19967 "./ContextPad": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\ContextPad.js"
19969 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\Create.js": [function(require, module, exports) {
19972 var MARKER_OK = 'drop-ok',
19973 MARKER_NOT_OK = 'drop-not-ok';
19976 function Create(eventBus, dragging, rules, modeling, canvas, elementFactory, renderer, styles) {
19980 function canCreate(shape, target, source) {
19983 return rules.allowed('shape.append', {
19989 return rules.allowed('shape.create', {
19999 function createVisual(shape) {
20000 var group, preview, visual;
20002 group = canvas.getDefaultLayer().group().attr(styles.cls('djs-drag-group', ['no-events']));
20004 preview = group.group().addClass('djs-dragger');
20006 preview.translate(shape.width / -2, shape.height / -2);
20008 visual = preview.group().addClass('djs-visual');
20010 // hijack renderer to draw preview
20011 renderer.drawShape(visual, shape);
20019 eventBus.on('create.move', function(event) {
20021 var context = event.context,
20022 shape = context.shape,
20023 visual = context.visual;
20025 // lazy init drag visual once we received the first real
20026 // drag move event (this allows us to get the proper canvas local
20029 visual = context.visual = createVisual(shape);
20032 visual.translate(event.x, event.y);
20034 var hover = event.hover,
20037 canExecute = context.canExecute = hover && canCreate(context.shape, hover, context.source);
20039 // ignore hover visually if canExecute is null
20040 if (hover && canExecute !== null) {
20041 context.target = hover;
20042 canvas.addMarker(hover, canExecute ? MARKER_OK : MARKER_NOT_OK);
20046 eventBus.on(['create.end', 'create.out', 'create.cleanup'], function(event) {
20047 var context = event.context;
20049 if (context.target) {
20050 canvas.removeMarker(context.target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
20054 eventBus.on('create.end', function(event) {
20055 var context = event.context,
20056 source = context.source,
20057 shape = context.shape,
20058 target = context.target,
20059 canExecute = context.canExecute,
20070 modeling.appendShape(source, shape, position, target);
20072 modeling.createShape(shape, position, target);
20077 eventBus.on('create.cleanup', function(event) {
20078 var context = event.context;
20080 if (context.visual) {
20081 context.visual.remove();
20087 this.start = function(event, shape, source) {
20089 dragging.activate(event, 'create', {
20090 cursor: 'grabbing',
20091 autoActivate: true,
20103 Create.$inject = ['eventBus', 'dragging', 'rules', 'modeling', 'canvas', 'elementFactory', 'renderer', 'styles'];
20105 module.exports = Create;
20107 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\index.js": [function(require, module, exports) {
20110 require('../dragging'),
20111 require('../selection')
20113 create: ['type', require('./Create')]
20116 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
20117 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
20118 "./Create": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\Create.js"
20120 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\Dragging.js": [function(require, module, exports) {
20123 /* global TouchEvent */
20125 var assign = require('lodash/object/assign');
20127 var domEvent = require('min-dom/lib/event'),
20128 Event = require('../../util/Event'),
20129 ClickTrap = require('../../util/ClickTrap'),
20130 Cursor = require('../../util/Cursor');
20132 function suppressEvent(event) {
20133 if (event instanceof MouseEvent) {
20134 Event.stopEvent(event, true);
20136 Event.preventDefault(event);
20140 function getLength(point) {
20141 return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
20144 function substract(p1, p2) {
20152 * A helper that fires canvas localized drag events and realizes the general
20153 * "drag-and-drop" look and feel.
20155 * Calling {@link Dragging#activate} activates dragging on a canvas.
20157 * It provides the following:
20158 * * emits the events `start`, `move`, `end`, `cancel` and `cleanup` via the
20159 * {@link EventBus}. Each of the events is prefixed with a prefix that is
20160 * assigned during activate. * sets and restores the cursor * sets and restores
20161 * the selection * ensures there can be only one drag operation active at a time
20163 * Dragging may be canceled manually by calling {@link Dragging#cancel} or by
20168 * function MyDragComponent(eventBus, dragging) {
20170 * eventBus.on('mydrag.start', function(event) { console.log('yes, we start
20173 * eventBus.on('mydrag.move', function(event) { console.log('canvas local
20174 * coordinates', event.x, event.y, event.dx, event.dy);
20175 * // local drag data is passed with the event event.context.foo; // "BAR"
20176 * // the original mouse event, too event.originalEvent; // MouseEvent(...) });
20178 * eventBus.on('element.click', function(event) { dragging.activate(event,
20179 * 'mydrag', { cursor: 'grabbing', data: { context: { foo: "BAR" } } }); }); }
20181 function Dragging(eventBus, canvas, selection) {
20183 var defaultOptions = {
20187 // the currently active drag operation
20188 // dragging is active as soon as this context exists.
20190 // it is visually _active_ only when a context.active flag is set to true.
20196 function fire(type) {
20198 var ActualEvent = require('../../core/EventBus').Event;
20200 var event = assign(new ActualEvent(), context.payload, context.data);
20202 // default integration
20203 if (eventBus.fire('drag.' + type, event) === false) {
20207 return eventBus.fire(context.prefix + '.' + type, event);
20212 function move(event, activate) {
20214 var payload = context.payload,
20215 start = context.start,
20216 position = Event.toPoint(event),
20217 delta = substract(position, start),
20218 clientRect = canvas._container.getBoundingClientRect(),
20221 // canvas relative position
20224 x: clientRect.left,
20228 // update actual event payload with canvas relative measures
20230 var viewbox = canvas.viewbox();
20233 x: viewbox.x + (position.x - offset.x) / viewbox.scale,
20234 y: viewbox.y + (position.y - offset.y) / viewbox.scale,
20235 dx: delta.x / viewbox.scale,
20236 dy: delta.y / viewbox.scale
20239 // activate context explicitly or once threshold is reached
20241 if (!context.active && (activate || getLength(delta) > context.threshold)) {
20243 // fire start event with original
20244 // starting coordinates
20247 x: movement.x - movement.dx,
20248 y: movement.y - movement.dy,
20252 originalEvent: event
20255 if (false === fire('start')) {
20259 context.active = true;
20262 if (!context.keepSelection) {
20263 context.previousSelection = selection.get();
20264 selection.select(null);
20267 // allow custom cursor
20268 if (context.cursor) {
20269 Cursor.set(context.cursor);
20273 suppressEvent(event);
20275 if (context.active) {
20277 // fire move event with actual coordinates
20278 assign(payload, movement, {
20279 originalEvent: event
20286 function end(event) {
20288 var returnValue = true;
20290 if (context.active) {
20293 context.payload.originalEvent = event;
20295 // suppress original event (click, ...)
20296 // because we just ended a drag operation
20297 suppressEvent(event);
20300 // implementations may stop restoring the
20301 // original state (selections, ...) by preventing the
20302 // end events default action
20303 returnValue = fire('end');
20306 if (returnValue === false) {
20310 cleanup(returnValue !== true);
20314 // cancel active drag operation if the user presses
20315 // the ESC key on the keyboard
20317 function checkCancel(event) {
20319 if (event.which === 27) {
20320 event.preventDefault();
20327 // prevent ghost click that might occur after a finished
20328 // drag and drop session
20330 function trapClickAndEnd(event) {
20334 // trap the click in case we are part of an active
20335 // drag operation. This will effectively prevent
20336 // the ghost click that cannot be canceled otherwise.
20337 if (context.active) {
20338 untrap = ClickTrap.install();
20339 setTimeout(untrap, 400);
20345 function trapTouch(event) {
20349 // update the drag events hover (djs.model.Base) and hoverGfx
20350 // (Snap<SVGElement>)
20351 // properties during hover and out and fire {prefix}.hover and {prefix}.out
20355 function hover(event) {
20356 var payload = context.payload;
20358 payload.hoverGfx = event.gfx;
20359 payload.hover = event.element;
20364 function out(event) {
20367 var payload = context.payload;
20369 payload.hoverGfx = null;
20370 payload.hover = null;
20374 // life-cycle methods
20376 function cancel(restore) {
20382 if (context.active) {
20389 function cleanup(restore) {
20396 // reset dom listeners
20397 domEvent.unbind(document, 'mousemove', move);
20399 domEvent.unbind(document, 'mousedown', trapClickAndEnd, true);
20400 domEvent.unbind(document, 'mouseup', trapClickAndEnd, true);
20402 domEvent.unbind(document, 'keyup', checkCancel);
20404 domEvent.unbind(document, 'touchstart', trapTouch, true);
20405 domEvent.unbind(document, 'touchcancel', cancel, true);
20406 domEvent.unbind(document, 'touchmove', move, true);
20407 domEvent.unbind(document, 'touchend', end, true);
20409 eventBus.off('element.hover', hover);
20410 eventBus.off('element.out', out);
20412 // restore selection, unless it has changed
20413 if (restore !== false && context.previousSelection && !selection.get().length) {
20414 selection.select(context.previousSelection);
20421 * Activate a drag operation
20423 * @param {MouseEvent|TouchEvent}
20430 function activate(event, prefix, options) {
20432 // only one drag operation may be active, at a time
20437 options = assign({}, defaultOptions, options || {});
20439 var data = options.data || {},
20444 originalEvent = Event.getOriginal(event) || event;
20445 start = Event.toPoint(event);
20447 suppressEvent(event);
20449 originalEvent = null;
20463 // skip dom registration if trigger
20464 // is set to manual (during testing)
20465 if (!options.manual) {
20467 // add dom listeners
20469 // fixes TouchEvent not being available on desktop Firefox
20470 if (typeof TouchEvent !== 'undefined' && originalEvent instanceof TouchEvent) {
20471 domEvent.bind(document, 'touchstart', trapTouch, true);
20472 domEvent.bind(document, 'touchcancel', cancel, true);
20473 domEvent.bind(document, 'touchmove', move, true);
20474 domEvent.bind(document, 'touchend', end, true);
20476 // assume we use the mouse to interact per default
20477 domEvent.bind(document, 'mousemove', move);
20479 domEvent.bind(document, 'mousedown', trapClickAndEnd, true);
20480 domEvent.bind(document, 'mouseup', trapClickAndEnd, true);
20483 domEvent.bind(document, 'keyup', checkCancel);
20485 eventBus.on('element.hover', hover);
20486 eventBus.on('element.out', out);
20491 if (options.autoActivate) {
20496 // cancel on diagram destruction
20497 eventBus.on('diagram.destroy', cancel);
20502 this.activate = activate;
20504 this.hover = hover;
20508 this.cancel = cancel;
20510 // for introspection
20512 this.active = function() {
20516 this.setOptions = function(options) {
20517 assign(defaultOptions, options);
20521 Dragging.$inject = ['eventBus', 'canvas', 'selection'];
20523 module.exports = Dragging;
20525 "../../core/EventBus": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js",
20526 "../../util/ClickTrap": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\ClickTrap.js",
20527 "../../util/Cursor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js",
20528 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
20529 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
20530 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
20532 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js": [function(require, module, exports) {
20535 require('../selection')
20537 dragging: ['type', require('./Dragging')]
20540 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
20541 "./Dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\Dragging.js"
20543 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\InteractionEvents.js": [function(require, module, exports) {
20546 var forEach = require('lodash/collection/forEach'),
20547 domDelegate = require('min-dom/lib/delegate'),
20548 Renderer = require('../../draw/Renderer'),
20549 createLine = Renderer.createLine,
20550 updateLine = Renderer.updateLine;
20553 var isPrimaryButton = require('../../util/Mouse').isPrimaryButton;
20555 var Snap = require('../../../vendor/snapsvg');
20558 * A plugin that provides interaction events for diagram elements.
20560 * It emits the following events:
20561 * * element.hover * element.out * element.click * element.dblclick *
20562 * element.mousedown
20564 * Each event is a tuple { element, gfx, originalEvent }.
20566 * Canceling the event via Event#preventDefault() prevents the original DOM
20569 * @param {EventBus}
20572 function InteractionEvents(eventBus, elementRegistry, styles) {
20574 var HIT_STYLE = styles.cls('djs-hit', ['no-fill', 'no-border'], {
20579 function fire(type, event) {
20580 var target = event.delegateTarget || event.target,
20581 gfx = target && new Snap(target),
20582 element = elementRegistry.get(gfx),
20585 if (!gfx || !element) {
20589 returnValue = eventBus.fire(type, {
20592 originalEvent: event
20595 if (returnValue === false) {
20596 event.stopPropagation();
20597 event.preventDefault();
20603 function mouseHandler(type) {
20605 var fn = handlers[type];
20608 fn = handlers[type] = function(event) {
20609 // only indicate left mouse button interactions
20610 if (isPrimaryButton(event)) {
20620 mouseover: 'element.hover',
20621 mouseout: 'element.out',
20622 click: 'element.click',
20623 dblclick: 'element.dblclick',
20624 mousedown: 'element.mousedown',
20625 mouseup: 'element.mouseup',
20626 keydown: 'element.keyup'
20630 var elementSelector = 'svg, .djs-element';
20632 // /// event registration
20634 function registerEvent(node, event, localEvent) {
20635 var handler = mouseHandler(localEvent);
20636 handler.$delegate = domDelegate.bind(node, elementSelector, event, handler);
20639 function unregisterEvent(node, event, localEvent) {
20640 domDelegate.unbind(node, event, mouseHandler(localEvent).$delegate);
20643 function registerEvents(svg) {
20644 forEach(bindings, function(val, key) {
20645 registerEvent(svg.node, key, val);
20649 function unregisterEvents(svg) {
20650 forEach(bindings, function(val, key) {
20651 unregisterEvent(svg.node, key, val);
20655 eventBus.on('canvas.destroy', function(event) {
20656 unregisterEvents(event.svg);
20659 eventBus.on('canvas.init', function(event) {
20660 registerEvents(event.svg);
20664 eventBus.on(['shape.added', 'connection.added'], function(event) {
20665 var element = event.element,
20670 if (element.waypoints) {
20671 hit = createLine(element.waypoints);
20672 type = 'connection';
20674 hit = Snap.create('rect', {
20677 width: element.width,
20678 height: element.height
20683 hit.attr(HIT_STYLE).appendTo(gfx.node);
20686 // update djs-hit on change
20688 eventBus.on('shape.changed', function(event) {
20690 var element = event.element,
20692 hit = gfx.select('.djs-hit');
20695 width: element.width,
20696 height: element.height
20700 eventBus.on('connection.changed', function(event) {
20702 var element = event.element,
20704 hit = gfx.select('.djs-hit');
20706 updateLine(hit, element.waypoints);
20714 this.mouseHandler = mouseHandler;
20716 this.registerEvent = registerEvent;
20717 this.unregisterEvent = unregisterEvent;
20721 InteractionEvents.$inject = ['eventBus', 'elementRegistry', 'styles'];
20723 module.exports = InteractionEvents;
20727 * An event indicating that the mouse hovered over an element
20729 * @event element.hover
20732 * @property {djs.model.Base} element
20733 * @property {Snap<Element>} gfx
20734 * @property {Event} originalEvent
20738 * An event indicating that the mouse has left an element
20740 * @event element.out
20743 * @property {djs.model.Base} element
20744 * @property {Snap<Element>} gfx
20745 * @property {Event} originalEvent
20749 * An event indicating that the mouse has clicked an element
20751 * @event element.click
20754 * @property {djs.model.Base} element
20755 * @property {Snap<Element>} gfx
20756 * @property {Event} originalEvent
20760 * An event indicating that the mouse has double clicked an element
20762 * @event element.dblclick
20765 * @property {djs.model.Base} element
20766 * @property {Snap<Element>} gfx
20767 * @property {Event} originalEvent
20771 * An event indicating that the mouse has gone down on an element.
20773 * @event element.mousedown
20776 * @property {djs.model.Base} element
20777 * @property {Snap<Element>} gfx
20778 * @property {Event} originalEvent
20782 * An event indicating that the mouse has gone up on an element.
20784 * @event element.mouseup
20787 * @property {djs.model.Base} element
20788 * @property {Snap<Element>} gfx
20789 * @property {Event} originalEvent
20792 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
20793 "../../draw/Renderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js",
20794 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
20795 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
20796 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js"
20798 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js": [function(require, module, exports) {
20800 __init__: ['interactionEvents'],
20801 interactionEvents: ['type', require('./InteractionEvents')]
20804 "./InteractionEvents": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\InteractionEvents.js"
20806 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\Keyboard.js": [function(require, module, exports) {
20809 var domEvent = require('min-dom/lib/event'),
20810 domMatches = require('min-dom/lib/matches');
20811 //keyboard.bindTo=DOMElement;
20812 // var $ = require('jquery'),
20818 * A keyboard abstraction that may be activated and
20819 * deactivated by users at will, consuming key events
20820 * and triggering diagram actions.
20822 * The implementation fires the following key events that allow
20823 * other components to hook into key handling:
20826 * - keyboard.unbind
20828 * - keyboard.destroy
20830 * All events contain the fields (node, listeners).
20832 * A default binding for the keyboard may be specified via the
20833 * `keyboard.bindTo` configuration option.
20835 * @param {EventBus} eventBus
20836 * @param {CommandStack} commandStack
20837 * @param {Modeling} modeling
20838 * @param {Selection} selection
20842 function Keyboard(config, eventBus, commandStack, modeling, selection, zoomScroll, canvas) {
20844 $(document).keydown(function(e) {
20845 if (commandStack._selectedModel == selected_model) {
20846 if (commandStack._eventBus._listeners != null) {
20848 var model_commandStack = [];
20849 for (var i = 0; i < commandStackList.length; i++) {
20850 if (commandStackList[i]._selectedModel == selected_model) {
20851 if (commandStackList[i]._stack.length > 0) {
20852 model_commandStack.push(commandStackList[i]);
20857 var selected_commandStack;
20858 for (var i = model_commandStack.length - 1; i >= 0; i--) {
20859 if (model_commandStack[i]._stackIdx > -1) {
20860 selected_commandStack = model_commandStack[i];
20865 if (e.which == 90 && e.ctrlKey) {
20866 if (commandStack == selected_commandStack) {
20867 commandStack.undo();
20870 } else if (e.which == 89 && e.ctrlKey) {
20871 commandStack.redo();
20884 this._commandStack = commandStack;
20885 this._modeling = modeling;
20886 this._selection = selection;
20887 this._eventBus = eventBus;
20888 this._zoomScroll = zoomScroll;
20889 this._canvas = canvas;
20891 this._listeners = [];
20893 // our key handler is a singleton that passes
20894 // (keycode, modifiers) to each listener.
20896 // listeners must indicate that they handled a key event
20897 // by returning true. This stops the event propagation.
20899 this._keyHandler = function(event) {
20902 target = event.target,
20903 listeners = self._listeners,
20904 code = event.keyCode || event.charCode || -1;
20906 if (domMatches(target, 'input, textarea')) {
20910 for (i = 0; !!(l = listeners[i]); i++) {
20911 if (l(code, event)) {
20912 event.preventDefault();
20913 event.stopPropagation();
20918 // properly clean dom registrations
20919 eventBus.on('diagram.destroy', function() {
20920 self._fire('destroy');
20923 self._listeners = null;
20926 eventBus.on('diagram.init', function() {
20927 self._fire('init');
20929 if (config && config.bindTo) {
20930 self.bind(config.bindTo);
20937 Keyboard.$inject = [
20947 module.exports = Keyboard;
20950 Keyboard.prototype.bind = function(node) {
20954 domEvent.bind(node, 'keydown', this._keyHandler, true);
20956 this._fire('bind');
20959 Keyboard.prototype.getBinding = function() {
20963 Keyboard.prototype.unbind = function() {
20964 var node = this._node;
20967 this._fire('unbind');
20969 // unbind key events
20970 domEvent.unbind(node, 'keydown', this._keyHandler, true);
20977 Keyboard.prototype._fire = function(event) {
20978 this._eventBus.fire('keyboard.' + event, {
20980 listeners: this._listeners
20988 Keyboard.prototype._init = function() {
20990 var listeners = this._listeners,
20991 commandStack = this._commandStack,
20992 modeling = this._modeling,
20993 selection = this._selection,
20994 zoomScroll = this._zoomScroll,
20995 canvas = this._canvas;
20997 // init default listeners
21001 function undo(key, modifiers) {
21003 if (isCmd(modifiers) && !isShift(modifiers) && key === 90) {
21004 commandStack.undo();
21013 function redo(key, modifiers) {
21015 if (isCmd(modifiers) && (key === 89 || (key === 90 && isShift(modifiers)))) {
21016 commandStack.redo();
21026 * 107 = numpad plus
21027 * 187 = regular plus
21028 * 171 = regular plus in Firefox (german keyboard layout)
21029 * 61 = regular plus in Firefox (US keyboard layout)
21031 function zoomIn(key, modifiers) {
21033 if ((key === 107 || key === 187 || key === 171 || key === 61) && isCmd(modifiers)) {
21035 zoomScroll.stepZoom(1);
21042 * zoom out one step
21045 * 109 = numpad minus
21046 * 189 = regular minus
21047 * 173 = regular minus in Firefox (US and german keyboard layout)
21049 function zoomOut(key, modifiers) {
21051 if ((key === 109 || key === 189 || key === 173) && isCmd(modifiers)) {
21053 zoomScroll.stepZoom(-1);
21060 * zoom to the default level
21064 * 48 = regular zero
21066 function zoomDefault(key, modifiers) {
21068 if ((key === 96 || key === 48) && isCmd(modifiers)) {
21076 // delete selected element
21078 function remove(key, modifiers) {
21082 var selectedElements = selection.get();
21083 console.log(selectedElements);
21084 if (selectedElements.length) {
21085 modeling.removeElements(selectedElements.slice());
21092 listeners.push(undo);
21093 listeners.push(redo);
21094 listeners.push(remove);
21095 listeners.push(zoomIn);
21096 listeners.push(zoomOut);
21097 listeners.push(zoomDefault);
21102 * Add a listener function that is notified with (key, modifiers) whenever
21103 * the keyboard is bound and the user presses a key.
21105 * @param {Function} listenerFn
21107 Keyboard.prototype.addListener = function(listenerFn) {
21109 this._listeners.push(listenerFn);
21112 Keyboard.prototype.hasModifier = hasModifier;
21113 Keyboard.prototype.isCmd = isCmd;
21114 Keyboard.prototype.isShift = isShift;
21117 function hasModifier(modifiers) {
21118 return (modifiers.ctrlKey || modifiers.metaKey || modifiers.shiftKey || modifiers.altKey);
21121 function isCmd(modifiers) {
21122 return modifiers.ctrlKey || modifiers.metaKey;
21125 function isShift(modifiers) {
21126 return modifiers.shiftKey;
21130 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
21131 "min-dom/lib/matches": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\matches.js"
21133 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\index.js": [function(require, module, exports) {
21135 __init__: ['keyboard'],
21136 keyboard: ['type', require('./Keyboard')]
21140 "./Keyboard": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\Keyboard.js"
21142 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\lasso-tool\\LassoTool.js": [function(require, module, exports) {
21145 var values = require('lodash/object/values');
21147 var getEnclosedElements = require('../../util/Elements').getEnclosedElements;
21149 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier;
21151 var Snap = require('../../../vendor/snapsvg');
21154 function LassoTool(eventBus, canvas, dragging, elementRegistry, selection) {
21156 this._selection = selection;
21157 this._dragging = dragging;
21161 // lasso visuals implementation
21164 * A helper that realizes the selection box visual
21168 create: function(context) {
21169 var container = canvas.getDefaultLayer(),
21172 frame = context.frame = Snap.create('rect', {
21173 class: 'djs-lasso-overlay',
21180 frame.appendTo(container);
21183 update: function(context) {
21184 var frame = context.frame,
21185 bbox = context.bbox;
21191 height: bbox.height
21195 remove: function(context) {
21197 if (context.frame) {
21198 context.frame.remove();
21204 eventBus.on('lasso.selection.end', function(event) {
21206 setTimeout(function() {
21207 self.activateLasso(event.originalEvent, true);
21211 // lasso interaction implementation
21213 eventBus.on('lasso.end', function(event) {
21215 var bbox = toBBox(event);
21217 var elements = elementRegistry.filter(function(element) {
21221 self.select(elements, bbox);
21224 eventBus.on('lasso.start', function(event) {
21226 var context = event.context;
21228 context.bbox = toBBox(event);
21229 visuals.create(context);
21232 eventBus.on('lasso.move', function(event) {
21234 var context = event.context;
21236 context.bbox = toBBox(event);
21237 visuals.update(context);
21240 eventBus.on('lasso.end', function(event) {
21242 var context = event.context;
21244 visuals.remove(context);
21247 eventBus.on('lasso.cleanup', function(event) {
21249 var context = event.context;
21251 visuals.remove(context);
21255 // event integration
21257 eventBus.on('element.mousedown', 1500, function(event) {
21259 if (hasPrimaryModifier(event)) {
21260 self.activateLasso(event.originalEvent);
21262 event.stopPropagation();
21267 LassoTool.$inject = [
21275 module.exports = LassoTool;
21278 LassoTool.prototype.activateLasso = function(event, autoActivate) {
21280 this._dragging.activate(event, 'lasso', {
21281 autoActivate: autoActivate,
21282 cursor: 'crosshair',
21289 LassoTool.prototype.activateSelection = function(event) {
21291 this._dragging.activate(event, 'lasso.selection', {
21292 cursor: 'crosshair'
21296 LassoTool.prototype.select = function(elements, bbox) {
21297 var selectedElements = getEnclosedElements(elements, bbox);
21299 this._selection.select(values(selectedElements));
21303 function toBBox(event) {
21307 x: event.x - event.dx,
21308 y: event.y - event.dy
21318 if ((start.x <= end.x && start.y < end.y) ||
21319 (start.x < end.x && start.y <= end.y)) {
21324 width: end.x - start.x,
21325 height: end.y - start.y
21327 } else if ((start.x >= end.x && start.y < end.y) ||
21328 (start.x > end.x && start.y <= end.y)) {
21333 width: start.x - end.x,
21334 height: end.y - start.y
21336 } else if ((start.x <= end.x && start.y > end.y) ||
21337 (start.x < end.x && start.y >= end.y)) {
21342 width: end.x - start.x,
21343 height: start.y - end.y
21345 } else if ((start.x >= end.x && start.y > end.y) ||
21346 (start.x > end.x && start.y >= end.y)) {
21351 width: start.x - end.x,
21352 height: start.y - end.y
21366 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
21367 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
21368 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
21369 "lodash/object/values": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\values.js"
21371 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\lasso-tool\\index.js": [function(require, module, exports) {
21375 __init__: ['lassoTool'],
21376 lassoTool: ['type', require('./LassoTool')]
21380 "./LassoTool": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\lasso-tool\\LassoTool.js"
21382 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\Modeling.js": [function(require, module, exports) {
21385 var forEach = require('lodash/collection/forEach');
21387 var model = require('../../model');
21391 * The basic modeling entry point.
21393 * @param {EventBus}
21395 * @param {ElementFactory}
21397 * @param {CommandStack}
21400 function Modeling(eventBus, elementFactory, commandStack) {
21401 this._eventBus = eventBus;
21402 this._elementFactory = elementFactory;
21403 this._commandStack = commandStack;
21406 eventBus.on('diagram.init', function() {
21407 // register modeling handlers
21408 self.registerHandlers(commandStack);
21412 Modeling.$inject = ['eventBus', 'elementFactory', 'commandStack'];
21414 module.exports = Modeling;
21417 Modeling.prototype.getHandlers = function() {
21419 'shape.append': require('./cmd/AppendShapeHandler'),
21420 'shape.create': require('./cmd/CreateShapeHandler'),
21421 'shape.delete': require('./cmd/DeleteShapeHandler'),
21422 'shape.move': require('./cmd/MoveShapeHandler'),
21423 'shapes.move': require('./cmd/MoveShapesHandler'),
21424 'shape.resize': require('./cmd/ResizeShapeHandler'),
21425 'shape.replace': require('./cmd/ReplaceShapeHandler'),
21427 'spaceTool': require('./cmd/SpaceToolHandler'),
21429 'label.create': require('./cmd/CreateLabelHandler'),
21431 'connection.create': require('./cmd/CreateConnectionHandler'),
21432 'connection.delete': require('./cmd/DeleteConnectionHandler'),
21433 'connection.move': require('./cmd/MoveConnectionHandler'),
21434 'connection.layout': require('./cmd/LayoutConnectionHandler'),
21436 'connection.updateWaypoints': require('./cmd/UpdateWaypointsHandler'),
21438 'connection.reconnectStart': require('./cmd/ReconnectConnectionHandler'),
21439 'connection.reconnectEnd': require('./cmd/ReconnectConnectionHandler'),
21441 'elements.delete': require('./cmd/DeleteElementsHandler'),
21442 'element.updateAnchors': require('./cmd/UpdateAnchorsHandler')
21447 * Register handlers with the command stack
21449 * @param {CommandStack}
21452 Modeling.prototype.registerHandlers = function(commandStack) {
21453 forEach(this.getHandlers(), function(handler, id) {
21454 commandStack.registerHandler(id, handler);
21459 // /// modeling helpers /////////////////////////////////////////
21462 Modeling.prototype.moveShape = function(shape, delta, newParent, hints) {
21467 newParent: newParent,
21471 this._commandStack.execute('shape.move', context);
21475 Modeling.prototype.moveShapes = function(shapes, delta, newParent, hints) {
21480 newParent: newParent,
21484 this._commandStack.execute('shapes.move', context);
21488 * Update the anchors on the element with the given delta movement
21490 * @param {djs.model.Element}
21495 Modeling.prototype.updateAnchors = function(element, delta) {
21501 this._commandStack.execute('element.updateAnchors', context);
21504 Modeling.prototype.moveConnection = function(connection, delta, newParent, hints) {
21507 connection: connection,
21509 newParent: newParent,
21513 this._commandStack.execute('connection.move', context);
21517 Modeling.prototype.layoutConnection = function(connection, hints) {
21520 connection: connection,
21524 this._commandStack.execute('connection.layout', context);
21528 Modeling.prototype.createConnection = function(source, target, connection, parent) {
21530 connection = this._create('connection', connection);
21536 connection: connection
21539 this._commandStack.execute('connection.create', context);
21541 return context.connection;
21544 Modeling.prototype.createShape = function(shape, position, parent) {
21546 shape = this._create('shape', shape);
21549 position: position,
21554 this._commandStack.execute('shape.create', context);
21556 return context.shape;
21560 Modeling.prototype.createLabel = function(labelTarget, position, label, parent) {
21562 label = this._create('label', label);
21565 labelTarget: labelTarget,
21566 position: position,
21571 this._commandStack.execute('label.create', context);
21573 return context.shape;
21577 Modeling.prototype.appendShape = function(source, shape, position, parent, connection, connectionParent) {
21579 shape = this._create('shape', shape);
21583 position: position,
21586 connection: connection,
21587 connectionParent: connectionParent
21590 this._commandStack.execute('shape.append', context);
21592 return context.shape;
21596 Modeling.prototype.removeElements = function(elements) {
21597 console.log(elements);
21602 this._commandStack.execute('elements.delete', context);
21606 Modeling.prototype.removeShape = function(shape) {
21611 this._commandStack.execute('shape.delete', context);
21615 Modeling.prototype.removeConnection = function(connection) {
21617 connection: connection
21620 this._commandStack.execute('connection.delete', context);
21623 Modeling.prototype.replaceShape = function(oldShape, newShape, options) {
21625 oldShape: oldShape,
21630 this._commandStack.execute('shape.replace', context);
21632 return context.newShape;
21635 Modeling.prototype.resizeShape = function(shape, newBounds) {
21638 newBounds: newBounds
21641 this._commandStack.execute('shape.resize', context);
21644 Modeling.prototype.createSpace = function(movingShapes, resizingShapes, delta, direction) {
21646 movingShapes: movingShapes,
21647 resizingShapes: resizingShapes,
21649 direction: direction
21652 this._commandStack.execute('spaceTool', context);
21655 Modeling.prototype.updateWaypoints = function(connection, newWaypoints) {
21657 connection: connection,
21658 newWaypoints: newWaypoints
21661 this._commandStack.execute('connection.updateWaypoints', context);
21664 Modeling.prototype.reconnectStart = function(connection, newSource, dockingPoint) {
21666 connection: connection,
21667 newSource: newSource,
21668 dockingPoint: dockingPoint
21671 this._commandStack.execute('connection.reconnectStart', context);
21674 Modeling.prototype.reconnectEnd = function(connection, newTarget, dockingPoint) {
21676 connection: connection,
21677 newTarget: newTarget,
21678 dockingPoint: dockingPoint
21681 this._commandStack.execute('connection.reconnectEnd', context);
21684 Modeling.prototype.connect = function(source, target, attrs) {
21685 return this.createConnection(source, target, attrs || {}, source.parent);
21689 Modeling.prototype._create = function(type, attrs) {
21690 if (attrs instanceof model.Base) {
21693 return this._elementFactory.create(type, attrs);
21698 "../../model": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js",
21699 "./cmd/AppendShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\AppendShapeHandler.js",
21700 "./cmd/CreateConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateConnectionHandler.js",
21701 "./cmd/CreateLabelHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateLabelHandler.js",
21702 "./cmd/CreateShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateShapeHandler.js",
21703 "./cmd/DeleteConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteConnectionHandler.js",
21704 "./cmd/DeleteElementsHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteElementsHandler.js",
21705 "./cmd/DeleteShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteShapeHandler.js",
21706 "./cmd/LayoutConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\LayoutConnectionHandler.js",
21707 "./cmd/MoveConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveConnectionHandler.js",
21708 "./cmd/MoveShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapeHandler.js",
21709 "./cmd/MoveShapesHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapesHandler.js",
21710 "./cmd/ReconnectConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReconnectConnectionHandler.js",
21711 "./cmd/ReplaceShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReplaceShapeHandler.js",
21712 "./cmd/ResizeShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ResizeShapeHandler.js",
21713 "./cmd/SpaceToolHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\SpaceToolHandler.js",
21714 "./cmd/UpdateAnchorsHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateAnchorsHandler.js",
21715 "./cmd/UpdateWaypointsHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateWaypointsHandler.js",
21716 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
21718 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\AppendShapeHandler.js": [function(require, module, exports) {
21721 var inherits = require('inherits');
21725 * A handler that implements reversible appending of shapes to a source shape.
21729 * @param {elementFactory}
21731 * @param {modeling}
21734 function AppendShapeHandler(modeling) {
21735 this._modeling = modeling;
21738 inherits(AppendShapeHandler, require('./NoopHandler'));
21741 AppendShapeHandler.$inject = ['modeling'];
21743 module.exports = AppendShapeHandler;
21746 // //// api /////////////////////////////////////////////
21749 * Creates a new shape
21753 * @param {ElementDescriptor}
21754 * context.shape the new shape
21755 * @param {ElementDescriptor}
21756 * context.source the source object
21757 * @param {ElementDescriptor}
21758 * context.parent the parent object
21760 * context.position position of the new element
21762 AppendShapeHandler.prototype.preExecute = function(context) {
21764 if (!context.source) {
21765 throw new Error('source required');
21768 var parent = context.parent || context.source.parent,
21769 shape = this._modeling.createShape(context.shape, context.position, parent);
21771 context.shape = shape;
21774 AppendShapeHandler.prototype.postExecute = function(context) {
21775 var parent = context.connectionParent || context.shape.parent;
21777 // create connection
21778 this._modeling.connect(context.source, context.shape, context.connection, parent);
21781 "./NoopHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\NoopHandler.js",
21782 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js"
21784 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateConnectionHandler.js": [function(require, module, exports) {
21788 function CreateConnectionHandler(canvas, layouter) {
21789 this._canvas = canvas;
21790 this._layouter = layouter;
21793 CreateConnectionHandler.$inject = ['canvas', 'layouter'];
21795 module.exports = CreateConnectionHandler;
21799 // //// api /////////////////////////////////////////
21802 * Appends a shape to a target shape
21806 * @param {djs.element.Base}
21807 * context.source the source object
21808 * @param {djs.element.Base}
21809 * context.target the parent object
21811 * context.position position of the new element
21813 CreateConnectionHandler.prototype.execute = function(context) {
21815 var source = context.source,
21816 target = context.target,
21817 parent = context.parent;
21819 if (!source || !target) {
21820 throw new Error('source and target required');
21824 throw new Error('parent required');
21827 var connection = context.connection;
21829 connection.source = source;
21830 connection.target = target;
21832 if (!connection.waypoints) {
21833 connection.waypoints = this._layouter.layoutConnection(connection);
21837 this._canvas.addConnection(connection, parent);
21842 CreateConnectionHandler.prototype.revert = function(context) {
21843 var connection = context.connection;
21845 this._canvas.removeConnection(connection);
21847 connection.source = null;
21848 connection.target = null;
21851 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateLabelHandler.js": [function(require, module, exports) {
21854 var inherits = require('inherits');
21856 var CreateShapeHandler = require('./CreateShapeHandler');
21860 * A handler that attaches a label to a given target shape.
21865 function CreateLabelHandler(canvas) {
21866 CreateShapeHandler.call(this, canvas);
21869 inherits(CreateLabelHandler, CreateShapeHandler);
21871 CreateLabelHandler.$inject = ['canvas'];
21873 module.exports = CreateLabelHandler;
21877 // //// api /////////////////////////////////////////
21881 * Appends a label to a target shape.
21883 * @method CreateLabelHandler#execute
21887 * @param {ElementDescriptor}
21888 * context.target the element the label is attached to
21889 * @param {ElementDescriptor}
21890 * context.parent the parent object
21892 * context.position position of the new element
21896 * Undo append by removing the shape
21898 CreateLabelHandler.prototype.revert = function(context) {
21899 context.shape.labelTarget = null;
21900 this._canvas.removeShape(context.shape);
21904 // //// helpers /////////////////////////////////////////
21906 CreateLabelHandler.prototype.getParent = function(context) {
21907 return context.parent || context.labelTarget && context.labelTarget.parent;
21910 CreateLabelHandler.prototype.addElement = function(shape, parent, context) {
21911 shape.labelTarget = context.labelTarget;
21912 this._canvas.addShape(shape, parent, true);
21915 "./CreateShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateShapeHandler.js",
21916 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js"
21918 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateShapeHandler.js": [function(require, module, exports) {
21921 var assign = require('lodash/object/assign');
21925 * A handler that implements reversible addition of shapes.
21930 function CreateShapeHandler(canvas) {
21931 this._canvas = canvas;
21934 CreateShapeHandler.$inject = ['canvas'];
21936 module.exports = CreateShapeHandler;
21940 // //// api /////////////////////////////////////////
21944 * Appends a shape to a target shape
21948 * @param {djs.model.Base}
21949 * context.parent the parent object
21951 * context.position position of the new element
21953 CreateShapeHandler.prototype.execute = function(context) {
21955 var parent = this.getParent(context);
21957 var shape = context.shape;
21959 this.setPosition(shape, context);
21961 this.addElement(shape, parent, context);
21968 * Undo append by removing the shape
21970 CreateShapeHandler.prototype.revert = function(context) {
21971 this._canvas.removeShape(context.shape);
21975 // //// helpers /////////////////////////////////////////
21977 CreateShapeHandler.prototype.getParent = function(context) {
21978 var parent = context.parent;
21981 throw new Error('parent required');
21987 CreateShapeHandler.prototype.getPosition = function(context) {
21988 if (!context.position) {
21989 throw new Error('no position given');
21992 return context.position;
21995 CreateShapeHandler.prototype.addElement = function(shape, parent) {
21996 this._canvas.addShape(shape, parent);
21999 CreateShapeHandler.prototype.setPosition = function(shape, context) {
22000 var position = this.getPosition(context);
22002 // update to center position
22003 // specified in create context
22005 x: position.x - shape.width / 2,
22006 y: position.y - shape.height / 2
22010 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22012 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteConnectionHandler.js": [function(require, module, exports) {
22015 var Collections = require('../../../util/Collections');
22019 * A handler that implements reversible deletion of Connections.
22022 function DeleteConnectionHandler(canvas, modeling) {
22023 this._canvas = canvas;
22024 this._modeling = modeling;
22027 DeleteConnectionHandler.$inject = ['canvas', 'modeling'];
22029 module.exports = DeleteConnectionHandler;
22033 * - Remove attached label
22035 DeleteConnectionHandler.prototype.preExecute = function(context) {
22037 var connection = context.connection;
22040 if (connection.label) {
22041 this._modeling.removeShape(connection.label);
22045 DeleteConnectionHandler.prototype.execute = function(context) {
22047 var connection = context.connection,
22048 parent = connection.parent;
22050 context.parent = parent;
22051 context.parentIndex = Collections.indexOf(parent.children, connection);
22053 context.source = connection.source;
22054 context.target = connection.target;
22056 this._canvas.removeConnection(connection);
22058 connection.source = null;
22059 connection.target = null;
22060 connection.label = null;
22064 * Command revert implementation.
22066 DeleteConnectionHandler.prototype.revert = function(context) {
22068 var connection = context.connection,
22069 parent = context.parent,
22070 parentIndex = context.parentIndex;
22072 connection.source = context.source;
22073 connection.target = context.target;
22075 // restore previous location in old parent
22076 Collections.add(parent.children, connection, parentIndex);
22078 this._canvas.addConnection(connection, parent);
22082 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js"
22084 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteElementsHandler.js": [function(require, module, exports) {
22087 var forEach = require('lodash/collection/forEach'),
22088 inherits = require('inherits');
22091 function DeleteElementsHandler(modeling, elementRegistry) {
22092 this._modeling = modeling;
22093 this._elementRegistry = elementRegistry;
22096 inherits(DeleteElementsHandler, require('./NoopHandler'));
22098 DeleteElementsHandler.$inject = ['modeling', 'elementRegistry'];
22100 module.exports = DeleteElementsHandler;
22103 DeleteElementsHandler.prototype.postExecute = function(context) {
22105 var modeling = this._modeling,
22106 elementRegistry = this._elementRegistry,
22107 elements = context.elements;
22109 forEach(elements, function(element) {
22111 // element may have been removed with previous
22112 // remove operations already (e.g. in case of nesting)
22113 if (!elementRegistry.get(element.id)) {
22117 if (element.waypoints) {
22118 modeling.removeConnection(element);
22120 modeling.removeShape(element);
22125 "./NoopHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\NoopHandler.js",
22126 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js",
22127 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
22129 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteShapeHandler.js": [function(require, module, exports) {
22132 var Collections = require('../../../util/Collections');
22136 * A handler that implements reversible deletion of shapes.
22139 function DeleteShapeHandler(canvas, modeling) {
22140 this._canvas = canvas;
22141 this._modeling = modeling;
22144 DeleteShapeHandler.$inject = ['canvas', 'modeling'];
22146 module.exports = DeleteShapeHandler;
22150 * - Remove connections - Remove all direct children
22152 DeleteShapeHandler.prototype.preExecute = function(context) {
22154 var shape = context.shape,
22155 label = shape.label,
22156 modeling = this._modeling;
22158 // Clean up on removeShape(label)
22159 if (shape.labelTarget) {
22160 context.labelTarget = shape.labelTarget;
22161 shape.labelTarget = null;
22166 this._modeling.removeShape(label);
22169 // remove connections
22170 this._saveClear(shape.incoming, function(connection) {
22171 // To make sure that the connection isn't removed twice
22172 // For example if a container is removed
22173 modeling.removeConnection(connection);
22176 this._saveClear(shape.outgoing, function(connection) {
22177 modeling.removeConnection(connection);
22182 this._saveClear(shape.children, function(e) {
22183 modeling.removeShape(e);
22188 DeleteShapeHandler.prototype._saveClear = function(collection, remove) {
22192 while (!!(e = collection[0])) {
22199 * Remove shape and remember the parent
22201 DeleteShapeHandler.prototype.execute = function(context) {
22203 var shape = context.shape,
22204 parent = shape.parent;
22206 context.parent = parent;
22207 context.parentIndex = Collections.indexOf(parent.children, shape);
22209 shape.label = null;
22211 this._canvas.removeShape(shape);
22216 * Command revert implementation
22218 DeleteShapeHandler.prototype.revert = function(context) {
22220 var shape = context.shape,
22221 parent = context.parent,
22222 parentIndex = context.parentIndex,
22223 labelTarget = context.labelTarget;
22225 // restore previous location in old parent
22226 Collections.add(parent.children, shape, parentIndex);
22229 labelTarget.label = shape;
22232 this._canvas.addShape(shape, parent);
22236 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js"
22238 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\LayoutConnectionHandler.js": [function(require, module, exports) {
22241 var assign = require('lodash/object/assign');
22245 * A handler that implements reversible moving of shapes.
22247 function LayoutConnectionHandler(layouter, canvas) {
22248 this._layouter = layouter;
22249 this._canvas = canvas;
22252 LayoutConnectionHandler.$inject = ['layouter', 'canvas'];
22254 module.exports = LayoutConnectionHandler;
22256 LayoutConnectionHandler.prototype.execute = function(context) {
22258 var connection = context.connection,
22259 parent = connection.parent,
22260 connectionSiblings = parent.children;
22262 var oldIndex = connectionSiblings.indexOf(connection);
22265 oldWaypoints: connection.waypoints,
22269 sendToFront(connection);
22271 connection.waypoints = this._layouter.layoutConnection(connection, context.hints);
22276 LayoutConnectionHandler.prototype.revert = function(context) {
22278 var connection = context.connection,
22279 parent = connection.parent,
22280 connectionSiblings = parent.children,
22281 currentIndex = connectionSiblings.indexOf(connection),
22282 oldIndex = context.oldIndex;
22284 connection.waypoints = context.oldWaypoints;
22286 if (oldIndex !== currentIndex) {
22288 // change position of connection in shape
22289 connectionSiblings.splice(currentIndex, 1);
22290 connectionSiblings.splice(oldIndex, 0, connection);
22296 // connections should have a higher z-order as there source and targets
22297 function sendToFront(connection) {
22299 var connectionSiblings = connection.parent.children;
22301 var connectionIdx = connectionSiblings.indexOf(connection),
22302 sourceIdx = findIndex(connectionSiblings, connection.source),
22303 targetIdx = findIndex(connectionSiblings, connection.target),
22305 // ensure we do not send the connection back
22306 // if it is already in front
22307 insertIndex = Math.max(sourceIdx + 1, targetIdx + 1, connectionIdx);
22309 if (connectionIdx < insertIndex) {
22310 connectionSiblings.splice(insertIndex, 0, connection); // add to new
22312 connectionSiblings.splice(connectionIdx, 1); // remove from old position
22315 function findIndex(array, obj) {
22317 var index = array.indexOf(obj);
22318 if (index < 0 && obj) {
22319 var parent = obj.parent;
22320 index = findIndex(array, parent);
22325 return insertIndex;
22329 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22331 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveConnectionHandler.js": [function(require, module, exports) {
22334 var forEach = require('lodash/collection/forEach');
22336 var Collections = require('../../../util/Collections');
22340 * A handler that implements reversible moving of connections.
22342 * The handler differs from the layout connection handler in a sense that it
22343 * preserves the connection layout.
22345 function MoveConnectionHandler() {}
22347 module.exports = MoveConnectionHandler;
22350 MoveConnectionHandler.prototype.execute = function(context) {
22352 var updateAnchors = (context.hints.updateAnchors !== false);
22354 var connection = context.connection,
22355 delta = context.delta;
22357 var newParent = this.getNewParent(connection, context),
22358 oldParent = connection.parent;
22360 // save old position + parent in context
22361 context.oldParent = oldParent;
22362 context.oldParentIndex = Collections.indexOf(oldParent.children, connection);
22364 // update waypoint positions
22365 forEach(connection.waypoints, function(p) {
22369 if (updateAnchors && p.original) {
22370 p.original.x += delta.x;
22371 p.original.y += delta.y;
22376 connection.parent = newParent;
22381 MoveConnectionHandler.prototype.revert = function(context) {
22383 var updateAnchors = (context.hints.updateAnchors !== false);
22385 var connection = context.connection,
22386 oldParent = context.oldParent,
22387 oldParentIndex = context.oldParentIndex,
22388 delta = context.delta;
22390 // restore previous location in old parent
22391 Collections.add(oldParent.children, connection, oldParentIndex);
22394 connection.parent = oldParent;
22396 // revert to old waypoint positions
22397 forEach(connection.waypoints, function(p) {
22401 if (updateAnchors && p.original) {
22402 p.original.x -= delta.x;
22403 p.original.y -= delta.y;
22411 MoveConnectionHandler.prototype.getNewParent = function(connection, context) {
22412 return context.newParent || connection.parent;
22416 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
22417 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
22419 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapeHandler.js": [function(require, module, exports) {
22422 var assign = require('lodash/object/assign'),
22423 forEach = require('lodash/collection/forEach');
22425 var MoveHelper = require('./helper/MoveHelper'),
22426 Collections = require('../../../util/Collections');
22430 * A handler that implements reversible moving of shapes.
22432 function MoveShapeHandler(modeling) {
22433 this._modeling = modeling;
22435 this._helper = new MoveHelper(modeling);
22438 MoveShapeHandler.$inject = ['modeling'];
22440 module.exports = MoveShapeHandler;
22443 MoveShapeHandler.prototype.execute = function(context) {
22445 var shape = context.shape,
22446 delta = context.delta,
22447 newParent = this.getNewParent(context),
22448 oldParent = shape.parent;
22450 // save old parent in context
22451 context.oldParent = oldParent;
22452 context.oldParentIndex = Collections.indexOf(oldParent.children, shape);
22454 // update shape parent + position
22457 x: shape.x + delta.x,
22458 y: shape.y + delta.y
22464 MoveShapeHandler.prototype.postExecute = function(context) {
22466 var shape = context.shape,
22467 delta = context.delta;
22469 var modeling = this._modeling;
22471 if (context.hints.updateAnchors !== false) {
22472 modeling.updateAnchors(shape, delta);
22475 if (context.hints.layout !== false) {
22476 forEach(shape.incoming, function(c) {
22477 modeling.layoutConnection(c, {
22482 forEach(shape.outgoing, function(c) {
22483 modeling.layoutConnection(c, {
22489 if (context.hints.recurse !== false) {
22490 this.moveChildren(context);
22494 MoveShapeHandler.prototype.revert = function(context) {
22496 var shape = context.shape,
22497 oldParent = context.oldParent,
22498 oldParentIndex = context.oldParentIndex,
22499 delta = context.delta;
22501 // restore previous location in old parent
22502 Collections.add(oldParent.children, shape, oldParentIndex);
22504 // revert to old position and parent
22507 x: shape.x - delta.x,
22508 y: shape.y - delta.y
22514 MoveShapeHandler.prototype.moveChildren = function(context) {
22516 var delta = context.delta,
22517 shape = context.shape;
22519 this._helper.moveRecursive(shape.children, delta, null);
22522 MoveShapeHandler.prototype.getNewParent = function(context) {
22523 return context.newParent || context.shape.parent;
22526 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
22527 "./helper/MoveHelper": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\helper\\MoveHelper.js",
22528 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
22529 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22531 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapesHandler.js": [function(require, module, exports) {
22534 var MoveHelper = require('./helper/MoveHelper');
22538 * A handler that implements reversible moving of shapes.
22540 function MoveShapesHandler(modeling) {
22541 this._helper = new MoveHelper(modeling);
22544 MoveShapesHandler.$inject = ['modeling'];
22546 module.exports = MoveShapesHandler;
22548 MoveShapesHandler.prototype.preExecute = function(context) {
22549 context.closure = this._helper.getClosure(context.shapes);
22552 MoveShapesHandler.prototype.postExecute = function(context) {
22553 this._helper.moveClosure(context.closure, context.delta, context.newParent);
22557 MoveShapesHandler.prototype.execute = function(context) {};
22558 MoveShapesHandler.prototype.revert = function(context) {};
22561 "./helper/MoveHelper": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\helper\\MoveHelper.js"
22563 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\NoopHandler.js": [function(require, module, exports) {
22566 function NoopHandler() {}
22568 module.exports = NoopHandler;
22570 NoopHandler.prototype.execute = function() {};
22571 NoopHandler.prototype.revert = function() {};
22573 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReconnectConnectionHandler.js": [function(require, module, exports) {
22577 function ReconnectConnectionHandler(layouter) {}
22579 ReconnectConnectionHandler.$inject = ['layouter'];
22581 module.exports = ReconnectConnectionHandler;
22583 ReconnectConnectionHandler.prototype.execute = function(context) {
22585 var newSource = context.newSource,
22586 newTarget = context.newTarget,
22587 connection = context.connection;
22589 if (!newSource && !newTarget) {
22590 throw new Error('newSource or newTarget are required');
22593 if (newSource && newTarget) {
22594 throw new Error('must specify either newSource or newTarget');
22598 context.oldSource = connection.source;
22599 connection.source = newSource;
22601 context.oldDockingPoint = connection.waypoints[0];
22602 connection.waypoints[0] = context.dockingPoint;
22606 context.oldTarget = connection.target;
22607 connection.target = newTarget;
22609 context.oldDockingPoint = connection.waypoints[connection.waypoints.length - 1];
22610 connection.waypoints[connection.waypoints.length - 1] = context.dockingPoint;
22616 ReconnectConnectionHandler.prototype.revert = function(context) {
22618 var newSource = context.newSource,
22619 newTarget = context.newTarget,
22620 connection = context.connection;
22623 connection.source = context.oldSource;
22624 connection.waypoints[0] = context.oldDockingPoint;
22628 connection.target = context.oldTarget;
22629 connection.waypoints[connection.waypoints.length - 1] = context.oldDockingPoint;
22635 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReplaceShapeHandler.js": [function(require, module, exports) {
22638 var forEach = require('lodash/collection/forEach');
22642 * A handler that implements reversible replacing of shapes. Internally the old
22643 * shape will be removed and the new shape will be added.
22652 function ReplaceShapeHandler(modeling, rules) {
22653 this._modeling = modeling;
22654 this._rules = rules;
22657 ReplaceShapeHandler.$inject = ['modeling', 'rules'];
22659 module.exports = ReplaceShapeHandler;
22663 // //// api /////////////////////////////////////////
22667 * Replaces a shape with an replacement Element.
22669 * The newData object should contain type, x, y.
22671 * If possible also the incoming/outgoing connection will be restored.
22676 ReplaceShapeHandler.prototype.preExecute = function(context) {
22678 var modeling = this._modeling,
22679 rules = this._rules;
22681 var oldShape = context.oldShape,
22682 newData = context.newData,
22686 // (1) place a new shape at the given position
22693 newShape = context.newShape = context.newShape || modeling.createShape(newData, position, oldShape.parent);
22696 // (2) reconnect connections to the new shape (where allowed)
22698 var incoming = oldShape.incoming.slice(),
22699 outgoing = oldShape.outgoing.slice();
22701 forEach(incoming, function(connection) {
22702 var waypoints = connection.waypoints,
22703 docking = waypoints[waypoints.length - 1],
22704 allowed = rules.allowed('connection.reconnectEnd', {
22705 source: connection.source,
22707 connection: connection
22711 modeling.reconnectEnd(connection, newShape, docking);
22715 forEach(outgoing, function(connection) {
22716 var waypoints = connection.waypoints,
22717 docking = waypoints[0],
22718 allowed = rules.allowed('connection.reconnectStart', {
22720 target: connection.target,
22721 connection: connection
22725 modeling.reconnectStart(connection, newShape, docking);
22731 ReplaceShapeHandler.prototype.postExecute = function(context) {
22732 var modeling = this._modeling;
22734 var oldShape = context.oldShape;
22736 modeling.removeShape(oldShape);
22740 ReplaceShapeHandler.prototype.execute = function(context) {};
22742 ReplaceShapeHandler.prototype.revert = function(context) {};
22745 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
22747 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ResizeShapeHandler.js": [function(require, module, exports) {
22750 var assign = require('lodash/object/assign'),
22751 forEach = require('lodash/collection/forEach');
22755 * A handler that implements reversible resizing of shapes.
22758 function ResizeShapeHandler(modeling) {
22759 this._modeling = modeling;
22762 ResizeShapeHandler.$inject = ['modeling'];
22764 module.exports = ResizeShapeHandler;
22767 * { shape: {....} newBounds: { width: 20, height: 40, x: 5, y: 10 }
22770 ResizeShapeHandler.prototype.execute = function(context) {
22772 var shape = context.shape,
22773 newBounds = context.newBounds;
22775 if (newBounds.x === undefined || newBounds.y === undefined ||
22776 newBounds.width === undefined || newBounds.height === undefined) {
22777 throw new Error('newBounds must have {x, y, width, height} properties');
22780 if (newBounds.width < 10 || newBounds.height < 10) {
22781 throw new Error('width and height cannot be less than 10px');
22784 // save old bbox in context
22785 context.oldBounds = {
22786 width: shape.width,
22787 height: shape.height,
22794 width: newBounds.width,
22795 height: newBounds.height,
22803 ResizeShapeHandler.prototype.postExecute = function(context) {
22805 var shape = context.shape;
22807 var modeling = this._modeling;
22809 forEach(shape.incoming, function(c) {
22810 modeling.layoutConnection(c, {
22815 forEach(shape.outgoing, function(c) {
22816 modeling.layoutConnection(c, {
22823 ResizeShapeHandler.prototype.revert = function(context) {
22825 var shape = context.shape,
22826 oldBounds = context.oldBounds;
22828 // restore previous bbox
22830 width: oldBounds.width,
22831 height: oldBounds.height,
22840 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
22841 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22843 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\SpaceToolHandler.js": [function(require, module, exports) {
22846 var forEach = require('lodash/collection/forEach');
22848 var SpaceUtil = require('../../space-tool/SpaceUtil');
22851 * A handler that implements reversible creating and removing of space.
22853 * It executes in two phases:
22855 * (1) resize all affected resizeShapes (2) move all affected moveShapes
22857 function SpaceToolHandler(modeling) {
22858 this._modeling = modeling;
22861 SpaceToolHandler.$inject = ['modeling'];
22863 module.exports = SpaceToolHandler;
22866 SpaceToolHandler.prototype.preExecute = function(context) {
22869 var modeling = this._modeling,
22870 resizingShapes = context.resizingShapes,
22871 delta = context.delta,
22872 direction = context.direction;
22874 forEach(resizingShapes, function(shape) {
22875 var newBounds = SpaceUtil.resizeBounds(shape, direction, delta);
22877 modeling.resizeShape(shape, newBounds);
22881 SpaceToolHandler.prototype.postExecute = function(context) {
22883 var modeling = this._modeling,
22884 movingShapes = context.movingShapes,
22885 delta = context.delta;
22887 modeling.moveShapes(movingShapes, delta);
22890 SpaceToolHandler.prototype.execute = function(context) {};
22891 SpaceToolHandler.prototype.revert = function(context) {};
22894 "../../space-tool/SpaceUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceUtil.js",
22895 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
22897 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateAnchorsHandler.js": [function(require, module, exports) {
22900 var forEach = require('lodash/collection/forEach'),
22901 assign = require('lodash/object/assign');
22905 * Update the anchors of
22907 function UpdateAnchorsHandler() {}
22909 module.exports = UpdateAnchorsHandler;
22912 UpdateAnchorsHandler.prototype.execute = function(context) {
22914 // update connection anchors
22915 return this.updateAnchors(context.element, context.delta);
22918 UpdateAnchorsHandler.prototype.revert = function(context) {
22920 var delta = context.delta,
22926 // revert update connection anchors
22927 return this.updateAnchors(context.element, revertedDelta);
22931 * Update anchors on the element according to the delta movement.
22933 * @param {djs.model.Element}
22938 * @return Array<djs.model.Connection>
22940 UpdateAnchorsHandler.prototype.updateAnchors = function(element, delta) {
22942 function add(point, delta) {
22944 x: point.x + delta.x,
22945 y: point.y + delta.y
22949 function updateAnchor(waypoint) {
22950 var original = waypoint.original;
22952 waypoint.original = assign(original || {}, add(original || waypoint, delta));
22957 forEach(element.incoming, function(c) {
22958 var waypoints = c.waypoints;
22959 updateAnchor(waypoints[waypoints.length - 1]);
22964 forEach(element.outgoing, function(c) {
22965 var waypoints = c.waypoints;
22966 updateAnchor(waypoints[0]);
22974 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
22975 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22977 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateWaypointsHandler.js": [function(require, module, exports) {
22980 function UpdateWaypointsHandler() {}
22982 module.exports = UpdateWaypointsHandler;
22984 UpdateWaypointsHandler.prototype.execute = function(context) {
22986 var connection = context.connection,
22987 newWaypoints = context.newWaypoints;
22989 context.oldWaypoints = connection.waypoints;
22991 connection.waypoints = newWaypoints;
22996 UpdateWaypointsHandler.prototype.revert = function(context) {
22998 var connection = context.connection,
22999 oldWaypoints = context.oldWaypoints;
23001 connection.waypoints = oldWaypoints;
23006 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\helper\\MoveHelper.js": [function(require, module, exports) {
23009 var forEach = require('lodash/collection/forEach');
23011 var Elements = require('../../../../util/Elements');
23015 * A helper that is able to carry out serialized move operations on multiple
23018 * @param {Modeling}
23021 function MoveHelper(modeling) {
23022 this._modeling = modeling;
23025 module.exports = MoveHelper;
23028 * Move the specified elements and all children by the given delta.
23030 * This moves all enclosed connections, too and layouts all affected external
23034 * <djs.model.Base>} elements
23037 * @param {djs.model.Base}
23038 * newParent applied to the first level of shapes
23040 * @return {Array<djs.model.Base>} list of touched elements
23042 MoveHelper.prototype.moveRecursive = function(elements, delta, newParent) {
23043 return this.moveClosure(this.getClosure(elements), delta, newParent);
23047 * Move the given closure of elmements
23049 MoveHelper.prototype.moveClosure = function(closure, delta, newParent) {
23051 var modeling = this._modeling;
23053 var allShapes = closure.allShapes,
23054 allConnections = closure.allConnections,
23055 enclosedConnections = closure.enclosedConnections,
23056 topLevel = closure.topLevel;
23059 forEach(allShapes, function(s) {
23061 modeling.moveShape(s, delta, topLevel[s.id] && newParent, {
23067 // move all child connections / layout external connections
23068 forEach(allConnections, function(c) {
23070 var startMoved = !!allShapes[c.source.id],
23071 endMoved = !!allShapes[c.target.id];
23073 if (enclosedConnections[c.id] &&
23074 startMoved && endMoved) {
23075 modeling.moveConnection(c, delta, topLevel[c.id] && newParent, {
23076 updateAnchors: false
23079 modeling.layoutConnection(c, {
23080 startChanged: startMoved,
23081 endChanged: endMoved
23088 * Returns the closure for the selected elements
23091 * <djs.model.Base>} elements
23092 * @return {Object} closure
23094 MoveHelper.prototype.getClosure = function(elements) {
23095 return Elements.getClosure(elements);
23099 "../../../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
23100 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
23102 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\index.js": [function(require, module, exports) {
23105 require('../../command'),
23106 require('../change-support'),
23107 require('../rules')
23109 __init__: ['modeling'],
23110 modeling: ['type', require('./Modeling')],
23111 layouter: ['type', require('../../layout/BaseLayouter')]
23115 "../../command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
23116 "../../layout/BaseLayouter": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\BaseLayouter.js",
23117 "../change-support": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js",
23118 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
23119 "./Modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\Modeling.js"
23121 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\Move.js": [function(require, module, exports) {
23124 var assign = require('lodash/object/assign'),
23125 filter = require('lodash/collection/filter'),
23126 groupBy = require('lodash/collection/groupBy');
23129 var LOW_PRIORITY = 500,
23130 HIGH_PRIORITY = 1500;
23132 var getOriginalEvent = require('../../util/Event').getOriginal;
23134 var round = Math.round;
23138 * Return a filtered list of elements that do not contain those nested into
23142 * <djs.model.Base>} elements
23144 * @return {Array<djs.model.Base>} filtered
23146 function removeNested(elements) {
23148 var ids = groupBy(elements, 'id');
23150 return filter(elements, function(element) {
23151 while (!!(element = element.parent)) {
23152 if (ids[element.id]) {
23164 * A plugin that makes shapes draggable / droppable.
23166 * @param {EventBus}
23168 * @param {Dragging}
23170 * @param {Modeling}
23172 * @param {Selection}
23177 function MoveEvents(eventBus, dragging, modeling, selection, rules) {
23181 function canMove(shapes, delta, target) {
23183 return rules.allowed('shapes.move', {
23193 // assign a high priority to this handler to setup the environment
23194 // others may hook up later, e.g. at default priority and modify
23195 // the move environment
23197 eventBus.on('shape.move.start', HIGH_PRIORITY, function(event) {
23199 var context = event.context,
23200 shape = event.shape,
23201 shapes = selection.get().slice();
23203 // move only single shape shape if the dragged element
23204 // is not part of the current selection
23205 if (shapes.indexOf(shape) === -1) {
23209 // ensure we remove nested elements in the collection
23210 shapes = removeNested(shapes);
23212 // attach shapes to drag context
23218 // check if we can move the elements
23219 if (!canMove(shapes)) {
23220 // suppress move operation
23221 event.stopPropagation();
23227 // assign a low priority to this handler
23228 // to let others modify the move event before we update
23231 eventBus.on('shape.move.move', LOW_PRIORITY, function(event) {
23233 var context = event.context,
23234 shapes = context.shapes,
23235 hover = event.hover,
23242 // check if we can move the elements
23243 canExecute = canMove(shapes, delta, hover);
23245 context.delta = delta;
23246 context.canExecute = canExecute;
23248 // simply ignore move over
23249 if (canExecute === null) {
23250 context.target = null;
23255 context.target = hover;
23258 eventBus.on('shape.move.end', function(event) {
23260 var context = event.context;
23262 var delta = context.delta,
23263 canExecute = context.canExecute;
23269 // ensure we have actual pixel values deltas
23270 // (important when zoom level was > 1 during move)
23271 delta.x = round(delta.x);
23272 delta.y = round(delta.y);
23274 modeling.moveShapes(context.shapes, delta, context.target);
23280 eventBus.on('element.mousedown', function(event) {
23282 var originalEvent = getOriginalEvent(event);
23284 if (!originalEvent) {
23285 throw new Error('must supply DOM mousedown event');
23288 start(originalEvent, event.element);
23292 function start(event, element, activate) {
23294 // do not move connections or the root element
23295 if (element.waypoints || !element.parent) {
23299 dragging.activate(event, 'shape.move', {
23300 cursor: 'grabbing',
23301 autoActivate: activate,
23311 this.start = start;
23314 MoveEvents.$inject = ['eventBus', 'dragging', 'modeling', 'selection', 'rules'];
23316 module.exports = MoveEvents;
23319 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
23320 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
23321 "lodash/collection/groupBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js",
23322 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
23324 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\MoveVisuals.js": [function(require, module, exports) {
23327 var flatten = require('lodash/array/flatten'),
23328 forEach = require('lodash/collection/forEach'),
23329 filter = require('lodash/collection/filter'),
23330 find = require('lodash/collection/find'),
23331 map = require('lodash/collection/map');
23333 var Elements = require('../../util/Elements');
23335 var LOW_PRIORITY = 500;
23337 var MARKER_DRAGGING = 'djs-dragging',
23338 MARKER_OK = 'drop-ok',
23339 MARKER_NOT_OK = 'drop-not-ok';
23343 * A plugin that makes shapes draggable / droppable.
23345 * @param {EventBus}
23347 * @param {ElementRegistry}
23354 function MoveVisuals(eventBus, elementRegistry, canvas, styles) {
23356 function getGfx(e) {
23357 return elementRegistry.getGraphics(e);
23360 function getVisualDragShapes(shapes) {
23362 var elements = Elements.selfAndDirectChildren(shapes, true);
23363 var filteredElements = removeEdges(elements);
23365 return filteredElements;
23368 function getAllDraggedElements(shapes) {
23369 var allShapes = Elements.selfAndAllChildren(shapes, true);
23371 var allConnections = map(allShapes, function(shape) {
23372 return (shape.incoming || []).concat(shape.outgoing || []);
23375 return flatten(allShapes.concat(allConnections), true);
23378 function addDragger(shape, dragGroup) {
23379 var gfx = getGfx(shape);
23380 var dragger = gfx.clone();
23381 var bbox = gfx.getBBox();
23383 dragger.attr(styles.cls('djs-dragger', [], {
23388 dragGroup.add(dragger);
23391 // assign a low priority to this handler
23392 // to let others modify the move context before
23395 eventBus.on('shape.move.start', LOW_PRIORITY, function(event) {
23397 var context = event.context,
23398 dragShapes = context.shapes;
23400 var dragGroup = canvas.getDefaultLayer().group().attr(styles.cls('djs-drag-group', ['no-events']));
23402 var visuallyDraggedShapes = getVisualDragShapes(dragShapes);
23404 visuallyDraggedShapes.forEach(function(shape) {
23405 addDragger(shape, dragGroup);
23409 // cache all dragged elements / gfx
23410 // so that we can quickly undo their state changes later
23411 var allDraggedElements = context.allDraggedElements = getAllDraggedElements(dragShapes);
23413 // add dragging marker
23414 forEach(allDraggedElements, function(e) {
23415 canvas.addMarker(e, MARKER_DRAGGING);
23418 context.dragGroup = dragGroup;
23421 // assign a low priority to this handler
23422 // to let others modify the move context before
23425 eventBus.on('shape.move.move', LOW_PRIORITY, function(event) {
23427 var context = event.context,
23428 dragGroup = context.dragGroup,
23429 target = context.target;
23432 canvas.addMarker(target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
23435 dragGroup.translate(event.dx, event.dy);
23438 eventBus.on(['shape.move.out', 'shape.move.cleanup'], function(event) {
23439 var context = event.context;
23441 if (context.target) {
23442 canvas.removeMarker(context.target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
23446 eventBus.on('shape.move.cleanup', function(event) {
23448 var context = event.context,
23449 allDraggedElements = context.allDraggedElements,
23450 dragGroup = context.dragGroup;
23453 // remove dragging marker
23454 forEach(allDraggedElements, function(e) {
23455 canvas.removeMarker(e, MARKER_DRAGGING);
23459 dragGroup.remove();
23464 // returns elements minus all connections
23465 // where source or target is not elements
23466 function removeEdges(elements) {
23468 var filteredElements = filter(elements, function(element) {
23470 if (!element.waypoints) { // shapes
23472 } else { // connections
23473 var srcFound = find(elements, element.source);
23474 var targetFound = find(elements, element.target);
23476 return srcFound && targetFound;
23480 return filteredElements;
23483 MoveVisuals.$inject = ['eventBus', 'elementRegistry', 'canvas', 'styles'];
23485 module.exports = MoveVisuals;
23488 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
23489 "lodash/array/flatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\flatten.js",
23490 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
23491 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
23492 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
23493 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js"
23495 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\index.js": [function(require, module, exports) {
23498 require('../interaction-events'),
23499 require('../selection'),
23500 require('../outline'),
23501 require('../rules'),
23502 require('../dragging')
23504 __init__: ['move', 'moveVisuals'],
23505 move: ['type', require('./Move')],
23506 moveVisuals: ['type', require('./MoveVisuals')]
23510 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
23511 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
23512 "../outline": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\index.js",
23513 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
23514 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
23515 "./Move": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\Move.js",
23516 "./MoveVisuals": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\MoveVisuals.js"
23518 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\Outline.js": [function(require, module, exports) {
23521 var Snap = require('../../../vendor/snapsvg');
23522 var getBBox = require('../../util/Elements').getBBox;
23528 * A plugin that adds an outline to shapes and connections that may be activated
23529 * and styled via CSS classes.
23531 * @param {EventBus}
23532 * events the event bus
23534 function Outline(eventBus, styles, elementRegistry) {
23536 var OUTLINE_OFFSET = 6;
23538 var OUTLINE_STYLE = styles.cls('djs-outline', ['no-fill']);
23540 function createOutline(gfx, bounds) {
23541 return Snap.create('rect', OUTLINE_STYLE).prependTo(gfx);
23544 function updateShapeOutline(outline, bounds) {
23547 x: -OUTLINE_OFFSET,
23548 y: -OUTLINE_OFFSET,
23549 width: bounds.width + OUTLINE_OFFSET * 2,
23550 height: bounds.height + OUTLINE_OFFSET * 2
23554 function updateConnectionOutline(outline, connection) {
23556 var bbox = getBBox(connection);
23559 x: bbox.x - OUTLINE_OFFSET,
23560 y: bbox.y - OUTLINE_OFFSET,
23561 width: bbox.width + OUTLINE_OFFSET * 2,
23562 height: bbox.height + OUTLINE_OFFSET * 2
23566 eventBus.on(['shape.added', 'shape.changed'], function(event) {
23567 var element = event.element,
23570 var outline = gfx.select('.djs-outline');
23573 outline = createOutline(gfx, element);
23576 updateShapeOutline(outline, element);
23579 eventBus.on(['connection.added', 'connection.changed'], function(event) {
23580 var element = event.element,
23583 var outline = gfx.select('.djs-outline');
23586 outline = createOutline(gfx, element);
23589 updateConnectionOutline(outline, element);
23596 Outline.$inject = ['eventBus', 'styles', 'elementRegistry'];
23598 module.exports = Outline;
23601 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
23602 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js"
23604 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\index.js": [function(require, module, exports) {
23608 __init__: ['outline'],
23609 outline: ['type', require('./Outline')]
23612 "./Outline": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\Outline.js"
23614 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\Overlays.js": [function(require, module, exports) {
23617 var isArray = require('lodash/lang/isArray'),
23618 isString = require('lodash/lang/isString'),
23619 isObject = require('lodash/lang/isObject'),
23620 assign = require('lodash/object/assign'),
23621 forEach = require('lodash/collection/forEach'),
23622 filter = require('lodash/collection/filter'),
23623 debounce = require('lodash/function/debounce');
23625 var domify = require('min-dom/lib/domify'),
23626 domClasses = require('min-dom/lib/classes'),
23627 domRemove = require('min-dom/lib/remove');
23629 var getBBox = require('../../util/Elements').getBBox;
23631 // document wide unique overlay ids
23632 var ids = new(require('../../util/IdGenerator'))('ov');
23635 function createRoot(parent) {
23636 var root = domify('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />');
23637 parent.insertBefore(root, parent.firstChild);
23643 function setPosition(el, x, y) {
23650 function setVisible(el, visible) {
23651 el.style.display = visible === false ? 'none' : '';
23655 * A service that allows users to attach overlays to diagram elements.
23657 * The overlay service will take care of overlay positioning during updates.
23660 * // add a pink badge on the top left of the shape overlays.add(someShape, {
23661 * position: { top: -5, left: -5 }, html: '<div style="width: 10px; background:
23662 * fuchsia; color: white;">0</div>' });
23663 * // or add via shape id
23665 * overlays.add('some-element-id', { position: { top: -5, left: -5 } html: '<div
23666 * style="width: 10px; background: fuchsia; color: white;">0</div>' });
23667 * // or add with optional type
23669 * overlays.add(someShape, 'badge', { position: { top: -5, left: -5 } html: '<div
23670 * style="width: 10px; background: fuchsia; color: white;">0</div>' });
23672 * // remove an overlay
23674 * var id = overlays.add(...); overlays.remove(id);
23676 * @param {EventBus}
23680 * @param {ElementRegistry}
23683 function Overlays(config, eventBus, canvas, elementRegistry) {
23685 this._eventBus = eventBus;
23686 this._canvas = canvas;
23687 this._elementRegistry = elementRegistry;
23691 this._overlayDefaults = {
23699 * Mapping overlayId -> overlay
23701 this._overlays = {};
23704 * Mapping elementId -> overlay container
23706 this._overlayContainers = {};
23708 // root html element for all overlays
23709 this._overlayRoot = createRoot(canvas.getContainer());
23711 this._init(config);
23715 Overlays.$inject = ['config.overlays', 'eventBus', 'canvas', 'elementRegistry'];
23717 module.exports = Overlays;
23721 * Returns the overlay with the specified id or a list of overlays for an
23722 * element with a given type.
23725 * // return the single overlay with the given id overlays.get('some-id');
23726 * // return all overlays for the shape overlays.get({ element: someShape });
23727 * // return all overlays on shape with type 'badge' overlays.get({ element:
23728 * someShape, type: 'badge' });
23729 * // shape can also be specified as id overlays.get({ element: 'element-id',
23730 * type: 'badge' });
23737 * @param {String|djs.model.Base}
23742 * @return {Object|Array<Object>} the overlay(s)
23744 Overlays.prototype.get = function(search) {
23746 if (isString(search)) {
23752 if (search.element) {
23753 var container = this._getOverlayContainer(search.element, true);
23755 // return a list of overlays when searching by element (+type)
23757 return search.type ? filter(container.overlays, {
23759 }) : container.overlays.slice();
23765 return filter(this._overlays, {
23769 // return single element when searching by id
23770 return search.id ? this._overlays[search.id] : null;
23775 * Adds a HTML overlay to an element.
23777 * @param {String|djs.model.Base}
23778 * element attach overlay to this shape
23780 * [type] optional type to assign to the overlay
23782 * overlay the overlay configuration
23784 * @param {String|DOMElement}
23785 * overlay.html html element to use as an overlay
23787 * [overlay.show] show configuration
23789 * [overlay.show.minZoom] minimal zoom level to show the overlay
23791 * [overlay.show.maxZoom] maximum zoom level to show the overlay
23793 * overlay.position where to attach the overlay
23795 * [overlay.position.left] relative to element bbox left attachment
23797 * [overlay.position.top] relative to element bbox top attachment
23799 * [overlay.position.bottom] relative to element bbox bottom
23802 * [overlay.position.right] relative to element bbox right attachment
23804 * @return {String} id that may be used to reference the overlay for update or
23807 Overlays.prototype.add = function(element, type, overlay) {
23809 if (isObject(type)) {
23815 element = this._elementRegistry.get(element);
23818 if (!overlay.position) {
23819 throw new Error('must specifiy overlay position');
23822 if (!overlay.html) {
23823 throw new Error('must specifiy overlay html');
23827 throw new Error('invalid element specified');
23830 var id = this._ids.next();
23832 overlay = assign({}, this._overlayDefaults, overlay, {
23839 this._addOverlay(overlay);
23846 * Remove an overlay with the given id or all overlays matching the given
23849 * @see Overlays#get for filter options.
23856 Overlays.prototype.remove = function(filter) {
23858 var overlays = this.get(filter) || [];
23860 if (!isArray(overlays)) {
23861 overlays = [overlays];
23866 forEach(overlays, function(overlay) {
23868 var container = self._getOverlayContainer(overlay.element, true);
23871 domRemove(overlay.html);
23872 domRemove(overlay.htmlContainer);
23874 delete overlay.htmlContainer;
23875 delete overlay.element;
23877 delete self._overlays[overlay.id];
23881 var idx = container.overlays.indexOf(overlay);
23883 container.overlays.splice(idx, 1);
23891 Overlays.prototype.show = function() {
23892 setVisible(this._overlayRoot);
23896 Overlays.prototype.hide = function() {
23897 setVisible(this._overlayRoot, false);
23901 Overlays.prototype._updateOverlayContainer = function(container) {
23902 var element = container.element,
23903 html = container.html;
23905 // update container left,top according to the elements x,y coordinates
23906 // this ensures we can attach child elements relative to this container
23911 if (element.waypoints) {
23912 var bbox = getBBox(element);
23917 setPosition(html, x, y);
23921 Overlays.prototype._updateOverlay = function(overlay) {
23923 var position = overlay.position,
23924 htmlContainer = overlay.htmlContainer,
23925 element = overlay.element;
23927 // update overlay html relative to shape because
23928 // it is already positioned on the element
23931 var left = position.left,
23932 top = position.top;
23934 if (position.right !== undefined) {
23938 if (element.waypoints) {
23939 width = getBBox(element).width;
23941 width = element.width;
23944 left = position.right * -1 + width;
23947 if (position.bottom !== undefined) {
23951 if (element.waypoints) {
23952 height = getBBox(element).height;
23954 height = element.height;
23957 top = position.bottom * -1 + height;
23960 setPosition(htmlContainer, left || 0, top || 0);
23964 Overlays.prototype._createOverlayContainer = function(element) {
23965 var html = domify('<div class="djs-overlays djs-overlays-' + element.id + '" style="position: absolute" />');
23967 this._overlayRoot.appendChild(html);
23975 this._updateOverlayContainer(container);
23981 Overlays.prototype._updateRoot = function(viewbox) {
23982 var a = viewbox.scale || 1;
23983 var d = viewbox.scale || 1;
23985 var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
23987 this._overlayRoot.style.transform = matrix;
23988 this._overlayRoot.style['-ms-transform'] = matrix;
23992 Overlays.prototype._getOverlayContainer = function(element, raw) {
23993 var id = (element && element.id) || element;
23995 var container = this._overlayContainers[id];
23996 if (!container && !raw) {
23997 container = this._overlayContainers[id] = this._createOverlayContainer(element);
24004 Overlays.prototype._addOverlay = function(overlay) {
24006 var id = overlay.id,
24007 element = overlay.element,
24008 html = overlay.html,
24012 // unwrap jquery (for those who need it)
24014 html = html.get(0);
24017 // create proper html elements from
24018 // overlay HTML strings
24019 if (isString(html)) {
24020 html = domify(html);
24023 overlayContainer = this._getOverlayContainer(element);
24025 htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
24027 htmlContainer.appendChild(html);
24029 if (overlay.type) {
24030 domClasses(htmlContainer).add('djs-overlay-' + overlay.type);
24033 overlay.htmlContainer = htmlContainer;
24035 overlayContainer.overlays.push(overlay);
24036 overlayContainer.html.appendChild(htmlContainer);
24038 this._overlays[id] = overlay;
24040 this._updateOverlay(overlay);
24043 Overlays.prototype._updateOverlayVisibilty = function(viewbox) {
24045 forEach(this._overlays, function(overlay) {
24046 var show = overlay.show,
24047 htmlContainer = overlay.htmlContainer,
24051 if (show.minZoom > viewbox.scale ||
24052 show.maxZoom < viewbox.scale) {
24056 setVisible(htmlContainer, visible);
24061 Overlays.prototype._init = function(config) {
24063 var eventBus = this._eventBus;
24068 // scroll/zoom integration
24070 var updateViewbox = function(viewbox) {
24071 self._updateRoot(viewbox);
24072 self._updateOverlayVisibilty(viewbox);
24077 if (!config || config.deferUpdate !== false) {
24078 updateViewbox = debounce(updateViewbox, 300);
24081 eventBus.on('canvas.viewbox.changed', function(event) {
24083 updateViewbox(event.viewbox);
24087 // remove integration
24089 eventBus.on(['shape.remove', 'connection.remove'], function(e) {
24090 var overlays = self.get({
24094 forEach(overlays, function(o) {
24100 // move integration
24105 var element = e.element;
24107 var container = self._getOverlayContainer(element, true);
24110 forEach(container.overlays, function(overlay) {
24111 self._updateOverlay(overlay);
24114 self._updateOverlayContainer(container);
24119 // marker integration, simply add them on the overlays as classes, too.
24121 eventBus.on('element.marker.update', function(e) {
24122 var container = self._getOverlayContainer(e.element, true);
24124 domClasses(container.html)[e.add ? 'add' : 'remove'](e.marker);
24130 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
24131 "../../util/IdGenerator": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\IdGenerator.js",
24132 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
24133 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
24134 "lodash/function/debounce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js",
24135 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
24136 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
24137 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
24138 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
24139 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
24140 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
24141 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js"
24143 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\index.js": [function(require, module, exports) {
24145 __init__: ['overlays'],
24146 overlays: ['type', require('./Overlays')]
24149 "./Overlays": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\Overlays.js"
24151 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\Palette.js": [function(require, module, exports) {
24154 var isFunction = require('lodash/lang/isFunction'),
24155 forEach = require('lodash/collection/forEach');
24157 var domify = require('min-dom/lib/domify'),
24158 domQuery = require('min-dom/lib/query'),
24159 domAttr = require('min-dom/lib/attr'),
24160 domClear = require('min-dom/lib/clear'),
24161 domClasses = require('min-dom/lib/classes'),
24162 domMatches = require('min-dom/lib/matches'),
24163 domDelegate = require('min-dom/lib/delegate'),
24164 domEvent = require('min-dom/lib/event');
24167 var toggleSelector = '.djs-palette-toggle',
24168 entrySelector = '.entry',
24169 elementSelector = toggleSelector + ', ' + entrySelector;
24173 * A palette containing modeling elements.
24175 function Palette(eventBus, canvas) {
24177 this._eventBus = eventBus;
24178 this._canvas = canvas;
24180 this._providers = [];
24183 Palette.$inject = ['eventBus', 'canvas'];
24185 module.exports = Palette;
24189 * Register a provider with the palette
24191 * @param {PaletteProvider}
24194 Palette.prototype.registerProvider = function(provider) {
24195 this._providers.push(provider);
24197 if (!this._container) {
24206 * Returns the palette entries for a given element
24208 * @return {Array<PaletteEntryDescriptor>} list of entries
24210 Palette.prototype.getEntries = function() {
24214 // loop through all providers and their entries.
24215 // group entries by id so that overriding an entry is possible
24216 forEach(this._providers, function(provider) {
24217 var e = provider.getPaletteEntries();
24219 forEach(e, function(entry, id) {
24220 entries[id] = entry;
24231 Palette.prototype._init = function() {
24232 var parent = this._canvas.getContainer(),
24233 container = this._container = domify(Palette.HTML_MARKUP),
24236 parent.appendChild(container);
24238 domDelegate.bind(container, elementSelector, 'click', function(event) {
24240 var target = event.delegateTarget;
24242 if (domMatches(target, toggleSelector)) {
24243 return self.toggle();
24246 self.trigger('click', event);
24249 // prevent drag propagation
24250 domEvent.bind(container, 'mousedown', function(event) {
24251 event.stopPropagation();
24254 // prevent drag propagation
24255 domDelegate.bind(container, entrySelector, 'dragstart', function(event) {
24256 self.trigger('dragstart', event);
24259 this._eventBus.fire('palette.create', {
24265 Palette.prototype._update = function() {
24267 var entriesContainer = domQuery('.djs-palette-entries', this._container),
24268 entries = this._entries = this.getEntries();
24270 domClear(entriesContainer);
24272 forEach(entries, function(entry, id) {
24274 var grouping = entry.group || 'default';
24276 var container = domQuery('[data-group=' + grouping + ']', entriesContainer);
24278 container = domify('<div class="group" data-group="' + grouping + '"></div>');
24279 entriesContainer.appendChild(container);
24282 var html = entry.html || (
24284 '<hr class="separator" />' :
24285 '<div class="entry" draggable="true"></div>');
24288 var control = domify(html);
24289 // alert("Control ::" + control + " HTML :: " + html);
24291 container.appendChild(control);
24293 if (!entry.separator) {
24294 domAttr(control, 'data-action', id);
24297 domAttr(control, 'title', entry.title);
24302 if (entry.className) {
24303 domClasses(control).add(entry.className);
24306 if (entry.imageUrl) {
24307 control.appendChild(domify('<img src="' + entry.imageUrl + '">'));
24311 // alert("Entry Title :: " + entry.title + " Entry HTML :: " + html);
24314 // open after update
24320 * Trigger an action available on the palette
24327 Palette.prototype.trigger = function(action, event, autoActivate) {
24329 var entries = this._entries,
24333 button = event.delegateTarget || event.target;
24336 return event.preventDefault();
24340 entry = entries[domAttr(button, 'data-action')];
24341 handler = entry.action;
24343 originalEvent = event.originalEvent || event;
24345 // simple action (via callback function)
24346 if (isFunction(handler)) {
24347 if (action === 'click') {
24348 return handler(originalEvent, autoActivate);
24351 if (handler[action]) {
24352 return handler[action](originalEvent, autoActivate);
24356 // silence other actions
24357 event.preventDefault();
24362 * Close the palette
24364 Palette.prototype.close = function() {
24365 domClasses(this._container).remove('open');
24372 Palette.prototype.open = function() {
24373 domClasses(this._container).add('open');
24377 Palette.prototype.toggle = function(open) {
24378 if (this.isOpen()) {
24387 * Return true if the palette is opened.
24393 * if (palette.isOpen()) { // yes, we are open }
24395 * @return {boolean} true if palette is opened
24397 Palette.prototype.isOpen = function() {
24398 return this._container && domClasses(this._container).has('open');
24402 /* markup definition */
24404 Palette.HTML_MARKUP =
24405 '<div class="djs-palette">' +
24406 '<div class="djs-palette-entries"></div>' +
24407 '<div class="djs-palette-toggle"></div>' +
24410 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
24411 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
24412 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
24413 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
24414 "min-dom/lib/clear": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js",
24415 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js",
24416 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
24417 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
24418 "min-dom/lib/matches": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\matches.js",
24419 "min-dom/lib/query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\query.js"
24421 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\index.js": [function(require, module, exports) {
24423 __init__: ['palette'],
24424 palette: ['type', require('./Palette')]
24428 "./Palette": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\Palette.js"
24430 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\PopupMenu.js": [function(require, module, exports) {
24433 var forEach = require('lodash/collection/forEach'),
24434 assign = require('lodash/object/assign'),
24435 domEvent = require('min-dom/lib/event'),
24436 domify = require('min-dom/lib/domify'),
24437 domClasses = require('min-dom/lib/classes'),
24438 domAttr = require('min-dom/lib/attr'),
24439 domRemove = require('min-dom/lib/remove');
24442 function PopupMenu(eventBus, canvas) {
24444 this._eventBus = eventBus;
24445 this._canvas = canvas;
24446 this._instances = {};
24449 PopupMenu.$inject = ['eventBus', 'canvas'];
24451 module.exports = PopupMenu;
24453 PopupMenu.prototype.open = function(name, position, entries, options) {
24456 canvas = this._canvas,
24457 instances = outer._instances;
24459 // return existing instance
24460 if (instances[name]) {
24461 return instances[name];
24464 var parent = canvas.getContainer();
24466 // ------------------------
24467 function PopupMenuInstance() {
24471 self._actions = {};
24472 self.name = name || 'popup-menu';
24475 entryClassName: 'entry'
24477 assign(_options, options);
24480 var container = this._container = domify('<div class="djs-popup">');
24482 assign(container.style, {
24483 position: 'absolute',
24484 left: position.x + 'px',
24485 top: position.y + 'px'
24487 domClasses(container).add(name);
24490 forEach(entries, function(entry) {
24492 var entryContainer = domify('<div>');
24493 domClasses(entryContainer).add(entry.className || _options.entryClassName);
24494 domClasses(entryContainer).add('djs-popup-entry');
24497 domAttr(entryContainer, 'style', entry.style);
24500 if (entry.action) {
24501 domAttr(entryContainer, 'data-action', entry.action.name);
24502 self._actions[entry.action.name] = entry.action.handler;
24505 var title = domify('<span>');
24506 title.textContent = entry.label;
24507 entryContainer.appendChild(title);
24509 container.appendChild(entryContainer);
24513 domEvent.bind(container, 'click', function(event) {
24514 self.trigger(event);
24519 // apply canvas zoom level
24520 var zoom = canvas.zoom();
24522 container.style.transformOrigin = 'top left';
24523 container.style.transform = 'scale(' + zoom + ')';
24526 parent.appendChild(container);
24529 this.bindHandlers();
24532 PopupMenuInstance.prototype.close = function() {
24533 this.unbindHandlers();
24534 domRemove(this._container);
24535 delete outer._instances[this.name];
24538 PopupMenuInstance.prototype.bindHandlers = function() {
24541 eventBus = outer._eventBus;
24543 this._closeHandler = function() {
24547 eventBus.once('contextPad.close', this._closeHandler);
24548 eventBus.once('canvas.viewbox.changed', this._closeHandler);
24551 PopupMenuInstance.prototype.unbindHandlers = function() {
24553 var eventBus = outer._eventBus;
24555 eventBus.off('contextPad.close', this._closeHandler);
24556 eventBus.off('canvas.viewbox.changed', this._closeHandler);
24559 PopupMenuInstance.prototype.trigger = function(event) {
24561 var element = event.target,
24562 actionName = element.getAttribute('data-action') ||
24563 element.parentNode.getAttribute('data-action');
24565 var action = this._actions[actionName];
24572 // silence other actions
24573 event.preventDefault();
24576 var instance = outer._instances[name] = new PopupMenuInstance(position, entries, parent, options);
24582 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
24583 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
24584 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
24585 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
24586 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
24587 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
24588 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js"
24590 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\index.js": [function(require, module, exports) {
24594 __init__: ['popupMenu'],
24595 popupMenu: ['type', require('./PopupMenu')]
24599 "./PopupMenu": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\PopupMenu.js"
24601 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\Replace.js": [function(require, module, exports) {
24606 * Service that allow replacing of elements.
24612 function Replace(modeling) {
24614 this._modeling = modeling;
24617 module.exports = Replace;
24619 Replace.$inject = ['modeling'];
24623 * oldElement - Element to be replaced
24625 * newElementData - Containing information about the new Element, for
24626 * example height, width, type.
24628 * options - Custom options that will be attached to the context. It
24629 * can be used to inject data that is needed in the command chain.
24630 * For example it could be used in
24631 * eventbus.on('commandStack.shape.replace.postExecute') to change
24632 * shape attributes after shape creation.
24634 Replace.prototype.replaceElement = function(oldElement, newElementData, options) {
24636 var modeling = this._modeling;
24638 var newElement = null;
24640 if (oldElement.waypoints) {
24642 // modeling.replaceConnection
24644 // set center of element for modeling API
24645 // if no new width / height is given use old elements size
24646 newElementData.x = oldElement.x + (newElementData.width || oldElement.width) / 2;
24647 newElementData.y = oldElement.y + (newElementData.height || oldElement.height) / 2;
24649 newElement = modeling.replaceShape(oldElement, newElementData, options);
24656 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\index.js": [function(require, module, exports) {
24660 __init__: ['replace'],
24661 replace: ['type', require('./Replace')]
24665 "./Replace": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\Replace.js"
24667 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\Resize.js": [function(require, module, exports) {
24670 var forEach = require('lodash/collection/forEach'),
24671 filter = require('lodash/collection/filter'),
24672 pick = require('lodash/object/pick');
24674 var ResizeUtil = require('./ResizeUtil'),
24675 domEvent = require('min-dom/lib/event'),
24676 Elements = require('../../util/Elements');
24678 var isPrimaryButton = require('../../util/Mouse').isPrimaryButton;
24680 var round = Math.round;
24682 var Snap = require('../../../vendor/snapsvg');
24684 var HANDLE_OFFSET = -2,
24686 HANDLE_HIT_SIZE = 20;
24688 var MARKER_RESIZING = 'djs-resizing',
24689 MARKER_RESIZE_NOT_OK = 'resize-not-ok',
24690 CLS_RESIZER = 'djs-resizer';
24694 * Implements resize on shapes by
24695 * * adding resize handles, * creating a visual during resize * checking resize
24696 * rules * committing a change once finished
24700 * It's possible to customize the resizing behaviour by intercepting
24701 * 'resize.start' and providing the following parameters through the 'context':
24702 * * minDimensions ({ width, height }) - Minimum shape dimensions *
24703 * childrenBoxPadding (number) - Gap between the minimum bounding box and the
24708 * eventBus.on('resize.start', 1500, function(event) { var context =
24711 * context.minDimensions = { width: 140, height: 120 };
24712 * context.childrenBoxPadding = 30; });
24715 function Resize(eventBus, elementRegistry, rules, modeling, canvas, selection, dragging) {
24717 function canResize(context) {
24718 var ctx = pick(context, ['newBounds', 'shape', 'delta', 'direction']);
24719 return rules.allowed('shape.resize', ctx);
24723 // resizing implementation //////////////////////////////////
24726 * A helper that realizes the resize visuals
24729 create: function(context) {
24730 var container = canvas.getDefaultLayer(),
24731 shape = context.shape,
24734 frame = context.frame = Snap.create('rect', {
24735 class: 'djs-resize-overlay',
24736 width: shape.width + 10,
24737 height: shape.height + 10,
24742 frame.appendTo(container);
24745 update: function(context) {
24746 var frame = context.frame,
24747 bounds = context.newBounds;
24749 if (bounds.width > 5) {
24752 width: bounds.width
24756 if (bounds.height > 5) {
24759 height: bounds.height
24763 frame[context.canExecute ? 'removeClass' : 'addClass'](MARKER_RESIZE_NOT_OK);
24766 remove: function(context) {
24767 if (context.frame) {
24768 context.frame.remove();
24773 function computeMinBoundaryBox(context) {
24775 var shape = context.shape,
24776 direction = context.direction,
24777 minDimensions = context.minDimensions || {},
24778 childrenBoxPadding = context.childrenBoxPadding || 20,
24782 // grab all the shapes that are NOT labels or connections
24783 children = filter(shape.children, function(child) {
24785 if (child.waypoints) {
24790 if (child.type === 'label') {
24797 // compute a minimum bounding box
24798 // around the existing children
24799 if (children.length) {
24800 minBoundaryBox = Elements.getBBox(children);
24802 // add a gap between the minBoundaryBox and the resizable container
24803 minBoundaryBox.width += childrenBoxPadding * 2;
24804 minBoundaryBox.height += childrenBoxPadding * 2;
24805 minBoundaryBox.x -= childrenBoxPadding;
24806 minBoundaryBox.y -= childrenBoxPadding;
24808 minBoundaryBox = ResizeUtil.getMinResizeBounds(direction, shape, {
24809 width: minDimensions.width || 10,
24810 height: minDimensions.height || 10
24814 return minBoundaryBox;
24817 eventBus.on('resize.start', function(event) {
24819 var context = event.context,
24820 shape = context.shape,
24821 minBoundaryBox = context.minBoundaryBox;
24823 if (minBoundaryBox === undefined) {
24824 context.minBoundaryBox = computeMinBoundaryBox(context);
24827 // add resizable indicator
24828 canvas.addMarker(shape, MARKER_RESIZING);
24830 visuals.create(context);
24833 eventBus.on('resize.move', function(event) {
24835 var context = event.context,
24836 shape = context.shape,
24837 direction = context.direction,
24838 minBoundaryBox = context.minBoundaryBox,
24846 context.delta = delta;
24848 context.newBounds = ResizeUtil.resizeBounds(shape, direction, delta);
24850 if (minBoundaryBox) {
24851 context.newBounds = ResizeUtil.ensureMinBounds(context.newBounds, minBoundaryBox);
24854 // update + cache executable state
24855 context.canExecute = canResize(context);
24857 // update resize frame visuals
24858 visuals.update(context);
24861 eventBus.on('resize.end', function(event) {
24862 var context = event.context,
24863 shape = context.shape;
24865 var newBounds = context.newBounds;
24868 // ensure we have actual pixel values for new bounds
24869 // (important when zoom level was > 1 during move)
24870 newBounds.x = round(newBounds.x);
24871 newBounds.y = round(newBounds.y);
24872 newBounds.width = round(newBounds.width);
24873 newBounds.height = round(newBounds.height);
24875 // perform the actual resize
24876 if (context.canExecute) {
24877 modeling.resizeShape(shape, context.newBounds);
24881 eventBus.on('resize.cleanup', function(event) {
24883 var context = event.context,
24884 shape = context.shape;
24886 // remove resizable indicator
24887 canvas.removeMarker(shape, MARKER_RESIZING);
24889 // remove frame + destroy context
24890 visuals.remove(context);
24894 function activate(event, shape, direction) {
24896 dragging.activate(event, 'resize', {
24897 autoActivate: true,
24898 cursor: 'resize-' + (/nw|se/.test(direction) ? 'nwse' : 'nesw'),
24902 direction: direction,
24909 function makeDraggable(element, gfx, direction) {
24911 function listener(event) {
24912 // only trigger on left mouse button
24913 if (isPrimaryButton(event)) {
24914 activate(event, element, direction);
24918 domEvent.bind(gfx.node, 'mousedown', listener);
24919 domEvent.bind(gfx.node, 'touchstart', listener);
24922 function __createResizer(gfx, x, y, rotation, direction) {
24924 var group = gfx.group().addClass(CLS_RESIZER).addClass(CLS_RESIZER + '-' + direction);
24926 var origin = -HANDLE_SIZE + HANDLE_OFFSET;
24928 // Create four drag indicators on the outline
24929 group.rect(origin, origin, HANDLE_SIZE, HANDLE_SIZE).addClass(CLS_RESIZER + '-visual');
24930 group.rect(origin, origin, HANDLE_HIT_SIZE, HANDLE_HIT_SIZE).addClass(CLS_RESIZER + '-hit');
24932 var matrix = new Snap.Matrix().translate(x, y).rotate(rotation, 0, 0);
24933 group.transform(matrix);
24938 function createResizer(element, gfx, direction) {
24942 if (direction === 'nw') {
24943 resizer = __createResizer(gfx, 0, 0, 0, direction);
24944 } else if (direction === 'ne') {
24945 resizer = __createResizer(gfx, element.width, 0, 90, direction);
24946 } else if (direction === 'se') {
24947 resizer = __createResizer(gfx, element.width, element.height, 180, direction);
24949 resizer = __createResizer(gfx, 0, element.height, 270, direction);
24952 makeDraggable(element, resizer, direction);
24955 // resize handles implementation ///////////////////////////////
24957 function addResize(shape) {
24965 var gfx = elementRegistry.getGraphics(shape);
24967 createResizer(shape, gfx, 'nw');
24968 createResizer(shape, gfx, 'ne');
24969 createResizer(shape, gfx, 'se');
24970 createResizer(shape, gfx, 'sw');
24973 function removeResize(shape) {
24975 var gfx = elementRegistry.getGraphics(shape);
24976 var resizers = gfx.selectAll('.' + CLS_RESIZER);
24978 forEach(resizers, function(resizer) {
24983 eventBus.on('selection.changed', function(e) {
24985 var oldSelection = e.oldSelection,
24986 newSelection = e.newSelection;
24988 // remove old selection markers
24989 forEach(oldSelection, removeResize);
24991 // add new selection markers ONLY if single selection
24992 if (newSelection.length === 1) {
24993 forEach(newSelection, addResize);
24997 eventBus.on('shape.changed', function(e) {
24998 var shape = e.element;
25000 removeResize(shape);
25002 if (selection.isSelected(shape)) {
25010 this.activate = activate;
25013 Resize.$inject = ['eventBus', 'elementRegistry', 'rules', 'modeling', 'canvas', 'selection', 'dragging'];
25015 module.exports = Resize;
25018 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
25019 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
25020 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
25021 "./ResizeUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\ResizeUtil.js",
25022 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
25023 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
25024 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js",
25025 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
25027 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\ResizeUtil.js": [function(require, module, exports) {
25031 * Resize the given bounds by the specified delta from a given anchor point.
25034 * bounds the bounding box that should be resized
25036 * direction in which the element is resized (nw, ne, se, sw)
25038 * delta of the resize operation
25040 * @return {Bounds} resized bounding box
25042 module.exports.resizeBounds = function(bounds, direction, delta) {
25047 switch (direction) {
25053 width: bounds.width - dx,
25054 height: bounds.height - dy
25061 width: bounds.width - dx,
25062 height: bounds.height + dy
25069 width: bounds.width + dx,
25070 height: bounds.height - dy
25077 width: bounds.width + dx,
25078 height: bounds.height + dy
25082 throw new Error('unrecognized direction: ' + direction);
25086 module.exports.reattachPoint = function(bounds, newBounds, point) {
25088 var sx = bounds.width / newBounds.width,
25089 sy = bounds.height / newBounds.height;
25092 x: Math.round((newBounds.x + newBounds.width / 2)) - Math.floor(((bounds.x + bounds.width / 2) - point.x) / sx),
25093 y: Math.round((newBounds.y + newBounds.height / 2)) - Math.floor(((bounds.y + bounds.height / 2) - point.y) / sy)
25098 module.exports.ensureMinBounds = function(currentBounds, minBounds) {
25100 x: Math.min(currentBounds.x, minBounds.x),
25101 y: Math.min(currentBounds.y, minBounds.y)
25104 var bottomRight = {
25105 x: Math.max(currentBounds.x + currentBounds.width, minBounds.x + minBounds.width),
25106 y: Math.max(currentBounds.y + currentBounds.height, minBounds.y + minBounds.height)
25112 width: bottomRight.x - topLeft.x,
25113 height: bottomRight.y - topLeft.y
25118 module.exports.getMinResizeBounds = function(direction, currentBounds, minDimensions) {
25120 switch (direction) {
25123 x: currentBounds.x + currentBounds.width - minDimensions.width,
25124 y: currentBounds.y + currentBounds.height - minDimensions.height,
25125 width: minDimensions.width,
25126 height: minDimensions.height
25130 x: currentBounds.x + currentBounds.width - minDimensions.width,
25131 y: currentBounds.y,
25132 width: minDimensions.width,
25133 height: minDimensions.height
25137 x: currentBounds.x,
25138 y: currentBounds.y + currentBounds.height - minDimensions.height,
25139 width: minDimensions.width,
25140 height: minDimensions.height
25144 x: currentBounds.x,
25145 y: currentBounds.y,
25146 width: minDimensions.width,
25147 height: minDimensions.height
25150 throw new Error('unrecognized direction: ' + direction);
25157 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\index.js": [function(require, module, exports) {
25160 require('../modeling'),
25161 require('../rules'),
25162 require('../dragging')
25164 __init__: ['resize'],
25165 resize: ['type', require('./Resize')]
25169 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
25170 "../modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\index.js",
25171 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
25172 "./Resize": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\Resize.js"
25174 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\RuleProvider.js": [function(require, module, exports) {
25177 var inherits = require('inherits');
25179 var CommandInterceptor = require('../../command/CommandInterceptor');
25182 * A basic provider that may be extended to implement modeling rules.
25184 * Extensions should implement the init method to actually add their custom
25185 * modeling checks. Checks may be added via the #addRule(action, fn) method.
25187 * @param {EventBus}
25190 function RuleProvider(eventBus) {
25191 CommandInterceptor.call(this, eventBus);
25196 RuleProvider.$inject = ['eventBus'];
25198 inherits(RuleProvider, CommandInterceptor);
25200 module.exports = RuleProvider;
25204 * Adds a modeling rule for the given action, implemented through a callback
25207 * The function will receive the modeling specific action context to perform its
25208 * check. It must return false or null to disallow the action from happening.
25210 * Returning <code>null</code> may encode simply ignoring the action.
25214 * ResizableRules.prototype.init = function() {
25216 * this.addRule('shape.resize', function(context) {
25218 * var shape = context.shape;
25220 * if (!context.newBounds) { // check general resizability if (!shape.resizable) {
25221 * return false; } } else { // element must have minimum size of 10*10 points
25222 * return context.newBounds.width > 10 && context.newBounds.height > 10; } }); };
25224 * @param {String|Array
25225 * <String>} actions the identifier for the modeling action to check
25226 * @param {Function}
25227 * fn the callback function that performs the actual check
25229 RuleProvider.prototype.addRule = function(actions, fn) {
25233 if (typeof actions === 'string') {
25234 actions = [actions];
25237 actions.forEach(function(action) {
25239 self.canExecute(action, function(context, action, event) {
25240 return fn(context);
25245 "../../command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
25246 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js"
25248 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\Rules.js": [function(require, module, exports) {
25252 * A service that provides rules for certain diagram actions.
25254 * @param {CommandStack}
25257 function Rules(commandStack) {
25258 this._commandStack = commandStack;
25261 Rules.$inject = ['commandStack'];
25263 module.exports = Rules;
25267 * This method can be queried to ask whether certain modeling actions are
25271 * action the action to be checked
25273 * [context] the context to check the action in
25275 * @return {Boolean} returns true, false or null depending on whether the
25276 * operation is allowed, not allowed or should be ignored.
25278 Rules.prototype.allowed = function(action, context) {
25279 var allowed = this._commandStack.canExecute(action, context);
25281 // map undefined to true, i.e. no rules
25282 return allowed === undefined ? true : allowed;
25285 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js": [function(require, module, exports) {
25287 __depends__: [require('../../command')],
25288 __init__: ['rules'],
25289 rules: ['type', require('./Rules')]
25293 "../../command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
25294 "./Rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\Rules.js"
25296 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\Selection.js": [function(require, module, exports) {
25299 var isArray = require('lodash/lang/isArray'),
25300 forEach = require('lodash/collection/forEach');
25304 * A service that offers the current selection in a diagram. Offers the api to
25305 * control the selection, too.
25309 * @param {EventBus}
25310 * eventBus the event bus
25312 function Selection(eventBus) {
25314 this._eventBus = eventBus;
25316 this._selectedElements = [];
25320 eventBus.on(['shape.remove', 'connection.remove'], function(e) {
25321 var element = e.element;
25322 self.deselect(element);
25326 Selection.$inject = ['eventBus'];
25328 module.exports = Selection;
25331 Selection.prototype.deselect = function(element) {
25332 var selectedElements = this._selectedElements;
25334 var idx = selectedElements.indexOf(element);
25337 var oldSelection = selectedElements.slice();
25339 selectedElements.splice(idx, 1);
25341 this._eventBus.fire('selection.changed', {
25342 oldSelection: oldSelection,
25343 newSelection: selectedElements
25349 Selection.prototype.get = function() {
25350 return this._selectedElements;
25353 Selection.prototype.isSelected = function(element) {
25354 return this._selectedElements.indexOf(element) !== -1;
25359 * This method selects one or more elements on the diagram.
25361 * By passing an additional add parameter you can decide whether or not the
25362 * element(s) should be added to the already existing selection or not.
25364 * @method Selection#select
25366 * @param {Object|Object[]}
25367 * elements element or array of elements to be selected
25369 * [add] whether the element(s) should be appended to the current
25370 * selection, defaults to false
25372 Selection.prototype.select = function(elements, add) {
25373 var selectedElements = this._selectedElements,
25374 oldSelection = selectedElements.slice();
25376 if (!isArray(elements)) {
25377 elements = elements ? [elements] : [];
25380 // selection may be cleared by passing an empty array or null
25383 forEach(elements, function(element) {
25384 if (selectedElements.indexOf(element) !== -1) {
25385 // already selected
25388 selectedElements.push(element);
25392 this._selectedElements = selectedElements = elements.slice();
25394 this._eventBus.fire('selection.changed', {
25395 oldSelection: oldSelection,
25396 newSelection: selectedElements
25401 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
25402 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
25404 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionBehavior.js": [function(require, module, exports) {
25407 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier;
25410 function SelectionBehavior(eventBus, selection, canvas) {
25412 eventBus.on('create.end', 500, function(e) {
25413 if (e.context.canExecute) {
25414 selection.select(e.shape);
25418 eventBus.on('connect.end', 500, function(e) {
25419 if (e.context.canExecute && e.context.target) {
25420 selection.select(e.context.target);
25424 eventBus.on('shape.move.end', 500, function(e) {
25425 selection.select(e.context.shapes);
25428 eventBus.on('element.keydown', function(event) {
25429 alert("Key Down Elements ");
25431 // Shift + click selection
25432 eventBus.on('element.click', function(event) {
25434 var element = event.element;
25436 // do not select the root element
25438 if (element === canvas.getRootElement()) {
25442 var isSelected = selection.isSelected(element),
25443 isMultiSelect = selection.get().length > 1;
25445 // mouse-event: SELECTION_KEY
25446 var add = hasPrimaryModifier(event);
25448 // select OR deselect element in multi selection
25449 if (isSelected && isMultiSelect) {
25451 return selection.deselect(element);
25453 return selection.select(element);
25457 selection.select(element, add);
25459 selection.deselect(element);
25465 SelectionBehavior.$inject = ['eventBus', 'selection', 'canvas'];
25467 module.exports = SelectionBehavior;
25470 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js"
25472 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionVisuals.js": [function(require, module, exports) {
25475 var forEach = require('lodash/collection/forEach');
25477 var MARKER_HOVER = 'hover',
25478 MARKER_SELECTED = 'selected';
25482 * A plugin that adds a visible selection UI to shapes and connections by
25483 * appending the <code>hover</code> and <code>selected</code> classes to
25488 * Makes elements selectable, too.
25490 * @param {EventBus}
25492 * @param {SelectionService}
25497 function SelectionVisuals(events, canvas, selection, graphicsFactory, styles) {
25499 this._multiSelectionBox = null;
25501 function addMarker(e, cls) {
25502 canvas.addMarker(e, cls);
25505 function removeMarker(e, cls) {
25506 canvas.removeMarker(e, cls);
25509 events.on('element.hover', function(event) {
25510 addMarker(event.element, MARKER_HOVER);
25513 events.on('element.out', function(event) {
25514 removeMarker(event.element, MARKER_HOVER);
25517 events.on('selection.changed', function(event) {
25519 function deselect(s) {
25520 removeMarker(s, MARKER_SELECTED);
25523 function select(s) {
25524 addMarker(s, MARKER_SELECTED);
25527 var oldSelection = event.oldSelection,
25528 newSelection = event.newSelection;
25530 forEach(oldSelection, function(e) {
25531 if (newSelection.indexOf(e) === -1) {
25536 forEach(newSelection, function(e) {
25537 if (oldSelection.indexOf(e) === -1) {
25544 SelectionVisuals.$inject = [
25552 module.exports = SelectionVisuals;
25555 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
25557 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js": [function(require, module, exports) {
25559 __init__: ['selectionVisuals', 'selectionBehavior'],
25561 require('../interaction-events'),
25562 require('../outline')
25564 selection: ['type', require('./Selection')],
25565 selectionVisuals: ['type', require('./SelectionVisuals')],
25566 selectionBehavior: ['type', require('./SelectionBehavior')]
25570 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
25571 "../outline": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\index.js",
25572 "./Selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\Selection.js",
25573 "./SelectionBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionBehavior.js",
25574 "./SelectionVisuals": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionVisuals.js"
25576 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapContext.js": [function(require, module, exports) {
25579 var forEach = require('lodash/collection/forEach');
25581 var snapTo = require('./SnapUtil').snapTo;
25585 * A snap context, containing the (possibly incomplete) mappings of drop targets
25586 * (to identify the snapping) to computed snap points.
25588 function SnapContext() {
25591 * Map<String, SnapPoints> mapping drop targets to a list of possible
25596 this._targets = {};
25599 * Map<String, Point> initial positioning of element regarding various snap
25604 this._snapOrigins = {};
25607 * List of snap locations
25609 * @type {Array<String>}
25611 this._snapLocations = [];
25614 * Map<String, Array<Point>> of default snapping locations
25618 this._defaultSnaps = {};
25622 SnapContext.prototype.getSnapOrigin = function(snapLocation) {
25623 return this._snapOrigins[snapLocation];
25627 SnapContext.prototype.setSnapOrigin = function(snapLocation, initialValue) {
25628 this._snapOrigins[snapLocation] = initialValue;
25630 if (this._snapLocations.indexOf(snapLocation) === -1) {
25631 this._snapLocations.push(snapLocation);
25636 SnapContext.prototype.addDefaultSnap = function(type, point) {
25638 var snapValues = this._defaultSnaps[type];
25641 snapValues = this._defaultSnaps[type] = [];
25644 snapValues.push(point);
25648 * Return a number of initialized snaps, i.e. snap locations such as top-left,
25649 * mid, bottom-right and so forth.
25651 * @return {Array<String>} snapLocations
25653 SnapContext.prototype.getSnapLocations = function() {
25654 return this._snapLocations;
25658 * Set the snap locations for this context.
25660 * The order of locations determines precedence.
25663 * <String>} snapLocations
25665 SnapContext.prototype.setSnapLocations = function(snapLocations) {
25666 this._snapLocations = snapLocations;
25670 * Get snap points for a given target
25672 * @param {Element|String}
25675 SnapContext.prototype.pointsForTarget = function(target) {
25677 var targetId = target.id || target;
25679 var snapPoints = this._targets[targetId];
25682 snapPoints = this._targets[targetId] = new SnapPoints();
25683 snapPoints.initDefaults(this._defaultSnaps);
25689 module.exports = SnapContext;
25693 * Creates the snap points and initializes them with the given default values.
25696 * <String, Array<Point>>} [defaultPoints]
25698 function SnapPoints(defaultSnaps) {
25701 * Map<String, Map<(x|y), Array<Number>>> mapping snap locations, i.e.
25702 * top-left, bottom-right, center to actual snap values.
25706 this._snapValues = {};
25709 SnapPoints.prototype.add = function(snapLocation, point) {
25711 var snapValues = this._snapValues[snapLocation];
25714 snapValues = this._snapValues[snapLocation] = {
25720 if (snapValues.x.indexOf(point.x) === -1) {
25721 snapValues.x.push(point.x);
25724 if (snapValues.y.indexOf(point.y) === -1) {
25725 snapValues.y.push(point.y);
25730 SnapPoints.prototype.snap = function(point, snapLocation, axis, tolerance) {
25731 var snappingValues = this._snapValues[snapLocation];
25733 return snappingValues && snapTo(point[axis], snappingValues[axis], tolerance);
25737 * Initialize a number of default snapping points.
25742 SnapPoints.prototype.initDefaults = function(defaultSnaps) {
25746 forEach(defaultSnaps || {}, function(snapPoints, snapLocation) {
25747 forEach(snapPoints, function(point) {
25748 self.add(snapLocation, point);
25753 "./SnapUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js",
25754 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
25756 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js": [function(require, module, exports) {
25759 var abs = Math.abs,
25760 round = Math.round;
25764 * Snap value to a collection of reference values.
25773 * @return {Number} the value we snapped to or null, if none snapped
25775 function snapTo(value, values, tolerance) {
25776 tolerance = tolerance === undefined ? 10 : tolerance;
25778 var idx, snapValue;
25780 for (idx = 0; idx < values.length; idx++) {
25781 snapValue = values[idx];
25783 if (abs(snapValue - value) <= tolerance) {
25790 module.exports.snapTo = snapTo;
25793 function topLeft(bounds) {
25800 module.exports.topLeft = topLeft;
25803 function mid(bounds, defaultValue) {
25805 if (!bounds || isNaN(bounds.x) || isNaN(bounds.y)) {
25806 return defaultValue;
25810 x: round(bounds.x + bounds.width / 2),
25811 y: round(bounds.y + bounds.height / 2)
25815 module.exports.mid = mid;
25818 function bottomRight(bounds) {
25820 x: bounds.x + bounds.width,
25821 y: bounds.y + bounds.height
25825 module.exports.bottomRight = bottomRight;
25827 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\Snapping.js": [function(require, module, exports) {
25830 var filter = require('lodash/collection/filter'),
25831 forEach = require('lodash/collection/forEach'),
25832 debounce = require('lodash/function/debounce');
25835 var mid = require('./SnapUtil').mid;
25837 var SnapContext = require('./SnapContext');
25840 * A general purpose snapping component for diagram elements.
25842 * @param {EventBus}
25847 function Snapping(eventBus, canvas) {
25849 this._canvas = canvas;
25853 eventBus.on(['shape.move.start', 'create.start'], function(event) {
25854 self.initSnap(event);
25857 eventBus.on(['shape.move.move', 'shape.move.end', 'create.move', 'create.end'], function(event) {
25858 if (event.snapped) {
25865 eventBus.on(['shape.move.cleanup', 'create.cleanup'], function(event) {
25869 // delay hide by 1000 seconds since last match
25870 this._asyncHide = debounce(this.hide, 1000);
25873 Snapping.$inject = ['eventBus', 'canvas'];
25875 module.exports = Snapping;
25878 Snapping.prototype.initSnap = function(event) {
25880 var context = event.context,
25881 shape = context.shape,
25882 snapContext = context.snapContext;
25884 if (!snapContext) {
25885 snapContext = context.snapContext = new SnapContext();
25888 var snapMid = mid(shape, event);
25890 snapContext.setSnapOrigin('mid', {
25891 x: snapMid.x - event.x,
25892 y: snapMid.y - event.y
25895 return snapContext;
25899 Snapping.prototype.snap = function(event) {
25901 var context = event.context,
25902 snapContext = context.snapContext,
25903 shape = context.shape,
25904 target = context.target,
25905 snapLocations = snapContext.getSnapLocations();
25911 var snapPoints = snapContext.pointsForTarget(target);
25913 if (!snapPoints.initialized) {
25914 this.addTargetSnaps(snapPoints, shape, target);
25916 snapPoints.initialized = true;
25922 forEach(snapLocations, function(location) {
25924 var snapOrigin = snapContext.getSnapOrigin(location);
25926 var snapCurrent = {
25927 x: event.x + snapOrigin.x,
25928 y: event.y + snapOrigin.y
25931 // snap on both axis, if not snapped already
25932 forEach(['x', 'y'], function(axis) {
25933 var locationSnapping;
25935 if (!snapping[axis]) {
25936 locationSnapping = snapPoints.snap(snapCurrent, location, axis, 7);
25938 if (locationSnapping !== undefined) {
25940 value: locationSnapping,
25941 originValue: locationSnapping - snapOrigin[axis]
25947 // no more need to snap, drop out of interation
25948 if (snapping.x && snapping.y) {
25954 // show snap visuals
25956 this.showSnapLine('vertical', snapping.x && snapping.x.value);
25957 this.showSnapLine('horizontal', snapping.y && snapping.y.value);
25960 // adjust event { x, y, dx, dy } and mark as snapping
25965 cx = event.x - snapping.x.originValue;
25967 event.x = snapping.x.originValue;
25968 event.dx = event.dx - cx;
25970 event.snapped = true;
25974 cy = event.y - snapping.y.originValue;
25976 event.y = snapping.y.originValue;
25977 event.dy = event.dy - cy;
25979 event.snapped = true;
25984 Snapping.prototype._createLine = function(orientation) {
25986 var root = this._canvas.getLayer('snap');
25988 var line = root.path('M0,0 L0,0').addClass('djs-snap-line');
25991 update: function(position) {
25993 if (position === undefined) {
25998 if (orientation === 'horizontal') {
26000 path: 'M-100000,' + position + ' L+100000,' + position,
26005 path: 'M ' + position + ',-100000 L ' + position + ', +100000',
26015 Snapping.prototype._createSnapLines = function() {
26017 this._snapLines = {
26018 horizontal: this._createLine('horizontal'),
26019 vertical: this._createLine('vertical')
26023 Snapping.prototype.showSnapLine = function(orientation, position) {
26025 var line = this.getSnapLine(orientation);
26028 line.update(position);
26034 Snapping.prototype.getSnapLine = function(orientation) {
26035 if (!this._snapLines) {
26036 this._createSnapLines();
26039 return this._snapLines[orientation];
26042 Snapping.prototype.hide = function() {
26043 forEach(this._snapLines, function(l) {
26048 Snapping.prototype.addTargetSnaps = function(snapPoints, shape, target) {
26050 var siblings = this.getSiblings(shape, target);
26052 forEach(siblings, function(s) {
26053 snapPoints.add('mid', mid(s));
26058 Snapping.prototype.getSiblings = function(element, target) {
26060 // snap to all non connection siblings
26061 return target && filter(target.children, function(e) {
26062 return !e.hidden && !e.labelTarget && !e.waypoints && e !== element;
26066 "./SnapContext": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapContext.js",
26067 "./SnapUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js",
26068 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
26069 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
26070 "lodash/function/debounce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js"
26072 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceTool.js": [function(require, module, exports) {
26075 var SpaceUtil = require('./SpaceUtil');
26077 var Cursor = require('../../util/Cursor');
26079 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier;
26081 var abs = Math.abs,
26082 round = Math.round;
26084 var HIGH_PRIORITY = 1500;
26087 * A tool that allows users to create and remove space in a diagram.
26089 * The tool needs to be activated manually via
26090 * {@link SpaceTool#activate(MouseEvent)}.
26092 function SpaceTool(eventBus, dragging, elementRegistry, modeling, rules) {
26094 function canResize(shape) {
26098 return rules.allowed('shape.resize', ctx);
26101 function activateSelection(event, autoActivate) {
26102 dragging.activate(event, 'spaceTool.selection', {
26103 cursor: 'crosshair',
26104 autoActivate: autoActivate,
26113 function activateMakeSpace(event) {
26114 dragging.activate(event, 'spaceTool', {
26115 autoActivate: true,
26116 cursor: 'crosshair',
26124 eventBus.on('spaceTool.selection.end', function(event) {
26125 setTimeout(function() {
26126 activateMakeSpace(event.originalEvent);
26131 var AXIS_TO_DIMENSION = {
26141 function initializeMakeSpace(event, context) {
26143 var axis = abs(event.dx) > abs(event.dy) ? 'x' : 'y',
26144 offset = event['d' + axis],
26145 // start point of create space operation
26146 spacePos = event[axis] - offset,
26147 // list of moving shapes
26149 // list of resizing shapes
26150 resizingShapes = [];
26152 if (abs(offset) < 5) {
26156 // inverts the offset to choose the shapes
26157 // on the opposite side of the resizer if
26158 // a key modifier is pressed
26159 if (hasPrimaryModifier(event)) {
26163 // collect all elements that need to be moved _AND_
26164 // resized given on the initial create space position
26165 elementRegistry.forEach(function(shape) {
26166 var shapeStart = shape[[axis]],
26167 shapeEnd = shapeStart + shape[AXIS_TO_DIMENSION[axis]];
26169 // checking if it's root
26170 if (!shape.parent) {
26174 // checking if it's a shape
26175 if (shape.waypoints) {
26179 // shape after spacePos
26180 if (offset > 0 && shapeStart > spacePos) {
26181 return movingShapes.push(shape);
26184 // shape before spacePos
26185 if (offset < 0 && shapeEnd < spacePos) {
26186 return movingShapes.push(shape);
26189 // shape on top of spacePos, resize only if allowed
26190 if (shapeStart < spacePos && shapeEnd > spacePos && canResize(shape)) {
26191 return resizingShapes.push(shape);
26195 // store data in context
26196 context.axis = axis;
26197 context.direction = SpaceUtil.getDirection(axis, offset);
26198 context.movingShapes = movingShapes;
26199 context.resizingShapes = resizingShapes;
26201 Cursor.set('resize-' + (axis === 'x' ? 'ew' : 'ns'));
26207 eventBus.on('spaceTool.move', HIGH_PRIORITY, function(event) {
26209 var context = event.context;
26211 if (!context.initialized) {
26212 context.initialized = initializeMakeSpace(event, context);
26217 eventBus.on('spaceTool.end', function(event) {
26219 var context = event.context,
26220 axis = context.axis,
26221 direction = context.direction,
26222 movingShapes = context.movingShapes,
26223 resizingShapes = context.resizingShapes;
26225 // skip if create space has not been initialized yet
26226 if (!context.initialized) {
26231 x: round(event.dx),
26234 delta[AXIS_INVERTED[axis]] = 0;
26236 return modeling.createSpace(movingShapes, resizingShapes, delta, direction);
26240 this.activateSelection = activateSelection;
26241 this.activateMakeSpace = activateMakeSpace;
26244 SpaceTool.$inject = ['eventBus', 'dragging', 'elementRegistry', 'modeling', 'rules'];
26246 module.exports = SpaceTool;
26249 "../../util/Cursor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js",
26250 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
26251 "./SpaceUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceUtil.js"
26253 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceToolVisuals.js": [function(require, module, exports) {
26256 var forEach = require('lodash/collection/forEach');
26259 var MARKER_DRAGGING = 'djs-dragging';
26263 * A plugin that makes shapes draggable / droppable.
26265 * @param {EventBus}
26267 * @param {ElementRegistry}
26275 function SpaceToolVisuals(eventBus, elementRegistry, canvas, styles) {
26277 function getGfx(e) {
26278 return elementRegistry.getGraphics(e);
26281 function addDragger(shape, dragGroup) {
26282 var gfx = getGfx(shape);
26283 var dragger = gfx.clone();
26284 var bbox = gfx.getBBox();
26286 dragger.attr(styles.cls('djs-dragger', [], {
26291 dragGroup.add(dragger);
26294 eventBus.on('spaceTool.selection.start', function(event) {
26295 var space = canvas.getLayer('space'),
26296 context = event.context;
26298 var orientation = {
26299 x: 'M 0,-10000 L 0,10000',
26300 y: 'M -10000,0 L 10000,0'
26303 var crosshairGroup = space.group().attr(styles.cls('djs-crosshair-group', ['no-events']));
26305 crosshairGroup.path(orientation.x).addClass('djs-crosshair');
26306 crosshairGroup.path(orientation.y).addClass('djs-crosshair');
26308 context.crosshairGroup = crosshairGroup;
26311 eventBus.on('spaceTool.selection.move', function(event) {
26312 var crosshairGroup = event.context.crosshairGroup;
26314 crosshairGroup.translate(event.x, event.y);
26317 eventBus.on('spaceTool.selection.cleanup', function(event) {
26318 var context = event.context,
26319 crosshairGroup = context.crosshairGroup;
26321 if (crosshairGroup) {
26322 crosshairGroup.remove();
26327 // assign a low priority to this handler
26328 // to let others modify the move context before
26330 eventBus.on('spaceTool.move', function(event) {
26332 * TODO (Ricardo): extend connections while adding space
26335 var context = event.context,
26336 line = context.line,
26337 axis = context.axis,
26338 dragShapes = context.movingShapes;
26340 if (!context.initialized) {
26344 if (!context.dragGroup) {
26345 var spaceLayer = canvas.getLayer('space');
26346 line = spaceLayer.path('M0,0 L0,0').addClass('djs-crosshair');
26348 context.line = line;
26349 var dragGroup = canvas.getDefaultLayer().group().attr(styles.cls('djs-drag-group', ['no-events']));
26352 forEach(dragShapes, function(shape) {
26353 addDragger(shape, dragGroup);
26354 canvas.addMarker(shape, MARKER_DRAGGING);
26357 context.dragGroup = dragGroup;
26360 var orientation = {
26361 x: 'M' + event.x + ', -10000 L' + event.x + ', 10000',
26362 y: 'M -10000, ' + event.y + ' L 10000, ' + event.y
26366 path: orientation[axis],
26378 delta[opposite[context.axis]] = 0;
26380 context.dragGroup.translate(delta.x, delta.y);
26383 eventBus.on('spaceTool.cleanup', function(event) {
26385 var context = event.context,
26386 shapes = context.movingShapes,
26387 line = context.line,
26388 dragGroup = context.dragGroup;
26390 // remove dragging marker
26391 forEach(shapes, function(e) {
26392 canvas.removeMarker(e, MARKER_DRAGGING);
26397 dragGroup.remove();
26402 SpaceToolVisuals.$inject = ['eventBus', 'elementRegistry', 'canvas', 'styles'];
26404 module.exports = SpaceToolVisuals;
26407 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
26409 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceUtil.js": [function(require, module, exports) {
26413 * Get Resize direction given axis + offset
26420 * @return {String} (e|w|n|s)
26422 function getDirection(axis, offset) {
26424 if (axis === 'x') {
26434 if (axis === 'y') {
26447 module.exports.getDirection = getDirection;
26450 * Resize the given bounds by the specified delta from a given anchor point.
26453 * bounds the bounding box that should be resized
26455 * direction in which the element is resized (n, s, e, w)
26457 * delta of the resize operation
26459 * @return {Bounds} resized bounding box
26461 module.exports.resizeBounds = function(bounds, direction, delta) {
26466 switch (direction) {
26472 width: bounds.width,
26473 height: bounds.height - dy
26480 width: bounds.width,
26481 height: bounds.height + dy
26488 width: bounds.width - dx,
26489 height: bounds.height
26496 width: bounds.width + dx,
26497 height: bounds.height
26501 throw new Error('unrecognized direction: ' + direction);
26505 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\index.js": [function(require, module, exports) {
26507 __init__: ['spaceToolVisuals'],
26508 __depends__: [require('../dragging'), require('../modeling'), require('../rules')],
26509 spaceTool: ['type', require('./SpaceTool')],
26510 spaceToolVisuals: ['type', require('./SpaceToolVisuals')]
26514 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
26515 "../modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\index.js",
26516 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
26517 "./SpaceTool": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceTool.js",
26518 "./SpaceToolVisuals": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceToolVisuals.js"
26520 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\Tooltips.js": [function(require, module, exports) {
26523 var isString = require('lodash/lang/isString'),
26524 assign = require('lodash/object/assign'),
26525 forEach = require('lodash/collection/forEach'),
26526 debounce = require('lodash/function/debounce');
26528 var domify = require('min-dom/lib/domify'),
26529 domAttr = require('min-dom/lib/attr'),
26530 domClasses = require('min-dom/lib/classes'),
26531 domRemove = require('min-dom/lib/remove'),
26532 domDelegate = require('min-dom/lib/delegate');
26535 // document wide unique tooltip ids
26536 var ids = new(require('../../util/IdGenerator'))('tt');
26539 function createRoot(parent) {
26540 var root = domify('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />');
26541 parent.insertBefore(root, parent.firstChild);
26547 function setPosition(el, x, y) {
26554 function setVisible(el, visible) {
26555 el.style.display = visible === false ? 'none' : '';
26559 var tooltipClass = 'djs-tooltip',
26560 tooltipSelector = '.' + tooltipClass;
26563 * A service that allows users to render tool tips on the diagram.
26565 * The tooltip service will take care of updating the tooltip positioning during
26566 * navigation + zooming.
26571 * // add a pink badge on the top left of the shape tooltips.add({ position: {
26572 * x: 50, y: 100 }, html: '<div style="width: 10px; background: fuchsia; color:
26573 * white;">0</div>' });
26574 * // or with optional life span tooltips.add({ position: { top: -5, left: -5 },
26575 * html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>',
26577 * // remove a tool tip var id = tooltips.add(...); tooltips.remove(id); ```
26581 * @param {EventBus}
26586 function Tooltips(config, eventBus, canvas) {
26588 this._eventBus = eventBus;
26589 this._canvas = canvas;
26593 this._tooltipDefaults = {
26601 * Mapping tooltipId -> tooltip
26603 this._tooltips = {};
26605 // root html element for all tooltips
26606 this._tooltipRoot = createRoot(canvas.getContainer());
26611 domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mousedown', function(event) {
26612 event.stopPropagation();
26615 domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mouseover', function(event) {
26616 self.trigger('mouseover', event);
26619 domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mouseout', function(event) {
26620 self.trigger('mouseout', event);
26623 this._init(config);
26627 Tooltips.$inject = ['config.tooltips', 'eventBus', 'canvas'];
26629 module.exports = Tooltips;
26633 * Adds a HTML tooltip to the diagram
26636 * tooltip the tooltip configuration
26638 * @param {String|DOMElement}
26639 * tooltip.html html element to use as an tooltip
26641 * [tooltip.show] show configuration
26643 * [tooltip.show.minZoom] minimal zoom level to show the tooltip
26645 * [tooltip.show.maxZoom] maximum zoom level to show the tooltip
26647 * tooltip.position where to attach the tooltip
26649 * [tooltip.position.left] relative to element bbox left attachment
26651 * [tooltip.position.top] relative to element bbox top attachment
26653 * [tooltip.position.bottom] relative to element bbox bottom
26656 * [tooltip.position.right] relative to element bbox right attachment
26658 * [tooltip.timeout=-1]
26660 * @return {String} id that may be used to reference the tooltip for update or
26663 Tooltips.prototype.add = function(tooltip) {
26665 if (!tooltip.position) {
26666 throw new Error('must specifiy tooltip position');
26669 if (!tooltip.html) {
26670 throw new Error('must specifiy tooltip html');
26673 var id = this._ids.next();
26675 tooltip = assign({}, this._tooltipDefaults, tooltip, {
26679 this._addTooltip(tooltip);
26681 if (tooltip.timeout) {
26682 this.setTimeout(tooltip);
26688 Tooltips.prototype.trigger = function(action, event) {
26690 var node = event.delegateTarget || event.target;
26692 var tooltip = this.get(domAttr(node, 'data-tooltip-id'));
26698 if (action === 'mouseover' && tooltip.timeout) {
26699 this.clearTimeout(tooltip);
26702 if (action === 'mouseout' && tooltip.timeout) {
26703 // cut timeout after mouse out
26704 tooltip.timeout = 1000;
26706 this.setTimeout(tooltip);
26709 console.log('mouse leave', event);
26713 * Get a tooltip with the given id
26718 Tooltips.prototype.get = function(id) {
26720 if (typeof id !== 'string') {
26724 return this._tooltips[id];
26727 Tooltips.prototype.clearTimeout = function(tooltip) {
26729 tooltip = this.get(tooltip);
26735 var removeTimer = tooltip.removeTimer;
26738 clearTimeout(removeTimer);
26739 tooltip.removeTimer = null;
26743 Tooltips.prototype.setTimeout = function(tooltip) {
26745 tooltip = this.get(tooltip);
26751 this.clearTimeout(tooltip);
26755 tooltip.removeTimer = setTimeout(function() {
26756 self.remove(tooltip);
26757 }, tooltip.timeout);
26761 * Remove an tooltip with the given id
26766 Tooltips.prototype.remove = function(id) {
26768 var tooltip = this.get(id);
26771 domRemove(tooltip.html);
26772 domRemove(tooltip.htmlContainer);
26774 delete tooltip.htmlContainer;
26776 delete this._tooltips[tooltip.id];
26781 Tooltips.prototype.show = function() {
26782 setVisible(this._tooltipRoot);
26786 Tooltips.prototype.hide = function() {
26787 setVisible(this._tooltipRoot, false);
26791 Tooltips.prototype._updateRoot = function(viewbox) {
26792 var a = viewbox.scale || 1;
26793 var d = viewbox.scale || 1;
26795 var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
26797 this._tooltipRoot.style.transform = matrix;
26798 this._tooltipRoot.style['-ms-transform'] = matrix;
26802 Tooltips.prototype._addTooltip = function(tooltip) {
26804 var id = tooltip.id,
26805 html = tooltip.html,
26807 tooltipRoot = this._tooltipRoot;
26809 // unwrap jquery (for those who need it)
26811 html = html.get(0);
26814 // create proper html elements from
26815 // tooltip HTML strings
26816 if (isString(html)) {
26817 html = domify(html);
26820 htmlContainer = domify('<div data-tooltip-id="' + id + '" class="' + tooltipClass + '" style="position: absolute">');
26822 htmlContainer.appendChild(html);
26824 if (tooltip.type) {
26825 domClasses(htmlContainer).add('djs-tooltip-' + tooltip.type);
26828 if (tooltip.className) {
26829 domClasses(htmlContainer).add(tooltip.className);
26832 tooltip.htmlContainer = htmlContainer;
26834 tooltipRoot.appendChild(htmlContainer);
26836 this._tooltips[id] = tooltip;
26838 this._updateTooltip(tooltip);
26842 Tooltips.prototype._updateTooltip = function(tooltip) {
26844 var position = tooltip.position,
26845 htmlContainer = tooltip.htmlContainer;
26847 // update overlay html based on tooltip x, y
26849 setPosition(htmlContainer, position.x, position.y);
26853 Tooltips.prototype._updateTooltipVisibilty = function(viewbox) {
26855 forEach(this._tooltips, function(tooltip) {
26856 var show = tooltip.show,
26857 htmlContainer = tooltip.htmlContainer,
26861 if (show.minZoom > viewbox.scale ||
26862 show.maxZoom < viewbox.scale) {
26866 setVisible(htmlContainer, visible);
26871 Tooltips.prototype._init = function(config) {
26876 // scroll/zoom integration
26878 var updateViewbox = function(viewbox) {
26879 self._updateRoot(viewbox);
26880 self._updateTooltipVisibilty(viewbox);
26885 if (!config || config.deferUpdate !== false) {
26886 updateViewbox = debounce(updateViewbox, 300);
26889 this._eventBus.on('canvas.viewbox.changed', function(event) {
26891 updateViewbox(event.viewbox);
26896 "../../util/IdGenerator": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\IdGenerator.js",
26897 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
26898 "lodash/function/debounce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js",
26899 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
26900 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
26901 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
26902 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
26903 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js",
26904 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
26905 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js"
26907 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\index.js": [function(require, module, exports) {
26909 __init__: ['tooltips'],
26910 tooltips: ['type', require('./Tooltips')]
26913 "./Tooltips": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\Tooltips.js"
26915 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchFix.js": [function(require, module, exports) {
26918 function TouchFix(canvas, eventBus) {
26922 eventBus.on('canvas.init', function(e) {
26923 self.addBBoxMarker(e.svg);
26927 TouchFix.$inject = ['canvas', 'eventBus'];
26929 module.exports = TouchFix;
26933 * Safari mobile (iOS 7) does not fire touchstart event in <SVG> element if
26934 * there is no shape between 0,0 and viewport elements origin.
26936 * So touchstart event is only fired when the <g class="viewport"> element was
26937 * hit. Putting an element over and below the 'viewport' fixes that behavior.
26939 TouchFix.prototype.addBBoxMarker = function(paper) {
26941 var markerStyle = {
26943 class: 'outer-bound-marker'
26946 paper.rect(-10000, -10000, 10, 10).attr(markerStyle);
26947 paper.rect(10000, 10000, 10, 10).attr(markerStyle);
26951 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchInteractionEvents.js": [function(require, module, exports) {
26954 var forEach = require('lodash/collection/forEach'),
26955 domEvent = require('min-dom/lib/event'),
26956 domClosest = require('min-dom/lib/closest'),
26957 Hammer = require('hammerjs'),
26958 Snap = require('../../../vendor/snapsvg'),
26959 Event = require('../../util/Event');
26961 var MIN_ZOOM = 0.2,
26964 var mouseEvents = [
26975 console.log.apply(console, arguments);
26979 function get(service, injector) {
26981 return injector.get(service);
26987 function createTouchRecognizer(node) {
26989 function stopEvent(event) {
26990 Event.stopEvent(event, true);
26993 function stopMouse(event) {
26995 forEach(mouseEvents, function(e) {
26996 domEvent.bind(node, e, stopEvent, true);
27000 function allowMouse(event) {
27001 setTimeout(function() {
27002 forEach(mouseEvents, function(e) {
27003 domEvent.unbind(node, e, stopEvent, true);
27008 domEvent.bind(node, 'touchstart', stopMouse, true);
27009 domEvent.bind(node, 'touchend', allowMouse, true);
27010 domEvent.bind(node, 'touchcancel', allowMouse, true);
27012 // A touch event recognizer that handles
27013 // touch events only (we know, we can already handle
27014 // mouse events out of the box)
27016 var recognizer = new Hammer.Manager(node, {
27017 inputClass: Hammer.TouchInput,
27022 var tap = new Hammer.Tap();
27023 var pan = new Hammer.Pan({
27026 var press = new Hammer.Press();
27027 var pinch = new Hammer.Pinch();
27029 var doubleTap = new Hammer.Tap({
27030 event: 'doubletap',
27034 pinch.requireFailure(pan);
27035 pinch.requireFailure(press);
27037 recognizer.add([pan, press, pinch, doubleTap, tap]);
27039 recognizer.reset = function(force) {
27040 var recognizers = this.recognizers,
27041 session = this.session;
27043 if (session.stopped) {
27047 log('recognizer', 'stop');
27049 recognizer.stop(force);
27051 setTimeout(function() {
27054 log('recognizer', 'reset');
27055 for (i = 0; !!(r = recognizers[i]); i++) {
27057 r.state = 8; // FAILED STATE
27060 session.curRecognizer = null;
27064 recognizer.on('hammer.input', function(event) {
27065 if (event.srcEvent.defaultPrevented) {
27066 recognizer.reset(true);
27074 * A plugin that provides touch events for elements.
27076 * @param {EventBus}
27078 * @param {InteractionEvents}
27079 * interactionEvents
27081 function TouchInteractionEvents(injector, canvas, eventBus, elementRegistry, interactionEvents, snap) {
27083 // optional integrations
27084 var dragging = get('dragging', injector),
27085 move = get('move', injector),
27086 contextPad = get('contextPad', injector),
27087 palette = get('palette', injector);
27089 // the touch recognizer
27092 function handler(type) {
27094 return function(event) {
27095 log('element', type, event);
27097 interactionEvents.fire(type, event);
27101 function getGfx(target) {
27102 var node = domClosest(target, 'svg, .djs-element', true);
27103 return node && new Snap(node);
27106 function initEvents(svg) {
27108 // touch recognizer
27109 recognizer = createTouchRecognizer(svg);
27111 recognizer.on('doubletap', handler('element.dblclick'));
27113 recognizer.on('tap', handler('element.click'));
27115 function startGrabCanvas(event) {
27117 log('canvas', 'grab start');
27122 function update(e) {
27124 var dx = e.deltaX - lx,
27125 dy = e.deltaY - ly;
27137 recognizer.off('panmove', update);
27138 recognizer.off('panend', end);
27139 recognizer.off('pancancel', end);
27141 log('canvas', 'grab end');
27144 recognizer.on('panmove', update);
27145 recognizer.on('panend', end);
27146 recognizer.on('pancancel', end);
27149 function startGrab(event) {
27151 var gfx = getGfx(event.target),
27152 element = gfx && elementRegistry.get(gfx);
27155 if (move && canvas.getRootElement() !== element) {
27156 log('element', 'move start', element, event, true);
27157 return move.start(event, element, true);
27159 startGrabCanvas(event);
27163 function startZoom(e) {
27165 log('canvas', 'zoom start');
27167 var zoom = canvas.zoom(),
27170 function update(e) {
27172 var ratio = 1 - (1 - e.scale) / 1.50,
27173 newZoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, ratio * zoom));
27175 canvas.zoom(newZoom, mid);
27177 Event.stopEvent(e, true);
27181 recognizer.off('pinchmove', update);
27182 recognizer.off('pinchend', end);
27183 recognizer.off('pinchcancel', end);
27185 recognizer.reset(true);
27187 log('canvas', 'zoom end');
27190 recognizer.on('pinchmove', update);
27191 recognizer.on('pinchend', end);
27192 recognizer.on('pinchcancel', end);
27195 recognizer.on('panstart', startGrab);
27196 recognizer.on('press', startGrab);
27198 recognizer.on('pinchstart', startZoom);
27203 // simulate hover during dragging
27204 eventBus.on('drag.move', function(event) {
27206 var position = Event.toPoint(event.originalEvent);
27208 var node = document.elementFromPoint(position.x, position.y),
27209 gfx = getGfx(node),
27210 element = gfx && elementRegistry.get(gfx);
27212 if (element !== event.hover) {
27214 dragging.out(event);
27223 event.hover = element;
27224 event.hoverGfx = gfx;
27232 eventBus.on('contextPad.create', function(event) {
27233 var node = event.pad.html;
27235 // touch recognizer
27236 var padRecognizer = createTouchRecognizer(node);
27238 padRecognizer.on('panstart', function(event) {
27239 log('context-pad', 'panstart', event);
27240 contextPad.trigger('dragstart', event, true);
27243 padRecognizer.on('press', function(event) {
27244 log('context-pad', 'press', event);
27245 contextPad.trigger('dragstart', event, true);
27248 padRecognizer.on('tap', function(event) {
27249 log('context-pad', 'tap', event);
27250 contextPad.trigger('click', event);
27256 eventBus.on('palette.create', function(event) {
27257 var node = event.html;
27259 // touch recognizer
27260 var padRecognizer = createTouchRecognizer(node);
27262 padRecognizer.on('panstart', function(event) {
27263 log('palette', 'panstart', event);
27264 palette.trigger('dragstart', event, true);
27267 padRecognizer.on('press', function(event) {
27268 log('palette', 'press', event);
27269 palette.trigger('dragstart', event, true);
27272 padRecognizer.on('tap', function(event) {
27273 log('palette', 'tap', event);
27274 palette.trigger('click', event);
27279 eventBus.on('canvas.init', function(event) {
27280 initEvents(event.svg.node);
27285 TouchInteractionEvents.$inject = [
27290 'interactionEvents',
27294 module.exports = TouchInteractionEvents;
27296 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
27297 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
27298 "hammerjs": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\hammerjs\\hammer.js",
27299 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
27300 "min-dom/lib/closest": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\closest.js",
27301 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
27303 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\index.js": [function(require, module, exports) {
27305 __depends__: [require('../interaction-events')],
27306 __init__: ['touchInteractionEvents'],
27307 touchInteractionEvents: ['type', require('./TouchInteractionEvents')],
27308 touchFix: ['type', require('./TouchFix')]
27311 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
27312 "./TouchFix": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchFix.js",
27313 "./TouchInteractionEvents": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchInteractionEvents.js"
27315 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\BaseLayouter.js": [function(require, module, exports) {
27318 var LayoutUtil = require('./LayoutUtil');
27322 * A base connection layouter implementation that layouts the connection by
27323 * directly connecting mid(source) + mid(target).
27325 function BaseLayouter() {}
27327 module.exports = BaseLayouter;
27331 * Return the new layouted waypoints for the given connection.
27333 * @param {djs.model.Connection}
27338 * [hints.movedStart=false]
27340 * [hints.movedEnd=false]
27342 * @return {Array<Point>} the layouted connection waypoints
27344 BaseLayouter.prototype.layoutConnection = function(connection, hints) {
27346 LayoutUtil.getMidPoint(connection.source),
27347 LayoutUtil.getMidPoint(connection.target)
27352 "./LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js"
27354 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\CroppingConnectionDocking.js": [function(require, module, exports) {
27357 var assign = require('lodash/object/assign');
27359 var LayoutUtil = require('./LayoutUtil');
27362 function dockingToPoint(docking) {
27363 // use the dockings actual point and
27364 // retain the original docking
27366 original: docking.point.original || docking.point
27367 }, docking.actual);
27372 * A {@link ConnectionDocking} that crops connection waypoints based on the
27373 * path(s) of the connection source and target.
27375 * @param {djs.core.ElementRegistry}
27378 function CroppingConnectionDocking(elementRegistry, renderer) {
27379 this._elementRegistry = elementRegistry;
27380 this._renderer = renderer;
27383 CroppingConnectionDocking.$inject = ['elementRegistry', 'renderer'];
27385 module.exports = CroppingConnectionDocking;
27389 * @inheritDoc ConnectionDocking#getCroppedWaypoints
27391 CroppingConnectionDocking.prototype.getCroppedWaypoints = function(connection, source, target) {
27393 source = source || connection.source;
27394 target = target || connection.target;
27396 var sourceDocking = this.getDockingPoint(connection, source, true),
27397 targetDocking = this.getDockingPoint(connection, target);
27399 var croppedWaypoints = connection.waypoints.slice(sourceDocking.idx + 1, targetDocking.idx);
27401 croppedWaypoints.unshift(dockingToPoint(sourceDocking));
27402 croppedWaypoints.push(dockingToPoint(targetDocking));
27404 return croppedWaypoints;
27408 * Return the connection docking point on the specified shape
27410 * @inheritDoc ConnectionDocking#getDockingPoint
27412 CroppingConnectionDocking.prototype.getDockingPoint = function(connection, shape, dockStart) {
27414 var waypoints = connection.waypoints,
27419 dockingIdx = dockStart ? 0 : waypoints.length - 1;
27420 dockingPoint = waypoints[dockingIdx];
27422 croppedPoint = this._getIntersection(shape, connection, dockStart);
27425 point: dockingPoint,
27426 actual: croppedPoint || dockingPoint,
27432 // //// helper methods ///////////////////////////////////////////////////
27434 CroppingConnectionDocking.prototype._getIntersection = function(shape, connection, takeFirst) {
27436 var shapePath = this._getShapePath(shape),
27437 connectionPath = this._getConnectionPath(connection);
27439 return LayoutUtil.getElementLineIntersection(shapePath, connectionPath, takeFirst);
27442 CroppingConnectionDocking.prototype._getConnectionPath = function(connection) {
27443 return this._renderer.getConnectionPath(connection);
27446 CroppingConnectionDocking.prototype._getShapePath = function(shape) {
27447 return this._renderer.getShapePath(shape);
27450 CroppingConnectionDocking.prototype._getGfx = function(element) {
27451 return this._elementRegistry.getGraphics(element);
27454 "./LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js",
27455 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
27457 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js": [function(require, module, exports) {
27460 var isArray = require('lodash/lang/isArray'),
27461 sortBy = require('lodash/collection/sortBy');
27463 var Snap = require('../../vendor/snapsvg');
27466 * Returns whether two points are in a horizontal or vertical line.
27473 * @return {String|Boolean} returns false if the points are not aligned or 'h|v'
27474 * if they are aligned horizontally / vertically.
27476 function pointsAligned(a, b) {
27487 module.exports.pointsAligned = pointsAligned;
27490 function roundPoint(point) {
27493 x: Math.round(point.x),
27494 y: Math.round(point.y)
27498 module.exports.roundPoint = roundPoint;
27501 function pointsEqual(a, b) {
27502 return a.x === b.x && a.y === b.y;
27505 module.exports.pointsEqual = pointsEqual;
27508 function pointDistance(a, b) {
27509 return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
27512 module.exports.pointDistance = pointDistance;
27515 function asTRBL(bounds) {
27518 right: bounds.x + (bounds.width || 0),
27519 bottom: bounds.y + (bounds.height || 0),
27524 module.exports.asTRBL = asTRBL;
27527 function getMidPoint(bounds) {
27528 return roundPoint({
27529 x: bounds.x + bounds.width / 2,
27530 y: bounds.y + bounds.height / 2
27534 module.exports.getMidPoint = getMidPoint;
27537 // //// orientation utils //////////////////////////////
27539 function getOrientation(rect, reference, pointDistance) {
27541 pointDistance = pointDistance || 0;
27543 var rectOrientation = asTRBL(rect),
27544 referenceOrientation = asTRBL(reference);
27546 var top = rectOrientation.bottom + pointDistance <= referenceOrientation.top,
27547 right = rectOrientation.left - pointDistance >= referenceOrientation.right,
27548 bottom = rectOrientation.top - pointDistance >= referenceOrientation.bottom,
27549 left = rectOrientation.right + pointDistance <= referenceOrientation.left;
27551 var vertical = top ? 'top' : (bottom ? 'bottom' : null),
27552 horizontal = left ? 'left' : (right ? 'right' : null);
27554 if (horizontal && vertical) {
27555 return vertical + '-' + horizontal;
27557 if (horizontal || vertical) {
27558 return horizontal || vertical;
27560 return 'intersect';
27564 module.exports.getOrientation = getOrientation;
27567 function hasAnyOrientation(rect, reference, pointDistance, locations) {
27569 if (isArray(pointDistance)) {
27570 locations = pointDistance;
27574 var orientation = getOrientation(rect, reference, pointDistance);
27576 return locations.indexOf(orientation) !== -1;
27579 module.exports.hasAnyOrientation = hasAnyOrientation;
27582 // //// intersection utils //////////////////////////////
27584 function getElementLineIntersection(elementPath, linePath, cropStart) {
27586 var intersections = getIntersections(elementPath, linePath);
27588 // recognize intersections
27589 // only one -> choose
27590 // two close together -> choose first
27591 // two or more distinct -> pull out appropriate one
27592 // none -> ok (fallback to point itself)
27593 if (intersections.length === 1) {
27594 return roundPoint(intersections[0]);
27595 } else if (intersections.length === 2 && pointDistance(intersections[0], intersections[1]) < 1) {
27596 return roundPoint(intersections[0]);
27597 } else if (intersections.length > 1) {
27599 // sort by intersections based on connection segment +
27600 // distance from start
27601 intersections = sortBy(intersections, function(i) {
27602 var distance = Math.floor(i.t2 * 100) || 1;
27604 distance = 100 - distance;
27606 distance = (distance < 10 ? '0' : '') + distance;
27608 // create a sort string that makes sure we sort
27609 // line segment ASC + line segment position DESC (for cropStart)
27610 // line segment ASC + line segment position ASC (for cropEnd)
27611 return i.segment2 + '#' + distance;
27614 return roundPoint(intersections[cropStart ? 0 : intersections.length - 1]);
27620 module.exports.getElementLineIntersection = getElementLineIntersection;
27623 function getIntersections(a, b) {
27624 return Snap.path.intersection(a, b);
27627 module.exports.getIntersections = getIntersections;
27629 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
27630 "lodash/collection/sortBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\sortBy.js",
27631 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
27633 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\ManhattanLayout.js": [function(require, module, exports) {
27636 var isArray = require('lodash/lang/isArray'),
27637 find = require('lodash/collection/find');
27639 var LayoutUtil = require('./LayoutUtil'),
27640 Geometry = require('../util/Geometry');
27642 var MIN_DISTANCE = 20;
27646 * Returns the mid points for a manhattan connection between two points.
27650 * [a]----[x] | [x]--->[b]
27659 * @return {Array<Point>}
27661 module.exports.getMidPoints = function(a, b, directions) {
27663 directions = directions || 'h:h';
27667 // one point, next to a
27668 if (directions === 'h:v') {
27674 // one point, above a
27675 if (directions === 'v:h') {
27681 // vertical edge xmid
27682 if (directions === 'h:h') {
27683 xmid = Math.round((b.x - a.x) / 2 + a.x);
27693 // horizontal edge ymid
27694 if (directions === 'v:v') {
27695 ymid = Math.round((b.y - a.y) / 2 + a.y);
27706 'unknown directions: <' + directions + '>: ' +
27707 'directions must be specified as {a direction}:{b direction} (direction in h|v)');
27713 * Create a connection between the two points according to the manhattan layout
27714 * (only horizontal and vertical) edges.
27722 * [directions='h:h'] specifies manhattan directions for each point
27723 * as {adirection}:{bdirection}. A directionfor a point is either `h`
27724 * (horizontal) or `v` (vertical)
27726 * @return {Array<Point>}
27728 module.exports.connectPoints = function(a, b, directions) {
27732 if (!LayoutUtil.pointsAligned(a, b)) {
27733 points = this.getMidPoints(a, b, directions);
27744 * Connect two rectangles using a manhattan layouted connection.
27747 * source source rectangle
27749 * target target rectangle
27751 * [start] source docking
27753 * [end] target docking
27755 * @return {Array<Point>} connection points
27757 module.exports.connectRectangles = function(source, target, start, end, options) {
27759 options = options || {};
27761 var orientation = LayoutUtil.getOrientation(source, target, MIN_DISTANCE);
27763 var directions = this.getDirections(source, target, options.preferVertical);
27765 start = start || LayoutUtil.getMidPoint(source);
27766 end = end || LayoutUtil.getMidPoint(target);
27768 // overlapping elements
27773 if (directions === 'h:h') {
27775 switch (orientation) {
27778 case 'bottom-right':
27786 x: target.x + target.width,
27792 case 'bottom-left':
27795 x: source.x + source.width,
27807 if (directions === 'v:v') {
27809 switch (orientation) {
27816 y: source.y + source.height
27824 case 'bottom-left':
27826 case 'bottom-right':
27835 y: target.y + target.height
27841 return this.connectPoints(start, end, directions);
27845 * Repair the connection between two rectangles, of which one has been updated.
27856 * <Point>} waypoints
27860 * hints.preferStraight
27862 * hints.preferVertical
27864 * hints.startChanged
27868 * @return {Array<Point>} repaired waypoints
27870 module.exports.repairConnection = function(source, target, start, end, waypoints, hints) {
27872 if (isArray(start)) {
27876 start = LayoutUtil.getMidPoint(source);
27877 end = LayoutUtil.getMidPoint(target);
27880 hints = hints || {};
27883 var repairedWaypoints;
27885 // just layout non-existing or simple connections
27886 // attempt to render straight lines, if required
27887 if (!waypoints || waypoints.length < 3) {
27889 if (hints.preferStraight) {
27890 // attempt to layout a straight line
27891 repairedWaypoints = this.layoutStraight(source, target, start, end, hints);
27894 // check if we layout from start or end
27895 if (hints.endChanged) {
27896 repairedWaypoints = this._repairConnectionSide(target, source, end, waypoints.slice().reverse());
27897 repairedWaypoints = repairedWaypoints && repairedWaypoints.reverse();
27899 if (hints.startChanged) {
27900 repairedWaypoints = this._repairConnectionSide(source, target, start, waypoints);
27902 // or whether nothing seems to have changed
27904 repairedWaypoints = waypoints;
27908 // simply reconnect if nothing else worked
27909 if (!repairedWaypoints) {
27910 return this.connectRectangles(source, target, start, end, hints);
27913 return repairedWaypoints;
27916 function max(a, b) {
27917 return Math.max(a, b);
27920 function min(a, b) {
27921 return Math.min(a, b);
27924 function inRange(a, start, end) {
27925 return a >= start && a <= end;
27928 module.exports.layoutStraight = function(source, target, start, end, hints) {
27930 var startX, endX, x,
27933 startX = max(source.x + 10, target.x + 10);
27934 endX = min(source.x + source.width - 10, target.x + target.width - 10);
27936 if (startX < endX) {
27938 if (source.width === target.width) {
27940 if (hints.endChanged && inRange(end.x, startX, endX)) {
27943 if (inRange(start.x, startX, endX)) {
27948 if (x === undefined) {
27949 if (source.width < target.width && inRange(start.x, startX, endX)) {
27952 if (source.width > target.width && inRange(end.x, startX, endX)) {
27955 x = (startX + endX) / 2;
27960 startY = max(source.y + 10, target.y + 10);
27961 endY = min(source.y + source.height - 10, target.y + target.height - 10);
27963 if (startY < endY) {
27965 if (source.height === target.height) {
27966 if (hints.endChanged && inRange(end.y, startY, endY)) {
27969 if (inRange(start.y, startY, endY)) {
27974 if (y === undefined) {
27975 if (source.height <= target.height && inRange(start.y, startY, endY)) {
27978 if (target.height <= source.height && inRange(end.y, startY, endY)) {
27981 y = (startY + endY) / 2;
27986 // cannot layout straight
27987 if (x === undefined && y === undefined) {
27992 x: x !== undefined ? x : start.x,
27993 y: y !== undefined ? y : start.y
27995 x: x !== undefined ? x : end.x,
27996 y: y !== undefined ? y : end.y
28002 * Repair a connection from one side that moved.
28011 * <Point>} points originalPoints from moved to other
28013 * @return {Array<Point>} the repaired points between the two rectangles
28015 module.exports._repairConnectionSide = function(moved, other, newDocking, points) {
28017 function needsRelayout(moved, other, points) {
28019 if (points.length < 3) {
28023 if (points.length > 4) {
28027 // relayout if two points overlap
28028 // this is most likely due to
28029 return !!find(points, function(p, idx) {
28030 var q = points[idx - 1];
28032 return q && Geometry.distance(p, q) < 3;
28036 function repairBendpoint(candidate, oldPeer, newPeer) {
28038 var alignment = LayoutUtil.pointsAligned(oldPeer, candidate);
28040 switch (alignment) {
28042 // repair vertical alignment
28048 // repair horizontal alignment
28061 function removeOverlapping(points, a, b) {
28064 for (i = points.length - 2; i !== 0; i--) {
28066 // intersects (?) break, remove all bendpoints up to this one and
28068 if (Geometry.pointInRect(points[i], a, MIN_DISTANCE) ||
28069 Geometry.pointInRect(points[i], b, MIN_DISTANCE)) {
28071 // return sliced old connection
28072 return points.slice(i);
28080 // (0) only repair what has layoutable bendpoints
28082 // (1) if only one bendpoint and on shape moved onto other shapes axis
28083 // (horizontally / vertically), relayout
28085 if (needsRelayout(moved, other, points)) {
28089 var oldDocking = points[0],
28090 newPoints = points.slice(),
28093 // (2) repair only last line segment and only if it was layouted before
28095 newPoints[0] = newDocking;
28096 newPoints[1] = repairBendpoint(newPoints[1], oldDocking, newDocking);
28099 // (3) if shape intersects with any bendpoint after repair,
28100 // remove all segments up to this bendpoint and repair from there
28102 slicedPoints = removeOverlapping(newPoints, moved, other);
28103 if (slicedPoints !== newPoints) {
28104 return this._repairConnectionSide(moved, other, newDocking, slicedPoints);
28111 * Returns the default manhattan directions connecting two rectangles.
28122 module.exports.getDirections = function(source, target, preferVertical) {
28123 var orientation = LayoutUtil.getOrientation(source, target, MIN_DISTANCE);
28125 switch (orientation) {
28138 return preferVertical ? 'v:v' : 'h:h';
28142 "../util/Geometry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js",
28143 "./LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js",
28144 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
28145 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
28147 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js": [function(require, module, exports) {
28150 var assign = require('lodash/object/assign'),
28151 inherits = require('inherits');
28153 var Refs = require('object-refs');
28155 var parentRefs = new Refs({
28162 labelRefs = new Refs({
28166 name: 'labelTarget'
28168 outgoingRefs = new Refs({
28174 incomingRefs = new Refs({
28182 * @namespace djs.model
28186 * @memberOf djs.model
28190 * The basic graphical representation
28199 * The object that backs up the shape
28201 * @name Base#businessObject
28204 Object.defineProperty(this, 'businessObject', {
28211 * @name Base#parent
28214 parentRefs.bind(this, 'parent');
28220 labelRefs.bind(this, 'label');
28223 * The list of outgoing connections
28225 * @name Base#outgoing
28226 * @type Array<Connection>
28228 outgoingRefs.bind(this, 'outgoing');
28231 * The list of outgoing connections
28233 * @name Base#incoming
28234 * @type Array<Connection>
28236 incomingRefs.bind(this, 'incoming');
28241 * A graphical object
28252 * The list of children
28254 * @name Shape#children
28255 * @type Array<Base>
28257 parentRefs.bind(this, 'children');
28260 inherits(Shape, Base);
28264 * A root graphical object
28275 inherits(Root, Shape);
28279 * A label for an element
28290 * The labeled element
28292 * @name Label#labelTarget
28295 labelRefs.bind(this, 'labelTarget');
28298 inherits(Label, Shape);
28302 * A connection between two elements
28309 function Connection() {
28313 * The element this connection originates from
28315 * @name Connection#source
28318 outgoingRefs.bind(this, 'source');
28321 * The element this connection points to
28323 * @name Connection#target
28326 incomingRefs.bind(this, 'target');
28329 inherits(Connection, Base);
28333 connection: Connection,
28340 * Creates a new model element of the specified type
28346 * var shape1 = Model.create('shape', { x: 10, y: 10, width: 100, height: 100
28347 * }); var shape2 = Model.create('shape', { x: 210, y: 210, width: 100, height:
28350 * var connection = Model.create('connection', { waypoints: [ { x: 110, y: 55 },
28351 * {x: 210, y: 55 } ] });
28354 * type lower-cased model name
28356 * attrs attributes to initialize the new model instance with
28358 * @return {Base} the new model instance
28360 module.exports.create = function(type, attrs) {
28361 var Type = types[type];
28363 throw new Error('unknown type: <' + type + '>');
28365 return assign(new Type(), attrs);
28369 module.exports.Base = Base;
28370 module.exports.Root = Root;
28371 module.exports.Shape = Shape;
28372 module.exports.Connection = Connection;
28373 module.exports.Label = Label;
28375 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js",
28376 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
28377 "object-refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\index.js"
28379 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\movecanvas\\MoveCanvas.js": [function(require, module, exports) {
28382 var Cursor = require('../../util/Cursor'),
28383 ClickTrap = require('../../util/ClickTrap'),
28384 domEvent = require('min-dom/lib/event'),
28385 Event = require('../../util/Event');
28387 function substract(p1, p2) {
28394 function length(point) {
28395 return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
28399 var THRESHOLD = 15;
28402 function MoveCanvas(eventBus, canvas) {
28404 var container = canvas._container,
28408 function handleMove(event) {
28410 var start = context.start,
28411 position = Event.toPoint(event),
28412 delta = substract(position, start);
28414 if (!context.dragging && length(delta) > THRESHOLD) {
28415 context.dragging = true;
28417 // prevent mouse click in this
28418 // interaction sequence
28419 ClickTrap.install();
28421 Cursor.set('move');
28424 if (context.dragging) {
28426 var lastPosition = context.last || context.start;
28428 delta = substract(position, lastPosition);
28435 context.last = position;
28439 event.preventDefault();
28443 function handleEnd(event) {
28444 domEvent.unbind(document, 'mousemove', handleMove);
28445 domEvent.unbind(document, 'mouseup', handleEnd);
28452 Event.stopEvent(event);
28455 function handleStart(event) {
28457 // reject non-left left mouse button or modifier key
28458 if (event.button || event.ctrlKey || event.shiftKey || event.altKey) {
28463 start: Event.toPoint(event)
28466 domEvent.bind(document, 'mousemove', handleMove);
28467 domEvent.bind(document, 'mouseup', handleEnd);
28470 Event.stopEvent(event);
28473 domEvent.bind(container, 'mousedown', handleStart);
28477 MoveCanvas.$inject = ['eventBus', 'canvas'];
28479 module.exports = MoveCanvas;
28482 "../../util/ClickTrap": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\ClickTrap.js",
28483 "../../util/Cursor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js",
28484 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
28485 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
28487 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\movecanvas\\index.js": [function(require, module, exports) {
28489 __init__: ['moveCanvas'],
28490 moveCanvas: ['type', require('./MoveCanvas')]
28493 "./MoveCanvas": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\movecanvas\\MoveCanvas.js"
28495 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\touch\\index.js": [function(require, module, exports) {
28497 __depends__: [require('../../features/touch')]
28500 "../../features/touch": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\index.js"
28502 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\zoomscroll\\ZoomScroll.js": [function(require, module, exports) {
28505 var domEvent = require('min-dom/lib/event');
28507 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier,
28508 hasSecondaryModifier = require('../../util/Mouse').hasSecondaryModifier;
28510 var isMac = require('../../util/Platform').isMac;
28513 function ZoomScroll(events, canvas) {
28514 var $canvas = $(canvas.getContainer()), //canvas.getContainer()
28515 $controls = $('<div></div>'),
28516 $zoomOut = $('<div><span class="glyphicon glyphicon-zoom-out"></span></div>'),
28517 $zoomIn = $('<div><span class="glyphicon glyphicon-zoom-in"></span></div>'),
28518 $zoomFit = $('<div><span class="glyphicon glyphicon-fullscreen"></span></div>'),
28522 $canvas.append($controls);
28523 $controls.append($zoomIn);
28524 $controls.append($zoomOut);
28525 $controls.append($zoomFit);
28527 $controls.addClass('zoom-controls');
28528 $zoomOut.addClass('zoom zoom-out');
28529 $zoomIn.addClass('zoom zoom-in');
28530 $zoomFit.addClass('zoom zoom-fit');
28532 $zoomOut.attr('title', 'Zoom out');
28533 $zoomIn.attr('title', 'Zoom in');
28534 $zoomFit.attr('title', 'Fit to viewport');
28536 // set initial zoom level
28537 //canvas.zoom( zlevel, 'auto' );
28539 // update our zoom level on viewbox change
28540 events.on('canvas.viewbox.changed', function(evt) {
28541 zlevel = evt.viewbox.scale;
28544 // define click handlers for controls
28545 $zoomFit.on('click', function() {
28546 canvas.zoom('fit-viewport', 'auto');
28549 $zoomOut.on('click', function() {
28550 zlevel = Math.max(zlevel - zstep, zstep);
28551 canvas.zoom(zlevel, 'auto');
28554 $zoomIn.on('click', function() {
28555 zlevel = Math.min(zlevel + zstep, 7);
28556 canvas.zoom(zlevel, 'auto');
28559 $(".TCS").click(function() {
28560 console.log($(this).data("stuff"));
28561 var modelElements = $(this).data("stuff").modelElements;
28562 var modelName = $(this).data("model").name;
28563 var hElements = [];
28564 modelElements.forEach(function(mElement) {
28565 if (hElements.indexOf(mElement.elementID) == -1) {
28566 hElements.push(mElement.elementID);
28569 highlightPath(hElements);
28572 function highlightPath(hElements) {
28574 var elementRegistry = canvas._elementRegistry;
28575 //console.log(elementRegistry);
28576 hElements.forEach(function(hElement) {
28578 //console.log(hElement);
28579 var activityShape = elementRegistry.get(hElement);
28580 var outgoing = activityShape.incoming;
28582 if (canvas.hasMarker(hElement, 'highlight')) {
28583 canvas.removeMarker(hElement, 'highlight');
28584 outgoing.forEach(function(flow) {
28585 var outgoingGfx = elementRegistry.getGraphics(flow.id);
28586 if (hElements.indexOf(flow.id) != -1) {
28587 outgoingGfx.select('path').attr({
28593 canvas.addMarker(hElement, 'highlight');
28594 outgoing.forEach(function(flow) {
28595 var outgoingGfx = elementRegistry.getGraphics(flow.id);
28596 if (hElements.indexOf(flow.id) != -1) {
28597 outgoingGfx.select('path').attr({
28604 //console.log(err);
28611 var elementRegistry = canvas._elementRegistry;
28612 elementRegistry.forEach(function(hElement) {
28614 canvas.removeMarker(hElement, 'highlight');
28615 var outgoing = hElement.incoming;
28616 outgoing.forEach(function(flow) {
28617 var outgoingGfx = elementRegistry.getGraphics(flow.id);
28618 outgoingGfx.select('path').attr({
28628 //console.log('endzoom');
28636 function cap(scale) {
28637 return Math.max(RANGE.min, Math.min(RANGE.max, scale));
28641 canvas.zoom('fit-viewport');
28644 function zoom(direction, position) {
28646 var currentZoom = canvas.zoom();
28647 var factor = Math.pow(1 + Math.abs(direction), direction > 0 ? 1 : -1);
28649 canvas.zoom(cap(currentZoom * factor), position);
28652 function scroll(delta) {
28653 canvas.scroll(delta);
28656 function init(element) {
28658 domEvent.bind(element, 'wheel', function(event) {
28661 event.preventDefault();
28663 // mouse-event: SELECTION_KEY
28664 // mouse-event: AND_KEY
28665 var isVerticalScroll = hasPrimaryModifier(event),
28666 isHorizontalScroll = hasSecondaryModifier(event);
28670 if (isVerticalScroll || isHorizontalScroll) {
28673 factor = event.deltaMode === 0 ? 1.25 : 50;
28675 factor = event.deltaMode === 0 ? 1 / 40 : 1 / 2;
28680 if (isHorizontalScroll) {
28681 delta.dx = (factor * (event.deltaX || event.deltaY));
28683 delta.dy = (factor * event.deltaY);
28688 factor = (event.deltaMode === 0 ? 1 / 40 : 1 / 2);
28690 var elementRect = element.getBoundingClientRect();
28693 x: event.clientX - elementRect.left,
28694 y: event.clientY - elementRect.top
28697 // zoom in relative to diagram {x,y} coordinates
28698 zoom(event.deltaY * factor / (-5), offset);
28704 events.on('canvas.init', function(e) {
28705 init(canvas._container);
28710 this.reset = reset;
28714 ZoomScroll.$inject = ['eventBus', 'canvas'];
28716 module.exports = ZoomScroll;
28720 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
28721 "../../util/Platform": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Platform.js",
28722 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
28724 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\zoomscroll\\index.js": [function(require, module, exports) {
28726 __init__: ['zoomScroll'],
28727 zoomScroll: ['type', require('./ZoomScroll')]
28730 "./ZoomScroll": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\zoomscroll\\ZoomScroll.js"
28732 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\ClickTrap.js": [function(require, module, exports) {
28735 var domEvent = require('min-dom/lib/event'),
28736 stopEvent = require('./Event').stopEvent;
28738 function trap(event) {
28744 function toggle(active) {
28745 domEvent[active ? 'bind' : 'unbind'](document.body, 'click', trap, true);
28749 * Installs a click trap that prevents a ghost click following a dragging
28752 * @return {Function} a function to immediately remove the installed trap.
28754 function install() {
28758 return function() {
28763 module.exports.install = install;
28765 "./Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
28766 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
28768 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js": [function(require, module, exports) {
28772 * Failsafe remove an element from a collection
28775 * <Object>} [collection]
28779 * @return {Object} the element that got removed or undefined
28781 module.exports.remove = function(collection, element) {
28783 if (!collection || !element) {
28787 var idx = collection.indexOf(element);
28792 collection.splice(idx, 1);
28798 * Fail save add an element to the given connection, ensuring it does not yet
28802 * <Object>} collection
28808 module.exports.add = function(collection, element, idx) {
28810 if (!collection || !element) {
28818 var currentIdx = collection.indexOf(element);
28820 if (currentIdx !== -1) {
28822 if (currentIdx === idx) {
28823 // nothing to do, position has not changed
28828 // remove from current position
28829 collection.splice(currentIdx, 1);
28831 // already exists in collection
28838 // insert at specified position
28839 collection.splice(idx, 0, element);
28842 collection.push(element);
28848 * Fail get the index of an element in a collection.
28851 * <Object>} collection
28855 * @return {Number} the index or -1 if collection or element do not exist or the
28856 * element is not contained.
28858 module.exports.indexOf = function(collection, element) {
28860 if (!collection || !element) {
28864 return collection.indexOf(element);
28868 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js": [function(require, module, exports) {
28871 var domClasses = require('min-dom/lib/classes');
28873 var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
28876 module.exports.set = function(mode) {
28877 var classes = domClasses(document.body);
28879 classes.removeMatching(CURSOR_CLS_PATTERN);
28882 classes.add('djs-cursor-' + mode);
28886 module.exports.unset = function() {
28890 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js"
28892 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js": [function(require, module, exports) {
28895 var isArray = require('lodash/lang/isArray'),
28896 isNumber = require('lodash/lang/isNumber'),
28897 groupBy = require('lodash/collection/groupBy'),
28898 forEach = require('lodash/collection/forEach');
28901 * Adds an element to a collection and returns true if the element was added.
28904 * <Object>} elements
28910 function add(elements, e, unique) {
28911 var canAdd = !unique || elements.indexOf(e) === -1;
28920 function eachElement(elements, fn, depth) {
28922 depth = depth || 0;
28924 forEach(elements, function(s, i) {
28925 var filter = fn(s, i, depth);
28927 if (isArray(filter) && filter.length) {
28928 eachElement(filter, fn, depth + 1);
28934 * Collects self + child elements up to a given depth from a list of elements.
28937 * <djs.model.Base>} elements the elements to select the children
28940 * unique whether to return a unique result set (no duplicates)
28942 * maxDepth the depth to search through or -1 for infinite
28944 * @return {Array<djs.model.Base>} found elements
28946 function selfAndChildren(elements, unique, maxDepth) {
28948 processedChildren = [];
28950 eachElement(elements, function(element, i, depth) {
28951 add(result, element, unique);
28953 var children = element.children;
28955 // max traversal depth not reached yet
28956 if (maxDepth === -1 || depth < maxDepth) {
28958 // children exist && children not yet processed
28959 if (children && add(processedChildren, children, unique)) {
28969 * Return self + direct children for a number of elements
28972 * <djs.model.Base>} elements to query
28974 * allowDuplicates to allow duplicates in the result set
28976 * @return {Array<djs.model.Base>} the collected elements
28978 function selfAndDirectChildren(elements, allowDuplicates) {
28979 return selfAndChildren(elements, !allowDuplicates, 1);
28983 * Return self + ALL children for a number of elements
28986 * <djs.model.Base>} elements to query
28988 * allowDuplicates to allow duplicates in the result set
28990 * @return {Array<djs.model.Base>} the collected elements
28992 function selfAndAllChildren(elements, allowDuplicates) {
28993 return selfAndChildren(elements, !allowDuplicates, -1);
28997 * Gets the the closure fo all selected elements, their connections and
29000 * <djs.model.Base>} elements
29001 * @return {Object} enclosure
29003 function getClosure(elements) {
29005 // original elements passed to this function
29006 var topLevel = groupBy(elements, function(e) {
29010 var allShapes = {},
29011 allConnections = {},
29012 enclosedElements = {},
29013 enclosedConnections = {};
29015 function handleConnection(c) {
29016 if (topLevel[c.source.id] && topLevel[c.target.id]) {
29017 topLevel[c.id] = c;
29020 // not enclosed as a child, but maybe logically
29021 // (connecting two moved elements?)
29022 if (allShapes[c.source.id] && allShapes[c.target.id]) {
29023 enclosedConnections[c.id] = enclosedElements[c.id] = c;
29026 allConnections[c.id] = c;
29029 function handleElement(element) {
29031 enclosedElements[element.id] = element;
29033 if (element.waypoints) {
29034 // remember connection
29035 enclosedConnections[element.id] = allConnections[element.id] = element;
29038 allShapes[element.id] = element;
29040 // remember all connections
29041 forEach(element.incoming, handleConnection);
29043 forEach(element.outgoing, handleConnection);
29045 // recurse into children
29046 return element.children;
29050 eachElement(elements, handleElement);
29053 allShapes: allShapes,
29054 allConnections: allConnections,
29055 topLevel: topLevel,
29056 enclosedConnections: enclosedConnections,
29057 enclosedElements: enclosedElements
29062 * Returns the surrounding bbox for all elements in the array or the element
29065 function getBBox(elements, stopRecursion) {
29067 stopRecursion = !!stopRecursion;
29068 if (!isArray(elements)) {
29069 elements = [elements];
29077 forEach(elements, function(element) {
29079 // If element is a connection the bbox must be computed first
29080 var bbox = element;
29081 if (element.waypoints && !stopRecursion) {
29082 bbox = getBBox(element.waypoints, true);
29087 height = bbox.height || 0,
29088 width = bbox.width || 0;
29090 if (x < minX || minX === undefined) {
29093 if (y < minY || minY === undefined) {
29097 if ((x + width) > maxX || maxX === undefined) {
29100 if ((y + height) > maxY || maxY === undefined) {
29108 height: maxY - minY,
29115 * Returns all elements that are enclosed from the bounding box.
29118 * <Object>} elements List of Elements to search through
29120 * bbox the enclosing bbox.
29122 * <li>If bbox.(width|height) is not specified the method returns
29123 * all elements with element.x/y > bbox.x/y </li>
29124 * <li>If only bbox.x or bbox.y is specified, method return all
29125 * elements with e.x > bbox.x or e.y > bbox.y.</li>
29129 function getEnclosedElements(elements, bbox) {
29131 var filteredElements = {};
29133 forEach(elements, function(element) {
29141 if (!isNumber(bbox.y) && (e.x > bbox.x)) {
29142 filteredElements[element.id] = element;
29144 if (!isNumber(bbox.x) && (e.y > bbox.y)) {
29145 filteredElements[element.id] = element;
29147 if (e.x > bbox.x && e.y > bbox.y) {
29148 if (isNumber(bbox.width) && isNumber(bbox.height) &&
29149 e.width + e.x < bbox.width + bbox.x &&
29150 e.height + e.y < bbox.height + bbox.y) {
29152 filteredElements[element.id] = element;
29153 } else if (!isNumber(bbox.width) || !isNumber(bbox.height)) {
29154 filteredElements[element.id] = element;
29159 return filteredElements;
29164 module.exports.eachElement = eachElement;
29165 module.exports.selfAndDirectChildren = selfAndDirectChildren;
29166 module.exports.selfAndAllChildren = selfAndAllChildren;
29167 module.exports.getBBox = getBBox;
29168 module.exports.getEnclosedElements = getEnclosedElements;
29170 module.exports.getClosure = getClosure;
29173 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
29174 "lodash/collection/groupBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js",
29175 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
29176 "lodash/lang/isNumber": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js"
29178 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js": [function(require, module, exports) {
29181 function __preventDefault(event) {
29182 return event && event.preventDefault();
29185 function __stopPropagation(event, immediate) {
29190 if (event.stopPropagation) {
29191 event.stopPropagation();
29194 if (immediate && event.stopImmediatePropagation) {
29195 event.stopImmediatePropagation();
29200 function getOriginal(event) {
29201 return event.originalEvent || event.srcEvent;
29204 module.exports.getOriginal = getOriginal;
29207 function stopEvent(event, immediate) {
29208 stopPropagation(event, immediate);
29209 preventDefault(event);
29212 module.exports.stopEvent = stopEvent;
29215 function preventDefault(event) {
29216 __preventDefault(event);
29217 __preventDefault(getOriginal(event));
29220 module.exports.preventDefault = preventDefault;
29223 function stopPropagation(event, immediate) {
29224 __stopPropagation(event, immediate);
29225 __stopPropagation(getOriginal(event), immediate);
29228 module.exports.stopPropagation = stopPropagation;
29231 function toPoint(event) {
29233 if (event.pointers && event.pointers.length) {
29234 event = event.pointers[0];
29237 if (event.touches && event.touches.length) {
29238 event = event.touches[0];
29247 module.exports.toPoint = toPoint;
29250 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js": [function(require, module, exports) {
29254 * Computes the distance between two points
29261 * @return {Number} distance
29263 var distance = module.exports.distance = function(p, q) {
29264 return Math.sqrt(Math.pow(q.x - p.x, 2) + Math.pow(q.y - p.y, 2));
29268 * Returns true if the point r is on the line between p and y
29277 * @return {Boolean}
29279 module.exports.pointsOnLine = function(p, q, r) {
29281 if (!p || !q || !r) {
29285 var val = (q.x - p.x) * (r.y - p.y) - (q.y - p.y) * (r.x - p.x),
29286 dist = distance(p, q);
29288 // @see http://stackoverflow.com/a/907491/412190
29289 return Math.abs(val / dist) < 5;
29292 module.exports.pointInRect = function(p, rect, tolerance) {
29293 tolerance = tolerance || 0;
29295 return p.x > rect.x - tolerance &&
29296 p.y > rect.y - tolerance &&
29297 p.x < rect.x + rect.width + tolerance &&
29298 p.y < rect.y + rect.height + tolerance;
29301 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\GraphicsUtil.js": [function(require, module, exports) {
29305 * SVGs for elements are generated by the {@link GraphicsFactory}.
29307 * This utility gives quick access to the important semantic parts of an
29312 * Returns the visual part of a diagram element
29315 * <SVGElement>} gfx
29317 * @return {Snap<SVGElement>}
29319 function getVisual(gfx) {
29320 return gfx.select('.djs-visual');
29324 * Returns the children for a given diagram element.
29327 * <SVGElement>} gfx
29328 * @return {Snap<SVGElement>}
29330 function getChildren(gfx) {
29331 return gfx.parent().children()[1];
29335 * Returns the visual bbox of an element
29338 * <SVGElement>} gfx
29342 function getBBox(gfx) {
29343 return getVisual(gfx).select('*').getBBox();
29347 module.exports.getVisual = getVisual;
29348 module.exports.getChildren = getChildren;
29349 module.exports.getBBox = getBBox;
29351 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\IdGenerator.js": [function(require, module, exports) {
29355 * Util that provides unique IDs.
29357 * @class djs.util.IdGenerator
29359 * @memberOf djs.util
29361 * The ids can be customized via a given prefix and contain a random value to
29362 * avoid collisions.
29365 * prefix a prefix to prepend to generated ids (for better
29368 function IdGenerator(prefix) {
29371 this._prefix = (prefix ? prefix + '-' : '') + Math.floor(Math.random() * 1000000000) + '-';
29374 module.exports = IdGenerator;
29377 * Returns a next unique ID.
29379 * @method djs.util.IdGenerator#next
29381 * @returns {String} the id
29383 IdGenerator.prototype.next = function() {
29384 return this._prefix + (++this._counter);
29388 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js": [function(require, module, exports) {
29391 var getOriginalEvent = require('./Event').getOriginal;
29393 var isMac = require('./Platform').isMac;
29396 function isPrimaryButton(event) {
29397 // button === 0 -> left áka primary mouse button
29398 return !(getOriginalEvent(event) || event).button;
29401 module.exports.isPrimaryButton = isPrimaryButton;
29403 module.exports.isMac = isMac;
29405 module.exports.hasPrimaryModifier = function(event) {
29406 var originalEvent = getOriginalEvent(event) || event;
29408 if (!isPrimaryButton(event)) {
29412 // Use alt as primary modifier key for mac OS
29414 return originalEvent.altKey;
29416 return originalEvent.ctrlKey;
29421 module.exports.hasSecondaryModifier = function(event) {
29422 var originalEvent = getOriginalEvent(event) || event;
29424 return isPrimaryButton(event) && originalEvent.shiftKey;
29428 "./Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
29429 "./Platform": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Platform.js"
29431 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Platform.js": [function(require, module, exports) {
29434 module.exports.isMac = function isMac() {
29435 return (/mac/i).test(navigator.platform);
29438 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Text.js": [function(require, module, exports) {
29441 var isObject = require('lodash/lang/isObject'),
29442 assign = require('lodash/object/assign'),
29443 forEach = require('lodash/collection/forEach'),
29444 reduce = require('lodash/collection/reduce'),
29445 merge = require('lodash/object/merge');
29447 var Snap = require('../../vendor/snapsvg');
29449 var DEFAULT_BOX_PADDING = 0;
29451 var DEFAULT_LABEL_SIZE = {
29457 function parseAlign(align) {
29459 var parts = align.split('-');
29462 horizontal: parts[0] || 'center',
29463 vertical: parts[1] || 'top'
29467 function parsePadding(padding) {
29469 if (isObject(padding)) {
29486 function getTextBBox(text, fakeText) {
29487 fakeText.textContent = text;
29488 return fakeText.getBBox();
29493 * Layout the next line and return the layouted element.
29495 * Alters the lines passed.
29499 * @return {Object} the line descriptor, an object { width, height, text }
29501 function layoutNext(lines, maxWidth, fakeText) {
29503 var originalLine = lines.shift(),
29504 fitLine = originalLine;
29509 textBBox = getTextBBox(fitLine, fakeText);
29511 textBBox.width = fitLine ? textBBox.width : 0;
29514 if (fitLine === ' ' || fitLine === '' || textBBox.width < Math.round(maxWidth) || fitLine.length < 4) {
29515 return fit(lines, fitLine, originalLine, textBBox);
29519 fitLine = shortenLine(fitLine, textBBox.width, maxWidth);
29523 function fit(lines, fitLine, originalLine, textBBox) {
29524 if (fitLine.length < originalLine.length) {
29525 var nextLine = lines[0] || '',
29526 remainder = originalLine.slice(fitLine.length).trim();
29528 if (/-\s*$/.test(remainder)) {
29529 nextLine = remainder.replace(/-\s*$/, '') + nextLine.replace(/^\s+/, '');
29531 nextLine = remainder + ' ' + nextLine;
29534 lines[0] = nextLine;
29537 width: textBBox.width,
29538 height: textBBox.height,
29545 * Shortens a line based on spacing and hyphens. Returns the shortened result on
29551 * maxLength the maximum characters of the string
29552 * @return {String} the shortened string
29554 function semanticShorten(line, maxLength) {
29555 var parts = line.split(/(\s|-)/g),
29557 shortenedParts = [],
29560 // try to shorten via spaces + hyphens
29561 if (parts.length > 1) {
29562 while ((part = parts.shift())) {
29563 if (part.length + length < maxLength) {
29564 shortenedParts.push(part);
29565 length += part.length;
29567 // remove previous part, too if hyphen does not fit anymore
29568 if (part === '-') {
29569 shortenedParts.pop();
29577 return shortenedParts.join('');
29581 function shortenLine(line, width, maxWidth) {
29582 var length = Math.max(line.length * (maxWidth / width), 1);
29584 // try to shorten semantically (i.e. based on spaces and hyphens)
29585 var shortenedLine = semanticShorten(line, length);
29587 if (!shortenedLine) {
29589 // force shorten by cutting the long word
29590 shortenedLine = line.slice(0, Math.max(Math.round(length - 1), 1));
29593 return shortenedLine;
29598 * Creates a new label utility
29602 * @param {Dimensions}
29611 function Text(config) {
29613 this._config = assign({}, {
29614 size: DEFAULT_LABEL_SIZE,
29615 padding: DEFAULT_BOX_PADDING,
29617 align: 'center-top'
29623 * Create a label in the parent node.
29625 * @method Text#createText
29627 * @param {SVGElement}
29628 * parent the parent to draw the label on
29630 * text the text to render on the label
29634 * options.align how to align in the bounding box. Any of {
29635 * 'center-middle', 'center-top' }, defaults to 'center-top'.
29637 * options.style style to be applied to the text
29639 * @return {SVGText} the text element created
29641 Text.prototype.createText = function(parent, text, options) {
29643 var box = merge({}, this._config.size, options.box || {}),
29644 style = merge({}, this._config.style, options.style || {}),
29645 align = parseAlign(options.align || this._config.align),
29646 padding = parsePadding(options.padding !== undefined ? options.padding : this._config.padding);
29648 var lines = text.split(/\r?\n/g),
29651 var maxWidth = box.width - padding.left - padding.right;
29653 // FF regression: ensure text is shown during rendering
29654 // by attaching it directly to the body
29655 var fakeText = parent.paper.text(0, 0, '').attr(style).node;
29657 while (lines.length) {
29658 layouted.push(layoutNext(lines, maxWidth, fakeText));
29661 var totalHeight = reduce(layouted, function(sum, line, idx) {
29662 return sum + line.height;
29665 // the y position of the next line
29668 switch (align.vertical) {
29670 y = (box.height - totalHeight) / 2 - layouted[0].height / 4;
29677 var textElement = parent.text().attr(style);
29679 forEach(layouted, function(line) {
29682 switch (align.horizontal) {
29688 x = (maxWidth - padding.right - line.width);
29693 x = Math.max(((maxWidth - line.width) / 2 + padding.left), 0);
29697 var tspan = Snap.create('tspan', {
29701 tspan.textContent = line.text;
29703 textElement.append(tspan);
29706 // remove fake text
29707 fakeText.parentNode.removeChild(fakeText);
29709 return textElement;
29713 module.exports = Text;
29715 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
29716 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
29717 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
29718 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
29719 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
29720 "lodash/object/merge": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\merge.js"
29722 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\annotation.js": [function(require, module, exports) {
29724 var isArray = function(obj) {
29725 return Object.prototype.toString.call(obj) === '[object Array]';
29728 var annotate = function() {
29729 var args = Array.prototype.slice.call(arguments);
29731 if (args.length === 1 && isArray(args[0])) {
29735 var fn = args.pop();
29743 // Current limitations:
29744 // - can't put into "function arg" comments
29745 // function /* (no parenthesis like this) */ (){}
29746 // function abc( /* xx (no parenthesis like this) */ a, b) {}
29748 // Just put the comment before function or inside:
29749 // /* (((this is fine))) */ function(a, b) {}
29750 // function abc(a) { /* (((this is fine))) */}
29752 var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
29753 var FN_ARG = /\/\*([^\*]*)\*\//m;
29755 var parse = function(fn) {
29756 if (typeof fn !== 'function') {
29757 throw new Error('Cannot annotate "' + fn + '". Expected a function!');
29760 var match = fn.toString().match(FN_ARGS);
29761 return match[1] && match[1].split(',').map(function(arg) {
29762 match = arg.match(FN_ARG);
29763 return match ? match[1].trim() : arg.trim();
29768 exports.annotate = annotate;
29769 exports.parse = parse;
29770 exports.isArray = isArray;
29773 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\index.js": [function(require, module, exports) {
29775 annotate: require('./annotation').annotate,
29776 Module: require('./module'),
29777 Injector: require('./injector')
29781 "./annotation": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\annotation.js",
29782 "./injector": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\injector.js",
29783 "./module": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\module.js"
29785 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\injector.js": [function(require, module, exports) {
29786 var Module = require('./module');
29787 var autoAnnotate = require('./annotation').parse;
29788 var annotate = require('./annotation').annotate;
29789 var isArray = require('./annotation').isArray;
29792 var Injector = function(modules, parent) {
29793 parent = parent || {
29794 get: function(name) {
29795 currentlyResolving.push(name);
29796 throw error('No provider for "' + name + '"!');
29800 var currentlyResolving = [];
29801 var providers = this._providers = Object.create(parent._providers || null);
29802 var instances = this._instances = Object.create(null);
29804 var self = instances.injector = this;
29806 var error = function(msg) {
29807 var stack = currentlyResolving.join(' -> ');
29808 currentlyResolving.length = 0;
29809 return new Error(stack ? msg + ' (Resolving: ' + stack + ')' : msg);
29812 var get = function(name) {
29813 if (!providers[name] && name.indexOf('.') !== -1) {
29814 var parts = name.split('.');
29815 var pivot = get(parts.shift());
29817 while (parts.length) {
29818 pivot = pivot[parts.shift()];
29824 if (Object.hasOwnProperty.call(instances, name)) {
29825 return instances[name];
29828 if (Object.hasOwnProperty.call(providers, name)) {
29829 if (currentlyResolving.indexOf(name) !== -1) {
29830 currentlyResolving.push(name);
29831 throw error('Cannot resolve circular dependency!');
29834 currentlyResolving.push(name);
29835 instances[name] = providers[name][0](providers[name][1]);
29836 currentlyResolving.pop();
29838 return instances[name];
29841 return parent.get(name);
29844 var instantiate = function(Type) {
29845 var instance = Object.create(Type.prototype);
29846 var returned = invoke(Type, instance);
29848 return typeof returned === 'object' ? returned : instance;
29851 var invoke = function(fn, context) {
29852 if (typeof fn !== 'function') {
29854 fn = annotate(fn.slice());
29856 throw new Error('Cannot invoke "' + fn + '". Expected a function!');
29860 var inject = fn.$inject && fn.$inject || autoAnnotate(fn);
29861 var dependencies = inject.map(function(dep) {
29865 // TODO(vojta): optimize without apply
29866 return fn.apply(context, dependencies);
29870 var createPrivateInjectorFactory = function(privateChildInjector) {
29871 return annotate(function(key) {
29872 return privateChildInjector.get(key);
29876 var createChild = function(modules, forceNewInstances) {
29877 if (forceNewInstances && forceNewInstances.length) {
29878 var fromParentModule = Object.create(null);
29879 var matchedScopes = Object.create(null);
29881 var privateInjectorsCache = [];
29882 var privateChildInjectors = [];
29883 var privateChildFactories = [];
29887 var privateChildInjector;
29888 var privateChildInjectorFactory;
29889 for (var name in providers) {
29890 provider = providers[name];
29892 if (forceNewInstances.indexOf(name) !== -1) {
29893 if (provider[2] === 'private') {
29894 cacheIdx = privateInjectorsCache.indexOf(provider[3]);
29895 if (cacheIdx === -1) {
29896 privateChildInjector = provider[3].createChild([], forceNewInstances);
29897 privateChildInjectorFactory = createPrivateInjectorFactory(privateChildInjector);
29898 privateInjectorsCache.push(provider[3]);
29899 privateChildInjectors.push(privateChildInjector);
29900 privateChildFactories.push(privateChildInjectorFactory);
29901 fromParentModule[name] = [privateChildInjectorFactory, name, 'private', privateChildInjector];
29903 fromParentModule[name] = [privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx]];
29906 fromParentModule[name] = [provider[2], provider[1]];
29908 matchedScopes[name] = true;
29911 if ((provider[2] === 'factory' || provider[2] === 'type') && provider[1].$scope) {
29912 forceNewInstances.forEach(function(scope) {
29913 if (provider[1].$scope.indexOf(scope) !== -1) {
29914 fromParentModule[name] = [provider[2], provider[1]];
29915 matchedScopes[scope] = true;
29921 forceNewInstances.forEach(function(scope) {
29922 if (!matchedScopes[scope]) {
29923 throw new Error('No provider for "' + scope + '". Cannot use provider from the parent!');
29927 modules.unshift(fromParentModule);
29930 return new Injector(modules, self);
29936 value: function(value) {
29941 modules.forEach(function(module) {
29943 function arrayUnwrap(type, value) {
29944 if (type !== 'value' && isArray(value)) {
29945 value = annotate(value.slice());
29951 // TODO(vojta): handle wrong inputs (modules)
29952 if (module instanceof Module) {
29953 module.forEach(function(provider) {
29954 var name = provider[0];
29955 var type = provider[1];
29956 var value = provider[2];
29958 providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
29960 } else if (typeof module === 'object') {
29961 if (module.__exports__) {
29962 var clonedModule = Object.keys(module).reduce(function(m, key) {
29963 if (key.substring(0, 2) !== '__') {
29964 m[key] = module[key];
29967 }, Object.create(null));
29969 var privateInjector = new Injector((module.__modules__ || []).concat([clonedModule]), self);
29970 var getFromPrivateInjector = annotate(function(key) {
29971 return privateInjector.get(key);
29973 module.__exports__.forEach(function(key) {
29974 providers[key] = [getFromPrivateInjector, key, 'private', privateInjector];
29977 Object.keys(module).forEach(function(name) {
29978 if (module[name][2] === 'private') {
29979 providers[name] = module[name];
29983 var type = module[name][0];
29984 var value = module[name][1];
29986 providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
29994 this.invoke = invoke;
29995 this.instantiate = instantiate;
29996 this.createChild = createChild;
29999 module.exports = Injector;
30002 "./annotation": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\annotation.js",
30003 "./module": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\module.js"
30005 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\module.js": [function(require, module, exports) {
30006 var Module = function() {
30007 var providers = [];
30009 this.factory = function(name, factory) {
30010 providers.push([name, 'factory', factory]);
30014 this.value = function(name, value) {
30015 providers.push([name, 'value', value]);
30019 this.type = function(name, type) {
30020 providers.push([name, 'type', type]);
30024 this.forEach = function(iterator) {
30025 providers.forEach(iterator);
30029 module.exports = Module;
30032 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\eve\\eve.js": [function(require, module, exports) {
30033 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
30035 // Licensed under the Apache License, Version 2.0 (the "License");
30036 // you may not use this file except in compliance with the License.
30037 // You may obtain a copy of the License at
30039 // http://www.apache.org/licenses/LICENSE-2.0
30041 // Unless required by applicable law or agreed to in writing, software
30042 // distributed under the License is distributed on an "AS IS" BASIS,
30043 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30044 // See the License for the specific language governing permissions and
30045 // limitations under the License.
30046 // ��������������������������������������������������������������
30048 // � Eve 0.4.2 - JavaScript Events Library � \\
30049 // ��������������������������������������������������������������
30051 // � Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) �
30053 // ��������������������������������������������������������������
30057 var version = "0.4.2",
30058 has = "hasOwnProperty",
30059 separator = /[\.\/]/,
30060 comaseparator = /\s*,\s*/,
30062 fun = function() {},
30063 numsort = function(a, b) {
30071 firstDefined = function() {
30072 for (var i = 0, ii = this.length; i < ii; i++) {
30073 if (typeof this[i] != "undefined") {
30078 lastDefined = function() {
30079 var i = this.length;
30081 if (typeof this[i] != "undefined") {
30089 * Fires event with given `name`, given scope and other parameters.
30091 * - name (string) name of the *event*, dot (`.`) or slash (`/`) separated -
30092 * scope (object) context for the event handlers - varargs (...) the rest of
30093 * arguments will be sent to event handlers
30094 * = (object) array of returned values from the listeners. Array has two
30095 * methods `.firstDefined()` and `.lastDefined()` to get first or last not
30096 * `undefined` value. \
30098 eve = function(name, scope) {
30099 name = String(name);
30102 args = Array.prototype.slice.call(arguments, 2),
30103 listeners = eve.listeners(name),
30110 ce = current_event,
30112 out.firstDefined = firstDefined;
30113 out.lastDefined = lastDefined;
30114 current_event = name;
30116 for (var i = 0, ii = listeners.length; i < ii; i++)
30117 if ("zIndex" in listeners[i]) {
30118 indexed.push(listeners[i].zIndex);
30119 if (listeners[i].zIndex < 0) {
30120 queue[listeners[i].zIndex] = listeners[i];
30123 indexed.sort(numsort);
30124 while (indexed[z] < 0) {
30125 l = queue[indexed[z++]];
30126 out.push(l.apply(scope, args));
30132 for (i = 0; i < ii; i++) {
30134 if ("zIndex" in l) {
30135 if (l.zIndex == indexed[z]) {
30136 out.push(l.apply(scope, args));
30142 l = queue[indexed[z]];
30143 l && out.push(l.apply(scope, args));
30149 queue[l.zIndex] = l;
30152 out.push(l.apply(scope, args));
30159 current_event = ce;
30162 // Undocumented. Debug only.
30163 eve._events = events;
30165 * \ eve.listeners [ method ]
30167 * Internal method which gives you array of all event handlers that will be
30168 * triggered by the given `name`.
30170 * - name (string) name of the event, dot (`.`) or slash (`/`) separated
30171 * = (array) array of event handlers \
30173 eve.listeners = function(name) {
30174 var names = name.split(separator),
30186 for (i = 0, ii = names.length; i < ii; i++) {
30188 for (j = 0, jj = es.length; j < jj; j++) {
30190 items = [e[names[i]], e[wildcard]];
30196 out = out.concat(item.f || []);
30206 * \ eve.on [ method ] * Binds given event handler with a given name. You
30207 * can use wildcards “`*`� for the names: | eve.on("*.under.*",
30208 * f); | eve("mouse.under.floor"); // triggers f Use @eve to trigger the
30209 * listener. * > Arguments * - name (string) name of the event, dot (`.`) or
30210 * slash (`/`) separated, with optional wildcards - f (function) event
30211 * handler function * = (function) returned function accepts a single
30212 * numeric parameter that represents z-index of the handler. It is an
30213 * optional feature and only used when you need to ensure that some subset
30214 * of handlers will be invoked in a given order, despite of the order of
30215 * assignment. > Example: | eve.on("mouse", eatIt)(2); | eve.on("mouse",
30216 * scream); | eve.on("mouse", catchIt)(1); This will ensure that `catchIt`
30217 * function will be called before `eatIt`.
30219 * If you want to put your handler before non-indexed handlers, specify a
30220 * negative value. Note: I assume most of the time you don’t need to
30221 * worry about z-index, but it’s nice to have this feature
30222 * “just in case�. \
30224 eve.on = function(name, f) {
30225 name = String(name);
30226 if (typeof f != "function") {
30227 return function() {};
30229 var names = name.split(comaseparator);
30230 for (var i = 0, ii = names.length; i < ii; i++) {
30232 var names = name.split(separator),
30235 for (var i = 0, ii = names.length; i < ii; i++) {
30237 e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {
30242 for (i = 0, ii = e.f.length; i < ii; i++)
30246 }!exist && e.f.push(f);
30249 return function(zIndex) {
30250 if (+zIndex == +zIndex) {
30251 f.zIndex = +zIndex;
30256 * \ eve.f [ method ] * Returns function that will fire given event with
30257 * optional arguments. Arguments that will be passed to the result function
30258 * will be also concated to the list of final arguments. | el.onclick =
30259 * eve.f("click", 1, 2); | eve.on("click", function (a, b, c) { |
30260 * console.log(a, b, c); // 1, 2, [event object] | }); > Arguments - event
30261 * (string) event name - varargs (…) and any other arguments =
30262 * (function) possible event handler function \
30264 eve.f = function(event) {
30265 var attrs = [].slice.call(arguments, 1);
30266 return function() {
30267 eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0)));
30271 * \ eve.stop [ method ] * Is used inside an event handler to stop the
30272 * event, preventing any subsequent listeners from firing. \
30274 eve.stop = function() {
30278 * \ eve.nt [ method ] * Could be used inside event handler to figure out
30279 * actual name of the event. * > Arguments * - subname (string) #optional
30280 * subname of the event * = (string) name of the event, if `subname` is not
30281 * specified or = (boolean) `true`, if current event’s name contains
30284 eve.nt = function(subname) {
30286 return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event);
30288 return current_event;
30291 * \ eve.nts [ method ] * Could be used inside event handler to figure out
30292 * actual name of the event. * * = (array) names of the event \
30294 eve.nts = function() {
30295 return current_event.split(separator);
30298 * \ eve.off [ method ] * Removes given function from the list of event
30299 * listeners assigned to given name. If no arguments specified all the
30300 * events will be cleared. * > Arguments * - name (string) name of the
30301 * event, dot (`.`) or slash (`/`) separated, with optional wildcards - f
30302 * (function) event handler function \
30305 * \ eve.unbind [ method ] * See @eve.off \
30307 eve.off = eve.unbind = function(name, f) {
30309 eve._events = events = {
30314 var names = name.split(comaseparator);
30315 if (names.length > 1) {
30316 for (var i = 0, ii = names.length; i < ii; i++) {
30317 eve.off(names[i], f);
30321 names = name.split(separator);
30327 for (i = 0, ii = names.length; i < ii; i++) {
30328 for (j = 0; j < cur.length; j += splice.length - 2) {
30331 if (names[i] != wildcard) {
30333 splice.push(e[names[i]]);
30338 splice.push(e[key]);
30341 cur.splice.apply(cur, splice);
30344 for (i = 0, ii = cur.length; i < ii; i++) {
30349 for (j = 0, jj = e.f.length; j < jj; j++)
30353 }!e.f.length && delete e.f;
30356 if (e.n[has](key) && e.n[key].f) {
30357 var funcs = e.n[key].f;
30358 for (j = 0, jj = funcs.length; j < jj; j++)
30359 if (funcs[j] == f) {
30360 funcs.splice(j, 1);
30362 }!funcs.length && delete e.n[key].f;
30367 if (e.n[has](key) && e.n[key].f) {
30376 * \ eve.once [ method ] * Binds given event handler with a given name to
30377 * only run once then unbind itself. | eve.once("login", f); | eve("login"); //
30378 * triggers f | eve("login"); // no listeners Use @eve to trigger the
30379 * listener. * > Arguments * - name (string) name of the event, dot (`.`) or
30380 * slash (`/`) separated, with optional wildcards - f (function) event
30381 * handler function * = (function) same return function as @eve.on \
30383 eve.once = function(name, f) {
30384 var f2 = function() {
30385 eve.unbind(name, f2);
30386 return f.apply(this, arguments);
30388 return eve.on(name, f2);
30391 * \ eve.version [ property (string) ] * Current version of the library. \
30393 eve.version = version;
30394 eve.toString = function() {
30395 return "You are running Eve " + version;
30397 (typeof module != "undefined" && module.exports) ? (module.exports = eve) : (typeof define === "function" && define.amd ? (define("eve", [], function() {
30399 })) : (glob.eve = eve));
30403 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\hammerjs\\hammer.js": [function(require, module, exports) {
30405 * ! Hammer.JS - v2.0.4 - 2014-09-28 http://hammerjs.github.io/
30407 * Copyright (c) 2014 Jorik Tangelder; Licensed under the MIT license
30409 (function(window, document, exportName, undefined) {
30412 var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o'];
30413 var TEST_ELEMENT = document.createElement('div');
30415 var TYPE_FUNCTION = 'function';
30417 var round = Math.round;
30418 var abs = Math.abs;
30419 var now = Date.now;
30422 * set a timeout with a given scope
30424 * @param {Function}
30430 * @returns {number}
30432 function setTimeoutContext(fn, timeout, context) {
30433 return setTimeout(bindFn(fn, context), timeout);
30437 * if the argument is an array, we want to execute the fn on each entry if it
30438 * aint an array we don't want to do a thing. this is used by all the methods
30439 * that accept a single and array argument.
30447 * @returns {Boolean}
30449 function invokeArrayArg(arg, fn, context) {
30450 if (Array.isArray(arg)) {
30451 each(arg, context[fn], context);
30458 * walk objects and arrays
30462 * @param {Function}
30467 function each(obj, iterator, context) {
30475 obj.forEach(iterator, context);
30476 } else if (obj.length !== undefined) {
30478 while (i < obj.length) {
30479 iterator.call(context, obj[i], i, obj);
30484 obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
30490 * extend object. means that properties in dest will be overwritten by the ones
30499 * @returns {Object} dest
30501 function extend(dest, src, merge) {
30502 var keys = Object.keys(src);
30504 while (i < keys.length) {
30505 if (!merge || (merge && dest[keys[i]] === undefined)) {
30506 dest[keys[i]] = src[keys[i]];
30514 * merge the values from src in the dest. means that properties that exist in
30515 * dest will not be overwritten by src
30521 * @returns {Object} dest
30523 function merge(dest, src) {
30524 return extend(dest, src, true);
30528 * simple class inheritance
30530 * @param {Function}
30532 * @param {Function}
30537 function inherit(child, base, properties) {
30538 var baseP = base.prototype,
30541 childP = child.prototype = Object.create(baseP);
30542 childP.constructor = child;
30543 childP._super = baseP;
30546 extend(childP, properties);
30551 * simple function bind
30553 * @param {Function}
30557 * @returns {Function}
30559 function bindFn(fn, context) {
30560 return function boundFn() {
30561 return fn.apply(context, arguments);
30566 * let a boolean value also be a function that must return a boolean this first
30567 * item in args will be used as the context
30569 * @param {Boolean|Function}
30573 * @returns {Boolean}
30575 function boolOrFn(val, args) {
30576 if (typeof val == TYPE_FUNCTION) {
30577 return val.apply(args ? args[0] || undefined : undefined, args);
30583 * use the val2 when val1 is undefined
30591 function ifUndefined(val1, val2) {
30592 return (val1 === undefined) ? val2 : val1;
30596 * addEventListener with multiple events at once
30598 * @param {EventTarget}
30602 * @param {Function}
30605 function addEventListeners(target, types, handler) {
30606 each(splitStr(types), function(type) {
30607 target.addEventListener(type, handler, false);
30612 * removeEventListener with multiple events at once
30614 * @param {EventTarget}
30618 * @param {Function}
30621 function removeEventListeners(target, types, handler) {
30622 each(splitStr(types), function(type) {
30623 target.removeEventListener(type, handler, false);
30628 * find if a node is in the given parent
30630 * @method hasParent
30631 * @param {HTMLElement}
30633 * @param {HTMLElement}
30635 * @return {Boolean} found
30637 function hasParent(node, parent) {
30639 if (node == parent) {
30642 node = node.parentNode;
30648 * small indexOf wrapper
30654 * @returns {Boolean} found
30656 function inStr(str, find) {
30657 return str.indexOf(find) > -1;
30661 * split string on whitespace
30665 * @returns {Array} words
30667 function splitStr(str) {
30668 return str.trim().split(/\s+/g);
30672 * find if a array contains the object using indexOf or a simple polyFill
30680 * @return {Boolean|Number} false when not found, or the index
30682 function inArray(src, find, findByKey) {
30683 if (src.indexOf && !findByKey) {
30684 return src.indexOf(find);
30687 while (i < src.length) {
30688 if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
30698 * convert array-like objects to real arrays
30704 function toArray(obj) {
30705 return Array.prototype.slice.call(obj, 0);
30709 * unique array with objects based on a key (like 'id') or just by the array's
30713 * src [{id:1},{id:2},{id:1}]
30718 * @returns {Array} [{id:1},{id:2}]
30720 function uniqueArray(src, key, sort) {
30725 while (i < src.length) {
30726 var val = key ? src[i][key] : src[i];
30727 if (inArray(values, val) < 0) {
30728 results.push(src[i]);
30736 results = results.sort();
30738 results = results.sort(function sortUniqueArray(a, b) {
30739 return a[key] > b[key];
30748 * get the prefixed property
30754 * @returns {String|Undefined} prefixed
30756 function prefixed(obj, property) {
30758 var camelProp = property[0].toUpperCase() + property.slice(1);
30761 while (i < VENDOR_PREFIXES.length) {
30762 prefix = VENDOR_PREFIXES[i];
30763 prop = (prefix) ? prefix + camelProp : property;
30776 * @returns {number} uniqueId
30780 function uniqueId() {
30781 return _uniqueId++;
30785 * get the window object of an element
30787 * @param {HTMLElement}
30789 * @returns {DocumentView|Window}
30791 function getWindowForElement(element) {
30792 var doc = element.ownerDocument;
30793 return (doc.defaultView || doc.parentWindow);
30796 var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
30798 var SUPPORT_TOUCH = ('ontouchstart' in window);
30799 var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
30800 var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
30802 var INPUT_TYPE_TOUCH = 'touch';
30803 var INPUT_TYPE_PEN = 'pen';
30804 var INPUT_TYPE_MOUSE = 'mouse';
30805 var INPUT_TYPE_KINECT = 'kinect';
30807 var COMPUTE_INTERVAL = 25;
30809 var INPUT_START = 1;
30810 var INPUT_MOVE = 2;
30812 var INPUT_CANCEL = 8;
30814 var DIRECTION_NONE = 1;
30815 var DIRECTION_LEFT = 2;
30816 var DIRECTION_RIGHT = 4;
30817 var DIRECTION_UP = 8;
30818 var DIRECTION_DOWN = 16;
30820 var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
30821 var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
30822 var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
30824 var PROPS_XY = ['x', 'y'];
30825 var PROPS_CLIENT_XY = ['clientX', 'clientY'];
30828 * create new input type manager
30832 * @param {Function}
30837 function Input(manager, callback) {
30839 this.manager = manager;
30840 this.callback = callback;
30841 this.element = manager.element;
30842 this.target = manager.options.inputTarget;
30844 // smaller wrapper around the handler, for the scope and the enabled state
30846 // so when disabled the input events are completely bypassed.
30847 this.domHandler = function(ev) {
30848 if (boolOrFn(manager.options.enable, [manager])) {
30857 Input.prototype = {
30859 * should handle the inputEvent data and trigger the callback
30863 handler: function() {},
30869 this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
30870 this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
30871 this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
30875 * unbind the events
30877 destroy: function() {
30878 this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
30879 this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
30880 this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
30885 * create new input type manager called by the Manager constructor
30891 function createInputInstance(manager) {
30893 var inputClass = manager.options.inputClass;
30897 } else if (SUPPORT_POINTER_EVENTS) {
30898 Type = PointerEventInput;
30899 } else if (SUPPORT_ONLY_TOUCH) {
30901 } else if (!SUPPORT_TOUCH) {
30904 Type = TouchMouseInput;
30906 return new(Type)(manager, inputHandler);
30910 * handle input events
30919 function inputHandler(manager, eventType, input) {
30920 var pointersLen = input.pointers.length;
30921 var changedPointersLen = input.changedPointers.length;
30922 var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
30923 var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));
30925 input.isFirst = !!isFirst;
30926 input.isFinal = !!isFinal;
30929 manager.session = {};
30932 // source event is the normalized value of the domEvents
30933 // like 'touchstart, mouseup, pointerdown'
30934 input.eventType = eventType;
30936 // compute scale, rotation etc
30937 computeInputData(manager, input);
30939 // emit secret event
30940 manager.emit('hammer.input', input);
30942 manager.recognize(input);
30943 manager.session.prevInput = input;
30947 * extend the data with some usable properties like scale, rotate, velocity etc
30954 function computeInputData(manager, input) {
30955 var session = manager.session;
30956 var pointers = input.pointers;
30957 var pointersLength = pointers.length;
30959 // store the first input to calculate the distance and direction
30960 if (!session.firstInput) {
30961 session.firstInput = simpleCloneInputData(input);
30964 // to compute scale and rotation we need to store the multiple touches
30965 if (pointersLength > 1 && !session.firstMultiple) {
30966 session.firstMultiple = simpleCloneInputData(input);
30967 } else if (pointersLength === 1) {
30968 session.firstMultiple = false;
30971 var firstInput = session.firstInput;
30972 var firstMultiple = session.firstMultiple;
30973 var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
30975 var center = input.center = getCenter(pointers);
30976 input.timeStamp = now();
30977 input.deltaTime = input.timeStamp - firstInput.timeStamp;
30979 input.angle = getAngle(offsetCenter, center);
30980 input.distance = getDistance(offsetCenter, center);
30982 computeDeltaXY(session, input);
30983 input.offsetDirection = getDirection(input.deltaX, input.deltaY);
30985 input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
30986 input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
30988 computeIntervalInputData(session, input);
30990 // find the correct target
30991 var target = manager.element;
30992 if (hasParent(input.srcEvent.target, target)) {
30993 target = input.srcEvent.target;
30995 input.target = target;
30998 function computeDeltaXY(session, input) {
30999 var center = input.center;
31000 var offset = session.offsetDelta || {};
31001 var prevDelta = session.prevDelta || {};
31002 var prevInput = session.prevInput || {};
31004 if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
31005 prevDelta = session.prevDelta = {
31006 x: prevInput.deltaX || 0,
31007 y: prevInput.deltaY || 0
31010 offset = session.offsetDelta = {
31016 input.deltaX = prevDelta.x + (center.x - offset.x);
31017 input.deltaY = prevDelta.y + (center.y - offset.y);
31021 * velocity is calculated every x ms
31028 function computeIntervalInputData(session, input) {
31029 var last = session.lastInterval || input,
31030 deltaTime = input.timeStamp - last.timeStamp,
31031 velocity, velocityX, velocityY, direction;
31033 if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
31034 var deltaX = last.deltaX - input.deltaX;
31035 var deltaY = last.deltaY - input.deltaY;
31037 var v = getVelocity(deltaTime, deltaX, deltaY);
31040 velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
31041 direction = getDirection(deltaX, deltaY);
31043 session.lastInterval = input;
31045 // use latest velocity info if it doesn't overtake a minimum period
31046 velocity = last.velocity;
31047 velocityX = last.velocityX;
31048 velocityY = last.velocityY;
31049 direction = last.direction;
31052 input.velocity = velocity;
31053 input.velocityX = velocityX;
31054 input.velocityY = velocityY;
31055 input.direction = direction;
31059 * create a simple clone from the input used for storage of firstInput and
31064 * @returns {Object} clonedInputData
31066 function simpleCloneInputData(input) {
31067 // make a simple copy of the pointers because we will get a reference if we
31069 // we only need clientXY for the calculations
31072 while (i < input.pointers.length) {
31074 clientX: round(input.pointers[i].clientX),
31075 clientY: round(input.pointers[i].clientY)
31082 pointers: pointers,
31083 center: getCenter(pointers),
31084 deltaX: input.deltaX,
31085 deltaY: input.deltaY
31090 * get the center of all the pointers
31094 * @return {Object} center contains `x` and `y` properties
31096 function getCenter(pointers) {
31097 var pointersLength = pointers.length;
31099 // no need to loop when only one touch
31100 if (pointersLength === 1) {
31102 x: round(pointers[0].clientX),
31103 y: round(pointers[0].clientY)
31110 while (i < pointersLength) {
31111 x += pointers[i].clientX;
31112 y += pointers[i].clientY;
31117 x: round(x / pointersLength),
31118 y: round(y / pointersLength)
31123 * calculate the velocity between two points. unit is in px per ms.
31131 * @return {Object} velocity `x` and `y`
31133 function getVelocity(deltaTime, x, y) {
31135 x: x / deltaTime || 0,
31136 y: y / deltaTime || 0
31141 * get the direction between two points
31147 * @return {Number} direction
31149 function getDirection(x, y) {
31151 return DIRECTION_NONE;
31154 if (abs(x) >= abs(y)) {
31155 return x > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
31157 return y > 0 ? DIRECTION_UP : DIRECTION_DOWN;
31161 * calculate the absolute distance between two points
31168 * [props] containing x and y keys
31169 * @return {Number} distance
31171 function getDistance(p1, p2, props) {
31175 var x = p2[props[0]] - p1[props[0]],
31176 y = p2[props[1]] - p1[props[1]];
31178 return Math.sqrt((x * x) + (y * y));
31182 * calculate the angle between two coordinates
31189 * [props] containing x and y keys
31190 * @return {Number} angle
31192 function getAngle(p1, p2, props) {
31196 var x = p2[props[0]] - p1[props[0]],
31197 y = p2[props[1]] - p1[props[1]];
31198 return Math.atan2(y, x) * 180 / Math.PI;
31202 * calculate the rotation degrees between two pointersets
31205 * start array of pointers
31207 * end array of pointers
31208 * @return {Number} rotation
31210 function getRotation(start, end) {
31211 return getAngle(end[1], end[0], PROPS_CLIENT_XY) - getAngle(start[1], start[0], PROPS_CLIENT_XY);
31215 * calculate the scale factor between two pointersets no scale is 1, and goes
31216 * down to 0 when pinched together, and bigger when pinched out
31219 * start array of pointers
31221 * end array of pointers
31222 * @return {Number} scale
31224 function getScale(start, end) {
31225 return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
31228 var MOUSE_INPUT_MAP = {
31229 mousedown: INPUT_START,
31230 mousemove: INPUT_MOVE,
31234 var MOUSE_ELEMENT_EVENTS = 'mousedown';
31235 var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
31238 * Mouse events input
31243 function MouseInput() {
31244 this.evEl = MOUSE_ELEMENT_EVENTS;
31245 this.evWin = MOUSE_WINDOW_EVENTS;
31247 this.allow = true; // used by Input.TouchMouse to disable mouse events
31248 this.pressed = false; // mousedown state
31250 Input.apply(this, arguments);
31253 inherit(MouseInput, Input, {
31255 * handle mouse events
31260 handler: function MEhandler(ev) {
31261 var eventType = MOUSE_INPUT_MAP[ev.type];
31263 // on start we want to have the left mouse button down
31264 if (eventType & INPUT_START && ev.button === 0) {
31265 this.pressed = true;
31268 if (eventType & INPUT_MOVE && ev.which !== 1) {
31269 eventType = INPUT_END;
31272 // mouse must be down, and mouse events are allowed (see the TouchMouse
31274 if (!this.pressed || !this.allow) {
31278 if (eventType & INPUT_END) {
31279 this.pressed = false;
31282 this.callback(this.manager, eventType, {
31284 changedPointers: [ev],
31285 pointerType: INPUT_TYPE_MOUSE,
31291 var POINTER_INPUT_MAP = {
31292 pointerdown: INPUT_START,
31293 pointermove: INPUT_MOVE,
31294 pointerup: INPUT_END,
31295 pointercancel: INPUT_CANCEL,
31296 pointerout: INPUT_CANCEL
31299 // in IE10 the pointer types is defined as an enum
31300 var IE10_POINTER_TYPE_ENUM = {
31301 2: INPUT_TYPE_TOUCH,
31303 4: INPUT_TYPE_MOUSE,
31304 5: INPUT_TYPE_KINECT // see
31305 // https://twitter.com/jacobrossi/status/480596438489890816
31308 var POINTER_ELEMENT_EVENTS = 'pointerdown';
31309 var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
31311 // IE10 has prefixed support, and case-sensitive
31312 if (window.MSPointerEvent) {
31313 POINTER_ELEMENT_EVENTS = 'MSPointerDown';
31314 POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
31318 * Pointer events input
31323 function PointerEventInput() {
31324 this.evEl = POINTER_ELEMENT_EVENTS;
31325 this.evWin = POINTER_WINDOW_EVENTS;
31327 Input.apply(this, arguments);
31329 this.store = (this.manager.session.pointerEvents = []);
31332 inherit(PointerEventInput, Input, {
31334 * handle mouse events
31339 handler: function PEhandler(ev) {
31340 var store = this.store;
31341 var removePointer = false;
31343 var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
31344 var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
31345 var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
31347 var isTouch = (pointerType == INPUT_TYPE_TOUCH);
31349 // get index of the event in the store
31350 var storeIndex = inArray(store, ev.pointerId, 'pointerId');
31352 // start and mouse must be down
31353 if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
31354 if (storeIndex < 0) {
31356 storeIndex = store.length - 1;
31358 } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
31359 removePointer = true;
31362 // it not found, so the pointer hasn't been down (so it's probably a
31364 if (storeIndex < 0) {
31368 // update the event in the store
31369 store[storeIndex] = ev;
31371 this.callback(this.manager, eventType, {
31373 changedPointers: [ev],
31374 pointerType: pointerType,
31378 if (removePointer) {
31379 // remove from the store
31380 store.splice(storeIndex, 1);
31385 var SINGLE_TOUCH_INPUT_MAP = {
31386 touchstart: INPUT_START,
31387 touchmove: INPUT_MOVE,
31388 touchend: INPUT_END,
31389 touchcancel: INPUT_CANCEL
31392 var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
31393 var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
31396 * Touch events input
31401 function SingleTouchInput() {
31402 this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
31403 this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
31404 this.started = false;
31406 Input.apply(this, arguments);
31409 inherit(SingleTouchInput, Input, {
31410 handler: function TEhandler(ev) {
31411 var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
31413 // should we handle the touch events?
31414 if (type === INPUT_START) {
31415 this.started = true;
31418 if (!this.started) {
31422 var touches = normalizeSingleTouches.call(this, ev, type);
31424 // when done, reset the started state
31425 if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
31426 this.started = false;
31429 this.callback(this.manager, type, {
31430 pointers: touches[0],
31431 changedPointers: touches[1],
31432 pointerType: INPUT_TYPE_TOUCH,
31439 * @this {TouchInput}
31444 * @returns {undefined|Array} [all, changed]
31446 function normalizeSingleTouches(ev, type) {
31447 var all = toArray(ev.touches);
31448 var changed = toArray(ev.changedTouches);
31450 if (type & (INPUT_END | INPUT_CANCEL)) {
31451 all = uniqueArray(all.concat(changed), 'identifier', true);
31454 return [all, changed];
31457 var TOUCH_INPUT_MAP = {
31458 touchstart: INPUT_START,
31459 touchmove: INPUT_MOVE,
31460 touchend: INPUT_END,
31461 touchcancel: INPUT_CANCEL
31464 var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
31467 * Multi-user touch events input
31472 function TouchInput() {
31473 this.evTarget = TOUCH_TARGET_EVENTS;
31474 this.targetIds = {};
31476 Input.apply(this, arguments);
31479 inherit(TouchInput, Input, {
31480 handler: function MTEhandler(ev) {
31481 var type = TOUCH_INPUT_MAP[ev.type];
31482 var touches = getTouches.call(this, ev, type);
31487 this.callback(this.manager, type, {
31488 pointers: touches[0],
31489 changedPointers: touches[1],
31490 pointerType: INPUT_TYPE_TOUCH,
31497 * @this {TouchInput}
31502 * @returns {undefined|Array} [all, changed]
31504 function getTouches(ev, type) {
31505 var allTouches = toArray(ev.touches);
31506 var targetIds = this.targetIds;
31508 // when there is only one touch, the process can be simplified
31509 if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
31510 targetIds[allTouches[0].identifier] = true;
31511 return [allTouches, allTouches];
31516 changedTouches = toArray(ev.changedTouches),
31517 changedTargetTouches = [],
31518 target = this.target;
31520 // get target touches from touches
31521 targetTouches = allTouches.filter(function(touch) {
31522 return hasParent(touch.target, target);
31526 if (type === INPUT_START) {
31528 while (i < targetTouches.length) {
31529 targetIds[targetTouches[i].identifier] = true;
31534 // filter changed touches to only contain touches that exist in the
31535 // collected target ids
31537 while (i < changedTouches.length) {
31538 if (targetIds[changedTouches[i].identifier]) {
31539 changedTargetTouches.push(changedTouches[i]);
31542 // cleanup removed touches
31543 if (type & (INPUT_END | INPUT_CANCEL)) {
31544 delete targetIds[changedTouches[i].identifier];
31549 if (!changedTargetTouches.length) {
31554 // merge targetTouches with changedTargetTouches so it contains ALL
31555 // touches, including 'end' and 'cancel'
31556 uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
31557 changedTargetTouches
31562 * Combined touch and mouse input
31564 * Touch has a higher priority then mouse, and while touching no mouse events
31565 * are allowed. This because touch devices also emit mouse events while doing a
31571 function TouchMouseInput() {
31572 Input.apply(this, arguments);
31574 var handler = bindFn(this.handler, this);
31575 this.touch = new TouchInput(this.manager, handler);
31576 this.mouse = new MouseInput(this.manager, handler);
31579 inherit(TouchMouseInput, Input, {
31581 * handle mouse and touch events
31590 handler: function TMEhandler(manager, inputEvent, inputData) {
31591 var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
31592 isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
31594 // when we're in a touch event, so block all upcoming mouse events
31595 // most mobile browser also emit mouseevents, right after touchstart
31597 this.mouse.allow = false;
31598 } else if (isMouse && !this.mouse.allow) {
31602 // reset the allowMouse when we're done
31603 if (inputEvent & (INPUT_END | INPUT_CANCEL)) {
31604 this.mouse.allow = true;
31607 this.callback(manager, inputEvent, inputData);
31611 * remove the event listeners
31613 destroy: function destroy() {
31614 this.touch.destroy();
31615 this.mouse.destroy();
31619 var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
31620 var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
31622 // magical touchAction value
31623 var TOUCH_ACTION_COMPUTE = 'compute';
31624 var TOUCH_ACTION_AUTO = 'auto';
31625 var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
31626 var TOUCH_ACTION_NONE = 'none';
31627 var TOUCH_ACTION_PAN_X = 'pan-x';
31628 var TOUCH_ACTION_PAN_Y = 'pan-y';
31631 * Touch Action sets the touchAction property or uses the js alternative
31639 function TouchAction(manager, value) {
31640 this.manager = manager;
31644 TouchAction.prototype = {
31646 * set the touchAction value on the element or enable the polyfill
31651 set: function(value) {
31652 // find out the touch-action by the event handlers
31653 if (value == TOUCH_ACTION_COMPUTE) {
31654 value = this.compute();
31657 if (NATIVE_TOUCH_ACTION) {
31658 this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
31660 this.actions = value.toLowerCase().trim();
31664 * just re-set the touchAction value
31666 update: function() {
31667 this.set(this.manager.options.touchAction);
31671 * compute the value for the touchAction property based on the recognizer's
31674 * @returns {String} value
31676 compute: function() {
31678 each(this.manager.recognizers, function(recognizer) {
31679 if (boolOrFn(recognizer.options.enable, [recognizer])) {
31680 actions = actions.concat(recognizer.getTouchAction());
31683 return cleanTouchActions(actions.join(' '));
31687 * this method is called on each input cycle and provides the preventing of
31688 * the browser behavior
31693 preventDefaults: function(input) {
31694 // not needed with native support for the touchAction property
31695 if (NATIVE_TOUCH_ACTION) {
31699 var srcEvent = input.srcEvent;
31700 var direction = input.offsetDirection;
31702 // if the touch action did prevented once this session
31703 if (this.manager.session.prevented) {
31704 srcEvent.preventDefault();
31708 var actions = this.actions;
31709 var hasNone = inStr(actions, TOUCH_ACTION_NONE);
31710 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
31711 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
31714 (hasPanY && direction & DIRECTION_HORIZONTAL) ||
31715 (hasPanX && direction & DIRECTION_VERTICAL)) {
31716 return this.preventSrc(srcEvent);
31721 * call preventDefault to prevent the browser's default behavior (scrolling
31727 preventSrc: function(srcEvent) {
31728 this.manager.session.prevented = true;
31729 srcEvent.preventDefault();
31734 * when the touchActions are collected they are not a valid value, so we need to
31735 * clean things up. *
31741 function cleanTouchActions(actions) {
31743 if (inStr(actions, TOUCH_ACTION_NONE)) {
31744 return TOUCH_ACTION_NONE;
31747 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
31748 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
31750 // pan-x and pan-y can be combined
31751 if (hasPanX && hasPanY) {
31752 return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y;
31756 if (hasPanX || hasPanY) {
31757 return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
31761 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
31762 return TOUCH_ACTION_MANIPULATION;
31765 return TOUCH_ACTION_AUTO;
31769 * Recognizer flow explained; * All recognizers have the initial state of
31770 * POSSIBLE when a input session starts. The definition of a input session is
31771 * from the first input until the last input, with all it's movement in it. *
31772 * Example session for mouse-input: mousedown -> mousemove -> mouseup
31774 * On each recognizing cycle (see Manager.recognize) the .recognize() method is
31775 * executed which determines with state it should be.
31777 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals
31778 * ENDED), it is reset to POSSIBLE to give it another change on the next cycle.
31780 * Possible | +-----+---------------+ | | +-----+-----+ | | | | Failed Cancelled |
31781 * +-------+------+ | | Recognized Began | Changed | Ended/Recognized
31783 var STATE_POSSIBLE = 1;
31784 var STATE_BEGAN = 2;
31785 var STATE_CHANGED = 4;
31786 var STATE_ENDED = 8;
31787 var STATE_RECOGNIZED = STATE_ENDED;
31788 var STATE_CANCELLED = 16;
31789 var STATE_FAILED = 32;
31792 * Recognizer Every recognizer needs to extend from this class.
31798 function Recognizer(options) {
31799 this.id = uniqueId();
31801 this.manager = null;
31802 this.options = merge(options || {}, this.defaults);
31804 // default is enable true
31805 this.options.enable = ifUndefined(this.options.enable, true);
31807 this.state = STATE_POSSIBLE;
31809 this.simultaneous = {};
31810 this.requireFail = [];
31813 Recognizer.prototype = {
31825 * @return {Recognizer}
31827 set: function(options) {
31828 extend(this.options, options);
31830 // also update the touchAction, in case something changed about the
31831 // directions/enabled state
31832 this.manager && this.manager.touchAction.update();
31837 * recognize simultaneous with an other recognizer.
31839 * @param {Recognizer}
31841 * @returns {Recognizer} this
31843 recognizeWith: function(otherRecognizer) {
31844 if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
31848 var simultaneous = this.simultaneous;
31849 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
31850 if (!simultaneous[otherRecognizer.id]) {
31851 simultaneous[otherRecognizer.id] = otherRecognizer;
31852 otherRecognizer.recognizeWith(this);
31858 * drop the simultaneous link. it doesnt remove the link on the other
31861 * @param {Recognizer}
31863 * @returns {Recognizer} this
31865 dropRecognizeWith: function(otherRecognizer) {
31866 if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
31870 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
31871 delete this.simultaneous[otherRecognizer.id];
31876 * recognizer can only run when an other is failing
31878 * @param {Recognizer}
31880 * @returns {Recognizer} this
31882 requireFailure: function(otherRecognizer) {
31883 if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
31887 var requireFail = this.requireFail;
31888 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
31889 if (inArray(requireFail, otherRecognizer) === -1) {
31890 requireFail.push(otherRecognizer);
31891 otherRecognizer.requireFailure(this);
31897 * drop the requireFailure link. it does not remove the link on the other
31900 * @param {Recognizer}
31902 * @returns {Recognizer} this
31904 dropRequireFailure: function(otherRecognizer) {
31905 if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
31909 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
31910 var index = inArray(this.requireFail, otherRecognizer);
31912 this.requireFail.splice(index, 1);
31918 * has require failures boolean
31920 * @returns {boolean}
31922 hasRequireFailures: function() {
31923 return this.requireFail.length > 0;
31927 * if the recognizer can recognize simultaneous with an other recognizer
31929 * @param {Recognizer}
31931 * @returns {Boolean}
31933 canRecognizeWith: function(otherRecognizer) {
31934 return !!this.simultaneous[otherRecognizer.id];
31938 * You should use `tryEmit` instead of `emit` directly to check that all the
31939 * needed recognizers has failed before emitting.
31944 emit: function(input) {
31946 var state = this.state;
31948 function emit(withState) {
31949 self.manager.emit(self.options.event + (withState ? stateStr(state) : ''), input);
31952 // 'panstart' and 'panmove'
31953 if (state < STATE_ENDED) {
31957 emit(); // simple 'eventName' events
31959 // panend and pancancel
31960 if (state >= STATE_ENDED) {
31966 * Check that all the require failure recognizers has failed, if true, it
31967 * emits a gesture event, otherwise, setup the state to FAILED.
31972 tryEmit: function(input) {
31973 if (this.canEmit()) {
31974 return this.emit(input);
31976 // it's failing anyway
31977 this.state = STATE_FAILED;
31983 * @returns {boolean}
31985 canEmit: function() {
31987 while (i < this.requireFail.length) {
31988 if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
31997 * update the recognizer
32002 recognize: function(inputData) {
32003 // make a new copy of the inputData
32004 // so we can change the inputData without messing up the other
32006 var inputDataClone = extend({}, inputData);
32008 // is is enabled and allow recognizing?
32009 if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
32011 this.state = STATE_FAILED;
32015 // reset when we've reached the end
32016 if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
32017 this.state = STATE_POSSIBLE;
32020 this.state = this.process(inputDataClone);
32022 // the recognizer has recognized a gesture
32023 // so trigger an event
32024 if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
32025 this.tryEmit(inputDataClone);
32030 * return the state of the recognizer the actual recognizing happens in this
32036 * @returns {Const} STATE
32038 process: function(inputData) {}, // jshint ignore:line
32041 * return the preferred touch-action
32046 getTouchAction: function() {},
32049 * called when the gesture isn't allowed to recognize like when another is
32050 * being recognized or it is disabled
32054 reset: function() {}
32058 * get a usable string, used as event postfix
32062 * @returns {String} state
32064 function stateStr(state) {
32065 if (state & STATE_CANCELLED) {
32067 } else if (state & STATE_ENDED) {
32069 } else if (state & STATE_CHANGED) {
32071 } else if (state & STATE_BEGAN) {
32078 * direction cons to string
32082 * @returns {String}
32084 function directionStr(direction) {
32085 if (direction == DIRECTION_DOWN) {
32087 } else if (direction == DIRECTION_UP) {
32089 } else if (direction == DIRECTION_LEFT) {
32091 } else if (direction == DIRECTION_RIGHT) {
32098 * get a recognizer by name if it is bound to a manager
32100 * @param {Recognizer|String}
32102 * @param {Recognizer}
32104 * @returns {Recognizer}
32106 function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
32107 var manager = recognizer.manager;
32109 return manager.get(otherRecognizer);
32111 return otherRecognizer;
32115 * This recognizer is just used as a base for the simple attribute recognizers.
32118 * @extends Recognizer
32120 function AttrRecognizer() {
32121 Recognizer.apply(this, arguments);
32124 inherit(AttrRecognizer, Recognizer, {
32127 * @memberof AttrRecognizer
32138 * Used to check if it the recognizer receives valid input, like
32139 * input.distance > 10.
32141 * @memberof AttrRecognizer
32144 * @returns {Boolean} recognized
32146 attrTest: function(input) {
32147 var optionPointers = this.options.pointers;
32148 return optionPointers === 0 || input.pointers.length === optionPointers;
32152 * Process the input and return the state for the recognizer
32154 * @memberof AttrRecognizer
32157 * @returns {*} State
32159 process: function(input) {
32160 var state = this.state;
32161 var eventType = input.eventType;
32163 var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
32164 var isValid = this.attrTest(input);
32166 // on cancel input and we've recognized before, return STATE_CANCELLED
32167 if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
32168 return state | STATE_CANCELLED;
32169 } else if (isRecognized || isValid) {
32170 if (eventType & INPUT_END) {
32171 return state | STATE_ENDED;
32172 } else if (!(state & STATE_BEGAN)) {
32173 return STATE_BEGAN;
32175 return state | STATE_CHANGED;
32177 return STATE_FAILED;
32182 * Pan Recognized when the pointer is down and moved in the allowed direction.
32185 * @extends AttrRecognizer
32187 function PanRecognizer() {
32188 AttrRecognizer.apply(this, arguments);
32194 inherit(PanRecognizer, AttrRecognizer, {
32197 * @memberof PanRecognizer
32203 direction: DIRECTION_ALL
32206 getTouchAction: function() {
32207 var direction = this.options.direction;
32209 if (direction & DIRECTION_HORIZONTAL) {
32210 actions.push(TOUCH_ACTION_PAN_Y);
32212 if (direction & DIRECTION_VERTICAL) {
32213 actions.push(TOUCH_ACTION_PAN_X);
32218 directionTest: function(input) {
32219 var options = this.options;
32220 var hasMoved = true;
32221 var distance = input.distance;
32222 var direction = input.direction;
32223 var x = input.deltaX;
32224 var y = input.deltaY;
32227 if (!(direction & options.direction)) {
32228 if (options.direction & DIRECTION_HORIZONTAL) {
32229 direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
32230 hasMoved = x != this.pX;
32231 distance = Math.abs(input.deltaX);
32233 direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
32234 hasMoved = y != this.pY;
32235 distance = Math.abs(input.deltaY);
32238 input.direction = direction;
32239 return hasMoved && distance > options.threshold && direction & options.direction;
32242 attrTest: function(input) {
32243 return AttrRecognizer.prototype.attrTest.call(this, input) &&
32244 (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
32247 emit: function(input) {
32248 this.pX = input.deltaX;
32249 this.pY = input.deltaY;
32251 var direction = directionStr(input.direction);
32253 this.manager.emit(this.options.event + direction, input);
32256 this._super.emit.call(this, input);
32261 * Pinch Recognized when two or more pointers are moving toward (zoom-in) or
32262 * away from each other (zoom-out).
32265 * @extends AttrRecognizer
32267 function PinchRecognizer() {
32268 AttrRecognizer.apply(this, arguments);
32271 inherit(PinchRecognizer, AttrRecognizer, {
32274 * @memberof PinchRecognizer
32282 getTouchAction: function() {
32283 return [TOUCH_ACTION_NONE];
32286 attrTest: function(input) {
32287 return this._super.attrTest.call(this, input) &&
32288 (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
32291 emit: function(input) {
32292 this._super.emit.call(this, input);
32293 if (input.scale !== 1) {
32294 var inOut = input.scale < 1 ? 'in' : 'out';
32295 this.manager.emit(this.options.event + inOut, input);
32301 * Press Recognized when the pointer is down for x ms without any movement.
32304 * @extends Recognizer
32306 function PressRecognizer() {
32307 Recognizer.apply(this, arguments);
32309 this._timer = null;
32310 this._input = null;
32313 inherit(PressRecognizer, Recognizer, {
32316 * @memberof PressRecognizer
32321 time: 500, // minimal time of the pointer to be pressed
32322 threshold: 5 // a minimal movement is ok, but keep it low
32325 getTouchAction: function() {
32326 return [TOUCH_ACTION_AUTO];
32329 process: function(input) {
32330 var options = this.options;
32331 var validPointers = input.pointers.length === options.pointers;
32332 var validMovement = input.distance < options.threshold;
32333 var validTime = input.deltaTime > options.time;
32335 this._input = input;
32337 // we only allow little movement
32338 // and we've reached an end event, so a tap is possible
32339 if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
32341 } else if (input.eventType & INPUT_START) {
32343 this._timer = setTimeoutContext(function() {
32344 this.state = STATE_RECOGNIZED;
32346 }, options.time, this);
32347 } else if (input.eventType & INPUT_END) {
32348 return STATE_RECOGNIZED;
32350 return STATE_FAILED;
32353 reset: function() {
32354 clearTimeout(this._timer);
32357 emit: function(input) {
32358 if (this.state !== STATE_RECOGNIZED) {
32362 if (input && (input.eventType & INPUT_END)) {
32363 this.manager.emit(this.options.event + 'up', input);
32365 this._input.timeStamp = now();
32366 this.manager.emit(this.options.event, this._input);
32372 * Rotate Recognized when two or more pointer are moving in a circular motion.
32375 * @extends AttrRecognizer
32377 function RotateRecognizer() {
32378 AttrRecognizer.apply(this, arguments);
32381 inherit(RotateRecognizer, AttrRecognizer, {
32384 * @memberof RotateRecognizer
32392 getTouchAction: function() {
32393 return [TOUCH_ACTION_NONE];
32396 attrTest: function(input) {
32397 return this._super.attrTest.call(this, input) &&
32398 (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
32403 * Swipe Recognized when the pointer is moving fast (velocity), with enough
32404 * distance in the allowed direction.
32407 * @extends AttrRecognizer
32409 function SwipeRecognizer() {
32410 AttrRecognizer.apply(this, arguments);
32413 inherit(SwipeRecognizer, AttrRecognizer, {
32416 * @memberof SwipeRecognizer
32422 direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
32426 getTouchAction: function() {
32427 return PanRecognizer.prototype.getTouchAction.call(this);
32430 attrTest: function(input) {
32431 var direction = this.options.direction;
32434 if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
32435 velocity = input.velocity;
32436 } else if (direction & DIRECTION_HORIZONTAL) {
32437 velocity = input.velocityX;
32438 } else if (direction & DIRECTION_VERTICAL) {
32439 velocity = input.velocityY;
32442 return this._super.attrTest.call(this, input) &&
32443 direction & input.direction &&
32444 input.distance > this.options.threshold &&
32445 abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
32448 emit: function(input) {
32449 var direction = directionStr(input.direction);
32451 this.manager.emit(this.options.event + direction, input);
32454 this.manager.emit(this.options.event, input);
32459 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps
32460 * are recognized if they occur between the given interval and position. The
32461 * delay option can be used to recognize multi-taps without firing a single tap.
32463 * The eventData from the emitted event contains the property `tapCount`, which
32464 * contains the amount of multi-taps being recognized.
32467 * @extends Recognizer
32469 function TapRecognizer() {
32470 Recognizer.apply(this, arguments);
32472 // previous time and center,
32473 // used for tap counting
32474 this.pTime = false;
32475 this.pCenter = false;
32477 this._timer = null;
32478 this._input = null;
32482 inherit(TapRecognizer, Recognizer, {
32485 * @memberof PinchRecognizer
32491 interval: 300, // max time between the multi-tap taps
32492 time: 250, // max time of the pointer to be down (like finger on the
32494 threshold: 2, // a minimal movement is ok, but keep it low
32495 posThreshold: 10 // a multi-tap can be a bit off the initial position
32498 getTouchAction: function() {
32499 return [TOUCH_ACTION_MANIPULATION];
32502 process: function(input) {
32503 var options = this.options;
32505 var validPointers = input.pointers.length === options.pointers;
32506 var validMovement = input.distance < options.threshold;
32507 var validTouchTime = input.deltaTime < options.time;
32511 if ((input.eventType & INPUT_START) && (this.count === 0)) {
32512 return this.failTimeout();
32515 // we only allow little movement
32516 // and we've reached an end event, so a tap is possible
32517 if (validMovement && validTouchTime && validPointers) {
32518 if (input.eventType != INPUT_END) {
32519 return this.failTimeout();
32522 var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
32523 var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
32525 this.pTime = input.timeStamp;
32526 this.pCenter = input.center;
32528 if (!validMultiTap || !validInterval) {
32534 this._input = input;
32536 // if tap count matches we have recognized it,
32537 // else it has began recognizing...
32538 var tapCount = this.count % options.taps;
32539 if (tapCount === 0) {
32540 // no failing requirements, immediately trigger the tap event
32541 // or wait as long as the multitap interval to trigger
32542 if (!this.hasRequireFailures()) {
32543 return STATE_RECOGNIZED;
32545 this._timer = setTimeoutContext(function() {
32546 this.state = STATE_RECOGNIZED;
32548 }, options.interval, this);
32549 return STATE_BEGAN;
32553 return STATE_FAILED;
32556 failTimeout: function() {
32557 this._timer = setTimeoutContext(function() {
32558 this.state = STATE_FAILED;
32559 }, this.options.interval, this);
32560 return STATE_FAILED;
32563 reset: function() {
32564 clearTimeout(this._timer);
32568 if (this.state == STATE_RECOGNIZED) {
32569 this._input.tapCount = this.count;
32570 this.manager.emit(this.options.event, this._input);
32576 * Simple way to create an manager with a default set of recognizers.
32578 * @param {HTMLElement}
32584 function Hammer(element, options) {
32585 options = options || {};
32586 options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
32587 return new Manager(element, options);
32593 Hammer.VERSION = '2.0.4';
32600 Hammer.defaults = {
32602 * set if DOM events are being triggered. But this is slower and unused by
32603 * simple implementations, so disabled by default.
32611 * The value for the touchAction property/fallback. When set to `compute` it
32612 * will magically set the correct value based on the added recognizers.
32617 touchAction: TOUCH_ACTION_COMPUTE,
32626 * EXPERIMENTAL FEATURE -- can be removed/changed Change the parent input
32627 * target element. If Null, then it is being set the to main element.
32629 * @type {Null|EventTarget}
32635 * force an input class
32637 * @type {Null|Function}
32643 * Default recognizer setup when calling `Hammer()` When creating a new
32644 * Manager these will be skipped.
32649 // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
32650 [RotateRecognizer, {
32653 [PinchRecognizer, {
32658 [SwipeRecognizer, {
32659 direction: DIRECTION_HORIZONTAL
32662 direction: DIRECTION_HORIZONTAL
32668 event: 'doubletap',
32677 * Some CSS properties can be used to improve the working of Hammer. Add
32678 * them to this method and they will be set when creating a new Manager.
32684 * Disables text selection to improve the dragging gesture. Mainly for
32685 * desktop browsers.
32690 userSelect: 'none',
32693 * Disable the Windows Phone grippers when pressing an element.
32698 touchSelect: 'none',
32701 * Disables the default callout shown when you touch and hold a touch
32702 * target. On iOS, when you touch and hold a touch target such as a
32703 * link, Safari displays a callout containing information about the
32704 * link. This property allows you to disable that callout.
32709 touchCallout: 'none',
32712 * Specifies whether zooming is enabled. Used by IE10>
32717 contentZooming: 'none',
32720 * Specifies that an entire element should be draggable instead of its
32721 * contents. Mainly for desktop browsers.
32729 * Overrides the highlight color shown when the user taps a link or a
32730 * JavaScript clickable element in iOS. This property obeys the alpha
32731 * value, if specified.
32734 * @default 'rgba(0,0,0,0)'
32736 tapHighlightColor: 'rgba(0,0,0,0)'
32741 var FORCED_STOP = 2;
32746 * @param {HTMLElement}
32752 function Manager(element, options) {
32753 options = options || {};
32755 this.options = merge(options, Hammer.defaults);
32756 this.options.inputTarget = this.options.inputTarget || element;
32758 this.handlers = {};
32760 this.recognizers = [];
32762 this.element = element;
32763 this.input = createInputInstance(this);
32764 this.touchAction = new TouchAction(this, this.options.touchAction);
32766 toggleCssProps(this, true);
32768 each(options.recognizers, function(item) {
32769 var recognizer = this.add(new(item[0])(item[1]));
32770 item[2] && recognizer.recognizeWith(item[2]);
32771 item[3] && recognizer.requireFailure(item[3]);
32775 Manager.prototype = {
32781 * @returns {Manager}
32783 set: function(options) {
32784 extend(this.options, options);
32786 // Options that need a little more setup
32787 if (options.touchAction) {
32788 this.touchAction.update();
32790 if (options.inputTarget) {
32791 // Clean up existing event listeners and reinitialize
32792 this.input.destroy();
32793 this.input.target = options.inputTarget;
32800 * stop recognizing for this session. This session will be discarded, when a
32801 * new [input]start event is fired. When forced, the recognizer cycle is
32802 * stopped immediately.
32807 stop: function(force) {
32808 this.session.stopped = force ? FORCED_STOP : STOP;
32812 * run the recognizers! called by the inputHandler function on every
32813 * movement of the pointers (touches) it walks through all the recognizers
32814 * and tries to detect the gesture that is being made
32819 recognize: function(inputData) {
32820 var session = this.session;
32821 if (session.stopped) {
32825 // run the touch-action polyfill
32826 this.touchAction.preventDefaults(inputData);
32829 var recognizers = this.recognizers;
32831 // this holds the recognizer that is being recognized.
32832 // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or
32834 // if no recognizer is detecting a thing, it is set to `null`
32835 var curRecognizer = session.curRecognizer;
32837 // reset when the last recognizer is recognized
32838 // or when we're in a new session
32839 if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
32840 curRecognizer = session.curRecognizer = null;
32844 while (i < recognizers.length) {
32845 recognizer = recognizers[i];
32847 // find out if we are allowed try to recognize the input for this
32849 // 1. allow if the session is NOT forced stopped (see the .stop()
32851 // 2. allow if we still haven't recognized a gesture in this
32852 // session, or the this recognizer is the one
32853 // that is being recognized.
32854 // 3. allow if the recognizer is allowed to run simultaneous with
32855 // the current recognized recognizer.
32856 // this can be setup with the `recognizeWith()` method on the
32858 if (session.stopped !== FORCED_STOP && ( // 1
32859 !curRecognizer || recognizer == curRecognizer || // 2
32860 recognizer.canRecognizeWith(curRecognizer))) { // 3
32861 recognizer.recognize(inputData);
32863 recognizer.reset();
32866 // if the recognizer has been recognizing the input as a valid
32867 // gesture, we want to store this one as the
32868 // current active recognizer. but only if we don't already have an
32869 // active recognizer
32870 if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
32871 curRecognizer = session.curRecognizer = recognizer;
32878 * get a recognizer by its event name.
32880 * @param {Recognizer|String}
32882 * @returns {Recognizer|Null}
32884 get: function(recognizer) {
32885 if (recognizer instanceof Recognizer) {
32889 var recognizers = this.recognizers;
32890 for (var i = 0; i < recognizers.length; i++) {
32891 if (recognizers[i].options.event == recognizer) {
32892 return recognizers[i];
32899 * add a recognizer to the manager existing recognizers with the same event
32900 * name will be removed
32902 * @param {Recognizer}
32904 * @returns {Recognizer|Manager}
32906 add: function(recognizer) {
32907 if (invokeArrayArg(recognizer, 'add', this)) {
32912 var existing = this.get(recognizer.options.event);
32914 this.remove(existing);
32917 this.recognizers.push(recognizer);
32918 recognizer.manager = this;
32920 this.touchAction.update();
32925 * remove a recognizer by name or instance
32927 * @param {Recognizer|String}
32929 * @returns {Manager}
32931 remove: function(recognizer) {
32932 if (invokeArrayArg(recognizer, 'remove', this)) {
32936 var recognizers = this.recognizers;
32937 recognizer = this.get(recognizer);
32938 recognizers.splice(inArray(recognizers, recognizer), 1);
32940 this.touchAction.update();
32949 * @param {Function}
32951 * @returns {EventEmitter} this
32953 on: function(events, handler) {
32954 var handlers = this.handlers;
32955 each(splitStr(events), function(event) {
32956 handlers[event] = handlers[event] || [];
32957 handlers[event].push(handler);
32963 * unbind event, leave emit blank to remove all handlers
32967 * @param {Function}
32969 * @returns {EventEmitter} this
32971 off: function(events, handler) {
32972 var handlers = this.handlers;
32973 each(splitStr(events), function(event) {
32975 delete handlers[event];
32977 handlers[event].splice(inArray(handlers[event], handler), 1);
32984 * emit event to the listeners
32991 emit: function(event, data) {
32992 // we also want to trigger dom events
32993 if (this.options.domEvents) {
32994 triggerDomEvent(event, data);
32997 // no handlers, so skip it all
32998 var handlers = this.handlers[event] && this.handlers[event].slice();
32999 if (!handlers || !handlers.length) {
33004 data.preventDefault = function() {
33005 data.srcEvent.preventDefault();
33009 while (i < handlers.length) {
33016 * destroy the manager and unbinds all events it doesn't unbind dom events,
33017 * that is the user own responsibility
33019 destroy: function() {
33020 this.element && toggleCssProps(this, false);
33022 this.handlers = {};
33024 this.input.destroy();
33025 this.element = null;
33030 * add/remove the css properties as defined in manager.options.cssProps
33037 function toggleCssProps(manager, add) {
33038 var element = manager.element;
33039 each(manager.options.cssProps, function(value, name) {
33040 element.style[prefixed(element.style, name)] = add ? value : '';
33045 * trigger dom event
33052 function triggerDomEvent(event, data) {
33053 var gestureEvent = document.createEvent('Event');
33054 gestureEvent.initEvent(event, true, true);
33055 gestureEvent.gesture = data;
33056 data.target.dispatchEvent(gestureEvent);
33060 INPUT_START: INPUT_START,
33061 INPUT_MOVE: INPUT_MOVE,
33062 INPUT_END: INPUT_END,
33063 INPUT_CANCEL: INPUT_CANCEL,
33065 STATE_POSSIBLE: STATE_POSSIBLE,
33066 STATE_BEGAN: STATE_BEGAN,
33067 STATE_CHANGED: STATE_CHANGED,
33068 STATE_ENDED: STATE_ENDED,
33069 STATE_RECOGNIZED: STATE_RECOGNIZED,
33070 STATE_CANCELLED: STATE_CANCELLED,
33071 STATE_FAILED: STATE_FAILED,
33073 DIRECTION_NONE: DIRECTION_NONE,
33074 DIRECTION_LEFT: DIRECTION_LEFT,
33075 DIRECTION_RIGHT: DIRECTION_RIGHT,
33076 DIRECTION_UP: DIRECTION_UP,
33077 DIRECTION_DOWN: DIRECTION_DOWN,
33078 DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
33079 DIRECTION_VERTICAL: DIRECTION_VERTICAL,
33080 DIRECTION_ALL: DIRECTION_ALL,
33084 TouchAction: TouchAction,
33086 TouchInput: TouchInput,
33087 MouseInput: MouseInput,
33088 PointerEventInput: PointerEventInput,
33089 TouchMouseInput: TouchMouseInput,
33090 SingleTouchInput: SingleTouchInput,
33092 Recognizer: Recognizer,
33093 AttrRecognizer: AttrRecognizer,
33094 Tap: TapRecognizer,
33095 Pan: PanRecognizer,
33096 Swipe: SwipeRecognizer,
33097 Pinch: PinchRecognizer,
33098 Rotate: RotateRecognizer,
33099 Press: PressRecognizer,
33101 on: addEventListeners,
33102 off: removeEventListeners,
33111 if (typeof define == TYPE_FUNCTION && define.amd) {
33112 define(function() {
33115 } else if (typeof module != 'undefined' && module.exports) {
33116 module.exports = Hammer;
33118 window[exportName] = Hammer;
33121 })(window, document, 'Hammer');
33124 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js": [function(require, module, exports) {
33125 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"][0].apply(exports, arguments)
33127 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js": [function(require, module, exports) {
33129 * Set attribute `name` to `val`, or get attr `name`.
33140 module.exports = function(el, name, val) {
33142 if (arguments.length == 2) {
33143 return el.getAttribute(name);
33147 if (val === null) {
33148 return el.removeAttribute(name);
33152 el.setAttribute(name, val);
33157 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js": [function(require, module, exports) {
33158 module.exports = require('component-classes');
33160 "component-classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-classes\\index.js"
33162 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js": [function(require, module, exports) {
33163 module.exports = function(el) {
33167 while (el.childNodes.length) {
33168 c = el.childNodes[0];
33175 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\closest.js": [function(require, module, exports) {
33176 module.exports = require('component-closest');
33178 "component-closest": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-closest\\index.js"
33180 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js": [function(require, module, exports) {
33181 module.exports = require('component-delegate');
33183 "component-delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-delegate\\index.js"
33185 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js": [function(require, module, exports) {
33186 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\domify.js"][0].apply(exports, arguments)
33188 "domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\domify\\index.js"
33190 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js": [function(require, module, exports) {
33191 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\event.js"][0].apply(exports, arguments)
33193 "component-event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js"
33195 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\matches.js": [function(require, module, exports) {
33196 module.exports = require('component-matches-selector');
33198 "component-matches-selector": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-matches-selector\\index.js"
33200 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\query.js": [function(require, module, exports) {
33201 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\query.js"][0].apply(exports, arguments)
33203 "component-query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js"
33205 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js": [function(require, module, exports) {
33206 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\remove.js"][0].apply(exports, arguments)
33208 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-classes\\index.js": [function(require, module, exports) {
33210 * Module dependencies.
33213 var index = require('indexof');
33216 * Whitespace regexp.
33222 * toString reference.
33225 var toString = Object.prototype.toString;
33228 * Wrap `el` in a `ClassList`.
33232 * @return {ClassList}
33236 module.exports = function(el) {
33237 return new ClassList(el);
33241 * Initialize a new ClassList for `el`.
33248 function ClassList(el) {
33249 if (!el || !el.nodeType) {
33250 throw new Error('A DOM element reference is required');
33253 this.list = el.classList;
33257 * Add class `name` if not already present.
33261 * @return {ClassList}
33265 ClassList.prototype.add = function(name) {
33268 this.list.add(name);
33273 var arr = this.array();
33274 var i = index(arr, name);
33275 if (!~i) arr.push(name);
33276 this.el.className = arr.join(' ');
33281 * Remove class `name` when present, or pass a regular expression to remove any
33284 * @param {String|RegExp}
33286 * @return {ClassList}
33290 ClassList.prototype.remove = function(name) {
33291 if ('[object RegExp]' == toString.call(name)) {
33292 return this.removeMatching(name);
33297 this.list.remove(name);
33302 var arr = this.array();
33303 var i = index(arr, name);
33304 if (~i) arr.splice(i, 1);
33305 this.el.className = arr.join(' ');
33310 * Remove all classes matching `re`.
33314 * @return {ClassList}
33318 ClassList.prototype.removeMatching = function(re) {
33319 var arr = this.array();
33320 for (var i = 0; i < arr.length; i++) {
33321 if (re.test(arr[i])) {
33322 this.remove(arr[i]);
33329 * Toggle class `name`, can force state via `force`.
33331 * For browsers that support classList, but do not support `force` yet, the
33332 * mistake will be detected and corrected.
33338 * @return {ClassList}
33342 ClassList.prototype.toggle = function(name, force) {
33345 if ("undefined" !== typeof force) {
33346 if (force !== this.list.toggle(name, force)) {
33347 this.list.toggle(name); // toggle again to correct
33350 this.list.toggle(name);
33356 if ("undefined" !== typeof force) {
33363 if (this.has(name)) {
33374 * Return an array of classes.
33380 ClassList.prototype.array = function() {
33381 var className = this.el.getAttribute('class') || '';
33382 var str = className.replace(/^\s+|\s+$/g, '');
33383 var arr = str.split(re);
33384 if ('' === arr[0]) arr.shift();
33389 * Check if class `name` is present.
33393 * @return {ClassList}
33397 ClassList.prototype.has =
33398 ClassList.prototype.contains = function(name) {
33399 return this.list ? this.list.contains(name) : !!~index(this.array(), name);
33403 "indexof": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-classes\\node_modules\\component-indexof\\index.js"
33405 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-classes\\node_modules\\component-indexof\\index.js": [function(require, module, exports) {
33406 module.exports = function(arr, obj) {
33407 if (arr.indexOf) return arr.indexOf(obj);
33408 for (var i = 0; i < arr.length; ++i) {
33409 if (arr[i] === obj) return i;
33414 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-closest\\index.js": [function(require, module, exports) {
33415 var matches = require('matches-selector')
33417 module.exports = function(element, selector, checkYoSelf, root) {
33418 element = checkYoSelf ? {
33419 parentNode: element
33422 root = root || document
33424 // Make sure `element !== document` and `element != null`
33425 // otherwise we get an illegal invocation
33426 while ((element = element.parentNode) && element !== document) {
33427 if (matches(element, selector))
33429 // After `matches` on the edge case that
33430 // the selector matches the root
33431 // (when the root is not the document)
33432 if (element === root)
33438 "matches-selector": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-matches-selector\\index.js"
33440 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-delegate\\index.js": [function(require, module, exports) {
33442 * Module dependencies.
33445 var closest = require('closest'),
33446 event = require('event');
33449 * Delegate event `type` to `selector` and invoke `fn(e)`. A callback function
33450 * is returned which may be passed to `.unbind()`.
33458 * @param {Function}
33462 * @return {Function}
33466 exports.bind = function(el, selector, type, fn, capture) {
33467 return event.bind(el, type, function(e) {
33468 var target = e.target || e.srcElement;
33469 e.delegateTarget = closest(target, selector, true, el);
33470 if (e.delegateTarget) fn.call(el, e);
33475 * Unbind event `type`'s callback `fn`.
33481 * @param {Function}
33488 exports.unbind = function(el, type, fn, capture) {
33489 event.unbind(el, type, fn, capture);
33493 "closest": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-closest\\index.js",
33494 "event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js"
33496 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js": [function(require, module, exports) {
33497 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js"][0].apply(exports, arguments)
33499 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-matches-selector\\index.js": [function(require, module, exports) {
33501 * Module dependencies.
33504 var query = require('query');
33507 * Element prototype.
33510 var proto = Element.prototype;
33516 var vendor = proto.matches || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector;
33519 * Expose `match()`.
33522 module.exports = match;
33525 * Match `el` to `selector`.
33531 * @return {Boolean}
33535 function match(el, selector) {
33536 if (!el || el.nodeType !== 1) return false;
33537 if (vendor) return vendor.call(el, selector);
33538 var nodes = query.all(selector, el.parentNode);
33539 for (var i = 0; i < nodes.length; ++i) {
33540 if (nodes[i] == el) return true;
33546 "query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js"
33548 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js": [function(require, module, exports) {
33549 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js"][0].apply(exports, arguments)
33551 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\domify\\index.js": [function(require, module, exports) {
33552 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\domify\\index.js"][0].apply(exports, arguments)
33554 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\index.js": [function(require, module, exports) {
33555 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\index.js"][0].apply(exports, arguments)
33557 "./lib/collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\collection.js",
33558 "./lib/refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\refs.js"
33560 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\collection.js": [function(require, module, exports) {
33561 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js"][0].apply(exports, arguments)
33563 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\refs.js": [function(require, module, exports) {
33564 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\refs.js"][0].apply(exports, arguments)
33566 "./collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\collection.js"
33568 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\snapsvg\\dist\\snap.svg.js": [function(require, module, exports) {
33571 // Copyright (c) 2013 – 2014 Adobe Systems Incorporated. All rights
33574 // Licensed under the Apache License, Version 2.0 (the "License");
33575 // you may not use this file except in compliance with the License.
33576 // You may obtain a copy of the License at
33578 // http://www.apache.org/licenses/LICENSE-2.0
33580 // Unless required by applicable law or agreed to in writing, software
33581 // distributed under the License is distributed on an "AS IS" BASIS,
33582 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33583 // See the License for the specific language governing permissions and
33584 // limitations under the License.
33586 // build: 2014-09-08
33588 (function(glob, factory) {
33590 if (typeof define === "function" && define.amd) {
33591 // Define as an anonymous module
33592 define(["eve"], function(eve) {
33593 return factory(glob, eve);
33595 } else if (typeof exports !== 'undefined') {
33596 // Next for Node.js or CommonJS
33597 var eve = require('eve');
33598 module.exports = factory(glob, eve);
33600 // Browser globals (glob is window)
33601 // Snap adds itself to window
33602 factory(glob, glob.eve);
33604 }(window || this, function(window, eve) {
33606 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
33608 // Licensed under the Apache License, Version 2.0 (the "License");
33609 // you may not use this file except in compliance with the License.
33610 // You may obtain a copy of the License at
33612 // http://www.apache.org/licenses/LICENSE-2.0
33614 // Unless required by applicable law or agreed to in writing, software
33615 // distributed under the License is distributed on an "AS IS" BASIS,
33616 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33617 // See the License for the specific language governing permissions and
33618 // limitations under the License.
33619 var mina = (function(eve) {
33620 var animations = {},
33621 requestAnimFrame = window.requestAnimationFrame ||
33622 window.webkitRequestAnimationFrame ||
33623 window.mozRequestAnimationFrame ||
33624 window.oRequestAnimationFrame ||
33625 window.msRequestAnimationFrame ||
33626 function(callback) {
33627 setTimeout(callback, 16);
33629 isArray = Array.isArray || function(a) {
33630 return a instanceof Array ||
33631 Object.prototype.toString.call(a) == "[object Array]";
33634 idprefix = "M" + (+new Date).toString(36),
33636 return idprefix + (idgen++).toString(36);
33638 diff = function(a, b, A, B) {
33641 for (var i = 0, ii = a.length; i < ii; i++) {
33642 res[i] = diff(a[i], b, A[i], B);
33646 var dif = (A - a) / (B - b);
33647 return function(bb) {
33648 return a + dif * (bb - b);
33651 timer = Date.now || function() {
33654 sta = function(val) {
33659 var ds = a.s - val;
33664 speed = function(val) {
33671 duration = function(val) {
33676 a.s = a.s * val / a.dur;
33679 stopit = function() {
33681 delete animations[a.id];
33683 eve("mina.stop." + a.id, a);
33685 pause = function() {
33690 delete animations[a.id];
33692 a.pdif = a.get() - a.b;
33694 resume = function() {
33699 a.b = a.get() - a.pdif;
33701 animations[a.id] = a;
33703 update = function() {
33706 if (isArray(a.start)) {
33708 for (var j = 0, jj = a.start.length; j < jj; j++) {
33709 res[j] = +a.start[j] +
33710 (a.end[j] - a.start[j]) * a.easing(a.s);
33713 res = +a.start + (a.end - a.start) * a.easing(a.s);
33717 frame = function() {
33719 for (var i in animations)
33720 if (animations.hasOwnProperty(i)) {
33721 var a = animations[i],
33725 a.s = (b - a.b) / (a.dur / a.spd);
33727 delete animations[i];
33731 setTimeout(function() {
33732 eve("mina.finish." + a.id, a);
33738 len && requestAnimFrame(frame);
33741 * \ mina [ method ] * Generic animation of numbers * - a (number) start
33742 * _slave_ number - A (number) end _slave_ number - b (number) start
33743 * _master_ number (start time in general case) - B (number) end _master_
33744 * number (end time in gereal case) - get (function) getter of _master_
33745 * number (see @mina.time) - set (function) setter of _slave_ number -
33746 * easing (function) #optional easing function, default is @mina.linear =
33747 * (object) animation descriptor o { o id (string) animation id, o start
33748 * (number) start _slave_ number, o end (number) end _slave_ number, o b
33749 * (number) start _master_ number, o s (number) animation status (0..1), o
33750 * dur (number) animation duration, o spd (number) animation speed, o get
33751 * (function) getter of _master_ number (see @mina.time), o set (function)
33752 * setter of _slave_ number, o easing (function) easing function, default is
33753 * @mina.linear, o status (function) status getter/setter, o speed
33754 * (function) speed getter/setter, o duration (function) duration
33755 * getter/setter, o stop (function) animation stopper o pause (function)
33756 * pauses the animation o resume (function) resumes the animation o update
33757 * (function) calles setter with the right value of the animation o } \
33759 mina = function(a, A, b, B, get, set, easing) {
33770 easing: easing || mina.linear,
33773 duration: duration,
33779 animations[anim.id] = anim;
33782 for (i in animations)
33783 if (animations.hasOwnProperty(i)) {
33789 len == 1 && requestAnimFrame(frame);
33793 * \ mina.time [ method ] * Returns the current time. Equivalent to: |
33794 * function () { | return (new Date).getTime(); | } \
33798 * \ mina.getById [ method ] * Returns an animation by its id - id (string)
33799 * animation's id = (object) See @mina \
33801 mina.getById = function(id) {
33802 return animations[id] || null;
33806 * \ mina.linear [ method ] * Default linear easing - n (number) input 0..1 =
33807 * (number) output 0..1 \
33809 mina.linear = function(n) {
33813 * \ mina.easeout [ method ] * Easeout easing - n (number) input 0..1 =
33814 * (number) output 0..1 \
33816 mina.easeout = function(n) {
33817 return Math.pow(n, 1.7);
33820 * \ mina.easein [ method ] * Easein easing - n (number) input 0..1 =
33821 * (number) output 0..1 \
33823 mina.easein = function(n) {
33824 return Math.pow(n, .48);
33827 * \ mina.easeinout [ method ] * Easeinout easing - n (number) input 0..1 =
33828 * (number) output 0..1 \
33830 mina.easeinout = function(n) {
33837 var q = .48 - n / 1.04,
33838 Q = Math.sqrt(.1734 + q * q),
33840 X = Math.pow(Math.abs(x), 1 / 3) * (x < 0 ? -1 : 1),
33842 Y = Math.pow(Math.abs(y), 1 / 3) * (y < 0 ? -1 : 1),
33844 return (1 - t) * 3 * t * t + t * t * t;
33847 * \ mina.backin [ method ] * Backin easing - n (number) input 0..1 =
33848 * (number) output 0..1 \
33850 mina.backin = function(n) {
33855 return n * n * ((s + 1) * n - s);
33858 * \ mina.backout [ method ] * Backout easing - n (number) input 0..1 =
33859 * (number) output 0..1 \
33861 mina.backout = function(n) {
33867 return n * n * ((s + 1) * n + s) + 1;
33870 * \ mina.elastic [ method ] * Elastic easing - n (number) input 0..1 =
33871 * (number) output 0..1 \
33873 mina.elastic = function(n) {
33877 return Math.pow(2, -10 * n) * Math.sin((n - .075) *
33878 (2 * Math.PI) / .3) + 1;
33881 * \ mina.bounce [ method ] * Bounce easing - n (number) input 0..1 =
33882 * (number) output 0..1 \
33884 mina.bounce = function(n) {
33893 l = s * n * n + .75;
33895 if (n < (2.5 / p)) {
33897 l = s * n * n + .9375;
33900 l = s * n * n + .984375;
33906 window.mina = mina;
33908 })(typeof eve == "undefined" ? function() {} : eve);
33909 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
33911 // Licensed under the Apache License, Version 2.0 (the "License");
33912 // you may not use this file except in compliance with the License.
33913 // You may obtain a copy of the License at
33915 // http://www.apache.org/licenses/LICENSE-2.0
33917 // Unless required by applicable law or agreed to in writing, software
33918 // distributed under the License is distributed on an "AS IS" BASIS,
33919 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33920 // See the License for the specific language governing permissions and
33921 // limitations under the License.
33923 var Snap = (function(root) {
33924 Snap.version = "0.3.0";
33926 * \ Snap [ method ] * Creates a drawing surface or wraps existing SVG element. * -
33927 * width (number|string) width of surface - height (number|string) height of
33928 * surface or - DOM (SVGElement) element to be wrapped into Snap structure or -
33929 * array (array) array of elements (will return set of elements) or - query
33930 * (string) CSS query selector = (object) @Element \
33932 function Snap(w, h) {
33937 if (is(w, "array") && Snap.set) {
33938 return Snap.set.apply(Snap, w);
33940 if (w instanceof Element) {
33944 w = glob.doc.querySelector(w);
33948 w = w == null ? "100%" : w;
33949 h = h == null ? "100%" : h;
33950 return new Paper(w, h);
33952 Snap.toString = function() {
33953 return "Snap v" + this.version;
33958 doc: root.window.document
33960 Snap._.glob = glob;
33961 var has = "hasOwnProperty",
33963 toFloat = parseFloat,
33971 round = math.round,
33974 objectToString = Object.prototype.toString,
33975 ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
33976 colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,
33977 bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
33978 reURLValue = /^url\(#?([^)]+)\)$/,
33979 separator = Snap._.separator = /[,\s]+/,
33980 whitespace = /[\s]/g,
33981 commaSpaces = /[\s]*,[\s]*/,
33986 pathCommand = /([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig,
33987 tCommand = /([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig,
33988 pathValues = /(-?\d*\.?\d*(?:e[\-+]?\\d+)?)[\s]*,?[\s]*/ig,
33990 idprefix = "S" + (+new Date).toString(36),
33991 ID = function(el) {
33992 return (el && el.type ? el.type : E) + idprefix + (idgen++).toString(36);
33994 xlink = "http://www.w3.org/1999/xlink",
33995 xmlns = "http://www.w3.org/2000/svg",
33997 URL = Snap.url = function(url) {
33998 return "url('#" + url + "')";
34001 function $(el, attr) {
34003 if (el == "#text") {
34004 el = glob.doc.createTextNode(attr.text || "");
34006 if (typeof el == "string") {
34009 if (typeof attr == "string") {
34010 if (attr.substring(0, 6) == "xlink:") {
34011 return el.getAttributeNS(xlink, attr.substring(6));
34013 if (attr.substring(0, 4) == "xml:") {
34014 return el.getAttributeNS(xmlns, attr.substring(4));
34016 return el.getAttribute(attr);
34018 for (var key in attr)
34019 if (attr[has](key)) {
34020 var val = Str(attr[key]);
34022 if (key.substring(0, 6) == "xlink:") {
34023 el.setAttributeNS(xlink, key.substring(6), val);
34024 } else if (key.substring(0, 4) == "xml:") {
34025 el.setAttributeNS(xmlns, key.substring(4), val);
34027 el.setAttribute(key, val);
34030 el.removeAttribute(key);
34034 el = glob.doc.createElementNS(xmlns, el);
34041 function getAttrs(el) {
34042 var attrs = el.attributes,
34045 for (var i = 0; i < attrs.length; i++) {
34046 if (attrs[i].namespaceURI == xlink) {
34051 name += attrs[i].name;
34052 out[name] = attrs[i].textContent;
34057 function is(o, type) {
34058 type = Str.prototype.toLowerCase.call(type);
34059 if (type == "finite") {
34060 return isFinite(o);
34062 if (type == "array" &&
34063 (o instanceof Array || Array.isArray && Array.isArray(o))) {
34066 return (type == "null" && o === null) ||
34067 (type == typeof o && o !== null) ||
34068 (type == "object" && o === Object(o)) ||
34069 objectToString.call(o).slice(8, -1).toLowerCase() == type;
34072 * \ Snap.format [ method ] * Replaces construction of type `{<name>}` to the
34073 * corresponding argument * - token (string) string to format - json (object)
34074 * object which properties are used as a replacement = (string) formatted string >
34075 * Usage | // this draws a rectangular shape equivalent to "M10,20h40v50h-40z" |
34076 * paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative
34077 * width']}z", { | x: 10, | y: 20, | dim: { | width: 40, | height: 50, |
34078 * "negative width": -40 | } | })); \
34080 Snap.format = (function() {
34081 var tokenRegex = /\{([^\}]+)\}/g,
34082 objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, // matches
34091 replacer = function(all, key, obj) {
34093 key.replace(objNotationRegex, function(all, name, quote, quotedName, isFunc) {
34094 name = name || quotedName;
34099 typeof res == "function" && isFunc && (res = res());
34102 res = (res == null || res == obj ? all : res) + "";
34105 return function(str, obj) {
34106 return Str(str).replace(tokenRegex, function(all, key) {
34107 return replacer(all, key, obj);
34112 function clone(obj) {
34113 if (typeof obj == "function" || Object(obj) !== obj) {
34116 var res = new obj.constructor;
34117 for (var key in obj)
34118 if (obj[has](key)) {
34119 res[key] = clone(obj[key]);
34123 Snap._.clone = clone;
34125 function repush(array, item) {
34126 for (var i = 0, ii = array.length; i < ii; i++)
34127 if (array[i] === item) {
34128 return array.push(array.splice(i, 1)[0]);
34132 function cacher(f, scope, postprocessor) {
34134 var arg = Array.prototype.slice.call(arguments, 0),
34135 args = arg.join("\u2400"),
34136 cache = newf.cache = newf.cache || {},
34137 count = newf.count = newf.count || [];
34138 if (cache[has](args)) {
34139 repush(count, args);
34140 return postprocessor ? postprocessor(cache[args]) : cache[args];
34142 count.length >= 1e3 && delete cache[count.shift()];
34144 cache[args] = f.apply(scope, arg);
34145 return postprocessor ? postprocessor(cache[args]) : cache[args];
34149 Snap._.cacher = cacher;
34151 function angle(x1, y1, x2, y2, x3, y3) {
34158 return (180 + math.atan2(-y, -x) * 180 / PI + 360) % 360;
34160 return angle(x1, y1, x3, y3) - angle(x2, y2, x3, y3);
34164 function rad(deg) {
34165 return deg % 360 * PI / 180;
34168 function deg(rad) {
34169 return rad * 180 / PI % 360;
34173 return this.x + S + this.y;
34176 function x_y_w_h() {
34177 return this.x + S + this.y + S + this.width + " \xd7 " + this.height;
34181 * \ Snap.rad [ method ] * Transform angle to radians - deg (number) angle in
34182 * degrees = (number) angle in radians \
34186 * \ Snap.deg [ method ] * Transform angle to degrees - rad (number) angle in
34187 * radians = (number) angle in degrees \
34191 * \ Snap.angle [ method ] * Returns an angle between two or three points >
34192 * Parameters - x1 (number) x coord of first point - y1 (number) y coord of
34193 * first point - x2 (number) x coord of second point - y2 (number) y coord of
34194 * second point - x3 (number) #optional x coord of third point - y3 (number)
34195 * #optional y coord of third point = (number) angle in degrees \
34197 Snap.angle = angle;
34199 * \ Snap.is [ method ] * Handy replacement for the `typeof` operator - o
34200 * (…) any object or primitive - type (string) name of the type, e.g.,
34201 * `string`, `function`, `number`, etc. = (boolean) `true` if given value is of
34206 * \ Snap.snapTo [ method ] * Snaps given value to given grid - values
34207 * (array|number) given array of values or step of the grid - value (number)
34208 * value to adjust - tolerance (number) #optional maximum distance to the target
34209 * value that would trigger the snap. Default is `10`. = (number) adjusted value \
34211 Snap.snapTo = function(values, value, tolerance) {
34212 tolerance = is(tolerance, "finite") ? tolerance : 10;
34213 if (is(values, "array")) {
34214 var i = values.length;
34216 if (abs(values[i] - value) <= tolerance) {
34221 var rem = value % values;
34222 if (rem < tolerance) {
34223 return value - rem;
34225 if (rem > values - tolerance) {
34226 return value - rem + values;
34233 * \ Snap.getRGB [ method ] * Parses color string as RGB object - color (string)
34234 * color string in one of the following formats: # <ul> # <li>Color name (<code>red</code>,
34235 * <code>green</code>, <code>cornflowerblue</code>, etc)</li> # <li>#•••
34236 * � shortened HTML color: (<code>#000</code>, <code>#fc0</code>,
34237 * etc.)</li> # <li>#•••••• � full
34238 * length HTML color: (<code>#000000</code>, <code>#bd2300</code>)</li> #
34239 * <li>rgb(•••, •••, •••)
34240 * � red, green and blue channels values: (<code>rgb(200, 100, 0)</code>)</li> #
34241 * <li>rgba(•••, •••,
34242 * •••, •••) � also with opacity</li> #
34243 * <li>rgb(•••%, •••%,
34244 * •••%) � same as above, but in %: (<code>rgb(100%, 175%, 0%)</code>)</li> #
34245 * <li>rgba(•••%, •••%,
34246 * •••%, •••%) � also with opacity</li> #
34247 * <li>hsb(•••, •••, •••)
34248 * � hue, saturation and brightness values: (<code>hsb(0.5, 0.25, 1)</code>)</li> #
34249 * <li>hsba(•••, •••,
34250 * •••, •••) � also with opacity</li> #
34251 * <li>hsb(•••%, •••%,
34252 * •••%) � same as above, but in %</li> # <li>hsba(•••%,
34253 * •••%, •••%, •••%)
34254 * � also with opacity</li> # <li>hsl(•••,
34255 * •••, •••) � hue, saturation and
34256 * luminosity values: (<code>hsb(0.5, 0.25, 0.5)</code>)</li> #
34257 * <li>hsla(•••, •••,
34258 * •••, •••) � also with opacity</li> #
34259 * <li>hsl(•••%, •••%,
34260 * •••%) � same as above, but in %</li> # <li>hsla(•••%,
34261 * •••%, •••%, •••%)
34262 * � also with opacity</li> # </ul> Note that `%` can be used any time:
34263 * `rgb(20%, 255, 50%)`. = (object) RGB object in the following format: o { o r
34264 * (number) red, o g (number) green, o b (number) blue, o hex (string) color in
34265 * HTML/CSS format: #••••••, o error
34266 * (boolean) true if string can't be parsed o } \
34268 Snap.getRGB = cacher(function(colour) {
34269 if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) {
34276 toString: rgbtoString
34279 if (colour == "none") {
34285 toString: rgbtoString
34287 }!(hsrg[has](colour.toLowerCase().substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour));
34295 toString: rgbtoString
34305 rgb = colour.match(colourRegExp);
34308 blue = toInt(rgb[2].substring(5), 16);
34309 green = toInt(rgb[2].substring(3, 5), 16);
34310 red = toInt(rgb[2].substring(1, 3), 16);
34313 blue = toInt((t = rgb[3].charAt(3)) + t, 16);
34314 green = toInt((t = rgb[3].charAt(2)) + t, 16);
34315 red = toInt((t = rgb[3].charAt(1)) + t, 16);
34318 values = rgb[4].split(commaSpaces);
34319 red = toFloat(values[0]);
34320 values[0].slice(-1) == "%" && (red *= 2.55);
34321 green = toFloat(values[1]);
34322 values[1].slice(-1) == "%" && (green *= 2.55);
34323 blue = toFloat(values[2]);
34324 values[2].slice(-1) == "%" && (blue *= 2.55);
34325 rgb[1].toLowerCase().slice(0, 4) == "rgba" && (opacity = toFloat(values[3]));
34326 values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
34329 values = rgb[5].split(commaSpaces);
34330 red = toFloat(values[0]);
34331 values[0].slice(-1) == "%" && (red /= 100);
34332 green = toFloat(values[1]);
34333 values[1].slice(-1) == "%" && (green /= 100);
34334 blue = toFloat(values[2]);
34335 values[2].slice(-1) == "%" && (blue /= 100);
34336 (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
34337 rgb[1].toLowerCase().slice(0, 4) == "hsba" && (opacity = toFloat(values[3]));
34338 values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
34339 return Snap.hsb2rgb(red, green, blue, opacity);
34342 values = rgb[6].split(commaSpaces);
34343 red = toFloat(values[0]);
34344 values[0].slice(-1) == "%" && (red /= 100);
34345 green = toFloat(values[1]);
34346 values[1].slice(-1) == "%" && (green /= 100);
34347 blue = toFloat(values[2]);
34348 values[2].slice(-1) == "%" && (blue /= 100);
34349 (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
34350 rgb[1].toLowerCase().slice(0, 4) == "hsla" && (opacity = toFloat(values[3]));
34351 values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
34352 return Snap.hsl2rgb(red, green, blue, opacity);
34354 red = mmin(math.round(red), 255);
34355 green = mmin(math.round(green), 255);
34356 blue = mmin(math.round(blue), 255);
34357 opacity = mmin(mmax(opacity, 0), 1);
34362 toString: rgbtoString
34364 rgb.hex = "#" + (16777216 | blue | (green << 8) | (red << 16)).toString(16).slice(1);
34365 rgb.opacity = is(opacity, "finite") ? opacity : 1;
34374 toString: rgbtoString
34377 // SIERRA It seems odd that the following 3 conversion methods are not expressed
34378 // as .this2that(), like the others.
34380 * \ Snap.hsb [ method ] * Converts HSB values to a hex representation of the
34381 * color - h (number) hue - s (number) saturation - b (number) value or
34382 * brightness = (string) hex representation of the color \
34384 Snap.hsb = cacher(function(h, s, b) {
34385 return Snap.hsb2rgb(h, s, b).hex;
34388 * \ Snap.hsl [ method ] * Converts HSL values to a hex representation of the
34389 * color - h (number) hue - s (number) saturation - l (number) luminosity =
34390 * (string) hex representation of the color \
34392 Snap.hsl = cacher(function(h, s, l) {
34393 return Snap.hsl2rgb(h, s, l).hex;
34396 * \ Snap.rgb [ method ] * Converts RGB values to a hex representation of the
34397 * color - r (number) red - g (number) green - b (number) blue = (string) hex
34398 * representation of the color \
34400 Snap.rgb = cacher(function(r, g, b, o) {
34401 if (is(o, "finite")) {
34402 var round = math.round;
34403 return "rgba(" + [round(r), round(g), round(b), +o.toFixed(2)] + ")";
34405 return "#" + (16777216 | b | (g << 8) | (r << 16)).toString(16).slice(1);
34407 var toHex = function(color) {
34408 var i = glob.doc.getElementsByTagName("head")[0] || glob.doc.getElementsByTagName("svg")[0],
34409 red = "rgb(255, 0, 0)";
34410 toHex = cacher(function(color) {
34411 if (color.toLowerCase() == "red") {
34414 i.style.color = red;
34415 i.style.color = color;
34416 var out = glob.doc.defaultView.getComputedStyle(i, E).getPropertyValue("color");
34417 return out == red ? null : out;
34419 return toHex(color);
34421 hsbtoString = function() {
34422 return "hsb(" + [this.h, this.s, this.b] + ")";
34424 hsltoString = function() {
34425 return "hsl(" + [this.h, this.s, this.l] + ")";
34427 rgbtoString = function() {
34428 return this.opacity == 1 || this.opacity == null ?
34430 "rgba(" + [this.r, this.g, this.b, this.opacity] + ")";
34432 prepareRGB = function(r, g, b) {
34433 if (g == null && is(r, "object") && "r" in r && "g" in r && "b" in r) {
34438 if (g == null && is(r, string)) {
34439 var clr = Snap.getRGB(r);
34444 if (r > 1 || g > 1 || b > 1) {
34452 packageRGB = function(r, g, b, o) {
34453 r = math.round(r * 255);
34454 g = math.round(g * 255);
34455 b = math.round(b * 255);
34460 opacity: is(o, "finite") ? o : 1,
34461 hex: Snap.rgb(r, g, b),
34462 toString: rgbtoString
34464 is(o, "finite") && (rgb.opacity = o);
34467 // SIERRA Clarify if Snap does not support consolidated HSLA/RGBA colors. E.g.,
34468 // can you specify a semi-transparent value for Snap.filter.shadow()?
34470 * \ Snap.color [ method ] * Parses the color string and returns an object
34471 * featuring the color's component values - clr (string) color string in one of
34472 * the supported formats (see @Snap.getRGB) = (object) Combined RGB/HSB object
34473 * in the following format: o { o r (number) red, o g (number) green, o b
34474 * (number) blue, o hex (string) color in HTML/CSS format:
34475 * #••••••, o error (boolean) `true` if
34476 * string can't be parsed, o h (number) hue, o s (number) saturation, o v
34477 * (number) value (brightness), o l (number) lightness o } \
34479 Snap.color = function(clr) {
34481 if (is(clr, "object") && "h" in clr && "s" in clr && "b" in clr) {
34482 rgb = Snap.hsb2rgb(clr);
34488 } else if (is(clr, "object") && "h" in clr && "s" in clr && "l" in clr) {
34489 rgb = Snap.hsl2rgb(clr);
34496 if (is(clr, "string")) {
34497 clr = Snap.getRGB(clr);
34499 if (is(clr, "object") && "r" in clr && "g" in clr && "b" in clr && !("error" in clr)) {
34500 rgb = Snap.rgb2hsl(clr);
34504 rgb = Snap.rgb2hsb(clr);
34510 clr.r = clr.g = clr.b = clr.h = clr.s = clr.v = clr.l = -1;
34514 clr.toString = rgbtoString;
34518 * \ Snap.hsb2rgb [ method ] * Converts HSB values to an RGB object - h (number)
34519 * hue - s (number) saturation - v (number) value or brightness = (object) RGB
34520 * object in the following format: o { o r (number) red, o g (number) green, o b
34521 * (number) blue, o hex (string) color in HTML/CSS format:
34522 * #•••••• o } \
34524 Snap.hsb2rgb = function(h, s, v, o) {
34525 if (is(h, "object") && "h" in h && "s" in h && "b" in h) {
34533 h = (h % 360) / 60;
34535 X = C * (1 - abs(h % 2 - 1));
34539 R += [C, X, 0, 0, X, C][h];
34540 G += [X, C, C, X, 0, 0][h];
34541 B += [0, 0, X, C, C, X][h];
34542 return packageRGB(R, G, B, o);
34545 * \ Snap.hsl2rgb [ method ] * Converts HSL values to an RGB object - h (number)
34546 * hue - s (number) saturation - l (number) luminosity = (object) RGB object in
34547 * the following format: o { o r (number) red, o g (number) green, o b (number)
34548 * blue, o hex (string) color in HTML/CSS format:
34549 * #•••••• o } \
34551 Snap.hsl2rgb = function(h, s, l, o) {
34552 if (is(h, "object") && "h" in h && "s" in h && "l" in h) {
34557 if (h > 1 || s > 1 || l > 1) {
34564 h = (h % 360) / 60;
34565 C = 2 * s * (l < .5 ? l : 1 - l);
34566 X = C * (1 - abs(h % 2 - 1));
34567 R = G = B = l - C / 2;
34570 R += [C, X, 0, 0, X, C][h];
34571 G += [X, C, C, X, 0, 0][h];
34572 B += [0, 0, X, C, C, X][h];
34573 return packageRGB(R, G, B, o);
34576 * \ Snap.rgb2hsb [ method ] * Converts RGB values to an HSB object - r (number)
34577 * red - g (number) green - b (number) blue = (object) HSB object in the
34578 * following format: o { o h (number) hue, o s (number) saturation, o b (number)
34581 Snap.rgb2hsb = function(r, g, b) {
34582 b = prepareRGB(r, g, b);
34589 C = V - mmin(r, g, b);
34590 H = (C == 0 ? null :
34591 V == r ? (g - b) / C :
34592 V == g ? (b - r) / C + 2 :
34595 H = ((H + 360) % 6) * 60 / 360;
34596 S = C == 0 ? 0 : C / V;
34601 toString: hsbtoString
34605 * \ Snap.rgb2hsl [ method ] * Converts RGB values to an HSL object - r (number)
34606 * red - g (number) green - b (number) blue = (object) HSL object in the
34607 * following format: o { o h (number) hue, o s (number) saturation, o l (number)
34610 Snap.rgb2hsl = function(r, g, b) {
34611 b = prepareRGB(r, g, b);
34616 var H, S, L, M, m, C;
34620 H = (C == 0 ? null :
34621 M == r ? (g - b) / C :
34622 M == g ? (b - r) / C + 2 :
34624 H = ((H + 360) % 6) * 60 / 360;
34627 L < .5 ? C / (2 * L) :
34633 toString: hsltoString
34638 // SIERRA Snap.parsePathString(): By _array of arrays,_ I assume you mean a
34639 // format like this for two separate segments? [ ["M10,10","L90,90"],
34640 // ["M90,10","L10,90"] ] Otherwise how is each command structured?
34642 * \ Snap.parsePathString [ method ] * Utility method * Parses given path string
34643 * into an array of arrays of path segments - pathString (string|array) path
34644 * string or array of segments (in the last case it is returned straight away) =
34645 * (array) array of segments \
34647 Snap.parsePathString = function(pathString) {
34651 var pth = Snap.path(pathString);
34653 return Snap.path.clone(pth.arr);
34656 var paramCounts = {
34672 if (is(pathString, "array") && is(pathString[0], "array")) { // rough
34674 data = Snap.path.clone(pathString);
34676 if (!data.length) {
34677 Str(pathString).replace(pathCommand, function(a, b, c) {
34679 name = b.toLowerCase();
34680 c.replace(pathValues, function(a, b) {
34681 b && params.push(+b);
34683 if (name == "m" && params.length > 2) {
34684 data.push([b].concat(params.splice(0, 2)));
34686 b = b == "m" ? "l" : "L";
34688 if (name == "o" && params.length == 1) {
34689 data.push([b, params[0]]);
34692 data.push([b].concat(params));
34694 while (params.length >= paramCounts[name]) {
34695 data.push([b].concat(params.splice(0, paramCounts[name])));
34696 if (!paramCounts[name]) {
34702 data.toString = Snap.path.toString;
34703 pth.arr = Snap.path.clone(data);
34707 * \ Snap.parseTransformString [ method ] * Utility method * Parses given
34708 * transform string into an array of transformations - TString (string|array)
34709 * transform string or array of transformations (in the last case it is returned
34710 * straight away) = (array) array of transformations \
34712 var parseTransformString = Snap.parseTransformString = function(TString) {
34716 var paramCounts = {
34723 if (is(TString, "array") && is(TString[0], "array")) { // rough assumption
34724 data = Snap.path.clone(TString);
34726 if (!data.length) {
34727 Str(TString).replace(tCommand, function(a, b, c) {
34729 name = b.toLowerCase();
34730 c.replace(pathValues, function(a, b) {
34731 b && params.push(+b);
34733 data.push([b].concat(params));
34736 data.toString = Snap.path.toString;
34740 function svgTransform2string(tstr) {
34742 tstr = tstr.replace(/(?:^|\s)(\w+)\(([^)]+)\)/g, function(all, name, params) {
34743 params = params.split(/\s*,\s*|\s+/);
34744 if (name == "rotate" && params.length == 1) {
34747 if (name == "scale") {
34748 if (params.length > 2) {
34749 params = params.slice(0, 2);
34750 } else if (params.length == 2) {
34753 if (params.length == 1) {
34754 params.push(params[0], 0, 0);
34757 if (name == "skewX") {
34758 res.push(["m", 1, 0, math.tan(rad(params[0])), 1, 0, 0]);
34759 } else if (name == "skewY") {
34760 res.push(["m", 1, math.tan(rad(params[0])), 0, 1, 0, 0]);
34762 res.push([name.charAt(0)].concat(params));
34768 Snap._.svgTransform2string = svgTransform2string;
34769 Snap._.rgTransform = /^[a-z][\s]*-?\.?\d/i;
34771 function transform2matrix(tstr, bbox) {
34772 var tdata = parseTransformString(tstr),
34773 m = new Snap.Matrix;
34775 for (var i = 0, ii = tdata.length; i < ii; i++) {
34778 command = Str(t[0]).toLowerCase(),
34779 absolute = t[0] != command,
34780 inver = absolute ? m.invert() : 0,
34786 if (command == "t" && tlen == 2) {
34787 m.translate(t[1], 0);
34788 } else if (command == "t" && tlen == 3) {
34790 x1 = inver.x(0, 0);
34791 y1 = inver.y(0, 0);
34792 x2 = inver.x(t[1], t[2]);
34793 y2 = inver.y(t[1], t[2]);
34794 m.translate(x2 - x1, y2 - y1);
34796 m.translate(t[1], t[2]);
34798 } else if (command == "r") {
34801 m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2);
34802 } else if (tlen == 4) {
34804 x2 = inver.x(t[2], t[3]);
34805 y2 = inver.y(t[2], t[3]);
34806 m.rotate(t[1], x2, y2);
34808 m.rotate(t[1], t[2], t[3]);
34811 } else if (command == "s") {
34812 if (tlen == 2 || tlen == 3) {
34814 m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2);
34815 } else if (tlen == 4) {
34817 x2 = inver.x(t[2], t[3]);
34818 y2 = inver.y(t[2], t[3]);
34819 m.scale(t[1], t[1], x2, y2);
34821 m.scale(t[1], t[1], t[2], t[3]);
34823 } else if (tlen == 5) {
34825 x2 = inver.x(t[3], t[4]);
34826 y2 = inver.y(t[3], t[4]);
34827 m.scale(t[1], t[2], x2, y2);
34829 m.scale(t[1], t[2], t[3], t[4]);
34832 } else if (command == "m" && tlen == 7) {
34833 m.add(t[1], t[2], t[3], t[4], t[5], t[6]);
34839 Snap._.transform2matrix = transform2matrix;
34840 Snap._unit2px = unit2px;
34841 var contains = glob.doc.contains || glob.doc.compareDocumentPosition ?
34843 var adown = a.nodeType == 9 ? a.documentElement : a,
34844 bup = b && b.parentNode;
34845 return a == bup || !!(bup && bup.nodeType == 1 && (
34847 adown.contains(bup) :
34848 a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
34863 function getSomeDefs(el) {
34864 var p = (el.node.ownerSVGElement && wrap(el.node.ownerSVGElement)) ||
34865 (el.node.parentNode && wrap(el.node.parentNode)) ||
34866 Snap.select("svg") ||
34868 pdefs = p.select("defs"),
34869 defs = pdefs == null ? false : pdefs.node;
34871 defs = make("defs", p.node).node;
34876 function getSomeSVG(el) {
34877 return el.node.ownerSVGElement && wrap(el.node.ownerSVGElement) || Snap.select("svg");
34879 Snap._.getSomeDefs = getSomeDefs;
34880 Snap._.getSomeSVG = getSomeSVG;
34882 function unit2px(el, name, value) {
34883 var svg = getSomeSVG(el).node,
34885 mgr = svg.querySelector(".svg---mgr");
34893 "class": "svg---mgr",
34896 svg.appendChild(mgr);
34899 function getW(val) {
34910 return mgr.getBBox().width;
34916 function getH(val) {
34927 return mgr.getBBox().height;
34933 function set(nam, f) {
34934 if (name == null) {
34935 out[nam] = f(el.attr(nam) || 0);
34936 } else if (nam == name) {
34937 out = f(value == null ? el.attr(nam) || 0 : value);
34945 set("width", getW);
34946 set("height", getH);
34970 set("markerWidth", getW);
34972 set("markerHeight", getH);
34974 case "radialGradient":
34985 svg.removeChild(mgr);
34989 * \ Snap.select [ method ] * Wraps a DOM element specified by CSS selector as
34990 * @Element - query (string) CSS selector of the element = (Element) the current
34993 Snap.select = function(query) {
34994 query = Str(query).replace(/([^\\]):/g, "$1\\:");
34995 return wrap(glob.doc.querySelector(query));
34998 * \ Snap.selectAll [ method ] * Wraps DOM elements specified by CSS selector as
34999 * set or array of @Element - query (string) CSS selector of the element =
35000 * (Element) the current element \
35002 Snap.selectAll = function(query) {
35003 var nodelist = glob.doc.querySelectorAll(query),
35004 set = (Snap.set || Array)();
35005 for (var i = 0; i < nodelist.length; i++) {
35006 set.push(wrap(nodelist[i]));
35011 function add2group(list) {
35012 if (!is(list, "array")) {
35013 list = Array.prototype.slice.call(arguments, 0);
35018 while (this[i]) delete this[i++];
35019 for (i = 0; i < list.length; i++) {
35020 if (list[i].type == "set") {
35021 list[i].forEach(function(el) {
35022 node.appendChild(el.node);
35025 node.appendChild(list[i].node);
35028 var children = node.childNodes;
35029 for (i = 0; i < children.length; i++) {
35030 this[j++] = wrap(children[i]);
35034 // Hub garbage collector every 10s
35035 setInterval(function() {
35036 for (var key in hub)
35037 if (hub[has](key)) {
35040 if (el.type != "svg" && !node.ownerSVGElement || el.type == "svg" && (!node.parentNode || "ownerSVGElement" in node.parentNode && !node.ownerSVGElement)) {
35046 function Element(el) {
35047 if (el.snap in hub) {
35048 return hub[el.snap];
35052 svg = el.ownerSVGElement;
35055 * \ Element.node [ property (object) ] * Gives you a reference to the DOM
35056 * object, so you can assign event handlers or just mess around. > Usage | //
35057 * draw a circle at coordinate 10,10 with radius of 10 | var c =
35058 * paper.circle(10, 10, 10); | c.node.onclick = function () { |
35059 * c.attr("fill", "red"); | }; \
35063 this.paper = new Paper(svg);
35066 * \ Element.type [ property (string) ] * SVG tag name of the given element. \
35068 this.type = el.tagName;
35069 var id = this.id = ID(this);
35076 if (this.type == "g") {
35077 this.add = add2group;
35085 for (var method in Paper.prototype)
35086 if (Paper.prototype[has](method)) {
35087 this[method] = Paper.prototype[method];
35092 * \ Element.attr [ method ] * Gets or sets given attributes of the element. * -
35093 * params (object) contains key-value pairs of attributes you want to set or -
35094 * param (string) name of the attribute = (Element) the current element or =
35095 * (string) value of attribute > Usage | el.attr({ | fill: "#fc0", | stroke:
35096 * "#000", | strokeWidth: 2, // CamelCase... | "fill-opacity": 0.5, // or
35097 * dash-separated names | width: "*=2" // prefixed values | }); |
35098 * console.log(el.attr("fill")); // #fc0 Prefixed values in format `"+=10"`
35099 * supported. All four operations (`+`, `-`, `*` and `/`) could be used.
35100 * Optionally you can use units for `+` and `-`: `"+=2em"`. \
35102 Element.prototype.attr = function(params, value) {
35108 if (is(params, "string")) {
35109 if (arguments.length > 1) {
35111 json[params] = value;
35114 return eve("snap.util.getattr." + params, el).firstDefined();
35117 for (var att in params) {
35118 if (params[has](att)) {
35119 eve("snap.util.attr." + att, el, params[att]);
35125 * \ Snap.parse [ method ] * Parses SVG fragment and converts it into a
35126 * @Fragment * - svg (string) SVG string = (Fragment) the @Fragment \
35128 Snap.parse = function(svg) {
35129 var f = glob.doc.createDocumentFragment(),
35131 div = glob.doc.createElement("div");
35133 if (!svg.match(/^\s*<\s*svg(?:\s|>)/)) {
35134 svg = "<svg>" + svg + "</svg>";
35137 div.innerHTML = svg;
35138 svg = div.getElementsByTagName("svg")[0];
35143 while (svg.firstChild) {
35144 f.appendChild(svg.firstChild);
35149 return new Fragment(f);
35152 function Fragment(frag) {
35155 // SIERRA Snap.fragment() could especially use a code example
35157 * \ Snap.fragment [ method ] * Creates a DOM fragment from a given list of
35158 * elements or strings * - varargs (…) SVG string = (Fragment) the
35161 Snap.fragment = function() {
35162 var args = Array.prototype.slice.call(arguments, 0),
35163 f = glob.doc.createDocumentFragment();
35164 for (var i = 0, ii = args.length; i < ii; i++) {
35165 var item = args[i];
35166 if (item.node && item.node.nodeType) {
35167 f.appendChild(item.node);
35169 if (item.nodeType) {
35170 f.appendChild(item);
35172 if (typeof item == "string") {
35173 f.appendChild(Snap.parse(item).node);
35176 return new Fragment(f);
35179 function make(name, parent) {
35181 parent.appendChild(res);
35182 var el = wrap(res);
35186 function Paper(w, h) {
35190 proto = Paper.prototype;
35191 if (w && w.tagName == "svg") {
35192 if (w.snap in hub) {
35193 return hub[w.snap];
35195 var doc = w.ownerDocument;
35196 res = new Element(w);
35197 desc = w.getElementsByTagName("desc")[0];
35198 defs = w.getElementsByTagName("defs")[0];
35201 desc.appendChild(doc.createTextNode("Created with Snap"));
35202 res.node.appendChild(desc);
35206 res.node.appendChild(defs);
35209 for (var key in proto)
35210 if (proto[has](key)) {
35211 res[key] = proto[key];
35213 res.paper = res.root = res;
35215 res = make("svg", glob.doc.body);
35226 function wrap(dom) {
35230 if (dom instanceof Element || dom instanceof Fragment) {
35233 if (dom.tagName && dom.tagName.toLowerCase() == "svg") {
35234 return new Paper(dom);
35236 if (dom.tagName && dom.tagName.toLowerCase() == "object" && dom.type == "image/svg+xml") {
35237 return new Paper(dom.contentDocument.getElementsByTagName("svg")[0]);
35239 return new Element(dom);
35242 Snap._.make = make;
35243 Snap._.wrap = wrap;
35245 * \ Paper.el [ method ] * Creates an element on paper with a given name and no
35246 * attributes * - name (string) tag name - attr (object) attributes = (Element)
35247 * the current element > Usage | var c = paper.circle(10, 10, 10); // is the
35248 * same as... | var c = paper.el("circle").attr({ | cx: 10, | cy: 10, | r: 10 |
35249 * }); | // and the same as | var c = paper.el("circle", { | cx: 10, | cy: 10, |
35252 Paper.prototype.el = function(name, attr) {
35253 var el = make(name, this.node);
35254 attr && el.attr(attr);
35258 eve.on("snap.util.getattr", function() {
35259 var att = eve.nt();
35260 att = att.substring(att.lastIndexOf(".") + 1);
35261 var css = att.replace(/[A-Z]/g, function(letter) {
35262 return "-" + letter.toLowerCase();
35264 if (cssAttr[has](css)) {
35265 return this.node.ownerDocument.defaultView.getComputedStyle(this.node, null).getPropertyValue(css);
35267 return $(this.node, att);
35271 "alignment-baseline": 0,
35272 "baseline-shift": 0,
35277 "color-interpolation": 0,
35278 "color-interpolation-filters": 0,
35279 "color-profile": 0,
35280 "color-rendering": 0,
35284 "dominant-baseline": 0,
35285 "enable-background": 0,
35291 "flood-opacity": 0,
35295 "font-size-adjust": 0,
35300 "glyph-orientation-horizontal": 0,
35301 "glyph-orientation-vertical": 0,
35302 "image-rendering": 0,
35304 "letter-spacing": 0,
35305 "lighting-color": 0,
35313 "pointer-events": 0,
35314 "shape-rendering": 0,
35318 "stroke-dasharray": 0,
35319 "stroke-dashoffset": 0,
35320 "stroke-linecap": 0,
35321 "stroke-linejoin": 0,
35322 "stroke-miterlimit": 0,
35323 "stroke-opacity": 0,
35326 "text-decoration": 0,
35327 "text-rendering": 0,
35334 eve.on("snap.util.attr", function(value) {
35335 var att = eve.nt(),
35337 att = att.substring(att.lastIndexOf(".") + 1);
35339 var style = att.replace(/-(\w)/gi, function(all, letter) {
35340 return letter.toUpperCase();
35342 css = att.replace(/[A-Z]/g, function(letter) {
35343 return "-" + letter.toLowerCase();
35345 if (cssAttr[has](css)) {
35346 this.node.style[style] = value == null ? E : value;
35348 $(this.node, attr);
35351 (function(proto) {}(Paper.prototype));
35355 * \ Snap.ajax [ method ] * Simple implementation of Ajax * - url (string) URL -
35356 * postData (object|string) data for post request - callback (function) callback -
35357 * scope (object) #optional scope of callback or - url (string) URL - callback
35358 * (function) callback - scope (object) #optional scope of callback =
35359 * (XMLHttpRequest) the XMLHttpRequest object, just in case \
35361 Snap.ajax = function(url, postData, callback, scope) {
35362 var req = new XMLHttpRequest,
35365 if (is(postData, "function")) {
35367 callback = postData;
35369 } else if (is(postData, "object")) {
35371 for (var key in postData)
35372 if (postData.hasOwnProperty(key)) {
35373 pd.push(encodeURIComponent(key) + "=" + encodeURIComponent(postData[key]));
35375 postData = pd.join("&");
35377 req.open((postData ? "POST" : "GET"), url, true);
35379 req.setRequestHeader("X-Requested-With", "XMLHttpRequest");
35380 req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
35383 eve.once("snap.ajax." + id + ".0", callback);
35384 eve.once("snap.ajax." + id + ".200", callback);
35385 eve.once("snap.ajax." + id + ".304", callback);
35387 req.onreadystatechange = function() {
35388 if (req.readyState != 4) return;
35389 eve("snap.ajax." + id + "." + req.status, scope, req);
35391 if (req.readyState == 4) {
35394 req.send(postData);
35399 * \ Snap.load [ method ] * Loads external SVG file as a @Fragment (see
35400 * @Snap.ajax for more advanced AJAX) * - url (string) URL - callback (function)
35401 * callback - scope (object) #optional scope of callback \
35403 Snap.load = function(url, callback, scope) {
35404 Snap.ajax(url, function(req) {
35405 var f = Snap.parse(req.responseText);
35406 scope ? callback.call(scope, f) : callback(f);
35409 var getOffset = function(elem) {
35410 var box = elem.getBoundingClientRect(),
35411 doc = elem.ownerDocument,
35413 docElem = doc.documentElement,
35414 clientTop = docElem.clientTop || body.clientTop || 0,
35415 clientLeft = docElem.clientLeft || body.clientLeft || 0,
35416 top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop) - clientTop,
35417 left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft;
35424 * \ Snap.getElementByPoint [ method ] * Returns you topmost element under given
35425 * point. * = (object) Snap element object - x (number) x coordinate from the
35426 * top left corner of the window - y (number) y coordinate from the top left
35427 * corner of the window > Usage | Snap.getElementByPoint(mouseX,
35428 * mouseY).attr({stroke: "#f00"}); \
35430 Snap.getElementByPoint = function(x, y) {
35432 svg = paper.canvas,
35433 target = glob.doc.elementFromPoint(x, y);
35434 if (glob.win.opera && target.tagName == "svg") {
35435 var so = getOffset(target),
35436 sr = target.createSVGRect();
35439 sr.width = sr.height = 1;
35440 var hits = target.getIntersectionList(sr, null);
35442 target = hits[hits.length - 1];
35448 return wrap(target);
35451 * \ Snap.plugin [ method ] * Let you write plugins. You pass in a function with
35452 * four arguments, like this: | Snap.plugin(function (Snap, Element, Paper,
35453 * global, Fragment) { | Snap.newmethod = function () {}; |
35454 * Element.prototype.newmethod = function () {}; | Paper.prototype.newmethod =
35455 * function () {}; | }); Inside the function you have access to all main objects
35456 * (and their prototypes). This allow you to extend anything you want. * - f
35457 * (function) your plugin body \
35459 Snap.plugin = function(f) {
35460 f(Snap, Element, Paper, glob, Fragment);
35462 glob.win.Snap = Snap;
35464 }(window || this));
35465 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
35467 // Licensed under the Apache License, Version 2.0 (the "License");
35468 // you may not use this file except in compliance with the License.
35469 // You may obtain a copy of the License at
35471 // http://www.apache.org/licenses/LICENSE-2.0
35473 // Unless required by applicable law or agreed to in writing, software
35474 // distributed under the License is distributed on an "AS IS" BASIS,
35475 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35476 // See the License for the specific language governing permissions and
35477 // limitations under the License.
35478 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
35479 var elproto = Element.prototype,
35482 unit2px = Snap._unit2px,
35484 make = Snap._.make,
35485 getSomeDefs = Snap._.getSomeDefs,
35486 has = "hasOwnProperty",
35487 wrap = Snap._.wrap;
35489 * \ Element.getBBox [ method ] * Returns the bounding box descriptor for
35490 * the given element * = (object) bounding box descriptor: o { o cx:
35491 * (number) x of the center, o cy: (number) x of the center, o h: (number)
35492 * height, o height: (number) height, o path: (string) path command for the
35493 * box, o r0: (number) radius of a circle that fully encloses the box, o r1:
35494 * (number) radius of the smallest circle that can be enclosed, o r2:
35495 * (number) radius of the largest circle that can be enclosed, o vb:
35496 * (string) box as a viewbox command, o w: (number) width, o width: (number)
35497 * width, o x2: (number) x of the right side, o x: (number) x of the left
35498 * side, o y2: (number) y of the bottom edge, o y: (number) y of the top
35501 elproto.getBBox = function(isWithoutTransform) {
35502 if (!Snap.Matrix || !Snap.path) {
35503 return this.node.getBBox();
35506 m = new Snap.Matrix;
35508 return Snap._.box();
35510 while (el.type == "use") {
35511 if (!isWithoutTransform) {
35512 m = m.add(el.transform().localMatrix.translate(el.attr("x") || 0, el.attr("y") || 0));
35517 var href = el.attr("xlink:href");
35518 el = el.original = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
35522 pathfinder = Snap.path.get[el.type] || Snap.path.get.deflt;
35524 if (isWithoutTransform) {
35525 _.bboxwt = pathfinder ? Snap.path.getBBox(el.realPath = pathfinder(el)) : Snap._.box(el.node.getBBox());
35526 return Snap._.box(_.bboxwt);
35528 el.realPath = pathfinder(el);
35529 el.matrix = el.transform().localMatrix;
35530 _.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
35531 return Snap._.box(_.bbox);
35534 // Firefox doesn’t give you bbox of hidden element
35535 return Snap._.box();
35538 var propString = function() {
35539 return this.string;
35542 function extractTransform(el, tstr) {
35543 if (tstr == null) {
35544 var doReturn = true;
35545 if (el.type == "linearGradient" || el.type == "radialGradient") {
35546 tstr = el.node.getAttribute("gradientTransform");
35547 } else if (el.type == "pattern") {
35548 tstr = el.node.getAttribute("patternTransform");
35550 tstr = el.node.getAttribute("transform");
35553 return new Snap.Matrix;
35555 tstr = Snap._.svgTransform2string(tstr);
35557 if (!Snap._.rgTransform.test(tstr)) {
35558 tstr = Snap._.svgTransform2string(tstr);
35560 tstr = Str(tstr).replace(/\.{3}|\u2026/g, el._.transform || E);
35562 if (is(tstr, "array")) {
35563 tstr = Snap.path ? Snap.path.toString.call(tstr) : Str(tstr);
35565 el._.transform = tstr;
35567 var m = Snap._.transform2matrix(tstr, el.getBBox(1));
35575 * \ Element.transform [ method ] * Gets or sets transformation of the
35576 * element * - tstr (string) transform string in Snap or SVG format =
35577 * (Element) the current element or = (object) transformation descriptor: o {
35578 * o string (string) transform string, o globalMatrix (Matrix) matrix of all
35579 * transformations applied to element or its parents, o localMatrix (Matrix)
35580 * matrix of transformations applied only to the element, o diffMatrix
35581 * (Matrix) matrix of difference between global and local transformations, o
35582 * global (string) global transformation as string, o local (string) local
35583 * transformation as string, o toString (function) returns `string` property
35586 elproto.transform = function(tstr) {
35588 if (tstr == null) {
35590 global = new Snap.Matrix(this.node.getCTM()),
35591 local = extractTransform(this),
35593 m = new Snap.Matrix,
35595 localString = local.toTransformString(),
35596 string = Str(local) == Str(this.matrix) ?
35597 Str(_.transform) : localString;
35598 while (papa.type != "svg" && (papa = papa.parent())) {
35599 ms.push(extractTransform(papa));
35607 globalMatrix: global,
35609 localMatrix: local,
35610 diffMatrix: global.clone().add(local.invert()),
35611 global: global.toTransformString(),
35612 total: m.toTransformString(),
35613 local: localString,
35614 toString: propString
35617 if (tstr instanceof Snap.Matrix) {
35618 this.matrix = tstr;
35619 this._.transform = tstr.toTransformString();
35621 extractTransform(this, tstr);
35625 if (this.type == "linearGradient" || this.type == "radialGradient") {
35627 gradientTransform: this.matrix
35629 } else if (this.type == "pattern") {
35631 patternTransform: this.matrix
35635 transform: this.matrix
35643 * \ Element.parent [ method ] * Returns the element's parent * = (Element)
35644 * the parent element \
35646 elproto.parent = function() {
35647 return wrap(this.node.parentNode);
35650 * \ Element.append [ method ] * Appends the given element to current one * -
35651 * el (Element|Set) element to append = (Element) the parent element \
35654 * \ Element.add [ method ] * See @Element.append \
35656 elproto.append = elproto.add = function(el) {
35658 if (el.type == "set") {
35660 el.forEach(function(el) {
35666 this.node.appendChild(el.node);
35667 el.paper = this.paper;
35672 * \ Element.appendTo [ method ] * Appends the current element to the given
35673 * one * - el (Element) parent element to append to = (Element) the child
35676 elproto.appendTo = function(el) {
35684 * \ Element.prepend [ method ] * Prepends the given element to the current
35685 * one * - el (Element) element to prepend = (Element) the parent element \
35687 elproto.prepend = function(el) {
35689 if (el.type == "set") {
35692 el.forEach(function(el) {
35703 var parent = el.parent();
35704 this.node.insertBefore(el.node, this.node.firstChild);
35705 this.add && this.add();
35706 el.paper = this.paper;
35707 this.parent() && this.parent().add();
35708 parent && parent.add();
35713 * \ Element.prependTo [ method ] * Prepends the current element to the
35714 * given one * - el (Element) parent element to prepend to = (Element) the
35717 elproto.prependTo = function(el) {
35723 * \ Element.before [ method ] * Inserts given element before the current
35724 * one * - el (Element) element to insert = (Element) the parent element \
35726 elproto.before = function(el) {
35727 if (el.type == "set") {
35729 el.forEach(function(el) {
35730 var parent = el.parent();
35731 it.node.parentNode.insertBefore(el.node, it.node);
35732 parent && parent.add();
35734 this.parent().add();
35738 var parent = el.parent();
35739 this.node.parentNode.insertBefore(el.node, this.node);
35740 this.parent() && this.parent().add();
35741 parent && parent.add();
35742 el.paper = this.paper;
35746 * \ Element.after [ method ] * Inserts given element after the current one * -
35747 * el (Element) element to insert = (Element) the parent element \
35749 elproto.after = function(el) {
35751 var parent = el.parent();
35752 if (this.node.nextSibling) {
35753 this.node.parentNode.insertBefore(el.node, this.node.nextSibling);
35755 this.node.parentNode.appendChild(el.node);
35757 this.parent() && this.parent().add();
35758 parent && parent.add();
35759 el.paper = this.paper;
35763 * \ Element.insertBefore [ method ] * Inserts the element after the given
35764 * one * - el (Element) element next to whom insert to = (Element) the
35767 elproto.insertBefore = function(el) {
35769 var parent = this.parent();
35770 el.node.parentNode.insertBefore(this.node, el.node);
35771 this.paper = el.paper;
35772 parent && parent.add();
35773 el.parent() && el.parent().add();
35777 * \ Element.insertAfter [ method ] * Inserts the element after the given
35778 * one * - el (Element) element next to whom insert to = (Element) the
35781 elproto.insertAfter = function(el) {
35783 var parent = this.parent();
35784 el.node.parentNode.insertBefore(this.node, el.node.nextSibling);
35785 this.paper = el.paper;
35786 parent && parent.add();
35787 el.parent() && el.parent().add();
35791 * \ Element.remove [ method ] * Removes element from the DOM = (Element)
35792 * the detached element \
35794 elproto.remove = function() {
35795 var parent = this.parent();
35796 this.node.parentNode && this.node.parentNode.removeChild(this.node);
35798 this.removed = true;
35799 parent && parent.add();
35803 * \ Element.select [ method ] * Gathers the nested @Element matching the
35804 * given set of CSS selectors * - query (string) CSS selector = (Element)
35805 * result of query selection \
35807 elproto.select = function(query) {
35808 query = Str(query).replace(/([^\\]):/g, "$1\\:");
35809 return wrap(this.node.querySelector(query));
35812 * \ Element.selectAll [ method ] * Gathers nested @Element objects matching
35813 * the given set of CSS selectors * - query (string) CSS selector =
35814 * (Set|array) result of query selection \
35816 elproto.selectAll = function(query) {
35817 var nodelist = this.node.querySelectorAll(query),
35818 set = (Snap.set || Array)();
35819 for (var i = 0; i < nodelist.length; i++) {
35820 set.push(wrap(nodelist[i]));
35825 * \ Element.asPX [ method ] * Returns given attribute of the element as a
35826 * `px` value (not %, em, etc.) * - attr (string) attribute name - value
35827 * (string) #optional attribute value = (Element) result of query selection \
35829 elproto.asPX = function(attr, value) {
35830 if (value == null) {
35831 value = this.attr(attr);
35833 return +unit2px(this, attr, value);
35835 // SIERRA Element.use(): I suggest adding a note about how to access the
35836 // original element the returned <use> instantiates. It's a part of SVG with
35837 // which ordinary web developers may be least familiar.
35839 * \ Element.use [ method ] * Creates a `<use>` element linked to the
35840 * current element * = (Element) the `<use>` element \
35842 elproto.use = function() {
35851 if (this.type == "linearGradient" || this.type == "radialGradient" ||
35852 this.type == "pattern") {
35853 use = make(this.type, this.node.parentNode);
35855 use = make("use", this.node.parentNode);
35858 "xlink:href": "#" + id
35860 use.original = this;
35864 function fixids(el) {
35865 var els = el.selectAll("*"),
35867 url = /^\s*url\(("|'|)(.*)\1\)\s*$/,
35871 function urltest(it, name) {
35872 var val = $(it.node, name);
35873 val = val && val.match(url);
35874 val = val && val[2];
35875 if (val && val.charAt() == "#") {
35876 val = val.substring(1);
35881 uses[val] = (uses[val] || []).concat(function(id) {
35883 attr[name] = URL(id);
35889 function linktest(it) {
35890 var val = $(it.node, "xlink:href");
35891 if (val && val.charAt() == "#") {
35892 val = val.substring(1);
35897 uses[val] = (uses[val] || []).concat(function(id) {
35898 it.attr("xlink:href", "#" + id);
35902 for (var i = 0, ii = els.length; i < ii; i++) {
35904 urltest(it, "fill");
35905 urltest(it, "stroke");
35906 urltest(it, "filter");
35907 urltest(it, "mask");
35908 urltest(it, "clip-path");
35910 var oldid = $(it.node, "id");
35921 for (i = 0, ii = ids.length; i < ii; i++) {
35922 var fs = uses[ids[i].old];
35924 for (var j = 0, jj = fs.length; j < jj; j++) {
35931 * \ Element.clone [ method ] * Creates a clone of the element and inserts
35932 * it after the element * = (Element) the clone \
35934 elproto.clone = function() {
35935 var clone = wrap(this.node.cloneNode(true));
35936 if ($(clone.node, "id")) {
35942 clone.insertAfter(this);
35946 * \ Element.toDefs [ method ] * Moves element to the shared `<defs>` area * =
35947 * (Element) the element \
35949 elproto.toDefs = function() {
35950 var defs = getSomeDefs(this);
35951 defs.appendChild(this.node);
35955 * \ Element.toPattern [ method ] * Creates a `<pattern>` element from the
35956 * current element * To create a pattern you have to specify the pattern
35957 * rect: - x (string|number) - y (string|number) - width (string|number) -
35958 * height (string|number) = (Element) the `<pattern>` element You can use
35959 * pattern later on as an argument for `fill` attribute: | var p =
35960 * paper.path("M10-5-10,15M15,0,0,15M0-5-20,15").attr({ | fill: "none", |
35961 * stroke: "#bada55", | strokeWidth: 5 | }).pattern(0, 0, 10, 10), | c =
35962 * paper.circle(200, 200, 100); | c.attr({ | fill: p | }); \
35964 elproto.pattern = elproto.toPattern = function(x, y, width, height) {
35965 var p = make("pattern", getSomeDefs(this));
35967 x = this.getBBox();
35969 if (is(x, "object") && "x" in x) {
35980 patternUnits: "userSpaceOnUse",
35982 viewBox: [x, y, width, height].join(" ")
35984 p.node.appendChild(this.node);
35987 // SIERRA Element.marker(): clarify what a reference point is. E.g., helps you
35988 // offset the object from its edge such as when centering it over a path.
35989 // SIERRA Element.marker(): I suggest the method should accept default reference
35990 // point values. Perhaps centered with (refX = width/2) and (refY = height/2)?
35991 // Also, couldn't it assume the element's current _width_ and _height_? And
35992 // please specify what _x_ and _y_ mean: offsets? If so, from where? Couldn't
35993 // they also be assigned default values?
35995 * \ Element.marker [ method ] * Creates a `<marker>` element from the
35996 * current element * To create a marker you have to specify the bounding
35997 * rect and reference point: - x (number) - y (number) - width (number) -
35998 * height (number) - refX (number) - refY (number) = (Element) the `<marker>`
35999 * element You can specify the marker later as an argument for
36000 * `marker-start`, `marker-end`, `marker-mid`, and `marker` attributes. The
36001 * `marker` attribute places the marker at every point along the path, and
36002 * `marker-mid` places them at every point except the start and end. \
36004 // TODO add usage for markers
36005 elproto.marker = function(x, y, width, height, refX, refY) {
36006 var p = make("marker", getSomeDefs(this));
36008 x = this.getBBox();
36010 if (is(x, "object") && "x" in x) {
36014 refX = x.refX || x.cx;
36015 refY = x.refY || x.cy;
36019 viewBox: [x, y, width, height].join(" "),
36020 markerWidth: width,
36021 markerHeight: height,
36027 p.node.appendChild(this.node);
36031 function slice(from, to, f) {
36032 return function(arr) {
36033 var res = arr.slice(from, to);
36034 if (res.length == 1) {
36037 return f ? f(res) : res;
36040 var Animation = function(attr, ms, easing, callback) {
36041 if (typeof easing == "function" && !easing.length) {
36043 easing = mina.linear;
36047 easing && (this.easing = easing);
36048 callback && (this.callback = callback);
36050 Snap._.Animation = Animation;
36052 * \ Snap.animation [ method ] * Creates an animation object * - attr
36053 * (object) attributes of final destination - duration (number) duration of
36054 * the animation, in milliseconds - easing (function) #optional one of
36055 * easing functions of @mina or custom one - callback (function) #optional
36056 * callback function that fires when animation ends = (object) animation
36059 Snap.animation = function(attr, ms, easing, callback) {
36060 return new Animation(attr, ms, easing, callback);
36063 * \ Element.inAnim [ method ] * Returns a set of animations that may be
36064 * able to manipulate the current element * = (object) in format: o { o anim
36065 * (object) animation object, o mina (object) @mina object, o curStatus
36066 * (number) 0..1 � status of the animation: 0 � just started,
36067 * 1 � just finished, o status (function) gets or sets the status of
36068 * the animation, o stop (function) stops the animation o } \
36070 elproto.inAnim = function() {
36073 for (var id in el.anims)
36074 if (el.anims[has](id)) {
36077 anim: new Animation(a._attrs, a.dur, a.easing, a._callback),
36079 curStatus: a.status(),
36080 status: function(val) {
36081 return a.status(val);
36092 * \ Snap.animate [ method ] * Runs generic animation of one number into
36093 * another with a caring function * - from (number|array) number or array of
36094 * numbers - to (number|array) number or array of numbers - setter
36095 * (function) caring function that accepts one number argument - duration
36096 * (number) duration, in milliseconds - easing (function) #optional easing
36097 * function from @mina or custom - callback (function) #optional callback
36098 * function to execute when animation ends = (object) animation object in
36099 * @mina format o { o id (string) animation id, consider it read-only, o
36100 * duration (function) gets or sets the duration of the animation, o easing
36101 * (function) easing, o speed (function) gets or sets the speed of the
36102 * animation, o status (function) gets or sets the status of the animation,
36103 * o stop (function) stops the animation o } | var rect = Snap().rect(0, 0,
36104 * 10, 10); | Snap.animate(0, 10, function (val) { | rect.attr({ | x: val |
36105 * }); | }, 1000); | // in given context is equivalent to | rect.animate({x:
36108 Snap.animate = function(from, to, setter, ms, easing, callback) {
36109 if (typeof easing == "function" && !easing.length) {
36111 easing = mina.linear;
36113 var now = mina.time(),
36114 anim = mina(from, to, now, now + ms, mina.time, setter, easing);
36115 callback && eve.once("mina.finish." + anim.id, callback);
36119 * \ Element.stop [ method ] * Stops all the animations for the current
36120 * element * = (Element) the current element \
36122 elproto.stop = function() {
36123 var anims = this.inAnim();
36124 for (var i = 0, ii = anims.length; i < ii; i++) {
36130 * \ Element.animate [ method ] * Animates the given attributes of the
36131 * element * - attrs (object) key-value pairs of destination attributes -
36132 * duration (number) duration of the animation in milliseconds - easing
36133 * (function) #optional easing function from @mina or custom - callback
36134 * (function) #optional callback function that executes when the animation
36135 * ends = (Element) the current element \
36137 elproto.animate = function(attrs, ms, easing, callback) {
36138 if (typeof easing == "function" && !easing.length) {
36140 easing = mina.linear;
36142 if (attrs instanceof Animation) {
36143 callback = attrs.callback;
36144 easing = attrs.easing;
36146 attrs = attrs.attr;
36153 for (var key in attrs)
36154 if (attrs[has](key)) {
36156 eq = el.equal(key, Str(attrs[key]));
36161 from = +el.attr(key);
36164 var len = is(from, "array") ? from.length : 1;
36165 keys[key] = slice(fkeys.length, fkeys.length + len, f);
36166 fkeys = fkeys.concat(from);
36167 tkeys = tkeys.concat(to);
36169 var now = mina.time(),
36170 anim = mina(fkeys, tkeys, now, now + ms, mina.time, function(val) {
36172 for (var key in keys)
36173 if (keys[has](key)) {
36174 attr[key] = keys[key](val);
36178 el.anims[anim.id] = anim;
36179 anim._attrs = attrs;
36180 anim._callback = callback;
36181 eve("snap.animcreated." + el.id, anim);
36182 eve.once("mina.finish." + anim.id, function() {
36183 delete el.anims[anim.id];
36184 callback && callback.call(el);
36186 eve.once("mina.stop." + anim.id, function() {
36187 delete el.anims[anim.id];
36193 * \ Element.data [ method ] * Adds or retrieves given value associated with
36194 * given key. (Don’t confuse with `data-` attributes)
36196 * See also @Element.removeData - key (string) key to store data - value
36197 * (any) #optional value to store = (object) @Element or, if value is not
36198 * specified: = (any) value > Usage | for (var i = 0, i < 5, i++) { |
36199 * paper.circle(10 + 15 * i, 10, 10) | .attr({fill: "#000"}) | .data("i", i) |
36200 * .click(function () { | alert(this.data("i")); | }); | } \
36202 elproto.data = function(key, value) {
36203 var data = eldata[this.id] = eldata[this.id] || {};
36204 if (arguments.length == 0) {
36205 eve("snap.data.get." + this.id, this, data, null);
36208 if (arguments.length == 1) {
36209 if (Snap.is(key, "object")) {
36212 this.data(i, key[i]);
36216 eve("snap.data.get." + this.id, this, data[key], key);
36220 eve("snap.data.set." + this.id, this, value, key);
36224 * \ Element.removeData [ method ] * Removes value associated with an
36225 * element by given key. If key is not provided, removes all the data of the
36226 * element. - key (string) #optional key = (object) @Element \
36228 elproto.removeData = function(key) {
36230 eldata[this.id] = {};
36232 eldata[this.id] && delete eldata[this.id][key];
36237 * \ Element.outerSVG [ method ] * Returns SVG code for the element,
36238 * equivalent to HTML's `outerHTML`.
36240 * See also @Element.innerSVG = (string) SVG code for the element \
36243 * \ Element.toString [ method ] * See @Element.outerSVG \
36245 elproto.outerSVG = elproto.toString = toString(1);
36247 * \ Element.innerSVG [ method ] * Returns SVG code for the element's
36248 * contents, equivalent to HTML's `innerHTML` = (string) SVG code for the
36251 elproto.innerSVG = toString();
36253 function toString(type) {
36254 return function() {
36255 var res = type ? "<" + this.type : "",
36256 attr = this.node.attributes,
36257 chld = this.node.childNodes;
36259 for (var i = 0, ii = attr.length; i < ii; i++) {
36260 res += " " + attr[i].name + '="' +
36261 attr[i].value.replace(/"/g, '\\"') + '"';
36265 type && (res += ">");
36266 for (i = 0, ii = chld.length; i < ii; i++) {
36267 if (chld[i].nodeType == 3) {
36268 res += chld[i].nodeValue;
36269 } else if (chld[i].nodeType == 1) {
36270 res += wrap(chld[i]).toString();
36273 type && (res += "</" + this.type + ">");
36275 type && (res += "/>");
36280 elproto.toDataURL = function() {
36281 if (window && window.btoa) {
36282 var bb = this.getBBox(),
36283 svg = Snap.format('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{width}" height="{height}" viewBox="{x} {y} {width} {height}">{contents}</svg>', {
36284 x: +bb.x.toFixed(3),
36285 y: +bb.y.toFixed(3),
36286 width: +bb.width.toFixed(3),
36287 height: +bb.height.toFixed(3),
36288 contents: this.outerSVG()
36290 return "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(svg)));
36294 * \ Fragment.select [ method ] * See @Element.select \
36296 Fragment.prototype.select = elproto.select;
36298 * \ Fragment.selectAll [ method ] * See @Element.selectAll \
36300 Fragment.prototype.selectAll = elproto.selectAll;
36303 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
36305 // Licensed under the Apache License, Version 2.0 (the "License");
36306 // you may not use this file except in compliance with the License.
36307 // You may obtain a copy of the License at
36309 // http://www.apache.org/licenses/LICENSE-2.0
36311 // Unless required by applicable law or agreed to in writing, software
36312 // distributed under the License is distributed on an "AS IS" BASIS,
36313 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36314 // See the License for the specific language governing permissions and
36315 // limitations under the License.
36316 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
36317 var objectToString = Object.prototype.toString,
36322 function Matrix(a, b, c, d, e, f) {
36323 if (b == null && objectToString.call(a) == "[object SVGMatrix]") {
36348 (function(matrixproto) {
36350 * \ Matrix.add [ method ] * Adds the given matrix to existing one - a
36351 * (number) - b (number) - c (number) - d (number) - e (number) - f
36352 * (number) or - matrix (object) @Matrix \
36354 matrixproto.add = function(a, b, c, d, e, f) {
36361 [this.a, this.c, this.e],
36362 [this.b, this.d, this.f],
36372 if (a && a instanceof Matrix) {
36380 for (x = 0; x < 3; x++) {
36381 for (y = 0; y < 3; y++) {
36383 for (z = 0; z < 3; z++) {
36384 res += m[x][z] * matrix[z][y];
36389 this.a = out[0][0];
36390 this.b = out[1][0];
36391 this.c = out[0][1];
36392 this.d = out[1][1];
36393 this.e = out[0][2];
36394 this.f = out[1][2];
36398 * \ Matrix.invert [ method ] * Returns an inverted version of the
36399 * matrix = (object) @Matrix \
36401 matrixproto.invert = function() {
36403 x = me.a * me.d - me.b * me.c;
36404 return new Matrix(me.d / x, -me.b / x, -me.c / x, me.a / x, (me.c * me.f - me.d * me.e) / x, (me.b * me.e - me.a * me.f) / x);
36407 * \ Matrix.clone [ method ] * Returns a copy of the matrix = (object)
36410 matrixproto.clone = function() {
36411 return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
36414 * \ Matrix.translate [ method ] * Translate the matrix - x (number)
36415 * horizontal offset distance - y (number) vertical offset distance \
36417 matrixproto.translate = function(x, y) {
36418 return this.add(1, 0, 0, 1, x, y);
36421 * \ Matrix.scale [ method ] * Scales the matrix - x (number) amount to
36422 * be scaled, with `1` resulting in no change - y (number) #optional
36423 * amount to scale along the vertical axis. (Otherwise `x` applies to
36424 * both axes.) - cx (number) #optional horizontal origin point from
36425 * which to scale - cy (number) #optional vertical origin point from
36426 * which to scale Default cx, cy is the middle point of the element. \
36428 matrixproto.scale = function(x, y, cx, cy) {
36429 y == null && (y = x);
36430 (cx || cy) && this.add(1, 0, 0, 1, cx, cy);
36431 this.add(x, 0, 0, y, 0, 0);
36432 (cx || cy) && this.add(1, 0, 0, 1, -cx, -cy);
36436 * \ Matrix.rotate [ method ] * Rotates the matrix - a (number) angle of
36437 * rotation, in degrees - x (number) horizontal origin point from which
36438 * to rotate - y (number) vertical origin point from which to rotate \
36440 matrixproto.rotate = function(a, x, y) {
36444 var cos = +math.cos(a).toFixed(9),
36445 sin = +math.sin(a).toFixed(9);
36446 this.add(cos, sin, -sin, cos, x, y);
36447 return this.add(1, 0, 0, 1, -x, -y);
36450 * \ Matrix.x [ method ] * Returns x coordinate for given point after
36451 * transformation described by the matrix. See also @Matrix.y - x
36452 * (number) - y (number) = (number) x \
36454 matrixproto.x = function(x, y) {
36455 return x * this.a + y * this.c + this.e;
36458 * \ Matrix.y [ method ] * Returns y coordinate for given point after
36459 * transformation described by the matrix. See also @Matrix.x - x
36460 * (number) - y (number) = (number) y \
36462 matrixproto.y = function(x, y) {
36463 return x * this.b + y * this.d + this.f;
36465 matrixproto.get = function(i) {
36466 return +this[Str.fromCharCode(97 + i)].toFixed(4);
36468 matrixproto.toString = function() {
36469 return "matrix(" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + ")";
36471 matrixproto.offset = function() {
36472 return [this.e.toFixed(4), this.f.toFixed(4)];
36476 return a[0] * a[0] + a[1] * a[1];
36479 function normalize(a) {
36480 var mag = math.sqrt(norm(a));
36481 a[0] && (a[0] /= mag);
36482 a[1] && (a[1] /= mag);
36485 * \ Matrix.determinant [ method ] * Finds determinant of the given
36486 * matrix. = (number) determinant \
36488 matrixproto.determinant = function() {
36489 return this.a * this.d - this.b * this.c;
36492 * \ Matrix.split [ method ] * Splits matrix into primitive
36493 * transformations = (object) in format: o dx (number) translation by x
36494 * o dy (number) translation by y o scalex (number) scale by x o scaley
36495 * (number) scale by y o shear (number) shear o rotate (number) rotation
36496 * in deg o isSimple (boolean) could it be represented via simple
36497 * transformations \
36499 matrixproto.split = function() {
36510 out.scalex = math.sqrt(norm(row[0]));
36513 out.shear = row[0][0] * row[1][0] + row[0][1] * row[1][1];
36514 row[1] = [row[1][0] - row[0][0] * out.shear, row[1][1] - row[0][1] * out.shear];
36516 out.scaley = math.sqrt(norm(row[1]));
36518 out.shear /= out.scaley;
36520 if (this.determinant() < 0) {
36521 out.scalex = -out.scalex;
36525 var sin = -row[0][1],
36528 out.rotate = Snap.deg(math.acos(cos));
36530 out.rotate = 360 - out.rotate;
36533 out.rotate = Snap.deg(math.asin(sin));
36536 out.isSimple = !+out.shear.toFixed(9) && (out.scalex.toFixed(9) == out.scaley.toFixed(9) || !out.rotate);
36537 out.isSuperSimple = !+out.shear.toFixed(9) && out.scalex.toFixed(9) == out.scaley.toFixed(9) && !out.rotate;
36538 out.noRotation = !+out.shear.toFixed(9) && !out.rotate;
36542 * \ Matrix.toTransformString [ method ] * Returns transform string that
36543 * represents given matrix = (string) transform string \
36545 matrixproto.toTransformString = function(shorter) {
36546 var s = shorter || this.split();
36547 if (!+s.shear.toFixed(9)) {
36548 s.scalex = +s.scalex.toFixed(4);
36549 s.scaley = +s.scaley.toFixed(4);
36550 s.rotate = +s.rotate.toFixed(4);
36551 return (s.dx || s.dy ? "t" + [+s.dx.toFixed(4), +s.dy.toFixed(4)] : E) +
36552 (s.scalex != 1 || s.scaley != 1 ? "s" + [s.scalex, s.scaley, 0, 0] : E) +
36553 (s.rotate ? "r" + [+s.rotate.toFixed(4), 0, 0] : E);
36555 return "m" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)];
36558 })(Matrix.prototype);
36560 * \ Snap.Matrix [ method ] * Matrix constructor, extend on your own risk.
36561 * To create matrices use @Snap.matrix. \
36563 Snap.Matrix = Matrix;
36565 * \ Snap.matrix [ method ] * Utility method * Returns a matrix based on the
36566 * given parameters - a (number) - b (number) - c (number) - d (number) - e
36567 * (number) - f (number) or - svgMatrix (SVGMatrix) = (object) @Matrix \
36569 Snap.matrix = function(a, b, c, d, e, f) {
36570 return new Matrix(a, b, c, d, e, f);
36573 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
36575 // Licensed under the Apache License, Version 2.0 (the "License");
36576 // you may not use this file except in compliance with the License.
36577 // You may obtain a copy of the License at
36579 // http://www.apache.org/licenses/LICENSE-2.0
36581 // Unless required by applicable law or agreed to in writing, software
36582 // distributed under the License is distributed on an "AS IS" BASIS,
36583 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36584 // See the License for the specific language governing permissions and
36585 // limitations under the License.
36586 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
36587 var has = "hasOwnProperty",
36588 make = Snap._.make,
36589 wrap = Snap._.wrap,
36591 getSomeDefs = Snap._.getSomeDefs,
36592 reURLValue = /^url\(#?([^)]+)\)$/,
36596 separator = Snap._.separator,
36598 // Attributes event handlers
36599 eve.on("snap.util.attr.mask", function(value) {
36600 if (value instanceof Element || value instanceof Fragment) {
36602 if (value instanceof Fragment && value.node.childNodes.length == 1) {
36603 value = value.node.firstChild;
36604 getSomeDefs(this).appendChild(value);
36605 value = wrap(value);
36607 if (value.type == "mask") {
36610 mask = make("mask", getSomeDefs(this));
36611 mask.node.appendChild(value.node);
36612 }!mask.node.id && $(mask.node, {
36620 (function(clipIt) {
36621 eve.on("snap.util.attr.clip", clipIt);
36622 eve.on("snap.util.attr.clip-path", clipIt);
36623 eve.on("snap.util.attr.clipPath", clipIt);
36624 }(function(value) {
36625 if (value instanceof Element || value instanceof Fragment) {
36627 if (value.type == "clipPath") {
36630 clip = make("clipPath", getSomeDefs(this));
36631 clip.node.appendChild(value.node);
36632 !clip.node.id && $(clip.node, {
36637 "clip-path": URL(clip.node.id || clip.id)
36642 function fillStroke(name) {
36643 return function(value) {
36645 if (value instanceof Fragment && value.node.childNodes.length == 1 &&
36646 (value.node.firstChild.tagName == "radialGradient" ||
36647 value.node.firstChild.tagName == "linearGradient" ||
36648 value.node.firstChild.tagName == "pattern")) {
36649 value = value.node.firstChild;
36650 getSomeDefs(this).appendChild(value);
36651 value = wrap(value);
36653 if (value instanceof Element) {
36654 if (value.type == "radialGradient" || value.type == "linearGradient" || value.type == "pattern") {
36655 if (!value.node.id) {
36660 var fill = URL(value.node.id);
36662 fill = value.attr(name);
36665 fill = Snap.color(value);
36667 var grad = Snap(getSomeDefs(this).ownerSVGElement).gradient(value);
36669 if (!grad.node.id) {
36674 fill = URL(grad.node.id);
36683 attrs[name] = fill;
36684 $(this.node, attrs);
36685 this.node.style[name] = E;
36688 eve.on("snap.util.attr.fill", fillStroke("fill"));
36689 eve.on("snap.util.attr.stroke", fillStroke("stroke"));
36690 var gradrg = /^([lr])(?:\(([^)]*)\))?(.*)$/i;
36691 eve.on("snap.util.grad.parse", function parseGrad(string) {
36692 string = Str(string);
36693 var tokens = string.match(gradrg);
36697 var type = tokens[1],
36698 params = tokens[2],
36700 params = params.split(/\s*,\s*/).map(function(el) {
36701 return +el == el ? +el : el;
36703 if (params.length == 1 && params[0] == 0) {
36706 stops = stops.split("-");
36707 stops = stops.map(function(el) {
36708 el = el.split(":");
36713 out.offset = parseFloat(el[1]);
36724 eve.on("snap.util.attr.d", function(value) {
36726 if (is(value, "array") && is(value[0], "array")) {
36727 value = Snap.path.toString.call(value);
36729 value = Str(value);
36730 if (value.match(/[ruo]/i)) {
36731 value = Snap.path.toAbsolute(value);
36737 eve.on("snap.util.attr.#text", function(value) {
36739 value = Str(value);
36740 var txt = glob.doc.createTextNode(value);
36741 while (this.node.firstChild) {
36742 this.node.removeChild(this.node.firstChild);
36744 this.node.appendChild(txt);
36746 eve.on("snap.util.attr.path", function(value) {
36752 eve.on("snap.util.attr.class", function(value) {
36754 this.node.className.baseVal = value;
36756 eve.on("snap.util.attr.viewBox", function(value) {
36758 if (is(value, "object") && "x" in value) {
36759 vb = [value.x, value.y, value.width, value.height].join(" ");
36760 } else if (is(value, "array")) {
36761 vb = value.join(" ");
36770 eve.on("snap.util.attr.transform", function(value) {
36771 this.transform(value);
36774 eve.on("snap.util.attr.r", function(value) {
36775 if (this.type == "rect") {
36783 eve.on("snap.util.attr.textpath", function(value) {
36785 if (this.type == "text") {
36787 if (!value && this.textPath) {
36788 tp = this.textPath;
36789 while (tp.node.firstChild) {
36790 this.node.appendChild(tp.node.firstChild);
36793 delete this.textPath;
36796 if (is(value, "string")) {
36797 var defs = getSomeDefs(this),
36798 path = wrap(defs.parentNode).path(value);
36799 defs.appendChild(path.node);
36805 value = wrap(value);
36806 if (value instanceof Element) {
36807 id = value.attr("id");
36817 tp = this.textPath;
36821 "xlink:href": "#" + id
36824 tp = $("textPath", {
36825 "xlink:href": "#" + id
36827 while (node.firstChild) {
36828 tp.appendChild(node.firstChild);
36830 node.appendChild(tp);
36831 this.textPath = wrap(tp);
36836 eve.on("snap.util.attr.text", function(value) {
36837 if (this.type == "text") {
36840 tuner = function(chunk) {
36841 var out = $("tspan");
36842 if (is(chunk, "array")) {
36843 for (var i = 0; i < chunk.length; i++) {
36844 out.appendChild(tuner(chunk[i]));
36847 out.appendChild(glob.doc.createTextNode(chunk));
36849 out.normalize && out.normalize();
36852 while (node.firstChild) {
36853 node.removeChild(node.firstChild);
36855 var tuned = tuner(value);
36856 while (tuned.firstChild) {
36857 node.appendChild(tuned.firstChild);
36863 function setFontSize(value) {
36865 if (value == +value) {
36868 this.node.style.fontSize = value;
36870 eve.on("snap.util.attr.fontSize", setFontSize)(-1);
36871 eve.on("snap.util.attr.font-size", setFontSize)(-1);
36874 eve.on("snap.util.getattr.transform", function() {
36876 return this.transform();
36878 eve.on("snap.util.getattr.textpath", function() {
36880 return this.textPath;
36884 function getter(end) {
36885 return function() {
36887 var style = glob.doc.defaultView.getComputedStyle(this.node, null).getPropertyValue("marker-" + end);
36888 if (style == "none") {
36891 return Snap(glob.doc.getElementById(style.match(reURLValue)[1]));
36896 function setter(end) {
36897 return function(value) {
36899 var name = "marker" + end.charAt(0).toUpperCase() + end.substring(1);
36900 if (value == "" || !value) {
36901 this.node.style[name] = "none";
36904 if (value.type == "marker") {
36905 var id = value.node.id;
36911 this.node.style[name] = URL(id);
36916 eve.on("snap.util.getattr.marker-end", getter("end"))(-1);
36917 eve.on("snap.util.getattr.markerEnd", getter("end"))(-1);
36918 eve.on("snap.util.getattr.marker-start", getter("start"))(-1);
36919 eve.on("snap.util.getattr.markerStart", getter("start"))(-1);
36920 eve.on("snap.util.getattr.marker-mid", getter("mid"))(-1);
36921 eve.on("snap.util.getattr.markerMid", getter("mid"))(-1);
36922 eve.on("snap.util.attr.marker-end", setter("end"))(-1);
36923 eve.on("snap.util.attr.markerEnd", setter("end"))(-1);
36924 eve.on("snap.util.attr.marker-start", setter("start"))(-1);
36925 eve.on("snap.util.attr.markerStart", setter("start"))(-1);
36926 eve.on("snap.util.attr.marker-mid", setter("mid"))(-1);
36927 eve.on("snap.util.attr.markerMid", setter("mid"))(-1);
36929 eve.on("snap.util.getattr.r", function() {
36930 if (this.type == "rect" && $(this.node, "rx") == $(this.node, "ry")) {
36932 return $(this.node, "rx");
36936 function textExtract(node) {
36938 var children = node.childNodes;
36939 for (var i = 0, ii = children.length; i < ii; i++) {
36940 var chi = children[i];
36941 if (chi.nodeType == 3) {
36942 out.push(chi.nodeValue);
36944 if (chi.tagName == "tspan") {
36945 if (chi.childNodes.length == 1 && chi.firstChild.nodeType == 3) {
36946 out.push(chi.firstChild.nodeValue);
36948 out.push(textExtract(chi));
36954 eve.on("snap.util.getattr.text", function() {
36955 if (this.type == "text" || this.type == "tspan") {
36957 var out = textExtract(this.node);
36958 return out.length == 1 ? out[0] : out;
36961 eve.on("snap.util.getattr.#text", function() {
36962 return this.node.textContent;
36964 eve.on("snap.util.getattr.viewBox", function() {
36966 var vb = $(this.node, "viewBox");
36968 vb = vb.split(separator);
36969 return Snap._.box(+vb[0], +vb[1], +vb[2], +vb[3]);
36974 eve.on("snap.util.getattr.points", function() {
36975 var p = $(this.node, "points");
36978 return p.split(separator);
36983 eve.on("snap.util.getattr.path", function() {
36984 var p = $(this.node, "d");
36988 eve.on("snap.util.getattr.class", function() {
36989 return this.node.className.baseVal;
36992 function getFontSize() {
36994 return this.node.style.fontSize;
36996 eve.on("snap.util.getattr.fontSize", getFontSize)(-1);
36997 eve.on("snap.util.getattr.font-size", getFontSize)(-1);
37000 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
37002 // Licensed under the Apache License, Version 2.0 (the "License");
37003 // you may not use this file except in compliance with the License.
37004 // You may obtain a copy of the License at
37006 // http://www.apache.org/licenses/LICENSE-2.0
37008 // Unless required by applicable law or agreed to in writing, software
37009 // distributed under the License is distributed on an "AS IS" BASIS,
37010 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37011 // See the License for the specific language governing permissions and
37012 // limitations under the License.
37013 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
37014 var proto = Paper.prototype,
37017 * \ Paper.rect [ method ]
37019 * Draws a rectangle * - x (number) x coordinate of the top left corner - y
37020 * (number) y coordinate of the top left corner - width (number) width -
37021 * height (number) height - rx (number) #optional horizontal radius for
37022 * rounded corners, default is 0 - ry (number) #optional vertical radius for
37023 * rounded corners, default is rx or 0 = (object) the `rect` element * >
37024 * Usage | // regular rectangle | var c = paper.rect(10, 10, 50, 50); | //
37025 * rectangle with rounded corners | var c = paper.rect(40, 40, 50, 50, 10); \
37027 proto.rect = function(x, y, w, h, rx, ry) {
37032 if (is(x, "object") && x == "[object Object]") {
37034 } else if (x != null) {
37046 return this.el("rect", attr);
37049 * \ Paper.circle [ method ] * Draws a circle * - x (number) x coordinate of
37050 * the centre - y (number) y coordinate of the centre - r (number) radius =
37051 * (object) the `circle` element * > Usage | var c = paper.circle(50, 50,
37054 proto.circle = function(cx, cy, r) {
37056 if (is(cx, "object") && cx == "[object Object]") {
37058 } else if (cx != null) {
37065 return this.el("circle", attr);
37068 var preload = (function() {
37069 function onerror() {
37070 this.parentNode.removeChild(this);
37072 return function(src, f) {
37073 var img = glob.doc.createElement("img"),
37074 body = glob.doc.body;
37075 img.style.cssText = "position:absolute;left:-9999em;top:-9999em";
37076 img.onload = function() {
37078 img.onload = img.onerror = null;
37079 body.removeChild(img);
37081 img.onerror = onerror;
37082 body.appendChild(img);
37088 * \ Paper.image [ method ] * Places an image on the surface * - src
37089 * (string) URI of the source image - x (number) x offset position - y
37090 * (number) y offset position - width (number) width of the image - height
37091 * (number) height of the image = (object) the `image` element or = (object)
37092 * Snap element object with type `image` * > Usage | var c =
37093 * paper.image("apple.png", 10, 10, 80, 80); \
37095 proto.image = function(src, x, y, width, height) {
37096 var el = this.el("image");
37097 if (is(src, "object") && "src" in src) {
37099 } else if (src != null) {
37102 preserveAspectRatio: "none"
37104 if (x != null && y != null) {
37108 if (width != null && height != null) {
37110 set.height = height;
37112 preload(src, function() {
37113 Snap._.$(el.node, {
37114 width: this.offsetWidth,
37115 height: this.offsetHeight
37119 Snap._.$(el.node, set);
37124 * \ Paper.ellipse [ method ] * Draws an ellipse * - x (number) x coordinate
37125 * of the centre - y (number) y coordinate of the centre - rx (number)
37126 * horizontal radius - ry (number) vertical radius = (object) the `ellipse`
37127 * element * > Usage | var c = paper.ellipse(50, 50, 40, 20); \
37129 proto.ellipse = function(cx, cy, rx, ry) {
37131 if (is(cx, "object") && cx == "[object Object]") {
37133 } else if (cx != null) {
37141 return this.el("ellipse", attr);
37143 // SIERRA Paper.path(): Unclear from the link what a Catmull-Rom curveto is,
37144 // and why it would make life any easier.
37146 * \ Paper.path [ method ] * Creates a `<path>` element using the given
37147 * string as the path's definition - pathString (string) #optional path
37148 * string in SVG format Path string consists of one-letter commands,
37149 * followed by comma seprarated arguments in numerical form. Example: |
37150 * "M10,20L30,40" This example features two commands: `M`, with arguments
37151 * `(10, 20)` and `L` with arguments `(30, 40)`. Uppercase letter commands
37152 * express coordinates in absolute terms, while lowercase commands express
37153 * them in relative terms from the most recently declared coordinates.
37154 * # <p>Here is short list of commands available, for more details see <a
37155 * href="http://www.w3.org/TR/SVG/paths.html#PathData" title="Details of a
37156 * path's data attribute's format are described in the SVG
37157 * specification.">SVG path string format</a> or <a
37158 * href="https://developer.mozilla.org/en/SVG/Tutorial/Paths">article about
37159 * path strings at MDN</a>.</p> # <table><thead><tr><th>Command</th><th>Name</th><th>Parameters</th></tr></thead><tbody> #
37160 * <tr><td>M</td><td>moveto</td><td>(x y)+</td></tr> # <tr><td>Z</td><td>closepath</td><td>(none)</td></tr> #
37161 * <tr><td>L</td><td>lineto</td><td>(x y)+</td></tr> # <tr><td>H</td><td>horizontal
37162 * lineto</td><td>x+</td></tr> # <tr><td>V</td><td>vertical lineto</td><td>y+</td></tr> #
37163 * <tr><td>C</td><td>curveto</td><td>(x1 y1 x2 y2 x y)+</td></tr> #
37164 * <tr><td>S</td><td>smooth curveto</td><td>(x2 y2 x y)+</td></tr> #
37165 * <tr><td>Q</td><td>quadratic Bézier curveto</td><td>(x1 y1 x
37166 * y)+</td></tr> # <tr><td>T</td><td>smooth quadratic Bézier
37167 * curveto</td><td>(x y)+</td></tr> # <tr><td>A</td><td>elliptical
37168 * arc</td><td>(rx ry x-axis-rotation large-arc-flag sweep-flag x y)+</td></tr> #
37169 * <tr><td>R</td><td><a
37170 * href="http://en.wikipedia.org/wiki/Catmull–Rom_spline#Catmull.E2.80.93Rom_spline">Catmull-Rom
37171 * curveto</a>*</td><td>x1 y1 (x y)+</td></tr></tbody></table> *
37172 * _Catmull-Rom curveto_ is a not standard SVG command and added to make
37173 * life easier. Note: there is a special case when a path consists of only
37174 * three commands: `M10,10R…z`. In this case the path connects back to
37175 * its starting point. > Usage | var c = paper.path("M10 10L90 90"); | //
37176 * draw a diagonal line: | // move to 10,10, line to 90,90 \
37178 proto.path = function(d) {
37180 if (is(d, "object") && !is(d, "array")) {
37187 return this.el("path", attr);
37190 * \ Paper.g [ method ] * Creates a group element * - varargs (…)
37191 * #optional elements to nest within the group = (object) the `g` element * >
37192 * Usage | var c1 = paper.circle(), | c2 = paper.rect(), | g = paper.g(c2,
37193 * c1); // note that the order of elements is different or | var c1 =
37194 * paper.circle(), | c2 = paper.rect(), | g = paper.g(); | g.add(c2, c1); \
37197 * \ Paper.group [ method ] * See @Paper.g \
37199 proto.group = proto.g = function(first) {
37202 if (arguments.length == 1 && first && !first.type) {
37204 } else if (arguments.length) {
37205 el.add(Array.prototype.slice.call(arguments, 0));
37210 * \ Paper.svg [ method ] * Creates a nested SVG element. - x (number)
37211 * @optional X of the element - y (number) @optional Y of the element -
37212 * width (number) @optional width of the element - height (number) @optional
37213 * height of the element - vbx (number) @optional viewbox X - vby (number)
37214 * @optional viewbox Y - vbw (number) @optional viewbox width - vbh (number)
37215 * @optional viewbox height * = (object) the `svg` element * \
37217 proto.svg = function(x, y, width, height, vbx, vby, vbw, vbh) {
37219 if (is(x, "object") && y == null) {
37228 if (width != null) {
37229 attrs.width = width;
37231 if (height != null) {
37232 attrs.height = height;
37234 if (vbx != null && vby != null && vbw != null && vbh != null) {
37235 attrs.viewBox = [vbx, vby, vbw, vbh];
37238 return this.el("svg", attrs);
37241 * \ Paper.mask [ method ] * Equivalent in behaviour to @Paper.g, except
37242 * it’s a mask. * = (object) the `mask` element * \
37244 proto.mask = function(first) {
37246 el = this.el("mask");
37247 if (arguments.length == 1 && first && !first.type) {
37249 } else if (arguments.length) {
37250 el.add(Array.prototype.slice.call(arguments, 0));
37255 * \ Paper.ptrn [ method ] * Equivalent in behaviour to @Paper.g, except
37256 * it’s a pattern. - x (number) @optional X of the element - y
37257 * (number) @optional Y of the element - width (number) @optional width of
37258 * the element - height (number) @optional height of the element - vbx
37259 * (number) @optional viewbox X - vby (number) @optional viewbox Y - vbw
37260 * (number) @optional viewbox width - vbh (number) @optional viewbox height * =
37261 * (object) the `pattern` element * \
37263 proto.ptrn = function(x, y, width, height, vx, vy, vw, vh) {
37264 if (is(x, "object")) {
37268 patternUnits: "userSpaceOnUse"
37276 if (width != null) {
37277 attr.width = width;
37279 if (height != null) {
37280 attr.height = height;
37282 if (vx != null && vy != null && vw != null && vh != null) {
37283 attr.viewBox = [vx, vy, vw, vh];
37286 return this.el("pattern", attr);
37289 * \ Paper.use [ method ] * Creates a <use> element. - id (string) @optional
37290 * id of element to link or - id (Element) @optional element to link * =
37291 * (object) the `use` element * \
37293 proto.use = function(id) {
37295 if (id instanceof Element) {
37296 if (!id.attr("id")) {
37301 id = id.attr("id");
37303 if (String(id).charAt() == "#") {
37304 id = id.substring(1);
37306 return this.el("use", {
37307 "xlink:href": "#" + id
37310 return Element.prototype.use.call(this);
37314 * \ Paper.symbol [ method ] * Creates a <symbol> element. - vbx (number)
37315 * @optional viewbox X - vby (number) @optional viewbox Y - vbw (number)
37316 * @optional viewbox width - vbh (number) @optional viewbox height =
37317 * (object) the `symbol` element * \
37319 proto.symbol = function(vx, vy, vw, vh) {
37321 if (vx != null && vy != null && vw != null && vh != null) {
37322 attr.viewBox = [vx, vy, vw, vh];
37325 return this.el("symbol", attr);
37328 * \ Paper.text [ method ] * Draws a text string * - x (number) x coordinate
37329 * position - y (number) y coordinate position - text (string|array) The
37330 * text string to draw or array of strings to nest within separate `<tspan>`
37331 * elements = (object) the `text` element * > Usage | var t1 =
37332 * paper.text(50, 50, "Snap"); | var t2 = paper.text(50, 50,
37333 * ["S","n","a","p"]); | // Text path usage | t1.attr({textpath:
37334 * "M10,10L100,100"}); | // or | var pth = paper.path("M10,10L100,100"); |
37335 * t1.attr({textpath: pth}); \
37337 proto.text = function(x, y, text) {
37339 if (is(x, "object")) {
37341 } else if (x != null) {
37348 return this.el("text", attr);
37351 * \ Paper.line [ method ] * Draws a line * - x1 (number) x coordinate
37352 * position of the start - y1 (number) y coordinate position of the start -
37353 * x2 (number) x coordinate position of the end - y2 (number) y coordinate
37354 * position of the end = (object) the `line` element * > Usage | var t1 =
37355 * paper.line(50, 50, 100, 100); \
37357 proto.line = function(x1, y1, x2, y2) {
37359 if (is(x1, "object")) {
37361 } else if (x1 != null) {
37369 return this.el("line", attr);
37372 * \ Paper.polyline [ method ] * Draws a polyline * - points (array) array
37373 * of points or - varargs (…) points = (object) the `polyline` element * >
37374 * Usage | var p1 = paper.polyline([10, 10, 100, 100]); | var p2 =
37375 * paper.polyline(10, 10, 100, 100); \
37377 proto.polyline = function(points) {
37378 if (arguments.length > 1) {
37379 points = Array.prototype.slice.call(arguments, 0);
37382 if (is(points, "object") && !is(points, "array")) {
37384 } else if (points != null) {
37389 return this.el("polyline", attr);
37392 * \ Paper.polygon [ method ] * Draws a polygon. See @Paper.polyline \
37394 proto.polygon = function(points) {
37395 if (arguments.length > 1) {
37396 points = Array.prototype.slice.call(arguments, 0);
37399 if (is(points, "object") && !is(points, "array")) {
37401 } else if (points != null) {
37406 return this.el("polygon", attr);
37411 // gradients' helpers
37412 function Gstops() {
37413 return this.selectAll("stop");
37416 function GaddStop(color, offset) {
37417 var stop = $("stop"),
37419 offset: +offset + "%"
37421 color = Snap.color(color);
37422 attr["stop-color"] = color.hex;
37423 if (color.opacity < 1) {
37424 attr["stop-opacity"] = color.opacity;
37427 this.node.appendChild(stop);
37431 function GgetBBox() {
37432 if (this.type == "linearGradient") {
37433 var x1 = $(this.node, "x1") || 0,
37434 x2 = $(this.node, "x2") || 1,
37435 y1 = $(this.node, "y1") || 0,
37436 y2 = $(this.node, "y2") || 0;
37437 return Snap._.box(x1, y1, math.abs(x2 - x1), math.abs(y2 - y1));
37439 var cx = this.node.cx || .5,
37440 cy = this.node.cy || .5,
37441 r = this.node.r || 0;
37442 return Snap._.box(cx - r, cy - r, r * 2, r * 2);
37446 function gradient(defs, str) {
37447 var grad = eve("snap.util.grad.parse", null, str).firstDefined(),
37452 grad.params.unshift(defs);
37453 if (grad.type.toLowerCase() == "l") {
37454 el = gradientLinear.apply(0, grad.params);
37456 el = gradientRadial.apply(0, grad.params);
37458 if (grad.type != grad.type.toLowerCase()) {
37460 gradientUnits: "userSpaceOnUse"
37463 var stops = grad.stops,
37464 len = stops.length,
37468 function seed(i, end) {
37469 var step = (end - start) / (i - j);
37470 for (var k = j; k < i; k++) {
37471 stops[k].offset = +(+start + step * (k - j)).toFixed(2);
37477 for (var i = 0; i < len; i++)
37478 if ("offset" in stops[i]) {
37479 seed(i, stops[i].offset);
37481 stops[len].offset = stops[len].offset || 100;
37482 seed(len, stops[len].offset);
37483 for (i = 0; i <= len; i++) {
37484 var stop = stops[i];
37485 el.addStop(stop.color, stop.offset);
37490 function gradientLinear(defs, x1, y1, x2, y2) {
37491 var el = Snap._.make("linearGradient", defs);
37493 el.addStop = GaddStop;
37494 el.getBBox = GgetBBox;
37506 function gradientRadial(defs, cx, cy, r, fx, fy) {
37507 var el = Snap._.make("radialGradient", defs);
37509 el.addStop = GaddStop;
37510 el.getBBox = GgetBBox;
37518 if (fx != null && fy != null) {
37527 * \ Paper.gradient [ method ] * Creates a gradient element * - gradient
37528 * (string) gradient descriptor > Gradient Descriptor The gradient
37529 * descriptor is an expression formatted as follows: `<type>(<coords>)<colors>`.
37530 * The `<type>` can be either linear or radial. The uppercase `L` or
37531 * `R` letters indicate absolute coordinates offset from the SVG
37532 * surface. Lowercase `l` or `r` letters indicate coordinates calculated
37533 * relative to the element to which the gradient is applied. Coordinates
37534 * specify a linear gradient vector as `x1`, `y1`, `x2`, `y2`, or a
37535 * radial gradient as `cx`, `cy`, `r` and optional `fx`, `fy` specifying
37536 * a focal point away from the center of the circle. Specify `<colors>`
37537 * as a list of dash-separated CSS color values. Each color may be
37538 * followed by a custom offset value, separated with a colon character. >
37539 * Examples Linear gradient, relative from top-left corner to
37540 * bottom-right corner, from black through red to white: | var g =
37541 * paper.gradient("l(0, 0, 1, 1)#000-#f00-#fff"); Linear gradient,
37542 * absolute from (0, 0) to (100, 100), from black through red at 25% to
37543 * white: | var g = paper.gradient("L(0, 0, 100,
37544 * 100)#000-#f00:25-#fff"); Radial gradient, relative from the center of
37545 * the element with radius half the width, from black to white: | var g =
37546 * paper.gradient("r(0.5, 0.5, 0.5)#000-#fff"); To apply the gradient: |
37547 * paper.circle(50, 50, 40).attr({ | fill: g | }); = (object) the
37548 * `gradient` element \
37550 proto.gradient = function(str) {
37551 return gradient(this.defs, str);
37553 proto.gradientLinear = function(x1, y1, x2, y2) {
37554 return gradientLinear(this.defs, x1, y1, x2, y2);
37556 proto.gradientRadial = function(cx, cy, r, fx, fy) {
37557 return gradientRadial(this.defs, cx, cy, r, fx, fy);
37560 * \ Paper.toString [ method ] * Returns SVG code for the @Paper =
37561 * (string) SVG code for the @Paper \
37563 proto.toString = function() {
37564 var doc = this.node.ownerDocument,
37565 f = doc.createDocumentFragment(),
37566 d = doc.createElement("div"),
37567 svg = this.node.cloneNode(true),
37570 d.appendChild(svg);
37572 xmlns: "http://www.w3.org/2000/svg"
37575 f.removeChild(f.firstChild);
37579 * \ Paper.toDataURL [ method ] * Returns SVG code for the @Paper as
37580 * Data URI string. = (string) Data URI string \
37582 proto.toDataURL = function() {
37583 if (window && window.btoa) {
37584 return "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(this)));
37588 * \ Paper.clear [ method ] * Removes all child nodes of the paper,
37591 proto.clear = function() {
37592 var node = this.node.firstChild,
37595 next = node.nextSibling;
37596 if (node.tagName != "defs") {
37597 node.parentNode.removeChild(node);
37609 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
37611 // Licensed under the Apache License, Version 2.0 (the "License");
37612 // you may not use this file except in compliance with the License.
37613 // You may obtain a copy of the License at
37615 // http://www.apache.org/licenses/LICENSE-2.0
37617 // Unless required by applicable law or agreed to in writing, software
37618 // distributed under the License is distributed on an "AS IS" BASIS,
37619 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37620 // See the License for the specific language governing permissions and
37621 // limitations under the License.
37622 Snap.plugin(function(Snap, Element, Paper, glob) {
37623 var elproto = Element.prototype,
37625 clone = Snap._.clone,
37626 has = "hasOwnProperty",
37627 p2s = /,?([a-z]),?/gi,
37628 toFloat = parseFloat,
37636 function paths(ps) {
37637 var p = paths.ps = paths.ps || {};
37645 setTimeout(function() {
37647 if (p[has](key) && key != ps) {
37649 !p[key].sleep && delete p[key];
37655 function box(x, y, width, height) {
37657 x = y = width = height = 0;
37675 cy: y + height / 2,
37676 r1: math.min(width, height) / 2,
37677 r2: math.max(width, height) / 2,
37678 r0: math.sqrt(width * width + height * height) / 2,
37679 path: rectPath(x, y, width, height),
37680 vb: [x, y, width, height].join(" ")
37684 function toString() {
37685 return this.join(",").replace(p2s, "$1");
37688 function pathClone(pathArray) {
37689 var res = clone(pathArray);
37690 res.toString = toString;
37694 function getPointAtSegmentLength(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
37695 if (length == null) {
37696 return bezlen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y);
37698 return findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y,
37699 getTotLen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length));
37703 function getLengthFactory(istotal, subpath) {
37705 return +(+val).toFixed(3);
37707 return Snap._.cacher(function(path, length, onlystart) {
37708 if (path instanceof Element) {
37709 path = path.attr("d");
37711 path = path2curve(path);
37712 var x, y, p, l, sp = "",
37716 for (var i = 0, ii = path.length; i < ii; i++) {
37722 l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
37723 if (len + l > length) {
37724 if (subpath && !subpaths.start) {
37725 point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
37727 "C" + O(point.start.x),
37737 subpaths.start = sp;
37740 O(point.y) + "C" + O(point.n.x),
37752 if (!istotal && !subpath) {
37753 point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
37761 sp += p.shift() + p;
37764 point = istotal ? len : subpath ? subpaths : findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1);
37766 }, null, Snap._.clone);
37768 var getTotalLength = getLengthFactory(1),
37769 getPointAtLength = getLengthFactory(),
37770 getSubpathsAtLength = getLengthFactory(0, 1);
37772 function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
37778 x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x,
37779 y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y,
37780 mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),
37781 my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),
37782 nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),
37783 ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),
37784 ax = t1 * p1x + t * c1x,
37785 ay = t1 * p1y + t * c1y,
37786 cx = t1 * c2x + t * p2x,
37787 cy = t1 * c2y + t * p2y,
37788 alpha = (90 - math.atan2(mx - nx, my - ny) * 180 / PI);
37789 // (mx > nx || my < ny) && (alpha += 180);
37813 function bezierBBox(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
37814 if (!Snap.is(p1x, "array")) {
37815 p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
37817 var bbox = curveDim.apply(null, p1x);
37821 bbox.max.x - bbox.min.x,
37822 bbox.max.y - bbox.min.y
37826 function isPointInsideBBox(bbox, x, y) {
37827 return x >= bbox.x &&
37828 x <= bbox.x + bbox.width &&
37830 y <= bbox.y + bbox.height;
37833 function isBBoxIntersect(bbox1, bbox2) {
37834 bbox1 = box(bbox1);
37835 bbox2 = box(bbox2);
37836 return isPointInsideBBox(bbox2, bbox1.x, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2) || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);
37839 function base3(t, p1, p2, p3, p4) {
37840 var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4,
37841 t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
37842 return t * t2 - 3 * p1 + 3 * p2;
37845 function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
37849 z = z > 1 ? 1 : z < 0 ? 0 : z;
37852 Tvalues = [-.1252, .1252, -.3678, .3678, -.5873, .5873, -.7699, .7699, -.9041, .9041, -.9816, .9816],
37853 Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472],
37855 for (var i = 0; i < n; i++) {
37856 var ct = z2 * Tvalues[i] + z2,
37857 xbase = base3(ct, x1, x2, x3, x4),
37858 ybase = base3(ct, y1, y2, y3, y4),
37859 comb = xbase * xbase + ybase * ybase;
37860 sum += Cvalues[i] * math.sqrt(comb);
37865 function getTotLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) {
37866 if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) {
37874 l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);
37875 while (abs(l - ll) > e) {
37877 t2 += (l < ll ? 1 : -1) * step;
37878 l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);
37883 function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
37885 mmax(x1, x2) < mmin(x3, x4) ||
37886 mmin(x1, x2) > mmax(x3, x4) ||
37887 mmax(y1, y2) < mmin(y3, y4) ||
37888 mmin(y1, y2) > mmax(y3, y4)
37892 var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4),
37893 ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4),
37894 denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
37896 if (!denominator) {
37899 var px = nx / denominator,
37900 py = ny / denominator,
37901 px2 = +px.toFixed(2),
37902 py2 = +py.toFixed(2);
37904 px2 < +mmin(x1, x2).toFixed(2) ||
37905 px2 > +mmax(x1, x2).toFixed(2) ||
37906 px2 < +mmin(x3, x4).toFixed(2) ||
37907 px2 > +mmax(x3, x4).toFixed(2) ||
37908 py2 < +mmin(y1, y2).toFixed(2) ||
37909 py2 > +mmax(y1, y2).toFixed(2) ||
37910 py2 < +mmin(y3, y4).toFixed(2) ||
37911 py2 > +mmax(y3, y4).toFixed(2)
37921 function inter(bez1, bez2) {
37922 return interHelper(bez1, bez2);
37925 function interCount(bez1, bez2) {
37926 return interHelper(bez1, bez2, 1);
37929 function interHelper(bez1, bez2, justCount) {
37930 var bbox1 = bezierBBox(bez1),
37931 bbox2 = bezierBBox(bez2);
37932 if (!isBBoxIntersect(bbox1, bbox2)) {
37933 return justCount ? 0 : [];
37935 var l1 = bezlen.apply(0, bez1),
37936 l2 = bezlen.apply(0, bez2),
37942 res = justCount ? 0 : [];
37943 for (var i = 0; i < n1 + 1; i++) {
37944 var p = findDotsAtSegment.apply(0, bez1.concat(i / n1));
37951 for (i = 0; i < n2 + 1; i++) {
37952 p = findDotsAtSegment.apply(0, bez2.concat(i / n2));
37959 for (i = 0; i < n1; i++) {
37960 for (var j = 0; j < n2; j++) {
37962 di1 = dots1[i + 1],
37964 dj1 = dots2[j + 1],
37965 ci = abs(di1.x - di.x) < .001 ? "y" : "x",
37966 cj = abs(dj1.x - dj.x) < .001 ? "y" : "x",
37967 is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
37969 if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) {
37972 xy[is.x.toFixed(4)] = is.y.toFixed(4);
37973 var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t),
37974 t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
37975 if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
37993 function pathIntersection(path1, path2) {
37994 return interPathHelper(path1, path2);
37997 function pathIntersectionNumber(path1, path2) {
37998 return interPathHelper(path1, path2, 1);
38001 function interPathHelper(path1, path2, justCount) {
38002 path1 = path2curve(path1);
38003 path2 = path2curve(path2);
38004 var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2,
38005 res = justCount ? 0 : [];
38006 for (var i = 0, ii = path1.length; i < ii; i++) {
38008 if (pi[0] == "M") {
38012 if (pi[0] == "C") {
38013 bez1 = [x1, y1].concat(pi.slice(1));
38017 bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
38021 for (var j = 0, jj = path2.length; j < jj; j++) {
38023 if (pj[0] == "M") {
38027 if (pj[0] == "C") {
38028 bez2 = [x2, y2].concat(pj.slice(1));
38032 bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];
38036 var intr = interHelper(bez1, bez2, justCount);
38040 for (var k = 0, kk = intr.length; k < kk; k++) {
38041 intr[k].segment1 = i;
38042 intr[k].segment2 = j;
38043 intr[k].bez1 = bez1;
38044 intr[k].bez2 = bez2;
38046 res = res.concat(intr);
38055 function isPointInsidePath(path, x, y) {
38056 var bbox = pathBBox(path);
38057 return isPointInsideBBox(bbox, x, y) &&
38058 interPathHelper(path, [
38060 ["H", bbox.x2 + 10]
38064 function pathBBox(path) {
38065 var pth = paths(path);
38067 return clone(pth.bbox);
38072 path = path2curve(path);
38078 for (var i = 0, ii = path.length; i < ii; i++) {
38086 var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
38087 X = X.concat(dim.min.x, dim.max.x);
38088 Y = Y.concat(dim.min.y, dim.max.y);
38093 var xmin = mmin.apply(0, X),
38094 ymin = mmin.apply(0, Y),
38095 xmax = mmax.apply(0, X),
38096 ymax = mmax.apply(0, Y),
38097 bb = box(xmin, ymin, xmax - xmin, ymax - ymin);
38098 pth.bbox = clone(bb);
38102 function rectPath(x, y, w, h, r) {
38105 ["M", +x + (+r), y],
38106 ["l", w - r * 2, 0],
38107 ["a", r, r, 0, 0, 1, r, r],
38108 ["l", 0, h - r * 2],
38109 ["a", r, r, 0, 0, 1, -r, r],
38110 ["l", r * 2 - w, 0],
38111 ["a", r, r, 0, 0, 1, -r, -r],
38112 ["l", 0, r * 2 - h],
38113 ["a", r, r, 0, 0, 1, r, -r],
38124 res.toString = toString;
38128 function ellipsePath(x, y, rx, ry, a) {
38129 if (a == null && ry == null) {
38137 var rad = Math.PI / 180,
38138 x1 = x + rx * Math.cos(-ry * rad),
38139 x2 = x + rx * Math.cos(-a * rad),
38140 y1 = y + rx * Math.sin(-ry * rad),
38141 y2 = y + rx * Math.sin(-a * rad),
38144 ["A", rx, rx, 0, +(a - ry > 180), 0, x2, y2]
38150 ["a", rx, ry, 0, 1, 1, 0, 2 * ry],
38151 ["a", rx, ry, 0, 1, 1, 0, -2 * ry],
38155 res.toString = toString;
38158 var unit2px = Snap._unit2px,
38160 path: function(el) {
38161 return el.attr("path");
38163 circle: function(el) {
38164 var attr = unit2px(el);
38165 return ellipsePath(attr.cx, attr.cy, attr.r);
38167 ellipse: function(el) {
38168 var attr = unit2px(el);
38169 return ellipsePath(attr.cx || 0, attr.cy || 0, attr.rx, attr.ry);
38171 rect: function(el) {
38172 var attr = unit2px(el);
38173 return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height, attr.rx, attr.ry);
38175 image: function(el) {
38176 var attr = unit2px(el);
38177 return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height);
38179 line: function(el) {
38180 return "M" + [el.attr("x1") || 0, el.attr("y1") || 0, el.attr("x2"), el.attr("y2")];
38182 polyline: function(el) {
38183 return "M" + el.attr("points");
38185 polygon: function(el) {
38186 return "M" + el.attr("points") + "z";
38188 deflt: function(el) {
38189 var bbox = el.node.getBBox();
38190 return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
38194 function pathToRelative(pathArray) {
38195 var pth = paths(pathArray),
38196 lowerCase = String.prototype.toLowerCase;
38198 return pathClone(pth.rel);
38200 if (!Snap.is(pathArray, "array") || !Snap.is(pathArray && pathArray[0], "array")) {
38201 pathArray = Snap.parsePathString(pathArray);
38209 if (pathArray[0][0] == "M") {
38210 x = pathArray[0][1];
38211 y = pathArray[0][2];
38215 res.push(["M", x, y]);
38217 for (var i = start, ii = pathArray.length; i < ii; i++) {
38218 var r = res[i] = [],
38220 if (pa[0] != lowerCase.call(pa[0])) {
38221 r[0] = lowerCase.call(pa[0]);
38229 r[6] = +(pa[6] - x).toFixed(3);
38230 r[7] = +(pa[7] - y).toFixed(3);
38233 r[1] = +(pa[1] - y).toFixed(3);
38239 for (var j = 1, jj = pa.length; j < jj; j++) {
38240 r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);
38245 if (pa[0] == "m") {
38249 for (var k = 0, kk = pa.length; k < kk; k++) {
38253 var len = res[i].length;
38254 switch (res[i][0]) {
38260 x += +res[i][len - 1];
38263 y += +res[i][len - 1];
38266 x += +res[i][len - 2];
38267 y += +res[i][len - 1];
38270 res.toString = toString;
38271 pth.rel = pathClone(res);
38275 function pathToAbsolute(pathArray) {
38276 var pth = paths(pathArray);
38278 return pathClone(pth.abs);
38280 if (!is(pathArray, "array") || !is(pathArray && pathArray[0], "array")) { // rough
38282 pathArray = Snap.parsePathString(pathArray);
38284 if (!pathArray || !pathArray.length) {
38296 if (pathArray[0][0] == "M") {
38297 x = +pathArray[0][1];
38298 y = +pathArray[0][2];
38302 res[0] = ["M", x, y];
38304 var crz = pathArray.length == 3 &&
38305 pathArray[0][0] == "M" &&
38306 pathArray[1][0].toUpperCase() == "R" &&
38307 pathArray[2][0].toUpperCase() == "Z";
38308 for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {
38312 if (pa0 != pa0.toUpperCase()) {
38313 r[0] = pa0.toUpperCase();
38331 var dots = [x, y].concat(pa.slice(1));
38332 for (var j = 2, jj = dots.length; j < jj; j++) {
38333 dots[j] = +dots[j] + x;
38334 dots[++j] = +dots[j] + y;
38337 res = res.concat(catmullRom2bezier(dots, crz));
38341 dots = ellipsePath(x, y, pa[1], pa[2]);
38342 dots.push(dots[0]);
38343 res = res.concat(dots);
38347 res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
38348 r = ["U"].concat(res[res.length - 1].slice(-2));
38354 for (j = 1, jj = pa.length; j < jj; j++) {
38355 r[j] = +pa[j] + ((j % 2) ? x : y);
38358 } else if (pa0 == "R") {
38359 dots = [x, y].concat(pa.slice(1));
38361 res = res.concat(catmullRom2bezier(dots, crz));
38362 r = ["R"].concat(pa.slice(-2));
38363 } else if (pa0 == "O") {
38365 dots = ellipsePath(x, y, pa[1], pa[2]);
38366 dots.push(dots[0]);
38367 res = res.concat(dots);
38368 } else if (pa0 == "U") {
38370 res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
38371 r = ["U"].concat(res[res.length - 1].slice(-2));
38373 for (var k = 0, kk = pa.length; k < kk; k++) {
38377 pa0 = pa0.toUpperCase();
38391 mx = r[r.length - 2];
38392 my = r[r.length - 1];
38394 x = r[r.length - 2];
38395 y = r[r.length - 1];
38399 res.toString = toString;
38400 pth.abs = pathClone(res);
38404 function l2c(x1, y1, x2, y2) {
38405 return [x1, y1, x2, y2, x2, y2];
38408 function q2c(x1, y1, ax, ay, x2, y2) {
38412 _13 * x1 + _23 * ax,
38413 _13 * y1 + _23 * ay,
38414 _13 * x2 + _23 * ax,
38415 _13 * y2 + _23 * ay,
38421 function a2c(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
38422 // for more information of where this math came from visit:
38423 // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
38424 var _120 = PI * 120 / 180,
38425 rad = PI / 180 * (+angle || 0),
38428 rotate = Snap._.cacher(function(x, y, rad) {
38429 var X = x * math.cos(rad) - y * math.sin(rad),
38430 Y = x * math.sin(rad) + y * math.cos(rad);
38437 xy = rotate(x1, y1, -rad);
38440 xy = rotate(x2, y2, -rad);
38443 var cos = math.cos(PI / 180 * angle),
38444 sin = math.sin(PI / 180 * angle),
38447 var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
38455 k = (large_arc_flag == sweep_flag ? -1 : 1) *
38456 math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),
38457 cx = k * rx * y / ry + (x1 + x2) / 2,
38458 cy = k * -ry * x / rx + (y1 + y2) / 2,
38459 f1 = math.asin(((y1 - cy) / ry).toFixed(9)),
38460 f2 = math.asin(((y2 - cy) / ry).toFixed(9));
38462 f1 = x1 < cx ? PI - f1 : f1;
38463 f2 = x2 < cx ? PI - f2 : f2;
38464 f1 < 0 && (f1 = PI * 2 + f1);
38465 f2 < 0 && (f2 = PI * 2 + f2);
38466 if (sweep_flag && f1 > f2) {
38469 if (!sweep_flag && f2 > f1) {
38479 if (abs(df) > _120) {
38483 f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
38484 x2 = cx + rx * math.cos(f2);
38485 y2 = cy + ry * math.sin(f2);
38486 res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
38489 var c1 = math.cos(f1),
38493 t = math.tan(df / 4),
38494 hx = 4 / 3 * rx * t,
38495 hy = 4 / 3 * ry * t,
38497 m2 = [x1 + hx * s1, y1 - hy * c1],
38498 m3 = [x2 + hx * s2, y2 - hy * c2],
38500 m2[0] = 2 * m1[0] - m2[0];
38501 m2[1] = 2 * m1[1] - m2[1];
38503 return [m2, m3, m4].concat(res);
38505 res = [m2, m3, m4].concat(res).join().split(",");
38507 for (var i = 0, ii = res.length; i < ii; i++) {
38508 newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
38514 function findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
38517 x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
38518 y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y
38522 // Returns bounding box of cubic bezier curve.
38524 // http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
38525 // Original version: NISHIO Hirokazu
38526 // Modifications: https://github.com/timo22345
38527 function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {
38533 a, b, c, t, t1, t2, b2ac, sqrtb2ac;
38534 for (var i = 0; i < 2; ++i) {
38536 b = 6 * x0 - 12 * x1 + 6 * x2;
38537 a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
38538 c = 3 * x1 - 3 * x0;
38540 b = 6 * y0 - 12 * y1 + 6 * y2;
38541 a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
38542 c = 3 * y1 - 3 * y0;
38544 if (abs(a) < 1e-12) {
38545 if (abs(b) < 1e-12) {
38549 if (0 < t && t < 1) {
38554 b2ac = b * b - 4 * c * a;
38555 sqrtb2ac = math.sqrt(b2ac);
38559 t1 = (-b + sqrtb2ac) / (2 * a);
38560 if (0 < t1 && t1 < 1) {
38563 t2 = (-b - sqrtb2ac) / (2 * a);
38564 if (0 < t2 && t2 < 1) {
38569 var x, y, j = tvalues.length,
38575 bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);
38576 bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);
38579 bounds[0][jlen] = x0;
38580 bounds[1][jlen] = y0;
38581 bounds[0][jlen + 1] = x3;
38582 bounds[1][jlen + 1] = y3;
38583 bounds[0].length = bounds[1].length = jlen + 2;
38588 x: mmin.apply(0, bounds[0]),
38589 y: mmin.apply(0, bounds[1])
38592 x: mmax.apply(0, bounds[0]),
38593 y: mmax.apply(0, bounds[1])
38598 function path2curve(path, path2) {
38599 var pth = !path2 && paths(path);
38600 if (!path2 && pth.curve) {
38601 return pathClone(pth.curve);
38603 var p = pathToAbsolute(path),
38604 p2 = path2 && pathToAbsolute(path2),
38625 processPath = function(path, d, pcom) {
38628 return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
38632 }) && (d.qx = d.qy = null);
38639 path = ["C"].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));
38642 if (pcom == "C" || pcom == "S") { // In "S" case we
38643 // have to take into
38645 // previous command
38647 nx = d.x * 2 - d.bx; // And reflect the
38649 ny = d.y * 2 - d.by; // command's control
38650 // point relative to
38653 } else { // or some else or
38658 path = ["C", nx, ny].concat(path.slice(1));
38661 if (pcom == "Q" || pcom == "T") { // In "T" case we
38662 // have to take into
38664 // previous command
38666 d.qx = d.x * 2 - d.qx; // And make a
38669 d.qy = d.y * 2 - d.qy; // to case "S".
38670 } else { // or something else
38675 path = ["C"].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
38680 path = ["C"].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
38683 path = ["C"].concat(l2c(d.x, d.y, path[1], path[2]));
38686 path = ["C"].concat(l2c(d.x, d.y, path[1], d.y));
38689 path = ["C"].concat(l2c(d.x, d.y, d.x, path[1]));
38692 path = ["C"].concat(l2c(d.x, d.y, d.X, d.Y));
38697 fixArc = function(pp, i) {
38698 if (pp[i].length > 7) {
38701 while (pi.length) {
38702 pcoms1[i] = "A"; // if created multiple C:s, their
38703 // original seg is saved
38704 p2 && (pcoms2[i] = "A"); // the same as above
38705 pp.splice(i++, 0, ["C"].concat(pi.splice(0, 6)));
38708 ii = mmax(p.length, p2 && p2.length || 0);
38711 fixM = function(path1, path2, a1, a2, i) {
38712 if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
38713 path2.splice(i, 0, ["M", a2.x, a2.y]);
38716 a1.x = path1[i][1];
38717 a1.y = path1[i][2];
38718 ii = mmax(p.length, p2 && p2.length || 0);
38721 pcoms1 = [], // path commands of original path p
38722 pcoms2 = [], // path commands of original path p2
38723 pfirst = "", // temporary holder for original path command
38724 pcom = ""; // holder for previous path command of original path
38725 for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {
38726 p[i] && (pfirst = p[i][0]); // save current path command
38728 if (pfirst != "C") // C is not saved yet, because it may be result
38731 pcoms1[i] = pfirst; // Save current path command
38732 i && (pcom = pcoms1[i - 1]); // Get previous path command
38735 p[i] = processPath(p[i], attrs, pcom); // Previous path command is
38736 // inputted to processPath
38738 if (pcoms1[i] != "A" && pfirst == "C") pcoms1[i] = "C"; // A is the
38741 // which may produce multiple C:s
38742 // so we have to make sure that C is also C in original path
38744 fixArc(p, i); // fixArc adds also the right amount of A:s to
38747 if (p2) { // the same procedures is done to p2
38748 p2[i] && (pfirst = p2[i][0]);
38749 if (pfirst != "C") {
38750 pcoms2[i] = pfirst;
38751 i && (pcom = pcoms2[i - 1]);
38753 p2[i] = processPath(p2[i], attrs2, pcom);
38755 if (pcoms2[i] != "A" && pfirst == "C") {
38761 fixM(p, p2, attrs, attrs2, i);
38762 fixM(p2, p, attrs2, attrs, i);
38764 seg2 = p2 && p2[i],
38765 seglen = seg.length,
38766 seg2len = p2 && seg2.length;
38767 attrs.x = seg[seglen - 2];
38768 attrs.y = seg[seglen - 1];
38769 attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;
38770 attrs.by = toFloat(seg[seglen - 3]) || attrs.y;
38771 attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);
38772 attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);
38773 attrs2.x = p2 && seg2[seg2len - 2];
38774 attrs2.y = p2 && seg2[seg2len - 1];
38777 pth.curve = pathClone(p);
38779 return p2 ? [p, p2] : p;
38782 function mapPath(path, matrix) {
38786 var x, y, i, j, ii, jj, pathi;
38787 path = path2curve(path);
38788 for (i = 0, ii = path.length; i < ii; i++) {
38790 for (j = 1, jj = pathi.length; j < jj; j += 2) {
38791 x = matrix.x(pathi[j], pathi[j + 1]);
38792 y = matrix.y(pathi[j], pathi[j + 1]);
38800 // http://schepers.cc/getting-to-the-point
38801 function catmullRom2bezier(crp, z) {
38803 for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {
38823 } else if (iLen - 4 == i) {
38828 } else if (iLen - 2 == i) {
38839 if (iLen - 4 == i) {
38848 d.push(["C", (-p[0].x + 6 * p[1].x + p[2].x) / 6, (-p[0].y + 6 * p[1].y + p[2].y) / 6, (p[1].x + 6 * p[2].x - p[3].x) / 6, (p[1].y + 6 * p[2].y - p[3].y) / 6,
38861 * \ Snap.path.getTotalLength [ method ] * Returns the length of the given
38862 * path in pixels * - path (string) SVG path string * = (number) length \
38864 Snap.path.getTotalLength = getTotalLength;
38866 * \ Snap.path.getPointAtLength [ method ] * Returns the coordinates of the
38867 * point located at the given length along the given path * - path (string)
38868 * SVG path string - length (number) length, in pixels, from the start of
38869 * the path, excluding non-rendering jumps * = (object) representation of
38870 * the point: o { o x: (number) x coordinate, o y: (number) y coordinate, o
38871 * alpha: (number) angle of derivative o } \
38873 Snap.path.getPointAtLength = getPointAtLength;
38875 * \ Snap.path.getSubpath [ method ] * Returns the subpath of a given path
38876 * between given start and end lengths * - path (string) SVG path string -
38877 * from (number) length, in pixels, from the start of the path to the start
38878 * of the segment - to (number) length, in pixels, from the start of the
38879 * path to the end of the segment * = (string) path string definition for
38882 Snap.path.getSubpath = function(path, from, to) {
38883 if (this.getTotalLength(path) - to < 1e-6) {
38884 return getSubpathsAtLength(path, from).end;
38886 var a = getSubpathsAtLength(path, to, 1);
38887 return from ? getSubpathsAtLength(a, from).end : a;
38890 * \ Element.getTotalLength [ method ] * Returns the length of the path in
38891 * pixels (only works for `path` elements) = (number) length \
38893 elproto.getTotalLength = function() {
38894 if (this.node.getTotalLength) {
38895 return this.node.getTotalLength();
38898 // SIERRA Element.getPointAtLength()/Element.getTotalLength(): If a <path>
38899 // is broken into different segments, is the jump distance to the new
38900 // coordinates set by the _M_ or _m_ commands calculated as part of the
38901 // path's total length?
38903 * \ Element.getPointAtLength [ method ] * Returns coordinates of the point
38904 * located at the given length on the given path (only works for `path`
38905 * elements) * - length (number) length, in pixels, from the start of the
38906 * path, excluding non-rendering jumps * = (object) representation of the
38907 * point: o { o x: (number) x coordinate, o y: (number) y coordinate, o
38908 * alpha: (number) angle of derivative o } \
38910 elproto.getPointAtLength = function(length) {
38911 return getPointAtLength(this.attr("d"), length);
38913 // SIERRA Element.getSubpath(): Similar to the problem for
38914 // Element.getPointAtLength(). Unclear how this would work for a segmented
38915 // path. Overall, the concept of _subpath_ and what I'm calling a _segment_
38916 // (series of non-_M_ or _Z_ commands) is unclear.
38918 * \ Element.getSubpath [ method ] * Returns subpath of a given element from
38919 * given start and end lengths (only works for `path` elements) * - from
38920 * (number) length, in pixels, from the start of the path to the start of
38921 * the segment - to (number) length, in pixels, from the start of the path
38922 * to the end of the segment * = (string) path string definition for the
38925 elproto.getSubpath = function(from, to) {
38926 return Snap.path.getSubpath(this.attr("d"), from, to);
38930 * \ Snap.path.findDotsAtSegment [ method ] * Utility method * Finds dot
38931 * coordinates on the given cubic beziér curve at the given t - p1x
38932 * (number) x of the first point of the curve - p1y (number) y of the first
38933 * point of the curve - c1x (number) x of the first anchor of the curve -
38934 * c1y (number) y of the first anchor of the curve - c2x (number) x of the
38935 * second anchor of the curve - c2y (number) y of the second anchor of the
38936 * curve - p2x (number) x of the second point of the curve - p2y (number) y
38937 * of the second point of the curve - t (number) position on the curve
38938 * (0..1) = (object) point information in format: o { o x: (number) x
38939 * coordinate of the point, o y: (number) y coordinate of the point, o m: {
38940 * o x: (number) x coordinate of the left anchor, o y: (number) y coordinate
38941 * of the left anchor o }, o n: { o x: (number) x coordinate of the right
38942 * anchor, o y: (number) y coordinate of the right anchor o }, o start: { o
38943 * x: (number) x coordinate of the start of the curve, o y: (number) y
38944 * coordinate of the start of the curve o }, o end: { o x: (number) x
38945 * coordinate of the end of the curve, o y: (number) y coordinate of the end
38946 * of the curve o }, o alpha: (number) angle of the curve derivative at the
38949 Snap.path.findDotsAtSegment = findDotsAtSegment;
38951 * \ Snap.path.bezierBBox [ method ] * Utility method * Returns the bounding
38952 * box of a given cubic beziér curve - p1x (number) x of the first point
38953 * of the curve - p1y (number) y of the first point of the curve - c1x
38954 * (number) x of the first anchor of the curve - c1y (number) y of the first
38955 * anchor of the curve - c2x (number) x of the second anchor of the curve -
38956 * c2y (number) y of the second anchor of the curve - p2x (number) x of the
38957 * second point of the curve - p2y (number) y of the second point of the
38958 * curve or - bez (array) array of six points for beziér curve = (object)
38959 * bounding box o { o x: (number) x coordinate of the left top point of the
38960 * box, o y: (number) y coordinate of the left top point of the box, o x2:
38961 * (number) x coordinate of the right bottom point of the box, o y2:
38962 * (number) y coordinate of the right bottom point of the box, o width:
38963 * (number) width of the box, o height: (number) height of the box o } \
38965 Snap.path.bezierBBox = bezierBBox;
38967 * \ Snap.path.isPointInsideBBox [ method ] * Utility method * Returns
38968 * `true` if given point is inside bounding box - bbox (string) bounding box -
38969 * x (string) x coordinate of the point - y (string) y coordinate of the
38970 * point = (boolean) `true` if point is inside \
38972 Snap.path.isPointInsideBBox = isPointInsideBBox;
38974 * \ Snap.path.isBBoxIntersect [ method ] * Utility method * Returns `true`
38975 * if two bounding boxes intersect - bbox1 (string) first bounding box -
38976 * bbox2 (string) second bounding box = (boolean) `true` if bounding boxes
38979 Snap.path.isBBoxIntersect = isBBoxIntersect;
38981 * \ Snap.path.intersection [ method ] * Utility method * Finds
38982 * intersections of two paths - path1 (string) path string - path2 (string)
38983 * path string = (array) dots of intersection o [ o { o x: (number) x
38984 * coordinate of the point, o y: (number) y coordinate of the point, o t1:
38985 * (number) t value for segment of path1, o t2: (number) t value for segment
38986 * of path2, o segment1: (number) order number for segment of path1, o
38987 * segment2: (number) order number for segment of path2, o bez1: (array)
38988 * eight coordinates representing beziér curve for the segment of path1,
38989 * o bez2: (array) eight coordinates representing beziér curve for the
38990 * segment of path2 o } o ] \
38992 Snap.path.intersection = pathIntersection;
38993 Snap.path.intersectionNumber = pathIntersectionNumber;
38995 * \ Snap.path.isPointInside [ method ] * Utility method * Returns `true` if
38996 * given point is inside a given closed path.
38998 * Note: fill mode doesn’t affect the result of this method. - path
38999 * (string) path string - x (number) x of the point - y (number) y of the
39000 * point = (boolean) `true` if point is inside the path \
39002 Snap.path.isPointInside = isPointInsidePath;
39004 * \ Snap.path.getBBox [ method ] * Utility method * Returns the bounding
39005 * box of a given path - path (string) path string = (object) bounding box o {
39006 * o x: (number) x coordinate of the left top point of the box, o y:
39007 * (number) y coordinate of the left top point of the box, o x2: (number) x
39008 * coordinate of the right bottom point of the box, o y2: (number) y
39009 * coordinate of the right bottom point of the box, o width: (number) width
39010 * of the box, o height: (number) height of the box o } \
39012 Snap.path.getBBox = pathBBox;
39013 Snap.path.get = getPath;
39015 * \ Snap.path.toRelative [ method ] * Utility method * Converts path
39016 * coordinates into relative values - path (string) path string = (array)
39019 Snap.path.toRelative = pathToRelative;
39021 * \ Snap.path.toAbsolute [ method ] * Utility method * Converts path
39022 * coordinates into absolute values - path (string) path string = (array)
39025 Snap.path.toAbsolute = pathToAbsolute;
39027 * \ Snap.path.toCubic [ method ] * Utility method * Converts path to a new
39028 * path where all segments are cubic beziér curves - pathString
39029 * (string|array) path string or array of segments = (array) array of
39032 Snap.path.toCubic = path2curve;
39034 * \ Snap.path.map [ method ] * Transform the path string with the given
39035 * matrix - path (string) path string - matrix (object) see @Matrix =
39036 * (string) transformed path string \
39038 Snap.path.map = mapPath;
39039 Snap.path.toString = toString;
39040 Snap.path.clone = pathClone;
39042 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
39044 // Licensed under the Apache License, Version 2.0 (the "License");
39045 // you may not use this file except in compliance with the License.
39046 // You may obtain a copy of the License at
39048 // http://www.apache.org/licenses/LICENSE-2.0
39050 // Unless required by applicable law or agreed to in writing, software
39051 // distributed under the License is distributed on an "AS IS" BASIS,
39052 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39053 // See the License for the specific language governing permissions and
39054 // limitations under the License.
39055 Snap.plugin(function(Snap, Element, Paper, glob) {
39056 var elproto = Element.prototype,
39057 has = "hasOwnProperty",
39058 supportsTouch = "createTouch" in glob.doc,
39060 "click", "dblclick", "mousedown", "mousemove", "mouseout",
39061 "mouseover", "mouseup", "touchstart", "touchmove", "touchend",
39062 "touchcancel", "keyup"
39065 mousedown: "touchstart",
39066 mousemove: "touchmove",
39067 mouseup: "touchend"
39069 getScroll = function(xy, el) {
39070 var name = xy == "y" ? "scrollTop" : "scrollLeft",
39071 doc = el && el.node ? el.node.ownerDocument : glob.doc;
39072 return doc[name in doc.documentElement ? "documentElement" : "body"][name];
39074 preventDefault = function() {
39075 this.returnValue = false;
39077 preventTouch = function() {
39078 return this.originalEvent.preventDefault();
39080 stopPropagation = function() {
39081 this.cancelBubble = true;
39083 stopTouch = function() {
39084 return this.originalEvent.stopPropagation();
39086 addEvent = (function() {
39087 if (glob.doc.addEventListener) {
39088 return function(obj, type, fn, element) {
39089 var realName = supportsTouch && touchMap[type] ? touchMap[type] : type,
39091 var scrollY = getScroll("y", element),
39092 scrollX = getScroll("x", element);
39093 if (supportsTouch && touchMap[has](type)) {
39094 for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {
39095 if (e.targetTouches[i].target == obj || obj.contains(e.targetTouches[i].target)) {
39097 e = e.targetTouches[i];
39098 e.originalEvent = olde;
39099 e.preventDefault = preventTouch;
39100 e.stopPropagation = stopTouch;
39105 var x = e.clientX + scrollX,
39106 y = e.clientY + scrollY;
39107 return fn.call(element, e, x, y);
39110 if (type !== realName) {
39111 obj.addEventListener(type, f, false);
39114 obj.addEventListener(realName, f, false);
39116 return function() {
39117 if (type !== realName) {
39118 obj.removeEventListener(type, f, false);
39121 obj.removeEventListener(realName, f, false);
39125 } else if (glob.doc.attachEvent) {
39126 return function(obj, type, fn, element) {
39127 var f = function(e) {
39128 e = e || element.node.ownerDocument.window.event;
39129 var scrollY = getScroll("y", element),
39130 scrollX = getScroll("x", element),
39131 x = e.clientX + scrollX,
39132 y = e.clientY + scrollY;
39133 e.preventDefault = e.preventDefault || preventDefault;
39134 e.stopPropagation = e.stopPropagation || stopPropagation;
39135 return fn.call(element, e, x, y);
39137 obj.attachEvent("on" + type, f);
39138 var detacher = function() {
39139 obj.detachEvent("on" + type, f);
39147 dragMove = function(e) {
39150 scrollY = getScroll("y"),
39151 scrollX = getScroll("x"),
39156 if (supportsTouch) {
39157 var i = e.touches && e.touches.length,
39160 touch = e.touches[i];
39161 if (touch.identifier == dragi.el._drag.id || dragi.el.node.contains(touch.target)) {
39164 (e.originalEvent ? e.originalEvent : e).preventDefault();
39169 e.preventDefault();
39171 var node = dragi.el.node,
39173 next = node.nextSibling,
39174 parent = node.parentNode,
39175 display = node.style.display;
39176 // glob.win.opera && parent.removeChild(node);
39177 // node.style.display = "none";
39178 // o = dragi.el.paper.getElementByPoint(x, y);
39179 // node.style.display = display;
39180 // glob.win.opera && (next ? parent.insertBefore(node, next) :
39181 // parent.appendChild(node));
39182 // o && eve("snap.drag.over." + dragi.el.id, dragi.el, o);
39185 eve("snap.drag.move." + dragi.el.id, dragi.move_scope || dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y, e);
39188 dragUp = function(e) {
39189 Snap.unmousemove(dragMove).unmouseup(dragUp);
39190 var i = drag.length,
39194 dragi.el._drag = {};
39195 eve("snap.drag.end." + dragi.el.id, dragi.end_scope || dragi.start_scope || dragi.move_scope || dragi.el, e);
39200 * \ Element.click [ method ] * Adds a click event handler to the element -
39201 * handler (function) handler for the event = (object) @Element \
39204 * \ Element.unclick [ method ] * Removes a click event handler from the
39205 * element - handler (function) handler for the event = (object) @Element \
39209 * \ Element.dblclick [ method ] * Adds a double click event handler to the
39210 * element - handler (function) handler for the event = (object) @Element \
39213 * \ Element.undblclick [ method ] * Removes a double click event handler
39214 * from the element - handler (function) handler for the event = (object)
39219 * \ Element.mousedown [ method ] * Adds a mousedown event handler to the
39220 * element - handler (function) handler for the event = (object) @Element \
39223 * \ Element.unmousedown [ method ] * Removes a mousedown event handler from
39224 * the element - handler (function) handler for the event = (object)
39229 * \ Element.mousemove [ method ] * Adds a mousemove event handler to the
39230 * element - handler (function) handler for the event = (object) @Element \
39233 * \ Element.unmousemove [ method ] * Removes a mousemove event handler from
39234 * the element - handler (function) handler for the event = (object)
39239 * \ Element.mouseout [ method ] * Adds a mouseout event handler to the
39240 * element - handler (function) handler for the event = (object) @Element \
39243 * \ Element.unmouseout [ method ] * Removes a mouseout event handler from
39244 * the element - handler (function) handler for the event = (object)
39249 * \ Element.mouseover [ method ] * Adds a mouseover event handler to the
39250 * element - handler (function) handler for the event = (object) @Element \
39253 * \ Element.unmouseover [ method ] * Removes a mouseover event handler from
39254 * the element - handler (function) handler for the event = (object)
39259 * \ Element.mouseup [ method ] * Adds a mouseup event handler to the
39260 * element - handler (function) handler for the event = (object) @Element \
39263 * \ Element.unmouseup [ method ] * Removes a mouseup event handler from the
39264 * element - handler (function) handler for the event = (object) @Element \
39268 * \ Element.touchstart [ method ] * Adds a touchstart event handler to the
39269 * element - handler (function) handler for the event = (object) @Element \
39272 * \ Element.untouchstart [ method ] * Removes a touchstart event handler
39273 * from the element - handler (function) handler for the event = (object)
39278 * \ Element.touchmove [ method ] * Adds a touchmove event handler to the
39279 * element - handler (function) handler for the event = (object) @Element \
39282 * \ Element.untouchmove [ method ] * Removes a touchmove event handler from
39283 * the element - handler (function) handler for the event = (object)
39288 * \ Element.touchend [ method ] * Adds a touchend event handler to the
39289 * element - handler (function) handler for the event = (object) @Element \
39292 * \ Element.untouchend [ method ] * Removes a touchend event handler from
39293 * the element - handler (function) handler for the event = (object)
39298 * \ Element.touchcancel [ method ] * Adds a touchcancel event handler to
39299 * the element - handler (function) handler for the event = (object)
39303 * \ Element.untouchcancel [ method ] * Removes a touchcancel event handler
39304 * from the element - handler (function) handler for the event = (object)
39307 for (var i = events.length; i--;) {
39308 (function(eventName) {
39309 Snap[eventName] = elproto[eventName] = function(fn, scope) {
39310 if (Snap.is(fn, "function")) {
39311 this.events = this.events || [];
39315 unbind: addEvent(this.node || document, eventName, fn, scope || this)
39320 Snap["un" + eventName] =
39321 elproto["un" + eventName] = function(fn) {
39322 var events = this.events || [],
39325 if (events[l].name == eventName &&
39326 (events[l].f == fn || !fn)) {
39327 events[l].unbind();
39328 events.splice(l, 1);
39329 !events.length && delete this.events;
39337 * \ Element.hover [ method ] * Adds hover event handlers to the element -
39338 * f_in (function) handler for hover in - f_out (function) handler for hover
39339 * out - icontext (object) #optional context for hover in handler - ocontext
39340 * (object) #optional context for hover out handler = (object) @Element \
39342 elproto.hover = function(f_in, f_out, scope_in, scope_out) {
39343 return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in);
39346 * \ Element.unhover [ method ] * Removes hover event handlers from the
39347 * element - f_in (function) handler for hover in - f_out (function) handler
39348 * for hover out = (object) @Element \
39350 elproto.unhover = function(f_in, f_out) {
39351 return this.unmouseover(f_in).unmouseout(f_out);
39353 var draggable = [];
39354 // SIERRA unclear what _context_ refers to for starting, ending, moving the
39356 // SIERRA Element.drag(): _x position of the mouse_: Where are the x/y
39357 // values offset from?
39358 // SIERRA Element.drag(): much of this member's doc appears to be duplicated
39359 // for some reason.
39360 // SIERRA Unclear about this sentence: _Additionally following drag events
39361 // will be triggered: drag.start.<id> on start, drag.end.<id> on end and
39362 // drag.move.<id> on every move._ Is there a global _drag_ object to which
39363 // you can assign handlers keyed by an element's ID?
39365 * \ Element.drag [ method ] * Adds event handlers for an element's drag
39366 * gesture * - onmove (function) handler for moving - onstart (function)
39367 * handler for drag start - onend (function) handler for drag end - mcontext
39368 * (object) #optional context for moving handler - scontext (object)
39369 * #optional context for drag start handler - econtext (object) #optional
39370 * context for drag end handler Additionaly following `drag` events are
39371 * triggered: `drag.start.<id>` on start, `drag.end.<id>` on end and
39372 * `drag.move.<id>` on every move. When element is dragged over another
39373 * element `drag.over.<id>` fires as well.
39375 * Start event and start handler are called in specified context or in
39376 * context of the element with following parameters: o x (number) x position
39377 * of the mouse o y (number) y position of the mouse o event (object) DOM
39378 * event object Move event and move handler are called in specified context
39379 * or in context of the element with following parameters: o dx (number)
39380 * shift by x from the start point o dy (number) shift by y from the start
39381 * point o x (number) x position of the mouse o y (number) y position of the
39382 * mouse o event (object) DOM event object End event and end handler are
39383 * called in specified context or in context of the element with following
39384 * parameters: o event (object) DOM event object = (object) @Element \
39386 elproto.drag = function(onmove, onstart, onend, move_scope, start_scope, end_scope) {
39387 if (!arguments.length) {
39389 return this.drag(function(dx, dy) {
39391 transform: origTransform + (origTransform ? "T" : "t") + [dx, dy]
39394 origTransform = this.transform().local;
39398 function start(e, x, y) {
39399 (e.originalEvent || e).preventDefault();
39402 this._drag.id = e.identifier;
39403 !drag.length && Snap.mousemove(dragMove).mouseup(dragUp);
39406 move_scope: move_scope,
39407 start_scope: start_scope,
39408 end_scope: end_scope
39410 onstart && eve.on("snap.drag.start." + this.id, onstart);
39411 onmove && eve.on("snap.drag.move." + this.id, onmove);
39412 onend && eve.on("snap.drag.end." + this.id, onend);
39413 eve("snap.drag.start." + this.id, start_scope || move_scope || this, x, y, e);
39420 this.mousedown(start);
39424 * Element.onDragOver [ method ] * Shortcut to assign event handler for
39425 * `drag.over.<id>` event, where `id` is the element's `id` (see
39426 * @Element.id) - f (function) handler for event, first argument would be
39427 * the element you are dragging over \
39429 // elproto.onDragOver = function (f) {
39430 // f ? eve.on("snap.drag.over." + this.id, f) : eve.unbind("snap.drag.over."
39434 * \ Element.undrag [ method ] * Removes all drag event handlers from the
39437 elproto.undrag = function() {
39438 var i = draggable.length;
39440 if (draggable[i].el == this) {
39441 this.unmousedown(draggable[i].start);
39442 draggable.splice(i, 1);
39443 eve.unbind("snap.drag.*." + this.id);
39444 }!draggable.length && Snap.unmousemove(dragMove).unmouseup(dragUp);
39448 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
39450 // Licensed under the Apache License, Version 2.0 (the "License");
39451 // you may not use this file except in compliance with the License.
39452 // You may obtain a copy of the License at
39454 // http://www.apache.org/licenses/LICENSE-2.0
39456 // Unless required by applicable law or agreed to in writing, software
39457 // distributed under the License is distributed on an "AS IS" BASIS,
39458 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39459 // See the License for the specific language governing permissions and
39460 // limitations under the License.
39461 Snap.plugin(function(Snap, Element, Paper, glob) {
39462 var elproto = Element.prototype,
39463 pproto = Paper.prototype,
39464 rgurl = /^\s*url\((.+)\)/,
39469 * \ Paper.filter [ method ] * Creates a `<filter>` element * - filstr
39470 * (string) SVG fragment of filter provided as a string = (object) @Element
39471 * Note: It is recommended to use filters embedded into the page inside an
39472 * empty SVG element. > Usage | var f = paper.filter('<feGaussianBlur
39473 * stdDeviation="2"/>'), | c = paper.circle(10, 10, 10).attr({ | filter: f |
39476 pproto.filter = function(filstr) {
39478 if (paper.type != "svg") {
39479 paper = paper.paper;
39481 var f = Snap.parse(Str(filstr)),
39483 width = paper.node.offsetWidth,
39484 height = paper.node.offsetHeight,
39485 filter = $("filter");
39488 filterUnits: "userSpaceOnUse"
39490 filter.appendChild(f.node);
39491 paper.defs.appendChild(filter);
39492 return new Element(filter);
39495 eve.on("snap.util.getattr.filter", function() {
39497 var p = $(this.node, "filter");
39499 var match = Str(p).match(rgurl);
39500 return match && Snap.select(match[1]);
39503 eve.on("snap.util.attr.filter", function(value) {
39504 if (value instanceof Element && value.type == "filter") {
39506 var id = value.node.id;
39514 filter: Snap.url(id)
39517 if (!value || value == "none") {
39519 this.node.removeAttribute("filter");
39523 * \ Snap.filter.blur [ method ] * Returns an SVG markup string for the blur
39524 * filter * - x (number) amount of horizontal blur, in pixels - y (number)
39525 * #optional amount of vertical blur, in pixels = (string) filter
39526 * representation > Usage | var f = paper.filter(Snap.filter.blur(5, 10)), |
39527 * c = paper.circle(10, 10, 10).attr({ | filter: f | }); \
39529 Snap.filter.blur = function(x, y) {
39533 var def = y == null ? x : [x, y];
39534 return Snap.format('\<feGaussianBlur stdDeviation="{def}"/>', {
39538 Snap.filter.blur.toString = function() {
39542 * \ Snap.filter.shadow [ method ] * Returns an SVG markup string for the
39543 * shadow filter * - dx (number) #optional horizontal shift of the shadow,
39544 * in pixels - dy (number) #optional vertical shift of the shadow, in pixels -
39545 * blur (number) #optional amount of blur - color (string) #optional color
39546 * of the shadow - opacity (number) #optional `0..1` opacity of the shadow
39547 * or - dx (number) #optional horizontal shift of the shadow, in pixels - dy
39548 * (number) #optional vertical shift of the shadow, in pixels - color
39549 * (string) #optional color of the shadow - opacity (number) #optional
39550 * `0..1` opacity of the shadow which makes blur default to `4`. Or - dx
39551 * (number) #optional horizontal shift of the shadow, in pixels - dy
39552 * (number) #optional vertical shift of the shadow, in pixels - opacity
39553 * (number) #optional `0..1` opacity of the shadow = (string) filter
39554 * representation > Usage | var f = paper.filter(Snap.filter.shadow(0, 2,
39555 * 3)), | c = paper.circle(10, 10, 10).attr({ | filter: f | }); \
39557 Snap.filter.shadow = function(dx, dy, blur, color, opacity) {
39558 if (typeof blur == "string") {
39563 if (typeof color != "string") {
39567 color = color || "#000";
39568 if (blur == null) {
39571 if (opacity == null) {
39581 color = Snap.color(color);
39582 return Snap.format('<feGaussianBlur in="SourceAlpha" stdDeviation="{blur}"/><feOffset dx="{dx}" dy="{dy}" result="offsetblur"/><feFlood flood-color="{color}"/><feComposite in2="offsetblur" operator="in"/><feComponentTransfer><feFuncA type="linear" slope="{opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge>', {
39590 Snap.filter.shadow.toString = function() {
39594 * \ Snap.filter.grayscale [ method ] * Returns an SVG markup string for the
39595 * grayscale filter * - amount (number) amount of filter (`0..1`) = (string)
39596 * filter representation \
39598 Snap.filter.grayscale = function(amount) {
39599 if (amount == null) {
39602 return Snap.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {b} {h} 0 0 0 0 0 1 0"/>', {
39603 a: 0.2126 + 0.7874 * (1 - amount),
39604 b: 0.7152 - 0.7152 * (1 - amount),
39605 c: 0.0722 - 0.0722 * (1 - amount),
39606 d: 0.2126 - 0.2126 * (1 - amount),
39607 e: 0.7152 + 0.2848 * (1 - amount),
39608 f: 0.0722 - 0.0722 * (1 - amount),
39609 g: 0.2126 - 0.2126 * (1 - amount),
39610 h: 0.0722 + 0.9278 * (1 - amount)
39613 Snap.filter.grayscale.toString = function() {
39617 * \ Snap.filter.sepia [ method ] * Returns an SVG markup string for the
39618 * sepia filter * - amount (number) amount of filter (`0..1`) = (string)
39619 * filter representation \
39621 Snap.filter.sepia = function(amount) {
39622 if (amount == null) {
39625 return Snap.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {h} {i} 0 0 0 0 0 1 0"/>', {
39626 a: 0.393 + 0.607 * (1 - amount),
39627 b: 0.769 - 0.769 * (1 - amount),
39628 c: 0.189 - 0.189 * (1 - amount),
39629 d: 0.349 - 0.349 * (1 - amount),
39630 e: 0.686 + 0.314 * (1 - amount),
39631 f: 0.168 - 0.168 * (1 - amount),
39632 g: 0.272 - 0.272 * (1 - amount),
39633 h: 0.534 - 0.534 * (1 - amount),
39634 i: 0.131 + 0.869 * (1 - amount)
39637 Snap.filter.sepia.toString = function() {
39641 * \ Snap.filter.saturate [ method ] * Returns an SVG markup string for the
39642 * saturate filter * - amount (number) amount of filter (`0..1`) = (string)
39643 * filter representation \
39645 Snap.filter.saturate = function(amount) {
39646 if (amount == null) {
39649 return Snap.format('<feColorMatrix type="saturate" values="{amount}"/>', {
39653 Snap.filter.saturate.toString = function() {
39657 * \ Snap.filter.hueRotate [ method ] * Returns an SVG markup string for the
39658 * hue-rotate filter * - angle (number) angle of rotation = (string) filter
39661 Snap.filter.hueRotate = function(angle) {
39662 angle = angle || 0;
39663 return Snap.format('<feColorMatrix type="hueRotate" values="{angle}"/>', {
39667 Snap.filter.hueRotate.toString = function() {
39671 * \ Snap.filter.invert [ method ] * Returns an SVG markup string for the
39672 * invert filter * - amount (number) amount of filter (`0..1`) = (string)
39673 * filter representation \
39675 Snap.filter.invert = function(amount) {
39676 if (amount == null) {
39679 return Snap.format('<feComponentTransfer><feFuncR type="table" tableValues="{amount} {amount2}"/><feFuncG type="table" tableValues="{amount} {amount2}"/><feFuncB type="table" tableValues="{amount} {amount2}"/></feComponentTransfer>', {
39681 amount2: 1 - amount
39684 Snap.filter.invert.toString = function() {
39688 * \ Snap.filter.brightness [ method ] * Returns an SVG markup string for
39689 * the brightness filter * - amount (number) amount of filter (`0..1`) =
39690 * (string) filter representation \
39692 Snap.filter.brightness = function(amount) {
39693 if (amount == null) {
39696 return Snap.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}"/><feFuncG type="linear" slope="{amount}"/><feFuncB type="linear" slope="{amount}"/></feComponentTransfer>', {
39700 Snap.filter.brightness.toString = function() {
39704 * \ Snap.filter.contrast [ method ] * Returns an SVG markup string for the
39705 * contrast filter * - amount (number) amount of filter (`0..1`) = (string)
39706 * filter representation \
39708 Snap.filter.contrast = function(amount) {
39709 if (amount == null) {
39712 return Snap.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}" intercept="{amount2}"/><feFuncG type="linear" slope="{amount}" intercept="{amount2}"/><feFuncB type="linear" slope="{amount}" intercept="{amount2}"/></feComponentTransfer>', {
39714 amount2: .5 - amount / 2
39717 Snap.filter.contrast.toString = function() {
39725 "eve": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\eve\\eve.js"
39727 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js": [function(require, module, exports) {
39730 var snapsvg = module.exports = require('snapsvg');
39732 snapsvg.plugin(function(Snap, Element) {
39735 * \ Element.children [ method ] * Returns array of all the children of the
39736 * element. = (array) array of Elements \
39738 Element.prototype.children = function() {
39740 ch = this.node.childNodes;
39741 for (var i = 0, ii = ch.length; i < ii; i++) {
39742 out[i] = new Snap(ch[i]);
39750 * @class ClassPlugin
39752 * Extends snapsvg with methods to add and remove classes
39754 snapsvg.plugin(function(Snap, Element, Paper, global) {
39756 function split(str) {
39757 return str.split(/\s+/);
39760 function join(array) {
39761 return array.join(' ');
39764 function getClasses(e) {
39765 return split(e.attr('class') || '');
39768 function setClasses(e, classes) {
39769 e.attr('class', join(classes));
39773 * @method snapsvg.Element#addClass
39777 * e.attr('class', 'selector');
39779 * e.addClass('foo bar'); // adds classes foo and bar e.attr('class'); // ->
39780 * 'selector foo bar'
39782 * e.addClass('fooBar'); e.attr('class'); // -> 'selector foo bar fooBar'
39785 * cls classes to be added to the element
39787 * @return {snapsvg.Element} the element (this)
39789 Element.prototype.addClass = function(cls) {
39790 var current = getClasses(this),
39794 for (i = 0, e; !!(e = add[i]); i++) {
39795 if (current.indexOf(e) === -1) {
39800 setClasses(this, current);
39806 * @method snapsvg.Element#hasClass
39809 * cls the class to query for
39810 * @return {Boolean} returns true if the element has the given class
39812 Element.prototype.hasClass = function(cls) {
39814 throw new Error('[snapsvg] syntax: hasClass(clsStr)');
39817 return getClasses(this).indexOf(cls) !== -1;
39821 * @method snapsvg.Element#removeClass
39825 * e.attr('class', 'foo bar');
39827 * e.removeClass('foo'); e.attr('class'); // -> 'bar'
39829 * e.removeClass('foo bar'); // removes classes foo and bar e.attr('class'); // -> ''
39832 * cls classes to be removed from element
39834 * @return {snapsvg.Element} the element (this)
39836 Element.prototype.removeClass = function(cls) {
39837 var current = getClasses(this),
39838 remove = split(cls),
39841 for (i = 0, e; !!(e = remove[i]); i++) {
39842 idx = current.indexOf(e);
39845 // remove element from array
39846 current.splice(idx, 1);
39850 setClasses(this, current);
39858 * @class TranslatePlugin
39860 * Extends snapsvg with methods to translate elements
39862 snapsvg.plugin(function(Snap, Element, Paper, global) {
39865 * @method snapsvg.Element#translate
39869 * e.translate(10, 20);
39870 * // sets transform matrix to translate(10, 20)
39872 * @param {Number} x translation @param {Number} y translation
39874 * @return {snapsvg.Element} the element (this)
39876 Element.prototype.translate = function(x, y) {
39877 var matrix = new Snap.Matrix();
39878 matrix.translate(x, y);
39879 return this.transform(matrix);
39885 * @class CreatePlugin
39887 * Create an svg element without attaching it to the dom
39889 snapsvg.plugin(function(Snap) {
39891 Snap.create = function(name, attrs) {
39892 return Snap._.wrap(Snap._.$(name, attrs));
39898 * @class CreatSnapAtPlugin
39900 * Extends snap.svg with a method to create a SVG element at a specific position
39903 snapsvg.plugin(function(Snap, Element, Paper, global) {
39906 * @method snapsvg.createSnapAt
39910 * snapsvg.createSnapAt(parentNode, 200, 200);
39912 * @param {Number} width of svg @param {Number} height of svg @param
39913 * {Object} parentNode svg Element will be child of this
39915 * @return {snapsvg.Element} the newly created wrapped SVG element instance
39917 Snap.createSnapAt = function(width, height, parentNode) {
39919 var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
39920 svg.setAttribute('width', width);
39921 svg.setAttribute('height', height);
39923 parentNode = document.body;
39925 parentNode.appendChild(svg);
39927 return new Snap(svg);
39931 "snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\snapsvg\\dist\\snap.svg.js"
39933 "\\bpmn-js-examples-master\\modeler\\node_modules\\jquery\\dist\\jquery.js": [function(require, module, exports) {
39935 * ! jQuery JavaScript Library v2.1.4 http://jquery.com/
39937 * Includes Sizzle.js http://sizzlejs.com/
39939 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors Released
39940 * under the MIT license http://jquery.org/license
39942 * Date: 2015-04-28T16:01Z
39945 (function(global, factory) {
39947 if (typeof module === "object" && typeof module.exports === "object") {
39948 // For CommonJS and CommonJS-like environments where a proper `window`
39949 // is present, execute the factory and get jQuery.
39950 // For environments that do not have a `window` with a `document`
39951 // (such as Node.js), expose a factory as module.exports.
39952 // This accentuates the need for the creation of a real `window`.
39953 // e.g. var jQuery = require("jquery")(window);
39954 // See ticket #14549 for more info.
39955 module.exports = global.document ?
39956 factory(global, true) :
39959 throw new Error("jQuery requires a window with a document");
39967 // Pass this if window is not defined yet
39968 }(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
39970 // Support: Firefox 18+
39971 // Can't be in strict mode, several libs including ASP.NET trace
39972 // the stack via arguments.caller.callee and Firefox dies if
39973 // you try to trace through "use strict" call chains. (#13335)
39978 var slice = arr.slice;
39980 var concat = arr.concat;
39982 var push = arr.push;
39984 var indexOf = arr.indexOf;
39986 var class2type = {};
39988 var toString = class2type.toString;
39990 var hasOwn = class2type.hasOwnProperty;
39997 // Use the correct document accordingly with window argument (sandbox)
39998 document = window.document,
40002 // Define a local copy of jQuery
40003 jQuery = function(selector, context) {
40004 // The jQuery object is actually just the init constructor 'enhanced'
40005 // Need init if jQuery is called (just allow error to be thrown if not
40007 return new jQuery.fn.init(selector, context);
40010 // Support: Android<4.1
40011 // Make sure we trim BOM and NBSP
40012 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
40014 // Matches dashed string for camelizing
40015 rmsPrefix = /^-ms-/,
40016 rdashAlpha = /-([\da-z])/gi,
40018 // Used by jQuery.camelCase as callback to replace()
40019 fcamelCase = function(all, letter) {
40020 return letter.toUpperCase();
40023 jQuery.fn = jQuery.prototype = {
40024 // The current version of jQuery being used
40027 constructor: jQuery,
40029 // Start with an empty selector
40032 // The default length of a jQuery object is 0
40035 toArray: function() {
40036 return slice.call(this);
40039 // Get the Nth element in the matched element set OR
40040 // Get the whole matched element set as a clean array
40041 get: function(num) {
40042 return num != null ?
40044 // Return just the one element from the set
40045 (num < 0 ? this[num + this.length] : this[num]) :
40047 // Return all the elements in a clean array
40051 // Take an array of elements and push it onto the stack
40052 // (returning the new matched element set)
40053 pushStack: function(elems) {
40055 // Build a new jQuery matched element set
40056 var ret = jQuery.merge(this.constructor(), elems);
40058 // Add the old object onto the stack (as a reference)
40059 ret.prevObject = this;
40060 ret.context = this.context;
40062 // Return the newly-formed element set
40066 // Execute a callback for every element in the matched set.
40067 // (You can seed the arguments with an array of args, but this is
40068 // only used internally.)
40069 each: function(callback, args) {
40070 return jQuery.each(this, callback, args);
40073 map: function(callback) {
40074 return this.pushStack(jQuery.map(this, function(elem, i) {
40075 return callback.call(elem, i, elem);
40079 slice: function() {
40080 return this.pushStack(slice.apply(this, arguments));
40083 first: function() {
40088 return this.eq(-1);
40092 var len = this.length,
40093 j = +i + (i < 0 ? len : 0);
40094 return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
40098 return this.prevObject || this.constructor(null);
40101 // For internal use only.
40102 // Behaves like an Array's method, not like a jQuery method.
40108 jQuery.extend = jQuery.fn.extend = function() {
40109 var options, name, src, copy, copyIsArray, clone,
40110 target = arguments[0] || {},
40112 length = arguments.length,
40115 // Handle a deep copy situation
40116 if (typeof target === "boolean") {
40119 // Skip the boolean and the target
40120 target = arguments[i] || {};
40124 // Handle case when target is a string or something (possible in deep copy)
40125 if (typeof target !== "object" && !jQuery.isFunction(target)) {
40129 // Extend jQuery itself if only one argument is passed
40130 if (i === length) {
40135 for (; i < length; i++) {
40136 // Only deal with non-null/undefined values
40137 if ((options = arguments[i]) != null) {
40138 // Extend the base object
40139 for (name in options) {
40140 src = target[name];
40141 copy = options[name];
40143 // Prevent never-ending loop
40144 if (target === copy) {
40148 // Recurse if we're merging plain objects or arrays
40149 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
40151 copyIsArray = false;
40152 clone = src && jQuery.isArray(src) ? src : [];
40155 clone = src && jQuery.isPlainObject(src) ? src : {};
40158 // Never move original objects, clone them
40159 target[name] = jQuery.extend(deep, clone, copy);
40161 // Don't bring in undefined values
40162 } else if (copy !== undefined) {
40163 target[name] = copy;
40169 // Return the modified object
40174 // Unique for each copy of jQuery on the page
40175 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
40177 // Assume jQuery is ready without the ready module
40180 error: function(msg) {
40181 throw new Error(msg);
40184 noop: function() {},
40186 isFunction: function(obj) {
40187 return jQuery.type(obj) === "function";
40190 isArray: Array.isArray,
40192 isWindow: function(obj) {
40193 return obj != null && obj === obj.window;
40196 isNumeric: function(obj) {
40197 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
40198 // ...but misinterprets leading-number strings, particularly hex
40199 // literals ("0x...")
40200 // subtraction forces infinities to NaN
40201 // adding 1 corrects loss of precision from parseFloat (#15100)
40202 return !jQuery.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0;
40205 isPlainObject: function(obj) {
40206 // Not plain objects:
40207 // - Any object or value whose internal [[Class]] property is not
40208 // "[object Object]"
40211 if (jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
40215 if (obj.constructor &&
40216 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
40220 // If the function hasn't returned already, we're confident that
40221 // |obj| is a plain object, created by {} or constructed with new Object
40225 isEmptyObject: function(obj) {
40227 for (name in obj) {
40233 type: function(obj) {
40237 // Support: Android<4.0, iOS<6 (functionish RegExp)
40238 return typeof obj === "object" || typeof obj === "function" ?
40239 class2type[toString.call(obj)] || "object" :
40243 // Evaluates a script in a global context
40244 globalEval: function(code) {
40248 code = jQuery.trim(code);
40251 // If the code includes a valid, prologue position
40252 // strict mode pragma, execute code by injecting a
40253 // script tag into the document.
40254 if (code.indexOf("use strict") === 1) {
40255 script = document.createElement("script");
40256 script.text = code;
40257 document.head.appendChild(script).parentNode.removeChild(script);
40259 // Otherwise, avoid the DOM node creation, insertion
40260 // and removal by using an indirect global eval
40266 // Convert dashed to camelCase; used by the css and data modules
40267 // Support: IE9-11+
40268 // Microsoft forgot to hump their vendor prefix (#9572)
40269 camelCase: function(string) {
40270 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
40273 nodeName: function(elem, name) {
40274 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
40277 // args is for internal usage only
40278 each: function(obj, callback, args) {
40281 length = obj.length,
40282 isArray = isArraylike(obj);
40286 for (; i < length; i++) {
40287 value = callback.apply(obj[i], args);
40289 if (value === false) {
40295 value = callback.apply(obj[i], args);
40297 if (value === false) {
40303 // A special, fast, case for the most common use of each
40306 for (; i < length; i++) {
40307 value = callback.call(obj[i], i, obj[i]);
40309 if (value === false) {
40315 value = callback.call(obj[i], i, obj[i]);
40317 if (value === false) {
40327 // Support: Android<4.1
40328 trim: function(text) {
40329 return text == null ?
40331 (text + "").replace(rtrim, "");
40334 // results is for internal usage only
40335 makeArray: function(arr, results) {
40336 var ret = results || [];
40339 if (isArraylike(Object(arr))) {
40341 typeof arr === "string" ? [arr] : arr
40344 push.call(ret, arr);
40351 inArray: function(elem, arr, i) {
40352 return arr == null ? -1 : indexOf.call(arr, elem, i);
40355 merge: function(first, second) {
40356 var len = +second.length,
40360 for (; j < len; j++) {
40361 first[i++] = second[j];
40369 grep: function(elems, callback, invert) {
40370 var callbackInverse,
40373 length = elems.length,
40374 callbackExpect = !invert;
40376 // Go through the array, only saving the items
40377 // that pass the validator function
40378 for (; i < length; i++) {
40379 callbackInverse = !callback(elems[i], i);
40380 if (callbackInverse !== callbackExpect) {
40381 matches.push(elems[i]);
40388 // arg is for internal usage only
40389 map: function(elems, callback, arg) {
40392 length = elems.length,
40393 isArray = isArraylike(elems),
40396 // Go through the array, translating each of the items to their new
40399 for (; i < length; i++) {
40400 value = callback(elems[i], i, arg);
40402 if (value != null) {
40407 // Go through every key on the object,
40410 value = callback(elems[i], i, arg);
40412 if (value != null) {
40418 // Flatten any nested arrays
40419 return concat.apply([], ret);
40422 // A global GUID counter for objects
40425 // Bind a function to a context, optionally partially applying any
40427 proxy: function(fn, context) {
40428 var tmp, args, proxy;
40430 if (typeof context === "string") {
40436 // Quick check to determine if target is callable, in the spec
40437 // this throws a TypeError, but we will just return undefined.
40438 if (!jQuery.isFunction(fn)) {
40443 args = slice.call(arguments, 2);
40444 proxy = function() {
40445 return fn.apply(context || this, args.concat(slice.call(arguments)));
40448 // Set the guid of unique handler to the same of original handler, so it
40450 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
40457 // jQuery.support is not used in Core but other projects attach their
40458 // properties to it so it needs to exist.
40462 // Populate the class2type map
40463 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
40464 class2type["[object " + name + "]"] = name.toLowerCase();
40467 function isArraylike(obj) {
40469 // Support: iOS 8.2 (not reproducible in simulator)
40470 // `in` check used to prevent JIT error (gh-2145)
40471 // hasOwn isn't used here due to false negatives
40472 // regarding Nodelist length in IE
40473 var length = "length" in obj && obj.length,
40474 type = jQuery.type(obj);
40476 if (type === "function" || jQuery.isWindow(obj)) {
40480 if (obj.nodeType === 1 && length) {
40484 return type === "array" || length === 0 ||
40485 typeof length === "number" && length > 0 && (length - 1) in obj;
40489 * ! Sizzle CSS Selector Engine v2.2.0-pre http://sizzlejs.com/
40491 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors Released
40492 * under the MIT license http://jquery.org/license
40496 (function(window) {
40510 // Local document vars
40520 // Instance-specific data
40521 expando = "sizzle" + 1 * new Date(),
40522 preferredDoc = window.document,
40525 classCache = createCache(),
40526 tokenCache = createCache(),
40527 compilerCache = createCache(),
40528 sortOrder = function(a, b) {
40530 hasDuplicate = true;
40535 // General-purpose constants
40536 MAX_NEGATIVE = 1 << 31,
40538 // Instance methods
40539 hasOwn = ({}).hasOwnProperty,
40542 push_native = arr.push,
40545 // Use a stripped-down indexOf as it's faster than native
40546 // http://jsperf.com/thor-indexof-vs-for/5
40547 indexOf = function(list, elem) {
40550 for (; i < len; i++) {
40551 if (list[i] === elem) {
40558 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
40560 // Regular expressions
40562 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
40563 whitespace = "[\\x20\\t\\r\\n\\f]",
40564 // http://www.w3.org/TR/css3-syntax/#characters
40565 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
40567 // Loosely modeled on CSS identifier characters
40568 // An unquoted value should be a CSS identifier
40569 // http://www.w3.org/TR/css3-selectors/#attribute-selectors
40571 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
40572 identifier = characterEncoding.replace("w", "w#"),
40574 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
40575 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
40576 // Operator (capture 2)
40577 "*([*^$|!~]?=)" + whitespace +
40578 // "Attribute values must be CSS identifiers [capture 5] or strings
40579 // [capture 3 or capture 4]"
40580 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
40583 pseudos = ":(" + characterEncoding + ")(?:\\((" +
40584 // To reduce the number of selectors needing tokenize in the preFilter,
40585 // prefer arguments:
40586 // 1. quoted (capture 3; capture 4 or capture 5)
40587 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
40588 // 2. simple (capture 6)
40589 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
40590 // 3. anything else (capture 2)
40594 // Leading and non-escaped trailing whitespace, capturing some
40595 // non-whitespace characters preceding the latter
40596 rwhitespace = new RegExp(whitespace + "+", "g"),
40597 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
40599 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
40600 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
40602 rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
40604 rpseudo = new RegExp(pseudos),
40605 ridentifier = new RegExp("^" + identifier + "$"),
40608 "ID": new RegExp("^#(" + characterEncoding + ")"),
40609 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
40610 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
40611 "ATTR": new RegExp("^" + attributes),
40612 "PSEUDO": new RegExp("^" + pseudos),
40613 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
40614 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
40615 "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
40616 "bool": new RegExp("^(?:" + booleans + ")$", "i"),
40617 // For use in libraries implementing .is()
40618 // We use this for POS matching in `select`
40619 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
40620 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
40623 rinputs = /^(?:input|select|textarea|button)$/i,
40624 rheader = /^h\d$/i,
40626 rnative = /^[^{]+\{\s*\[native \w/,
40628 // Easily-parseable/retrievable ID or TAG or CLASS selectors
40629 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
40634 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
40635 runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
40636 funescape = function(_, escaped, escapedWhitespace) {
40637 var high = "0x" + escaped - 0x10000;
40638 // NaN means non-codepoint
40639 // Support: Firefox<24
40640 // Workaround erroneous numeric interpretation of +"0x"
40641 return high !== high || escapedWhitespace ?
40645 String.fromCharCode(high + 0x10000) :
40646 // Supplemental Plane codepoint (surrogate pair)
40647 String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
40650 // Used for iframes
40651 // See setDocument()
40652 // Removing the function wrapper causes a "Permission Denied"
40654 unloadHandler = function() {
40658 // Optimize for push.apply( _, NodeList )
40661 (arr = slice.call(preferredDoc.childNodes)),
40662 preferredDoc.childNodes
40664 // Support: Android<4.0
40665 // Detect silently failing push.apply
40666 arr[preferredDoc.childNodes.length].nodeType;
40669 apply: arr.length ?
40671 // Leverage slice if possible
40672 function(target, els) {
40673 push_native.apply(target, slice.call(els));
40677 // Otherwise append directly
40678 function(target, els) {
40679 var j = target.length,
40681 // Can't trust NodeList.length
40682 while ((target[j++] = els[i++])) {}
40683 target.length = j - 1;
40688 function Sizzle(selector, context, results, seed) {
40689 var match, elem, m, nodeType,
40691 i, groups, old, nid, newContext, newSelector;
40693 if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
40694 setDocument(context);
40697 context = context || document;
40698 results = results || [];
40699 nodeType = context.nodeType;
40701 if (typeof selector !== "string" || !selector ||
40702 nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
40707 if (!seed && documentIsHTML) {
40709 // Try to shortcut find operations when possible (e.g., not under
40710 // DocumentFragment)
40711 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
40712 // Speed-up: Sizzle("#ID")
40713 if ((m = match[1])) {
40714 if (nodeType === 9) {
40715 elem = context.getElementById(m);
40716 // Check parentNode to catch when Blackberry 4.6 returns
40717 // nodes that are no longer in the document (jQuery #6963)
40718 if (elem && elem.parentNode) {
40719 // Handle the case where IE, Opera, and Webkit return
40721 // by name instead of ID
40722 if (elem.id === m) {
40723 results.push(elem);
40730 // Context is not a document
40731 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) &&
40732 contains(context, elem) && elem.id === m) {
40733 results.push(elem);
40738 // Speed-up: Sizzle("TAG")
40739 } else if (match[2]) {
40740 push.apply(results, context.getElementsByTagName(selector));
40743 // Speed-up: Sizzle(".CLASS")
40744 } else if ((m = match[3]) && support.getElementsByClassName) {
40745 push.apply(results, context.getElementsByClassName(m));
40751 if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
40752 nid = old = expando;
40753 newContext = context;
40754 newSelector = nodeType !== 1 && selector;
40756 // qSA works strangely on Element-rooted queries
40757 // We can work around this by specifying an extra ID on the root
40758 // and working up from there (Thanks to Andrew Dupont for the
40760 // IE 8 doesn't work on object elements
40761 if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
40762 groups = tokenize(selector);
40764 if ((old = context.getAttribute("id"))) {
40765 nid = old.replace(rescape, "\\$&");
40767 context.setAttribute("id", nid);
40769 nid = "[id='" + nid + "'] ";
40773 groups[i] = nid + toSelector(groups[i]);
40775 newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
40776 newSelector = groups.join(",");
40781 push.apply(results,
40782 newContext.querySelectorAll(newSelector)
40785 } catch (qsaError) {} finally {
40787 context.removeAttribute("id");
40795 return select(selector.replace(rtrim, "$1"), context, results, seed);
40799 * Create key-value caches of limited size
40801 * @returns {Function(string, Object)} Returns the Object data after storing it
40802 * on itself with property name the (space-suffixed) string and (if the
40803 * cache is larger than Expr.cacheLength) deleting the oldest entry
40805 function createCache() {
40808 function cache(key, value) {
40809 // Use (key + " ") to avoid collision with native prototype properties
40810 // (see Issue #157)
40811 if (keys.push(key + " ") > Expr.cacheLength) {
40812 // Only keep the most recent entries
40813 delete cache[keys.shift()];
40815 return (cache[key + " "] = value);
40821 * Mark a function for special use by Sizzle
40823 * @param {Function}
40824 * fn The function to mark
40826 function markFunction(fn) {
40827 fn[expando] = true;
40832 * Support testing using an element
40834 * @param {Function}
40835 * fn Passed the created div and expects a boolean result
40837 function assert(fn) {
40838 var div = document.createElement("div");
40845 // Remove from its parent by default
40846 if (div.parentNode) {
40847 div.parentNode.removeChild(div);
40849 // release memory in IE
40855 * Adds the same handler for all of the specified attrs
40858 * attrs Pipe-separated list of attributes
40859 * @param {Function}
40860 * handler The method that will be applied
40862 function addHandle(attrs, handler) {
40863 var arr = attrs.split("|"),
40867 Expr.attrHandle[arr[i]] = handler;
40872 * Checks document order of two siblings
40878 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a
40881 function siblingCheck(a, b) {
40883 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
40884 (~b.sourceIndex || MAX_NEGATIVE) -
40885 (~a.sourceIndex || MAX_NEGATIVE);
40887 // Use IE sourceIndex if available on both nodes
40892 // Check if b follows a
40894 while ((cur = cur.nextSibling)) {
40905 * Returns a function to use in pseudos for input types
40910 function createInputPseudo(type) {
40911 return function(elem) {
40912 var name = elem.nodeName.toLowerCase();
40913 return name === "input" && elem.type === type;
40918 * Returns a function to use in pseudos for buttons
40923 function createButtonPseudo(type) {
40924 return function(elem) {
40925 var name = elem.nodeName.toLowerCase();
40926 return (name === "input" || name === "button") && elem.type === type;
40931 * Returns a function to use in pseudos for positionals
40933 * @param {Function}
40936 function createPositionalPseudo(fn) {
40937 return markFunction(function(argument) {
40938 argument = +argument;
40939 return markFunction(function(seed, matches) {
40941 matchIndexes = fn([], seed.length, argument),
40942 i = matchIndexes.length;
40944 // Match elements found at the specified indexes
40946 if (seed[(j = matchIndexes[i])]) {
40947 seed[j] = !(matches[j] = seed[j]);
40955 * Checks a node for validity as a Sizzle context
40957 * @param {Element|Object=}
40959 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a
40962 function testContext(context) {
40963 return context && typeof context.getElementsByTagName !== "undefined" && context;
40966 // Expose support vars for convenience
40967 support = Sizzle.support = {};
40970 * Detects XML nodes
40972 * @param {Element|Object}
40973 * elem An element or a document
40974 * @returns {Boolean} True iff elem is a non-HTML XML node
40976 isXML = Sizzle.isXML = function(elem) {
40977 // documentElement is verified for cases where it doesn't yet exist
40978 // (such as loading iframes in IE - #4833)
40979 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
40980 return documentElement ? documentElement.nodeName !== "HTML" : false;
40984 * Sets document-related variables once based on the current document
40986 * @param {Element|Object}
40987 * [doc] An element or document object to use to set the document
40988 * @returns {Object} Returns the current document
40990 setDocument = Sizzle.setDocument = function(node) {
40991 var hasCompare, parent,
40992 doc = node ? node.ownerDocument || node : preferredDoc;
40994 // If no document and documentElement is available, return
40995 if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
40999 // Set our document
41001 docElem = doc.documentElement;
41002 parent = doc.defaultView;
41005 // If iframe document is assigned to "document" variable and if iframe has
41007 // IE will throw "permission denied" error when accessing "document"
41008 // variable, see jQuery #13936
41009 // IE6-8 do not support the defaultView property so parent will be undefined
41010 if (parent && parent !== parent.top) {
41011 // IE11 does not have attachEvent, so all must suffer
41012 if (parent.addEventListener) {
41013 parent.addEventListener("unload", unloadHandler, false);
41014 } else if (parent.attachEvent) {
41015 parent.attachEvent("onunload", unloadHandler);
41021 * ----------------------------------------------------------------------
41023 documentIsHTML = !isXML(doc);
41027 * ----------------------------------------------------------------------
41031 // Verify that getAttribute really returns attributes and not properties
41032 // (excepting IE8 booleans)
41033 support.attributes = assert(function(div) {
41034 div.className = "i";
41035 return !div.getAttribute("className");
41038 /***************************************************************************
41040 * ----------------------------------------------------------------------
41043 // Check if getElementsByTagName("*") returns only elements
41044 support.getElementsByTagName = assert(function(div) {
41045 div.appendChild(doc.createComment(""));
41046 return !div.getElementsByTagName("*").length;
41050 support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
41053 // Check if getElementById returns elements by name
41054 // The broken getElementById methods don't pick up programatically-set
41056 // so use a roundabout getElementsByName test
41057 support.getById = assert(function(div) {
41058 docElem.appendChild(div).id = expando;
41059 return !doc.getElementsByName || !doc.getElementsByName(expando).length;
41062 // ID find and filter
41063 if (support.getById) {
41064 Expr.find["ID"] = function(id, context) {
41065 if (typeof context.getElementById !== "undefined" && documentIsHTML) {
41066 var m = context.getElementById(id);
41067 // Check parentNode to catch when Blackberry 4.6 returns
41068 // nodes that are no longer in the document #6963
41069 return m && m.parentNode ? [m] : [];
41072 Expr.filter["ID"] = function(id) {
41073 var attrId = id.replace(runescape, funescape);
41074 return function(elem) {
41075 return elem.getAttribute("id") === attrId;
41080 // getElementById is not reliable as a find shortcut
41081 delete Expr.find["ID"];
41083 Expr.filter["ID"] = function(id) {
41084 var attrId = id.replace(runescape, funescape);
41085 return function(elem) {
41086 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
41087 return node && node.value === attrId;
41093 Expr.find["TAG"] = support.getElementsByTagName ?
41094 function(tag, context) {
41095 if (typeof context.getElementsByTagName !== "undefined") {
41096 return context.getElementsByTagName(tag);
41098 // DocumentFragment nodes don't have gEBTN
41099 } else if (support.qsa) {
41100 return context.querySelectorAll(tag);
41104 function(tag, context) {
41108 // By happy coincidence, a (broken) gEBTN appears on
41109 // DocumentFragment nodes too
41110 results = context.getElementsByTagName(tag);
41112 // Filter out possible comments
41114 while ((elem = results[i++])) {
41115 if (elem.nodeType === 1) {
41126 Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
41127 if (documentIsHTML) {
41128 return context.getElementsByClassName(className);
41133 * QSA/matchesSelector
41134 * ----------------------------------------------------------------------
41137 // QSA and matchesSelector support
41139 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
41140 rbuggyMatches = [];
41142 // qSa(:focus) reports false when true (Chrome 21)
41143 // We allow this because of a bug in IE8/9 that throws an error
41144 // whenever `document.activeElement` is accessed on an iframe
41145 // So, we allow :focus to pass through QSA all the time to avoid the IE
41147 // See http://bugs.jquery.com/ticket/13378
41150 if ((support.qsa = rnative.test(doc.querySelectorAll))) {
41152 // Regex strategy adopted from Diego Perini
41153 assert(function(div) {
41154 // Select is set to empty string on purpose
41155 // This is to test IE's treatment of not explicitly
41156 // setting a boolean content attribute,
41157 // since its presence should be enough
41158 // http://bugs.jquery.com/ticket/12359
41159 docElem.appendChild(div).innerHTML = "<a id='" + expando + "'></a>" +
41160 "<select id='" + expando + "-\f]' msallowcapture=''>" +
41161 "<option selected=''></option></select>";
41163 // Support: IE8, Opera 11-12.16
41164 // Nothing should be selected when empty strings follow ^= or $= or
41166 // The test attribute must be unknown in Opera but "safe" for WinRT
41167 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
41168 if (div.querySelectorAll("[msallowcapture^='']").length) {
41169 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
41173 // Boolean attributes and "value" are not treated correctly
41174 if (!div.querySelectorAll("[selected]").length) {
41175 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
41178 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+,
41179 // PhantomJS<1.9.7+
41180 if (!div.querySelectorAll("[id~=" + expando + "-]").length) {
41181 rbuggyQSA.push("~=");
41184 // Webkit/Opera - :checked should return selected option elements
41185 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
41186 // IE8 throws error here and will not see later tests
41187 if (!div.querySelectorAll(":checked").length) {
41188 rbuggyQSA.push(":checked");
41191 // Support: Safari 8+, iOS 8+
41192 // https://bugs.webkit.org/show_bug.cgi?id=136851
41193 // In-page `selector#id sibing-combinator selector` fails
41194 if (!div.querySelectorAll("a#" + expando + "+*").length) {
41195 rbuggyQSA.push(".#.+[+~]");
41199 assert(function(div) {
41200 // Support: Windows 8 Native Apps
41201 // The type and name attributes are restricted during .innerHTML
41203 var input = doc.createElement("input");
41204 input.setAttribute("type", "hidden");
41205 div.appendChild(input).setAttribute("name", "D");
41208 // Enforce case-sensitivity of name attribute
41209 if (div.querySelectorAll("[name=d]").length) {
41210 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
41213 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements
41214 // are still enabled)
41215 // IE8 throws error here and will not see later tests
41216 if (!div.querySelectorAll(":enabled").length) {
41217 rbuggyQSA.push(":enabled", ":disabled");
41220 // Opera 10-11 does not throw on post-comma invalid pseudos
41221 div.querySelectorAll("*,:x");
41222 rbuggyQSA.push(",.*:");
41226 if ((support.matchesSelector = rnative.test((matches = docElem.matches ||
41227 docElem.webkitMatchesSelector ||
41228 docElem.mozMatchesSelector ||
41229 docElem.oMatchesSelector ||
41230 docElem.msMatchesSelector)))) {
41232 assert(function(div) {
41233 // Check to see if it's possible to do matchesSelector
41234 // on a disconnected node (IE 9)
41235 support.disconnectedMatch = matches.call(div, "div");
41237 // This should fail with an exception
41238 // Gecko does not error, returns false instead
41239 matches.call(div, "[s!='']:x");
41240 rbuggyMatches.push("!=", pseudos);
41244 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
41245 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
41249 * ----------------------------------------------------------------------
41251 hasCompare = rnative.test(docElem.compareDocumentPosition);
41253 // Element contains another
41254 // Purposefully does not implement inclusive descendent
41255 // As in, an element does not contain itself
41256 contains = hasCompare || rnative.test(docElem.contains) ?
41258 var adown = a.nodeType === 9 ? a.documentElement : a,
41259 bup = b && b.parentNode;
41260 return a === bup || !!(bup && bup.nodeType === 1 && (
41262 adown.contains(bup) :
41263 a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
41268 while ((b = b.parentNode)) {
41279 * ----------------------------------------------------------------------
41282 // Document order sorting
41283 sortOrder = hasCompare ?
41286 // Flag for duplicate removal
41288 hasDuplicate = true;
41292 // Sort on method existence if only one input has
41293 // compareDocumentPosition
41294 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
41299 // Calculate position if both inputs belong to the same document
41300 compare = (a.ownerDocument || a) === (b.ownerDocument || b) ?
41301 a.compareDocumentPosition(b) :
41303 // Otherwise we know they are disconnected
41306 // Disconnected nodes
41308 (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
41310 // Choose the first element that is related to our preferred
41312 if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
41315 if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
41319 // Maintain original order
41321 (indexOf(sortInput, a) - indexOf(sortInput, b)) :
41325 return compare & 4 ? -1 : 1;
41328 // Exit early if the nodes are identical
41330 hasDuplicate = true;
41336 aup = a.parentNode,
41337 bup = b.parentNode,
41341 // Parentless nodes are either documents or disconnected
41342 if (!aup || !bup) {
41343 return a === doc ? -1 :
41348 (indexOf(sortInput, a) - indexOf(sortInput, b)) :
41351 // If the nodes are siblings, we can do a quick check
41352 } else if (aup === bup) {
41353 return siblingCheck(a, b);
41356 // Otherwise we need full lists of their ancestors for comparison
41358 while ((cur = cur.parentNode)) {
41362 while ((cur = cur.parentNode)) {
41366 // Walk down the tree looking for a discrepancy
41367 while (ap[i] === bp[i]) {
41372 // Do a sibling check if the nodes have a common ancestor
41373 siblingCheck(ap[i], bp[i]) :
41375 // Otherwise nodes in our document sort first
41376 ap[i] === preferredDoc ? -1 :
41377 bp[i] === preferredDoc ? 1 :
41384 Sizzle.matches = function(expr, elements) {
41385 return Sizzle(expr, null, null, elements);
41388 Sizzle.matchesSelector = function(elem, expr) {
41389 // Set document vars if needed
41390 if ((elem.ownerDocument || elem) !== document) {
41394 // Make sure that attribute selectors are quoted
41395 expr = expr.replace(rattributeQuotes, "='$1']");
41397 if (support.matchesSelector && documentIsHTML &&
41398 (!rbuggyMatches || !rbuggyMatches.test(expr)) &&
41399 (!rbuggyQSA || !rbuggyQSA.test(expr))) {
41402 var ret = matches.call(elem, expr);
41404 // IE 9's matchesSelector returns false on disconnected nodes
41405 if (ret || support.disconnectedMatch ||
41406 // As well, disconnected nodes are said to be in a document
41407 // fragment in IE 9
41408 elem.document && elem.document.nodeType !== 11) {
41414 return Sizzle(expr, document, null, [elem]).length > 0;
41417 Sizzle.contains = function(context, elem) {
41418 // Set document vars if needed
41419 if ((context.ownerDocument || context) !== document) {
41420 setDocument(context);
41422 return contains(context, elem);
41425 Sizzle.attr = function(elem, name) {
41426 // Set document vars if needed
41427 if ((elem.ownerDocument || elem) !== document) {
41431 var fn = Expr.attrHandle[name.toLowerCase()],
41432 // Don't get fooled by Object.prototype properties (jQuery #13807)
41433 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?
41434 fn(elem, name, !documentIsHTML) :
41437 return val !== undefined ?
41439 support.attributes || !documentIsHTML ?
41440 elem.getAttribute(name) :
41441 (val = elem.getAttributeNode(name)) && val.specified ?
41446 Sizzle.error = function(msg) {
41447 throw new Error("Syntax error, unrecognized expression: " + msg);
41451 * Document sorting and removing duplicates
41453 * @param {ArrayLike}
41456 Sizzle.uniqueSort = function(results) {
41462 // Unless we *know* we can detect duplicates, assume their presence
41463 hasDuplicate = !support.detectDuplicates;
41464 sortInput = !support.sortStable && results.slice(0);
41465 results.sort(sortOrder);
41467 if (hasDuplicate) {
41468 while ((elem = results[i++])) {
41469 if (elem === results[i]) {
41470 j = duplicates.push(i);
41474 results.splice(duplicates[j], 1);
41478 // Clear input after sorting to release objects
41479 // See https://github.com/jquery/sizzle/pull/225
41486 * Utility function for retrieving the text value of an array of DOM nodes
41488 * @param {Array|Element}
41491 getText = Sizzle.getText = function(elem) {
41495 nodeType = elem.nodeType;
41498 // If no nodeType, this is expected to be an array
41499 while ((node = elem[i++])) {
41500 // Do not traverse comment nodes
41501 ret += getText(node);
41503 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
41504 // Use textContent for elements
41505 // innerText usage removed for consistency of new lines (jQuery #11153)
41506 if (typeof elem.textContent === "string") {
41507 return elem.textContent;
41509 // Traverse its children
41510 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
41511 ret += getText(elem);
41514 } else if (nodeType === 3 || nodeType === 4) {
41515 return elem.nodeValue;
41517 // Do not include comment or processing instruction nodes
41522 Expr = Sizzle.selectors = {
41524 // Can be adjusted by the user
41527 createPseudo: markFunction,
41544 dir: "previousSibling",
41548 dir: "previousSibling"
41553 "ATTR": function(match) {
41554 match[1] = match[1].replace(runescape, funescape);
41556 // Move the given value to match[3] whether quoted or unquoted
41557 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
41559 if (match[2] === "~=") {
41560 match[3] = " " + match[3] + " ";
41563 return match.slice(0, 4);
41566 "CHILD": function(match) {
41568 * matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what
41569 * (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4
41570 * xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component
41571 * 6 x of xn-component 7 sign of y-component 8 y of y-component
41573 match[1] = match[1].toLowerCase();
41575 if (match[1].slice(0, 3) === "nth") {
41576 // nth-* requires argument
41578 Sizzle.error(match[0]);
41581 // numeric x and y parameters for Expr.filter.CHILD
41582 // remember that false/true cast respectively to 0/1
41583 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
41584 match[5] = +((match[7] + match[8]) || match[3] === "odd");
41586 // other types prohibit arguments
41587 } else if (match[3]) {
41588 Sizzle.error(match[0]);
41594 "PSEUDO": function(match) {
41596 unquoted = !match[6] && match[2];
41598 if (matchExpr["CHILD"].test(match[0])) {
41602 // Accept quoted arguments as-is
41604 match[2] = match[4] || match[5] || "";
41606 // Strip excess characters from unquoted arguments
41607 } else if (unquoted && rpseudo.test(unquoted) &&
41608 // Get excess from tokenize (recursively)
41609 (excess = tokenize(unquoted, true)) &&
41610 // advance to the next closing parenthesis
41611 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
41613 // excess is a negative index
41614 match[0] = match[0].slice(0, excess);
41615 match[2] = unquoted.slice(0, excess);
41618 // Return only captures needed by the pseudo filter method (type and
41620 return match.slice(0, 3);
41626 "TAG": function(nodeNameSelector) {
41627 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
41628 return nodeNameSelector === "*" ?
41633 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
41637 "CLASS": function(className) {
41638 var pattern = classCache[className + " "];
41641 (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) &&
41642 classCache(className, function(elem) {
41643 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
41647 "ATTR": function(name, operator, check) {
41648 return function(elem) {
41649 var result = Sizzle.attr(elem, name);
41651 if (result == null) {
41652 return operator === "!=";
41660 return operator === "=" ? result === check :
41661 operator === "!=" ? result !== check :
41662 operator === "^=" ? check && result.indexOf(check) === 0 :
41663 operator === "*=" ? check && result.indexOf(check) > -1 :
41664 operator === "$=" ? check && result.slice(-check.length) === check :
41665 operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 :
41666 operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" :
41671 "CHILD": function(type, what, argument, first, last) {
41672 var simple = type.slice(0, 3) !== "nth",
41673 forward = type.slice(-4) !== "last",
41674 ofType = what === "of-type";
41676 return first === 1 && last === 0 ?
41678 // Shortcut for :nth-*(n)
41680 return !!elem.parentNode;
41683 function(elem, context, xml) {
41684 var cache, outerCache, node, diff, nodeIndex, start,
41685 dir = simple !== forward ? "nextSibling" : "previousSibling",
41686 parent = elem.parentNode,
41687 name = ofType && elem.nodeName.toLowerCase(),
41688 useCache = !xml && !ofType;
41692 // :(first|last|only)-(child|of-type)
41696 while ((node = node[dir])) {
41697 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
41701 // Reverse direction for :only-* (if we haven't
41703 start = dir = type === "only" && !start && "nextSibling";
41708 start = [forward ? parent.firstChild : parent.lastChild];
41710 // non-xml :nth-child(...) stores cache data on `parent`
41711 if (forward && useCache) {
41712 // Seek `elem` from a previously-cached index
41713 outerCache = parent[expando] || (parent[expando] = {});
41714 cache = outerCache[type] || [];
41715 nodeIndex = cache[0] === dirruns && cache[1];
41716 diff = cache[0] === dirruns && cache[2];
41717 node = nodeIndex && parent.childNodes[nodeIndex];
41719 while ((node = ++nodeIndex && node && node[dir] ||
41721 // Fallback to seeking `elem` from the start
41722 (diff = nodeIndex = 0) || start.pop())) {
41724 // When found, cache indexes on `parent` and
41726 if (node.nodeType === 1 && ++diff && node === elem) {
41727 outerCache[type] = [dirruns, nodeIndex, diff];
41732 // Use previously-cached element index if available
41733 } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
41736 // xml :nth-child(...) or :nth-last-child(...) or
41737 // :nth(-last)?-of-type(...)
41739 // Use the same loop as above to seek `elem` from
41741 while ((node = ++nodeIndex && node && node[dir] ||
41742 (diff = nodeIndex = 0) || start.pop())) {
41744 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
41745 // Cache the index of each encountered
41748 (node[expando] || (node[expando] = {}))[type] = [dirruns, diff];
41751 if (node === elem) {
41758 // Incorporate the offset, then check against cycle size
41760 return diff === first || (diff % first === 0 && diff / first >= 0);
41765 "PSEUDO": function(pseudo, argument) {
41766 // pseudo-class names are case-insensitive
41767 // http://www.w3.org/TR/selectors/#pseudo-classes
41768 // Prioritize by case sensitivity in case custom pseudos are added
41769 // with uppercase letters
41770 // Remember that setFilters inherits from pseudos
41772 fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||
41773 Sizzle.error("unsupported pseudo: " + pseudo);
41775 // The user may use createPseudo to indicate that
41776 // arguments are needed to create the filter function
41777 // just as Sizzle does
41779 return fn(argument);
41782 // But maintain support for old signatures
41783 if (fn.length > 1) {
41784 args = [pseudo, pseudo, "", argument];
41785 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?
41786 markFunction(function(seed, matches) {
41788 matched = fn(seed, argument),
41789 i = matched.length;
41791 idx = indexOf(seed, matched[i]);
41792 seed[idx] = !(matches[idx] = matched[i]);
41796 return fn(elem, 0, args);
41805 // Potentially complex pseudos
41806 "not": markFunction(function(selector) {
41807 // Trim the selector passed to compile
41808 // to avoid treating leading and trailing
41809 // spaces as combinators
41812 matcher = compile(selector.replace(rtrim, "$1"));
41814 return matcher[expando] ?
41815 markFunction(function(seed, matches, context, xml) {
41817 unmatched = matcher(seed, null, xml, []),
41820 // Match elements unmatched by `matcher`
41822 if ((elem = unmatched[i])) {
41823 seed[i] = !(matches[i] = elem);
41827 function(elem, context, xml) {
41829 matcher(input, null, xml, results);
41830 // Don't keep the element (issue #299)
41832 return !results.pop();
41836 "has": markFunction(function(selector) {
41837 return function(elem) {
41838 return Sizzle(selector, elem).length > 0;
41842 "contains": markFunction(function(text) {
41843 text = text.replace(runescape, funescape);
41844 return function(elem) {
41845 return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
41849 // "Whether an element is represented by a :lang() selector
41850 // is based solely on the element's language value
41851 // being equal to the identifier C,
41852 // or beginning with the identifier C immediately followed by "-".
41853 // The matching of C against the element's language value is performed
41854 // case-insensitively.
41855 // The identifier C does not have to be a valid language name."
41856 // http://www.w3.org/TR/selectors/#lang-pseudo
41857 "lang": markFunction(function(lang) {
41858 // lang value must be a valid identifier
41859 if (!ridentifier.test(lang || "")) {
41860 Sizzle.error("unsupported lang: " + lang);
41862 lang = lang.replace(runescape, funescape).toLowerCase();
41863 return function(elem) {
41866 if ((elemLang = documentIsHTML ?
41868 elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
41870 elemLang = elemLang.toLowerCase();
41871 return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
41873 } while ((elem = elem.parentNode) && elem.nodeType === 1);
41879 "target": function(elem) {
41880 var hash = window.location && window.location.hash;
41881 return hash && hash.slice(1) === elem.id;
41884 "root": function(elem) {
41885 return elem === docElem;
41888 "focus": function(elem) {
41889 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
41892 // Boolean properties
41893 "enabled": function(elem) {
41894 return elem.disabled === false;
41897 "disabled": function(elem) {
41898 return elem.disabled === true;
41901 "checked": function(elem) {
41902 // In CSS3, :checked should return both checked and selected
41904 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
41905 var nodeName = elem.nodeName.toLowerCase();
41906 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
41909 "selected": function(elem) {
41910 // Accessing this property makes selected-by-default
41911 // options in Safari work properly
41912 if (elem.parentNode) {
41913 elem.parentNode.selectedIndex;
41916 return elem.selected === true;
41920 "empty": function(elem) {
41921 // http://www.w3.org/TR/selectors/#empty-pseudo
41922 // :empty is negated by element (1) or content nodes (text: 3;
41923 // cdata: 4; entity ref: 5),
41924 // but not by others (comment: 8; processing instruction: 7; etc.)
41925 // nodeType < 6 works because attributes (2) do not appear as
41927 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
41928 if (elem.nodeType < 6) {
41935 "parent": function(elem) {
41936 return !Expr.pseudos["empty"](elem);
41939 // Element/input types
41940 "header": function(elem) {
41941 return rheader.test(elem.nodeName);
41944 "input": function(elem) {
41945 return rinputs.test(elem.nodeName);
41948 "button": function(elem) {
41949 var name = elem.nodeName.toLowerCase();
41950 return name === "input" && elem.type === "button" || name === "button";
41953 "text": function(elem) {
41955 return elem.nodeName.toLowerCase() === "input" &&
41956 elem.type === "text" &&
41959 // New HTML5 attribute values (e.g., "search") appear with
41960 // elem.type === "text"
41961 ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
41964 // Position-in-collection
41965 "first": createPositionalPseudo(function() {
41969 "last": createPositionalPseudo(function(matchIndexes, length) {
41970 return [length - 1];
41973 "eq": createPositionalPseudo(function(matchIndexes, length, argument) {
41974 return [argument < 0 ? argument + length : argument];
41977 "even": createPositionalPseudo(function(matchIndexes, length) {
41979 for (; i < length; i += 2) {
41980 matchIndexes.push(i);
41982 return matchIndexes;
41985 "odd": createPositionalPseudo(function(matchIndexes, length) {
41987 for (; i < length; i += 2) {
41988 matchIndexes.push(i);
41990 return matchIndexes;
41993 "lt": createPositionalPseudo(function(matchIndexes, length, argument) {
41994 var i = argument < 0 ? argument + length : argument;
41995 for (; --i >= 0;) {
41996 matchIndexes.push(i);
41998 return matchIndexes;
42001 "gt": createPositionalPseudo(function(matchIndexes, length, argument) {
42002 var i = argument < 0 ? argument + length : argument;
42003 for (; ++i < length;) {
42004 matchIndexes.push(i);
42006 return matchIndexes;
42011 Expr.pseudos["nth"] = Expr.pseudos["eq"];
42013 // Add button/input type pseudos
42021 Expr.pseudos[i] = createInputPseudo(i);
42027 Expr.pseudos[i] = createButtonPseudo(i);
42030 // Easy API for creating new setFilters
42031 function setFilters() {}
42032 setFilters.prototype = Expr.filters = Expr.pseudos;
42033 Expr.setFilters = new setFilters();
42035 tokenize = Sizzle.tokenize = function(selector, parseOnly) {
42036 var matched, match, tokens, type,
42037 soFar, groups, preFilters,
42038 cached = tokenCache[selector + " "];
42041 return parseOnly ? 0 : cached.slice(0);
42046 preFilters = Expr.preFilter;
42050 // Comma and first run
42051 if (!matched || (match = rcomma.exec(soFar))) {
42053 // Don't consume trailing commas as valid
42054 soFar = soFar.slice(match[0].length) || soFar;
42056 groups.push((tokens = []));
42062 if ((match = rcombinators.exec(soFar))) {
42063 matched = match.shift();
42066 // Cast descendant combinators to space
42067 type: match[0].replace(rtrim, " ")
42069 soFar = soFar.slice(matched.length);
42073 for (type in Expr.filter) {
42074 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||
42075 (match = preFilters[type](match)))) {
42076 matched = match.shift();
42082 soFar = soFar.slice(matched.length);
42091 // Return the length of the invalid excess
42092 // if we're just parsing
42093 // Otherwise, throw an error or return tokens
42097 Sizzle.error(selector) :
42098 // Cache the tokens
42099 tokenCache(selector, groups).slice(0);
42102 function toSelector(tokens) {
42104 len = tokens.length,
42106 for (; i < len; i++) {
42107 selector += tokens[i].value;
42112 function addCombinator(matcher, combinator, base) {
42113 var dir = combinator.dir,
42114 checkNonElements = base && dir === "parentNode",
42117 return combinator.first ?
42118 // Check against closest ancestor/preceding element
42119 function(elem, context, xml) {
42120 while ((elem = elem[dir])) {
42121 if (elem.nodeType === 1 || checkNonElements) {
42122 return matcher(elem, context, xml);
42127 // Check against all ancestor/preceding elements
42128 function(elem, context, xml) {
42129 var oldCache, outerCache,
42130 newCache = [dirruns, doneName];
42132 // We can't set arbitrary data on XML nodes, so they don't benefit
42133 // from dir caching
42135 while ((elem = elem[dir])) {
42136 if (elem.nodeType === 1 || checkNonElements) {
42137 if (matcher(elem, context, xml)) {
42143 while ((elem = elem[dir])) {
42144 if (elem.nodeType === 1 || checkNonElements) {
42145 outerCache = elem[expando] || (elem[expando] = {});
42146 if ((oldCache = outerCache[dir]) &&
42147 oldCache[0] === dirruns && oldCache[1] === doneName) {
42149 // Assign to newCache so results back-propagate to
42150 // previous elements
42151 return (newCache[2] = oldCache[2]);
42153 // Reuse newcache so results back-propagate to
42154 // previous elements
42155 outerCache[dir] = newCache;
42157 // A match means we're done; a fail means we have to
42159 if ((newCache[2] = matcher(elem, context, xml))) {
42169 function elementMatcher(matchers) {
42170 return matchers.length > 1 ?
42171 function(elem, context, xml) {
42172 var i = matchers.length;
42174 if (!matchers[i](elem, context, xml)) {
42183 function multipleContexts(selector, contexts, results) {
42185 len = contexts.length;
42186 for (; i < len; i++) {
42187 Sizzle(selector, contexts[i], results);
42192 function condense(unmatched, map, filter, context, xml) {
42196 len = unmatched.length,
42197 mapped = map != null;
42199 for (; i < len; i++) {
42200 if ((elem = unmatched[i])) {
42201 if (!filter || filter(elem, context, xml)) {
42202 newUnmatched.push(elem);
42210 return newUnmatched;
42213 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
42214 if (postFilter && !postFilter[expando]) {
42215 postFilter = setMatcher(postFilter);
42217 if (postFinder && !postFinder[expando]) {
42218 postFinder = setMatcher(postFinder, postSelector);
42220 return markFunction(function(seed, results, context, xml) {
42224 preexisting = results.length,
42226 // Get initial elements from seed or context
42227 elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
42229 // Prefilter to get matcher input, preserving a map for seed-results
42231 matcherIn = preFilter && (seed || !selector) ?
42232 condense(elems, preMap, preFilter, context, xml) :
42235 matcherOut = matcher ?
42236 // If we have a postFinder, or filtered seed, or non-seed
42237 // postFilter or preexisting results,
42238 postFinder || (seed ? preFilter : preexisting || postFilter) ?
42240 // ...intermediate processing is necessary
42243 // ...otherwise use results directly
42247 // Find primary matches
42249 matcher(matcherIn, matcherOut, context, xml);
42252 // Apply postFilter
42254 temp = condense(matcherOut, postMap);
42255 postFilter(temp, [], context, xml);
42257 // Un-match failing elements by moving them back to matcherIn
42260 if ((elem = temp[i])) {
42261 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
42267 if (postFinder || preFilter) {
42269 // Get the final matcherOut by condensing this intermediate
42270 // into postFinder contexts
42272 i = matcherOut.length;
42274 if ((elem = matcherOut[i])) {
42275 // Restore matcherIn since elem is not yet a final
42277 temp.push((matcherIn[i] = elem));
42280 postFinder(null, (matcherOut = []), temp, xml);
42283 // Move matched elements from seed to results to keep them
42285 i = matcherOut.length;
42287 if ((elem = matcherOut[i]) &&
42288 (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
42290 seed[temp] = !(results[temp] = elem);
42295 // Add elements to results, through postFinder if defined
42297 matcherOut = condense(
42298 matcherOut === results ?
42299 matcherOut.splice(preexisting, matcherOut.length) :
42303 postFinder(null, results, matcherOut, xml);
42305 push.apply(results, matcherOut);
42311 function matcherFromTokens(tokens) {
42312 var checkContext, matcher, j,
42313 len = tokens.length,
42314 leadingRelative = Expr.relative[tokens[0].type],
42315 implicitRelative = leadingRelative || Expr.relative[" "],
42316 i = leadingRelative ? 1 : 0,
42318 // The foundational matcher ensures that elements are reachable from
42319 // top-level context(s)
42320 matchContext = addCombinator(function(elem) {
42321 return elem === checkContext;
42322 }, implicitRelative, true),
42323 matchAnyContext = addCombinator(function(elem) {
42324 return indexOf(checkContext, elem) > -1;
42325 }, implicitRelative, true),
42326 matchers = [function(elem, context, xml) {
42327 var ret = (!leadingRelative && (xml || context !== outermostContext)) || (
42328 (checkContext = context).nodeType ?
42329 matchContext(elem, context, xml) :
42330 matchAnyContext(elem, context, xml));
42331 // Avoid hanging onto element (issue #299)
42332 checkContext = null;
42336 for (; i < len; i++) {
42337 if ((matcher = Expr.relative[tokens[i].type])) {
42338 matchers = [addCombinator(elementMatcher(matchers), matcher)];
42340 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
42342 // Return special upon seeing a positional matcher
42343 if (matcher[expando]) {
42344 // Find the next relative operator (if any) for proper handling
42346 for (; j < len; j++) {
42347 if (Expr.relative[tokens[j].type]) {
42352 i > 1 && elementMatcher(matchers),
42353 i > 1 && toSelector(
42354 // If the preceding token was a descendant combinator,
42355 // insert an implicit any-element `*`
42356 tokens.slice(0, i - 1).concat({
42357 value: tokens[i - 2].type === " " ? "*" : ""
42359 ).replace(rtrim, "$1"),
42361 i < j && matcherFromTokens(tokens.slice(i, j)),
42362 j < len && matcherFromTokens((tokens = tokens.slice(j))),
42363 j < len && toSelector(tokens)
42366 matchers.push(matcher);
42370 return elementMatcher(matchers);
42373 function matcherFromGroupMatchers(elementMatchers, setMatchers) {
42374 var bySet = setMatchers.length > 0,
42375 byElement = elementMatchers.length > 0,
42376 superMatcher = function(seed, context, xml, results, outermost) {
42377 var elem, j, matcher,
42380 unmatched = seed && [],
42382 contextBackup = outermostContext,
42383 // We must always have either seed elements or outermost context
42384 elems = seed || byElement && Expr.find["TAG"]("*", outermost),
42385 // Use integer dirruns iff this is the outermost matcher
42386 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
42387 len = elems.length;
42390 outermostContext = context !== document && context;
42393 // Add elements passing elementMatchers directly to results
42394 // Keep `i` a string if there are no elements so `matchedCount` will
42396 // Support: IE<9, Safari
42397 // Tolerate NodeList properties (IE: "length"; Safari: <number>)
42398 // matching elements by id
42399 for (; i !== len && (elem = elems[i]) != null; i++) {
42400 if (byElement && elem) {
42402 while ((matcher = elementMatchers[j++])) {
42403 if (matcher(elem, context, xml)) {
42404 results.push(elem);
42409 dirruns = dirrunsUnique;
42413 // Track unmatched elements for set filters
42415 // They will have gone through all possible matchers
42416 if ((elem = !matcher && elem)) {
42420 // Lengthen the array for every element, matched or not
42422 unmatched.push(elem);
42427 // Apply set filters to unmatched elements
42429 if (bySet && i !== matchedCount) {
42431 while ((matcher = setMatchers[j++])) {
42432 matcher(unmatched, setMatched, context, xml);
42436 // Reintegrate element matches to eliminate the need for
42438 if (matchedCount > 0) {
42440 if (!(unmatched[i] || setMatched[i])) {
42441 setMatched[i] = pop.call(results);
42446 // Discard index placeholder values to get only actual
42448 setMatched = condense(setMatched);
42451 // Add matches to results
42452 push.apply(results, setMatched);
42454 // Seedless set matches succeeding multiple successful matchers
42455 // stipulate sorting
42456 if (outermost && !seed && setMatched.length > 0 &&
42457 (matchedCount + setMatchers.length) > 1) {
42459 Sizzle.uniqueSort(results);
42463 // Override manipulation of globals by nested matchers
42465 dirruns = dirrunsUnique;
42466 outermostContext = contextBackup;
42473 markFunction(superMatcher) :
42477 compile = Sizzle.compile = function(selector, match /* Internal Use Only */ ) {
42480 elementMatchers = [],
42481 cached = compilerCache[selector + " "];
42484 // Generate a function of recursive functions that can be used to check
42487 match = tokenize(selector);
42491 cached = matcherFromTokens(match[i]);
42492 if (cached[expando]) {
42493 setMatchers.push(cached);
42495 elementMatchers.push(cached);
42499 // Cache the compiled function
42500 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
42502 // Save selector and tokenization
42503 cached.selector = selector;
42509 * A low-level selection function that works with Sizzle's compiled selector
42512 * @param {String|Function}
42513 * selector A selector or a pre-compiled selector function built with
42520 * [seed] A set of elements to match against
42522 select = Sizzle.select = function(selector, context, results, seed) {
42523 var i, tokens, token, type, find,
42524 compiled = typeof selector === "function" && selector,
42525 match = !seed && tokenize((selector = compiled.selector || selector));
42527 results = results || [];
42529 // Try to minimize operations if there is no seed and only one group
42530 if (match.length === 1) {
42532 // Take a shortcut and set the context if the root selector is an ID
42533 tokens = match[0] = match[0].slice(0);
42534 if (tokens.length > 2 && (token = tokens[0]).type === "ID" &&
42535 support.getById && context.nodeType === 9 && documentIsHTML &&
42536 Expr.relative[tokens[1].type]) {
42538 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
42542 // Precompiled matchers will still verify ancestry, so step up a
42544 } else if (compiled) {
42545 context = context.parentNode;
42548 selector = selector.slice(tokens.shift().value.length);
42551 // Fetch a seed set for right-to-left matching
42552 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
42556 // Abort if we hit a combinator
42557 if (Expr.relative[(type = token.type)]) {
42560 if ((find = Expr.find[type])) {
42561 // Search, expanding context for leading sibling combinators
42563 token.matches[0].replace(runescape, funescape),
42564 rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
42567 // If seed is empty or no tokens remain, we can return early
42568 tokens.splice(i, 1);
42569 selector = seed.length && toSelector(tokens);
42571 push.apply(results, seed);
42581 // Compile and execute a filtering function if one is not provided
42582 // Provide `match` to avoid retokenization if we modified the selector above
42583 (compiled || compile(selector, match))(
42585 context, !documentIsHTML,
42587 rsibling.test(selector) && testContext(context.parentNode) || context
42592 // One-time assignments
42595 support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
42597 // Support: Chrome 14-35+
42598 // Always assume duplicates if they aren't passed to the comparison function
42599 support.detectDuplicates = !!hasDuplicate;
42601 // Initialize against the default document
42604 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
42605 // Detached nodes confoundingly follow *each other*
42606 support.sortDetached = assert(function(div1) {
42607 // Should return 1, but returns 4 (following)
42608 return div1.compareDocumentPosition(document.createElement("div")) & 1;
42612 // Prevent attribute/property "interpolation"
42613 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
42614 if (!assert(function(div) {
42615 div.innerHTML = "<a href='#'></a>";
42616 return div.firstChild.getAttribute("href") === "#";
42618 addHandle("type|href|height|width", function(elem, name, isXML) {
42620 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
42626 // Use defaultValue in place of getAttribute("value")
42627 if (!support.attributes || !assert(function(div) {
42628 div.innerHTML = "<input/>";
42629 div.firstChild.setAttribute("value", "");
42630 return div.firstChild.getAttribute("value") === "";
42632 addHandle("value", function(elem, name, isXML) {
42633 if (!isXML && elem.nodeName.toLowerCase() === "input") {
42634 return elem.defaultValue;
42640 // Use getAttributeNode to fetch booleans when getAttribute lies
42641 if (!assert(function(div) {
42642 return div.getAttribute("disabled") == null;
42644 addHandle(booleans, function(elem, name, isXML) {
42647 return elem[name] === true ? name.toLowerCase() :
42648 (val = elem.getAttributeNode(name)) && val.specified ?
42661 jQuery.find = Sizzle;
42662 jQuery.expr = Sizzle.selectors;
42663 jQuery.expr[":"] = jQuery.expr.pseudos;
42664 jQuery.unique = Sizzle.uniqueSort;
42665 jQuery.text = Sizzle.getText;
42666 jQuery.isXMLDoc = Sizzle.isXML;
42667 jQuery.contains = Sizzle.contains;
42671 var rneedsContext = jQuery.expr.match.needsContext;
42673 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
42677 var risSimple = /^.[^:#\[\.,]*$/;
42679 // Implement the identical functionality for filter and not
42680 function winnow(elements, qualifier, not) {
42681 if (jQuery.isFunction(qualifier)) {
42682 return jQuery.grep(elements, function(elem, i) {
42684 return !!qualifier.call(elem, i, elem) !== not;
42689 if (qualifier.nodeType) {
42690 return jQuery.grep(elements, function(elem) {
42691 return (elem === qualifier) !== not;
42696 if (typeof qualifier === "string") {
42697 if (risSimple.test(qualifier)) {
42698 return jQuery.filter(qualifier, elements, not);
42701 qualifier = jQuery.filter(qualifier, elements);
42704 return jQuery.grep(elements, function(elem) {
42705 return (indexOf.call(qualifier, elem) >= 0) !== not;
42709 jQuery.filter = function(expr, elems, not) {
42710 var elem = elems[0];
42713 expr = ":not(" + expr + ")";
42716 return elems.length === 1 && elem.nodeType === 1 ?
42717 jQuery.find.matchesSelector(elem, expr) ? [elem] : [] :
42718 jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
42719 return elem.nodeType === 1;
42724 find: function(selector) {
42730 if (typeof selector !== "string") {
42731 return this.pushStack(jQuery(selector).filter(function() {
42732 for (i = 0; i < len; i++) {
42733 if (jQuery.contains(self[i], this)) {
42740 for (i = 0; i < len; i++) {
42741 jQuery.find(selector, self[i], ret);
42744 // Needed because $( selector, context ) becomes $( context ).find(
42746 ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
42747 ret.selector = this.selector ? this.selector + " " + selector : selector;
42750 filter: function(selector) {
42751 return this.pushStack(winnow(this, selector || [], false));
42753 not: function(selector) {
42754 return this.pushStack(winnow(this, selector || [], true));
42756 is: function(selector) {
42760 // If this is a positional/relative selector, check membership in
42761 // the returned set
42762 // so $("p:first").is("p:last") won't return true for a doc with two
42764 typeof selector === "string" && rneedsContext.test(selector) ?
42773 // Initialize a jQuery object
42776 // A central reference to the root jQuery(document)
42779 // A simple way to check for HTML strings
42780 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
42781 // Strict HTML recognition (#11290: must start with <)
42782 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
42784 init = jQuery.fn.init = function(selector, context) {
42787 // HANDLE: $(""), $(null), $(undefined), $(false)
42792 // Handle HTML strings
42793 if (typeof selector === "string") {
42794 if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
42795 // Assume that strings that start and end with <> are HTML and
42796 // skip the regex check
42797 match = [null, selector, null];
42800 match = rquickExpr.exec(selector);
42803 // Match html or make sure no context is specified for #id
42804 if (match && (match[1] || !context)) {
42806 // HANDLE: $(html) -> $(array)
42808 context = context instanceof jQuery ? context[0] : context;
42810 // Option to run scripts is true for back-compat
42811 // Intentionally let the error be thrown if parseHTML is not
42813 jQuery.merge(this, jQuery.parseHTML(
42815 context && context.nodeType ? context.ownerDocument || context : document,
42819 // HANDLE: $(html, props)
42820 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
42821 for (match in context) {
42822 // Properties of context are called as methods if
42824 if (jQuery.isFunction(this[match])) {
42825 this[match](context[match]);
42827 // ...and otherwise set as attributes
42829 this.attr(match, context[match]);
42838 elem = document.getElementById(match[2]);
42840 // Support: Blackberry 4.6
42841 // gEBID returns nodes no longer in the document (#6963)
42842 if (elem && elem.parentNode) {
42843 // Inject the element directly into the jQuery object
42848 this.context = document;
42849 this.selector = selector;
42853 // HANDLE: $(expr, $(...))
42854 } else if (!context || context.jquery) {
42855 return (context || rootjQuery).find(selector);
42857 // HANDLE: $(expr, context)
42858 // (which is just equivalent to: $(context).find(expr)
42860 return this.constructor(context).find(selector);
42863 // HANDLE: $(DOMElement)
42864 } else if (selector.nodeType) {
42865 this.context = this[0] = selector;
42869 // HANDLE: $(function)
42870 // Shortcut for document ready
42871 } else if (jQuery.isFunction(selector)) {
42872 return typeof rootjQuery.ready !== "undefined" ?
42873 rootjQuery.ready(selector) :
42874 // Execute immediately if ready is not present
42878 if (selector.selector !== undefined) {
42879 this.selector = selector.selector;
42880 this.context = selector.context;
42883 return jQuery.makeArray(selector, this);
42886 // Give the init function the jQuery prototype for later instantiation
42887 init.prototype = jQuery.fn;
42889 // Initialize central reference
42890 rootjQuery = jQuery(document);
42893 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
42894 // Methods guaranteed to produce a unique set when starting from a unique
42896 guaranteedUnique = {
42904 dir: function(elem, dir, until) {
42906 truncate = until !== undefined;
42908 while ((elem = elem[dir]) && elem.nodeType !== 9) {
42909 if (elem.nodeType === 1) {
42910 if (truncate && jQuery(elem).is(until)) {
42913 matched.push(elem);
42919 sibling: function(n, elem) {
42922 for (; n; n = n.nextSibling) {
42923 if (n.nodeType === 1 && n !== elem) {
42933 has: function(target) {
42934 var targets = jQuery(target, this),
42935 l = targets.length;
42937 return this.filter(function() {
42939 for (; i < l; i++) {
42940 if (jQuery.contains(this, targets[i])) {
42947 closest: function(selectors, context) {
42952 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ?
42953 jQuery(selectors, context || this.context) :
42956 for (; i < l; i++) {
42957 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
42958 // Always skip document fragments
42959 if (cur.nodeType < 11 && (pos ?
42960 pos.index(cur) > -1 :
42962 // Don't pass non-elements to Sizzle
42963 cur.nodeType === 1 &&
42964 jQuery.find.matchesSelector(cur, selectors))) {
42972 return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched);
42975 // Determine the position of an element within the set
42976 index: function(elem) {
42978 // No argument, return index in parent
42980 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1;
42983 // Index in selector
42984 if (typeof elem === "string") {
42985 return indexOf.call(jQuery(elem), this[0]);
42988 // Locate the position of the desired element
42989 return indexOf.call(this,
42991 // If it receives a jQuery object, the first element is used
42992 elem.jquery ? elem[0] : elem
42996 add: function(selector, context) {
42997 return this.pushStack(
42999 jQuery.merge(this.get(), jQuery(selector, context))
43004 addBack: function(selector) {
43005 return this.add(selector == null ?
43006 this.prevObject : this.prevObject.filter(selector)
43011 function sibling(cur, dir) {
43012 while ((cur = cur[dir]) && cur.nodeType !== 1) {}
43017 parent: function(elem) {
43018 var parent = elem.parentNode;
43019 return parent && parent.nodeType !== 11 ? parent : null;
43021 parents: function(elem) {
43022 return jQuery.dir(elem, "parentNode");
43024 parentsUntil: function(elem, i, until) {
43025 return jQuery.dir(elem, "parentNode", until);
43027 next: function(elem) {
43028 return sibling(elem, "nextSibling");
43030 prev: function(elem) {
43031 return sibling(elem, "previousSibling");
43033 nextAll: function(elem) {
43034 return jQuery.dir(elem, "nextSibling");
43036 prevAll: function(elem) {
43037 return jQuery.dir(elem, "previousSibling");
43039 nextUntil: function(elem, i, until) {
43040 return jQuery.dir(elem, "nextSibling", until);
43042 prevUntil: function(elem, i, until) {
43043 return jQuery.dir(elem, "previousSibling", until);
43045 siblings: function(elem) {
43046 return jQuery.sibling((elem.parentNode || {}).firstChild, elem);
43048 children: function(elem) {
43049 return jQuery.sibling(elem.firstChild);
43051 contents: function(elem) {
43052 return elem.contentDocument || jQuery.merge([], elem.childNodes);
43054 }, function(name, fn) {
43055 jQuery.fn[name] = function(until, selector) {
43056 var matched = jQuery.map(this, fn, until);
43058 if (name.slice(-5) !== "Until") {
43062 if (selector && typeof selector === "string") {
43063 matched = jQuery.filter(selector, matched);
43066 if (this.length > 1) {
43067 // Remove duplicates
43068 if (!guaranteedUnique[name]) {
43069 jQuery.unique(matched);
43072 // Reverse order for parents* and prev-derivatives
43073 if (rparentsprev.test(name)) {
43078 return this.pushStack(matched);
43081 var rnotwhite = (/\S+/g);
43085 // String to Object options format cache
43086 var optionsCache = {};
43088 // Convert String-formatted options into Object-formatted ones and store in
43090 function createOptions(options) {
43091 var object = optionsCache[options] = {};
43092 jQuery.each(options.match(rnotwhite) || [], function(_, flag) {
43093 object[flag] = true;
43099 * Create a callback list using the following parameters:
43101 * options: an optional list of space-separated options that will change how the
43102 * callback list behaves or a more traditional option object
43104 * By default a callback list will act like an event callback list and can be
43105 * "fired" multiple times.
43107 * Possible options:
43109 * once: will ensure the callback list can only be fired once (like a Deferred)
43111 * memory: will keep track of previous values and will call any callback added
43112 * after the list has been fired right away with the latest "memorized" values
43113 * (like a Deferred)
43115 * unique: will ensure a callback can only be added once (no duplicate in the
43118 * stopOnFalse: interrupt callings when a callback returns false
43121 jQuery.Callbacks = function(options) {
43123 // Convert options from String-formatted to Object-formatted if needed
43124 // (we check in cache first)
43125 options = typeof options === "string" ?
43126 (optionsCache[options] || createOptions(options)) :
43127 jQuery.extend({}, options);
43129 var // Last fire value (for non-forgettable lists)
43131 // Flag to know if list was already fired
43133 // Flag to know if list is currently firing
43135 // First callback to fire (used internally by add and fireWith)
43137 // End of the loop when firing
43139 // Index of currently firing callback (modified by remove if needed)
43141 // Actual callback list
43143 // Stack of fire calls for repeatable lists
43144 stack = !options.once && [],
43146 fire = function(data) {
43147 memory = options.memory && data;
43149 firingIndex = firingStart || 0;
43151 firingLength = list.length;
43153 for (; list && firingIndex < firingLength; firingIndex++) {
43154 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
43155 memory = false; // To prevent further calls using add
43162 if (stack.length) {
43163 fire(stack.shift());
43165 } else if (memory) {
43172 // Actual Callbacks object
43174 // Add a callback or a collection of callbacks to the list
43177 // First, we save the current length
43178 var start = list.length;
43179 (function add(args) {
43180 jQuery.each(args, function(_, arg) {
43181 var type = jQuery.type(arg);
43182 if (type === "function") {
43183 if (!options.unique || !self.has(arg)) {
43186 } else if (arg && arg.length && type !== "string") {
43187 // Inspect recursively
43192 // Do we need to add the callbacks to the
43193 // current firing batch?
43195 firingLength = list.length;
43196 // With memory, if we're not firing then
43197 // we should call right away
43198 } else if (memory) {
43199 firingStart = start;
43205 // Remove a callback from the list
43206 remove: function() {
43208 jQuery.each(arguments, function(_, arg) {
43210 while ((index = jQuery.inArray(arg, list, index)) > -1) {
43211 list.splice(index, 1);
43212 // Handle firing indexes
43214 if (index <= firingLength) {
43217 if (index <= firingIndex) {
43226 // Check if a given callback is in the list.
43227 // If no argument is given, return whether or not list has callbacks
43229 has: function(fn) {
43230 return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length);
43232 // Remove all callbacks from the list
43233 empty: function() {
43238 // Have the list do nothing anymore
43239 disable: function() {
43240 list = stack = memory = undefined;
43244 disabled: function() {
43247 // Lock the list in its current state
43256 locked: function() {
43259 // Call all callbacks with the given context and arguments
43260 fireWith: function(context, args) {
43261 if (list && (!fired || stack)) {
43263 args = [context, args.slice ? args.slice() : args];
43272 // Call all the callbacks with the given arguments
43274 self.fireWith(this, arguments);
43277 // To know if the callbacks have already been called at least once
43278 fired: function() {
43289 Deferred: function(func) {
43291 // action, add listener, listener list, final state
43292 ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
43293 ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
43294 ["notify", "progress", jQuery.Callbacks("memory")]
43298 state: function() {
43301 always: function() {
43302 deferred.done(arguments).fail(arguments);
43305 then: function( /* fnDone, fnFail, fnProgress */ ) {
43306 var fns = arguments;
43307 return jQuery.Deferred(function(newDefer) {
43308 jQuery.each(tuples, function(i, tuple) {
43309 var fn = jQuery.isFunction(fns[i]) && fns[i];
43310 // deferred[ done | fail | progress ] for forwarding
43311 // actions to newDefer
43312 deferred[tuple[1]](function() {
43313 var returned = fn && fn.apply(this, arguments);
43314 if (returned && jQuery.isFunction(returned.promise)) {
43316 .done(newDefer.resolve)
43317 .fail(newDefer.reject)
43318 .progress(newDefer.notify);
43320 newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments);
43327 // Get a promise for this deferred
43328 // If obj is provided, the promise aspect is added to the object
43329 promise: function(obj) {
43330 return obj != null ? jQuery.extend(obj, promise) : promise;
43335 // Keep pipe for back-compat
43336 promise.pipe = promise.then;
43338 // Add list-specific methods
43339 jQuery.each(tuples, function(i, tuple) {
43340 var list = tuple[2],
43341 stateString = tuple[3];
43343 // promise[ done | fail | progress ] = list.add
43344 promise[tuple[1]] = list.add;
43348 list.add(function() {
43349 // state = [ resolved | rejected ]
43350 state = stateString;
43352 // [ reject_list | resolve_list ].disable; progress_list.lock
43353 }, tuples[i ^ 1][2].disable, tuples[2][2].lock);
43356 // deferred[ resolve | reject | notify ]
43357 deferred[tuple[0]] = function() {
43358 deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
43361 deferred[tuple[0] + "With"] = list.fireWith;
43364 // Make the deferred a promise
43365 promise.promise(deferred);
43367 // Call given func if any
43369 func.call(deferred, deferred);
43377 when: function(subordinate /* , ..., subordinateN */ ) {
43379 resolveValues = slice.call(arguments),
43380 length = resolveValues.length,
43382 // the count of uncompleted subordinates
43383 remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0,
43385 // the master Deferred. If resolveValues consist of only a single
43386 // Deferred, just use that.
43387 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
43389 // Update function for both resolve and progress values
43390 updateFunc = function(i, contexts, values) {
43391 return function(value) {
43392 contexts[i] = this;
43393 values[i] = arguments.length > 1 ? slice.call(arguments) : value;
43394 if (values === progressValues) {
43395 deferred.notifyWith(contexts, values);
43396 } else if (!(--remaining)) {
43397 deferred.resolveWith(contexts, values);
43402 progressValues, progressContexts, resolveContexts;
43404 // Add listeners to Deferred subordinates; treat others as resolved
43406 progressValues = new Array(length);
43407 progressContexts = new Array(length);
43408 resolveContexts = new Array(length);
43409 for (; i < length; i++) {
43410 if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
43411 resolveValues[i].promise()
43412 .done(updateFunc(i, resolveContexts, resolveValues))
43413 .fail(deferred.reject)
43414 .progress(updateFunc(i, progressContexts, progressValues));
43421 // If we're not waiting on anything, resolve the master
43423 deferred.resolveWith(resolveContexts, resolveValues);
43426 return deferred.promise();
43431 // The deferred used on DOM ready
43434 jQuery.fn.ready = function(fn) {
43435 // Add the callback
43436 jQuery.ready.promise().done(fn);
43442 // Is the DOM ready to be used? Set to true once it occurs.
43445 // A counter to track how many items to wait for before
43446 // the ready event fires. See #6781
43449 // Hold (or release) the ready event
43450 holdReady: function(hold) {
43452 jQuery.readyWait++;
43454 jQuery.ready(true);
43458 // Handle when the DOM is ready
43459 ready: function(wait) {
43461 // Abort if there are pending holds or we're already ready
43462 if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
43466 // Remember that the DOM is ready
43467 jQuery.isReady = true;
43469 // If a normal DOM Ready event fired, decrement, and wait if need be
43470 if (wait !== true && --jQuery.readyWait > 0) {
43474 // If there are functions bound, to execute
43475 readyList.resolveWith(document, [jQuery]);
43477 // Trigger any bound ready events
43478 if (jQuery.fn.triggerHandler) {
43479 jQuery(document).triggerHandler("ready");
43480 jQuery(document).off("ready");
43486 * The ready event handler and self cleanup method
43488 function completed() {
43489 document.removeEventListener("DOMContentLoaded", completed, false);
43490 window.removeEventListener("load", completed, false);
43494 jQuery.ready.promise = function(obj) {
43497 readyList = jQuery.Deferred();
43499 // Catch cases where $(document).ready() is called after the browser
43500 // event has already occurred.
43501 // We once tried to use readyState "interactive" here, but it caused
43502 // issues like the one
43503 // discovered by ChrisS here:
43504 // http://bugs.jquery.com/ticket/12282#comment:15
43505 if (document.readyState === "complete") {
43506 // Handle it asynchronously to allow scripts the opportunity to
43508 setTimeout(jQuery.ready);
43512 // Use the handy event callback
43513 document.addEventListener("DOMContentLoaded", completed, false);
43515 // A fallback to window.onload, that will always work
43516 window.addEventListener("load", completed, false);
43519 return readyList.promise(obj);
43522 // Kick off the DOM ready check even if the user does not
43523 jQuery.ready.promise();
43528 // Multifunctional method to get and set values of a collection
43529 // The value/s can optionally be executed if it's a function
43530 var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) {
43532 len = elems.length,
43533 bulk = key == null;
43535 // Sets many values
43536 if (jQuery.type(key) === "object") {
43539 jQuery.access(elems, fn, i, key[i], true, emptyGet, raw);
43543 } else if (value !== undefined) {
43546 if (!jQuery.isFunction(value)) {
43551 // Bulk operations run against the entire set
43553 fn.call(elems, value);
43556 // ...except when executing function values
43559 fn = function(elem, key, value) {
43560 return bulk.call(jQuery(elem), value);
43566 for (; i < len; i++) {
43567 fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
43578 len ? fn(elems[0], key) : emptyGet;
43583 * Determines whether an object can have data
43585 jQuery.acceptData = function(owner) {
43588 // - Node.ELEMENT_NODE
43589 // - Node.DOCUMENT_NODE
43593 return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType);
43598 // Support: Android<4,
43599 // Old WebKit does not have Object.preventExtensions/freeze method,
43600 // return new empty object instead with no [[set]] accessor
43601 Object.defineProperty(this.cache = {}, 0, {
43607 this.expando = jQuery.expando + Data.uid++;
43611 Data.accepts = jQuery.acceptData;
43614 key: function(owner) {
43615 // We can accept data for non-element nodes in modern browsers,
43616 // but we should not, see #8335.
43617 // Always return the key for a frozen object.
43618 if (!Data.accepts(owner)) {
43622 var descriptor = {},
43623 // Check if the owner object already has a cache key
43624 unlock = owner[this.expando];
43626 // If not, create one
43628 unlock = Data.uid++;
43630 // Secure it in a non-enumerable, non-writable property
43632 descriptor[this.expando] = {
43635 Object.defineProperties(owner, descriptor);
43637 // Support: Android<4
43638 // Fallback to a less secure definition
43640 descriptor[this.expando] = unlock;
43641 jQuery.extend(owner, descriptor);
43645 // Ensure the cache object
43646 if (!this.cache[unlock]) {
43647 this.cache[unlock] = {};
43652 set: function(owner, data, value) {
43654 // There may be an unlock assigned to this node,
43655 // if there is no entry for this "owner", create one inline
43656 // and set the unlock as though an owner entry had always existed
43657 unlock = this.key(owner),
43658 cache = this.cache[unlock];
43660 // Handle: [ owner, key, value ] args
43661 if (typeof data === "string") {
43662 cache[data] = value;
43664 // Handle: [ owner, { properties } ] args
43666 // Fresh assignments by object are shallow copied
43667 if (jQuery.isEmptyObject(cache)) {
43668 jQuery.extend(this.cache[unlock], data);
43669 // Otherwise, copy the properties one-by-one to the cache object
43671 for (prop in data) {
43672 cache[prop] = data[prop];
43678 get: function(owner, key) {
43679 // Either a valid cache is found, or will be created.
43680 // New caches will be created and the unlock returned,
43681 // allowing direct access to the newly created
43682 // empty data object. A valid owner object must be provided.
43683 var cache = this.cache[this.key(owner)];
43685 return key === undefined ?
43686 cache : cache[key];
43688 access: function(owner, key, value) {
43690 // In cases where either:
43692 // 1. No key was specified
43693 // 2. A string key was specified, but no value provided
43695 // Take the "read" path and allow the get method to determine
43696 // which value to return, respectively either:
43698 // 1. The entire cache object
43699 // 2. The data stored at the key
43701 if (key === undefined ||
43702 ((key && typeof key === "string") && value === undefined)) {
43704 stored = this.get(owner, key);
43706 return stored !== undefined ?
43707 stored : this.get(owner, jQuery.camelCase(key));
43710 // [*]When the key is not a string, or both a key and value
43711 // are specified, set or extend (existing objects) with either:
43713 // 1. An object of properties
43714 // 2. A key and value
43716 this.set(owner, key, value);
43718 // Since the "set" path can have two possible entry points
43719 // return the expected data based on which path was taken[*]
43720 return value !== undefined ? value : key;
43722 remove: function(owner, key) {
43723 var i, name, camel,
43724 unlock = this.key(owner),
43725 cache = this.cache[unlock];
43727 if (key === undefined) {
43728 this.cache[unlock] = {};
43731 // Support array or space separated string of keys
43732 if (jQuery.isArray(key)) {
43733 // If "name" is an array of keys...
43734 // When data is initially created, via ("key", "val") signature,
43735 // keys will be converted to camelCase.
43736 // Since there is no way to tell _how_ a key was added, remove
43737 // both plain key and camelCase key. #12786
43738 // This will only penalize the array argument path.
43739 name = key.concat(key.map(jQuery.camelCase));
43741 camel = jQuery.camelCase(key);
43742 // Try the string as a key before any manipulation
43743 if (key in cache) {
43744 name = [key, camel];
43746 // If a key with the spaces exists, use it.
43747 // Otherwise, create an array by matching non-whitespace
43749 name = name in cache ? [name] : (name.match(rnotwhite) || []);
43755 delete cache[name[i]];
43759 hasData: function(owner) {
43760 return !jQuery.isEmptyObject(
43761 this.cache[owner[this.expando]] || {}
43764 discard: function(owner) {
43765 if (owner[this.expando]) {
43766 delete this.cache[owner[this.expando]];
43770 var data_priv = new Data();
43772 var data_user = new Data();
43776 // Implementation Summary
43778 // 1. Enforce API surface and semantic compatibility with 1.9.x branch
43779 // 2. Improve the module's maintainability by reducing the storage
43780 // paths to a single mechanism.
43781 // 3. Use the same single mechanism to support "private" and "user" data.
43782 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
43783 // 5. Avoid exposing implementation details on user objects (eg. expando
43785 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
43787 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
43788 rmultiDash = /([A-Z])/g;
43790 function dataAttr(elem, key, data) {
43793 // If nothing was found internally, try to fetch any
43794 // data from the HTML5 data-* attribute
43795 if (data === undefined && elem.nodeType === 1) {
43796 name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
43797 data = elem.getAttribute(name);
43799 if (typeof data === "string") {
43801 data = data === "true" ? true :
43802 data === "false" ? false :
43803 data === "null" ? null :
43804 // Only convert to a number if it doesn't change the string
43805 +data + "" === data ? +data :
43806 rbrace.test(data) ? jQuery.parseJSON(data) :
43810 // Make sure we set the data so it isn't changed later
43811 data_user.set(elem, key, data);
43820 hasData: function(elem) {
43821 return data_user.hasData(elem) || data_priv.hasData(elem);
43824 data: function(elem, name, data) {
43825 return data_user.access(elem, name, data);
43828 removeData: function(elem, name) {
43829 data_user.remove(elem, name);
43832 // TODO: Now that all calls to _data and _removeData have been replaced
43833 // with direct calls to data_priv methods, these can be deprecated.
43834 _data: function(elem, name, data) {
43835 return data_priv.access(elem, name, data);
43838 _removeData: function(elem, name) {
43839 data_priv.remove(elem, name);
43844 data: function(key, value) {
43847 attrs = elem && elem.attributes;
43850 if (key === undefined) {
43852 data = data_user.get(elem);
43854 if (elem.nodeType === 1 && !data_priv.get(elem, "hasDataAttrs")) {
43859 // The attrs elements can be null (#14894)
43861 name = attrs[i].name;
43862 if (name.indexOf("data-") === 0) {
43863 name = jQuery.camelCase(name.slice(5));
43864 dataAttr(elem, name, data[name]);
43868 data_priv.set(elem, "hasDataAttrs", true);
43875 // Sets multiple values
43876 if (typeof key === "object") {
43877 return this.each(function() {
43878 data_user.set(this, key);
43882 return access(this, function(value) {
43884 camelKey = jQuery.camelCase(key);
43886 // The calling jQuery object (element matches) is not empty
43887 // (and therefore has an element appears at this[ 0 ]) and the
43888 // `value` parameter was not undefined. An empty jQuery object
43889 // will result in `undefined` for elem = this[ 0 ] which will
43890 // throw an exception if an attempt to read a data cache is made.
43891 if (elem && value === undefined) {
43892 // Attempt to get data from the cache
43893 // with the key as-is
43894 data = data_user.get(elem, key);
43895 if (data !== undefined) {
43899 // Attempt to get data from the cache
43900 // with the key camelized
43901 data = data_user.get(elem, camelKey);
43902 if (data !== undefined) {
43906 // Attempt to "discover" the data in
43907 // HTML5 custom data-* attrs
43908 data = dataAttr(elem, camelKey, undefined);
43909 if (data !== undefined) {
43913 // We tried really hard, but the data doesn't exist.
43918 this.each(function() {
43919 // First, attempt to store a copy or reference of any
43920 // data that might've been store with a camelCased key.
43921 var data = data_user.get(this, camelKey);
43923 // For HTML5 data-* attribute interop, we have to
43924 // store property names with dashes in a camelCase form.
43925 // This might not apply to all properties...*
43926 data_user.set(this, camelKey, value);
43928 // *... In the case of properties that might _actually_
43929 // have dashes, we need to also store a copy of that
43930 // unchanged property.
43931 if (key.indexOf("-") !== -1 && data !== undefined) {
43932 data_user.set(this, key, value);
43935 }, null, value, arguments.length > 1, null, true);
43938 removeData: function(key) {
43939 return this.each(function() {
43940 data_user.remove(this, key);
43947 queue: function(elem, type, data) {
43951 type = (type || "fx") + "queue";
43952 queue = data_priv.get(elem, type);
43954 // Speed up dequeue by getting out quickly if this is just a lookup
43956 if (!queue || jQuery.isArray(data)) {
43957 queue = data_priv.access(elem, type, jQuery.makeArray(data));
43962 return queue || [];
43966 dequeue: function(elem, type) {
43967 type = type || "fx";
43969 var queue = jQuery.queue(elem, type),
43970 startLength = queue.length,
43971 fn = queue.shift(),
43972 hooks = jQuery._queueHooks(elem, type),
43973 next = function() {
43974 jQuery.dequeue(elem, type);
43977 // If the fx queue is dequeued, always remove the progress sentinel
43978 if (fn === "inprogress") {
43979 fn = queue.shift();
43985 // Add a progress sentinel to prevent the fx queue from being
43986 // automatically dequeued
43987 if (type === "fx") {
43988 queue.unshift("inprogress");
43991 // Clear up the last queue stop function
43993 fn.call(elem, next, hooks);
43996 if (!startLength && hooks) {
43997 hooks.empty.fire();
44001 // Not public - generate a queueHooks object, or return the current one
44002 _queueHooks: function(elem, type) {
44003 var key = type + "queueHooks";
44004 return data_priv.get(elem, key) || data_priv.access(elem, key, {
44005 empty: jQuery.Callbacks("once memory").add(function() {
44006 data_priv.remove(elem, [type + "queue", key]);
44013 queue: function(type, data) {
44016 if (typeof type !== "string") {
44022 if (arguments.length < setter) {
44023 return jQuery.queue(this[0], type);
44026 return data === undefined ?
44028 this.each(function() {
44029 var queue = jQuery.queue(this, type, data);
44031 // Ensure a hooks for this queue
44032 jQuery._queueHooks(this, type);
44034 if (type === "fx" && queue[0] !== "inprogress") {
44035 jQuery.dequeue(this, type);
44039 dequeue: function(type) {
44040 return this.each(function() {
44041 jQuery.dequeue(this, type);
44044 clearQueue: function(type) {
44045 return this.queue(type || "fx", []);
44047 // Get a promise resolved when queues of a certain type
44048 // are emptied (fx is the type by default)
44049 promise: function(type, obj) {
44052 defer = jQuery.Deferred(),
44055 resolve = function() {
44057 defer.resolveWith(elements, [elements]);
44061 if (typeof type !== "string") {
44065 type = type || "fx";
44068 tmp = data_priv.get(elements[i], type + "queueHooks");
44069 if (tmp && tmp.empty) {
44071 tmp.empty.add(resolve);
44075 return defer.promise(obj);
44078 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
44080 var cssExpand = ["Top", "Right", "Bottom", "Left"];
44082 var isHidden = function(elem, el) {
44083 // isHidden might be called from jQuery#filter function;
44084 // in that case, element will be second argument
44086 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem);
44089 var rcheckableType = (/^(?:checkbox|radio)$/i);
44094 var fragment = document.createDocumentFragment(),
44095 div = fragment.appendChild(document.createElement("div")),
44096 input = document.createElement("input");
44098 // Support: Safari<=5.1
44099 // Check state lost if the name is set (#11217)
44100 // Support: Windows Web Apps (WWA)
44101 // `name` and `type` must use .setAttribute for WWA (#14901)
44102 input.setAttribute("type", "radio");
44103 input.setAttribute("checked", "checked");
44104 input.setAttribute("name", "t");
44106 div.appendChild(input);
44108 // Support: Safari<=5.1, Android<4.2
44109 // Older WebKit doesn't clone checked state correctly in fragments
44110 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
44112 // Support: IE<=11+
44113 // Make sure textarea (and checkbox) defaultValue is properly cloned
44114 div.innerHTML = "<textarea>x</textarea>";
44115 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
44117 var strundefined = typeof undefined;
44121 support.focusinBubbles = "onfocusin" in window;
44125 rkeyEvent = /^key/,
44126 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
44127 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
44128 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
44130 function returnTrue() {
44134 function returnFalse() {
44138 function safeActiveElement() {
44140 return document.activeElement;
44145 * Helper functions for managing events -- not part of the public interface.
44146 * Props to Dean Edwards' addEvent library for many of the ideas.
44152 add: function(elem, types, handler, data, selector) {
44154 var handleObjIn, eventHandle, tmp,
44155 events, t, handleObj,
44156 special, handlers, type, namespaces, origType,
44157 elemData = data_priv.get(elem);
44159 // Don't attach events to noData or text/comment nodes (but allow plain
44165 // Caller can pass in an object of custom data in lieu of the handler
44166 if (handler.handler) {
44167 handleObjIn = handler;
44168 handler = handleObjIn.handler;
44169 selector = handleObjIn.selector;
44172 // Make sure that the handler has a unique ID, used to find/remove it
44174 if (!handler.guid) {
44175 handler.guid = jQuery.guid++;
44178 // Init the element's event structure and main handler, if this is the
44180 if (!(events = elemData.events)) {
44181 events = elemData.events = {};
44183 if (!(eventHandle = elemData.handle)) {
44184 eventHandle = elemData.handle = function(e) {
44185 // Discard the second event of a jQuery.event.trigger() and
44186 // when an event is called after a page has unloaded
44187 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
44188 jQuery.event.dispatch.apply(elem, arguments) : undefined;
44192 // Handle multiple events separated by a space
44193 types = (types || "").match(rnotwhite) || [""];
44196 tmp = rtypenamespace.exec(types[t]) || [];
44197 type = origType = tmp[1];
44198 namespaces = (tmp[2] || "").split(".").sort();
44200 // There *must* be a type, no attaching namespace-only handlers
44205 // If event changes its type, use the special event handlers for the
44207 special = jQuery.event.special[type] || {};
44209 // If selector defined, determine special event api type, otherwise
44211 type = (selector ? special.delegateType : special.bindType) || type;
44213 // Update special based on newly reset type
44214 special = jQuery.event.special[type] || {};
44216 // handleObj is passed to all event handlers
44217 handleObj = jQuery.extend({
44219 origType: origType,
44222 guid: handler.guid,
44223 selector: selector,
44224 needsContext: selector && jQuery.expr.match.needsContext.test(selector),
44225 namespace: namespaces.join(".")
44228 // Init the event handler queue if we're the first
44229 if (!(handlers = events[type])) {
44230 handlers = events[type] = [];
44231 handlers.delegateCount = 0;
44233 // Only use addEventListener if the special events handler
44235 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
44236 if (elem.addEventListener) {
44237 elem.addEventListener(type, eventHandle, false);
44243 special.add.call(elem, handleObj);
44245 if (!handleObj.handler.guid) {
44246 handleObj.handler.guid = handler.guid;
44250 // Add to the element's handler list, delegates in front
44252 handlers.splice(handlers.delegateCount++, 0, handleObj);
44254 handlers.push(handleObj);
44257 // Keep track of which events have ever been used, for event
44259 jQuery.event.global[type] = true;
44264 // Detach an event or set of events from an element
44265 remove: function(elem, types, handler, selector, mappedTypes) {
44267 var j, origCount, tmp,
44268 events, t, handleObj,
44269 special, handlers, type, namespaces, origType,
44270 elemData = data_priv.hasData(elem) && data_priv.get(elem);
44272 if (!elemData || !(events = elemData.events)) {
44276 // Once for each type.namespace in types; type may be omitted
44277 types = (types || "").match(rnotwhite) || [""];
44280 tmp = rtypenamespace.exec(types[t]) || [];
44281 type = origType = tmp[1];
44282 namespaces = (tmp[2] || "").split(".").sort();
44284 // Unbind all events (on this namespace, if provided) for the
44287 for (type in events) {
44288 jQuery.event.remove(elem, type + types[t], handler, selector, true);
44293 special = jQuery.event.special[type] || {};
44294 type = (selector ? special.delegateType : special.bindType) || type;
44295 handlers = events[type] || [];
44296 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
44298 // Remove matching events
44299 origCount = j = handlers.length;
44301 handleObj = handlers[j];
44303 if ((mappedTypes || origType === handleObj.origType) &&
44304 (!handler || handler.guid === handleObj.guid) &&
44305 (!tmp || tmp.test(handleObj.namespace)) &&
44306 (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
44307 handlers.splice(j, 1);
44309 if (handleObj.selector) {
44310 handlers.delegateCount--;
44312 if (special.remove) {
44313 special.remove.call(elem, handleObj);
44318 // Remove generic event handler if we removed something and no more
44320 // (avoids potential for endless recursion during removal of special
44322 if (origCount && !handlers.length) {
44323 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
44324 jQuery.removeEvent(elem, type, elemData.handle);
44327 delete events[type];
44331 // Remove the expando if it's no longer used
44332 if (jQuery.isEmptyObject(events)) {
44333 delete elemData.handle;
44334 data_priv.remove(elem, "events");
44338 trigger: function(event, data, elem, onlyHandlers) {
44340 var i, cur, tmp, bubbleType, ontype, handle, special,
44341 eventPath = [elem || document],
44342 type = hasOwn.call(event, "type") ? event.type : event,
44343 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
44345 cur = tmp = elem = elem || document;
44347 // Don't do events on text and comment nodes
44348 if (elem.nodeType === 3 || elem.nodeType === 8) {
44352 // focus/blur morphs to focusin/out; ensure we're not firing them right
44354 if (rfocusMorph.test(type + jQuery.event.triggered)) {
44358 if (type.indexOf(".") >= 0) {
44359 // Namespaced trigger; create a regexp to match event type in
44361 namespaces = type.split(".");
44362 type = namespaces.shift();
44365 ontype = type.indexOf(":") < 0 && "on" + type;
44367 // Caller can pass in a jQuery.Event object, Object, or just an event
44369 event = event[jQuery.expando] ?
44371 new jQuery.Event(type, typeof event === "object" && event);
44373 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always
44375 event.isTrigger = onlyHandlers ? 2 : 3;
44376 event.namespace = namespaces.join(".");
44377 event.namespace_re = event.namespace ?
44378 new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") :
44381 // Clean up the event in case it is being reused
44382 event.result = undefined;
44383 if (!event.target) {
44384 event.target = elem;
44387 // Clone any incoming data and prepend the event, creating the handler
44389 data = data == null ? [event] :
44390 jQuery.makeArray(data, [event]);
44392 // Allow special events to draw outside the lines
44393 special = jQuery.event.special[type] || {};
44394 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
44398 // Determine event propagation path in advance, per W3C events spec
44400 // Bubble up to document, then to window; watch for a global
44401 // ownerDocument var (#9724)
44402 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
44404 bubbleType = special.delegateType || type;
44405 if (!rfocusMorph.test(bubbleType + type)) {
44406 cur = cur.parentNode;
44408 for (; cur; cur = cur.parentNode) {
44409 eventPath.push(cur);
44413 // Only add window if we got to document (e.g., not plain obj or
44415 if (tmp === (elem.ownerDocument || document)) {
44416 eventPath.push(tmp.defaultView || tmp.parentWindow || window);
44420 // Fire handlers on the event path
44422 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
44424 event.type = i > 1 ?
44426 special.bindType || type;
44429 handle = (data_priv.get(cur, "events") || {})[event.type] && data_priv.get(cur, "handle");
44431 handle.apply(cur, data);
44435 handle = ontype && cur[ontype];
44436 if (handle && handle.apply && jQuery.acceptData(cur)) {
44437 event.result = handle.apply(cur, data);
44438 if (event.result === false) {
44439 event.preventDefault();
44445 // If nobody prevented the default action, do it now
44446 if (!onlyHandlers && !event.isDefaultPrevented()) {
44448 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) &&
44449 jQuery.acceptData(elem)) {
44451 // Call a native DOM method on the target with the same name
44452 // name as the event.
44453 // Don't do default actions on window, that's where global
44454 // variables be (#6170)
44455 if (ontype && jQuery.isFunction(elem[type]) && !jQuery.isWindow(elem)) {
44457 // Don't re-trigger an onFOO event when we call its FOO()
44459 tmp = elem[ontype];
44462 elem[ontype] = null;
44465 // Prevent re-triggering of the same event, since we already
44466 // bubbled it above
44467 jQuery.event.triggered = type;
44469 jQuery.event.triggered = undefined;
44472 elem[ontype] = tmp;
44478 return event.result;
44481 dispatch: function(event) {
44483 // Make a writable jQuery.Event from the native event object
44484 event = jQuery.event.fix(event);
44486 var i, j, ret, matched, handleObj,
44488 args = slice.call(arguments),
44489 handlers = (data_priv.get(this, "events") || {})[event.type] || [],
44490 special = jQuery.event.special[event.type] || {};
44492 // Use the fix-ed jQuery.Event rather than the (read-only) native event
44494 event.delegateTarget = this;
44496 // Call the preDispatch hook for the mapped type, and let it bail if
44498 if (special.preDispatch && special.preDispatch.call(this, event) === false) {
44502 // Determine handlers
44503 handlerQueue = jQuery.event.handlers.call(this, event, handlers);
44505 // Run delegates first; they may want to stop propagation beneath us
44507 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
44508 event.currentTarget = matched.elem;
44511 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
44513 // Triggered event must either 1) have no namespace, or 2) have
44515 // a subset or equal to those in the bound event (both can have
44517 if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
44519 event.handleObj = handleObj;
44520 event.data = handleObj.data;
44522 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler)
44523 .apply(matched.elem, args);
44525 if (ret !== undefined) {
44526 if ((event.result = ret) === false) {
44527 event.preventDefault();
44528 event.stopPropagation();
44535 // Call the postDispatch hook for the mapped type
44536 if (special.postDispatch) {
44537 special.postDispatch.call(this, event);
44540 return event.result;
44543 handlers: function(event, handlers) {
44544 var i, matches, sel, handleObj,
44546 delegateCount = handlers.delegateCount,
44547 cur = event.target;
44549 // Find delegate handlers
44550 // Black-hole SVG <use> instance trees (#13180)
44551 // Avoid non-left-click bubbling in Firefox (#3861)
44552 if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
44554 for (; cur !== this; cur = cur.parentNode || this) {
44556 // Don't process clicks on disabled elements (#6911, #8165,
44558 if (cur.disabled !== true || event.type !== "click") {
44560 for (i = 0; i < delegateCount; i++) {
44561 handleObj = handlers[i];
44563 // Don't conflict with Object.prototype properties
44565 sel = handleObj.selector + " ";
44567 if (matches[sel] === undefined) {
44568 matches[sel] = handleObj.needsContext ?
44569 jQuery(sel, this).index(cur) >= 0 :
44570 jQuery.find(sel, this, null, [cur]).length;
44572 if (matches[sel]) {
44573 matches.push(handleObj);
44576 if (matches.length) {
44577 handlerQueue.push({
44586 // Add the remaining (directly-bound) handlers
44587 if (delegateCount < handlers.length) {
44588 handlerQueue.push({
44590 handlers: handlers.slice(delegateCount)
44594 return handlerQueue;
44597 // Includes some event props shared by KeyEvent and MouseEvent
44598 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
44603 props: "char charCode key keyCode".split(" "),
44604 filter: function(event, original) {
44606 // Add which for key events
44607 if (event.which == null) {
44608 event.which = original.charCode != null ? original.charCode : original.keyCode;
44616 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
44617 filter: function(event, original) {
44618 var eventDoc, doc, body,
44619 button = original.button;
44621 // Calculate pageX/Y if missing and clientX/Y available
44622 if (event.pageX == null && original.clientX != null) {
44623 eventDoc = event.target.ownerDocument || document;
44624 doc = eventDoc.documentElement;
44625 body = eventDoc.body;
44627 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
44628 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
44631 // Add which for click: 1 === left; 2 === middle; 3 === right
44632 // Note: button is not normalized, so don't use it
44633 if (!event.which && button !== undefined) {
44634 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
44641 fix: function(event) {
44642 if (event[jQuery.expando]) {
44646 // Create a writable copy of the event object and normalize some
44650 originalEvent = event,
44651 fixHook = this.fixHooks[type];
44654 this.fixHooks[type] = fixHook =
44655 rmouseEvent.test(type) ? this.mouseHooks :
44656 rkeyEvent.test(type) ? this.keyHooks : {};
44658 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
44660 event = new jQuery.Event(originalEvent);
44665 event[prop] = originalEvent[prop];
44668 // Support: Cordova 2.5 (WebKit) (#13255)
44669 // All events should have a target; Cordova deviceready doesn't
44670 if (!event.target) {
44671 event.target = document;
44674 // Support: Safari 6.0+, Chrome<28
44675 // Target should not be a text node (#504, #13143)
44676 if (event.target.nodeType === 3) {
44677 event.target = event.target.parentNode;
44680 return fixHook.filter ? fixHook.filter(event, originalEvent) : event;
44685 // Prevent triggered image.load events from bubbling to window.load
44689 // Fire native event if possible so blur/focus sequence is correct
44690 trigger: function() {
44691 if (this !== safeActiveElement() && this.focus) {
44696 delegateType: "focusin"
44699 trigger: function() {
44700 if (this === safeActiveElement() && this.blur) {
44705 delegateType: "focusout"
44708 // For checkbox, fire native event so checked state will be right
44709 trigger: function() {
44710 if (this.type === "checkbox" && this.click && jQuery.nodeName(this, "input")) {
44716 // For cross-browser consistency, don't fire native .click() on
44718 _default: function(event) {
44719 return jQuery.nodeName(event.target, "a");
44724 postDispatch: function(event) {
44726 // Support: Firefox 20+
44727 // Firefox doesn't alert if the returnValue field is not set.
44728 if (event.result !== undefined && event.originalEvent) {
44729 event.originalEvent.returnValue = event.result;
44735 simulate: function(type, elem, event, bubble) {
44736 // Piggyback on a donor event to simulate a different one.
44737 // Fake originalEvent to avoid donor's stopPropagation, but if the
44738 // simulated event prevents default then we do the same on the donor.
44739 var e = jQuery.extend(
44740 new jQuery.Event(),
44748 jQuery.event.trigger(e, null, elem);
44750 jQuery.event.dispatch.call(elem, e);
44752 if (e.isDefaultPrevented()) {
44753 event.preventDefault();
44758 jQuery.removeEvent = function(elem, type, handle) {
44759 if (elem.removeEventListener) {
44760 elem.removeEventListener(type, handle, false);
44764 jQuery.Event = function(src, props) {
44765 // Allow instantiation without the 'new' keyword
44766 if (!(this instanceof jQuery.Event)) {
44767 return new jQuery.Event(src, props);
44771 if (src && src.type) {
44772 this.originalEvent = src;
44773 this.type = src.type;
44775 // Events bubbling up the document may have been marked as prevented
44776 // by a handler lower down the tree; reflect the correct value.
44777 this.isDefaultPrevented = src.defaultPrevented ||
44778 src.defaultPrevented === undefined &&
44779 // Support: Android<4.0
44780 src.returnValue === false ?
44789 // Put explicitly provided properties onto the event object
44791 jQuery.extend(this, props);
44794 // Create a timestamp if incoming event doesn't have one
44795 this.timeStamp = src && src.timeStamp || jQuery.now();
44797 // Mark it as fixed
44798 this[jQuery.expando] = true;
44801 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language
44803 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
44804 jQuery.Event.prototype = {
44805 isDefaultPrevented: returnFalse,
44806 isPropagationStopped: returnFalse,
44807 isImmediatePropagationStopped: returnFalse,
44809 preventDefault: function() {
44810 var e = this.originalEvent;
44812 this.isDefaultPrevented = returnTrue;
44814 if (e && e.preventDefault) {
44815 e.preventDefault();
44818 stopPropagation: function() {
44819 var e = this.originalEvent;
44821 this.isPropagationStopped = returnTrue;
44823 if (e && e.stopPropagation) {
44824 e.stopPropagation();
44827 stopImmediatePropagation: function() {
44828 var e = this.originalEvent;
44830 this.isImmediatePropagationStopped = returnTrue;
44832 if (e && e.stopImmediatePropagation) {
44833 e.stopImmediatePropagation();
44836 this.stopPropagation();
44840 // Create mouseenter/leave events using mouseover/out and event-time checks
44841 // Support: Chrome 15+
44843 mouseenter: "mouseover",
44844 mouseleave: "mouseout",
44845 pointerenter: "pointerover",
44846 pointerleave: "pointerout"
44847 }, function(orig, fix) {
44848 jQuery.event.special[orig] = {
44852 handle: function(event) {
44855 related = event.relatedTarget,
44856 handleObj = event.handleObj;
44858 // For mousenter/leave call the handler if related is outside the
44860 // NB: No relatedTarget if the mouse left/entered the browser window
44861 if (!related || (related !== target && !jQuery.contains(target, related))) {
44862 event.type = handleObj.origType;
44863 ret = handleObj.handler.apply(this, arguments);
44871 // Support: Firefox, Chrome, Safari
44872 // Create "bubbling" focus and blur events
44873 if (!support.focusinBubbles) {
44877 }, function(orig, fix) {
44879 // Attach a single capturing handler on the document while someone wants
44880 // focusin/focusout
44881 var handler = function(event) {
44882 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true);
44885 jQuery.event.special[fix] = {
44886 setup: function() {
44887 var doc = this.ownerDocument || this,
44888 attaches = data_priv.access(doc, fix);
44891 doc.addEventListener(orig, handler, true);
44893 data_priv.access(doc, fix, (attaches || 0) + 1);
44895 teardown: function() {
44896 var doc = this.ownerDocument || this,
44897 attaches = data_priv.access(doc, fix) - 1;
44900 doc.removeEventListener(orig, handler, true);
44901 data_priv.remove(doc, fix);
44904 data_priv.access(doc, fix, attaches);
44913 on: function(types, selector, data, fn, /* INTERNAL */ one) {
44916 // Types can be a map of types/handlers
44917 if (typeof types === "object") {
44918 // ( types-Object, selector, data )
44919 if (typeof selector !== "string") {
44920 // ( types-Object, data )
44921 data = data || selector;
44922 selector = undefined;
44924 for (type in types) {
44925 this.on(type, selector, data, types[type], one);
44930 if (data == null && fn == null) {
44933 data = selector = undefined;
44934 } else if (fn == null) {
44935 if (typeof selector === "string") {
44936 // ( types, selector, fn )
44940 // ( types, data, fn )
44943 selector = undefined;
44946 if (fn === false) {
44954 fn = function(event) {
44955 // Can use an empty set, since event contains the info
44956 jQuery().off(event);
44957 return origFn.apply(this, arguments);
44959 // Use same guid so caller can remove using origFn
44960 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
44962 return this.each(function() {
44963 jQuery.event.add(this, types, fn, data, selector);
44966 one: function(types, selector, data, fn) {
44967 return this.on(types, selector, data, fn, 1);
44969 off: function(types, selector, fn) {
44970 var handleObj, type;
44971 if (types && types.preventDefault && types.handleObj) {
44972 // ( event ) dispatched jQuery.Event
44973 handleObj = types.handleObj;
44974 jQuery(types.delegateTarget).off(
44975 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
44976 handleObj.selector,
44981 if (typeof types === "object") {
44982 // ( types-object [, selector] )
44983 for (type in types) {
44984 this.off(type, selector, types[type]);
44988 if (selector === false || typeof selector === "function") {
44989 // ( types [, fn] )
44991 selector = undefined;
44993 if (fn === false) {
44996 return this.each(function() {
44997 jQuery.event.remove(this, types, fn, selector);
45001 trigger: function(type, data) {
45002 return this.each(function() {
45003 jQuery.event.trigger(type, data, this);
45006 triggerHandler: function(type, data) {
45007 var elem = this[0];
45009 return jQuery.event.trigger(type, data, elem, true);
45016 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
45017 rtagName = /<([\w:]+)/,
45018 rhtml = /<|&#?\w+;/,
45019 rnoInnerhtml = /<(?:script|style|link)/i,
45020 // checked="checked" or checked
45021 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
45022 rscriptType = /^$|\/(?:java|ecma)script/i,
45023 rscriptTypeMasked = /^true\/(.*)/,
45024 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
45026 // We have to close these tags to support XHTML (#13200)
45030 option: [1, "<select multiple='multiple'>", "</select>"],
45032 thead: [1, "<table>", "</table>"],
45033 col: [2, "<table><colgroup>", "</colgroup></table>"],
45034 tr: [2, "<table><tbody>", "</tbody></table>"],
45035 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
45037 _default: [0, "", ""]
45041 wrapMap.optgroup = wrapMap.option;
45043 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
45044 wrapMap.th = wrapMap.td;
45046 // Support: 1.x compatibility
45047 // Manipulating tables requires a tbody
45048 function manipulationTarget(elem, content) {
45049 return jQuery.nodeName(elem, "table") &&
45050 jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr") ?
45052 elem.getElementsByTagName("tbody")[0] ||
45053 elem.appendChild(elem.ownerDocument.createElement("tbody")) :
45057 // Replace/restore the type attribute of script elements for safe DOM
45059 function disableScript(elem) {
45060 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
45064 function restoreScript(elem) {
45065 var match = rscriptTypeMasked.exec(elem.type);
45068 elem.type = match[1];
45070 elem.removeAttribute("type");
45076 // Mark scripts as having already been evaluated
45077 function setGlobalEval(elems, refElements) {
45081 for (; i < l; i++) {
45083 elems[i], "globalEval", !refElements || data_priv.get(refElements[i], "globalEval")
45088 function cloneCopyEvent(src, dest) {
45089 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
45091 if (dest.nodeType !== 1) {
45095 // 1. Copy private data: events, handlers, etc.
45096 if (data_priv.hasData(src)) {
45097 pdataOld = data_priv.access(src);
45098 pdataCur = data_priv.set(dest, pdataOld);
45099 events = pdataOld.events;
45102 delete pdataCur.handle;
45103 pdataCur.events = {};
45105 for (type in events) {
45106 for (i = 0, l = events[type].length; i < l; i++) {
45107 jQuery.event.add(dest, type, events[type][i]);
45113 // 2. Copy user data
45114 if (data_user.hasData(src)) {
45115 udataOld = data_user.access(src);
45116 udataCur = jQuery.extend({}, udataOld);
45118 data_user.set(dest, udataCur);
45122 function getAll(context, tag) {
45123 var ret = context.getElementsByTagName ? context.getElementsByTagName(tag || "*") :
45124 context.querySelectorAll ? context.querySelectorAll(tag || "*") : [];
45126 return tag === undefined || tag && jQuery.nodeName(context, tag) ?
45127 jQuery.merge([context], ret) :
45131 // Fix IE bugs, see support tests
45132 function fixInput(src, dest) {
45133 var nodeName = dest.nodeName.toLowerCase();
45135 // Fails to persist the checked state of a cloned checkbox or radio button.
45136 if (nodeName === "input" && rcheckableType.test(src.type)) {
45137 dest.checked = src.checked;
45139 // Fails to return the selected option to the default selected state when
45141 } else if (nodeName === "input" || nodeName === "textarea") {
45142 dest.defaultValue = src.defaultValue;
45147 clone: function(elem, dataAndEvents, deepDataAndEvents) {
45148 var i, l, srcElements, destElements,
45149 clone = elem.cloneNode(true),
45150 inPage = jQuery.contains(elem.ownerDocument, elem);
45152 // Fix IE cloning issues
45153 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) &&
45154 !jQuery.isXMLDoc(elem)) {
45156 // We eschew Sizzle here for performance reasons:
45157 // http://jsperf.com/getall-vs-sizzle/2
45158 destElements = getAll(clone);
45159 srcElements = getAll(elem);
45161 for (i = 0, l = srcElements.length; i < l; i++) {
45162 fixInput(srcElements[i], destElements[i]);
45166 // Copy the events from the original to the clone
45167 if (dataAndEvents) {
45168 if (deepDataAndEvents) {
45169 srcElements = srcElements || getAll(elem);
45170 destElements = destElements || getAll(clone);
45172 for (i = 0, l = srcElements.length; i < l; i++) {
45173 cloneCopyEvent(srcElements[i], destElements[i]);
45176 cloneCopyEvent(elem, clone);
45180 // Preserve script evaluation history
45181 destElements = getAll(clone, "script");
45182 if (destElements.length > 0) {
45183 setGlobalEval(destElements, !inPage && getAll(elem, "script"));
45186 // Return the cloned set
45190 buildFragment: function(elems, context, scripts, selection) {
45191 var elem, tmp, tag, wrap, contains, j,
45192 fragment = context.createDocumentFragment(),
45197 for (; i < l; i++) {
45200 if (elem || elem === 0) {
45202 // Add nodes directly
45203 if (jQuery.type(elem) === "object") {
45204 // Support: QtWebKit, PhantomJS
45205 // push.apply(_, arraylike) throws on ancient WebKit
45206 jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
45208 // Convert non-html into a text node
45209 } else if (!rhtml.test(elem)) {
45210 nodes.push(context.createTextNode(elem));
45212 // Convert html into DOM nodes
45214 tmp = tmp || fragment.appendChild(context.createElement("div"));
45216 // Deserialize a standard representation
45217 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
45218 wrap = wrapMap[tag] || wrapMap._default;
45219 tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
45221 // Descend through wrappers to the right content
45224 tmp = tmp.lastChild;
45227 // Support: QtWebKit, PhantomJS
45228 // push.apply(_, arraylike) throws on ancient WebKit
45229 jQuery.merge(nodes, tmp.childNodes);
45231 // Remember the top-level container
45232 tmp = fragment.firstChild;
45234 // Ensure the created nodes are orphaned (#12392)
45235 tmp.textContent = "";
45240 // Remove wrapper from fragment
45241 fragment.textContent = "";
45244 while ((elem = nodes[i++])) {
45246 // #4087 - If origin and destination elements are the same, and this
45248 // that element, do not do anything
45249 if (selection && jQuery.inArray(elem, selection) !== -1) {
45253 contains = jQuery.contains(elem.ownerDocument, elem);
45255 // Append to fragment
45256 tmp = getAll(fragment.appendChild(elem), "script");
45258 // Preserve script evaluation history
45260 setGlobalEval(tmp);
45263 // Capture executables
45266 while ((elem = tmp[j++])) {
45267 if (rscriptType.test(elem.type || "")) {
45268 scripts.push(elem);
45277 cleanData: function(elems) {
45278 var data, elem, type, key,
45279 special = jQuery.event.special,
45283 (elem = elems[i]) !== undefined; i++) {
45284 if (jQuery.acceptData(elem)) {
45285 key = elem[data_priv.expando];
45287 if (key && (data = data_priv.cache[key])) {
45289 for (type in data.events) {
45290 if (special[type]) {
45291 jQuery.event.remove(elem, type);
45293 // This is a shortcut to avoid jQuery.event.remove's
45296 jQuery.removeEvent(elem, type, data.handle);
45300 if (data_priv.cache[key]) {
45301 // Discard any remaining `private` data
45302 delete data_priv.cache[key];
45306 // Discard any remaining `user` data
45307 delete data_user.cache[elem[data_user.expando]];
45313 text: function(value) {
45314 return access(this, function(value) {
45315 return value === undefined ?
45316 jQuery.text(this) :
45317 this.empty().each(function() {
45318 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
45319 this.textContent = value;
45322 }, null, value, arguments.length);
45325 append: function() {
45326 return this.domManip(arguments, function(elem) {
45327 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
45328 var target = manipulationTarget(this, elem);
45329 target.appendChild(elem);
45334 prepend: function() {
45335 return this.domManip(arguments, function(elem) {
45336 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
45337 var target = manipulationTarget(this, elem);
45338 target.insertBefore(elem, target.firstChild);
45343 before: function() {
45344 return this.domManip(arguments, function(elem) {
45345 if (this.parentNode) {
45346 this.parentNode.insertBefore(elem, this);
45351 after: function() {
45352 return this.domManip(arguments, function(elem) {
45353 if (this.parentNode) {
45354 this.parentNode.insertBefore(elem, this.nextSibling);
45359 remove: function(selector, keepData /* Internal Use Only */ ) {
45361 elems = selector ? jQuery.filter(selector, this) : this,
45365 (elem = elems[i]) != null; i++) {
45366 if (!keepData && elem.nodeType === 1) {
45367 jQuery.cleanData(getAll(elem));
45370 if (elem.parentNode) {
45371 if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
45372 setGlobalEval(getAll(elem, "script"));
45374 elem.parentNode.removeChild(elem);
45381 empty: function() {
45386 (elem = this[i]) != null; i++) {
45387 if (elem.nodeType === 1) {
45389 // Prevent memory leaks
45390 jQuery.cleanData(getAll(elem, false));
45392 // Remove any remaining nodes
45393 elem.textContent = "";
45400 clone: function(dataAndEvents, deepDataAndEvents) {
45401 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
45402 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
45404 return this.map(function() {
45405 return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
45409 html: function(value) {
45410 return access(this, function(value) {
45411 var elem = this[0] || {},
45415 if (value === undefined && elem.nodeType === 1) {
45416 return elem.innerHTML;
45419 // See if we can take a shortcut and just use innerHTML
45420 if (typeof value === "string" && !rnoInnerhtml.test(value) &&
45421 !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
45423 value = value.replace(rxhtmlTag, "<$1></$2>");
45426 for (; i < l; i++) {
45427 elem = this[i] || {};
45429 // Remove element nodes and prevent memory leaks
45430 if (elem.nodeType === 1) {
45431 jQuery.cleanData(getAll(elem, false));
45432 elem.innerHTML = value;
45438 // If using innerHTML throws an exception, use the fallback
45444 this.empty().append(value);
45446 }, null, value, arguments.length);
45449 replaceWith: function() {
45450 var arg = arguments[0];
45452 // Make the changes, replacing each context element with the new content
45453 this.domManip(arguments, function(elem) {
45454 arg = this.parentNode;
45456 jQuery.cleanData(getAll(this));
45459 arg.replaceChild(elem, this);
45463 // Force removal if there was no new content (e.g., from empty
45465 return arg && (arg.length || arg.nodeType) ? this : this.remove();
45468 detach: function(selector) {
45469 return this.remove(selector, true);
45472 domManip: function(args, callback) {
45474 // Flatten any nested arrays
45475 args = concat.apply([], args);
45477 var fragment, first, scripts, hasScripts, node, doc,
45483 isFunction = jQuery.isFunction(value);
45485 // We can't cloneNode fragments that contain checked, in WebKit
45487 (l > 1 && typeof value === "string" &&
45488 !support.checkClone && rchecked.test(value))) {
45489 return this.each(function(index) {
45490 var self = set.eq(index);
45492 args[0] = value.call(this, index, self.html());
45494 self.domManip(args, callback);
45499 fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
45500 first = fragment.firstChild;
45502 if (fragment.childNodes.length === 1) {
45507 scripts = jQuery.map(getAll(fragment, "script"), disableScript);
45508 hasScripts = scripts.length;
45510 // Use the original fragment for the last item instead of the
45511 // first because it can end up
45512 // being emptied incorrectly in certain situations (#8070).
45513 for (; i < l; i++) {
45516 if (i !== iNoClone) {
45517 node = jQuery.clone(node, true, true);
45519 // Keep references to cloned scripts for later
45522 // Support: QtWebKit
45523 // jQuery.merge because push.apply(_, arraylike)
45525 jQuery.merge(scripts, getAll(node, "script"));
45529 callback.call(this[i], node, i);
45533 doc = scripts[scripts.length - 1].ownerDocument;
45535 // Reenable scripts
45536 jQuery.map(scripts, restoreScript);
45538 // Evaluate executable scripts on first document insertion
45539 for (i = 0; i < hasScripts; i++) {
45541 if (rscriptType.test(node.type || "") &&
45542 !data_priv.access(node, "globalEval") && jQuery.contains(doc, node)) {
45545 // Optional AJAX dependency, but won't run
45546 // scripts if not present
45547 if (jQuery._evalUrl) {
45548 jQuery._evalUrl(node.src);
45551 jQuery.globalEval(node.textContent.replace(rcleanScript, ""));
45564 appendTo: "append",
45565 prependTo: "prepend",
45566 insertBefore: "before",
45567 insertAfter: "after",
45568 replaceAll: "replaceWith"
45569 }, function(name, original) {
45570 jQuery.fn[name] = function(selector) {
45573 insert = jQuery(selector),
45574 last = insert.length - 1,
45577 for (; i <= last; i++) {
45578 elems = i === last ? this : this.clone(true);
45579 jQuery(insert[i])[original](elems);
45581 // Support: QtWebKit
45582 // .get() because push.apply(_, arraylike) throws
45583 push.apply(ret, elems.get());
45586 return this.pushStack(ret);
45595 * Retrieve the actual display of a element
45598 * name nodeName of the element
45600 * doc Document object
45602 // Called only from within defaultDisplay
45603 function actualDisplay(name, doc) {
45605 elem = jQuery(doc.createElement(name)).appendTo(doc.body),
45607 // getDefaultComputedStyle might be reliably used only on attached
45609 display = window.getDefaultComputedStyle && (style = window.getDefaultComputedStyle(elem[0])) ?
45611 // Use of this method is a temporary fix (more like optimization)
45612 // until something better comes along,
45613 // since it was removed from specification and supported only in FF
45614 style.display : jQuery.css(elem[0], "display");
45616 // We don't have any data stored on the element,
45617 // so use "detach" method as fast way to get rid of the element
45624 * Try to determine the default display value of an element
45629 function defaultDisplay(nodeName) {
45630 var doc = document,
45631 display = elemdisplay[nodeName];
45634 display = actualDisplay(nodeName, doc);
45636 // If the simple way fails, read from inside an iframe
45637 if (display === "none" || !display) {
45639 // Use the already-created iframe if possible
45640 iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
45642 // Always write a new HTML skeleton so Webkit and Firefox don't
45644 doc = iframe[0].contentDocument;
45650 display = actualDisplay(nodeName, doc);
45654 // Store the correct default display
45655 elemdisplay[nodeName] = display;
45660 var rmargin = (/^margin/);
45662 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
45664 var getStyles = function(elem) {
45665 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
45666 // IE throws on elements created in popups
45667 // FF meanwhile throws on frame elements through
45668 // "defaultView.getComputedStyle"
45669 if (elem.ownerDocument.defaultView.opener) {
45670 return elem.ownerDocument.defaultView.getComputedStyle(elem, null);
45673 return window.getComputedStyle(elem, null);
45678 function curCSS(elem, name, computed) {
45679 var width, minWidth, maxWidth, ret,
45680 style = elem.style;
45682 computed = computed || getStyles(elem);
45685 // getPropertyValue is only needed for .css('filter') (#12537)
45687 ret = computed.getPropertyValue(name) || computed[name];
45692 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
45693 ret = jQuery.style(elem, name);
45696 // Support: iOS < 6
45697 // A tribute to the "awesome hack by Dean Edwards"
45698 // iOS < 6 (at least) returns percentage for a larger set of values, but
45699 // width seems to be reliably pixels
45700 // this is against the CSSOM draft spec:
45701 // http://dev.w3.org/csswg/cssom/#resolved-values
45702 if (rnumnonpx.test(ret) && rmargin.test(name)) {
45704 // Remember the original values
45705 width = style.width;
45706 minWidth = style.minWidth;
45707 maxWidth = style.maxWidth;
45709 // Put in the new values to get a computed value out
45710 style.minWidth = style.maxWidth = style.width = ret;
45711 ret = computed.width;
45713 // Revert the changed values
45714 style.width = width;
45715 style.minWidth = minWidth;
45716 style.maxWidth = maxWidth;
45720 return ret !== undefined ?
45722 // IE returns zIndex value as an integer.
45728 function addGetHookIf(conditionFn, hookFn) {
45729 // Define the hook, we'll check on the first run if it's really needed.
45732 if (conditionFn()) {
45733 // Hook not needed (or it's not possible to use it due
45734 // to missing dependency), remove it.
45739 // Hook needed; redefine it so that the support test is not executed
45741 return (this.get = hookFn).apply(this, arguments);
45748 var pixelPositionVal, boxSizingReliableVal,
45749 docElem = document.documentElement,
45750 container = document.createElement("div"),
45751 div = document.createElement("div");
45757 // Support: IE9-11+
45758 // Style of cloned element affects source element cloned (#8908)
45759 div.style.backgroundClip = "content-box";
45760 div.cloneNode(true).style.backgroundClip = "";
45761 support.clearCloneStyle = div.style.backgroundClip === "content-box";
45763 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
45764 "position:absolute";
45765 container.appendChild(div);
45767 // Executing both pixelPosition & boxSizingReliable tests require only one
45769 // so they're executed at the same time to save the second computation.
45770 function computePixelPositionAndBoxSizingReliable() {
45771 div.style.cssText =
45772 // Support: Firefox<29, Android 2.3
45773 // Vendor-prefix box-sizing
45774 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
45775 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
45776 "border:1px;padding:1px;width:4px;position:absolute";
45777 div.innerHTML = "";
45778 docElem.appendChild(container);
45780 var divStyle = window.getComputedStyle(div, null);
45781 pixelPositionVal = divStyle.top !== "1%";
45782 boxSizingReliableVal = divStyle.width === "4px";
45784 docElem.removeChild(container);
45787 // Support: node.js jsdom
45788 // Don't assume that getComputedStyle is a property of the global object
45789 if (window.getComputedStyle) {
45790 jQuery.extend(support, {
45791 pixelPosition: function() {
45793 // This test is executed only once but we still do memoizing
45794 // since we can use the boxSizingReliable pre-computing.
45795 // No need to check if the test was already performed, though.
45796 computePixelPositionAndBoxSizingReliable();
45797 return pixelPositionVal;
45799 boxSizingReliable: function() {
45800 if (boxSizingReliableVal == null) {
45801 computePixelPositionAndBoxSizingReliable();
45803 return boxSizingReliableVal;
45805 reliableMarginRight: function() {
45807 // Support: Android 2.3
45808 // Check if div with explicit width and no margin-right
45810 // gets computed margin-right based on width of container.
45812 // WebKit Bug 13343 - getComputedStyle returns wrong value for
45814 // This support function is only executed once so no memoizing
45817 marginDiv = div.appendChild(document.createElement("div"));
45819 // Reset CSS: box-sizing; display; margin; border; padding
45820 marginDiv.style.cssText = div.style.cssText =
45821 // Support: Firefox<29, Android 2.3
45822 // Vendor-prefix box-sizing
45823 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
45824 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
45825 marginDiv.style.marginRight = marginDiv.style.width = "0";
45826 div.style.width = "1px";
45827 docElem.appendChild(container);
45829 ret = !parseFloat(window.getComputedStyle(marginDiv, null).marginRight);
45831 docElem.removeChild(container);
45832 div.removeChild(marginDiv);
45841 // A method for quickly swapping in/out CSS properties to get correct
45843 jQuery.swap = function(elem, options, callback, args) {
45847 // Remember the old values, and insert the new ones
45848 for (name in options) {
45849 old[name] = elem.style[name];
45850 elem.style[name] = options[name];
45853 ret = callback.apply(elem, args || []);
45855 // Revert the old values
45856 for (name in options) {
45857 elem.style[name] = old[name];
45865 // Swappable if display is none or starts with table except "table",
45866 // "table-cell", or "table-caption"
45867 // See here for display values:
45868 // https://developer.mozilla.org/en-US/docs/CSS/display
45869 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
45870 rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
45871 rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
45874 position: "absolute",
45875 visibility: "hidden",
45878 cssNormalTransform = {
45879 letterSpacing: "0",
45883 cssPrefixes = ["Webkit", "O", "Moz", "ms"];
45885 // Return a css property mapped to a potentially vendor prefixed property
45886 function vendorPropName(style, name) {
45888 // Shortcut for names that are not vendor prefixed
45889 if (name in style) {
45893 // Check for vendor prefixed names
45894 var capName = name[0].toUpperCase() + name.slice(1),
45896 i = cssPrefixes.length;
45899 name = cssPrefixes[i] + capName;
45900 if (name in style) {
45908 function setPositiveNumber(elem, value, subtract) {
45909 var matches = rnumsplit.exec(value);
45911 // Guard against undefined "subtract", e.g., when used as in cssHooks
45912 Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") :
45916 function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
45917 var i = extra === (isBorderBox ? "border" : "content") ?
45918 // If we already have the right measurement, avoid augmentation
45920 // Otherwise initialize for horizontal or vertical properties
45921 name === "width" ? 1 : 0,
45925 for (; i < 4; i += 2) {
45926 // Both box models exclude margin, so add it if we want it
45927 if (extra === "margin") {
45928 val += jQuery.css(elem, extra + cssExpand[i], true, styles);
45932 // border-box includes padding, so remove it if we want content
45933 if (extra === "content") {
45934 val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
45937 // At this point, extra isn't border nor margin, so remove border
45938 if (extra !== "margin") {
45939 val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
45942 // At this point, extra isn't content, so add padding
45943 val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
45945 // At this point, extra isn't content nor padding, so add border
45946 if (extra !== "padding") {
45947 val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
45955 function getWidthOrHeight(elem, name, extra) {
45957 // Start with offset property, which is equivalent to the border-box value
45958 var valueIsBorderBox = true,
45959 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
45960 styles = getStyles(elem),
45961 isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
45963 // Some non-html elements return undefined for offsetWidth, so check for
45965 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
45966 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
45967 if (val <= 0 || val == null) {
45968 // Fall back to computed then uncomputed css if necessary
45969 val = curCSS(elem, name, styles);
45970 if (val < 0 || val == null) {
45971 val = elem.style[name];
45974 // Computed unit is not pixels. Stop here and return.
45975 if (rnumnonpx.test(val)) {
45979 // Check for style in case a browser which returns unreliable values
45980 // for getComputedStyle silently falls back to the reliable elem.style
45981 valueIsBorderBox = isBorderBox &&
45982 (support.boxSizingReliable() || val === elem.style[name]);
45984 // Normalize "", auto, and prepare for extra
45985 val = parseFloat(val) || 0;
45988 // Use the active box-sizing model to add/subtract irrelevant styles
45990 augmentWidthOrHeight(
45993 extra || (isBorderBox ? "border" : "content"),
46000 function showHide(elements, show) {
46001 var display, elem, hidden,
46004 length = elements.length;
46006 for (; index < length; index++) {
46007 elem = elements[index];
46012 values[index] = data_priv.get(elem, "olddisplay");
46013 display = elem.style.display;
46015 // Reset the inline display of this element to learn if it is
46016 // being hidden by cascaded rules or not
46017 if (!values[index] && display === "none") {
46018 elem.style.display = "";
46021 // Set elements which have been overridden with display: none
46022 // in a stylesheet to whatever the default browser style is
46023 // for such an element
46024 if (elem.style.display === "" && isHidden(elem)) {
46025 values[index] = data_priv.access(elem, "olddisplay", defaultDisplay(elem.nodeName));
46028 hidden = isHidden(elem);
46030 if (display !== "none" || !hidden) {
46031 data_priv.set(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"));
46036 // Set the display of most of the elements in a second loop
46037 // to avoid the constant reflow
46038 for (index = 0; index < length; index++) {
46039 elem = elements[index];
46043 if (!show || elem.style.display === "none" || elem.style.display === "") {
46044 elem.style.display = show ? values[index] || "" : "none";
46053 // Add in style property hooks for overriding the default
46054 // behavior of getting and setting a style property
46057 get: function(elem, computed) {
46060 // We should always get a number back from opacity
46061 var ret = curCSS(elem, "opacity");
46062 return ret === "" ? "1" : ret;
46068 // Don't automatically add "px" to these possibly-unitless properties
46070 "columnCount": true,
46071 "fillOpacity": true,
46073 "flexShrink": true,
46074 "fontWeight": true,
46075 "lineHeight": true,
46084 // Add in properties whose names you wish to fix before
46085 // setting or getting the value
46087 "float": "cssFloat"
46090 // Get and set the style property on a DOM Node
46091 style: function(elem, name, value, extra) {
46093 // Don't set styles on text and comment nodes
46094 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
46098 // Make sure that we're working with the right name
46099 var ret, type, hooks,
46100 origName = jQuery.camelCase(name),
46101 style = elem.style;
46103 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName));
46105 // Gets hook for the prefixed version, then unprefixed version
46106 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
46108 // Check if we're setting a value
46109 if (value !== undefined) {
46110 type = typeof value;
46112 // Convert "+=" or "-=" to relative numbers (#7345)
46113 if (type === "string" && (ret = rrelNum.exec(value))) {
46114 value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name));
46119 // Make sure that null and NaN values aren't set (#7116)
46120 if (value == null || value !== value) {
46124 // If a number, add 'px' to the (except for certain CSS properties)
46125 if (type === "number" && !jQuery.cssNumber[origName]) {
46129 // Support: IE9-11+
46130 // background-* props affect original clone's values
46131 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
46132 style[name] = "inherit";
46135 // If a hook was provided, use that value, otherwise just set the
46137 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
46138 style[name] = value;
46142 // If a hook was provided get the non-computed value from there
46143 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
46147 // Otherwise just get the value from the style object
46148 return style[name];
46152 css: function(elem, name, extra, styles) {
46153 var val, num, hooks,
46154 origName = jQuery.camelCase(name);
46156 // Make sure that we're working with the right name
46157 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName));
46159 // Try prefixed name followed by the unprefixed name
46160 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
46162 // If a hook was provided get the computed value from there
46163 if (hooks && "get" in hooks) {
46164 val = hooks.get(elem, true, extra);
46167 // Otherwise, if a way to get the computed value exists, use that
46168 if (val === undefined) {
46169 val = curCSS(elem, name, styles);
46172 // Convert "normal" to computed value
46173 if (val === "normal" && name in cssNormalTransform) {
46174 val = cssNormalTransform[name];
46177 // Make numeric if forced or a qualifier was provided and val looks
46179 if (extra === "" || extra) {
46180 num = parseFloat(val);
46181 return extra === true || jQuery.isNumeric(num) ? num || 0 : val;
46187 jQuery.each(["height", "width"], function(i, name) {
46188 jQuery.cssHooks[name] = {
46189 get: function(elem, computed, extra) {
46192 // Certain elements can have dimension info if we invisibly show
46194 // but it must have a current display style that would benefit
46195 return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ?
46196 jQuery.swap(elem, cssShow, function() {
46197 return getWidthOrHeight(elem, name, extra);
46199 getWidthOrHeight(elem, name, extra);
46203 set: function(elem, value, extra) {
46204 var styles = extra && getStyles(elem);
46205 return setPositiveNumber(elem, value, extra ?
46206 augmentWidthOrHeight(
46210 jQuery.css(elem, "boxSizing", false, styles) === "border-box",
46218 // Support: Android 2.3
46219 jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight,
46220 function(elem, computed) {
46222 return jQuery.swap(elem, {
46223 "display": "inline-block"
46225 curCSS, [elem, "marginRight"]);
46230 // These hooks are used by animate to expand properties
46235 }, function(prefix, suffix) {
46236 jQuery.cssHooks[prefix + suffix] = {
46237 expand: function(value) {
46241 // Assumes a single number if not a string
46242 parts = typeof value === "string" ? value.split(" ") : [value];
46244 for (; i < 4; i++) {
46245 expanded[prefix + cssExpand[i] + suffix] =
46246 parts[i] || parts[i - 2] || parts[0];
46253 if (!rmargin.test(prefix)) {
46254 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
46259 css: function(name, value) {
46260 return access(this, function(elem, name, value) {
46265 if (jQuery.isArray(name)) {
46266 styles = getStyles(elem);
46269 for (; i < len; i++) {
46270 map[name[i]] = jQuery.css(elem, name[i], false, styles);
46276 return value !== undefined ?
46277 jQuery.style(elem, name, value) :
46278 jQuery.css(elem, name);
46279 }, name, value, arguments.length > 1);
46282 return showHide(this, true);
46285 return showHide(this);
46287 toggle: function(state) {
46288 if (typeof state === "boolean") {
46289 return state ? this.show() : this.hide();
46292 return this.each(function() {
46293 if (isHidden(this)) {
46294 jQuery(this).show();
46296 jQuery(this).hide();
46303 function Tween(elem, options, prop, end, easing) {
46304 return new Tween.prototype.init(elem, options, prop, end, easing);
46306 jQuery.Tween = Tween;
46308 Tween.prototype = {
46309 constructor: Tween,
46310 init: function(elem, options, prop, end, easing, unit) {
46313 this.easing = easing || "swing";
46314 this.options = options;
46315 this.start = this.now = this.cur();
46317 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
46320 var hooks = Tween.propHooks[this.prop];
46322 return hooks && hooks.get ?
46324 Tween.propHooks._default.get(this);
46326 run: function(percent) {
46328 hooks = Tween.propHooks[this.prop];
46330 if (this.options.duration) {
46331 this.pos = eased = jQuery.easing[this.easing](
46332 percent, this.options.duration * percent, 0, 1, this.options.duration
46335 this.pos = eased = percent;
46337 this.now = (this.end - this.start) * eased + this.start;
46339 if (this.options.step) {
46340 this.options.step.call(this.elem, this.now, this);
46343 if (hooks && hooks.set) {
46346 Tween.propHooks._default.set(this);
46352 Tween.prototype.init.prototype = Tween.prototype;
46354 Tween.propHooks = {
46356 get: function(tween) {
46359 if (tween.elem[tween.prop] != null &&
46360 (!tween.elem.style || tween.elem.style[tween.prop] == null)) {
46361 return tween.elem[tween.prop];
46364 // Passing an empty string as a 3rd parameter to .css will
46366 // attempt a parseFloat and fallback to a string if the parse fails.
46367 // Simple values such as "10px" are parsed to Float;
46368 // complex values such as "rotate(1rad)" are returned as-is.
46369 result = jQuery.css(tween.elem, tween.prop, "");
46370 // Empty strings, null, undefined and "auto" are converted to 0.
46371 return !result || result === "auto" ? 0 : result;
46373 set: function(tween) {
46374 // Use step hook for back compat.
46375 // Use cssHook if its there.
46376 // Use .style if available and use plain properties where available.
46377 if (jQuery.fx.step[tween.prop]) {
46378 jQuery.fx.step[tween.prop](tween);
46379 } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
46380 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
46382 tween.elem[tween.prop] = tween.now;
46389 // Panic based approach to setting things on disconnected nodes
46390 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
46391 set: function(tween) {
46392 if (tween.elem.nodeType && tween.elem.parentNode) {
46393 tween.elem[tween.prop] = tween.now;
46399 linear: function(p) {
46402 swing: function(p) {
46403 return 0.5 - Math.cos(p * Math.PI) / 2;
46407 jQuery.fx = Tween.prototype.init;
46409 // Back Compat <1.8 extension point
46410 jQuery.fx.step = {};
46417 rfxtypes = /^(?:toggle|show|hide)$/,
46418 rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
46419 rrun = /queueHooks$/,
46420 animationPrefilters = [defaultPrefilter],
46422 "*": [function(prop, value) {
46423 var tween = this.createTween(prop, value),
46424 target = tween.cur(),
46425 parts = rfxnum.exec(value),
46426 unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
46428 // Starting value computation is required for potential unit
46430 start = (jQuery.cssNumber[prop] || unit !== "px" && +target) &&
46431 rfxnum.exec(jQuery.css(tween.elem, prop)),
46433 maxIterations = 20;
46435 if (start && start[3] !== unit) {
46436 // Trust units reported by jQuery.css
46437 unit = unit || start[3];
46439 // Make sure we update the tween properties later on
46440 parts = parts || [];
46442 // Iteratively approximate from a nonzero starting point
46443 start = +target || 1;
46446 // If previous iteration zeroed out, double until we get
46448 // Use string for doubling so we don't accidentally see
46449 // scale as unchanged below
46450 scale = scale || ".5";
46452 // Adjust and apply
46453 start = start / scale;
46454 jQuery.style(tween.elem, prop, start + unit);
46456 // Update scale, tolerating zero or NaN from tween.cur(),
46457 // break the loop if scale is unchanged or perfect, or if we've
46459 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations);
46462 // Update tween properties
46464 start = tween.start = +start || +target || 0;
46466 // If a +=/-= token was provided, we're doing a relative
46468 tween.end = parts[1] ?
46469 start + (parts[1] + 1) * parts[2] :
46477 // Animations created synchronously will run synchronously
46478 function createFxNow() {
46479 setTimeout(function() {
46482 return (fxNow = jQuery.now());
46485 // Generate parameters to create a standard animation
46486 function genFx(type, includeWidth) {
46493 // If we include width, step value is 1 to do all cssExpand values,
46494 // otherwise step value is 2 to skip over Left and Right
46495 includeWidth = includeWidth ? 1 : 0;
46496 for (; i < 4; i += 2 - includeWidth) {
46497 which = cssExpand[i];
46498 attrs["margin" + which] = attrs["padding" + which] = type;
46501 if (includeWidth) {
46502 attrs.opacity = attrs.width = type;
46508 function createTween(value, prop, animation) {
46510 collection = (tweeners[prop] || []).concat(tweeners["*"]),
46512 length = collection.length;
46513 for (; index < length; index++) {
46514 if ((tween = collection[index].call(animation, prop, value))) {
46516 // We're done with this property
46522 function defaultPrefilter(elem, props, opts) {
46523 /* jshint validthis: true */
46524 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
46527 style = elem.style,
46528 hidden = elem.nodeType && isHidden(elem),
46529 dataShow = data_priv.get(elem, "fxshow");
46531 // Handle queue: false promises
46533 hooks = jQuery._queueHooks(elem, "fx");
46534 if (hooks.unqueued == null) {
46535 hooks.unqueued = 0;
46536 oldfire = hooks.empty.fire;
46537 hooks.empty.fire = function() {
46538 if (!hooks.unqueued) {
46545 anim.always(function() {
46546 // Ensure the complete handler is called before this completes
46547 anim.always(function() {
46549 if (!jQuery.queue(elem, "fx").length) {
46550 hooks.empty.fire();
46556 // Height/width overflow pass
46557 if (elem.nodeType === 1 && ("height" in props || "width" in props)) {
46558 // Make sure that nothing sneaks out
46559 // Record all 3 overflow attributes because IE9-10 do not
46560 // change the overflow attribute when overflowX and
46561 // overflowY are set to the same value
46562 opts.overflow = [style.overflow, style.overflowX, style.overflowY];
46564 // Set display property to inline-block for height/width
46565 // animations on inline elements that are having width/height animated
46566 display = jQuery.css(elem, "display");
46568 // Test default display if display is currently "none"
46569 checkDisplay = display === "none" ?
46570 data_priv.get(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
46572 if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
46573 style.display = "inline-block";
46577 if (opts.overflow) {
46578 style.overflow = "hidden";
46579 anim.always(function() {
46580 style.overflow = opts.overflow[0];
46581 style.overflowX = opts.overflow[1];
46582 style.overflowY = opts.overflow[2];
46587 for (prop in props) {
46588 value = props[prop];
46589 if (rfxtypes.exec(value)) {
46590 delete props[prop];
46591 toggle = toggle || value === "toggle";
46592 if (value === (hidden ? "hide" : "show")) {
46594 // If there is dataShow left over from a stopped hide or show
46595 // and we are going to proceed with show, we should pretend to
46597 if (value === "show" && dataShow && dataShow[prop] !== undefined) {
46603 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
46605 // Any non-fx value stops us from restoring the original display value
46607 display = undefined;
46611 if (!jQuery.isEmptyObject(orig)) {
46613 if ("hidden" in dataShow) {
46614 hidden = dataShow.hidden;
46617 dataShow = data_priv.access(elem, "fxshow", {});
46620 // Store state if its toggle - enables .stop().toggle() to "reverse"
46622 dataShow.hidden = !hidden;
46625 jQuery(elem).show();
46627 anim.done(function() {
46628 jQuery(elem).hide();
46631 anim.done(function() {
46634 data_priv.remove(elem, "fxshow");
46635 for (prop in orig) {
46636 jQuery.style(elem, prop, orig[prop]);
46639 for (prop in orig) {
46640 tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
46642 if (!(prop in dataShow)) {
46643 dataShow[prop] = tween.start;
46645 tween.end = tween.start;
46646 tween.start = prop === "width" || prop === "height" ? 1 : 0;
46651 // If this is a noop like .hide().hide(), restore an overwritten display
46653 } else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
46654 style.display = display;
46658 function propFilter(props, specialEasing) {
46659 var index, name, easing, value, hooks;
46661 // camelCase, specialEasing and expand cssHook pass
46662 for (index in props) {
46663 name = jQuery.camelCase(index);
46664 easing = specialEasing[name];
46665 value = props[index];
46666 if (jQuery.isArray(value)) {
46668 value = props[index] = value[0];
46671 if (index !== name) {
46672 props[name] = value;
46673 delete props[index];
46676 hooks = jQuery.cssHooks[name];
46677 if (hooks && "expand" in hooks) {
46678 value = hooks.expand(value);
46679 delete props[name];
46681 // Not quite $.extend, this won't overwrite existing keys.
46682 // Reusing 'index' because we have the correct "name"
46683 for (index in value) {
46684 if (!(index in props)) {
46685 props[index] = value[index];
46686 specialEasing[index] = easing;
46690 specialEasing[name] = easing;
46695 function Animation(elem, properties, options) {
46699 length = animationPrefilters.length,
46700 deferred = jQuery.Deferred().always(function() {
46701 // Don't match elem in the :animated selector
46704 tick = function() {
46708 var currentTime = fxNow || createFxNow(),
46709 remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
46710 // Support: Android 2.3
46711 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )`
46713 temp = remaining / animation.duration || 0,
46714 percent = 1 - temp,
46716 length = animation.tweens.length;
46718 for (; index < length; index++) {
46719 animation.tweens[index].run(percent);
46722 deferred.notifyWith(elem, [animation, percent, remaining]);
46724 if (percent < 1 && length) {
46727 deferred.resolveWith(elem, [animation]);
46731 animation = deferred.promise({
46733 props: jQuery.extend({}, properties),
46734 opts: jQuery.extend(true, {
46737 originalProperties: properties,
46738 originalOptions: options,
46739 startTime: fxNow || createFxNow(),
46740 duration: options.duration,
46742 createTween: function(prop, end) {
46743 var tween = jQuery.Tween(elem, animation.opts, prop, end,
46744 animation.opts.specialEasing[prop] || animation.opts.easing);
46745 animation.tweens.push(tween);
46748 stop: function(gotoEnd) {
46750 // If we are going to the end, we want to run all the tweens
46751 // otherwise we skip this part
46752 length = gotoEnd ? animation.tweens.length : 0;
46757 for (; index < length; index++) {
46758 animation.tweens[index].run(1);
46761 // Resolve when we played the last frame; otherwise, reject
46763 deferred.resolveWith(elem, [animation, gotoEnd]);
46765 deferred.rejectWith(elem, [animation, gotoEnd]);
46770 props = animation.props;
46772 propFilter(props, animation.opts.specialEasing);
46774 for (; index < length; index++) {
46775 result = animationPrefilters[index].call(animation, elem, props, animation.opts);
46781 jQuery.map(props, createTween, animation);
46783 if (jQuery.isFunction(animation.opts.start)) {
46784 animation.opts.start.call(elem, animation);
46788 jQuery.extend(tick, {
46791 queue: animation.opts.queue
46795 // attach callbacks from options
46796 return animation.progress(animation.opts.progress)
46797 .done(animation.opts.done, animation.opts.complete)
46798 .fail(animation.opts.fail)
46799 .always(animation.opts.always);
46802 jQuery.Animation = jQuery.extend(Animation, {
46804 tweener: function(props, callback) {
46805 if (jQuery.isFunction(props)) {
46809 props = props.split(" ");
46814 length = props.length;
46816 for (; index < length; index++) {
46817 prop = props[index];
46818 tweeners[prop] = tweeners[prop] || [];
46819 tweeners[prop].unshift(callback);
46823 prefilter: function(callback, prepend) {
46825 animationPrefilters.unshift(callback);
46827 animationPrefilters.push(callback);
46832 jQuery.speed = function(speed, easing, fn) {
46833 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
46834 complete: fn || !fn && easing ||
46835 jQuery.isFunction(speed) && speed,
46837 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
46840 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
46841 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
46843 // Normalize opt.queue - true/undefined/null -> "fx"
46844 if (opt.queue == null || opt.queue === true) {
46849 opt.old = opt.complete;
46851 opt.complete = function() {
46852 if (jQuery.isFunction(opt.old)) {
46853 opt.old.call(this);
46857 jQuery.dequeue(this, opt.queue);
46865 fadeTo: function(speed, to, easing, callback) {
46867 // Show any hidden elements after setting opacity to 0
46868 return this.filter(isHidden).css("opacity", 0).show()
46870 // Animate to the value specified
46873 }, speed, easing, callback);
46875 animate: function(prop, speed, easing, callback) {
46876 var empty = jQuery.isEmptyObject(prop),
46877 optall = jQuery.speed(speed, easing, callback),
46878 doAnimation = function() {
46879 // Operate on a copy of prop so per-property easing won't be
46881 var anim = Animation(this, jQuery.extend({}, prop), optall);
46883 // Empty animations, or finishing resolves immediately
46884 if (empty || data_priv.get(this, "finish")) {
46888 doAnimation.finish = doAnimation;
46890 return empty || optall.queue === false ?
46891 this.each(doAnimation) :
46892 this.queue(optall.queue, doAnimation);
46894 stop: function(type, clearQueue, gotoEnd) {
46895 var stopQueue = function(hooks) {
46896 var stop = hooks.stop;
46901 if (typeof type !== "string") {
46902 gotoEnd = clearQueue;
46906 if (clearQueue && type !== false) {
46907 this.queue(type || "fx", []);
46910 return this.each(function() {
46911 var dequeue = true,
46912 index = type != null && type + "queueHooks",
46913 timers = jQuery.timers,
46914 data = data_priv.get(this);
46917 if (data[index] && data[index].stop) {
46918 stopQueue(data[index]);
46921 for (index in data) {
46922 if (data[index] && data[index].stop && rrun.test(index)) {
46923 stopQueue(data[index]);
46928 for (index = timers.length; index--;) {
46929 if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
46930 timers[index].anim.stop(gotoEnd);
46932 timers.splice(index, 1);
46936 // Start the next in the queue if the last step wasn't forced.
46937 // Timers currently will call their complete callbacks, which
46938 // will dequeue but only if they were gotoEnd.
46939 if (dequeue || !gotoEnd) {
46940 jQuery.dequeue(this, type);
46944 finish: function(type) {
46945 if (type !== false) {
46946 type = type || "fx";
46948 return this.each(function() {
46950 data = data_priv.get(this),
46951 queue = data[type + "queue"],
46952 hooks = data[type + "queueHooks"],
46953 timers = jQuery.timers,
46954 length = queue ? queue.length : 0;
46956 // Enable finishing flag on private data
46957 data.finish = true;
46959 // Empty the queue first
46960 jQuery.queue(this, type, []);
46962 if (hooks && hooks.stop) {
46963 hooks.stop.call(this, true);
46966 // Look for any active animations, and finish them
46967 for (index = timers.length; index--;) {
46968 if (timers[index].elem === this && timers[index].queue === type) {
46969 timers[index].anim.stop(true);
46970 timers.splice(index, 1);
46974 // Look for any animations in the old queue and finish them
46975 for (index = 0; index < length; index++) {
46976 if (queue[index] && queue[index].finish) {
46977 queue[index].finish.call(this);
46981 // Turn off finishing flag
46982 delete data.finish;
46987 jQuery.each(["toggle", "show", "hide"], function(i, name) {
46988 var cssFn = jQuery.fn[name];
46989 jQuery.fn[name] = function(speed, easing, callback) {
46990 return speed == null || typeof speed === "boolean" ?
46991 cssFn.apply(this, arguments) :
46992 this.animate(genFx(name, true), speed, easing, callback);
46996 // Generate shortcuts for custom animations
46998 slideDown: genFx("show"),
46999 slideUp: genFx("hide"),
47000 slideToggle: genFx("toggle"),
47010 }, function(name, props) {
47011 jQuery.fn[name] = function(speed, easing, callback) {
47012 return this.animate(props, speed, easing, callback);
47016 jQuery.timers = [];
47017 jQuery.fx.tick = function() {
47020 timers = jQuery.timers;
47022 fxNow = jQuery.now();
47024 for (; i < timers.length; i++) {
47026 // Checks the timer has not already been removed
47027 if (!timer() && timers[i] === timer) {
47028 timers.splice(i--, 1);
47032 if (!timers.length) {
47038 jQuery.fx.timer = function(timer) {
47039 jQuery.timers.push(timer);
47043 jQuery.timers.pop();
47047 jQuery.fx.interval = 13;
47049 jQuery.fx.start = function() {
47051 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval);
47055 jQuery.fx.stop = function() {
47056 clearInterval(timerId);
47060 jQuery.fx.speeds = {
47068 // Based off of the plugin by Clint Helfers, with permission.
47069 // http://blindsignals.com/index.php/2009/07/jquery-delay/
47070 jQuery.fn.delay = function(time, type) {
47071 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
47072 type = type || "fx";
47074 return this.queue(type, function(next, hooks) {
47075 var timeout = setTimeout(next, time);
47076 hooks.stop = function() {
47077 clearTimeout(timeout);
47084 var input = document.createElement("input"),
47085 select = document.createElement("select"),
47086 opt = select.appendChild(document.createElement("option"));
47088 input.type = "checkbox";
47090 // Support: iOS<=5.1, Android<=4.2+
47091 // Default value for a checkbox should be "on"
47092 support.checkOn = input.value !== "";
47094 // Support: IE<=11+
47095 // Must access selectedIndex to make default options select
47096 support.optSelected = opt.selected;
47098 // Support: Android<=2.3
47099 // Options inside disabled selects are incorrectly marked as disabled
47100 select.disabled = true;
47101 support.optDisabled = !opt.disabled;
47103 // Support: IE<=11+
47104 // An input loses its value after becoming a radio
47105 input = document.createElement("input");
47107 input.type = "radio";
47108 support.radioValue = input.value === "t";
47112 var nodeHook, boolHook,
47113 attrHandle = jQuery.expr.attrHandle;
47116 attr: function(name, value) {
47117 return access(this, jQuery.attr, name, value, arguments.length > 1);
47120 removeAttr: function(name) {
47121 return this.each(function() {
47122 jQuery.removeAttr(this, name);
47128 attr: function(elem, name, value) {
47130 nType = elem.nodeType;
47132 // don't get/set attributes on text, comment and attribute nodes
47133 if (!elem || nType === 3 || nType === 8 || nType === 2) {
47137 // Fallback to prop when attributes are not supported
47138 if (typeof elem.getAttribute === strundefined) {
47139 return jQuery.prop(elem, name, value);
47142 // All attributes are lowercase
47143 // Grab necessary hook if one is defined
47144 if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
47145 name = name.toLowerCase();
47146 hooks = jQuery.attrHooks[name] ||
47147 (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook);
47150 if (value !== undefined) {
47152 if (value === null) {
47153 jQuery.removeAttr(elem, name);
47155 } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
47159 elem.setAttribute(name, value + "");
47163 } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
47167 ret = jQuery.find.attr(elem, name);
47169 // Non-existent attributes return null, we normalize to undefined
47170 return ret == null ?
47176 removeAttr: function(elem, value) {
47177 var name, propName,
47179 attrNames = value && value.match(rnotwhite);
47181 if (attrNames && elem.nodeType === 1) {
47182 while ((name = attrNames[i++])) {
47183 propName = jQuery.propFix[name] || name;
47185 // Boolean attributes get special treatment (#10870)
47186 if (jQuery.expr.match.bool.test(name)) {
47187 // Set corresponding property to false
47188 elem[propName] = false;
47191 elem.removeAttribute(name);
47198 set: function(elem, value) {
47199 if (!support.radioValue && value === "radio" &&
47200 jQuery.nodeName(elem, "input")) {
47201 var val = elem.value;
47202 elem.setAttribute("type", value);
47213 // Hooks for boolean attributes
47215 set: function(elem, value, name) {
47216 if (value === false) {
47217 // Remove boolean attributes when set to false
47218 jQuery.removeAttr(elem, name);
47220 elem.setAttribute(name, name);
47225 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
47226 var getter = attrHandle[name] || jQuery.find.attr;
47228 attrHandle[name] = function(elem, name, isXML) {
47231 // Avoid an infinite loop by temporarily removing this function from
47233 handle = attrHandle[name];
47234 attrHandle[name] = ret;
47235 ret = getter(elem, name, isXML) != null ?
47236 name.toLowerCase() :
47238 attrHandle[name] = handle;
47247 var rfocusable = /^(?:input|select|textarea|button)$/i;
47250 prop: function(name, value) {
47251 return access(this, jQuery.prop, name, value, arguments.length > 1);
47254 removeProp: function(name) {
47255 return this.each(function() {
47256 delete this[jQuery.propFix[name] || name];
47264 "class": "className"
47267 prop: function(elem, name, value) {
47268 var ret, hooks, notxml,
47269 nType = elem.nodeType;
47271 // Don't get/set properties on text, comment and attribute nodes
47272 if (!elem || nType === 3 || nType === 8 || nType === 2) {
47276 notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
47279 // Fix name and attach hooks
47280 name = jQuery.propFix[name] || name;
47281 hooks = jQuery.propHooks[name];
47284 if (value !== undefined) {
47285 return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ?
47287 (elem[name] = value);
47290 return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ?
47298 get: function(elem) {
47299 return elem.hasAttribute("tabindex") || rfocusable.test(elem.nodeName) || elem.href ?
47307 if (!support.optSelected) {
47308 jQuery.propHooks.selected = {
47309 get: function(elem) {
47310 var parent = elem.parentNode;
47311 if (parent && parent.parentNode) {
47312 parent.parentNode.selectedIndex;
47331 jQuery.propFix[this.toLowerCase()] = this;
47337 var rclass = /[\t\r\n\f]/g;
47340 addClass: function(value) {
47341 var classes, elem, cur, clazz, j, finalValue,
47342 proceed = typeof value === "string" && value,
47346 if (jQuery.isFunction(value)) {
47347 return this.each(function(j) {
47348 jQuery(this).addClass(value.call(this, j, this.className));
47353 // The disjunction here is for better compressibility (see
47355 classes = (value || "").match(rnotwhite) || [];
47357 for (; i < len; i++) {
47359 cur = elem.nodeType === 1 && (elem.className ?
47360 (" " + elem.className + " ").replace(rclass, " ") :
47366 while ((clazz = classes[j++])) {
47367 if (cur.indexOf(" " + clazz + " ") < 0) {
47368 cur += clazz + " ";
47372 // only assign if different to avoid unneeded rendering.
47373 finalValue = jQuery.trim(cur);
47374 if (elem.className !== finalValue) {
47375 elem.className = finalValue;
47384 removeClass: function(value) {
47385 var classes, elem, cur, clazz, j, finalValue,
47386 proceed = arguments.length === 0 || typeof value === "string" && value,
47390 if (jQuery.isFunction(value)) {
47391 return this.each(function(j) {
47392 jQuery(this).removeClass(value.call(this, j, this.className));
47396 classes = (value || "").match(rnotwhite) || [];
47398 for (; i < len; i++) {
47400 // This expression is here for better compressibility (see
47402 cur = elem.nodeType === 1 && (elem.className ?
47403 (" " + elem.className + " ").replace(rclass, " ") :
47409 while ((clazz = classes[j++])) {
47410 // Remove *all* instances
47411 while (cur.indexOf(" " + clazz + " ") >= 0) {
47412 cur = cur.replace(" " + clazz + " ", " ");
47416 // Only assign if different to avoid unneeded rendering.
47417 finalValue = value ? jQuery.trim(cur) : "";
47418 if (elem.className !== finalValue) {
47419 elem.className = finalValue;
47428 toggleClass: function(value, stateVal) {
47429 var type = typeof value;
47431 if (typeof stateVal === "boolean" && type === "string") {
47432 return stateVal ? this.addClass(value) : this.removeClass(value);
47435 if (jQuery.isFunction(value)) {
47436 return this.each(function(i) {
47437 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal);
47441 return this.each(function() {
47442 if (type === "string") {
47443 // Toggle individual class names
47446 self = jQuery(this),
47447 classNames = value.match(rnotwhite) || [];
47449 while ((className = classNames[i++])) {
47450 // Check each className given, space separated list
47451 if (self.hasClass(className)) {
47452 self.removeClass(className);
47454 self.addClass(className);
47458 // Toggle whole class name
47459 } else if (type === strundefined || type === "boolean") {
47460 if (this.className) {
47461 // store className if set
47462 data_priv.set(this, "__className__", this.className);
47465 // If the element has a class name or if we're passed `false`,
47466 // then remove the whole classname (if there was one, the above
47468 // Otherwise bring back whatever was previously saved (if
47470 // falling back to the empty string if nothing was stored.
47471 this.className = this.className || value === false ? "" : data_priv.get(this, "__className__") || "";
47476 hasClass: function(selector) {
47477 var className = " " + selector + " ",
47480 for (; i < l; i++) {
47481 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
47493 var rreturn = /\r/g;
47496 val: function(value) {
47497 var hooks, ret, isFunction,
47500 if (!arguments.length) {
47502 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
47504 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
47510 return typeof ret === "string" ?
47511 // Handle most common string cases
47512 ret.replace(rreturn, "") :
47513 // Handle cases where value is null/undef or number
47514 ret == null ? "" : ret;
47520 isFunction = jQuery.isFunction(value);
47522 return this.each(function(i) {
47525 if (this.nodeType !== 1) {
47530 val = value.call(this, i, jQuery(this).val());
47535 // Treat null/undefined as ""; convert numbers to string
47539 } else if (typeof val === "number") {
47542 } else if (jQuery.isArray(val)) {
47543 val = jQuery.map(val, function(value) {
47544 return value == null ? "" : value + "";
47548 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
47550 // If set returns undefined, fall back to normal setting
47551 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
47561 get: function(elem) {
47562 var val = jQuery.find.attr(elem, "value");
47563 return val != null ?
47565 // Support: IE10-11+
47566 // option.text throws exceptions (#14686, #14858)
47567 jQuery.trim(jQuery.text(elem));
47571 get: function(elem) {
47573 options = elem.options,
47574 index = elem.selectedIndex,
47575 one = elem.type === "select-one" || index < 0,
47576 values = one ? null : [],
47577 max = one ? index + 1 : options.length,
47582 // Loop through all the selected options
47583 for (; i < max; i++) {
47584 option = options[i];
47586 // IE6-9 doesn't update selected after form reset (#2551)
47587 if ((option.selected || i === index) &&
47588 // Don't return options that are disabled or in a
47589 // disabled optgroup
47590 (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
47591 (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
47593 // Get the specific value for the option
47594 value = jQuery(option).val();
47596 // We don't need an array for one selects
47601 // Multi-Selects return an array
47602 values.push(value);
47609 set: function(elem, value) {
47610 var optionSet, option,
47611 options = elem.options,
47612 values = jQuery.makeArray(value),
47613 i = options.length;
47616 option = options[i];
47617 if ((option.selected = jQuery.inArray(option.value, values) >= 0)) {
47622 // Force browsers to behave consistently when non-matching value
47625 elem.selectedIndex = -1;
47633 // Radios and checkboxes getter/setter
47634 jQuery.each(["radio", "checkbox"], function() {
47635 jQuery.valHooks[this] = {
47636 set: function(elem, value) {
47637 if (jQuery.isArray(value)) {
47638 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0);
47642 if (!support.checkOn) {
47643 jQuery.valHooks[this].get = function(elem) {
47644 return elem.getAttribute("value") === null ? "on" : elem.value;
47652 // Return jQuery for attributes-only inclusion
47655 jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " +
47656 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
47657 "change select submit keydown keypress keyup error contextmenu").split(" "), function(i, name) {
47659 // Handle event binding
47660 jQuery.fn[name] = function(data, fn) {
47661 return arguments.length > 0 ?
47662 this.on(name, null, data, fn) :
47663 this.trigger(name);
47668 hover: function(fnOver, fnOut) {
47669 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
47672 bind: function(types, data, fn) {
47673 return this.on(types, null, data, fn);
47675 unbind: function(types, fn) {
47676 return this.off(types, null, fn);
47679 delegate: function(selector, types, data, fn) {
47680 return this.on(types, selector, data, fn);
47682 undelegate: function(selector, types, fn) {
47683 // ( namespace ) or ( selector, types [, fn] )
47684 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
47689 var nonce = jQuery.now();
47691 var rquery = (/\?/);
47695 // Support: Android 2.3
47696 // Workaround failure to string-cast null input
47697 jQuery.parseJSON = function(data) {
47698 return JSON.parse(data + "");
47702 // Cross-browser xml parsing
47703 jQuery.parseXML = function(data) {
47705 if (!data || typeof data !== "string") {
47711 tmp = new DOMParser();
47712 xml = tmp.parseFromString(data, "text/xml");
47717 if (!xml || xml.getElementsByTagName("parsererror").length) {
47718 jQuery.error("Invalid XML: " + data);
47726 rts = /([?&])_=[^&]*/,
47727 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
47728 // #7653, #8125, #8152: local protocol detection
47729 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
47730 rnoContent = /^(?:GET|HEAD)$/,
47731 rprotocol = /^\/\//,
47732 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
47735 * Prefilters 1) They are useful to introduce custom dataTypes (see
47736 * ajax/jsonp.js for an example) 2) These are called: - BEFORE asking for a
47737 * transport - AFTER param serialization (s.data is a string if
47738 * s.processData is true) 3) key is the dataType 4) the catchall symbol "*"
47739 * can be used 5) execution will start with transport dataType and THEN
47740 * continue down to "*" if needed
47745 * Transports bindings 1) key is the dataType 2) the catchall symbol "*" can
47746 * be used 3) selection will start with transport dataType and THEN go to
47751 // Avoid comment-prolog char sequence (#10098); must appease lint and evade
47753 allTypes = "*/".concat("*"),
47755 // Document location
47756 ajaxLocation = window.location.href,
47758 // Segment location into parts
47759 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
47761 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
47762 function addToPrefiltersOrTransports(structure) {
47764 // dataTypeExpression is optional and defaults to "*"
47765 return function(dataTypeExpression, func) {
47767 if (typeof dataTypeExpression !== "string") {
47768 func = dataTypeExpression;
47769 dataTypeExpression = "*";
47774 dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
47776 if (jQuery.isFunction(func)) {
47777 // For each dataType in the dataTypeExpression
47778 while ((dataType = dataTypes[i++])) {
47779 // Prepend if requested
47780 if (dataType[0] === "+") {
47781 dataType = dataType.slice(1) || "*";
47782 (structure[dataType] = structure[dataType] || []).unshift(func);
47784 // Otherwise append
47786 (structure[dataType] = structure[dataType] || []).push(func);
47793 // Base inspection function for prefilters and transports
47794 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
47796 var inspected = {},
47797 seekingTransport = (structure === transports);
47799 function inspect(dataType) {
47801 inspected[dataType] = true;
47802 jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
47803 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
47804 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
47805 options.dataTypes.unshift(dataTypeOrTransport);
47806 inspect(dataTypeOrTransport);
47808 } else if (seekingTransport) {
47809 return !(selected = dataTypeOrTransport);
47815 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
47818 // A special extend for ajax options
47819 // that takes "flat" options (not to be deep extended)
47821 function ajaxExtend(target, src) {
47823 flatOptions = jQuery.ajaxSettings.flatOptions || {};
47826 if (src[key] !== undefined) {
47827 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];
47831 jQuery.extend(true, target, deep);
47838 * Handles responses to an ajax request: - finds the right dataType (mediates
47839 * between content-type and expected dataType) - returns the corresponding
47842 function ajaxHandleResponses(s, jqXHR, responses) {
47844 var ct, type, finalDataType, firstDataType,
47845 contents = s.contents,
47846 dataTypes = s.dataTypes;
47848 // Remove auto dataType and get content-type in the process
47849 while (dataTypes[0] === "*") {
47851 if (ct === undefined) {
47852 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
47856 // Check if we're dealing with a known content-type
47858 for (type in contents) {
47859 if (contents[type] && contents[type].test(ct)) {
47860 dataTypes.unshift(type);
47866 // Check to see if we have a response for the expected dataType
47867 if (dataTypes[0] in responses) {
47868 finalDataType = dataTypes[0];
47870 // Try convertible dataTypes
47871 for (type in responses) {
47872 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
47873 finalDataType = type;
47876 if (!firstDataType) {
47877 firstDataType = type;
47880 // Or just use first one
47881 finalDataType = finalDataType || firstDataType;
47884 // If we found a dataType
47885 // We add the dataType to the list if needed
47886 // and return the corresponding response
47887 if (finalDataType) {
47888 if (finalDataType !== dataTypes[0]) {
47889 dataTypes.unshift(finalDataType);
47891 return responses[finalDataType];
47896 * Chain conversions given the request and the original response Also sets the
47897 * responseXXX fields on the jqXHR instance
47899 function ajaxConvert(s, response, jqXHR, isSuccess) {
47900 var conv2, current, conv, tmp, prev,
47902 // Work with a copy of dataTypes in case we need to modify it for
47904 dataTypes = s.dataTypes.slice();
47906 // Create converters map with lowercased keys
47907 if (dataTypes[1]) {
47908 for (conv in s.converters) {
47909 converters[conv.toLowerCase()] = s.converters[conv];
47913 current = dataTypes.shift();
47915 // Convert to each sequential dataType
47918 if (s.responseFields[current]) {
47919 jqXHR[s.responseFields[current]] = response;
47922 // Apply the dataFilter if provided
47923 if (!prev && isSuccess && s.dataFilter) {
47924 response = s.dataFilter(response, s.dataType);
47928 current = dataTypes.shift();
47932 // There's only work to do if current dataType is non-auto
47933 if (current === "*") {
47937 // Convert response if prev dataType is non-auto and differs from
47939 } else if (prev !== "*" && prev !== current) {
47941 // Seek a direct converter
47942 conv = converters[prev + " " + current] || converters["* " + current];
47944 // If none found, seek a pair
47946 for (conv2 in converters) {
47948 // If conv2 outputs current
47949 tmp = conv2.split(" ");
47950 if (tmp[1] === current) {
47952 // If prev can be converted to accepted input
47953 conv = converters[prev + " " + tmp[0]] ||
47954 converters["* " + tmp[0]];
47956 // Condense equivalence converters
47957 if (conv === true) {
47958 conv = converters[conv2];
47960 // Otherwise, insert the intermediate dataType
47961 } else if (converters[conv2] !== true) {
47963 dataTypes.unshift(tmp[1]);
47971 // Apply converter (if not an equivalence)
47972 if (conv !== true) {
47974 // Unless errors are allowed to bubble, catch and return
47976 if (conv && s["throws"]) {
47977 response = conv(response);
47980 response = conv(response);
47983 state: "parsererror",
47984 error: conv ? e : "No conversion from " + prev + " to " + current
48001 // Counter for holding the number of active queries
48004 // Last-Modified header cache for next request
48011 isLocal: rlocalProtocol.test(ajaxLocParts[1]),
48015 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
48017 * timeout: 0, data: null, dataType: null, username: null, password:
48018 * null, cache: null, throws: false, traditional: false, headers: {},
48023 text: "text/plain",
48025 xml: "application/xml, text/xml",
48026 json: "application/json, text/javascript"
48036 xml: "responseXML",
48037 text: "responseText",
48038 json: "responseJSON"
48042 // Keys separate source (or catchall "*") and destination types with a
48046 // Convert anything to text
48049 // Text to html (true = no transformation)
48052 // Evaluate text as a json expression
48053 "text json": jQuery.parseJSON,
48055 // Parse text as xml
48056 "text xml": jQuery.parseXML
48059 // For options that shouldn't be deep extended:
48060 // you can add your own custom options here if
48061 // and when you create one that shouldn't be
48062 // deep extended (see ajaxExtend)
48069 // Creates a full fledged settings object into target
48070 // with both ajaxSettings and settings fields.
48071 // If target is omitted, writes into ajaxSettings.
48072 ajaxSetup: function(target, settings) {
48075 // Building a settings object
48076 ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
48078 // Extending ajaxSettings
48079 ajaxExtend(jQuery.ajaxSettings, target);
48082 ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
48083 ajaxTransport: addToPrefiltersOrTransports(transports),
48086 ajax: function(url, options) {
48088 // If url is an object, simulate pre-1.5 signature
48089 if (typeof url === "object") {
48094 // Force options to be an object
48095 options = options || {};
48098 // URL without anti-cache param
48100 // Response headers
48101 responseHeadersString,
48105 // Cross-domain detection vars
48107 // To know if global events are to be dispatched
48111 // Create the final options object
48112 s = jQuery.ajaxSetup({}, options),
48113 // Callbacks context
48114 callbackContext = s.context || s,
48115 // Context for global events is callbackContext if it is a DOM node
48116 // or jQuery collection
48117 globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ?
48118 jQuery(callbackContext) :
48121 deferred = jQuery.Deferred(),
48122 completeDeferred = jQuery.Callbacks("once memory"),
48123 // Status-dependent callbacks
48124 statusCode = s.statusCode || {},
48125 // Headers (they are sent all at once)
48126 requestHeaders = {},
48127 requestHeadersNames = {},
48130 // Default abort message
48131 strAbort = "canceled",
48136 // Builds headers hashtable if needed
48137 getResponseHeader: function(key) {
48140 if (!responseHeaders) {
48141 responseHeaders = {};
48142 while ((match = rheaders.exec(responseHeadersString))) {
48143 responseHeaders[match[1].toLowerCase()] = match[2];
48146 match = responseHeaders[key.toLowerCase()];
48148 return match == null ? null : match;
48152 getAllResponseHeaders: function() {
48153 return state === 2 ? responseHeadersString : null;
48156 // Caches the header
48157 setRequestHeader: function(name, value) {
48158 var lname = name.toLowerCase();
48160 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
48161 requestHeaders[name] = value;
48166 // Overrides response content-type header
48167 overrideMimeType: function(type) {
48174 // Status-dependent callbacks
48175 statusCode: function(map) {
48179 for (code in map) {
48180 // Lazy-add the new callback in a way that
48181 // preserves old ones
48182 statusCode[code] = [statusCode[code], map[code]];
48185 // Execute the appropriate callbacks
48186 jqXHR.always(map[jqXHR.status]);
48192 // Cancel the request
48193 abort: function(statusText) {
48194 var finalText = statusText || strAbort;
48196 transport.abort(finalText);
48198 done(0, finalText);
48203 // Attach deferreds
48204 deferred.promise(jqXHR).complete = completeDeferred.add;
48205 jqXHR.success = jqXHR.done;
48206 jqXHR.error = jqXHR.fail;
48208 // Remove hash character (#7531: and string promotion)
48209 // Add protocol if not provided (prefilters might expect it)
48210 // Handle falsy url in the settings object (#10093: consistency with old
48212 // We also use the url parameter if available
48213 s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "")
48214 .replace(rprotocol, ajaxLocParts[1] + "//");
48216 // Alias method option to type as per ticket #12004
48217 s.type = options.method || options.type || s.method || s.type;
48219 // Extract dataTypes list
48220 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
48222 // A cross-domain request is in order when we have a protocol:host:port
48224 if (s.crossDomain == null) {
48225 parts = rurl.exec(s.url.toLowerCase());
48226 s.crossDomain = !!(parts &&
48227 (parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] ||
48228 (parts[3] || (parts[1] === "http:" ? "80" : "443")) !==
48229 (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? "80" : "443")))
48233 // Convert data if not already a string
48234 if (s.data && s.processData && typeof s.data !== "string") {
48235 s.data = jQuery.param(s.data, s.traditional);
48238 // Apply prefilters
48239 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
48241 // If request was aborted inside a prefilter, stop there
48246 // We can fire global events as of now if asked to
48247 // Don't fire events if jQuery.event is undefined in an AMD-usage
48248 // scenario (#15118)
48249 fireGlobals = jQuery.event && s.global;
48251 // Watch for a new set of requests
48252 if (fireGlobals && jQuery.active++ === 0) {
48253 jQuery.event.trigger("ajaxStart");
48256 // Uppercase the type
48257 s.type = s.type.toUpperCase();
48259 // Determine if request has content
48260 s.hasContent = !rnoContent.test(s.type);
48262 // Save the URL in case we're toying with the If-Modified-Since
48263 // and/or If-None-Match header later on
48266 // More options handling for requests with no content
48267 if (!s.hasContent) {
48269 // If data is available, append data to url
48271 cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
48272 // #9682: remove data so that it's not used in an eventual retry
48276 // Add anti-cache in url if needed
48277 if (s.cache === false) {
48278 s.url = rts.test(cacheURL) ?
48280 // If there is already a '_' parameter, set its value
48281 cacheURL.replace(rts, "$1_=" + nonce++) :
48283 // Otherwise add one to the end
48284 cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++;
48288 // Set the If-Modified-Since and/or If-None-Match header, if in
48289 // ifModified mode.
48290 if (s.ifModified) {
48291 if (jQuery.lastModified[cacheURL]) {
48292 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
48294 if (jQuery.etag[cacheURL]) {
48295 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
48299 // Set the correct header, if data is being sent
48300 if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
48301 jqXHR.setRequestHeader("Content-Type", s.contentType);
48304 // Set the Accepts header for the server, depending on the dataType
48305 jqXHR.setRequestHeader(
48307 s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?
48308 s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") :
48312 // Check for headers option
48313 for (i in s.headers) {
48314 jqXHR.setRequestHeader(i, s.headers[i]);
48317 // Allow custom headers/mimetypes and early abort
48318 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
48319 // Abort if not done already and return
48320 return jqXHR.abort();
48323 // Aborting is no longer a cancellation
48324 strAbort = "abort";
48326 // Install callbacks on deferreds
48336 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
48338 // If no transport, we auto-abort
48340 done(-1, "No Transport");
48342 jqXHR.readyState = 1;
48344 // Send global event
48346 globalEventContext.trigger("ajaxSend", [jqXHR, s]);
48349 if (s.async && s.timeout > 0) {
48350 timeoutTimer = setTimeout(function() {
48351 jqXHR.abort("timeout");
48357 transport.send(requestHeaders, done);
48359 // Propagate exception as error if not done
48362 // Simply rethrow otherwise
48369 // Callback for when everything is done
48370 function done(status, nativeStatusText, responses, headers) {
48371 var isSuccess, success, error, response, modified,
48372 statusText = nativeStatusText;
48379 // State is "done" now
48382 // Clear timeout if it exists
48383 if (timeoutTimer) {
48384 clearTimeout(timeoutTimer);
48387 // Dereference transport for early garbage collection
48388 // (no matter how long the jqXHR object will be used)
48389 transport = undefined;
48391 // Cache response headers
48392 responseHeadersString = headers || "";
48395 jqXHR.readyState = status > 0 ? 4 : 0;
48397 // Determine if successful
48398 isSuccess = status >= 200 && status < 300 || status === 304;
48400 // Get response data
48402 response = ajaxHandleResponses(s, jqXHR, responses);
48405 // Convert no matter what (that way responseXXX fields are always
48407 response = ajaxConvert(s, response, jqXHR, isSuccess);
48409 // If successful, handle type chaining
48412 // Set the If-Modified-Since and/or If-None-Match header, if in
48413 // ifModified mode.
48414 if (s.ifModified) {
48415 modified = jqXHR.getResponseHeader("Last-Modified");
48417 jQuery.lastModified[cacheURL] = modified;
48419 modified = jqXHR.getResponseHeader("etag");
48421 jQuery.etag[cacheURL] = modified;
48426 if (status === 204 || s.type === "HEAD") {
48427 statusText = "nocontent";
48430 } else if (status === 304) {
48431 statusText = "notmodified";
48433 // If we have data, let's convert it
48435 statusText = response.state;
48436 success = response.data;
48437 error = response.error;
48438 isSuccess = !error;
48441 // Extract error from statusText and normalize for non-aborts
48442 error = statusText;
48443 if (status || !statusText) {
48444 statusText = "error";
48451 // Set data for the fake xhr object
48452 jqXHR.status = status;
48453 jqXHR.statusText = (nativeStatusText || statusText) + "";
48457 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
48459 deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
48462 // Status-dependent callbacks
48463 jqXHR.statusCode(statusCode);
48464 statusCode = undefined;
48467 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
48471 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
48474 globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
48475 // Handle the global AJAX counter
48476 if (!(--jQuery.active)) {
48477 jQuery.event.trigger("ajaxStop");
48485 getJSON: function(url, data, callback) {
48486 return jQuery.get(url, data, callback, "json");
48489 getScript: function(url, callback) {
48490 return jQuery.get(url, undefined, callback, "script");
48494 jQuery.each(["get", "post"], function(i, method) {
48495 jQuery[method] = function(url, data, callback, type) {
48496 // Shift arguments if data argument was omitted
48497 if (jQuery.isFunction(data)) {
48498 type = type || callback;
48503 return jQuery.ajax({
48514 jQuery._evalUrl = function(url) {
48515 return jQuery.ajax({
48518 dataType: "script",
48527 wrapAll: function(html) {
48530 if (jQuery.isFunction(html)) {
48531 return this.each(function(i) {
48532 jQuery(this).wrapAll(html.call(this, i));
48538 // The elements to wrap the target around
48539 wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
48541 if (this[0].parentNode) {
48542 wrap.insertBefore(this[0]);
48545 wrap.map(function() {
48548 while (elem.firstElementChild) {
48549 elem = elem.firstElementChild;
48559 wrapInner: function(html) {
48560 if (jQuery.isFunction(html)) {
48561 return this.each(function(i) {
48562 jQuery(this).wrapInner(html.call(this, i));
48566 return this.each(function() {
48567 var self = jQuery(this),
48568 contents = self.contents();
48570 if (contents.length) {
48571 contents.wrapAll(html);
48579 wrap: function(html) {
48580 var isFunction = jQuery.isFunction(html);
48582 return this.each(function(i) {
48583 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html);
48587 unwrap: function() {
48588 return this.parent().each(function() {
48589 if (!jQuery.nodeName(this, "body")) {
48590 jQuery(this).replaceWith(this.childNodes);
48597 jQuery.expr.filters.hidden = function(elem) {
48598 // Support: Opera <= 12.12
48599 // Opera reports offsetWidths and offsetHeights less than zero on some
48601 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
48603 jQuery.expr.filters.visible = function(elem) {
48604 return !jQuery.expr.filters.hidden(elem);
48611 rbracket = /\[\]$/,
48613 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
48614 rsubmittable = /^(?:input|select|textarea|keygen)/i;
48616 function buildParams(prefix, obj, traditional, add) {
48619 if (jQuery.isArray(obj)) {
48620 // Serialize array item.
48621 jQuery.each(obj, function(i, v) {
48622 if (traditional || rbracket.test(prefix)) {
48623 // Treat each array item as a scalar.
48627 // Item is non-scalar (array or object), encode its numeric
48629 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
48633 } else if (!traditional && jQuery.type(obj) === "object") {
48634 // Serialize object item.
48635 for (name in obj) {
48636 buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
48640 // Serialize scalar item.
48645 // Serialize an array of form elements or a set of
48646 // key/values into a query string
48647 jQuery.param = function(a, traditional) {
48650 add = function(key, value) {
48651 // If value is a function, invoke it and return its value
48652 value = jQuery.isFunction(value) ? value() : (value == null ? "" : value);
48653 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
48656 // Set traditional to true for jQuery <= 1.3.2 behavior.
48657 if (traditional === undefined) {
48658 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
48661 // If an array was passed in, assume that it is an array of form elements.
48662 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
48663 // Serialize the form elements
48664 jQuery.each(a, function() {
48665 add(this.name, this.value);
48669 // If traditional, encode the "old" way (the way 1.3.2 or older
48670 // did it), otherwise encode params recursively.
48671 for (prefix in a) {
48672 buildParams(prefix, a[prefix], traditional, add);
48676 // Return the resulting serialization
48677 return s.join("&").replace(r20, "+");
48681 serialize: function() {
48682 return jQuery.param(this.serializeArray());
48684 serializeArray: function() {
48685 return this.map(function() {
48686 // Can add propHook for "elements" to filter or add form elements
48687 var elements = jQuery.prop(this, "elements");
48688 return elements ? jQuery.makeArray(elements) : this;
48690 .filter(function() {
48691 var type = this.type;
48693 // Use .is( ":disabled" ) so that fieldset[disabled] works
48694 return this.name && !jQuery(this).is(":disabled") &&
48695 rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) &&
48696 (this.checked || !rcheckableType.test(type));
48698 .map(function(i, elem) {
48699 var val = jQuery(this).val();
48701 return val == null ?
48703 jQuery.isArray(val) ?
48704 jQuery.map(val, function(val) {
48707 value: val.replace(rCRLF, "\r\n")
48711 value: val.replace(rCRLF, "\r\n")
48718 jQuery.ajaxSettings.xhr = function() {
48720 return new XMLHttpRequest();
48726 xhrSuccessStatus = {
48727 // file protocol always yields status code 0, assume 200
48730 // #1450: sometimes IE returns 1223 when it should be 204
48733 xhrSupported = jQuery.ajaxSettings.xhr();
48736 // Open requests must be manually aborted on unload (#5280)
48737 // See https://support.microsoft.com/kb/2856746 for more info
48738 if (window.attachEvent) {
48739 window.attachEvent("onunload", function() {
48740 for (var key in xhrCallbacks) {
48741 xhrCallbacks[key]();
48746 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
48747 support.ajax = xhrSupported = !!xhrSupported;
48749 jQuery.ajaxTransport(function(options) {
48752 // Cross domain only allowed if supported through XMLHttpRequest
48753 if (support.cors || xhrSupported && !options.crossDomain) {
48755 send: function(headers, complete) {
48757 xhr = options.xhr(),
48760 xhr.open(options.type, options.url, options.async, options.username, options.password);
48762 // Apply custom fields if provided
48763 if (options.xhrFields) {
48764 for (i in options.xhrFields) {
48765 xhr[i] = options.xhrFields[i];
48769 // Override mime type if needed
48770 if (options.mimeType && xhr.overrideMimeType) {
48771 xhr.overrideMimeType(options.mimeType);
48774 // X-Requested-With header
48775 // For cross-domain requests, seeing as conditions for a
48777 // akin to a jigsaw puzzle, we simply never set it to be sure.
48778 // (it can always be set on a per-request basis or even using
48780 // For same-domain requests, won't change header if already
48782 if (!options.crossDomain && !headers["X-Requested-With"]) {
48783 headers["X-Requested-With"] = "XMLHttpRequest";
48787 for (i in headers) {
48788 xhr.setRequestHeader(i, headers[i]);
48792 callback = function(type) {
48793 return function() {
48795 delete xhrCallbacks[id];
48796 callback = xhr.onload = xhr.onerror = null;
48798 if (type === "abort") {
48800 } else if (type === "error") {
48802 // file: protocol always yields status 0;
48803 // see #8605, #14207
48809 xhrSuccessStatus[xhr.status] || xhr.status,
48812 // Accessing binary-data responseText throws
48815 typeof xhr.responseText === "string" ? {
48816 text: xhr.responseText
48818 xhr.getAllResponseHeaders()
48825 // Listen to events
48826 xhr.onload = callback();
48827 xhr.onerror = callback("error");
48829 // Create the abort callback
48830 callback = xhrCallbacks[id] = callback("abort");
48833 // Do send the request (this may raise an exception)
48834 xhr.send(options.hasContent && options.data || null);
48836 // #14683: Only rethrow if this hasn't been notified as an
48844 abort: function() {
48856 // Install script dataType
48859 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
48862 script: /(?:java|ecma)script/
48865 "text script": function(text) {
48866 jQuery.globalEval(text);
48872 // Handle cache's special case and crossDomain
48873 jQuery.ajaxPrefilter("script", function(s) {
48874 if (s.cache === undefined) {
48877 if (s.crossDomain) {
48882 // Bind script tag hack transport
48883 jQuery.ajaxTransport("script", function(s) {
48884 // This transport only deals with cross domain requests
48885 if (s.crossDomain) {
48886 var script, callback;
48888 send: function(_, complete) {
48889 script = jQuery("<script>").prop({
48891 charset: s.scriptCharset,
48895 callback = function(evt) {
48899 complete(evt.type === "error" ? 404 : 200, evt.type);
48903 document.head.appendChild(script[0]);
48905 abort: function() {
48917 var oldCallbacks = [],
48918 rjsonp = /(=)\?(?=&|$)|\?\?/;
48920 // Default jsonp settings
48923 jsonpCallback: function() {
48924 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
48925 this[callback] = true;
48930 // Detect, normalize options and install callbacks for jsonp requests
48931 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
48933 var callbackName, overwritten, responseContainer,
48934 jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ?
48936 typeof s.data === "string" && !(s.contentType || "").indexOf("application/x-www-form-urlencoded") && rjsonp.test(s.data) && "data"
48939 // Handle iff the expected data type is "jsonp" or we have a parameter to
48941 if (jsonProp || s.dataTypes[0] === "jsonp") {
48943 // Get callback name, remembering preexisting value associated with it
48944 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ?
48945 s.jsonpCallback() :
48948 // Insert callback into url or form data
48950 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
48951 } else if (s.jsonp !== false) {
48952 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
48955 // Use data converter to retrieve json after script execution
48956 s.converters["script json"] = function() {
48957 if (!responseContainer) {
48958 jQuery.error(callbackName + " was not called");
48960 return responseContainer[0];
48963 // force json dataType
48964 s.dataTypes[0] = "json";
48966 // Install callback
48967 overwritten = window[callbackName];
48968 window[callbackName] = function() {
48969 responseContainer = arguments;
48972 // Clean-up function (fires after converters)
48973 jqXHR.always(function() {
48974 // Restore preexisting value
48975 window[callbackName] = overwritten;
48977 // Save back as free
48978 if (s[callbackName]) {
48979 // make sure that re-using the options doesn't screw things
48981 s.jsonpCallback = originalSettings.jsonpCallback;
48983 // save the callback name for future use
48984 oldCallbacks.push(callbackName);
48987 // Call if it was a function and we have a response
48988 if (responseContainer && jQuery.isFunction(overwritten)) {
48989 overwritten(responseContainer[0]);
48992 responseContainer = overwritten = undefined;
48995 // Delegate to script
49003 // data: string of html
49004 // context (optional): If specified, the fragment will be created in this
49005 // context, defaults to document
49006 // keepScripts (optional): If true, will include scripts passed in the html
49008 jQuery.parseHTML = function(data, context, keepScripts) {
49009 if (!data || typeof data !== "string") {
49012 if (typeof context === "boolean") {
49013 keepScripts = context;
49016 context = context || document;
49018 var parsed = rsingleTag.exec(data),
49019 scripts = !keepScripts && [];
49023 return [context.createElement(parsed[1])];
49026 parsed = jQuery.buildFragment([data], context, scripts);
49028 if (scripts && scripts.length) {
49029 jQuery(scripts).remove();
49032 return jQuery.merge([], parsed.childNodes);
49036 // Keep a copy of the old load method
49037 var _load = jQuery.fn.load;
49040 * Load a url into a page
49042 jQuery.fn.load = function(url, params, callback) {
49043 if (typeof url !== "string" && _load) {
49044 return _load.apply(this, arguments);
49047 var selector, type, response,
49049 off = url.indexOf(" ");
49052 selector = jQuery.trim(url.slice(off));
49053 url = url.slice(0, off);
49056 // If it's a function
49057 if (jQuery.isFunction(params)) {
49059 // We assume that it's the callback
49061 params = undefined;
49063 // Otherwise, build a param string
49064 } else if (params && typeof params === "object") {
49068 // If we have elements to modify, make the request
49069 if (self.length > 0) {
49073 // if "type" variable is undefined, then "GET" method will be used
49077 }).done(function(responseText) {
49079 // Save response for use in complete callback
49080 response = arguments;
49082 self.html(selector ?
49084 // If a selector was specified, locate the right elements in a
49086 // Exclude scripts to avoid IE 'Permission Denied' errors
49087 jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
49089 // Otherwise use the full result
49092 }).complete(callback && function(jqXHR, status) {
49093 self.each(callback, response || [jqXHR.responseText, status, jqXHR]);
49103 // Attach a bunch of functions for handling common AJAX events
49104 jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) {
49105 jQuery.fn[type] = function(fn) {
49106 return this.on(type, fn);
49113 jQuery.expr.filters.animated = function(elem) {
49114 return jQuery.grep(jQuery.timers, function(fn) {
49115 return elem === fn.elem;
49122 var docElem = window.document.documentElement;
49125 * Gets a window from an element
49127 function getWindow(elem) {
49128 return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
49132 setOffset: function(elem, options, i) {
49133 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
49134 position = jQuery.css(elem, "position"),
49135 curElem = jQuery(elem),
49138 // Set position first, in-case top/left are set even on static elem
49139 if (position === "static") {
49140 elem.style.position = "relative";
49143 curOffset = curElem.offset();
49144 curCSSTop = jQuery.css(elem, "top");
49145 curCSSLeft = jQuery.css(elem, "left");
49146 calculatePosition = (position === "absolute" || position === "fixed") &&
49147 (curCSSTop + curCSSLeft).indexOf("auto") > -1;
49149 // Need to be able to calculate position if either
49150 // top or left is auto and position is either absolute or fixed
49151 if (calculatePosition) {
49152 curPosition = curElem.position();
49153 curTop = curPosition.top;
49154 curLeft = curPosition.left;
49157 curTop = parseFloat(curCSSTop) || 0;
49158 curLeft = parseFloat(curCSSLeft) || 0;
49161 if (jQuery.isFunction(options)) {
49162 options = options.call(elem, i, curOffset);
49165 if (options.top != null) {
49166 props.top = (options.top - curOffset.top) + curTop;
49168 if (options.left != null) {
49169 props.left = (options.left - curOffset.left) + curLeft;
49172 if ("using" in options) {
49173 options.using.call(elem, props);
49176 curElem.css(props);
49182 offset: function(options) {
49183 if (arguments.length) {
49184 return options === undefined ?
49186 this.each(function(i) {
49187 jQuery.offset.setOffset(this, options, i);
49197 doc = elem && elem.ownerDocument;
49203 docElem = doc.documentElement;
49205 // Make sure it's not a disconnected DOM node
49206 if (!jQuery.contains(docElem, elem)) {
49210 // Support: BlackBerry 5, iOS 3 (original iPhone)
49211 // If we don't have gBCR, just use 0,0 rather than error
49212 if (typeof elem.getBoundingClientRect !== strundefined) {
49213 box = elem.getBoundingClientRect();
49215 win = getWindow(doc);
49217 top: box.top + win.pageYOffset - docElem.clientTop,
49218 left: box.left + win.pageXOffset - docElem.clientLeft
49222 position: function() {
49227 var offsetParent, offset,
49234 // Fixed elements are offset from window (parentOffset = {top:0, left:
49235 // 0}, because it is its only offset parent
49236 if (jQuery.css(elem, "position") === "fixed") {
49237 // Assume getBoundingClientRect is there when computed position is
49239 offset = elem.getBoundingClientRect();
49242 // Get *real* offsetParent
49243 offsetParent = this.offsetParent();
49245 // Get correct offsets
49246 offset = this.offset();
49247 if (!jQuery.nodeName(offsetParent[0], "html")) {
49248 parentOffset = offsetParent.offset();
49251 // Add offsetParent borders
49252 parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
49253 parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true);
49256 // Subtract parent offsets and element margins
49258 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
49259 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
49263 offsetParent: function() {
49264 return this.map(function() {
49265 var offsetParent = this.offsetParent || docElem;
49267 while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) {
49268 offsetParent = offsetParent.offsetParent;
49271 return offsetParent || docElem;
49276 // Create scrollLeft and scrollTop methods
49278 scrollLeft: "pageXOffset",
49279 scrollTop: "pageYOffset"
49280 }, function(method, prop) {
49281 var top = "pageYOffset" === prop;
49283 jQuery.fn[method] = function(val) {
49284 return access(this, function(elem, method, val) {
49285 var win = getWindow(elem);
49287 if (val === undefined) {
49288 return win ? win[prop] : elem[method];
49292 win.scrollTo(!top ? val : window.pageXOffset,
49293 top ? val : window.pageYOffset
49297 elem[method] = val;
49299 }, method, val, arguments.length, null);
49303 // Support: Safari<7+, Chrome<37+
49304 // Add the top/left cssHooks using jQuery.fn.position
49305 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
49306 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
49307 // getComputedStyle returns percent when specified for top/left/bottom/right;
49308 // rather than make the css module depend on the offset module, just check for
49310 jQuery.each(["top", "left"], function(i, prop) {
49311 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition,
49312 function(elem, computed) {
49314 computed = curCSS(elem, prop);
49315 // If curCSS returns percentage, fallback to offset
49316 return rnumnonpx.test(computed) ?
49317 jQuery(elem).position()[prop] + "px" :
49325 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth
49330 }, function(name, type) {
49332 padding: "inner" + name,
49335 }, function(defaultExtra, funcName) {
49336 // Margin is only for outerHeight, outerWidth
49337 jQuery.fn[funcName] = function(margin, value) {
49338 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
49339 extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
49341 return access(this, function(elem, type, value) {
49344 if (jQuery.isWindow(elem)) {
49345 // As of 5/8/2012 this will yield incorrect results for
49346 // Mobile Safari, but there
49347 // isn't a whole lot we can do. See pull request at this URL
49349 // https://github.com/jquery/jquery/pull/764
49350 return elem.document.documentElement["client" + name];
49353 // Get document width or height
49354 if (elem.nodeType === 9) {
49355 doc = elem.documentElement;
49357 // Either scroll[Width/Height] or offset[Width/Height] or
49358 // client[Width/Height],
49359 // whichever is greatest
49361 elem.body["scroll" + name], doc["scroll" + name],
49362 elem.body["offset" + name], doc["offset" + name],
49363 doc["client" + name]
49367 return value === undefined ?
49368 // Get width or height on the element, requesting but not
49369 // forcing parseFloat
49370 jQuery.css(elem, type, extra) :
49372 // Set width or height on the element
49373 jQuery.style(elem, type, value, extra);
49374 }, type, chainable ? margin : undefined, chainable, null);
49380 // The number of elements contained in the matched element set
49381 jQuery.fn.size = function() {
49382 return this.length;
49385 jQuery.fn.andSelf = jQuery.fn.addBack;
49390 // Register as a named AMD module, since jQuery can be concatenated with other
49391 // files that may use define, but not via a proper concatenation script that
49392 // understands anonymous AMD modules. A named AMD is safest and most robust
49393 // way to register. Lowercase jquery is used because AMD module names are
49394 // derived from file names, and jQuery is normally delivered in a lowercase
49395 // file name. Do this after creating the global so that if an AMD module wants
49396 // to call noConflict to hide this version of jQuery, it will work.
49398 // Note that for maximum portability, libraries that are not jQuery should
49399 // declare themselves as anonymous modules, and avoid setting a global if an
49400 // AMD loader is present. jQuery is a special case. For more information, see
49401 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
49403 if (typeof define === "function" && define.amd) {
49404 define("jquery", [], function() {
49413 // Map over jQuery in case of overwrite
49414 _jQuery = window.jQuery,
49416 // Map over the $ in case of overwrite
49419 jQuery.noConflict = function(deep) {
49420 if (window.$ === jQuery) {
49424 if (deep && window.jQuery === jQuery) {
49425 window.jQuery = _jQuery;
49431 // Expose jQuery and $ identifiers, even in AMD
49432 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
49433 // and CommonJS for browser emulators (#13566)
49434 if (typeof noGlobal === strundefined) {
49435 window.jQuery = window.$ = jQuery;
49446 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\flatten.js": [function(require, module, exports) {
49447 var baseFlatten = require('../internal/baseFlatten'),
49448 isIterateeCall = require('../internal/isIterateeCall');
49451 * Flattens a nested array. If `isDeep` is `true` the array is recursively
49452 * flattened, otherwise it's only flattened a single level.
49458 * array The array to flatten.
49460 * [isDeep] Specify a deep flatten.
49461 * @param- {Object} [guard] Enables use as a callback for functions like
49463 * @returns {Array} Returns the new flattened array.
49466 * _.flatten([1, [2, 3, [4]]]); // => [1, 2, 3, [4]]
49467 * // using `isDeep` _.flatten([1, [2, 3, [4]]], true); // => [1, 2, 3, 4]
49469 function flatten(array, isDeep, guard) {
49470 var length = array ? array.length : 0;
49471 if (guard && isIterateeCall(array, isDeep, guard)) {
49474 return length ? baseFlatten(array, isDeep) : [];
49477 module.exports = flatten;
49480 "../internal/baseFlatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js",
49481 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js"
49483 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\last.js": [function(require, module, exports) {
49485 * Gets the last element of `array`.
49491 * array The array to query.
49492 * @returns {*} Returns the last element of `array`.
49495 * _.last([1, 2, 3]); // => 3
49497 function last(array) {
49498 var length = array ? array.length : 0;
49499 return length ? array[length - 1] : undefined;
49502 module.exports = last;
49505 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\uniq.js": [function(require, module, exports) {
49506 var baseCallback = require('../internal/baseCallback'),
49507 baseUniq = require('../internal/baseUniq'),
49508 isIterateeCall = require('../internal/isIterateeCall'),
49509 sortedUniq = require('../internal/sortedUniq');
49512 * Creates a duplicate-free version of an array, using
49513 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
49514 * for equality comparisons, in which only the first occurence of each element
49515 * is kept. Providing `true` for `isSorted` performs a faster search algorithm
49516 * for sorted arrays. If an iteratee function is provided it's invoked for each
49517 * element in the array to generate the criterion by which uniqueness is
49518 * computed. The `iteratee` is bound to `thisArg` and invoked with three
49519 * arguments: (value, index, array).
49521 * If a property name is provided for `iteratee` the created `_.property` style
49522 * callback returns the property value of the given element.
49524 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49525 * style callback returns `true` for elements that have a matching property
49526 * value, else `false`.
49528 * If an object is provided for `iteratee` the created `_.matches` style
49529 * callback returns `true` for elements that have the properties of the given
49530 * object, else `false`.
49537 * array The array to inspect.
49539 * [isSorted] Specify the array is sorted.
49540 * @param {Function|Object|string}
49541 * [iteratee] The function invoked per iteration.
49543 * [thisArg] The `this` binding of `iteratee`.
49544 * @returns {Array} Returns the new duplicate-value-free array.
49547 * _.uniq([2, 1, 2]); // => [2, 1]
49548 * // using `isSorted` _.uniq([1, 1, 2], true); // => [1, 2]
49549 * // using an iteratee function _.uniq([1, 2.5, 1.5, 2], function(n) { return
49550 * this.floor(n); }, Math); // => [1, 2.5]
49551 * // using the `_.property` callback shorthand _.uniq([{ 'x': 1 }, { 'x': 2 }, {
49552 * 'x': 1 }], 'x'); // => [{ 'x': 1 }, { 'x': 2 }]
49554 function uniq(array, isSorted, iteratee, thisArg) {
49555 var length = array ? array.length : 0;
49559 if (isSorted != null && typeof isSorted != 'boolean') {
49560 thisArg = iteratee;
49561 iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
49564 iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3);
49565 return (isSorted) ? sortedUniq(array, iteratee) : baseUniq(array, iteratee);
49568 module.exports = uniq;
49571 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
49572 "../internal/baseUniq": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseUniq.js",
49573 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
49574 "../internal/sortedUniq": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\sortedUniq.js"
49576 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\unique.js": [function(require, module, exports) {
49577 module.exports = require('./uniq');
49580 "./uniq": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\uniq.js"
49582 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\chain\\lodash.js": [function(require, module, exports) {
49583 var LazyWrapper = require('../internal/LazyWrapper'),
49584 LodashWrapper = require('../internal/LodashWrapper'),
49585 baseLodash = require('../internal/baseLodash'),
49586 isArray = require('../lang/isArray'),
49587 isObjectLike = require('../internal/isObjectLike'),
49588 wrapperClone = require('../internal/wrapperClone');
49590 /** Used for native method references. */
49591 var objectProto = Object.prototype;
49593 /** Used to check objects for own properties. */
49594 var hasOwnProperty = objectProto.hasOwnProperty;
49597 * Creates a `lodash` object which wraps `value` to enable implicit chaining.
49598 * Methods that operate on and return arrays, collections, and functions can be
49599 * chained together. Methods that retrieve a single value or may return a
49600 * primitive value will automatically end the chain returning the unwrapped
49601 * value. Explicit chaining may be enabled using `_.chain`. The execution of
49602 * chained methods is lazy, that is, execution is deferred until `_#value` is
49603 * implicitly or explicitly called.
49605 * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
49606 * fusion is an optimization strategy which merge iteratee calls; this can help
49607 * to avoid the creation of intermediate data structures and greatly reduce the
49608 * number of iteratee executions.
49610 * Chaining is supported in custom builds as long as the `_#value` method is
49611 * directly or indirectly included in the build.
49613 * In addition to lodash methods, wrappers have `Array` and `String` methods.
49615 * The wrapper `Array` methods are: `concat`, `join`, `pop`, `push`, `reverse`,
49616 * `shift`, `slice`, `sort`, `splice`, and `unshift`
49618 * The wrapper `String` methods are: `replace` and `split`
49620 * The wrapper methods that support shortcut fusion are: `compact`, `drop`,
49621 * `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `first`, `initial`,
49622 * `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, `slice`, `take`,
49623 * `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, and `where`
49625 * The chainable wrapper methods are: `after`, `ary`, `assign`, `at`, `before`,
49626 * `bind`, `bindAll`, `bindKey`, `callback`, `chain`, `chunk`, `commit`,
49627 * `compact`, `concat`, `constant`, `countBy`, `create`, `curry`, `debounce`,
49628 * `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, `drop`,
49629 * `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, `filter`, `flatten`,
49630 * `flattenDeep`, `flow`, `flowRight`, `forEach`, `forEachRight`, `forIn`,
49631 * `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`,
49632 * `initial`, `intersection`, `invert`, `invoke`, `keys`, `keysIn`, `map`,
49633 * `mapKeys`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`,
49634 * `method`, `methodOf`, `mixin`, `modArgs`, `negate`, `omit`, `once`, `pairs`,
49635 * `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`, `property`,
49636 * `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`,
49637 * `rest`, `restParam`, `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`,
49638 * `sortByAll`, `sortByOrder`, `splice`, `spread`, `take`, `takeRight`,
49639 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`,
49640 * `toPlainObject`, `transform`, `union`, `uniq`, `unshift`, `unzip`,
49641 * `unzipWith`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`,
49642 * `zipObject`, `zipWith`
49644 * The wrapper methods that are **not** chainable by default are: `add`,
49645 * `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`, `deburr`,
49646 * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
49647 * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
49648 * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
49649 * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
49650 * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
49651 * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
49652 * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
49653 * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
49654 * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
49655 * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
49656 * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
49657 * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
49658 * `unescape`, `uniqueId`, `value`, and `words`
49660 * The wrapper method `sample` will return a wrapped value when `n` is provided,
49661 * otherwise an unwrapped value is returned.
49667 * value The value to wrap in a `lodash` instance.
49668 * @returns {Object} Returns the new `lodash` wrapper instance.
49671 * var wrapped = _([1, 2, 3]);
49672 * // returns an unwrapped value wrapped.reduce(function(total, n) { return
49673 * total + n; }); // => 6
49674 * // returns a wrapped value var squares = wrapped.map(function(n) { return n *
49677 * _.isArray(squares); // => false
49679 * _.isArray(squares.value()); // => true
49681 function lodash(value) {
49682 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
49683 if (value instanceof LodashWrapper) {
49686 if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
49687 return wrapperClone(value);
49690 return new LodashWrapper(value);
49693 // Ensure wrappers are instances of `baseLodash`.
49694 lodash.prototype = baseLodash.prototype;
49696 module.exports = lodash;
49699 "../internal/LazyWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js",
49700 "../internal/LodashWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LodashWrapper.js",
49701 "../internal/baseLodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js",
49702 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js",
49703 "../internal/wrapperClone": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\wrapperClone.js",
49704 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
49706 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\every.js": [function(require, module, exports) {
49707 var arrayEvery = require('../internal/arrayEvery'),
49708 baseCallback = require('../internal/baseCallback'),
49709 baseEvery = require('../internal/baseEvery'),
49710 isArray = require('../lang/isArray'),
49711 isIterateeCall = require('../internal/isIterateeCall');
49714 * Checks if `predicate` returns truthy for **all** elements of `collection`.
49715 * The predicate is bound to `thisArg` and invoked with three arguments: (value,
49716 * index|key, collection).
49718 * If a property name is provided for `predicate` the created `_.property` style
49719 * callback returns the property value of the given element.
49721 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49722 * style callback returns `true` for elements that have a matching property
49723 * value, else `false`.
49725 * If an object is provided for `predicate` the created `_.matches` style
49726 * callback returns `true` for elements that have the properties of the given
49727 * object, else `false`.
49732 * @category Collection
49733 * @param {Array|Object|string}
49734 * collection The collection to iterate over.
49735 * @param {Function|Object|string}
49736 * [predicate=_.identity] The function invoked per iteration.
49738 * [thisArg] The `this` binding of `predicate`.
49739 * @returns {boolean} Returns `true` if all elements pass the predicate check,
49743 * _.every([true, 1, null, 'yes'], Boolean); // => false
49745 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
49746 * 'active': false } ];
49747 * // using the `_.matches` callback shorthand _.every(users, { 'user':
49748 * 'barney', 'active': false }); // => false
49749 * // using the `_.matchesProperty` callback shorthand _.every(users, 'active',
49750 * false); // => true
49751 * // using the `_.property` callback shorthand _.every(users, 'active'); // =>
49754 function every(collection, predicate, thisArg) {
49755 var func = isArray(collection) ? arrayEvery : baseEvery;
49756 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
49757 predicate = undefined;
49759 if (typeof predicate != 'function' || thisArg !== undefined) {
49760 predicate = baseCallback(predicate, thisArg, 3);
49762 return func(collection, predicate);
49765 module.exports = every;
49768 "../internal/arrayEvery": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEvery.js",
49769 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
49770 "../internal/baseEvery": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEvery.js",
49771 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
49772 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
49774 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js": [function(require, module, exports) {
49775 var arrayFilter = require('../internal/arrayFilter'),
49776 baseCallback = require('../internal/baseCallback'),
49777 baseFilter = require('../internal/baseFilter'),
49778 isArray = require('../lang/isArray');
49781 * Iterates over elements of `collection`, returning an array of all elements
49782 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
49783 * invoked with three arguments: (value, index|key, collection).
49785 * If a property name is provided for `predicate` the created `_.property` style
49786 * callback returns the property value of the given element.
49788 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49789 * style callback returns `true` for elements that have a matching property
49790 * value, else `false`.
49792 * If an object is provided for `predicate` the created `_.matches` style
49793 * callback returns `true` for elements that have the properties of the given
49794 * object, else `false`.
49799 * @category Collection
49800 * @param {Array|Object|string}
49801 * collection The collection to iterate over.
49802 * @param {Function|Object|string}
49803 * [predicate=_.identity] The function invoked per iteration.
49805 * [thisArg] The `this` binding of `predicate`.
49806 * @returns {Array} Returns the new filtered array.
49809 * _.filter([4, 5, 6], function(n) { return n % 2 == 0; }); // => [4, 6]
49811 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
49812 * 'fred', 'age': 40, 'active': false } ];
49813 * // using the `_.matches` callback shorthand _.pluck(_.filter(users, { 'age':
49814 * 36, 'active': true }), 'user'); // => ['barney']
49815 * // using the `_.matchesProperty` callback shorthand _.pluck(_.filter(users,
49816 * 'active', false), 'user'); // => ['fred']
49817 * // using the `_.property` callback shorthand _.pluck(_.filter(users,
49818 * 'active'), 'user'); // => ['barney']
49820 function filter(collection, predicate, thisArg) {
49821 var func = isArray(collection) ? arrayFilter : baseFilter;
49822 predicate = baseCallback(predicate, thisArg, 3);
49823 return func(collection, predicate);
49826 module.exports = filter;
49829 "../internal/arrayFilter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayFilter.js",
49830 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
49831 "../internal/baseFilter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFilter.js",
49832 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
49834 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js": [function(require, module, exports) {
49835 var baseEach = require('../internal/baseEach'),
49836 createFind = require('../internal/createFind');
49839 * Iterates over elements of `collection`, returning the first element
49840 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
49841 * invoked with three arguments: (value, index|key, collection).
49843 * If a property name is provided for `predicate` the created `_.property` style
49844 * callback returns the property value of the given element.
49846 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49847 * style callback returns `true` for elements that have a matching property
49848 * value, else `false`.
49850 * If an object is provided for `predicate` the created `_.matches` style
49851 * callback returns `true` for elements that have the properties of the given
49852 * object, else `false`.
49857 * @category Collection
49858 * @param {Array|Object|string}
49859 * collection The collection to search.
49860 * @param {Function|Object|string}
49861 * [predicate=_.identity] The function invoked per iteration.
49863 * [thisArg] The `this` binding of `predicate`.
49864 * @returns {*} Returns the matched element, else `undefined`.
49867 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
49868 * 'fred', 'age': 40, 'active': false }, { 'user': 'pebbles', 'age': 1,
49869 * 'active': true } ];
49871 * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); // =>
49873 * // using the `_.matches` callback shorthand _.result(_.find(users, { 'age':
49874 * 1, 'active': true }), 'user'); // => 'pebbles'
49875 * // using the `_.matchesProperty` callback shorthand _.result(_.find(users,
49876 * 'active', false), 'user'); // => 'fred'
49877 * // using the `_.property` callback shorthand _.result(_.find(users,
49878 * 'active'), 'user'); // => 'barney'
49880 var find = createFind(baseEach);
49882 module.exports = find;
49885 "../internal/baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
49886 "../internal/createFind": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createFind.js"
49888 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js": [function(require, module, exports) {
49889 var arrayEach = require('../internal/arrayEach'),
49890 baseEach = require('../internal/baseEach'),
49891 createForEach = require('../internal/createForEach');
49894 * Iterates over elements of `collection` invoking `iteratee` for each element.
49895 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
49896 * (value, index|key, collection). Iteratee functions may exit iteration early
49897 * by explicitly returning `false`.
49899 * **Note:** As with other "Collections" methods, objects with a "length"
49900 * property are iterated like arrays. To avoid this behavior `_.forIn` or
49901 * `_.forOwn` may be used for object iteration.
49906 * @category Collection
49907 * @param {Array|Object|string}
49908 * collection The collection to iterate over.
49909 * @param {Function}
49910 * [iteratee=_.identity] The function invoked per iteration.
49912 * [thisArg] The `this` binding of `iteratee`.
49913 * @returns {Array|Object|string} Returns `collection`.
49916 * _([1, 2]).forEach(function(n) { console.log(n); }).value(); // => logs each
49917 * value from left to right and returns the array
49919 * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { console.log(n, key); }); // =>
49920 * logs each value-key pair and returns the object (iteration order is not
49923 var forEach = createForEach(arrayEach, baseEach);
49925 module.exports = forEach;
49928 "../internal/arrayEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEach.js",
49929 "../internal/baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
49930 "../internal/createForEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createForEach.js"
49932 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js": [function(require, module, exports) {
49933 var createAggregator = require('../internal/createAggregator');
49935 /** Used for native method references. */
49936 var objectProto = Object.prototype;
49938 /** Used to check objects for own properties. */
49939 var hasOwnProperty = objectProto.hasOwnProperty;
49942 * Creates an object composed of keys generated from the results of running each
49943 * element of `collection` through `iteratee`. The corresponding value of each
49944 * key is an array of the elements responsible for generating the key. The
49945 * `iteratee` is bound to `thisArg` and invoked with three arguments: (value,
49946 * index|key, collection).
49948 * If a property name is provided for `iteratee` the created `_.property` style
49949 * callback returns the property value of the given element.
49951 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49952 * style callback returns `true` for elements that have a matching property
49953 * value, else `false`.
49955 * If an object is provided for `iteratee` the created `_.matches` style
49956 * callback returns `true` for elements that have the properties of the given
49957 * object, else `false`.
49961 * @category Collection
49962 * @param {Array|Object|string}
49963 * collection The collection to iterate over.
49964 * @param {Function|Object|string}
49965 * [iteratee=_.identity] The function invoked per iteration.
49967 * [thisArg] The `this` binding of `iteratee`.
49968 * @returns {Object} Returns the composed aggregate object.
49971 * _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); }); // => {
49972 * '4': [4.2], '6': [6.1, 6.4] }
49974 * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); // => {
49975 * '4': [4.2], '6': [6.1, 6.4] }
49976 * // using the `_.property` callback shorthand _.groupBy(['one', 'two',
49977 * 'three'], 'length'); // => { '3': ['one', 'two'], '5': ['three'] }
49979 var groupBy = createAggregator(function(result, value, key) {
49980 if (hasOwnProperty.call(result, key)) {
49981 result[key].push(value);
49983 result[key] = [value];
49987 module.exports = groupBy;
49990 "../internal/createAggregator": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAggregator.js"
49992 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\includes.js": [function(require, module, exports) {
49993 var baseIndexOf = require('../internal/baseIndexOf'),
49994 getLength = require('../internal/getLength'),
49995 isArray = require('../lang/isArray'),
49996 isIterateeCall = require('../internal/isIterateeCall'),
49997 isLength = require('../internal/isLength'),
49998 isString = require('../lang/isString'),
49999 values = require('../object/values');
50002 * Native method references for those with the same name as other `lodash`
50005 var nativeMax = Math.max;
50008 * Checks if `target` is in `collection` using
50009 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
50010 * for equality comparisons. If `fromIndex` is negative, it's used as the offset
50011 * from the end of `collection`.
50015 * @alias contains, include
50016 * @category Collection
50017 * @param {Array|Object|string}
50018 * collection The collection to search.
50020 * target The value to search for.
50022 * [fromIndex=0] The index to search from.
50023 * @param- {Object} [guard] Enables use as a callback for functions like
50025 * @returns {boolean} Returns `true` if a matching element is found, else
50029 * _.includes([1, 2, 3], 1); // => true
50031 * _.includes([1, 2, 3], 1, 2); // => false
50033 * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); // => true
50035 * _.includes('pebbles', 'eb'); // => true
50037 function includes(collection, target, fromIndex, guard) {
50038 var length = collection ? getLength(collection) : 0;
50039 if (!isLength(length)) {
50040 collection = values(collection);
50041 length = collection.length;
50043 if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
50046 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
50048 return (typeof collection == 'string' || !isArray(collection) && isString(collection)) ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) : (!!length && baseIndexOf(collection, target, fromIndex) > -1);
50051 module.exports = includes;
50054 "../internal/baseIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js",
50055 "../internal/getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
50056 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
50057 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
50058 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
50059 "../lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
50060 "../object/values": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\values.js"
50062 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js": [function(require, module, exports) {
50063 var arrayMap = require('../internal/arrayMap'),
50064 baseCallback = require('../internal/baseCallback'),
50065 baseMap = require('../internal/baseMap'),
50066 isArray = require('../lang/isArray');
50069 * Creates an array of values by running each element in `collection` through
50070 * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
50071 * arguments: (value, index|key, collection).
50073 * If a property name is provided for `iteratee` the created `_.property` style
50074 * callback returns the property value of the given element.
50076 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50077 * style callback returns `true` for elements that have a matching property
50078 * value, else `false`.
50080 * If an object is provided for `iteratee` the created `_.matches` style
50081 * callback returns `true` for elements that have the properties of the given
50082 * object, else `false`.
50084 * Many lodash methods are guarded to work as iteratees for methods like
50085 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
50087 * The guarded methods are: `ary`, `callback`, `chunk`, `clone`, `create`,
50088 * `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, `flatten`,
50089 * `invert`, `max`, `min`, `parseInt`, `slice`, `sortBy`, `take`, `takeRight`,
50090 * `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `random`, `range`,
50091 * `sample`, `some`, `sum`, `uniq`, and `words`
50096 * @category Collection
50097 * @param {Array|Object|string}
50098 * collection The collection to iterate over.
50099 * @param {Function|Object|string}
50100 * [iteratee=_.identity] The function invoked per iteration.
50102 * [thisArg] The `this` binding of `iteratee`.
50103 * @returns {Array} Returns the new mapped array.
50106 * function timesThree(n) { return n * 3; }
50108 * _.map([1, 2], timesThree); // => [3, 6]
50110 * _.map({ 'a': 1, 'b': 2 }, timesThree); // => [3, 6] (iteration order is not
50113 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
50114 * // using the `_.property` callback shorthand _.map(users, 'user'); // =>
50115 * ['barney', 'fred']
50117 function map(collection, iteratee, thisArg) {
50118 var func = isArray(collection) ? arrayMap : baseMap;
50119 iteratee = baseCallback(iteratee, thisArg, 3);
50120 return func(collection, iteratee);
50123 module.exports = map;
50126 "../internal/arrayMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayMap.js",
50127 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
50128 "../internal/baseMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMap.js",
50129 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
50131 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js": [function(require, module, exports) {
50132 var arrayReduce = require('../internal/arrayReduce'),
50133 baseEach = require('../internal/baseEach'),
50134 createReduce = require('../internal/createReduce');
50137 * Reduces `collection` to a value which is the accumulated result of running
50138 * each element in `collection` through `iteratee`, where each successive
50139 * invocation is supplied the return value of the previous. If `accumulator` is
50140 * not provided the first element of `collection` is used as the initial value.
50141 * The `iteratee` is bound to `thisArg` and invoked with four arguments:
50142 * (accumulator, value, index|key, collection).
50144 * Many lodash methods are guarded to work as iteratees for methods like
50145 * `_.reduce`, `_.reduceRight`, and `_.transform`.
50147 * The guarded methods are: `assign`, `defaults`, `defaultsDeep`, `includes`,
50148 * `merge`, `sortByAll`, and `sortByOrder`
50152 * @alias foldl, inject
50153 * @category Collection
50154 * @param {Array|Object|string}
50155 * collection The collection to iterate over.
50156 * @param {Function}
50157 * [iteratee=_.identity] The function invoked per iteration.
50159 * [accumulator] The initial value.
50161 * [thisArg] The `this` binding of `iteratee`.
50162 * @returns {*} Returns the accumulated value.
50165 * _.reduce([1, 2], function(total, n) { return total + n; }); // => 3
50167 * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { result[key] = n * 3;
50168 * return result; }, {}); // => { 'a': 3, 'b': 6 } (iteration order is not
50171 var reduce = createReduce(arrayReduce, baseEach);
50173 module.exports = reduce;
50176 "../internal/arrayReduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayReduce.js",
50177 "../internal/baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
50178 "../internal/createReduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createReduce.js"
50180 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\size.js": [function(require, module, exports) {
50181 var getLength = require('../internal/getLength'),
50182 isLength = require('../internal/isLength'),
50183 keys = require('../object/keys');
50186 * Gets the size of `collection` by returning its length for array-like values
50187 * or the number of own enumerable properties for objects.
50191 * @category Collection
50192 * @param {Array|Object|string}
50193 * collection The collection to inspect.
50194 * @returns {number} Returns the size of `collection`.
50197 * _.size([1, 2, 3]); // => 3
50199 * _.size({ 'a': 1, 'b': 2 }); // => 2
50201 * _.size('pebbles'); // => 7
50203 function size(collection) {
50204 var length = collection ? getLength(collection) : 0;
50205 return isLength(length) ? length : keys(collection).length;
50208 module.exports = size;
50211 "../internal/getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
50212 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
50213 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
50215 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\some.js": [function(require, module, exports) {
50216 var arraySome = require('../internal/arraySome'),
50217 baseCallback = require('../internal/baseCallback'),
50218 baseSome = require('../internal/baseSome'),
50219 isArray = require('../lang/isArray'),
50220 isIterateeCall = require('../internal/isIterateeCall');
50223 * Checks if `predicate` returns truthy for **any** element of `collection`. The
50224 * function returns as soon as it finds a passing value and does not iterate
50225 * over the entire collection. The predicate is bound to `thisArg` and invoked
50226 * with three arguments: (value, index|key, collection).
50228 * If a property name is provided for `predicate` the created `_.property` style
50229 * callback returns the property value of the given element.
50231 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50232 * style callback returns `true` for elements that have a matching property
50233 * value, else `false`.
50235 * If an object is provided for `predicate` the created `_.matches` style
50236 * callback returns `true` for elements that have the properties of the given
50237 * object, else `false`.
50242 * @category Collection
50243 * @param {Array|Object|string}
50244 * collection The collection to iterate over.
50245 * @param {Function|Object|string}
50246 * [predicate=_.identity] The function invoked per iteration.
50248 * [thisArg] The `this` binding of `predicate`.
50249 * @returns {boolean} Returns `true` if any element passes the predicate check,
50253 * _.some([null, 0, 'yes', false], Boolean); // => true
50255 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
50256 * 'active': false } ];
50257 * // using the `_.matches` callback shorthand _.some(users, { 'user':
50258 * 'barney', 'active': false }); // => false
50259 * // using the `_.matchesProperty` callback shorthand _.some(users, 'active',
50260 * false); // => true
50261 * // using the `_.property` callback shorthand _.some(users, 'active'); // =>
50264 function some(collection, predicate, thisArg) {
50265 var func = isArray(collection) ? arraySome : baseSome;
50266 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
50267 predicate = undefined;
50269 if (typeof predicate != 'function' || thisArg !== undefined) {
50270 predicate = baseCallback(predicate, thisArg, 3);
50272 return func(collection, predicate);
50275 module.exports = some;
50278 "../internal/arraySome": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arraySome.js",
50279 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
50280 "../internal/baseSome": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSome.js",
50281 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
50282 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
50284 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\sortBy.js": [function(require, module, exports) {
50285 var baseCallback = require('../internal/baseCallback'),
50286 baseMap = require('../internal/baseMap'),
50287 baseSortBy = require('../internal/baseSortBy'),
50288 compareAscending = require('../internal/compareAscending'),
50289 isIterateeCall = require('../internal/isIterateeCall');
50292 * Creates an array of elements, sorted in ascending order by the results of
50293 * running each element in a collection through `iteratee`. This method performs
50294 * a stable sort, that is, it preserves the original sort order of equal
50295 * elements. The `iteratee` is bound to `thisArg` and invoked with three
50296 * arguments: (value, index|key, collection).
50298 * If a property name is provided for `iteratee` the created `_.property` style
50299 * callback returns the property value of the given element.
50301 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50302 * style callback returns `true` for elements that have a matching property
50303 * value, else `false`.
50305 * If an object is provided for `iteratee` the created `_.matches` style
50306 * callback returns `true` for elements that have the properties of the given
50307 * object, else `false`.
50311 * @category Collection
50312 * @param {Array|Object|string}
50313 * collection The collection to iterate over.
50314 * @param {Function|Object|string}
50315 * [iteratee=_.identity] The function invoked per iteration.
50317 * [thisArg] The `this` binding of `iteratee`.
50318 * @returns {Array} Returns the new sorted array.
50321 * _.sortBy([1, 2, 3], function(n) { return Math.sin(n); }); // => [3, 1, 2]
50323 * _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math); // => [3, 1,
50326 * var users = [ { 'user': 'fred' }, { 'user': 'pebbles' }, { 'user': 'barney' } ];
50327 * // using the `_.property` callback shorthand _.pluck(_.sortBy(users,
50328 * 'user'), 'user'); // => ['barney', 'fred', 'pebbles']
50330 function sortBy(collection, iteratee, thisArg) {
50331 if (collection == null) {
50334 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
50335 iteratee = undefined;
50338 iteratee = baseCallback(iteratee, thisArg, 3);
50340 var result = baseMap(collection, function(value, key, collection) {
50342 'criteria': iteratee(value, key, collection),
50347 return baseSortBy(result, compareAscending);
50350 module.exports = sortBy;
50353 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
50354 "../internal/baseMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMap.js",
50355 "../internal/baseSortBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSortBy.js",
50356 "../internal/compareAscending": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\compareAscending.js",
50357 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js"
50359 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\date\\now.js": [function(require, module, exports) {
50360 var getNative = require('../internal/getNative');
50363 * Native method references for those with the same name as other `lodash`
50366 var nativeNow = getNative(Date, 'now');
50369 * Gets the number of milliseconds that have elapsed since the Unix epoch (1
50370 * January 1970 00:00:00 UTC).
50377 * _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now()); // =>
50378 * logs the number of milliseconds it took for the deferred function to be
50381 var now = nativeNow || function() {
50382 return new Date().getTime();
50385 module.exports = now;
50388 "../internal/getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
50390 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\bind.js": [function(require, module, exports) {
50391 var createWrapper = require('../internal/createWrapper'),
50392 replaceHolders = require('../internal/replaceHolders'),
50393 restParam = require('./restParam');
50395 /** Used to compose bitmasks for wrapper metadata. */
50400 * Creates a function that invokes `func` with the `this` binding of `thisArg`
50401 * and prepends any additional `_.bind` arguments to those provided to the bound
50404 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
50405 * may be used as a placeholder for partially applied arguments.
50407 * **Note:** Unlike native `Function#bind` this method does not set the "length"
50408 * property of bound functions.
50412 * @category Function
50413 * @param {Function}
50414 * func The function to bind.
50416 * thisArg The `this` binding of `func`.
50418 * [partials] The arguments to be partially applied.
50419 * @returns {Function} Returns the new bound function.
50422 * var greet = function(greeting, punctuation) { return greeting + ' ' +
50423 * this.user + punctuation; };
50425 * var object = { 'user': 'fred' };
50427 * var bound = _.bind(greet, object, 'hi'); bound('!'); // => 'hi fred!'
50428 * // using placeholders var bound = _.bind(greet, object, _, '!');
50429 * bound('hi'); // => 'hi fred!'
50431 var bind = restParam(function(func, thisArg, partials) {
50432 var bitmask = BIND_FLAG;
50433 if (partials.length) {
50434 var holders = replaceHolders(partials, bind.placeholder);
50435 bitmask |= PARTIAL_FLAG;
50437 return createWrapper(func, bitmask, thisArg, partials, holders);
50440 // Assign default placeholders.
50441 bind.placeholder = {};
50443 module.exports = bind;
50446 "../internal/createWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createWrapper.js",
50447 "../internal/replaceHolders": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js",
50448 "./restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js"
50450 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js": [function(require, module, exports) {
50451 var isObject = require('../lang/isObject'),
50452 now = require('../date/now');
50454 /** Used as the `TypeError` message for "Functions" methods. */
50455 var FUNC_ERROR_TEXT = 'Expected a function';
50458 * Native method references for those with the same name as other `lodash`
50461 var nativeMax = Math.max;
50464 * Creates a debounced function that delays invoking `func` until after `wait`
50465 * milliseconds have elapsed since the last time the debounced function was
50466 * invoked. The debounced function comes with a `cancel` method to cancel
50467 * delayed invocations. Provide an options object to indicate that `func` should
50468 * be invoked on the leading and/or trailing edge of the `wait` timeout.
50469 * Subsequent calls to the debounced function return the result of the last
50470 * `func` invocation.
50472 * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
50473 * on the trailing edge of the timeout only if the the debounced function is
50474 * invoked more than once during the `wait` timeout.
50476 * See [David Corbacho's
50477 * article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
50478 * for details over the differences between `_.debounce` and `_.throttle`.
50482 * @category Function
50483 * @param {Function}
50484 * func The function to debounce.
50486 * [wait=0] The number of milliseconds to delay.
50488 * [options] The options object.
50490 * [options.leading=false] Specify invoking on the leading edge of
50493 * [options.maxWait] The maximum time `func` is allowed to be delayed
50494 * before it's invoked.
50496 * [options.trailing=true] Specify invoking on the trailing edge of
50498 * @returns {Function} Returns the new debounced function.
50500 * // avoid costly calculations while the window size is in flux
50501 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
50502 * // invoke `sendMail` when the click event is fired, debouncing subsequent
50503 * calls jQuery('#postbox').on('click', _.debounce(sendMail, 300, { 'leading':
50504 * true, 'trailing': false }));
50505 * // ensure `batchLog` is invoked once after 1 second of debounced calls var
50506 * source = new EventSource('/stream'); jQuery(source).on('message',
50507 * _.debounce(batchLog, 250, { 'maxWait': 1000 }));
50508 * // cancel a debounced call var todoChanges = _.debounce(batchLog, 1000);
50509 * Object.observe(models.todo, todoChanges);
50511 * Object.observe(models, function(changes) { if (_.find(changes, { 'user':
50512 * 'todo', 'type': 'delete'})) { todoChanges.cancel(); } }, ['delete']);
50513 * // ...at some point `models.todo` is changed models.todo.completed = true;
50514 * // ...before 1 second has passed `models.todo` is deleted // which cancels
50515 * the debounced `todoChanges` call delete models.todo;
50517 function debounce(func, wait, options) {
50529 if (typeof func != 'function') {
50530 throw new TypeError(FUNC_ERROR_TEXT);
50532 wait = wait < 0 ? 0 : (+wait || 0);
50533 if (options === true) {
50534 var leading = true;
50536 } else if (isObject(options)) {
50537 leading = !!options.leading;
50538 maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
50539 trailing = 'trailing' in options ? !!options.trailing : trailing;
50542 function cancel() {
50544 clearTimeout(timeoutId);
50546 if (maxTimeoutId) {
50547 clearTimeout(maxTimeoutId);
50550 maxTimeoutId = timeoutId = trailingCall = undefined;
50553 function complete(isCalled, id) {
50557 maxTimeoutId = timeoutId = trailingCall = undefined;
50559 lastCalled = now();
50560 result = func.apply(thisArg, args);
50561 if (!timeoutId && !maxTimeoutId) {
50562 args = thisArg = undefined;
50567 function delayed() {
50568 var remaining = wait - (now() - stamp);
50569 if (remaining <= 0 || remaining > wait) {
50570 complete(trailingCall, maxTimeoutId);
50572 timeoutId = setTimeout(delayed, remaining);
50576 function maxDelayed() {
50577 complete(trailing, timeoutId);
50580 function debounced() {
50584 trailingCall = trailing && (timeoutId || !leading);
50586 if (maxWait === false) {
50587 var leadingCall = leading && !timeoutId;
50589 if (!maxTimeoutId && !leading) {
50590 lastCalled = stamp;
50592 var remaining = maxWait - (stamp - lastCalled),
50593 isCalled = remaining <= 0 || remaining > maxWait;
50596 if (maxTimeoutId) {
50597 maxTimeoutId = clearTimeout(maxTimeoutId);
50599 lastCalled = stamp;
50600 result = func.apply(thisArg, args);
50601 } else if (!maxTimeoutId) {
50602 maxTimeoutId = setTimeout(maxDelayed, remaining);
50605 if (isCalled && timeoutId) {
50606 timeoutId = clearTimeout(timeoutId);
50607 } else if (!timeoutId && wait !== maxWait) {
50608 timeoutId = setTimeout(delayed, wait);
50612 result = func.apply(thisArg, args);
50614 if (isCalled && !timeoutId && !maxTimeoutId) {
50615 args = thisArg = undefined;
50619 debounced.cancel = cancel;
50623 module.exports = debounce;
50626 "../date/now": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\date\\now.js",
50627 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
50629 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\defer.js": [function(require, module, exports) {
50630 var baseDelay = require('../internal/baseDelay'),
50631 restParam = require('./restParam');
50634 * Defers invoking the `func` until the current call stack has cleared. Any
50635 * additional arguments are provided to `func` when it's invoked.
50639 * @category Function
50640 * @param {Function}
50641 * func The function to defer.
50643 * [args] The arguments to invoke the function with.
50644 * @returns {number} Returns the timer id.
50647 * _.defer(function(text) { console.log(text); }, 'deferred'); // logs
50648 * 'deferred' after one or more milliseconds
50650 var defer = restParam(function(func, args) {
50651 return baseDelay(func, 1, args);
50654 module.exports = defer;
50657 "../internal/baseDelay": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDelay.js",
50658 "./restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js"
50660 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js": [function(require, module, exports) {
50661 /** Used as the `TypeError` message for "Functions" methods. */
50662 var FUNC_ERROR_TEXT = 'Expected a function';
50665 * Native method references for those with the same name as other `lodash`
50668 var nativeMax = Math.max;
50671 * Creates a function that invokes `func` with the `this` binding of the created
50672 * function and arguments from `start` and beyond provided as an array.
50674 * **Note:** This method is based on the [rest
50675 * parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
50679 * @category Function
50680 * @param {Function}
50681 * func The function to apply a rest parameter to.
50683 * [start=func.length-1] The start position of the rest parameter.
50684 * @returns {Function} Returns the new function.
50687 * var say = _.restParam(function(what, names) { return what + ' ' +
50688 * _.initial(names).join(', ') + (_.size(names) > 1 ? ', & ' : '') +
50689 * _.last(names); });
50691 * say('hello', 'fred', 'barney', 'pebbles'); // => 'hello fred, barney, &
50694 function restParam(func, start) {
50695 if (typeof func != 'function') {
50696 throw new TypeError(FUNC_ERROR_TEXT);
50698 start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
50699 return function() {
50700 var args = arguments,
50702 length = nativeMax(args.length - start, 0),
50703 rest = Array(length);
50705 while (++index < length) {
50706 rest[index] = args[start + index];
50710 return func.call(this, rest);
50712 return func.call(this, args[0], rest);
50714 return func.call(this, args[0], args[1], rest);
50716 var otherArgs = Array(start + 1);
50718 while (++index < start) {
50719 otherArgs[index] = args[index];
50721 otherArgs[start] = rest;
50722 return func.apply(this, otherArgs);
50726 module.exports = restParam;
50729 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\index.js": [function(require, module, exports) {
50730 (function(global) {
50732 * @license lodash 3.10.1 (Custom Build) <https://lodash.com/> Build: `lodash
50733 * modern -d -o ./index.js` Copyright 2012-2015 The Dojo Foundation
50734 * <http://dojofoundation.org/> Based on Underscore.js 1.8.3
50735 * <http://underscorejs.org/LICENSE> Copyright 2009-2015 Jeremy
50736 * Ashkenas, DocumentCloud and Investigative Reporters & Editors
50737 * Available under MIT license <https://lodash.com/license>
50742 /** Used as a safe reference for `undefined` in pre-ES5 environments. */
50745 /** Used as the semantic version number. */
50746 var VERSION = '3.10.1';
50748 /** Used to compose bitmasks for wrapper metadata. */
50751 CURRY_BOUND_FLAG = 4,
50753 CURRY_RIGHT_FLAG = 16,
50755 PARTIAL_RIGHT_FLAG = 64,
50759 /** Used as default options for `_.trunc`. */
50760 var DEFAULT_TRUNC_LENGTH = 30,
50761 DEFAULT_TRUNC_OMISSION = '...';
50763 /** Used to detect when a function becomes hot. */
50764 var HOT_COUNT = 150,
50767 /** Used as the size to enable large array optimizations. */
50768 var LARGE_ARRAY_SIZE = 200;
50770 /** Used to indicate the type of lazy iteratees. */
50771 var LAZY_FILTER_FLAG = 1,
50774 /** Used as the `TypeError` message for "Functions" methods. */
50775 var FUNC_ERROR_TEXT = 'Expected a function';
50777 /** Used as the internal argument placeholder. */
50778 var PLACEHOLDER = '__lodash_placeholder__';
50780 /** `Object#toString` result references. */
50781 var argsTag = '[object Arguments]',
50782 arrayTag = '[object Array]',
50783 boolTag = '[object Boolean]',
50784 dateTag = '[object Date]',
50785 errorTag = '[object Error]',
50786 funcTag = '[object Function]',
50787 mapTag = '[object Map]',
50788 numberTag = '[object Number]',
50789 objectTag = '[object Object]',
50790 regexpTag = '[object RegExp]',
50791 setTag = '[object Set]',
50792 stringTag = '[object String]',
50793 weakMapTag = '[object WeakMap]';
50795 var arrayBufferTag = '[object ArrayBuffer]',
50796 float32Tag = '[object Float32Array]',
50797 float64Tag = '[object Float64Array]',
50798 int8Tag = '[object Int8Array]',
50799 int16Tag = '[object Int16Array]',
50800 int32Tag = '[object Int32Array]',
50801 uint8Tag = '[object Uint8Array]',
50802 uint8ClampedTag = '[object Uint8ClampedArray]',
50803 uint16Tag = '[object Uint16Array]',
50804 uint32Tag = '[object Uint32Array]';
50806 /** Used to match empty string literals in compiled template source. */
50807 var reEmptyStringLeading = /\b__p \+= '';/g,
50808 reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
50809 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
50811 /** Used to match HTML entities and HTML characters. */
50812 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
50813 reUnescapedHtml = /[&<>"'`]/g,
50814 reHasEscapedHtml = RegExp(reEscapedHtml.source),
50815 reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
50817 /** Used to match template delimiters. */
50818 var reEscape = /<%-([\s\S]+?)%>/g,
50819 reEvaluate = /<%([\s\S]+?)%>/g,
50820 reInterpolate = /<%=([\s\S]+?)%>/g;
50822 /** Used to match property names within property paths. */
50823 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
50824 reIsPlainProp = /^\w*$/,
50825 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
50828 * Used to match `RegExp` [syntax
50829 * characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns) and
50830 * those outlined by
50831 * [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
50833 var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
50834 reHasRegExpChars = RegExp(reRegExpChars.source);
50837 * Used to match [combining diacritical
50838 * marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
50840 var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
50842 /** Used to match backslashes in property paths. */
50843 var reEscapeChar = /\\(\\)?/g;
50846 * Used to match [ES template
50847 * delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).
50849 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
50851 /** Used to match `RegExp` flags from their coerced string values. */
50852 var reFlags = /\w*$/;
50854 /** Used to detect hexadecimal string values. */
50855 var reHasHexPrefix = /^0[xX]/;
50857 /** Used to detect host constructors (Safari > 5). */
50858 var reIsHostCtor = /^\[object .+?Constructor\]$/;
50860 /** Used to detect unsigned integer values. */
50861 var reIsUint = /^\d+$/;
50864 * Used to match latin-1 supplementary letters (excluding mathematical
50867 var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
50869 /** Used to ensure capturing order of template delimiters. */
50870 var reNoMatch = /($^)/;
50872 /** Used to match unescaped characters in compiled string literals. */
50873 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
50875 /** Used to match words to create compound words. */
50876 var reWords = (function() {
50877 var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
50878 lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
50880 return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
50883 /** Used to assign default `context` object properties. */
50884 var contextProps = [
50885 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
50886 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
50887 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',
50888 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
50889 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'
50892 /** Used to make template sourceURLs easier to identify. */
50893 var templateCounter = -1;
50895 /** Used to identify `toStringTag` values of typed arrays. */
50896 var typedArrayTags = {};
50897 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
50898 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
50899 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
50900 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
50901 typedArrayTags[uint32Tag] = true;
50902 typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
50903 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
50904 typedArrayTags[dateTag] = typedArrayTags[errorTag] =
50905 typedArrayTags[funcTag] = typedArrayTags[mapTag] =
50906 typedArrayTags[numberTag] = typedArrayTags[objectTag] =
50907 typedArrayTags[regexpTag] = typedArrayTags[setTag] =
50908 typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
50910 /** Used to identify `toStringTag` values supported by `_.clone`. */
50911 var cloneableTags = {};
50912 cloneableTags[argsTag] = cloneableTags[arrayTag] =
50913 cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
50914 cloneableTags[dateTag] = cloneableTags[float32Tag] =
50915 cloneableTags[float64Tag] = cloneableTags[int8Tag] =
50916 cloneableTags[int16Tag] = cloneableTags[int32Tag] =
50917 cloneableTags[numberTag] = cloneableTags[objectTag] =
50918 cloneableTags[regexpTag] = cloneableTags[stringTag] =
50919 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
50920 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
50921 cloneableTags[errorTag] = cloneableTags[funcTag] =
50922 cloneableTags[mapTag] = cloneableTags[setTag] =
50923 cloneableTags[weakMapTag] = false;
50925 /** Used to map latin-1 supplementary letters to basic latin letters. */
50926 var deburredLetters = {
50991 /** Used to map characters to HTML entities. */
50992 var htmlEscapes = {
51001 /** Used to map HTML entities to characters. */
51002 var htmlUnescapes = {
51011 /** Used to determine if values are of the language type `Object`. */
51012 var objectTypes = {
51017 /** Used to escape characters for inclusion in compiled regexes. */
51018 var regexpEscapes = {
51049 /** Used to escape characters for inclusion in compiled string literals. */
51050 var stringEscapes = {
51059 /** Detect free variable `exports`. */
51060 var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
51062 /** Detect free variable `module`. */
51063 var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
51065 /** Detect free variable `global` from Node.js. */
51066 var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
51068 /** Detect free variable `self`. */
51069 var freeSelf = objectTypes[typeof self] && self && self.Object && self;
51071 /** Detect free variable `window`. */
51072 var freeWindow = objectTypes[typeof window] && window && window.Object && window;
51074 /** Detect the popular CommonJS extension `module.exports`. */
51075 var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
51078 * Used as a reference to the global object.
51080 * The `this` value is used if it's the global object to avoid
51081 * Greasemonkey's restricted `window` object, otherwise the `window` object
51084 var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
51086 /*--------------------------------------------------------------------------*/
51089 * The base implementation of `compareAscending` which compares values and
51090 * sorts them in ascending order without guaranteeing a stable sort.
51094 * value The value to compare.
51096 * other The other value to compare.
51097 * @returns {number} Returns the sort order indicator for `value`.
51099 function baseCompareAscending(value, other) {
51100 if (value !== other) {
51101 var valIsNull = value === null,
51102 valIsUndef = value === undefined,
51103 valIsReflexive = value === value;
51105 var othIsNull = other === null,
51106 othIsUndef = other === undefined,
51107 othIsReflexive = other === other;
51109 if ((value > other && !othIsNull) || !valIsReflexive ||
51110 (valIsNull && !othIsUndef && othIsReflexive) ||
51111 (valIsUndef && othIsReflexive)) {
51114 if ((value < other && !valIsNull) || !othIsReflexive ||
51115 (othIsNull && !valIsUndef && valIsReflexive) ||
51116 (othIsUndef && valIsReflexive)) {
51124 * The base implementation of `_.findIndex` and `_.findLastIndex` without
51125 * support for callback shorthands and `this` binding.
51129 * array The array to search.
51130 * @param {Function}
51131 * predicate The function invoked per iteration.
51133 * [fromRight] Specify iterating from right to left.
51134 * @returns {number} Returns the index of the matched value, else `-1`.
51136 function baseFindIndex(array, predicate, fromRight) {
51137 var length = array.length,
51138 index = fromRight ? length : -1;
51140 while ((fromRight ? index-- : ++index < length)) {
51141 if (predicate(array[index], index, array)) {
51149 * The base implementation of `_.indexOf` without support for binary
51154 * array The array to search.
51156 * value The value to search for.
51158 * fromIndex The index to search from.
51159 * @returns {number} Returns the index of the matched value, else `-1`.
51161 function baseIndexOf(array, value, fromIndex) {
51162 if (value !== value) {
51163 return indexOfNaN(array, fromIndex);
51165 var index = fromIndex - 1,
51166 length = array.length;
51168 while (++index < length) {
51169 if (array[index] === value) {
51177 * The base implementation of `_.isFunction` without support for
51178 * environments with incorrect `typeof` results.
51182 * value The value to check.
51183 * @returns {boolean} Returns `true` if `value` is correctly classified,
51186 function baseIsFunction(value) {
51187 // Avoid a Chakra JIT bug in compatibility modes of IE 11.
51188 // See https://github.com/jashkenas/underscore/issues/1621 for more details.
51189 return typeof value == 'function' || false;
51193 * Converts `value` to a string if it's not one. An empty string is returned
51194 * for `null` or `undefined` values.
51198 * value The value to process.
51199 * @returns {string} Returns the string.
51201 function baseToString(value) {
51202 return value == null ? '' : (value + '');
51206 * Used by `_.trim` and `_.trimLeft` to get the index of the first character
51207 * of `string` that is not found in `chars`.
51211 * string The string to inspect.
51213 * chars The characters to find.
51214 * @returns {number} Returns the index of the first character not found in
51217 function charsLeftIndex(string, chars) {
51219 length = string.length;
51221 while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}
51226 * Used by `_.trim` and `_.trimRight` to get the index of the last character
51227 * of `string` that is not found in `chars`.
51231 * string The string to inspect.
51233 * chars The characters to find.
51234 * @returns {number} Returns the index of the last character not found in
51237 function charsRightIndex(string, chars) {
51238 var index = string.length;
51240 while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
51245 * Used by `_.sortBy` to compare transformed elements of a collection and
51246 * stable sort them in ascending order.
51250 * object The object to compare.
51252 * other The other object to compare.
51253 * @returns {number} Returns the sort order indicator for `object`.
51255 function compareAscending(object, other) {
51256 return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
51260 * Used by `_.sortByOrder` to compare multiple properties of a value to
51261 * another and stable sort them.
51263 * If `orders` is unspecified, all valuess are sorted in ascending order.
51264 * Otherwise, a value is sorted in ascending order if its corresponding
51265 * order is "asc", and descending if "desc".
51269 * object The object to compare.
51271 * other The other object to compare.
51272 * @param {boolean[]}
51273 * orders The order to sort by for each property.
51274 * @returns {number} Returns the sort order indicator for `object`.
51276 function compareMultiple(object, other, orders) {
51278 objCriteria = object.criteria,
51279 othCriteria = other.criteria,
51280 length = objCriteria.length,
51281 ordersLength = orders.length;
51283 while (++index < length) {
51284 var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
51286 if (index >= ordersLength) {
51289 var order = orders[index];
51290 return result * ((order === 'asc' || order === true) ? 1 : -1);
51293 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
51294 // that causes it, under certain circumstances, to provide the same value
51296 // `object` and `other`. See
51297 // https://github.com/jashkenas/underscore/pull/1247
51298 // for more details.
51300 // This also ensures a stable sort in V8 and other engines.
51301 // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
51302 return object.index - other.index;
51306 * Used by `_.deburr` to convert latin-1 supplementary letters to basic
51311 * letter The matched letter to deburr.
51312 * @returns {string} Returns the deburred letter.
51314 function deburrLetter(letter) {
51315 return deburredLetters[letter];
51319 * Used by `_.escape` to convert characters to HTML entities.
51323 * chr The matched character to escape.
51324 * @returns {string} Returns the escaped character.
51326 function escapeHtmlChar(chr) {
51327 return htmlEscapes[chr];
51331 * Used by `_.escapeRegExp` to escape characters for inclusion in compiled
51336 * chr The matched character to escape.
51338 * leadingChar The capture group for a leading character.
51340 * whitespaceChar The capture group for a whitespace character.
51341 * @returns {string} Returns the escaped character.
51343 function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
51345 chr = regexpEscapes[chr];
51346 } else if (whitespaceChar) {
51347 chr = stringEscapes[chr];
51353 * Used by `_.template` to escape characters for inclusion in compiled
51358 * chr The matched character to escape.
51359 * @returns {string} Returns the escaped character.
51361 function escapeStringChar(chr) {
51362 return '\\' + stringEscapes[chr];
51366 * Gets the index at which the first occurrence of `NaN` is found in
51371 * array The array to search.
51373 * fromIndex The index to search from.
51375 * [fromRight] Specify iterating from right to left.
51376 * @returns {number} Returns the index of the matched `NaN`, else `-1`.
51378 function indexOfNaN(array, fromIndex, fromRight) {
51379 var length = array.length,
51380 index = fromIndex + (fromRight ? 0 : -1);
51382 while ((fromRight ? index-- : ++index < length)) {
51383 var other = array[index];
51384 if (other !== other) {
51392 * Checks if `value` is object-like.
51396 * value The value to check.
51397 * @returns {boolean} Returns `true` if `value` is object-like, else
51400 function isObjectLike(value) {
51401 return !!value && typeof value == 'object';
51405 * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
51406 * character code is whitespace.
51410 * charCode The character code to inspect.
51411 * @returns {boolean} Returns `true` if `charCode` is whitespace, else
51414 function isSpace(charCode) {
51415 return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
51416 (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
51420 * Replaces all `placeholder` elements in `array` with an internal
51421 * placeholder and returns an array of their indexes.
51425 * array The array to modify.
51427 * placeholder The placeholder to replace.
51428 * @returns {Array} Returns the new array of placeholder indexes.
51430 function replaceHolders(array, placeholder) {
51432 length = array.length,
51436 while (++index < length) {
51437 if (array[index] === placeholder) {
51438 array[index] = PLACEHOLDER;
51439 result[++resIndex] = index;
51446 * An implementation of `_.uniq` optimized for sorted arrays without support
51447 * for callback shorthands and `this` binding.
51451 * array The array to inspect.
51452 * @param {Function}
51453 * [iteratee] The function invoked per iteration.
51454 * @returns {Array} Returns the new duplicate-value-free array.
51456 function sortedUniq(array, iteratee) {
51459 length = array.length,
51463 while (++index < length) {
51464 var value = array[index],
51465 computed = iteratee ? iteratee(value, index, array) : value;
51467 if (!index || seen !== computed) {
51469 result[++resIndex] = value;
51476 * Used by `_.trim` and `_.trimLeft` to get the index of the first
51477 * non-whitespace character of `string`.
51481 * string The string to inspect.
51482 * @returns {number} Returns the index of the first non-whitespace
51485 function trimmedLeftIndex(string) {
51487 length = string.length;
51489 while (++index < length && isSpace(string.charCodeAt(index))) {}
51494 * Used by `_.trim` and `_.trimRight` to get the index of the last
51495 * non-whitespace character of `string`.
51499 * string The string to inspect.
51500 * @returns {number} Returns the index of the last non-whitespace character.
51502 function trimmedRightIndex(string) {
51503 var index = string.length;
51505 while (index-- && isSpace(string.charCodeAt(index))) {}
51510 * Used by `_.unescape` to convert HTML entities to characters.
51514 * chr The matched character to unescape.
51515 * @returns {string} Returns the unescaped character.
51517 function unescapeHtmlChar(chr) {
51518 return htmlUnescapes[chr];
51521 /*--------------------------------------------------------------------------*/
51524 * Create a new pristine `lodash` function using the given `context` object.
51528 * @category Utility
51530 * [context=root] The context object.
51531 * @returns {Function} Returns a new `lodash` function.
51534 * _.mixin({ 'foo': _.constant('foo') });
51536 * var lodash = _.runInContext(); lodash.mixin({ 'bar':
51537 * lodash.constant('bar') });
51539 * _.isFunction(_.foo); // => true _.isFunction(_.bar); // => false
51541 * lodash.isFunction(lodash.foo); // => false lodash.isFunction(lodash.bar); // =>
51543 * // using `context` to mock `Date#getTime` use in `_.now` var mock =
51544 * _.runInContext({ 'Date': function() { return { 'getTime': getTimeMock }; }
51546 * // or creating a suped-up `defer` in Node.js var defer =
51547 * _.runInContext({ 'setTimeout': setImmediate }).defer;
51549 function runInContext(context) {
51550 // Avoid issues with some ES3 environments that attempt to use values, named
51551 // after built-in constructors like `Object`, for the creation of literals.
51552 // ES5 clears this up by stating that literals must use built-in
51554 // See https://es5.github.io/#x11.1.5 for more details.
51555 context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
51557 /** Native constructor references. */
51558 var Array = context.Array,
51559 Date = context.Date,
51560 Error = context.Error,
51561 Function = context.Function,
51562 Math = context.Math,
51563 Number = context.Number,
51564 Object = context.Object,
51565 RegExp = context.RegExp,
51566 String = context.String,
51567 TypeError = context.TypeError;
51569 /** Used for native method references. */
51570 var arrayProto = Array.prototype,
51571 objectProto = Object.prototype,
51572 stringProto = String.prototype;
51574 /** Used to resolve the decompiled source of functions. */
51575 var fnToString = Function.prototype.toString;
51577 /** Used to check objects for own properties. */
51578 var hasOwnProperty = objectProto.hasOwnProperty;
51580 /** Used to generate unique IDs. */
51584 * Used to resolve the
51585 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
51588 var objToString = objectProto.toString;
51590 /** Used to restore the original `_` reference in `_.noConflict`. */
51591 var oldDash = root._;
51593 /** Used to detect if a method is native. */
51594 var reIsNative = RegExp('^' +
51595 fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
51596 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
51599 /** Native method references. */
51600 var ArrayBuffer = context.ArrayBuffer,
51601 clearTimeout = context.clearTimeout,
51602 parseFloat = context.parseFloat,
51604 propertyIsEnumerable = objectProto.propertyIsEnumerable,
51605 Set = getNative(context, 'Set'),
51606 setTimeout = context.setTimeout,
51607 splice = arrayProto.splice,
51608 Uint8Array = context.Uint8Array,
51609 WeakMap = getNative(context, 'WeakMap');
51612 * Native method references for those with the same name as other `lodash`
51615 var nativeCeil = Math.ceil,
51616 nativeCreate = getNative(Object, 'create'),
51617 nativeFloor = Math.floor,
51618 nativeIsArray = getNative(Array, 'isArray'),
51619 nativeIsFinite = context.isFinite,
51620 nativeKeys = getNative(Object, 'keys'),
51621 nativeMax = Math.max,
51622 nativeMin = Math.min,
51623 nativeNow = getNative(Date, 'now'),
51624 nativeParseInt = context.parseInt,
51625 nativeRandom = Math.random;
51627 /** Used as references for `-Infinity` and `Infinity`. */
51628 var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
51629 POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
51631 /** Used as references for the maximum length and index of an array. */
51632 var MAX_ARRAY_LENGTH = 4294967295,
51633 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
51634 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
51637 * Used as the [maximum
51638 * length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
51639 * of an array-like value.
51641 var MAX_SAFE_INTEGER = 9007199254740991;
51643 /** Used to store function metadata. */
51644 var metaMap = WeakMap && new WeakMap;
51646 /** Used to lookup unminified function names. */
51647 var realNames = {};
51649 /*------------------------------------------------------------------------*/
51652 * Creates a `lodash` object which wraps `value` to enable implicit
51653 * chaining. Methods that operate on and return arrays, collections, and
51654 * functions can be chained together. Methods that retrieve a single value
51655 * or may return a primitive value will automatically end the chain
51656 * returning the unwrapped value. Explicit chaining may be enabled using
51657 * `_.chain`. The execution of chained methods is lazy, that is, execution
51658 * is deferred until `_#value` is implicitly or explicitly called.
51660 * Lazy evaluation allows several methods to support shortcut fusion.
51661 * Shortcut fusion is an optimization strategy which merge iteratee calls;
51662 * this can help to avoid the creation of intermediate data structures and
51663 * greatly reduce the number of iteratee executions.
51665 * Chaining is supported in custom builds as long as the `_#value` method is
51666 * directly or indirectly included in the build.
51668 * In addition to lodash methods, wrappers have `Array` and `String`
51671 * The wrapper `Array` methods are: `concat`, `join`, `pop`, `push`,
51672 * `reverse`, `shift`, `slice`, `sort`, `splice`, and `unshift`
51674 * The wrapper `String` methods are: `replace` and `split`
51676 * The wrapper methods that support shortcut fusion are: `compact`, `drop`,
51677 * `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `first`, `initial`,
51678 * `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, `slice`, `take`,
51679 * `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, and `where`
51681 * The chainable wrapper methods are: `after`, `ary`, `assign`, `at`,
51682 * `before`, `bind`, `bindAll`, `bindKey`, `callback`, `chain`, `chunk`,
51683 * `commit`, `compact`, `concat`, `constant`, `countBy`, `create`, `curry`,
51684 * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`,
51685 * `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, `filter`,
51686 * `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, `forEachRight`,
51687 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`,
51688 * `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
51689 * `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
51690 * `memoize`, `merge`, `method`, `methodOf`, `mixin`, `modArgs`, `negate`,
51691 * `omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`,
51692 * `plant`, `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`,
51693 * `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`, `reverse`,
51694 * `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`,
51695 * `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`,
51696 * `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
51697 * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
51698 * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`,
51701 * The wrapper methods that are **not** chainable by default are: `add`,
51702 * `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
51703 * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`,
51704 * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`,
51705 * `findWhere`, `first`, `floor`, `get`, `gt`, `gte`, `has`, `identity`,
51706 * `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, `isBoolean`,
51707 * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`
51708 * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`,
51709 * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`,
51710 * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lt`, `lte`,
51711 * `max`, `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`,
51712 * `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
51713 * `round`, `runInContext`, `shift`, `size`, `snakeCase`, `some`,
51714 * `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`, `sum`,
51715 * `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`,
51716 * `uniqueId`, `value`, and `words`
51718 * The wrapper method `sample` will return a wrapped value when `n` is
51719 * provided, otherwise an unwrapped value is returned.
51725 * value The value to wrap in a `lodash` instance.
51726 * @returns {Object} Returns the new `lodash` wrapper instance.
51729 * var wrapped = _([1, 2, 3]);
51730 * // returns an unwrapped value wrapped.reduce(function(total, n) { return
51731 * total + n; }); // => 6
51732 * // returns a wrapped value var squares = wrapped.map(function(n) {
51733 * return n * n; });
51735 * _.isArray(squares); // => false
51737 * _.isArray(squares.value()); // => true
51739 function lodash(value) {
51740 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
51741 if (value instanceof LodashWrapper) {
51744 if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
51745 return wrapperClone(value);
51748 return new LodashWrapper(value);
51752 * The function whose prototype all chaining wrappers inherit from.
51756 function baseLodash() {
51757 // No operation performed.
51761 * The base constructor for creating `lodash` wrapper objects.
51765 * value The value to wrap.
51767 * [chainAll] Enable chaining for all wrapper methods.
51769 * [actions=[]] Actions to peform to resolve the unwrapped value.
51771 function LodashWrapper(value, chainAll, actions) {
51772 this.__wrapped__ = value;
51773 this.__actions__ = actions || [];
51774 this.__chain__ = !!chainAll;
51778 * An object environment feature flags.
51784 var support = lodash.support = {};
51787 * By default, the template delimiters used by lodash are like those in
51788 * embedded Ruby (ERB). Change the following template settings to use
51789 * alternative delimiters.
51795 lodash.templateSettings = {
51798 * Used to detect `data` property values to be HTML-escaped.
51800 * @memberOf _.templateSettings
51803 'escape': reEscape,
51806 * Used to detect code to be evaluated.
51808 * @memberOf _.templateSettings
51811 'evaluate': reEvaluate,
51814 * Used to detect `data` property values to inject.
51816 * @memberOf _.templateSettings
51819 'interpolate': reInterpolate,
51822 * Used to reference the data object in the template text.
51824 * @memberOf _.templateSettings
51830 * Used to import variables into the compiled template.
51832 * @memberOf _.templateSettings
51838 * A reference to the `lodash` function.
51840 * @memberOf _.templateSettings.imports
51847 /*------------------------------------------------------------------------*/
51850 * Creates a lazy wrapper object which wraps `value` to enable lazy
51855 * value The value to wrap.
51857 function LazyWrapper(value) {
51858 this.__wrapped__ = value;
51859 this.__actions__ = [];
51861 this.__filtered__ = false;
51862 this.__iteratees__ = [];
51863 this.__takeCount__ = POSITIVE_INFINITY;
51864 this.__views__ = [];
51868 * Creates a clone of the lazy wrapper object.
51872 * @memberOf LazyWrapper
51873 * @returns {Object} Returns the cloned `LazyWrapper` object.
51875 function lazyClone() {
51876 var result = new LazyWrapper(this.__wrapped__);
51877 result.__actions__ = arrayCopy(this.__actions__);
51878 result.__dir__ = this.__dir__;
51879 result.__filtered__ = this.__filtered__;
51880 result.__iteratees__ = arrayCopy(this.__iteratees__);
51881 result.__takeCount__ = this.__takeCount__;
51882 result.__views__ = arrayCopy(this.__views__);
51887 * Reverses the direction of lazy iteration.
51891 * @memberOf LazyWrapper
51892 * @returns {Object} Returns the new reversed `LazyWrapper` object.
51894 function lazyReverse() {
51895 if (this.__filtered__) {
51896 var result = new LazyWrapper(this);
51897 result.__dir__ = -1;
51898 result.__filtered__ = true;
51900 result = this.clone();
51901 result.__dir__ *= -1;
51907 * Extracts the unwrapped value from its lazy wrapper.
51911 * @memberOf LazyWrapper
51912 * @returns {*} Returns the unwrapped value.
51914 function lazyValue() {
51915 var array = this.__wrapped__.value(),
51916 dir = this.__dir__,
51917 isArr = isArray(array),
51919 arrLength = isArr ? array.length : 0,
51920 view = getView(0, arrLength, this.__views__),
51921 start = view.start,
51923 length = end - start,
51924 index = isRight ? end : (start - 1),
51925 iteratees = this.__iteratees__,
51926 iterLength = iteratees.length,
51928 takeCount = nativeMin(length, this.__takeCount__);
51930 if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
51931 return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
51936 while (length-- && resIndex < takeCount) {
51939 var iterIndex = -1,
51940 value = array[index];
51942 while (++iterIndex < iterLength) {
51943 var data = iteratees[iterIndex],
51944 iteratee = data.iteratee,
51946 computed = iteratee(value);
51948 if (type == LAZY_MAP_FLAG) {
51950 } else if (!computed) {
51951 if (type == LAZY_FILTER_FLAG) {
51958 result[resIndex++] = value;
51963 /*------------------------------------------------------------------------*/
51966 * Creates a cache object to store key/value pairs.
51971 * @memberOf _.memoize
51973 function MapCache() {
51974 this.__data__ = {};
51978 * Removes `key` and its value from the cache.
51982 * @memberOf _.memoize.Cache
51984 * key The key of the value to remove.
51985 * @returns {boolean} Returns `true` if the entry was removed successfully,
51988 function mapDelete(key) {
51989 return this.has(key) && delete this.__data__[key];
51993 * Gets the cached value for `key`.
51997 * @memberOf _.memoize.Cache
51999 * key The key of the value to get.
52000 * @returns {*} Returns the cached value.
52002 function mapGet(key) {
52003 return key == '__proto__' ? undefined : this.__data__[key];
52007 * Checks if a cached value for `key` exists.
52011 * @memberOf _.memoize.Cache
52013 * key The key of the entry to check.
52014 * @returns {boolean} Returns `true` if an entry for `key` exists, else
52017 function mapHas(key) {
52018 return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
52022 * Sets `value` to `key` of the cache.
52026 * @memberOf _.memoize.Cache
52028 * key The key of the value to cache.
52030 * value The value to cache.
52031 * @returns {Object} Returns the cache object.
52033 function mapSet(key, value) {
52034 if (key != '__proto__') {
52035 this.__data__[key] = value;
52040 /*------------------------------------------------------------------------*/
52044 * Creates a cache object to store unique values.
52048 * [values] The values to cache.
52050 function SetCache(values) {
52051 var length = values ? values.length : 0;
52054 'hash': nativeCreate(null),
52058 this.push(values[length]);
52063 * Checks if `value` is in `cache` mimicking the return signature of
52064 * `_.indexOf` by returning `0` if the value is found, else `-1`.
52068 * cache The cache to search.
52070 * value The value to search for.
52071 * @returns {number} Returns `0` if `value` is found, else `-1`.
52073 function cacheIndexOf(cache, value) {
52074 var data = cache.data,
52075 result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
52077 return result ? 0 : -1;
52081 * Adds `value` to the cache.
52085 * @memberOf SetCache
52087 * value The value to cache.
52089 function cachePush(value) {
52090 var data = this.data;
52091 if (typeof value == 'string' || isObject(value)) {
52092 data.set.add(value);
52094 data.hash[value] = true;
52098 /*------------------------------------------------------------------------*/
52101 * Creates a new array joining `array` with `other`.
52105 * array The array to join.
52107 * other The other array to join.
52108 * @returns {Array} Returns the new concatenated array.
52110 function arrayConcat(array, other) {
52112 length = array.length,
52114 othLength = other.length,
52115 result = Array(length + othLength);
52117 while (++index < length) {
52118 result[index] = array[index];
52120 while (++othIndex < othLength) {
52121 result[index++] = other[othIndex];
52127 * Copies the values of `source` to `array`.
52131 * source The array to copy values from.
52133 * [array=[]] The array to copy values to.
52134 * @returns {Array} Returns `array`.
52136 function arrayCopy(source, array) {
52138 length = source.length;
52140 array || (array = Array(length));
52141 while (++index < length) {
52142 array[index] = source[index];
52148 * A specialized version of `_.forEach` for arrays without support for
52149 * callback shorthands and `this` binding.
52153 * array The array to iterate over.
52154 * @param {Function}
52155 * iteratee The function invoked per iteration.
52156 * @returns {Array} Returns `array`.
52158 function arrayEach(array, iteratee) {
52160 length = array.length;
52162 while (++index < length) {
52163 if (iteratee(array[index], index, array) === false) {
52171 * A specialized version of `_.forEachRight` for arrays without support for
52172 * callback shorthands and `this` binding.
52176 * array The array to iterate over.
52177 * @param {Function}
52178 * iteratee The function invoked per iteration.
52179 * @returns {Array} Returns `array`.
52181 function arrayEachRight(array, iteratee) {
52182 var length = array.length;
52185 if (iteratee(array[length], length, array) === false) {
52193 * A specialized version of `_.every` for arrays without support for
52194 * callback shorthands and `this` binding.
52198 * array The array to iterate over.
52199 * @param {Function}
52200 * predicate The function invoked per iteration.
52201 * @returns {boolean} Returns `true` if all elements pass the predicate
52202 * check, else `false`.
52204 function arrayEvery(array, predicate) {
52206 length = array.length;
52208 while (++index < length) {
52209 if (!predicate(array[index], index, array)) {
52217 * A specialized version of `baseExtremum` for arrays which invokes
52218 * `iteratee` with one argument: (value).
52222 * array The array to iterate over.
52223 * @param {Function}
52224 * iteratee The function invoked per iteration.
52225 * @param {Function}
52226 * comparator The function used to compare values.
52228 * exValue The initial extremum value.
52229 * @returns {*} Returns the extremum value.
52231 function arrayExtremum(array, iteratee, comparator, exValue) {
52233 length = array.length,
52234 computed = exValue,
52237 while (++index < length) {
52238 var value = array[index],
52239 current = +iteratee(value);
52241 if (comparator(current, computed)) {
52242 computed = current;
52250 * A specialized version of `_.filter` for arrays without support for
52251 * callback shorthands and `this` binding.
52255 * array The array to iterate over.
52256 * @param {Function}
52257 * predicate The function invoked per iteration.
52258 * @returns {Array} Returns the new filtered array.
52260 function arrayFilter(array, predicate) {
52262 length = array.length,
52266 while (++index < length) {
52267 var value = array[index];
52268 if (predicate(value, index, array)) {
52269 result[++resIndex] = value;
52276 * A specialized version of `_.map` for arrays without support for callback
52277 * shorthands and `this` binding.
52281 * array The array to iterate over.
52282 * @param {Function}
52283 * iteratee The function invoked per iteration.
52284 * @returns {Array} Returns the new mapped array.
52286 function arrayMap(array, iteratee) {
52288 length = array.length,
52289 result = Array(length);
52291 while (++index < length) {
52292 result[index] = iteratee(array[index], index, array);
52298 * Appends the elements of `values` to `array`.
52302 * array The array to modify.
52304 * values The values to append.
52305 * @returns {Array} Returns `array`.
52307 function arrayPush(array, values) {
52309 length = values.length,
52310 offset = array.length;
52312 while (++index < length) {
52313 array[offset + index] = values[index];
52319 * A specialized version of `_.reduce` for arrays without support for
52320 * callback shorthands and `this` binding.
52324 * array The array to iterate over.
52325 * @param {Function}
52326 * iteratee The function invoked per iteration.
52328 * [accumulator] The initial value.
52330 * [initFromArray] Specify using the first element of `array` as
52331 * the initial value.
52332 * @returns {*} Returns the accumulated value.
52334 function arrayReduce(array, iteratee, accumulator, initFromArray) {
52336 length = array.length;
52338 if (initFromArray && length) {
52339 accumulator = array[++index];
52341 while (++index < length) {
52342 accumulator = iteratee(accumulator, array[index], index, array);
52344 return accumulator;
52348 * A specialized version of `_.reduceRight` for arrays without support for
52349 * callback shorthands and `this` binding.
52353 * array The array to iterate over.
52354 * @param {Function}
52355 * iteratee The function invoked per iteration.
52357 * [accumulator] The initial value.
52359 * [initFromArray] Specify using the last element of `array` as
52360 * the initial value.
52361 * @returns {*} Returns the accumulated value.
52363 function arrayReduceRight(array, iteratee, accumulator, initFromArray) {
52364 var length = array.length;
52365 if (initFromArray && length) {
52366 accumulator = array[--length];
52369 accumulator = iteratee(accumulator, array[length], length, array);
52371 return accumulator;
52375 * A specialized version of `_.some` for arrays without support for callback
52376 * shorthands and `this` binding.
52380 * array The array to iterate over.
52381 * @param {Function}
52382 * predicate The function invoked per iteration.
52383 * @returns {boolean} Returns `true` if any element passes the predicate
52384 * check, else `false`.
52386 function arraySome(array, predicate) {
52388 length = array.length;
52390 while (++index < length) {
52391 if (predicate(array[index], index, array)) {
52399 * A specialized version of `_.sum` for arrays without support for callback
52400 * shorthands and `this` binding..
52404 * array The array to iterate over.
52405 * @param {Function}
52406 * iteratee The function invoked per iteration.
52407 * @returns {number} Returns the sum.
52409 function arraySum(array, iteratee) {
52410 var length = array.length,
52414 result += +iteratee(array[length]) || 0;
52420 * Used by `_.defaults` to customize its `_.assign` use.
52424 * objectValue The destination object property value.
52426 * sourceValue The source object property value.
52427 * @returns {*} Returns the value to assign to the destination object.
52429 function assignDefaults(objectValue, sourceValue) {
52430 return objectValue === undefined ? sourceValue : objectValue;
52434 * Used by `_.template` to customize its `_.assign` use.
52436 * **Note:** This function is like `assignDefaults` except that it ignores
52437 * inherited property values when checking if a property is `undefined`.
52441 * objectValue The destination object property value.
52443 * sourceValue The source object property value.
52445 * key The key associated with the object and source values.
52447 * object The destination object.
52448 * @returns {*} Returns the value to assign to the destination object.
52450 function assignOwnDefaults(objectValue, sourceValue, key, object) {
52451 return (objectValue === undefined || !hasOwnProperty.call(object, key)) ? sourceValue : objectValue;
52455 * A specialized version of `_.assign` for customizing assigned values
52456 * without support for argument juggling, multiple sources, and `this`
52457 * binding `customizer` functions.
52461 * object The destination object.
52463 * source The source object.
52464 * @param {Function}
52465 * customizer The function to customize assigned values.
52466 * @returns {Object} Returns `object`.
52468 function assignWith(object, source, customizer) {
52470 props = keys(source),
52471 length = props.length;
52473 while (++index < length) {
52474 var key = props[index],
52475 value = object[key],
52476 result = customizer(value, source[key], key, object, source);
52478 if ((result === result ? (result !== value) : (value === value)) ||
52479 (value === undefined && !(key in object))) {
52480 object[key] = result;
52487 * The base implementation of `_.assign` without support for argument
52488 * juggling, multiple sources, and `customizer` functions.
52492 * object The destination object.
52494 * source The source object.
52495 * @returns {Object} Returns `object`.
52497 function baseAssign(object, source) {
52498 return source == null ? object : baseCopy(source, keys(source), object);
52502 * The base implementation of `_.at` without support for string collections
52503 * and individual key arguments.
52506 * @param {Array|Object}
52507 * collection The collection to iterate over.
52508 * @param {number[]|string[]}
52509 * props The property names or indexes of elements to pick.
52510 * @returns {Array} Returns the new array of picked elements.
52512 function baseAt(collection, props) {
52514 isNil = collection == null,
52515 isArr = !isNil && isArrayLike(collection),
52516 length = isArr ? collection.length : 0,
52517 propsLength = props.length,
52518 result = Array(propsLength);
52520 while (++index < propsLength) {
52521 var key = props[index];
52523 result[index] = isIndex(key, length) ? collection[key] : undefined;
52525 result[index] = isNil ? undefined : collection[key];
52532 * Copies properties of `source` to `object`.
52536 * source The object to copy properties from.
52538 * props The property names to copy.
52540 * [object={}] The object to copy properties to.
52541 * @returns {Object} Returns `object`.
52543 function baseCopy(source, props, object) {
52544 object || (object = {});
52547 length = props.length;
52549 while (++index < length) {
52550 var key = props[index];
52551 object[key] = source[key];
52557 * The base implementation of `_.callback` which supports specifying the
52558 * number of arguments to provide to `func`.
52562 * [func=_.identity] The value to convert to a callback.
52564 * [thisArg] The `this` binding of `func`.
52566 * [argCount] The number of arguments to provide to `func`.
52567 * @returns {Function} Returns the callback.
52569 function baseCallback(func, thisArg, argCount) {
52570 var type = typeof func;
52571 if (type == 'function') {
52572 return thisArg === undefined ? func : bindCallback(func, thisArg, argCount);
52574 if (func == null) {
52577 if (type == 'object') {
52578 return baseMatches(func);
52580 return thisArg === undefined ? property(func) : baseMatchesProperty(func, thisArg);
52584 * The base implementation of `_.clone` without support for argument
52585 * juggling and `this` binding `customizer` functions.
52589 * value The value to clone.
52591 * [isDeep] Specify a deep clone.
52592 * @param {Function}
52593 * [customizer] The function to customize cloning values.
52595 * [key] The key of `value`.
52597 * [object] The object `value` belongs to.
52599 * [stackA=[]] Tracks traversed source objects.
52601 * [stackB=[]] Associates clones with source counterparts.
52602 * @returns {*} Returns the cloned value.
52604 function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
52607 result = object ? customizer(value, key, object) : customizer(value);
52609 if (result !== undefined) {
52612 if (!isObject(value)) {
52615 var isArr = isArray(value);
52617 result = initCloneArray(value);
52619 return arrayCopy(value, result);
52622 var tag = objToString.call(value),
52623 isFunc = tag == funcTag;
52625 if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
52626 result = initCloneObject(isFunc ? {} : value);
52628 return baseAssign(result, value);
52631 return cloneableTags[tag] ? initCloneByTag(value, tag, isDeep) : (object ? value : {});
52634 // Check for circular references and return its corresponding clone.
52635 stackA || (stackA = []);
52636 stackB || (stackB = []);
52638 var length = stackA.length;
52640 if (stackA[length] == value) {
52641 return stackB[length];
52644 // Add the source value to the stack of traversed objects and associate
52645 // it with its clone.
52646 stackA.push(value);
52647 stackB.push(result);
52649 // Recursively populate clone (susceptible to call stack limits).
52650 (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
52651 result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
52657 * The base implementation of `_.create` without support for assigning
52658 * properties to the created object.
52662 * prototype The object to inherit from.
52663 * @returns {Object} Returns the new object.
52665 var baseCreate = (function() {
52666 function object() {}
52667 return function(prototype) {
52668 if (isObject(prototype)) {
52669 object.prototype = prototype;
52670 var result = new object;
52671 object.prototype = undefined;
52673 return result || {};
52678 * The base implementation of `_.delay` and `_.defer` which accepts an index
52679 * of where to slice the arguments to provide to `func`.
52682 * @param {Function}
52683 * func The function to delay.
52685 * wait The number of milliseconds to delay invocation.
52687 * args The arguments provide to `func`.
52688 * @returns {number} Returns the timer id.
52690 function baseDelay(func, wait, args) {
52691 if (typeof func != 'function') {
52692 throw new TypeError(FUNC_ERROR_TEXT);
52694 return setTimeout(function() {
52695 func.apply(undefined, args);
52700 * The base implementation of `_.difference` which accepts a single array of
52701 * values to exclude.
52705 * array The array to inspect.
52707 * values The values to exclude.
52708 * @returns {Array} Returns the new array of filtered values.
52710 function baseDifference(array, values) {
52711 var length = array ? array.length : 0,
52718 indexOf = getIndexOf(),
52719 isCommon = indexOf == baseIndexOf,
52720 cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
52721 valuesLength = values.length;
52724 indexOf = cacheIndexOf;
52729 while (++index < length) {
52730 var value = array[index];
52732 if (isCommon && value === value) {
52733 var valuesIndex = valuesLength;
52734 while (valuesIndex--) {
52735 if (values[valuesIndex] === value) {
52739 result.push(value);
52740 } else if (indexOf(values, value, 0) < 0) {
52741 result.push(value);
52748 * The base implementation of `_.forEach` without support for callback
52749 * shorthands and `this` binding.
52752 * @param {Array|Object|string}
52753 * collection The collection to iterate over.
52754 * @param {Function}
52755 * iteratee The function invoked per iteration.
52756 * @returns {Array|Object|string} Returns `collection`.
52758 var baseEach = createBaseEach(baseForOwn);
52761 * The base implementation of `_.forEachRight` without support for callback
52762 * shorthands and `this` binding.
52765 * @param {Array|Object|string}
52766 * collection The collection to iterate over.
52767 * @param {Function}
52768 * iteratee The function invoked per iteration.
52769 * @returns {Array|Object|string} Returns `collection`.
52771 var baseEachRight = createBaseEach(baseForOwnRight, true);
52774 * The base implementation of `_.every` without support for callback
52775 * shorthands and `this` binding.
52778 * @param {Array|Object|string}
52779 * collection The collection to iterate over.
52780 * @param {Function}
52781 * predicate The function invoked per iteration.
52782 * @returns {boolean} Returns `true` if all elements pass the predicate
52783 * check, else `false`
52785 function baseEvery(collection, predicate) {
52787 baseEach(collection, function(value, index, collection) {
52788 result = !!predicate(value, index, collection);
52795 * Gets the extremum value of `collection` invoking `iteratee` for each
52796 * value in `collection` to generate the criterion by which the value is
52797 * ranked. The `iteratee` is invoked with three arguments: (value,
52798 * index|key, collection).
52801 * @param {Array|Object|string}
52802 * collection The collection to iterate over.
52803 * @param {Function}
52804 * iteratee The function invoked per iteration.
52805 * @param {Function}
52806 * comparator The function used to compare values.
52808 * exValue The initial extremum value.
52809 * @returns {*} Returns the extremum value.
52811 function baseExtremum(collection, iteratee, comparator, exValue) {
52812 var computed = exValue,
52815 baseEach(collection, function(value, index, collection) {
52816 var current = +iteratee(value, index, collection);
52817 if (comparator(current, computed) || (current === exValue && current === result)) {
52818 computed = current;
52826 * The base implementation of `_.fill` without an iteratee call guard.
52830 * array The array to fill.
52832 * value The value to fill `array` with.
52834 * [start=0] The start position.
52836 * [end=array.length] The end position.
52837 * @returns {Array} Returns `array`.
52839 function baseFill(array, value, start, end) {
52840 var length = array.length;
52842 start = start == null ? 0 : (+start || 0);
52844 start = -start > length ? 0 : (length + start);
52846 end = (end === undefined || end > length) ? length : (+end || 0);
52850 length = start > end ? 0 : (end >>> 0);
52853 while (start < length) {
52854 array[start++] = value;
52860 * The base implementation of `_.filter` without support for callback
52861 * shorthands and `this` binding.
52864 * @param {Array|Object|string}
52865 * collection The collection to iterate over.
52866 * @param {Function}
52867 * predicate The function invoked per iteration.
52868 * @returns {Array} Returns the new filtered array.
52870 function baseFilter(collection, predicate) {
52872 baseEach(collection, function(value, index, collection) {
52873 if (predicate(value, index, collection)) {
52874 result.push(value);
52881 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and
52882 * `_.findLastKey`, without support for callback shorthands and `this`
52883 * binding, which iterates over `collection` using the provided `eachFunc`.
52886 * @param {Array|Object|string}
52887 * collection The collection to search.
52888 * @param {Function}
52889 * predicate The function invoked per iteration.
52890 * @param {Function}
52891 * eachFunc The function to iterate over `collection`.
52893 * [retKey] Specify returning the key of the found element
52894 * instead of the element itself.
52895 * @returns {*} Returns the found element or its key, else `undefined`.
52897 function baseFind(collection, predicate, eachFunc, retKey) {
52899 eachFunc(collection, function(value, key, collection) {
52900 if (predicate(value, key, collection)) {
52901 result = retKey ? key : value;
52909 * The base implementation of `_.flatten` with added support for restricting
52910 * flattening and specifying the start index.
52914 * array The array to flatten.
52916 * [isDeep] Specify a deep flatten.
52918 * [isStrict] Restrict flattening to arrays-like objects.
52920 * [result=[]] The initial result value.
52921 * @returns {Array} Returns the new flattened array.
52923 function baseFlatten(array, isDeep, isStrict, result) {
52924 result || (result = []);
52927 length = array.length;
52929 while (++index < length) {
52930 var value = array[index];
52931 if (isObjectLike(value) && isArrayLike(value) &&
52932 (isStrict || isArray(value) || isArguments(value))) {
52934 // Recursively flatten arrays (susceptible to call stack limits).
52935 baseFlatten(value, isDeep, isStrict, result);
52937 arrayPush(result, value);
52939 } else if (!isStrict) {
52940 result[result.length] = value;
52947 * The base implementation of `baseForIn` and `baseForOwn` which iterates
52948 * over `object` properties returned by `keysFunc` invoking `iteratee` for
52949 * each property. Iteratee functions may exit iteration early by explicitly
52950 * returning `false`.
52954 * object The object to iterate over.
52955 * @param {Function}
52956 * iteratee The function invoked per iteration.
52957 * @param {Function}
52958 * keysFunc The function to get the keys of `object`.
52959 * @returns {Object} Returns `object`.
52961 var baseFor = createBaseFor();
52964 * This function is like `baseFor` except that it iterates over properties
52965 * in the opposite order.
52969 * object The object to iterate over.
52970 * @param {Function}
52971 * iteratee The function invoked per iteration.
52972 * @param {Function}
52973 * keysFunc The function to get the keys of `object`.
52974 * @returns {Object} Returns `object`.
52976 var baseForRight = createBaseFor(true);
52979 * The base implementation of `_.forIn` without support for callback
52980 * shorthands and `this` binding.
52984 * object The object to iterate over.
52985 * @param {Function}
52986 * iteratee The function invoked per iteration.
52987 * @returns {Object} Returns `object`.
52989 function baseForIn(object, iteratee) {
52990 return baseFor(object, iteratee, keysIn);
52994 * The base implementation of `_.forOwn` without support for callback
52995 * shorthands and `this` binding.
52999 * object The object to iterate over.
53000 * @param {Function}
53001 * iteratee The function invoked per iteration.
53002 * @returns {Object} Returns `object`.
53004 function baseForOwn(object, iteratee) {
53005 return baseFor(object, iteratee, keys);
53009 * The base implementation of `_.forOwnRight` without support for callback
53010 * shorthands and `this` binding.
53014 * object The object to iterate over.
53015 * @param {Function}
53016 * iteratee The function invoked per iteration.
53017 * @returns {Object} Returns `object`.
53019 function baseForOwnRight(object, iteratee) {
53020 return baseForRight(object, iteratee, keys);
53024 * The base implementation of `_.functions` which creates an array of
53025 * `object` function property names filtered from those provided.
53029 * object The object to inspect.
53031 * props The property names to filter.
53032 * @returns {Array} Returns the new array of filtered property names.
53034 function baseFunctions(object, props) {
53036 length = props.length,
53040 while (++index < length) {
53041 var key = props[index];
53042 if (isFunction(object[key])) {
53043 result[++resIndex] = key;
53050 * The base implementation of `get` without support for string paths and
53055 * object The object to query.
53057 * path The path of the property to get.
53059 * [pathKey] The key representation of path.
53060 * @returns {*} Returns the resolved value.
53062 function baseGet(object, path, pathKey) {
53063 if (object == null) {
53066 if (pathKey !== undefined && pathKey in toObject(object)) {
53070 length = path.length;
53072 while (object != null && index < length) {
53073 object = object[path[index++]];
53075 return (index && index == length) ? object : undefined;
53079 * The base implementation of `_.isEqual` without support for `this` binding
53080 * `customizer` functions.
53084 * value The value to compare.
53086 * other The other value to compare.
53087 * @param {Function}
53088 * [customizer] The function to customize comparing values.
53090 * [isLoose] Specify performing partial comparisons.
53092 * [stackA] Tracks traversed `value` objects.
53094 * [stackB] Tracks traversed `other` objects.
53095 * @returns {boolean} Returns `true` if the values are equivalent, else
53098 function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
53099 if (value === other) {
53102 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
53103 return value !== value && other !== other;
53105 return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
53109 * A specialized version of `baseIsEqual` for arrays and objects which
53110 * performs deep comparisons and tracks traversed objects enabling objects
53111 * with circular references to be compared.
53115 * object The object to compare.
53117 * other The other object to compare.
53118 * @param {Function}
53119 * equalFunc The function to determine equivalents of values.
53120 * @param {Function}
53121 * [customizer] The function to customize comparing objects.
53123 * [isLoose] Specify performing partial comparisons.
53125 * [stackA=[]] Tracks traversed `value` objects.
53127 * [stackB=[]] Tracks traversed `other` objects.
53128 * @returns {boolean} Returns `true` if the objects are equivalent, else
53131 function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
53132 var objIsArr = isArray(object),
53133 othIsArr = isArray(other),
53138 objTag = objToString.call(object);
53139 if (objTag == argsTag) {
53140 objTag = objectTag;
53141 } else if (objTag != objectTag) {
53142 objIsArr = isTypedArray(object);
53146 othTag = objToString.call(other);
53147 if (othTag == argsTag) {
53148 othTag = objectTag;
53149 } else if (othTag != objectTag) {
53150 othIsArr = isTypedArray(other);
53153 var objIsObj = objTag == objectTag,
53154 othIsObj = othTag == objectTag,
53155 isSameTag = objTag == othTag;
53157 if (isSameTag && !(objIsArr || objIsObj)) {
53158 return equalByTag(object, other, objTag);
53161 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
53162 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
53164 if (objIsWrapped || othIsWrapped) {
53165 return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
53171 // Assume cyclic values are equal.
53172 // For more information on detecting circular references see
53173 // https://es5.github.io/#JO.
53174 stackA || (stackA = []);
53175 stackB || (stackB = []);
53177 var length = stackA.length;
53179 if (stackA[length] == object) {
53180 return stackB[length] == other;
53183 // Add `object` and `other` to the stack of traversed objects.
53184 stackA.push(object);
53185 stackB.push(other);
53187 var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
53196 * The base implementation of `_.isMatch` without support for callback
53197 * shorthands and `this` binding.
53201 * object The object to inspect.
53203 * matchData The propery names, values, and compare flags to
53205 * @param {Function}
53206 * [customizer] The function to customize comparing objects.
53207 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
53209 function baseIsMatch(object, matchData, customizer) {
53210 var index = matchData.length,
53212 noCustomizer = !customizer;
53214 if (object == null) {
53217 object = toObject(object);
53219 var data = matchData[index];
53220 if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object)) {
53224 while (++index < length) {
53225 data = matchData[index];
53227 objValue = object[key],
53228 srcValue = data[1];
53230 if (noCustomizer && data[2]) {
53231 if (objValue === undefined && !(key in object)) {
53235 var result = customizer ? customizer(objValue, srcValue, key) : undefined;
53236 if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
53245 * The base implementation of `_.map` without support for callback
53246 * shorthands and `this` binding.
53249 * @param {Array|Object|string}
53250 * collection The collection to iterate over.
53251 * @param {Function}
53252 * iteratee The function invoked per iteration.
53253 * @returns {Array} Returns the new mapped array.
53255 function baseMap(collection, iteratee) {
53257 result = isArrayLike(collection) ? Array(collection.length) : [];
53259 baseEach(collection, function(value, key, collection) {
53260 result[++index] = iteratee(value, key, collection);
53266 * The base implementation of `_.matches` which does not clone `source`.
53270 * source The object of property values to match.
53271 * @returns {Function} Returns the new function.
53273 function baseMatches(source) {
53274 var matchData = getMatchData(source);
53275 if (matchData.length == 1 && matchData[0][2]) {
53276 var key = matchData[0][0],
53277 value = matchData[0][1];
53279 return function(object) {
53280 if (object == null) {
53283 return object[key] === value && (value !== undefined || (key in toObject(object)));
53286 return function(object) {
53287 return baseIsMatch(object, matchData);
53292 * The base implementation of `_.matchesProperty` which does not clone
53297 * path The path of the property to get.
53299 * srcValue The value to compare.
53300 * @returns {Function} Returns the new function.
53302 function baseMatchesProperty(path, srcValue) {
53303 var isArr = isArray(path),
53304 isCommon = isKey(path) && isStrictComparable(srcValue),
53305 pathKey = (path + '');
53307 path = toPath(path);
53308 return function(object) {
53309 if (object == null) {
53313 object = toObject(object);
53314 if ((isArr || !isCommon) && !(key in object)) {
53315 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
53316 if (object == null) {
53320 object = toObject(object);
53322 return object[key] === srcValue ? (srcValue !== undefined || (key in object)) : baseIsEqual(srcValue, object[key], undefined, true);
53327 * The base implementation of `_.merge` without support for argument
53328 * juggling, multiple sources, and `this` binding `customizer` functions.
53332 * object The destination object.
53334 * source The source object.
53335 * @param {Function}
53336 * [customizer] The function to customize merged values.
53338 * [stackA=[]] Tracks traversed source objects.
53340 * [stackB=[]] Associates values with source counterparts.
53341 * @returns {Object} Returns `object`.
53343 function baseMerge(object, source, customizer, stackA, stackB) {
53344 if (!isObject(object)) {
53347 var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
53348 props = isSrcArr ? undefined : keys(source);
53350 arrayEach(props || source, function(srcValue, key) {
53353 srcValue = source[key];
53355 if (isObjectLike(srcValue)) {
53356 stackA || (stackA = []);
53357 stackB || (stackB = []);
53358 baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
53360 var value = object[key],
53361 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
53362 isCommon = result === undefined;
53367 if ((result !== undefined || (isSrcArr && !(key in object))) &&
53368 (isCommon || (result === result ? (result !== value) : (value === value)))) {
53369 object[key] = result;
53377 * A specialized version of `baseMerge` for arrays and objects which
53378 * performs deep merges and tracks traversed objects enabling objects with
53379 * circular references to be merged.
53383 * object The destination object.
53385 * source The source object.
53387 * key The key of the value to merge.
53388 * @param {Function}
53389 * mergeFunc The function to merge values.
53390 * @param {Function}
53391 * [customizer] The function to customize merged values.
53393 * [stackA=[]] Tracks traversed source objects.
53395 * [stackB=[]] Associates values with source counterparts.
53396 * @returns {boolean} Returns `true` if the objects are equivalent, else
53399 function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
53400 var length = stackA.length,
53401 srcValue = source[key];
53404 if (stackA[length] == srcValue) {
53405 object[key] = stackB[length];
53409 var value = object[key],
53410 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
53411 isCommon = result === undefined;
53415 if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
53416 result = isArray(value) ? value : (isArrayLike(value) ? arrayCopy(value) : []);
53417 } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
53418 result = isArguments(value) ? toPlainObject(value) : (isPlainObject(value) ? value : {});
53423 // Add the source value to the stack of traversed objects and associate
53424 // it with its merged value.
53425 stackA.push(srcValue);
53426 stackB.push(result);
53429 // Recursively merge objects and arrays (susceptible to call stack
53431 object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
53432 } else if (result === result ? (result !== value) : (value === value)) {
53433 object[key] = result;
53438 * The base implementation of `_.property` without support for deep paths.
53442 * key The key of the property to get.
53443 * @returns {Function} Returns the new function.
53445 function baseProperty(key) {
53446 return function(object) {
53447 return object == null ? undefined : object[key];
53452 * A specialized version of `baseProperty` which supports deep paths.
53455 * @param {Array|string}
53456 * path The path of the property to get.
53457 * @returns {Function} Returns the new function.
53459 function basePropertyDeep(path) {
53460 var pathKey = (path + '');
53461 path = toPath(path);
53462 return function(object) {
53463 return baseGet(object, path, pathKey);
53468 * The base implementation of `_.pullAt` without support for individual
53469 * index arguments and capturing the removed elements.
53473 * array The array to modify.
53474 * @param {number[]}
53475 * indexes The indexes of elements to remove.
53476 * @returns {Array} Returns `array`.
53478 function basePullAt(array, indexes) {
53479 var length = array ? indexes.length : 0;
53481 var index = indexes[length];
53482 if (index != previous && isIndex(index)) {
53483 var previous = index;
53484 splice.call(array, index, 1);
53491 * The base implementation of `_.random` without support for argument
53492 * juggling and returning floating-point numbers.
53496 * min The minimum possible value.
53498 * max The maximum possible value.
53499 * @returns {number} Returns the random number.
53501 function baseRandom(min, max) {
53502 return min + nativeFloor(nativeRandom() * (max - min + 1));
53506 * The base implementation of `_.reduce` and `_.reduceRight` without support
53507 * for callback shorthands and `this` binding, which iterates over
53508 * `collection` using the provided `eachFunc`.
53511 * @param {Array|Object|string}
53512 * collection The collection to iterate over.
53513 * @param {Function}
53514 * iteratee The function invoked per iteration.
53516 * accumulator The initial value.
53518 * initFromCollection Specify using the first or last element of
53519 * `collection` as the initial value.
53520 * @param {Function}
53521 * eachFunc The function to iterate over `collection`.
53522 * @returns {*} Returns the accumulated value.
53524 function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
53525 eachFunc(collection, function(value, index, collection) {
53526 accumulator = initFromCollection ? (initFromCollection = false, value) : iteratee(accumulator, value, index, collection);
53528 return accumulator;
53532 * The base implementation of `setData` without support for hot loop
53536 * @param {Function}
53537 * func The function to associate metadata with.
53539 * data The metadata.
53540 * @returns {Function} Returns `func`.
53542 var baseSetData = !metaMap ? identity : function(func, data) {
53543 metaMap.set(func, data);
53548 * The base implementation of `_.slice` without an iteratee call guard.
53552 * array The array to slice.
53554 * [start=0] The start position.
53556 * [end=array.length] The end position.
53557 * @returns {Array} Returns the slice of `array`.
53559 function baseSlice(array, start, end) {
53561 length = array.length;
53563 start = start == null ? 0 : (+start || 0);
53565 start = -start > length ? 0 : (length + start);
53567 end = (end === undefined || end > length) ? length : (+end || 0);
53571 length = start > end ? 0 : ((end - start) >>> 0);
53574 var result = Array(length);
53575 while (++index < length) {
53576 result[index] = array[index + start];
53582 * The base implementation of `_.some` without support for callback
53583 * shorthands and `this` binding.
53586 * @param {Array|Object|string}
53587 * collection The collection to iterate over.
53588 * @param {Function}
53589 * predicate The function invoked per iteration.
53590 * @returns {boolean} Returns `true` if any element passes the predicate
53591 * check, else `false`.
53593 function baseSome(collection, predicate) {
53596 baseEach(collection, function(value, index, collection) {
53597 result = predicate(value, index, collection);
53604 * The base implementation of `_.sortBy` which uses `comparer` to define the
53605 * sort order of `array` and replaces criteria objects with their
53606 * corresponding values.
53610 * array The array to sort.
53611 * @param {Function}
53612 * comparer The function to define sort order.
53613 * @returns {Array} Returns `array`.
53615 function baseSortBy(array, comparer) {
53616 var length = array.length;
53618 array.sort(comparer);
53620 array[length] = array[length].value;
53626 * The base implementation of `_.sortByOrder` without param guards.
53629 * @param {Array|Object|string}
53630 * collection The collection to iterate over.
53631 * @param {Function[]|Object[]|string[]}
53632 * iteratees The iteratees to sort by.
53633 * @param {boolean[]}
53634 * orders The sort orders of `iteratees`.
53635 * @returns {Array} Returns the new sorted array.
53637 function baseSortByOrder(collection, iteratees, orders) {
53638 var callback = getCallback(),
53641 iteratees = arrayMap(iteratees, function(iteratee) {
53642 return callback(iteratee);
53645 var result = baseMap(collection, function(value) {
53646 var criteria = arrayMap(iteratees, function(iteratee) {
53647 return iteratee(value);
53650 'criteria': criteria,
53656 return baseSortBy(result, function(object, other) {
53657 return compareMultiple(object, other, orders);
53662 * The base implementation of `_.sum` without support for callback
53663 * shorthands and `this` binding.
53666 * @param {Array|Object|string}
53667 * collection The collection to iterate over.
53668 * @param {Function}
53669 * iteratee The function invoked per iteration.
53670 * @returns {number} Returns the sum.
53672 function baseSum(collection, iteratee) {
53674 baseEach(collection, function(value, index, collection) {
53675 result += +iteratee(value, index, collection) || 0;
53681 * The base implementation of `_.uniq` without support for callback
53682 * shorthands and `this` binding.
53686 * array The array to inspect.
53687 * @param {Function}
53688 * [iteratee] The function invoked per iteration.
53689 * @returns {Array} Returns the new duplicate-value-free array.
53691 function baseUniq(array, iteratee) {
53693 indexOf = getIndexOf(),
53694 length = array.length,
53695 isCommon = indexOf == baseIndexOf,
53696 isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
53697 seen = isLarge ? createCache() : null,
53701 indexOf = cacheIndexOf;
53705 seen = iteratee ? [] : result;
53708 while (++index < length) {
53709 var value = array[index],
53710 computed = iteratee ? iteratee(value, index, array) : value;
53712 if (isCommon && value === value) {
53713 var seenIndex = seen.length;
53714 while (seenIndex--) {
53715 if (seen[seenIndex] === computed) {
53720 seen.push(computed);
53722 result.push(value);
53723 } else if (indexOf(seen, computed, 0) < 0) {
53724 if (iteratee || isLarge) {
53725 seen.push(computed);
53727 result.push(value);
53734 * The base implementation of `_.values` and `_.valuesIn` which creates an
53735 * array of `object` property values corresponding to the property names of
53740 * object The object to query.
53742 * props The property names to get values for.
53743 * @returns {Object} Returns the array of property values.
53745 function baseValues(object, props) {
53747 length = props.length,
53748 result = Array(length);
53750 while (++index < length) {
53751 result[index] = object[props[index]];
53757 * The base implementation of `_.dropRightWhile`, `_.dropWhile`,
53758 * `_.takeRightWhile`, and `_.takeWhile` without support for callback
53759 * shorthands and `this` binding.
53763 * array The array to query.
53764 * @param {Function}
53765 * predicate The function invoked per iteration.
53767 * [isDrop] Specify dropping elements instead of taking them.
53769 * [fromRight] Specify iterating from right to left.
53770 * @returns {Array} Returns the slice of `array`.
53772 function baseWhile(array, predicate, isDrop, fromRight) {
53773 var length = array.length,
53774 index = fromRight ? length : -1;
53776 while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
53777 return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
53781 * The base implementation of `wrapperValue` which returns the result of
53782 * performing a sequence of actions on the unwrapped `value`, where each
53783 * successive action is supplied the return value of the previous.
53787 * value The unwrapped value.
53789 * actions Actions to peform to resolve the unwrapped value.
53790 * @returns {*} Returns the resolved value.
53792 function baseWrapperValue(value, actions) {
53793 var result = value;
53794 if (result instanceof LazyWrapper) {
53795 result = result.value();
53798 length = actions.length;
53800 while (++index < length) {
53801 var action = actions[index];
53802 result = action.func.apply(action.thisArg, arrayPush([result], action.args));
53808 * Performs a binary search of `array` to determine the index at which
53809 * `value` should be inserted into `array` in order to maintain its sort
53814 * array The sorted array to inspect.
53816 * value The value to evaluate.
53818 * [retHighest] Specify returning the highest qualified index.
53819 * @returns {number} Returns the index at which `value` should be inserted
53822 function binaryIndex(array, value, retHighest) {
53824 high = array ? array.length : low;
53826 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
53827 while (low < high) {
53828 var mid = (low + high) >>> 1,
53829 computed = array[mid];
53831 if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
53839 return binaryIndexBy(array, value, identity, retHighest);
53843 * This function is like `binaryIndex` except that it invokes `iteratee` for
53844 * `value` and each element of `array` to compute their sort ranking. The
53845 * iteratee is invoked with one argument; (value).
53849 * array The sorted array to inspect.
53851 * value The value to evaluate.
53852 * @param {Function}
53853 * iteratee The function invoked per iteration.
53855 * [retHighest] Specify returning the highest qualified index.
53856 * @returns {number} Returns the index at which `value` should be inserted
53859 function binaryIndexBy(array, value, iteratee, retHighest) {
53860 value = iteratee(value);
53863 high = array ? array.length : 0,
53864 valIsNaN = value !== value,
53865 valIsNull = value === null,
53866 valIsUndef = value === undefined;
53868 while (low < high) {
53869 var mid = nativeFloor((low + high) / 2),
53870 computed = iteratee(array[mid]),
53871 isDef = computed !== undefined,
53872 isReflexive = computed === computed;
53875 var setLow = isReflexive || retHighest;
53876 } else if (valIsNull) {
53877 setLow = isReflexive && isDef && (retHighest || computed != null);
53878 } else if (valIsUndef) {
53879 setLow = isReflexive && (retHighest || isDef);
53880 } else if (computed == null) {
53883 setLow = retHighest ? (computed <= value) : (computed < value);
53891 return nativeMin(high, MAX_ARRAY_INDEX);
53895 * A specialized version of `baseCallback` which only supports `this`
53896 * binding and specifying the number of arguments to provide to `func`.
53899 * @param {Function}
53900 * func The function to bind.
53902 * thisArg The `this` binding of `func`.
53904 * [argCount] The number of arguments to provide to `func`.
53905 * @returns {Function} Returns the callback.
53907 function bindCallback(func, thisArg, argCount) {
53908 if (typeof func != 'function') {
53911 if (thisArg === undefined) {
53914 switch (argCount) {
53916 return function(value) {
53917 return func.call(thisArg, value);
53920 return function(value, index, collection) {
53921 return func.call(thisArg, value, index, collection);
53924 return function(accumulator, value, index, collection) {
53925 return func.call(thisArg, accumulator, value, index, collection);
53928 return function(value, other, key, object, source) {
53929 return func.call(thisArg, value, other, key, object, source);
53932 return function() {
53933 return func.apply(thisArg, arguments);
53938 * Creates a clone of the given array buffer.
53941 * @param {ArrayBuffer}
53942 * buffer The array buffer to clone.
53943 * @returns {ArrayBuffer} Returns the cloned array buffer.
53945 function bufferClone(buffer) {
53946 var result = new ArrayBuffer(buffer.byteLength),
53947 view = new Uint8Array(result);
53949 view.set(new Uint8Array(buffer));
53954 * Creates an array that is the composition of partially applied arguments,
53955 * placeholders, and provided arguments into a single array of arguments.
53958 * @param {Array|Object}
53959 * args The provided arguments.
53961 * partials The arguments to prepend to those provided.
53963 * holders The `partials` placeholder indexes.
53964 * @returns {Array} Returns the new array of composed arguments.
53966 function composeArgs(args, partials, holders) {
53967 var holdersLength = holders.length,
53969 argsLength = nativeMax(args.length - holdersLength, 0),
53971 leftLength = partials.length,
53972 result = Array(leftLength + argsLength);
53974 while (++leftIndex < leftLength) {
53975 result[leftIndex] = partials[leftIndex];
53977 while (++argsIndex < holdersLength) {
53978 result[holders[argsIndex]] = args[argsIndex];
53980 while (argsLength--) {
53981 result[leftIndex++] = args[argsIndex++];
53987 * This function is like `composeArgs` except that the arguments composition
53988 * is tailored for `_.partialRight`.
53991 * @param {Array|Object}
53992 * args The provided arguments.
53994 * partials The arguments to append to those provided.
53996 * holders The `partials` placeholder indexes.
53997 * @returns {Array} Returns the new array of composed arguments.
53999 function composeArgsRight(args, partials, holders) {
54000 var holdersIndex = -1,
54001 holdersLength = holders.length,
54003 argsLength = nativeMax(args.length - holdersLength, 0),
54005 rightLength = partials.length,
54006 result = Array(argsLength + rightLength);
54008 while (++argsIndex < argsLength) {
54009 result[argsIndex] = args[argsIndex];
54011 var offset = argsIndex;
54012 while (++rightIndex < rightLength) {
54013 result[offset + rightIndex] = partials[rightIndex];
54015 while (++holdersIndex < holdersLength) {
54016 result[offset + holders[holdersIndex]] = args[argsIndex++];
54022 * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition`
54026 * @param {Function}
54027 * setter The function to set keys and values of the accumulator
54029 * @param {Function}
54030 * [initializer] The function to initialize the accumulator
54032 * @returns {Function} Returns the new aggregator function.
54034 function createAggregator(setter, initializer) {
54035 return function(collection, iteratee, thisArg) {
54036 var result = initializer ? initializer() : {};
54037 iteratee = getCallback(iteratee, thisArg, 3);
54039 if (isArray(collection)) {
54041 length = collection.length;
54043 while (++index < length) {
54044 var value = collection[index];
54045 setter(result, value, iteratee(value, index, collection), collection);
54048 baseEach(collection, function(value, key, collection) {
54049 setter(result, value, iteratee(value, key, collection), collection);
54057 * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
54060 * @param {Function}
54061 * assigner The function to assign values.
54062 * @returns {Function} Returns the new assigner function.
54064 function createAssigner(assigner) {
54065 return restParam(function(object, sources) {
54067 length = object == null ? 0 : sources.length,
54068 customizer = length > 2 ? sources[length - 2] : undefined,
54069 guard = length > 2 ? sources[2] : undefined,
54070 thisArg = length > 1 ? sources[length - 1] : undefined;
54072 if (typeof customizer == 'function') {
54073 customizer = bindCallback(customizer, thisArg, 5);
54076 customizer = typeof thisArg == 'function' ? thisArg : undefined;
54077 length -= (customizer ? 1 : 0);
54079 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
54080 customizer = length < 3 ? undefined : customizer;
54083 while (++index < length) {
54084 var source = sources[index];
54086 assigner(object, source, customizer);
54094 * Creates a `baseEach` or `baseEachRight` function.
54097 * @param {Function}
54098 * eachFunc The function to iterate over a collection.
54100 * [fromRight] Specify iterating from right to left.
54101 * @returns {Function} Returns the new base function.
54103 function createBaseEach(eachFunc, fromRight) {
54104 return function(collection, iteratee) {
54105 var length = collection ? getLength(collection) : 0;
54106 if (!isLength(length)) {
54107 return eachFunc(collection, iteratee);
54109 var index = fromRight ? length : -1,
54110 iterable = toObject(collection);
54112 while ((fromRight ? index-- : ++index < length)) {
54113 if (iteratee(iterable[index], index, iterable) === false) {
54122 * Creates a base function for `_.forIn` or `_.forInRight`.
54126 * [fromRight] Specify iterating from right to left.
54127 * @returns {Function} Returns the new base function.
54129 function createBaseFor(fromRight) {
54130 return function(object, iteratee, keysFunc) {
54131 var iterable = toObject(object),
54132 props = keysFunc(object),
54133 length = props.length,
54134 index = fromRight ? length : -1;
54136 while ((fromRight ? index-- : ++index < length)) {
54137 var key = props[index];
54138 if (iteratee(iterable[key], key, iterable) === false) {
54147 * Creates a function that wraps `func` and invokes it with the `this`
54148 * binding of `thisArg`.
54151 * @param {Function}
54152 * func The function to bind.
54154 * [thisArg] The `this` binding of `func`.
54155 * @returns {Function} Returns the new bound function.
54157 function createBindWrapper(func, thisArg) {
54158 var Ctor = createCtorWrapper(func);
54160 function wrapper() {
54161 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
54162 return fn.apply(thisArg, arguments);
54168 * Creates a `Set` cache object to optimize linear searches of large arrays.
54172 * [values] The values to cache.
54173 * @returns {null|Object} Returns the new cache object if `Set` is
54174 * supported, else `null`.
54176 function createCache(values) {
54177 return (nativeCreate && Set) ? new SetCache(values) : null;
54181 * Creates a function that produces compound words out of the words in a
54185 * @param {Function}
54186 * callback The function to combine each word.
54187 * @returns {Function} Returns the new compounder function.
54189 function createCompounder(callback) {
54190 return function(string) {
54192 array = words(deburr(string)),
54193 length = array.length,
54196 while (++index < length) {
54197 result = callback(result, array[index], index);
54204 * Creates a function that produces an instance of `Ctor` regardless of
54205 * whether it was invoked as part of a `new` expression or by `call` or
54209 * @param {Function}
54210 * Ctor The constructor to wrap.
54211 * @returns {Function} Returns the new wrapped function.
54213 function createCtorWrapper(Ctor) {
54214 return function() {
54215 // Use a `switch` statement to work with class constructors.
54217 // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
54218 // for more details.
54219 var args = arguments;
54220 switch (args.length) {
54224 return new Ctor(args[0]);
54226 return new Ctor(args[0], args[1]);
54228 return new Ctor(args[0], args[1], args[2]);
54230 return new Ctor(args[0], args[1], args[2], args[3]);
54232 return new Ctor(args[0], args[1], args[2], args[3], args[4]);
54234 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
54236 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
54238 var thisBinding = baseCreate(Ctor.prototype),
54239 result = Ctor.apply(thisBinding, args);
54241 // Mimic the constructor's `return` behavior.
54242 // See https://es5.github.io/#x13.2.2 for more details.
54243 return isObject(result) ? result : thisBinding;
54248 * Creates a `_.curry` or `_.curryRight` function.
54252 * flag The curry bit flag.
54253 * @returns {Function} Returns the new curry function.
54255 function createCurry(flag) {
54256 function curryFunc(func, arity, guard) {
54257 if (guard && isIterateeCall(func, arity, guard)) {
54260 var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);
54261 result.placeholder = curryFunc.placeholder;
54268 * Creates a `_.defaults` or `_.defaultsDeep` function.
54271 * @param {Function}
54272 * assigner The function to assign values.
54273 * @param {Function}
54274 * customizer The function to customize assigned values.
54275 * @returns {Function} Returns the new defaults function.
54277 function createDefaults(assigner, customizer) {
54278 return restParam(function(args) {
54279 var object = args[0];
54280 if (object == null) {
54283 args.push(customizer);
54284 return assigner.apply(undefined, args);
54289 * Creates a `_.max` or `_.min` function.
54292 * @param {Function}
54293 * comparator The function used to compare values.
54295 * exValue The initial extremum value.
54296 * @returns {Function} Returns the new extremum function.
54298 function createExtremum(comparator, exValue) {
54299 return function(collection, iteratee, thisArg) {
54300 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
54301 iteratee = undefined;
54303 iteratee = getCallback(iteratee, thisArg, 3);
54304 if (iteratee.length == 1) {
54305 collection = isArray(collection) ? collection : toIterable(collection);
54306 var result = arrayExtremum(collection, iteratee, comparator, exValue);
54307 if (!(collection.length && result === exValue)) {
54311 return baseExtremum(collection, iteratee, comparator, exValue);
54316 * Creates a `_.find` or `_.findLast` function.
54319 * @param {Function}
54320 * eachFunc The function to iterate over a collection.
54322 * [fromRight] Specify iterating from right to left.
54323 * @returns {Function} Returns the new find function.
54325 function createFind(eachFunc, fromRight) {
54326 return function(collection, predicate, thisArg) {
54327 predicate = getCallback(predicate, thisArg, 3);
54328 if (isArray(collection)) {
54329 var index = baseFindIndex(collection, predicate, fromRight);
54330 return index > -1 ? collection[index] : undefined;
54332 return baseFind(collection, predicate, eachFunc);
54337 * Creates a `_.findIndex` or `_.findLastIndex` function.
54341 * [fromRight] Specify iterating from right to left.
54342 * @returns {Function} Returns the new find function.
54344 function createFindIndex(fromRight) {
54345 return function(array, predicate, thisArg) {
54346 if (!(array && array.length)) {
54349 predicate = getCallback(predicate, thisArg, 3);
54350 return baseFindIndex(array, predicate, fromRight);
54355 * Creates a `_.findKey` or `_.findLastKey` function.
54358 * @param {Function}
54359 * objectFunc The function to iterate over an object.
54360 * @returns {Function} Returns the new find function.
54362 function createFindKey(objectFunc) {
54363 return function(object, predicate, thisArg) {
54364 predicate = getCallback(predicate, thisArg, 3);
54365 return baseFind(object, predicate, objectFunc, true);
54370 * Creates a `_.flow` or `_.flowRight` function.
54374 * [fromRight] Specify iterating from right to left.
54375 * @returns {Function} Returns the new flow function.
54377 function createFlow(fromRight) {
54378 return function() {
54380 length = arguments.length,
54381 index = fromRight ? length : -1,
54383 funcs = Array(length);
54385 while ((fromRight ? index-- : ++index < length)) {
54386 var func = funcs[leftIndex++] = arguments[index];
54387 if (typeof func != 'function') {
54388 throw new TypeError(FUNC_ERROR_TEXT);
54390 if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
54391 wrapper = new LodashWrapper([], true);
54394 index = wrapper ? -1 : length;
54395 while (++index < length) {
54396 func = funcs[index];
54398 var funcName = getFuncName(func),
54399 data = funcName == 'wrapper' ? getData(func) : undefined;
54401 if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
54402 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
54404 wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
54407 return function() {
54408 var args = arguments,
54411 if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
54412 return wrapper.plant(value).value();
54415 result = length ? funcs[index].apply(this, args) : value;
54417 while (++index < length) {
54418 result = funcs[index].call(this, result);
54426 * Creates a function for `_.forEach` or `_.forEachRight`.
54429 * @param {Function}
54430 * arrayFunc The function to iterate over an array.
54431 * @param {Function}
54432 * eachFunc The function to iterate over a collection.
54433 * @returns {Function} Returns the new each function.
54435 function createForEach(arrayFunc, eachFunc) {
54436 return function(collection, iteratee, thisArg) {
54437 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee) : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
54442 * Creates a function for `_.forIn` or `_.forInRight`.
54445 * @param {Function}
54446 * objectFunc The function to iterate over an object.
54447 * @returns {Function} Returns the new each function.
54449 function createForIn(objectFunc) {
54450 return function(object, iteratee, thisArg) {
54451 if (typeof iteratee != 'function' || thisArg !== undefined) {
54452 iteratee = bindCallback(iteratee, thisArg, 3);
54454 return objectFunc(object, iteratee, keysIn);
54459 * Creates a function for `_.forOwn` or `_.forOwnRight`.
54462 * @param {Function}
54463 * objectFunc The function to iterate over an object.
54464 * @returns {Function} Returns the new each function.
54466 function createForOwn(objectFunc) {
54467 return function(object, iteratee, thisArg) {
54468 if (typeof iteratee != 'function' || thisArg !== undefined) {
54469 iteratee = bindCallback(iteratee, thisArg, 3);
54471 return objectFunc(object, iteratee);
54476 * Creates a function for `_.mapKeys` or `_.mapValues`.
54480 * [isMapKeys] Specify mapping keys instead of values.
54481 * @returns {Function} Returns the new map function.
54483 function createObjectMapper(isMapKeys) {
54484 return function(object, iteratee, thisArg) {
54486 iteratee = getCallback(iteratee, thisArg, 3);
54488 baseForOwn(object, function(value, key, object) {
54489 var mapped = iteratee(value, key, object);
54490 key = isMapKeys ? mapped : key;
54491 value = isMapKeys ? value : mapped;
54492 result[key] = value;
54499 * Creates a function for `_.padLeft` or `_.padRight`.
54503 * [fromRight] Specify padding from the right.
54504 * @returns {Function} Returns the new pad function.
54506 function createPadDir(fromRight) {
54507 return function(string, length, chars) {
54508 string = baseToString(string);
54509 return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
54514 * Creates a `_.partial` or `_.partialRight` function.
54518 * flag The partial bit flag.
54519 * @returns {Function} Returns the new partial function.
54521 function createPartial(flag) {
54522 var partialFunc = restParam(function(func, partials) {
54523 var holders = replaceHolders(partials, partialFunc.placeholder);
54524 return createWrapper(func, flag, undefined, partials, holders);
54526 return partialFunc;
54530 * Creates a function for `_.reduce` or `_.reduceRight`.
54533 * @param {Function}
54534 * arrayFunc The function to iterate over an array.
54535 * @param {Function}
54536 * eachFunc The function to iterate over a collection.
54537 * @returns {Function} Returns the new each function.
54539 function createReduce(arrayFunc, eachFunc) {
54540 return function(collection, iteratee, accumulator, thisArg) {
54541 var initFromArray = arguments.length < 3;
54542 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee, accumulator, initFromArray) : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
54547 * Creates a function that wraps `func` and invokes it with optional `this`
54548 * binding of, partial application, and currying.
54551 * @param {Function|string}
54552 * func The function or method name to reference.
54554 * bitmask The bitmask of flags. See `createWrapper` for more
54557 * [thisArg] The `this` binding of `func`.
54559 * [partials] The arguments to prepend to those provided to the
54562 * [holders] The `partials` placeholder indexes.
54564 * [partialsRight] The arguments to append to those provided to
54565 * the new function.
54567 * [holdersRight] The `partialsRight` placeholder indexes.
54569 * [argPos] The argument positions of the new function.
54571 * [ary] The arity cap of `func`.
54573 * [arity] The arity of `func`.
54574 * @returns {Function} Returns the new wrapped function.
54576 function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
54577 var isAry = bitmask & ARY_FLAG,
54578 isBind = bitmask & BIND_FLAG,
54579 isBindKey = bitmask & BIND_KEY_FLAG,
54580 isCurry = bitmask & CURRY_FLAG,
54581 isCurryBound = bitmask & CURRY_BOUND_FLAG,
54582 isCurryRight = bitmask & CURRY_RIGHT_FLAG,
54583 Ctor = isBindKey ? undefined : createCtorWrapper(func);
54585 function wrapper() {
54586 // Avoid `arguments` object use disqualifying optimizations by
54587 // converting it to an array before providing it to other functions.
54588 var length = arguments.length,
54590 args = Array(length);
54593 args[index] = arguments[index];
54596 args = composeArgs(args, partials, holders);
54598 if (partialsRight) {
54599 args = composeArgsRight(args, partialsRight, holdersRight);
54601 if (isCurry || isCurryRight) {
54602 var placeholder = wrapper.placeholder,
54603 argsHolders = replaceHolders(args, placeholder);
54605 length -= argsHolders.length;
54606 if (length < arity) {
54607 var newArgPos = argPos ? arrayCopy(argPos) : undefined,
54608 newArity = nativeMax(arity - length, 0),
54609 newsHolders = isCurry ? argsHolders : undefined,
54610 newHoldersRight = isCurry ? undefined : argsHolders,
54611 newPartials = isCurry ? args : undefined,
54612 newPartialsRight = isCurry ? undefined : args;
54614 bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
54615 bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
54617 if (!isCurryBound) {
54618 bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
54620 var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
54621 result = createHybridWrapper.apply(undefined, newData);
54623 if (isLaziable(func)) {
54624 setData(result, newData);
54626 result.placeholder = placeholder;
54630 var thisBinding = isBind ? thisArg : this,
54631 fn = isBindKey ? thisBinding[func] : func;
54634 args = reorder(args, argPos);
54636 if (isAry && ary < args.length) {
54639 if (this && this !== root && this instanceof wrapper) {
54640 fn = Ctor || createCtorWrapper(func);
54642 return fn.apply(thisBinding, args);
54648 * Creates the padding required for `string` based on the given `length`.
54649 * The `chars` string is truncated if the number of characters exceeds
54654 * string The string to create padding for.
54656 * [length=0] The padding length.
54658 * [chars=' '] The string used as padding.
54659 * @returns {string} Returns the pad for `string`.
54661 function createPadding(string, length, chars) {
54662 var strLength = string.length;
54665 if (strLength >= length || !nativeIsFinite(length)) {
54668 var padLength = length - strLength;
54669 chars = chars == null ? ' ' : (chars + '');
54670 return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);
54674 * Creates a function that wraps `func` and invokes it with the optional
54675 * `this` binding of `thisArg` and the `partials` prepended to those
54676 * provided to the wrapper.
54679 * @param {Function}
54680 * func The function to partially apply arguments to.
54682 * bitmask The bitmask of flags. See `createWrapper` for more
54685 * thisArg The `this` binding of `func`.
54687 * partials The arguments to prepend to those provided to the new
54689 * @returns {Function} Returns the new bound function.
54691 function createPartialWrapper(func, bitmask, thisArg, partials) {
54692 var isBind = bitmask & BIND_FLAG,
54693 Ctor = createCtorWrapper(func);
54695 function wrapper() {
54696 // Avoid `arguments` object use disqualifying optimizations by
54697 // converting it to an array before providing it `func`.
54698 var argsIndex = -1,
54699 argsLength = arguments.length,
54701 leftLength = partials.length,
54702 args = Array(leftLength + argsLength);
54704 while (++leftIndex < leftLength) {
54705 args[leftIndex] = partials[leftIndex];
54707 while (argsLength--) {
54708 args[leftIndex++] = arguments[++argsIndex];
54710 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
54711 return fn.apply(isBind ? thisArg : this, args);
54717 * Creates a `_.ceil`, `_.floor`, or `_.round` function.
54721 * methodName The name of the `Math` method to use when rounding.
54722 * @returns {Function} Returns the new round function.
54724 function createRound(methodName) {
54725 var func = Math[methodName];
54726 return function(number, precision) {
54727 precision = precision === undefined ? 0 : (+precision || 0);
54729 precision = pow(10, precision);
54730 return func(number * precision) / precision;
54732 return func(number);
54737 * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
54741 * [retHighest] Specify returning the highest qualified index.
54742 * @returns {Function} Returns the new index function.
54744 function createSortedIndex(retHighest) {
54745 return function(array, value, iteratee, thisArg) {
54746 var callback = getCallback(iteratee);
54747 return (iteratee == null && callback === baseCallback) ? binaryIndex(array, value, retHighest) : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);
54752 * Creates a function that either curries or invokes `func` with optional
54753 * `this` binding and partially applied arguments.
54756 * @param {Function|string}
54757 * func The function or method name to reference.
54759 * bitmask The bitmask of flags. The bitmask may be composed of
54760 * the following flags: 1 - `_.bind` 2 - `_.bindKey` 4 -
54761 * `_.curry` or `_.curryRight` of a bound function 8 - `_.curry`
54762 * 16 - `_.curryRight` 32 - `_.partial` 64 - `_.partialRight` 128 -
54763 * `_.rearg` 256 - `_.ary`
54765 * [thisArg] The `this` binding of `func`.
54767 * [partials] The arguments to be partially applied.
54769 * [holders] The `partials` placeholder indexes.
54771 * [argPos] The argument positions of the new function.
54773 * [ary] The arity cap of `func`.
54775 * [arity] The arity of `func`.
54776 * @returns {Function} Returns the new wrapped function.
54778 function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
54779 var isBindKey = bitmask & BIND_KEY_FLAG;
54780 if (!isBindKey && typeof func != 'function') {
54781 throw new TypeError(FUNC_ERROR_TEXT);
54783 var length = partials ? partials.length : 0;
54785 bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
54786 partials = holders = undefined;
54788 length -= (holders ? holders.length : 0);
54789 if (bitmask & PARTIAL_RIGHT_FLAG) {
54790 var partialsRight = partials,
54791 holdersRight = holders;
54793 partials = holders = undefined;
54795 var data = isBindKey ? undefined : getData(func),
54796 newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
54799 mergeData(newData, data);
54800 bitmask = newData[1];
54801 arity = newData[9];
54803 newData[9] = arity == null ? (isBindKey ? 0 : func.length) : (nativeMax(arity - length, 0) || 0);
54805 if (bitmask == BIND_FLAG) {
54806 var result = createBindWrapper(newData[0], newData[2]);
54807 } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
54808 result = createPartialWrapper.apply(undefined, newData);
54810 result = createHybridWrapper.apply(undefined, newData);
54812 var setter = data ? baseSetData : setData;
54813 return setter(result, newData);
54817 * A specialized version of `baseIsEqualDeep` for arrays with support for
54818 * partial deep comparisons.
54822 * array The array to compare.
54824 * other The other array to compare.
54825 * @param {Function}
54826 * equalFunc The function to determine equivalents of values.
54827 * @param {Function}
54828 * [customizer] The function to customize comparing arrays.
54830 * [isLoose] Specify performing partial comparisons.
54832 * [stackA] Tracks traversed `value` objects.
54834 * [stackB] Tracks traversed `other` objects.
54835 * @returns {boolean} Returns `true` if the arrays are equivalent, else
54838 function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
54840 arrLength = array.length,
54841 othLength = other.length;
54843 if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
54846 // Ignore non-index properties.
54847 while (++index < arrLength) {
54848 var arrValue = array[index],
54849 othValue = other[index],
54850 result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
54852 if (result !== undefined) {
54858 // Recursively compare arrays (susceptible to call stack limits).
54860 if (!arraySome(other, function(othValue) {
54861 return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
54865 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
54873 * A specialized version of `baseIsEqualDeep` for comparing objects of the
54874 * same `toStringTag`.
54876 * **Note:** This function only supports comparing values with tags of
54877 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
54881 * object The object to compare.
54883 * other The other object to compare.
54885 * tag The `toStringTag` of the objects to compare.
54886 * @returns {boolean} Returns `true` if the objects are equivalent, else
54889 function equalByTag(object, other, tag) {
54893 // Coerce dates and booleans to numbers, dates to milliseconds and
54895 // to `1` or `0` treating invalid dates coerced to `NaN` as not
54897 return +object == +other;
54900 return object.name == other.name && object.message == other.message;
54903 // Treat `NaN` vs. `NaN` as equal.
54904 return (object != +object) ? other != +other : object == +other;
54908 // Coerce regexes to strings and treat strings primitives and string
54909 // objects as equal. See https://es5.github.io/#x15.10.6.4 for more
54911 return object == (other + '');
54917 * A specialized version of `baseIsEqualDeep` for objects with support for
54918 * partial deep comparisons.
54922 * object The object to compare.
54924 * other The other object to compare.
54925 * @param {Function}
54926 * equalFunc The function to determine equivalents of values.
54927 * @param {Function}
54928 * [customizer] The function to customize comparing values.
54930 * [isLoose] Specify performing partial comparisons.
54932 * [stackA] Tracks traversed `value` objects.
54934 * [stackB] Tracks traversed `other` objects.
54935 * @returns {boolean} Returns `true` if the objects are equivalent, else
54938 function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
54939 var objProps = keys(object),
54940 objLength = objProps.length,
54941 othProps = keys(other),
54942 othLength = othProps.length;
54944 if (objLength != othLength && !isLoose) {
54947 var index = objLength;
54949 var key = objProps[index];
54950 if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
54954 var skipCtor = isLoose;
54955 while (++index < objLength) {
54956 key = objProps[index];
54957 var objValue = object[key],
54958 othValue = other[key],
54959 result = customizer ? customizer(isLoose ? othValue : objValue, isLoose ? objValue : othValue, key) : undefined;
54961 // Recursively compare objects (susceptible to call stack limits).
54962 if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
54965 skipCtor || (skipCtor = key == 'constructor');
54968 var objCtor = object.constructor,
54969 othCtor = other.constructor;
54971 // Non `Object` object instances with different constructors are not
54973 if (objCtor != othCtor &&
54974 ('constructor' in object && 'constructor' in other) &&
54975 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
54976 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
54984 * Gets the appropriate "callback" function. If the `_.callback` method is
54985 * customized this function returns the custom method, otherwise it returns
54986 * the `baseCallback` function. If arguments are provided the chosen
54987 * function is invoked with them and its result is returned.
54990 * @returns {Function} Returns the chosen function or its result.
54992 function getCallback(func, thisArg, argCount) {
54993 var result = lodash.callback || callback;
54994 result = result === callback ? baseCallback : result;
54995 return argCount ? result(func, thisArg, argCount) : result;
54999 * Gets metadata for `func`.
55002 * @param {Function}
55003 * func The function to query.
55004 * @returns {*} Returns the metadata for `func`.
55006 var getData = !metaMap ? noop : function(func) {
55007 return metaMap.get(func);
55011 * Gets the name of `func`.
55014 * @param {Function}
55015 * func The function to query.
55016 * @returns {string} Returns the function name.
55018 function getFuncName(func) {
55019 var result = func.name,
55020 array = realNames[result],
55021 length = array ? array.length : 0;
55024 var data = array[length],
55025 otherFunc = data.func;
55026 if (otherFunc == null || otherFunc == func) {
55034 * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
55035 * customized this function returns the custom method, otherwise it returns
55036 * the `baseIndexOf` function. If arguments are provided the chosen function
55037 * is invoked with them and its result is returned.
55040 * @returns {Function|number} Returns the chosen function or its result.
55042 function getIndexOf(collection, target, fromIndex) {
55043 var result = lodash.indexOf || indexOf;
55044 result = result === indexOf ? baseIndexOf : result;
55045 return collection ? result(collection, target, fromIndex) : result;
55049 * Gets the "length" property value of `object`.
55051 * **Note:** This function is used to avoid a [JIT
55052 * bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects Safari
55053 * on at least iOS 8.1-8.3 ARM64.
55057 * object The object to query.
55058 * @returns {*} Returns the "length" value.
55060 var getLength = baseProperty('length');
55063 * Gets the propery names, values, and compare flags of `object`.
55067 * object The object to query.
55068 * @returns {Array} Returns the match data of `object`.
55070 function getMatchData(object) {
55071 var result = pairs(object),
55072 length = result.length;
55075 result[length][2] = isStrictComparable(result[length][1]);
55081 * Gets the native function at `key` of `object`.
55085 * object The object to query.
55087 * key The key of the method to get.
55088 * @returns {*} Returns the function if it's native, else `undefined`.
55090 function getNative(object, key) {
55091 var value = object == null ? undefined : object[key];
55092 return isNative(value) ? value : undefined;
55096 * Gets the view, applying any `transforms` to the `start` and `end`
55101 * start The start of the view.
55103 * end The end of the view.
55105 * transforms The transformations to apply to the view.
55106 * @returns {Object} Returns an object containing the `start` and `end`
55107 * positions of the view.
55109 function getView(start, end, transforms) {
55111 length = transforms.length;
55113 while (++index < length) {
55114 var data = transforms[index],
55117 switch (data.type) {
55125 end = nativeMin(end, start + size);
55128 start = nativeMax(start, end - size);
55139 * Initializes an array clone.
55143 * array The array to clone.
55144 * @returns {Array} Returns the initialized clone.
55146 function initCloneArray(array) {
55147 var length = array.length,
55148 result = new array.constructor(length);
55150 // Add array properties assigned by `RegExp#exec`.
55151 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
55152 result.index = array.index;
55153 result.input = array.input;
55159 * Initializes an object clone.
55163 * object The object to clone.
55164 * @returns {Object} Returns the initialized clone.
55166 function initCloneObject(object) {
55167 var Ctor = object.constructor;
55168 if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
55175 * Initializes an object clone based on its `toStringTag`.
55177 * **Note:** This function only supports cloning values with tags of
55178 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
55182 * object The object to clone.
55184 * tag The `toStringTag` of the object to clone.
55186 * [isDeep] Specify a deep clone.
55187 * @returns {Object} Returns the initialized clone.
55189 function initCloneByTag(object, tag, isDeep) {
55190 var Ctor = object.constructor;
55192 case arrayBufferTag:
55193 return bufferClone(object);
55197 return new Ctor(+object);
55205 case uint8ClampedTag:
55208 var buffer = object.buffer;
55209 return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
55213 return new Ctor(object);
55216 var result = new Ctor(object.source, reFlags.exec(object));
55217 result.lastIndex = object.lastIndex;
55223 * Invokes the method at `path` on `object`.
55227 * object The object to query.
55228 * @param {Array|string}
55229 * path The path of the method to invoke.
55231 * args The arguments to invoke the method with.
55232 * @returns {*} Returns the result of the invoked method.
55234 function invokePath(object, path, args) {
55235 if (object != null && !isKey(path, object)) {
55236 path = toPath(path);
55237 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
55240 var func = object == null ? object : object[path];
55241 return func == null ? undefined : func.apply(object, args);
55245 * Checks if `value` is array-like.
55249 * value The value to check.
55250 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
55252 function isArrayLike(value) {
55253 return value != null && isLength(getLength(value));
55257 * Checks if `value` is a valid array-like index.
55261 * value The value to check.
55263 * [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
55264 * @returns {boolean} Returns `true` if `value` is a valid index, else
55267 function isIndex(value, length) {
55268 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
55269 length = length == null ? MAX_SAFE_INTEGER : length;
55270 return value > -1 && value % 1 == 0 && value < length;
55274 * Checks if the provided arguments are from an iteratee call.
55278 * value The potential iteratee value argument.
55280 * index The potential iteratee index or key argument.
55282 * object The potential iteratee object argument.
55283 * @returns {boolean} Returns `true` if the arguments are from an iteratee
55284 * call, else `false`.
55286 function isIterateeCall(value, index, object) {
55287 if (!isObject(object)) {
55290 var type = typeof index;
55291 if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) {
55292 var other = object[index];
55293 return value === value ? (value === other) : (other !== other);
55299 * Checks if `value` is a property name and not a property path.
55303 * value The value to check.
55305 * [object] The object to query keys on.
55306 * @returns {boolean} Returns `true` if `value` is a property name, else
55309 function isKey(value, object) {
55310 var type = typeof value;
55311 if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
55314 if (isArray(value)) {
55317 var result = !reIsDeepProp.test(value);
55318 return result || (object != null && value in toObject(object));
55322 * Checks if `func` has a lazy counterpart.
55325 * @param {Function}
55326 * func The function to check.
55327 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else
55330 function isLaziable(func) {
55331 var funcName = getFuncName(func);
55332 if (!(funcName in LazyWrapper.prototype)) {
55335 var other = lodash[funcName];
55336 if (func === other) {
55339 var data = getData(other);
55340 return !!data && func === data[0];
55344 * Checks if `value` is a valid array-like length.
55346 * **Note:** This function is based on
55347 * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
55351 * value The value to check.
55352 * @returns {boolean} Returns `true` if `value` is a valid length, else
55355 function isLength(value) {
55356 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
55360 * Checks if `value` is suitable for strict equality comparisons, i.e.
55365 * value The value to check.
55366 * @returns {boolean} Returns `true` if `value` if suitable for strict
55367 * equality comparisons, else `false`.
55369 function isStrictComparable(value) {
55370 return value === value && !isObject(value);
55374 * Merges the function metadata of `source` into `data`.
55376 * Merging metadata reduces the number of wrappers required to invoke a
55377 * function. This is possible because methods like `_.bind`, `_.curry`, and
55378 * `_.partial` may be applied regardless of execution order. Methods like
55379 * `_.ary` and `_.rearg` augment function arguments, making the order in
55380 * which they are executed important, preventing the merging of metadata.
55381 * However, we make an exception for a safe common case where curried
55382 * functions have `_.ary` and or `_.rearg` applied.
55386 * data The destination metadata.
55388 * source The source metadata.
55389 * @returns {Array} Returns `data`.
55391 function mergeData(data, source) {
55392 var bitmask = data[1],
55393 srcBitmask = source[1],
55394 newBitmask = bitmask | srcBitmask,
55395 isCommon = newBitmask < ARY_FLAG;
55398 (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
55399 (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
55400 (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
55402 // Exit early if metadata can't be merged.
55403 if (!(isCommon || isCombo)) {
55406 // Use source `thisArg` if available.
55407 if (srcBitmask & BIND_FLAG) {
55408 data[2] = source[2];
55409 // Set when currying a bound function.
55410 newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
55412 // Compose partial arguments.
55413 var value = source[3];
55415 var partials = data[3];
55416 data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
55417 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
55419 // Compose partial right arguments.
55422 partials = data[5];
55423 data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
55424 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
55426 // Use source `argPos` if available.
55429 data[7] = arrayCopy(value);
55431 // Use source `ary` if it's smaller.
55432 if (srcBitmask & ARY_FLAG) {
55433 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
55435 // Use source `arity` if one is not provided.
55436 if (data[9] == null) {
55437 data[9] = source[9];
55439 // Use source `func` and merge bitmasks.
55440 data[0] = source[0];
55441 data[1] = newBitmask;
55447 * Used by `_.defaultsDeep` to customize its `_.merge` use.
55451 * objectValue The destination object property value.
55453 * sourceValue The source object property value.
55454 * @returns {*} Returns the value to assign to the destination object.
55456 function mergeDefaults(objectValue, sourceValue) {
55457 return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);
55461 * A specialized version of `_.pick` which picks `object` properties
55462 * specified by `props`.
55466 * object The source object.
55467 * @param {string[]}
55468 * props The property names to pick.
55469 * @returns {Object} Returns the new object.
55471 function pickByArray(object, props) {
55472 object = toObject(object);
55475 length = props.length,
55478 while (++index < length) {
55479 var key = props[index];
55480 if (key in object) {
55481 result[key] = object[key];
55488 * A specialized version of `_.pick` which picks `object` properties
55489 * `predicate` returns truthy for.
55493 * object The source object.
55494 * @param {Function}
55495 * predicate The function invoked per iteration.
55496 * @returns {Object} Returns the new object.
55498 function pickByCallback(object, predicate) {
55500 baseForIn(object, function(value, key, object) {
55501 if (predicate(value, key, object)) {
55502 result[key] = value;
55509 * Reorder `array` according to the specified indexes where the element at
55510 * the first index is assigned as the first element, the element at the
55511 * second index is assigned as the second element, and so on.
55515 * array The array to reorder.
55517 * indexes The arranged array indexes.
55518 * @returns {Array} Returns `array`.
55520 function reorder(array, indexes) {
55521 var arrLength = array.length,
55522 length = nativeMin(indexes.length, arrLength),
55523 oldArray = arrayCopy(array);
55526 var index = indexes[length];
55527 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
55533 * Sets metadata for `func`.
55535 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
55536 * period of time, it will trip its breaker and transition to an identity
55537 * function to avoid garbage collection pauses in V8. See [V8 issue
55538 * 2070](https://code.google.com/p/v8/issues/detail?id=2070) for more
55542 * @param {Function}
55543 * func The function to associate metadata with.
55545 * data The metadata.
55546 * @returns {Function} Returns `func`.
55548 var setData = (function() {
55552 return function(key, value) {
55554 remaining = HOT_SPAN - (stamp - lastCalled);
55556 lastCalled = stamp;
55557 if (remaining > 0) {
55558 if (++count >= HOT_COUNT) {
55564 return baseSetData(key, value);
55569 * A fallback implementation of `Object.keys` which creates an array of the
55570 * own enumerable property names of `object`.
55574 * object The object to query.
55575 * @returns {Array} Returns the array of property names.
55577 function shimKeys(object) {
55578 var props = keysIn(object),
55579 propsLength = props.length,
55580 length = propsLength && object.length;
55582 var allowIndexes = !!length && isLength(length) &&
55583 (isArray(object) || isArguments(object));
55588 while (++index < propsLength) {
55589 var key = props[index];
55590 if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
55598 * Converts `value` to an array-like object if it's not one.
55602 * value The value to process.
55603 * @returns {Array|Object} Returns the array-like object.
55605 function toIterable(value) {
55606 if (value == null) {
55609 if (!isArrayLike(value)) {
55610 return values(value);
55612 return isObject(value) ? value : Object(value);
55616 * Converts `value` to an object if it's not one.
55620 * value The value to process.
55621 * @returns {Object} Returns the object.
55623 function toObject(value) {
55624 return isObject(value) ? value : Object(value);
55628 * Converts `value` to property path array if it's not one.
55632 * value The value to process.
55633 * @returns {Array} Returns the property path array.
55635 function toPath(value) {
55636 if (isArray(value)) {
55640 baseToString(value).replace(rePropName, function(match, number, quote, string) {
55641 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
55647 * Creates a clone of `wrapper`.
55651 * wrapper The wrapper to clone.
55652 * @returns {Object} Returns the cloned wrapper.
55654 function wrapperClone(wrapper) {
55655 return wrapper instanceof LazyWrapper ? wrapper.clone() : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
55658 /*------------------------------------------------------------------------*/
55661 * Creates an array of elements split into groups the length of `size`. If
55662 * `collection` can't be split evenly, the final chunk will be the remaining
55669 * array The array to process.
55671 * [size=1] The length of each chunk.
55672 * @param- {Object} [guard] Enables use as a callback for functions like
55674 * @returns {Array} Returns the new array containing chunks.
55677 * _.chunk(['a', 'b', 'c', 'd'], 2); // => [['a', 'b'], ['c', 'd']]
55679 * _.chunk(['a', 'b', 'c', 'd'], 3); // => [['a', 'b', 'c'], ['d']]
55681 function chunk(array, size, guard) {
55682 if (guard ? isIterateeCall(array, size, guard) : size == null) {
55685 size = nativeMax(nativeFloor(size) || 1, 1);
55688 length = array ? array.length : 0,
55690 result = Array(nativeCeil(length / size));
55692 while (index < length) {
55693 result[++resIndex] = baseSlice(array, index, (index += size));
55699 * Creates an array with all falsey values removed. The values `false`,
55700 * `null`, `0`, `""`, `undefined`, and `NaN` are falsey.
55706 * array The array to compact.
55707 * @returns {Array} Returns the new array of filtered values.
55710 * _.compact([0, 1, false, 2, '', 3]); // => [1, 2, 3]
55712 function compact(array) {
55714 length = array ? array.length : 0,
55718 while (++index < length) {
55719 var value = array[index];
55721 result[++resIndex] = value;
55728 * Creates an array of unique `array` values not included in the other
55729 * provided arrays using
55730 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
55731 * for equality comparisons.
55737 * array The array to inspect.
55738 * @param {...Array}
55739 * [values] The arrays of values to exclude.
55740 * @returns {Array} Returns the new array of filtered values.
55743 * _.difference([1, 2, 3], [4, 2]); // => [1, 3]
55745 var difference = restParam(function(array, values) {
55746 return (isObjectLike(array) && isArrayLike(array)) ? baseDifference(array, baseFlatten(values, false, true)) : [];
55750 * Creates a slice of `array` with `n` elements dropped from the beginning.
55756 * array The array to query.
55758 * [n=1] The number of elements to drop.
55759 * @param- {Object} [guard] Enables use as a callback for functions like
55761 * @returns {Array} Returns the slice of `array`.
55764 * _.drop([1, 2, 3]); // => [2, 3]
55766 * _.drop([1, 2, 3], 2); // => [3]
55768 * _.drop([1, 2, 3], 5); // => []
55770 * _.drop([1, 2, 3], 0); // => [1, 2, 3]
55772 function drop(array, n, guard) {
55773 var length = array ? array.length : 0;
55777 if (guard ? isIterateeCall(array, n, guard) : n == null) {
55780 return baseSlice(array, n < 0 ? 0 : n);
55784 * Creates a slice of `array` with `n` elements dropped from the end.
55790 * array The array to query.
55792 * [n=1] The number of elements to drop.
55793 * @param- {Object} [guard] Enables use as a callback for functions like
55795 * @returns {Array} Returns the slice of `array`.
55798 * _.dropRight([1, 2, 3]); // => [1, 2]
55800 * _.dropRight([1, 2, 3], 2); // => [1]
55802 * _.dropRight([1, 2, 3], 5); // => []
55804 * _.dropRight([1, 2, 3], 0); // => [1, 2, 3]
55806 function dropRight(array, n, guard) {
55807 var length = array ? array.length : 0;
55811 if (guard ? isIterateeCall(array, n, guard) : n == null) {
55814 n = length - (+n || 0);
55815 return baseSlice(array, 0, n < 0 ? 0 : n);
55819 * Creates a slice of `array` excluding elements dropped from the end.
55820 * Elements are dropped until `predicate` returns falsey. The predicate is
55821 * bound to `thisArg` and invoked with three arguments: (value, index,
55824 * If a property name is provided for `predicate` the created `_.property`
55825 * style callback returns the property value of the given element.
55827 * If a value is also provided for `thisArg` the created `_.matchesProperty`
55828 * style callback returns `true` for elements that have a matching property
55829 * value, else `false`.
55831 * If an object is provided for `predicate` the created `_.matches` style
55832 * callback returns `true` for elements that match the properties of the
55833 * given object, else `false`.
55839 * array The array to query.
55840 * @param {Function|Object|string}
55841 * [predicate=_.identity] The function invoked per iteration.
55843 * [thisArg] The `this` binding of `predicate`.
55844 * @returns {Array} Returns the slice of `array`.
55847 * _.dropRightWhile([1, 2, 3], function(n) { return n > 1; }); // => [1]
55849 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
55850 * 'active': false }, { 'user': 'pebbles', 'active': false } ];
55851 * // using the `_.matches` callback shorthand
55852 * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }),
55853 * 'user'); // => ['barney', 'fred']
55854 * // using the `_.matchesProperty` callback shorthand
55855 * _.pluck(_.dropRightWhile(users, 'active', false), 'user'); // =>
55857 * // using the `_.property` callback shorthand
55858 * _.pluck(_.dropRightWhile(users, 'active'), 'user'); // => ['barney',
55859 * 'fred', 'pebbles']
55861 function dropRightWhile(array, predicate, thisArg) {
55862 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true) : [];
55866 * Creates a slice of `array` excluding elements dropped from the beginning.
55867 * Elements are dropped until `predicate` returns falsey. The predicate is
55868 * bound to `thisArg` and invoked with three arguments: (value, index,
55871 * If a property name is provided for `predicate` the created `_.property`
55872 * style callback returns the property value of the given element.
55874 * If a value is also provided for `thisArg` the created `_.matchesProperty`
55875 * style callback returns `true` for elements that have a matching property
55876 * value, else `false`.
55878 * If an object is provided for `predicate` the created `_.matches` style
55879 * callback returns `true` for elements that have the properties of the
55880 * given object, else `false`.
55886 * array The array to query.
55887 * @param {Function|Object|string}
55888 * [predicate=_.identity] The function invoked per iteration.
55890 * [thisArg] The `this` binding of `predicate`.
55891 * @returns {Array} Returns the slice of `array`.
55894 * _.dropWhile([1, 2, 3], function(n) { return n < 3; }); // => [3]
55896 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
55897 * 'active': false }, { 'user': 'pebbles', 'active': true } ];
55898 * // using the `_.matches` callback shorthand _.pluck(_.dropWhile(users, {
55899 * 'user': 'barney', 'active': false }), 'user'); // => ['fred', 'pebbles']
55900 * // using the `_.matchesProperty` callback shorthand
55901 * _.pluck(_.dropWhile(users, 'active', false), 'user'); // => ['pebbles']
55902 * // using the `_.property` callback shorthand _.pluck(_.dropWhile(users,
55903 * 'active'), 'user'); // => ['barney', 'fred', 'pebbles']
55905 function dropWhile(array, predicate, thisArg) {
55906 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3), true) : [];
55910 * Fills elements of `array` with `value` from `start` up to, but not
55911 * including, `end`.
55913 * **Note:** This method mutates `array`.
55919 * array The array to fill.
55921 * value The value to fill `array` with.
55923 * [start=0] The start position.
55925 * [end=array.length] The end position.
55926 * @returns {Array} Returns `array`.
55929 * var array = [1, 2, 3];
55931 * _.fill(array, 'a'); console.log(array); // => ['a', 'a', 'a']
55933 * _.fill(Array(3), 2); // => [2, 2, 2]
55935 * _.fill([4, 6, 8], '*', 1, 2); // => [4, '*', 8]
55937 function fill(array, value, start, end) {
55938 var length = array ? array.length : 0;
55942 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
55946 return baseFill(array, value, start, end);
55950 * This method is like `_.find` except that it returns the index of the
55951 * first element `predicate` returns truthy for instead of the element
55954 * If a property name is provided for `predicate` the created `_.property`
55955 * style callback returns the property value of the given element.
55957 * If a value is also provided for `thisArg` the created `_.matchesProperty`
55958 * style callback returns `true` for elements that have a matching property
55959 * value, else `false`.
55961 * If an object is provided for `predicate` the created `_.matches` style
55962 * callback returns `true` for elements that have the properties of the
55963 * given object, else `false`.
55969 * array The array to search.
55970 * @param {Function|Object|string}
55971 * [predicate=_.identity] The function invoked per iteration.
55973 * [thisArg] The `this` binding of `predicate`.
55974 * @returns {number} Returns the index of the found element, else `-1`.
55977 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
55978 * 'active': false }, { 'user': 'pebbles', 'active': true } ];
55980 * _.findIndex(users, function(chr) { return chr.user == 'barney'; }); // =>
55982 * // using the `_.matches` callback shorthand _.findIndex(users, { 'user':
55983 * 'fred', 'active': false }); // => 1
55984 * // using the `_.matchesProperty` callback shorthand _.findIndex(users,
55985 * 'active', false); // => 0
55986 * // using the `_.property` callback shorthand _.findIndex(users,
55987 * 'active'); // => 2
55989 var findIndex = createFindIndex();
55992 * This method is like `_.findIndex` except that it iterates over elements
55993 * of `collection` from right to left.
55995 * If a property name is provided for `predicate` the created `_.property`
55996 * style callback returns the property value of the given element.
55998 * If a value is also provided for `thisArg` the created `_.matchesProperty`
55999 * style callback returns `true` for elements that have a matching property
56000 * value, else `false`.
56002 * If an object is provided for `predicate` the created `_.matches` style
56003 * callback returns `true` for elements that have the properties of the
56004 * given object, else `false`.
56010 * array The array to search.
56011 * @param {Function|Object|string}
56012 * [predicate=_.identity] The function invoked per iteration.
56014 * [thisArg] The `this` binding of `predicate`.
56015 * @returns {number} Returns the index of the found element, else `-1`.
56018 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
56019 * 'active': false }, { 'user': 'pebbles', 'active': false } ];
56021 * _.findLastIndex(users, function(chr) { return chr.user == 'pebbles'; }); // =>
56023 * // using the `_.matches` callback shorthand _.findLastIndex(users, {
56024 * 'user': 'barney', 'active': true }); // => 0
56025 * // using the `_.matchesProperty` callback shorthand
56026 * _.findLastIndex(users, 'active', false); // => 2
56027 * // using the `_.property` callback shorthand _.findLastIndex(users,
56028 * 'active'); // => 0
56030 var findLastIndex = createFindIndex(true);
56033 * Gets the first element of `array`.
56040 * array The array to query.
56041 * @returns {*} Returns the first element of `array`.
56044 * _.first([1, 2, 3]); // => 1
56046 * _.first([]); // => undefined
56048 function first(array) {
56049 return array ? array[0] : undefined;
56053 * Flattens a nested array. If `isDeep` is `true` the array is recursively
56054 * flattened, otherwise it is only flattened a single level.
56060 * array The array to flatten.
56062 * [isDeep] Specify a deep flatten.
56063 * @param- {Object} [guard] Enables use as a callback for functions like
56065 * @returns {Array} Returns the new flattened array.
56068 * _.flatten([1, [2, 3, [4]]]); // => [1, 2, 3, [4]]
56069 * // using `isDeep` _.flatten([1, [2, 3, [4]]], true); // => [1, 2, 3, 4]
56071 function flatten(array, isDeep, guard) {
56072 var length = array ? array.length : 0;
56073 if (guard && isIterateeCall(array, isDeep, guard)) {
56076 return length ? baseFlatten(array, isDeep) : [];
56080 * Recursively flattens a nested array.
56086 * array The array to recursively flatten.
56087 * @returns {Array} Returns the new flattened array.
56090 * _.flattenDeep([1, [2, 3, [4]]]); // => [1, 2, 3, 4]
56092 function flattenDeep(array) {
56093 var length = array ? array.length : 0;
56094 return length ? baseFlatten(array, true) : [];
56098 * Gets the index at which the first occurrence of `value` is found in
56100 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56101 * for equality comparisons. If `fromIndex` is negative, it is used as the
56102 * offset from the end of `array`. If `array` is sorted providing `true` for
56103 * `fromIndex` performs a faster binary search.
56109 * array The array to search.
56111 * value The value to search for.
56112 * @param {boolean|number}
56113 * [fromIndex=0] The index to search from or `true` to perform a
56114 * binary search on a sorted array.
56115 * @returns {number} Returns the index of the matched value, else `-1`.
56118 * _.indexOf([1, 2, 1, 2], 2); // => 1
56119 * // using `fromIndex` _.indexOf([1, 2, 1, 2], 2, 2); // => 3
56120 * // performing a binary search _.indexOf([1, 1, 2, 2], 2, true); // => 2
56122 function indexOf(array, value, fromIndex) {
56123 var length = array ? array.length : 0;
56127 if (typeof fromIndex == 'number') {
56128 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
56129 } else if (fromIndex) {
56130 var index = binaryIndex(array, value);
56131 if (index < length &&
56132 (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
56137 return baseIndexOf(array, value, fromIndex || 0);
56141 * Gets all but the last element of `array`.
56147 * array The array to query.
56148 * @returns {Array} Returns the slice of `array`.
56151 * _.initial([1, 2, 3]); // => [1, 2]
56153 function initial(array) {
56154 return dropRight(array, 1);
56158 * Creates an array of unique values that are included in all of the
56159 * provided arrays using
56160 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56161 * for equality comparisons.
56166 * @param {...Array}
56167 * [arrays] The arrays to inspect.
56168 * @returns {Array} Returns the new array of shared values.
56169 * @example _.intersection([1, 2], [4, 2], [2, 1]); // => [2]
56171 var intersection = restParam(function(arrays) {
56172 var othLength = arrays.length,
56173 othIndex = othLength,
56174 caches = Array(length),
56175 indexOf = getIndexOf(),
56176 isCommon = indexOf == baseIndexOf,
56179 while (othIndex--) {
56180 var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
56181 caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
56183 var array = arrays[0],
56185 length = array ? array.length : 0,
56189 while (++index < length) {
56190 value = array[index];
56191 if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
56192 var othIndex = othLength;
56193 while (--othIndex) {
56194 var cache = caches[othIndex];
56195 if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
56202 result.push(value);
56209 * Gets the last element of `array`.
56215 * array The array to query.
56216 * @returns {*} Returns the last element of `array`.
56219 * _.last([1, 2, 3]); // => 3
56221 function last(array) {
56222 var length = array ? array.length : 0;
56223 return length ? array[length - 1] : undefined;
56227 * This method is like `_.indexOf` except that it iterates over elements of
56228 * `array` from right to left.
56234 * array The array to search.
56236 * value The value to search for.
56237 * @param {boolean|number}
56238 * [fromIndex=array.length-1] The index to search from or `true`
56239 * to perform a binary search on a sorted array.
56240 * @returns {number} Returns the index of the matched value, else `-1`.
56243 * _.lastIndexOf([1, 2, 1, 2], 2); // => 3
56244 * // using `fromIndex` _.lastIndexOf([1, 2, 1, 2], 2, 2); // => 1
56245 * // performing a binary search _.lastIndexOf([1, 1, 2, 2], 2, true); // =>
56248 function lastIndexOf(array, value, fromIndex) {
56249 var length = array ? array.length : 0;
56253 var index = length;
56254 if (typeof fromIndex == 'number') {
56255 index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;
56256 } else if (fromIndex) {
56257 index = binaryIndex(array, value, true) - 1;
56258 var other = array[index];
56259 if (value === value ? (value === other) : (other !== other)) {
56264 if (value !== value) {
56265 return indexOfNaN(array, index, true);
56268 if (array[index] === value) {
56276 * Removes all provided values from `array` using
56277 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56278 * for equality comparisons.
56280 * **Note:** Unlike `_.without`, this method mutates `array`.
56286 * array The array to modify.
56288 * [values] The values to remove.
56289 * @returns {Array} Returns `array`.
56292 * var array = [1, 2, 3, 1, 2, 3];
56294 * _.pull(array, 2, 3); console.log(array); // => [1, 1]
56297 var args = arguments,
56300 if (!(array && array.length)) {
56304 indexOf = getIndexOf(),
56305 length = args.length;
56307 while (++index < length) {
56309 value = args[index];
56311 while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
56312 splice.call(array, fromIndex, 1);
56319 * Removes elements from `array` corresponding to the given indexes and
56320 * returns an array of the removed elements. Indexes may be specified as an
56321 * array of indexes or as individual arguments.
56323 * **Note:** Unlike `_.at`, this method mutates `array`.
56329 * array The array to modify.
56330 * @param {...(number|number[])}
56331 * [indexes] The indexes of elements to remove, specified as
56332 * individual indexes or arrays of indexes.
56333 * @returns {Array} Returns the new array of removed elements.
56336 * var array = [5, 10, 15, 20]; var evens = _.pullAt(array, 1, 3);
56338 * console.log(array); // => [5, 15]
56340 * console.log(evens); // => [10, 20]
56342 var pullAt = restParam(function(array, indexes) {
56343 indexes = baseFlatten(indexes);
56345 var result = baseAt(array, indexes);
56346 basePullAt(array, indexes.sort(baseCompareAscending));
56351 * Removes all elements from `array` that `predicate` returns truthy for and
56352 * returns an array of the removed elements. The predicate is bound to
56353 * `thisArg` and invoked with three arguments: (value, index, array).
56355 * If a property name is provided for `predicate` the created `_.property`
56356 * style callback returns the property value of the given element.
56358 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56359 * style callback returns `true` for elements that have a matching property
56360 * value, else `false`.
56362 * If an object is provided for `predicate` the created `_.matches` style
56363 * callback returns `true` for elements that have the properties of the
56364 * given object, else `false`.
56366 * **Note:** Unlike `_.filter`, this method mutates `array`.
56372 * array The array to modify.
56373 * @param {Function|Object|string}
56374 * [predicate=_.identity] The function invoked per iteration.
56376 * [thisArg] The `this` binding of `predicate`.
56377 * @returns {Array} Returns the new array of removed elements.
56380 * var array = [1, 2, 3, 4]; var evens = _.remove(array, function(n) {
56381 * return n % 2 == 0; });
56383 * console.log(array); // => [1, 3]
56385 * console.log(evens); // => [2, 4]
56387 function remove(array, predicate, thisArg) {
56389 if (!(array && array.length)) {
56394 length = array.length;
56396 predicate = getCallback(predicate, thisArg, 3);
56397 while (++index < length) {
56398 var value = array[index];
56399 if (predicate(value, index, array)) {
56400 result.push(value);
56401 indexes.push(index);
56404 basePullAt(array, indexes);
56409 * Gets all but the first element of `array`.
56416 * array The array to query.
56417 * @returns {Array} Returns the slice of `array`.
56420 * _.rest([1, 2, 3]); // => [2, 3]
56422 function rest(array) {
56423 return drop(array, 1);
56427 * Creates a slice of `array` from `start` up to, but not including, `end`.
56429 * **Note:** This method is used instead of `Array#slice` to support node
56430 * lists in IE < 9 and to ensure dense arrays are returned.
56436 * array The array to slice.
56438 * [start=0] The start position.
56440 * [end=array.length] The end position.
56441 * @returns {Array} Returns the slice of `array`.
56443 function slice(array, start, end) {
56444 var length = array ? array.length : 0;
56448 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
56452 return baseSlice(array, start, end);
56456 * Uses a binary search to determine the lowest index at which `value`
56457 * should be inserted into `array` in order to maintain its sort order. If
56458 * an iteratee function is provided it is invoked for `value` and each
56459 * element of `array` to compute their sort ranking. The iteratee is bound
56460 * to `thisArg` and invoked with one argument; (value).
56462 * If a property name is provided for `iteratee` the created `_.property`
56463 * style callback returns the property value of the given element.
56465 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56466 * style callback returns `true` for elements that have a matching property
56467 * value, else `false`.
56469 * If an object is provided for `iteratee` the created `_.matches` style
56470 * callback returns `true` for elements that have the properties of the
56471 * given object, else `false`.
56477 * array The sorted array to inspect.
56479 * value The value to evaluate.
56480 * @param {Function|Object|string}
56481 * [iteratee=_.identity] The function invoked per iteration.
56483 * [thisArg] The `this` binding of `iteratee`.
56484 * @returns {number} Returns the index at which `value` should be inserted
56488 * _.sortedIndex([30, 50], 40); // => 1
56490 * _.sortedIndex([4, 4, 5, 5], 5); // => 2
56492 * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
56493 * // using an iteratee function _.sortedIndex(['thirty', 'fifty'],
56494 * 'forty', function(word) { return this.data[word]; }, dict); // => 1
56495 * // using the `_.property` callback shorthand _.sortedIndex([{ 'x': 30 }, {
56496 * 'x': 50 }], { 'x': 40 }, 'x'); // => 1
56498 var sortedIndex = createSortedIndex();
56501 * This method is like `_.sortedIndex` except that it returns the highest
56502 * index at which `value` should be inserted into `array` in order to
56503 * maintain its sort order.
56509 * array The sorted array to inspect.
56511 * value The value to evaluate.
56512 * @param {Function|Object|string}
56513 * [iteratee=_.identity] The function invoked per iteration.
56515 * [thisArg] The `this` binding of `iteratee`.
56516 * @returns {number} Returns the index at which `value` should be inserted
56520 * _.sortedLastIndex([4, 4, 5, 5], 5); // => 4
56522 var sortedLastIndex = createSortedIndex(true);
56525 * Creates a slice of `array` with `n` elements taken from the beginning.
56531 * array The array to query.
56533 * [n=1] The number of elements to take.
56534 * @param- {Object} [guard] Enables use as a callback for functions like
56536 * @returns {Array} Returns the slice of `array`.
56539 * _.take([1, 2, 3]); // => [1]
56541 * _.take([1, 2, 3], 2); // => [1, 2]
56543 * _.take([1, 2, 3], 5); // => [1, 2, 3]
56545 * _.take([1, 2, 3], 0); // => []
56547 function take(array, n, guard) {
56548 var length = array ? array.length : 0;
56552 if (guard ? isIterateeCall(array, n, guard) : n == null) {
56555 return baseSlice(array, 0, n < 0 ? 0 : n);
56559 * Creates a slice of `array` with `n` elements taken from the end.
56565 * array The array to query.
56567 * [n=1] The number of elements to take.
56568 * @param- {Object} [guard] Enables use as a callback for functions like
56570 * @returns {Array} Returns the slice of `array`.
56573 * _.takeRight([1, 2, 3]); // => [3]
56575 * _.takeRight([1, 2, 3], 2); // => [2, 3]
56577 * _.takeRight([1, 2, 3], 5); // => [1, 2, 3]
56579 * _.takeRight([1, 2, 3], 0); // => []
56581 function takeRight(array, n, guard) {
56582 var length = array ? array.length : 0;
56586 if (guard ? isIterateeCall(array, n, guard) : n == null) {
56589 n = length - (+n || 0);
56590 return baseSlice(array, n < 0 ? 0 : n);
56594 * Creates a slice of `array` with elements taken from the end. Elements are
56595 * taken until `predicate` returns falsey. The predicate is bound to
56596 * `thisArg` and invoked with three arguments: (value, index, array).
56598 * If a property name is provided for `predicate` the created `_.property`
56599 * style callback returns the property value of the given element.
56601 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56602 * style callback returns `true` for elements that have a matching property
56603 * value, else `false`.
56605 * If an object is provided for `predicate` the created `_.matches` style
56606 * callback returns `true` for elements that have the properties of the
56607 * given object, else `false`.
56613 * array The array to query.
56614 * @param {Function|Object|string}
56615 * [predicate=_.identity] The function invoked per iteration.
56617 * [thisArg] The `this` binding of `predicate`.
56618 * @returns {Array} Returns the slice of `array`.
56621 * _.takeRightWhile([1, 2, 3], function(n) { return n > 1; }); // => [2, 3]
56623 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
56624 * 'active': false }, { 'user': 'pebbles', 'active': false } ];
56625 * // using the `_.matches` callback shorthand
56626 * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }),
56627 * 'user'); // => ['pebbles']
56628 * // using the `_.matchesProperty` callback shorthand
56629 * _.pluck(_.takeRightWhile(users, 'active', false), 'user'); // => ['fred',
56631 * // using the `_.property` callback shorthand
56632 * _.pluck(_.takeRightWhile(users, 'active'), 'user'); // => []
56634 function takeRightWhile(array, predicate, thisArg) {
56635 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true) : [];
56639 * Creates a slice of `array` with elements taken from the beginning.
56640 * Elements are taken until `predicate` returns falsey. The predicate is
56641 * bound to `thisArg` and invoked with three arguments: (value, index,
56644 * If a property name is provided for `predicate` the created `_.property`
56645 * style callback returns the property value of the given element.
56647 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56648 * style callback returns `true` for elements that have a matching property
56649 * value, else `false`.
56651 * If an object is provided for `predicate` the created `_.matches` style
56652 * callback returns `true` for elements that have the properties of the
56653 * given object, else `false`.
56659 * array The array to query.
56660 * @param {Function|Object|string}
56661 * [predicate=_.identity] The function invoked per iteration.
56663 * [thisArg] The `this` binding of `predicate`.
56664 * @returns {Array} Returns the slice of `array`.
56667 * _.takeWhile([1, 2, 3], function(n) { return n < 3; }); // => [1, 2]
56669 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
56670 * 'active': false}, { 'user': 'pebbles', 'active': true } ];
56671 * // using the `_.matches` callback shorthand _.pluck(_.takeWhile(users, {
56672 * 'user': 'barney', 'active': false }), 'user'); // => ['barney']
56673 * // using the `_.matchesProperty` callback shorthand
56674 * _.pluck(_.takeWhile(users, 'active', false), 'user'); // => ['barney',
56676 * // using the `_.property` callback shorthand _.pluck(_.takeWhile(users,
56677 * 'active'), 'user'); // => []
56679 function takeWhile(array, predicate, thisArg) {
56680 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3)) : [];
56684 * Creates an array of unique values, in order, from all of the provided
56686 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56687 * for equality comparisons.
56692 * @param {...Array}
56693 * [arrays] The arrays to inspect.
56694 * @returns {Array} Returns the new array of combined values.
56697 * _.union([1, 2], [4, 2], [2, 1]); // => [1, 2, 4]
56699 var union = restParam(function(arrays) {
56700 return baseUniq(baseFlatten(arrays, false, true));
56704 * Creates a duplicate-free version of an array, using
56705 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56706 * for equality comparisons, in which only the first occurence of each
56707 * element is kept. Providing `true` for `isSorted` performs a faster search
56708 * algorithm for sorted arrays. If an iteratee function is provided it is
56709 * invoked for each element in the array to generate the criterion by which
56710 * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked
56711 * with three arguments: (value, index, array).
56713 * If a property name is provided for `iteratee` the created `_.property`
56714 * style callback returns the property value of the given element.
56716 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56717 * style callback returns `true` for elements that have a matching property
56718 * value, else `false`.
56720 * If an object is provided for `iteratee` the created `_.matches` style
56721 * callback returns `true` for elements that have the properties of the
56722 * given object, else `false`.
56729 * array The array to inspect.
56731 * [isSorted] Specify the array is sorted.
56732 * @param {Function|Object|string}
56733 * [iteratee] The function invoked per iteration.
56735 * [thisArg] The `this` binding of `iteratee`.
56736 * @returns {Array} Returns the new duplicate-value-free array.
56739 * _.uniq([2, 1, 2]); // => [2, 1]
56740 * // using `isSorted` _.uniq([1, 1, 2], true); // => [1, 2]
56741 * // using an iteratee function _.uniq([1, 2.5, 1.5, 2], function(n) {
56742 * return this.floor(n); }, Math); // => [1, 2.5]
56743 * // using the `_.property` callback shorthand _.uniq([{ 'x': 1 }, { 'x':
56744 * 2 }, { 'x': 1 }], 'x'); // => [{ 'x': 1 }, { 'x': 2 }]
56746 function uniq(array, isSorted, iteratee, thisArg) {
56747 var length = array ? array.length : 0;
56751 if (isSorted != null && typeof isSorted != 'boolean') {
56752 thisArg = iteratee;
56753 iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
56756 var callback = getCallback();
56757 if (!(iteratee == null && callback === baseCallback)) {
56758 iteratee = callback(iteratee, thisArg, 3);
56760 return (isSorted && getIndexOf() == baseIndexOf) ? sortedUniq(array, iteratee) : baseUniq(array, iteratee);
56764 * This method is like `_.zip` except that it accepts an array of grouped
56765 * elements and creates an array regrouping the elements to their pre-zip
56772 * array The array of grouped elements to process.
56773 * @returns {Array} Returns the new array of regrouped elements.
56776 * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); // =>
56777 * [['fred', 30, true], ['barney', 40, false]]
56779 * _.unzip(zipped); // => [['fred', 'barney'], [30, 40], [true, false]]
56781 function unzip(array) {
56782 if (!(array && array.length)) {
56788 array = arrayFilter(array, function(group) {
56789 if (isArrayLike(group)) {
56790 length = nativeMax(group.length, length);
56794 var result = Array(length);
56795 while (++index < length) {
56796 result[index] = arrayMap(array, baseProperty(index));
56802 * This method is like `_.unzip` except that it accepts an iteratee to
56803 * specify how regrouped values should be combined. The `iteratee` is bound
56804 * to `thisArg` and invoked with four arguments: (accumulator, value, index,
56811 * array The array of grouped elements to process.
56812 * @param {Function}
56813 * [iteratee] The function to combine regrouped values.
56815 * [thisArg] The `this` binding of `iteratee`.
56816 * @returns {Array} Returns the new array of regrouped elements.
56819 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); // => [[1, 10, 100],
56822 * _.unzipWith(zipped, _.add); // => [3, 30, 300]
56824 function unzipWith(array, iteratee, thisArg) {
56825 var length = array ? array.length : 0;
56829 var result = unzip(array);
56830 if (iteratee == null) {
56833 iteratee = bindCallback(iteratee, thisArg, 4);
56834 return arrayMap(result, function(group) {
56835 return arrayReduce(group, iteratee, undefined, true);
56840 * Creates an array excluding all provided values using
56841 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56842 * for equality comparisons.
56848 * array The array to filter.
56850 * [values] The values to exclude.
56851 * @returns {Array} Returns the new array of filtered values.
56854 * _.without([1, 2, 1, 3], 1, 2); // => [3]
56856 var without = restParam(function(array, values) {
56857 return isArrayLike(array) ? baseDifference(array, values) : [];
56861 * Creates an array of unique values that is the [symmetric
56862 * difference](https://en.wikipedia.org/wiki/Symmetric_difference) of the
56868 * @param {...Array}
56869 * [arrays] The arrays to inspect.
56870 * @returns {Array} Returns the new array of values.
56873 * _.xor([1, 2], [4, 2]); // => [1, 4]
56877 length = arguments.length;
56879 while (++index < length) {
56880 var array = arguments[index];
56881 if (isArrayLike(array)) {
56882 var result = result ? arrayPush(baseDifference(result, array), baseDifference(array, result)) : array;
56885 return result ? baseUniq(result) : [];
56889 * Creates an array of grouped elements, the first of which contains the
56890 * first elements of the given arrays, the second of which contains the
56891 * second elements of the given arrays, and so on.
56896 * @param {...Array}
56897 * [arrays] The arrays to process.
56898 * @returns {Array} Returns the new array of grouped elements.
56901 * _.zip(['fred', 'barney'], [30, 40], [true, false]); // => [['fred', 30,
56902 * true], ['barney', 40, false]]
56904 var zip = restParam(unzip);
56907 * The inverse of `_.pairs`; this method returns an object composed from
56908 * arrays of property names and values. Provide either a single two
56909 * dimensional array, e.g. `[[key1, value1], [key2, value2]]` or two arrays,
56910 * one of property names and one of corresponding values.
56917 * props The property names.
56919 * [values=[]] The property values.
56920 * @returns {Object} Returns the new object.
56923 * _.zipObject([['fred', 30], ['barney', 40]]); // => { 'fred': 30,
56926 * _.zipObject(['fred', 'barney'], [30, 40]); // => { 'fred': 30, 'barney':
56929 function zipObject(props, values) {
56931 length = props ? props.length : 0,
56934 if (length && !values && !isArray(props[0])) {
56937 while (++index < length) {
56938 var key = props[index];
56940 result[key] = values[index];
56942 result[key[0]] = key[1];
56949 * This method is like `_.zip` except that it accepts an iteratee to specify
56950 * how grouped values should be combined. The `iteratee` is bound to
56951 * `thisArg` and invoked with four arguments: (accumulator, value, index,
56957 * @param {...Array}
56958 * [arrays] The arrays to process.
56959 * @param {Function}
56960 * [iteratee] The function to combine grouped values.
56962 * [thisArg] The `this` binding of `iteratee`.
56963 * @returns {Array} Returns the new array of grouped elements.
56966 * _.zipWith([1, 2], [10, 20], [100, 200], _.add); // => [111, 222]
56968 var zipWith = restParam(function(arrays) {
56969 var length = arrays.length,
56970 iteratee = length > 2 ? arrays[length - 2] : undefined,
56971 thisArg = length > 1 ? arrays[length - 1] : undefined;
56973 if (length > 2 && typeof iteratee == 'function') {
56976 iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
56977 thisArg = undefined;
56979 arrays.length = length;
56980 return unzipWith(arrays, iteratee, thisArg);
56983 /*------------------------------------------------------------------------*/
56986 * Creates a `lodash` object that wraps `value` with explicit method
56987 * chaining enabled.
56993 * value The value to wrap.
56994 * @returns {Object} Returns the new `lodash` wrapper instance.
56997 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
56998 * 40 }, { 'user': 'pebbles', 'age': 1 } ];
57000 * var youngest = _.chain(users) .sortBy('age') .map(function(chr) { return
57001 * chr.user + ' is ' + chr.age; }) .first() .value(); // => 'pebbles is 1'
57003 function chain(value) {
57004 var result = lodash(value);
57005 result.__chain__ = true;
57010 * This method invokes `interceptor` and returns `value`. The interceptor is
57011 * bound to `thisArg` and invoked with one argument; (value). The purpose of
57012 * this method is to "tap into" a method chain in order to perform
57013 * operations on intermediate results within the chain.
57019 * value The value to provide to `interceptor`.
57020 * @param {Function}
57021 * interceptor The function to invoke.
57023 * [thisArg] The `this` binding of `interceptor`.
57024 * @returns {*} Returns `value`.
57027 * _([1, 2, 3]) .tap(function(array) { array.pop(); }) .reverse() .value(); // =>
57030 function tap(value, interceptor, thisArg) {
57031 interceptor.call(thisArg, value);
57036 * This method is like `_.tap` except that it returns the result of
57043 * value The value to provide to `interceptor`.
57044 * @param {Function}
57045 * interceptor The function to invoke.
57047 * [thisArg] The `this` binding of `interceptor`.
57048 * @returns {*} Returns the result of `interceptor`.
57051 * _(' abc ') .chain() .trim() .thru(function(value) { return [value]; })
57052 * .value(); // => ['abc']
57054 function thru(value, interceptor, thisArg) {
57055 return interceptor.call(thisArg, value);
57059 * Enables explicit method chaining on the wrapper object.
57064 * @returns {Object} Returns the new `lodash` wrapper instance.
57067 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
57069 * // without explicit chaining _(users).first(); // => { 'user': 'barney',
57071 * // with explicit chaining _(users).chain() .first() .pick('user')
57072 * .value(); // => { 'user': 'barney' }
57074 function wrapperChain() {
57075 return chain(this);
57079 * Executes the chained sequence and returns the wrapped result.
57084 * @returns {Object} Returns the new `lodash` wrapper instance.
57087 * var array = [1, 2]; var wrapped = _(array).push(3);
57089 * console.log(array); // => [1, 2]
57091 * wrapped = wrapped.commit(); console.log(array); // => [1, 2, 3]
57093 * wrapped.last(); // => 3
57095 * console.log(array); // => [1, 2, 3]
57097 function wrapperCommit() {
57098 return new LodashWrapper(this.value(), this.__chain__);
57102 * Creates a new array joining a wrapped array with any additional arrays
57109 * [values] The values to concatenate.
57110 * @returns {Array} Returns the new concatenated array.
57113 * var array = [1]; var wrapped = _(array).concat(2, [3], [[4]]);
57115 * console.log(wrapped.value()); // => [1, 2, 3, [4]]
57117 * console.log(array); // => [1]
57119 var wrapperConcat = restParam(function(values) {
57120 values = baseFlatten(values);
57121 return this.thru(function(array) {
57122 return arrayConcat(isArray(array) ? array : [toObject(array)], values);
57127 * Creates a clone of the chained sequence planting `value` as the wrapped
57133 * @returns {Object} Returns the new `lodash` wrapper instance.
57136 * var array = [1, 2]; var wrapped = _(array).map(function(value) { return
57137 * Math.pow(value, 2); });
57139 * var other = [3, 4]; var otherWrapped = wrapped.plant(other);
57141 * otherWrapped.value(); // => [9, 16]
57143 * wrapped.value(); // => [1, 4]
57145 function wrapperPlant(value) {
57149 while (parent instanceof baseLodash) {
57150 var clone = wrapperClone(parent);
57152 previous.__wrapped__ = clone;
57156 var previous = clone;
57157 parent = parent.__wrapped__;
57159 previous.__wrapped__ = value;
57164 * Reverses the wrapped array so the first element becomes the last, the
57165 * second element becomes the second to last, and so on.
57167 * **Note:** This method mutates the wrapped array.
57172 * @returns {Object} Returns the new reversed `lodash` wrapper instance.
57175 * var array = [1, 2, 3];
57177 * _(array).reverse().value() // => [3, 2, 1]
57179 * console.log(array); // => [3, 2, 1]
57181 function wrapperReverse() {
57182 var value = this.__wrapped__;
57184 var interceptor = function(value) {
57185 return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
57187 if (value instanceof LazyWrapper) {
57188 var wrapped = value;
57189 if (this.__actions__.length) {
57190 wrapped = new LazyWrapper(this);
57192 wrapped = wrapped.reverse();
57193 wrapped.__actions__.push({
57195 'args': [interceptor],
57196 'thisArg': undefined
57198 return new LodashWrapper(wrapped, this.__chain__);
57200 return this.thru(interceptor);
57204 * Produces the result of coercing the unwrapped value to a string.
57209 * @returns {string} Returns the coerced string value.
57212 * _([1, 2, 3]).toString(); // => '1,2,3'
57214 function wrapperToString() {
57215 return (this.value() + '');
57219 * Executes the chained sequence to extract the unwrapped value.
57223 * @alias run, toJSON, valueOf
57225 * @returns {*} Returns the resolved unwrapped value.
57228 * _([1, 2, 3]).value(); // => [1, 2, 3]
57230 function wrapperValue() {
57231 return baseWrapperValue(this.__wrapped__, this.__actions__);
57234 /*------------------------------------------------------------------------*/
57237 * Creates an array of elements corresponding to the given keys, or indexes,
57238 * of `collection`. Keys may be specified as individual arguments or as
57243 * @category Collection
57244 * @param {Array|Object|string}
57245 * collection The collection to iterate over.
57246 * @param {...(number|number[]|string|string[])}
57247 * [props] The property names or indexes of elements to pick,
57248 * specified individually or in arrays.
57249 * @returns {Array} Returns the new array of picked elements.
57252 * _.at(['a', 'b', 'c'], [0, 2]); // => ['a', 'c']
57254 * _.at(['barney', 'fred', 'pebbles'], 0, 2); // => ['barney', 'pebbles']
57256 var at = restParam(function(collection, props) {
57257 return baseAt(collection, baseFlatten(props));
57261 * Creates an object composed of keys generated from the results of running
57262 * each element of `collection` through `iteratee`. The corresponding value
57263 * of each key is the number of times the key was returned by `iteratee`.
57264 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
57265 * (value, index|key, collection).
57267 * If a property name is provided for `iteratee` the created `_.property`
57268 * style callback returns the property value of the given element.
57270 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57271 * style callback returns `true` for elements that have a matching property
57272 * value, else `false`.
57274 * If an object is provided for `iteratee` the created `_.matches` style
57275 * callback returns `true` for elements that have the properties of the
57276 * given object, else `false`.
57280 * @category Collection
57281 * @param {Array|Object|string}
57282 * collection The collection to iterate over.
57283 * @param {Function|Object|string}
57284 * [iteratee=_.identity] The function invoked per iteration.
57286 * [thisArg] The `this` binding of `iteratee`.
57287 * @returns {Object} Returns the composed aggregate object.
57290 * _.countBy([4.3, 6.1, 6.4], function(n) { return Math.floor(n); }); // => {
57293 * _.countBy([4.3, 6.1, 6.4], function(n) { return this.floor(n); }, Math); // => {
57296 * _.countBy(['one', 'two', 'three'], 'length'); // => { '3': 2, '5': 1 }
57298 var countBy = createAggregator(function(result, value, key) {
57299 hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);
57303 * Checks if `predicate` returns truthy for **all** elements of
57304 * `collection`. The predicate is bound to `thisArg` and invoked with three
57305 * arguments: (value, index|key, collection).
57307 * If a property name is provided for `predicate` the created `_.property`
57308 * style callback returns the property value of the given element.
57310 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57311 * style callback returns `true` for elements that have a matching property
57312 * value, else `false`.
57314 * If an object is provided for `predicate` the created `_.matches` style
57315 * callback returns `true` for elements that have the properties of the
57316 * given object, else `false`.
57321 * @category Collection
57322 * @param {Array|Object|string}
57323 * collection The collection to iterate over.
57324 * @param {Function|Object|string}
57325 * [predicate=_.identity] The function invoked per iteration.
57327 * [thisArg] The `this` binding of `predicate`.
57328 * @returns {boolean} Returns `true` if all elements pass the predicate
57329 * check, else `false`.
57332 * _.every([true, 1, null, 'yes'], Boolean); // => false
57334 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
57335 * 'active': false } ];
57336 * // using the `_.matches` callback shorthand _.every(users, { 'user':
57337 * 'barney', 'active': false }); // => false
57338 * // using the `_.matchesProperty` callback shorthand _.every(users,
57339 * 'active', false); // => true
57340 * // using the `_.property` callback shorthand _.every(users, 'active'); // =>
57343 function every(collection, predicate, thisArg) {
57344 var func = isArray(collection) ? arrayEvery : baseEvery;
57345 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
57346 predicate = undefined;
57348 if (typeof predicate != 'function' || thisArg !== undefined) {
57349 predicate = getCallback(predicate, thisArg, 3);
57351 return func(collection, predicate);
57355 * Iterates over elements of `collection`, returning an array of all
57356 * elements `predicate` returns truthy for. The predicate is bound to
57357 * `thisArg` and invoked with three arguments: (value, index|key,
57360 * If a property name is provided for `predicate` the created `_.property`
57361 * style callback returns the property value of the given element.
57363 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57364 * style callback returns `true` for elements that have a matching property
57365 * value, else `false`.
57367 * If an object is provided for `predicate` the created `_.matches` style
57368 * callback returns `true` for elements that have the properties of the
57369 * given object, else `false`.
57374 * @category Collection
57375 * @param {Array|Object|string}
57376 * collection The collection to iterate over.
57377 * @param {Function|Object|string}
57378 * [predicate=_.identity] The function invoked per iteration.
57380 * [thisArg] The `this` binding of `predicate`.
57381 * @returns {Array} Returns the new filtered array.
57384 * _.filter([4, 5, 6], function(n) { return n % 2 == 0; }); // => [4, 6]
57386 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
57387 * 'fred', 'age': 40, 'active': false } ];
57388 * // using the `_.matches` callback shorthand _.pluck(_.filter(users, {
57389 * 'age': 36, 'active': true }), 'user'); // => ['barney']
57390 * // using the `_.matchesProperty` callback shorthand
57391 * _.pluck(_.filter(users, 'active', false), 'user'); // => ['fred']
57392 * // using the `_.property` callback shorthand _.pluck(_.filter(users,
57393 * 'active'), 'user'); // => ['barney']
57395 function filter(collection, predicate, thisArg) {
57396 var func = isArray(collection) ? arrayFilter : baseFilter;
57397 predicate = getCallback(predicate, thisArg, 3);
57398 return func(collection, predicate);
57402 * Iterates over elements of `collection`, returning the first element
57403 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
57404 * invoked with three arguments: (value, index|key, collection).
57406 * If a property name is provided for `predicate` the created `_.property`
57407 * style callback returns the property value of the given element.
57409 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57410 * style callback returns `true` for elements that have a matching property
57411 * value, else `false`.
57413 * If an object is provided for `predicate` the created `_.matches` style
57414 * callback returns `true` for elements that have the properties of the
57415 * given object, else `false`.
57420 * @category Collection
57421 * @param {Array|Object|string}
57422 * collection The collection to search.
57423 * @param {Function|Object|string}
57424 * [predicate=_.identity] The function invoked per iteration.
57426 * [thisArg] The `this` binding of `predicate`.
57427 * @returns {*} Returns the matched element, else `undefined`.
57430 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
57431 * 'fred', 'age': 40, 'active': false }, { 'user': 'pebbles', 'age': 1,
57432 * 'active': true } ];
57434 * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); // =>
57436 * // using the `_.matches` callback shorthand _.result(_.find(users, {
57437 * 'age': 1, 'active': true }), 'user'); // => 'pebbles'
57438 * // using the `_.matchesProperty` callback shorthand
57439 * _.result(_.find(users, 'active', false), 'user'); // => 'fred'
57440 * // using the `_.property` callback shorthand _.result(_.find(users,
57441 * 'active'), 'user'); // => 'barney'
57443 var find = createFind(baseEach);
57446 * This method is like `_.find` except that it iterates over elements of
57447 * `collection` from right to left.
57451 * @category Collection
57452 * @param {Array|Object|string}
57453 * collection The collection to search.
57454 * @param {Function|Object|string}
57455 * [predicate=_.identity] The function invoked per iteration.
57457 * [thisArg] The `this` binding of `predicate`.
57458 * @returns {*} Returns the matched element, else `undefined`.
57461 * _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; }); // => 3
57463 var findLast = createFind(baseEachRight, true);
57466 * Performs a deep comparison between each element in `collection` and the
57467 * source object, returning the first element that has equivalent property
57470 * **Note:** This method supports comparing arrays, booleans, `Date`
57471 * objects, numbers, `Object` objects, regexes, and strings. Objects are
57472 * compared by their own, not inherited, enumerable properties. For
57473 * comparing a single own or inherited property value see
57474 * `_.matchesProperty`.
57478 * @category Collection
57479 * @param {Array|Object|string}
57480 * collection The collection to search.
57482 * source The object of property values to match.
57483 * @returns {*} Returns the matched element, else `undefined`.
57486 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
57487 * 'fred', 'age': 40, 'active': false } ];
57489 * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); // =>
57492 * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); // =>
57495 function findWhere(collection, source) {
57496 return find(collection, baseMatches(source));
57500 * Iterates over elements of `collection` invoking `iteratee` for each
57501 * element. The `iteratee` is bound to `thisArg` and invoked with three
57502 * arguments: (value, index|key, collection). Iteratee functions may exit
57503 * iteration early by explicitly returning `false`.
57505 * **Note:** As with other "Collections" methods, objects with a "length"
57506 * property are iterated like arrays. To avoid this behavior `_.forIn` or
57507 * `_.forOwn` may be used for object iteration.
57512 * @category Collection
57513 * @param {Array|Object|string}
57514 * collection The collection to iterate over.
57515 * @param {Function}
57516 * [iteratee=_.identity] The function invoked per iteration.
57518 * [thisArg] The `this` binding of `iteratee`.
57519 * @returns {Array|Object|string} Returns `collection`.
57522 * _([1, 2]).forEach(function(n) { console.log(n); }).value(); // => logs
57523 * each value from left to right and returns the array
57525 * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { console.log(n, key); }); // =>
57526 * logs each value-key pair and returns the object (iteration order is not
57529 var forEach = createForEach(arrayEach, baseEach);
57532 * This method is like `_.forEach` except that it iterates over elements of
57533 * `collection` from right to left.
57538 * @category Collection
57539 * @param {Array|Object|string}
57540 * collection The collection to iterate over.
57541 * @param {Function}
57542 * [iteratee=_.identity] The function invoked per iteration.
57544 * [thisArg] The `this` binding of `iteratee`.
57545 * @returns {Array|Object|string} Returns `collection`.
57548 * _([1, 2]).forEachRight(function(n) { console.log(n); }).value(); // =>
57549 * logs each value from right to left and returns the array
57551 var forEachRight = createForEach(arrayEachRight, baseEachRight);
57554 * Creates an object composed of keys generated from the results of running
57555 * each element of `collection` through `iteratee`. The corresponding value
57556 * of each key is an array of the elements responsible for generating the
57557 * key. The `iteratee` is bound to `thisArg` and invoked with three
57558 * arguments: (value, index|key, collection).
57560 * If a property name is provided for `iteratee` the created `_.property`
57561 * style callback returns the property value of the given element.
57563 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57564 * style callback returns `true` for elements that have a matching property
57565 * value, else `false`.
57567 * If an object is provided for `iteratee` the created `_.matches` style
57568 * callback returns `true` for elements that have the properties of the
57569 * given object, else `false`.
57573 * @category Collection
57574 * @param {Array|Object|string}
57575 * collection The collection to iterate over.
57576 * @param {Function|Object|string}
57577 * [iteratee=_.identity] The function invoked per iteration.
57579 * [thisArg] The `this` binding of `iteratee`.
57580 * @returns {Object} Returns the composed aggregate object.
57583 * _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); }); // => {
57584 * '4': [4.2], '6': [6.1, 6.4] }
57586 * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); // => {
57587 * '4': [4.2], '6': [6.1, 6.4] }
57588 * // using the `_.property` callback shorthand _.groupBy(['one', 'two',
57589 * 'three'], 'length'); // => { '3': ['one', 'two'], '5': ['three'] }
57591 var groupBy = createAggregator(function(result, value, key) {
57592 if (hasOwnProperty.call(result, key)) {
57593 result[key].push(value);
57595 result[key] = [value];
57600 * Checks if `value` is in `collection` using
57601 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
57602 * for equality comparisons. If `fromIndex` is negative, it is used as the
57603 * offset from the end of `collection`.
57607 * @alias contains, include
57608 * @category Collection
57609 * @param {Array|Object|string}
57610 * collection The collection to search.
57612 * target The value to search for.
57614 * [fromIndex=0] The index to search from.
57615 * @param- {Object} [guard] Enables use as a callback for functions like
57617 * @returns {boolean} Returns `true` if a matching element is found, else
57621 * _.includes([1, 2, 3], 1); // => true
57623 * _.includes([1, 2, 3], 1, 2); // => false
57625 * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); // => true
57627 * _.includes('pebbles', 'eb'); // => true
57629 function includes(collection, target, fromIndex, guard) {
57630 var length = collection ? getLength(collection) : 0;
57631 if (!isLength(length)) {
57632 collection = values(collection);
57633 length = collection.length;
57635 if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
57638 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
57640 return (typeof collection == 'string' || !isArray(collection) && isString(collection)) ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) : (!!length && getIndexOf(collection, target, fromIndex) > -1);
57644 * Creates an object composed of keys generated from the results of running
57645 * each element of `collection` through `iteratee`. The corresponding value
57646 * of each key is the last element responsible for generating the key. The
57647 * iteratee function is bound to `thisArg` and invoked with three arguments:
57648 * (value, index|key, collection).
57650 * If a property name is provided for `iteratee` the created `_.property`
57651 * style callback returns the property value of the given element.
57653 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57654 * style callback returns `true` for elements that have a matching property
57655 * value, else `false`.
57657 * If an object is provided for `iteratee` the created `_.matches` style
57658 * callback returns `true` for elements that have the properties of the
57659 * given object, else `false`.
57663 * @category Collection
57664 * @param {Array|Object|string}
57665 * collection The collection to iterate over.
57666 * @param {Function|Object|string}
57667 * [iteratee=_.identity] The function invoked per iteration.
57669 * [thisArg] The `this` binding of `iteratee`.
57670 * @returns {Object} Returns the composed aggregate object.
57673 * var keyData = [ { 'dir': 'left', 'code': 97 }, { 'dir': 'right', 'code':
57676 * _.indexBy(keyData, 'dir'); // => { 'left': { 'dir': 'left', 'code': 97 },
57677 * 'right': { 'dir': 'right', 'code': 100 } }
57679 * _.indexBy(keyData, function(object) { return
57680 * String.fromCharCode(object.code); }); // => { 'a': { 'dir': 'left',
57681 * 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
57683 * _.indexBy(keyData, function(object) { return
57684 * this.fromCharCode(object.code); }, String); // => { 'a': { 'dir': 'left',
57685 * 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
57687 var indexBy = createAggregator(function(result, value, key) {
57688 result[key] = value;
57692 * Invokes the method at `path` of each element in `collection`, returning
57693 * an array of the results of each invoked method. Any additional arguments
57694 * are provided to each invoked method. If `methodName` is a function it is
57695 * invoked for, and `this` bound to, each element in `collection`.
57699 * @category Collection
57700 * @param {Array|Object|string}
57701 * collection The collection to iterate over.
57702 * @param {Array|Function|string}
57703 * path The path of the method to invoke or the function invoked
57706 * [args] The arguments to invoke the method with.
57707 * @returns {Array} Returns the array of results.
57710 * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); // => [[1, 5, 7], [1, 2, 3]]
57712 * _.invoke([123, 456], String.prototype.split, ''); // => [['1', '2', '3'],
57715 var invoke = restParam(function(collection, path, args) {
57717 isFunc = typeof path == 'function',
57718 isProp = isKey(path),
57719 result = isArrayLike(collection) ? Array(collection.length) : [];
57721 baseEach(collection, function(value) {
57722 var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
57723 result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
57729 * Creates an array of values by running each element in `collection`
57730 * through `iteratee`. The `iteratee` is bound to `thisArg` and invoked with
57731 * three arguments: (value, index|key, collection).
57733 * If a property name is provided for `iteratee` the created `_.property`
57734 * style callback returns the property value of the given element.
57736 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57737 * style callback returns `true` for elements that have a matching property
57738 * value, else `false`.
57740 * If an object is provided for `iteratee` the created `_.matches` style
57741 * callback returns `true` for elements that have the properties of the
57742 * given object, else `false`.
57744 * Many lodash methods are guarded to work as iteratees for methods like
57745 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
57747 * The guarded methods are: `ary`, `callback`, `chunk`, `clone`, `create`,
57748 * `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, `flatten`,
57749 * `invert`, `max`, `min`, `parseInt`, `slice`, `sortBy`, `take`,
57750 * `takeRight`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
57751 * `random`, `range`, `sample`, `some`, `sum`, `uniq`, and `words`
57756 * @category Collection
57757 * @param {Array|Object|string}
57758 * collection The collection to iterate over.
57759 * @param {Function|Object|string}
57760 * [iteratee=_.identity] The function invoked per iteration.
57762 * [thisArg] The `this` binding of `iteratee`.
57763 * @returns {Array} Returns the new mapped array.
57766 * function timesThree(n) { return n * 3; }
57768 * _.map([1, 2], timesThree); // => [3, 6]
57770 * _.map({ 'a': 1, 'b': 2 }, timesThree); // => [3, 6] (iteration order is
57773 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
57774 * // using the `_.property` callback shorthand _.map(users, 'user'); // =>
57775 * ['barney', 'fred']
57777 function map(collection, iteratee, thisArg) {
57778 var func = isArray(collection) ? arrayMap : baseMap;
57779 iteratee = getCallback(iteratee, thisArg, 3);
57780 return func(collection, iteratee);
57784 * Creates an array of elements split into two groups, the first of which
57785 * contains elements `predicate` returns truthy for, while the second of
57786 * which contains elements `predicate` returns falsey for. The predicate is
57787 * bound to `thisArg` and invoked with three arguments: (value, index|key,
57790 * If a property name is provided for `predicate` the created `_.property`
57791 * style callback returns the property value of the given element.
57793 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57794 * style callback returns `true` for elements that have a matching property
57795 * value, else `false`.
57797 * If an object is provided for `predicate` the created `_.matches` style
57798 * callback returns `true` for elements that have the properties of the
57799 * given object, else `false`.
57803 * @category Collection
57804 * @param {Array|Object|string}
57805 * collection The collection to iterate over.
57806 * @param {Function|Object|string}
57807 * [predicate=_.identity] The function invoked per iteration.
57809 * [thisArg] The `this` binding of `predicate`.
57810 * @returns {Array} Returns the array of grouped elements.
57813 * _.partition([1, 2, 3], function(n) { return n % 2; }); // => [[1, 3],
57816 * _.partition([1.2, 2.3, 3.4], function(n) { return this.floor(n) % 2; },
57817 * Math); // => [[1.2, 3.4], [2.3]]
57819 * var users = [ { 'user': 'barney', 'age': 36, 'active': false }, { 'user':
57820 * 'fred', 'age': 40, 'active': true }, { 'user': 'pebbles', 'age': 1,
57821 * 'active': false } ];
57823 * var mapper = function(array) { return _.pluck(array, 'user'); };
57824 * // using the `_.matches` callback shorthand _.map(_.partition(users, {
57825 * 'age': 1, 'active': false }), mapper); // => [['pebbles'], ['barney',
57827 * // using the `_.matchesProperty` callback shorthand
57828 * _.map(_.partition(users, 'active', false), mapper); // => [['barney',
57829 * 'pebbles'], ['fred']]
57830 * // using the `_.property` callback shorthand _.map(_.partition(users,
57831 * 'active'), mapper); // => [['fred'], ['barney', 'pebbles']]
57833 var partition = createAggregator(function(result, value, key) {
57834 result[key ? 0 : 1].push(value);
57843 * Gets the property value of `path` from all elements in `collection`.
57847 * @category Collection
57848 * @param {Array|Object|string}
57849 * collection The collection to iterate over.
57850 * @param {Array|string}
57851 * path The path of the property to pluck.
57852 * @returns {Array} Returns the property values.
57855 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
57858 * _.pluck(users, 'user'); // => ['barney', 'fred']
57860 * var userIndex = _.indexBy(users, 'user'); _.pluck(userIndex, 'age'); // =>
57861 * [36, 40] (iteration order is not guaranteed)
57863 function pluck(collection, path) {
57864 return map(collection, property(path));
57868 * Reduces `collection` to a value which is the accumulated result of
57869 * running each element in `collection` through `iteratee`, where each
57870 * successive invocation is supplied the return value of the previous. If
57871 * `accumulator` is not provided the first element of `collection` is used
57872 * as the initial value. The `iteratee` is bound to `thisArg` and invoked
57873 * with four arguments: (accumulator, value, index|key, collection).
57875 * Many lodash methods are guarded to work as iteratees for methods like
57876 * `_.reduce`, `_.reduceRight`, and `_.transform`.
57878 * The guarded methods are: `assign`, `defaults`, `defaultsDeep`,
57879 * `includes`, `merge`, `sortByAll`, and `sortByOrder`
57883 * @alias foldl, inject
57884 * @category Collection
57885 * @param {Array|Object|string}
57886 * collection The collection to iterate over.
57887 * @param {Function}
57888 * [iteratee=_.identity] The function invoked per iteration.
57890 * [accumulator] The initial value.
57892 * [thisArg] The `this` binding of `iteratee`.
57893 * @returns {*} Returns the accumulated value.
57896 * _.reduce([1, 2], function(total, n) { return total + n; }); // => 3
57898 * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { result[key] = n *
57899 * 3; return result; }, {}); // => { 'a': 3, 'b': 6 } (iteration order is
57902 var reduce = createReduce(arrayReduce, baseEach);
57905 * This method is like `_.reduce` except that it iterates over elements of
57906 * `collection` from right to left.
57911 * @category Collection
57912 * @param {Array|Object|string}
57913 * collection The collection to iterate over.
57914 * @param {Function}
57915 * [iteratee=_.identity] The function invoked per iteration.
57917 * [accumulator] The initial value.
57919 * [thisArg] The `this` binding of `iteratee`.
57920 * @returns {*} Returns the accumulated value.
57923 * var array = [[0, 1], [2, 3], [4, 5]];
57925 * _.reduceRight(array, function(flattened, other) { return
57926 * flattened.concat(other); }, []); // => [4, 5, 2, 3, 0, 1]
57928 var reduceRight = createReduce(arrayReduceRight, baseEachRight);
57931 * The opposite of `_.filter`; this method returns the elements of
57932 * `collection` that `predicate` does **not** return truthy for.
57936 * @category Collection
57937 * @param {Array|Object|string}
57938 * collection The collection to iterate over.
57939 * @param {Function|Object|string}
57940 * [predicate=_.identity] The function invoked per iteration.
57942 * [thisArg] The `this` binding of `predicate`.
57943 * @returns {Array} Returns the new filtered array.
57946 * _.reject([1, 2, 3, 4], function(n) { return n % 2 == 0; }); // => [1, 3]
57948 * var users = [ { 'user': 'barney', 'age': 36, 'active': false }, { 'user':
57949 * 'fred', 'age': 40, 'active': true } ];
57950 * // using the `_.matches` callback shorthand _.pluck(_.reject(users, {
57951 * 'age': 40, 'active': true }), 'user'); // => ['barney']
57952 * // using the `_.matchesProperty` callback shorthand
57953 * _.pluck(_.reject(users, 'active', false), 'user'); // => ['fred']
57954 * // using the `_.property` callback shorthand _.pluck(_.reject(users,
57955 * 'active'), 'user'); // => ['barney']
57957 function reject(collection, predicate, thisArg) {
57958 var func = isArray(collection) ? arrayFilter : baseFilter;
57959 predicate = getCallback(predicate, thisArg, 3);
57960 return func(collection, function(value, index, collection) {
57961 return !predicate(value, index, collection);
57966 * Gets a random element or `n` random elements from a collection.
57970 * @category Collection
57971 * @param {Array|Object|string}
57972 * collection The collection to sample.
57974 * [n] The number of elements to sample.
57975 * @param- {Object} [guard] Enables use as a callback for functions like
57977 * @returns {*} Returns the random sample(s).
57980 * _.sample([1, 2, 3, 4]); // => 2
57982 * _.sample([1, 2, 3, 4], 2); // => [3, 1]
57984 function sample(collection, n, guard) {
57985 if (guard ? isIterateeCall(collection, n, guard) : n == null) {
57986 collection = toIterable(collection);
57987 var length = collection.length;
57988 return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
57991 result = toArray(collection),
57992 length = result.length,
57993 lastIndex = length - 1;
57995 n = nativeMin(n < 0 ? 0 : (+n || 0), length);
57996 while (++index < n) {
57997 var rand = baseRandom(index, lastIndex),
57998 value = result[rand];
58000 result[rand] = result[index];
58001 result[index] = value;
58008 * Creates an array of shuffled values, using a version of the [Fisher-Yates
58009 * shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
58013 * @category Collection
58014 * @param {Array|Object|string}
58015 * collection The collection to shuffle.
58016 * @returns {Array} Returns the new shuffled array.
58019 * _.shuffle([1, 2, 3, 4]); // => [4, 1, 3, 2]
58021 function shuffle(collection) {
58022 return sample(collection, POSITIVE_INFINITY);
58026 * Gets the size of `collection` by returning its length for array-like
58027 * values or the number of own enumerable properties for objects.
58031 * @category Collection
58032 * @param {Array|Object|string}
58033 * collection The collection to inspect.
58034 * @returns {number} Returns the size of `collection`.
58037 * _.size([1, 2, 3]); // => 3
58039 * _.size({ 'a': 1, 'b': 2 }); // => 2
58041 * _.size('pebbles'); // => 7
58043 function size(collection) {
58044 var length = collection ? getLength(collection) : 0;
58045 return isLength(length) ? length : keys(collection).length;
58049 * Checks if `predicate` returns truthy for **any** element of `collection`.
58050 * The function returns as soon as it finds a passing value and does not
58051 * iterate over the entire collection. The predicate is bound to `thisArg`
58052 * and invoked with three arguments: (value, index|key, collection).
58054 * If a property name is provided for `predicate` the created `_.property`
58055 * style callback returns the property value of the given element.
58057 * If a value is also provided for `thisArg` the created `_.matchesProperty`
58058 * style callback returns `true` for elements that have a matching property
58059 * value, else `false`.
58061 * If an object is provided for `predicate` the created `_.matches` style
58062 * callback returns `true` for elements that have the properties of the
58063 * given object, else `false`.
58068 * @category Collection
58069 * @param {Array|Object|string}
58070 * collection The collection to iterate over.
58071 * @param {Function|Object|string}
58072 * [predicate=_.identity] The function invoked per iteration.
58074 * [thisArg] The `this` binding of `predicate`.
58075 * @returns {boolean} Returns `true` if any element passes the predicate
58076 * check, else `false`.
58079 * _.some([null, 0, 'yes', false], Boolean); // => true
58081 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
58082 * 'active': false } ];
58083 * // using the `_.matches` callback shorthand _.some(users, { 'user':
58084 * 'barney', 'active': false }); // => false
58085 * // using the `_.matchesProperty` callback shorthand _.some(users,
58086 * 'active', false); // => true
58087 * // using the `_.property` callback shorthand _.some(users, 'active'); // =>
58090 function some(collection, predicate, thisArg) {
58091 var func = isArray(collection) ? arraySome : baseSome;
58092 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
58093 predicate = undefined;
58095 if (typeof predicate != 'function' || thisArg !== undefined) {
58096 predicate = getCallback(predicate, thisArg, 3);
58098 return func(collection, predicate);
58102 * Creates an array of elements, sorted in ascending order by the results of
58103 * running each element in a collection through `iteratee`. This method
58104 * performs a stable sort, that is, it preserves the original sort order of
58105 * equal elements. The `iteratee` is bound to `thisArg` and invoked with
58106 * three arguments: (value, index|key, collection).
58108 * If a property name is provided for `iteratee` the created `_.property`
58109 * style callback returns the property value of the given element.
58111 * If a value is also provided for `thisArg` the created `_.matchesProperty`
58112 * style callback returns `true` for elements that have a matching property
58113 * value, else `false`.
58115 * If an object is provided for `iteratee` the created `_.matches` style
58116 * callback returns `true` for elements that have the properties of the
58117 * given object, else `false`.
58121 * @category Collection
58122 * @param {Array|Object|string}
58123 * collection The collection to iterate over.
58124 * @param {Function|Object|string}
58125 * [iteratee=_.identity] The function invoked per iteration.
58127 * [thisArg] The `this` binding of `iteratee`.
58128 * @returns {Array} Returns the new sorted array.
58131 * _.sortBy([1, 2, 3], function(n) { return Math.sin(n); }); // => [3, 1, 2]
58133 * _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math); // => [3,
58136 * var users = [ { 'user': 'fred' }, { 'user': 'pebbles' }, { 'user':
58138 * // using the `_.property` callback shorthand _.pluck(_.sortBy(users,
58139 * 'user'), 'user'); // => ['barney', 'fred', 'pebbles']
58141 function sortBy(collection, iteratee, thisArg) {
58142 if (collection == null) {
58145 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
58146 iteratee = undefined;
58149 iteratee = getCallback(iteratee, thisArg, 3);
58151 var result = baseMap(collection, function(value, key, collection) {
58153 'criteria': iteratee(value, key, collection),
58158 return baseSortBy(result, compareAscending);
58162 * This method is like `_.sortBy` except that it can sort by multiple
58163 * iteratees or property names.
58165 * If a property name is provided for an iteratee the created `_.property`
58166 * style callback returns the property value of the given element.
58168 * If an object is provided for an iteratee the created `_.matches` style
58169 * callback returns `true` for elements that have the properties of the
58170 * given object, else `false`.
58174 * @category Collection
58175 * @param {Array|Object|string}
58176 * collection The collection to iterate over.
58177 * @param {...(Function|Function[]|Object|Object[]|string|string[])}
58178 * iteratees The iteratees to sort by, specified as individual
58179 * values or arrays of values.
58180 * @returns {Array} Returns the new sorted array.
58183 * var users = [ { 'user': 'fred', 'age': 48 }, { 'user': 'barney', 'age':
58184 * 36 }, { 'user': 'fred', 'age': 42 }, { 'user': 'barney', 'age': 34 } ];
58186 * _.map(_.sortByAll(users, ['user', 'age']), _.values); // => [['barney',
58187 * 34], ['barney', 36], ['fred', 42], ['fred', 48]]
58189 * _.map(_.sortByAll(users, 'user', function(chr) { return
58190 * Math.floor(chr.age / 10); }), _.values); // => [['barney', 36],
58191 * ['barney', 34], ['fred', 48], ['fred', 42]]
58193 var sortByAll = restParam(function(collection, iteratees) {
58194 if (collection == null) {
58197 var guard = iteratees[2];
58198 if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {
58199 iteratees.length = 1;
58201 return baseSortByOrder(collection, baseFlatten(iteratees), []);
58205 * This method is like `_.sortByAll` except that it allows specifying the
58206 * sort orders of the iteratees to sort by. If `orders` is unspecified, all
58207 * values are sorted in ascending order. Otherwise, a value is sorted in
58208 * ascending order if its corresponding order is "asc", and descending if
58211 * If a property name is provided for an iteratee the created `_.property`
58212 * style callback returns the property value of the given element.
58214 * If an object is provided for an iteratee the created `_.matches` style
58215 * callback returns `true` for elements that have the properties of the
58216 * given object, else `false`.
58220 * @category Collection
58221 * @param {Array|Object|string}
58222 * collection The collection to iterate over.
58223 * @param {Function[]|Object[]|string[]}
58224 * iteratees The iteratees to sort by.
58225 * @param {boolean[]}
58226 * [orders] The sort orders of `iteratees`.
58227 * @param- {Object} [guard] Enables use as a callback for functions like
58229 * @returns {Array} Returns the new sorted array.
58232 * var users = [ { 'user': 'fred', 'age': 48 }, { 'user': 'barney', 'age':
58233 * 34 }, { 'user': 'fred', 'age': 42 }, { 'user': 'barney', 'age': 36 } ];
58234 * // sort by `user` in ascending order and by `age` in descending order
58235 * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values); // =>
58236 * [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
58238 function sortByOrder(collection, iteratees, orders, guard) {
58239 if (collection == null) {
58242 if (guard && isIterateeCall(iteratees, orders, guard)) {
58243 orders = undefined;
58245 if (!isArray(iteratees)) {
58246 iteratees = iteratees == null ? [] : [iteratees];
58248 if (!isArray(orders)) {
58249 orders = orders == null ? [] : [orders];
58251 return baseSortByOrder(collection, iteratees, orders);
58255 * Performs a deep comparison between each element in `collection` and the
58256 * source object, returning an array of all elements that have equivalent
58259 * **Note:** This method supports comparing arrays, booleans, `Date`
58260 * objects, numbers, `Object` objects, regexes, and strings. Objects are
58261 * compared by their own, not inherited, enumerable properties. For
58262 * comparing a single own or inherited property value see
58263 * `_.matchesProperty`.
58267 * @category Collection
58268 * @param {Array|Object|string}
58269 * collection The collection to search.
58271 * source The object of property values to match.
58272 * @returns {Array} Returns the new filtered array.
58275 * var users = [ { 'user': 'barney', 'age': 36, 'active': false, 'pets':
58276 * ['hoppy'] }, { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby
58277 * puss', 'dino'] } ];
58279 * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); // =>
58282 * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); // => ['fred']
58284 function where(collection, source) {
58285 return filter(collection, baseMatches(source));
58288 /*------------------------------------------------------------------------*/
58291 * Gets the number of milliseconds that have elapsed since the Unix epoch (1
58292 * January 1970 00:00:00 UTC).
58299 * _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now()); // =>
58300 * logs the number of milliseconds it took for the deferred function to be
58303 var now = nativeNow || function() {
58304 return new Date().getTime();
58307 /*------------------------------------------------------------------------*/
58310 * The opposite of `_.before`; this method creates a function that invokes
58311 * `func` once it is called `n` or more times.
58315 * @category Function
58317 * n The number of calls before `func` is invoked.
58318 * @param {Function}
58319 * func The function to restrict.
58320 * @returns {Function} Returns the new restricted function.
58323 * var saves = ['profile', 'settings'];
58325 * var done = _.after(saves.length, function() { console.log('done
58328 * _.forEach(saves, function(type) { asyncSave({ 'type': type, 'complete':
58329 * done }); }); // => logs 'done saving!' after the two async saves have
58332 function after(n, func) {
58333 if (typeof func != 'function') {
58334 if (typeof n == 'function') {
58339 throw new TypeError(FUNC_ERROR_TEXT);
58342 n = nativeIsFinite(n = +n) ? n : 0;
58343 return function() {
58345 return func.apply(this, arguments);
58351 * Creates a function that accepts up to `n` arguments ignoring any
58352 * additional arguments.
58356 * @category Function
58357 * @param {Function}
58358 * func The function to cap arguments for.
58360 * [n=func.length] The arity cap.
58361 * @param- {Object} [guard] Enables use as a callback for functions like
58363 * @returns {Function} Returns the new function.
58366 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); // => [6, 8, 10]
58368 function ary(func, n, guard) {
58369 if (guard && isIterateeCall(func, n, guard)) {
58372 n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
58373 return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
58377 * Creates a function that invokes `func`, with the `this` binding and
58378 * arguments of the created function, while it is called less than `n`
58379 * times. Subsequent calls to the created function return the result of the
58380 * last `func` invocation.
58384 * @category Function
58386 * n The number of calls at which `func` is no longer invoked.
58387 * @param {Function}
58388 * func The function to restrict.
58389 * @returns {Function} Returns the new restricted function.
58392 * jQuery('#add').on('click', _.before(5, addContactToList)); // => allows
58393 * adding up to 4 contacts to the list
58395 function before(n, func) {
58397 if (typeof func != 'function') {
58398 if (typeof n == 'function') {
58403 throw new TypeError(FUNC_ERROR_TEXT);
58406 return function() {
58408 result = func.apply(this, arguments);
58418 * Creates a function that invokes `func` with the `this` binding of
58419 * `thisArg` and prepends any additional `_.bind` arguments to those
58420 * provided to the bound function.
58422 * The `_.bind.placeholder` value, which defaults to `_` in monolithic
58423 * builds, may be used as a placeholder for partially applied arguments.
58425 * **Note:** Unlike native `Function#bind` this method does not set the
58426 * "length" property of bound functions.
58430 * @category Function
58431 * @param {Function}
58432 * func The function to bind.
58434 * thisArg The `this` binding of `func`.
58436 * [partials] The arguments to be partially applied.
58437 * @returns {Function} Returns the new bound function.
58440 * var greet = function(greeting, punctuation) { return greeting + ' ' +
58441 * this.user + punctuation; };
58443 * var object = { 'user': 'fred' };
58445 * var bound = _.bind(greet, object, 'hi'); bound('!'); // => 'hi fred!'
58446 * // using placeholders var bound = _.bind(greet, object, _, '!');
58447 * bound('hi'); // => 'hi fred!'
58449 var bind = restParam(function(func, thisArg, partials) {
58450 var bitmask = BIND_FLAG;
58451 if (partials.length) {
58452 var holders = replaceHolders(partials, bind.placeholder);
58453 bitmask |= PARTIAL_FLAG;
58455 return createWrapper(func, bitmask, thisArg, partials, holders);
58459 * Binds methods of an object to the object itself, overwriting the existing
58460 * method. Method names may be specified as individual arguments or as
58461 * arrays of method names. If no method names are provided all enumerable
58462 * function properties, own and inherited, of `object` are bound.
58464 * **Note:** This method does not set the "length" property of bound
58469 * @category Function
58471 * object The object to bind and assign the bound methods to.
58472 * @param {...(string|string[])}
58473 * [methodNames] The object method names to bind, specified as
58474 * individual method names or arrays of method names.
58475 * @returns {Object} Returns `object`.
58478 * var view = { 'label': 'docs', 'onClick': function() {
58479 * console.log('clicked ' + this.label); } };
58481 * _.bindAll(view); jQuery('#docs').on('click', view.onClick); // => logs
58482 * 'clicked docs' when the element is clicked
58484 var bindAll = restParam(function(object, methodNames) {
58485 methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);
58488 length = methodNames.length;
58490 while (++index < length) {
58491 var key = methodNames[index];
58492 object[key] = createWrapper(object[key], BIND_FLAG, object);
58498 * Creates a function that invokes the method at `object[key]` and prepends
58499 * any additional `_.bindKey` arguments to those provided to the bound
58502 * This method differs from `_.bind` by allowing bound functions to
58503 * reference methods that may be redefined or don't yet exist. See [Peter
58505 * article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
58506 * for more details.
58508 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
58509 * builds, may be used as a placeholder for partially applied arguments.
58513 * @category Function
58515 * object The object the method belongs to.
58517 * key The key of the method.
58519 * [partials] The arguments to be partially applied.
58520 * @returns {Function} Returns the new bound function.
58523 * var object = { 'user': 'fred', 'greet': function(greeting, punctuation) {
58524 * return greeting + ' ' + this.user + punctuation; } };
58526 * var bound = _.bindKey(object, 'greet', 'hi'); bound('!'); // => 'hi
58529 * object.greet = function(greeting, punctuation) { return greeting + 'ya ' +
58530 * this.user + punctuation; };
58532 * bound('!'); // => 'hiya fred!'
58533 * // using placeholders var bound = _.bindKey(object, 'greet', _, '!');
58534 * bound('hi'); // => 'hiya fred!'
58536 var bindKey = restParam(function(object, key, partials) {
58537 var bitmask = BIND_FLAG | BIND_KEY_FLAG;
58538 if (partials.length) {
58539 var holders = replaceHolders(partials, bindKey.placeholder);
58540 bitmask |= PARTIAL_FLAG;
58542 return createWrapper(key, bitmask, object, partials, holders);
58546 * Creates a function that accepts one or more arguments of `func` that when
58547 * called either invokes `func` returning its result, if all `func`
58548 * arguments have been provided, or returns a function that accepts one or
58549 * more of the remaining `func` arguments, and so on. The arity of `func`
58550 * may be specified if `func.length` is not sufficient.
58552 * The `_.curry.placeholder` value, which defaults to `_` in monolithic
58553 * builds, may be used as a placeholder for provided arguments.
58555 * **Note:** This method does not set the "length" property of curried
58560 * @category Function
58561 * @param {Function}
58562 * func The function to curry.
58564 * [arity=func.length] The arity of `func`.
58565 * @param- {Object} [guard] Enables use as a callback for functions like
58567 * @returns {Function} Returns the new curried function.
58570 * var abc = function(a, b, c) { return [a, b, c]; };
58572 * var curried = _.curry(abc);
58574 * curried(1)(2)(3); // => [1, 2, 3]
58576 * curried(1, 2)(3); // => [1, 2, 3]
58578 * curried(1, 2, 3); // => [1, 2, 3]
58579 * // using placeholders curried(1)(_, 3)(2); // => [1, 2, 3]
58581 var curry = createCurry(CURRY_FLAG);
58584 * This method is like `_.curry` except that arguments are applied to `func`
58585 * in the manner of `_.partialRight` instead of `_.partial`.
58587 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
58588 * builds, may be used as a placeholder for provided arguments.
58590 * **Note:** This method does not set the "length" property of curried
58595 * @category Function
58596 * @param {Function}
58597 * func The function to curry.
58599 * [arity=func.length] The arity of `func`.
58600 * @param- {Object} [guard] Enables use as a callback for functions like
58602 * @returns {Function} Returns the new curried function.
58605 * var abc = function(a, b, c) { return [a, b, c]; };
58607 * var curried = _.curryRight(abc);
58609 * curried(3)(2)(1); // => [1, 2, 3]
58611 * curried(2, 3)(1); // => [1, 2, 3]
58613 * curried(1, 2, 3); // => [1, 2, 3]
58614 * // using placeholders curried(3)(1, _)(2); // => [1, 2, 3]
58616 var curryRight = createCurry(CURRY_RIGHT_FLAG);
58619 * Creates a debounced function that delays invoking `func` until after
58620 * `wait` milliseconds have elapsed since the last time the debounced
58621 * function was invoked. The debounced function comes with a `cancel` method
58622 * to cancel delayed invocations. Provide an options object to indicate that
58623 * `func` should be invoked on the leading and/or trailing edge of the
58624 * `wait` timeout. Subsequent calls to the debounced function return the
58625 * result of the last `func` invocation.
58627 * **Note:** If `leading` and `trailing` options are `true`, `func` is
58628 * invoked on the trailing edge of the timeout only if the the debounced
58629 * function is invoked more than once during the `wait` timeout.
58631 * See [David Corbacho's
58632 * article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
58633 * for details over the differences between `_.debounce` and `_.throttle`.
58637 * @category Function
58638 * @param {Function}
58639 * func The function to debounce.
58641 * [wait=0] The number of milliseconds to delay.
58643 * [options] The options object.
58645 * [options.leading=false] Specify invoking on the leading edge
58648 * [options.maxWait] The maximum time `func` is allowed to be
58649 * delayed before it is invoked.
58651 * [options.trailing=true] Specify invoking on the trailing edge
58653 * @returns {Function} Returns the new debounced function.
58655 * // avoid costly calculations while the window size is in flux
58656 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
58657 * // invoke `sendMail` when the click event is fired, debouncing
58658 * subsequent calls jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
58659 * 'leading': true, 'trailing': false }));
58660 * // ensure `batchLog` is invoked once after 1 second of debounced calls
58661 * var source = new EventSource('/stream'); jQuery(source).on('message',
58662 * _.debounce(batchLog, 250, { 'maxWait': 1000 }));
58663 * // cancel a debounced call var todoChanges = _.debounce(batchLog, 1000);
58664 * Object.observe(models.todo, todoChanges);
58666 * Object.observe(models, function(changes) { if (_.find(changes, { 'user':
58667 * 'todo', 'type': 'delete'})) { todoChanges.cancel(); } }, ['delete']);
58668 * // ...at some point `models.todo` is changed models.todo.completed =
58670 * // ...before 1 second has passed `models.todo` is deleted // which
58671 * cancels the debounced `todoChanges` call delete models.todo;
58673 function debounce(func, wait, options) {
58685 if (typeof func != 'function') {
58686 throw new TypeError(FUNC_ERROR_TEXT);
58688 wait = wait < 0 ? 0 : (+wait || 0);
58689 if (options === true) {
58690 var leading = true;
58692 } else if (isObject(options)) {
58693 leading = !!options.leading;
58694 maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
58695 trailing = 'trailing' in options ? !!options.trailing : trailing;
58698 function cancel() {
58700 clearTimeout(timeoutId);
58702 if (maxTimeoutId) {
58703 clearTimeout(maxTimeoutId);
58706 maxTimeoutId = timeoutId = trailingCall = undefined;
58709 function complete(isCalled, id) {
58713 maxTimeoutId = timeoutId = trailingCall = undefined;
58715 lastCalled = now();
58716 result = func.apply(thisArg, args);
58717 if (!timeoutId && !maxTimeoutId) {
58718 args = thisArg = undefined;
58723 function delayed() {
58724 var remaining = wait - (now() - stamp);
58725 if (remaining <= 0 || remaining > wait) {
58726 complete(trailingCall, maxTimeoutId);
58728 timeoutId = setTimeout(delayed, remaining);
58732 function maxDelayed() {
58733 complete(trailing, timeoutId);
58736 function debounced() {
58740 trailingCall = trailing && (timeoutId || !leading);
58742 if (maxWait === false) {
58743 var leadingCall = leading && !timeoutId;
58745 if (!maxTimeoutId && !leading) {
58746 lastCalled = stamp;
58748 var remaining = maxWait - (stamp - lastCalled),
58749 isCalled = remaining <= 0 || remaining > maxWait;
58752 if (maxTimeoutId) {
58753 maxTimeoutId = clearTimeout(maxTimeoutId);
58755 lastCalled = stamp;
58756 result = func.apply(thisArg, args);
58757 } else if (!maxTimeoutId) {
58758 maxTimeoutId = setTimeout(maxDelayed, remaining);
58761 if (isCalled && timeoutId) {
58762 timeoutId = clearTimeout(timeoutId);
58763 } else if (!timeoutId && wait !== maxWait) {
58764 timeoutId = setTimeout(delayed, wait);
58768 result = func.apply(thisArg, args);
58770 if (isCalled && !timeoutId && !maxTimeoutId) {
58771 args = thisArg = undefined;
58775 debounced.cancel = cancel;
58780 * Defers invoking the `func` until the current call stack has cleared. Any
58781 * additional arguments are provided to `func` when it is invoked.
58785 * @category Function
58786 * @param {Function}
58787 * func The function to defer.
58789 * [args] The arguments to invoke the function with.
58790 * @returns {number} Returns the timer id.
58793 * _.defer(function(text) { console.log(text); }, 'deferred'); // logs
58794 * 'deferred' after one or more milliseconds
58796 var defer = restParam(function(func, args) {
58797 return baseDelay(func, 1, args);
58801 * Invokes `func` after `wait` milliseconds. Any additional arguments are
58802 * provided to `func` when it is invoked.
58806 * @category Function
58807 * @param {Function}
58808 * func The function to delay.
58810 * wait The number of milliseconds to delay invocation.
58812 * [args] The arguments to invoke the function with.
58813 * @returns {number} Returns the timer id.
58816 * _.delay(function(text) { console.log(text); }, 1000, 'later'); // => logs
58817 * 'later' after one second
58819 var delay = restParam(function(func, wait, args) {
58820 return baseDelay(func, wait, args);
58824 * Creates a function that returns the result of invoking the provided
58825 * functions with the `this` binding of the created function, where each
58826 * successive invocation is supplied the return value of the previous.
58830 * @category Function
58831 * @param {...Function}
58832 * [funcs] Functions to invoke.
58833 * @returns {Function} Returns the new function.
58836 * function square(n) { return n * n; }
58838 * var addSquare = _.flow(_.add, square); addSquare(1, 2); // => 9
58840 var flow = createFlow();
58843 * This method is like `_.flow` except that it creates a function that
58844 * invokes the provided functions from right to left.
58848 * @alias backflow, compose
58849 * @category Function
58850 * @param {...Function}
58851 * [funcs] Functions to invoke.
58852 * @returns {Function} Returns the new function.
58855 * function square(n) { return n * n; }
58857 * var addSquare = _.flowRight(square, _.add); addSquare(1, 2); // => 9
58859 var flowRight = createFlow(true);
58862 * Creates a function that memoizes the result of `func`. If `resolver` is
58863 * provided it determines the cache key for storing the result based on the
58864 * arguments provided to the memoized function. By default, the first
58865 * argument provided to the memoized function is coerced to a string and
58866 * used as the cache key. The `func` is invoked with the `this` binding of
58867 * the memoized function.
58869 * **Note:** The cache is exposed as the `cache` property on the memoized
58870 * function. Its creation may be customized by replacing the
58871 * `_.memoize.Cache` constructor with one whose instances implement the
58872 * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
58873 * method interface of `get`, `has`, and `set`.
58877 * @category Function
58878 * @param {Function}
58879 * func The function to have its output memoized.
58880 * @param {Function}
58881 * [resolver] The function to resolve the cache key.
58882 * @returns {Function} Returns the new memoizing function.
58885 * var upperCase = _.memoize(function(string) { return string.toUpperCase();
58888 * upperCase('fred'); // => 'FRED'
58889 * // modifying the result cache upperCase.cache.set('fred', 'BARNEY');
58890 * upperCase('fred'); // => 'BARNEY'
58891 * // replacing `_.memoize.Cache` var object = { 'user': 'fred' }; var
58892 * other = { 'user': 'barney' }; var identity = _.memoize(_.identity);
58894 * identity(object); // => { 'user': 'fred' } identity(other); // => {
58897 * _.memoize.Cache = WeakMap; var identity = _.memoize(_.identity);
58899 * identity(object); // => { 'user': 'fred' } identity(other); // => {
58900 * 'user': 'barney' }
58902 function memoize(func, resolver) {
58903 if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
58904 throw new TypeError(FUNC_ERROR_TEXT);
58906 var memoized = function() {
58907 var args = arguments,
58908 key = resolver ? resolver.apply(this, args) : args[0],
58909 cache = memoized.cache;
58911 if (cache.has(key)) {
58912 return cache.get(key);
58914 var result = func.apply(this, args);
58915 memoized.cache = cache.set(key, result);
58918 memoized.cache = new memoize.Cache;
58923 * Creates a function that runs each argument through a corresponding
58924 * transform function.
58928 * @category Function
58929 * @param {Function}
58930 * func The function to wrap.
58931 * @param {...(Function|Function[])}
58932 * [transforms] The functions to transform arguments, specified
58933 * as individual functions or arrays of functions.
58934 * @returns {Function} Returns the new function.
58937 * function doubled(n) { return n * 2; }
58939 * function square(n) { return n * n; }
58941 * var modded = _.modArgs(function(x, y) { return [x, y]; }, square,
58944 * modded(1, 2); // => [1, 4]
58946 * modded(5, 10); // => [25, 20]
58948 var modArgs = restParam(function(func, transforms) {
58949 transforms = baseFlatten(transforms);
58950 if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {
58951 throw new TypeError(FUNC_ERROR_TEXT);
58953 var length = transforms.length;
58954 return restParam(function(args) {
58955 var index = nativeMin(args.length, length);
58957 args[index] = transforms[index](args[index]);
58959 return func.apply(this, args);
58964 * Creates a function that negates the result of the predicate `func`. The
58965 * `func` predicate is invoked with the `this` binding and arguments of the
58966 * created function.
58970 * @category Function
58971 * @param {Function}
58972 * predicate The predicate to negate.
58973 * @returns {Function} Returns the new function.
58976 * function isEven(n) { return n % 2 == 0; }
58978 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); // => [1, 3, 5]
58980 function negate(predicate) {
58981 if (typeof predicate != 'function') {
58982 throw new TypeError(FUNC_ERROR_TEXT);
58984 return function() {
58985 return !predicate.apply(this, arguments);
58990 * Creates a function that is restricted to invoking `func` once. Repeat
58991 * calls to the function return the value of the first call. The `func` is
58992 * invoked with the `this` binding and arguments of the created function.
58996 * @category Function
58997 * @param {Function}
58998 * func The function to restrict.
58999 * @returns {Function} Returns the new restricted function.
59002 * var initialize = _.once(createApplication); initialize(); initialize(); //
59003 * `initialize` invokes `createApplication` once
59005 function once(func) {
59006 return before(2, func);
59010 * Creates a function that invokes `func` with `partial` arguments prepended
59011 * to those provided to the new function. This method is like `_.bind`
59012 * except it does **not** alter the `this` binding.
59014 * The `_.partial.placeholder` value, which defaults to `_` in monolithic
59015 * builds, may be used as a placeholder for partially applied arguments.
59017 * **Note:** This method does not set the "length" property of partially
59018 * applied functions.
59022 * @category Function
59023 * @param {Function}
59024 * func The function to partially apply arguments to.
59026 * [partials] The arguments to be partially applied.
59027 * @returns {Function} Returns the new partially applied function.
59030 * var greet = function(greeting, name) { return greeting + ' ' + name; };
59032 * var sayHelloTo = _.partial(greet, 'hello'); sayHelloTo('fred'); // =>
59034 * // using placeholders var greetFred = _.partial(greet, _, 'fred');
59035 * greetFred('hi'); // => 'hi fred'
59037 var partial = createPartial(PARTIAL_FLAG);
59040 * This method is like `_.partial` except that partially applied arguments
59041 * are appended to those provided to the new function.
59043 * The `_.partialRight.placeholder` value, which defaults to `_` in
59044 * monolithic builds, may be used as a placeholder for partially applied
59047 * **Note:** This method does not set the "length" property of partially
59048 * applied functions.
59052 * @category Function
59053 * @param {Function}
59054 * func The function to partially apply arguments to.
59056 * [partials] The arguments to be partially applied.
59057 * @returns {Function} Returns the new partially applied function.
59060 * var greet = function(greeting, name) { return greeting + ' ' + name; };
59062 * var greetFred = _.partialRight(greet, 'fred'); greetFred('hi'); // => 'hi
59064 * // using placeholders var sayHelloTo = _.partialRight(greet, 'hello',
59065 * _); sayHelloTo('fred'); // => 'hello fred'
59067 var partialRight = createPartial(PARTIAL_RIGHT_FLAG);
59070 * Creates a function that invokes `func` with arguments arranged according
59071 * to the specified indexes where the argument value at the first index is
59072 * provided as the first argument, the argument value at the second index is
59073 * provided as the second argument, and so on.
59077 * @category Function
59078 * @param {Function}
59079 * func The function to rearrange arguments for.
59080 * @param {...(number|number[])}
59081 * indexes The arranged argument indexes, specified as individual
59082 * indexes or arrays of indexes.
59083 * @returns {Function} Returns the new function.
59086 * var rearged = _.rearg(function(a, b, c) { return [a, b, c]; }, 2, 0, 1);
59088 * rearged('b', 'c', 'a') // => ['a', 'b', 'c']
59090 * var map = _.rearg(_.map, [1, 0]); map(function(n) { return n * 3; }, [1,
59091 * 2, 3]); // => [3, 6, 9]
59093 var rearg = restParam(function(func, indexes) {
59094 return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
59098 * Creates a function that invokes `func` with the `this` binding of the
59099 * created function and arguments from `start` and beyond provided as an
59102 * **Note:** This method is based on the [rest
59103 * parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
59107 * @category Function
59108 * @param {Function}
59109 * func The function to apply a rest parameter to.
59111 * [start=func.length-1] The start position of the rest
59113 * @returns {Function} Returns the new function.
59116 * var say = _.restParam(function(what, names) { return what + ' ' +
59117 * _.initial(names).join(', ') + (_.size(names) > 1 ? ', & ' : '') +
59118 * _.last(names); });
59120 * say('hello', 'fred', 'barney', 'pebbles'); // => 'hello fred, barney, &
59123 function restParam(func, start) {
59124 if (typeof func != 'function') {
59125 throw new TypeError(FUNC_ERROR_TEXT);
59127 start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
59128 return function() {
59129 var args = arguments,
59131 length = nativeMax(args.length - start, 0),
59132 rest = Array(length);
59134 while (++index < length) {
59135 rest[index] = args[start + index];
59139 return func.call(this, rest);
59141 return func.call(this, args[0], rest);
59143 return func.call(this, args[0], args[1], rest);
59145 var otherArgs = Array(start + 1);
59147 while (++index < start) {
59148 otherArgs[index] = args[index];
59150 otherArgs[start] = rest;
59151 return func.apply(this, otherArgs);
59156 * Creates a function that invokes `func` with the `this` binding of the
59157 * created function and an array of arguments much like
59158 * [`Function#apply`](https://es5.github.io/#x15.3.4.3).
59160 * **Note:** This method is based on the [spread
59161 * operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).
59165 * @category Function
59166 * @param {Function}
59167 * func The function to spread arguments over.
59168 * @returns {Function} Returns the new function.
59171 * var say = _.spread(function(who, what) { return who + ' says ' + what;
59174 * say(['fred', 'hello']); // => 'fred says hello'
59175 * // with a Promise var numbers = Promise.all([ Promise.resolve(40),
59176 * Promise.resolve(36) ]);
59178 * numbers.then(_.spread(function(x, y) { return x + y; })); // => a Promise
59181 function spread(func) {
59182 if (typeof func != 'function') {
59183 throw new TypeError(FUNC_ERROR_TEXT);
59185 return function(array) {
59186 return func.apply(this, array);
59191 * Creates a throttled function that only invokes `func` at most once per
59192 * every `wait` milliseconds. The throttled function comes with a `cancel`
59193 * method to cancel delayed invocations. Provide an options object to
59194 * indicate that `func` should be invoked on the leading and/or trailing
59195 * edge of the `wait` timeout. Subsequent calls to the throttled function
59196 * return the result of the last `func` call.
59198 * **Note:** If `leading` and `trailing` options are `true`, `func` is
59199 * invoked on the trailing edge of the timeout only if the the throttled
59200 * function is invoked more than once during the `wait` timeout.
59202 * See [David Corbacho's
59203 * article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
59204 * for details over the differences between `_.throttle` and `_.debounce`.
59208 * @category Function
59209 * @param {Function}
59210 * func The function to throttle.
59212 * [wait=0] The number of milliseconds to throttle invocations
59215 * [options] The options object.
59217 * [options.leading=true] Specify invoking on the leading edge of
59220 * [options.trailing=true] Specify invoking on the trailing edge
59222 * @returns {Function} Returns the new throttled function.
59224 * // avoid excessively updating the position while scrolling
59225 * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
59226 * // invoke `renewToken` when the click event is fired, but not more than
59227 * once every 5 minutes jQuery('.interactive').on('click',
59228 * _.throttle(renewToken, 300000, { 'trailing': false }));
59229 * // cancel a trailing throttled call jQuery(window).on('popstate',
59230 * throttled.cancel);
59232 function throttle(func, wait, options) {
59233 var leading = true,
59236 if (typeof func != 'function') {
59237 throw new TypeError(FUNC_ERROR_TEXT);
59239 if (options === false) {
59241 } else if (isObject(options)) {
59242 leading = 'leading' in options ? !!options.leading : leading;
59243 trailing = 'trailing' in options ? !!options.trailing : trailing;
59245 return debounce(func, wait, {
59246 'leading': leading,
59248 'trailing': trailing
59253 * Creates a function that provides `value` to the wrapper function as its
59254 * first argument. Any additional arguments provided to the function are
59255 * appended to those provided to the wrapper function. The wrapper is
59256 * invoked with the `this` binding of the created function.
59260 * @category Function
59262 * value The value to wrap.
59263 * @param {Function}
59264 * wrapper The wrapper function.
59265 * @returns {Function} Returns the new function.
59268 * var p = _.wrap(_.escape, function(func, text) { return '
59269 * <p>' + func(text) + '
59272 * p('fred, barney, & pebbles'); // => '
59274 * fred, barney, & pebbles
59277 function wrap(value, wrapper) {
59278 wrapper = wrapper == null ? identity : wrapper;
59279 return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);
59282 /*------------------------------------------------------------------------*/
59285 * Creates a clone of `value`. If `isDeep` is `true` nested objects are
59286 * cloned, otherwise they are assigned by reference. If `customizer` is
59287 * provided it is invoked to produce the cloned values. If `customizer`
59288 * returns `undefined` cloning is handled by the method instead. The
59289 * `customizer` is bound to `thisArg` and invoked with two argument; (value [,
59290 * index|key, object]).
59292 * **Note:** This method is loosely based on the [structured clone
59293 * algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
59294 * The enumerable properties of `arguments` objects and objects created by
59295 * constructors other than `Object` are cloned to plain `Object` objects. An
59296 * empty object is returned for uncloneable values such as functions, DOM
59297 * nodes, Maps, Sets, and WeakMaps.
59303 * value The value to clone.
59305 * [isDeep] Specify a deep clone.
59306 * @param {Function}
59307 * [customizer] The function to customize cloning values.
59309 * [thisArg] The `this` binding of `customizer`.
59310 * @returns {*} Returns the cloned value.
59313 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
59315 * var shallow = _.clone(users); shallow[0] === users[0]; // => true
59317 * var deep = _.clone(users, true); deep[0] === users[0]; // => false
59318 * // using a customizer callback var el = _.clone(document.body,
59319 * function(value) { if (_.isElement(value)) { return
59320 * value.cloneNode(false); } });
59322 * el === document.body // => false el.nodeName // => BODY
59323 * el.childNodes.length; // => 0
59325 function clone(value, isDeep, customizer, thisArg) {
59326 if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
59328 } else if (typeof isDeep == 'function') {
59329 thisArg = customizer;
59330 customizer = isDeep;
59333 return typeof customizer == 'function' ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1)) : baseClone(value, isDeep);
59337 * Creates a deep clone of `value`. If `customizer` is provided it is
59338 * invoked to produce the cloned values. If `customizer` returns `undefined`
59339 * cloning is handled by the method instead. The `customizer` is bound to
59340 * `thisArg` and invoked with two argument; (value [, index|key, object]).
59342 * **Note:** This method is loosely based on the [structured clone
59343 * algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
59344 * The enumerable properties of `arguments` objects and objects created by
59345 * constructors other than `Object` are cloned to plain `Object` objects. An
59346 * empty object is returned for uncloneable values such as functions, DOM
59347 * nodes, Maps, Sets, and WeakMaps.
59353 * value The value to deep clone.
59354 * @param {Function}
59355 * [customizer] The function to customize cloning values.
59357 * [thisArg] The `this` binding of `customizer`.
59358 * @returns {*} Returns the deep cloned value.
59361 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
59363 * var deep = _.cloneDeep(users); deep[0] === users[0]; // => false
59364 * // using a customizer callback var el = _.cloneDeep(document.body,
59365 * function(value) { if (_.isElement(value)) { return value.cloneNode(true); }
59368 * el === document.body // => false el.nodeName // => BODY
59369 * el.childNodes.length; // => 20
59371 function cloneDeep(value, customizer, thisArg) {
59372 return typeof customizer == 'function' ? baseClone(value, true, bindCallback(customizer, thisArg, 1)) : baseClone(value, true);
59376 * Checks if `value` is greater than `other`.
59382 * value The value to compare.
59384 * other The other value to compare.
59385 * @returns {boolean} Returns `true` if `value` is greater than `other`,
59389 * _.gt(3, 1); // => true
59391 * _.gt(3, 3); // => false
59393 * _.gt(1, 3); // => false
59395 function gt(value, other) {
59396 return value > other;
59400 * Checks if `value` is greater than or equal to `other`.
59406 * value The value to compare.
59408 * other The other value to compare.
59409 * @returns {boolean} Returns `true` if `value` is greater than or equal to
59410 * `other`, else `false`.
59413 * _.gte(3, 1); // => true
59415 * _.gte(3, 3); // => true
59417 * _.gte(1, 3); // => false
59419 function gte(value, other) {
59420 return value >= other;
59424 * Checks if `value` is classified as an `arguments` object.
59430 * value The value to check.
59431 * @returns {boolean} Returns `true` if `value` is correctly classified,
59435 * _.isArguments(function() { return arguments; }()); // => true
59437 * _.isArguments([1, 2, 3]); // => false
59439 function isArguments(value) {
59440 return isObjectLike(value) && isArrayLike(value) &&
59441 hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
59445 * Checks if `value` is classified as an `Array` object.
59451 * value The value to check.
59452 * @returns {boolean} Returns `true` if `value` is correctly classified,
59456 * _.isArray([1, 2, 3]); // => true
59458 * _.isArray(function() { return arguments; }()); // => false
59460 var isArray = nativeIsArray || function(value) {
59461 return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
59465 * Checks if `value` is classified as a boolean primitive or object.
59471 * value The value to check.
59472 * @returns {boolean} Returns `true` if `value` is correctly classified,
59476 * _.isBoolean(false); // => true
59478 * _.isBoolean(null); // => false
59480 function isBoolean(value) {
59481 return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
59485 * Checks if `value` is classified as a `Date` object.
59491 * value The value to check.
59492 * @returns {boolean} Returns `true` if `value` is correctly classified,
59496 * _.isDate(new Date); // => true
59498 * _.isDate('Mon April 23 2012'); // => false
59500 function isDate(value) {
59501 return isObjectLike(value) && objToString.call(value) == dateTag;
59505 * Checks if `value` is a DOM element.
59511 * value The value to check.
59512 * @returns {boolean} Returns `true` if `value` is a DOM element, else
59516 * _.isElement(document.body); // => true
59518 * _.isElement('<body>'); // => false
59520 function isElement(value) {
59521 return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
59525 * Checks if `value` is empty. A value is considered empty unless it is an
59526 * `arguments` object, array, string, or jQuery-like collection with a
59527 * length greater than `0` or an object with own enumerable properties.
59532 * @param {Array|Object|string}
59533 * value The value to inspect.
59534 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
59537 * _.isEmpty(null); // => true
59539 * _.isEmpty(true); // => true
59541 * _.isEmpty(1); // => true
59543 * _.isEmpty([1, 2, 3]); // => false
59545 * _.isEmpty({ 'a': 1 }); // => false
59547 function isEmpty(value) {
59548 if (value == null) {
59551 if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
59552 (isObjectLike(value) && isFunction(value.splice)))) {
59553 return !value.length;
59555 return !keys(value).length;
59559 * Performs a deep comparison between two values to determine if they are
59560 * equivalent. If `customizer` is provided it is invoked to compare values.
59561 * If `customizer` returns `undefined` comparisons are handled by the method
59562 * instead. The `customizer` is bound to `thisArg` and invoked with three
59563 * arguments: (value, other [, index|key]).
59565 * **Note:** This method supports comparing arrays, booleans, `Date`
59566 * objects, numbers, `Object` objects, regexes, and strings. Objects are
59567 * compared by their own, not inherited, enumerable properties. Functions
59568 * and DOM nodes are **not** supported. Provide a customizer function to
59569 * extend support for comparing other values.
59576 * value The value to compare.
59578 * other The other value to compare.
59579 * @param {Function}
59580 * [customizer] The function to customize value comparisons.
59582 * [thisArg] The `this` binding of `customizer`.
59583 * @returns {boolean} Returns `true` if the values are equivalent, else
59587 * var object = { 'user': 'fred' }; var other = { 'user': 'fred' };
59589 * object == other; // => false
59591 * _.isEqual(object, other); // => true
59592 * // using a customizer callback var array = ['hello', 'goodbye']; var
59593 * other = ['hi', 'goodbye'];
59595 * _.isEqual(array, other, function(value, other) { if (_.every([value,
59596 * other], RegExp.prototype.test, /^h(?:i|ello)$/)) { return true; } }); // =>
59599 function isEqual(value, other, customizer, thisArg) {
59600 customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
59601 var result = customizer ? customizer(value, other) : undefined;
59602 return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
59606 * Checks if `value` is an `Error`, `EvalError`, `RangeError`,
59607 * `ReferenceError`, `SyntaxError`, `TypeError`, or `URIError` object.
59613 * value The value to check.
59614 * @returns {boolean} Returns `true` if `value` is an error object, else
59618 * _.isError(new Error); // => true
59620 * _.isError(Error); // => false
59622 function isError(value) {
59623 return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
59627 * Checks if `value` is a finite primitive number.
59629 * **Note:** This method is based on
59630 * [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).
59636 * value The value to check.
59637 * @returns {boolean} Returns `true` if `value` is a finite number, else
59641 * _.isFinite(10); // => true
59643 * _.isFinite('10'); // => false
59645 * _.isFinite(true); // => false
59647 * _.isFinite(Object(10)); // => false
59649 * _.isFinite(Infinity); // => false
59651 function isFinite(value) {
59652 return typeof value == 'number' && nativeIsFinite(value);
59656 * Checks if `value` is classified as a `Function` object.
59662 * value The value to check.
59663 * @returns {boolean} Returns `true` if `value` is correctly classified,
59667 * _.isFunction(_); // => true
59669 * _.isFunction(/abc/); // => false
59671 function isFunction(value) {
59672 // The use of `Object#toString` avoids issues with the `typeof` operator
59673 // in older versions of Chrome and Safari which return 'function' for
59675 // and Safari 8 equivalents which return 'object' for typed array
59677 return isObject(value) && objToString.call(value) == funcTag;
59681 * Checks if `value` is the [language type](https://es5.github.io/#x8) of
59682 * `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and
59683 * `new String('')`)
59689 * value The value to check.
59690 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
59693 * _.isObject({}); // => true
59695 * _.isObject([1, 2, 3]); // => true
59697 * _.isObject(1); // => false
59699 function isObject(value) {
59700 // Avoid a V8 JIT bug in Chrome 19-20.
59701 // See https://code.google.com/p/v8/issues/detail?id=2291 for more
59703 var type = typeof value;
59704 return !!value && (type == 'object' || type == 'function');
59708 * Performs a deep comparison between `object` and `source` to determine if
59709 * `object` contains equivalent property values. If `customizer` is provided
59710 * it is invoked to compare values. If `customizer` returns `undefined`
59711 * comparisons are handled by the method instead. The `customizer` is bound
59712 * to `thisArg` and invoked with three arguments: (value, other, index|key).
59714 * **Note:** This method supports comparing properties of arrays, booleans,
59715 * `Date` objects, numbers, `Object` objects, regexes, and strings.
59716 * Functions and DOM nodes are **not** supported. Provide a customizer
59717 * function to extend support for comparing other values.
59723 * object The object to inspect.
59725 * source The object of property values to match.
59726 * @param {Function}
59727 * [customizer] The function to customize value comparisons.
59729 * [thisArg] The `this` binding of `customizer`.
59730 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
59733 * var object = { 'user': 'fred', 'age': 40 };
59735 * _.isMatch(object, { 'age': 40 }); // => true
59737 * _.isMatch(object, { 'age': 36 }); // => false
59738 * // using a customizer callback var object = { 'greeting': 'hello' }; var
59739 * source = { 'greeting': 'hi' };
59741 * _.isMatch(object, source, function(value, other) { return _.every([value,
59742 * other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; }); // =>
59745 function isMatch(object, source, customizer, thisArg) {
59746 customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
59747 return baseIsMatch(object, getMatchData(source), customizer);
59751 * Checks if `value` is `NaN`.
59753 * **Note:** This method is not the same as
59754 * [`isNaN`](https://es5.github.io/#x15.1.2.4) which returns `true` for
59755 * `undefined` and other non-numeric values.
59761 * value The value to check.
59762 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
59765 * _.isNaN(NaN); // => true
59767 * _.isNaN(new Number(NaN)); // => true
59769 * isNaN(undefined); // => true
59771 * _.isNaN(undefined); // => false
59773 function isNaN(value) {
59774 // An `NaN` primitive is the only value that is not equal to itself.
59775 // Perform the `toStringTag` check first to avoid errors with some host
59777 return isNumber(value) && value != +value;
59781 * Checks if `value` is a native function.
59787 * value The value to check.
59788 * @returns {boolean} Returns `true` if `value` is a native function, else
59792 * _.isNative(Array.prototype.push); // => true
59794 * _.isNative(_); // => false
59796 function isNative(value) {
59797 if (value == null) {
59800 if (isFunction(value)) {
59801 return reIsNative.test(fnToString.call(value));
59803 return isObjectLike(value) && reIsHostCtor.test(value);
59807 * Checks if `value` is `null`.
59813 * value The value to check.
59814 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
59817 * _.isNull(null); // => true
59819 * _.isNull(void 0); // => false
59821 function isNull(value) {
59822 return value === null;
59826 * Checks if `value` is classified as a `Number` primitive or object.
59828 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
59829 * classified as numbers, use the `_.isFinite` method.
59835 * value The value to check.
59836 * @returns {boolean} Returns `true` if `value` is correctly classified,
59840 * _.isNumber(8.4); // => true
59842 * _.isNumber(NaN); // => true
59844 * _.isNumber('8.4'); // => false
59846 function isNumber(value) {
59847 return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
59851 * Checks if `value` is a plain object, that is, an object created by the
59852 * `Object` constructor or one with a `[[Prototype]]` of `null`.
59854 * **Note:** This method assumes objects created by the `Object` constructor
59855 * have no inherited enumerable properties.
59861 * value The value to check.
59862 * @returns {boolean} Returns `true` if `value` is a plain object, else
59866 * function Foo() { this.a = 1; }
59868 * _.isPlainObject(new Foo); // => false
59870 * _.isPlainObject([1, 2, 3]); // => false
59872 * _.isPlainObject({ 'x': 0, 'y': 0 }); // => true
59874 * _.isPlainObject(Object.create(null)); // => true
59876 function isPlainObject(value) {
59879 // Exit early for non `Object` objects.
59880 if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
59881 (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
59884 // IE < 9 iterates inherited properties before own properties. If the
59886 // iterated property is an object's own property then there are no
59888 // enumerable properties.
59890 // In most environments an object's own properties are iterated before
59891 // its inherited properties. If the last iterated property is an
59893 // own property then there are no inherited enumerable properties.
59894 baseForIn(value, function(subValue, key) {
59897 return result === undefined || hasOwnProperty.call(value, result);
59901 * Checks if `value` is classified as a `RegExp` object.
59907 * value The value to check.
59908 * @returns {boolean} Returns `true` if `value` is correctly classified,
59912 * _.isRegExp(/abc/); // => true
59914 * _.isRegExp('/abc/'); // => false
59916 function isRegExp(value) {
59917 return isObject(value) && objToString.call(value) == regexpTag;
59921 * Checks if `value` is classified as a `String` primitive or object.
59927 * value The value to check.
59928 * @returns {boolean} Returns `true` if `value` is correctly classified,
59932 * _.isString('abc'); // => true
59934 * _.isString(1); // => false
59936 function isString(value) {
59937 return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
59941 * Checks if `value` is classified as a typed array.
59947 * value The value to check.
59948 * @returns {boolean} Returns `true` if `value` is correctly classified,
59952 * _.isTypedArray(new Uint8Array); // => true
59954 * _.isTypedArray([]); // => false
59956 function isTypedArray(value) {
59957 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
59961 * Checks if `value` is `undefined`.
59967 * value The value to check.
59968 * @returns {boolean} Returns `true` if `value` is `undefined`, else
59972 * _.isUndefined(void 0); // => true
59974 * _.isUndefined(null); // => false
59976 function isUndefined(value) {
59977 return value === undefined;
59981 * Checks if `value` is less than `other`.
59987 * value The value to compare.
59989 * other The other value to compare.
59990 * @returns {boolean} Returns `true` if `value` is less than `other`, else
59994 * _.lt(1, 3); // => true
59996 * _.lt(3, 3); // => false
59998 * _.lt(3, 1); // => false
60000 function lt(value, other) {
60001 return value < other;
60005 * Checks if `value` is less than or equal to `other`.
60011 * value The value to compare.
60013 * other The other value to compare.
60014 * @returns {boolean} Returns `true` if `value` is less than or equal to
60015 * `other`, else `false`.
60018 * _.lte(1, 3); // => true
60020 * _.lte(3, 3); // => true
60022 * _.lte(3, 1); // => false
60024 function lte(value, other) {
60025 return value <= other;
60029 * Converts `value` to an array.
60035 * value The value to convert.
60036 * @returns {Array} Returns the converted array.
60039 * (function() { return _.toArray(arguments).slice(1); }(1, 2, 3)); // =>
60042 function toArray(value) {
60043 var length = value ? getLength(value) : 0;
60044 if (!isLength(length)) {
60045 return values(value);
60050 return arrayCopy(value);
60054 * Converts `value` to a plain object flattening inherited enumerable
60055 * properties of `value` to own properties of the plain object.
60061 * value The value to convert.
60062 * @returns {Object} Returns the converted plain object.
60065 * function Foo() { this.b = 2; }
60067 * Foo.prototype.c = 3;
60069 * _.assign({ 'a': 1 }, new Foo); // => { 'a': 1, 'b': 2 }
60071 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); // => { 'a': 1, 'b': 2,
60074 function toPlainObject(value) {
60075 return baseCopy(value, keysIn(value));
60078 /*------------------------------------------------------------------------*/
60081 * Recursively merges own enumerable properties of the source object(s),
60082 * that don't resolve to `undefined` into the destination object. Subsequent
60083 * sources overwrite property assignments of previous sources. If
60084 * `customizer` is provided it is invoked to produce the merged values of
60085 * the destination and source properties. If `customizer` returns
60086 * `undefined` merging is handled by the method instead. The `customizer` is
60087 * bound to `thisArg` and invoked with five arguments: (objectValue,
60088 * sourceValue, key, object, source).
60094 * object The destination object.
60095 * @param {...Object}
60096 * [sources] The source objects.
60097 * @param {Function}
60098 * [customizer] The function to customize assigned values.
60100 * [thisArg] The `this` binding of `customizer`.
60101 * @returns {Object} Returns `object`.
60104 * var users = { 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] };
60106 * var ages = { 'data': [{ 'age': 36 }, { 'age': 40 }] };
60108 * _.merge(users, ages); // => { 'data': [{ 'user': 'barney', 'age': 36 }, {
60109 * 'user': 'fred', 'age': 40 }] }
60110 * // using a customizer callback var object = { 'fruits': ['apple'],
60111 * 'vegetables': ['beet'] };
60113 * var other = { 'fruits': ['banana'], 'vegetables': ['carrot'] };
60115 * _.merge(object, other, function(a, b) { if (_.isArray(a)) { return
60116 * a.concat(b); } }); // => { 'fruits': ['apple', 'banana'], 'vegetables':
60117 * ['beet', 'carrot'] }
60119 var merge = createAssigner(baseMerge);
60122 * Assigns own enumerable properties of source object(s) to the destination
60123 * object. Subsequent sources overwrite property assignments of previous
60124 * sources. If `customizer` is provided it is invoked to produce the
60125 * assigned values. The `customizer` is bound to `thisArg` and invoked with
60126 * five arguments: (objectValue, sourceValue, key, object, source).
60128 * **Note:** This method mutates `object` and is based on
60129 * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
60136 * object The destination object.
60137 * @param {...Object}
60138 * [sources] The source objects.
60139 * @param {Function}
60140 * [customizer] The function to customize assigned values.
60142 * [thisArg] The `this` binding of `customizer`.
60143 * @returns {Object} Returns `object`.
60146 * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); // => {
60147 * 'user': 'fred', 'age': 40 }
60148 * // using a customizer callback var defaults = _.partialRight(_.assign,
60149 * function(value, other) { return _.isUndefined(value) ? other : value; });
60151 * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); // => {
60152 * 'user': 'barney', 'age': 36 }
60154 var assign = createAssigner(function(object, source, customizer) {
60155 return customizer ? assignWith(object, source, customizer) : baseAssign(object, source);
60159 * Creates an object that inherits from the given `prototype` object. If a
60160 * `properties` object is provided its own enumerable properties are
60161 * assigned to the created object.
60167 * prototype The object to inherit from.
60169 * [properties] The properties to assign to the object.
60170 * @param- {Object} [guard] Enables use as a callback for functions like
60172 * @returns {Object} Returns the new object.
60175 * function Shape() { this.x = 0; this.y = 0; }
60177 * function Circle() { Shape.call(this); }
60179 * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle });
60181 * var circle = new Circle; circle instanceof Circle; // => true
60183 * circle instanceof Shape; // => true
60185 function create(prototype, properties, guard) {
60186 var result = baseCreate(prototype);
60187 if (guard && isIterateeCall(prototype, properties, guard)) {
60188 properties = undefined;
60190 return properties ? baseAssign(result, properties) : result;
60194 * Assigns own enumerable properties of source object(s) to the destination
60195 * object for all destination properties that resolve to `undefined`. Once a
60196 * property is set, additional values of the same property are ignored.
60198 * **Note:** This method mutates `object`.
60204 * object The destination object.
60205 * @param {...Object}
60206 * [sources] The source objects.
60207 * @returns {Object} Returns `object`.
60210 * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); // => {
60211 * 'user': 'barney', 'age': 36 }
60213 var defaults = createDefaults(assign, assignDefaults);
60216 * This method is like `_.defaults` except that it recursively assigns
60217 * default properties.
60219 * **Note:** This method mutates `object`.
60225 * object The destination object.
60226 * @param {...Object}
60227 * [sources] The source objects.
60228 * @returns {Object} Returns `object`.
60231 * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name':
60232 * 'fred', 'age': 36 } }); // => { 'user': { 'name': 'barney', 'age': 36 } }
60235 var defaultsDeep = createDefaults(merge, mergeDefaults);
60238 * This method is like `_.find` except that it returns the key of the first
60239 * element `predicate` returns truthy for instead of the element itself.
60241 * If a property name is provided for `predicate` the created `_.property`
60242 * style callback returns the property value of the given element.
60244 * If a value is also provided for `thisArg` the created `_.matchesProperty`
60245 * style callback returns `true` for elements that have a matching property
60246 * value, else `false`.
60248 * If an object is provided for `predicate` the created `_.matches` style
60249 * callback returns `true` for elements that have the properties of the
60250 * given object, else `false`.
60256 * object The object to search.
60257 * @param {Function|Object|string}
60258 * [predicate=_.identity] The function invoked per iteration.
60260 * [thisArg] The `this` binding of `predicate`.
60261 * @returns {string|undefined} Returns the key of the matched element, else
60265 * var users = { 'barney': { 'age': 36, 'active': true }, 'fred': { 'age':
60266 * 40, 'active': false }, 'pebbles': { 'age': 1, 'active': true } };
60268 * _.findKey(users, function(chr) { return chr.age < 40; }); // => 'barney'
60269 * (iteration order is not guaranteed)
60270 * // using the `_.matches` callback shorthand _.findKey(users, { 'age': 1,
60271 * 'active': true }); // => 'pebbles'
60272 * // using the `_.matchesProperty` callback shorthand _.findKey(users,
60273 * 'active', false); // => 'fred'
60274 * // using the `_.property` callback shorthand _.findKey(users, 'active'); // =>
60277 var findKey = createFindKey(baseForOwn);
60280 * This method is like `_.findKey` except that it iterates over elements of
60281 * a collection in the opposite order.
60283 * If a property name is provided for `predicate` the created `_.property`
60284 * style callback returns the property value of the given element.
60286 * If a value is also provided for `thisArg` the created `_.matchesProperty`
60287 * style callback returns `true` for elements that have a matching property
60288 * value, else `false`.
60290 * If an object is provided for `predicate` the created `_.matches` style
60291 * callback returns `true` for elements that have the properties of the
60292 * given object, else `false`.
60298 * object The object to search.
60299 * @param {Function|Object|string}
60300 * [predicate=_.identity] The function invoked per iteration.
60302 * [thisArg] The `this` binding of `predicate`.
60303 * @returns {string|undefined} Returns the key of the matched element, else
60307 * var users = { 'barney': { 'age': 36, 'active': true }, 'fred': { 'age':
60308 * 40, 'active': false }, 'pebbles': { 'age': 1, 'active': true } };
60310 * _.findLastKey(users, function(chr) { return chr.age < 40; }); // =>
60311 * returns `pebbles` assuming `_.findKey` returns `barney`
60312 * // using the `_.matches` callback shorthand _.findLastKey(users, {
60313 * 'age': 36, 'active': true }); // => 'barney'
60314 * // using the `_.matchesProperty` callback shorthand _.findLastKey(users,
60315 * 'active', false); // => 'fred'
60316 * // using the `_.property` callback shorthand _.findLastKey(users,
60317 * 'active'); // => 'pebbles'
60319 var findLastKey = createFindKey(baseForOwnRight);
60322 * Iterates over own and inherited enumerable properties of an object
60323 * invoking `iteratee` for each property. The `iteratee` is bound to
60324 * `thisArg` and invoked with three arguments: (value, key, object).
60325 * Iteratee functions may exit iteration early by explicitly returning
60332 * object The object to iterate over.
60333 * @param {Function}
60334 * [iteratee=_.identity] The function invoked per iteration.
60336 * [thisArg] The `this` binding of `iteratee`.
60337 * @returns {Object} Returns `object`.
60340 * function Foo() { this.a = 1; this.b = 2; }
60342 * Foo.prototype.c = 3;
60344 * _.forIn(new Foo, function(value, key) { console.log(key); }); // => logs
60345 * 'a', 'b', and 'c' (iteration order is not guaranteed)
60347 var forIn = createForIn(baseFor);
60350 * This method is like `_.forIn` except that it iterates over properties of
60351 * `object` in the opposite order.
60357 * object The object to iterate over.
60358 * @param {Function}
60359 * [iteratee=_.identity] The function invoked per iteration.
60361 * [thisArg] The `this` binding of `iteratee`.
60362 * @returns {Object} Returns `object`.
60365 * function Foo() { this.a = 1; this.b = 2; }
60367 * Foo.prototype.c = 3;
60369 * _.forInRight(new Foo, function(value, key) { console.log(key); }); // =>
60370 * logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
60372 var forInRight = createForIn(baseForRight);
60375 * Iterates over own enumerable properties of an object invoking `iteratee`
60376 * for each property. The `iteratee` is bound to `thisArg` and invoked with
60377 * three arguments: (value, key, object). Iteratee functions may exit
60378 * iteration early by explicitly returning `false`.
60384 * object The object to iterate over.
60385 * @param {Function}
60386 * [iteratee=_.identity] The function invoked per iteration.
60388 * [thisArg] The `this` binding of `iteratee`.
60389 * @returns {Object} Returns `object`.
60392 * function Foo() { this.a = 1; this.b = 2; }
60394 * Foo.prototype.c = 3;
60396 * _.forOwn(new Foo, function(value, key) { console.log(key); }); // => logs
60397 * 'a' and 'b' (iteration order is not guaranteed)
60399 var forOwn = createForOwn(baseForOwn);
60402 * This method is like `_.forOwn` except that it iterates over properties of
60403 * `object` in the opposite order.
60409 * object The object to iterate over.
60410 * @param {Function}
60411 * [iteratee=_.identity] The function invoked per iteration.
60413 * [thisArg] The `this` binding of `iteratee`.
60414 * @returns {Object} Returns `object`.
60417 * function Foo() { this.a = 1; this.b = 2; }
60419 * Foo.prototype.c = 3;
60421 * _.forOwnRight(new Foo, function(value, key) { console.log(key); }); // =>
60422 * logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
60424 var forOwnRight = createForOwn(baseForOwnRight);
60427 * Creates an array of function property names from all enumerable
60428 * properties, own and inherited, of `object`.
60435 * object The object to inspect.
60436 * @returns {Array} Returns the new array of property names.
60439 * _.functions(_); // => ['after', 'ary', 'assign', ...]
60441 function functions(object) {
60442 return baseFunctions(object, keysIn(object));
60446 * Gets the property value at `path` of `object`. If the resolved value is
60447 * `undefined` the `defaultValue` is used in its place.
60453 * object The object to query.
60454 * @param {Array|string}
60455 * path The path of the property to get.
60457 * [defaultValue] The value returned if the resolved value is
60459 * @returns {*} Returns the resolved value.
60462 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
60464 * _.get(object, 'a[0].b.c'); // => 3
60466 * _.get(object, ['a', '0', 'b', 'c']); // => 3
60468 * _.get(object, 'a.b.c', 'default'); // => 'default'
60470 function get(object, path, defaultValue) {
60471 var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
60472 return result === undefined ? defaultValue : result;
60476 * Checks if `path` is a direct property.
60482 * object The object to query.
60483 * @param {Array|string}
60484 * path The path to check.
60485 * @returns {boolean} Returns `true` if `path` is a direct property, else
60489 * var object = { 'a': { 'b': { 'c': 3 } } };
60491 * _.has(object, 'a'); // => true
60493 * _.has(object, 'a.b.c'); // => true
60495 * _.has(object, ['a', 'b', 'c']); // => true
60497 function has(object, path) {
60498 if (object == null) {
60501 var result = hasOwnProperty.call(object, path);
60502 if (!result && !isKey(path)) {
60503 path = toPath(path);
60504 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
60505 if (object == null) {
60509 result = hasOwnProperty.call(object, path);
60511 return result || (isLength(object.length) && isIndex(path, object.length) &&
60512 (isArray(object) || isArguments(object)));
60516 * Creates an object composed of the inverted keys and values of `object`.
60517 * If `object` contains duplicate values, subsequent values overwrite
60518 * property assignments of previous values unless `multiValue` is `true`.
60524 * object The object to invert.
60526 * [multiValue] Allow multiple values per key.
60527 * @param- {Object} [guard] Enables use as a callback for functions like
60529 * @returns {Object} Returns the new inverted object.
60532 * var object = { 'a': 1, 'b': 2, 'c': 1 };
60534 * _.invert(object); // => { '1': 'c', '2': 'b' }
60535 * // with `multiValue` _.invert(object, true); // => { '1': ['a', 'c'],
60538 function invert(object, multiValue, guard) {
60539 if (guard && isIterateeCall(object, multiValue, guard)) {
60540 multiValue = undefined;
60543 props = keys(object),
60544 length = props.length,
60547 while (++index < length) {
60548 var key = props[index],
60549 value = object[key];
60552 if (hasOwnProperty.call(result, value)) {
60553 result[value].push(key);
60555 result[value] = [key];
60558 result[value] = key;
60565 * Creates an array of the own enumerable property names of `object`.
60567 * **Note:** Non-object values are coerced to objects. See the [ES
60568 * spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) for
60575 * object The object to query.
60576 * @returns {Array} Returns the array of property names.
60579 * function Foo() { this.a = 1; this.b = 2; }
60581 * Foo.prototype.c = 3;
60583 * _.keys(new Foo); // => ['a', 'b'] (iteration order is not guaranteed)
60585 * _.keys('hi'); // => ['0', '1']
60587 var keys = !nativeKeys ? shimKeys : function(object) {
60588 var Ctor = object == null ? undefined : object.constructor;
60589 if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
60590 (typeof object != 'function' && isArrayLike(object))) {
60591 return shimKeys(object);
60593 return isObject(object) ? nativeKeys(object) : [];
60597 * Creates an array of the own and inherited enumerable property names of
60600 * **Note:** Non-object values are coerced to objects.
60606 * object The object to query.
60607 * @returns {Array} Returns the array of property names.
60610 * function Foo() { this.a = 1; this.b = 2; }
60612 * Foo.prototype.c = 3;
60614 * _.keysIn(new Foo); // => ['a', 'b', 'c'] (iteration order is not
60617 function keysIn(object) {
60618 if (object == null) {
60621 if (!isObject(object)) {
60622 object = Object(object);
60624 var length = object.length;
60625 length = (length && isLength(length) &&
60626 (isArray(object) || isArguments(object)) && length) || 0;
60628 var Ctor = object.constructor,
60630 isProto = typeof Ctor == 'function' && Ctor.prototype === object,
60631 result = Array(length),
60632 skipIndexes = length > 0;
60634 while (++index < length) {
60635 result[index] = (index + '');
60637 for (var key in object) {
60638 if (!(skipIndexes && isIndex(key, length)) &&
60639 !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
60647 * The opposite of `_.mapValues`; this method creates an object with the
60648 * same values as `object` and keys generated by running each own enumerable
60649 * property of `object` through `iteratee`.
60655 * object The object to iterate over.
60656 * @param {Function|Object|string}
60657 * [iteratee=_.identity] The function invoked per iteration.
60659 * [thisArg] The `this` binding of `iteratee`.
60660 * @returns {Object} Returns the new mapped object.
60663 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { return key + value;
60664 * }); // => { 'a1': 1, 'b2': 2 }
60666 var mapKeys = createObjectMapper(true);
60669 * Creates an object with the same keys as `object` and values generated by
60670 * running each own enumerable property of `object` through `iteratee`. The
60671 * iteratee function is bound to `thisArg` and invoked with three arguments:
60672 * (value, key, object).
60674 * If a property name is provided for `iteratee` the created `_.property`
60675 * style callback returns the property value of the given element.
60677 * If a value is also provided for `thisArg` the created `_.matchesProperty`
60678 * style callback returns `true` for elements that have a matching property
60679 * value, else `false`.
60681 * If an object is provided for `iteratee` the created `_.matches` style
60682 * callback returns `true` for elements that have the properties of the
60683 * given object, else `false`.
60689 * object The object to iterate over.
60690 * @param {Function|Object|string}
60691 * [iteratee=_.identity] The function invoked per iteration.
60693 * [thisArg] The `this` binding of `iteratee`.
60694 * @returns {Object} Returns the new mapped object.
60697 * _.mapValues({ 'a': 1, 'b': 2 }, function(n) { return n * 3; }); // => {
60700 * var users = { 'fred': { 'user': 'fred', 'age': 40 }, 'pebbles': { 'user':
60701 * 'pebbles', 'age': 1 } };
60702 * // using the `_.property` callback shorthand _.mapValues(users, 'age'); // => {
60703 * 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
60705 var mapValues = createObjectMapper();
60708 * The opposite of `_.pick`; this method creates an object composed of the
60709 * own and inherited enumerable properties of `object` that are not omitted.
60715 * object The source object.
60716 * @param {Function|...(string|string[])}
60717 * [predicate] The function invoked per iteration or property
60718 * names to omit, specified as individual property names or
60719 * arrays of property names.
60721 * [thisArg] The `this` binding of `predicate`.
60722 * @returns {Object} Returns the new object.
60725 * var object = { 'user': 'fred', 'age': 40 };
60727 * _.omit(object, 'age'); // => { 'user': 'fred' }
60729 * _.omit(object, _.isNumber); // => { 'user': 'fred' }
60731 var omit = restParam(function(object, props) {
60732 if (object == null) {
60735 if (typeof props[0] != 'function') {
60736 var props = arrayMap(baseFlatten(props), String);
60737 return pickByArray(object, baseDifference(keysIn(object), props));
60739 var predicate = bindCallback(props[0], props[1], 3);
60740 return pickByCallback(object, function(value, key, object) {
60741 return !predicate(value, key, object);
60746 * Creates a two dimensional array of the key-value pairs for `object`, e.g.
60747 * `[[key1, value1], [key2, value2]]`.
60753 * object The object to query.
60754 * @returns {Array} Returns the new array of key-value pairs.
60757 * _.pairs({ 'barney': 36, 'fred': 40 }); // => [['barney', 36], ['fred',
60758 * 40]] (iteration order is not guaranteed)
60760 function pairs(object) {
60761 object = toObject(object);
60764 props = keys(object),
60765 length = props.length,
60766 result = Array(length);
60768 while (++index < length) {
60769 var key = props[index];
60770 result[index] = [key, object[key]];
60776 * Creates an object composed of the picked `object` properties. Property
60777 * names may be specified as individual arguments or as arrays of property
60778 * names. If `predicate` is provided it is invoked for each property of
60779 * `object` picking the properties `predicate` returns truthy for. The
60780 * predicate is bound to `thisArg` and invoked with three arguments: (value,
60787 * object The source object.
60788 * @param {Function|...(string|string[])}
60789 * [predicate] The function invoked per iteration or property
60790 * names to pick, specified as individual property names or
60791 * arrays of property names.
60793 * [thisArg] The `this` binding of `predicate`.
60794 * @returns {Object} Returns the new object.
60797 * var object = { 'user': 'fred', 'age': 40 };
60799 * _.pick(object, 'user'); // => { 'user': 'fred' }
60801 * _.pick(object, _.isString); // => { 'user': 'fred' }
60803 var pick = restParam(function(object, props) {
60804 if (object == null) {
60807 return typeof props[0] == 'function' ? pickByCallback(object, bindCallback(props[0], props[1], 3)) : pickByArray(object, baseFlatten(props));
60811 * This method is like `_.get` except that if the resolved value is a
60812 * function it is invoked with the `this` binding of its parent object and
60813 * its result is returned.
60819 * object The object to query.
60820 * @param {Array|string}
60821 * path The path of the property to resolve.
60823 * [defaultValue] The value returned if the resolved value is
60825 * @returns {*} Returns the resolved value.
60828 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
60830 * _.result(object, 'a[0].b.c1'); // => 3
60832 * _.result(object, 'a[0].b.c2'); // => 4
60834 * _.result(object, 'a.b.c', 'default'); // => 'default'
60836 * _.result(object, 'a.b.c', _.constant('default')); // => 'default'
60838 function result(object, path, defaultValue) {
60839 var result = object == null ? undefined : object[path];
60840 if (result === undefined) {
60841 if (object != null && !isKey(path, object)) {
60842 path = toPath(path);
60843 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
60844 result = object == null ? undefined : object[last(path)];
60846 result = result === undefined ? defaultValue : result;
60848 return isFunction(result) ? result.call(object) : result;
60852 * Sets the property value of `path` on `object`. If a portion of `path`
60853 * does not exist it is created.
60859 * object The object to augment.
60860 * @param {Array|string}
60861 * path The path of the property to set.
60863 * value The value to set.
60864 * @returns {Object} Returns `object`.
60867 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
60869 * _.set(object, 'a[0].b.c', 4); console.log(object.a[0].b.c); // => 4
60871 * _.set(object, 'x[0].y.z', 5); console.log(object.x[0].y.z); // => 5
60873 function set(object, path, value) {
60874 if (object == null) {
60877 var pathKey = (path + '');
60878 path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);
60881 length = path.length,
60882 lastIndex = length - 1,
60885 while (nested != null && ++index < length) {
60886 var key = path[index];
60887 if (isObject(nested)) {
60888 if (index == lastIndex) {
60889 nested[key] = value;
60890 } else if (nested[key] == null) {
60891 nested[key] = isIndex(path[index + 1]) ? [] : {};
60894 nested = nested[key];
60900 * An alternative to `_.reduce`; this method transforms `object` to a new
60901 * `accumulator` object which is the result of running each of its own
60902 * enumerable properties through `iteratee`, with each invocation
60903 * potentially mutating the `accumulator` object. The `iteratee` is bound to
60904 * `thisArg` and invoked with four arguments: (accumulator, value, key,
60905 * object). Iteratee functions may exit iteration early by explicitly
60906 * returning `false`.
60911 * @param {Array|Object}
60912 * object The object to iterate over.
60913 * @param {Function}
60914 * [iteratee=_.identity] The function invoked per iteration.
60916 * [accumulator] The custom accumulator value.
60918 * [thisArg] The `this` binding of `iteratee`.
60919 * @returns {*} Returns the accumulated value.
60922 * _.transform([2, 3, 4], function(result, n) { result.push(n *= n); return
60923 * n % 2 == 0; }); // => [4, 9]
60925 * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) { result[key] =
60926 * n * 3; }); // => { 'a': 3, 'b': 6 }
60928 function transform(object, iteratee, accumulator, thisArg) {
60929 var isArr = isArray(object) || isTypedArray(object);
60930 iteratee = getCallback(iteratee, thisArg, 4);
60932 if (accumulator == null) {
60933 if (isArr || isObject(object)) {
60934 var Ctor = object.constructor;
60936 accumulator = isArray(object) ? new Ctor : [];
60938 accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
60944 (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
60945 return iteratee(accumulator, value, index, object);
60947 return accumulator;
60951 * Creates an array of the own enumerable property values of `object`.
60953 * **Note:** Non-object values are coerced to objects.
60959 * object The object to query.
60960 * @returns {Array} Returns the array of property values.
60963 * function Foo() { this.a = 1; this.b = 2; }
60965 * Foo.prototype.c = 3;
60967 * _.values(new Foo); // => [1, 2] (iteration order is not guaranteed)
60969 * _.values('hi'); // => ['h', 'i']
60971 function values(object) {
60972 return baseValues(object, keys(object));
60976 * Creates an array of the own and inherited enumerable property values of
60979 * **Note:** Non-object values are coerced to objects.
60985 * object The object to query.
60986 * @returns {Array} Returns the array of property values.
60989 * function Foo() { this.a = 1; this.b = 2; }
60991 * Foo.prototype.c = 3;
60993 * _.valuesIn(new Foo); // => [1, 2, 3] (iteration order is not guaranteed)
60995 function valuesIn(object) {
60996 return baseValues(object, keysIn(object));
60999 /*------------------------------------------------------------------------*/
61002 * Checks if `n` is between `start` and up to but not including, `end`. If
61003 * `end` is not specified it is set to `start` with `start` then set to `0`.
61009 * n The number to check.
61011 * [start=0] The start of the range.
61013 * end The end of the range.
61014 * @returns {boolean} Returns `true` if `n` is in the range, else `false`.
61017 * _.inRange(3, 2, 4); // => true
61019 * _.inRange(4, 8); // => true
61021 * _.inRange(4, 2); // => false
61023 * _.inRange(2, 2); // => false
61025 * _.inRange(1.2, 2); // => true
61027 * _.inRange(5.2, 4); // => false
61029 function inRange(value, start, end) {
61030 start = +start || 0;
61031 if (end === undefined) {
61037 return value >= nativeMin(start, end) && value < nativeMax(start, end);
61041 * Produces a random number between `min` and `max` (inclusive). If only one
61042 * argument is provided a number between `0` and the given number is
61043 * returned. If `floating` is `true`, or either `min` or `max` are floats, a
61044 * floating-point number is returned instead of an integer.
61050 * [min=0] The minimum possible value.
61052 * [max=1] The maximum possible value.
61054 * [floating] Specify returning a floating-point number.
61055 * @returns {number} Returns the random number.
61058 * _.random(0, 5); // => an integer between 0 and 5
61060 * _.random(5); // => also an integer between 0 and 5
61062 * _.random(5, true); // => a floating-point number between 0 and 5
61064 * _.random(1.2, 5.2); // => a floating-point number between 1.2 and 5.2
61066 function random(min, max, floating) {
61067 if (floating && isIterateeCall(min, max, floating)) {
61068 max = floating = undefined;
61070 var noMin = min == null,
61071 noMax = max == null;
61073 if (floating == null) {
61074 if (noMax && typeof min == 'boolean') {
61077 } else if (typeof max == 'boolean') {
61082 if (noMin && noMax) {
61093 if (floating || min % 1 || max % 1) {
61094 var rand = nativeRandom();
61095 return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max);
61097 return baseRandom(min, max);
61100 /*------------------------------------------------------------------------*/
61103 * Converts `string` to [camel
61104 * case](https://en.wikipedia.org/wiki/CamelCase).
61110 * [string=''] The string to convert.
61111 * @returns {string} Returns the camel cased string.
61114 * _.camelCase('Foo Bar'); // => 'fooBar'
61116 * _.camelCase('--foo-bar'); // => 'fooBar'
61118 * _.camelCase('__foo_bar__'); // => 'fooBar'
61120 var camelCase = createCompounder(function(result, word, index) {
61121 word = word.toLowerCase();
61122 return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
61126 * Capitalizes the first character of `string`.
61132 * [string=''] The string to capitalize.
61133 * @returns {string} Returns the capitalized string.
61136 * _.capitalize('fred'); // => 'Fred'
61138 function capitalize(string) {
61139 string = baseToString(string);
61140 return string && (string.charAt(0).toUpperCase() + string.slice(1));
61144 * Deburrs `string` by converting [latin-1 supplementary
61145 * letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
61146 * to basic latin letters and removing [combining diacritical
61147 * marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
61153 * [string=''] The string to deburr.
61154 * @returns {string} Returns the deburred string.
61157 * _.deburr('déjàvu'); // => 'deja vu'
61159 function deburr(string) {
61160 string = baseToString(string);
61161 return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
61165 * Checks if `string` ends with the given target string.
61171 * [string=''] The string to search.
61173 * [target] The string to search for.
61175 * [position=string.length] The position to search from.
61176 * @returns {boolean} Returns `true` if `string` ends with `target`, else
61180 * _.endsWith('abc', 'c'); // => true
61182 * _.endsWith('abc', 'b'); // => false
61184 * _.endsWith('abc', 'b', 2); // => true
61186 function endsWith(string, target, position) {
61187 string = baseToString(string);
61188 target = (target + '');
61190 var length = string.length;
61191 position = position === undefined ? length : nativeMin(position < 0 ? 0 : (+position || 0), length);
61193 position -= target.length;
61194 return position >= 0 && string.indexOf(target, position) == position;
61198 * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string`
61199 * to their corresponding HTML entities.
61201 * **Note:** No other characters are escaped. To escape additional
61202 * characters use a third-party library like [_he_](https://mths.be/he).
61204 * Though the ">" character is escaped for symmetry, characters like ">" and
61205 * "/" don't need escaping in HTML and have no special meaning unless
61206 * they're part of a tag or unquoted attribute value. See [Mathias Bynens's
61207 * article](https://mathiasbynens.be/notes/ambiguous-ampersands) (under
61208 * "semi-related fun fact") for more details.
61210 * Backticks are escaped because in Internet Explorer < 9, they can break
61211 * out of attribute values or HTML comments. See
61212 * [#59](https://html5sec.org/#59), [#102](https://html5sec.org/#102),
61213 * [#108](https://html5sec.org/#108), and [#133](https://html5sec.org/#133)
61214 * of the [HTML5 Security Cheatsheet](https://html5sec.org/) for more
61217 * When working with HTML you should always [quote attribute
61218 * values](http://wonko.com/post/html-escaping) to reduce XSS vectors.
61224 * [string=''] The string to escape.
61225 * @returns {string} Returns the escaped string.
61228 * _.escape('fred, barney, & pebbles'); // => 'fred, barney, & pebbles'
61230 function escape(string) {
61231 // Reset `lastIndex` because in IE < 9 `String#replace` does not.
61232 string = baseToString(string);
61233 return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
61237 * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|",
61238 * "?", "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
61244 * [string=''] The string to escape.
61245 * @returns {string} Returns the escaped string.
61248 * _.escapeRegExp('[lodash](https://lodash.com/)'); // =>
61249 * '\[lodash\]\(https:\/\/lodash\.com\/\)'
61251 function escapeRegExp(string) {
61252 string = baseToString(string);
61253 return (string && reHasRegExpChars.test(string)) ? string.replace(reRegExpChars, escapeRegExpChar) : (string || '(?:)');
61257 * Converts `string` to [kebab
61258 * case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
61264 * [string=''] The string to convert.
61265 * @returns {string} Returns the kebab cased string.
61268 * _.kebabCase('Foo Bar'); // => 'foo-bar'
61270 * _.kebabCase('fooBar'); // => 'foo-bar'
61272 * _.kebabCase('__foo_bar__'); // => 'foo-bar'
61274 var kebabCase = createCompounder(function(result, word, index) {
61275 return result + (index ? '-' : '') + word.toLowerCase();
61279 * Pads `string` on the left and right sides if it's shorter than `length`.
61280 * Padding characters are truncated if they can't be evenly divided by
61287 * [string=''] The string to pad.
61289 * [length=0] The padding length.
61291 * [chars=' '] The string used as padding.
61292 * @returns {string} Returns the padded string.
61295 * _.pad('abc', 8); // => ' abc '
61297 * _.pad('abc', 8, '_-'); // => '_-abc_-_'
61299 * _.pad('abc', 3); // => 'abc'
61301 function pad(string, length, chars) {
61302 string = baseToString(string);
61305 var strLength = string.length;
61306 if (strLength >= length || !nativeIsFinite(length)) {
61309 var mid = (length - strLength) / 2,
61310 leftLength = nativeFloor(mid),
61311 rightLength = nativeCeil(mid);
61313 chars = createPadding('', rightLength, chars);
61314 return chars.slice(0, leftLength) + string + chars;
61318 * Pads `string` on the left side if it's shorter than `length`. Padding
61319 * characters are truncated if they exceed `length`.
61325 * [string=''] The string to pad.
61327 * [length=0] The padding length.
61329 * [chars=' '] The string used as padding.
61330 * @returns {string} Returns the padded string.
61333 * _.padLeft('abc', 6); // => ' abc'
61335 * _.padLeft('abc', 6, '_-'); // => '_-_abc'
61337 * _.padLeft('abc', 3); // => 'abc'
61339 var padLeft = createPadDir();
61342 * Pads `string` on the right side if it's shorter than `length`. Padding
61343 * characters are truncated if they exceed `length`.
61349 * [string=''] The string to pad.
61351 * [length=0] The padding length.
61353 * [chars=' '] The string used as padding.
61354 * @returns {string} Returns the padded string.
61357 * _.padRight('abc', 6); // => 'abc '
61359 * _.padRight('abc', 6, '_-'); // => 'abc_-_'
61361 * _.padRight('abc', 3); // => 'abc'
61363 var padRight = createPadDir(true);
61366 * Converts `string` to an integer of the specified radix. If `radix` is
61367 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
61368 * hexadecimal, in which case a `radix` of `16` is used.
61370 * **Note:** This method aligns with the [ES5
61371 * implementation](https://es5.github.io/#E) of `parseInt`.
61377 * string The string to convert.
61379 * [radix] The radix to interpret `value` by.
61380 * @param- {Object} [guard] Enables use as a callback for functions like
61382 * @returns {number} Returns the converted integer.
61385 * _.parseInt('08'); // => 8
61387 * _.map(['6', '08', '10'], _.parseInt); // => [6, 8, 10]
61389 function parseInt(string, radix, guard) {
61390 // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
61391 // Chrome fails to trim leading <BOM> whitespace characters.
61392 // See https://code.google.com/p/v8/issues/detail?id=3109 for more
61394 if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
61396 } else if (radix) {
61399 string = trim(string);
61400 return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
61404 * Repeats the given string `n` times.
61410 * [string=''] The string to repeat.
61412 * [n=0] The number of times to repeat the string.
61413 * @returns {string} Returns the repeated string.
61416 * _.repeat('*', 3); // => '***'
61418 * _.repeat('abc', 2); // => 'abcabc'
61420 * _.repeat('abc', 0); // => ''
61422 function repeat(string, n) {
61424 string = baseToString(string);
61426 if (n < 1 || !string || !nativeIsFinite(n)) {
61429 // Leverage the exponentiation by squaring algorithm for a faster
61431 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more
61437 n = nativeFloor(n / 2);
61445 * Converts `string` to [snake
61446 * case](https://en.wikipedia.org/wiki/Snake_case).
61452 * [string=''] The string to convert.
61453 * @returns {string} Returns the snake cased string.
61456 * _.snakeCase('Foo Bar'); // => 'foo_bar'
61458 * _.snakeCase('fooBar'); // => 'foo_bar'
61460 * _.snakeCase('--foo-bar'); // => 'foo_bar'
61462 var snakeCase = createCompounder(function(result, word, index) {
61463 return result + (index ? '_' : '') + word.toLowerCase();
61467 * Converts `string` to [start
61468 * case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
61474 * [string=''] The string to convert.
61475 * @returns {string} Returns the start cased string.
61478 * _.startCase('--foo-bar'); // => 'Foo Bar'
61480 * _.startCase('fooBar'); // => 'Foo Bar'
61482 * _.startCase('__foo_bar__'); // => 'Foo Bar'
61484 var startCase = createCompounder(function(result, word, index) {
61485 return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
61489 * Checks if `string` starts with the given target string.
61495 * [string=''] The string to search.
61497 * [target] The string to search for.
61499 * [position=0] The position to search from.
61500 * @returns {boolean} Returns `true` if `string` starts with `target`, else
61504 * _.startsWith('abc', 'a'); // => true
61506 * _.startsWith('abc', 'b'); // => false
61508 * _.startsWith('abc', 'b', 1); // => true
61510 function startsWith(string, target, position) {
61511 string = baseToString(string);
61512 position = position == null ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length);
61514 return string.lastIndexOf(target, position) == position;
61518 * Creates a compiled template function that can interpolate data properties
61519 * in "interpolate" delimiters, HTML-escape interpolated data properties in
61520 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters.
61521 * Data properties may be accessed as free variables in the template. If a
61522 * setting object is provided it takes precedence over `_.templateSettings`
61525 * **Note:** In the development build `_.template` utilizes
61526 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
61527 * for easier debugging.
61529 * For more information on precompiling templates see [lodash's custom
61530 * builds documentation](https://lodash.com/custom-builds).
61532 * For more information on Chrome extension sandboxes see [Chrome's
61534 * documentation](https://developer.chrome.com/extensions/sandboxingEval).
61540 * [string=''] The template string.
61542 * [options] The options object.
61544 * [options.escape] The HTML "escape" delimiter.
61546 * [options.evaluate] The "evaluate" delimiter.
61548 * [options.imports] An object to import into the template as
61551 * [options.interpolate] The "interpolate" delimiter.
61553 * [options.sourceURL] The sourceURL of the template's compiled
61556 * [options.variable] The data object variable name.
61557 * @param- {Object} [otherOptions] Enables the legacy `options` param
61559 * @returns {Function} Returns the compiled template function.
61561 * // using the "interpolate" delimiter to create a compiled
61562 * template var compiled = _.template('hello <%= user %>!'); compiled({
61563 * 'user': 'fred' }); // => 'hello fred!'
61564 * // using the HTML "escape" delimiter to escape data property values var
61565 * compiled = _.template('<b><%- value %></b>'); compiled({ 'value': '<script>'
61566 * }); // => '<b><script></b>'
61567 * // using the "evaluate" delimiter to execute JavaScript and generate
61568 * HTML var compiled = _.template('<% _.forEach(users, function(user) { %>
61569 * <li><%- user %></li><% }); %>'); compiled({ 'users': ['fred',
61570 * 'barney'] }); // => '
61573 * // using the internal `print` function in "evaluate" delimiters var
61574 * compiled = _.template('<% print("hello " + user); %>!'); compiled({
61575 * 'user': 'barney' }); // => 'hello barney!'
61576 * // using the ES delimiter as an alternative to the default "interpolate"
61577 * delimiter var compiled = _.template('hello ${ user }!'); compiled({
61578 * 'user': 'pebbles' }); // => 'hello pebbles!'
61579 * // using custom template delimiters _.templateSettings.interpolate =
61580 * /{{([\s\S]+?)}}/g; var compiled = _.template('hello {{ user }}!');
61581 * compiled({ 'user': 'mustache' }); // => 'hello mustache!'
61582 * // using backslashes to treat delimiters as plain text var compiled =
61583 * _.template('<%= "\\<%- value %\\>" %>'); compiled({ 'value': 'ignored'
61584 * }); // => '<%- value %>'
61585 * // using the `imports` option to import `jQuery` as `jq` var text = '<%
61586 * jq.each(users, function(user) { %>
61587 * <li><%- user %></li><% }); %>'; var compiled = _.template(text, {
61588 * 'imports': { 'jq': jQuery } }); compiled({ 'users': ['fred', 'barney']
61592 * // using the `sourceURL` option to specify a custom sourceURL for the
61593 * template var compiled = _.template('hello <%= user %>!', { 'sourceURL':
61594 * '/basic/greeting.jst' }); compiled(data); // => find the source of
61595 * "greeting.jst" under the Sources tab or Resources panel of the web
61597 * // using the `variable` option to ensure a with-statement isn't used in
61598 * the compiled template var compiled = _.template('hi <%= data.user %>!', {
61599 * 'variable': 'data' }); compiled.source; // => function(data) { // var
61600 * __t, __p = ''; // __p += 'hi ' + ((__t = ( data.user )) == null ? '' :
61601 * __t) + '!'; // return __p; // }
61602 * // using the `source` property to inline compiled templates for
61603 * meaningful // line numbers in error messages and a stack trace
61604 * fs.writeFileSync(path.join(cwd, 'jst.js'), '\ var JST = {\ "main": ' +
61605 * _.template(mainText).source + '\ };\ ');
61607 function template(string, options, otherOptions) {
61608 // Based on John Resig's `tmpl` implementation
61609 // (http://ejohn.org/blog/javascript-micro-templating/)
61610 // and Laura Doktorova's doT.js (https://github.com/olado/doT).
61611 var settings = lodash.templateSettings;
61613 if (otherOptions && isIterateeCall(string, options, otherOptions)) {
61614 options = otherOptions = undefined;
61616 string = baseToString(string);
61617 options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
61619 var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
61620 importsKeys = keys(imports),
61621 importsValues = baseValues(imports, importsKeys);
61626 interpolate = options.interpolate || reNoMatch,
61627 source = "__p += '";
61629 // Compile the regexp to match each delimiter.
61630 var reDelimiters = RegExp(
61631 (options.escape || reNoMatch).source + '|' +
61632 interpolate.source + '|' +
61633 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
61634 (options.evaluate || reNoMatch).source + '|$', 'g');
61636 // Use a sourceURL for easier debugging.
61637 var sourceURL = '//# sourceURL=' +
61638 ('sourceURL' in options ? options.sourceURL : ('lodash.templateSources[' + (++templateCounter) + ']')) + '\n';
61640 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
61641 interpolateValue || (interpolateValue = esTemplateValue);
61643 // Escape characters that can't be included in string literals.
61644 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
61646 // Replace delimiters with snippets.
61649 source += "' +\n__e(" + escapeValue + ") +\n'";
61651 if (evaluateValue) {
61652 isEvaluating = true;
61653 source += "';\n" + evaluateValue + ";\n__p += '";
61655 if (interpolateValue) {
61656 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
61658 index = offset + match.length;
61660 // The JS engine embedded in Adobe products requires returning the
61662 // string in order to produce the correct `offset` value.
61668 // If `variable` is not specified wrap a with-statement around the
61670 // code to add the data object to the top of the scope chain.
61671 var variable = options.variable;
61673 source = 'with (obj) {\n' + source + '\n}\n';
61675 // Cleanup code by stripping empty strings.
61676 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
61677 .replace(reEmptyStringMiddle, '$1')
61678 .replace(reEmptyStringTrailing, '$1;');
61680 // Frame code as the function body.
61681 source = 'function(' + (variable || 'obj') + ') {\n' +
61682 (variable ? '' : 'obj || (obj = {});\n') +
61683 "var __t, __p = ''" +
61684 (isEscaping ? ', __e = _.escape' : '') +
61685 (isEvaluating ? ', __j = Array.prototype.join;\n' +
61686 "function print() { __p += __j.call(arguments, '') }\n" : ';\n'
61691 var result = attempt(function() {
61692 return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues);
61695 // Provide the compiled function's source by its `toString` method or
61696 // the `source` property as a convenience for inlining compiled
61698 result.source = source;
61699 if (isError(result)) {
61706 * Removes leading and trailing whitespace or specified characters from
61713 * [string=''] The string to trim.
61715 * [chars=whitespace] The characters to trim.
61716 * @param- {Object} [guard] Enables use as a callback for functions like
61718 * @returns {string} Returns the trimmed string.
61721 * _.trim(' abc '); // => 'abc'
61723 * _.trim('-_-abc-_-', '_-'); // => 'abc'
61725 * _.map([' foo ', ' bar '], _.trim); // => ['foo', 'bar']
61727 function trim(string, chars, guard) {
61728 var value = string;
61729 string = baseToString(string);
61733 if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
61734 return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1);
61736 chars = (chars + '');
61737 return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1);
61741 * Removes leading whitespace or specified characters from `string`.
61747 * [string=''] The string to trim.
61749 * [chars=whitespace] The characters to trim.
61750 * @param- {Object} [guard] Enables use as a callback for functions like
61752 * @returns {string} Returns the trimmed string.
61755 * _.trimLeft(' abc '); // => 'abc '
61757 * _.trimLeft('-_-abc-_-', '_-'); // => 'abc-_-'
61759 function trimLeft(string, chars, guard) {
61760 var value = string;
61761 string = baseToString(string);
61765 if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
61766 return string.slice(trimmedLeftIndex(string));
61768 return string.slice(charsLeftIndex(string, (chars + '')));
61772 * Removes trailing whitespace or specified characters from `string`.
61778 * [string=''] The string to trim.
61780 * [chars=whitespace] The characters to trim.
61781 * @param- {Object} [guard] Enables use as a callback for functions like
61783 * @returns {string} Returns the trimmed string.
61786 * _.trimRight(' abc '); // => ' abc'
61788 * _.trimRight('-_-abc-_-', '_-'); // => '-_-abc'
61790 function trimRight(string, chars, guard) {
61791 var value = string;
61792 string = baseToString(string);
61796 if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
61797 return string.slice(0, trimmedRightIndex(string) + 1);
61799 return string.slice(0, charsRightIndex(string, (chars + '')) + 1);
61803 * Truncates `string` if it's longer than the given maximum string length.
61804 * The last characters of the truncated string are replaced with the
61805 * omission string which defaults to "...".
61811 * [string=''] The string to truncate.
61812 * @param {Object|number}
61813 * [options] The options object or maximum string length.
61815 * [options.length=30] The maximum string length.
61817 * [options.omission='...'] The string to indicate text is
61819 * @param {RegExp|string}
61820 * [options.separator] The separator pattern to truncate to.
61821 * @param- {Object} [guard] Enables use as a callback for functions like
61823 * @returns {string} Returns the truncated string.
61826 * _.trunc('hi-diddly-ho there, neighborino'); // => 'hi-diddly-ho there,
61829 * _.trunc('hi-diddly-ho there, neighborino', 24); // => 'hi-diddly-ho
61832 * _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' '
61833 * }); // => 'hi-diddly-ho there,...'
61835 * _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator':
61836 * /,? +/ }); // => 'hi-diddly-ho there...'
61838 * _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' [...]' }); // =>
61839 * 'hi-diddly-ho there, neig [...]'
61841 function trunc(string, options, guard) {
61842 if (guard && isIterateeCall(string, options, guard)) {
61843 options = undefined;
61845 var length = DEFAULT_TRUNC_LENGTH,
61846 omission = DEFAULT_TRUNC_OMISSION;
61848 if (options != null) {
61849 if (isObject(options)) {
61850 var separator = 'separator' in options ? options.separator : separator;
61851 length = 'length' in options ? (+options.length || 0) : length;
61852 omission = 'omission' in options ? baseToString(options.omission) : omission;
61854 length = +options || 0;
61857 string = baseToString(string);
61858 if (length >= string.length) {
61861 var end = length - omission.length;
61865 var result = string.slice(0, end);
61866 if (separator == null) {
61867 return result + omission;
61869 if (isRegExp(separator)) {
61870 if (string.slice(end).search(separator)) {
61873 substring = string.slice(0, end);
61875 if (!separator.global) {
61876 separator = RegExp(separator.source, (reFlags.exec(separator) || '') + 'g');
61878 separator.lastIndex = 0;
61879 while ((match = separator.exec(substring))) {
61880 newEnd = match.index;
61882 result = result.slice(0, newEnd == null ? end : newEnd);
61884 } else if (string.indexOf(separator, end) != end) {
61885 var index = result.lastIndexOf(separator);
61887 result = result.slice(0, index);
61890 return result + omission;
61894 * The inverse of `_.escape`; this method converts the HTML entities
61895 * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to
61896 * their corresponding characters.
61898 * **Note:** No other HTML entities are unescaped. To unescape additional
61899 * HTML entities use a third-party library like [_he_](https://mths.be/he).
61905 * [string=''] The string to unescape.
61906 * @returns {string} Returns the unescaped string.
61909 * _.unescape('fred, barney, & pebbles'); // => 'fred, barney, &
61912 function unescape(string) {
61913 string = baseToString(string);
61914 return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
61918 * Splits `string` into an array of its words.
61924 * [string=''] The string to inspect.
61925 * @param {RegExp|string}
61926 * [pattern] The pattern to match words.
61927 * @param- {Object} [guard] Enables use as a callback for functions like
61929 * @returns {Array} Returns the words of `string`.
61932 * _.words('fred, barney, & pebbles'); // => ['fred', 'barney', 'pebbles']
61934 * _.words('fred, barney, & pebbles', /[^, ]+/g); // => ['fred', 'barney',
61937 function words(string, pattern, guard) {
61938 if (guard && isIterateeCall(string, pattern, guard)) {
61939 pattern = undefined;
61941 string = baseToString(string);
61942 return string.match(pattern || reWords) || [];
61945 /*------------------------------------------------------------------------*/
61948 * Attempts to invoke `func`, returning either the result or the caught
61949 * error object. Any additional arguments are provided to `func` when it is
61954 * @category Utility
61955 * @param {Function}
61956 * func The function to attempt.
61957 * @returns {*} Returns the `func` result or error object.
61959 * // avoid throwing errors for invalid selectors var elements =
61960 * _.attempt(function(selector) { return
61961 * document.querySelectorAll(selector); }, '>_>');
61963 * if (_.isError(elements)) { elements = []; }
61965 var attempt = restParam(function(func, args) {
61967 return func.apply(undefined, args);
61969 return isError(e) ? e : new Error(e);
61974 * Creates a function that invokes `func` with the `this` binding of
61975 * `thisArg` and arguments of the created function. If `func` is a property
61976 * name the created callback returns the property value for a given element.
61977 * If `func` is an object the created callback returns `true` for elements
61978 * that contain the equivalent object properties, otherwise it returns
61984 * @category Utility
61986 * [func=_.identity] The value to convert to a callback.
61988 * [thisArg] The `this` binding of `func`.
61989 * @param- {Object} [guard] Enables use as a callback for functions like
61991 * @returns {Function} Returns the callback.
61994 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
61996 * // wrap to create custom callback shorthands _.callback =
61997 * _.wrap(_.callback, function(callback, func, thisArg) { var match =
61998 * /^(.+?)__([gl]t)(.+)$/.exec(func); if (!match) { return callback(func,
61999 * thisArg); } return function(object) { return match[2] == 'gt' ?
62000 * object[match[1]] > match[3] : object[match[1]] < match[3]; }; });
62002 * _.filter(users, 'age__gt36'); // => [{ 'user': 'fred', 'age': 40 }]
62004 function callback(func, thisArg, guard) {
62005 if (guard && isIterateeCall(func, thisArg, guard)) {
62006 thisArg = undefined;
62008 return isObjectLike(func) ? matches(func) : baseCallback(func, thisArg);
62012 * Creates a function that returns `value`.
62016 * @category Utility
62018 * value The value to return from the new function.
62019 * @returns {Function} Returns the new function.
62022 * var object = { 'user': 'fred' }; var getter = _.constant(object);
62024 * getter() === object; // => true
62026 function constant(value) {
62027 return function() {
62033 * This method returns the first argument provided to it.
62037 * @category Utility
62040 * @returns {*} Returns `value`.
62043 * var object = { 'user': 'fred' };
62045 * _.identity(object) === object; // => true
62047 function identity(value) {
62052 * Creates a function that performs a deep comparison between a given object
62053 * and `source`, returning `true` if the given object has equivalent
62054 * property values, else `false`.
62056 * **Note:** This method supports comparing arrays, booleans, `Date`
62057 * objects, numbers, `Object` objects, regexes, and strings. Objects are
62058 * compared by their own, not inherited, enumerable properties. For
62059 * comparing a single own or inherited property value see
62060 * `_.matchesProperty`.
62064 * @category Utility
62066 * source The object of property values to match.
62067 * @returns {Function} Returns the new function.
62070 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
62071 * 'fred', 'age': 40, 'active': false } ];
62073 * _.filter(users, _.matches({ 'age': 40, 'active': false })); // => [{
62074 * 'user': 'fred', 'age': 40, 'active': false }]
62076 function matches(source) {
62077 return baseMatches(baseClone(source, true));
62081 * Creates a function that compares the property value of `path` on a given
62082 * object to `value`.
62084 * **Note:** This method supports comparing arrays, booleans, `Date`
62085 * objects, numbers, `Object` objects, regexes, and strings. Objects are
62086 * compared by their own, not inherited, enumerable properties.
62090 * @category Utility
62091 * @param {Array|string}
62092 * path The path of the property to get.
62094 * srcValue The value to match.
62095 * @returns {Function} Returns the new function.
62098 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
62100 * _.find(users, _.matchesProperty('user', 'fred')); // => { 'user': 'fred' }
62102 function matchesProperty(path, srcValue) {
62103 return baseMatchesProperty(path, baseClone(srcValue, true));
62107 * Creates a function that invokes the method at `path` on a given object.
62108 * Any additional arguments are provided to the invoked method.
62112 * @category Utility
62113 * @param {Array|string}
62114 * path The path of the method to invoke.
62116 * [args] The arguments to invoke the method with.
62117 * @returns {Function} Returns the new function.
62120 * var objects = [ { 'a': { 'b': { 'c': _.constant(2) } } }, { 'a': { 'b': {
62121 * 'c': _.constant(1) } } } ];
62123 * _.map(objects, _.method('a.b.c')); // => [2, 1]
62125 * _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); // =>
62128 var method = restParam(function(path, args) {
62129 return function(object) {
62130 return invokePath(object, path, args);
62135 * The opposite of `_.method`; this method creates a function that invokes
62136 * the method at a given path on `object`. Any additional arguments are
62137 * provided to the invoked method.
62141 * @category Utility
62143 * object The object to query.
62145 * [args] The arguments to invoke the method with.
62146 * @returns {Function} Returns the new function.
62149 * var array = _.times(3, _.constant), object = { 'a': array, 'b': array,
62152 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); // => [2, 0]
62154 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); // => [2, 0]
62156 var methodOf = restParam(function(object, args) {
62157 return function(path) {
62158 return invokePath(object, path, args);
62163 * Adds all own enumerable function properties of a source object to the
62164 * destination object. If `object` is a function then methods are added to
62165 * its prototype as well.
62167 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
62168 * avoid conflicts caused by modifying the original.
62172 * @category Utility
62173 * @param {Function|Object}
62174 * [object=lodash] The destination object.
62176 * source The object of functions to add.
62178 * [options] The options object.
62180 * [options.chain=true] Specify whether the functions added are
62182 * @returns {Function|Object} Returns `object`.
62185 * function vowels(string) { return _.filter(string, function(v) { return
62186 * /[aeiou]/i.test(v); }); }
62188 * _.mixin({ 'vowels': vowels }); _.vowels('fred'); // => ['e']
62190 * _('fred').vowels().value(); // => ['e']
62192 * _.mixin({ 'vowels': vowels }, { 'chain': false }); _('fred').vowels(); // =>
62195 function mixin(object, source, options) {
62196 if (options == null) {
62197 var isObj = isObject(source),
62198 props = isObj ? keys(source) : undefined,
62199 methodNames = (props && props.length) ? baseFunctions(source, props) : undefined;
62201 if (!(methodNames ? methodNames.length : isObj)) {
62202 methodNames = false;
62208 if (!methodNames) {
62209 methodNames = baseFunctions(source, keys(source));
62213 isFunc = isFunction(object),
62214 length = methodNames.length;
62216 if (options === false) {
62218 } else if (isObject(options) && 'chain' in options) {
62219 chain = options.chain;
62221 while (++index < length) {
62222 var methodName = methodNames[index],
62223 func = source[methodName];
62225 object[methodName] = func;
62227 object.prototype[methodName] = (function(func) {
62228 return function() {
62229 var chainAll = this.__chain__;
62230 if (chain || chainAll) {
62231 var result = object(this.__wrapped__),
62232 actions = result.__actions__ = arrayCopy(this.__actions__);
62239 result.__chain__ = chainAll;
62242 return func.apply(object, arrayPush([this.value()], arguments));
62251 * Reverts the `_` variable to its previous value and returns a reference to
62252 * the `lodash` function.
62256 * @category Utility
62257 * @returns {Function} Returns the `lodash` function.
62260 * var lodash = _.noConflict();
62262 function noConflict() {
62268 * A no-operation function that returns `undefined` regardless of the
62269 * arguments it receives.
62273 * @category Utility
62276 * var object = { 'user': 'fred' };
62278 * _.noop(object) === undefined; // => true
62281 // No operation performed.
62285 * Creates a function that returns the property value at `path` on a given
62290 * @category Utility
62291 * @param {Array|string}
62292 * path The path of the property to get.
62293 * @returns {Function} Returns the new function.
62296 * var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ];
62298 * _.map(objects, _.property('a.b.c')); // => [2, 1]
62300 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); // =>
62303 function property(path) {
62304 return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
62308 * The opposite of `_.property`; this method creates a function that returns
62309 * the property value at a given path on `object`.
62313 * @category Utility
62315 * object The object to query.
62316 * @returns {Function} Returns the new function.
62319 * var array = [0, 1, 2], object = { 'a': array, 'b': array, 'c': array };
62321 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); // => [2, 0]
62323 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); // => [2, 0]
62325 function propertyOf(object) {
62326 return function(path) {
62327 return baseGet(object, toPath(path), path + '');
62332 * Creates an array of numbers (positive and/or negative) progressing from
62333 * `start` up to, but not including, `end`. If `end` is not specified it is
62334 * set to `start` with `start` then set to `0`. If `end` is less than
62335 * `start` a zero-length range is created unless a negative `step` is
62340 * @category Utility
62342 * [start=0] The start of the range.
62344 * end The end of the range.
62346 * [step=1] The value to increment or decrement by.
62347 * @returns {Array} Returns the new array of numbers.
62350 * _.range(4); // => [0, 1, 2, 3]
62352 * _.range(1, 5); // => [1, 2, 3, 4]
62354 * _.range(0, 20, 5); // => [0, 5, 10, 15]
62356 * _.range(0, -4, -1); // => [0, -1, -2, -3]
62358 * _.range(1, 4, 0); // => [1, 1, 1]
62360 * _.range(0); // => []
62362 function range(start, end, step) {
62363 if (step && isIterateeCall(start, end, step)) {
62364 end = step = undefined;
62366 start = +start || 0;
62367 step = step == null ? 1 : (+step || 0);
62375 // Use `Array(length)` so engines like Chakra and V8 avoid slower modes.
62376 // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details.
62378 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
62379 result = Array(length);
62381 while (++index < length) {
62382 result[index] = start;
62389 * Invokes the iteratee function `n` times, returning an array of the
62390 * results of each invocation. The `iteratee` is bound to `thisArg` and
62391 * invoked with one argument; (index).
62395 * @category Utility
62397 * n The number of times to invoke `iteratee`.
62398 * @param {Function}
62399 * [iteratee=_.identity] The function invoked per iteration.
62401 * [thisArg] The `this` binding of `iteratee`.
62402 * @returns {Array} Returns the array of results.
62405 * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false)); // => [3,
62408 * _.times(3, function(n) { mage.castSpell(n); }); // => invokes
62409 * `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
62411 * _.times(3, function(n) { this.cast(n); }, mage); // => also invokes
62412 * `mage.castSpell(n)` three times
62414 function times(n, iteratee, thisArg) {
62415 n = nativeFloor(n);
62417 // Exit early to avoid a JSC JIT bug in Safari 8
62418 // where `Array(0)` is treated as `Array(1)`.
62419 if (n < 1 || !nativeIsFinite(n)) {
62423 result = Array(nativeMin(n, MAX_ARRAY_LENGTH));
62425 iteratee = bindCallback(iteratee, thisArg, 1);
62426 while (++index < n) {
62427 if (index < MAX_ARRAY_LENGTH) {
62428 result[index] = iteratee(index);
62437 * Generates a unique ID. If `prefix` is provided the ID is appended to it.
62441 * @category Utility
62443 * [prefix] The value to prefix the ID with.
62444 * @returns {string} Returns the unique ID.
62447 * _.uniqueId('contact_'); // => 'contact_104'
62449 * _.uniqueId(); // => '105'
62451 function uniqueId(prefix) {
62452 var id = ++idCounter;
62453 return baseToString(prefix) + id;
62456 /*------------------------------------------------------------------------*/
62459 * Adds two numbers.
62465 * augend The first number to add.
62467 * addend The second number to add.
62468 * @returns {number} Returns the sum.
62471 * _.add(6, 4); // => 10
62473 function add(augend, addend) {
62474 return (+augend || 0) + (+addend || 0);
62478 * Calculates `n` rounded up to `precision`.
62484 * n The number to round up.
62486 * [precision=0] The precision to round up to.
62487 * @returns {number} Returns the rounded up number.
62490 * _.ceil(4.006); // => 5
62492 * _.ceil(6.004, 2); // => 6.01
62494 * _.ceil(6040, -2); // => 6100
62496 var ceil = createRound('ceil');
62499 * Calculates `n` rounded down to `precision`.
62505 * n The number to round down.
62507 * [precision=0] The precision to round down to.
62508 * @returns {number} Returns the rounded down number.
62511 * _.floor(4.006); // => 4
62513 * _.floor(0.046, 2); // => 0.04
62515 * _.floor(4060, -2); // => 4000
62517 var floor = createRound('floor');
62520 * Gets the maximum value of `collection`. If `collection` is empty or
62521 * falsey `-Infinity` is returned. If an iteratee function is provided it is
62522 * invoked for each value in `collection` to generate the criterion by which
62523 * the value is ranked. The `iteratee` is bound to `thisArg` and invoked
62524 * with three arguments: (value, index, collection).
62526 * If a property name is provided for `iteratee` the created `_.property`
62527 * style callback returns the property value of the given element.
62529 * If a value is also provided for `thisArg` the created `_.matchesProperty`
62530 * style callback returns `true` for elements that have a matching property
62531 * value, else `false`.
62533 * If an object is provided for `iteratee` the created `_.matches` style
62534 * callback returns `true` for elements that have the properties of the
62535 * given object, else `false`.
62540 * @param {Array|Object|string}
62541 * collection The collection to iterate over.
62542 * @param {Function|Object|string}
62543 * [iteratee] The function invoked per iteration.
62545 * [thisArg] The `this` binding of `iteratee`.
62546 * @returns {*} Returns the maximum value.
62549 * _.max([4, 2, 8, 6]); // => 8
62551 * _.max([]); // => -Infinity
62553 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
62556 * _.max(users, function(chr) { return chr.age; }); // => { 'user': 'fred',
62558 * // using the `_.property` callback shorthand _.max(users, 'age'); // => {
62559 * 'user': 'fred', 'age': 40 }
62561 var max = createExtremum(gt, NEGATIVE_INFINITY);
62564 * Gets the minimum value of `collection`. If `collection` is empty or
62565 * falsey `Infinity` is returned. If an iteratee function is provided it is
62566 * invoked for each value in `collection` to generate the criterion by which
62567 * the value is ranked. The `iteratee` is bound to `thisArg` and invoked
62568 * with three arguments: (value, index, collection).
62570 * If a property name is provided for `iteratee` the created `_.property`
62571 * style callback returns the property value of the given element.
62573 * If a value is also provided for `thisArg` the created `_.matchesProperty`
62574 * style callback returns `true` for elements that have a matching property
62575 * value, else `false`.
62577 * If an object is provided for `iteratee` the created `_.matches` style
62578 * callback returns `true` for elements that have the properties of the
62579 * given object, else `false`.
62584 * @param {Array|Object|string}
62585 * collection The collection to iterate over.
62586 * @param {Function|Object|string}
62587 * [iteratee] The function invoked per iteration.
62589 * [thisArg] The `this` binding of `iteratee`.
62590 * @returns {*} Returns the minimum value.
62593 * _.min([4, 2, 8, 6]); // => 2
62595 * _.min([]); // => Infinity
62597 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
62600 * _.min(users, function(chr) { return chr.age; }); // => { 'user':
62601 * 'barney', 'age': 36 }
62602 * // using the `_.property` callback shorthand _.min(users, 'age'); // => {
62603 * 'user': 'barney', 'age': 36 }
62605 var min = createExtremum(lt, POSITIVE_INFINITY);
62608 * Calculates `n` rounded to `precision`.
62614 * n The number to round.
62616 * [precision=0] The precision to round to.
62617 * @returns {number} Returns the rounded number.
62620 * _.round(4.006); // => 4
62622 * _.round(4.006, 2); // => 4.01
62624 * _.round(4060, -2); // => 4100
62626 var round = createRound('round');
62629 * Gets the sum of the values in `collection`.
62634 * @param {Array|Object|string}
62635 * collection The collection to iterate over.
62636 * @param {Function|Object|string}
62637 * [iteratee] The function invoked per iteration.
62639 * [thisArg] The `this` binding of `iteratee`.
62640 * @returns {number} Returns the sum.
62643 * _.sum([4, 6]); // => 10
62645 * _.sum({ 'a': 4, 'b': 6 }); // => 10
62647 * var objects = [ { 'n': 4 }, { 'n': 6 } ];
62649 * _.sum(objects, function(object) { return object.n; }); // => 10
62650 * // using the `_.property` callback shorthand _.sum(objects, 'n'); // =>
62653 function sum(collection, iteratee, thisArg) {
62654 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
62655 iteratee = undefined;
62657 iteratee = getCallback(iteratee, thisArg, 3);
62658 return iteratee.length == 1 ? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee) : baseSum(collection, iteratee);
62661 /*------------------------------------------------------------------------*/
62663 // Ensure wrappers are instances of `baseLodash`.
62664 lodash.prototype = baseLodash.prototype;
62666 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
62667 LodashWrapper.prototype.constructor = LodashWrapper;
62669 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
62670 LazyWrapper.prototype.constructor = LazyWrapper;
62672 // Add functions to the `Map` cache.
62673 MapCache.prototype['delete'] = mapDelete;
62674 MapCache.prototype.get = mapGet;
62675 MapCache.prototype.has = mapHas;
62676 MapCache.prototype.set = mapSet;
62678 // Add functions to the `Set` cache.
62679 SetCache.prototype.push = cachePush;
62681 // Assign cache to `_.memoize`.
62682 memoize.Cache = MapCache;
62684 // Add functions that return wrapped values when chaining.
62685 lodash.after = after;
62687 lodash.assign = assign;
62689 lodash.before = before;
62690 lodash.bind = bind;
62691 lodash.bindAll = bindAll;
62692 lodash.bindKey = bindKey;
62693 lodash.callback = callback;
62694 lodash.chain = chain;
62695 lodash.chunk = chunk;
62696 lodash.compact = compact;
62697 lodash.constant = constant;
62698 lodash.countBy = countBy;
62699 lodash.create = create;
62700 lodash.curry = curry;
62701 lodash.curryRight = curryRight;
62702 lodash.debounce = debounce;
62703 lodash.defaults = defaults;
62704 lodash.defaultsDeep = defaultsDeep;
62705 lodash.defer = defer;
62706 lodash.delay = delay;
62707 lodash.difference = difference;
62708 lodash.drop = drop;
62709 lodash.dropRight = dropRight;
62710 lodash.dropRightWhile = dropRightWhile;
62711 lodash.dropWhile = dropWhile;
62712 lodash.fill = fill;
62713 lodash.filter = filter;
62714 lodash.flatten = flatten;
62715 lodash.flattenDeep = flattenDeep;
62716 lodash.flow = flow;
62717 lodash.flowRight = flowRight;
62718 lodash.forEach = forEach;
62719 lodash.forEachRight = forEachRight;
62720 lodash.forIn = forIn;
62721 lodash.forInRight = forInRight;
62722 lodash.forOwn = forOwn;
62723 lodash.forOwnRight = forOwnRight;
62724 lodash.functions = functions;
62725 lodash.groupBy = groupBy;
62726 lodash.indexBy = indexBy;
62727 lodash.initial = initial;
62728 lodash.intersection = intersection;
62729 lodash.invert = invert;
62730 lodash.invoke = invoke;
62731 lodash.keys = keys;
62732 lodash.keysIn = keysIn;
62734 lodash.mapKeys = mapKeys;
62735 lodash.mapValues = mapValues;
62736 lodash.matches = matches;
62737 lodash.matchesProperty = matchesProperty;
62738 lodash.memoize = memoize;
62739 lodash.merge = merge;
62740 lodash.method = method;
62741 lodash.methodOf = methodOf;
62742 lodash.mixin = mixin;
62743 lodash.modArgs = modArgs;
62744 lodash.negate = negate;
62745 lodash.omit = omit;
62746 lodash.once = once;
62747 lodash.pairs = pairs;
62748 lodash.partial = partial;
62749 lodash.partialRight = partialRight;
62750 lodash.partition = partition;
62751 lodash.pick = pick;
62752 lodash.pluck = pluck;
62753 lodash.property = property;
62754 lodash.propertyOf = propertyOf;
62755 lodash.pull = pull;
62756 lodash.pullAt = pullAt;
62757 lodash.range = range;
62758 lodash.rearg = rearg;
62759 lodash.reject = reject;
62760 lodash.remove = remove;
62761 lodash.rest = rest;
62762 lodash.restParam = restParam;
62764 lodash.shuffle = shuffle;
62765 lodash.slice = slice;
62766 lodash.sortBy = sortBy;
62767 lodash.sortByAll = sortByAll;
62768 lodash.sortByOrder = sortByOrder;
62769 lodash.spread = spread;
62770 lodash.take = take;
62771 lodash.takeRight = takeRight;
62772 lodash.takeRightWhile = takeRightWhile;
62773 lodash.takeWhile = takeWhile;
62775 lodash.throttle = throttle;
62776 lodash.thru = thru;
62777 lodash.times = times;
62778 lodash.toArray = toArray;
62779 lodash.toPlainObject = toPlainObject;
62780 lodash.transform = transform;
62781 lodash.union = union;
62782 lodash.uniq = uniq;
62783 lodash.unzip = unzip;
62784 lodash.unzipWith = unzipWith;
62785 lodash.values = values;
62786 lodash.valuesIn = valuesIn;
62787 lodash.where = where;
62788 lodash.without = without;
62789 lodash.wrap = wrap;
62792 lodash.zipObject = zipObject;
62793 lodash.zipWith = zipWith;
62796 lodash.backflow = flowRight;
62797 lodash.collect = map;
62798 lodash.compose = flowRight;
62799 lodash.each = forEach;
62800 lodash.eachRight = forEachRight;
62801 lodash.extend = assign;
62802 lodash.iteratee = callback;
62803 lodash.methods = functions;
62804 lodash.object = zipObject;
62805 lodash.select = filter;
62806 lodash.tail = rest;
62807 lodash.unique = uniq;
62809 // Add functions to `lodash.prototype`.
62810 mixin(lodash, lodash);
62812 /*------------------------------------------------------------------------*/
62814 // Add functions that return unwrapped values when chaining.
62816 lodash.attempt = attempt;
62817 lodash.camelCase = camelCase;
62818 lodash.capitalize = capitalize;
62819 lodash.ceil = ceil;
62820 lodash.clone = clone;
62821 lodash.cloneDeep = cloneDeep;
62822 lodash.deburr = deburr;
62823 lodash.endsWith = endsWith;
62824 lodash.escape = escape;
62825 lodash.escapeRegExp = escapeRegExp;
62826 lodash.every = every;
62827 lodash.find = find;
62828 lodash.findIndex = findIndex;
62829 lodash.findKey = findKey;
62830 lodash.findLast = findLast;
62831 lodash.findLastIndex = findLastIndex;
62832 lodash.findLastKey = findLastKey;
62833 lodash.findWhere = findWhere;
62834 lodash.first = first;
62835 lodash.floor = floor;
62840 lodash.identity = identity;
62841 lodash.includes = includes;
62842 lodash.indexOf = indexOf;
62843 lodash.inRange = inRange;
62844 lodash.isArguments = isArguments;
62845 lodash.isArray = isArray;
62846 lodash.isBoolean = isBoolean;
62847 lodash.isDate = isDate;
62848 lodash.isElement = isElement;
62849 lodash.isEmpty = isEmpty;
62850 lodash.isEqual = isEqual;
62851 lodash.isError = isError;
62852 lodash.isFinite = isFinite;
62853 lodash.isFunction = isFunction;
62854 lodash.isMatch = isMatch;
62855 lodash.isNaN = isNaN;
62856 lodash.isNative = isNative;
62857 lodash.isNull = isNull;
62858 lodash.isNumber = isNumber;
62859 lodash.isObject = isObject;
62860 lodash.isPlainObject = isPlainObject;
62861 lodash.isRegExp = isRegExp;
62862 lodash.isString = isString;
62863 lodash.isTypedArray = isTypedArray;
62864 lodash.isUndefined = isUndefined;
62865 lodash.kebabCase = kebabCase;
62866 lodash.last = last;
62867 lodash.lastIndexOf = lastIndexOf;
62872 lodash.noConflict = noConflict;
62873 lodash.noop = noop;
62876 lodash.padLeft = padLeft;
62877 lodash.padRight = padRight;
62878 lodash.parseInt = parseInt;
62879 lodash.random = random;
62880 lodash.reduce = reduce;
62881 lodash.reduceRight = reduceRight;
62882 lodash.repeat = repeat;
62883 lodash.result = result;
62884 lodash.round = round;
62885 lodash.runInContext = runInContext;
62886 lodash.size = size;
62887 lodash.snakeCase = snakeCase;
62888 lodash.some = some;
62889 lodash.sortedIndex = sortedIndex;
62890 lodash.sortedLastIndex = sortedLastIndex;
62891 lodash.startCase = startCase;
62892 lodash.startsWith = startsWith;
62894 lodash.template = template;
62895 lodash.trim = trim;
62896 lodash.trimLeft = trimLeft;
62897 lodash.trimRight = trimRight;
62898 lodash.trunc = trunc;
62899 lodash.unescape = unescape;
62900 lodash.uniqueId = uniqueId;
62901 lodash.words = words;
62904 lodash.all = every;
62906 lodash.contains = includes;
62907 lodash.eq = isEqual;
62908 lodash.detect = find;
62909 lodash.foldl = reduce;
62910 lodash.foldr = reduceRight;
62911 lodash.head = first;
62912 lodash.include = includes;
62913 lodash.inject = reduce;
62915 mixin(lodash, (function() {
62917 baseForOwn(lodash, function(func, methodName) {
62918 if (!lodash.prototype[methodName]) {
62919 source[methodName] = func;
62925 /*------------------------------------------------------------------------*/
62927 // Add functions capable of returning wrapped and unwrapped values when
62929 lodash.sample = sample;
62931 lodash.prototype.sample = function(n) {
62932 if (!this.__chain__ && n == null) {
62933 return sample(this.value());
62935 return this.thru(function(value) {
62936 return sample(value, n);
62940 /*------------------------------------------------------------------------*/
62943 * The semantic version number.
62949 lodash.VERSION = VERSION;
62951 // Assign default placeholders.
62952 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
62953 lodash[methodName].placeholder = lodash;
62956 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
62957 arrayEach(['drop', 'take'], function(methodName, index) {
62958 LazyWrapper.prototype[methodName] = function(n) {
62959 var filtered = this.__filtered__;
62960 if (filtered && !index) {
62961 return new LazyWrapper(this);
62963 n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0);
62965 var result = this.clone();
62967 result.__takeCount__ = nativeMin(result.__takeCount__, n);
62969 result.__views__.push({
62971 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
62977 LazyWrapper.prototype[methodName + 'Right'] = function(n) {
62978 return this.reverse()[methodName](n).reverse();
62982 // Add `LazyWrapper` methods that accept an `iteratee` value.
62983 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
62984 var type = index + 1,
62985 isFilter = type != LAZY_MAP_FLAG;
62987 LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
62988 var result = this.clone();
62989 result.__iteratees__.push({
62990 'iteratee': getCallback(iteratee, thisArg, 1),
62993 result.__filtered__ = result.__filtered__ || isFilter;
62998 // Add `LazyWrapper` methods for `_.first` and `_.last`.
62999 arrayEach(['first', 'last'], function(methodName, index) {
63000 var takeName = 'take' + (index ? 'Right' : '');
63002 LazyWrapper.prototype[methodName] = function() {
63003 return this[takeName](1).value()[0];
63007 // Add `LazyWrapper` methods for `_.initial` and `_.rest`.
63008 arrayEach(['initial', 'rest'], function(methodName, index) {
63009 var dropName = 'drop' + (index ? '' : 'Right');
63011 LazyWrapper.prototype[methodName] = function() {
63012 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
63016 // Add `LazyWrapper` methods for `_.pluck` and `_.where`.
63017 arrayEach(['pluck', 'where'], function(methodName, index) {
63018 var operationName = index ? 'filter' : 'map',
63019 createCallback = index ? baseMatches : property;
63021 LazyWrapper.prototype[methodName] = function(value) {
63022 return this[operationName](createCallback(value));
63026 LazyWrapper.prototype.compact = function() {
63027 return this.filter(identity);
63030 LazyWrapper.prototype.reject = function(predicate, thisArg) {
63031 predicate = getCallback(predicate, thisArg, 1);
63032 return this.filter(function(value) {
63033 return !predicate(value);
63037 LazyWrapper.prototype.slice = function(start, end) {
63038 start = start == null ? 0 : (+start || 0);
63041 if (result.__filtered__ && (start > 0 || end < 0)) {
63042 return new LazyWrapper(result);
63045 result = result.takeRight(-start);
63046 } else if (start) {
63047 result = result.drop(start);
63049 if (end !== undefined) {
63051 result = end < 0 ? result.dropRight(-end) : result.take(end - start);
63056 LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) {
63057 return this.reverse().takeWhile(predicate, thisArg).reverse();
63060 LazyWrapper.prototype.toArray = function() {
63061 return this.take(POSITIVE_INFINITY);
63064 // Add `LazyWrapper` methods to `lodash.prototype`.
63065 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
63066 var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName),
63067 retUnwrapped = /^(?:first|last)$/.test(methodName),
63068 lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName];
63073 lodash.prototype[methodName] = function() {
63074 var args = retUnwrapped ? [1] : arguments,
63075 chainAll = this.__chain__,
63076 value = this.__wrapped__,
63077 isHybrid = !!this.__actions__.length,
63078 isLazy = value instanceof LazyWrapper,
63079 iteratee = args[0],
63080 useLazy = isLazy || isArray(value);
63082 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
63083 // Avoid lazy use if the iteratee has a "length" value other than
63085 isLazy = useLazy = false;
63087 var interceptor = function(value) {
63088 return (retUnwrapped && chainAll) ? lodashFunc(value, 1)[0] : lodashFunc.apply(undefined, arrayPush([value], args));
63093 'args': [interceptor],
63094 'thisArg': undefined
63096 onlyLazy = isLazy && !isHybrid;
63098 if (retUnwrapped && !chainAll) {
63100 value = value.clone();
63101 value.__actions__.push(action);
63102 return func.call(value);
63104 return lodashFunc.call(undefined, this.value())[0];
63106 if (!retUnwrapped && useLazy) {
63107 value = onlyLazy ? value : new LazyWrapper(this);
63108 var result = func.apply(value, args);
63109 result.__actions__.push(action);
63110 return new LodashWrapper(result, chainAll);
63112 return this.thru(interceptor);
63116 // Add `Array` and `String` methods to `lodash.prototype`.
63117 arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
63118 var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName],
63119 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
63120 retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName);
63122 lodash.prototype[methodName] = function() {
63123 var args = arguments;
63124 if (retUnwrapped && !this.__chain__) {
63125 return func.apply(this.value(), args);
63127 return this[chainName](function(value) {
63128 return func.apply(value, args);
63133 // Map minified function names to their real names.
63134 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
63135 var lodashFunc = lodash[methodName];
63137 var key = lodashFunc.name,
63138 names = realNames[key] || (realNames[key] = []);
63141 'name': methodName,
63147 realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{
63152 // Add functions to the lazy wrapper.
63153 LazyWrapper.prototype.clone = lazyClone;
63154 LazyWrapper.prototype.reverse = lazyReverse;
63155 LazyWrapper.prototype.value = lazyValue;
63157 // Add chaining functions to the `lodash` wrapper.
63158 lodash.prototype.chain = wrapperChain;
63159 lodash.prototype.commit = wrapperCommit;
63160 lodash.prototype.concat = wrapperConcat;
63161 lodash.prototype.plant = wrapperPlant;
63162 lodash.prototype.reverse = wrapperReverse;
63163 lodash.prototype.toString = wrapperToString;
63164 lodash.prototype.run = lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
63166 // Add function aliases to the `lodash` wrapper.
63167 lodash.prototype.collect = lodash.prototype.map;
63168 lodash.prototype.head = lodash.prototype.first;
63169 lodash.prototype.select = lodash.prototype.filter;
63170 lodash.prototype.tail = lodash.prototype.rest;
63175 /*--------------------------------------------------------------------------*/
63178 var _ = runInContext();
63180 // Some AMD build optimizers like r.js check for condition patterns like the
63182 if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
63183 // Expose lodash to the global object when an AMD loader is present to avoid
63184 // errors in cases where lodash is loaded by a script tag and not intended
63185 // as an AMD module. See http://requirejs.org/docs/errors.html#mismatch for
63189 // Define as an anonymous module so, through path mapping, it can be
63190 // referenced as the "underscore" module.
63191 define(function() {
63195 // Check for `exports` after `define` in case a build optimizer adds an
63196 // `exports` object.
63197 else if (freeExports && freeModule) {
63198 // Export for Node.js or RingoJS.
63199 if (moduleExports) {
63200 (freeModule.exports = _)._ = _;
63202 // Export for Rhino with CommonJS support.
63207 // Export for a browser or Rhino.
63212 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
63214 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js": [function(require, module, exports) {
63215 var baseCreate = require('./baseCreate'),
63216 baseLodash = require('./baseLodash');
63218 /** Used as references for `-Infinity` and `Infinity`. */
63219 var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
63222 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
63226 * value The value to wrap.
63228 function LazyWrapper(value) {
63229 this.__wrapped__ = value;
63230 this.__actions__ = [];
63232 this.__filtered__ = false;
63233 this.__iteratees__ = [];
63234 this.__takeCount__ = POSITIVE_INFINITY;
63235 this.__views__ = [];
63238 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
63239 LazyWrapper.prototype.constructor = LazyWrapper;
63241 module.exports = LazyWrapper;
63244 "./baseCreate": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js",
63245 "./baseLodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js"
63247 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LodashWrapper.js": [function(require, module, exports) {
63248 var baseCreate = require('./baseCreate'),
63249 baseLodash = require('./baseLodash');
63252 * The base constructor for creating `lodash` wrapper objects.
63256 * value The value to wrap.
63258 * [chainAll] Enable chaining for all wrapper methods.
63260 * [actions=[]] Actions to peform to resolve the unwrapped value.
63262 function LodashWrapper(value, chainAll, actions) {
63263 this.__wrapped__ = value;
63264 this.__actions__ = actions || [];
63265 this.__chain__ = !!chainAll;
63268 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
63269 LodashWrapper.prototype.constructor = LodashWrapper;
63271 module.exports = LodashWrapper;
63274 "./baseCreate": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js",
63275 "./baseLodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js"
63277 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\SetCache.js": [function(require, module, exports) {
63278 (function(global) {
63279 var cachePush = require('./cachePush'),
63280 getNative = require('./getNative');
63282 /** Native method references. */
63283 var Set = getNative(global, 'Set');
63286 * Native method references for those with the same name as other `lodash`
63289 var nativeCreate = getNative(Object, 'create');
63293 * Creates a cache object to store unique values.
63297 * [values] The values to cache.
63299 function SetCache(values) {
63300 var length = values ? values.length : 0;
63303 'hash': nativeCreate(null),
63307 this.push(values[length]);
63311 // Add functions to the `Set` cache.
63312 SetCache.prototype.push = cachePush;
63314 module.exports = SetCache;
63316 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
63318 "./cachePush": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cachePush.js",
63319 "./getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
63321 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js": [function(require, module, exports) {
63323 * Copies the values of `source` to `array`.
63327 * source The array to copy values from.
63329 * [array=[]] The array to copy values to.
63330 * @returns {Array} Returns `array`.
63332 function arrayCopy(source, array) {
63334 length = source.length;
63336 array || (array = Array(length));
63337 while (++index < length) {
63338 array[index] = source[index];
63343 module.exports = arrayCopy;
63346 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEach.js": [function(require, module, exports) {
63348 * A specialized version of `_.forEach` for arrays without support for callback
63349 * shorthands and `this` binding.
63353 * array The array to iterate over.
63354 * @param {Function}
63355 * iteratee The function invoked per iteration.
63356 * @returns {Array} Returns `array`.
63358 function arrayEach(array, iteratee) {
63360 length = array.length;
63362 while (++index < length) {
63363 if (iteratee(array[index], index, array) === false) {
63370 module.exports = arrayEach;
63373 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEvery.js": [function(require, module, exports) {
63375 * A specialized version of `_.every` for arrays without support for callback
63376 * shorthands and `this` binding.
63380 * array The array to iterate over.
63381 * @param {Function}
63382 * predicate The function invoked per iteration.
63383 * @returns {boolean} Returns `true` if all elements pass the predicate check,
63386 function arrayEvery(array, predicate) {
63388 length = array.length;
63390 while (++index < length) {
63391 if (!predicate(array[index], index, array)) {
63398 module.exports = arrayEvery;
63401 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayFilter.js": [function(require, module, exports) {
63403 * A specialized version of `_.filter` for arrays without support for callback
63404 * shorthands and `this` binding.
63408 * array The array to iterate over.
63409 * @param {Function}
63410 * predicate The function invoked per iteration.
63411 * @returns {Array} Returns the new filtered array.
63413 function arrayFilter(array, predicate) {
63415 length = array.length,
63419 while (++index < length) {
63420 var value = array[index];
63421 if (predicate(value, index, array)) {
63422 result[++resIndex] = value;
63428 module.exports = arrayFilter;
63431 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayMap.js": [function(require, module, exports) {
63433 * A specialized version of `_.map` for arrays without support for callback
63434 * shorthands and `this` binding.
63438 * array The array to iterate over.
63439 * @param {Function}
63440 * iteratee The function invoked per iteration.
63441 * @returns {Array} Returns the new mapped array.
63443 function arrayMap(array, iteratee) {
63445 length = array.length,
63446 result = Array(length);
63448 while (++index < length) {
63449 result[index] = iteratee(array[index], index, array);
63454 module.exports = arrayMap;
63457 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayPush.js": [function(require, module, exports) {
63459 * Appends the elements of `values` to `array`.
63463 * array The array to modify.
63465 * values The values to append.
63466 * @returns {Array} Returns `array`.
63468 function arrayPush(array, values) {
63470 length = values.length,
63471 offset = array.length;
63473 while (++index < length) {
63474 array[offset + index] = values[index];
63479 module.exports = arrayPush;
63482 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayReduce.js": [function(require, module, exports) {
63484 * A specialized version of `_.reduce` for arrays without support for callback
63485 * shorthands and `this` binding.
63489 * array The array to iterate over.
63490 * @param {Function}
63491 * iteratee The function invoked per iteration.
63493 * [accumulator] The initial value.
63495 * [initFromArray] Specify using the first element of `array` as the
63497 * @returns {*} Returns the accumulated value.
63499 function arrayReduce(array, iteratee, accumulator, initFromArray) {
63501 length = array.length;
63503 if (initFromArray && length) {
63504 accumulator = array[++index];
63506 while (++index < length) {
63507 accumulator = iteratee(accumulator, array[index], index, array);
63509 return accumulator;
63512 module.exports = arrayReduce;
63515 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arraySome.js": [function(require, module, exports) {
63517 * A specialized version of `_.some` for arrays without support for callback
63518 * shorthands and `this` binding.
63522 * array The array to iterate over.
63523 * @param {Function}
63524 * predicate The function invoked per iteration.
63525 * @returns {boolean} Returns `true` if any element passes the predicate check,
63528 function arraySome(array, predicate) {
63530 length = array.length;
63532 while (++index < length) {
63533 if (predicate(array[index], index, array)) {
63540 module.exports = arraySome;
63543 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\assignWith.js": [function(require, module, exports) {
63544 var keys = require('../object/keys');
63547 * A specialized version of `_.assign` for customizing assigned values without
63548 * support for argument juggling, multiple sources, and `this` binding
63549 * `customizer` functions.
63553 * object The destination object.
63555 * source The source object.
63556 * @param {Function}
63557 * customizer The function to customize assigned values.
63558 * @returns {Object} Returns `object`.
63560 function assignWith(object, source, customizer) {
63562 props = keys(source),
63563 length = props.length;
63565 while (++index < length) {
63566 var key = props[index],
63567 value = object[key],
63568 result = customizer(value, source[key], key, object, source);
63570 if ((result === result ? (result !== value) : (value === value)) ||
63571 (value === undefined && !(key in object))) {
63572 object[key] = result;
63578 module.exports = assignWith;
63581 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
63583 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseAssign.js": [function(require, module, exports) {
63584 var baseCopy = require('./baseCopy'),
63585 keys = require('../object/keys');
63588 * The base implementation of `_.assign` without support for argument juggling,
63589 * multiple sources, and `customizer` functions.
63593 * object The destination object.
63595 * source The source object.
63596 * @returns {Object} Returns `object`.
63598 function baseAssign(object, source) {
63599 return source == null ? object : baseCopy(source, keys(source), object);
63602 module.exports = baseAssign;
63605 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
63606 "./baseCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCopy.js"
63608 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js": [function(require, module, exports) {
63609 var baseMatches = require('./baseMatches'),
63610 baseMatchesProperty = require('./baseMatchesProperty'),
63611 bindCallback = require('./bindCallback'),
63612 identity = require('../utility/identity'),
63613 property = require('../utility/property');
63616 * The base implementation of `_.callback` which supports specifying the number
63617 * of arguments to provide to `func`.
63621 * [func=_.identity] The value to convert to a callback.
63623 * [thisArg] The `this` binding of `func`.
63625 * [argCount] The number of arguments to provide to `func`.
63626 * @returns {Function} Returns the callback.
63628 function baseCallback(func, thisArg, argCount) {
63629 var type = typeof func;
63630 if (type == 'function') {
63631 return thisArg === undefined ? func : bindCallback(func, thisArg, argCount);
63633 if (func == null) {
63636 if (type == 'object') {
63637 return baseMatches(func);
63639 return thisArg === undefined ? property(func) : baseMatchesProperty(func, thisArg);
63642 module.exports = baseCallback;
63645 "../utility/identity": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js",
63646 "../utility/property": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\property.js",
63647 "./baseMatches": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatches.js",
63648 "./baseMatchesProperty": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatchesProperty.js",
63649 "./bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js"
63651 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCompareAscending.js": [function(require, module, exports) {
63653 * The base implementation of `compareAscending` which compares values and sorts
63654 * them in ascending order without guaranteeing a stable sort.
63658 * value The value to compare.
63660 * other The other value to compare.
63661 * @returns {number} Returns the sort order indicator for `value`.
63663 function baseCompareAscending(value, other) {
63664 if (value !== other) {
63665 var valIsNull = value === null,
63666 valIsUndef = value === undefined,
63667 valIsReflexive = value === value;
63669 var othIsNull = other === null,
63670 othIsUndef = other === undefined,
63671 othIsReflexive = other === other;
63673 if ((value > other && !othIsNull) || !valIsReflexive ||
63674 (valIsNull && !othIsUndef && othIsReflexive) ||
63675 (valIsUndef && othIsReflexive)) {
63678 if ((value < other && !valIsNull) || !othIsReflexive ||
63679 (othIsNull && !valIsUndef && valIsReflexive) ||
63680 (othIsUndef && valIsReflexive)) {
63687 module.exports = baseCompareAscending;
63690 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCopy.js": [function(require, module, exports) {
63692 * Copies properties of `source` to `object`.
63696 * source The object to copy properties from.
63698 * props The property names to copy.
63700 * [object={}] The object to copy properties to.
63701 * @returns {Object} Returns `object`.
63703 function baseCopy(source, props, object) {
63704 object || (object = {});
63707 length = props.length;
63709 while (++index < length) {
63710 var key = props[index];
63711 object[key] = source[key];
63716 module.exports = baseCopy;
63719 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js": [function(require, module, exports) {
63720 var isObject = require('../lang/isObject');
63723 * The base implementation of `_.create` without support for assigning
63724 * properties to the created object.
63728 * prototype The object to inherit from.
63729 * @returns {Object} Returns the new object.
63731 var baseCreate = (function() {
63732 function object() {}
63733 return function(prototype) {
63734 if (isObject(prototype)) {
63735 object.prototype = prototype;
63736 var result = new object;
63737 object.prototype = undefined;
63739 return result || {};
63743 module.exports = baseCreate;
63746 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
63748 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDelay.js": [function(require, module, exports) {
63749 /** Used as the `TypeError` message for "Functions" methods. */
63750 var FUNC_ERROR_TEXT = 'Expected a function';
63753 * The base implementation of `_.delay` and `_.defer` which accepts an index of
63754 * where to slice the arguments to provide to `func`.
63757 * @param {Function}
63758 * func The function to delay.
63760 * wait The number of milliseconds to delay invocation.
63762 * args The arguments provide to `func`.
63763 * @returns {number} Returns the timer id.
63765 function baseDelay(func, wait, args) {
63766 if (typeof func != 'function') {
63767 throw new TypeError(FUNC_ERROR_TEXT);
63769 return setTimeout(function() {
63770 func.apply(undefined, args);
63774 module.exports = baseDelay;
63777 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDifference.js": [function(require, module, exports) {
63778 var baseIndexOf = require('./baseIndexOf'),
63779 cacheIndexOf = require('./cacheIndexOf'),
63780 createCache = require('./createCache');
63782 /** Used as the size to enable large array optimizations. */
63783 var LARGE_ARRAY_SIZE = 200;
63786 * The base implementation of `_.difference` which accepts a single array of
63787 * values to exclude.
63791 * array The array to inspect.
63793 * values The values to exclude.
63794 * @returns {Array} Returns the new array of filtered values.
63796 function baseDifference(array, values) {
63797 var length = array ? array.length : 0,
63804 indexOf = baseIndexOf,
63806 cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
63807 valuesLength = values.length;
63810 indexOf = cacheIndexOf;
63815 while (++index < length) {
63816 var value = array[index];
63818 if (isCommon && value === value) {
63819 var valuesIndex = valuesLength;
63820 while (valuesIndex--) {
63821 if (values[valuesIndex] === value) {
63825 result.push(value);
63826 } else if (indexOf(values, value, 0) < 0) {
63827 result.push(value);
63833 module.exports = baseDifference;
63836 "./baseIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js",
63837 "./cacheIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cacheIndexOf.js",
63838 "./createCache": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCache.js"
63840 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js": [function(require, module, exports) {
63841 var baseForOwn = require('./baseForOwn'),
63842 createBaseEach = require('./createBaseEach');
63845 * The base implementation of `_.forEach` without support for callback
63846 * shorthands and `this` binding.
63849 * @param {Array|Object|string}
63850 * collection The collection to iterate over.
63851 * @param {Function}
63852 * iteratee The function invoked per iteration.
63853 * @returns {Array|Object|string} Returns `collection`.
63855 var baseEach = createBaseEach(baseForOwn);
63857 module.exports = baseEach;
63860 "./baseForOwn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForOwn.js",
63861 "./createBaseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseEach.js"
63863 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEvery.js": [function(require, module, exports) {
63864 var baseEach = require('./baseEach');
63867 * The base implementation of `_.every` without support for callback shorthands
63868 * and `this` binding.
63871 * @param {Array|Object|string}
63872 * collection The collection to iterate over.
63873 * @param {Function}
63874 * predicate The function invoked per iteration.
63875 * @returns {boolean} Returns `true` if all elements pass the predicate check,
63878 function baseEvery(collection, predicate) {
63880 baseEach(collection, function(value, index, collection) {
63881 result = !!predicate(value, index, collection);
63887 module.exports = baseEvery;
63890 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
63892 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFilter.js": [function(require, module, exports) {
63893 var baseEach = require('./baseEach');
63896 * The base implementation of `_.filter` without support for callback shorthands
63897 * and `this` binding.
63900 * @param {Array|Object|string}
63901 * collection The collection to iterate over.
63902 * @param {Function}
63903 * predicate The function invoked per iteration.
63904 * @returns {Array} Returns the new filtered array.
63906 function baseFilter(collection, predicate) {
63908 baseEach(collection, function(value, index, collection) {
63909 if (predicate(value, index, collection)) {
63910 result.push(value);
63916 module.exports = baseFilter;
63919 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
63921 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFind.js": [function(require, module, exports) {
63923 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and
63924 * `_.findLastKey`, without support for callback shorthands and `this` binding,
63925 * which iterates over `collection` using the provided `eachFunc`.
63928 * @param {Array|Object|string}
63929 * collection The collection to search.
63930 * @param {Function}
63931 * predicate The function invoked per iteration.
63932 * @param {Function}
63933 * eachFunc The function to iterate over `collection`.
63935 * [retKey] Specify returning the key of the found element instead of
63936 * the element itself.
63937 * @returns {*} Returns the found element or its key, else `undefined`.
63939 function baseFind(collection, predicate, eachFunc, retKey) {
63941 eachFunc(collection, function(value, key, collection) {
63942 if (predicate(value, key, collection)) {
63943 result = retKey ? key : value;
63950 module.exports = baseFind;
63953 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFindIndex.js": [function(require, module, exports) {
63955 * The base implementation of `_.findIndex` and `_.findLastIndex` without
63956 * support for callback shorthands and `this` binding.
63960 * array The array to search.
63961 * @param {Function}
63962 * predicate The function invoked per iteration.
63964 * [fromRight] Specify iterating from right to left.
63965 * @returns {number} Returns the index of the matched value, else `-1`.
63967 function baseFindIndex(array, predicate, fromRight) {
63968 var length = array.length,
63969 index = fromRight ? length : -1;
63971 while ((fromRight ? index-- : ++index < length)) {
63972 if (predicate(array[index], index, array)) {
63979 module.exports = baseFindIndex;
63982 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js": [function(require, module, exports) {
63983 var arrayPush = require('./arrayPush'),
63984 isArguments = require('../lang/isArguments'),
63985 isArray = require('../lang/isArray'),
63986 isArrayLike = require('./isArrayLike'),
63987 isObjectLike = require('./isObjectLike');
63990 * The base implementation of `_.flatten` with added support for restricting
63991 * flattening and specifying the start index.
63995 * array The array to flatten.
63997 * [isDeep] Specify a deep flatten.
63999 * [isStrict] Restrict flattening to arrays-like objects.
64001 * [result=[]] The initial result value.
64002 * @returns {Array} Returns the new flattened array.
64004 function baseFlatten(array, isDeep, isStrict, result) {
64005 result || (result = []);
64008 length = array.length;
64010 while (++index < length) {
64011 var value = array[index];
64012 if (isObjectLike(value) && isArrayLike(value) &&
64013 (isStrict || isArray(value) || isArguments(value))) {
64015 // Recursively flatten arrays (susceptible to call stack limits).
64016 baseFlatten(value, isDeep, isStrict, result);
64018 arrayPush(result, value);
64020 } else if (!isStrict) {
64021 result[result.length] = value;
64027 module.exports = baseFlatten;
64030 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
64031 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64032 "./arrayPush": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayPush.js",
64033 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
64034 "./isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
64036 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFor.js": [function(require, module, exports) {
64037 var createBaseFor = require('./createBaseFor');
64040 * The base implementation of `baseForIn` and `baseForOwn` which iterates over
64041 * `object` properties returned by `keysFunc` invoking `iteratee` for each
64042 * property. Iteratee functions may exit iteration early by explicitly returning
64047 * object The object to iterate over.
64048 * @param {Function}
64049 * iteratee The function invoked per iteration.
64050 * @param {Function}
64051 * keysFunc The function to get the keys of `object`.
64052 * @returns {Object} Returns `object`.
64054 var baseFor = createBaseFor();
64056 module.exports = baseFor;
64059 "./createBaseFor": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseFor.js"
64061 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForIn.js": [function(require, module, exports) {
64062 var baseFor = require('./baseFor'),
64063 keysIn = require('../object/keysIn');
64066 * The base implementation of `_.forIn` without support for callback shorthands
64067 * and `this` binding.
64071 * object The object to iterate over.
64072 * @param {Function}
64073 * iteratee The function invoked per iteration.
64074 * @returns {Object} Returns `object`.
64076 function baseForIn(object, iteratee) {
64077 return baseFor(object, iteratee, keysIn);
64080 module.exports = baseForIn;
64083 "../object/keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js",
64084 "./baseFor": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFor.js"
64086 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForOwn.js": [function(require, module, exports) {
64087 var baseFor = require('./baseFor'),
64088 keys = require('../object/keys');
64091 * The base implementation of `_.forOwn` without support for callback shorthands
64092 * and `this` binding.
64096 * object The object to iterate over.
64097 * @param {Function}
64098 * iteratee The function invoked per iteration.
64099 * @returns {Object} Returns `object`.
64101 function baseForOwn(object, iteratee) {
64102 return baseFor(object, iteratee, keys);
64105 module.exports = baseForOwn;
64108 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
64109 "./baseFor": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFor.js"
64111 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseGet.js": [function(require, module, exports) {
64112 var toObject = require('./toObject');
64115 * The base implementation of `get` without support for string paths and default
64120 * object The object to query.
64122 * path The path of the property to get.
64124 * [pathKey] The key representation of path.
64125 * @returns {*} Returns the resolved value.
64127 function baseGet(object, path, pathKey) {
64128 if (object == null) {
64131 if (pathKey !== undefined && pathKey in toObject(object)) {
64135 length = path.length;
64137 while (object != null && index < length) {
64138 object = object[path[index++]];
64140 return (index && index == length) ? object : undefined;
64143 module.exports = baseGet;
64146 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
64148 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js": [function(require, module, exports) {
64149 var indexOfNaN = require('./indexOfNaN');
64152 * The base implementation of `_.indexOf` without support for binary searches.
64156 * array The array to search.
64158 * value The value to search for.
64160 * fromIndex The index to search from.
64161 * @returns {number} Returns the index of the matched value, else `-1`.
64163 function baseIndexOf(array, value, fromIndex) {
64164 if (value !== value) {
64165 return indexOfNaN(array, fromIndex);
64167 var index = fromIndex - 1,
64168 length = array.length;
64170 while (++index < length) {
64171 if (array[index] === value) {
64178 module.exports = baseIndexOf;
64181 "./indexOfNaN": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\indexOfNaN.js"
64183 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqual.js": [function(require, module, exports) {
64184 var baseIsEqualDeep = require('./baseIsEqualDeep'),
64185 isObject = require('../lang/isObject'),
64186 isObjectLike = require('./isObjectLike');
64189 * The base implementation of `_.isEqual` without support for `this` binding
64190 * `customizer` functions.
64194 * value The value to compare.
64196 * other The other value to compare.
64197 * @param {Function}
64198 * [customizer] The function to customize comparing values.
64200 * [isLoose] Specify performing partial comparisons.
64202 * [stackA] Tracks traversed `value` objects.
64204 * [stackB] Tracks traversed `other` objects.
64205 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
64207 function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
64208 if (value === other) {
64211 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
64212 return value !== value && other !== other;
64214 return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
64217 module.exports = baseIsEqual;
64220 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
64221 "./baseIsEqualDeep": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqualDeep.js",
64222 "./isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
64224 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqualDeep.js": [function(require, module, exports) {
64225 var equalArrays = require('./equalArrays'),
64226 equalByTag = require('./equalByTag'),
64227 equalObjects = require('./equalObjects'),
64228 isArray = require('../lang/isArray'),
64229 isTypedArray = require('../lang/isTypedArray');
64231 /** `Object#toString` result references. */
64232 var argsTag = '[object Arguments]',
64233 arrayTag = '[object Array]',
64234 objectTag = '[object Object]';
64236 /** Used for native method references. */
64237 var objectProto = Object.prototype;
64239 /** Used to check objects for own properties. */
64240 var hasOwnProperty = objectProto.hasOwnProperty;
64243 * Used to resolve the
64244 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
64247 var objToString = objectProto.toString;
64250 * A specialized version of `baseIsEqual` for arrays and objects which performs
64251 * deep comparisons and tracks traversed objects enabling objects with circular
64252 * references to be compared.
64256 * object The object to compare.
64258 * other The other object to compare.
64259 * @param {Function}
64260 * equalFunc The function to determine equivalents of values.
64261 * @param {Function}
64262 * [customizer] The function to customize comparing objects.
64264 * [isLoose] Specify performing partial comparisons.
64266 * [stackA=[]] Tracks traversed `value` objects.
64268 * [stackB=[]] Tracks traversed `other` objects.
64269 * @returns {boolean} Returns `true` if the objects are equivalent, else
64272 function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
64273 var objIsArr = isArray(object),
64274 othIsArr = isArray(other),
64279 objTag = objToString.call(object);
64280 if (objTag == argsTag) {
64281 objTag = objectTag;
64282 } else if (objTag != objectTag) {
64283 objIsArr = isTypedArray(object);
64287 othTag = objToString.call(other);
64288 if (othTag == argsTag) {
64289 othTag = objectTag;
64290 } else if (othTag != objectTag) {
64291 othIsArr = isTypedArray(other);
64294 var objIsObj = objTag == objectTag,
64295 othIsObj = othTag == objectTag,
64296 isSameTag = objTag == othTag;
64298 if (isSameTag && !(objIsArr || objIsObj)) {
64299 return equalByTag(object, other, objTag);
64302 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
64303 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
64305 if (objIsWrapped || othIsWrapped) {
64306 return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
64312 // Assume cyclic values are equal.
64313 // For more information on detecting circular references see
64314 // https://es5.github.io/#JO.
64315 stackA || (stackA = []);
64316 stackB || (stackB = []);
64318 var length = stackA.length;
64320 if (stackA[length] == object) {
64321 return stackB[length] == other;
64324 // Add `object` and `other` to the stack of traversed objects.
64325 stackA.push(object);
64326 stackB.push(other);
64328 var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
64336 module.exports = baseIsEqualDeep;
64339 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64340 "../lang/isTypedArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js",
64341 "./equalArrays": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalArrays.js",
64342 "./equalByTag": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalByTag.js",
64343 "./equalObjects": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalObjects.js"
64345 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsMatch.js": [function(require, module, exports) {
64346 var baseIsEqual = require('./baseIsEqual'),
64347 toObject = require('./toObject');
64350 * The base implementation of `_.isMatch` without support for callback
64351 * shorthands and `this` binding.
64355 * object The object to inspect.
64357 * matchData The propery names, values, and compare flags to match.
64358 * @param {Function}
64359 * [customizer] The function to customize comparing objects.
64360 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
64362 function baseIsMatch(object, matchData, customizer) {
64363 var index = matchData.length,
64365 noCustomizer = !customizer;
64367 if (object == null) {
64370 object = toObject(object);
64372 var data = matchData[index];
64373 if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object)) {
64377 while (++index < length) {
64378 data = matchData[index];
64380 objValue = object[key],
64381 srcValue = data[1];
64383 if (noCustomizer && data[2]) {
64384 if (objValue === undefined && !(key in object)) {
64388 var result = customizer ? customizer(objValue, srcValue, key) : undefined;
64389 if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
64397 module.exports = baseIsMatch;
64400 "./baseIsEqual": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqual.js",
64401 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
64403 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js": [function(require, module, exports) {
64405 * The function whose prototype all chaining wrappers inherit from.
64409 function baseLodash() {
64410 // No operation performed.
64413 module.exports = baseLodash;
64416 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMap.js": [function(require, module, exports) {
64417 var baseEach = require('./baseEach'),
64418 isArrayLike = require('./isArrayLike');
64421 * The base implementation of `_.map` without support for callback shorthands
64422 * and `this` binding.
64425 * @param {Array|Object|string}
64426 * collection The collection to iterate over.
64427 * @param {Function}
64428 * iteratee The function invoked per iteration.
64429 * @returns {Array} Returns the new mapped array.
64431 function baseMap(collection, iteratee) {
64433 result = isArrayLike(collection) ? Array(collection.length) : [];
64435 baseEach(collection, function(value, key, collection) {
64436 result[++index] = iteratee(value, key, collection);
64441 module.exports = baseMap;
64444 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
64445 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js"
64447 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatches.js": [function(require, module, exports) {
64448 var baseIsMatch = require('./baseIsMatch'),
64449 getMatchData = require('./getMatchData'),
64450 toObject = require('./toObject');
64453 * The base implementation of `_.matches` which does not clone `source`.
64457 * source The object of property values to match.
64458 * @returns {Function} Returns the new function.
64460 function baseMatches(source) {
64461 var matchData = getMatchData(source);
64462 if (matchData.length == 1 && matchData[0][2]) {
64463 var key = matchData[0][0],
64464 value = matchData[0][1];
64466 return function(object) {
64467 if (object == null) {
64470 return object[key] === value && (value !== undefined || (key in toObject(object)));
64473 return function(object) {
64474 return baseIsMatch(object, matchData);
64478 module.exports = baseMatches;
64481 "./baseIsMatch": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsMatch.js",
64482 "./getMatchData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getMatchData.js",
64483 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
64485 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatchesProperty.js": [function(require, module, exports) {
64486 var baseGet = require('./baseGet'),
64487 baseIsEqual = require('./baseIsEqual'),
64488 baseSlice = require('./baseSlice'),
64489 isArray = require('../lang/isArray'),
64490 isKey = require('./isKey'),
64491 isStrictComparable = require('./isStrictComparable'),
64492 last = require('../array/last'),
64493 toObject = require('./toObject'),
64494 toPath = require('./toPath');
64497 * The base implementation of `_.matchesProperty` which does not clone
64502 * path The path of the property to get.
64504 * srcValue The value to compare.
64505 * @returns {Function} Returns the new function.
64507 function baseMatchesProperty(path, srcValue) {
64508 var isArr = isArray(path),
64509 isCommon = isKey(path) && isStrictComparable(srcValue),
64510 pathKey = (path + '');
64512 path = toPath(path);
64513 return function(object) {
64514 if (object == null) {
64518 object = toObject(object);
64519 if ((isArr || !isCommon) && !(key in object)) {
64520 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
64521 if (object == null) {
64525 object = toObject(object);
64527 return object[key] === srcValue ? (srcValue !== undefined || (key in object)) : baseIsEqual(srcValue, object[key], undefined, true);
64531 module.exports = baseMatchesProperty;
64534 "../array/last": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\last.js",
64535 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64536 "./baseGet": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseGet.js",
64537 "./baseIsEqual": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqual.js",
64538 "./baseSlice": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSlice.js",
64539 "./isKey": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isKey.js",
64540 "./isStrictComparable": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isStrictComparable.js",
64541 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js",
64542 "./toPath": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toPath.js"
64544 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMerge.js": [function(require, module, exports) {
64545 var arrayEach = require('./arrayEach'),
64546 baseMergeDeep = require('./baseMergeDeep'),
64547 isArray = require('../lang/isArray'),
64548 isArrayLike = require('./isArrayLike'),
64549 isObject = require('../lang/isObject'),
64550 isObjectLike = require('./isObjectLike'),
64551 isTypedArray = require('../lang/isTypedArray'),
64552 keys = require('../object/keys');
64555 * The base implementation of `_.merge` without support for argument juggling,
64556 * multiple sources, and `this` binding `customizer` functions.
64560 * object The destination object.
64562 * source The source object.
64563 * @param {Function}
64564 * [customizer] The function to customize merged values.
64566 * [stackA=[]] Tracks traversed source objects.
64568 * [stackB=[]] Associates values with source counterparts.
64569 * @returns {Object} Returns `object`.
64571 function baseMerge(object, source, customizer, stackA, stackB) {
64572 if (!isObject(object)) {
64575 var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
64576 props = isSrcArr ? undefined : keys(source);
64578 arrayEach(props || source, function(srcValue, key) {
64581 srcValue = source[key];
64583 if (isObjectLike(srcValue)) {
64584 stackA || (stackA = []);
64585 stackB || (stackB = []);
64586 baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
64588 var value = object[key],
64589 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
64590 isCommon = result === undefined;
64595 if ((result !== undefined || (isSrcArr && !(key in object))) &&
64596 (isCommon || (result === result ? (result !== value) : (value === value)))) {
64597 object[key] = result;
64604 module.exports = baseMerge;
64607 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64608 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
64609 "../lang/isTypedArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js",
64610 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
64611 "./arrayEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEach.js",
64612 "./baseMergeDeep": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMergeDeep.js",
64613 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
64614 "./isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
64616 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMergeDeep.js": [function(require, module, exports) {
64617 var arrayCopy = require('./arrayCopy'),
64618 isArguments = require('../lang/isArguments'),
64619 isArray = require('../lang/isArray'),
64620 isArrayLike = require('./isArrayLike'),
64621 isPlainObject = require('../lang/isPlainObject'),
64622 isTypedArray = require('../lang/isTypedArray'),
64623 toPlainObject = require('../lang/toPlainObject');
64626 * A specialized version of `baseMerge` for arrays and objects which performs
64627 * deep merges and tracks traversed objects enabling objects with circular
64628 * references to be merged.
64632 * object The destination object.
64634 * source The source object.
64636 * key The key of the value to merge.
64637 * @param {Function}
64638 * mergeFunc The function to merge values.
64639 * @param {Function}
64640 * [customizer] The function to customize merged values.
64642 * [stackA=[]] Tracks traversed source objects.
64644 * [stackB=[]] Associates values with source counterparts.
64645 * @returns {boolean} Returns `true` if the objects are equivalent, else
64648 function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
64649 var length = stackA.length,
64650 srcValue = source[key];
64653 if (stackA[length] == srcValue) {
64654 object[key] = stackB[length];
64658 var value = object[key],
64659 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
64660 isCommon = result === undefined;
64664 if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
64665 result = isArray(value) ? value : (isArrayLike(value) ? arrayCopy(value) : []);
64666 } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
64667 result = isArguments(value) ? toPlainObject(value) : (isPlainObject(value) ? value : {});
64672 // Add the source value to the stack of traversed objects and associate
64673 // it with its merged value.
64674 stackA.push(srcValue);
64675 stackB.push(result);
64678 // Recursively merge objects and arrays (susceptible to call stack limits).
64679 object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
64680 } else if (result === result ? (result !== value) : (value === value)) {
64681 object[key] = result;
64685 module.exports = baseMergeDeep;
64688 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
64689 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64690 "../lang/isPlainObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isPlainObject.js",
64691 "../lang/isTypedArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js",
64692 "../lang/toPlainObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\toPlainObject.js",
64693 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
64694 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js"
64696 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseProperty.js": [function(require, module, exports) {
64698 * The base implementation of `_.property` without support for deep paths.
64702 * key The key of the property to get.
64703 * @returns {Function} Returns the new function.
64705 function baseProperty(key) {
64706 return function(object) {
64707 return object == null ? undefined : object[key];
64711 module.exports = baseProperty;
64714 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\basePropertyDeep.js": [function(require, module, exports) {
64715 var baseGet = require('./baseGet'),
64716 toPath = require('./toPath');
64719 * A specialized version of `baseProperty` which supports deep paths.
64722 * @param {Array|string}
64723 * path The path of the property to get.
64724 * @returns {Function} Returns the new function.
64726 function basePropertyDeep(path) {
64727 var pathKey = (path + '');
64728 path = toPath(path);
64729 return function(object) {
64730 return baseGet(object, path, pathKey);
64734 module.exports = basePropertyDeep;
64737 "./baseGet": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseGet.js",
64738 "./toPath": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toPath.js"
64740 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseReduce.js": [function(require, module, exports) {
64742 * The base implementation of `_.reduce` and `_.reduceRight` without support for
64743 * callback shorthands and `this` binding, which iterates over `collection`
64744 * using the provided `eachFunc`.
64747 * @param {Array|Object|string}
64748 * collection The collection to iterate over.
64749 * @param {Function}
64750 * iteratee The function invoked per iteration.
64752 * accumulator The initial value.
64754 * initFromCollection Specify using the first or last element of
64755 * `collection` as the initial value.
64756 * @param {Function}
64757 * eachFunc The function to iterate over `collection`.
64758 * @returns {*} Returns the accumulated value.
64760 function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
64761 eachFunc(collection, function(value, index, collection) {
64762 accumulator = initFromCollection ? (initFromCollection = false, value) : iteratee(accumulator, value, index, collection);
64764 return accumulator;
64767 module.exports = baseReduce;
64770 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSetData.js": [function(require, module, exports) {
64771 var identity = require('../utility/identity'),
64772 metaMap = require('./metaMap');
64775 * The base implementation of `setData` without support for hot loop detection.
64778 * @param {Function}
64779 * func The function to associate metadata with.
64781 * data The metadata.
64782 * @returns {Function} Returns `func`.
64784 var baseSetData = !metaMap ? identity : function(func, data) {
64785 metaMap.set(func, data);
64789 module.exports = baseSetData;
64792 "../utility/identity": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js",
64793 "./metaMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\metaMap.js"
64795 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSlice.js": [function(require, module, exports) {
64797 * The base implementation of `_.slice` without an iteratee call guard.
64801 * array The array to slice.
64803 * [start=0] The start position.
64805 * [end=array.length] The end position.
64806 * @returns {Array} Returns the slice of `array`.
64808 function baseSlice(array, start, end) {
64810 length = array.length;
64812 start = start == null ? 0 : (+start || 0);
64814 start = -start > length ? 0 : (length + start);
64816 end = (end === undefined || end > length) ? length : (+end || 0);
64820 length = start > end ? 0 : ((end - start) >>> 0);
64823 var result = Array(length);
64824 while (++index < length) {
64825 result[index] = array[index + start];
64830 module.exports = baseSlice;
64833 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSome.js": [function(require, module, exports) {
64834 var baseEach = require('./baseEach');
64837 * The base implementation of `_.some` without support for callback shorthands
64838 * and `this` binding.
64841 * @param {Array|Object|string}
64842 * collection The collection to iterate over.
64843 * @param {Function}
64844 * predicate The function invoked per iteration.
64845 * @returns {boolean} Returns `true` if any element passes the predicate check,
64848 function baseSome(collection, predicate) {
64851 baseEach(collection, function(value, index, collection) {
64852 result = predicate(value, index, collection);
64858 module.exports = baseSome;
64861 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
64863 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSortBy.js": [function(require, module, exports) {
64865 * The base implementation of `_.sortBy` which uses `comparer` to define the
64866 * sort order of `array` and replaces criteria objects with their corresponding
64871 * array The array to sort.
64872 * @param {Function}
64873 * comparer The function to define sort order.
64874 * @returns {Array} Returns `array`.
64876 function baseSortBy(array, comparer) {
64877 var length = array.length;
64879 array.sort(comparer);
64881 array[length] = array[length].value;
64886 module.exports = baseSortBy;
64889 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseToString.js": [function(require, module, exports) {
64891 * Converts `value` to a string if it's not one. An empty string is returned for
64892 * `null` or `undefined` values.
64896 * value The value to process.
64897 * @returns {string} Returns the string.
64899 function baseToString(value) {
64900 return value == null ? '' : (value + '');
64903 module.exports = baseToString;
64906 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseUniq.js": [function(require, module, exports) {
64907 var baseIndexOf = require('./baseIndexOf'),
64908 cacheIndexOf = require('./cacheIndexOf'),
64909 createCache = require('./createCache');
64911 /** Used as the size to enable large array optimizations. */
64912 var LARGE_ARRAY_SIZE = 200;
64915 * The base implementation of `_.uniq` without support for callback shorthands
64916 * and `this` binding.
64920 * array The array to inspect.
64921 * @param {Function}
64922 * [iteratee] The function invoked per iteration.
64923 * @returns {Array} Returns the new duplicate free array.
64925 function baseUniq(array, iteratee) {
64927 indexOf = baseIndexOf,
64928 length = array.length,
64930 isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
64931 seen = isLarge ? createCache() : null,
64935 indexOf = cacheIndexOf;
64939 seen = iteratee ? [] : result;
64942 while (++index < length) {
64943 var value = array[index],
64944 computed = iteratee ? iteratee(value, index, array) : value;
64946 if (isCommon && value === value) {
64947 var seenIndex = seen.length;
64948 while (seenIndex--) {
64949 if (seen[seenIndex] === computed) {
64954 seen.push(computed);
64956 result.push(value);
64957 } else if (indexOf(seen, computed, 0) < 0) {
64958 if (iteratee || isLarge) {
64959 seen.push(computed);
64961 result.push(value);
64967 module.exports = baseUniq;
64970 "./baseIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js",
64971 "./cacheIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cacheIndexOf.js",
64972 "./createCache": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCache.js"
64974 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseValues.js": [function(require, module, exports) {
64976 * The base implementation of `_.values` and `_.valuesIn` which creates an array
64977 * of `object` property values corresponding to the property names of `props`.
64981 * object The object to query.
64983 * props The property names to get values for.
64984 * @returns {Object} Returns the array of property values.
64986 function baseValues(object, props) {
64988 length = props.length,
64989 result = Array(length);
64991 while (++index < length) {
64992 result[index] = object[props[index]];
64997 module.exports = baseValues;
65000 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js": [function(require, module, exports) {
65001 var identity = require('../utility/identity');
65004 * A specialized version of `baseCallback` which only supports `this` binding
65005 * and specifying the number of arguments to provide to `func`.
65008 * @param {Function}
65009 * func The function to bind.
65011 * thisArg The `this` binding of `func`.
65013 * [argCount] The number of arguments to provide to `func`.
65014 * @returns {Function} Returns the callback.
65016 function bindCallback(func, thisArg, argCount) {
65017 if (typeof func != 'function') {
65020 if (thisArg === undefined) {
65023 switch (argCount) {
65025 return function(value) {
65026 return func.call(thisArg, value);
65029 return function(value, index, collection) {
65030 return func.call(thisArg, value, index, collection);
65033 return function(accumulator, value, index, collection) {
65034 return func.call(thisArg, accumulator, value, index, collection);
65037 return function(value, other, key, object, source) {
65038 return func.call(thisArg, value, other, key, object, source);
65041 return function() {
65042 return func.apply(thisArg, arguments);
65046 module.exports = bindCallback;
65049 "../utility/identity": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js"
65051 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cacheIndexOf.js": [function(require, module, exports) {
65052 var isObject = require('../lang/isObject');
65055 * Checks if `value` is in `cache` mimicking the return signature of `_.indexOf`
65056 * by returning `0` if the value is found, else `-1`.
65060 * cache The cache to search.
65062 * value The value to search for.
65063 * @returns {number} Returns `0` if `value` is found, else `-1`.
65065 function cacheIndexOf(cache, value) {
65066 var data = cache.data,
65067 result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
65069 return result ? 0 : -1;
65072 module.exports = cacheIndexOf;
65075 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
65077 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cachePush.js": [function(require, module, exports) {
65078 var isObject = require('../lang/isObject');
65081 * Adds `value` to the cache.
65085 * @memberOf SetCache
65087 * value The value to cache.
65089 function cachePush(value) {
65090 var data = this.data;
65091 if (typeof value == 'string' || isObject(value)) {
65092 data.set.add(value);
65094 data.hash[value] = true;
65098 module.exports = cachePush;
65101 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
65103 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\compareAscending.js": [function(require, module, exports) {
65104 var baseCompareAscending = require('./baseCompareAscending');
65107 * Used by `_.sortBy` to compare transformed elements of a collection and stable
65108 * sort them in ascending order.
65112 * object The object to compare.
65114 * other The other object to compare.
65115 * @returns {number} Returns the sort order indicator for `object`.
65117 function compareAscending(object, other) {
65118 return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
65121 module.exports = compareAscending;
65124 "./baseCompareAscending": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCompareAscending.js"
65126 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgs.js": [function(require, module, exports) {
65128 * Native method references for those with the same name as other `lodash`
65131 var nativeMax = Math.max;
65134 * Creates an array that is the composition of partially applied arguments,
65135 * placeholders, and provided arguments into a single array of arguments.
65138 * @param {Array|Object}
65139 * args The provided arguments.
65141 * partials The arguments to prepend to those provided.
65143 * holders The `partials` placeholder indexes.
65144 * @returns {Array} Returns the new array of composed arguments.
65146 function composeArgs(args, partials, holders) {
65147 var holdersLength = holders.length,
65149 argsLength = nativeMax(args.length - holdersLength, 0),
65151 leftLength = partials.length,
65152 result = Array(leftLength + argsLength);
65154 while (++leftIndex < leftLength) {
65155 result[leftIndex] = partials[leftIndex];
65157 while (++argsIndex < holdersLength) {
65158 result[holders[argsIndex]] = args[argsIndex];
65160 while (argsLength--) {
65161 result[leftIndex++] = args[argsIndex++];
65166 module.exports = composeArgs;
65169 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgsRight.js": [function(require, module, exports) {
65171 * Native method references for those with the same name as other `lodash`
65174 var nativeMax = Math.max;
65177 * This function is like `composeArgs` except that the arguments composition is
65178 * tailored for `_.partialRight`.
65181 * @param {Array|Object}
65182 * args The provided arguments.
65184 * partials The arguments to append to those provided.
65186 * holders The `partials` placeholder indexes.
65187 * @returns {Array} Returns the new array of composed arguments.
65189 function composeArgsRight(args, partials, holders) {
65190 var holdersIndex = -1,
65191 holdersLength = holders.length,
65193 argsLength = nativeMax(args.length - holdersLength, 0),
65195 rightLength = partials.length,
65196 result = Array(argsLength + rightLength);
65198 while (++argsIndex < argsLength) {
65199 result[argsIndex] = args[argsIndex];
65201 var offset = argsIndex;
65202 while (++rightIndex < rightLength) {
65203 result[offset + rightIndex] = partials[rightIndex];
65205 while (++holdersIndex < holdersLength) {
65206 result[offset + holders[holdersIndex]] = args[argsIndex++];
65211 module.exports = composeArgsRight;
65214 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAggregator.js": [function(require, module, exports) {
65215 var baseCallback = require('./baseCallback'),
65216 baseEach = require('./baseEach'),
65217 isArray = require('../lang/isArray');
65220 * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.
65223 * @param {Function}
65224 * setter The function to set keys and values of the accumulator
65226 * @param {Function}
65227 * [initializer] The function to initialize the accumulator object.
65228 * @returns {Function} Returns the new aggregator function.
65230 function createAggregator(setter, initializer) {
65231 return function(collection, iteratee, thisArg) {
65232 var result = initializer ? initializer() : {};
65233 iteratee = baseCallback(iteratee, thisArg, 3);
65235 if (isArray(collection)) {
65237 length = collection.length;
65239 while (++index < length) {
65240 var value = collection[index];
65241 setter(result, value, iteratee(value, index, collection), collection);
65244 baseEach(collection, function(value, key, collection) {
65245 setter(result, value, iteratee(value, key, collection), collection);
65252 module.exports = createAggregator;
65255 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65256 "./baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
65257 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
65259 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAssigner.js": [function(require, module, exports) {
65260 var bindCallback = require('./bindCallback'),
65261 isIterateeCall = require('./isIterateeCall'),
65262 restParam = require('../function/restParam');
65265 * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
65268 * @param {Function}
65269 * assigner The function to assign values.
65270 * @returns {Function} Returns the new assigner function.
65272 function createAssigner(assigner) {
65273 return restParam(function(object, sources) {
65275 length = object == null ? 0 : sources.length,
65276 customizer = length > 2 ? sources[length - 2] : undefined,
65277 guard = length > 2 ? sources[2] : undefined,
65278 thisArg = length > 1 ? sources[length - 1] : undefined;
65280 if (typeof customizer == 'function') {
65281 customizer = bindCallback(customizer, thisArg, 5);
65284 customizer = typeof thisArg == 'function' ? thisArg : undefined;
65285 length -= (customizer ? 1 : 0);
65287 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
65288 customizer = length < 3 ? undefined : customizer;
65291 while (++index < length) {
65292 var source = sources[index];
65294 assigner(object, source, customizer);
65301 module.exports = createAssigner;
65304 "../function/restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js",
65305 "./bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js",
65306 "./isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js"
65308 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseEach.js": [function(require, module, exports) {
65309 var getLength = require('./getLength'),
65310 isLength = require('./isLength'),
65311 toObject = require('./toObject');
65314 * Creates a `baseEach` or `baseEachRight` function.
65317 * @param {Function}
65318 * eachFunc The function to iterate over a collection.
65320 * [fromRight] Specify iterating from right to left.
65321 * @returns {Function} Returns the new base function.
65323 function createBaseEach(eachFunc, fromRight) {
65324 return function(collection, iteratee) {
65325 var length = collection ? getLength(collection) : 0;
65326 if (!isLength(length)) {
65327 return eachFunc(collection, iteratee);
65329 var index = fromRight ? length : -1,
65330 iterable = toObject(collection);
65332 while ((fromRight ? index-- : ++index < length)) {
65333 if (iteratee(iterable[index], index, iterable) === false) {
65341 module.exports = createBaseEach;
65344 "./getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
65345 "./isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
65346 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
65348 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseFor.js": [function(require, module, exports) {
65349 var toObject = require('./toObject');
65352 * Creates a base function for `_.forIn` or `_.forInRight`.
65356 * [fromRight] Specify iterating from right to left.
65357 * @returns {Function} Returns the new base function.
65359 function createBaseFor(fromRight) {
65360 return function(object, iteratee, keysFunc) {
65361 var iterable = toObject(object),
65362 props = keysFunc(object),
65363 length = props.length,
65364 index = fromRight ? length : -1;
65366 while ((fromRight ? index-- : ++index < length)) {
65367 var key = props[index];
65368 if (iteratee(iterable[key], key, iterable) === false) {
65376 module.exports = createBaseFor;
65379 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
65381 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBindWrapper.js": [function(require, module, exports) {
65382 (function(global) {
65383 var createCtorWrapper = require('./createCtorWrapper');
65386 * Creates a function that wraps `func` and invokes it with the `this` binding
65390 * @param {Function}
65391 * func The function to bind.
65393 * [thisArg] The `this` binding of `func`.
65394 * @returns {Function} Returns the new bound function.
65396 function createBindWrapper(func, thisArg) {
65397 var Ctor = createCtorWrapper(func);
65399 function wrapper() {
65400 var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
65401 return fn.apply(thisArg, arguments);
65406 module.exports = createBindWrapper;
65408 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65410 "./createCtorWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js"
65412 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCache.js": [function(require, module, exports) {
65413 (function(global) {
65414 var SetCache = require('./SetCache'),
65415 getNative = require('./getNative');
65417 /** Native method references. */
65418 var Set = getNative(global, 'Set');
65421 * Native method references for those with the same name as other `lodash`
65424 var nativeCreate = getNative(Object, 'create');
65427 * Creates a `Set` cache object to optimize linear searches of large arrays.
65431 * [values] The values to cache.
65432 * @returns {null|Object} Returns the new cache object if `Set` is supported,
65435 function createCache(values) {
65436 return (nativeCreate && Set) ? new SetCache(values) : null;
65439 module.exports = createCache;
65441 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65443 "./SetCache": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\SetCache.js",
65444 "./getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
65446 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js": [function(require, module, exports) {
65447 var baseCreate = require('./baseCreate'),
65448 isObject = require('../lang/isObject');
65451 * Creates a function that produces an instance of `Ctor` regardless of whether
65452 * it was invoked as part of a `new` expression or by `call` or `apply`.
65455 * @param {Function}
65456 * Ctor The constructor to wrap.
65457 * @returns {Function} Returns the new wrapped function.
65459 function createCtorWrapper(Ctor) {
65460 return function() {
65461 // Use a `switch` statement to work with class constructors.
65463 // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
65464 // for more details.
65465 var args = arguments;
65466 switch (args.length) {
65470 return new Ctor(args[0]);
65472 return new Ctor(args[0], args[1]);
65474 return new Ctor(args[0], args[1], args[2]);
65476 return new Ctor(args[0], args[1], args[2], args[3]);
65478 return new Ctor(args[0], args[1], args[2], args[3], args[4]);
65480 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
65482 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
65484 var thisBinding = baseCreate(Ctor.prototype),
65485 result = Ctor.apply(thisBinding, args);
65487 // Mimic the constructor's `return` behavior.
65488 // See https://es5.github.io/#x13.2.2 for more details.
65489 return isObject(result) ? result : thisBinding;
65493 module.exports = createCtorWrapper;
65496 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
65497 "./baseCreate": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js"
65499 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createFind.js": [function(require, module, exports) {
65500 var baseCallback = require('./baseCallback'),
65501 baseFind = require('./baseFind'),
65502 baseFindIndex = require('./baseFindIndex'),
65503 isArray = require('../lang/isArray');
65506 * Creates a `_.find` or `_.findLast` function.
65509 * @param {Function}
65510 * eachFunc The function to iterate over a collection.
65512 * [fromRight] Specify iterating from right to left.
65513 * @returns {Function} Returns the new find function.
65515 function createFind(eachFunc, fromRight) {
65516 return function(collection, predicate, thisArg) {
65517 predicate = baseCallback(predicate, thisArg, 3);
65518 if (isArray(collection)) {
65519 var index = baseFindIndex(collection, predicate, fromRight);
65520 return index > -1 ? collection[index] : undefined;
65522 return baseFind(collection, predicate, eachFunc);
65526 module.exports = createFind;
65529 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65530 "./baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
65531 "./baseFind": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFind.js",
65532 "./baseFindIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFindIndex.js"
65534 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createForEach.js": [function(require, module, exports) {
65535 var bindCallback = require('./bindCallback'),
65536 isArray = require('../lang/isArray');
65539 * Creates a function for `_.forEach` or `_.forEachRight`.
65542 * @param {Function}
65543 * arrayFunc The function to iterate over an array.
65544 * @param {Function}
65545 * eachFunc The function to iterate over a collection.
65546 * @returns {Function} Returns the new each function.
65548 function createForEach(arrayFunc, eachFunc) {
65549 return function(collection, iteratee, thisArg) {
65550 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee) : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
65554 module.exports = createForEach;
65557 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65558 "./bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js"
65560 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createHybridWrapper.js": [function(require, module, exports) {
65561 (function(global) {
65562 var arrayCopy = require('./arrayCopy'),
65563 composeArgs = require('./composeArgs'),
65564 composeArgsRight = require('./composeArgsRight'),
65565 createCtorWrapper = require('./createCtorWrapper'),
65566 isLaziable = require('./isLaziable'),
65567 reorder = require('./reorder'),
65568 replaceHolders = require('./replaceHolders'),
65569 setData = require('./setData');
65571 /** Used to compose bitmasks for wrapper metadata. */
65574 CURRY_BOUND_FLAG = 4,
65576 CURRY_RIGHT_FLAG = 16,
65578 PARTIAL_RIGHT_FLAG = 64,
65582 * Native method references for those with the same name as other `lodash`
65585 var nativeMax = Math.max;
65588 * Creates a function that wraps `func` and invokes it with optional `this`
65589 * binding of, partial application, and currying.
65592 * @param {Function|string}
65593 * func The function or method name to reference.
65595 * bitmask The bitmask of flags. See `createWrapper` for more
65598 * [thisArg] The `this` binding of `func`.
65600 * [partials] The arguments to prepend to those provided to the new
65603 * [holders] The `partials` placeholder indexes.
65605 * [partialsRight] The arguments to append to those provided to the
65608 * [holdersRight] The `partialsRight` placeholder indexes.
65610 * [argPos] The argument positions of the new function.
65612 * [ary] The arity cap of `func`.
65614 * [arity] The arity of `func`.
65615 * @returns {Function} Returns the new wrapped function.
65617 function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
65618 var isAry = bitmask & ARY_FLAG,
65619 isBind = bitmask & BIND_FLAG,
65620 isBindKey = bitmask & BIND_KEY_FLAG,
65621 isCurry = bitmask & CURRY_FLAG,
65622 isCurryBound = bitmask & CURRY_BOUND_FLAG,
65623 isCurryRight = bitmask & CURRY_RIGHT_FLAG,
65624 Ctor = isBindKey ? undefined : createCtorWrapper(func);
65626 function wrapper() {
65627 // Avoid `arguments` object use disqualifying optimizations by
65628 // converting it to an array before providing it to other functions.
65629 var length = arguments.length,
65631 args = Array(length);
65634 args[index] = arguments[index];
65637 args = composeArgs(args, partials, holders);
65639 if (partialsRight) {
65640 args = composeArgsRight(args, partialsRight, holdersRight);
65642 if (isCurry || isCurryRight) {
65643 var placeholder = wrapper.placeholder,
65644 argsHolders = replaceHolders(args, placeholder);
65646 length -= argsHolders.length;
65647 if (length < arity) {
65648 var newArgPos = argPos ? arrayCopy(argPos) : undefined,
65649 newArity = nativeMax(arity - length, 0),
65650 newsHolders = isCurry ? argsHolders : undefined,
65651 newHoldersRight = isCurry ? undefined : argsHolders,
65652 newPartials = isCurry ? args : undefined,
65653 newPartialsRight = isCurry ? undefined : args;
65655 bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
65656 bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
65658 if (!isCurryBound) {
65659 bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
65661 var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
65662 result = createHybridWrapper.apply(undefined, newData);
65664 if (isLaziable(func)) {
65665 setData(result, newData);
65667 result.placeholder = placeholder;
65671 var thisBinding = isBind ? thisArg : this,
65672 fn = isBindKey ? thisBinding[func] : func;
65675 args = reorder(args, argPos);
65677 if (isAry && ary < args.length) {
65680 if (this && this !== global && this instanceof wrapper) {
65681 fn = Ctor || createCtorWrapper(func);
65683 return fn.apply(thisBinding, args);
65688 module.exports = createHybridWrapper;
65690 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65692 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
65693 "./composeArgs": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgs.js",
65694 "./composeArgsRight": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgsRight.js",
65695 "./createCtorWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js",
65696 "./isLaziable": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLaziable.js",
65697 "./reorder": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\reorder.js",
65698 "./replaceHolders": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js",
65699 "./setData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\setData.js"
65701 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createPartialWrapper.js": [function(require, module, exports) {
65702 (function(global) {
65703 var createCtorWrapper = require('./createCtorWrapper');
65705 /** Used to compose bitmasks for wrapper metadata. */
65709 * Creates a function that wraps `func` and invokes it with the optional `this`
65710 * binding of `thisArg` and the `partials` prepended to those provided to the
65714 * @param {Function}
65715 * func The function to partially apply arguments to.
65717 * bitmask The bitmask of flags. See `createWrapper` for more
65720 * thisArg The `this` binding of `func`.
65722 * partials The arguments to prepend to those provided to the new
65724 * @returns {Function} Returns the new bound function.
65726 function createPartialWrapper(func, bitmask, thisArg, partials) {
65727 var isBind = bitmask & BIND_FLAG,
65728 Ctor = createCtorWrapper(func);
65730 function wrapper() {
65731 // Avoid `arguments` object use disqualifying optimizations by
65732 // converting it to an array before providing it `func`.
65733 var argsIndex = -1,
65734 argsLength = arguments.length,
65736 leftLength = partials.length,
65737 args = Array(leftLength + argsLength);
65739 while (++leftIndex < leftLength) {
65740 args[leftIndex] = partials[leftIndex];
65742 while (argsLength--) {
65743 args[leftIndex++] = arguments[++argsIndex];
65745 var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
65746 return fn.apply(isBind ? thisArg : this, args);
65751 module.exports = createPartialWrapper;
65753 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65755 "./createCtorWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js"
65757 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createReduce.js": [function(require, module, exports) {
65758 var baseCallback = require('./baseCallback'),
65759 baseReduce = require('./baseReduce'),
65760 isArray = require('../lang/isArray');
65763 * Creates a function for `_.reduce` or `_.reduceRight`.
65766 * @param {Function}
65767 * arrayFunc The function to iterate over an array.
65768 * @param {Function}
65769 * eachFunc The function to iterate over a collection.
65770 * @returns {Function} Returns the new each function.
65772 function createReduce(arrayFunc, eachFunc) {
65773 return function(collection, iteratee, accumulator, thisArg) {
65774 var initFromArray = arguments.length < 3;
65775 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee, accumulator, initFromArray) : baseReduce(collection, baseCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
65779 module.exports = createReduce;
65782 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65783 "./baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
65784 "./baseReduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseReduce.js"
65786 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createWrapper.js": [function(require, module, exports) {
65787 var baseSetData = require('./baseSetData'),
65788 createBindWrapper = require('./createBindWrapper'),
65789 createHybridWrapper = require('./createHybridWrapper'),
65790 createPartialWrapper = require('./createPartialWrapper'),
65791 getData = require('./getData'),
65792 mergeData = require('./mergeData'),
65793 setData = require('./setData');
65795 /** Used to compose bitmasks for wrapper metadata. */
65799 PARTIAL_RIGHT_FLAG = 64;
65801 /** Used as the `TypeError` message for "Functions" methods. */
65802 var FUNC_ERROR_TEXT = 'Expected a function';
65805 * Native method references for those with the same name as other `lodash`
65808 var nativeMax = Math.max;
65811 * Creates a function that either curries or invokes `func` with optional `this`
65812 * binding and partially applied arguments.
65815 * @param {Function|string}
65816 * func The function or method name to reference.
65818 * bitmask The bitmask of flags. The bitmask may be composed of the
65819 * following flags: 1 - `_.bind` 2 - `_.bindKey` 4 - `_.curry` or
65820 * `_.curryRight` of a bound function 8 - `_.curry` 16 -
65821 * `_.curryRight` 32 - `_.partial` 64 - `_.partialRight` 128 -
65822 * `_.rearg` 256 - `_.ary`
65824 * [thisArg] The `this` binding of `func`.
65826 * [partials] The arguments to be partially applied.
65828 * [holders] The `partials` placeholder indexes.
65830 * [argPos] The argument positions of the new function.
65832 * [ary] The arity cap of `func`.
65834 * [arity] The arity of `func`.
65835 * @returns {Function} Returns the new wrapped function.
65837 function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
65838 var isBindKey = bitmask & BIND_KEY_FLAG;
65839 if (!isBindKey && typeof func != 'function') {
65840 throw new TypeError(FUNC_ERROR_TEXT);
65842 var length = partials ? partials.length : 0;
65844 bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
65845 partials = holders = undefined;
65847 length -= (holders ? holders.length : 0);
65848 if (bitmask & PARTIAL_RIGHT_FLAG) {
65849 var partialsRight = partials,
65850 holdersRight = holders;
65852 partials = holders = undefined;
65854 var data = isBindKey ? undefined : getData(func),
65855 newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
65858 mergeData(newData, data);
65859 bitmask = newData[1];
65860 arity = newData[9];
65862 newData[9] = arity == null ? (isBindKey ? 0 : func.length) : (nativeMax(arity - length, 0) || 0);
65864 if (bitmask == BIND_FLAG) {
65865 var result = createBindWrapper(newData[0], newData[2]);
65866 } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
65867 result = createPartialWrapper.apply(undefined, newData);
65869 result = createHybridWrapper.apply(undefined, newData);
65871 var setter = data ? baseSetData : setData;
65872 return setter(result, newData);
65875 module.exports = createWrapper;
65878 "./baseSetData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSetData.js",
65879 "./createBindWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBindWrapper.js",
65880 "./createHybridWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createHybridWrapper.js",
65881 "./createPartialWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createPartialWrapper.js",
65882 "./getData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getData.js",
65883 "./mergeData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\mergeData.js",
65884 "./setData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\setData.js"
65886 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalArrays.js": [function(require, module, exports) {
65887 var arraySome = require('./arraySome');
65890 * A specialized version of `baseIsEqualDeep` for arrays with support for
65891 * partial deep comparisons.
65895 * array The array to compare.
65897 * other The other array to compare.
65898 * @param {Function}
65899 * equalFunc The function to determine equivalents of values.
65900 * @param {Function}
65901 * [customizer] The function to customize comparing arrays.
65903 * [isLoose] Specify performing partial comparisons.
65905 * [stackA] Tracks traversed `value` objects.
65907 * [stackB] Tracks traversed `other` objects.
65908 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
65910 function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
65912 arrLength = array.length,
65913 othLength = other.length;
65915 if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
65918 // Ignore non-index properties.
65919 while (++index < arrLength) {
65920 var arrValue = array[index],
65921 othValue = other[index],
65922 result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
65924 if (result !== undefined) {
65930 // Recursively compare arrays (susceptible to call stack limits).
65932 if (!arraySome(other, function(othValue) {
65933 return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
65937 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
65944 module.exports = equalArrays;
65947 "./arraySome": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arraySome.js"
65949 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalByTag.js": [function(require, module, exports) {
65950 /** `Object#toString` result references. */
65951 var boolTag = '[object Boolean]',
65952 dateTag = '[object Date]',
65953 errorTag = '[object Error]',
65954 numberTag = '[object Number]',
65955 regexpTag = '[object RegExp]',
65956 stringTag = '[object String]';
65959 * A specialized version of `baseIsEqualDeep` for comparing objects of the same
65962 * **Note:** This function only supports comparing values with tags of
65963 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
65967 * object The object to compare.
65969 * other The other object to compare.
65971 * tag The `toStringTag` of the objects to compare.
65972 * @returns {boolean} Returns `true` if the objects are equivalent, else
65975 function equalByTag(object, other, tag) {
65979 // Coerce dates and booleans to numbers, dates to milliseconds and
65981 // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
65982 return +object == +other;
65985 return object.name == other.name && object.message == other.message;
65988 // Treat `NaN` vs. `NaN` as equal.
65989 return (object != +object) ? other != +other : object == +other;
65993 // Coerce regexes to strings and treat strings primitives and string
65994 // objects as equal. See https://es5.github.io/#x15.10.6.4 for more
65996 return object == (other + '');
66001 module.exports = equalByTag;
66004 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalObjects.js": [function(require, module, exports) {
66005 var keys = require('../object/keys');
66007 /** Used for native method references. */
66008 var objectProto = Object.prototype;
66010 /** Used to check objects for own properties. */
66011 var hasOwnProperty = objectProto.hasOwnProperty;
66014 * A specialized version of `baseIsEqualDeep` for objects with support for
66015 * partial deep comparisons.
66019 * object The object to compare.
66021 * other The other object to compare.
66022 * @param {Function}
66023 * equalFunc The function to determine equivalents of values.
66024 * @param {Function}
66025 * [customizer] The function to customize comparing values.
66027 * [isLoose] Specify performing partial comparisons.
66029 * [stackA] Tracks traversed `value` objects.
66031 * [stackB] Tracks traversed `other` objects.
66032 * @returns {boolean} Returns `true` if the objects are equivalent, else
66035 function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
66036 var objProps = keys(object),
66037 objLength = objProps.length,
66038 othProps = keys(other),
66039 othLength = othProps.length;
66041 if (objLength != othLength && !isLoose) {
66044 var index = objLength;
66046 var key = objProps[index];
66047 if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
66051 var skipCtor = isLoose;
66052 while (++index < objLength) {
66053 key = objProps[index];
66054 var objValue = object[key],
66055 othValue = other[key],
66056 result = customizer ? customizer(isLoose ? othValue : objValue, isLoose ? objValue : othValue, key) : undefined;
66058 // Recursively compare objects (susceptible to call stack limits).
66059 if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
66062 skipCtor || (skipCtor = key == 'constructor');
66065 var objCtor = object.constructor,
66066 othCtor = other.constructor;
66068 // Non `Object` object instances with different constructors are not equal.
66069 if (objCtor != othCtor &&
66070 ('constructor' in object && 'constructor' in other) &&
66071 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
66072 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
66079 module.exports = equalObjects;
66082 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
66084 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getData.js": [function(require, module, exports) {
66085 var metaMap = require('./metaMap'),
66086 noop = require('../utility/noop');
66089 * Gets metadata for `func`.
66092 * @param {Function}
66093 * func The function to query.
66094 * @returns {*} Returns the metadata for `func`.
66096 var getData = !metaMap ? noop : function(func) {
66097 return metaMap.get(func);
66100 module.exports = getData;
66103 "../utility/noop": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\noop.js",
66104 "./metaMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\metaMap.js"
66106 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getFuncName.js": [function(require, module, exports) {
66107 var realNames = require('./realNames');
66110 * Gets the name of `func`.
66113 * @param {Function}
66114 * func The function to query.
66115 * @returns {string} Returns the function name.
66117 function getFuncName(func) {
66118 var result = (func.name + ''),
66119 array = realNames[result],
66120 length = array ? array.length : 0;
66123 var data = array[length],
66124 otherFunc = data.func;
66125 if (otherFunc == null || otherFunc == func) {
66132 module.exports = getFuncName;
66135 "./realNames": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\realNames.js"
66137 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js": [function(require, module, exports) {
66138 var baseProperty = require('./baseProperty');
66141 * Gets the "length" property value of `object`.
66143 * **Note:** This function is used to avoid a [JIT
66144 * bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects Safari on
66145 * at least iOS 8.1-8.3 ARM64.
66149 * object The object to query.
66150 * @returns {*} Returns the "length" value.
66152 var getLength = baseProperty('length');
66154 module.exports = getLength;
66157 "./baseProperty": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseProperty.js"
66159 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getMatchData.js": [function(require, module, exports) {
66160 var isStrictComparable = require('./isStrictComparable'),
66161 pairs = require('../object/pairs');
66164 * Gets the propery names, values, and compare flags of `object`.
66168 * object The object to query.
66169 * @returns {Array} Returns the match data of `object`.
66171 function getMatchData(object) {
66172 var result = pairs(object),
66173 length = result.length;
66176 result[length][2] = isStrictComparable(result[length][1]);
66181 module.exports = getMatchData;
66184 "../object/pairs": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pairs.js",
66185 "./isStrictComparable": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isStrictComparable.js"
66187 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js": [function(require, module, exports) {
66188 var isNative = require('../lang/isNative');
66191 * Gets the native function at `key` of `object`.
66195 * object The object to query.
66197 * key The key of the method to get.
66198 * @returns {*} Returns the function if it's native, else `undefined`.
66200 function getNative(object, key) {
66201 var value = object == null ? undefined : object[key];
66202 return isNative(value) ? value : undefined;
66205 module.exports = getNative;
66208 "../lang/isNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNative.js"
66210 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\indexOfNaN.js": [function(require, module, exports) {
66212 * Gets the index at which the first occurrence of `NaN` is found in `array`.
66216 * array The array to search.
66218 * fromIndex The index to search from.
66220 * [fromRight] Specify iterating from right to left.
66221 * @returns {number} Returns the index of the matched `NaN`, else `-1`.
66223 function indexOfNaN(array, fromIndex, fromRight) {
66224 var length = array.length,
66225 index = fromIndex + (fromRight ? 0 : -1);
66227 while ((fromRight ? index-- : ++index < length)) {
66228 var other = array[index];
66229 if (other !== other) {
66236 module.exports = indexOfNaN;
66239 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js": [function(require, module, exports) {
66240 var getLength = require('./getLength'),
66241 isLength = require('./isLength');
66244 * Checks if `value` is array-like.
66248 * value The value to check.
66249 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
66251 function isArrayLike(value) {
66252 return value != null && isLength(getLength(value));
66255 module.exports = isArrayLike;
66258 "./getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
66259 "./isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js"
66261 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js": [function(require, module, exports) {
66262 /** Used to detect unsigned integer values. */
66263 var reIsUint = /^\d+$/;
66266 * Used as the [maximum
66267 * length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
66268 * of an array-like value.
66270 var MAX_SAFE_INTEGER = 9007199254740991;
66273 * Checks if `value` is a valid array-like index.
66277 * value The value to check.
66279 * [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
66280 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
66282 function isIndex(value, length) {
66283 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
66284 length = length == null ? MAX_SAFE_INTEGER : length;
66285 return value > -1 && value % 1 == 0 && value < length;
66288 module.exports = isIndex;
66291 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js": [function(require, module, exports) {
66292 var isArrayLike = require('./isArrayLike'),
66293 isIndex = require('./isIndex'),
66294 isObject = require('../lang/isObject');
66297 * Checks if the provided arguments are from an iteratee call.
66301 * value The potential iteratee value argument.
66303 * index The potential iteratee index or key argument.
66305 * object The potential iteratee object argument.
66306 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
66309 function isIterateeCall(value, index, object) {
66310 if (!isObject(object)) {
66313 var type = typeof index;
66314 if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) {
66315 var other = object[index];
66316 return value === value ? (value === other) : (other !== other);
66321 module.exports = isIterateeCall;
66324 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
66325 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
66326 "./isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js"
66328 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isKey.js": [function(require, module, exports) {
66329 var isArray = require('../lang/isArray'),
66330 toObject = require('./toObject');
66332 /** Used to match property names within property paths. */
66333 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
66334 reIsPlainProp = /^\w*$/;
66337 * Checks if `value` is a property name and not a property path.
66341 * value The value to check.
66343 * [object] The object to query keys on.
66344 * @returns {boolean} Returns `true` if `value` is a property name, else
66347 function isKey(value, object) {
66348 var type = typeof value;
66349 if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
66352 if (isArray(value)) {
66355 var result = !reIsDeepProp.test(value);
66356 return result || (object != null && value in toObject(object));
66359 module.exports = isKey;
66362 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
66363 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
66365 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLaziable.js": [function(require, module, exports) {
66366 var LazyWrapper = require('./LazyWrapper'),
66367 getData = require('./getData'),
66368 getFuncName = require('./getFuncName'),
66369 lodash = require('../chain/lodash');
66372 * Checks if `func` has a lazy counterpart.
66375 * @param {Function}
66376 * func The function to check.
66377 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else
66380 function isLaziable(func) {
66381 var funcName = getFuncName(func),
66382 other = lodash[funcName];
66384 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
66387 if (func === other) {
66390 var data = getData(other);
66391 return !!data && func === data[0];
66394 module.exports = isLaziable;
66397 "../chain/lodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\chain\\lodash.js",
66398 "./LazyWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js",
66399 "./getData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getData.js",
66400 "./getFuncName": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getFuncName.js"
66402 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js": [function(require, module, exports) {
66404 * Used as the [maximum
66405 * length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
66406 * of an array-like value.
66408 var MAX_SAFE_INTEGER = 9007199254740991;
66411 * Checks if `value` is a valid array-like length.
66413 * **Note:** This function is based on
66414 * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
66418 * value The value to check.
66419 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
66421 function isLength(value) {
66422 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
66425 module.exports = isLength;
66428 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js": [function(require, module, exports) {
66430 * Checks if `value` is object-like.
66434 * value The value to check.
66435 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
66437 function isObjectLike(value) {
66438 return !!value && typeof value == 'object';
66441 module.exports = isObjectLike;
66444 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isStrictComparable.js": [function(require, module, exports) {
66445 var isObject = require('../lang/isObject');
66448 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
66452 * value The value to check.
66453 * @returns {boolean} Returns `true` if `value` if suitable for strict equality
66454 * comparisons, else `false`.
66456 function isStrictComparable(value) {
66457 return value === value && !isObject(value);
66460 module.exports = isStrictComparable;
66463 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
66465 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\mergeData.js": [function(require, module, exports) {
66466 var arrayCopy = require('./arrayCopy'),
66467 composeArgs = require('./composeArgs'),
66468 composeArgsRight = require('./composeArgsRight'),
66469 replaceHolders = require('./replaceHolders');
66471 /** Used to compose bitmasks for wrapper metadata. */
66473 CURRY_BOUND_FLAG = 4,
66478 /** Used as the internal argument placeholder. */
66479 var PLACEHOLDER = '__lodash_placeholder__';
66482 * Native method references for those with the same name as other `lodash`
66485 var nativeMin = Math.min;
66488 * Merges the function metadata of `source` into `data`.
66490 * Merging metadata reduces the number of wrappers required to invoke a
66491 * function. This is possible because methods like `_.bind`, `_.curry`, and
66492 * `_.partial` may be applied regardless of execution order. Methods like
66493 * `_.ary` and `_.rearg` augment function arguments, making the order in which
66494 * they are executed important, preventing the merging of metadata. However, we
66495 * make an exception for a safe common case where curried functions have `_.ary`
66496 * and or `_.rearg` applied.
66500 * data The destination metadata.
66502 * source The source metadata.
66503 * @returns {Array} Returns `data`.
66505 function mergeData(data, source) {
66506 var bitmask = data[1],
66507 srcBitmask = source[1],
66508 newBitmask = bitmask | srcBitmask,
66509 isCommon = newBitmask < ARY_FLAG;
66512 (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
66513 (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
66514 (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
66516 // Exit early if metadata can't be merged.
66517 if (!(isCommon || isCombo)) {
66520 // Use source `thisArg` if available.
66521 if (srcBitmask & BIND_FLAG) {
66522 data[2] = source[2];
66523 // Set when currying a bound function.
66524 newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
66526 // Compose partial arguments.
66527 var value = source[3];
66529 var partials = data[3];
66530 data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
66531 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
66533 // Compose partial right arguments.
66536 partials = data[5];
66537 data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
66538 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
66540 // Use source `argPos` if available.
66543 data[7] = arrayCopy(value);
66545 // Use source `ary` if it's smaller.
66546 if (srcBitmask & ARY_FLAG) {
66547 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
66549 // Use source `arity` if one is not provided.
66550 if (data[9] == null) {
66551 data[9] = source[9];
66553 // Use source `func` and merge bitmasks.
66554 data[0] = source[0];
66555 data[1] = newBitmask;
66560 module.exports = mergeData;
66563 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
66564 "./composeArgs": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgs.js",
66565 "./composeArgsRight": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgsRight.js",
66566 "./replaceHolders": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js"
66568 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\metaMap.js": [function(require, module, exports) {
66569 (function(global) {
66570 var getNative = require('./getNative');
66572 /** Native method references. */
66573 var WeakMap = getNative(global, 'WeakMap');
66575 /** Used to store function metadata. */
66576 var metaMap = WeakMap && new WeakMap;
66578 module.exports = metaMap;
66580 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
66582 "./getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
66584 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByArray.js": [function(require, module, exports) {
66585 var toObject = require('./toObject');
66588 * A specialized version of `_.pick` which picks `object` properties specified
66593 * object The source object.
66594 * @param {string[]}
66595 * props The property names to pick.
66596 * @returns {Object} Returns the new object.
66598 function pickByArray(object, props) {
66599 object = toObject(object);
66602 length = props.length,
66605 while (++index < length) {
66606 var key = props[index];
66607 if (key in object) {
66608 result[key] = object[key];
66614 module.exports = pickByArray;
66617 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
66619 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByCallback.js": [function(require, module, exports) {
66620 var baseForIn = require('./baseForIn');
66623 * A specialized version of `_.pick` which picks `object` properties `predicate`
66624 * returns truthy for.
66628 * object The source object.
66629 * @param {Function}
66630 * predicate The function invoked per iteration.
66631 * @returns {Object} Returns the new object.
66633 function pickByCallback(object, predicate) {
66635 baseForIn(object, function(value, key, object) {
66636 if (predicate(value, key, object)) {
66637 result[key] = value;
66643 module.exports = pickByCallback;
66646 "./baseForIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForIn.js"
66648 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\realNames.js": [function(require, module, exports) {
66649 /** Used to lookup unminified function names. */
66650 var realNames = {};
66652 module.exports = realNames;
66655 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\reorder.js": [function(require, module, exports) {
66656 var arrayCopy = require('./arrayCopy'),
66657 isIndex = require('./isIndex');
66660 * Native method references for those with the same name as other `lodash`
66663 var nativeMin = Math.min;
66666 * Reorder `array` according to the specified indexes where the element at the
66667 * first index is assigned as the first element, the element at the second index
66668 * is assigned as the second element, and so on.
66672 * array The array to reorder.
66674 * indexes The arranged array indexes.
66675 * @returns {Array} Returns `array`.
66677 function reorder(array, indexes) {
66678 var arrLength = array.length,
66679 length = nativeMin(indexes.length, arrLength),
66680 oldArray = arrayCopy(array);
66683 var index = indexes[length];
66684 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
66689 module.exports = reorder;
66692 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
66693 "./isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js"
66695 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js": [function(require, module, exports) {
66696 /** Used as the internal argument placeholder. */
66697 var PLACEHOLDER = '__lodash_placeholder__';
66700 * Replaces all `placeholder` elements in `array` with an internal placeholder
66701 * and returns an array of their indexes.
66705 * array The array to modify.
66707 * placeholder The placeholder to replace.
66708 * @returns {Array} Returns the new array of placeholder indexes.
66710 function replaceHolders(array, placeholder) {
66712 length = array.length,
66716 while (++index < length) {
66717 if (array[index] === placeholder) {
66718 array[index] = PLACEHOLDER;
66719 result[++resIndex] = index;
66725 module.exports = replaceHolders;
66728 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\setData.js": [function(require, module, exports) {
66729 var baseSetData = require('./baseSetData'),
66730 now = require('../date/now');
66732 /** Used to detect when a function becomes hot. */
66733 var HOT_COUNT = 150,
66737 * Sets metadata for `func`.
66739 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
66740 * period of time, it will trip its breaker and transition to an identity
66741 * function to avoid garbage collection pauses in V8. See [V8 issue
66742 * 2070](https://code.google.com/p/v8/issues/detail?id=2070) for more details.
66745 * @param {Function}
66746 * func The function to associate metadata with.
66748 * data The metadata.
66749 * @returns {Function} Returns `func`.
66751 var setData = (function() {
66755 return function(key, value) {
66757 remaining = HOT_SPAN - (stamp - lastCalled);
66759 lastCalled = stamp;
66760 if (remaining > 0) {
66761 if (++count >= HOT_COUNT) {
66767 return baseSetData(key, value);
66771 module.exports = setData;
66774 "../date/now": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\date\\now.js",
66775 "./baseSetData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSetData.js"
66777 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\shimKeys.js": [function(require, module, exports) {
66778 var isArguments = require('../lang/isArguments'),
66779 isArray = require('../lang/isArray'),
66780 isIndex = require('./isIndex'),
66781 isLength = require('./isLength'),
66782 keysIn = require('../object/keysIn');
66784 /** Used for native method references. */
66785 var objectProto = Object.prototype;
66787 /** Used to check objects for own properties. */
66788 var hasOwnProperty = objectProto.hasOwnProperty;
66791 * A fallback implementation of `Object.keys` which creates an array of the own
66792 * enumerable property names of `object`.
66796 * object The object to query.
66797 * @returns {Array} Returns the array of property names.
66799 function shimKeys(object) {
66800 var props = keysIn(object),
66801 propsLength = props.length,
66802 length = propsLength && object.length;
66804 var allowIndexes = !!length && isLength(length) &&
66805 (isArray(object) || isArguments(object));
66810 while (++index < propsLength) {
66811 var key = props[index];
66812 if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
66819 module.exports = shimKeys;
66822 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
66823 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
66824 "../object/keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js",
66825 "./isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js",
66826 "./isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js"
66828 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\sortedUniq.js": [function(require, module, exports) {
66830 * An implementation of `_.uniq` optimized for sorted arrays without support for
66831 * callback shorthands and `this` binding.
66835 * array The array to inspect.
66836 * @param {Function}
66837 * [iteratee] The function invoked per iteration.
66838 * @returns {Array} Returns the new duplicate free array.
66840 function sortedUniq(array, iteratee) {
66843 length = array.length,
66847 while (++index < length) {
66848 var value = array[index],
66849 computed = iteratee ? iteratee(value, index, array) : value;
66851 if (!index || seen !== computed) {
66853 result[++resIndex] = value;
66859 module.exports = sortedUniq;
66862 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js": [function(require, module, exports) {
66863 var isObject = require('../lang/isObject');
66866 * Converts `value` to an object if it's not one.
66870 * value The value to process.
66871 * @returns {Object} Returns the object.
66873 function toObject(value) {
66874 return isObject(value) ? value : Object(value);
66877 module.exports = toObject;
66880 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
66882 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toPath.js": [function(require, module, exports) {
66883 var baseToString = require('./baseToString'),
66884 isArray = require('../lang/isArray');
66886 /** Used to match property names within property paths. */
66887 var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
66889 /** Used to match backslashes in property paths. */
66890 var reEscapeChar = /\\(\\)?/g;
66893 * Converts `value` to property path array if it's not one.
66897 * value The value to process.
66898 * @returns {Array} Returns the property path array.
66900 function toPath(value) {
66901 if (isArray(value)) {
66905 baseToString(value).replace(rePropName, function(match, number, quote, string) {
66906 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
66911 module.exports = toPath;
66914 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
66915 "./baseToString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseToString.js"
66917 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\wrapperClone.js": [function(require, module, exports) {
66918 var LazyWrapper = require('./LazyWrapper'),
66919 LodashWrapper = require('./LodashWrapper'),
66920 arrayCopy = require('./arrayCopy');
66923 * Creates a clone of `wrapper`.
66927 * wrapper The wrapper to clone.
66928 * @returns {Object} Returns the cloned wrapper.
66930 function wrapperClone(wrapper) {
66931 return wrapper instanceof LazyWrapper ? wrapper.clone() : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
66934 module.exports = wrapperClone;
66937 "./LazyWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js",
66938 "./LodashWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LodashWrapper.js",
66939 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js"
66941 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js": [function(require, module, exports) {
66942 var isArrayLike = require('../internal/isArrayLike'),
66943 isObjectLike = require('../internal/isObjectLike');
66945 /** Used for native method references. */
66946 var objectProto = Object.prototype;
66948 /** Used to check objects for own properties. */
66949 var hasOwnProperty = objectProto.hasOwnProperty;
66951 /** Native method references. */
66952 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
66955 * Checks if `value` is classified as an `arguments` object.
66961 * value The value to check.
66962 * @returns {boolean} Returns `true` if `value` is correctly classified, else
66966 * _.isArguments(function() { return arguments; }()); // => true
66968 * _.isArguments([1, 2, 3]); // => false
66970 function isArguments(value) {
66971 return isObjectLike(value) && isArrayLike(value) &&
66972 hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
66975 module.exports = isArguments;
66978 "../internal/isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
66979 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
66981 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js": [function(require, module, exports) {
66982 var getNative = require('../internal/getNative'),
66983 isLength = require('../internal/isLength'),
66984 isObjectLike = require('../internal/isObjectLike');
66986 /** `Object#toString` result references. */
66987 var arrayTag = '[object Array]';
66989 /** Used for native method references. */
66990 var objectProto = Object.prototype;
66993 * Used to resolve the
66994 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
66997 var objToString = objectProto.toString;
67000 * Native method references for those with the same name as other `lodash`
67003 var nativeIsArray = getNative(Array, 'isArray');
67006 * Checks if `value` is classified as an `Array` object.
67012 * value The value to check.
67013 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67017 * _.isArray([1, 2, 3]); // => true
67019 * _.isArray(function() { return arguments; }()); // => false
67021 var isArray = nativeIsArray || function(value) {
67022 return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
67025 module.exports = isArray;
67028 "../internal/getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js",
67029 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
67030 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67032 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js": [function(require, module, exports) {
67033 var isObject = require('./isObject');
67035 /** `Object#toString` result references. */
67036 var funcTag = '[object Function]';
67038 /** Used for native method references. */
67039 var objectProto = Object.prototype;
67042 * Used to resolve the
67043 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67046 var objToString = objectProto.toString;
67049 * Checks if `value` is classified as a `Function` object.
67055 * value The value to check.
67056 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67060 * _.isFunction(_); // => true
67062 * _.isFunction(/abc/); // => false
67064 function isFunction(value) {
67065 // The use of `Object#toString` avoids issues with the `typeof` operator
67066 // in older versions of Chrome and Safari which return 'function' for
67068 // and Safari 8 which returns 'object' for typed array constructors.
67069 return isObject(value) && objToString.call(value) == funcTag;
67072 module.exports = isFunction;
67075 "./isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
67077 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNative.js": [function(require, module, exports) {
67078 var isFunction = require('./isFunction'),
67079 isObjectLike = require('../internal/isObjectLike');
67081 /** Used to detect host constructors (Safari > 5). */
67082 var reIsHostCtor = /^\[object .+?Constructor\]$/;
67084 /** Used for native method references. */
67085 var objectProto = Object.prototype;
67087 /** Used to resolve the decompiled source of functions. */
67088 var fnToString = Function.prototype.toString;
67090 /** Used to check objects for own properties. */
67091 var hasOwnProperty = objectProto.hasOwnProperty;
67093 /** Used to detect if a method is native. */
67094 var reIsNative = RegExp('^' +
67095 fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
67096 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
67100 * Checks if `value` is a native function.
67106 * value The value to check.
67107 * @returns {boolean} Returns `true` if `value` is a native function, else
67111 * _.isNative(Array.prototype.push); // => true
67113 * _.isNative(_); // => false
67115 function isNative(value) {
67116 if (value == null) {
67119 if (isFunction(value)) {
67120 return reIsNative.test(fnToString.call(value));
67122 return isObjectLike(value) && reIsHostCtor.test(value);
67125 module.exports = isNative;
67128 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js",
67129 "./isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js"
67131 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js": [function(require, module, exports) {
67132 var isObjectLike = require('../internal/isObjectLike');
67134 /** `Object#toString` result references. */
67135 var numberTag = '[object Number]';
67137 /** Used for native method references. */
67138 var objectProto = Object.prototype;
67141 * Used to resolve the
67142 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67145 var objToString = objectProto.toString;
67148 * Checks if `value` is classified as a `Number` primitive or object.
67150 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
67151 * as numbers, use the `_.isFinite` method.
67157 * value The value to check.
67158 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67162 * _.isNumber(8.4); // => true
67164 * _.isNumber(NaN); // => true
67166 * _.isNumber('8.4'); // => false
67168 function isNumber(value) {
67169 return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
67172 module.exports = isNumber;
67175 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67177 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js": [function(require, module, exports) {
67179 * Checks if `value` is the [language type](https://es5.github.io/#x8) of
67180 * `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and
67181 * `new String('')`)
67187 * value The value to check.
67188 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
67191 * _.isObject({}); // => true
67193 * _.isObject([1, 2, 3]); // => true
67195 * _.isObject(1); // => false
67197 function isObject(value) {
67198 // Avoid a V8 JIT bug in Chrome 19-20.
67199 // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
67200 var type = typeof value;
67201 return !!value && (type == 'object' || type == 'function');
67204 module.exports = isObject;
67207 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isPlainObject.js": [function(require, module, exports) {
67208 var baseForIn = require('../internal/baseForIn'),
67209 isArguments = require('./isArguments'),
67210 isObjectLike = require('../internal/isObjectLike');
67212 /** `Object#toString` result references. */
67213 var objectTag = '[object Object]';
67215 /** Used for native method references. */
67216 var objectProto = Object.prototype;
67218 /** Used to check objects for own properties. */
67219 var hasOwnProperty = objectProto.hasOwnProperty;
67222 * Used to resolve the
67223 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67226 var objToString = objectProto.toString;
67229 * Checks if `value` is a plain object, that is, an object created by the
67230 * `Object` constructor or one with a `[[Prototype]]` of `null`.
67232 * **Note:** This method assumes objects created by the `Object` constructor
67233 * have no inherited enumerable properties.
67239 * value The value to check.
67240 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
67243 * function Foo() { this.a = 1; }
67245 * _.isPlainObject(new Foo); // => false
67247 * _.isPlainObject([1, 2, 3]); // => false
67249 * _.isPlainObject({ 'x': 0, 'y': 0 }); // => true
67251 * _.isPlainObject(Object.create(null)); // => true
67253 function isPlainObject(value) {
67256 // Exit early for non `Object` objects.
67257 if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
67258 (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
67261 // IE < 9 iterates inherited properties before own properties. If the first
67262 // iterated property is an object's own property then there are no inherited
67263 // enumerable properties.
67265 // In most environments an object's own properties are iterated before
67266 // its inherited properties. If the last iterated property is an object's
67267 // own property then there are no inherited enumerable properties.
67268 baseForIn(value, function(subValue, key) {
67271 return result === undefined || hasOwnProperty.call(value, result);
67274 module.exports = isPlainObject;
67277 "../internal/baseForIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForIn.js",
67278 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js",
67279 "./isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js"
67281 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js": [function(require, module, exports) {
67282 var isObjectLike = require('../internal/isObjectLike');
67284 /** `Object#toString` result references. */
67285 var stringTag = '[object String]';
67287 /** Used for native method references. */
67288 var objectProto = Object.prototype;
67291 * Used to resolve the
67292 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67295 var objToString = objectProto.toString;
67298 * Checks if `value` is classified as a `String` primitive or object.
67304 * value The value to check.
67305 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67309 * _.isString('abc'); // => true
67311 * _.isString(1); // => false
67313 function isString(value) {
67314 return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
67317 module.exports = isString;
67320 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67322 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js": [function(require, module, exports) {
67323 var isLength = require('../internal/isLength'),
67324 isObjectLike = require('../internal/isObjectLike');
67326 /** `Object#toString` result references. */
67327 var argsTag = '[object Arguments]',
67328 arrayTag = '[object Array]',
67329 boolTag = '[object Boolean]',
67330 dateTag = '[object Date]',
67331 errorTag = '[object Error]',
67332 funcTag = '[object Function]',
67333 mapTag = '[object Map]',
67334 numberTag = '[object Number]',
67335 objectTag = '[object Object]',
67336 regexpTag = '[object RegExp]',
67337 setTag = '[object Set]',
67338 stringTag = '[object String]',
67339 weakMapTag = '[object WeakMap]';
67341 var arrayBufferTag = '[object ArrayBuffer]',
67342 float32Tag = '[object Float32Array]',
67343 float64Tag = '[object Float64Array]',
67344 int8Tag = '[object Int8Array]',
67345 int16Tag = '[object Int16Array]',
67346 int32Tag = '[object Int32Array]',
67347 uint8Tag = '[object Uint8Array]',
67348 uint8ClampedTag = '[object Uint8ClampedArray]',
67349 uint16Tag = '[object Uint16Array]',
67350 uint32Tag = '[object Uint32Array]';
67352 /** Used to identify `toStringTag` values of typed arrays. */
67353 var typedArrayTags = {};
67354 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
67355 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
67356 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
67357 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
67358 typedArrayTags[uint32Tag] = true;
67359 typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
67360 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
67361 typedArrayTags[dateTag] = typedArrayTags[errorTag] =
67362 typedArrayTags[funcTag] = typedArrayTags[mapTag] =
67363 typedArrayTags[numberTag] = typedArrayTags[objectTag] =
67364 typedArrayTags[regexpTag] = typedArrayTags[setTag] =
67365 typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
67367 /** Used for native method references. */
67368 var objectProto = Object.prototype;
67371 * Used to resolve the
67372 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67375 var objToString = objectProto.toString;
67378 * Checks if `value` is classified as a typed array.
67384 * value The value to check.
67385 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67389 * _.isTypedArray(new Uint8Array); // => true
67391 * _.isTypedArray([]); // => false
67393 function isTypedArray(value) {
67394 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
67397 module.exports = isTypedArray;
67400 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
67401 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67403 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\toPlainObject.js": [function(require, module, exports) {
67404 var baseCopy = require('../internal/baseCopy'),
67405 keysIn = require('../object/keysIn');
67408 * Converts `value` to a plain object flattening inherited enumerable properties
67409 * of `value` to own properties of the plain object.
67415 * value The value to convert.
67416 * @returns {Object} Returns the converted plain object.
67419 * function Foo() { this.b = 2; }
67421 * Foo.prototype.c = 3;
67423 * _.assign({ 'a': 1 }, new Foo); // => { 'a': 1, 'b': 2 }
67425 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); // => { 'a': 1, 'b': 2, 'c':
67428 function toPlainObject(value) {
67429 return baseCopy(value, keysIn(value));
67432 module.exports = toPlainObject;
67435 "../internal/baseCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCopy.js",
67436 "../object/keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js"
67438 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js": [function(require, module, exports) {
67439 var assignWith = require('../internal/assignWith'),
67440 baseAssign = require('../internal/baseAssign'),
67441 createAssigner = require('../internal/createAssigner');
67444 * Assigns own enumerable properties of source object(s) to the destination
67445 * object. Subsequent sources overwrite property assignments of previous
67446 * sources. If `customizer` is provided it's invoked to produce the assigned
67447 * values. The `customizer` is bound to `thisArg` and invoked with five
67448 * arguments: (objectValue, sourceValue, key, object, source).
67450 * **Note:** This method mutates `object` and is based on
67451 * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
67458 * object The destination object.
67459 * @param {...Object}
67460 * [sources] The source objects.
67461 * @param {Function}
67462 * [customizer] The function to customize assigned values.
67464 * [thisArg] The `this` binding of `customizer`.
67465 * @returns {Object} Returns `object`.
67468 * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); // => {
67469 * 'user': 'fred', 'age': 40 }
67470 * // using a customizer callback var defaults = _.partialRight(_.assign,
67471 * function(value, other) { return _.isUndefined(value) ? other : value; });
67473 * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); // => {
67474 * 'user': 'barney', 'age': 36 }
67476 var assign = createAssigner(function(object, source, customizer) {
67477 return customizer ? assignWith(object, source, customizer) : baseAssign(object, source);
67480 module.exports = assign;
67483 "../internal/assignWith": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\assignWith.js",
67484 "../internal/baseAssign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseAssign.js",
67485 "../internal/createAssigner": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAssigner.js"
67487 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js": [function(require, module, exports) {
67488 var getNative = require('../internal/getNative'),
67489 isArrayLike = require('../internal/isArrayLike'),
67490 isObject = require('../lang/isObject'),
67491 shimKeys = require('../internal/shimKeys');
67494 * Native method references for those with the same name as other `lodash`
67497 var nativeKeys = getNative(Object, 'keys');
67500 * Creates an array of the own enumerable property names of `object`.
67502 * **Note:** Non-object values are coerced to objects. See the [ES
67503 * spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) for more
67510 * object The object to query.
67511 * @returns {Array} Returns the array of property names.
67514 * function Foo() { this.a = 1; this.b = 2; }
67516 * Foo.prototype.c = 3;
67518 * _.keys(new Foo); // => ['a', 'b'] (iteration order is not guaranteed)
67520 * _.keys('hi'); // => ['0', '1']
67522 var keys = !nativeKeys ? shimKeys : function(object) {
67523 var Ctor = object == null ? undefined : object.constructor;
67524 if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
67525 (typeof object != 'function' && isArrayLike(object))) {
67526 return shimKeys(object);
67528 return isObject(object) ? nativeKeys(object) : [];
67531 module.exports = keys;
67534 "../internal/getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js",
67535 "../internal/isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
67536 "../internal/shimKeys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\shimKeys.js",
67537 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
67539 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js": [function(require, module, exports) {
67540 var isArguments = require('../lang/isArguments'),
67541 isArray = require('../lang/isArray'),
67542 isIndex = require('../internal/isIndex'),
67543 isLength = require('../internal/isLength'),
67544 isObject = require('../lang/isObject');
67546 /** Used for native method references. */
67547 var objectProto = Object.prototype;
67549 /** Used to check objects for own properties. */
67550 var hasOwnProperty = objectProto.hasOwnProperty;
67553 * Creates an array of the own and inherited enumerable property names of
67556 * **Note:** Non-object values are coerced to objects.
67562 * object The object to query.
67563 * @returns {Array} Returns the array of property names.
67566 * function Foo() { this.a = 1; this.b = 2; }
67568 * Foo.prototype.c = 3;
67570 * _.keysIn(new Foo); // => ['a', 'b', 'c'] (iteration order is not guaranteed)
67572 function keysIn(object) {
67573 if (object == null) {
67576 if (!isObject(object)) {
67577 object = Object(object);
67579 var length = object.length;
67580 length = (length && isLength(length) &&
67581 (isArray(object) || isArguments(object)) && length) || 0;
67583 var Ctor = object.constructor,
67585 isProto = typeof Ctor == 'function' && Ctor.prototype === object,
67586 result = Array(length),
67587 skipIndexes = length > 0;
67589 while (++index < length) {
67590 result[index] = (index + '');
67592 for (var key in object) {
67593 if (!(skipIndexes && isIndex(key, length)) &&
67594 !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
67601 module.exports = keysIn;
67604 "../internal/isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js",
67605 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
67606 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
67607 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
67608 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
67610 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\merge.js": [function(require, module, exports) {
67611 var baseMerge = require('../internal/baseMerge'),
67612 createAssigner = require('../internal/createAssigner');
67615 * Recursively merges own enumerable properties of the source object(s), that
67616 * don't resolve to `undefined` into the destination object. Subsequent sources
67617 * overwrite property assignments of previous sources. If `customizer` is
67618 * provided it's invoked to produce the merged values of the destination and
67619 * source properties. If `customizer` returns `undefined` merging is handled by
67620 * the method instead. The `customizer` is bound to `thisArg` and invoked with
67621 * five arguments: (objectValue, sourceValue, key, object, source).
67627 * object The destination object.
67628 * @param {...Object}
67629 * [sources] The source objects.
67630 * @param {Function}
67631 * [customizer] The function to customize assigned values.
67633 * [thisArg] The `this` binding of `customizer`.
67634 * @returns {Object} Returns `object`.
67637 * var users = { 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] };
67639 * var ages = { 'data': [{ 'age': 36 }, { 'age': 40 }] };
67641 * _.merge(users, ages); // => { 'data': [{ 'user': 'barney', 'age': 36 }, {
67642 * 'user': 'fred', 'age': 40 }] }
67643 * // using a customizer callback var object = { 'fruits': ['apple'],
67644 * 'vegetables': ['beet'] };
67646 * var other = { 'fruits': ['banana'], 'vegetables': ['carrot'] };
67648 * _.merge(object, other, function(a, b) { if (_.isArray(a)) { return
67649 * a.concat(b); } }); // => { 'fruits': ['apple', 'banana'], 'vegetables':
67650 * ['beet', 'carrot'] }
67652 var merge = createAssigner(baseMerge);
67654 module.exports = merge;
67657 "../internal/baseMerge": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMerge.js",
67658 "../internal/createAssigner": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAssigner.js"
67660 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\omit.js": [function(require, module, exports) {
67661 var arrayMap = require('../internal/arrayMap'),
67662 baseDifference = require('../internal/baseDifference'),
67663 baseFlatten = require('../internal/baseFlatten'),
67664 bindCallback = require('../internal/bindCallback'),
67665 keysIn = require('./keysIn'),
67666 pickByArray = require('../internal/pickByArray'),
67667 pickByCallback = require('../internal/pickByCallback'),
67668 restParam = require('../function/restParam');
67671 * The opposite of `_.pick`; this method creates an object composed of the own
67672 * and inherited enumerable properties of `object` that are not omitted.
67678 * object The source object.
67679 * @param {Function|...(string|string[])}
67680 * [predicate] The function invoked per iteration or property names
67681 * to omit, specified as individual property names or arrays of
67684 * [thisArg] The `this` binding of `predicate`.
67685 * @returns {Object} Returns the new object.
67688 * var object = { 'user': 'fred', 'age': 40 };
67690 * _.omit(object, 'age'); // => { 'user': 'fred' }
67692 * _.omit(object, _.isNumber); // => { 'user': 'fred' }
67694 var omit = restParam(function(object, props) {
67695 if (object == null) {
67698 if (typeof props[0] != 'function') {
67699 var props = arrayMap(baseFlatten(props), String);
67700 return pickByArray(object, baseDifference(keysIn(object), props));
67702 var predicate = bindCallback(props[0], props[1], 3);
67703 return pickByCallback(object, function(value, key, object) {
67704 return !predicate(value, key, object);
67708 module.exports = omit;
67711 "../function/restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js",
67712 "../internal/arrayMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayMap.js",
67713 "../internal/baseDifference": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDifference.js",
67714 "../internal/baseFlatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js",
67715 "../internal/bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js",
67716 "../internal/pickByArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByArray.js",
67717 "../internal/pickByCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByCallback.js",
67718 "./keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js"
67720 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pairs.js": [function(require, module, exports) {
67721 var keys = require('./keys'),
67722 toObject = require('../internal/toObject');
67725 * Creates a two dimensional array of the key-value pairs for `object`, e.g.
67726 * `[[key1, value1], [key2, value2]]`.
67732 * object The object to query.
67733 * @returns {Array} Returns the new array of key-value pairs.
67736 * _.pairs({ 'barney': 36, 'fred': 40 }); // => [['barney', 36], ['fred', 40]]
67737 * (iteration order is not guaranteed)
67739 function pairs(object) {
67740 object = toObject(object);
67743 props = keys(object),
67744 length = props.length,
67745 result = Array(length);
67747 while (++index < length) {
67748 var key = props[index];
67749 result[index] = [key, object[key]];
67754 module.exports = pairs;
67757 "../internal/toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js",
67758 "./keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
67760 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js": [function(require, module, exports) {
67761 var baseFlatten = require('../internal/baseFlatten'),
67762 bindCallback = require('../internal/bindCallback'),
67763 pickByArray = require('../internal/pickByArray'),
67764 pickByCallback = require('../internal/pickByCallback'),
67765 restParam = require('../function/restParam');
67768 * Creates an object composed of the picked `object` properties. Property names
67769 * may be specified as individual arguments or as arrays of property names. If
67770 * `predicate` is provided it's invoked for each property of `object` picking
67771 * the properties `predicate` returns truthy for. The predicate is bound to
67772 * `thisArg` and invoked with three arguments: (value, key, object).
67778 * object The source object.
67779 * @param {Function|...(string|string[])}
67780 * [predicate] The function invoked per iteration or property names
67781 * to pick, specified as individual property names or arrays of
67784 * [thisArg] The `this` binding of `predicate`.
67785 * @returns {Object} Returns the new object.
67788 * var object = { 'user': 'fred', 'age': 40 };
67790 * _.pick(object, 'user'); // => { 'user': 'fred' }
67792 * _.pick(object, _.isString); // => { 'user': 'fred' }
67794 var pick = restParam(function(object, props) {
67795 if (object == null) {
67798 return typeof props[0] == 'function' ? pickByCallback(object, bindCallback(props[0], props[1], 3)) : pickByArray(object, baseFlatten(props));
67801 module.exports = pick;
67804 "../function/restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js",
67805 "../internal/baseFlatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js",
67806 "../internal/bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js",
67807 "../internal/pickByArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByArray.js",
67808 "../internal/pickByCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByCallback.js"
67810 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\values.js": [function(require, module, exports) {
67811 var baseValues = require('../internal/baseValues'),
67812 keys = require('./keys');
67815 * Creates an array of the own enumerable property values of `object`.
67817 * **Note:** Non-object values are coerced to objects.
67823 * object The object to query.
67824 * @returns {Array} Returns the array of property values.
67827 * function Foo() { this.a = 1; this.b = 2; }
67829 * Foo.prototype.c = 3;
67831 * _.values(new Foo); // => [1, 2] (iteration order is not guaranteed)
67833 * _.values('hi'); // => ['h', 'i']
67835 function values(object) {
67836 return baseValues(object, keys(object));
67839 module.exports = values;
67842 "../internal/baseValues": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseValues.js",
67843 "./keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
67845 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js": [function(require, module, exports) {
67847 * This method returns the first argument provided to it.
67851 * @category Utility
67854 * @returns {*} Returns `value`.
67857 * var object = { 'user': 'fred' };
67859 * _.identity(object) === object; // => true
67861 function identity(value) {
67865 module.exports = identity;
67868 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\noop.js": [function(require, module, exports) {
67870 * A no-operation function that returns `undefined` regardless of the arguments
67875 * @category Utility
67878 * var object = { 'user': 'fred' };
67880 * _.noop(object) === undefined; // => true
67883 // No operation performed.
67886 module.exports = noop;
67889 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\property.js": [function(require, module, exports) {
67890 var baseProperty = require('../internal/baseProperty'),
67891 basePropertyDeep = require('../internal/basePropertyDeep'),
67892 isKey = require('../internal/isKey');
67895 * Creates a function that returns the property value at `path` on a given
67900 * @category Utility
67901 * @param {Array|string}
67902 * path The path of the property to get.
67903 * @returns {Function} Returns the new function.
67906 * var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ];
67908 * _.map(objects, _.property('a.b.c')); // => [2, 1]
67910 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); // => [1,
67913 function property(path) {
67914 return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
67917 module.exports = property;
67920 "../internal/baseProperty": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseProperty.js",
67921 "../internal/basePropertyDeep": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\basePropertyDeep.js",
67922 "../internal/isKey": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isKey.js"
67924 }, {}, ["\\bpmn-js-examples-master\\modeler\\app\\index.js"]);