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:Collector': function(p, element) {
1454 var lane = renderer('bpmn:Lane')(p, element, {
1458 var expandedPool = DiUtil.isExpanded(element);
1476 var text2 = getSemantic(element).name;
1477 if (text2 == undefined) {
1478 text2 = 'Collector';
1481 renderLabel(p, text2, {
1483 align: 'center-middle'
1487 // Collapsed pool draw text inline
1488 var text2 = getSemantic(element).name;
1489 renderLabel(p, text2, {
1491 align: 'center-middle'
1495 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1497 if (participantMultiplicity) {
1498 renderer('ParticipantMultiplicityMarker')(p, element);
1505 'bpmn:VesCollector': function(p, element) {
1506 var lane = renderer('bpmn:Lane')(p, element, {
1510 var expandedPool = DiUtil.isExpanded(element);
1529 textUtil.createText(p, "V", {
1534 right: element.width - 20,
1538 textUtil.createText(p, "E", {
1543 right: element.width - 20,
1547 textUtil.createText(p, "S", {
1552 right: element.width - 20,
1557 var text2 = getSemantic(element).name;
1558 if (text2 == undefined) {
1559 text2 = 'VesCollector';
1562 renderLabel(p, text2, {
1564 align: 'center-middle'
1568 // Collapsed pool draw text inline
1569 var text2 = getSemantic(element).name;
1570 renderLabel(p, text2, {
1572 align: 'center-middle'
1576 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1578 if (participantMultiplicity) {
1579 renderer('ParticipantMultiplicityMarker')(p, element);
1585 'bpmn:Holmes': function(p, element) {
1586 var lane = renderer('bpmn:Lane')(p, element, {
1590 var expandedPool = DiUtil.isExpanded(element);
1592 var instanceName = getSemantic(element).name;
1595 if (instanceName == undefined) {
1596 instanceName = 'Holmes';
1599 // add holmes 'icon'
1600 var attrs = computeStyle({}, {
1605 p.circle(15, 15, 10).attr(attrs)
1606 textUtil.createText(p, "H", {
1615 renderLabel(p, instanceName, {
1617 align: 'center-middle'
1620 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1622 if (participantMultiplicity) {
1623 renderer('ParticipantMultiplicityMarker')(p, element);
1630 'bpmn:StringMatch': function(p, element) {
1631 var lane = renderer('bpmn:Lane')(p, element, {
1635 var expandedPool = DiUtil.isExpanded(element);
1646 var text2 = getSemantic(element).name;
1647 if (text2 == undefined) {
1648 text2 = 'StringMatch';
1650 renderLabel(p, text2, {
1652 align: 'center-middle'
1656 // Collapsed pool draw text inline
1657 var text2 = getSemantic(element).name;
1658 renderLabel(p, text2, {
1660 align: 'center-middle'
1664 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1666 if (participantMultiplicity) {
1667 renderer('ParticipantMultiplicityMarker')(p, element);
1675 'bpmn:TCA': function(p, element) {
1676 var lane = renderer('bpmn:Lane')(p, element, {
1680 var expandedPool = DiUtil.isExpanded(element);
1687 y: element.height - 20
1690 y: element.height - 20
1692 var text2 = getSemantic(element).name;
1693 if (text2 == undefined) {
1696 renderLabel(p, text2, {
1698 align: 'center-middle'
1702 // Collapsed pool draw text inline
1703 var text2 = getSemantic(element).name;
1704 renderLabel(p, text2, {
1706 align: 'center-middle'
1710 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1712 if (participantMultiplicity) {
1713 renderer('ParticipantMultiplicityMarker')(p, element);
1720 'bpmn:GOC': function(p, element) {
1721 var lane = renderer('bpmn:Lane')(p, element, {
1725 var expandedPool = DiUtil.isExpanded(element);
1732 x: element.width / 2,
1736 y: element.height / 2
1738 var text2 = getSemantic(element).name;
1739 if (text2 == undefined) {
1742 renderLabel(p, text2, {
1744 align: 'center-middle'
1748 // Collapsed pool draw text inline
1749 var text2 = getSemantic(element).name;
1750 renderLabel(p, text2, {
1752 align: 'center-middle'
1756 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1758 if (participantMultiplicity) {
1759 renderer('ParticipantMultiplicityMarker')(p, element);
1766 'bpmn:Policy': function(p, element) {
1767 var lane = renderer('bpmn:Lane')(p, element, {
1771 var expandedPool = DiUtil.isExpanded(element);
1779 y: element.height / 2
1781 x: element.width / 2,
1784 var text2 = getSemantic(element).name;
1785 if (text2 == undefined) {
1788 renderLabel(p, text2, {
1790 align: 'center-middle'
1794 // Collapsed pool draw text inline
1795 var text2 = getSemantic(element).name;
1796 renderLabel(p, text2, {
1798 align: 'center-middle'
1802 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
1804 if (participantMultiplicity) {
1805 renderer('ParticipantMultiplicityMarker')(p, element);
1812 'bpmn:MessageEventDefinition': function(p, element, isThrowing) {
1813 var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
1816 containerWidth: element.width,
1817 containerHeight: element.height,
1824 var fill = isThrowing ? 'black' : 'white';
1825 var stroke = isThrowing ? 'white' : 'black';
1827 var messagePath = drawPath(p, pathData, {
1835 'bpmn:TimerEventDefinition': function(p, element) {
1837 var circle = drawCircle(p, element.width, element.height, 0.2 * element.height, {
1841 var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
1844 containerWidth: element.width,
1845 containerHeight: element.height,
1852 drawPath(p, pathData, {
1854 strokeLinecap: 'square'
1857 for (var i = 0; i < 12; i++) {
1859 var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
1862 containerWidth: element.width,
1863 containerHeight: element.height,
1870 var width = element.width / 2;
1871 var height = element.height / 2;
1873 drawPath(p, linePathData, {
1875 strokeLinecap: 'square',
1876 transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
1882 'bpmn:EscalationEventDefinition': function(p, event, isThrowing) {
1883 var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
1886 containerWidth: event.width,
1887 containerHeight: event.height,
1894 var fill = isThrowing ? 'black' : 'none';
1896 return drawPath(p, pathData, {
1901 'bpmn:ConditionalEventDefinition': function(p, event) {
1902 var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
1905 containerWidth: event.width,
1906 containerHeight: event.height,
1913 return drawPath(p, pathData, {
1917 'bpmn:LinkEventDefinition': function(p, event, isThrowing) {
1918 var pathData = pathMap.getScaledPath('EVENT_LINK', {
1921 containerWidth: event.width,
1922 containerHeight: event.height,
1929 var fill = isThrowing ? 'black' : 'none';
1931 return drawPath(p, pathData, {
1936 'bpmn:ErrorEventDefinition': function(p, event, isThrowing) {
1937 var pathData = pathMap.getScaledPath('EVENT_ERROR', {
1940 containerWidth: event.width,
1941 containerHeight: event.height,
1948 var fill = isThrowing ? 'black' : 'none';
1950 return drawPath(p, pathData, {
1955 'bpmn:CancelEventDefinition': function(p, event, isThrowing) {
1956 var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
1959 containerWidth: event.width,
1960 containerHeight: event.height,
1967 var fill = isThrowing ? 'black' : 'none';
1969 return drawPath(p, pathData, {
1972 }).transform('rotate(45)');
1974 'bpmn:CompensateEventDefinition': function(p, event, isThrowing) {
1975 var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
1978 containerWidth: event.width,
1979 containerHeight: event.height,
1986 var fill = isThrowing ? 'black' : 'none';
1988 return drawPath(p, pathData, {
1993 'bpmn:SignalEventDefinition': function(p, event, isThrowing) {
1994 var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
1997 containerWidth: event.width,
1998 containerHeight: event.height,
2005 var fill = isThrowing ? 'black' : 'none';
2007 return drawPath(p, pathData, {
2012 'bpmn:MultipleEventDefinition': function(p, event, isThrowing) {
2013 var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
2016 containerWidth: event.width,
2017 containerHeight: event.height,
2024 var fill = isThrowing ? 'black' : 'none';
2026 return drawPath(p, pathData, {
2031 'bpmn:ParallelMultipleEventDefinition': function(p, event) {
2032 var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
2035 containerWidth: event.width,
2036 containerHeight: event.height,
2043 return drawPath(p, pathData, {
2047 'bpmn:EndEvent': function(p, element) {
2048 var circle = renderer('bpmn:Event')(p, element, {
2052 renderEventContent(element, p, true);
2056 'bpmn:TerminateEventDefinition': function(p, element) {
2057 var circle = drawCircle(p, element.width, element.height, 8, {
2064 'bpmn:IntermediateEvent': function(p, element) {
2065 var outer = renderer('bpmn:Event')(p, element, {
2069 drawCircle(p, element.width, element.height, INNER_OUTER_DIST, {
2074 renderEventContent(element, p);
2078 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
2079 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
2081 'bpmn:Activity': function(p, element, attrs) {
2082 return drawRect(p, element.width, element.height, TASK_BORDER_RADIUS, attrs);
2085 'bpmn:Task': function(p, element, attrs) {
2086 var rect = renderer('bpmn:Activity')(p, element, attrs);
2087 renderEmbeddedLabel(p, element, 'center-middle');
2088 attachTaskMarkers(p, element);
2091 'bpmn:ServiceTask': function(p, element) {
2092 var task = renderer('bpmn:Task')(p, element);
2094 var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
2102 drawPath(p, pathDataBG, {
2107 var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
2115 drawPath(p, fillPathData, {
2121 var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
2129 drawPath(p, pathData, {
2136 'bpmn:UserTask': function(p, element) {
2137 var task = renderer('bpmn:Task')(p, element);
2142 var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {
2150 drawPath(p, pathData, {
2155 var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
2163 drawPath(p, pathData2, {
2168 var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
2176 drawPath(p, pathData3, {
2183 'bpmn:ManualTask': function(p, element) {
2184 var task = renderer('bpmn:Task')(p, element);
2186 var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
2194 drawPath(p, pathData, {
2202 'bpmn:SendTask': function(p, element) {
2203 var task = renderer('bpmn:Task')(p, element);
2205 var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
2209 containerHeight: 14,
2217 drawPath(p, pathData, {
2225 'bpmn:ReceiveTask': function(p, element) {
2226 var semantic = getSemantic(element);
2228 var task = renderer('bpmn:Task')(p, element);
2231 if (semantic.instantiate) {
2232 drawCircle(p, 28, 28, 20 * 0.22, {
2236 pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
2244 pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
2248 containerHeight: 14,
2257 drawPath(p, pathData, {
2263 'bpmn:ScriptTask': function(p, element) {
2264 var task = renderer('bpmn:Task')(p, element);
2266 var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
2274 drawPath(p, pathData, {
2280 'bpmn:BusinessRuleTask': function(p, element) {
2281 var task = renderer('bpmn:Task')(p, element);
2283 var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
2290 var businessHeaderPath = drawPath(p, headerPathData);
2291 businessHeaderPath.attr({
2296 var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
2303 var businessPath = drawPath(p, headerData);
2310 'bpmn:SubProcess': function(p, element, attrs) {
2311 var rect = renderer('bpmn:Activity')(p, element, attrs);
2313 var semantic = getSemantic(element);
2315 var expanded = DiUtil.isExpanded(semantic);
2317 var isEventSubProcess = !!semantic.triggeredByEvent;
2318 if (isEventSubProcess) {
2320 strokeDasharray: '1,2'
2324 renderEmbeddedLabel(p, element, expanded ? 'center-top' : 'center-middle');
2327 attachTaskMarkers(p, element);
2329 attachTaskMarkers(p, element, ['SubProcessMarker']);
2334 'bpmn:AdHocSubProcess': function(p, element) {
2335 return renderer('bpmn:SubProcess')(p, element);
2337 'bpmn:Transaction': function(p, element) {
2338 var outer = renderer('bpmn:SubProcess')(p, element);
2340 var innerAttrs = styles.style(['no-fill', 'no-events']);
2343 drawRect(p, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
2347 'bpmn:CallActivity': function(p, element) {
2348 return renderer('bpmn:Task')(p, element, {
2352 'bpmn:Participant': function(p, element) {
2354 var lane = renderer('bpmn:Lane')(p, element, {
2358 var expandedPool = DiUtil.isExpanded(element);
2368 var text = getSemantic(element).name;
2369 renderLaneLabel(p, text, element);
2371 // Collapsed pool draw text inline
2372 var text2 = getSemantic(element).name;
2373 renderLabel(p, text2, {
2375 align: 'center-middle'
2379 var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
2381 if (participantMultiplicity) {
2382 renderer('ParticipantMultiplicityMarker')(p, element);
2387 'bpmn:Lane': function(p, element, attrs) {
2388 var rect = drawRect(p, element.width, element.height, 0, attrs || {
2392 var semantic = getSemantic(element);
2394 if (semantic.$type === 'bpmn:Lane') {
2395 var text = semantic.name;
2396 renderLaneLabel(p, text, element);
2401 'bpmn:InclusiveGateway': function(p, element) {
2402 var diamond = drawDiamond(p, element.width, element.height);
2405 drawCircle(p, element.width, element.height, element.height * 0.24, {
2412 'bpmn:ExclusiveGateway': function(p, element) {
2413 var diamond = drawDiamond(p, element.width, element.height);
2414 renderEmbeddedLabel(p, element, 'center-middle');
2416 var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
2419 containerWidth: element.width,
2420 containerHeight: element.height,
2427 if (!!(getDi(element).isMarkerVisible)) {
2428 drawPath(p, pathData, {
2436 'bpmn:ComplexGateway': function(p, element) {
2437 var diamond = drawDiamond(p, element.width, element.height);
2439 var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
2442 containerWidth: element.width,
2443 containerHeight: element.height,
2451 drawPath(p, pathData, {
2458 'bpmn:ParallelGateway': function(p, element) {
2459 var diamond = drawDiamond(p, element.width, element.height);
2461 var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
2464 containerWidth: element.width,
2465 containerHeight: element.height,
2473 drawPath(p, pathData, {
2480 'bpmn:EventBasedGateway': function(p, element) {
2482 var semantic = getSemantic(element);
2484 var diamond = drawDiamond(p, element.width, element.height);
2486 /* outer circle path */
2487 drawCircle(p, element.width, element.height, element.height * 0.20, {
2492 var type = semantic.eventGatewayType;
2493 var instantiate = !!semantic.instantiate;
2495 function drawEvent() {
2497 var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
2500 containerWidth: element.width,
2501 containerHeight: element.height,
2509 drawPath(p, pathData, {
2515 if (type === 'Parallel') {
2517 var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
2520 containerWidth: element.width,
2521 containerHeight: element.height,
2528 var parallelPath = drawPath(p, pathData);
2533 } else if (type === 'Exclusive') {
2536 var innerCircle = drawCircle(p, element.width, element.height, element.height * 0.26);
2549 'bpmn:Gateway': function(p, element) {
2550 var diamond = drawDiamond(p, element.width, element.height);
2551 renderEmbeddedLabel(p, element, 'center-middle');
2555 'bpmn:SequenceFlow': function(p, element) {
2556 var pathData = createPathFromConnection(element);
2557 var path = drawPath(p, pathData, {
2558 strokeLinejoin: 'round',
2559 markerEnd: marker('sequenceflow-end')
2562 var sequenceFlow = getSemantic(element);
2563 var source = element.source.businessObject;
2565 // conditional flow marker
2566 if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Task')) {
2568 markerStart: marker('conditional-flow-marker')
2573 if (source.default && source.$instanceOf('bpmn:Gateway') && source.default === sequenceFlow) {
2575 markerStart: marker('conditional-default-flow-marker')
2581 'bpmn:Association': function(p, element, attrs) {
2584 strokeDasharray: '1,6',
2585 strokeLinecap: 'round',
2586 strokeLinejoin: 'round'
2589 // TODO(nre): style according to directed state
2590 return drawLine(p, element.waypoints, attrs);
2592 'bpmn:DataInputAssociation': function(p, element) {
2593 return renderer('bpmn:Association')(p, element, {
2594 markerEnd: marker('data-association-end')
2597 'bpmn:DataOutputAssociation': function(p, element) {
2598 return renderer('bpmn:Association')(p, element, {
2599 markerEnd: marker('data-association-end')
2602 'bpmn:MessageFlow': function(p, element) {
2604 var semantic = getSemantic(element),
2605 di = getDi(element);
2607 var pathData = createPathFromConnection(element);
2608 var path = drawPath(p, pathData, {
2609 markerEnd: marker('messageflow-end'),
2610 markerStart: marker('messageflow-start'),
2611 strokeDasharray: '10, 12',
2612 strokeLinecap: 'round',
2613 strokeLinejoin: 'round',
2614 strokeWidth: '1.5px'
2617 if (semantic.messageRef) {
2618 var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
2620 var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
2627 var messageAttrs = {
2631 if (di.messageVisibleKind === 'initiating') {
2632 messageAttrs.fill = 'white';
2633 messageAttrs.stroke = 'black';
2635 messageAttrs.fill = '#888';
2636 messageAttrs.stroke = 'white';
2639 drawPath(p, markerPathData, messageAttrs);
2644 'bpmn:DataObject': function(p, element) {
2645 var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
2648 containerWidth: element.width,
2649 containerHeight: element.height,
2656 var elementObject = drawPath(p, pathData, {
2660 var semantic = getSemantic(element);
2662 if (isCollection(semantic)) {
2663 renderDataItemCollection(p, element);
2666 return elementObject;
2668 'bpmn:DataObjectReference': as('bpmn:DataObject'),
2669 'bpmn:DataInput': function(p, element) {
2671 var arrowPathData = pathMap.getRawPath('DATA_ARROW');
2674 var elementObject = renderer('bpmn:DataObject')(p, element);
2676 /* input arrow path */
2677 drawPath(p, arrowPathData, {
2681 return elementObject;
2683 'bpmn:DataOutput': function(p, element) {
2684 var arrowPathData = pathMap.getRawPath('DATA_ARROW');
2687 var elementObject = renderer('bpmn:DataObject')(p, element);
2689 /* output arrow path */
2690 drawPath(p, arrowPathData, {
2695 return elementObject;
2697 'bpmn:DataStoreReference': function(p, element) {
2698 var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
2701 containerWidth: element.width,
2702 containerHeight: element.height,
2709 var elementStore = drawPath(p, DATA_STORE_PATH, {
2714 return elementStore;
2716 'bpmn:BoundaryEvent': function(p, element) {
2718 var semantic = getSemantic(element),
2719 cancel = semantic.cancelActivity;
2722 strokeLinecap: 'round',
2727 attrs.strokeDasharray = '6';
2730 var outer = renderer('bpmn:Event')(p, element, attrs);
2732 drawCircle(p, element.width, element.height, INNER_OUTER_DIST, attrs);
2734 renderEventContent(element, p);
2738 'bpmn:Group': function(p, element) {
2739 return drawRect(p, element.width, element.height, TASK_BORDER_RADIUS, {
2741 strokeDasharray: '8,3,1,3',
2743 pointerEvents: 'none'
2746 'label': function(p, element) {
2747 return renderExternalLabel(p, element, '');
2749 'bpmn:TextAnnotation': function(p, element) {
2754 var textElement = drawRect(p, element.width, element.height, 0, 0, style);
2755 var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
2758 containerWidth: element.width,
2759 containerHeight: element.height,
2765 drawPath(p, textPathData);
2767 var text = getSemantic(element).text || '';
2768 renderLabel(p, text, {
2770 align: 'left-middle',
2776 'ParticipantMultiplicityMarker': function(p, element) {
2777 var subProcessPath = pathMap.getScaledPath('MARKER_PARALLEL', {
2780 containerWidth: element.width,
2781 containerHeight: element.height,
2783 mx: ((element.width / 2) / element.width),
2784 my: (element.height - 15) / element.height
2788 drawPath(p, subProcessPath);
2790 'SubProcessMarker': function(p, element) {
2791 var markerRect = drawRect(p, 14, 14, 0, {
2795 // Process marker is placed in the middle of the box
2796 // therefore fixed values can be used here
2797 markerRect.transform('translate(' + (element.width / 2 - 7.5) + ',' + (element.height - 20) + ')');
2799 var subProcessPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
2802 containerWidth: element.width,
2803 containerHeight: element.height,
2805 mx: (element.width / 2 - 7.5) / element.width,
2806 my: (element.height - 20) / element.height
2810 drawPath(p, subProcessPath);
2812 'ParallelMarker': function(p, element, position) {
2813 var subProcessPath = pathMap.getScaledPath('MARKER_PARALLEL', {
2816 containerWidth: element.width,
2817 containerHeight: element.height,
2819 mx: ((element.width / 2 + position.parallel) / element.width),
2820 my: (element.height - 20) / element.height
2823 drawPath(p, subProcessPath);
2825 'SequentialMarker': function(p, element, position) {
2826 var sequentialPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
2829 containerWidth: element.width,
2830 containerHeight: element.height,
2832 mx: ((element.width / 2 + position.seq) / element.width),
2833 my: (element.height - 19) / element.height
2836 drawPath(p, sequentialPath);
2838 'CompensationMarker': function(p, element, position) {
2839 var compensationPath = pathMap.getScaledPath('MARKER_COMPENSATION', {
2842 containerWidth: element.width,
2843 containerHeight: element.height,
2845 mx: ((element.width / 2 + position.compensation) / element.width),
2846 my: (element.height - 13) / element.height
2849 drawPath(p, compensationPath, {
2853 'LoopMarker': function(p, element, position) {
2854 var loopPath = pathMap.getScaledPath('MARKER_LOOP', {
2857 containerWidth: element.width,
2858 containerHeight: element.height,
2860 mx: ((element.width / 2 + position.loop) / element.width),
2861 my: (element.height - 7) / element.height
2865 drawPath(p, loopPath, {
2868 strokeLinecap: 'round',
2869 strokeMiterlimit: 0.5
2872 'AdhocMarker': function(p, element, position) {
2873 var loopPath = pathMap.getScaledPath('MARKER_ADHOC', {
2876 containerWidth: element.width,
2877 containerHeight: element.height,
2879 mx: ((element.width / 2 + position.adhoc) / element.width),
2880 my: (element.height - 15) / element.height
2884 drawPath(p, loopPath, {
2891 function attachTaskMarkers(p, element, taskMarkers) {
2892 var obj = getSemantic(element);
2894 var subprocess = includes(taskMarkers, 'SubProcessMarker');
2915 forEach(taskMarkers, function(marker) {
2916 renderer(marker)(p, element, position);
2919 if (obj.$type === 'bpmn:AdHocSubProcess') {
2920 renderer('AdhocMarker')(p, element, position);
2922 if (obj.loopCharacteristics && obj.loopCharacteristics.isSequential === undefined) {
2923 renderer('LoopMarker')(p, element, position);
2926 if (obj.loopCharacteristics &&
2927 obj.loopCharacteristics.isSequential !== undefined &&
2928 !obj.loopCharacteristics.isSequential) {
2929 renderer('ParallelMarker')(p, element, position);
2931 if (obj.loopCharacteristics && !!obj.loopCharacteristics.isSequential) {
2932 renderer('SequentialMarker')(p, element, position);
2934 if (!!obj.isForCompensation) {
2935 renderer('CompensationMarker')(p, element, position);
2939 function drawShape(parent, element) {
2940 var type = element.type;
2941 var h = handlers[type];
2945 return DefaultRenderer.prototype.drawShape.apply(this, [parent, element]);
2947 return h(parent, element);
2951 function drawConnection(parent, element) {
2952 var type = element.type;
2953 var h = handlers[type];
2957 return DefaultRenderer.prototype.drawConnection.apply(this, [parent, element]);
2959 return h(parent, element);
2963 function renderDataItemCollection(p, element) {
2965 var yPosition = (element.height - 16) / element.height;
2967 var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
2970 containerWidth: element.width,
2971 containerHeight: element.height,
2978 /* collection path */
2979 drawPath(p, pathData, {
2984 function isCollection(element, filter) {
2985 return element.isCollection ||
2986 (element.elementObjectRef && element.elementObjectRef.isCollection);
2989 function getDi(element) {
2990 return element.businessObject.di;
2993 function getSemantic(element) {
2994 return element.businessObject;
2998 * Checks if eventDefinition of the given element matches with semantic
3001 * @return {boolean} true if element is of the given semantic type
3003 function isTypedEvent(event, eventDefinitionType, filter) {
3005 function matches(definition, filter) {
3006 return every(filter, function(val, key) {
3008 // we want a == conversion here, to be able to catch
3009 // undefined == false and friends
3011 return definition[key] == val;
3015 return some(event.eventDefinitions, function(definition) {
3016 return definition.$type === eventDefinitionType && matches(event, filter);
3020 function isThrowEvent(event) {
3021 return (event.$type === 'bpmn:IntermediateThrowEvent') || (event.$type === 'bpmn:EndEvent');
3025 // ///// cropping path customizations /////////////////////////
3027 function componentsToPath(elements) {
3028 return elements.join(',').replace(/,?([A-z]),?/g, '$1');
3031 function getCirclePath(shape) {
3033 var cx = shape.x + shape.width / 2,
3034 cy = shape.y + shape.height / 2,
3035 radius = shape.width / 2;
3040 ['a', radius, radius, 0, 1, 1, 0, 2 * radius],
3041 ['a', radius, radius, 0, 1, 1, 0, -2 * radius],
3045 return componentsToPath(circlePath);
3048 function getRoundRectPath(shape) {
3050 var radius = TASK_BORDER_RADIUS,
3053 width = shape.width,
3054 height = shape.height;
3056 var roundRectPath = [
3057 ['M', x + radius, y],
3058 ['l', width - radius * 2, 0],
3059 ['a', radius, radius, 0, 0, 1, radius, radius],
3060 ['l', 0, height - radius * 2],
3061 ['a', radius, radius, 0, 0, 1, -radius, radius],
3062 ['l', radius * 2 - width, 0],
3063 ['a', radius, radius, 0, 0, 1, -radius, -radius],
3064 ['l', 0, radius * 2 - height],
3065 ['a', radius, radius, 0, 0, 1, radius, -radius],
3069 return componentsToPath(roundRectPath);
3072 function getDiamondPath(shape) {
3074 var width = shape.width,
3075 height = shape.height,
3078 halfWidth = width / 2,
3079 halfHeight = height / 2;
3082 ['M', x + halfWidth, y],
3083 ['l', halfWidth, halfHeight],
3084 ['l', -halfWidth, halfHeight],
3085 ['l', -halfWidth, -halfHeight],
3089 return componentsToPath(diamondPath);
3092 function getRectPath(shape) {
3095 width = shape.width,
3096 height = shape.height;
3106 return componentsToPath(rectPath);
3109 function getShapePath(element) {
3110 var obj = getSemantic(element);
3112 if (obj.$instanceOf('bpmn:Event')) {
3113 return getCirclePath(element);
3116 if (obj.$instanceOf('bpmn:Activity')) {
3117 return getRoundRectPath(element);
3120 if (obj.$instanceOf('bpmn:Gateway')) {
3121 return getDiamondPath(element);
3124 return getRectPath(element);
3128 // hook onto canvas init event to initialize
3129 // connection start/end markers on svg
3130 events.on('canvas.init', function(event) {
3131 initMarkers(event.svg);
3134 this.drawShape = drawShape;
3135 this.drawConnection = drawConnection;
3137 this.getShapePath = getShapePath;
3140 inherits(BpmnRenderer, DefaultRenderer);
3143 BpmnRenderer.$inject = ['eventBus', 'styles', 'pathMap'];
3145 module.exports = BpmnRenderer;
3148 "../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
3149 "diagram-js/lib/draw/Renderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js",
3150 "diagram-js/lib/util/Text": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Text.js",
3151 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
3152 "lodash/collection/every": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\every.js",
3153 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
3154 "lodash/collection/includes": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\includes.js",
3155 "lodash/collection/some": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\some.js",
3156 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
3157 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
3158 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
3160 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\PathMap.js": [function(require, module, exports) {
3163 var Snap = require('diagram-js/vendor/snapsvg');
3166 * Map containing SVG paths needed by BpmnRenderer.
3169 function PathMap() {
3172 * Contains a map of path elements
3174 * <h1>Path definition</h1>
3175 * A parameterized path is defined like this:
3178 * 'GATEWAY_PARALLEL': {
3179 * d: 'm {mx},{my} {e.x0},0 0,{e.x1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
3180 * '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
3183 * heightElements: [2.5, 7.5],
3184 * widthElements: [2.5, 7.5]
3189 * It's important to specify a correct <b>height and width</b> for the path
3190 * as the scaling is based on the ratio between the specified height and
3191 * width in this object and the height and width that is set as scale target
3192 * (Note x,y coordinates will be scaled with individual ratios).
3195 * The '<b>heightElements</b>' and '<b>widthElements</b>' array must
3196 * contain the values that will be scaled. The scaling is based on the
3197 * computed ratios. Coordinates on the y axis should be in the
3198 * <b>heightElement</b>'s array, they will be scaled using the computed
3199 * ratio coefficient. In the parameterized path the scaled values can be
3200 * accessed through the 'e' object in {} brackets.
3202 * <li>The values for the y axis can be accessed in the path string using
3203 * {e.y0}, {e.y1}, ....</li>
3204 * <li>The values for the x axis can be accessed in the path string using
3205 * {e.x0}, {e.x1}, ....</li>
3207 * The numbers x0, x1 respectively y0, y1, ... map to the corresponding
3213 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}',
3216 heightElements: [6, 14],
3217 widthElements: [10.5, 21]
3220 d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z',
3223 heightElements: [18],
3224 widthElements: [10, 20]
3226 'EVENT_ESCALATION': {
3227 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} ' +
3228 '{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',
3231 heightElements: [2.382, 4.764, 4.926, 6.589333, 7.146, 13.178667, 19.768],
3232 widthElements: [2.463, 2.808, 4.926, 5.616, 7.389, 8.424]
3234 'EVENT_CONDITIONAL': {
3235 d: 'M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z ' +
3236 'M {e.x2},{e.y3} l {e.x0},0 ' +
3237 'M {e.x2},{e.y4} l {e.x0},0 ' +
3238 'M {e.x2},{e.y5} l {e.x0},0 ' +
3239 'M {e.x2},{e.y6} l {e.x0},0 ' +
3240 'M {e.x2},{e.y7} l {e.x0},0 ' +
3241 'M {e.x2},{e.y8} l {e.x0},0 ',
3244 heightElements: [8.5, 14.5, 18, 11.5, 14.5, 17.5, 20.5, 23.5, 26.5],
3245 widthElements: [10.5, 14.5, 12.5]
3248 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',
3251 heightElements: [4.4375, 6.75, 7.8125],
3252 widthElements: [9.84375, 13.5]
3255 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',
3258 heightElements: [0.023, 8.737, 8.151, 16.564, 10.591, 8.714],
3259 widthElements: [0.085, 6.672, 6.97, 4.273, 5.337, 6.636]
3261 'EVENT_CANCEL_45': {
3262 d: 'm {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
3263 '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
3266 heightElements: [4.75, 8.5],
3267 widthElements: [4.75, 8.5]
3269 'EVENT_COMPENSATION': {
3270 d: 'm {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x0},0 {e.x0},-{e.y0} 0,{e.y1} z',
3273 heightElements: [5, 10],
3277 d: 'M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ',
3280 heightElements: [10, 2],
3281 widthElements: [3, 7]
3283 'EVENT_TIMER_LINE': {
3285 'm {e.x0},{e.y0} l -{e.x1},{e.y1} ',
3288 heightElements: [10, 3],
3289 widthElements: [0, 0]
3292 d: 'm {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z',
3295 heightElements: [6.28099, 12.56199],
3296 widthElements: [3.1405, 9.42149, 12.56198]
3298 'EVENT_PARALLEL_MULTIPLE': {
3299 d: 'm {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
3300 '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
3303 heightElements: [2.56228, 7.68683],
3304 widthElements: [2.56228, 7.68683]
3306 'GATEWAY_EXCLUSIVE': {
3307 d: 'm {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' +
3308 '{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' +
3309 '{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z',
3312 heightElements: [8.5, 6.5312, -6.5312, -8.5],
3313 widthElements: [6.5, -6.5, 3, -3, 5, -5]
3315 'GATEWAY_PARALLEL': {
3316 d: 'm {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
3317 '0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
3320 heightElements: [5, 12.5],
3321 widthElements: [5, 12.5]
3323 'GATEWAY_EVENT_BASED': {
3324 d: 'm {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z',
3327 heightElements: [-6, 6, 12, -12],
3328 widthElements: [9, -3, -12]
3330 'GATEWAY_COMPLEX': {
3331 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} ' +
3332 '{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} ' +
3333 '{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} ' +
3334 '-{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z',
3337 heightElements: [4.875, 3.4375, 2.125, 3],
3338 widthElements: [3.4375, 2.125, 4.875, 3]
3340 'DATA_OBJECT_PATH': {
3341 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',
3344 heightElements: [10, 50, 60],
3345 widthElements: [10, 40, 50, 60]
3347 'DATA_OBJECT_COLLECTION_PATH': {
3348 d: 'm {mx}, {my} ' +
3354 heightElements: [12],
3355 widthElements: [1, 6, 12, 15]
3358 d: 'm 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z',
3367 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
3369 'c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0' +
3370 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
3371 'm -{e.x2},{e.y0}' +
3372 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0' +
3373 'm -{e.x2},{e.y0}' +
3374 'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0',
3377 heightElements: [7, 10, 45],
3378 widthElements: [2, 58, 60]
3380 'TEXT_ANNOTATION': {
3381 d: 'm {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0',
3384 heightElements: [30],
3387 'MARKER_SUB_PROCESS': {
3388 d: 'm{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0',
3394 'MARKER_PARALLEL': {
3395 d: 'm{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10',
3401 'MARKER_SEQUENTIAL': {
3402 d: 'm{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0',
3408 'MARKER_COMPENSATION': {
3409 d: 'm {mx},{my} 8,-5 0,10 z m 9,0 8,-5 0,10 z',
3416 d: 'm {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 ' +
3417 '-6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 ' +
3418 '0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 ' +
3419 'l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902',
3426 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 ' +
3427 '3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 ' +
3428 '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 ' +
3429 '-3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 ' +
3430 '-2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z',
3437 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}',
3440 heightElements: [6, 14],
3441 widthElements: [10.5, 21]
3443 'TASK_TYPE_SCRIPT': {
3444 d: 'm {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 ' +
3445 'c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z ' +
3447 'm -4.5,3 l 4.5,0 ' +
3452 heightElements: [6, 14],
3453 widthElements: [10.5, 21]
3455 'TASK_TYPE_USER_1': {
3456 d: 'm {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 ' +
3457 '-4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 ' +
3458 '0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 ' +
3459 'h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 z' +
3460 'm -8,6 l 0,5.5 m 11,0 l 0,-5'
3462 'TASK_TYPE_USER_2': {
3463 d: 'm {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 ' +
3464 '-2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 '
3466 'TASK_TYPE_USER_3': {
3467 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 ' +
3468 '4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 ' +
3469 '-4.20799998,3.36699999 -4.20699998,4.34799999 z'
3471 'TASK_TYPE_MANUAL': {
3472 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 ' +
3473 '-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 ' +
3474 '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 ' +
3475 '-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 ' +
3476 '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 ' +
3477 '-10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 ' +
3478 '2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 ' +
3479 '-0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 ' +
3480 '-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 ' +
3481 '-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 ' +
3482 '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 ' +
3483 '-5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z'
3485 'TASK_TYPE_INSTANTIATING_SEND': {
3486 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'
3488 'TASK_TYPE_SERVICE': {
3489 d: 'm {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 ' +
3490 '0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 ' +
3491 '-1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 ' +
3492 'v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 ' +
3493 '-0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 ' +
3494 '-1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 ' +
3495 '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 ' +
3496 '-0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 ' +
3497 'c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 ' +
3498 'l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 ' +
3499 '0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 ' +
3500 'c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z ' +
3501 'm 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
3502 '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
3503 '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
3505 'TASK_TYPE_SERVICE_FILL': {
3506 d: 'm {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
3507 '0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
3508 '0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
3510 'TASK_TYPE_BUSINESS_RULE_HEADER': {
3511 d: 'm {mx},{my} 0,4 20,0 0,-4 z'
3513 'TASK_TYPE_BUSINESS_RULE_MAIN': {
3514 d: 'm {mx},{my} 0,12 20,0 0,-12 z' +
3518 'MESSAGE_FLOW_MARKER': {
3519 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'
3523 this.getRawPath = function getRawPath(pathId) {
3524 return this.pathMap[pathId].d;
3528 * Scales the path to the given height and width.
3531 * Use case is to scale the content of elements (event, gateways) based on
3532 * the element bounding box's size.
3534 * <h1>Why not transform</h1>
3536 * Scaling a path with transform() will also scale the stroke and IE does
3537 * not support the option 'non-scaling-stroke' to prevent this. Also there
3538 * are use cases where only some parts of a path should be scaled.
3542 * pathId The ID of the path.
3546 * Example param object scales the path to 60% size of the
3547 * container (data.width, data.height).
3551 * xScaleFactor : 0.6,
3552 * yScaleFactor : 0.6,
3553 * containerWidth : data.width,
3554 * containerHeight : data.height,
3563 * <li>targetpathwidth = xScaleFactor * containerWidth</li>
3564 * <li>targetpathheight = yScaleFactor * containerHeight</li>
3565 * <li>Position is used to set the starting coordinate of the
3566 * path. M is computed:
3568 * <li>position.x * containerWidth</li>
3569 * <li>position.y * containerHeight</li>
3571 * Center of the container
3580 * Upper left corner of the container
3594 this.getScaledPath = function getScaledPath(pathId, param) {
3595 var rawPath = this.pathMap[pathId];
3598 // compute the start point of the path
3601 if (!!param.abspos) {
3602 mx = param.abspos.x;
3603 my = param.abspos.y;
3605 mx = param.containerWidth * param.position.mx;
3606 my = param.containerHeight * param.position.my;
3609 var coordinates = {}; // map for the scaled coordinates
3610 if (param.position) {
3613 var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor;
3614 var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor;
3617 // Apply height ratio
3618 for (var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) {
3619 coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio;
3622 // Apply width ratio
3623 for (var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) {
3624 coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio;
3628 // Apply value to raw path
3629 var path = Snap.format(
3640 module.exports = PathMap;
3643 "diagram-js/vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js"
3645 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\index.js": [function(require, module, exports) {
3647 renderer: ['type', require('./BpmnRenderer')],
3648 pathMap: ['type', require('./PathMap')]
3651 "./BpmnRenderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\BpmnRenderer.js",
3652 "./PathMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\draw\\PathMap.js"
3654 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\context-pad\\ContextPadProvider.js": [function(require, module, exports) {
3658 var assign = require('lodash/object/assign'),
3659 forEach = require('lodash/collection/forEach');
3663 * A provider for BPMN 2.0 elements context pad
3665 function ContextPadProvider(contextPad, modeling, elementFactory,
3666 connect, create, bpmnReplace,
3669 contextPad.registerProvider(this);
3671 this._contextPad = contextPad;
3673 this._modeling = modeling;
3675 this._elementFactory = elementFactory;
3676 this._connect = connect;
3677 this._create = create;
3678 this._bpmnReplace = bpmnReplace;
3679 this._canvas = canvas;
3682 ContextPadProvider.$inject = [
3692 ContextPadProvider.prototype.getContextPadEntries = function(element) {
3694 var contextPad = this._contextPad,
3695 modeling = this._modeling,
3697 elementFactory = this._elementFactory,
3698 connect = this._connect,
3699 create = this._create,
3700 bpmnReplace = this._bpmnReplace,
3701 canvas = this._canvas;
3705 if (element.type === 'label') {
3709 var bpmnElement = element.businessObject;
3711 function startConnect(event, element, autoActivate) {
3712 connect.start(event, element, autoActivate);
3715 function removeElement(e) {
3717 if (element.waypoints) {
3718 modeling.removeConnection(element);
3720 modeling.removeShape(element);
3723 if (element.id == selected_decison_element) {
3725 invisiblepropertyExplorer();
3729 function getReplaceMenuPosition(element) {
3733 var diagramContainer = canvas.getContainer(),
3734 pad = contextPad.getPad(element).html;
3736 var diagramRect = diagramContainer.getBoundingClientRect(),
3737 padRect = pad.getBoundingClientRect();
3739 var top = padRect.top - diagramRect.top;
3740 var left = padRect.left - diagramRect.left;
3744 y: top + padRect.height + Y_OFFSET
3751 var change_color = function(par1, par2) {
3752 if (isImportSchema == true) {
3754 return par2 /*'define-schema'*/ ;
3756 return par1 /*'define-modify-schema'*/ ;
3760 function appendAction(type, className, options) {
3762 function appendListener(event, element) {
3764 var shape = elementFactory.createShape(assign({
3767 create.start(event, shape, element);
3770 var shortType = type.replace(/^bpmn\:/, '');
3774 className: className,
3775 title: 'Append ' + shortType,
3777 dragstart: appendListener,
3778 click: appendListener
3784 if (bpmnElement.$instanceOf('bpmn:Gateway') || bpmnElement.$instanceOf('bpmn:MultiBranchConnector')) {
3787 group: 'DefinePath',
3788 className: 'define-path',
3789 title: 'Define/View Path',
3791 click: function(event) {
3793 if (bpmnElement.name) {
3794 var bpmnElementID = bpmnElement.id;
3795 selected_decison_element = bpmnElementID;
3796 var bpmnElementName = bpmnElement.name;
3797 selected_element_name = bpmnElementName;
3798 var pathIdentifiers = [];
3800 if (bpmnElement.outgoing) {
3802 var check_outgoing_names = true;
3803 forEach(bpmnElement.outgoing, function(og) {
3805 if (og.name && og.name.length != 0) {
3807 pathIdentifiers.push(og.name);
3811 errorProperty(bpmnElement.name + " out going path name was not entered");
3812 check_outgoing_names = false;
3816 if (check_outgoing_names) {
3818 pathDetails(bpmnElementID, bpmnElementName, pathIdentifiers);
3824 errorProperty(bpmnElement.name + ' should atleast one output path was required');
3828 errorProperty('Enter Valid Decision Name');
3838 if (bpmnElement.$instanceOf('bpmn:InitiateProcess')) {}
3840 if (bpmnElement.$instanceOf('bpmn:StartEvent')) {}
3841 if (bpmnElement.$instanceOf('bpmn:Collector')) {
3845 label: 'Edit Properties',
3846 className: 'clds-edit-properties',
3847 title: 'Properties',
3849 click: function(event) {
3850 lastElementSelected = bpmnElement.id
3851 CollectorsWindow(bpmnElement);
3858 if (bpmnElement.$instanceOf('bpmn:StringMatch')) {
3862 label: 'Edit Properties',
3863 className: 'clds-edit-properties',
3864 title: 'Properties',
3866 click: function(event) {
3867 lastElementSelected = bpmnElement.id
3868 StringMatchWindow(bpmnElement);
3874 if (bpmnElement.$instanceOf('bpmn:Holmes')) {
3878 label: 'Edit Properties',
3879 className: 'clds-edit-properties',
3880 title: 'Properties',
3882 click: function(event) {
3883 lastElementSelected = bpmnElement.id
3884 HolmesWindow(bpmnElement);
3890 if (bpmnElement.$instanceOf('bpmn:TCA')) {
3894 label: 'Edit Properties',
3895 className: 'clds-edit-properties',
3896 title: 'Properties',
3898 click: function(event) {
3900 lastElementSelected = bpmnElement.id
3906 if (bpmnElement.$instanceOf('bpmn:GOC')) {
3910 label: 'Edit Properties',
3911 className: 'clds-edit-properties',
3912 title: 'Properties',
3914 click: function(event) {
3915 lastElementSelected = bpmnElement.id
3922 if (bpmnElement.$instanceOf('bpmn:Policy')) {
3926 label: 'Edit Properties',
3927 className: 'clds-edit-properties',
3928 title: 'Properties',
3930 click: function(event) {
3931 lastElementSelected = bpmnElement.id
3932 PolicyWindow(bpmnElement);
3939 if (bpmnElement.$instanceOf('bpmn:FlowNode') ||
3940 bpmnElement.$instanceOf('bpmn:InteractionNode')) {
3943 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'icon-text-annotation'),
3947 className: 'icon-connection',
3950 click: startConnect,
3951 dragstart: startConnect
3957 // Delete Element Entry
3961 className: 'icon-trash',
3964 click: removeElement,
3965 dragstart: removeElement
3976 function isEventType(eventBo, type, definition) {
3978 var isType = eventBo.$instanceOf(type);
3979 var isDefinition = false;
3981 var definitions = eventBo.eventDefinitions || [];
3982 forEach(definitions, function(def) {
3983 if (def.$type === definition) {
3984 isDefinition = true;
3988 return isType && isDefinition;
3992 module.exports = ContextPadProvider;
3995 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
3996 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
3998 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\context-pad\\index.js": [function(require, module, exports) {
4001 require('diagram-js-direct-editing'),
4002 require('diagram-js/lib/features/context-pad'),
4003 require('diagram-js/lib/features/selection'),
4004 require('diagram-js/lib/features/connect'),
4005 require('diagram-js/lib/features/create'),
4006 require('../replace')
4008 __init__: ['contextPadProvider'],
4009 contextPadProvider: ['type', require('./ContextPadProvider')]
4012 "../replace": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\index.js",
4013 "./ContextPadProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\context-pad\\ContextPadProvider.js",
4014 "diagram-js-direct-editing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\index.js",
4015 "diagram-js/lib/features/connect": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\index.js",
4016 "diagram-js/lib/features/context-pad": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\index.js",
4017 "diagram-js/lib/features/create": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\index.js",
4018 "diagram-js/lib/features/selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js"
4020 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\keyboard\\BpmnKeyBindings.js": [function(require, module, exports) {
4024 function BpmnKeyBindings(keyboard, spaceTool, lassoTool, directEditing, selection) {
4026 keyboard.addListener(function(key, modifiers) {
4028 if (keyboard.hasModifier(modifiers)) {
4032 // S -> activate space tool
4034 spaceTool.activateSelection();
4039 // L -> activate lasso tool
4041 lassoTool.activateSelection();
4046 var currentSelection = selection.get();
4048 // E -> activate direct editing
4050 if (currentSelection.length) {
4051 directEditing.activate(currentSelection[0]);
4059 BpmnKeyBindings.$inject = ['keyboard', 'spaceTool', 'lassoTool', 'directEditing', 'selection'];
4061 module.exports = BpmnKeyBindings;
4063 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\keyboard\\index.js": [function(require, module, exports) {
4066 require('diagram-js/lib/features/keyboard')
4068 __init__: ['bpmnKeyBindings'],
4069 bpmnKeyBindings: ['type', require('./BpmnKeyBindings')]
4072 "./BpmnKeyBindings": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\keyboard\\BpmnKeyBindings.js",
4073 "diagram-js/lib/features/keyboard": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\index.js"
4075 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelEditingProvider.js": [function(require, module, exports) {
4078 var UpdateLabelHandler = require('./cmd/UpdateLabelHandler');
4080 var LabelUtil = require('./LabelUtil');
4082 var is = require('../../util/ModelUtil').is,
4083 isExpanded = require('../../util/DiUtil').isExpanded;
4085 var daOriginalLabel = '';
4093 function LabelEditingProvider(eventBus, canvas, directEditing, commandStack, injector) {
4095 directEditing.registerProvider(this);
4096 commandStack.registerHandler('element.updateLabel', UpdateLabelHandler);
4098 // listen to dblclick on non-root elements
4099 eventBus.on('element.dblclick', function(event) {
4101 directEditing.activate(event.element);
4105 // complete on followup canvas operation
4106 eventBus.on(['element.mousedown', 'drag.activate', 'canvas.viewbox.changed'], function(event) {
4107 directEditing.complete();
4110 // cancel on command stack changes
4111 eventBus.on(['commandStack.changed'], function() {
4112 directEditing.cancel();
4116 // activate direct editing for activities and text annotations
4119 if ('ontouchstart' in document.documentElement) {
4120 // we deactivate automatic label editing on mobile devices
4121 // as it breaks the user interaction workflow
4123 // TODO(nre): we should temporarily focus the edited element here
4124 // and release the focused viewport after the direct edit operation is
4127 eventBus.on('create.end', 500, function(e) {
4129 var element = e.shape,
4130 canExecute = e.context.canExecute;
4136 if (is(element, 'bpmn:Task') || is(element, 'bpmn:TextAnnotation') ||
4137 (is(element, 'bpmn:SubProcess') && !isExpanded(element))) {
4139 directEditing.activate(element);
4144 this._canvas = canvas;
4145 this._commandStack = commandStack;
4148 LabelEditingProvider.$inject = ['eventBus', 'canvas', 'directEditing', 'commandStack', 'injector'];
4150 module.exports = LabelEditingProvider;
4153 LabelEditingProvider.prototype.activate = function(element) {
4155 var text = LabelUtil.getLabel(element);
4157 if (text === undefined) {
4161 daOriginalLabel = text;
4163 var bbox = this.getEditingBBox(element);
4165 // adjust for expanded pools AND lanes
4166 if ((is(element, 'bpmn:Participant') && isExpanded(element)) || is(element, 'bpmn:Lane')) {
4168 bbox.width = MIN_BOUNDS.width;
4169 bbox.height = MIN_BOUNDS.height;
4171 bbox.x = bbox.x + 10 - bbox.width / 2;
4172 bbox.y = bbox.mid.y - bbox.height / 2;
4175 // adjust for expanded sub processes
4176 if (is(element, 'bpmn:SubProcess') && isExpanded(element)) {
4178 bbox.height = MIN_BOUNDS.height;
4180 bbox.x = bbox.mid.x - bbox.width / 2;
4181 bbox.y = bbox.y + 10 - bbox.height / 2;
4191 LabelEditingProvider.prototype.getEditingBBox = function(element, maxBounds) {
4193 var target = element.label || element;
4195 var bbox = this._canvas.getAbsoluteBBox(target);
4198 x: bbox.x + bbox.width / 2,
4199 y: bbox.y + bbox.height / 2
4203 if (target.labelTarget) {
4204 bbox.width = Math.max(bbox.width, MIN_BOUNDS.width);
4205 bbox.height = Math.max(bbox.height, MIN_BOUNDS.height);
4207 bbox.x = mid.x - bbox.width / 2;
4216 LabelEditingProvider.prototype.update = function(element, newLabel) {
4217 //update conditional node
4218 if (is(element, 'bpmn:ExclusiveGateway') || is(element, 'bpmn:MultiBranchConnector')) {
4219 updateDecisionLabel(daOriginalLabel, newLabel);
4222 this._commandStack.execute('element.updateLabel', {
4228 "../../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
4229 "../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
4230 "./LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelUtil.js",
4231 "./cmd/UpdateLabelHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\cmd\\UpdateLabelHandler.js"
4233 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelUtil.js": [function(require, module, exports) {
4236 function getLabelAttr(semantic) {
4237 if (semantic.$instanceOf('bpmn:FlowElement') ||
4238 semantic.$instanceOf('bpmn:Participant') ||
4239 semantic.$instanceOf('bpmn:Lane') ||
4240 semantic.$instanceOf('bpmn:SequenceFlow') ||
4241 semantic.$instanceOf('bpmn:MessageFlow')) {
4245 if (semantic.$instanceOf('bpmn:TextAnnotation')) {
4250 module.exports.getLabel = function(element) {
4251 var semantic = element.businessObject,
4252 attr = getLabelAttr(semantic);
4255 return semantic[attr] || '';
4260 module.exports.setLabel = function(element, text) {
4261 var semantic = element.businessObject,
4262 attr = getLabelAttr(semantic);
4265 semantic[attr] = text;
4268 var label = element.label || element;
4271 label.hidden = false;
4276 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\cmd\\UpdateLabelHandler.js": [function(require, module, exports) {
4279 var LabelUtil = require('../LabelUtil');
4283 * A handler that updates the text of a BPMN element.
4288 function UpdateTextHandler(eventBus) {
4290 function setText(element, text) {
4291 var label = LabelUtil.setLabel(element, text);
4293 eventBus.fire('element.changed', {
4298 function execute(ctx) {
4299 ctx.oldLabel = LabelUtil.getLabel(ctx.element);
4300 return setText(ctx.element, ctx.newLabel);
4303 function revert(ctx) {
4304 return setText(ctx.element, ctx.oldLabel);
4308 function canExecute(ctx) {
4314 this.execute = execute;
4315 this.revert = revert;
4317 this.canExecute = canExecute;
4321 UpdateTextHandler.$inject = ['eventBus'];
4323 module.exports = UpdateTextHandler;
4325 "../LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelUtil.js"
4327 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\index.js": [function(require, module, exports) {
4330 require('diagram-js/lib/command'),
4331 require('diagram-js/lib/features/change-support'),
4332 require('diagram-js-direct-editing')
4334 __init__: ['labelEditingProvider'],
4335 labelEditingProvider: ['type', require('./LabelEditingProvider')]
4338 "./LabelEditingProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\LabelEditingProvider.js",
4339 "diagram-js-direct-editing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\index.js",
4340 "diagram-js/lib/command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
4341 "diagram-js/lib/features/change-support": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js"
4343 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnFactory.js": [function(require, module, exports) {
4346 var map = require('lodash/collection/map'),
4347 assign = require('lodash/object/assign'),
4348 pick = require('lodash/object/pick');
4351 function BpmnFactory(moddle) {
4352 this._model = moddle;
4355 BpmnFactory.$inject = ['moddle'];
4358 BpmnFactory.prototype._needsId = function(element) {
4359 return element.$instanceOf('bpmn:RootElement') ||
4360 element.$instanceOf('bpmn:FlowElement') ||
4361 element.$instanceOf('bpmn:MessageFlow') ||
4362 element.$instanceOf('bpmn:Artifact') ||
4363 element.$instanceOf('bpmn:Participant') ||
4364 element.$instanceOf('bpmn:Process') ||
4365 element.$instanceOf('bpmn:Collaboration') ||
4366 element.$instanceOf('bpmndi:BPMNShape') ||
4367 element.$instanceOf('bpmndi:BPMNEdge') ||
4368 element.$instanceOf('bpmndi:BPMNDiagram') ||
4369 element.$instanceOf('bpmndi:BPMNPlane');
4372 BpmnFactory.prototype._ensureId = function(element) {
4374 // generate semantic ids for elements
4375 // bpmn:SequenceFlow -> SequenceFlow_ID
4376 var prefix = (element.$type || '').replace(/^[^:]*:/g, '') + '_';
4378 if (!element.id && this._needsId(element)) {
4379 element.id = this._model.ids.nextPrefixed(prefix, element);
4384 BpmnFactory.prototype.create = function(type, attrs) {
4385 var element = this._model.create(type, attrs || {});
4387 this._ensureId(element);
4393 BpmnFactory.prototype.createDiLabel = function() {
4394 return this.create('bpmndi:BPMNLabel', {
4395 bounds: this.createDiBounds()
4400 BpmnFactory.prototype.createDiShape = function(semantic, bounds, attrs) {
4402 return this.create('bpmndi:BPMNShape', assign({
4403 bpmnElement: semantic,
4404 bounds: this.createDiBounds(bounds)
4409 BpmnFactory.prototype.createDiBounds = function(bounds) {
4410 return this.create('dc:Bounds', bounds);
4414 BpmnFactory.prototype.createDiWaypoints = function(waypoints) {
4415 return map(waypoints, function(pos) {
4416 return this.createDiWaypoint(pos);
4420 BpmnFactory.prototype.createDiWaypoint = function(point) {
4421 return this.create('dc:Point', pick(point, ['x', 'y']));
4425 BpmnFactory.prototype.createDiEdge = function(semantic, waypoints, attrs) {
4426 return this.create('bpmndi:BPMNEdge', assign({
4427 bpmnElement: semantic
4431 BpmnFactory.prototype.createDiPlane = function(semantic) {
4432 return this.create('bpmndi:BPMNPlane', {
4433 bpmnElement: semantic
4437 module.exports = BpmnFactory;
4440 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js",
4441 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
4442 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
4444 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnLayouter.js": [function(require, module, exports) {
4447 var inherits = require('inherits');
4449 var assign = require('lodash/object/assign');
4451 var BaseLayouter = require('diagram-js/lib/layout/BaseLayouter'),
4452 LayoutUtil = require('diagram-js/lib/layout/LayoutUtil'),
4453 ManhattanLayout = require('diagram-js/lib/layout/ManhattanLayout');
4455 var is = require('../../util/ModelUtil').is;
4458 function BpmnLayouter() {}
4460 inherits(BpmnLayouter, BaseLayouter);
4462 module.exports = BpmnLayouter;
4465 function getAttachment(waypoints, idx, shape) {
4466 var point = waypoints && waypoints[idx];
4468 return point ? (point.original || point) : LayoutUtil.getMidPoint(shape);
4472 BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
4473 var source = connection.source,
4474 target = connection.target,
4475 waypoints = connection.waypoints,
4479 var layoutManhattan,
4482 start = getAttachment(waypoints, 0, source);
4483 end = getAttachment(waypoints, waypoints && waypoints.length - 1, target);
4485 // manhattan layout sequence / message flows
4486 if (is(connection, 'bpmn:MessageFlow')) {
4488 preferStraight: true,
4489 preferVertical: true
4493 if (is(connection, 'bpmn:SequenceFlow')) {
4494 layoutManhattan = {};
4497 if (layoutManhattan) {
4499 layoutManhattan = assign(layoutManhattan, hints);
4502 ManhattanLayout.repairConnection(
4503 source, target, start, end,
4508 return updatedWaypoints || [start, end];
4511 "../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
4512 "diagram-js/lib/layout/BaseLayouter": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\BaseLayouter.js",
4513 "diagram-js/lib/layout/LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js",
4514 "diagram-js/lib/layout/ManhattanLayout": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\ManhattanLayout.js",
4515 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
4516 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
4518 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnUpdater.js": [function(require, module, exports) {
4521 var assign = require('lodash/object/assign'),
4522 forEach = require('lodash/collection/forEach'),
4523 inherits = require('inherits');
4525 var Collections = require('diagram-js/lib/util/Collections'),
4526 Model = require('diagram-js/lib/model');
4528 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
4532 * A handler responsible for updating the underlying BPMN 2.0 XML + DI once
4533 * changes on the diagram happen
4535 function BpmnUpdater(eventBus, bpmnFactory, connectionDocking) {
4537 CommandInterceptor.call(this, eventBus);
4539 this._bpmnFactory = bpmnFactory;
4545 // //// connection cropping /////////////////////////
4547 // crop connection ends during create/update
4548 function cropConnection(e) {
4549 var context = e.context,
4552 if (!context.cropped) {
4553 connection = context.connection;
4554 connection.waypoints = connectionDocking.getCroppedWaypoints(connection);
4555 context.cropped = true;
4560 'connection.layout',
4561 'connection.create',
4562 'connection.reconnectEnd',
4563 'connection.reconnectStart'
4566 this.reverted(['connection.layout'], function(e) {
4567 delete e.context.cropped;
4572 // //// BPMN + DI update /////////////////////////
4576 function updateParent(e) {
4577 self.updateParent(e.context.shape || e.context.connection);
4580 this.executed(['shape.move',
4583 'connection.create',
4587 this.reverted(['shape.move',
4590 'connection.create',
4596 * ## Updating Parent
4598 * When morphing a Process into a Collaboration or vice-versa, make sure
4599 * that both the *semantic* and *di* parent of each element is updated.
4602 function updateRoot(event) {
4603 var context = event.context,
4604 oldRoot = context.oldRoot,
4605 children = oldRoot.children;
4607 forEach(children, function(child) {
4608 self.updateParent(child);
4612 this.executed(['canvas.updateRoot'], updateRoot);
4613 this.reverted(['canvas.updateRoot'], updateRoot);
4617 function updateBounds(e) {
4618 self.updateBounds(e.context.shape);
4621 this.executed(['shape.move', 'shape.create', 'shape.resize'], updateBounds);
4622 this.reverted(['shape.move', 'shape.create', 'shape.resize'], updateBounds);
4625 // attach / detach connection
4626 function updateConnection(e) {
4627 self.updateConnection(e.context.connection);
4631 'connection.create',
4633 'connection.delete',
4634 'connection.reconnectEnd',
4635 'connection.reconnectStart'
4636 ], updateConnection);
4639 'connection.create',
4641 'connection.delete',
4642 'connection.reconnectEnd',
4643 'connection.reconnectStart'
4644 ], updateConnection);
4648 function updateConnectionWaypoints(e) {
4649 self.updateConnectionWaypoints(e.context.connection);
4653 'connection.layout',
4655 'connection.updateWaypoints',
4656 'connection.reconnectEnd',
4657 'connection.reconnectStart'
4658 ], updateConnectionWaypoints);
4661 'connection.layout',
4663 'connection.updateWaypoints',
4664 'connection.reconnectEnd',
4665 'connection.reconnectStart'
4666 ], updateConnectionWaypoints);
4669 inherits(BpmnUpdater, CommandInterceptor);
4671 module.exports = BpmnUpdater;
4673 BpmnUpdater.$inject = ['eventBus', 'bpmnFactory', 'connectionDocking'];
4676 // ///// implementation //////////////////////////////////
4679 BpmnUpdater.prototype.updateParent = function(element) {
4681 // do not update BPMN 2.0 label parent
4682 if (element instanceof Model.Label) {
4686 var parentShape = element.parent;
4688 var businessObject = element.businessObject,
4689 parentBusinessObject = parentShape && parentShape.businessObject,
4690 parentDi = parentBusinessObject && parentBusinessObject.di;
4692 this.updateSemanticParent(businessObject, parentBusinessObject);
4694 this.updateDiParent(businessObject.di, parentDi);
4698 BpmnUpdater.prototype.updateBounds = function(shape) {
4700 var di = shape.businessObject.di;
4702 var bounds = (shape instanceof Model.Label) ? this._getLabel(di).bounds : di.bounds;
4708 height: shape.height
4713 BpmnUpdater.prototype.updateDiParent = function(di, parentDi) {
4715 if (parentDi && !parentDi.$instanceOf('bpmndi:BPMNPlane')) {
4716 parentDi = parentDi.$parent;
4719 if (di.$parent === parentDi) {
4723 var planeElements = (parentDi || di.$parent).get('planeElement');
4726 planeElements.push(di);
4727 di.$parent = parentDi;
4729 Collections.remove(planeElements, di);
4734 function getDefinitions(element) {
4735 while (element && !element.$instanceOf('bpmn:Definitions')) {
4736 element = element.$parent;
4742 BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent) {
4746 if (businessObject.$parent === newParent) {
4750 if (businessObject.$instanceOf('bpmn:FlowElement')) {
4752 if (newParent && newParent.$instanceOf('bpmn:Participant')) {
4753 newParent = newParent.processRef;
4756 containment = 'flowElements';
4760 if (businessObject.$instanceOf('bpmn:Artifact')) {
4763 !newParent.$instanceOf('bpmn:Process') &&
4764 !newParent.$instanceOf('bpmn:SubProcess') &&
4765 !newParent.$instanceOf('bpmn:Collaboration')) {
4767 if (newParent.$instanceOf('bpmn:Participant')) {
4768 newParent = newParent.processRef;
4771 newParent = newParent.$parent;
4775 containment = 'artifacts';
4778 if (businessObject.$instanceOf('bpmn:MessageFlow')) {
4779 containment = 'messageFlows';
4783 if (businessObject.$instanceOf('bpmn:Participant')) {
4784 containment = 'participants';
4786 // make sure the participants process is properly attached / detached
4787 // from the XML document
4789 var process = businessObject.processRef,
4793 definitions = getDefinitions(businessObject.$parent || newParent);
4795 if (businessObject.$parent) {
4796 Collections.remove(definitions.get('rootElements'), process);
4797 process.$parent = null;
4801 Collections.add(definitions.get('rootElements'), process);
4802 process.$parent = definitions;
4808 throw new Error('no parent for ', businessObject, newParent);
4813 if (businessObject.$parent) {
4814 // remove from old parent
4815 children = businessObject.$parent.get(containment);
4816 Collections.remove(children, businessObject);
4820 businessObject.$parent = null;
4822 // add to new parent
4823 children = newParent.get(containment);
4824 children.push(businessObject);
4825 businessObject.$parent = newParent;
4830 BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {
4832 connection.businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
4836 BpmnUpdater.prototype.updateConnection = function(connection) {
4838 var businessObject = connection.businessObject,
4839 newSource = connection.source && connection.source.businessObject,
4840 newTarget = connection.target && connection.target.businessObject;
4842 var inverseSet = businessObject.$instanceOf('bpmn:SequenceFlow');
4844 if (businessObject.sourceRef !== newSource) {
4846 Collections.remove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
4849 newSource.get('outgoing').push(businessObject);
4853 businessObject.sourceRef = newSource;
4855 if (businessObject.targetRef !== newTarget) {
4857 Collections.remove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
4860 newTarget.get('incoming').push(businessObject);
4864 businessObject.targetRef = newTarget;
4867 businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
4871 // ///// helpers /////////////////////////////////////////
4873 BpmnUpdater.prototype._getLabel = function(di) {
4875 di.label = this._bpmnFactory.createDiLabel();
4881 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
4882 "diagram-js/lib/model": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js",
4883 "diagram-js/lib/util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
4884 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
4885 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
4886 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
4888 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ElementFactory.js": [function(require, module, exports) {
4891 var assign = require('lodash/object/assign'),
4892 inherits = require('inherits');
4894 var BaseElementFactory = require('diagram-js/lib/core/ElementFactory'),
4895 LabelUtil = require('../../util/LabelUtil');
4899 * A bpmn-aware factory for diagram-js shapes
4901 function ElementFactory(bpmnFactory, moddle) {
4902 BaseElementFactory.call(this);
4904 this._bpmnFactory = bpmnFactory;
4905 this._moddle = moddle;
4908 inherits(ElementFactory, BaseElementFactory);
4911 ElementFactory.$inject = ['bpmnFactory', 'moddle'];
4913 module.exports = ElementFactory;
4915 ElementFactory.prototype.baseCreate = BaseElementFactory.prototype.create;
4917 ElementFactory.prototype.create = function(elementType, attrs) {
4919 // no special magic for labels,
4920 // we assume their businessObjects have already been created
4921 // and wired via attrs
4922 if (elementType === 'label') {
4923 return this.baseCreate(elementType, assign({
4925 }, LabelUtil.DEFAULT_LABEL_SIZE, attrs));
4928 attrs = attrs || {};
4930 var businessObject = attrs.businessObject,
4933 if (!businessObject) {
4935 throw new Error('no shape type specified');
4938 businessObject = this._bpmnFactory.create(attrs.type);
4941 if (!businessObject.di) {
4942 if (elementType === 'root') {
4943 businessObject.di = this._bpmnFactory.createDiPlane(businessObject, [], {
4944 id: businessObject.id + '_di'
4947 if (elementType === 'connection') {
4948 businessObject.di = this._bpmnFactory.createDiEdge(businessObject, [], {
4949 id: businessObject.id + '_di'
4952 businessObject.di = this._bpmnFactory.createDiShape(businessObject, {}, {
4953 id: businessObject.id + '_di'
4958 if (!!attrs.isExpanded) {
4959 businessObject.di.isExpanded = attrs.isExpanded;
4963 * if (businessObject.$instanceOf('bpmn:ExclusiveGateway')) {
4964 * businessObject.di.isMarkerVisible = true; }
4967 if (attrs._eventDefinitionType) {
4968 var eventDefinitions = businessObject.get('eventDefinitions') || [],
4969 newEventDefinition = this._moddle.create(attrs._eventDefinitionType);
4971 eventDefinitions.push(newEventDefinition);
4972 businessObject.eventDefinitions = eventDefinitions;
4975 size = this._getDefaultSize(businessObject);
4978 businessObject: businessObject,
4979 id: businessObject.id
4982 return this.baseCreate(elementType, attrs);
4986 ElementFactory.prototype._getDefaultSize = function(semantic) {
4988 if (semantic.$instanceOf('bpmn:SubProcess')) {
4989 var isExpanded = semantic.di.isExpanded === true;
5004 if (semantic.$instanceOf('bpmn:InitiateProcess')) {
5010 if (semantic.$instanceOf('bpmn:Collector')) {
5017 if (semantic.$instanceOf('bpmn:StringMatch')) {
5023 if (semantic.$instanceOf('bpmn:VesCollector')) {
5029 if (semantic.$instanceOf('bpmn:Holmes')) {
5035 if (semantic.$instanceOf('bpmn:TCA')) {
5042 if (semantic.$instanceOf('bpmn:Policy')) {
5049 if (semantic.$instanceOf('bpmn:GOC')) {
5055 if (semantic.$instanceOf('bpmn:ParentReturn')) {
5061 if (semantic.$instanceOf('bpmn:SubProcessCall')) {
5068 if (semantic.$instanceOf('bpmn:ExclusiveGateway')) {
5075 if (semantic.$instanceOf('bpmn:Task')) {
5082 if (semantic.$instanceOf('bpmn:Gateway')) {
5089 if (semantic.$instanceOf('bpmn:Event')) {
5096 if (semantic.$instanceOf('bpmn:Participant')) {
5110 ElementFactory.prototype.createParticipantShape = function(collapsed) {
5111 // alert("entering createParticipantShape");
5112 var participantShape = this.createShape({
5113 type: 'bpmn:Participant'
5117 participantShape.businessObject.processRef = this._bpmnFactory.create('bpmn:Process');
5120 return participantShape;
5123 "../../util/LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js",
5124 "diagram-js/lib/core/ElementFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementFactory.js",
5125 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
5126 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
5128 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\LabelSupport.js": [function(require, module, exports) {
5131 var assign = require('lodash/object/assign'),
5132 forEach = require('lodash/collection/forEach');
5134 var LabelUtil = require('../../util/LabelUtil');
5136 var hasExternalLabel = LabelUtil.hasExternalLabel,
5137 getExternalLabelMid = LabelUtil.getExternalLabelMid;
5140 function LabelSupport(eventBus, modeling, bpmnFactory) {
5142 // create external labels on shape creation
5145 'commandStack.shape.create.postExecute',
5146 'commandStack.connection.create.postExecute'
5148 var context = e.context;
5150 var element = context.shape || context.connection,
5151 businessObject = element.businessObject;
5155 if (hasExternalLabel(businessObject)) {
5156 position = getExternalLabelMid(element);
5157 modeling.createLabel(element, position, {
5158 id: businessObject.id + '_label',
5159 businessObject: businessObject
5165 //move label when connection/shape is being moved
5166 //if shape is being moved, get connection as element
5168 eventBus.on(['commandStack.connection.create.postExecute',
5169 'commandStack.connection.move.postExecute',
5170 //'commandStack.connection.delete.postExecute',
5171 'commandStack.connection.reconnectEnd.postExecute',
5172 'commandStack.connection.reconnectStart.postExecute',
5173 'commandStack.connection.updateWaypoints.postExecute',
5177 var context = e.context;
5180 if (context.allDraggedElements != null) {
5181 if (context.allDraggedElements.length > 0) {
5182 element = context.allDraggedElements[1];
5185 element = context.connection;
5188 if (element == null) {
5192 var businessObject = element.businessObject;
5194 if (businessObject.$type != 'bpmn:SequenceFlow') {
5200 if (hasExternalLabel(businessObject)) {
5201 position = getExternalLabelMid(element);
5202 modeling.removeShape(element.label);
5203 modeling.createLabel(element, position, {
5204 id: businessObject.id + '_label',
5205 businessObject: businessObject
5212 // indicate label is dragged during move
5214 // we need to add labels to the list of selected
5215 // shapes before the visuals get drawn.
5217 // Hence this awesome magic number.
5219 eventBus.on('shape.move.start', function(e) {
5221 var context = e.context,
5222 shapes = context.shapes;
5226 forEach(shapes, function(element) {
5227 var label = element.label;
5229 if (label && !label.hidden && context.shapes.indexOf(label) === -1) {
5234 forEach(labels, function(label) {
5240 // move labels with shapes
5243 'commandStack.shapes.move.postExecute'
5246 var context = e.context,
5247 closure = context.closure,
5248 enclosedElements = closure.enclosedElements;
5250 // ensure we move all labels with their respective elements
5251 // if they have not been moved already
5253 forEach(enclosedElements, function(e) {
5254 if (e.label && !enclosedElements[e.label.id]) {
5255 modeling.moveShape(e.label, context.delta, e.parent);
5261 // update di information on label movement and creation
5264 'commandStack.label.create.executed',
5265 'commandStack.shape.moved.executed'
5268 var element = e.context.shape,
5269 businessObject = element.businessObject,
5270 di = businessObject.di;
5272 // we want to trigger on real labels only
5273 if (!element.labelTarget) {
5278 di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
5279 bounds: bpmnFactory.create('dc:Bounds')
5283 assign(di.label.bounds, {
5286 width: element.width,
5287 height: element.height
5292 LabelSupport.$inject = ['eventBus', 'modeling', 'bpmnFactory'];
5294 module.exports = LabelSupport;
5297 "../../util/LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js",
5298 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
5299 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
5301 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\Modeling.js": [function(require, module, exports) {
5304 var inherits = require('inherits');
5306 var BaseModeling = require('diagram-js/lib/features/modeling/Modeling');
5308 var UpdatePropertiesHandler = require('./cmd/UpdatePropertiesHandler'),
5309 UpdateCanvasRootHandler = require('./cmd/UpdateCanvasRootHandler');
5313 * BPMN 2.0 modeling features activator
5317 * @param {ElementFactory}
5319 * @param {CommandStack}
5321 * @param {BpmnRules}
5324 function Modeling(eventBus, elementFactory, commandStack, bpmnRules) {
5325 BaseModeling.call(this, eventBus, elementFactory, commandStack);
5327 this._bpmnRules = bpmnRules;
5330 inherits(Modeling, BaseModeling);
5332 Modeling.$inject = ['eventBus', 'elementFactory', 'commandStack', 'bpmnRules'];
5334 module.exports = Modeling;
5337 Modeling.prototype.getHandlers = function() {
5338 var handlers = BaseModeling.prototype.getHandlers.call(this);
5340 handlers['element.updateProperties'] = UpdatePropertiesHandler;
5341 handlers['canvas.updateRoot'] = UpdateCanvasRootHandler;
5347 Modeling.prototype.updateLabel = function(element, newLabel) {
5348 this._commandStack.execute('element.updateLabel', {
5355 var getSharedParent = require('./ModelingUtil').getSharedParent;
5357 Modeling.prototype.connect = function(source, target, attrs) {
5359 var bpmnRules = this._bpmnRules;
5362 if (bpmnRules.canConnectMessageFlow(source, target)) {
5364 type: 'bpmn:MessageFlow'
5367 if (bpmnRules.canConnectSequenceFlow(source, target)) {
5369 type: 'bpmn:SequenceFlow'
5373 type: 'bpmn:Association'
5378 return this.createConnection(source, target, attrs, getSharedParent(source, target));
5382 Modeling.prototype.updateProperties = function(element, properties) {
5383 this._commandStack.execute('element.updateProperties', {
5385 properties: properties
5391 * Transform the current diagram into a collaboration.
5393 * @return {djs.model.Root} the new root element
5395 Modeling.prototype.makeCollaboration = function() {
5397 var collaborationElement = this._create('root', {
5398 type: 'bpmn:Collaboration'
5402 newRoot: collaborationElement
5405 this._commandStack.execute('canvas.updateRoot', context);
5407 return collaborationElement;
5411 * Transform the current diagram into a process.
5413 * @return {djs.model.Root} the new root element
5415 Modeling.prototype.makeProcess = function() {
5417 var processElement = this._create('root', {
5418 type: 'bpmn:Process'
5422 newRoot: processElement
5425 this._commandStack.execute('canvas.updateRoot', context);
5428 "./ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
5429 "./cmd/UpdateCanvasRootHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdateCanvasRootHandler.js",
5430 "./cmd/UpdatePropertiesHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdatePropertiesHandler.js",
5431 "diagram-js/lib/features/modeling/Modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\Modeling.js",
5432 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5434 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js": [function(require, module, exports) {
5437 var find = require('lodash/collection/find');
5440 function getParents(element) {
5445 element = element.parent;
5448 parents.push(element);
5455 module.exports.getParents = getParents;
5458 function getSharedParent(a, b) {
5460 var parentsA = getParents(a),
5461 parentsB = getParents(b);
5463 return find(parentsA, function(parent) {
5464 return parentsB.indexOf(parent) !== -1;
5468 module.exports.getSharedParent = getSharedParent;
5470 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js"
5472 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\AppendBehavior.js": [function(require, module, exports) {
5475 var inherits = require('inherits');
5477 var is = require('../../../util/ModelUtil').is;
5479 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5482 function AppendBehavior(eventBus, elementFactory, bpmnRules) {
5484 CommandInterceptor.call(this, eventBus);
5486 // assign correct shape position unless already set
5488 this.preExecute('shape.append', function(context) {
5490 var source = context.source,
5491 shape = context.shape;
5493 if (!context.position) {
5495 if (is(shape, 'bpmn:TextAnnotation')) {
5496 context.position = {
5497 x: source.x + source.width / 2 + 75,
5498 y: source.y - (50) - shape.height / 2
5501 context.position = {
5502 x: source.x + source.width + 80 + shape.width / 2,
5503 y: source.y + source.height / 2
5511 AppendBehavior.$inject = ['eventBus', 'elementFactory', 'bpmnRules'];
5513 inherits(AppendBehavior, CommandInterceptor);
5515 module.exports = AppendBehavior;
5517 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5518 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5519 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5521 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\CreateBehavior.js": [function(require, module, exports) {
5524 var inherits = require('inherits');
5526 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5528 var is = require('../../../util/ModelUtil').is;
5531 * BPMN specific create behavior
5533 function CreateBehavior(eventBus, modeling) {
5535 CommandInterceptor.call(this, eventBus);
5539 * morph process into collaboration before adding participant onto
5543 this.preExecute('shape.create', function(context) {
5545 var parent = context.parent,
5546 shape = context.shape,
5547 position = context.position;
5549 if (is(parent, 'bpmn:Process') && is(shape, 'bpmn:Participant')) {
5551 // this is going to detach the process root
5552 // and set the returned collaboration element
5553 // as the new root element
5554 var collaborationElement = modeling.makeCollaboration();
5556 // monkey patch the create context
5557 // so that the participant is being dropped
5558 // onto the new collaboration root instead
5559 context.position = position;
5560 context.parent = collaborationElement;
5562 context.processRoot = parent;
5566 this.execute('shape.create', function(context) {
5568 var processRoot = context.processRoot,
5569 shape = context.shape;
5572 context.oldProcessRef = shape.businessObject.processRef;
5574 // assign the participant processRef
5575 shape.businessObject.processRef = processRoot.businessObject;
5579 this.revert('shape.create', function(context) {
5580 var processRoot = context.processRoot,
5581 shape = context.shape;
5584 // assign the participant processRef
5585 shape.businessObject.processRef = context.oldProcessRef;
5589 this.postExecute('shape.create', function(context) {
5591 var processRoot = context.processRoot,
5592 shape = context.shape;
5595 // process root is already detached at this point
5596 var processChildren = processRoot.children.slice();
5597 modeling.moveShapes(processChildren, {
5602 //console.log(context.shape.id);
5603 //newElementProcessor(context.shape.id);
5604 //console.log(context)
5609 CreateBehavior.$inject = ['eventBus', 'modeling'];
5611 inherits(CreateBehavior, CommandInterceptor);
5613 module.exports = CreateBehavior;
5615 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5616 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5617 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5619 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\DropBehavior.js": [function(require, module, exports) {
5622 var forEach = require('lodash/collection/forEach'),
5623 inherits = require('inherits');
5625 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5627 var is = require('../../../util/ModelUtil').is,
5628 getSharedParent = require('../ModelingUtil').getSharedParent;
5631 function DropBehavior(eventBus, modeling, bpmnRules) {
5633 CommandInterceptor.call(this, eventBus);
5635 // remove sequence flows that should not be allowed
5636 // after a move operation
5638 this.postExecute('shapes.move', function(context) {
5640 var closure = context.closure,
5641 allConnections = closure.allConnections;
5643 forEach(allConnections, function(c) {
5645 var source = c.source,
5648 var replacementType,
5652 * Check if incoming or outgoing connections can stay or could be
5653 * substituted with an appropriate replacement.
5655 * This holds true for SequenceFlow <> MessageFlow.
5658 if (is(c, 'bpmn:SequenceFlow')) {
5659 if (!bpmnRules.canConnectSequenceFlow(source, target)) {
5663 if (bpmnRules.canConnectMessageFlow(source, target)) {
5664 replacementType = 'bpmn:MessageFlow';
5668 // transform message flows into sequence flows, if possible
5670 if (is(c, 'bpmn:MessageFlow')) {
5672 if (!bpmnRules.canConnectMessageFlow(source, target)) {
5676 if (bpmnRules.canConnectSequenceFlow(source, target)) {
5677 replacementType = 'bpmn:SequenceFlow';
5681 if (is(c, 'bpmn:Association') && !bpmnRules.canConnectAssociation(source, target)) {
5686 // remove invalid connection
5688 modeling.removeConnection(c);
5691 // replace SequenceFlow <> MessageFlow
5693 if (replacementType) {
5694 modeling.createConnection(source, target, {
5695 type: replacementType,
5696 waypoints: c.waypoints.slice()
5697 }, getSharedParent(source, target));
5703 inherits(DropBehavior, CommandInterceptor);
5705 DropBehavior.$inject = ['eventBus', 'modeling', 'bpmnRules'];
5707 module.exports = DropBehavior;
5709 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5710 "../ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
5711 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5712 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
5713 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
5715 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\ModelingFeedback.js": [function(require, module, exports) {
5718 var is = require('../../../util/ModelUtil').is;
5721 function ModelingFeedback(eventBus, tooltips) {
5723 function showError(position, message) {
5731 html: '<div>' + message + '</div>'
5735 eventBus.on(['shape.move.rejected', 'create.rejected'], function(event) {
5737 var context = event.context,
5738 shape = context.shape,
5739 target = context.target;
5741 if (is(target, 'bpmn:Collaboration') && is(shape, 'bpmn:FlowNode')) {
5742 showError(event, 'flow elements must be children of pools/participants');
5749 ModelingFeedback.$inject = ['eventBus', 'tooltips'];
5751 module.exports = ModelingFeedback;
5753 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js"
5755 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\RemoveBehavior.js": [function(require, module, exports) {
5758 var inherits = require('inherits');
5760 var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
5762 var is = require('../../../util/ModelUtil').is;
5766 * BPMN specific remove behavior
5768 function RemoveBehavior(eventBus, modeling) {
5770 CommandInterceptor.call(this, eventBus);
5774 * morph collaboration diagram into process diagram after the last
5775 * participant has been removed
5778 this.preExecute('shape.delete', function(context) {
5779 //delete elementMap[context.shape.id];
5780 //console.log(context.shape.id);
5781 var shape = context.shape,
5782 parent = shape.parent;
5784 // activate the behavior if the shape to be removed
5786 if (is(shape, 'bpmn:Participant')) {
5787 context.collaborationRoot = parent;
5791 this.postExecute('shape.delete', function(context) {
5793 var collaborationRoot = context.collaborationRoot;
5795 if (collaborationRoot && !collaborationRoot.businessObject.participants.length) {
5796 // replace empty collaboration with process diagram
5797 modeling.makeProcess();
5803 RemoveBehavior.$inject = ['eventBus', 'modeling'];
5805 inherits(RemoveBehavior, CommandInterceptor);
5807 module.exports = RemoveBehavior;
5809 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
5810 "diagram-js/lib/command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
5811 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"
5813 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\index.js": [function(require, module, exports) {
5822 appendBehavior: ['type', require('./AppendBehavior')],
5823 dropBehavior: ['type', require('./DropBehavior')],
5824 createBehavior: ['type', require('./CreateBehavior')],
5825 removeBehavior: ['type', require('./RemoveBehavior')],
5826 modelingFeedback: ['type', require('./ModelingFeedback')]
5829 "./AppendBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\AppendBehavior.js",
5830 "./CreateBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\CreateBehavior.js",
5831 "./DropBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\DropBehavior.js",
5832 "./ModelingFeedback": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\ModelingFeedback.js",
5833 "./RemoveBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\RemoveBehavior.js"
5835 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdateCanvasRootHandler.js": [function(require, module, exports) {
5838 var Collections = require('diagram-js/lib/util/Collections');
5841 function UpdateCanvasRootHandler(canvas, modeling) {
5842 this._canvas = canvas;
5843 this._modeling = modeling;
5846 UpdateCanvasRootHandler.$inject = ['canvas', 'modeling'];
5848 module.exports = UpdateCanvasRootHandler;
5851 UpdateCanvasRootHandler.prototype.execute = function(context) {
5853 var canvas = this._canvas;
5855 var newRoot = context.newRoot,
5856 newRootBusinessObject = newRoot.businessObject,
5857 oldRoot = canvas.getRootElement(),
5858 oldRootBusinessObject = oldRoot.businessObject,
5859 bpmnDefinitions = oldRootBusinessObject.$parent,
5860 diPlane = oldRootBusinessObject.di;
5862 // (1) replace process old <> new root
5863 canvas.setRootElement(newRoot, true);
5865 // (2) update root elements
5866 Collections.add(bpmnDefinitions.rootElements, newRootBusinessObject);
5867 newRootBusinessObject.$parent = bpmnDefinitions;
5869 Collections.remove(bpmnDefinitions.rootElements, oldRootBusinessObject);
5870 oldRootBusinessObject.$parent = null;
5873 oldRootBusinessObject.di = null;
5875 diPlane.bpmnElement = newRootBusinessObject;
5876 newRootBusinessObject.di = diPlane;
5878 context.oldRoot = oldRoot;
5882 UpdateCanvasRootHandler.prototype.revert = function(context) {
5884 var canvas = this._canvas;
5886 var newRoot = context.newRoot,
5887 newRootBusinessObject = newRoot.businessObject,
5888 oldRoot = context.oldRoot,
5889 oldRootBusinessObject = oldRoot.businessObject,
5890 bpmnDefinitions = newRootBusinessObject.$parent,
5891 diPlane = newRootBusinessObject.di;
5893 // (1) replace process old <> new root
5894 canvas.setRootElement(oldRoot, true);
5896 // (2) update root elements
5897 Collections.remove(bpmnDefinitions.rootElements, newRootBusinessObject);
5898 newRootBusinessObject.$parent = null;
5900 Collections.add(bpmnDefinitions.rootElements, oldRootBusinessObject);
5901 oldRootBusinessObject.$parent = bpmnDefinitions;
5904 newRootBusinessObject.di = null;
5906 diPlane.bpmnElement = oldRootBusinessObject;
5907 oldRootBusinessObject.di = diPlane;
5910 "diagram-js/lib/util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js"
5912 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\cmd\\UpdatePropertiesHandler.js": [function(require, module, exports) {
5915 var assign = require('lodash/object/assign'),
5916 pick = require('lodash/object/pick'),
5917 keys = require('lodash/object/keys');
5919 var DEFAULT_FLOW = 'default',
5925 * A handler that implements a BPMN 2.0 property update.
5927 * This should be used to set simple properties on elements with an underlying
5928 * BPMN business object.
5930 * Use respective diagram-js provided handlers if you would like to perform
5931 * automated modeling.
5933 function UpdatePropertiesHandler(elementRegistry) {
5934 this._elementRegistry = elementRegistry;
5937 UpdatePropertiesHandler.$inject = ['elementRegistry'];
5939 module.exports = UpdatePropertiesHandler;
5942 // //// api /////////////////////////////////////////////
5945 * Updates a BPMN element with a list of new properties
5949 * @param {djs.model.Base}
5950 * context.element the element to update
5952 * context.properties a list of properties to set on the element's
5953 * businessObject (the BPMN model element)
5955 * @return {Array<djs.mode.Base>} the updated element
5957 UpdatePropertiesHandler.prototype.execute = function(context) {
5959 var element = context.element,
5960 changed = [element];
5963 throw new Error('element required');
5966 var elementRegistry = this._elementRegistry;
5968 var businessObject = element.businessObject,
5969 properties = context.properties,
5970 oldProperties = context.oldProperties || pick(businessObject, keys(properties));
5972 if (ID in properties) {
5973 elementRegistry.updateId(element, properties[ID]);
5976 // correctly indicate visual changes on default flow updates
5977 if (DEFAULT_FLOW in properties) {
5979 if (properties[DEFAULT_FLOW]) {
5980 changed.push(elementRegistry.get(properties[DEFAULT_FLOW].id));
5983 if (businessObject[DEFAULT_FLOW]) {
5984 changed.push(elementRegistry.get(businessObject[DEFAULT_FLOW].id));
5988 if (NAME in properties && element.label) {
5989 changed.push(element.label);
5992 // update properties
5993 assign(businessObject, properties);
5997 context.oldProperties = oldProperties;
5998 context.changed = changed;
6000 // indicate changed on objects affected by the update
6005 * Reverts the update on a BPMN elements properties.
6010 * @return {djs.mode.Base} the updated element
6012 UpdatePropertiesHandler.prototype.revert = function(context) {
6014 var element = context.element,
6015 oldProperties = context.oldProperties,
6016 businessObject = element.businessObject,
6017 elementRegistry = this._elementRegistry;
6019 assign(businessObject, context.oldProperties);
6021 if (ID in oldProperties) {
6022 elementRegistry.updateId(element, oldProperties[ID]);
6025 return context.changed;
6028 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
6029 "lodash/object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
6030 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
6032 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\index.js": [function(require, module, exports) {
6034 __init__: ['modeling', 'bpmnUpdater', 'labelSupport'],
6036 require('../label-editing'),
6038 require('./behavior'),
6039 require('diagram-js/lib/command'),
6040 require('diagram-js/lib/features/tooltips'),
6041 require('diagram-js/lib/features/change-support')
6043 bpmnFactory: ['type', require('./BpmnFactory')],
6044 bpmnUpdater: ['type', require('./BpmnUpdater')],
6045 elementFactory: ['type', require('./ElementFactory')],
6046 modeling: ['type', require('./Modeling')],
6047 labelSupport: ['type', require('./LabelSupport')],
6048 layouter: ['type', require('./BpmnLayouter')],
6049 connectionDocking: ['type', require('diagram-js/lib/layout/CroppingConnectionDocking')]
6053 "../label-editing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\label-editing\\index.js",
6054 "./BpmnFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnFactory.js",
6055 "./BpmnLayouter": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnLayouter.js",
6056 "./BpmnUpdater": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\BpmnUpdater.js",
6057 "./ElementFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ElementFactory.js",
6058 "./LabelSupport": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\LabelSupport.js",
6059 "./Modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\Modeling.js",
6060 "./behavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\behavior\\index.js",
6061 "./rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\index.js",
6062 "diagram-js/lib/command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
6063 "diagram-js/lib/features/change-support": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js",
6064 "diagram-js/lib/features/tooltips": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\index.js",
6065 "diagram-js/lib/layout/CroppingConnectionDocking": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\CroppingConnectionDocking.js"
6067 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\BpmnRules.js": [function(require, module, exports) {
6070 var groupBy = require('lodash/collection/groupBy'),
6071 size = require('lodash/collection/size'),
6072 find = require('lodash/collection/find'),
6073 inherits = require('inherits');
6075 var getParents = require('../ModelingUtil').getParents,
6076 is = require('../../../util/ModelUtil').is,
6077 getBusinessObject = require('../../../util/ModelUtil').getBusinessObject,
6078 isExpanded = require('../../../util/DiUtil').isExpanded;
6081 var RuleProvider = require('diagram-js/lib/features/rules/RuleProvider');
6084 * BPMN specific modeling rule
6086 function BpmnRules(eventBus) {
6087 RuleProvider.call(this, eventBus);
6090 inherits(BpmnRules, RuleProvider);
6092 BpmnRules.$inject = ['eventBus'];
6094 module.exports = BpmnRules;
6096 BpmnRules.prototype.init = function() {
6098 this.addRule('connection.create', function(context) {
6099 var source = context.source,
6100 target = context.target;
6102 return canConnect(source, target);
6105 this.addRule('connection.reconnectStart', function(context) {
6107 var connection = context.connection,
6108 source = context.hover || context.source,
6109 target = connection.target;
6111 return canConnect(source, target, connection);
6114 this.addRule('connection.reconnectEnd', function(context) {
6116 var connection = context.connection,
6117 source = connection.source,
6118 target = context.hover || context.target;
6120 return canConnect(source, target, connection);
6123 this.addRule('connection.updateWaypoints', function(context) {
6124 // OK! but visually ignore
6128 this.addRule('shape.resize', function(context) {
6130 var shape = context.shape,
6131 newBounds = context.newBounds;
6133 return canResize(shape, newBounds);
6136 this.addRule('shapes.move', function(context) {
6138 var target = context.newParent,
6139 shapes = context.shapes;
6141 return canMove(shapes, target);
6144 this.addRule(['shape.create', 'shape.append'], function(context) {
6145 var target = context.parent,
6146 shape = context.shape,
6147 source = context.source;
6149 return canCreate(shape, target, source);
6154 BpmnRules.prototype.canConnectMessageFlow = canConnectMessageFlow;
6156 BpmnRules.prototype.canConnectSequenceFlow = canConnectSequenceFlow;
6158 BpmnRules.prototype.canConnectAssociation = canConnectAssociation;
6160 BpmnRules.prototype.canMove = canMove;
6162 BpmnRules.prototype.canDrop = canDrop;
6164 BpmnRules.prototype.canCreate = canCreate;
6166 BpmnRules.prototype.canConnect = canConnect;
6168 BpmnRules.prototype.canResize = canResize;
6171 * Utility functions for rule checking
6174 function nonExistantOrLabel(element) {
6175 return !element || isLabel(element);
6178 function isSame(a, b) {
6182 function getOrganizationalParent(element) {
6184 var bo = getBusinessObject(element);
6186 while (bo && !is(bo, 'bpmn:Process')) {
6187 if (is(bo, 'bpmn:Participant')) {
6188 return bo.processRef || bo;
6197 function isSameOrganization(a, b) {
6198 var parentA = getOrganizationalParent(a),
6199 parentB = getOrganizationalParent(b);
6201 return parentA === parentB;
6204 function isMessageFlowSource(element) {
6205 return is(element, 'bpmn:InteractionNode') && (!is(element, 'bpmn:Event') || (
6206 is(element, 'bpmn:ThrowEvent') &&
6207 hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')
6211 function isMessageFlowTarget(element) {
6212 return is(element, 'bpmn:InteractionNode') && (!is(element, 'bpmn:Event') || (
6213 is(element, 'bpmn:CatchEvent') &&
6214 hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')
6218 function getScopeParent(element) {
6220 var bo = getBusinessObject(element);
6222 if (is(bo, 'bpmn:Participant')) {
6229 if (is(bo, 'bpmn:FlowElementsContainer')) {
6237 function isSameScope(a, b) {
6238 var scopeParentA = getScopeParent(a),
6239 scopeParentB = getScopeParent(b);
6241 return scopeParentA && (scopeParentA === scopeParentB);
6244 function hasEventDefinition(element, eventDefinition) {
6245 var bo = getBusinessObject(element);
6247 return !!find(bo.eventDefinitions || [], function(definition) {
6248 return is(definition, eventDefinition);
6252 function hasEventDefinitionOrNone(element, eventDefinition) {
6253 var bo = getBusinessObject(element);
6255 return (bo.eventDefinitions || []).every(function(definition) {
6256 return is(definition, eventDefinition);
6260 function isSequenceFlowSource(element) {
6261 return is(element, 'bpmn:FlowNode') && !is(element, 'bpmn:EndEvent') && !(
6262 is(element, 'bpmn:IntermediateThrowEvent') &&
6263 hasEventDefinition(element, 'bpmn:LinkEventDefinition')
6267 function isSequenceFlowTarget(element) {
6268 return is(element, 'bpmn:FlowNode') && !is(element, 'bpmn:StartEvent') && !(
6269 is(element, 'bpmn:IntermediateCatchEvent') &&
6270 hasEventDefinition(element, 'bpmn:LinkEventDefinition')
6274 function isEventBasedTarget(element) {
6275 return is(element, 'bpmn:ReceiveTask') || (
6276 is(element, 'bpmn:IntermediateCatchEvent') && (
6277 hasEventDefinition(element, 'bpmn:MessageEventDefinition') ||
6278 hasEventDefinition(element, 'bpmn:TimerEventDefinition') ||
6279 hasEventDefinition(element, 'bpmn:ConditionalEventDefinition') ||
6280 hasEventDefinition(element, 'bpmn:SignalEventDefinition')
6285 function isLabel(element) {
6286 return element.labelTarget;
6289 function isConnection(element) {
6290 return element.waypoints;
6293 function isParent(possibleParent, element) {
6294 var allParents = getParents(element);
6295 return allParents.indexOf(possibleParent) !== -1;
6298 function canConnect(source, target, connection) {
6300 if (nonExistantOrLabel(source) || nonExistantOrLabel(target)) {
6304 // See https://github.com/bpmn-io/bpmn-js/issues/178
6305 // as a workround we disallow connections with same
6306 // target and source element.
6307 // This rule must be removed if a auto layout for this
6308 // connections is implemented.
6309 if (isSame(source, target)) {
6313 if (canConnectMessageFlow(source, target) ||
6314 canConnectSequenceFlow(source, target)) {
6319 if (is(connection, 'bpmn:Association')) {
6320 return canConnectAssociation(source, target);
6327 * Can an element be dropped into the target element
6331 function canDrop(element, target) {
6333 // can move labels everywhere
6334 if (isLabel(element) && !isConnection(target)) {
6338 // allow to create new participants on
6339 // on existing collaboration and process diagrams
6340 if (is(element, 'bpmn:Participant')) {
6341 return is(target, 'bpmn:Process') || is(target, 'bpmn:Collaboration');
6344 // drop flow elements onto flow element containers
6346 if (is(element, 'bpmn:FlowElement')) {
6347 if (is(target, 'bpmn:FlowElementsContainer')) {
6348 return isExpanded(target) !== false;
6351 return is(target, 'bpmn:Participant');
6354 if (is(element, 'bpmn:Artifact')) {
6355 return is(target, 'bpmn:Collaboration') ||
6356 is(target, 'bpmn:Participant') ||
6357 is(target, 'bpmn:Process');
6360 if (is(element, 'bpmn:MessageFlow')) {
6361 return is(target, 'bpmn:Collaboration');
6367 function canMove(elements, target) {
6369 // only move if they have the same parent
6370 var sameParent = size(groupBy(elements, function(s) {
6371 return s.parent && s.parent.id;
6382 return elements.every(function(element) {
6383 return canDrop(element, target);
6387 function canCreate(shape, target, source) {
6393 if (isLabel(target)) {
6397 if (isSame(source, target)) {
6401 // ensure we do not drop the element
6403 if (source && isParent(source, target)) {
6407 return canDrop(shape, target);
6410 function canResize(shape, newBounds) {
6411 if (is(shape, 'bpmn:SubProcess')) {
6412 return isExpanded(shape) && (!newBounds || (newBounds.width >= 100 && newBounds.height >= 80));
6415 if (is(shape, 'bpmn:Participant')) {
6416 return !newBounds || (newBounds.width >= 100 && newBounds.height >= 80);
6419 if (is(shape, 'bpmn:TextAnnotation')) {
6422 if (is(shape, 'bpmn:MultiBranchConnector')) {
6429 function canConnectAssociation(source, target) {
6431 // do not connect connections
6432 if (isConnection(source) || isConnection(target)) {
6436 // connect if different parent
6437 return !isParent(target, source) &&
6438 !isParent(source, target);
6441 function canConnectMessageFlow(source, target) {
6443 return isMessageFlowSource(source) &&
6444 isMessageFlowTarget(target) &&
6445 !isSameOrganization(source, target);
6448 function canConnectSequenceFlow(source, target) {
6450 return isSequenceFlowSource(source) &&
6451 isSequenceFlowTarget(target) &&
6452 isSameScope(source, target) &&
6453 !(is(source, 'bpmn:EventBasedGateway') && !isEventBasedTarget(target));
6456 "../../../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
6457 "../../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
6458 "../ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
6459 "diagram-js/lib/features/rules/RuleProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\RuleProvider.js",
6460 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
6461 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
6462 "lodash/collection/groupBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js",
6463 "lodash/collection/size": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\size.js"
6465 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\index.js": [function(require, module, exports) {
6468 require('diagram-js/lib/features/rules')
6470 __init__: ['bpmnRules'],
6471 bpmnRules: ['type', require('./BpmnRules')]
6475 "./BpmnRules": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\rules\\BpmnRules.js",
6476 "diagram-js/lib/features/rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js"
6478 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\palette\\PaletteProvider.js": [function(require, module, exports) {
6481 var assign = require('lodash/object/assign');
6484 * A palette provider for BPMN 2.0 elements.
6486 function PaletteProvider(palette, create, elementFactory, spaceTool, lassoTool) {
6488 this._create = create;
6489 this._elementFactory = elementFactory;
6490 this._spaceTool = spaceTool;
6491 this._lassoTool = lassoTool;
6493 palette.registerProvider(this);
6496 module.exports = PaletteProvider;
6498 PaletteProvider.$inject = ['palette', 'create', 'elementFactory', 'spaceTool', 'lassoTool'];
6501 PaletteProvider.prototype.getPaletteEntries = function(element) {
6504 create = this._create,
6505 elementFactory = this._elementFactory,
6506 spaceTool = this._spaceTool,
6507 lassoTool = this._lassoTool;
6510 function createAction(type, group, className, title, options) {
6511 function createListener(event) {
6512 var shape = elementFactory.createShape(assign({
6517 shape.businessObject.di.isExpanded = options.isExpanded;
6520 create.start(event, shape);
6523 var shortType = type.replace(/^bpmn\:/, '');
6527 className: className,
6528 title: title || 'Create ' + shortType,
6530 dragstart: createListener,
6531 click: createListener
6536 function createParticipant(event, collapsed) {
6537 create.start(event, elementFactory.createParticipantShape(collapsed));
6541 'create.start-event': createAction(
6542 'bpmn:StartEvent', 'event', 'icon-start-event-none', "Start"
6544 'create.collector': createAction(
6545 'bpmn:Collector', 'event', 'icon-collector-node', 'Collector'
6547 'create.String-Match': createAction(
6548 'bpmn:StringMatch', 'event', 'icon-stringmatch-node', 'String Match'
6550 'create.ves-collector': createAction(
6551 'bpmn:VesCollector', 'event', 'icon-ves-collector-node', 'Ves Collector'
6553 'create.holmes': createAction(
6554 'bpmn:Holmes', 'event', 'icon-holmes-node', 'Holmes'
6558 'create.TCA': createAction(
6559 'bpmn:TCA', 'event', 'icon-tca-node', 'TCA'
6561 'create.Aand-AI': createAction(
6562 'bpmn:Policy', 'event', 'icon-policy-node', 'Policy'
6564 'create.end-event': createAction(
6565 'bpmn:EndEvent', 'event', 'icon-end-event-none', "End"
6573 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
6575 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\palette\\index.js": [function(require, module, exports) {
6578 require('diagram-js/lib/features/palette'),
6579 require('diagram-js/lib/features/create')
6581 __init__: ['paletteProvider'],
6582 paletteProvider: ['type', require('./PaletteProvider')]
6586 "./PaletteProvider": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\palette\\PaletteProvider.js",
6587 "diagram-js/lib/features/create": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\index.js",
6588 "diagram-js/lib/features/palette": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\index.js"
6590 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\BpmnReplace.js": [function(require, module, exports) {
6593 var forEach = require('lodash/collection/forEach'),
6594 filter = require('lodash/collection/filter');
6596 var REPLACE_OPTIONS = require('./ReplaceOptions');
6598 var startEventReplace = REPLACE_OPTIONS.START_EVENT,
6599 intermediateEventReplace = REPLACE_OPTIONS.INTERMEDIATE_EVENT,
6600 endEventReplace = REPLACE_OPTIONS.END_EVENT,
6601 gatewayReplace = REPLACE_OPTIONS.GATEWAY,
6602 taskReplace = REPLACE_OPTIONS.TASK;
6606 * A replace menu provider that gives users the controls to choose and replace
6607 * BPMN elements with each other.
6609 * @param {BpmnFactory}
6613 * @param {PopupMenu}
6618 function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection) {
6621 * Prepares a new business object for the replacement element and triggers
6622 * the replace operation.
6624 * @param {djs.model.Base}
6628 * @return {djs.model.Base} the newly created element
6630 function replaceElement(element, target) {
6632 var type = target.type,
6633 oldBusinessObject = element.businessObject,
6634 businessObject = bpmnFactory.create(type);
6638 businessObject: businessObject
6641 // initialize custom BPMN extensions
6643 if (target.eventDefinition) {
6644 var eventDefinitions = businessObject.get('eventDefinitions'),
6645 eventDefinition = moddle.create(target.eventDefinition);
6647 eventDefinitions.push(eventDefinition);
6650 if (target.instantiate !== undefined) {
6651 businessObject.instantiate = target.instantiate;
6654 if (target.eventGatewayType !== undefined) {
6655 businessObject.eventGatewayType = target.eventGatewayType;
6658 // copy size (for activities only)
6659 if (oldBusinessObject.$instanceOf('bpmn:Activity')) {
6661 // TODO: need also to respect min/max Size
6663 newElement.width = element.width;
6664 newElement.height = element.height;
6667 // TODO: copy other elligable properties from old business object
6668 businessObject.name = oldBusinessObject.name;
6670 newElement = replace.replaceElement(element, newElement);
6672 selection.select(newElement);
6678 function getReplaceOptions(element) {
6680 var menuEntries = [];
6681 var businessObject = element.businessObject;
6683 if (businessObject.$instanceOf('bpmn:StartEvent')) {
6684 addEntries(startEventReplace, filterEvents);
6687 if (businessObject.$instanceOf('bpmn:IntermediateCatchEvent') ||
6688 businessObject.$instanceOf('bpmn:IntermediateThrowEvent')) {
6690 addEntries(intermediateEventReplace, filterEvents);
6693 if (businessObject.$instanceOf('bpmn:EndEvent')) {
6695 addEntries(endEventReplace, filterEvents);
6698 if (businessObject.$instanceOf('bpmn:Gateway')) {
6700 addEntries(gatewayReplace, function(entry) {
6702 return entry.target.type !== businessObject.$type;
6706 if (businessObject.$instanceOf('bpmn:FlowNode')) {
6707 addEntries(taskReplace, function(entry) {
6708 return entry.target.type !== businessObject.$type;
6712 function filterEvents(entry) {
6714 var target = entry.target;
6716 var eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0].$type;
6717 var isEventDefinitionEqual = target.eventDefinition == eventDefinition;
6718 var isEventTypeEqual = businessObject.$type == target.type;
6720 return ((!isEventDefinitionEqual && isEventTypeEqual) ||
6721 !isEventTypeEqual) ||
6722 !(isEventDefinitionEqual && isEventTypeEqual);
6725 function addEntries(entries, filterFun) {
6726 // Filter selected type from the array
6727 var filteredEntries = filter(entries, filterFun);
6729 // Add entries to replace menu
6730 forEach(filteredEntries, function(definition) {
6732 var entry = addMenuEntry(definition);
6733 menuEntries.push(entry);
6737 function addMenuEntry(definition) {
6740 label: definition.label,
6741 className: definition.className,
6743 name: definition.actionName,
6744 handler: function() {
6745 replaceElement(element, definition.target);
6757 this.openChooser = function(position, element) {
6758 var entries = this.getReplaceOptions(element);
6760 popupMenu.open('replace-menu', position, entries);
6763 this.getReplaceOptions = getReplaceOptions;
6765 this.replaceElement = replaceElement;
6768 BpmnReplace.$inject = ['bpmnFactory', 'moddle', 'popupMenu', 'replace', 'selection'];
6770 module.exports = BpmnReplace;
6772 "./ReplaceOptions": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\ReplaceOptions.js",
6773 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
6774 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
6776 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\ReplaceOptions.js": [function(require, module, exports) {
6779 module.exports.START_EVENT = [{
6780 label: 'Start Event',
6781 actionName: 'replace-with-none-start',
6782 className: 'icon-start-event-none',
6784 type: 'bpmn:StartEvent'
6787 label: 'Intermediate Throw Event',
6788 actionName: 'replace-with-intermediate-throwing',
6789 className: 'icon-intermediate-event-none',
6791 type: 'bpmn:IntermediateThrowEvent'
6795 actionName: 'replace-with-message-end',
6796 className: 'icon-end-event-none',
6798 type: 'bpmn:EndEvent'
6801 label: 'Message Start Event',
6802 actionName: 'replace-with-message-start',
6803 className: 'icon-start-event-message',
6805 type: 'bpmn:StartEvent',
6806 eventDefinition: 'bpmn:MessageEventDefinition'
6809 label: 'Timer Start Event',
6810 actionName: 'replace-with-timer-start',
6811 className: 'icon-start-event-timer',
6813 type: 'bpmn:StartEvent',
6814 eventDefinition: 'bpmn:TimerEventDefinition'
6817 label: 'Conditional Start Event',
6818 actionName: 'replace-with-conditional-start',
6819 className: 'icon-start-event-condition',
6821 type: 'bpmn:StartEvent',
6822 eventDefinition: 'bpmn:ConditionalEventDefinition'
6825 label: 'Signal Start Event',
6826 actionName: 'replace-with-signal-start',
6827 className: 'icon-start-event-signal',
6829 type: 'bpmn:StartEvent',
6830 eventDefinition: 'bpmn:SignalEventDefinition'
6834 module.exports.INTERMEDIATE_EVENT = [{
6835 label: 'Start Event',
6836 actionName: 'replace-with-none-start',
6837 className: 'icon-start-event-none',
6839 type: 'bpmn:StartEvent'
6842 label: 'Intermediate Throw Event',
6843 actionName: 'replace-with-message-intermediate-throw',
6844 className: 'icon-intermediate-event-none',
6846 type: 'bpmn:IntermediateThrowEvent'
6850 actionName: 'replace-with-message-end',
6851 className: 'icon-end-event-none',
6853 type: 'bpmn:EndEvent'
6856 label: 'Message Intermediate Catch Event',
6857 actionName: 'replace-with-intermediate-catch',
6858 className: 'icon-intermediate-event-catch-message',
6860 type: 'bpmn:IntermediateCatchEvent',
6861 eventDefinition: 'bpmn:MessageEventDefinition'
6864 label: 'Message Intermediate Throw Event',
6865 actionName: 'replace-with-intermediate-throw',
6866 className: 'icon-intermediate-event-throw-message',
6868 type: 'bpmn:IntermediateThrowEvent',
6869 eventDefinition: 'bpmn:MessageEventDefinition'
6872 label: 'Timer Intermediate Catch Event',
6873 actionName: 'replace-with-timer-intermediate-catch',
6874 className: 'icon-intermediate-event-catch-timer',
6876 type: 'bpmn:IntermediateCatchEvent',
6877 eventDefinition: 'bpmn:TimerEventDefinition'
6880 label: 'Escalation Intermediate Catch Event',
6881 actionName: 'replace-with-escalation-catch',
6882 className: 'icon-intermediate-event-catch-escalation',
6884 type: 'bpmn:IntermediateCatchEvent',
6885 eventDefinition: 'bpmn:EscalationEventDefinition'
6888 label: 'Conditional Intermediate Catch Event',
6889 actionName: 'replace-with-conditional-intermediate-catch',
6890 className: 'icon-intermediate-event-catch-condition',
6892 type: 'bpmn:IntermediateCatchEvent',
6893 eventDefinition: 'bpmn:ConditionalEventDefinition'
6896 label: 'Link Intermediate Catch Event',
6897 actionName: 'replace-with-link-intermediate-catch',
6898 className: 'icon-intermediate-event-catch-link',
6900 type: 'bpmn:IntermediateCatchEvent',
6901 eventDefinition: 'bpmn:LinkEventDefinition'
6904 label: 'Link Intermediate Throw Event',
6905 actionName: 'replace-with-link-intermediate-throw',
6906 className: 'icon-intermediate-event-throw-link',
6908 type: 'bpmn:IntermediateThrowEvent',
6909 eventDefinition: 'bpmn:LinkEventDefinition'
6912 label: 'Compensation Intermediate Throw Event',
6913 actionName: 'replace-with-compensation-intermediate-throw',
6914 className: 'icon-intermediate-event-throw-compensation',
6916 type: 'bpmn:IntermediateThrowEvent',
6917 eventDefinition: 'bpmn:CompensateEventDefinition'
6920 label: 'Signal Throw Catch Event',
6921 actionName: 'replace-with-throw-intermediate-catch',
6922 className: 'icon-intermediate-event-catch-signal',
6924 type: 'bpmn:IntermediateCatchEvent',
6925 eventDefinition: 'bpmn:SignalEventDefinition'
6928 label: 'Signal Intermediate Throw Event',
6929 actionName: 'replace-with-signal-intermediate-throw',
6930 className: 'icon-intermediate-event-throw-signal',
6932 type: 'bpmn:IntermediateThrowEvent',
6933 eventDefinition: 'bpmn:SignalEventDefinition'
6937 module.exports.END_EVENT = [{
6938 label: 'Start Event',
6939 actionName: 'replace-with-none-start',
6940 className: 'icon-start-event-none',
6942 type: 'bpmn:StartEvent'
6945 label: 'Intermediate Throw Event',
6946 actionName: 'replace-with-message-intermediate-throw',
6947 className: 'icon-intermediate-event-none',
6949 type: 'bpmn:IntermediateThrowEvent'
6953 actionName: 'replace-with-none-end',
6954 className: 'icon-end-event-none',
6956 type: 'bpmn:EndEvent'
6959 label: 'Message End Event',
6960 actionName: 'replace-with-message-end',
6961 className: 'icon-end-event-message',
6963 type: 'bpmn:EndEvent',
6964 eventDefinition: 'bpmn:MessageEventDefinition'
6967 label: 'Escalation End Event',
6968 actionName: 'replace-with-escalation-end',
6969 className: 'icon-end-event-escalation',
6971 type: 'bpmn:EndEvent',
6972 eventDefinition: 'bpmn:EscalationEventDefinition'
6975 label: 'Error End Event',
6976 actionName: 'replace-with-error-end',
6977 className: 'icon-end-event-error',
6979 type: 'bpmn:EndEvent',
6980 eventDefinition: 'bpmn:ErrorEventDefinition'
6983 label: 'Cancel End Event',
6984 actionName: 'replace-with-cancel-end',
6985 className: 'icon-end-event-cancel',
6987 type: 'bpmn:EndEvent',
6988 eventDefinition: 'bpmn:CancelEventDefinition'
6991 label: 'Compensation End Event',
6992 actionName: 'replace-with-compensation-end',
6993 className: 'icon-end-event-compensation',
6995 type: 'bpmn:EndEvent',
6996 eventDefinition: 'bpmn:CompensateEventDefinition'
6999 label: 'Signal End Event',
7000 actionName: 'replace-with-signal-end',
7001 className: 'icon-end-event-signal',
7003 type: 'bpmn:EndEvent',
7004 eventDefinition: 'bpmn:SignalEventDefinition'
7007 label: 'Terminate End Event',
7008 actionName: 'replace-with-terminate-end',
7009 className: 'icon-end-event-terminate',
7011 type: 'bpmn:EndEvent',
7012 eventDefinition: 'bpmn:TerminateEventDefinition'
7016 module.exports.GATEWAY = [{
7017 label: 'Exclusive Gateway',
7018 actionName: 'replace-with-exclusive-gateway',
7019 className: 'icon-gateway-xor',
7021 type: 'bpmn:ExclusiveGateway'
7024 label: 'Parallel Gateway',
7025 actionName: 'replace-with-parallel-gateway',
7026 className: 'icon-gateway-parallel',
7028 type: 'bpmn:ParallelGateway'
7031 label: 'Inclusive Gateway',
7032 actionName: 'replace-with-inclusive-gateway',
7033 className: 'icon-gateway-or',
7035 type: 'bpmn:InclusiveGateway'
7038 label: 'Complex Gateway',
7039 actionName: 'replace-with-complex-gateway',
7040 className: 'icon-gateway-complex',
7042 type: 'bpmn:ComplexGateway'
7045 label: 'Event based Gateway',
7046 actionName: 'replace-with-event-based-gateway',
7047 className: 'icon-gateway-eventbased',
7049 type: 'bpmn:EventBasedGateway',
7051 eventGatewayType: 'Exclusive'
7054 // Gateways deactivated until https://github.com/bpmn-io/bpmn-js/issues/194
7056 // label: 'Event based instantiating Gateway',
7057 // actionName: 'replace-with-exclusive-event-based-gateway',
7058 // className: 'icon-exclusive-event-based',
7060 // type: 'bpmn:EventBasedGateway'
7063 // businessObject: { instantiate: true, eventGatewayType: 'Exclusive' }
7067 // label: 'Parallel Event based instantiating Gateway',
7068 // actionName: 'replace-with-parallel-event-based-instantiate-gateway',
7069 // className: 'icon-parallel-event-based-instantiate-gateway',
7071 // type: 'bpmn:EventBasedGateway'
7074 // businessObject: { instantiate: true, eventGatewayType: 'Parallel' }
7080 module.exports.TASK = [{
7082 actionName: 'replace-with-task',
7083 className: 'icon-task',
7089 actionName: 'replace-with-send-task',
7090 className: 'icon-send',
7092 type: 'bpmn:SendTask'
7095 label: 'Receive Task',
7096 actionName: 'replace-with-receive-task',
7097 className: 'icon-receive',
7099 type: 'bpmn:ReceiveTask'
7103 actionName: 'replace-with-user-task',
7104 className: 'icon-user',
7106 type: 'bpmn:UserTask'
7109 label: 'Manual Task',
7110 actionName: 'replace-with-manual-task',
7111 className: 'icon-manual',
7113 type: 'bpmn:ManualTask'
7116 label: 'Business Rule Task',
7117 actionName: 'replace-with-rule-task',
7118 className: 'icon-business-rule',
7120 type: 'bpmn:BusinessRuleTask'
7123 label: 'Service Task',
7124 actionName: 'replace-with-service-task',
7125 className: 'icon-service',
7127 type: 'bpmn:ServiceTask'
7130 label: 'Script Task',
7131 actionName: 'replace-with-script-task',
7132 className: 'icon-script',
7134 type: 'bpmn:ScriptTask'
7138 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\index.js": [function(require, module, exports) {
7141 require('diagram-js/lib/features/popup-menu'),
7142 require('diagram-js/lib/features/replace'),
7143 require('diagram-js/lib/features/selection')
7145 bpmnReplace: ['type', require('./BpmnReplace')]
7148 "./BpmnReplace": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\replace\\BpmnReplace.js",
7149 "diagram-js/lib/features/popup-menu": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\index.js",
7150 "diagram-js/lib/features/replace": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\index.js",
7151 "diagram-js/lib/features/selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js"
7153 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\snapping\\BpmnSnapping.js": [function(require, module, exports) {
7156 var inherits = require('inherits');
7158 var forEach = require('lodash/collection/forEach');
7160 var getBoundingBox = require('diagram-js/lib/util/Elements').getBBox;
7161 var is = require('../modeling/ModelingUtil').is;
7163 var Snapping = require('diagram-js/lib/features/snapping/Snapping'),
7164 SnapUtil = require('diagram-js/lib/features/snapping/SnapUtil');
7166 var is = require('../../util/ModelUtil').is;
7168 var mid = SnapUtil.mid,
7169 topLeft = SnapUtil.topLeft,
7170 bottomRight = SnapUtil.bottomRight;
7172 var round = Math.round;
7176 * BPMN specific snapping functionality
7177 * * snap on process elements if a pool is created inside a process diagram
7184 function BpmnSnapping(eventBus, canvas) {
7186 // instantiate super
7187 Snapping.call(this, eventBus, canvas);
7191 * Drop participant on process <> process elements snapping
7194 function initParticipantSnapping(context, shape, elements) {
7196 if (!elements.length) {
7200 var snapBox = getBoundingBox(elements.filter(function(e) {
7201 return !e.labelTarget && !e.waypoints;
7206 snapBox.width += 70;
7207 snapBox.height += 40;
7209 // adjust shape height to include bounding box
7210 shape.width = Math.max(shape.width, snapBox.width);
7211 shape.height = Math.max(shape.height, snapBox.height);
7213 context.participantSnapBox = snapBox;
7216 function snapParticipant(snapBox, shape, event) {
7218 var shapeHalfWidth = shape.width / 2 - 30,
7219 shapeHalfHeight = shape.height / 2;
7221 var currentTopLeft = {
7222 x: event.x - shapeHalfWidth - 30,
7223 y: event.y - shapeHalfHeight
7226 var currentBottomRight = {
7227 x: event.x + shapeHalfWidth + 30,
7228 y: event.y + shapeHalfHeight
7231 var snapTopLeft = snapBox,
7232 snapBottomRight = bottomRight(snapBox);
7234 if (currentTopLeft.x >= snapTopLeft.x) {
7235 event.x = snapTopLeft.x + 30 + shapeHalfWidth;
7236 event.snapped = true;
7238 if (currentBottomRight.x <= snapBottomRight.x) {
7239 event.x = snapBottomRight.x - 30 - shapeHalfWidth;
7240 event.snapped = true;
7243 if (currentTopLeft.y >= snapTopLeft.y) {
7244 event.y = snapTopLeft.y + shapeHalfHeight;
7245 event.snapped = true;
7247 if (currentBottomRight.y <= snapBottomRight.y) {
7248 event.y = snapBottomRight.y - shapeHalfHeight;
7249 event.snapped = true;
7253 eventBus.on('create.start', function(event) {
7255 var context = event.context,
7256 shape = context.shape,
7257 rootElement = canvas.getRootElement();
7259 // snap participant around existing elements (if any)
7260 if (is(shape, 'bpmn:Participant') && is(rootElement, 'bpmn:Process')) {
7262 initParticipantSnapping(context, shape, rootElement.children);
7266 eventBus.on(['create.move', 'create.end'], 1500, function(event) {
7268 var context = event.context,
7269 shape = context.shape,
7270 participantSnapBox = context.participantSnapBox;
7272 if (!event.snapped && participantSnapBox) {
7273 snapParticipant(participantSnapBox, shape, event);
7277 eventBus.on('resize.start', 1500, function(event) {
7278 var context = event.context,
7279 shape = context.shape;
7281 if (is(shape, 'bpmn:SubProcess')) {
7282 context.minDimensions = {
7288 if (is(shape, 'bpmn:Participant')) {
7289 context.minDimensions = {
7295 if (is(shape, 'bpmn:TextAnnotation')) {
7296 context.minDimensions = {
7305 inherits(BpmnSnapping, Snapping);
7307 BpmnSnapping.$inject = ['eventBus', 'canvas'];
7309 module.exports = BpmnSnapping;
7312 BpmnSnapping.prototype.initSnap = function(event) {
7314 var context = event.context,
7315 shape = context.shape,
7323 snapContext = Snapping.prototype.initSnap.call(this, event);
7325 if (is(shape, 'bpmn:Participant')) {
7326 // assign higher priority for outer snaps on participants
7327 snapContext.setSnapLocations(['top-left', 'bottom-right', 'mid']);
7333 shapeMid = mid(shape, event);
7337 height: shape.height,
7338 x: isNaN(shape.x) ? round(shapeMid.x - shape.width / 2) : shape.x,
7339 y: isNaN(shape.y) ? round(shapeMid.y - shape.height / 2) : shape.y,
7342 shapeTopLeft = topLeft(shapeBounds);
7343 shapeBottomRight = bottomRight(shapeBounds);
7345 snapContext.setSnapOrigin('top-left', {
7346 x: shapeTopLeft.x - event.x,
7347 y: shapeTopLeft.y - event.y
7350 snapContext.setSnapOrigin('bottom-right', {
7351 x: shapeBottomRight.x - event.x,
7352 y: shapeBottomRight.y - event.y
7356 forEach(shape.outgoing, function(c) {
7357 var docking = c.waypoints[0];
7359 docking = docking.original || docking;
7361 snapContext.setSnapOrigin(c.id + '-docking', {
7362 x: docking.x - event.x,
7363 y: docking.y - event.y
7367 forEach(shape.incoming, function(c) {
7368 var docking = c.waypoints[c.waypoints.length - 1];
7370 docking = docking.original || docking;
7372 snapContext.setSnapOrigin(c.id + '-docking', {
7373 x: docking.x - event.x,
7374 y: docking.y - event.y
7380 var source = context.source;
7383 snapContext.addDefaultSnap('mid', mid(source));
7388 BpmnSnapping.prototype.addTargetSnaps = function(snapPoints, shape, target) {
7390 var siblings = this.getSiblings(shape, target);
7393 forEach(siblings, function(s) {
7394 snapPoints.add('mid', mid(s));
7396 if (is(s, 'bpmn:Participant')) {
7397 snapPoints.add('top-left', topLeft(s));
7398 snapPoints.add('bottom-right', bottomRight(s));
7402 forEach(shape.incoming, function(c) {
7404 if (siblings.indexOf(c.source) === -1) {
7405 snapPoints.add('mid', mid(c.source));
7407 var docking = c.waypoints[0];
7408 snapPoints.add(c.id + '-docking', docking.original || docking);
7413 forEach(shape.outgoing, function(c) {
7415 if (siblings.indexOf(c.target) === -1) {
7416 snapPoints.add('mid', mid(c.target));
7418 var docking = c.waypoints[c.waypoints.length - 1];
7419 snapPoints.add(c.id + '-docking', docking.original || docking);
7425 "../../util/ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js",
7426 "../modeling/ModelingUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\modeling\\ModelingUtil.js",
7427 "diagram-js/lib/features/snapping/SnapUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js",
7428 "diagram-js/lib/features/snapping/Snapping": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\Snapping.js",
7429 "diagram-js/lib/util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
7430 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js",
7431 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
7433 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\snapping\\index.js": [function(require, module, exports) {
7435 __init__: ['snapping'],
7436 snapping: ['type', require('./BpmnSnapping')]
7439 "./BpmnSnapping": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\features\\snapping\\BpmnSnapping.js"
7441 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnImporter.js": [function(require, module, exports) {
7444 var assign = require('lodash/object/assign'),
7445 map = require('lodash/collection/map');
7447 var LabelUtil = require('../util/LabelUtil');
7449 var hasExternalLabel = LabelUtil.hasExternalLabel,
7450 getExternalLabelBounds = LabelUtil.getExternalLabelBounds,
7451 isExpanded = require('../util/DiUtil').isExpanded,
7452 elementToString = require('./Util').elementToString;
7455 function elementData(semantic, attrs) {
7458 type: semantic.$type,
7459 businessObject: semantic
7463 function collectWaypoints(waypoints) {
7464 return map(waypoints, function(p) {
7474 * An importer that adds bpmn elements to the canvas
7480 * @param {ElementFactory}
7482 * @param {ElementRegistry}
7485 function BpmnImporter(eventBus, canvas, elementFactory, elementRegistry) {
7486 this._eventBus = eventBus;
7487 this._canvas = canvas;
7489 this._elementFactory = elementFactory;
7490 this._elementRegistry = elementRegistry;
7493 BpmnImporter.$inject = ['eventBus', 'canvas', 'elementFactory', 'elementRegistry'];
7495 module.exports = BpmnImporter;
7499 * Add bpmn element (semantic) to the canvas onto the specified parent shape.
7501 BpmnImporter.prototype.add = function(semantic, parentElement) {
7503 var di = semantic.di,
7507 // handle the special case that we deal with a
7508 // invisible root element (process or collaboration)
7509 if (di.$instanceOf('bpmndi:BPMNPlane')) {
7511 // add a virtual element (not being drawn)
7512 element = this._elementFactory.createRoot(elementData(semantic));
7514 this._canvas.setRootElement(element);
7518 else if (di.$instanceOf('bpmndi:BPMNShape')) {
7520 var collapsed = !isExpanded(semantic);
7521 var hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
7523 var bounds = semantic.di.bounds;
7525 element = this._elementFactory.createShape(elementData(semantic, {
7526 collapsed: collapsed,
7528 x: Math.round(bounds.x),
7529 y: Math.round(bounds.y),
7530 width: Math.round(bounds.width),
7531 height: Math.round(bounds.height)
7534 this._canvas.addShape(element, parentElement);
7538 else if (di.$instanceOf('bpmndi:BPMNEdge')) {
7540 var source = this._getSource(semantic),
7541 target = this._getTarget(semantic);
7543 element = this._elementFactory.createConnection(elementData(semantic, {
7546 waypoints: collectWaypoints(semantic.di.waypoint)
7549 this._canvas.addConnection(element, parentElement);
7551 throw new Error('unknown di ' + elementToString(di) + ' for element ' + elementToString(semantic));
7555 if (hasExternalLabel(semantic)) {
7556 this.addLabel(semantic, element);
7560 this._eventBus.fire('bpmnElement.added', {
7569 * add label for an element
7571 BpmnImporter.prototype.addLabel = function(semantic, element) {
7572 var bounds = getExternalLabelBounds(semantic, element);
7574 var label = this._elementFactory.createLabel(elementData(semantic, {
7575 id: semantic.id + '_label',
7576 labelTarget: element,
7578 hidden: element.hidden,
7579 x: Math.round(bounds.x),
7580 y: Math.round(bounds.y),
7581 width: Math.round(bounds.width),
7582 height: Math.round(bounds.height)
7585 return this._canvas.addShape(label, element.parent);
7589 * Return the drawn connection end based on the given side.
7592 * if the end is not yet drawn
7594 BpmnImporter.prototype._getEnd = function(semantic, side) {
7598 type = semantic.$type;
7600 refSemantic = semantic[side + 'Ref'];
7602 // handle mysterious isMany DataAssociation#sourceRef
7603 if (side === 'source' && type === 'bpmn:DataInputAssociation') {
7604 refSemantic = refSemantic && refSemantic[0];
7607 // fix source / target for DataInputAssociation / DataOutputAssociation
7608 if (side === 'source' && type === 'bpmn:DataOutputAssociation' ||
7609 side === 'target' && type === 'bpmn:DataInputAssociation') {
7611 refSemantic = semantic.$parent;
7614 element = refSemantic && this._getElement(refSemantic);
7622 'element ' + elementToString(refSemantic) + ' referenced by ' +
7623 elementToString(semantic) + '#' + side + 'Ref not yet drawn');
7625 throw new Error(elementToString(semantic) + '#' + side + 'Ref not specified');
7629 BpmnImporter.prototype._getSource = function(semantic) {
7630 return this._getEnd(semantic, 'source');
7633 BpmnImporter.prototype._getTarget = function(semantic) {
7634 return this._getEnd(semantic, 'target');
7638 BpmnImporter.prototype._getElement = function(semantic) {
7639 return this._elementRegistry.get(semantic.id);
7643 "../util/DiUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js",
7644 "../util/LabelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js",
7645 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Util.js",
7646 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js",
7647 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
7649 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnTreeWalker.js": [function(require, module, exports) {
7652 var filter = require('lodash/collection/filter'),
7653 find = require('lodash/collection/find'),
7654 forEach = require('lodash/collection/forEach');
7656 var Refs = require('object-refs');
7658 var elementToString = require('./Util').elementToString;
7660 var diRefs = new Refs({
7661 name: 'bpmnElement',
7668 * Returns true if an element has the given meta-model type
7670 * @param {ModdleElement}
7677 function is(element, type) {
7678 return element.$instanceOf(type);
7683 * Find a suitable display candidate for definitions where the DI does not
7684 * correctly specify one.
7686 function findDisplayCandidate(definitions) {
7687 return find(definitions.rootElements, function(e) {
7688 return is(e, 'bpmn:Process') || is(e, 'bpmn:Collaboration');
7693 function BpmnTreeWalker(handler) {
7695 // list of containers already walked
7696 var handledProcesses = [];
7698 // list of elements to handle deferred to ensure
7699 // prerequisites are drawn
7702 // /// Helpers /////////////////////////////////
7704 function contextual(fn, ctx) {
7705 return function(e) {
7710 function visit(element, ctx) {
7712 var gfx = element.gfx;
7714 // avoid multiple rendering of elements
7716 throw new Error('already rendered ' + elementToString(element));
7720 return handler.element(element, ctx);
7723 function visitRoot(element, diagram) {
7724 return handler.root(element, diagram);
7727 function visitIfDi(element, ctx) {
7729 return element.di && visit(element, ctx);
7731 logError(e.message, {
7736 console.error('failed to import ' + elementToString(element));
7741 function logError(message, context) {
7742 handler.error(message, context);
7745 // //// DI handling ////////////////////////////
7747 function registerDi(di) {
7748 var bpmnElement = di.bpmnElement;
7751 if (bpmnElement.di) {
7752 logError('multiple DI elements defined for ' + elementToString(bpmnElement), {
7753 element: bpmnElement
7756 diRefs.bind(bpmnElement, 'di');
7757 bpmnElement.di = di;
7760 logError('no bpmnElement referenced in ' + elementToString(di), {
7766 function handleDiagram(diagram) {
7767 handlePlane(diagram.plane);
7770 function handlePlane(plane) {
7773 forEach(plane.planeElement, handlePlaneElement);
7776 function handlePlaneElement(planeElement) {
7777 registerDi(planeElement);
7781 // //// Semantic handling //////////////////////
7783 function handleDefinitions(definitions, diagram) {
7784 // make sure we walk the correct bpmnElement
7786 var diagrams = definitions.diagrams;
7788 if (diagram && diagrams.indexOf(diagram) === -1) {
7789 throw new Error('diagram not part of bpmn:Definitions');
7792 if (!diagram && diagrams && diagrams.length) {
7793 diagram = diagrams[0];
7796 // no diagram -> nothing to import
7801 // load DI from selected diagram only
7802 handleDiagram(diagram);
7805 var plane = diagram.plane;
7808 throw new Error('no plane for ' + elementToString(diagram));
7812 var rootElement = plane.bpmnElement;
7814 // ensure we default to a suitable display candidate (process or
7816 // even if non is specified in DI
7818 rootElement = findDisplayCandidate(definitions);
7821 return logError('no process or collaboration present to display');
7824 logError('correcting missing bpmnElement on ' + elementToString(plane) + ' to ' + elementToString(rootElement));
7826 // correct DI on the fly
7827 plane.bpmnElement = rootElement;
7833 var ctx = visitRoot(rootElement, plane);
7835 if (is(rootElement, 'bpmn:Process')) {
7836 handleProcess(rootElement, ctx);
7837 } else if (is(rootElement, 'bpmn:Collaboration')) {
7838 handleCollaboration(rootElement, ctx);
7840 // force drawing of everything not yet drawn that is part of the target
7842 handleUnhandledProcesses(definitions.rootElements, ctx);
7844 throw new Error('unsupported bpmnElement for ' + elementToString(plane) + ' : ' + elementToString(rootElement));
7847 // handle all deferred elements
7848 handleDeferred(deferred);
7851 function handleDeferred(deferred) {
7852 forEach(deferred, function(d) {
7857 function handleProcess(process, context) {
7858 handleFlowElementsContainer(process, context);
7859 handleIoSpecification(process.ioSpecification, context);
7861 handleArtifacts(process.artifacts, context);
7863 // log process handled
7864 handledProcesses.push(process);
7867 function handleUnhandledProcesses(rootElements) {
7869 // walk through all processes that have not yet been drawn and draw them
7870 // if they contain lanes with DI information.
7871 // we do this to pass the free-floating lane test cases in the MIWG test
7873 var processes = filter(rootElements, function(e) {
7874 return is(e, 'bpmn:Process') && e.laneSets && handledProcesses.indexOf(e) === -1;
7877 processes.forEach(contextual(handleProcess));
7880 function handleMessageFlow(messageFlow, context) {
7881 visitIfDi(messageFlow, context);
7884 function handleMessageFlows(messageFlows, context) {
7885 forEach(messageFlows, contextual(handleMessageFlow, context));
7888 function handleDataAssociation(association, context) {
7889 visitIfDi(association, context);
7892 function handleDataInput(dataInput, context) {
7893 visitIfDi(dataInput, context);
7896 function handleDataOutput(dataOutput, context) {
7897 visitIfDi(dataOutput, context);
7900 function handleArtifact(artifact, context) {
7902 // bpmn:TextAnnotation
7906 visitIfDi(artifact, context);
7909 function handleArtifacts(artifacts, context) {
7911 forEach(artifacts, function(e) {
7912 if (is(e, 'bpmn:Association')) {
7913 deferred.push(function() {
7914 handleArtifact(e, context);
7917 handleArtifact(e, context);
7922 function handleIoSpecification(ioSpecification, context) {
7924 if (!ioSpecification) {
7928 forEach(ioSpecification.dataInputs, contextual(handleDataInput, context));
7929 forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
7932 function handleSubProcess(subProcess, context) {
7933 handleFlowElementsContainer(subProcess, context);
7934 handleArtifacts(subProcess.artifacts, context);
7937 function handleFlowNode(flowNode, context) {
7938 var childCtx = visitIfDi(flowNode, context);
7940 if (is(flowNode, 'bpmn:SubProcess')) {
7941 handleSubProcess(flowNode, childCtx || context);
7945 function handleSequenceFlow(sequenceFlow, context) {
7946 visitIfDi(sequenceFlow, context);
7949 function handleDataElement(dataObject, context) {
7950 visitIfDi(dataObject, context);
7953 function handleBoundaryEvent(dataObject, context) {
7954 visitIfDi(dataObject, context);
7957 function handleLane(lane, context) {
7958 var newContext = visitIfDi(lane, context);
7960 if (lane.childLaneSet) {
7961 handleLaneSet(lane.childLaneSet, newContext || context);
7963 var filterList = filter(lane.flowNodeRef, function(e) {
7964 return e.$type !== 'bpmn:BoundaryEvent';
7966 handleFlowElements(filterList, newContext || context);
7970 function handleLaneSet(laneSet, context) {
7971 forEach(laneSet.lanes, contextual(handleLane, context));
7974 function handleLaneSets(laneSets, context) {
7975 forEach(laneSets, contextual(handleLaneSet, context));
7978 function handleFlowElementsContainer(container, context) {
7980 if (container.laneSets) {
7981 handleLaneSets(container.laneSets, context);
7982 handleNonFlowNodes(container.flowElements);
7984 handleFlowElements(container.flowElements, context);
7988 function handleNonFlowNodes(flowElements, context) {
7989 forEach(flowElements, function(e) {
7990 if (is(e, 'bpmn:SequenceFlow')) {
7991 deferred.push(function() {
7992 handleSequenceFlow(e, context);
7994 } else if (is(e, 'bpmn:BoundaryEvent')) {
7995 deferred.unshift(function() {
7996 handleBoundaryEvent(e, context);
7998 } else if (is(e, 'bpmn:DataObject')) {
7999 // SKIP (assume correct referencing via DataObjectReference)
8000 } else if (is(e, 'bpmn:DataStoreReference')) {
8001 handleDataElement(e, context);
8002 } else if (is(e, 'bpmn:DataObjectReference')) {
8003 handleDataElement(e, context);
8008 function handleFlowElements(flowElements, context) {
8009 forEach(flowElements, function(e) {
8010 if (is(e, 'bpmn:SequenceFlow')) {
8011 deferred.push(function() {
8012 handleSequenceFlow(e, context);
8014 } else if (is(e, 'bpmn:BoundaryEvent')) {
8015 deferred.unshift(function() {
8016 handleBoundaryEvent(e, context);
8018 } else if (is(e, 'bpmn:FlowNode')) {
8019 handleFlowNode(e, context);
8021 if (is(e, 'bpmn:Activity')) {
8023 handleIoSpecification(e.ioSpecification, context);
8025 // defer handling of associations
8026 deferred.push(function() {
8027 forEach(e.dataInputAssociations, contextual(handleDataAssociation, context));
8028 forEach(e.dataOutputAssociations, contextual(handleDataAssociation, context));
8031 } else if (is(e, 'bpmn:DataObject')) {
8032 // SKIP (assume correct referencing via DataObjectReference)
8033 } else if (is(e, 'bpmn:DataStoreReference')) {
8034 handleDataElement(e, context);
8035 } else if (is(e, 'bpmn:DataObjectReference')) {
8036 handleDataElement(e, context);
8039 'unrecognized flowElement ' + elementToString(e) + ' in context ' +
8040 (context ? elementToString(context.businessObject) : null), {
8048 function handleParticipant(participant, context) {
8049 var newCtx = visitIfDi(participant, context);
8051 var process = participant.processRef;
8053 handleProcess(process, newCtx || context);
8057 function handleCollaboration(collaboration) {
8059 forEach(collaboration.participants, contextual(handleParticipant));
8061 handleArtifacts(collaboration.artifacts);
8063 // handle message flows latest in the process
8064 deferred.push(function() {
8065 handleMessageFlows(collaboration.messageFlows);
8070 // /// API ////////////////////////////////
8073 handleDefinitions: handleDefinitions
8077 module.exports = BpmnTreeWalker;
8079 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Util.js",
8080 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
8081 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
8082 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
8083 "object-refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\index.js"
8085 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Importer.js": [function(require, module, exports) {
8088 var BpmnTreeWalker = require('./BpmnTreeWalker');
8092 * Import the definitions into a diagram.
8094 * Errors and warnings are reported through the specified callback.
8098 * @param {ModdleElement}
8101 * done the callback, invoked with (err, [ warning ]) once the import
8104 function importBpmnDiagram(diagram, definitions, done) {
8106 var importer = diagram.get('bpmnImporter'),
8107 eventBus = diagram.get('eventBus');
8112 function parse(definitions) {
8116 root: function(element) {
8117 return importer.add(element);
8120 element: function(element, parentShape) {
8121 return importer.add(element, parentShape);
8124 error: function(message, context) {
8132 var walker = new BpmnTreeWalker(visitor);
8135 walker.handleDefinitions(definitions);
8138 eventBus.fire('import.start');
8146 eventBus.fire(error ? 'import.error' : 'import.success', {
8150 done(error, warnings);
8153 module.exports.importBpmnDiagram = importBpmnDiagram;
8155 "./BpmnTreeWalker": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnTreeWalker.js"
8157 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\Util.js": [function(require, module, exports) {
8160 module.exports.elementToString = function(e) {
8165 return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
8168 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\index.js": [function(require, module, exports) {
8170 bpmnImporter: ['type', require('./BpmnImporter')]
8173 "./BpmnImporter": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\import\\BpmnImporter.js"
8175 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\DiUtil.js": [function(require, module, exports) {
8178 var is = require('./ModelUtil').is,
8179 getBusinessObject = require('./ModelUtil').getBusinessObject;
8181 module.exports.isExpanded = function(element) {
8183 if (is(element, 'bpmn:CallActivity')) {
8187 if (is(element, 'bpmn:SubProcess')) {
8188 return getBusinessObject(element).di.isExpanded;
8191 if (is(element, 'bpmn:Participant')) {
8192 return !!getBusinessObject(element).processRef;
8199 "./ModelUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js"
8201 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\LabelUtil.js": [function(require, module, exports) {
8204 var assign = require('lodash/object/assign');
8207 var DEFAULT_LABEL_SIZE = module.exports.DEFAULT_LABEL_SIZE = {
8214 * Returns true if the given semantic has an external label
8216 * @param {BpmnElement}
8218 * @return {Boolean} true if has label
8220 module.exports.hasExternalLabel = function(semantic) {
8222 return semantic.$instanceOf('bpmn:Event') ||
8223 // semantic.$instanceOf('bpmn:Gateway') ||
8224 semantic.$instanceOf('bpmn:DataStoreReference') ||
8225 semantic.$instanceOf('bpmn:DataObjectReference') ||
8226 semantic.$instanceOf('bpmn:SequenceFlow') ||
8227 semantic.$instanceOf('bpmn:MessageFlow');
8232 * Get the middle of a number of waypoints
8235 * <Point>} waypoints
8236 * @return {Point} the mid point
8238 var getWaypointsMid = module.exports.getWaypointsMid = function(waypoints) {
8240 var mid = waypoints.length / 2 - 1;
8242 var first = waypoints[Math.floor(mid)];
8243 var second = waypoints[Math.ceil(mid + 0.01)];
8246 x: first.x + (second.x - first.x) / 2,
8247 y: first.y + (second.y - first.y) / 2
8252 var getExternalLabelMid = module.exports.getExternalLabelMid = function(element) {
8254 if (element.waypoints) {
8255 return getWaypointsMid(element.waypoints);
8258 x: element.x + element.width / 2,
8259 y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2
8265 * Returns the bounds of an elements label, parsed from the elements DI or
8266 * generated from its bounds.
8268 * @param {BpmnElement}
8270 * @param {djs.model.Base}
8273 module.exports.getExternalLabelBounds = function(semantic, element) {
8281 if (label && label.bounds) {
8282 bounds = label.bounds;
8285 width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
8286 height: bounds.height
8290 x: bounds.x + bounds.width / 2,
8291 y: bounds.y + bounds.height / 2
8295 mid = getExternalLabelMid(element);
8297 size = DEFAULT_LABEL_SIZE;
8301 x: mid.x - size.width / 2,
8302 y: mid.y - size.height / 2
8306 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
8308 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\lib\\util\\ModelUtil.js": [function(require, module, exports) {
8312 * Is an element of the given BPMN type?
8314 * @param {djs.model.Base|ModdleElement}
8321 function is(element, type) {
8322 var bo = getBusinessObject(element);
8324 return bo && bo.$instanceOf(type);
8327 module.exports.is = is;
8331 * Return the business object for a given element.
8333 * @param {djs.model.Base|ModdleElement}
8336 * @return {ModdleElement}
8338 function getBusinessObject(element) {
8339 return (element && element.businessObject) || element;
8342 module.exports.getBusinessObject = getBusinessObject;
8345 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\index.js": [function(require, module, exports) {
8346 module.exports = require('./lib/simple');
8348 "./lib/simple": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\simple.js"
8350 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\bpmn-moddle.js": [function(require, module, exports) {
8353 var isString = require('lodash/lang/isString'),
8354 isFunction = require('lodash/lang/isFunction'),
8355 assign = require('lodash/object/assign');
8357 var Moddle = require('moddle'),
8358 XmlReader = require('moddle-xml/lib/reader'),
8359 XmlWriter = require('moddle-xml/lib/writer');
8362 * A sub class of {@link Moddle} with support for import and export of BPMN 2.0
8368 * @param {Object|Array}
8369 * packages to use for instantiating the model
8371 * [options] additional options to pass over
8373 function BpmnModdle(packages, options) {
8374 Moddle.call(this, packages, options);
8377 BpmnModdle.prototype = Object.create(Moddle.prototype);
8379 module.exports = BpmnModdle;
8383 * Instantiates a BPMN model tree from a given xml string.
8388 * [typeName='bpmn:Definitions'] name of the root element
8390 * [options] options to pass to the underlying reader
8392 * done callback that is invoked with (err, result, parseContext)
8393 * once the import completes
8395 BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options, done) {
8397 if (!isString(typeName)) {
8400 typeName = 'bpmn:Definitions';
8403 if (isFunction(options)) {
8408 var reader = new XmlReader(assign({
8412 var rootHandler = reader.handler(typeName);
8414 reader.fromXML(xmlStr, rootHandler, done);
8419 * Serializes a BPMN 2.0 object tree to XML.
8422 * element the root element, typically an instance of
8423 * `bpmn:Definitions`
8425 * [options] to pass to the underlying writer
8427 * done callback invoked with (err, xmlStr) once the import completes
8433 BpmnModdle.prototype.toXML = function(element, options, done) {
8435 if (isFunction(options)) {
8440 var writer = new XmlWriter(options);
8442 var result = writer.toXML(element);
8444 list_models[selected_model] = result;
8452 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
8453 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
8454 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
8455 "moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\index.js",
8456 "moddle-xml/lib/reader": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\reader.js",
8457 "moddle-xml/lib/writer": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\writer.js"
8459 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\id-support.js": [function(require, module, exports) {
8462 var ID_PATTERN = /^(.*:)?id$/;
8465 * Extends the bpmn instance with id support.
8471 * require('id-support').extend(moddle, ids);
8473 * moddle.ids.next(); // create a next id moddle.ids; // ids instance
8474 * // claims id as used moddle.create('foo:Bar', { id: 'fooobar1' });
8482 * @return {Moddle} the extended moddle instance
8484 module.exports.extend = function(model, ids) {
8486 var set = model.properties.set;
8488 // do not reinitialize setter
8489 // unless it is already initialized
8492 model.properties.set = function(target, property, value) {
8494 // ensure we log used ids once they are assigned
8495 // to model elements
8496 if (ID_PATTERN.test(property)) {
8498 var assigned = model.ids.assigned(value);
8499 if (assigned && assigned !== target) {
8500 throw new Error('id <' + value + '> already used');
8503 model.ids.claim(value, target);
8506 set.call(this, target, property, value);
8515 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\simple.js": [function(require, module, exports) {
8518 var assign = require('lodash/object/assign');
8520 var BpmnModdle = require('./bpmn-moddle');
8523 bpmn: require('../resources/bpmn/json/bpmn.json'),
8524 bpmndi: require('../resources/bpmn/json/bpmndi.json'),
8525 dc: require('../resources/bpmn/json/dc.json'),
8526 di: require('../resources/bpmn/json/di.json')
8529 module.exports = function(additionalPackages, options) {
8530 return new BpmnModdle(assign({}, packages, additionalPackages), options);
8533 "../resources/bpmn/json/bpmn.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmn.json",
8534 "../resources/bpmn/json/bpmndi.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmndi.json",
8535 "../resources/bpmn/json/dc.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\dc.json",
8536 "../resources/bpmn/json/di.json": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\di.json",
8537 "./bpmn-moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\lib\\bpmn-moddle.js",
8538 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
8540 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\common.js": [function(require, module, exports) {
8543 function capitalize(string) {
8544 return string.charAt(0).toUpperCase() + string.slice(1);
8547 function lower(string) {
8548 return string.charAt(0).toLowerCase() + string.slice(1);
8551 function hasLowerCaseAlias(pkg) {
8552 return pkg.xml && pkg.xml.tagAlias === 'lowerCase';
8556 module.exports.aliasToName = function(alias, pkg) {
8557 if (hasLowerCaseAlias(pkg)) {
8558 return capitalize(alias);
8564 module.exports.nameToAlias = function(name, pkg) {
8565 if (hasLowerCaseAlias(pkg)) {
8572 module.exports.DEFAULT_NS_MAP = {
8573 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
8576 module.exports.XSI_TYPE = 'xsi:type';
8578 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\reader.js": [function(require, module, exports) {
8581 var reduce = require('lodash/collection/reduce'),
8582 forEach = require('lodash/collection/forEach'),
8583 find = require('lodash/collection/find'),
8584 assign = require('lodash/object/assign'),
8585 defer = require('lodash/function/defer');
8587 var Stack = require('tiny-stack'),
8588 SaxParser = require('sax').parser,
8589 Moddle = require('moddle'),
8590 parseNameNs = require('moddle/lib/ns').parseName,
8591 Types = require('moddle/lib/types'),
8592 coerceType = Types.coerceType,
8593 isSimpleType = Types.isSimple,
8594 common = require('./common'),
8595 XSI_TYPE = common.XSI_TYPE,
8596 XSI_URI = common.DEFAULT_NS_MAP.xsi,
8597 aliasToName = common.aliasToName;
8599 function parseNodeAttributes(node) {
8600 var nodeAttrs = node.attributes;
8602 return reduce(nodeAttrs, function(result, v, k) {
8608 ns = parseNameNs(v.name, v.prefix);
8612 result[name] = v.value;
8617 function normalizeType(node, attr, model) {
8618 var nameNs = parseNameNs(attr.value);
8620 var uri = node.ns[nameNs.prefix || ''],
8621 localName = nameNs.localName,
8622 pkg = uri && model.getPackage(uri),
8626 typePrefix = pkg.xml && pkg.xml.typePrefix;
8628 if (typePrefix && localName.indexOf(typePrefix) === 0) {
8629 localName = localName.slice(typePrefix.length);
8632 attr.value = pkg.prefix + ':' + localName;
8637 * Normalizes namespaces for a node given an optional default namespace and a
8638 * number of mappings from uris to default prefixes.
8643 * model the model containing all registered namespaces
8647 function normalizeNamespaces(node, model, defaultNsUri) {
8650 uri = node.uri || defaultNsUri;
8653 var pkg = model.getPackage(uri);
8656 prefix = pkg.prefix;
8658 prefix = node.prefix;
8661 node.prefix = prefix;
8665 forEach(node.attributes, function(attr) {
8667 // normalize xsi:type attributes because the
8668 // assigned type may or may not be namespace prefixed
8669 if (attr.uri === XSI_URI && attr.local === 'type') {
8670 normalizeType(node, attr, model);
8673 normalizeNamespaces(attr, model, null);
8685 * @param {ElementHandler}
8686 * options.parseRoot the root handler for parsing a document
8688 * [options.lax=false] whether or not to ignore invalid elements
8690 function Context(options) {
8693 * @property {ElementHandler} parseRoot
8697 * @property {Boolean} lax
8700 assign(this, options);
8702 var elementsById = this.elementsById = {};
8703 var references = this.references = [];
8704 var warnings = this.warnings = [];
8706 this.addReference = function(reference) {
8707 references.push(reference);
8710 this.addElement = function(id, element) {
8712 if (!id || !element) {
8713 throw new Error('[xml-reader] id or ctx must not be null');
8716 elementsById[id] = element;
8719 this.addWarning = function(w) {
8724 function BaseHandler() {}
8726 BaseHandler.prototype.handleEnd = function() {};
8727 BaseHandler.prototype.handleText = function() {};
8728 BaseHandler.prototype.handleNode = function() {};
8732 * A simple pass through handler that does nothing except for ignoring all input
8735 * This is used to ignore unknown elements and attributes.
8737 function NoopHandler() {}
8739 NoopHandler.prototype = new BaseHandler();
8741 NoopHandler.prototype.handleNode = function() {
8745 function BodyHandler() {}
8747 BodyHandler.prototype = new BaseHandler();
8749 BodyHandler.prototype.handleText = function(text) {
8750 this.body = (this.body || '') + text;
8753 function ReferenceHandler(property, context) {
8754 this.property = property;
8755 this.context = context;
8758 ReferenceHandler.prototype = new BodyHandler();
8760 ReferenceHandler.prototype.handleNode = function(node) {
8763 throw new Error('expected no sub nodes');
8765 this.element = this.createReference(node);
8771 ReferenceHandler.prototype.handleEnd = function() {
8772 this.element.id = this.body;
8775 ReferenceHandler.prototype.createReference = function() {
8777 property: this.property.ns.name,
8782 function ValueHandler(propertyDesc, element) {
8783 this.element = element;
8784 this.propertyDesc = propertyDesc;
8787 ValueHandler.prototype = new BodyHandler();
8789 ValueHandler.prototype.handleEnd = function() {
8791 var value = this.body,
8792 element = this.element,
8793 propertyDesc = this.propertyDesc;
8795 value = coerceType(propertyDesc.type, value);
8797 if (propertyDesc.isMany) {
8798 element.get(propertyDesc.name).push(value);
8800 element.set(propertyDesc.name, value);
8805 function BaseElementHandler() {}
8807 BaseElementHandler.prototype = Object.create(BodyHandler.prototype);
8809 BaseElementHandler.prototype.handleNode = function(node) {
8811 element = this.element,
8815 element = this.element = this.createElement(node);
8819 this.context.addElement(id, element);
8822 parser = this.handleChild(node);
8829 * @class XMLReader.ElementHandler
8832 function ElementHandler(model, type, context) {
8834 this.type = model.getType(type);
8835 this.context = context;
8838 ElementHandler.prototype = new BaseElementHandler();
8840 ElementHandler.prototype.addReference = function(reference) {
8841 this.context.addReference(reference);
8844 ElementHandler.prototype.handleEnd = function() {
8846 var value = this.body,
8847 element = this.element,
8848 descriptor = element.$descriptor,
8849 bodyProperty = descriptor.bodyProperty;
8851 if (bodyProperty && value !== undefined) {
8852 value = coerceType(bodyProperty.type, value);
8853 element.set(bodyProperty.name, value);
8858 * Create an instance of the model from the given node.
8863 ElementHandler.prototype.createElement = function(node) {
8864 var attributes = parseNodeAttributes(node),
8866 descriptor = Type.$descriptor,
8867 context = this.context,
8868 instance = new Type({});
8870 forEach(attributes, function(value, name) {
8872 var prop = descriptor.propertiesByName[name];
8874 if (prop && prop.isReference) {
8875 context.addReference({
8877 property: prop.ns.name,
8882 value = coerceType(prop.type, value);
8885 instance.set(name, value);
8892 ElementHandler.prototype.getPropertyForNode = function(node) {
8894 var nameNs = parseNameNs(node.local, node.prefix);
8896 var type = this.type,
8898 descriptor = type.$descriptor;
8900 var propertyName = nameNs.name,
8901 property = descriptor.propertiesByName[propertyName],
8906 // search for properties by name first
8910 if (property.serialize === XSI_TYPE) {
8911 typeAnnotation = node.attributes[XSI_TYPE];
8913 // xsi type is optional, if it does not exists the
8914 // default type is assumed
8915 if (typeAnnotation) {
8917 elementTypeName = typeAnnotation.value;
8919 // TODO: extract real name from attribute
8920 elementType = model.getType(elementTypeName);
8922 return assign({}, property, {
8923 effectiveType: elementType.$descriptor.name
8928 // search for properties by name first
8933 var pkg = model.getPackage(nameNs.prefix);
8936 elementTypeName = nameNs.prefix + ':' + aliasToName(nameNs.localName, descriptor.$pkg);
8937 elementType = model.getType(elementTypeName);
8939 // search for collection members later
8940 property = find(descriptor.properties, function(p) {
8941 return !p.isVirtual && !p.isReference && !p.isAttribute && elementType.hasType(p.type);
8945 return assign({}, property, {
8946 effectiveType: elementType.$descriptor.name
8950 // parse unknown element (maybe extension)
8951 property = find(descriptor.properties, function(p) {
8952 return !p.isReference && !p.isAttribute && p.type === 'Element';
8960 throw new Error('unrecognized element <' + nameNs.name + '>');
8963 ElementHandler.prototype.toString = function() {
8964 return 'ElementDescriptor[' + this.type.$descriptor.name + ']';
8967 ElementHandler.prototype.valueHandler = function(propertyDesc, element) {
8968 return new ValueHandler(propertyDesc, element);
8971 ElementHandler.prototype.referenceHandler = function(propertyDesc) {
8972 return new ReferenceHandler(propertyDesc, this.context);
8975 ElementHandler.prototype.handler = function(type) {
8976 if (type === 'Element') {
8977 return new GenericElementHandler(this.model, type, this.context);
8979 return new ElementHandler(this.model, type, this.context);
8984 * Handle the child element parsing
8989 ElementHandler.prototype.handleChild = function(node) {
8990 var propertyDesc, type, element, childHandler;
8992 propertyDesc = this.getPropertyForNode(node);
8993 element = this.element;
8995 type = propertyDesc.effectiveType || propertyDesc.type;
8997 if (isSimpleType(type)) {
8998 return this.valueHandler(propertyDesc, element);
9001 if (propertyDesc.isReference) {
9002 childHandler = this.referenceHandler(propertyDesc).handleNode(node);
9004 childHandler = this.handler(type).handleNode(node);
9007 var newElement = childHandler.element;
9009 // child handles may decide to skip elements
9010 // by not returning anything
9011 if (newElement !== undefined) {
9013 if (propertyDesc.isMany) {
9014 element.get(propertyDesc.name).push(newElement);
9016 element.set(propertyDesc.name, newElement);
9019 if (propertyDesc.isReference) {
9020 assign(newElement, {
9024 this.context.addReference(newElement);
9026 // establish child -> parent relationship
9027 newElement.$parent = element;
9031 return childHandler;
9035 function GenericElementHandler(model, type, context) {
9037 this.context = context;
9040 GenericElementHandler.prototype = Object.create(BaseElementHandler.prototype);
9042 GenericElementHandler.prototype.createElement = function(node) {
9044 var name = node.name,
9045 prefix = node.prefix,
9046 uri = node.ns[prefix],
9047 attributes = node.attributes;
9049 return this.model.createAny(name, uri, attributes);
9052 GenericElementHandler.prototype.handleChild = function(node) {
9054 var handler = new GenericElementHandler(this.model, 'Element', this.context).handleNode(node),
9055 element = this.element;
9057 var newElement = handler.element,
9060 if (newElement !== undefined) {
9061 children = element.$children = element.$children || [];
9062 children.push(newElement);
9064 // establish child -> parent relationship
9065 newElement.$parent = element;
9071 GenericElementHandler.prototype.handleText = function(text) {
9072 this.body = this.body || '' + text;
9075 GenericElementHandler.prototype.handleEnd = function() {
9077 this.element.$body = this.body;
9082 * A reader for a meta-model
9087 * options.model used to read xml files
9089 * options.lax whether to make parse errors warnings
9091 function XMLReader(options) {
9093 if (options instanceof Moddle) {
9105 XMLReader.prototype.fromXML = function(xml, rootHandler, done) {
9107 var model = this.model,
9109 context = new Context({
9110 parseRoot: rootHandler
9113 var parser = new SaxParser(true, {
9117 stack = new Stack();
9119 rootHandler.context = context;
9121 // push root handler
9122 stack.push(rootHandler);
9125 function resolveReferences() {
9127 var elementsById = context.elementsById;
9128 var references = context.references;
9132 for (i = 0; !!(r = references[i]); i++) {
9133 var element = r.element;
9134 var reference = elementsById[r.id];
9135 var property = element.$descriptor.propertiesByName[r.property];
9138 context.addWarning({
9139 message: 'unresolved reference <' + r.id + '>',
9141 property: r.property,
9146 if (property.isMany) {
9147 var collection = element.get(property.name),
9148 idx = collection.indexOf(r);
9151 // remove unresolvable reference
9152 collection.splice(idx, 1);
9155 collection[idx] = reference;
9158 element.set(property.name, reference);
9163 function handleClose(tagName) {
9164 stack.pop().handleEnd();
9167 function handleOpen(node) {
9168 var handler = stack.peek();
9170 normalizeNamespaces(node, model);
9173 stack.push(handler.handleNode(node));
9176 var line = this.line,
9177 column = this.column;
9180 'unparsable content <' + node.name + '> detected\n\t' +
9181 'line: ' + line + '\n\t' +
9182 'column: ' + column + '\n\t' +
9183 'nested error: ' + e.message;
9186 context.addWarning({
9191 console.warn('could not parse node');
9194 stack.push(new NoopHandler());
9196 console.error('could not parse document');
9199 throw new Error(message);
9204 function handleText(text) {
9205 stack.peek().handleText(text);
9208 parser.onopentag = handleOpen;
9209 parser.oncdata = parser.ontext = handleText;
9210 parser.onclosetag = handleClose;
9211 parser.onend = resolveReferences;
9213 // deferred parse XML to make loading really ascnchronous
9214 // this ensures the execution environment (node or browser)
9215 // is kept responsive and that certain optimization strategies
9221 parser.write(xml).close();
9226 done(error, error ? undefined : rootHandler.element, context);
9230 XMLReader.prototype.handler = function(name) {
9231 return new ElementHandler(this.model, name);
9234 module.exports = XMLReader;
9235 module.exports.ElementHandler = ElementHandler;
9237 "./common": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\common.js",
9238 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
9239 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
9240 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
9241 "lodash/function/defer": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\defer.js",
9242 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
9243 "moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\index.js",
9244 "moddle/lib/ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
9245 "moddle/lib/types": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js",
9246 "sax": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\node_modules\\sax\\lib\\sax.js",
9247 "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"
9249 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\writer.js": [function(require, module, exports) {
9252 var map = require('lodash/collection/map'),
9253 forEach = require('lodash/collection/forEach'),
9254 isString = require('lodash/lang/isString'),
9255 filter = require('lodash/collection/filter'),
9256 assign = require('lodash/object/assign');
9258 var Types = require('moddle/lib/types'),
9259 parseNameNs = require('moddle/lib/ns').parseName,
9260 common = require('./common'),
9261 nameToAlias = common.nameToAlias;
9263 var XML_PREAMBLE = '<?xml version="1.0" encoding="UTF-8"?>\n',
9264 ESCAPE_CHARS = /(<|>|'|"|&|\n\r|\n)/g,
9265 DEFAULT_NS_MAP = common.DEFAULT_NS_MAP,
9266 XSI_TYPE = common.XSI_TYPE;
9269 function nsName(ns) {
9273 return (ns.prefix ? ns.prefix + ':' : '') + ns.localName;
9277 function getElementNs(ns, descriptor) {
9278 if (descriptor.isGeneric) {
9279 return descriptor.name;
9282 localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg)
9287 function getPropertyNs(ns, descriptor) {
9289 localName: descriptor.ns.localName
9293 function getSerializableProperties(element) {
9294 var descriptor = element.$descriptor;
9296 return filter(descriptor.properties, function(p) {
9299 // do not serialize defaults
9300 if (!element.hasOwnProperty(name)) {
9304 var value = element[name];
9306 // do not serialize default equals
9307 if (value === p.default) {
9311 return p.isMany ? value.length : true;
9326 * Escape a string attribute to not contain any bad values (line breaks, '"',
9330 * str the string to escape
9331 * @return {String} the escaped string
9333 function escapeAttr(str) {
9335 // ensure we are handling strings here
9336 str = isString(str) ? str : '' + str;
9338 return str.replace(ESCAPE_CHARS, function(str) {
9339 return '&#' + ESCAPE_MAP[str] + ';';
9343 function filterAttributes(props) {
9344 return filter(props, function(p) {
9349 function filterContained(props) {
9350 return filter(props, function(p) {
9356 function ReferenceSerializer(parent, ns) {
9360 ReferenceSerializer.prototype.build = function(element) {
9361 this.element = element;
9365 ReferenceSerializer.prototype.serializeTo = function(writer) {
9368 .append('<' + nsName(this.ns) + '>' + this.element.id + '</' + nsName(this.ns) + '>')
9372 function BodySerializer() {}
9374 BodySerializer.prototype.serializeValue = BodySerializer.prototype.serializeTo = function(writer) {
9375 var escape = this.escape;
9378 writer.append('<![CDATA[');
9381 writer.append(this.value);
9384 writer.append(']]>');
9388 BodySerializer.prototype.build = function(prop, value) {
9391 if (prop.type === 'String' && ESCAPE_CHARS.test(value)) {
9398 function ValueSerializer(ns) {
9402 ValueSerializer.prototype = new BodySerializer();
9404 ValueSerializer.prototype.serializeTo = function(writer) {
9408 .append('<' + nsName(this.ns) + '>');
9410 this.serializeValue(writer);
9413 .append('</' + nsName(this.ns) + '>')
9417 function ElementSerializer(parent, ns) {
9421 this.parent = parent;
9425 ElementSerializer.prototype.build = function(element) {
9426 this.element = element;
9428 var otherAttrs = this.parseNsAttributes(element);
9431 this.ns = this.nsTagName(element.$descriptor);
9434 if (element.$descriptor.isGeneric) {
9435 this.parseGeneric(element);
9437 var properties = getSerializableProperties(element);
9439 this.parseAttributes(filterAttributes(properties));
9440 this.parseContainments(filterContained(properties));
9442 this.parseGenericAttributes(element, otherAttrs);
9448 ElementSerializer.prototype.nsTagName = function(descriptor) {
9449 var effectiveNs = this.logNamespaceUsed(descriptor.ns);
9450 return getElementNs(effectiveNs, descriptor);
9453 ElementSerializer.prototype.nsPropertyTagName = function(descriptor) {
9454 var effectiveNs = this.logNamespaceUsed(descriptor.ns);
9455 return getPropertyNs(effectiveNs, descriptor);
9458 ElementSerializer.prototype.isLocalNs = function(ns) {
9459 return ns.uri === this.ns.uri;
9462 ElementSerializer.prototype.nsAttributeName = function(element) {
9466 if (isString(element)) {
9467 ns = parseNameNs(element);
9473 var effectiveNs = this.logNamespaceUsed(ns);
9475 // strip prefix if same namespace like parent
9476 if (this.isLocalNs(effectiveNs)) {
9478 localName: ns.localName
9482 localName: ns.localName
9487 ElementSerializer.prototype.parseGeneric = function(element) {
9493 forEach(element, function(val, key) {
9495 if (key === '$body') {
9496 body.push(new BodySerializer().build({
9500 if (key === '$children') {
9501 forEach(val, function(child) {
9502 body.push(new ElementSerializer(self).build(child));
9505 if (key.indexOf('$') !== 0) {
9508 value: escapeAttr(val)
9515 * Parse namespaces and return a list of left over generic attributes
9519 * @return {Array<Object>}
9521 ElementSerializer.prototype.parseNsAttributes = function(element) {
9524 var genericAttrs = element.$attrs;
9526 var attributes = [];
9528 // parse namespace attributes first
9529 // and log them. push non namespace attributes to a list
9530 // and process them later
9531 forEach(genericAttrs, function(value, name) {
9532 var nameNs = parseNameNs(name);
9534 if (nameNs.prefix === 'xmlns') {
9536 prefix: nameNs.localName,
9540 if (!nameNs.prefix && nameNs.localName === 'xmlns') {
9555 ElementSerializer.prototype.parseGenericAttributes = function(element, attributes) {
9559 forEach(attributes, function(attr) {
9561 // do not serialize xsi:type attribute
9562 // it is set manually based on the actual implementation type
9563 if (attr.name === XSI_TYPE) {
9568 self.addAttribute(self.nsAttributeName(attr.name), attr.value);
9570 console.warn('[writer] missing namespace information for ', attr.name, '=', attr.value, 'on', element, e);
9575 ElementSerializer.prototype.parseContainments = function(properties) {
9579 element = this.element;
9581 forEach(properties, function(p) {
9582 var value = element.get(p.name),
9583 isReference = p.isReference,
9586 var ns = self.nsPropertyTagName(p);
9593 body.push(new BodySerializer().build(p, value[0]));
9595 if (Types.isSimple(p.type)) {
9596 forEach(value, function(v) {
9597 body.push(new ValueSerializer(ns).build(p, v));
9601 forEach(value, function(v) {
9602 body.push(new ReferenceSerializer(self, ns).build(v));
9605 // allow serialization via type
9606 // rather than element name
9607 var asType = p.serialize === XSI_TYPE;
9609 forEach(value, function(v) {
9613 serializer = new TypeSerializer(self, ns);
9615 serializer = new ElementSerializer(self);
9618 body.push(serializer.build(v));
9624 ElementSerializer.prototype.getNamespaces = function() {
9626 if (!this.namespaces) {
9634 this.namespaces = this.parent.getNamespaces();
9637 return this.namespaces;
9640 ElementSerializer.prototype.logNamespace = function(ns) {
9641 var namespaces = this.getNamespaces();
9643 var existing = namespaces.uriMap[ns.uri];
9646 namespaces.uriMap[ns.uri] = ns;
9649 namespaces.prefixMap[ns.prefix] = ns.uri;
9654 ElementSerializer.prototype.logNamespaceUsed = function(ns) {
9655 var element = this.element,
9656 model = element.$model,
9657 namespaces = this.getNamespaces();
9664 var prefix = ns.prefix;
9665 var uri = ns.uri || DEFAULT_NS_MAP[prefix] ||
9666 namespaces.prefixMap[prefix] || (model ? (model.getPackage(prefix) || {}).uri : null);
9669 throw new Error('no namespace uri given for prefix <' + ns.prefix + '>');
9672 ns = namespaces.uriMap[uri];
9675 ns = this.logNamespace({
9681 if (!namespaces.used[ns.uri]) {
9682 namespaces.used[ns.uri] = ns;
9688 ElementSerializer.prototype.parseAttributes = function(properties) {
9690 element = this.element;
9692 forEach(properties, function(p) {
9693 self.logNamespaceUsed(p.ns);
9695 var value = element.get(p.name);
9697 if (p.isReference) {
9701 self.addAttribute(self.nsAttributeName(p), value);
9705 ElementSerializer.prototype.addAttribute = function(name, value) {
9706 var attrs = this.attrs;
9708 if (isString(value)) {
9709 value = escapeAttr(value);
9718 ElementSerializer.prototype.serializeAttributes = function(writer) {
9719 var attrs = this.attrs,
9720 root = !this.parent,
9721 namespaces = this.namespaces;
9723 function collectNsAttrs() {
9724 return map(namespaces.used, function(ns) {
9725 var name = 'xmlns' + (ns.prefix ? ':' + ns.prefix : '');
9734 attrs = collectNsAttrs().concat(attrs);
9737 forEach(attrs, function(a) {
9740 .append(nsName(a.name)).append('="').append(a.value).append('"');
9744 ElementSerializer.prototype.serializeTo = function(writer) {
9745 var hasBody = this.body.length,
9746 indent = !(this.body.length === 1 && this.body[0] instanceof BodySerializer);
9750 .append('<' + nsName(this.ns));
9752 this.serializeAttributes(writer);
9754 writer.append(hasBody ? '>' : ' />');
9764 forEach(this.body, function(b) {
9765 b.serializeTo(writer);
9774 writer.append('</' + nsName(this.ns) + '>');
9777 writer.appendNewLine();
9781 * A serializer for types that handles serialization of data types
9783 function TypeSerializer(parent, ns) {
9784 ElementSerializer.call(this, parent, ns);
9787 TypeSerializer.prototype = new ElementSerializer();
9789 TypeSerializer.prototype.build = function(element) {
9790 var descriptor = element.$descriptor;
9792 this.element = element;
9794 this.typeNs = this.nsTagName(descriptor);
9796 // add xsi:type attribute to represent the elements
9799 var typeNs = this.typeNs,
9800 pkg = element.$model.getPackage(typeNs.uri),
9801 typePrefix = (pkg.xml && pkg.xml.typePrefix) || '';
9803 this.addAttribute(this.nsAttributeName(XSI_TYPE), (typeNs.prefix ? typeNs.prefix + ':' : '') +
9804 typePrefix + descriptor.ns.localName);
9806 // do the usual stuff
9807 return ElementSerializer.prototype.build.call(this, element);
9810 TypeSerializer.prototype.isLocalNs = function(ns) {
9811 return ns.uri === this.typeNs.uri;
9814 function SavingWriter() {
9817 this.write = function(str) {
9822 function FormatingWriter(out, format) {
9826 this.append = function(str) {
9832 this.appendNewLine = function() {
9840 this.appendIndent = function() {
9842 out.write(indent.join(' '));
9848 this.indent = function() {
9853 this.unindent = function() {
9860 * A writer for meta-model backed document trees
9863 * options output options to pass into the writer
9865 function XMLWriter(options) {
9872 function toXML(tree, writer) {
9873 var internalWriter = writer || new SavingWriter();
9874 var formatingWriter = new FormatingWriter(internalWriter, options.format);
9876 if (options.preamble) {
9877 formatingWriter.append(XML_PREAMBLE);
9880 new ElementSerializer().build(tree).serializeTo(formatingWriter);
9883 return internalWriter.value;
9892 module.exports = XMLWriter;
9894 "./common": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle-xml\\lib\\common.js",
9895 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
9896 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
9897 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js",
9898 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
9899 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
9900 "moddle/lib/ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
9901 "moddle/lib/types": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js"
9903 "\\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) {
9905 // wrapper for non-node envs
9909 sax.parser = function(strict, opt) {
9910 return new SAXParser(strict, opt)
9912 sax.SAXParser = SAXParser
9913 sax.SAXStream = SAXStream
9914 sax.createStream = createStream
9916 // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer
9918 // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer
9920 // since that's the earliest that a buffer overrun could occur. This way, checks
9922 // as rare as required, but as often as necessary to ensure never crossing this
9924 // Furthermore, buffers are only tested at most once per write(), so passing a
9926 // large string into write() might have undesirable effects, but this is
9928 // the caller, so it is assumed to be safe. Thus, a call to write() may, in the
9930 // edge case, result in creating at most one complete copy of the string passed
9932 // Set to Infinity to have unlimited buffers.
9933 sax.MAX_BUFFER_LENGTH = 64 * 1024
9936 "comment", "sgmlDecl", "textNode", "tagName", "doctype",
9937 "procInstName", "procInstBody", "entity", "attribName",
9938 "attribValue", "cdata", "script"
9941 sax.EVENTS = // for discoverability.
9942 ["text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "attribute", "opentag", "closetag", "opencdata", "cdata", "closecdata", "error", "end", "ready", "script", "opennamespace", "closenamespace"]
9944 function SAXParser(strict, opt) {
9945 if (!(this instanceof SAXParser)) return new SAXParser(strict, opt)
9948 clearBuffers(parser)
9949 parser.q = parser.c = ""
9950 parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
9951 parser.opt = opt || {}
9952 parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
9953 parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase"
9955 parser.closed = parser.closedRoot = parser.sawRoot = false
9956 parser.tag = parser.error = null
9957 parser.strict = !!strict
9958 parser.noscript = !!(strict || parser.opt.noscript)
9959 parser.state = S.BEGIN
9960 parser.ENTITIES = Object.create(sax.ENTITIES)
9961 parser.attribList = []
9963 // namespaces form a prototype chain.
9964 // it always points at the current tag,
9965 // which protos to its parent tag.
9966 if (parser.opt.xmlns) parser.ns = Object.create(rootNS)
9968 // mostly just for error reporting
9969 parser.trackPosition = parser.opt.position !== false
9970 if (parser.trackPosition) {
9971 parser.position = parser.line = parser.column = 0
9973 emit(parser, "onready")
9976 if (!Object.create) Object.create = function(o) {
9984 if (!Object.getPrototypeOf) Object.getPrototypeOf = function(o) {
9988 if (!Object.keys) Object.keys = function(o) {
9991 if (o.hasOwnProperty(i)) a.push(i)
9995 function checkBufferLength(parser) {
9996 var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10),
9998 for (var i = 0, l = buffers.length; i < l; i++) {
9999 var len = parser[buffers[i]].length
10000 if (len > maxAllowed) {
10001 // Text/cdata nodes can get big, and since they're buffered,
10002 // we can get here under normal conditions.
10003 // Avoid issues by emitting the text node now,
10004 // so at least it won't get any bigger.
10005 switch (buffers[i]) {
10011 emitNode(parser, "oncdata", parser.cdata)
10016 emitNode(parser, "onscript", parser.script)
10021 error(parser, "Max buffer length exceeded: " + buffers[i])
10024 maxActual = Math.max(maxActual, len)
10026 // schedule the next check for the earliest possible buffer overrun.
10027 parser.bufferCheckPosition = (sax.MAX_BUFFER_LENGTH - maxActual) + parser.position
10030 function clearBuffers(parser) {
10031 for (var i = 0, l = buffers.length; i < l; i++) {
10032 parser[buffers[i]] = ""
10036 function flushBuffers(parser) {
10038 if (parser.cdata !== "") {
10039 emitNode(parser, "oncdata", parser.cdata)
10042 if (parser.script !== "") {
10043 emitNode(parser, "onscript", parser.script)
10048 SAXParser.prototype = {
10053 resume: function() {
10057 close: function() {
10058 return this.write(null)
10060 flush: function() {
10066 var Stream = require("stream").Stream
10068 var Stream = function() {}
10072 var streamWraps = sax.EVENTS.filter(function(ev) {
10073 return ev !== "error" && ev !== "end"
10076 function createStream(strict, opt) {
10077 return new SAXStream(strict, opt)
10080 function SAXStream(strict, opt) {
10081 if (!(this instanceof SAXStream)) return new SAXStream(strict, opt)
10085 this._parser = new SAXParser(strict, opt)
10086 this.writable = true
10087 this.readable = true
10092 this._parser.onend = function() {
10096 this._parser.onerror = function(er) {
10097 me.emit("error", er)
10099 // if didn't throw, then means error was handled.
10100 // go ahead and clear error, so we can write again.
10101 me._parser.error = null
10104 this._decoder = null;
10106 streamWraps.forEach(function(ev) {
10107 Object.defineProperty(me, "on" + ev, {
10109 return me._parser["on" + ev]
10113 me.removeAllListeners(ev)
10114 return me._parser["on" + ev] = h
10119 configurable: false
10124 SAXStream.prototype = Object.create(Stream.prototype, {
10130 SAXStream.prototype.write = function(data) {
10131 if (typeof Buffer === 'function' &&
10132 typeof Buffer.isBuffer === 'function' &&
10133 Buffer.isBuffer(data)) {
10134 if (!this._decoder) {
10135 var SD = require('string_decoder').StringDecoder
10136 this._decoder = new SD('utf8')
10138 data = this._decoder.write(data);
10141 this._parser.write(data.toString())
10142 this.emit("data", data)
10146 SAXStream.prototype.end = function(chunk) {
10147 if (chunk && chunk.length) this.write(chunk)
10152 SAXStream.prototype.on = function(ev, handler) {
10154 if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
10155 me._parser["on" + ev] = function() {
10156 var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
10157 args.splice(0, 0, ev)
10158 me.emit.apply(me, args)
10162 return Stream.prototype.on.call(me, ev, handler)
10167 // character classes and tokens
10168 var whitespace = "\r\n\t "
10169 // this really needs to be replaced with character classes.
10170 // XML allows all manner of ridiculous numbers and digits.
10172 number = "0124356789",
10173 letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
10174 // (Letter | "_" | ":")
10177 entity = number + letter + "#",
10178 attribEnd = whitespace + ">",
10180 DOCTYPE = "DOCTYPE",
10181 XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace",
10182 XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/",
10184 xml: XML_NAMESPACE,
10185 xmlns: XMLNS_NAMESPACE
10188 // turn all the string character sets into character class objects.
10189 whitespace = charClass(whitespace)
10190 number = charClass(number)
10191 letter = charClass(letter)
10193 // http://www.w3.org/TR/REC-xml/#NT-NameStartChar
10194 // This implementation works on strings, a single character at a time
10195 // as such, it cannot ever support astral-plane characters (10000-EFFFF)
10196 // without a significant breaking change to either this parser, or the
10197 // JavaScript language. Implementation of an emoji-capable xml parser
10198 // is left as an exercise for the reader.
10199 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]/
10201 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-]/
10203 quote = charClass(quote)
10204 entity = charClass(entity)
10205 attribEnd = charClass(attribEnd)
10207 function charClass(str) {
10208 return str.split("").reduce(function(s, c) {
10214 function isRegExp(c) {
10215 return Object.prototype.toString.call(c) === '[object RegExp]'
10218 function is(charclass, c) {
10219 return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]
10222 function not(charclass, c) {
10223 return !is(charclass, c)
10229 TEXT: S++ // general stuff
10231 TEXT_ENTITY: S++ // & and such.
10233 OPEN_WAKA: S++ // <
10235 SGML_DECL: S++ // <!BLARG
10237 SGML_DECL_QUOTED: S++ // <!BLARG foo "bar
10239 DOCTYPE: S++ // <!DOCTYPE
10241 DOCTYPE_QUOTED: S++ // <!DOCTYPE "//blah
10243 DOCTYPE_DTD: S++ // <!DOCTYPE "//blah" [ ...
10245 DOCTYPE_DTD_QUOTED: S++ // <!DOCTYPE "//blah" [ "foo
10247 COMMENT_STARTING: S++ // <!-
10249 COMMENT: S++ // <!--
10251 COMMENT_ENDING: S++ // <!-- blah -
10253 COMMENT_ENDED: S++ // <!-- blah --
10255 CDATA: S++ // <![CDATA[ something
10257 CDATA_ENDING: S++ // ]
10259 CDATA_ENDING_2: S++ // ]]
10261 PROC_INST: S++ // <?hi
10263 PROC_INST_BODY: S++ // <?hi there
10265 PROC_INST_ENDING: S++ // <?hi "there" ?
10267 OPEN_TAG: S++ // <strong
10269 OPEN_TAG_SLASH: S++ // <strong /
10273 ATTRIB_NAME: S++ // <a foo
10275 ATTRIB_NAME_SAW_WHITE: S++ // <a foo _
10277 ATTRIB_VALUE: S++ // <a foo=
10279 ATTRIB_VALUE_QUOTED: S++ // <a foo="bar
10281 ATTRIB_VALUE_CLOSED: S++ // <a foo="bar"
10283 ATTRIB_VALUE_UNQUOTED: S++ // <a foo=bar
10285 ATTRIB_VALUE_ENTITY_Q: S++ // <foo bar="""
10287 ATTRIB_VALUE_ENTITY_U: S++ // <foo bar="
10289 CLOSE_TAG: S++ // </a
10291 CLOSE_TAG_SAW_WHITE: S++ // </a >
10293 SCRIPT: S++ // <script> ...
10295 SCRIPT_ENDING: S++ // <script> ... <
10554 Object.keys(sax.ENTITIES).forEach(function(key) {
10555 var e = sax.ENTITIES[key]
10556 var s = typeof e === 'number' ? String.fromCharCode(e) : e
10557 sax.ENTITIES[key] = s
10560 for (var S in sax.STATE) sax.STATE[sax.STATE[S]] = S
10565 function emit(parser, event, data) {
10566 parser[event] && parser[event](data)
10569 function emitNode(parser, nodeType, data) {
10570 if (parser.textNode) closeText(parser)
10571 emit(parser, nodeType, data)
10574 function closeText(parser) {
10575 parser.textNode = textopts(parser.opt, parser.textNode)
10576 if (parser.textNode) emit(parser, "ontext", parser.textNode)
10577 parser.textNode = ""
10580 function textopts(opt, text) {
10581 if (opt.trim) text = text.trim()
10582 if (opt.normalize) text = text.replace(/\s+/g, " ")
10586 function error(parser, er) {
10588 if (parser.trackPosition) {
10589 er += "\nLine: " + parser.line +
10590 "\nColumn: " + parser.column +
10591 "\nChar: " + parser.c
10595 emit(parser, "onerror", er)
10599 function end(parser) {
10600 if (!parser.closedRoot) strictFail(parser, "Unclosed root tag")
10601 if ((parser.state !== S.BEGIN) && (parser.state !== S.TEXT)) error(parser, "Unexpected end")
10604 parser.closed = true
10605 emit(parser, "onend")
10606 SAXParser.call(parser, parser.strict, parser.opt)
10610 function strictFail(parser, message) {
10611 if (typeof parser !== 'object' || !(parser instanceof SAXParser))
10612 throw new Error('bad call to strictFail');
10613 if (parser.strict) error(parser, message)
10616 function newTag(parser) {
10617 if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
10618 var parent = parser.tags[parser.tags.length - 1] || parser,
10619 tag = parser.tag = {
10620 name: parser.tagName,
10624 // will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
10625 if (parser.opt.xmlns) tag.ns = parent.ns
10626 parser.attribList.length = 0
10629 function qname(name, attribute) {
10630 var i = name.indexOf(":"),
10631 qualName = i < 0 ? ["", name] : name.split(":"),
10632 prefix = qualName[0],
10633 local = qualName[1]
10635 // <x "xmlns"="http://foo">
10636 if (attribute && name === "xmlns") {
10647 function attrib(parser) {
10648 if (!parser.strict) parser.attribName = parser.attribName[parser.looseCase]()
10650 if (parser.attribList.indexOf(parser.attribName) !== -1 ||
10651 parser.tag.attributes.hasOwnProperty(parser.attribName)) {
10652 return parser.attribName = parser.attribValue = ""
10655 if (parser.opt.xmlns) {
10656 var qn = qname(parser.attribName, true),
10657 prefix = qn.prefix,
10660 if (prefix === "xmlns") {
10661 // namespace binding attribute; push the binding into scope
10662 if (local === "xml" && parser.attribValue !== XML_NAMESPACE) {
10663 strictFail(parser, "xml: prefix must be bound to " + XML_NAMESPACE + "\n" + "Actual: " + parser.attribValue)
10664 } else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) {
10665 strictFail(parser, "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\n" + "Actual: " + parser.attribValue)
10667 var tag = parser.tag,
10668 parent = parser.tags[parser.tags.length - 1] || parser
10669 if (tag.ns === parent.ns) {
10670 tag.ns = Object.create(parent.ns)
10672 tag.ns[local] = parser.attribValue
10676 // defer onattribute events until all attributes have been seen
10677 // so any new bindings can take effect; preserve attribute order
10678 // so deferred events can be emitted in document order
10679 parser.attribList.push([parser.attribName, parser.attribValue])
10681 // in non-xmlns mode, we can emit the event right away
10682 parser.tag.attributes[parser.attribName] = parser.attribValue
10683 emitNode(parser, "onattribute", {
10684 name: parser.attribName,
10685 value: parser.attribValue
10689 parser.attribName = parser.attribValue = ""
10692 function openTag(parser, selfClosing) {
10693 if (parser.opt.xmlns) {
10694 // emit namespace binding events
10695 var tag = parser.tag
10697 // add namespace info to tag
10698 var qn = qname(parser.tagName)
10699 tag.prefix = qn.prefix
10700 tag.local = qn.local
10701 tag.uri = tag.ns[qn.prefix] || ""
10703 if (tag.prefix && !tag.uri) {
10704 strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName))
10705 tag.uri = qn.prefix
10708 var parent = parser.tags[parser.tags.length - 1] || parser
10709 if (tag.ns && parent.ns !== tag.ns) {
10710 Object.keys(tag.ns).forEach(function(p) {
10711 emitNode(parser, "onopennamespace", {
10718 // handle deferred onattribute events
10719 // Note: do not apply default ns to attributes:
10720 // http://www.w3.org/TR/REC-xml-names/#defaulting
10721 for (var i = 0, l = parser.attribList.length; i < l; i++) {
10722 var nv = parser.attribList[i]
10725 qualName = qname(name, true),
10726 prefix = qualName.prefix,
10727 local = qualName.local,
10728 uri = prefix == "" ? "" : (tag.ns[prefix] || ""),
10737 // if there's any attributes with an undefined namespace,
10738 // then fail on them now.
10739 if (prefix && prefix != "xmlns" && !uri) {
10740 strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix))
10743 parser.tag.attributes[name] = a
10744 emitNode(parser, "onattribute", a)
10746 parser.attribList.length = 0
10749 parser.tag.isSelfClosing = !!selfClosing
10752 parser.sawRoot = true
10753 parser.tags.push(parser.tag)
10754 emitNode(parser, "onopentag", parser.tag)
10755 if (!selfClosing) {
10756 // special case for <script> in non-strict mode.
10757 if (!parser.noscript && parser.tagName.toLowerCase() === "script") {
10758 parser.state = S.SCRIPT
10760 parser.state = S.TEXT
10763 parser.tagName = ""
10765 parser.attribName = parser.attribValue = ""
10766 parser.attribList.length = 0
10769 function closeTag(parser) {
10770 if (!parser.tagName) {
10771 strictFail(parser, "Weird empty close tag.")
10772 parser.textNode += "</>"
10773 parser.state = S.TEXT
10777 if (parser.script) {
10778 if (parser.tagName !== "script") {
10779 parser.script += "</" + parser.tagName + ">"
10780 parser.tagName = ""
10781 parser.state = S.SCRIPT
10784 emitNode(parser, "onscript", parser.script)
10788 // first make sure that the closing tag actually exists.
10789 // <a><b></c></b></a> will close everything, otherwise.
10790 var t = parser.tags.length
10791 var tagName = parser.tagName
10792 if (!parser.strict) tagName = tagName[parser.looseCase]()
10793 var closeTo = tagName
10795 var close = parser.tags[t]
10796 if (close.name !== closeTo) {
10797 // fail the first time in strict mode
10798 strictFail(parser, "Unexpected close tag")
10802 // didn't find it. we already failed for strict, so just abort.
10804 strictFail(parser, "Unmatched closing tag: " + parser.tagName)
10805 parser.textNode += "</" + parser.tagName + ">"
10806 parser.state = S.TEXT
10809 parser.tagName = tagName
10810 var s = parser.tags.length
10812 var tag = parser.tag = parser.tags.pop()
10813 parser.tagName = parser.tag.name
10814 emitNode(parser, "onclosetag", parser.tagName)
10817 for (var i in tag.ns) x[i] = tag.ns[i]
10819 var parent = parser.tags[parser.tags.length - 1] || parser
10820 if (parser.opt.xmlns && tag.ns !== parent.ns) {
10821 // remove namespace bindings introduced by tag
10822 Object.keys(tag.ns).forEach(function(p) {
10824 emitNode(parser, "onclosenamespace", {
10831 if (t === 0) parser.closedRoot = true
10832 parser.tagName = parser.attribValue = parser.attribName = ""
10833 parser.attribList.length = 0
10834 parser.state = S.TEXT
10837 function parseEntity(parser) {
10838 var entity = parser.entity,
10839 entityLC = entity.toLowerCase(),
10841 if (parser.ENTITIES[entity])
10842 return parser.ENTITIES[entity]
10843 if (parser.ENTITIES[entityLC])
10844 return parser.ENTITIES[entityLC]
10846 if (entity.charAt(0) === "#") {
10847 if (entity.charAt(1) === "x") {
10848 entity = entity.slice(2)
10849 num = parseInt(entity, 16)
10850 numStr = num.toString(16)
10852 entity = entity.slice(1)
10853 num = parseInt(entity, 10)
10854 numStr = num.toString(10)
10857 entity = entity.replace(/^0+/, "")
10858 if (numStr.toLowerCase() !== entity) {
10859 strictFail(parser, "Invalid character entity")
10860 return "&" + parser.entity + ";"
10863 return String.fromCodePoint(num)
10866 function write(chunk) {
10868 if (this.error) throw this.error
10869 if (parser.closed) return error(parser,
10870 "Cannot write after close. Assign an onready handler.")
10871 if (chunk === null) return end(parser)
10874 while (parser.c = c = chunk.charAt(i++)) {
10875 if (parser.trackPosition) {
10880 } else parser.column++
10882 switch (parser.state) {
10886 parser.state = S.OPEN_WAKA
10887 parser.startTagPosition = parser.position
10888 } else if (not(whitespace, c)) {
10889 // have to process this as a text node.
10890 // weird, but happens.
10891 strictFail(parser, "Non-whitespace before first tag.")
10892 parser.textNode = c
10893 parser.state = S.TEXT
10898 if (parser.sawRoot && !parser.closedRoot) {
10900 while (c && c !== "<" && c !== "&") {
10901 c = chunk.charAt(i++)
10902 if (c && parser.trackPosition) {
10907 } else parser.column++
10910 parser.textNode += chunk.substring(starti, i - 1)
10913 parser.state = S.OPEN_WAKA
10914 parser.startTagPosition = parser.position
10916 if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot))
10917 strictFail(parser, "Text data outside of root node.")
10918 if (c === "&") parser.state = S.TEXT_ENTITY
10919 else parser.textNode += c
10926 parser.state = S.SCRIPT_ENDING
10927 } else parser.script += c
10930 case S.SCRIPT_ENDING:
10932 parser.state = S.CLOSE_TAG
10934 parser.script += "<" + c
10935 parser.state = S.SCRIPT
10940 // either a /, ?, !, or text is coming next.
10942 parser.state = S.SGML_DECL
10943 parser.sgmlDecl = ""
10944 } else if (is(whitespace, c)) {
10946 } else if (is(nameStart, c)) {
10947 parser.state = S.OPEN_TAG
10949 } else if (c === "/") {
10950 parser.state = S.CLOSE_TAG
10951 parser.tagName = ""
10952 } else if (c === "?") {
10953 parser.state = S.PROC_INST
10954 parser.procInstName = parser.procInstBody = ""
10956 strictFail(parser, "Unencoded <")
10957 // if there was some whitespace, then add that in.
10958 if (parser.startTagPosition + 1 < parser.position) {
10959 var pad = parser.position - parser.startTagPosition
10960 c = new Array(pad).join(" ") + c
10962 parser.textNode += "<" + c
10963 parser.state = S.TEXT
10968 if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
10969 emitNode(parser, "onopencdata")
10970 parser.state = S.CDATA
10971 parser.sgmlDecl = ""
10973 } else if (parser.sgmlDecl + c === "--") {
10974 parser.state = S.COMMENT
10975 parser.comment = ""
10976 parser.sgmlDecl = ""
10977 } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
10978 parser.state = S.DOCTYPE
10979 if (parser.doctype || parser.sawRoot) strictFail(parser,
10980 "Inappropriately located doctype declaration")
10981 parser.doctype = ""
10982 parser.sgmlDecl = ""
10983 } else if (c === ">") {
10984 emitNode(parser, "onsgmldeclaration", parser.sgmlDecl)
10985 parser.sgmlDecl = ""
10986 parser.state = S.TEXT
10987 } else if (is(quote, c)) {
10988 parser.state = S.SGML_DECL_QUOTED
10989 parser.sgmlDecl += c
10990 } else parser.sgmlDecl += c
10993 case S.SGML_DECL_QUOTED:
10994 if (c === parser.q) {
10995 parser.state = S.SGML_DECL
10998 parser.sgmlDecl += c
11003 parser.state = S.TEXT
11004 emitNode(parser, "ondoctype", parser.doctype)
11005 parser.doctype = true // just remember that we saw it.
11007 parser.doctype += c
11008 if (c === "[") parser.state = S.DOCTYPE_DTD
11009 else if (is(quote, c)) {
11010 parser.state = S.DOCTYPE_QUOTED
11016 case S.DOCTYPE_QUOTED:
11017 parser.doctype += c
11018 if (c === parser.q) {
11020 parser.state = S.DOCTYPE
11024 case S.DOCTYPE_DTD:
11025 parser.doctype += c
11026 if (c === "]") parser.state = S.DOCTYPE
11027 else if (is(quote, c)) {
11028 parser.state = S.DOCTYPE_DTD_QUOTED
11033 case S.DOCTYPE_DTD_QUOTED:
11034 parser.doctype += c
11035 if (c === parser.q) {
11036 parser.state = S.DOCTYPE_DTD
11042 if (c === "-") parser.state = S.COMMENT_ENDING
11043 else parser.comment += c
11046 case S.COMMENT_ENDING:
11048 parser.state = S.COMMENT_ENDED
11049 parser.comment = textopts(parser.opt, parser.comment)
11050 if (parser.comment) emitNode(parser, "oncomment", parser.comment)
11051 parser.comment = ""
11053 parser.comment += "-" + c
11054 parser.state = S.COMMENT
11058 case S.COMMENT_ENDED:
11060 strictFail(parser, "Malformed comment")
11061 // allow <!-- blah -- bloo --> in non-strict mode,
11062 // which is a comment of " blah -- bloo "
11063 parser.comment += "--" + c
11064 parser.state = S.COMMENT
11065 } else parser.state = S.TEXT
11069 if (c === "]") parser.state = S.CDATA_ENDING
11070 else parser.cdata += c
11073 case S.CDATA_ENDING:
11074 if (c === "]") parser.state = S.CDATA_ENDING_2
11076 parser.cdata += "]" + c
11077 parser.state = S.CDATA
11081 case S.CDATA_ENDING_2:
11083 if (parser.cdata) emitNode(parser, "oncdata", parser.cdata)
11084 emitNode(parser, "onclosecdata")
11086 parser.state = S.TEXT
11087 } else if (c === "]") {
11088 parser.cdata += "]"
11090 parser.cdata += "]]" + c
11091 parser.state = S.CDATA
11096 if (c === "?") parser.state = S.PROC_INST_ENDING
11097 else if (is(whitespace, c)) parser.state = S.PROC_INST_BODY
11098 else parser.procInstName += c
11101 case S.PROC_INST_BODY:
11102 if (!parser.procInstBody && is(whitespace, c)) continue
11103 else if (c === "?") parser.state = S.PROC_INST_ENDING
11104 else parser.procInstBody += c
11107 case S.PROC_INST_ENDING:
11109 emitNode(parser, "onprocessinginstruction", {
11110 name: parser.procInstName,
11111 body: parser.procInstBody
11113 parser.procInstName = parser.procInstBody = ""
11114 parser.state = S.TEXT
11116 parser.procInstBody += "?" + c
11117 parser.state = S.PROC_INST_BODY
11122 if (is(nameBody, c)) parser.tagName += c
11125 if (c === ">") openTag(parser)
11126 else if (c === "/") parser.state = S.OPEN_TAG_SLASH
11128 if (not(whitespace, c)) strictFail(
11129 parser, "Invalid character in tag name")
11130 parser.state = S.ATTRIB
11135 case S.OPEN_TAG_SLASH:
11137 openTag(parser, true)
11140 strictFail(parser, "Forward-slash in opening tag not followed by >")
11141 parser.state = S.ATTRIB
11146 // haven't read the attribute name yet.
11147 if (is(whitespace, c)) continue
11148 else if (c === ">") openTag(parser)
11149 else if (c === "/") parser.state = S.OPEN_TAG_SLASH
11150 else if (is(nameStart, c)) {
11151 parser.attribName = c
11152 parser.attribValue = ""
11153 parser.state = S.ATTRIB_NAME
11154 } else strictFail(parser, "Invalid attribute name")
11157 case S.ATTRIB_NAME:
11158 if (c === "=") parser.state = S.ATTRIB_VALUE
11159 else if (c === ">") {
11160 strictFail(parser, "Attribute without value")
11161 parser.attribValue = parser.attribName
11164 } else if (is(whitespace, c)) parser.state = S.ATTRIB_NAME_SAW_WHITE
11165 else if (is(nameBody, c)) parser.attribName += c
11166 else strictFail(parser, "Invalid attribute name")
11169 case S.ATTRIB_NAME_SAW_WHITE:
11170 if (c === "=") parser.state = S.ATTRIB_VALUE
11171 else if (is(whitespace, c)) continue
11173 strictFail(parser, "Attribute without value")
11174 parser.tag.attributes[parser.attribName] = ""
11175 parser.attribValue = ""
11176 emitNode(parser, "onattribute", {
11177 name: parser.attribName,
11180 parser.attribName = ""
11181 if (c === ">") openTag(parser)
11182 else if (is(nameStart, c)) {
11183 parser.attribName = c
11184 parser.state = S.ATTRIB_NAME
11186 strictFail(parser, "Invalid attribute name")
11187 parser.state = S.ATTRIB
11192 case S.ATTRIB_VALUE:
11193 if (is(whitespace, c)) continue
11194 else if (is(quote, c)) {
11196 parser.state = S.ATTRIB_VALUE_QUOTED
11198 strictFail(parser, "Unquoted attribute value")
11199 parser.state = S.ATTRIB_VALUE_UNQUOTED
11200 parser.attribValue = c
11204 case S.ATTRIB_VALUE_QUOTED:
11205 if (c !== parser.q) {
11206 if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_Q
11207 else parser.attribValue += c
11212 parser.state = S.ATTRIB_VALUE_CLOSED
11215 case S.ATTRIB_VALUE_CLOSED:
11216 if (is(whitespace, c)) {
11217 parser.state = S.ATTRIB
11218 } else if (c === ">") openTag(parser)
11219 else if (c === "/") parser.state = S.OPEN_TAG_SLASH
11220 else if (is(nameStart, c)) {
11221 strictFail(parser, "No whitespace between attributes")
11222 parser.attribName = c
11223 parser.attribValue = ""
11224 parser.state = S.ATTRIB_NAME
11225 } else strictFail(parser, "Invalid attribute name")
11228 case S.ATTRIB_VALUE_UNQUOTED:
11229 if (not(attribEnd, c)) {
11230 if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_U
11231 else parser.attribValue += c
11235 if (c === ">") openTag(parser)
11236 else parser.state = S.ATTRIB
11240 if (!parser.tagName) {
11241 if (is(whitespace, c)) continue
11242 else if (not(nameStart, c)) {
11243 if (parser.script) {
11244 parser.script += "</" + c
11245 parser.state = S.SCRIPT
11247 strictFail(parser, "Invalid tagname in closing tag.")
11249 } else parser.tagName = c
11250 } else if (c === ">") closeTag(parser)
11251 else if (is(nameBody, c)) parser.tagName += c
11252 else if (parser.script) {
11253 parser.script += "</" + parser.tagName
11254 parser.tagName = ""
11255 parser.state = S.SCRIPT
11257 if (not(whitespace, c)) strictFail(parser,
11258 "Invalid tagname in closing tag")
11259 parser.state = S.CLOSE_TAG_SAW_WHITE
11263 case S.CLOSE_TAG_SAW_WHITE:
11264 if (is(whitespace, c)) continue
11265 if (c === ">") closeTag(parser)
11266 else strictFail(parser, "Invalid characters in closing tag")
11269 case S.TEXT_ENTITY:
11270 case S.ATTRIB_VALUE_ENTITY_Q:
11271 case S.ATTRIB_VALUE_ENTITY_U:
11272 switch (parser.state) {
11273 case S.TEXT_ENTITY:
11274 var returnState = S.TEXT,
11275 buffer = "textNode"
11278 case S.ATTRIB_VALUE_ENTITY_Q:
11279 var returnState = S.ATTRIB_VALUE_QUOTED,
11280 buffer = "attribValue"
11283 case S.ATTRIB_VALUE_ENTITY_U:
11284 var returnState = S.ATTRIB_VALUE_UNQUOTED,
11285 buffer = "attribValue"
11289 parser[buffer] += parseEntity(parser)
11291 parser.state = returnState
11292 } else if (is(entity, c)) parser.entity += c
11294 strictFail(parser, "Invalid character entity")
11295 parser[buffer] += "&" + parser.entity + c
11297 parser.state = returnState
11302 throw new Error(parser, "Unknown state: " + parser.state)
11305 // cdata blocks can get very big under normal conditions. emit and move on.
11306 // if (parser.state === S.CDATA && parser.cdata) {
11307 // emitNode(parser, "oncdata", parser.cdata)
11308 // parser.cdata = ""
11310 if (parser.position >= parser.bufferCheckPosition) checkBufferLength(parser)
11314 /* ! http://mths.be/fromcodepoint v0.1.0 by @mathias */
11315 if (!String.fromCodePoint) {
11317 var stringFromCharCode = String.fromCharCode;
11318 var floor = Math.floor;
11319 var fromCodePoint = function() {
11320 var MAX_SIZE = 0x4000;
11321 var codeUnits = [];
11325 var length = arguments.length;
11330 while (++index < length) {
11331 var codePoint = Number(arguments[index]);
11332 if (!isFinite(codePoint) || // `NaN`,
11336 codePoint < 0 || // not a valid
11339 codePoint > 0x10FFFF || // not a valid
11342 floor(codePoint) != codePoint // not
11346 throw RangeError('Invalid code point: ' + codePoint);
11348 if (codePoint <= 0xFFFF) { // BMP code point
11349 codeUnits.push(codePoint);
11350 } else { // Astral code point; split in
11351 // surrogate halves
11352 // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
11353 codePoint -= 0x10000;
11354 highSurrogate = (codePoint >> 10) + 0xD800;
11355 lowSurrogate = (codePoint % 0x400) + 0xDC00;
11356 codeUnits.push(highSurrogate, lowSurrogate);
11358 if (index + 1 == length || codeUnits.length > MAX_SIZE) {
11359 result += stringFromCharCode.apply(null, codeUnits);
11360 codeUnits.length = 0;
11365 if (Object.defineProperty) {
11366 Object.defineProperty(String, 'fromCodePoint', {
11367 'value': fromCodePoint,
11368 'configurable': true,
11372 String.fromCodePoint = fromCodePoint;
11377 })(typeof exports === "undefined" ? sax = {} : exports);
11379 }).call(this, undefined)
11382 "string_decoder": false
11384 "\\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) {
11386 * Tiny stack for browser or server
11388 * @author Jason Mulligan <jason.mulligan@avoidwork.com>
11389 * @copyright 2014 Jason Mulligan
11390 * @license BSD-3 <https://raw.github.com/avoidwork/tiny-stack/master/LICENSE>
11391 * @link http://avoidwork.github.io/tiny-stack
11392 * @module tiny-stack
11396 (function(global) {
11405 function TinyStack() {
11406 this.data = [null];
11414 * @memberOf TinyStack
11415 * @return {Object} {@link TinyStack}
11417 TinyStack.prototype.clear = function clear() {
11418 this.data = [null];
11425 * Gets the size of the stack
11428 * @memberOf TinyStack
11429 * @return {Number} Size of stack
11431 TinyStack.prototype.length = function length() {
11436 * Gets the item at the top of the stack
11439 * @memberOf TinyStack
11440 * @return {Mixed} Item at the top of the stack
11442 TinyStack.prototype.peek = function peek() {
11443 return this.data[this.top];
11447 * Gets & removes the item at the top of the stack
11450 * @memberOf TinyStack
11451 * @return {Mixed} Item at the top of the stack
11453 TinyStack.prototype.pop = function pop() {
11454 if (this.top > 0) {
11457 return this.data.pop();
11464 * Pushes an item onto the stack
11467 * @memberOf TinyStack
11468 * @return {Object} {@link TinyStack}
11470 TinyStack.prototype.push = function push(arg) {
11471 this.data[++this.top] = arg;
11477 * TinyStack factory
11480 * @return {Object} {@link TinyStack}
11482 function factory() {
11483 return new TinyStack();
11486 // Node, AMD & window supported
11487 if (typeof exports != "undefined") {
11488 module.exports = factory;
11489 } else if (typeof define == "function") {
11490 define(function() {
11494 global.stack = factory;
11499 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\index.js": [function(require, module, exports) {
11500 module.exports = require('./lib/moddle');
11502 "./lib/moddle": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\moddle.js"
11504 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\base.js": [function(require, module, exports) {
11509 Base.prototype.get = function(name) {
11510 return this.$model.properties.get(this, name);
11513 Base.prototype.set = function(name, value) {
11514 this.$model.properties.set(this, name, value);
11518 module.exports = Base;
11520 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\descriptor-builder.js": [function(require, module, exports) {
11523 var pick = require('lodash/object/pick'),
11524 assign = require('lodash/object/assign'),
11525 forEach = require('lodash/collection/forEach');
11527 var parseNameNs = require('./ns').parseName;
11530 function DescriptorBuilder(nameNs) {
11532 this.name = nameNs.name;
11533 this.allTypes = [];
11534 this.properties = [];
11535 this.propertiesByName = {};
11538 module.exports = DescriptorBuilder;
11541 DescriptorBuilder.prototype.build = function() {
11542 return pick(this, ['ns', 'name', 'allTypes', 'properties', 'propertiesByName', 'bodyProperty']);
11545 DescriptorBuilder.prototype.addProperty = function(p, idx) {
11546 this.addNamedProperty(p, true);
11548 var properties = this.properties;
11550 if (idx !== undefined) {
11551 properties.splice(idx, 0, p);
11553 properties.push(p);
11558 DescriptorBuilder.prototype.replaceProperty = function(oldProperty, newProperty) {
11559 var oldNameNs = oldProperty.ns;
11561 var props = this.properties,
11562 propertiesByName = this.propertiesByName,
11563 rename = oldProperty.name !== newProperty.name;
11565 if (oldProperty.isBody) {
11567 if (!newProperty.isBody) {
11569 'property <' + newProperty.ns.name + '> must be body property ' +
11570 'to refine <' + oldProperty.ns.name + '>');
11573 // TODO: Check compatibility
11574 this.setBodyProperty(newProperty, false);
11577 // replacing the named property is intentional
11578 // thus, validate only if this is a "rename" operation
11579 this.addNamedProperty(newProperty, rename);
11581 // replace old property at index with new one
11582 var idx = props.indexOf(oldProperty);
11584 throw new Error('property <' + oldNameNs.name + '> not found in property list');
11587 props[idx] = newProperty;
11589 // replace propertiesByName entry with new property
11590 propertiesByName[oldNameNs.name] = propertiesByName[oldNameNs.localName] = newProperty;
11594 DescriptorBuilder.prototype.redefineProperty = function(p) {
11596 var nsPrefix = p.ns.prefix;
11597 var parts = p.redefines.split('#');
11599 var name = parseNameNs(parts[0], nsPrefix);
11600 var attrName = parseNameNs(parts[1], name.prefix).name;
11602 var redefinedProperty = this.propertiesByName[attrName];
11603 if (!redefinedProperty) {
11604 throw new Error('refined property <' + attrName + '> not found');
11606 this.replaceProperty(redefinedProperty, p);
11609 delete p.redefines;
11612 DescriptorBuilder.prototype.addNamedProperty = function(p, validate) {
11614 propsByName = this.propertiesByName;
11617 this.assertNotDefined(p, ns.name);
11618 this.assertNotDefined(p, ns.localName);
11621 propsByName[ns.name] = propsByName[ns.localName] = p;
11624 DescriptorBuilder.prototype.removeNamedProperty = function(p) {
11626 propsByName = this.propertiesByName;
11628 delete propsByName[ns.name];
11629 delete propsByName[ns.localName];
11632 DescriptorBuilder.prototype.setBodyProperty = function(p, validate) {
11634 if (validate && this.bodyProperty) {
11636 'body property defined multiple times ' +
11637 '(<' + this.bodyProperty.ns.name + '>, <' + p.ns.name + '>)');
11640 this.bodyProperty = p;
11643 DescriptorBuilder.prototype.addIdProperty = function(name) {
11644 var nameNs = parseNameNs(name, this.ns.prefix);
11647 name: nameNs.localName,
11653 // ensure that id is always the first attribute (if present)
11654 this.addProperty(p, 0);
11657 DescriptorBuilder.prototype.assertNotDefined = function(p, name) {
11658 var propertyName = p.name,
11659 definedProperty = this.propertiesByName[propertyName];
11661 if (definedProperty) {
11663 'property <' + propertyName + '> already defined; ' +
11664 'override of <' + definedProperty.definedBy.ns.name + '#' + definedProperty.ns.name + '> by ' +
11665 '<' + p.definedBy.ns.name + '#' + p.ns.name + '> not allowed without redefines');
11669 DescriptorBuilder.prototype.hasProperty = function(name) {
11670 return this.propertiesByName[name];
11673 DescriptorBuilder.prototype.addTrait = function(t) {
11675 var allTypes = this.allTypes;
11677 if (allTypes.indexOf(t) !== -1) {
11681 forEach(t.properties, function(p) {
11683 // clone property to allow extensions
11684 p = assign({}, p, {
11685 name: p.ns.localName
11688 Object.defineProperty(p, 'definedBy', {
11692 // add redefine support
11694 this.redefineProperty(p);
11697 this.setBodyProperty(p);
11699 this.addProperty(p);
11707 "./ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
11708 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
11709 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
11710 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
11712 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\factory.js": [function(require, module, exports) {
11715 var forEach = require('lodash/collection/forEach');
11717 var Base = require('./base');
11720 function Factory(model, properties) {
11721 this.model = model;
11722 this.properties = properties;
11725 module.exports = Factory;
11728 Factory.prototype.createType = function(descriptor) {
11730 var model = this.model;
11732 var props = this.properties,
11733 prototype = Object.create(Base.prototype);
11735 // initialize default values
11736 forEach(descriptor.properties, function(p) {
11737 if (!p.isMany && p.default !== undefined) {
11738 prototype[p.name] = p.default;
11742 props.defineModel(prototype, model);
11743 props.defineDescriptor(prototype, descriptor);
11745 var name = descriptor.ns.name;
11748 * The new type constructor
11750 function ModdleElement(attrs) {
11751 props.define(this, '$type', {
11755 props.define(this, '$attrs', {
11758 props.define(this, '$parent', {
11762 forEach(attrs, function(val, key) {
11763 this.set(key, val);
11767 ModdleElement.prototype = prototype;
11769 ModdleElement.hasType = prototype.$instanceOf = this.model.hasType;
11772 props.defineModel(ModdleElement, model);
11773 props.defineDescriptor(ModdleElement, descriptor);
11775 return ModdleElement;
11778 "./base": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\base.js",
11779 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
11781 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\moddle.js": [function(require, module, exports) {
11784 var isString = require('lodash/lang/isString'),
11785 isObject = require('lodash/lang/isObject'),
11786 forEach = require('lodash/collection/forEach'),
11787 find = require('lodash/collection/find');
11790 var Factory = require('./factory'),
11791 Registry = require('./registry'),
11792 Properties = require('./properties');
11794 var parseNameNs = require('./ns').parseName;
11797 // // Moddle implementation /////////////////////////////////////////////////
11802 * A model that can be used to create elements of a specific type.
11806 * var Moddle = require('moddle');
11808 * var pkg = { name: 'mypackage', prefix: 'my', types: [ { name: 'Root' } ] };
11810 * var moddle = new Moddle([pkg]);
11813 * <Package>} packages the packages to contain
11815 * options additional options to pass to the model
11817 function Moddle(packages, options) {
11819 options = options || {};
11821 this.properties = new Properties(this);
11823 this.factory = new Factory(this, this.properties);
11824 this.registry = new Registry(packages, this.properties, options);
11826 this.typeCache = {};
11829 module.exports = Moddle;
11833 * Create an instance of the specified type.
11835 * @method Moddle#create
11839 * var foo = moddle.create('my:Foo'); var bar = moddle.create('my:Bar', { id:
11842 * @param {String|Object}
11843 * descriptor the type descriptor or name know to the model
11845 * attrs a number of attributes to initialize the model instance with
11846 * @return {Object} model instance
11848 Moddle.prototype.create = function(descriptor, attrs) {
11849 var Type = this.getType(descriptor);
11852 throw new Error('unknown type <' + descriptor + '>');
11855 return new Type(attrs);
11860 * Returns the type representing a given descriptor
11862 * @method Moddle#getType
11866 * var Foo = moddle.getType('my:Foo'); var foo = new Foo({ 'id' : 'FOO_1' });
11868 * @param {String|Object}
11869 * descriptor the type descriptor or name know to the model
11870 * @return {Object} the type representing the descriptor
11872 Moddle.prototype.getType = function(descriptor) {
11874 var cache = this.typeCache;
11876 var name = isString(descriptor) ? descriptor : descriptor.ns.name;
11878 var type = cache[name];
11881 descriptor = this.registry.getEffectiveDescriptor(name);
11882 type = cache[name] = this.factory.createType(descriptor);
11890 * Creates an any-element type to be used within model instances.
11892 * This can be used to create custom elements that lie outside the meta-model.
11893 * The created element contains all the meta-data required to serialize it as
11894 * part of meta-model elements.
11896 * @method Moddle#createAny
11900 * var foo = moddle.createAny('vendor:Foo', 'http://vendor', { value: 'bar' });
11902 * var container = moddle.create('my:Container', 'http://my', { any: [ foo ] });
11903 * // go ahead and serialize the stuff
11907 * name the name of the element
11909 * nsUri the namespace uri of the element
11911 * [properties] a map of properties to initialize the instance with
11912 * @return {Object} the any type instance
11914 Moddle.prototype.createAny = function(name, nsUri, properties) {
11916 var nameNs = parseNameNs(name);
11926 prefix: nameNs.prefix,
11927 localName: nameNs.localName,
11932 this.properties.defineDescriptor(element, descriptor);
11933 this.properties.defineModel(element, this);
11934 this.properties.define(element, '$parent', {
11939 forEach(properties, function(a, key) {
11940 if (isObject(a) && a.value !== undefined) {
11941 element[a.name] = a.value;
11951 * Returns a registered package by uri or prefix
11953 * @return {Object} the package
11955 Moddle.prototype.getPackage = function(uriOrPrefix) {
11956 return this.registry.getPackage(uriOrPrefix);
11960 * Returns a snapshot of all known packages
11962 * @return {Object} the package
11964 Moddle.prototype.getPackages = function() {
11965 return this.registry.getPackages();
11969 * Returns the descriptor for an element
11971 Moddle.prototype.getElementDescriptor = function(element) {
11972 return element.$descriptor;
11976 * Returns true if the given descriptor or instance represents the given type.
11978 * May be applied to this, if element is omitted.
11980 Moddle.prototype.hasType = function(element, type) {
11981 if (type === undefined) {
11986 var descriptor = element.$model.getElementDescriptor(element);
11988 return !!find(descriptor.allTypes, function(t) {
11989 return t.name === type;
11995 * Returns the descriptor of an elements named property
11997 Moddle.prototype.getPropertyDescriptor = function(element, property) {
11998 return this.getElementDescriptor(element).propertiesByName[property];
12002 "./factory": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\factory.js",
12003 "./ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
12004 "./properties": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\properties.js",
12005 "./registry": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\registry.js",
12006 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
12007 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
12008 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
12009 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js"
12011 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js": [function(require, module, exports) {
12015 * Parses a namespaced attribute name of the form (ns:)localName to an object,
12016 * given a default prefix to assume in case no explicit namespace is given.
12021 * [defaultPrefix] the default prefix to take, if none is present.
12023 * @return {Object} the parsed name
12025 module.exports.parseName = function(name, defaultPrefix) {
12026 var parts = name.split(/:/),
12029 // no prefix (i.e. only local name)
12030 if (parts.length === 1) {
12032 prefix = defaultPrefix;
12034 // prefix + local name
12035 if (parts.length === 2) {
12036 localName = parts[1];
12039 throw new Error('expected <prefix:localName> or <localName>, got ' + name);
12042 name = (prefix ? prefix + ':' : '') + localName;
12047 localName: localName
12051 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\properties.js": [function(require, module, exports) {
12056 * A utility that gets and sets properties of model elements.
12061 function Properties(model) {
12062 this.model = model;
12065 module.exports = Properties;
12069 * Sets a named property on the target element
12078 Properties.prototype.set = function(target, name, value) {
12080 var property = this.model.getPropertyDescriptor(target, name);
12083 target.$attrs[name] = value;
12085 Object.defineProperty(target, property.name, {
12086 enumerable: !property.isReference,
12094 * Returns the named property of the given element
12103 Properties.prototype.get = function(target, name) {
12105 var property = this.model.getPropertyDescriptor(target, name);
12108 return target.$attrs[name];
12111 var propertyName = property.name;
12113 // check if access to collection property and lazily initialize it
12114 if (!target[propertyName] && property.isMany) {
12115 Object.defineProperty(target, propertyName, {
12116 enumerable: !property.isReference,
12122 return target[propertyName];
12127 * Define a property on the target element
12136 Properties.prototype.define = function(target, name, options) {
12137 Object.defineProperty(target, name, options);
12142 * Define the descriptor for an element
12144 Properties.prototype.defineDescriptor = function(target, descriptor) {
12145 this.define(target, '$descriptor', {
12151 * Define the model for an element
12153 Properties.prototype.defineModel = function(target, model) {
12154 this.define(target, '$model', {
12159 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\registry.js": [function(require, module, exports) {
12162 var assign = require('lodash/object/assign'),
12163 forEach = require('lodash/collection/forEach');
12165 var Types = require('./types'),
12166 DescriptorBuilder = require('./descriptor-builder');
12168 var parseNameNs = require('./ns').parseName,
12169 isBuiltInType = Types.isBuiltIn;
12172 function Registry(packages, properties, options) {
12174 this.options = assign({
12178 this.packageMap = {};
12181 this.packages = [];
12183 this.properties = properties;
12185 forEach(packages, this.registerPackage, this);
12188 module.exports = Registry;
12191 Registry.prototype.getPackage = function(uriOrPrefix) {
12192 return this.packageMap[uriOrPrefix];
12195 Registry.prototype.getPackages = function() {
12196 return this.packages;
12200 Registry.prototype.registerPackage = function(pkg) {
12201 // alert("pkg :: " + pkg);
12203 pkg = assign({}, pkg);
12206 forEach(pkg.types, function(descriptor) {
12207 this.registerType(descriptor, pkg);
12210 this.packageMap[pkg.uri] = this.packageMap[pkg.prefix] = pkg;
12211 this.packages.push(pkg);
12216 * Register a type from a specific package with us
12218 Registry.prototype.registerType = function(type, pkg) {
12220 type = assign({}, type, {
12221 superClass: (type.superClass || []).slice(),
12222 extends: (type.extends || []).slice(),
12223 properties: (type.properties || []).slice()
12226 var ns = parseNameNs(type.name, pkg.prefix),
12228 propertiesByName = {};
12230 // parse properties
12231 forEach(type.properties, function(p) {
12233 // namespace property names
12234 var propertyNs = parseNameNs(p.name, ns.prefix),
12235 propertyName = propertyNs.name;
12237 // namespace property types
12238 if (!isBuiltInType(p.type)) {
12239 p.type = parseNameNs(p.type, propertyNs.prefix).name;
12247 propertiesByName[propertyName] = p;
12250 // update ns + name
12254 propertiesByName: propertiesByName
12257 forEach(type.extends, function(extendsName) {
12258 var extended = this.typeMap[extendsName];
12260 extended.traits = extended.traits || [];
12261 extended.traits.push(name);
12265 this.definePackage(type, pkg);
12268 this.typeMap[name] = type;
12273 * Traverse the type hierarchy from bottom to top.
12275 Registry.prototype.mapTypes = function(nsName, iterator) {
12277 // alert("nsName :: " + nsName.name);
12278 var type = isBuiltInType(nsName.name) ? {
12280 } : this.typeMap[nsName.name];
12281 // alert("Type :: " + type);
12286 * Traverse the selected super type or trait
12291 function traverseSuper(cls) {
12292 var parentNs = parseNameNs(cls, isBuiltInType(cls) ? '' : nsName.prefix);
12293 self.mapTypes(parentNs, iterator);
12297 throw new Error('unknown type <' + nsName.name + '>');
12300 forEach(type.superClass, traverseSuper);
12304 forEach(type.traits, traverseSuper);
12309 * Returns the effective descriptor for a type.
12312 * type the namespaced name (ns:localName) of the type
12314 * @return {Descriptor} the resulting effective descriptor
12316 Registry.prototype.getEffectiveDescriptor = function(name) {
12318 var nsName = parseNameNs(name);
12320 var builder = new DescriptorBuilder(nsName);
12322 this.mapTypes(nsName, function(type) {
12323 builder.addTrait(type);
12326 // check we have an id assigned
12327 var id = this.options.generateId;
12328 if (id && !builder.hasProperty(id)) {
12329 builder.addIdProperty(id);
12332 var descriptor = builder.build();
12334 // define package link
12335 this.definePackage(descriptor, descriptor.allTypes[descriptor.allTypes.length - 1].$pkg);
12341 Registry.prototype.definePackage = function(target, pkg) {
12342 this.properties.define(target, '$pkg', {
12347 "./descriptor-builder": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\descriptor-builder.js",
12348 "./ns": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\ns.js",
12349 "./types": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js",
12350 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
12351 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
12353 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\node_modules\\moddle\\lib\\types.js": [function(require, module, exports) {
12357 * Built-in moddle types
12368 * Converters for built in types from string representations
12370 var TYPE_CONVERTERS = {
12371 String: function(s) {
12374 Boolean: function(s) {
12375 return s === 'true';
12377 Integer: function(s) {
12378 return parseInt(s, 10);
12380 Real: function(s) {
12381 return parseFloat(s, 10);
12386 * Convert a type to its real representation
12388 module.exports.coerceType = function(type, value) {
12390 var converter = TYPE_CONVERTERS[type];
12393 return converter(value);
12400 * Return whether the given type is built-in
12402 module.exports.isBuiltIn = function(type) {
12403 return !!BUILTINS[type];
12407 * Return whether the given type is simple
12409 module.exports.isSimple = function(type) {
12410 return !!TYPE_CONVERTERS[type];
12413 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmn.json": [function(require, module, exports) {
12416 "uri": "http://www.omg.org/spec/BPMN/20100524/MODEL",
12417 "associations": [],
12419 "name": "Interface",
12428 "name": "operations",
12429 "type": "Operation",
12432 "name": "implementationRef",
12437 "name": "Operation",
12446 "name": "inMessageRef",
12449 "isReference": true
12451 "name": "outMessageRef",
12454 "isReference": true
12456 "name": "errorRefs",
12459 "isReference": true
12461 "name": "implementationRef",
12466 "name": "EndPoint",
12471 "name": "Auditing",
12476 "name": "GlobalTask",
12481 "name": "resources",
12482 "type": "ResourceRole",
12486 "name": "Monitoring",
12491 "name": "Performer",
12498 "FlowElementsContainer",
12502 "name": "processType",
12503 "type": "ProcessType",
12506 "name": "isClosed",
12510 "name": "auditing",
12513 "name": "monitoring",
12514 "type": "Monitoring"
12516 "name": "properties",
12517 "type": "Property",
12520 "name": "supports",
12523 "isReference": true
12525 "name": "definitionalCollaborationRef",
12526 "type": "Collaboration",
12528 "isReference": true
12530 "name": "isExecutable",
12534 "name": "resources",
12535 "type": "ResourceRole",
12538 "name": "artifacts",
12539 "type": "Artifact",
12542 "name": "correlationSubscriptions",
12543 "type": "CorrelationSubscription",
12570 "name": "childLaneSet",
12572 "serialize": "xsi:type"
12574 "name": "partitionElementRef",
12575 "type": "BaseElement",
12577 "isReference": true
12579 "name": "flowNodeRef",
12580 "type": "FlowNode",
12582 "isReference": true
12584 "name": "partitionElement",
12585 "type": "BaseElement"
12588 "name": "GlobalManualTask",
12593 "name": "ManualTask",
12598 "name": "UserTask",
12603 "name": "renderings",
12604 "type": "Rendering",
12607 "name": "implementation",
12612 "name": "Rendering",
12617 "name": "HumanPerformer",
12622 "name": "PotentialOwner",
12627 "name": "GlobalUserTask",
12632 "name": "implementation",
12636 "name": "renderings",
12637 "type": "Rendering",
12642 "isAbstract": true,
12647 "name": "gatewayDirection",
12648 "type": "GatewayDirection",
12649 "default": "Unspecified",
12653 "name": "EventBasedGateway",
12658 "name": "instantiate",
12663 "name": "eventGatewayType",
12664 "type": "EventBasedGatewayType",
12666 "default": "Exclusive"
12669 "name": "ComplexGateway",
12674 "name": "activationCondition",
12675 "type": "Expression",
12676 "serialize": "xsi:type"
12679 "type": "SequenceFlow",
12681 "isReference": true
12684 "name": "ExclusiveGateway",
12690 "type": "SequenceFlow",
12692 "isReference": true
12695 "name": "InclusiveGateway",
12701 "type": "SequenceFlow",
12703 "isReference": true
12706 "name": "ParallelGateway",
12711 "name": "RootElement",
12712 "isAbstract": true,
12717 "name": "Relationship",
12726 "name": "direction",
12727 "type": "RelationshipDirection",
12732 "isReference": true,
12737 "isReference": true,
12741 "name": "BaseElement",
12742 "isAbstract": true,
12748 "name": "documentation",
12749 "type": "Documentation",
12752 "name": "extensionDefinitions",
12753 "type": "ExtensionDefinition",
12755 "isReference": true
12757 "name": "extensionElements",
12758 "type": "ExtensionElements"
12761 "name": "Extension",
12763 "name": "mustUnderstand",
12768 "name": "definition",
12769 "type": "ExtensionDefinition"
12772 "name": "ExtensionDefinition",
12778 "name": "extensionAttributeDefinitions",
12779 "type": "ExtensionAttributeDefinition",
12783 "name": "ExtensionAttributeDefinition",
12793 "name": "isReference",
12798 "name": "extensionDefinition",
12799 "type": "ExtensionDefinition",
12801 "isReference": true
12804 "name": "ExtensionElements",
12806 "name": "valueRef",
12808 "isReference": true,
12815 "name": "extensionAttributeDefinition",
12816 "type": "ExtensionAttributeDefinition",
12818 "isReference": true
12821 "name": "Documentation",
12830 "name": "textFormat",
12831 "default": "text/plain",
12837 "isAbstract": true,
12843 "name": "properties",
12844 "type": "Property",
12848 "name": "IntermediateCatchEvent",
12853 "name": "IntermediateThrowEvent",
12858 "name": "EndEvent",
12863 "name": "StartEvent",
12868 "name": "isInterrupting",
12874 "name": "MultiBranchConnector",
12879 "name": "isInterrupting",
12885 "name": "ParentReturn",
12891 "name": "SubProcessCall",
12897 "name": "ThrowEvent",
12898 "isAbstract": true,
12903 "name": "inputSet",
12906 "name": "eventDefinitionRefs",
12907 "type": "EventDefinition",
12909 "isReference": true
12911 "name": "dataInputAssociation",
12912 "type": "DataInputAssociation",
12915 "name": "dataInputs",
12916 "type": "DataInput",
12919 "name": "eventDefinitions",
12920 "type": "EventDefinition",
12924 "name": "CatchEvent",
12925 "isAbstract": true,
12930 "name": "parallelMultiple",
12935 "name": "outputSet",
12936 "type": "OutputSet"
12938 "name": "eventDefinitionRefs",
12939 "type": "EventDefinition",
12941 "isReference": true
12943 "name": "dataOutputAssociation",
12944 "type": "DataOutputAssociation",
12947 "name": "dataOutputs",
12948 "type": "DataOutput",
12951 "name": "eventDefinitions",
12952 "type": "EventDefinition",
12956 "name": "BoundaryEvent",
12961 "name": "cancelActivity",
12966 "name": "attachedToRef",
12967 "type": "Activity",
12969 "isReference": true
12972 "name": "EventDefinition",
12973 "isAbstract": true,
12978 "name": "CancelEventDefinition",
12983 "name": "ErrorEventDefinition",
12988 "name": "errorRef",
12991 "isReference": true
12994 "name": "TerminateEventDefinition",
12999 "name": "EscalationEventDefinition",
13004 "name": "escalationRef",
13005 "type": "Escalation",
13007 "isReference": true
13010 "name": "Escalation",
13012 "name": "structureRef",
13013 "type": "ItemDefinition",
13015 "isReference": true
13021 "name": "escalationCode",
13029 "name": "CompensateEventDefinition",
13034 "name": "waitForCompletion",
13038 "name": "activityRef",
13039 "type": "Activity",
13041 "isReference": true
13044 "name": "TimerEventDefinition",
13049 "name": "timeDate",
13050 "type": "Expression",
13051 "serialize": "xsi:type"
13053 "name": "timeCycle",
13054 "type": "Expression",
13055 "serialize": "xsi:type"
13057 "name": "timeDuration",
13058 "type": "Expression",
13059 "serialize": "xsi:type"
13062 "name": "LinkEventDefinition",
13072 "type": "LinkEventDefinition",
13074 "isReference": true
13077 "type": "LinkEventDefinition",
13079 "isReference": true
13082 "name": "MessageEventDefinition",
13087 "name": "messageRef",
13090 "isReference": true
13092 "name": "operationRef",
13093 "type": "Operation",
13095 "isReference": true
13098 "name": "ConditionalEventDefinition",
13103 "name": "condition",
13104 "type": "Expression",
13105 "serialize": "xsi:type"
13108 "name": "SignalEventDefinition",
13113 "name": "signalRef",
13116 "isReference": true
13124 "name": "structureRef",
13125 "type": "ItemDefinition",
13127 "isReference": true
13134 "name": "ImplicitThrowEvent",
13139 "name": "DataState",
13149 "name": "ItemAwareElement",
13154 "name": "itemSubjectRef",
13155 "type": "ItemDefinition",
13157 "isReference": true
13159 "name": "dataState",
13160 "type": "DataState"
13163 "name": "DataAssociation",
13168 "name": "transformation",
13169 "type": "FormalExpression"
13171 "name": "assignment",
13172 "type": "Assignment",
13175 "name": "sourceRef",
13176 "type": "ItemAwareElement",
13178 "isReference": true
13180 "name": "targetRef",
13181 "type": "ItemAwareElement",
13182 "isReference": true
13185 "name": "DataInput",
13194 "name": "isCollection",
13199 "name": "inputSetRefs",
13200 "type": "InputSet",
13203 "isReference": true
13205 "name": "inputSetWithOptional",
13206 "type": "InputSet",
13209 "isReference": true
13211 "name": "inputSetWithWhileExecuting",
13212 "type": "InputSet",
13215 "isReference": true
13218 "name": "DataOutput",
13227 "name": "isCollection",
13232 "name": "outputSetRefs",
13233 "type": "OutputSet",
13236 "isReference": true
13238 "name": "outputSetWithOptional",
13239 "type": "OutputSet",
13242 "isReference": true
13244 "name": "outputSetWithWhileExecuting",
13245 "type": "OutputSet",
13248 "isReference": true
13251 "name": "InputSet",
13260 "name": "dataInputRefs",
13261 "type": "DataInput",
13263 "isReference": true
13265 "name": "optionalInputRefs",
13266 "type": "DataInput",
13268 "isReference": true
13270 "name": "whileExecutingInputRefs",
13271 "type": "DataInput",
13273 "isReference": true
13275 "name": "outputSetRefs",
13276 "type": "OutputSet",
13278 "isReference": true
13281 "name": "OutputSet",
13286 "name": "dataOutputRefs",
13287 "type": "DataOutput",
13289 "isReference": true
13295 "name": "inputSetRefs",
13296 "type": "InputSet",
13298 "isReference": true
13300 "name": "optionalOutputRefs",
13301 "type": "DataOutput",
13303 "isReference": true
13305 "name": "whileExecutingOutputRefs",
13306 "type": "DataOutput",
13308 "isReference": true
13311 "name": "Property",
13321 "name": "DataInputAssociation",
13326 "name": "DataOutputAssociation",
13331 "name": "InputOutputSpecification",
13336 "name": "inputSets",
13337 "type": "InputSet",
13340 "name": "outputSets",
13341 "type": "OutputSet",
13344 "name": "dataInputs",
13345 "type": "DataInput",
13348 "name": "dataOutputs",
13349 "type": "DataOutput",
13353 "name": "DataObject",
13359 "name": "isCollection",
13365 "name": "InputOutputBinding",
13367 "name": "inputDataRef",
13368 "type": "InputSet",
13370 "isReference": true
13372 "name": "outputDataRef",
13373 "type": "OutputSet",
13375 "isReference": true
13377 "name": "operationRef",
13378 "type": "Operation",
13380 "isReference": true
13383 "name": "Assignment",
13389 "type": "Expression",
13390 "serialize": "xsi:type"
13393 "type": "Expression",
13394 "serialize": "xsi:type"
13397 "name": "DataStore",
13407 "name": "capacity",
13411 "name": "isUnlimited",
13417 "name": "DataStoreReference",
13419 "ItemAwareElement",
13423 "name": "dataStoreRef",
13424 "type": "DataStore",
13426 "isReference": true
13429 "name": "DataObjectReference",
13431 "ItemAwareElement",
13435 "name": "dataObjectRef",
13436 "type": "DataObject",
13438 "isReference": true
13441 "name": "ConversationLink",
13446 "name": "sourceRef",
13447 "type": "InteractionNode",
13449 "isReference": true
13451 "name": "targetRef",
13452 "type": "InteractionNode",
13454 "isReference": true
13461 "name": "ConversationAssociation",
13466 "name": "innerConversationNodeRef",
13467 "type": "ConversationNode",
13469 "isReference": true
13471 "name": "outerConversationNodeRef",
13472 "type": "ConversationNode",
13474 "isReference": true
13477 "name": "CallConversation",
13482 "name": "calledCollaborationRef",
13483 "type": "Collaboration",
13485 "isReference": true
13487 "name": "participantAssociations",
13488 "type": "ParticipantAssociation",
13492 "name": "Conversation",
13497 "name": "SubConversation",
13502 "name": "conversationNodes",
13503 "type": "ConversationNode",
13507 "name": "ConversationNode",
13508 "isAbstract": true,
13518 "name": "participantRefs",
13519 "type": "Participant",
13521 "isReference": true
13523 "name": "messageFlowRefs",
13524 "type": "MessageFlow",
13526 "isReference": true
13528 "name": "correlationKeys",
13529 "type": "CorrelationKey",
13533 "name": "GlobalConversation",
13538 "name": "PartnerEntity",
13547 "name": "participantRef",
13548 "type": "Participant",
13550 "isReference": true
13553 "name": "PartnerRole",
13562 "name": "participantRef",
13563 "type": "Participant",
13565 "isReference": true
13568 "name": "CorrelationProperty",
13573 "name": "correlationPropertyRetrievalExpression",
13574 "type": "CorrelationPropertyRetrievalExpression",
13582 "type": "ItemDefinition",
13584 "isReference": true
13592 "name": "structureRef",
13593 "type": "ItemDefinition",
13595 "isReference": true
13601 "name": "errorCode",
13606 "name": "CorrelationKey",
13611 "name": "correlationPropertyRef",
13612 "type": "CorrelationProperty",
13614 "isReference": true
13621 "name": "Expression",
13627 "name": "FormalExpression",
13632 "name": "language",
13640 "name": "evaluatesToTypeRef",
13641 "type": "ItemDefinition",
13643 "isReference": true
13656 "type": "ItemDefinition",
13658 "isReference": true
13661 "name": "ItemDefinition",
13666 "name": "itemKind",
13667 "type": "ItemKind",
13670 "name": "structureRef",
13674 "name": "isCollection",
13682 "isReference": true
13685 "name": "FlowElement",
13686 "isAbstract": true,
13695 "name": "auditing",
13698 "name": "monitoring",
13699 "type": "Monitoring"
13701 "name": "categoryValueRef",
13702 "type": "CategoryValue",
13704 "isReference": true
13707 "name": "SequenceFlow",
13712 "name": "isImmediate",
13716 "name": "conditionExpression",
13717 "type": "Expression",
13718 "serialize": "xsi:type"
13720 "name": "sourceRef",
13721 "type": "FlowNode",
13723 "isReference": true
13725 "name": "targetRef",
13726 "type": "FlowNode",
13728 "isReference": true
13731 "name": "FlowElementsContainer",
13732 "isAbstract": true,
13737 "name": "laneSets",
13741 "name": "flowElements",
13742 "type": "FlowElement",
13746 "name": "CallableElement",
13747 "isAbstract": true,
13756 "name": "ioSpecification",
13757 "type": "InputOutputSpecification"
13759 "name": "supportedInterfaceRefs",
13760 "type": "Interface",
13762 "isReference": true
13764 "name": "ioBinding",
13765 "type": "InputOutputBinding",
13769 "name": "FlowNode",
13770 "isAbstract": true,
13775 "name": "incoming",
13776 "type": "SequenceFlow",
13778 "isReference": true
13780 "name": "outgoing",
13781 "type": "SequenceFlow",
13783 "isReference": true
13789 "isReference": true
13792 "name": "CorrelationPropertyRetrievalExpression",
13797 "name": "messagePath",
13798 "type": "FormalExpression"
13800 "name": "messageRef",
13803 "isReference": true
13806 "name": "CorrelationPropertyBinding",
13811 "name": "dataPath",
13812 "type": "FormalExpression"
13814 "name": "correlationPropertyRef",
13815 "type": "CorrelationProperty",
13817 "isReference": true
13820 "name": "Resource",
13829 "name": "resourceParameters",
13830 "type": "ResourceParameter",
13834 "name": "ResourceParameter",
13843 "name": "isRequired",
13848 "type": "ItemDefinition",
13850 "isReference": true
13853 "name": "CorrelationSubscription",
13858 "name": "correlationKeyRef",
13859 "type": "CorrelationKey",
13861 "isReference": true
13863 "name": "correlationPropertyBinding",
13864 "type": "CorrelationPropertyBinding",
13868 "name": "MessageFlow",
13877 "name": "sourceRef",
13878 "type": "InteractionNode",
13880 "isReference": true
13882 "name": "targetRef",
13883 "type": "InteractionNode",
13885 "isReference": true
13887 "name": "messageRef",
13890 "isReference": true
13893 "name": "MessageFlowAssociation",
13898 "name": "innerMessageFlowRef",
13899 "type": "MessageFlow",
13901 "isReference": true
13903 "name": "outerMessageFlowRef",
13904 "type": "MessageFlow",
13906 "isReference": true
13909 "name": "InteractionNode",
13910 "isAbstract": true,
13912 "name": "incomingConversationLinks",
13913 "type": "ConversationLink",
13916 "isReference": true
13918 "name": "outgoingConversationLinks",
13919 "type": "ConversationLink",
13922 "isReference": true
13925 "name": "Participant",
13935 "name": "interfaceRefs",
13936 "type": "Interface",
13938 "isReference": true
13940 "name": "participantMultiplicity",
13941 "type": "ParticipantMultiplicity"
13943 "name": "endPointRefs",
13944 "type": "EndPoint",
13946 "isReference": true
13948 "name": "processRef",
13951 "isReference": true
13954 "name": "ParticipantAssociation",
13959 "name": "innerParticipantRef",
13960 "type": "Participant",
13962 "isReference": true
13964 "name": "outerParticipantRef",
13965 "type": "Participant",
13967 "isReference": true
13970 "name": "ParticipantMultiplicity",
13983 "name": "Collaboration",
13992 "name": "isClosed",
13996 "name": "choreographyRef",
13997 "type": "Choreography",
13999 "isReference": true
14001 "name": "artifacts",
14002 "type": "Artifact",
14005 "name": "participantAssociations",
14006 "type": "ParticipantAssociation",
14009 "name": "messageFlowAssociations",
14010 "type": "MessageFlowAssociation",
14013 "name": "conversationAssociations",
14014 "type": "ConversationAssociation"
14016 "name": "participants",
14017 "type": "Participant",
14020 "name": "messageFlows",
14021 "type": "MessageFlow",
14024 "name": "correlationKeys",
14025 "type": "CorrelationKey",
14028 "name": "conversations",
14029 "type": "ConversationNode",
14032 "name": "conversationLinks",
14033 "type": "ConversationLink",
14037 "name": "ChoreographyActivity",
14038 "isAbstract": true,
14043 "name": "participantRefs",
14044 "type": "Participant",
14046 "isReference": true
14048 "name": "initiatingParticipantRef",
14049 "type": "Participant",
14051 "isReference": true
14053 "name": "correlationKeys",
14054 "type": "CorrelationKey",
14057 "name": "loopType",
14058 "type": "ChoreographyLoopType",
14063 "name": "CallChoreography",
14065 "ChoreographyActivity"
14068 "name": "calledChoreographyRef",
14069 "type": "Choreography",
14071 "isReference": true
14073 "name": "participantAssociations",
14074 "type": "ParticipantAssociation",
14078 "name": "SubChoreography",
14080 "ChoreographyActivity",
14081 "FlowElementsContainer"
14084 "name": "artifacts",
14085 "type": "Artifact",
14089 "name": "ChoreographyTask",
14091 "ChoreographyActivity"
14094 "name": "messageFlowRef",
14095 "type": "MessageFlow",
14097 "isReference": true
14100 "name": "Choreography",
14102 "FlowElementsContainer",
14106 "name": "GlobalChoreographyTask",
14111 "name": "initiatingParticipantRef",
14112 "type": "Participant",
14114 "isReference": true
14117 "name": "TextAnnotation",
14125 "name": "textFormat",
14126 "default": "text/plain",
14136 "name": "categoryValueRef",
14137 "type": "CategoryValue",
14139 "isReference": true
14142 "name": "Association",
14147 "name": "associationDirection",
14148 "type": "AssociationDirection",
14151 "name": "sourceRef",
14152 "type": "BaseElement",
14154 "isReference": true
14156 "name": "targetRef",
14157 "type": "BaseElement",
14159 "isReference": true
14162 "name": "Category",
14167 "name": "categoryValue",
14168 "type": "CategoryValue",
14176 "name": "Artifact",
14177 "isAbstract": true,
14182 "name": "CategoryValue",
14187 "name": "categorizedFlowElements",
14188 "type": "FlowElement",
14191 "isReference": true
14198 "name": "Activity",
14199 "isAbstract": true,
14204 "name": "isForCompensation",
14209 "name": "loopCharacteristics",
14210 "type": "LoopCharacteristics"
14212 "name": "resources",
14213 "type": "ResourceRole",
14217 "type": "SequenceFlow",
14219 "isReference": true
14221 "name": "properties",
14222 "type": "Property",
14225 "name": "ioSpecification",
14226 "type": "InputOutputSpecification"
14228 "name": "boundaryEventRefs",
14229 "type": "BoundaryEvent",
14231 "isReference": true
14233 "name": "dataInputAssociations",
14234 "type": "DataInputAssociation",
14237 "name": "dataOutputAssociations",
14238 "type": "DataOutputAssociation",
14241 "name": "startQuantity",
14246 "name": "completionQuantity",
14252 "name": "ServiceTask",
14257 "name": "implementation",
14261 "name": "operationRef",
14262 "type": "Operation",
14264 "isReference": true
14267 "name": "SubProcess",
14270 "FlowElementsContainer",
14274 "name": "triggeredByEvent",
14279 "name": "artifacts",
14280 "type": "Artifact",
14284 "name": "LoopCharacteristics",
14285 "isAbstract": true,
14290 "name": "MultiInstanceLoopCharacteristics",
14292 "LoopCharacteristics"
14295 "name": "isSequential",
14300 "name": "behavior",
14301 "type": "MultiInstanceBehavior",
14305 "name": "loopCardinality",
14306 "type": "Expression",
14307 "serialize": "xsi:type"
14309 "name": "loopDataInputRef",
14310 "type": "ItemAwareElement",
14312 "isReference": true
14314 "name": "loopDataOutputRef",
14315 "type": "ItemAwareElement",
14317 "isReference": true
14319 "name": "inputDataItem",
14320 "type": "DataInput"
14322 "name": "outputDataItem",
14323 "type": "DataOutput"
14325 "name": "completionCondition",
14326 "type": "Expression",
14327 "serialize": "xsi:type"
14329 "name": "complexBehaviorDefinition",
14330 "type": "ComplexBehaviorDefinition",
14333 "name": "oneBehaviorEventRef",
14334 "type": "EventDefinition",
14336 "isReference": true
14338 "name": "noneBehaviorEventRef",
14339 "type": "EventDefinition",
14341 "isReference": true
14344 "name": "StandardLoopCharacteristics",
14346 "LoopCharacteristics"
14349 "name": "testBefore",
14354 "name": "loopCondition",
14355 "type": "Expression",
14356 "serialize": "xsi:type"
14358 "name": "loopMaximum",
14359 "type": "Expression",
14360 "serialize": "xsi:type"
14363 "name": "CallActivity",
14368 "name": "calledElement",
14379 "name": "InitiateProcess",
14385 "name": "Collector",
14391 "name": "StringMatch",
14397 "name": "VesCollector",
14429 "name": "SendTask",
14434 "name": "implementation",
14438 "name": "operationRef",
14439 "type": "Operation",
14441 "isReference": true
14443 "name": "messageRef",
14446 "isReference": true
14449 "name": "ReceiveTask",
14454 "name": "implementation",
14458 "name": "instantiate",
14463 "name": "operationRef",
14464 "type": "Operation",
14466 "isReference": true
14468 "name": "messageRef",
14471 "isReference": true
14474 "name": "ScriptTask",
14479 "name": "scriptFormat",
14487 "name": "BusinessRuleTask",
14492 "name": "implementation",
14497 "name": "AdHocSubProcess",
14502 "name": "completionCondition",
14503 "type": "Expression",
14504 "serialize": "xsi:type"
14506 "name": "ordering",
14507 "type": "AdHocOrdering",
14510 "name": "cancelRemainingInstances",
14516 "name": "Transaction",
14521 "name": "protocol",
14530 "name": "GlobalScriptTask",
14535 "name": "scriptLanguage",
14544 "name": "GlobalBusinessRuleTask",
14549 "name": "implementation",
14554 "name": "ComplexBehaviorDefinition",
14559 "name": "condition",
14560 "type": "FormalExpression"
14563 "type": "ImplicitThrowEvent"
14566 "name": "ResourceRole",
14571 "name": "resourceRef",
14572 "type": "Resource",
14573 "isReference": true
14575 "name": "resourceParameterBindings",
14576 "type": "ResourceParameterBinding",
14579 "name": "resourceAssignmentExpression",
14580 "type": "ResourceAssignmentExpression"
14587 "name": "ResourceParameterBinding",
14589 "name": "expression",
14590 "type": "Expression",
14591 "serialize": "xsi:type"
14593 "name": "parameterRef",
14594 "type": "ResourceParameter",
14596 "isReference": true
14599 "name": "ResourceAssignmentExpression",
14601 "name": "expression",
14602 "type": "Expression",
14603 "serialize": "xsi:type"
14608 "name": "importType",
14612 "name": "location",
14616 "name": "namespace",
14621 "name": "Definitions",
14630 "name": "targetNamespace",
14634 "name": "expressionLanguage",
14635 "default": "http://www.w3.org/1999/XPath",
14639 "name": "typeLanguage",
14640 "default": "http://www.w3.org/2001/XMLSchema",
14648 "name": "extensions",
14649 "type": "Extension",
14652 "name": "rootElements",
14653 "type": "RootElement",
14656 "name": "diagrams",
14658 "type": "bpmndi:BPMNDiagram"
14660 "name": "exporter",
14664 "name": "relationships",
14665 "type": "Relationship",
14668 "name": "exporterVersion",
14675 "name": "ProcessType",
14676 "literalValues": [{
14684 "name": "GatewayDirection",
14685 "literalValues": [{
14686 "name": "Unspecified"
14688 "name": "Converging"
14690 "name": "Diverging"
14695 "name": "EventBasedGatewayType",
14696 "literalValues": [{
14699 "name": "Exclusive"
14702 "name": "RelationshipDirection",
14703 "literalValues": [{
14713 "name": "ItemKind",
14714 "literalValues": [{
14717 "name": "Information"
14720 "name": "ChoreographyLoopType",
14721 "literalValues": [{
14726 "name": "MultiInstanceSequential"
14728 "name": "MultiInstanceParallel"
14731 "name": "AssociationDirection",
14732 "literalValues": [{
14740 "name": "MultiInstanceBehavior",
14741 "literalValues": [{
14751 "name": "AdHocOrdering",
14752 "literalValues": [{
14755 "name": "Sequential"
14760 "tagAlias": "lowerCase",
14765 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\bpmndi.json": [function(require, module, exports) {
14768 "uri": "http://www.omg.org/spec/BPMN/20100524/DI",
14770 "name": "BPMNDiagram",
14773 "type": "BPMNPlane",
14774 "redefines": "di:Diagram#rootElement"
14776 "name": "labelStyle",
14777 "type": "BPMNLabelStyle",
14784 "name": "BPMNPlane",
14786 "name": "bpmnElement",
14788 "isReference": true,
14789 "type": "bpmn:BaseElement",
14790 "redefines": "di:DiagramElement#modelElement"
14796 "name": "BPMNShape",
14798 "name": "bpmnElement",
14800 "isReference": true,
14801 "type": "bpmn:BaseElement",
14802 "redefines": "di:DiagramElement#modelElement"
14804 "name": "isHorizontal",
14808 "name": "isExpanded",
14812 "name": "isMarkerVisible",
14817 "type": "BPMNLabel"
14819 "name": "isMessageVisible",
14823 "name": "participantBandKind",
14824 "type": "ParticipantBandKind",
14827 "name": "choreographyActivityShape",
14828 "type": "BPMNShape",
14830 "isReference": true
14836 "name": "BPMNEdge",
14839 "type": "BPMNLabel"
14841 "name": "bpmnElement",
14843 "isReference": true,
14844 "type": "bpmn:BaseElement",
14845 "redefines": "di:DiagramElement#modelElement"
14847 "name": "sourceElement",
14849 "isReference": true,
14850 "type": "di:DiagramElement",
14851 "redefines": "di:Edge#source"
14853 "name": "targetElement",
14855 "isReference": true,
14856 "type": "di:DiagramElement",
14857 "redefines": "di:Edge#target"
14859 "name": "messageVisibleKind",
14860 "type": "MessageVisibleKind",
14862 "default": "initiating"
14868 "name": "BPMNLabel",
14870 "name": "labelStyle",
14871 "type": "BPMNLabelStyle",
14873 "isReference": true,
14874 "redefines": "di:DiagramElement#style"
14880 "name": "BPMNLabelStyle",
14890 "name": "ParticipantBandKind",
14891 "literalValues": [{
14892 "name": "top_initiating"
14894 "name": "middle_initiating"
14896 "name": "bottom_initiating"
14898 "name": "top_non_initiating"
14900 "name": "middle_non_initiating"
14902 "name": "bottom_non_initiating"
14905 "name": "MessageVisibleKind",
14906 "literalValues": [{
14907 "name": "initiating"
14909 "name": "non_initiating"
14912 "associations": [],
14916 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\dc.json": [function(require, module, exports) {
14919 "uri": "http://www.omg.org/spec/DD/20100524/DC",
14943 "name": "isItalic",
14947 "name": "isUnderline",
14951 "name": "isStrikeThrough",
14994 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\bpmn-moddle\\resources\\bpmn\\json\\di.json": [function(require, module, exports) {
14997 "uri": "http://www.omg.org/spec/DD/20100524/DI",
14999 "name": "DiagramElement",
15000 "isAbstract": true,
15002 "name": "extension",
15003 "type": "Extension"
15005 "name": "owningDiagram",
15007 "isReadOnly": true,
15009 "isReference": true
15011 "name": "owningElement",
15012 "type": "DiagramElement",
15013 "isReadOnly": true,
15015 "isReference": true
15017 "name": "modelElement",
15018 "isReadOnly": true,
15020 "isReference": true,
15025 "isReadOnly": true,
15027 "isReference": true
15029 "name": "ownedElement",
15030 "type": "DiagramElement",
15031 "isReadOnly": true,
15037 "isAbstract": true,
15043 "isAbstract": true,
15049 "type": "DiagramElement",
15050 "isReadOnly": true,
15052 "isReference": true
15055 "type": "DiagramElement",
15056 "isReadOnly": true,
15058 "isReference": true
15060 "name": "waypoint",
15063 "type": "dc:Point",
15064 "serialize": "xsi:type"
15068 "isAbstract": true,
15070 "name": "rootElement",
15071 "type": "DiagramElement",
15072 "isReadOnly": true,
15079 "name": "documentation",
15083 "name": "resolution",
15087 "name": "ownedStyle",
15089 "isReadOnly": true,
15095 "isAbstract": true,
15101 "type": "dc:Bounds"
15105 "isAbstract": true,
15110 "name": "planeElement",
15111 "type": "DiagramElement",
15112 "subsettedProperty": "DiagramElement-ownedElement",
15116 "name": "LabeledEdge",
15117 "isAbstract": true,
15122 "name": "ownedLabel",
15124 "isReadOnly": true,
15125 "subsettedProperty": "DiagramElement-ownedElement",
15130 "name": "LabeledShape",
15131 "isAbstract": true,
15136 "name": "ownedLabel",
15138 "isReadOnly": true,
15139 "subsettedProperty": "DiagramElement-ownedElement",
15145 "isAbstract": true,
15151 "type": "dc:Bounds"
15157 "name": "Extension",
15164 "associations": [],
15167 "tagAlias": "lowerCase"
15171 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\index.js": [function(require, module, exports) {
15173 __depends__: [require('diagram-js/lib/features/interaction-events')],
15174 __init__: ['directEditing'],
15175 directEditing: ['type', require('./lib/DirectEditing')]
15178 "./lib/DirectEditing": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\DirectEditing.js",
15179 "diagram-js/lib/features/interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js"
15181 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\DirectEditing.js": [function(require, module, exports) {
15184 var bind = require('lodash/function/bind'),
15185 find = require('lodash/collection/find');
15187 var TextBox = require('./TextBox');
15191 * A direct editing component that allows users to edit an elements text
15192 * directly in the diagram
15194 * @param {EventBus}
15195 * eventBus the event bus
15197 function DirectEditing(eventBus, canvas) {
15199 this._eventBus = eventBus;
15201 this._providers = [];
15202 this._textbox = new TextBox({
15203 container: canvas.getContainer(),
15204 keyHandler: bind(this._handleKey, this)
15208 DirectEditing.$inject = ['eventBus', 'canvas'];
15212 * Register a direct editing provider
15215 * provider the provider, must expose an #activate(element) method
15216 * that returns an activation context ({ bounds: {x, y, width, height },
15217 * text }) if direct editing is available for the given element.
15218 * Additionally the provider must expose a #update(element, value)
15219 * method to receive direct editing updates.
15221 DirectEditing.prototype.registerProvider = function(provider) {
15222 this._providers.push(provider);
15227 * Returns true if direct editing is currently active
15229 * @return {Boolean}
15231 DirectEditing.prototype.isActive = function() {
15232 return !!this._active;
15237 * Cancel direct editing, if it is currently active
15239 DirectEditing.prototype.cancel = function() {
15240 if (!this._active) {
15244 this._fire('cancel');
15249 DirectEditing.prototype._fire = function(event) {
15250 this._eventBus.fire('directEditing.' + event, {
15251 active: this._active
15255 DirectEditing.prototype.close = function() {
15256 this._textbox.destroy();
15258 this._fire('deactivate');
15260 this._active = null;
15264 DirectEditing.prototype.complete = function() {
15266 var active = this._active;
15272 var text = this.getValue();
15274 if (text !== active.context.text) {
15275 active.provider.update(active.element, text, active.context.text);
15278 this._fire('complete');
15284 DirectEditing.prototype.getValue = function() {
15285 return this._textbox.getValue();
15289 DirectEditing.prototype._handleKey = function(e) {
15292 e.stopPropagation();
15294 var key = e.keyCode || e.charCode;
15298 e.preventDefault();
15299 return this.cancel();
15303 if (key === 13 && !e.shiftKey) {
15304 e.preventDefault();
15305 return this.complete();
15311 * Activate direct editing on the given element
15314 * ElementDescriptor the descriptor for a shape or connection
15315 * @return {Boolean} true if the activation was possible
15317 DirectEditing.prototype.activate = function(element) {
15319 if (this.isActive()) {
15323 // the direct editing context
15326 var provider = find(this._providers, function(p) {
15327 return !!(context = p.activate(element)) ? p : null;
15330 // check if activation took place
15332 this._textbox.create(context.bounds, context.style, context.text);
15340 this._fire('activate');
15347 module.exports = DirectEditing;
15349 "./TextBox": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\TextBox.js",
15350 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
15351 "lodash/function/bind": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\bind.js"
15353 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\diagram-js-direct-editing\\lib\\TextBox.js": [function(require, module, exports) {
15356 var assign = require('lodash/object/assign'),
15357 domEvent = require('min-dom/lib/event'),
15358 domRemove = require('min-dom/lib/remove');
15360 function stopPropagation(event) {
15361 event.stopPropagation();
15364 function TextBox(options) {
15366 this.container = options.container;
15367 this.textarea = document.createElement('textarea');
15369 this.keyHandler = options.keyHandler || function() {};
15372 module.exports = TextBox;
15375 TextBox.prototype.create = function(bounds, style, value) {
15377 var textarea = this.textarea,
15378 container = this.container;
15380 assign(textarea.style, {
15381 width: bounds.width + 'px',
15382 height: bounds.height + 'px',
15383 left: bounds.x + 'px',
15384 top: bounds.y + 'px',
15385 position: 'absolute',
15386 textAlign: 'center',
15387 boxSizing: 'border-box'
15390 textarea.value = value;
15391 textarea.title = 'Press SHIFT+Enter for line feed';
15393 domEvent.bind(textarea, 'keydown', this.keyHandler);
15394 domEvent.bind(textarea, 'mousedown', stopPropagation);
15396 container.appendChild(textarea);
15398 setTimeout(function() {
15399 if (textarea.parent) {
15406 TextBox.prototype.destroy = function() {
15407 var textarea = this.textarea;
15409 textarea.value = '';
15411 domEvent.unbind(textarea, 'keydown', this.keyHandler);
15412 domEvent.unbind(textarea, 'mousedown', stopPropagation);
15414 domRemove(textarea);
15417 TextBox.prototype.getValue = function() {
15418 return this.textarea.value;
15422 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
15423 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\event.js",
15424 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\remove.js"
15426 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\ids\\index.js": [function(require, module, exports) {
15429 var hat = require('hat');
15433 * Create a new id generator / cache instance.
15435 * You may optionally provide a seed that is used internally.
15440 function Ids(seed) {
15441 seed = seed || [128, 36, 1];
15442 this._seed = seed.length ? hat.rack(seed[0], seed[1], seed[2]) : seed;
15445 module.exports = Ids;
15448 * Generate a next id.
15451 * [element] element to bind the id to
15453 * @return {String} id
15455 Ids.prototype.next = function(element) {
15456 return this._seed(element || true);
15460 * Generate a next id with a given prefix.
15463 * [element] element to bind the id to
15465 * @return {String} id
15467 Ids.prototype.nextPrefixed = function(prefix, element) {
15471 id = prefix + this.next(true);
15472 } while (this.assigned(id));
15474 // claim {prefix}{random}
15475 this.claim(id, element);
15482 * Manually claim an existing id.
15487 * [element] element the id is claimed by
15489 Ids.prototype.claim = function(id, element) {
15490 this._seed.set(id, element || true);
15494 * Returns true if the given id has already been assigned.
15498 * @return {Boolean}
15500 Ids.prototype.assigned = function(id) {
15501 return this._seed.get(id) || false;
15504 "hat": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\ids\\node_modules\\hat\\index.js"
15506 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\ids\\node_modules\\hat\\index.js": [function(require, module, exports) {
15507 var hat = module.exports = function(bits, base) {
15508 if (!base) base = 16;
15509 if (bits === undefined) bits = 128;
15510 if (bits <= 0) return '0';
15512 var digits = Math.log(Math.pow(2, bits)) / Math.log(base);
15513 for (var i = 2; digits === Infinity; i *= 2) {
15514 digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i;
15517 var rem = digits - Math.floor(digits);
15521 for (var i = 0; i < Math.floor(digits); i++) {
15522 var x = Math.floor(Math.random() * base).toString(base);
15527 var b = Math.pow(base, rem);
15528 var x = Math.floor(Math.random() * b).toString(base);
15532 var parsed = parseInt(res, base);
15533 if (parsed !== Infinity && parsed >= Math.pow(2, bits)) {
15534 return hat(bits, base)
15538 hat.rack = function(bits, base, expandBy) {
15539 var fn = function(data) {
15542 if (iters++ > 10) {
15543 if (expandBy) bits += expandBy;
15544 else throw new Error('too many ID collisions, use more bits')
15547 var id = hat(bits, base);
15548 } while (Object.hasOwnProperty.call(hats, id));
15553 var hats = fn.hats = {};
15555 fn.get = function(id) {
15556 return fn.hats[id];
15559 fn.set = function(id, value) {
15560 fn.hats[id] = value;
15564 fn.bits = bits || 128;
15565 fn.base = base || 16;
15570 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js": [function(require, module, exports) {
15571 if (typeof Object.create === 'function') {
15572 // implementation from standard node.js 'util' module
15573 module.exports = function inherits(ctor, superCtor) {
15574 ctor.super_ = superCtor
15575 ctor.prototype = Object.create(superCtor.prototype, {
15585 // old school shim for old browsers
15586 module.exports = function inherits(ctor, superCtor) {
15587 ctor.super_ = superCtor
15588 var TempCtor = function() {}
15589 TempCtor.prototype = superCtor.prototype
15590 ctor.prototype = new TempCtor()
15591 ctor.prototype.constructor = ctor
15596 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\domify.js": [function(require, module, exports) {
15597 module.exports = require('domify');
15599 "domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\domify\\index.js"
15601 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\event.js": [function(require, module, exports) {
15602 module.exports = require('component-event');
15604 "component-event": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js"
15606 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\query.js": [function(require, module, exports) {
15607 module.exports = require('component-query');
15609 "component-query": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js"
15611 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\remove.js": [function(require, module, exports) {
15612 module.exports = function(el) {
15613 el.parentNode && el.parentNode.removeChild(el);
15616 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js": [function(require, module, exports) {
15617 var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
15618 unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
15619 prefix = bind !== 'addEventListener' ? 'on' : '';
15622 * Bind `el` event `type` to `fn`.
15628 * @param {Function}
15632 * @return {Function}
15636 exports.bind = function(el, type, fn, capture) {
15637 el[bind](prefix + type, fn, capture || false);
15642 * Unbind `el` event `type`'s callback `fn`.
15648 * @param {Function}
15652 * @return {Function}
15656 exports.unbind = function(el, type, fn, capture) {
15657 el[unbind](prefix + type, fn, capture || false);
15661 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js": [function(require, module, exports) {
15662 function one(selector, el) {
15663 return el.querySelector(selector);
15666 exports = module.exports = function(selector, el) {
15667 el = el || document;
15668 return one(selector, el);
15671 exports.all = function(selector, el) {
15672 el = el || document;
15673 return el.querySelectorAll(selector);
15676 exports.engine = function(obj) {
15677 if (!obj.one) throw new Error('.one callback required');
15678 if (!obj.all) throw new Error('.all callback required');
15680 exports.all = obj.all;
15685 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\domify\\index.js": [function(require, module, exports) {
15691 module.exports = parse;
15694 * Tests for browser support.
15697 var div = document.createElement('div');
15699 div.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
15700 // Make sure that link elements get serialized correctly by innerHTML
15701 // This requires a wrapper element in IE
15702 var innerHTMLBug = !div.getElementsByTagName('link').length;
15706 * Wrap map from jquery.
15710 legend: [1, '<fieldset>', '</fieldset>'],
15711 tr: [2, '<table><tbody>', '</tbody></table>'],
15712 col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
15713 // for script/link/style tags to work in IE6-8, you have to wrap
15714 // in a div with a non-whitespace character in front, ha!
15715 _default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
15719 map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
15722 map.optgroup = [1, '<select multiple="multiple">', '</select>'];
15728 map.tfoot = [1, '<table>', '</table>'];
15738 map.g = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">', '</svg>'];
15741 * Parse `html` and return a DOM Node instance, which could be a TextNode, HTML
15742 * DOM Node of some kind (<div> for example), or a DocumentFragment instance,
15743 * depending on the contents of the `html` string.
15746 * html - HTML string to "domify"
15747 * @param {Document}
15748 * doc - The `document` instance to create the Node for
15749 * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
15753 function parse(html, doc) {
15754 if ('string' != typeof html) throw new TypeError('String expected');
15756 // default to the global `document` object
15757 if (!doc) doc = document;
15760 var m = /<([\w:]+)/.exec(html);
15761 if (!m) return doc.createTextNode(html);
15763 html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing
15769 if (tag == 'body') {
15770 var el = doc.createElement('html');
15771 el.innerHTML = html;
15772 return el.removeChild(el.lastChild);
15776 var wrap = map[tag] || map._default;
15777 var depth = wrap[0];
15778 var prefix = wrap[1];
15779 var suffix = wrap[2];
15780 var el = doc.createElement('div');
15781 el.innerHTML = prefix + html + suffix;
15782 while (depth--) el = el.lastChild;
15785 if (el.firstChild == el.lastChild) {
15786 return el.removeChild(el.firstChild);
15789 // several elements
15790 var fragment = doc.createDocumentFragment();
15791 while (el.firstChild) {
15792 fragment.appendChild(el.removeChild(el.firstChild));
15799 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\index.js": [function(require, module, exports) {
15800 module.exports = require('./lib/refs');
15802 module.exports.Collection = require('./lib/collection');
15804 "./lib/collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js",
15805 "./lib/refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\refs.js"
15807 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js": [function(require, module, exports) {
15811 * An empty collection stub. Use {@link RefsCollection.extend} to extend a
15812 * collection with ref semantics.
15814 * @classdesc A change and inverse-reference aware collection with set
15817 * @class RefsCollection
15819 function RefsCollection() {}
15822 * Extends a collection with {@link Refs} aware methods
15824 * @memberof RefsCollection
15828 * <Object>} collection
15832 * property represented by the collection
15834 * target object the collection is attached to
15836 * @return {RefsCollection<Object>} the extended array
15838 function extend(collection, refs, property, target) {
15840 var inverseProperty = property.inverse;
15843 * Removes the given element from the array and returns it.
15845 * @method RefsCollection#remove
15848 * element the element to remove
15850 collection.remove = function(element) {
15851 var idx = this.indexOf(element);
15853 this.splice(idx, 1);
15856 refs.unset(element, inverseProperty, target);
15863 * Returns true if the collection contains the given element
15865 * @method RefsCollection#contains
15868 * element the element to check for
15870 collection.contains = function(element) {
15871 return this.indexOf(element) !== -1;
15875 * Adds an element to the array, unless it exists already (set semantics).
15877 * @method RefsCollection#add
15880 * element the element to add
15882 collection.add = function(element) {
15884 if (!this.contains(element)) {
15885 this.push(element);
15888 refs.set(element, inverseProperty, target);
15896 module.exports.extend = extend;
15898 "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\refs.js": [function(require, module, exports) {
15901 var Collection = require('./collection');
15903 function hasOwnProperty(e, property) {
15904 return Object.prototype.hasOwnProperty.call(e, property.name || property);
15908 function defineCollectionProperty(ref, property, target) {
15909 Object.defineProperty(target, property.name, {
15910 enumerable: property.enumerable,
15911 value: Collection.extend(target[property.name] || [], ref, property, target)
15916 function defineProperty(ref, property, target) {
15918 var inverseProperty = property.inverse;
15920 var _value = target[property.name];
15922 Object.defineProperty(target, property.name, {
15923 enumerable: property.enumerable,
15929 set: function(value) {
15931 // return if we already performed all changes
15932 if (value === _value) {
15938 // temporary set null
15942 ref.unset(old, inverseProperty, target);
15948 // set inverse value
15949 ref.set(_value, inverseProperty, target);
15956 * Creates a new references object defining two inversly related attribute
15957 * descriptors a and b.
15960 * When bound to an object using {@link Refs#bind} the references get activated
15961 * and ensure that add and remove operations are applied reversely, too.
15965 * For attributes represented as collections {@link Refs} provides the
15966 * {@link RefsCollection#add}, {@link RefsCollection#remove} and
15967 * {@link RefsCollection#contains} extensions that must be used to properly hook
15968 * into the inverse change mechanism.
15973 * @classdesc A bi-directional reference between two attributes.
15975 * @param {Refs.AttributeDescriptor}
15976 * a property descriptor
15977 * @param {Refs.AttributeDescriptor}
15978 * b property descriptor
15982 * var refs = Refs({ name: 'wheels', collection: true, enumerable: true }, {
15985 * var car = { name: 'toyota' }; var wheels = [{ pos: 'front-left' }, { pos:
15986 * 'front-right' }];
15988 * refs.bind(car, 'wheels');
15990 * car.wheels // [] car.wheels.add(wheels[0]); car.wheels.add(wheels[1]);
15992 * car.wheels // [{ pos: 'front-left' }, { pos: 'front-right' }]
15994 * wheels[0].car // { name: 'toyota' }; car.wheels.remove(wheels[0]);
15996 * wheels[0].car // undefined
15998 function Refs(a, b) {
16000 if (!(this instanceof Refs)) {
16001 return new Refs(a, b);
16009 this.props[a.name] = a;
16010 this.props[b.name] = b;
16014 * Binds one side of a bi-directional reference to a target object.
16023 Refs.prototype.bind = function(target, property) {
16024 if (typeof property === 'string') {
16025 if (!this.props[property]) {
16026 throw new Error('no property <' + property + '> in ref');
16028 property = this.props[property];
16031 if (property.collection) {
16032 defineCollectionProperty(this, property, target);
16034 defineProperty(this, property, target);
16038 Refs.prototype.ensureBound = function(target, property) {
16039 if (!hasOwnProperty(target, property)) {
16040 this.bind(target, property);
16044 Refs.prototype.unset = function(target, property, value) {
16047 this.ensureBound(target, property);
16049 if (property.collection) {
16050 target[property.name].remove(value);
16052 target[property.name] = undefined;
16057 Refs.prototype.set = function(target, property, value) {
16060 this.ensureBound(target, property);
16062 if (property.collection) {
16063 target[property.name].add(value);
16065 target[property.name] = value;
16070 module.exports = Refs;
16074 * An attribute descriptor to be used specify an attribute in a {@link Refs}
16077 * @typedef {Object} Refs.AttributeDescriptor
16078 * @property {String} name
16079 * @property {boolean} [collection=false]
16080 * @property {boolean} [enumerable=false]
16083 "./collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js"
16085 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\index.js": [function(require, module, exports) {
16086 module.exports = require('./lib/Diagram');
16088 "./lib/Diagram": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\Diagram.js"
16090 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\Diagram.js": [function(require, module, exports) {
16093 var di = require('didi');
16097 * Bootstrap an injector from a list of modules, instantiating a number of
16098 * default components
16102 * <didi.Module>} bootstrapModules
16104 * @return {didi.Injector} a injector to use to access the components
16106 function bootstrap(bootstrapModules) {
16111 function hasModule(m) {
16112 return modules.indexOf(m) >= 0;
16115 function addModule(m) {
16119 function visit(m) {
16120 if (hasModule(m)) {
16124 (m.__depends__ || []).forEach(visit);
16126 if (hasModule(m)) {
16132 (m.__init__ || []).forEach(function(c) {
16133 components.push(c);
16137 bootstrapModules.forEach(visit);
16139 var injector = new di.Injector(modules);
16141 components.forEach(function(c) {
16144 // eagerly resolve component (fn or string)
16145 injector[typeof c === 'string' ? 'get' : 'invoke'](c);
16147 console.error('Failed to instantiate component');
16148 console.error(e.stack);
16158 * Creates an injector from passed options.
16163 * @return {didi.Injector}
16165 function createInjector(options) {
16167 options = options || {};
16169 var configModule = {
16170 'config': ['value', options]
16173 var coreModule = require('./core');
16175 var modules = [configModule, coreModule].concat(options.modules || []);
16177 return bootstrap(modules);
16182 * The main diagram-js entry point that bootstraps the diagram with the given
16185 * To register extensions with the diagram, pass them as Array<didi.Module> to
16188 * @class djs.Diagram
16194 * <caption>Creating a plug-in that logs whenever a shape is added to the
16195 * canvas.</caption>
16196 * // plug-in implemenentation function MyLoggingPlugin(eventBus) {
16197 * eventBus.on('shape.added', function(event) { console.log('shape ',
16198 * event.shape, ' was added to the diagram'); }); }
16199 * // export as module module.exports = { __init__: [ 'myLoggingPlugin' ],
16200 * myLoggingPlugin: [ 'type', MyLoggingPlugin ] };
16202 * // instantiate the diagram with the new plug-in
16204 * var diagram = new Diagram({ modules: [ require('path-to-my-logging-plugin') ]
16207 * diagram.invoke([ 'canvas', function(canvas) { // add shape to drawing canvas
16208 * canvas.addShape({ x: 10, y: 10 }); });
16209 * // 'shape ... was added to the diagram' logged to console
16214 * <didi.Module>} [options.modules] external modules to instantiate
16216 * @param {didi.Injector}
16217 * [injector] an (optional) injector to bootstrap the diagram with
16219 function Diagram(options, injector) {
16221 // create injector unless explicitly specified
16222 this.injector = injector = injector || createInjector(options);
16227 * Resolves a diagram service
16229 * @method Diagram#get
16232 * name the name of the diagram service to be retrieved
16234 * [locals] a number of locals to use to resolve certain
16237 this.get = injector.get;
16240 * Executes a function into which diagram services are injected
16242 * @method Diagram#invoke
16244 * @param {Function|Object[]}
16245 * fn the function to resolve
16247 * locals a number of locals to use to resolve certain
16250 this.invoke = injector.invoke;
16254 // indicate via event
16258 * An event indicating that all plug-ins are loaded.
16260 * Use this event to fire other events to interested plug-ins
16262 * @memberOf Diagram
16264 * @event diagram.init
16268 * eventBus.on('diagram.init', function() { eventBus.fire('my-custom-event', {
16269 * foo: 'BAR' }); });
16273 this.get('eventBus').fire('diagram.init');
16276 module.exports = Diagram;
16280 * Destroys the diagram
16282 * @method Diagram#destroy
16284 Diagram.prototype.destroy = function() {
16285 this.get('eventBus').fire('diagram.destroy');
16288 "./core": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\index.js",
16289 "didi": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\index.js"
16291 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js": [function(require, module, exports) {
16294 var forEach = require('lodash/collection/forEach'),
16295 isFunction = require('lodash/lang/isFunction'),
16296 isArray = require('lodash/lang/isArray');
16300 * A utility that can be used to plug-in into the command execution for
16301 * extension and/or validation.
16303 * @param {EventBus}
16308 * var inherits = require('inherits');
16310 * var CommandInterceptor =
16311 * require('diagram-js/lib/command/CommandInterceptor');
16313 * function CommandLogger(eventBus) { CommandInterceptor.call(this, eventBus);
16315 * this.preExecute(function(event) { console.log('command pre-execute', event);
16318 * inherits(CommandLogger, CommandInterceptor);
16321 function CommandInterceptor(eventBus) {
16322 this._eventBus = eventBus;
16325 CommandInterceptor.$inject = ['eventBus'];
16327 module.exports = CommandInterceptor;
16329 function unwrapEvent(fn) {
16330 return function(event) {
16331 return fn(event.context, event.command, event);
16336 * Register an interceptor for a command execution
16338 * @param {String|Array
16339 * <String>} [events] list of commands to register on
16341 * [hook] command hook, i.e. preExecute, executed to listen on
16342 * @param {Function}
16343 * handlerFn interceptor to be invoked with (event)
16345 * unwrap if true, unwrap the event and pass (context, command,
16346 * event) to the listener instead
16348 CommandInterceptor.prototype.on = function(events, hook, handlerFn, unwrap) {
16350 if (isFunction(hook)) {
16351 unwrap = handlerFn;
16356 if (!isFunction(handlerFn)) {
16357 throw new Error('handlerFn must be a function');
16360 if (!isArray(events)) {
16364 var eventBus = this._eventBus;
16366 forEach(events, function(event) {
16367 // concat commandStack(.event)?(.hook)?
16368 var fullEvent = ['commandStack', event, hook].filter(function(e) {
16372 eventBus.on(fullEvent, unwrap ? unwrapEvent(handlerFn) : handlerFn);
16388 * Install hook shortcuts
16390 * This will generate the CommandInterceptor#(preExecute|...|reverted) methods
16391 * which will in term forward to CommandInterceptor#on.
16393 forEach(hooks, function(hook) {
16394 CommandInterceptor.prototype[hook] = function(events, fn, unwrap) {
16395 if (isFunction(events)) {
16401 this.on(events, hook, fn, unwrap);
16405 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
16406 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
16407 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js"
16409 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandStack.js": [function(require, module, exports) {
16412 var unique = require('lodash/array/unique'),
16413 isArray = require('lodash/lang/isArray'),
16414 assign = require('lodash/object/assign');
16416 var InternalEvent = require('../core/EventBus').Event;
16420 * A service that offers un- and redoable execution of commands.
16422 * The command stack is responsible for executing modeling actions in a un- and
16423 * redoable manner. To do this it delegates the actual command execution to
16424 * {@link CommandHandler}s.
16426 * Command handlers provide {@link CommandHandler#execute(ctx)} and
16427 * {@link CommandHandler#revert(ctx)} methods to un- and redo a command
16428 * identified by a command context.
16430 * ## Life-Cycle events
16432 * In the process the command stack fires a number of life-cycle events that
16433 * other components to participate in the command execution.
16434 * * preExecute * execute * executed * postExecute * revert * reverted
16436 * A special event is used for validating, whether a command can be performed
16437 * prior to its execution.
16440 * Each of the events is fired as `commandStack.{eventName}` and
16441 * `commandStack.{commandName}.{eventName}`, respectively. This gives components
16442 * fine grained control on where to hook into.
16444 * The event object fired transports `command`, the name of the command and
16445 * `context`, the command context.
16447 * ## Creating Command Handlers
16449 * Command handlers should provide the {@link CommandHandler#execute(ctx)} and
16450 * {@link CommandHandler#revert(ctx)} methods to implement redoing and undoing
16451 * of a command. They must ensure undo is performed properly in order not to
16452 * break the undo chain.
16454 * Command handlers may execute other modeling operations (and thus commands) in
16455 * their `preExecute` and `postExecute` phases. The command stack will properly
16456 * group all commands together into a logical unit that may be re- and undone
16459 * Command handlers must not execute other commands from within their core
16460 * implementation (`execute`, `revert`).
16462 * ## Change Tracking
16464 * During the execution of the CommandStack it will keep track of all elements
16465 * that have been touched during the command's execution.
16467 * At the end of the CommandStack execution it will notify interested components
16468 * via an 'elements.changed' event with all the dirty elements.
16470 * The event can be picked up by components that are interested in the fact that
16471 * elements have been changed. One use case for this is updating their graphical
16472 * representation after moving / resizing or deletion.
16475 * @param {EventBus}
16477 * @param {Injector}
16480 function CommandStack(eventBus, injector) {
16482 * A map of all registered command handlers.
16486 this._handlerMap = {};
16489 * A stack containing all re/undoable actions on the diagram
16491 * @type {Array<Object>}
16496 * The current index on the stack
16500 this._stackIdx = -1;
16503 * Current active commandStack execution
16507 this._currentExecution = {
16513 this._injector = injector;
16514 this._eventBus = eventBus;
16517 this._selectedModel = selected_model;
16519 commandStackList.push(this);
16522 CommandStack.$inject = ['eventBus', 'injector'];
16524 module.exports = CommandStack;
16528 * Execute a command
16531 * command the command to execute
16533 * context the environment to execute the command in
16535 CommandStack.prototype.execute = function(command, context) {
16537 throw new Error('command required');
16545 this._pushAction(action);
16546 this._internalExecute(action);
16547 this._popAction(action);
16552 * Ask whether a given command can be executed.
16554 * Implementors may hook into the mechanism on two ways:
16555 * * in event listeners:
16557 * Users may prevent the execution via an event listener. It must prevent the
16558 * default action for `commandStack.(<command>.)canExecute` events.
16559 * * in command handlers:
16561 * If the method {@link CommandHandler#canExecute} is implemented in a handler
16562 * it will be called to figure out whether the execution is allowed.
16565 * command the command to execute
16567 * context the environment to execute the command in
16569 * @return {Boolean} true if the command can be executed
16571 CommandStack.prototype.canExecute = function(command, context) {
16578 var handler = this._getHandler(command);
16584 var result = this._fire(command, 'canExecute', action);
16586 // handler#canExecute will only be called if no listener
16587 // decided on a result already
16588 if (result === undefined && handler.canExecute) {
16589 result = handler.canExecute(context);
16597 * Clear the command stack, erasing all undo / redo history
16599 CommandStack.prototype.clear = function() {
16600 this._stack.length = 0;
16601 this._stackIdx = -1;
16603 this._fire('changed');
16608 * Undo last command(s)
16610 CommandStack.prototype.undo = function() {
16611 var action = this._getUndoAction(),
16614 this._pushAction(action);
16617 this._internalUndo(action);
16618 next = this._getUndoAction();
16620 if (!next || next.id !== action.id) {
16633 * Redo last command(s)
16635 CommandStack.prototype.redo = function() {
16636 var action = this._getRedoAction(),
16640 this._pushAction(action);
16643 this._internalExecute(action, true);
16644 next = this._getRedoAction();
16646 if (!next || next.id !== action.id) {
16659 * Register a handler instance with the command stack
16663 * @param {CommandHandler}
16666 CommandStack.prototype.register = function(command, handler) {
16667 this._setHandler(command, handler);
16672 * Register a handler type with the command stack by instantiating it and
16673 * injecting its dependencies.
16677 * @param {Function}
16678 * a constructor for a {@link CommandHandler}
16680 CommandStack.prototype.registerHandler = function(command, handlerCls) {
16682 if (!command || !handlerCls) {
16683 throw new Error('command and handlerCls must be defined');
16686 var handler = this._injector.instantiate(handlerCls);
16687 this.register(command, handler);
16690 CommandStack.prototype.canUndo = function() {
16691 return !!this._getUndoAction();
16694 CommandStack.prototype.canRedo = function() {
16695 return !!this._getRedoAction();
16698 // //// stack access //////////////////////////////////////
16700 CommandStack.prototype._getRedoAction = function() {
16701 return this._stack[this._stackIdx + 1];
16705 CommandStack.prototype._getUndoAction = function() {
16706 return this._stack[this._stackIdx];
16710 // //// internal functionality /////////////////////////////
16712 CommandStack.prototype._internalUndo = function(action) {
16713 var command = action.command,
16714 context = action.context;
16716 var handler = this._getHandler(command);
16718 this._fire(command, 'revert', action);
16720 this._markDirty(handler.revert(context));
16722 this._revertedAction(action);
16724 this._fire(command, 'reverted', action);
16728 CommandStack.prototype._fire = function(command, qualifier, event) {
16729 if (arguments.length < 3) {
16734 var names = qualifier ? [command + '.' + qualifier, qualifier] : [command],
16737 event = assign(new InternalEvent(), event);
16739 for (i = 0; !!(name = names[i]); i++) {
16740 result = this._eventBus.fire('commandStack.' + name, event);
16742 if (event.cancelBubble) {
16750 CommandStack.prototype._createId = function() {
16751 return this._uid++;
16755 CommandStack.prototype._internalExecute = function(action, redo) {
16756 var command = action.command,
16757 context = action.context;
16759 var handler = this._getHandler(command);
16762 throw new Error('no command handler registered for <' + command + '>');
16765 this._pushAction(action);
16768 this._fire(command, 'preExecute', action);
16770 if (handler.preExecute) {
16771 handler.preExecute(context);
16775 this._fire(command, 'execute', action);
16778 this._markDirty(handler.execute(context));
16781 this._executedAction(action, redo);
16783 this._fire(command, 'executed', action);
16786 if (handler.postExecute) {
16787 handler.postExecute(context);
16790 this._fire(command, 'postExecute', action);
16793 this._popAction(action);
16797 CommandStack.prototype._pushAction = function(action) {
16799 var execution = this._currentExecution,
16800 actions = execution.actions;
16802 var baseAction = actions[0];
16805 action.id = (baseAction && baseAction.id) || this._createId();
16808 actions.push(action);
16812 CommandStack.prototype._popAction = function() {
16813 var execution = this._currentExecution,
16814 actions = execution.actions,
16815 dirty = execution.dirty;
16819 if (!actions.length) {
16820 this._eventBus.fire('elements.changed', {
16821 elements: unique(dirty)
16826 this._fire('changed');
16831 CommandStack.prototype._markDirty = function(elements) {
16832 var execution = this._currentExecution;
16838 elements = isArray(elements) ? elements : [elements];
16840 execution.dirty = execution.dirty.concat(elements);
16844 CommandStack.prototype._executedAction = function(action, redo) {
16845 var stackIdx = ++this._stackIdx;
16848 this._stack.splice(stackIdx, this._stack.length, action);
16853 CommandStack.prototype._revertedAction = function(action) {
16858 CommandStack.prototype._getHandler = function(command) {
16859 return this._handlerMap[command];
16862 CommandStack.prototype._setHandler = function(command, handler) {
16863 if (!command || !handler) {
16864 throw new Error('command and handler required');
16867 if (this._handlerMap[command]) {
16868 throw new Error('overriding handler for command <' + command + '>');
16871 this._handlerMap[command] = handler;
16875 "../core/EventBus": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js",
16876 "lodash/array/unique": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\unique.js",
16877 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
16878 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
16880 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js": [function(require, module, exports) {
16882 __depends__: [require('../core')],
16883 commandStack: ['type', require('./CommandStack')]
16886 "../core": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\index.js",
16887 "./CommandStack": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandStack.js"
16889 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\Canvas.js": [function(require, module, exports) {
16892 var isNumber = require('lodash/lang/isNumber'),
16893 assign = require('lodash/object/assign'),
16894 forEach = require('lodash/collection/forEach');
16896 var Collections = require('../util/Collections');
16898 var Snap = require('../../vendor/snapsvg');
16900 function round(number, resolution) {
16901 return Math.round(number * resolution) / resolution;
16904 function ensurePx(number) {
16905 return isNumber(number) ? number + 'px' : number;
16909 * Creates a HTML container element for a SVG element with the given
16914 * @return {HTMLElement} the container element
16916 function createContainer(options) {
16918 options = assign({}, {
16923 var container = options.container || document.body;
16925 // create a <div> around the svg element with the respective size
16926 // this way we can always get the correct container size
16927 // (this is impossible for <svg> elements at the moment)
16928 var parent = document.createElement('div');
16929 parent.setAttribute('class', 'djs-container');
16931 assign(parent.style, {
16932 position: 'relative',
16933 overflow: 'hidden',
16934 width: ensurePx(options.width),
16935 height: ensurePx(options.height)
16938 container.appendChild(parent);
16943 function createGroup(parent, cls) {
16944 return parent.group().attr({
16949 var BASE_LAYER = 'base';
16953 * The main drawing canvas.
16958 * @emits Canvas#canvas.init
16962 * @param {EventBus}
16964 * @param {GraphicsFactory}
16966 * @param {ElementRegistry}
16969 function Canvas(config, eventBus, graphicsFactory, elementRegistry) {
16970 this._eventBus = eventBus;
16971 this._elementRegistry = elementRegistry;
16972 this._graphicsFactory = graphicsFactory;
16974 this._init(config || {});
16977 Canvas.$inject = ['config.canvas', 'eventBus', 'graphicsFactory', 'elementRegistry'];
16979 module.exports = Canvas;
16982 Canvas.prototype._init = function(config) {
16984 // Creates a <svg> element that is wrapped into a <div>.
16985 // This way we are always able to correctly figure out the size of the svg
16987 // by querying the parent node.
16989 // (It is not possible to get the size of a svg element cross browser @
16992 // <div class="djs-container" style="width: {desired-width}, height:
16993 // {desired-height}">
16994 // <svg width="100%" height="100%">
17000 var eventBus = this._eventBus,
17002 container = createContainer(config),
17003 svg = Snap.createSnapAt('100%', '100%', container),
17004 viewport = createGroup(svg, 'viewport'),
17008 this._container = container;
17010 this._viewport = viewport;
17013 eventBus.on('diagram.init', function(event) {
17016 * An event indicating that the canvas is ready to be drawn on.
17020 * @event canvas.init
17023 * @property {Snap<SVGSVGElement>} svg the created svg element
17024 * @property {Snap<SVGGroup>} viewport the direct parent of diagram
17025 * elements and shapes
17027 eventBus.fire('canvas.init', {
17033 eventBus.on('diagram.destroy', function() {
17035 var parent = self._container.parentNode;
17038 parent.removeChild(container);
17041 eventBus.fire('canvas.destroy', {
17043 viewport: self._viewport
17046 self._svg.remove();
17048 self._svg = self._container = self._layers = self._viewport = null;
17054 * Returns the default layer on which all elements are drawn.
17056 * @returns {Snap<SVGGroup>}
17058 Canvas.prototype.getDefaultLayer = function() {
17059 return this.getLayer(BASE_LAYER);
17063 * Returns a layer that is used to draw elements or annotations on it.
17068 * @returns {Snap<SVGGroup>}
17070 Canvas.prototype.getLayer = function(name) {
17073 throw new Error('must specify a name');
17076 var layer = this._layers[name];
17078 layer = this._layers[name] = createGroup(this._viewport, 'layer-' + name);
17086 * Returns the html element that encloses the drawing canvas.
17088 * @return {DOMNode}
17090 Canvas.prototype.getContainer = function() {
17091 return this._container;
17095 // ///////////// markers ///////////////////////////////////
17097 Canvas.prototype._updateMarker = function(element, marker, add) {
17101 element = this._elementRegistry.get(element);
17104 // we need to access all
17105 container = this._elementRegistry._elements[element.id];
17111 forEach([container.gfx, container.secondaryGfx], function(gfx) {
17113 // invoke either addClass or removeClass based on mode
17114 gfx[add ? 'addClass' : 'removeClass'](marker);
17119 * An event indicating that a marker has been updated for an element
17121 * @event element.marker.update
17123 * @property {djs.model.Element} element the shape
17124 * @property {Object} gfx the graphical representation of the shape
17125 * @property {String} marker
17126 * @property {Boolean} add true if the marker was added, false if it got
17129 this._eventBus.fire('element.marker.update', {
17131 gfx: container.gfx,
17139 * Adds a marker to an element (basically a css class).
17141 * Fires the element.marker.update event, making it possible to integrate
17142 * extension into the marker life-cycle, too.
17144 * @example canvas.addMarker('foo', 'some-marker');
17146 * var fooGfx = canvas.getGraphics('foo');
17148 * fooGfx; // <g class="... some-marker"> ... </g>
17150 * @param {String|djs.model.Base}
17155 Canvas.prototype.addMarker = function(element, marker) {
17156 this._updateMarker(element, marker, true);
17161 * Remove a marker from an element.
17163 * Fires the element.marker.update event, making it possible to integrate
17164 * extension into the marker life-cycle, too.
17166 * @param {String|djs.model.Base}
17171 Canvas.prototype.removeMarker = function(element, marker) {
17172 this._updateMarker(element, marker, false);
17176 * Check the existence of a marker on element.
17178 * @param {String|djs.model.Base}
17183 Canvas.prototype.hasMarker = function(element, marker) {
17185 element = this._elementRegistry.get(element);
17188 var gfx = this.getGraphics(element);
17190 return gfx && gfx.hasClass(marker);
17194 * Toggles a marker on an element.
17196 * Fires the element.marker.update event, making it possible to integrate
17197 * extension into the marker life-cycle, too.
17199 * @param {String|djs.model.Base}
17204 Canvas.prototype.toggleMarker = function(element, marker) {
17205 if (this.hasMarker(element, marker)) {
17206 this.removeMarker(element, marker);
17208 this.addMarker(element, marker);
17212 Canvas.prototype.getRootElement = function() {
17213 if (!this._rootElement) {
17214 this.setRootElement({
17215 id: '__implicitroot'
17219 return this._rootElement;
17224 // ////////////// root element handling ///////////////////////////
17227 * Sets a given element as the new root element for the canvas and returns the
17228 * new root element.
17230 * @param {Object|djs.model.Root}
17233 * [override] whether to override the current root element, if any
17235 * @return {Object|djs.model.Root} new root element
17237 Canvas.prototype.setRootElement = function(element, override) {
17239 this._ensureValidId(element);
17241 var oldRoot = this._rootElement,
17242 elementRegistry = this._elementRegistry,
17243 eventBus = this._eventBus;
17247 throw new Error('rootElement already set, need to specify override');
17250 // simulate element remove event sequence
17251 eventBus.fire('root.remove', {
17254 eventBus.fire('root.removed', {
17258 elementRegistry.remove(oldRoot);
17261 var gfx = this.getDefaultLayer();
17263 // resemble element add event sequence
17264 eventBus.fire('root.add', {
17268 elementRegistry.add(element, gfx, this._svg);
17270 eventBus.fire('root.added', {
17275 this._rootElement = element;
17282 // /////////// add functionality ///////////////////////////////
17284 Canvas.prototype._ensureValidId = function(element) {
17286 throw new Error('element must have an id');
17289 if (this._elementRegistry.get(element.id)) {
17290 throw new Error('element with id ' + element.id + ' already exists');
17294 Canvas.prototype._setParent = function(element, parent) {
17295 Collections.add(parent.children, element);
17296 element.parent = parent;
17300 * Adds an element to the canvas.
17302 * This wires the parent <-> child relationship between the element and a
17303 * explicitly specified parent or an implicit root element.
17305 * During add it emits the events
17306 * * <{type}.add> (element, parent) * <{type}.added> (element, gfx)
17308 * Extensions may hook into these events to perform their magic.
17312 * @param {Object|djs.model.Base}
17314 * @param {Object|djs.model.Base}
17317 * @return {Object|djs.model.Base} the added element
17319 Canvas.prototype._addElement = function(type, element, parent) {
17321 parent = parent || this.getRootElement();
17323 var eventBus = this._eventBus,
17324 graphicsFactory = this._graphicsFactory;
17326 this._ensureValidId(element);
17328 eventBus.fire(type + '.add', {
17333 this._setParent(element, parent);
17336 var gfx = graphicsFactory.create(type, element);
17338 this._elementRegistry.add(element, gfx);
17340 // update its visual
17341 graphicsFactory.update(type, element, gfx);
17343 eventBus.fire(type + '.added', {
17352 * Adds a shape to the canvas
17354 * @param {Object|djs.model.Shape}
17355 * shape to add to the diagram
17356 * @param {djs.model.Base}
17359 * @return {djs.model.Shape} the added shape
17361 Canvas.prototype.addShape = function(shape, parent) {
17362 return this._addElement('shape', shape, parent);
17366 * Adds a connection to the canvas
17368 * @param {Object|djs.model.Connection}
17369 * connection to add to the diagram
17370 * @param {djs.model.Base}
17373 * @return {djs.model.Connection} the added connection
17375 Canvas.prototype.addConnection = function(connection, parent) {
17376 return this._addElement('connection', connection, parent);
17381 * Internal remove element
17383 Canvas.prototype._removeElement = function(element, type) {
17384 console.log(element);
17385 var elementRegistry = this._elementRegistry,
17386 graphicsFactory = this._graphicsFactory,
17387 eventBus = this._eventBus;
17389 element = elementRegistry.get(element.id || element);
17392 // element was removed already
17396 eventBus.fire(type + '.remove', {
17400 graphicsFactory.remove(element);
17402 // unset parent <-> child relationship
17403 Collections.remove(element.parent && element.parent.children, element);
17404 element.parent = null;
17406 eventBus.fire(type + '.removed', {
17410 elementRegistry.remove(element);
17417 * Removes a shape from the canvas
17419 * @param {String|djs.model.Shape}
17420 * shape or shape id to be removed
17422 * @return {djs.model.Shape} the removed shape
17424 Canvas.prototype.removeShape = function(shape) {
17427 * An event indicating that a shape is about to be removed from the canvas.
17431 * @event shape.remove
17433 * @property {djs.model.Shape} element the shape descriptor
17434 * @property {Object} gfx the graphical representation of the shape
17438 * An event indicating that a shape has been removed from the canvas.
17442 * @event shape.removed
17444 * @property {djs.model.Shape} element the shape descriptor
17445 * @property {Object} gfx the graphical representation of the shape
17447 return this._removeElement(shape, 'shape');
17452 * Removes a connection from the canvas
17454 * @param {String|djs.model.Connection}
17455 * connection or connection id to be removed
17457 * @return {djs.model.Connection} the removed connection
17459 Canvas.prototype.removeConnection = function(connection) {
17462 * An event indicating that a connection is about to be removed from the
17467 * @event connection.remove
17469 * @property {djs.model.Connection} element the connection descriptor
17470 * @property {Object} gfx the graphical representation of the connection
17474 * An event indicating that a connection has been removed from the canvas.
17478 * @event connection.removed
17480 * @property {djs.model.Connection} element the connection descriptor
17481 * @property {Object} gfx the graphical representation of the connection
17483 return this._removeElement(connection, 'connection');
17488 * Sends a shape to the front.
17490 * This method takes parent / child relationships between shapes into account
17491 * and makes sure that children are properly handled, too.
17493 * @param {djs.model.Shape}
17494 * shape descriptor of the shape to be sent to front
17496 * [bubble=true] whether to send parent shapes to front, too
17498 Canvas.prototype.sendToFront = function(shape, bubble) {
17500 if (bubble !== false) {
17504 if (bubble && shape.parent) {
17505 this.sendToFront(shape.parent);
17508 forEach(shape.children, function(child) {
17509 this.sendToFront(child, false);
17512 var gfx = this.getGraphics(shape),
17513 gfxParent = gfx.parent();
17515 gfx.remove().appendTo(gfxParent);
17520 * Return the graphical object underlaying a certain diagram element
17522 * @param {String|djs.model.Base}
17523 * element descriptor of the element
17525 * [secondary=false] whether to return the secondary connected
17528 * @return {SVGElement}
17530 Canvas.prototype.getGraphics = function(element, secondary) {
17531 return this._elementRegistry.getGraphics(element, secondary);
17535 Canvas.prototype._fireViewboxChange = function() {
17536 this._eventBus.fire('canvas.viewbox.changed', {
17537 viewbox: this.viewbox(false)
17543 * Gets or sets the view box of the canvas, i.e. the area that is currently
17547 * [box] the new view box to set
17549 * box.x the top left X coordinate of the canvas visible in view box
17551 * box.y the top left Y coordinate of the canvas visible in view box
17553 * box.width the visible width
17559 * canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })
17560 * // sets the visible area of the diagram to (100|100) -> (600|100) // and and
17561 * scales it according to the diagram width
17563 * @return {Object} the current view box
17565 Canvas.prototype.viewbox = function(box) {
17567 if (box === undefined && this._cachedViewbox) {
17568 return this._cachedViewbox;
17571 var viewport = this._viewport,
17573 outerBox = this.getSize(),
17579 // compute the inner box based on the
17580 // diagrams default layer. This allows us to exclude
17581 // external components, such as overlays
17582 innerBox = this.getDefaultLayer().getBBox(true);
17584 matrix = viewport.transform().localMatrix;
17585 scale = round(matrix.a, 1000);
17587 x = round(-matrix.e || 0, 1000);
17588 y = round(-matrix.f || 0, 1000);
17590 box = this._cachedViewbox = {
17591 x: x ? x / scale : 0,
17592 y: y ? y / scale : 0,
17593 width: outerBox.width / scale,
17594 height: outerBox.height / scale,
17597 width: innerBox.width,
17598 height: innerBox.height,
17607 scale = Math.min(outerBox.width / box.width, outerBox.height / box.height);
17609 matrix = new Snap.Matrix().scale(scale).translate(-box.x, -box.y);
17610 viewport.transform(matrix);
17612 this._fireViewboxChange();
17620 * Gets or sets the scroll of the canvas.
17623 * [delta] the new scroll to apply.
17630 Canvas.prototype.scroll = function(delta) {
17631 var node = this._viewport.node;
17632 var matrix = node.getCTM();
17640 matrix = this._svg.node.createSVGMatrix().translate(delta.dx, delta.dy).multiply(matrix);
17642 setCTM(node, matrix);
17644 this._fireViewboxChange();
17655 * Gets or sets the current zoom of the canvas, optionally zooming to the
17656 * specified position.
17658 * @param {String|Number}
17659 * [newScale] the new zoom level, either a number, i.e. 0.9, or
17660 * `fit-viewport` to adjust the size to fit the current viewport
17661 * @param {String|Point}
17662 * [center] the reference point { x: .., y: ..} to zoom to, 'auto' to
17663 * zoom into mid or null
17665 * @return {Number} the current scale
17667 Canvas.prototype.zoom = function(newScale, center) {
17669 if (newScale === 'fit-viewport') {
17670 return this._fitViewport(center);
17673 var vbox = this.viewbox();
17675 if (newScale === undefined) {
17679 var outer = vbox.outer;
17681 if (center === 'auto') {
17683 x: outer.width / 2,
17684 y: outer.height / 2
17688 var matrix = this._setZoom(newScale, center);
17690 this._fireViewboxChange();
17692 return round(matrix.a, 1000);
17695 function setCTM(node, m) {
17696 var mstr = 'matrix(' + m.a + ',' + m.b + ',' + m.c + ',' + m.d + ',' + m.e + ',' + m.f + ')';
17697 node.setAttribute('transform', mstr);
17700 Canvas.prototype._fitViewport = function(center) {
17702 var vbox = this.viewbox(),
17703 outer = vbox.outer,
17704 inner = vbox.inner,
17708 // display the complete diagram without zooming in.
17709 // instead of relying on internal zoom, we perform a
17710 // hard reset on the canvas viewbox to realize this
17712 // if diagram does not need to be zoomed in, we focus it around
17713 // the diagram origin instead
17715 if (inner.x >= 0 &&
17717 inner.x + inner.width <= outer.width &&
17718 inner.y + inner.height <= outer.height &&
17724 width: Math.max(inner.width + inner.x, outer.width),
17725 height: Math.max(inner.height + inner.y, outer.height)
17729 newScale = Math.min(1, outer.width / inner.width, outer.height / inner.height);
17731 x: inner.x + (center ? inner.width / 2 - outer.width / newScale / 2 : 0),
17732 y: inner.y + (center ? inner.height / 2 - outer.height / newScale / 2 : 0),
17733 width: outer.width / newScale,
17734 height: outer.height / newScale
17738 this.viewbox(newViewbox);
17740 return this.viewbox().scale;
17744 Canvas.prototype._setZoom = function(scale, center) {
17746 var svg = this._svg.node,
17747 viewport = this._viewport.node;
17749 var matrix = svg.createSVGMatrix();
17750 var point = svg.createSVGPoint();
17758 currentMatrix = viewport.getCTM();
17761 var currentScale = currentMatrix.a;
17764 centerPoint = assign(point, center);
17766 // revert applied viewport transformations
17767 originalPoint = centerPoint.matrixTransform(currentMatrix.inverse());
17769 // create scale matrix
17770 scaleMatrix = matrix
17771 .translate(originalPoint.x, originalPoint.y)
17772 .scale(1 / currentScale * scale)
17773 .translate(-originalPoint.x, -originalPoint.y);
17775 newMatrix = currentMatrix.multiply(scaleMatrix);
17777 newMatrix = matrix.scale(scale);
17780 setCTM(this._viewport.node, newMatrix);
17787 * Returns the size of the canvas
17789 * @return {Dimensions}
17791 Canvas.prototype.getSize = function() {
17793 width: this._container.clientWidth,
17794 height: this._container.clientHeight
17800 * Return the absolute bounding box for the given element
17802 * The absolute bounding box may be used to display overlays in the callers
17803 * (browser) coordinate system rather than the zoomed in/out canvas coordinates.
17805 * @param {ElementDescriptor}
17807 * @return {Bounds} the absolute bounding box
17809 Canvas.prototype.getAbsoluteBBox = function(element) {
17810 var vbox = this.viewbox();
17815 if (element.waypoints) {
17816 var gfx = this.getGraphics(element);
17818 var transformBBox = gfx.getBBox(true);
17819 bbox = gfx.getBBox();
17821 bbox.x -= transformBBox.x;
17822 bbox.y -= transformBBox.y;
17824 bbox.width += 2 * transformBBox.x;
17825 bbox.height += 2 * transformBBox.y;
17833 var x = bbox.x * vbox.scale - vbox.x * vbox.scale;
17834 var y = bbox.y * vbox.scale - vbox.y * vbox.scale;
17836 var width = bbox.width * vbox.scale;
17837 var height = bbox.height * vbox.scale;
17848 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
17849 "../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
17850 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
17851 "lodash/lang/isNumber": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js",
17852 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
17854 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementFactory.js": [function(require, module, exports) {
17857 var Model = require('../model');
17861 * A factory for diagram-js shapes
17863 function ElementFactory() {
17867 module.exports = ElementFactory;
17870 ElementFactory.prototype.createRoot = function(attrs) {
17871 return this.create('root', attrs);
17874 ElementFactory.prototype.createLabel = function(attrs) {
17875 return this.create('label', attrs);
17878 ElementFactory.prototype.createShape = function(attrs) {
17879 // alert("In createShape");
17880 return this.create('shape', attrs);
17883 ElementFactory.prototype.createConnection = function(attrs) {
17884 return this.create('connection', attrs);
17888 * Create a model element with the given type and a number of pre-set
17895 * @return {djs.model.Base} the newly created model instance
17897 ElementFactory.prototype.create = function(type, attrs) {
17898 // alert("In create");
17900 attrs = attrs || {};
17903 attrs.id = type + '_' + (this._uid++);
17906 return Model.create(type, attrs);
17909 "../model": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js"
17911 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementRegistry.js": [function(require, module, exports) {
17914 var ELEMENT_ID = 'data-element-id';
17920 * A registry that keeps track of all shapes in the diagram.
17922 function ElementRegistry() {
17923 this._elements = {};
17926 module.exports = ElementRegistry;
17929 * Register a pair of (element, gfx, (secondaryGfx)).
17931 * @param {djs.model.Base}
17934 * <SVGElement>} gfx
17936 * <SVGElement>} [secondaryGfx] optional other element to register,
17939 ElementRegistry.prototype.add = function(element, gfx, secondaryGfx) {
17941 var id = element.id;
17943 this._validateId(id);
17945 // associate dom node with element
17946 gfx.attr(ELEMENT_ID, id);
17948 if (secondaryGfx) {
17949 secondaryGfx.attr(ELEMENT_ID, id);
17952 this._elements[id] = {
17955 secondaryGfx: secondaryGfx
17960 * Removes an element from the registry.
17962 * @param {djs.model.Base}
17965 ElementRegistry.prototype.remove = function(element) {
17966 var elements = this._elements,
17967 id = element.id || element,
17968 container = id && elements[id];
17972 // unset element id on gfx
17973 container.gfx.attr(ELEMENT_ID, null);
17975 if (container.secondaryGfx) {
17976 container.secondaryGfx.attr(ELEMENT_ID, null);
17979 delete elements[id];
17984 * Update the id of an element
17986 * @param {djs.model.Base}
17991 ElementRegistry.prototype.updateId = function(element, newId) {
17993 this._validateId(newId);
17995 if (typeof element === 'string') {
17996 element = this.get(element);
17999 var gfx = this.getGraphics(element),
18000 secondaryGfx = this.getGraphics(element, true);
18002 this.remove(element);
18004 element.id = newId;
18006 this.add(element, gfx, secondaryGfx);
18010 * Return the model element for a given id or graphics.
18014 * elementRegistry.get('SomeElementId_1'); elementRegistry.get(gfx);
18017 * @param {String|SVGElement}
18018 * filter for selecting the element
18020 * @return {djs.model.Base}
18022 ElementRegistry.prototype.get = function(filter) {
18025 if (typeof filter === 'string') {
18028 id = filter && filter.attr(ELEMENT_ID);
18031 var container = this._elements[id];
18032 return container && container.element;
18036 * Return all elements that match a given filter function.
18038 * @param {Function}
18041 * @return {Array<djs.model.Base>}
18043 ElementRegistry.prototype.filter = function(fn) {
18047 this.forEach(function(element, gfx) {
18048 if (fn(element, gfx)) {
18049 filtered.push(element);
18057 * Iterate over all diagram elements.
18059 * @param {Function}
18062 ElementRegistry.prototype.forEach = function(fn) {
18064 var map = this._elements;
18066 Object.keys(map).forEach(function(id) {
18067 var container = map[id],
18068 element = container.element,
18069 gfx = container.gfx;
18071 return fn(element, gfx);
18076 * Return the graphical representation of an element or its id.
18078 * @example elementRegistry.getGraphics('SomeElementId_1');
18079 * elementRegistry.getGraphics(rootElement); // <g ...>
18081 * elementRegistry.getGraphics(rootElement, true); // <svg ...>
18084 * @param {String|djs.model.Base}
18087 * [secondary=false] whether to return the secondary connected
18090 * @return {SVGElement}
18092 ElementRegistry.prototype.getGraphics = function(filter, secondary) {
18093 var id = filter.id || filter;
18095 var container = this._elements[id];
18096 return container && (secondary ? container.secondaryGfx : container.gfx);
18100 * Validate the suitability of the given id and signals a problem with an
18107 * if id is empty or already assigned
18109 ElementRegistry.prototype._validateId = function(id) {
18111 throw new Error('element must have an id');
18114 if (this._elements[id]) {
18115 throw new Error('element with id ' + id + ' already added');
18119 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js": [function(require, module, exports) {
18122 var isFunction = require('lodash/lang/isFunction'),
18123 isArray = require('lodash/lang/isArray'),
18124 isNumber = require('lodash/lang/isNumber'),
18125 assign = require('lodash/object/assign');
18127 var DEFAULT_PRIORITY = 1000;
18131 * A general purpose event bus.
18133 * This component is used to communicate across a diagram instance. Other parts
18134 * of a diagram can use it to listen to and broadcast events.
18136 * ## Registering for Events
18138 * The event bus provides the {@link EventBus#on} and {@link EventBus#once}
18139 * methods to register for events. {@link EventBus#off} can be used to remove
18140 * event registrations. Listeners receive an instance of {@link Event} as the
18141 * first argument. It allows them to hook into the event execution.
18144 * // listen for event eventBus.on('foo', function(event) {
18145 * // access event type event.type; // 'foo'
18146 * // stop propagation to other listeners event.stopPropagation();
18147 * // prevent event default event.preventDefault(); });
18148 * // listen for event with custom payload eventBus.on('bar', function(event,
18149 * payload) { console.log(payload); });
18150 * // listen for event returning value eventBus.on('foobar', function(event) {
18151 * // stop event propagation + prevent default return false;
18152 * // stop event propagation + return custom result return { complex:
18153 * 'listening result' }; });
18155 * // listen with custom priority (default=1000, higher is better)
18156 * eventBus.on('priorityfoo', 1500, function(event) { console.log('invoked
18157 * first!'); }); ```
18159 * ## Emitting Events
18161 * Events can be emitted via the event bus using {@link EventBus#fire}.
18164 * // false indicates that the default action // was prevented by listeners if
18165 * (eventBus.fire('foo') === false) { console.log('default has been
18168 * // custom args + return value listener eventBus.on('sum', function(event, a,
18169 * b) { return a + b; });
18170 * // you can pass custom arguments + retrieve result values. var sum =
18171 * eventBus.fire('sum', 1, 2); console.log(sum); // 3 ```
18173 function EventBus() {
18174 this._listeners = {};
18176 // cleanup on destroy
18180 // destroy on lowest priority to allow
18181 // message passing until the bitter end
18182 this.on('diagram.destroy', 1, function() {
18183 self._listeners = null;
18187 module.exports = EventBus;
18191 * Register an event listener for events with the given name.
18193 * The callback will be invoked with `event, ...additionalArguments` that have
18194 * been passed to {@link EventBus#fire}.
18196 * Returning false from a listener will prevent the events default action (if
18197 * any is specified). To stop an event from being processed further in other
18198 * listeners execute {@link Event#stopPropagation}.
18200 * Returning anything but `undefined` from a listener will stop the listener
18203 * @param {String|Array
18206 * [priority=1000] the priority in which this listener is called,
18208 * @param {Function}
18211 EventBus.prototype.on = function(events, priority, callback) {
18213 events = isArray(events) ? events : [events];
18215 if (isFunction(priority)) {
18216 callback = priority;
18217 priority = DEFAULT_PRIORITY;
18220 if (!isNumber(priority)) {
18221 throw new Error('priority must be a number');
18226 priority: priority,
18230 events.forEach(function(e) {
18231 self._addListener(e, listener);
18237 * Register an event listener that is executed only once.
18240 * event the event name to register for
18241 * @param {Function}
18242 * callback the callback to execute
18244 EventBus.prototype.once = function(event, callback) {
18248 function wrappedCallback() {
18249 callback.apply(self, arguments);
18250 self.off(event, wrappedCallback);
18253 this.on(event, wrappedCallback);
18258 * Removes event listeners by event and callback.
18260 * If no callback is given, all listeners for a given event name are being
18265 * @param {Function}
18268 EventBus.prototype.off = function(event, callback) {
18269 var listeners = this._getListeners(event),
18274 // move through listeners from back to front
18275 // and remove matching listeners
18276 for (idx = listeners.length - 1; !!(listener = listeners[idx]); idx--) {
18277 if (listener.callback === callback) {
18278 listeners.splice(idx, 1);
18283 listeners.length = 0;
18289 * Fires a named event.
18292 * // fire event by name events.fire('foo');
18293 * // fire event object with nested type var event = { type: 'foo' };
18294 * events.fire(event);
18295 * // fire event with explicit type var event = { x: 10, y: 20 };
18296 * events.fire('element.moved', event);
18297 * // pass additional arguments to the event events.on('foo', function(event,
18298 * bar) { alert(bar); });
18300 * events.fire({ type: 'foo' }, 'I am bar!');
18303 * [name] the optional event name
18305 * [event] the event object
18306 * @param {...Object}
18307 * additional arguments to be passed to the callback functions
18309 * @return {Boolean} the events return value, if specified or false if the
18310 * default action was prevented by listeners
18312 EventBus.prototype.fire = function(type, data) {
18316 listeners, idx, listener,
18320 args = Array.prototype.slice.call(arguments);
18322 if (typeof type === 'object') {
18328 throw new Error('no event type specified');
18331 listeners = this._listeners[type];
18337 // we make sure we fire instances of our home made
18338 // events here. We wrap them only once, though
18339 if (data instanceof Event) {
18340 // we are fine, we alread have an event
18343 event = new Event();
18347 // ensure we pass the event as the first parameter
18350 // original event type (in case we delegate)
18351 originalType = event.type;
18355 // update event type before delegation
18356 if (type !== originalType) {
18360 for (idx = 0; !!(listener = listeners[idx]); idx++) {
18362 // handle stopped propagation
18363 if (event.cancelBubble) {
18368 // returning false prevents the default action
18369 returnValue = event.returnValue = listener.callback.apply(null, args);
18371 // stop propagation on return value
18372 if (returnValue !== undefined) {
18373 event.stopPropagation();
18376 // prevent default on return false
18377 if (returnValue === false) {
18378 event.preventDefault();
18381 if (!this.handleError(e)) {
18382 console.error('unhandled error in event listener');
18383 console.error(e.stack);
18390 // reset event type after delegation
18391 if (type !== originalType) {
18392 event.type = originalType;
18396 // set the return value to false if the event default
18397 // got prevented and no other return value exists
18398 if (returnValue === undefined && event.defaultPrevented) {
18399 returnValue = false;
18402 return returnValue;
18406 EventBus.prototype.handleError = function(error) {
18407 return this.fire('error', {
18414 * Add new listener with a certain priority to the list of listeners (for the
18417 * The semantics of listener registration / listener execution are first
18418 * register, first serve: New listeners will always be inserted after existing
18419 * listeners with the same priority.
18421 * Example: Inserting two listeners with priority 1000 and 1300
18422 * * before: [ 1500, 1500, 1000, 1000 ] * after: [ 1500, 1500, (new=1300),
18423 * 1000, 1000, (new=1000) ]
18425 * @param {String} event @param {Object} listener { priority, callback }
18427 EventBus.prototype._addListener = function(event, newListener) {
18429 var listeners = this._getListeners(event),
18433 // ensure we order listeners by priority from
18434 // 0 (high) to n > 0 (low)
18435 for (idx = 0; !!(existingListener = listeners[idx]); idx++) {
18436 if (existingListener.priority < newListener.priority) {
18438 // prepend newListener at before existingListener
18439 listeners.splice(idx, 0, newListener);
18444 listeners.push(newListener);
18448 EventBus.prototype._getListeners = function(name) {
18449 var listeners = this._listeners[name];
18452 this._listeners[name] = listeners = [];
18460 * A event that is emitted via the event bus.
18462 function Event() {}
18464 module.exports.Event = Event;
18466 Event.prototype.stopPropagation = function() {
18467 this.cancelBubble = true;
18470 Event.prototype.preventDefault = function() {
18471 this.defaultPrevented = true;
18474 Event.prototype.init = function(data) {
18475 assign(this, data || {});
18479 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
18480 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
18481 "lodash/lang/isNumber": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js",
18482 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
18484 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\GraphicsFactory.js": [function(require, module, exports) {
18487 var forEach = require('lodash/collection/forEach'),
18488 reduce = require('lodash/collection/reduce');
18490 var GraphicsUtil = require('../util/GraphicsUtil'),
18491 domClear = require('min-dom/lib/clear');
18494 * A factory that creates graphical elements
18496 * @param {Renderer}
18499 function GraphicsFactory(renderer, elementRegistry) {
18500 this._renderer = renderer;
18501 this._elementRegistry = elementRegistry;
18504 GraphicsFactory.$inject = ['renderer', 'elementRegistry'];
18506 module.exports = GraphicsFactory;
18509 GraphicsFactory.prototype._getChildren = function(element) {
18511 var gfx = this._elementRegistry.getGraphics(element);
18516 if (!element.parent) {
18519 childrenGfx = GraphicsUtil.getChildren(gfx);
18520 if (!childrenGfx) {
18521 childrenGfx = gfx.parent().group().attr('class', 'djs-children');
18525 return childrenGfx;
18529 * Clears the graphical representation of the element and returns the cleared
18530 * visual (the <g class="djs-visual" /> element).
18532 GraphicsFactory.prototype._clear = function(gfx) {
18533 var visual = GraphicsUtil.getVisual(gfx);
18535 domClear(visual.node);
18541 * Creates a gfx container for shapes and connections
18543 * The layout is as follows:
18545 * <g class="djs-group">
18547 * <!-- the gfx --> <g class="djs-element djs-(shape|connection)"> <g
18548 * class="djs-visual"> <!-- the renderer draws in here --> </g>
18550 * <!-- extensions (overlays, click box, ...) goes here </g>
18552 * <!-- the gfx child nodes --> <g class="djs-children"></g> </g>
18557 * type the type of the element, i.e. shape | connection
18559 GraphicsFactory.prototype._createContainer = function(type, parentGfx) {
18560 var outerGfx = parentGfx.group().attr('class', 'djs-group'),
18561 gfx = outerGfx.group().attr('class', 'djs-element djs-' + type);
18564 gfx.group().attr('class', 'djs-visual');
18569 GraphicsFactory.prototype.create = function(type, element) {
18570 var childrenGfx = this._getChildren(element.parent);
18571 return this._createContainer(type, childrenGfx);
18575 GraphicsFactory.prototype.updateContainments = function(elements) {
18578 elementRegistry = this._elementRegistry,
18582 parents = reduce(elements, function(map, e) {
18585 map[e.parent.id] = e.parent;
18591 // update all parents of changed and reorganized their children
18592 // in the correct order (as indicated in our model)
18593 forEach(parents, function(parent) {
18595 var childGfx = self._getChildren(parent),
18596 children = parent.children;
18602 forEach(children.slice().reverse(), function(c) {
18603 var gfx = elementRegistry.getGraphics(c);
18604 gfx.parent().prependTo(childGfx);
18610 GraphicsFactory.prototype.update = function(type, element, gfx) {
18612 // Do not update root element
18613 if (!element.parent) {
18617 var visual = this._clear(gfx);
18620 if (type === 'shape') {
18621 this._renderer.drawShape(visual, element);
18623 // update positioning
18624 gfx.translate(element.x, element.y);
18626 if (type === 'connection') {
18627 this._renderer.drawConnection(visual, element);
18629 throw new Error('unknown type: ' + type);
18632 gfx.attr('display', element.hidden ? 'none' : 'block');
18636 GraphicsFactory.prototype.remove = function(element) {
18637 var gfx = this._elementRegistry.getGraphics(element);
18640 gfx.parent().remove();
18644 "../util/GraphicsUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\GraphicsUtil.js",
18645 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
18646 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
18647 "min-dom/lib/clear": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js"
18649 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\index.js": [function(require, module, exports) {
18651 __depends__: [require('../draw')],
18652 __init__: ['canvas'],
18653 canvas: ['type', require('./Canvas')],
18654 elementRegistry: ['type', require('./ElementRegistry')],
18655 elementFactory: ['type', require('./ElementFactory')],
18656 eventBus: ['type', require('./EventBus')],
18657 graphicsFactory: ['type', require('./GraphicsFactory')]
18660 "../draw": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\index.js",
18661 "./Canvas": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\Canvas.js",
18662 "./ElementFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementFactory.js",
18663 "./ElementRegistry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\ElementRegistry.js",
18664 "./EventBus": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js",
18665 "./GraphicsFactory": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\GraphicsFactory.js"
18667 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js": [function(require, module, exports) {
18670 var Snap = require('../../vendor/snapsvg');
18674 * The default renderer used for shapes and connections.
18679 function Renderer(styles) {
18680 this.CONNECTION_STYLE = styles.style(['no-fill'], {
18684 this.SHAPE_STYLE = styles.style({
18691 module.exports = Renderer;
18693 Renderer.$inject = ['styles'];
18696 Renderer.prototype.drawShape = function drawShape(gfxGroup, data) {
18697 return gfxGroup.rect(0, 0, data.width || 0, data.height || 0).attr(this.SHAPE_STYLE);
18700 Renderer.prototype.drawConnection = function drawConnection(gfxGroup, data) {
18701 return createLine(data.waypoints, this.CONNECTION_STYLE).appendTo(gfxGroup);
18704 function componentsToPath(components) {
18705 return components.join(',').replace(/,?([A-z]),?/g, '$1');
18709 * Gets the default SVG path of a shape that represents it's visual bounds.
18711 * @param {djs.model.Shape}
18713 * @return {string} svg path
18715 Renderer.prototype.getShapePath = function getShapePath(shape) {
18719 width = shape.width,
18720 height = shape.height;
18730 return componentsToPath(shapePath);
18734 * Gets the default SVG path of a connection that represents it's visual bounds.
18736 * @param {djs.model.Connection}
18738 * @return {string} svg path
18740 Renderer.prototype.getConnectionPath = function getConnectionPath(connection) {
18741 var waypoints = connection.waypoints;
18743 var idx, point, connectionPath = [];
18745 for (idx = 0; !!(point = waypoints[idx]); idx++) {
18747 // take invisible docking into account
18748 // when creating the path
18749 point = point.original || point;
18751 connectionPath.push([idx === 0 ? 'M' : 'L', point.x, point.y]);
18754 return componentsToPath(connectionPath);
18758 function toSVGPoints(points) {
18761 for (var i = 0, p; !!(p = points[i]); i++) {
18762 result += p.x + ',' + p.y + ' ';
18768 function createLine(points, attrs) {
18769 return Snap.create('polyline', {
18770 points: toSVGPoints(points)
18771 }).attr(attrs || {});
18774 function updateLine(gfx, points) {
18776 points: toSVGPoints(points)
18780 module.exports.createLine = createLine;
18781 module.exports.updateLine = updateLine;
18783 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js"
18785 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Styles.js": [function(require, module, exports) {
18788 var isArray = require('lodash/lang/isArray'),
18789 assign = require('lodash/object/assign'),
18790 reduce = require('lodash/collection/reduce');
18794 * A component that manages shape styles
18796 function Styles() {
18798 var defaultTraits = {
18807 pointerEvents: 'none'
18812 * Builds a style definition from a className, a list of traits and an
18813 * object of additional attributes.
18822 * @return {Object} the style defintion
18824 this.cls = function(className, traits, additionalAttrs) {
18825 var attrs = this.style(traits, additionalAttrs);
18827 return assign(attrs, {
18833 * Builds a style definition from a list of traits and an object of
18834 * additional attributes.
18841 * @return {Object} the style defintion
18843 this.style = function(traits, additionalAttrs) {
18845 if (!isArray(traits) && !additionalAttrs) {
18846 additionalAttrs = traits;
18850 var attrs = reduce(traits, function(attrs, t) {
18851 return assign(attrs, defaultTraits[t] || {});
18854 return additionalAttrs ? assign(attrs, additionalAttrs) : attrs;
18858 module.exports = Styles;
18860 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
18861 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
18862 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
18864 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\index.js": [function(require, module, exports) {
18866 renderer: ['type', require('./Renderer')],
18867 styles: ['type', require('./Styles')]
18870 "./Renderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js",
18871 "./Styles": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Styles.js"
18873 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointMove.js": [function(require, module, exports) {
18876 var Geometry = require('../../util/Geometry'),
18877 Util = require('./Util');
18879 var MARKER_OK = 'connect-ok',
18880 MARKER_NOT_OK = 'connect-not-ok',
18881 MARKER_CONNECT_HOVER = 'connect-hover',
18882 MARKER_CONNECT_UPDATING = 'djs-updating';
18884 var COMMAND_BENDPOINT_UPDATE = 'connection.updateWaypoints',
18885 COMMAND_RECONNECT_START = 'connection.reconnectStart',
18886 COMMAND_RECONNECT_END = 'connection.reconnectEnd';
18888 var round = Math.round;
18892 * A component that implements moving of bendpoints
18894 function BendpointMove(injector, eventBus, canvas, dragging, graphicsFactory, rules, modeling) {
18896 var connectionDocking;
18898 // optional connection docking integration
18900 connectionDocking = injector.get('connectionDocking');
18906 this.start = function(event, connection, bendpointIndex, insert) {
18910 waypoints = connection.waypoints,
18911 gfx = canvas.getGraphics(connection);
18913 if (!insert && bendpointIndex === 0) {
18914 type = COMMAND_RECONNECT_START;
18916 if (!insert && bendpointIndex === waypoints.length - 1) {
18917 type = COMMAND_RECONNECT_END;
18919 type = COMMAND_BENDPOINT_UPDATE;
18923 connection: connection,
18924 bendpointIndex: bendpointIndex,
18929 dragging.activate(event, 'bendpoint.move', {
18931 connection: connection,
18932 connectionGfx: gfx,
18939 // DRAGGING IMPLEMENTATION
18942 function redrawConnection(data) {
18943 graphicsFactory.update('connection', data.connection, data.connectionGfx);
18946 function filterRedundantWaypoints(waypoints) {
18947 return waypoints.filter(function(r, idx) {
18948 return !Geometry.pointsOnLine(waypoints[idx - 1], waypoints[idx + 1], r);
18952 eventBus.on('bendpoint.move.start', function(e) {
18954 var context = e.context,
18955 connection = context.connection,
18956 originalWaypoints = connection.waypoints,
18957 waypoints = originalWaypoints.slice(),
18958 insert = context.insert,
18959 idx = context.bendpointIndex;
18961 context.originalWaypoints = originalWaypoints;
18964 // insert placeholder for bendpoint to-be-added
18965 waypoints.splice(idx, 0, null);
18968 connection.waypoints = waypoints;
18971 context.draggerGfx = Util.addBendpoint(canvas.getLayer('overlays'));
18972 context.draggerGfx.addClass('djs-dragging');
18974 canvas.addMarker(connection, MARKER_CONNECT_UPDATING);
18977 eventBus.on('bendpoint.move.hover', function(e) {
18978 e.context.hover = e.hover;
18980 canvas.addMarker(e.hover, MARKER_CONNECT_HOVER);
18984 'bendpoint.move.out',
18985 'bendpoint.move.cleanup'
18988 // remove connect marker
18990 var hover = e.context.hover;
18993 canvas.removeMarker(hover, MARKER_CONNECT_HOVER);
18994 canvas.removeMarker(hover, e.context.target ? MARKER_OK : MARKER_NOT_OK);
18998 eventBus.on('bendpoint.move.move', function(e) {
19000 var context = e.context,
19001 moveType = context.type,
19002 connection = e.connection,
19005 connection.waypoints[context.bendpointIndex] = {
19010 if (connectionDocking) {
19012 if (context.hover) {
19013 if (moveType === COMMAND_RECONNECT_START) {
19014 source = context.hover;
19017 if (moveType === COMMAND_RECONNECT_END) {
19018 target = context.hover;
19022 connection.waypoints = connectionDocking.getCroppedWaypoints(connection, source, target);
19025 // asks whether reconnect / bendpoint move / bendpoint add
19026 // is allowed at the given position
19027 var allowed = context.allowed = rules.allowed(context.type, context);
19031 if (context.hover) {
19032 canvas.removeMarker(context.hover, MARKER_NOT_OK);
19033 canvas.addMarker(context.hover, MARKER_OK);
19035 context.target = context.hover;
19038 if (allowed === false) {
19039 if (context.hover) {
19040 canvas.removeMarker(context.hover, MARKER_OK);
19041 canvas.addMarker(context.hover, MARKER_NOT_OK);
19043 context.target = null;
19048 context.draggerGfx.translate(e.x, e.y);
19050 redrawConnection(e);
19054 'bendpoint.move.end',
19055 'bendpoint.move.cancel'
19058 var context = e.context,
19059 connection = context.connection;
19061 // remove dragger gfx
19062 context.draggerGfx.remove();
19064 context.newWaypoints = connection.waypoints.slice();
19066 connection.waypoints = context.originalWaypoints;
19068 canvas.removeMarker(connection, MARKER_CONNECT_UPDATING);
19071 eventBus.on('bendpoint.move.end', function(e) {
19073 var context = e.context,
19074 waypoints = context.newWaypoints,
19075 bendpointIndex = context.bendpointIndex,
19076 bendpoint = waypoints[bendpointIndex],
19077 allowed = context.allowed;
19079 // ensure we have actual pixel values bendpoint
19080 // coordinates (important when zoom level was > 1 during move)
19081 bendpoint.x = round(bendpoint.x);
19082 bendpoint.y = round(bendpoint.y);
19084 if (allowed === true && context.type === COMMAND_RECONNECT_START) {
19085 modeling.reconnectStart(context.connection, context.target, bendpoint);
19087 if (allowed === true && context.type === COMMAND_RECONNECT_END) {
19088 modeling.reconnectEnd(context.connection, context.target, bendpoint);
19090 if (allowed !== false && context.type === COMMAND_BENDPOINT_UPDATE) {
19091 modeling.updateWaypoints(context.connection, filterRedundantWaypoints(waypoints));
19093 redrawConnection(e);
19099 eventBus.on('bendpoint.move.cancel', function(e) {
19100 redrawConnection(e);
19104 BendpointMove.$inject = ['injector', 'eventBus', 'canvas', 'dragging', 'graphicsFactory', 'rules', 'modeling'];
19106 module.exports = BendpointMove;
19108 "../../util/Geometry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js",
19109 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Util.js"
19111 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointSnapping.js": [function(require, module, exports) {
19114 var assign = require('lodash/object/assign'),
19115 pick = require('lodash/object/pick'),
19116 forEach = require('lodash/collection/forEach');
19118 var Snap = require('../../../vendor/snapsvg');
19120 var round = Math.round;
19123 function BendpointSnapping(eventBus) {
19125 function snapTo(candidates, point) {
19126 return Snap.snapTo(candidates, point);
19129 function toPoint(e) {
19130 return pick(e, ['x', 'y']);
19133 function mid(element) {
19134 if (element.width) {
19136 x: round(element.width / 2 + element.x),
19137 y: round(element.height / 2 + element.y)
19142 function getSnapPoints(context) {
19144 var snapPoints = context.snapPoints,
19145 waypoints = context.connection.waypoints,
19146 bendpointIndex = context.bendpointIndex,
19147 referenceWaypoints = [waypoints[bendpointIndex - 1], waypoints[bendpointIndex + 1]];
19150 context.snapPoints = snapPoints = {
19155 forEach(referenceWaypoints, function(p) {
19156 // we snap on existing bendpoints only,
19157 // not placeholders that are inserted during add
19159 p = p.original || p;
19161 snapPoints.horizontal.push(p.y);
19162 snapPoints.vertical.push(p.x);
19170 eventBus.on('bendpoint.move.start', function(event) {
19171 event.context.snapStart = toPoint(event);
19174 eventBus.on('bendpoint.move.move', 1500, function(event) {
19176 var context = event.context,
19177 snapPoints = getSnapPoints(context),
19178 start = context.snapStart,
19179 target = context.target,
19180 targetMid = target && mid(target),
19181 x = start.x + event.dx,
19182 y = start.y + event.dy,
19190 sx = snapTo(targetMid ? snapPoints.vertical.concat([targetMid.x]) : snapPoints.vertical, x);
19191 sy = snapTo(targetMid ? snapPoints.horizontal.concat([targetMid.y]) : snapPoints.horizontal, y);
19209 BendpointSnapping.$inject = ['eventBus'];
19211 module.exports = BendpointSnapping;
19213 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
19214 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
19215 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
19216 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js"
19218 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Bendpoints.js": [function(require, module, exports) {
19221 var domEvent = require('min-dom/lib/event'),
19222 Util = require('./Util');
19224 var BENDPOINT_CLS = Util.BENDPOINT_CLS;
19228 * A service that adds editable bendpoints to connections.
19230 function Bendpoints(injector, eventBus, canvas, interactionEvents, bendpointMove) {
19232 function getConnectionIntersection(waypoints, event) {
19233 var localPosition = Util.toCanvasCoordinates(canvas, event);
19234 return Util.getApproxIntersection(waypoints, localPosition);
19237 function activateBendpointMove(event, connection) {
19238 var waypoints = connection.waypoints,
19239 intersection = getConnectionIntersection(waypoints, event);
19241 if (!intersection) {
19245 bendpointMove.start(event, connection, intersection.index, !intersection.bendpoint);
19248 function getBendpointsContainer(element, create) {
19250 var layer = canvas.getLayer('overlays'),
19251 gfx = layer.select('.djs-bendpoints[data-element-id=' + element.id + ']');
19253 if (!gfx && create) {
19254 gfx = layer.group().addClass('djs-bendpoints').attr('data-element-id', element.id);
19256 domEvent.bind(gfx.node, 'mousedown', function(event) {
19257 activateBendpointMove(event, element);
19264 function createBendpoints(gfx, connection) {
19265 connection.waypoints.forEach(function(p, idx) {
19266 Util.addBendpoint(gfx).translate(p.x, p.y);
19269 // add floating bendpoint
19270 Util.addBendpoint(gfx).addClass('floating');
19273 function clearBendpoints(gfx) {
19274 gfx.selectAll('.' + BENDPOINT_CLS).forEach(function(s) {
19279 function addBendpoints(connection) {
19280 var gfx = getBendpointsContainer(connection);
19283 gfx = getBendpointsContainer(connection, true);
19284 createBendpoints(gfx, connection);
19290 function updateBendpoints(connection) {
19292 var gfx = getBendpointsContainer(connection);
19295 clearBendpoints(gfx);
19296 createBendpoints(gfx, connection);
19300 eventBus.on('connection.changed', function(event) {
19301 updateBendpoints(event.element);
19304 eventBus.on('connection.remove', function(event) {
19305 var gfx = getBendpointsContainer(event.element);
19311 eventBus.on('element.marker.update', function(event) {
19313 var element = event.element,
19316 if (!element.waypoints) {
19320 bendpointsGfx = addBendpoints(element);
19321 bendpointsGfx[event.add ? 'addClass' : 'removeClass'](event.marker);
19324 eventBus.on('element.mousemove', function(event) {
19326 var element = event.element,
19327 waypoints = element.waypoints,
19334 bendpointsGfx = getBendpointsContainer(element, true);
19335 floating = bendpointsGfx.select('.floating');
19341 intersection = getConnectionIntersection(waypoints, event.originalEvent);
19343 if (intersection) {
19344 floating.translate(intersection.point.x, intersection.point.y);
19349 eventBus.on('element.mousedown', function(event) {
19351 var originalEvent = event.originalEvent,
19352 element = event.element,
19353 waypoints = element.waypoints;
19359 activateBendpointMove(originalEvent, element, waypoints);
19362 eventBus.on('selection.changed', function(event) {
19363 var newSelection = event.newSelection,
19364 primary = newSelection[0];
19366 if (primary && primary.waypoints) {
19367 addBendpoints(primary);
19371 eventBus.on('element.hover', function(event) {
19372 var element = event.element;
19374 if (element.waypoints) {
19375 addBendpoints(element);
19377 interactionEvents.registerEvent(event.gfx.node, 'mousemove', 'element.mousemove');
19381 eventBus.on('element.out', function(event) {
19382 interactionEvents.unregisterEvent(event.gfx.node, 'mousemove', 'element.mousemove');
19386 Bendpoints.$inject = ['injector', 'eventBus', 'canvas', 'interactionEvents', 'bendpointMove'];
19388 module.exports = Bendpoints;
19390 "./Util": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Util.js",
19391 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
19393 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Util.js": [function(require, module, exports) {
19396 var Snap = require('../../../vendor/snapsvg');
19398 var Events = require('../../util/Event'),
19399 Geometry = require('../../util/Geometry');
19401 var BENDPOINT_CLS = module.exports.BENDPOINT_CLS = 'djs-bendpoint';
19403 module.exports.toCanvasCoordinates = function(canvas, event) {
19405 var position = Events.toPoint(event),
19406 clientRect = canvas._container.getBoundingClientRect(),
19409 // canvas relative position
19412 x: clientRect.left,
19416 // update actual event payload with canvas relative measures
19418 var viewbox = canvas.viewbox();
19421 x: viewbox.x + (position.x - offset.x) / viewbox.scale,
19422 y: viewbox.y + (position.y - offset.y) / viewbox.scale
19426 module.exports.addBendpoint = function(parentGfx) {
19427 var groupGfx = parentGfx.group().addClass(BENDPOINT_CLS);
19429 groupGfx.circle(0, 0, 4).addClass('djs-visual');
19430 groupGfx.circle(0, 0, 10).addClass('djs-hit');
19436 function circlePath(center, r) {
19443 ['a', r, r, 0, 1, 1, 0, 2 * r],
19444 ['a', r, r, 0, 1, 1, 0, -2 * r],
19449 function linePath(points) {
19452 points.forEach(function(p, idx) {
19453 segments.push([idx === 0 ? 'M' : 'L', p.x, p.y]);
19460 var INTERSECTION_THRESHOLD = 10;
19462 function getBendpointIntersection(waypoints, reference) {
19466 for (i = 0; !!(w = waypoints[i]); i++) {
19468 if (Geometry.distance(w, reference) <= INTERSECTION_THRESHOLD) {
19470 point: waypoints[i],
19480 function getPathIntersection(waypoints, reference) {
19482 var intersections = Snap.path.intersection(circlePath(reference, INTERSECTION_THRESHOLD), linePath(waypoints));
19484 var a = intersections[0],
19485 b = intersections[intersections.length - 1],
19495 if (a.segment2 !== b.segment2) {
19496 // we use the bendpoint in between both segments
19497 // as the intersection point
19499 idx = Math.max(a.segment2, b.segment2) - 1;
19502 point: waypoints[idx],
19510 x: (Math.round(a.x + b.x) / 2),
19511 y: (Math.round(a.y + b.y) / 2)
19519 x: Math.round(a.x),
19527 * Returns the closest point on the connection towards a given reference point.
19530 * <Point>} waypoints
19534 * @return {Object} intersection data (segment, point)
19536 module.exports.getApproxIntersection = function(waypoints, reference) {
19537 return getBendpointIntersection(waypoints, reference) || getPathIntersection(waypoints, reference);
19540 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
19541 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
19542 "../../util/Geometry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js"
19544 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\index.js": [function(require, module, exports) {
19546 __depends__: [require('../dragging'), require('../rules')],
19547 __init__: ['bendpoints', 'bendpointSnapping'],
19548 bendpoints: ['type', require('./Bendpoints')],
19549 bendpointMove: ['type', require('./BendpointMove')],
19550 bendpointSnapping: ['type', require('./BendpointSnapping')]
19553 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
19554 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
19555 "./BendpointMove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointMove.js",
19556 "./BendpointSnapping": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\BendpointSnapping.js",
19557 "./Bendpoints": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\bendpoints\\Bendpoints.js"
19559 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\ChangeSupport.js": [function(require, module, exports) {
19563 * Adds change support to the diagram, including
19566 * <li>redrawing shapes and connections on change</li>
19569 * @param {EventBus}
19571 * @param {ElementRegistry}
19573 * @param {GraphicsFactory}
19576 function ChangeSupport(eventBus, elementRegistry, graphicsFactory) {
19578 // redraw shapes / connections on change
19580 eventBus.on('element.changed', function(event) {
19582 var element = event.element;
19585 event.gfx = elementRegistry.getGraphics(element);
19588 // shape + gfx may have been deleted
19593 if (element.waypoints) {
19594 eventBus.fire('connection.changed', event);
19596 eventBus.fire('shape.changed', event);
19600 eventBus.on('elements.changed', function(event) {
19602 var elements = event.elements;
19604 elements.forEach(function(e) {
19605 eventBus.fire('element.changed', {
19610 graphicsFactory.updateContainments(elements);
19613 eventBus.on('shape.changed', function(event) {
19614 graphicsFactory.update('shape', event.element, event.gfx);
19617 eventBus.on('connection.changed', function(event) {
19618 graphicsFactory.update('connection', event.element, event.gfx);
19622 ChangeSupport.$inject = ['eventBus', 'elementRegistry', 'graphicsFactory'];
19624 module.exports = ChangeSupport;
19627 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js": [function(require, module, exports) {
19629 __init__: ['changeSupport'],
19630 changeSupport: ['type', require('./ChangeSupport')]
19633 "./ChangeSupport": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\ChangeSupport.js"
19635 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\Connect.js": [function(require, module, exports) {
19638 var LayoutUtil = require('../../layout/LayoutUtil');
19640 var MARKER_OK = 'connect-ok',
19641 MARKER_NOT_OK = 'connect-not-ok';
19644 function Connect(eventBus, dragging, modeling, rules, canvas, renderer) {
19646 // TODO(nre): separate UI and events
19650 function canConnect(source, target) {
19651 return rules.allowed('connection.create', {
19660 function crop(start, end, source, target) {
19662 var sourcePath = renderer.getShapePath(source),
19663 targetPath = target && renderer.getShapePath(target),
19664 connectionPath = renderer.getConnectionPath({
19665 waypoints: [start, end]
19668 start = LayoutUtil.getElementLineIntersection(sourcePath, connectionPath, true) || start;
19669 end = (target && LayoutUtil.getElementLineIntersection(targetPath, connectionPath, false)) || end;
19671 return [start, end];
19677 eventBus.on('connect.move', function(event) {
19679 var context = event.context,
19680 source = context.source,
19681 target = context.target,
19682 visual = context.visual,
19683 start, end, waypoints;
19685 // update connection visuals during drag
19687 start = LayoutUtil.getMidPoint(source);
19694 waypoints = crop(start, end, source, target);
19696 visual.attr('points', [waypoints[0].x, waypoints[0].y, waypoints[1].x, waypoints[1].y]);
19699 eventBus.on('connect.hover', function(event) {
19700 var context = event.context,
19701 source = context.source,
19702 hover = event.hover,
19705 canExecute = context.canExecute = canConnect(source, hover);
19707 // simply ignore hover
19708 if (canExecute === null) {
19712 context.target = hover;
19714 canvas.addMarker(hover, canExecute ? MARKER_OK : MARKER_NOT_OK);
19717 eventBus.on(['connect.out', 'connect.cleanup'], function(event) {
19718 var context = event.context;
19720 if (context.target) {
19721 canvas.removeMarker(context.target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
19724 context.target = null;
19727 eventBus.on('connect.cleanup', function(event) {
19728 var context = event.context;
19730 if (context.visual) {
19731 context.visual.remove();
19735 eventBus.on('connect.start', function(event) {
19736 var context = event.context,
19739 visual = canvas.getDefaultLayer().polyline().attr({
19741 'strokeDasharray': [1],
19743 'pointer-events': 'none'
19746 context.visual = visual;
19749 eventBus.on('connect.end', function(event) {
19751 var context = event.context,
19752 source = context.source,
19753 target = context.target,
19754 canExecute = context.canExecute || canConnect(source, target);
19760 modeling.connect(source, target);
19766 this.start = function(event, source, autoActivate) {
19768 dragging.activate(event, 'connect', {
19769 autoActivate: autoActivate,
19780 Connect.$inject = ['eventBus', 'dragging', 'modeling', 'rules', 'canvas', 'renderer'];
19782 module.exports = Connect;
19784 "../../layout/LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js"
19786 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\index.js": [function(require, module, exports) {
19789 require('../selection'),
19790 require('../rules'),
19791 require('../dragging')
19793 connect: ['type', require('./Connect')]
19797 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
19798 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
19799 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
19800 "./Connect": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\connect\\Connect.js"
19802 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\ContextPad.js": [function(require, module, exports) {
19805 var isFunction = require('lodash/lang/isFunction'),
19806 forEach = require('lodash/collection/forEach'),
19808 domDelegate = require('min-dom/lib/delegate'),
19809 domClear = require('min-dom/lib/clear'),
19810 domEvent = require('min-dom/lib/event'),
19811 domAttr = require('min-dom/lib/attr'),
19812 domQuery = require('min-dom/lib/query'),
19813 domClasses = require('min-dom/lib/classes'),
19814 domify = require('min-dom/lib/domify');
19817 var entrySelector = '.entry';
19821 * A context pad that displays element specific, contextual actions next to a
19824 * @param {EventBus}
19826 * @param {Overlays}
19829 function ContextPad(eventBus, overlays) {
19831 this._providers = [];
19833 this._eventBus = eventBus;
19834 this._overlays = overlays;
19836 this._current = null;
19841 ContextPad.$inject = ['eventBus', 'overlays'];
19844 * Registers events needed for interaction with other components
19846 ContextPad.prototype._init = function() {
19848 var eventBus = this._eventBus;
19852 eventBus.on('selection.changed', function(e) {
19854 var selection = e.newSelection;
19856 if (selection.length === 1) {
19857 self.open(selection[0]);
19866 * Register a provider with the context pad
19868 * @param {ContextPadProvider}
19871 ContextPad.prototype.registerProvider = function(provider) {
19872 this._providers.push(provider);
19877 * Returns the context pad entries for a given element
19879 * @param {djs.element.Base}
19882 * @return {Array<ContextPadEntryDescriptor>} list of entries
19884 ContextPad.prototype.getEntries = function(element) {
19887 // loop through all providers and their entries.
19888 // group entries by id so that overriding an entry is possible
19889 forEach(this._providers, function(provider) {
19890 var e = provider.getContextPadEntries(element);
19892 forEach(e, function(entry, id) {
19893 entries[id] = entry;
19902 * Trigger an action available on the opened context pad
19909 ContextPad.prototype.trigger = function(action, event, autoActivate) {
19911 var current = this._current,
19912 element = current.element,
19913 entries = current.entries,
19917 button = event.delegateTarget || event.target;
19920 return event.preventDefault();
19923 entry = entries[domAttr(button, 'data-action')];
19924 handler = entry.action;
19926 originalEvent = event.originalEvent || event;
19928 // simple action (via callback function)
19929 if (isFunction(handler)) {
19930 if (action === 'click') {
19931 return handler(originalEvent, element, autoActivate);
19934 if (handler[action]) {
19935 return handler[action](originalEvent, element, autoActivate);
19939 // silence other actions
19940 event.preventDefault();
19945 * Open the context pad for the given element
19947 * @param {djs.model.Base}
19950 ContextPad.prototype.open = function(element) {
19952 if (this._current && this._current.open) {
19954 if (this._current.element === element) {
19955 // no change needed
19962 this._updateAndOpen(element);
19966 ContextPad.prototype._updateAndOpen = function(element) {
19968 var entries = this.getEntries(element),
19969 pad = this.getPad(element),
19974 forEach(entries, function(entry, id) {
19975 var grouping = entry.group || 'default',
19976 control = domify(entry.html || '<div class="entry" draggable="true"></div>'),
19979 domAttr(control, 'data-action', id);
19981 container = domQuery('[data-group=' + grouping + ']', html);
19983 container = domify('<div class="group" data-group="' + grouping + '"></div>');
19984 html.appendChild(container);
19987 container.appendChild(control);
19989 if (entry.className) {
19990 domClasses(control).add(entry.className);
19994 domAttr(control, 'title', entry.title);
19997 if (entry.imageUrl) {
19998 control.appendChild(domify('<img src="' + entry.imageUrl + '">'));
20002 domClasses(html).add('open');
20011 this._eventBus.fire('contextPad.open', {
20012 current: this._current
20016 ContextPad.prototype.getPad = function(element) {
20020 var overlays = this._overlays,
20021 pads = overlays.get({
20023 type: 'context-pad'
20026 // create context pad on demand if needed
20027 if (!pads.length) {
20029 var html = domify('<div class="djs-context-pad"></div>');
20031 domDelegate.bind(html, entrySelector, 'click', function(event) {
20032 self.trigger('click', event);
20035 domDelegate.bind(html, entrySelector, 'dragstart', function(event) {
20036 self.trigger('dragstart', event);
20039 // stop propagation of mouse events
20040 domEvent.bind(html, 'mousedown', function(event) {
20041 event.stopPropagation();
20045 overlays.add(element, 'context-pad', {
20053 pads = overlays.get({
20055 type: 'context-pad'
20058 this._eventBus.fire('contextPad.create', {
20069 * Close the context pad
20071 ContextPad.prototype.close = function() {
20075 if (this._current) {
20076 if (this._current.open) {
20077 html = this._current.pad.html;
20078 domClasses(html).remove('open');
20081 this._current.open = false;
20083 this._eventBus.fire('contextPad.close', {
20084 current: this._current
20091 * Return the element the context pad is currently opened for, if it is opened.
20095 * contextPad.open(shape1);
20097 * if (contextPad.isOpen()) { // yes, we are open }
20099 * @return {djs.model.Base} element
20101 ContextPad.prototype.isOpen = function() {
20102 return this._current && this._current.open;
20105 module.exports = ContextPad;
20108 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
20109 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
20110 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
20111 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
20112 "min-dom/lib/clear": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js",
20113 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js",
20114 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
20115 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
20116 "min-dom/lib/query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\query.js"
20118 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\index.js": [function(require, module, exports) {
20121 require('../interaction-events'),
20122 require('../overlays')
20124 contextPad: ['type', require('./ContextPad')]
20127 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
20128 "../overlays": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\index.js",
20129 "./ContextPad": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\context-pad\\ContextPad.js"
20131 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\Create.js": [function(require, module, exports) {
20134 var MARKER_OK = 'drop-ok',
20135 MARKER_NOT_OK = 'drop-not-ok';
20138 function Create(eventBus, dragging, rules, modeling, canvas, elementFactory, renderer, styles) {
20142 function canCreate(shape, target, source) {
20145 return rules.allowed('shape.append', {
20151 return rules.allowed('shape.create', {
20161 function createVisual(shape) {
20162 var group, preview, visual;
20164 group = canvas.getDefaultLayer().group().attr(styles.cls('djs-drag-group', ['no-events']));
20166 preview = group.group().addClass('djs-dragger');
20168 preview.translate(shape.width / -2, shape.height / -2);
20170 visual = preview.group().addClass('djs-visual');
20172 // hijack renderer to draw preview
20173 renderer.drawShape(visual, shape);
20181 eventBus.on('create.move', function(event) {
20183 var context = event.context,
20184 shape = context.shape,
20185 visual = context.visual;
20187 // lazy init drag visual once we received the first real
20188 // drag move event (this allows us to get the proper canvas local
20191 visual = context.visual = createVisual(shape);
20194 visual.translate(event.x, event.y);
20196 var hover = event.hover,
20199 canExecute = context.canExecute = hover && canCreate(context.shape, hover, context.source);
20201 // ignore hover visually if canExecute is null
20202 if (hover && canExecute !== null) {
20203 context.target = hover;
20204 canvas.addMarker(hover, canExecute ? MARKER_OK : MARKER_NOT_OK);
20208 eventBus.on(['create.end', 'create.out', 'create.cleanup'], function(event) {
20209 var context = event.context;
20211 if (context.target) {
20212 canvas.removeMarker(context.target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
20216 eventBus.on('create.end', function(event) {
20217 var context = event.context,
20218 source = context.source,
20219 shape = context.shape,
20220 target = context.target,
20221 canExecute = context.canExecute,
20232 modeling.appendShape(source, shape, position, target);
20234 modeling.createShape(shape, position, target);
20239 eventBus.on('create.cleanup', function(event) {
20240 var context = event.context;
20242 if (context.visual) {
20243 context.visual.remove();
20249 this.start = function(event, shape, source) {
20251 dragging.activate(event, 'create', {
20252 cursor: 'grabbing',
20253 autoActivate: true,
20265 Create.$inject = ['eventBus', 'dragging', 'rules', 'modeling', 'canvas', 'elementFactory', 'renderer', 'styles'];
20267 module.exports = Create;
20269 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\index.js": [function(require, module, exports) {
20272 require('../dragging'),
20273 require('../selection')
20275 create: ['type', require('./Create')]
20278 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
20279 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
20280 "./Create": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\create\\Create.js"
20282 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\Dragging.js": [function(require, module, exports) {
20285 /* global TouchEvent */
20287 var assign = require('lodash/object/assign');
20289 var domEvent = require('min-dom/lib/event'),
20290 Event = require('../../util/Event'),
20291 ClickTrap = require('../../util/ClickTrap'),
20292 Cursor = require('../../util/Cursor');
20294 function suppressEvent(event) {
20295 if (event instanceof MouseEvent) {
20296 Event.stopEvent(event, true);
20298 Event.preventDefault(event);
20302 function getLength(point) {
20303 return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
20306 function substract(p1, p2) {
20314 * A helper that fires canvas localized drag events and realizes the general
20315 * "drag-and-drop" look and feel.
20317 * Calling {@link Dragging#activate} activates dragging on a canvas.
20319 * It provides the following:
20320 * * emits the events `start`, `move`, `end`, `cancel` and `cleanup` via the
20321 * {@link EventBus}. Each of the events is prefixed with a prefix that is
20322 * assigned during activate. * sets and restores the cursor * sets and restores
20323 * the selection * ensures there can be only one drag operation active at a time
20325 * Dragging may be canceled manually by calling {@link Dragging#cancel} or by
20330 * function MyDragComponent(eventBus, dragging) {
20332 * eventBus.on('mydrag.start', function(event) { console.log('yes, we start
20335 * eventBus.on('mydrag.move', function(event) { console.log('canvas local
20336 * coordinates', event.x, event.y, event.dx, event.dy);
20337 * // local drag data is passed with the event event.context.foo; // "BAR"
20338 * // the original mouse event, too event.originalEvent; // MouseEvent(...) });
20340 * eventBus.on('element.click', function(event) { dragging.activate(event,
20341 * 'mydrag', { cursor: 'grabbing', data: { context: { foo: "BAR" } } }); }); }
20343 function Dragging(eventBus, canvas, selection) {
20345 var defaultOptions = {
20349 // the currently active drag operation
20350 // dragging is active as soon as this context exists.
20352 // it is visually _active_ only when a context.active flag is set to true.
20358 function fire(type) {
20360 var ActualEvent = require('../../core/EventBus').Event;
20362 var event = assign(new ActualEvent(), context.payload, context.data);
20364 // default integration
20365 if (eventBus.fire('drag.' + type, event) === false) {
20369 return eventBus.fire(context.prefix + '.' + type, event);
20374 function move(event, activate) {
20376 var payload = context.payload,
20377 start = context.start,
20378 position = Event.toPoint(event),
20379 delta = substract(position, start),
20380 clientRect = canvas._container.getBoundingClientRect(),
20383 // canvas relative position
20386 x: clientRect.left,
20390 // update actual event payload with canvas relative measures
20392 var viewbox = canvas.viewbox();
20395 x: viewbox.x + (position.x - offset.x) / viewbox.scale,
20396 y: viewbox.y + (position.y - offset.y) / viewbox.scale,
20397 dx: delta.x / viewbox.scale,
20398 dy: delta.y / viewbox.scale
20401 // activate context explicitly or once threshold is reached
20403 if (!context.active && (activate || getLength(delta) > context.threshold)) {
20405 // fire start event with original
20406 // starting coordinates
20409 x: movement.x - movement.dx,
20410 y: movement.y - movement.dy,
20414 originalEvent: event
20417 if (false === fire('start')) {
20421 context.active = true;
20424 if (!context.keepSelection) {
20425 context.previousSelection = selection.get();
20426 selection.select(null);
20429 // allow custom cursor
20430 if (context.cursor) {
20431 Cursor.set(context.cursor);
20435 suppressEvent(event);
20437 if (context.active) {
20439 // fire move event with actual coordinates
20440 assign(payload, movement, {
20441 originalEvent: event
20448 function end(event) {
20450 var returnValue = true;
20452 if (context.active) {
20455 context.payload.originalEvent = event;
20457 // suppress original event (click, ...)
20458 // because we just ended a drag operation
20459 suppressEvent(event);
20462 // implementations may stop restoring the
20463 // original state (selections, ...) by preventing the
20464 // end events default action
20465 returnValue = fire('end');
20468 if (returnValue === false) {
20472 cleanup(returnValue !== true);
20476 // cancel active drag operation if the user presses
20477 // the ESC key on the keyboard
20479 function checkCancel(event) {
20481 if (event.which === 27) {
20482 event.preventDefault();
20489 // prevent ghost click that might occur after a finished
20490 // drag and drop session
20492 function trapClickAndEnd(event) {
20496 // trap the click in case we are part of an active
20497 // drag operation. This will effectively prevent
20498 // the ghost click that cannot be canceled otherwise.
20499 if (context.active) {
20500 untrap = ClickTrap.install();
20501 setTimeout(untrap, 400);
20507 function trapTouch(event) {
20511 // update the drag events hover (djs.model.Base) and hoverGfx
20512 // (Snap<SVGElement>)
20513 // properties during hover and out and fire {prefix}.hover and {prefix}.out
20517 function hover(event) {
20518 var payload = context.payload;
20520 payload.hoverGfx = event.gfx;
20521 payload.hover = event.element;
20526 function out(event) {
20529 var payload = context.payload;
20531 payload.hoverGfx = null;
20532 payload.hover = null;
20536 // life-cycle methods
20538 function cancel(restore) {
20544 if (context.active) {
20551 function cleanup(restore) {
20558 // reset dom listeners
20559 domEvent.unbind(document, 'mousemove', move);
20561 domEvent.unbind(document, 'mousedown', trapClickAndEnd, true);
20562 domEvent.unbind(document, 'mouseup', trapClickAndEnd, true);
20564 domEvent.unbind(document, 'keyup', checkCancel);
20566 domEvent.unbind(document, 'touchstart', trapTouch, true);
20567 domEvent.unbind(document, 'touchcancel', cancel, true);
20568 domEvent.unbind(document, 'touchmove', move, true);
20569 domEvent.unbind(document, 'touchend', end, true);
20571 eventBus.off('element.hover', hover);
20572 eventBus.off('element.out', out);
20574 // restore selection, unless it has changed
20575 if (restore !== false && context.previousSelection && !selection.get().length) {
20576 selection.select(context.previousSelection);
20583 * Activate a drag operation
20585 * @param {MouseEvent|TouchEvent}
20592 function activate(event, prefix, options) {
20594 // only one drag operation may be active, at a time
20599 options = assign({}, defaultOptions, options || {});
20601 var data = options.data || {},
20606 originalEvent = Event.getOriginal(event) || event;
20607 start = Event.toPoint(event);
20609 suppressEvent(event);
20611 originalEvent = null;
20625 // skip dom registration if trigger
20626 // is set to manual (during testing)
20627 if (!options.manual) {
20629 // add dom listeners
20631 // fixes TouchEvent not being available on desktop Firefox
20632 if (typeof TouchEvent !== 'undefined' && originalEvent instanceof TouchEvent) {
20633 domEvent.bind(document, 'touchstart', trapTouch, true);
20634 domEvent.bind(document, 'touchcancel', cancel, true);
20635 domEvent.bind(document, 'touchmove', move, true);
20636 domEvent.bind(document, 'touchend', end, true);
20638 // assume we use the mouse to interact per default
20639 domEvent.bind(document, 'mousemove', move);
20641 domEvent.bind(document, 'mousedown', trapClickAndEnd, true);
20642 domEvent.bind(document, 'mouseup', trapClickAndEnd, true);
20645 domEvent.bind(document, 'keyup', checkCancel);
20647 eventBus.on('element.hover', hover);
20648 eventBus.on('element.out', out);
20653 if (options.autoActivate) {
20658 // cancel on diagram destruction
20659 eventBus.on('diagram.destroy', cancel);
20664 this.activate = activate;
20666 this.hover = hover;
20670 this.cancel = cancel;
20672 // for introspection
20674 this.active = function() {
20678 this.setOptions = function(options) {
20679 assign(defaultOptions, options);
20683 Dragging.$inject = ['eventBus', 'canvas', 'selection'];
20685 module.exports = Dragging;
20687 "../../core/EventBus": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\core\\EventBus.js",
20688 "../../util/ClickTrap": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\ClickTrap.js",
20689 "../../util/Cursor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js",
20690 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
20691 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
20692 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
20694 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js": [function(require, module, exports) {
20697 require('../selection')
20699 dragging: ['type', require('./Dragging')]
20702 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
20703 "./Dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\Dragging.js"
20705 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\InteractionEvents.js": [function(require, module, exports) {
20708 var forEach = require('lodash/collection/forEach'),
20709 domDelegate = require('min-dom/lib/delegate'),
20710 Renderer = require('../../draw/Renderer'),
20711 createLine = Renderer.createLine,
20712 updateLine = Renderer.updateLine;
20715 var isPrimaryButton = require('../../util/Mouse').isPrimaryButton;
20717 var Snap = require('../../../vendor/snapsvg');
20720 * A plugin that provides interaction events for diagram elements.
20722 * It emits the following events:
20723 * * element.hover * element.out * element.click * element.dblclick *
20724 * element.mousedown
20726 * Each event is a tuple { element, gfx, originalEvent }.
20728 * Canceling the event via Event#preventDefault() prevents the original DOM
20731 * @param {EventBus}
20734 function InteractionEvents(eventBus, elementRegistry, styles) {
20736 var HIT_STYLE = styles.cls('djs-hit', ['no-fill', 'no-border'], {
20741 function fire(type, event) {
20742 var target = event.delegateTarget || event.target,
20743 gfx = target && new Snap(target),
20744 element = elementRegistry.get(gfx),
20747 if (!gfx || !element) {
20751 returnValue = eventBus.fire(type, {
20754 originalEvent: event
20757 if (returnValue === false) {
20758 event.stopPropagation();
20759 event.preventDefault();
20765 function mouseHandler(type) {
20767 var fn = handlers[type];
20770 fn = handlers[type] = function(event) {
20771 // only indicate left mouse button interactions
20772 if (isPrimaryButton(event)) {
20782 mouseover: 'element.hover',
20783 mouseout: 'element.out',
20784 click: 'element.click',
20785 dblclick: 'element.dblclick',
20786 mousedown: 'element.mousedown',
20787 mouseup: 'element.mouseup',
20788 keydown: 'element.keyup'
20792 var elementSelector = 'svg, .djs-element';
20794 // /// event registration
20796 function registerEvent(node, event, localEvent) {
20797 var handler = mouseHandler(localEvent);
20798 handler.$delegate = domDelegate.bind(node, elementSelector, event, handler);
20801 function unregisterEvent(node, event, localEvent) {
20802 domDelegate.unbind(node, event, mouseHandler(localEvent).$delegate);
20805 function registerEvents(svg) {
20806 forEach(bindings, function(val, key) {
20807 registerEvent(svg.node, key, val);
20811 function unregisterEvents(svg) {
20812 forEach(bindings, function(val, key) {
20813 unregisterEvent(svg.node, key, val);
20817 eventBus.on('canvas.destroy', function(event) {
20818 unregisterEvents(event.svg);
20821 eventBus.on('canvas.init', function(event) {
20822 registerEvents(event.svg);
20826 eventBus.on(['shape.added', 'connection.added'], function(event) {
20827 var element = event.element,
20832 if (element.waypoints) {
20833 hit = createLine(element.waypoints);
20834 type = 'connection';
20836 hit = Snap.create('rect', {
20839 width: element.width,
20840 height: element.height
20845 hit.attr(HIT_STYLE).appendTo(gfx.node);
20848 // update djs-hit on change
20850 eventBus.on('shape.changed', function(event) {
20852 var element = event.element,
20854 hit = gfx.select('.djs-hit');
20857 width: element.width,
20858 height: element.height
20862 eventBus.on('connection.changed', function(event) {
20864 var element = event.element,
20866 hit = gfx.select('.djs-hit');
20868 updateLine(hit, element.waypoints);
20876 this.mouseHandler = mouseHandler;
20878 this.registerEvent = registerEvent;
20879 this.unregisterEvent = unregisterEvent;
20883 InteractionEvents.$inject = ['eventBus', 'elementRegistry', 'styles'];
20885 module.exports = InteractionEvents;
20889 * An event indicating that the mouse hovered over an element
20891 * @event element.hover
20894 * @property {djs.model.Base} element
20895 * @property {Snap<Element>} gfx
20896 * @property {Event} originalEvent
20900 * An event indicating that the mouse has left an element
20902 * @event element.out
20905 * @property {djs.model.Base} element
20906 * @property {Snap<Element>} gfx
20907 * @property {Event} originalEvent
20911 * An event indicating that the mouse has clicked an element
20913 * @event element.click
20916 * @property {djs.model.Base} element
20917 * @property {Snap<Element>} gfx
20918 * @property {Event} originalEvent
20922 * An event indicating that the mouse has double clicked an element
20924 * @event element.dblclick
20927 * @property {djs.model.Base} element
20928 * @property {Snap<Element>} gfx
20929 * @property {Event} originalEvent
20933 * An event indicating that the mouse has gone down on an element.
20935 * @event element.mousedown
20938 * @property {djs.model.Base} element
20939 * @property {Snap<Element>} gfx
20940 * @property {Event} originalEvent
20944 * An event indicating that the mouse has gone up on an element.
20946 * @event element.mouseup
20949 * @property {djs.model.Base} element
20950 * @property {Snap<Element>} gfx
20951 * @property {Event} originalEvent
20954 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
20955 "../../draw/Renderer": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\draw\\Renderer.js",
20956 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
20957 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
20958 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js"
20960 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js": [function(require, module, exports) {
20962 __init__: ['interactionEvents'],
20963 interactionEvents: ['type', require('./InteractionEvents')]
20966 "./InteractionEvents": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\InteractionEvents.js"
20968 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\Keyboard.js": [function(require, module, exports) {
20971 var domEvent = require('min-dom/lib/event'),
20972 domMatches = require('min-dom/lib/matches');
20973 //keyboard.bindTo=DOMElement;
20974 // var $ = require('jquery'),
20980 * A keyboard abstraction that may be activated and
20981 * deactivated by users at will, consuming key events
20982 * and triggering diagram actions.
20984 * The implementation fires the following key events that allow
20985 * other components to hook into key handling:
20988 * - keyboard.unbind
20990 * - keyboard.destroy
20992 * All events contain the fields (node, listeners).
20994 * A default binding for the keyboard may be specified via the
20995 * `keyboard.bindTo` configuration option.
20997 * @param {EventBus} eventBus
20998 * @param {CommandStack} commandStack
20999 * @param {Modeling} modeling
21000 * @param {Selection} selection
21004 function Keyboard(config, eventBus, commandStack, modeling, selection, zoomScroll, canvas) {
21006 $(document).keydown(function(e) {
21007 if (commandStack._selectedModel == selected_model) {
21008 if (commandStack._eventBus._listeners != null) {
21010 var model_commandStack = [];
21011 for (var i = 0; i < commandStackList.length; i++) {
21012 if (commandStackList[i]._selectedModel == selected_model) {
21013 if (commandStackList[i]._stack.length > 0) {
21014 model_commandStack.push(commandStackList[i]);
21019 var selected_commandStack;
21020 for (var i = model_commandStack.length - 1; i >= 0; i--) {
21021 if (model_commandStack[i]._stackIdx > -1) {
21022 selected_commandStack = model_commandStack[i];
21027 if (e.which == 90 && e.ctrlKey) {
21028 if (commandStack == selected_commandStack) {
21029 commandStack.undo();
21032 } else if (e.which == 89 && e.ctrlKey) {
21033 commandStack.redo();
21046 this._commandStack = commandStack;
21047 this._modeling = modeling;
21048 this._selection = selection;
21049 this._eventBus = eventBus;
21050 this._zoomScroll = zoomScroll;
21051 this._canvas = canvas;
21053 this._listeners = [];
21055 // our key handler is a singleton that passes
21056 // (keycode, modifiers) to each listener.
21058 // listeners must indicate that they handled a key event
21059 // by returning true. This stops the event propagation.
21061 this._keyHandler = function(event) {
21064 target = event.target,
21065 listeners = self._listeners,
21066 code = event.keyCode || event.charCode || -1;
21068 if (domMatches(target, 'input, textarea')) {
21072 for (i = 0; !!(l = listeners[i]); i++) {
21073 if (l(code, event)) {
21074 event.preventDefault();
21075 event.stopPropagation();
21080 // properly clean dom registrations
21081 eventBus.on('diagram.destroy', function() {
21082 self._fire('destroy');
21085 self._listeners = null;
21088 eventBus.on('diagram.init', function() {
21089 self._fire('init');
21091 if (config && config.bindTo) {
21092 self.bind(config.bindTo);
21099 Keyboard.$inject = [
21109 module.exports = Keyboard;
21112 Keyboard.prototype.bind = function(node) {
21116 domEvent.bind(node, 'keydown', this._keyHandler, true);
21118 this._fire('bind');
21121 Keyboard.prototype.getBinding = function() {
21125 Keyboard.prototype.unbind = function() {
21126 var node = this._node;
21129 this._fire('unbind');
21131 // unbind key events
21132 domEvent.unbind(node, 'keydown', this._keyHandler, true);
21139 Keyboard.prototype._fire = function(event) {
21140 this._eventBus.fire('keyboard.' + event, {
21142 listeners: this._listeners
21150 Keyboard.prototype._init = function() {
21152 var listeners = this._listeners,
21153 commandStack = this._commandStack,
21154 modeling = this._modeling,
21155 selection = this._selection,
21156 zoomScroll = this._zoomScroll,
21157 canvas = this._canvas;
21159 // init default listeners
21163 function undo(key, modifiers) {
21165 if (isCmd(modifiers) && !isShift(modifiers) && key === 90) {
21166 commandStack.undo();
21175 function redo(key, modifiers) {
21177 if (isCmd(modifiers) && (key === 89 || (key === 90 && isShift(modifiers)))) {
21178 commandStack.redo();
21188 * 107 = numpad plus
21189 * 187 = regular plus
21190 * 171 = regular plus in Firefox (german keyboard layout)
21191 * 61 = regular plus in Firefox (US keyboard layout)
21193 function zoomIn(key, modifiers) {
21195 if ((key === 107 || key === 187 || key === 171 || key === 61) && isCmd(modifiers)) {
21197 zoomScroll.stepZoom(1);
21204 * zoom out one step
21207 * 109 = numpad minus
21208 * 189 = regular minus
21209 * 173 = regular minus in Firefox (US and german keyboard layout)
21211 function zoomOut(key, modifiers) {
21213 if ((key === 109 || key === 189 || key === 173) && isCmd(modifiers)) {
21215 zoomScroll.stepZoom(-1);
21222 * zoom to the default level
21226 * 48 = regular zero
21228 function zoomDefault(key, modifiers) {
21230 if ((key === 96 || key === 48) && isCmd(modifiers)) {
21238 // delete selected element
21240 function remove(key, modifiers) {
21244 var selectedElements = selection.get();
21245 console.log(selectedElements);
21246 if (selectedElements.length) {
21247 modeling.removeElements(selectedElements.slice());
21254 listeners.push(undo);
21255 listeners.push(redo);
21256 listeners.push(remove);
21257 listeners.push(zoomIn);
21258 listeners.push(zoomOut);
21259 listeners.push(zoomDefault);
21264 * Add a listener function that is notified with (key, modifiers) whenever
21265 * the keyboard is bound and the user presses a key.
21267 * @param {Function} listenerFn
21269 Keyboard.prototype.addListener = function(listenerFn) {
21271 this._listeners.push(listenerFn);
21274 Keyboard.prototype.hasModifier = hasModifier;
21275 Keyboard.prototype.isCmd = isCmd;
21276 Keyboard.prototype.isShift = isShift;
21279 function hasModifier(modifiers) {
21280 return (modifiers.ctrlKey || modifiers.metaKey || modifiers.shiftKey || modifiers.altKey);
21283 function isCmd(modifiers) {
21284 return modifiers.ctrlKey || modifiers.metaKey;
21287 function isShift(modifiers) {
21288 return modifiers.shiftKey;
21292 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
21293 "min-dom/lib/matches": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\matches.js"
21295 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\index.js": [function(require, module, exports) {
21297 __init__: ['keyboard'],
21298 keyboard: ['type', require('./Keyboard')]
21302 "./Keyboard": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\keyboard\\Keyboard.js"
21304 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\lasso-tool\\LassoTool.js": [function(require, module, exports) {
21307 var values = require('lodash/object/values');
21309 var getEnclosedElements = require('../../util/Elements').getEnclosedElements;
21311 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier;
21313 var Snap = require('../../../vendor/snapsvg');
21316 function LassoTool(eventBus, canvas, dragging, elementRegistry, selection) {
21318 this._selection = selection;
21319 this._dragging = dragging;
21323 // lasso visuals implementation
21326 * A helper that realizes the selection box visual
21330 create: function(context) {
21331 var container = canvas.getDefaultLayer(),
21334 frame = context.frame = Snap.create('rect', {
21335 class: 'djs-lasso-overlay',
21342 frame.appendTo(container);
21345 update: function(context) {
21346 var frame = context.frame,
21347 bbox = context.bbox;
21353 height: bbox.height
21357 remove: function(context) {
21359 if (context.frame) {
21360 context.frame.remove();
21366 eventBus.on('lasso.selection.end', function(event) {
21368 setTimeout(function() {
21369 self.activateLasso(event.originalEvent, true);
21373 // lasso interaction implementation
21375 eventBus.on('lasso.end', function(event) {
21377 var bbox = toBBox(event);
21379 var elements = elementRegistry.filter(function(element) {
21383 self.select(elements, bbox);
21386 eventBus.on('lasso.start', function(event) {
21388 var context = event.context;
21390 context.bbox = toBBox(event);
21391 visuals.create(context);
21394 eventBus.on('lasso.move', function(event) {
21396 var context = event.context;
21398 context.bbox = toBBox(event);
21399 visuals.update(context);
21402 eventBus.on('lasso.end', function(event) {
21404 var context = event.context;
21406 visuals.remove(context);
21409 eventBus.on('lasso.cleanup', function(event) {
21411 var context = event.context;
21413 visuals.remove(context);
21417 // event integration
21419 eventBus.on('element.mousedown', 1500, function(event) {
21421 if (hasPrimaryModifier(event)) {
21422 self.activateLasso(event.originalEvent);
21424 event.stopPropagation();
21429 LassoTool.$inject = [
21437 module.exports = LassoTool;
21440 LassoTool.prototype.activateLasso = function(event, autoActivate) {
21442 this._dragging.activate(event, 'lasso', {
21443 autoActivate: autoActivate,
21444 cursor: 'crosshair',
21451 LassoTool.prototype.activateSelection = function(event) {
21453 this._dragging.activate(event, 'lasso.selection', {
21454 cursor: 'crosshair'
21458 LassoTool.prototype.select = function(elements, bbox) {
21459 var selectedElements = getEnclosedElements(elements, bbox);
21461 this._selection.select(values(selectedElements));
21465 function toBBox(event) {
21469 x: event.x - event.dx,
21470 y: event.y - event.dy
21480 if ((start.x <= end.x && start.y < end.y) ||
21481 (start.x < end.x && start.y <= end.y)) {
21486 width: end.x - start.x,
21487 height: end.y - start.y
21489 } else if ((start.x >= end.x && start.y < end.y) ||
21490 (start.x > end.x && start.y <= end.y)) {
21495 width: start.x - end.x,
21496 height: end.y - start.y
21498 } else if ((start.x <= end.x && start.y > end.y) ||
21499 (start.x < end.x && start.y >= end.y)) {
21504 width: end.x - start.x,
21505 height: start.y - end.y
21507 } else if ((start.x >= end.x && start.y > end.y) ||
21508 (start.x > end.x && start.y >= end.y)) {
21513 width: start.x - end.x,
21514 height: start.y - end.y
21528 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
21529 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
21530 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
21531 "lodash/object/values": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\values.js"
21533 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\lasso-tool\\index.js": [function(require, module, exports) {
21537 __init__: ['lassoTool'],
21538 lassoTool: ['type', require('./LassoTool')]
21542 "./LassoTool": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\lasso-tool\\LassoTool.js"
21544 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\Modeling.js": [function(require, module, exports) {
21547 var forEach = require('lodash/collection/forEach');
21549 var model = require('../../model');
21553 * The basic modeling entry point.
21555 * @param {EventBus}
21557 * @param {ElementFactory}
21559 * @param {CommandStack}
21562 function Modeling(eventBus, elementFactory, commandStack) {
21563 this._eventBus = eventBus;
21564 this._elementFactory = elementFactory;
21565 this._commandStack = commandStack;
21568 eventBus.on('diagram.init', function() {
21569 // register modeling handlers
21570 self.registerHandlers(commandStack);
21574 Modeling.$inject = ['eventBus', 'elementFactory', 'commandStack'];
21576 module.exports = Modeling;
21579 Modeling.prototype.getHandlers = function() {
21581 'shape.append': require('./cmd/AppendShapeHandler'),
21582 'shape.create': require('./cmd/CreateShapeHandler'),
21583 'shape.delete': require('./cmd/DeleteShapeHandler'),
21584 'shape.move': require('./cmd/MoveShapeHandler'),
21585 'shapes.move': require('./cmd/MoveShapesHandler'),
21586 'shape.resize': require('./cmd/ResizeShapeHandler'),
21587 'shape.replace': require('./cmd/ReplaceShapeHandler'),
21589 'spaceTool': require('./cmd/SpaceToolHandler'),
21591 'label.create': require('./cmd/CreateLabelHandler'),
21593 'connection.create': require('./cmd/CreateConnectionHandler'),
21594 'connection.delete': require('./cmd/DeleteConnectionHandler'),
21595 'connection.move': require('./cmd/MoveConnectionHandler'),
21596 'connection.layout': require('./cmd/LayoutConnectionHandler'),
21598 'connection.updateWaypoints': require('./cmd/UpdateWaypointsHandler'),
21600 'connection.reconnectStart': require('./cmd/ReconnectConnectionHandler'),
21601 'connection.reconnectEnd': require('./cmd/ReconnectConnectionHandler'),
21603 'elements.delete': require('./cmd/DeleteElementsHandler'),
21604 'element.updateAnchors': require('./cmd/UpdateAnchorsHandler')
21609 * Register handlers with the command stack
21611 * @param {CommandStack}
21614 Modeling.prototype.registerHandlers = function(commandStack) {
21615 forEach(this.getHandlers(), function(handler, id) {
21616 commandStack.registerHandler(id, handler);
21621 // /// modeling helpers /////////////////////////////////////////
21624 Modeling.prototype.moveShape = function(shape, delta, newParent, hints) {
21629 newParent: newParent,
21633 this._commandStack.execute('shape.move', context);
21637 Modeling.prototype.moveShapes = function(shapes, delta, newParent, hints) {
21642 newParent: newParent,
21646 this._commandStack.execute('shapes.move', context);
21650 * Update the anchors on the element with the given delta movement
21652 * @param {djs.model.Element}
21657 Modeling.prototype.updateAnchors = function(element, delta) {
21663 this._commandStack.execute('element.updateAnchors', context);
21666 Modeling.prototype.moveConnection = function(connection, delta, newParent, hints) {
21669 connection: connection,
21671 newParent: newParent,
21675 this._commandStack.execute('connection.move', context);
21679 Modeling.prototype.layoutConnection = function(connection, hints) {
21682 connection: connection,
21686 this._commandStack.execute('connection.layout', context);
21690 Modeling.prototype.createConnection = function(source, target, connection, parent) {
21692 connection = this._create('connection', connection);
21698 connection: connection
21701 this._commandStack.execute('connection.create', context);
21703 return context.connection;
21706 Modeling.prototype.createShape = function(shape, position, parent) {
21708 shape = this._create('shape', shape);
21711 position: position,
21716 this._commandStack.execute('shape.create', context);
21718 return context.shape;
21722 Modeling.prototype.createLabel = function(labelTarget, position, label, parent) {
21724 label = this._create('label', label);
21727 labelTarget: labelTarget,
21728 position: position,
21733 this._commandStack.execute('label.create', context);
21735 return context.shape;
21739 Modeling.prototype.appendShape = function(source, shape, position, parent, connection, connectionParent) {
21741 shape = this._create('shape', shape);
21745 position: position,
21748 connection: connection,
21749 connectionParent: connectionParent
21752 this._commandStack.execute('shape.append', context);
21754 return context.shape;
21758 Modeling.prototype.removeElements = function(elements) {
21759 console.log(elements);
21764 this._commandStack.execute('elements.delete', context);
21768 Modeling.prototype.removeShape = function(shape) {
21773 this._commandStack.execute('shape.delete', context);
21777 Modeling.prototype.removeConnection = function(connection) {
21779 connection: connection
21782 this._commandStack.execute('connection.delete', context);
21785 Modeling.prototype.replaceShape = function(oldShape, newShape, options) {
21787 oldShape: oldShape,
21792 this._commandStack.execute('shape.replace', context);
21794 return context.newShape;
21797 Modeling.prototype.resizeShape = function(shape, newBounds) {
21800 newBounds: newBounds
21803 this._commandStack.execute('shape.resize', context);
21806 Modeling.prototype.createSpace = function(movingShapes, resizingShapes, delta, direction) {
21808 movingShapes: movingShapes,
21809 resizingShapes: resizingShapes,
21811 direction: direction
21814 this._commandStack.execute('spaceTool', context);
21817 Modeling.prototype.updateWaypoints = function(connection, newWaypoints) {
21819 connection: connection,
21820 newWaypoints: newWaypoints
21823 this._commandStack.execute('connection.updateWaypoints', context);
21826 Modeling.prototype.reconnectStart = function(connection, newSource, dockingPoint) {
21828 connection: connection,
21829 newSource: newSource,
21830 dockingPoint: dockingPoint
21833 this._commandStack.execute('connection.reconnectStart', context);
21836 Modeling.prototype.reconnectEnd = function(connection, newTarget, dockingPoint) {
21838 connection: connection,
21839 newTarget: newTarget,
21840 dockingPoint: dockingPoint
21843 this._commandStack.execute('connection.reconnectEnd', context);
21846 Modeling.prototype.connect = function(source, target, attrs) {
21847 return this.createConnection(source, target, attrs || {}, source.parent);
21851 Modeling.prototype._create = function(type, attrs) {
21852 if (attrs instanceof model.Base) {
21855 return this._elementFactory.create(type, attrs);
21860 "../../model": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js",
21861 "./cmd/AppendShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\AppendShapeHandler.js",
21862 "./cmd/CreateConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateConnectionHandler.js",
21863 "./cmd/CreateLabelHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateLabelHandler.js",
21864 "./cmd/CreateShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateShapeHandler.js",
21865 "./cmd/DeleteConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteConnectionHandler.js",
21866 "./cmd/DeleteElementsHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteElementsHandler.js",
21867 "./cmd/DeleteShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteShapeHandler.js",
21868 "./cmd/LayoutConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\LayoutConnectionHandler.js",
21869 "./cmd/MoveConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveConnectionHandler.js",
21870 "./cmd/MoveShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapeHandler.js",
21871 "./cmd/MoveShapesHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapesHandler.js",
21872 "./cmd/ReconnectConnectionHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReconnectConnectionHandler.js",
21873 "./cmd/ReplaceShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReplaceShapeHandler.js",
21874 "./cmd/ResizeShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ResizeShapeHandler.js",
21875 "./cmd/SpaceToolHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\SpaceToolHandler.js",
21876 "./cmd/UpdateAnchorsHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateAnchorsHandler.js",
21877 "./cmd/UpdateWaypointsHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateWaypointsHandler.js",
21878 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
21880 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\AppendShapeHandler.js": [function(require, module, exports) {
21883 var inherits = require('inherits');
21887 * A handler that implements reversible appending of shapes to a source shape.
21891 * @param {elementFactory}
21893 * @param {modeling}
21896 function AppendShapeHandler(modeling) {
21897 this._modeling = modeling;
21900 inherits(AppendShapeHandler, require('./NoopHandler'));
21903 AppendShapeHandler.$inject = ['modeling'];
21905 module.exports = AppendShapeHandler;
21908 // //// api /////////////////////////////////////////////
21911 * Creates a new shape
21915 * @param {ElementDescriptor}
21916 * context.shape the new shape
21917 * @param {ElementDescriptor}
21918 * context.source the source object
21919 * @param {ElementDescriptor}
21920 * context.parent the parent object
21922 * context.position position of the new element
21924 AppendShapeHandler.prototype.preExecute = function(context) {
21926 if (!context.source) {
21927 throw new Error('source required');
21930 var parent = context.parent || context.source.parent,
21931 shape = this._modeling.createShape(context.shape, context.position, parent);
21933 context.shape = shape;
21936 AppendShapeHandler.prototype.postExecute = function(context) {
21937 var parent = context.connectionParent || context.shape.parent;
21939 // create connection
21940 this._modeling.connect(context.source, context.shape, context.connection, parent);
21943 "./NoopHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\NoopHandler.js",
21944 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js"
21946 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateConnectionHandler.js": [function(require, module, exports) {
21950 function CreateConnectionHandler(canvas, layouter) {
21951 this._canvas = canvas;
21952 this._layouter = layouter;
21955 CreateConnectionHandler.$inject = ['canvas', 'layouter'];
21957 module.exports = CreateConnectionHandler;
21961 // //// api /////////////////////////////////////////
21964 * Appends a shape to a target shape
21968 * @param {djs.element.Base}
21969 * context.source the source object
21970 * @param {djs.element.Base}
21971 * context.target the parent object
21973 * context.position position of the new element
21975 CreateConnectionHandler.prototype.execute = function(context) {
21977 var source = context.source,
21978 target = context.target,
21979 parent = context.parent;
21981 if (!source || !target) {
21982 throw new Error('source and target required');
21986 throw new Error('parent required');
21989 var connection = context.connection;
21991 connection.source = source;
21992 connection.target = target;
21994 if (!connection.waypoints) {
21995 connection.waypoints = this._layouter.layoutConnection(connection);
21999 this._canvas.addConnection(connection, parent);
22004 CreateConnectionHandler.prototype.revert = function(context) {
22005 var connection = context.connection;
22007 this._canvas.removeConnection(connection);
22009 connection.source = null;
22010 connection.target = null;
22013 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateLabelHandler.js": [function(require, module, exports) {
22016 var inherits = require('inherits');
22018 var CreateShapeHandler = require('./CreateShapeHandler');
22022 * A handler that attaches a label to a given target shape.
22027 function CreateLabelHandler(canvas) {
22028 CreateShapeHandler.call(this, canvas);
22031 inherits(CreateLabelHandler, CreateShapeHandler);
22033 CreateLabelHandler.$inject = ['canvas'];
22035 module.exports = CreateLabelHandler;
22039 // //// api /////////////////////////////////////////
22043 * Appends a label to a target shape.
22045 * @method CreateLabelHandler#execute
22049 * @param {ElementDescriptor}
22050 * context.target the element the label is attached to
22051 * @param {ElementDescriptor}
22052 * context.parent the parent object
22054 * context.position position of the new element
22058 * Undo append by removing the shape
22060 CreateLabelHandler.prototype.revert = function(context) {
22061 context.shape.labelTarget = null;
22062 this._canvas.removeShape(context.shape);
22066 // //// helpers /////////////////////////////////////////
22068 CreateLabelHandler.prototype.getParent = function(context) {
22069 return context.parent || context.labelTarget && context.labelTarget.parent;
22072 CreateLabelHandler.prototype.addElement = function(shape, parent, context) {
22073 shape.labelTarget = context.labelTarget;
22074 this._canvas.addShape(shape, parent, true);
22077 "./CreateShapeHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateShapeHandler.js",
22078 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js"
22080 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\CreateShapeHandler.js": [function(require, module, exports) {
22083 var assign = require('lodash/object/assign');
22087 * A handler that implements reversible addition of shapes.
22092 function CreateShapeHandler(canvas) {
22093 this._canvas = canvas;
22096 CreateShapeHandler.$inject = ['canvas'];
22098 module.exports = CreateShapeHandler;
22102 // //// api /////////////////////////////////////////
22106 * Appends a shape to a target shape
22110 * @param {djs.model.Base}
22111 * context.parent the parent object
22113 * context.position position of the new element
22115 CreateShapeHandler.prototype.execute = function(context) {
22117 var parent = this.getParent(context);
22119 var shape = context.shape;
22121 this.setPosition(shape, context);
22123 this.addElement(shape, parent, context);
22130 * Undo append by removing the shape
22132 CreateShapeHandler.prototype.revert = function(context) {
22133 this._canvas.removeShape(context.shape);
22137 // //// helpers /////////////////////////////////////////
22139 CreateShapeHandler.prototype.getParent = function(context) {
22140 var parent = context.parent;
22143 throw new Error('parent required');
22149 CreateShapeHandler.prototype.getPosition = function(context) {
22150 if (!context.position) {
22151 throw new Error('no position given');
22154 return context.position;
22157 CreateShapeHandler.prototype.addElement = function(shape, parent) {
22158 this._canvas.addShape(shape, parent);
22161 CreateShapeHandler.prototype.setPosition = function(shape, context) {
22162 var position = this.getPosition(context);
22164 // update to center position
22165 // specified in create context
22167 x: position.x - shape.width / 2,
22168 y: position.y - shape.height / 2
22172 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22174 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteConnectionHandler.js": [function(require, module, exports) {
22177 var Collections = require('../../../util/Collections');
22181 * A handler that implements reversible deletion of Connections.
22184 function DeleteConnectionHandler(canvas, modeling) {
22185 this._canvas = canvas;
22186 this._modeling = modeling;
22189 DeleteConnectionHandler.$inject = ['canvas', 'modeling'];
22191 module.exports = DeleteConnectionHandler;
22195 * - Remove attached label
22197 DeleteConnectionHandler.prototype.preExecute = function(context) {
22199 var connection = context.connection;
22202 if (connection.label) {
22203 this._modeling.removeShape(connection.label);
22207 DeleteConnectionHandler.prototype.execute = function(context) {
22209 var connection = context.connection,
22210 parent = connection.parent;
22212 context.parent = parent;
22213 context.parentIndex = Collections.indexOf(parent.children, connection);
22215 context.source = connection.source;
22216 context.target = connection.target;
22218 this._canvas.removeConnection(connection);
22220 connection.source = null;
22221 connection.target = null;
22222 connection.label = null;
22226 * Command revert implementation.
22228 DeleteConnectionHandler.prototype.revert = function(context) {
22230 var connection = context.connection,
22231 parent = context.parent,
22232 parentIndex = context.parentIndex;
22234 connection.source = context.source;
22235 connection.target = context.target;
22237 // restore previous location in old parent
22238 Collections.add(parent.children, connection, parentIndex);
22240 this._canvas.addConnection(connection, parent);
22244 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js"
22246 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteElementsHandler.js": [function(require, module, exports) {
22249 var forEach = require('lodash/collection/forEach'),
22250 inherits = require('inherits');
22253 function DeleteElementsHandler(modeling, elementRegistry) {
22254 this._modeling = modeling;
22255 this._elementRegistry = elementRegistry;
22258 inherits(DeleteElementsHandler, require('./NoopHandler'));
22260 DeleteElementsHandler.$inject = ['modeling', 'elementRegistry'];
22262 module.exports = DeleteElementsHandler;
22265 DeleteElementsHandler.prototype.postExecute = function(context) {
22267 var modeling = this._modeling,
22268 elementRegistry = this._elementRegistry,
22269 elements = context.elements;
22271 forEach(elements, function(element) {
22273 // element may have been removed with previous
22274 // remove operations already (e.g. in case of nesting)
22275 if (!elementRegistry.get(element.id)) {
22279 if (element.waypoints) {
22280 modeling.removeConnection(element);
22282 modeling.removeShape(element);
22287 "./NoopHandler": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\NoopHandler.js",
22288 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js",
22289 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
22291 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\DeleteShapeHandler.js": [function(require, module, exports) {
22294 var Collections = require('../../../util/Collections');
22298 * A handler that implements reversible deletion of shapes.
22301 function DeleteShapeHandler(canvas, modeling) {
22302 this._canvas = canvas;
22303 this._modeling = modeling;
22306 DeleteShapeHandler.$inject = ['canvas', 'modeling'];
22308 module.exports = DeleteShapeHandler;
22312 * - Remove connections - Remove all direct children
22314 DeleteShapeHandler.prototype.preExecute = function(context) {
22316 var shape = context.shape,
22317 label = shape.label,
22318 modeling = this._modeling;
22320 // Clean up on removeShape(label)
22321 if (shape.labelTarget) {
22322 context.labelTarget = shape.labelTarget;
22323 shape.labelTarget = null;
22328 this._modeling.removeShape(label);
22331 // remove connections
22332 this._saveClear(shape.incoming, function(connection) {
22333 // To make sure that the connection isn't removed twice
22334 // For example if a container is removed
22335 modeling.removeConnection(connection);
22338 this._saveClear(shape.outgoing, function(connection) {
22339 modeling.removeConnection(connection);
22344 this._saveClear(shape.children, function(e) {
22345 modeling.removeShape(e);
22350 DeleteShapeHandler.prototype._saveClear = function(collection, remove) {
22354 while (!!(e = collection[0])) {
22361 * Remove shape and remember the parent
22363 DeleteShapeHandler.prototype.execute = function(context) {
22365 var shape = context.shape,
22366 parent = shape.parent;
22368 context.parent = parent;
22369 context.parentIndex = Collections.indexOf(parent.children, shape);
22371 shape.label = null;
22373 this._canvas.removeShape(shape);
22378 * Command revert implementation
22380 DeleteShapeHandler.prototype.revert = function(context) {
22382 var shape = context.shape,
22383 parent = context.parent,
22384 parentIndex = context.parentIndex,
22385 labelTarget = context.labelTarget;
22387 // restore previous location in old parent
22388 Collections.add(parent.children, shape, parentIndex);
22391 labelTarget.label = shape;
22394 this._canvas.addShape(shape, parent);
22398 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js"
22400 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\LayoutConnectionHandler.js": [function(require, module, exports) {
22403 var assign = require('lodash/object/assign');
22407 * A handler that implements reversible moving of shapes.
22409 function LayoutConnectionHandler(layouter, canvas) {
22410 this._layouter = layouter;
22411 this._canvas = canvas;
22414 LayoutConnectionHandler.$inject = ['layouter', 'canvas'];
22416 module.exports = LayoutConnectionHandler;
22418 LayoutConnectionHandler.prototype.execute = function(context) {
22420 var connection = context.connection,
22421 parent = connection.parent,
22422 connectionSiblings = parent.children;
22424 var oldIndex = connectionSiblings.indexOf(connection);
22427 oldWaypoints: connection.waypoints,
22431 sendToFront(connection);
22433 connection.waypoints = this._layouter.layoutConnection(connection, context.hints);
22438 LayoutConnectionHandler.prototype.revert = function(context) {
22440 var connection = context.connection,
22441 parent = connection.parent,
22442 connectionSiblings = parent.children,
22443 currentIndex = connectionSiblings.indexOf(connection),
22444 oldIndex = context.oldIndex;
22446 connection.waypoints = context.oldWaypoints;
22448 if (oldIndex !== currentIndex) {
22450 // change position of connection in shape
22451 connectionSiblings.splice(currentIndex, 1);
22452 connectionSiblings.splice(oldIndex, 0, connection);
22458 // connections should have a higher z-order as there source and targets
22459 function sendToFront(connection) {
22461 var connectionSiblings = connection.parent.children;
22463 var connectionIdx = connectionSiblings.indexOf(connection),
22464 sourceIdx = findIndex(connectionSiblings, connection.source),
22465 targetIdx = findIndex(connectionSiblings, connection.target),
22467 // ensure we do not send the connection back
22468 // if it is already in front
22469 insertIndex = Math.max(sourceIdx + 1, targetIdx + 1, connectionIdx);
22471 if (connectionIdx < insertIndex) {
22472 connectionSiblings.splice(insertIndex, 0, connection); // add to new
22474 connectionSiblings.splice(connectionIdx, 1); // remove from old position
22477 function findIndex(array, obj) {
22479 var index = array.indexOf(obj);
22480 if (index < 0 && obj) {
22481 var parent = obj.parent;
22482 index = findIndex(array, parent);
22487 return insertIndex;
22491 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22493 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveConnectionHandler.js": [function(require, module, exports) {
22496 var forEach = require('lodash/collection/forEach');
22498 var Collections = require('../../../util/Collections');
22502 * A handler that implements reversible moving of connections.
22504 * The handler differs from the layout connection handler in a sense that it
22505 * preserves the connection layout.
22507 function MoveConnectionHandler() {}
22509 module.exports = MoveConnectionHandler;
22512 MoveConnectionHandler.prototype.execute = function(context) {
22514 var updateAnchors = (context.hints.updateAnchors !== false);
22516 var connection = context.connection,
22517 delta = context.delta;
22519 var newParent = this.getNewParent(connection, context),
22520 oldParent = connection.parent;
22522 // save old position + parent in context
22523 context.oldParent = oldParent;
22524 context.oldParentIndex = Collections.indexOf(oldParent.children, connection);
22526 // update waypoint positions
22527 forEach(connection.waypoints, function(p) {
22531 if (updateAnchors && p.original) {
22532 p.original.x += delta.x;
22533 p.original.y += delta.y;
22538 connection.parent = newParent;
22543 MoveConnectionHandler.prototype.revert = function(context) {
22545 var updateAnchors = (context.hints.updateAnchors !== false);
22547 var connection = context.connection,
22548 oldParent = context.oldParent,
22549 oldParentIndex = context.oldParentIndex,
22550 delta = context.delta;
22552 // restore previous location in old parent
22553 Collections.add(oldParent.children, connection, oldParentIndex);
22556 connection.parent = oldParent;
22558 // revert to old waypoint positions
22559 forEach(connection.waypoints, function(p) {
22563 if (updateAnchors && p.original) {
22564 p.original.x -= delta.x;
22565 p.original.y -= delta.y;
22573 MoveConnectionHandler.prototype.getNewParent = function(connection, context) {
22574 return context.newParent || connection.parent;
22578 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
22579 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
22581 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapeHandler.js": [function(require, module, exports) {
22584 var assign = require('lodash/object/assign'),
22585 forEach = require('lodash/collection/forEach');
22587 var MoveHelper = require('./helper/MoveHelper'),
22588 Collections = require('../../../util/Collections');
22592 * A handler that implements reversible moving of shapes.
22594 function MoveShapeHandler(modeling) {
22595 this._modeling = modeling;
22597 this._helper = new MoveHelper(modeling);
22600 MoveShapeHandler.$inject = ['modeling'];
22602 module.exports = MoveShapeHandler;
22605 MoveShapeHandler.prototype.execute = function(context) {
22607 var shape = context.shape,
22608 delta = context.delta,
22609 newParent = this.getNewParent(context),
22610 oldParent = shape.parent;
22612 // save old parent in context
22613 context.oldParent = oldParent;
22614 context.oldParentIndex = Collections.indexOf(oldParent.children, shape);
22616 // update shape parent + position
22619 x: shape.x + delta.x,
22620 y: shape.y + delta.y
22626 MoveShapeHandler.prototype.postExecute = function(context) {
22628 var shape = context.shape,
22629 delta = context.delta;
22631 var modeling = this._modeling;
22633 if (context.hints.updateAnchors !== false) {
22634 modeling.updateAnchors(shape, delta);
22637 if (context.hints.layout !== false) {
22638 forEach(shape.incoming, function(c) {
22639 modeling.layoutConnection(c, {
22644 forEach(shape.outgoing, function(c) {
22645 modeling.layoutConnection(c, {
22651 if (context.hints.recurse !== false) {
22652 this.moveChildren(context);
22656 MoveShapeHandler.prototype.revert = function(context) {
22658 var shape = context.shape,
22659 oldParent = context.oldParent,
22660 oldParentIndex = context.oldParentIndex,
22661 delta = context.delta;
22663 // restore previous location in old parent
22664 Collections.add(oldParent.children, shape, oldParentIndex);
22666 // revert to old position and parent
22669 x: shape.x - delta.x,
22670 y: shape.y - delta.y
22676 MoveShapeHandler.prototype.moveChildren = function(context) {
22678 var delta = context.delta,
22679 shape = context.shape;
22681 this._helper.moveRecursive(shape.children, delta, null);
22684 MoveShapeHandler.prototype.getNewParent = function(context) {
22685 return context.newParent || context.shape.parent;
22688 "../../../util/Collections": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js",
22689 "./helper/MoveHelper": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\helper\\MoveHelper.js",
22690 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
22691 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
22693 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\MoveShapesHandler.js": [function(require, module, exports) {
22696 var MoveHelper = require('./helper/MoveHelper');
22700 * A handler that implements reversible moving of shapes.
22702 function MoveShapesHandler(modeling) {
22703 this._helper = new MoveHelper(modeling);
22706 MoveShapesHandler.$inject = ['modeling'];
22708 module.exports = MoveShapesHandler;
22710 MoveShapesHandler.prototype.preExecute = function(context) {
22711 context.closure = this._helper.getClosure(context.shapes);
22714 MoveShapesHandler.prototype.postExecute = function(context) {
22715 this._helper.moveClosure(context.closure, context.delta, context.newParent);
22719 MoveShapesHandler.prototype.execute = function(context) {};
22720 MoveShapesHandler.prototype.revert = function(context) {};
22723 "./helper/MoveHelper": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\helper\\MoveHelper.js"
22725 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\NoopHandler.js": [function(require, module, exports) {
22728 function NoopHandler() {}
22730 module.exports = NoopHandler;
22732 NoopHandler.prototype.execute = function() {};
22733 NoopHandler.prototype.revert = function() {};
22735 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReconnectConnectionHandler.js": [function(require, module, exports) {
22739 function ReconnectConnectionHandler(layouter) {}
22741 ReconnectConnectionHandler.$inject = ['layouter'];
22743 module.exports = ReconnectConnectionHandler;
22745 ReconnectConnectionHandler.prototype.execute = function(context) {
22747 var newSource = context.newSource,
22748 newTarget = context.newTarget,
22749 connection = context.connection;
22751 if (!newSource && !newTarget) {
22752 throw new Error('newSource or newTarget are required');
22755 if (newSource && newTarget) {
22756 throw new Error('must specify either newSource or newTarget');
22760 context.oldSource = connection.source;
22761 connection.source = newSource;
22763 context.oldDockingPoint = connection.waypoints[0];
22764 connection.waypoints[0] = context.dockingPoint;
22768 context.oldTarget = connection.target;
22769 connection.target = newTarget;
22771 context.oldDockingPoint = connection.waypoints[connection.waypoints.length - 1];
22772 connection.waypoints[connection.waypoints.length - 1] = context.dockingPoint;
22778 ReconnectConnectionHandler.prototype.revert = function(context) {
22780 var newSource = context.newSource,
22781 newTarget = context.newTarget,
22782 connection = context.connection;
22785 connection.source = context.oldSource;
22786 connection.waypoints[0] = context.oldDockingPoint;
22790 connection.target = context.oldTarget;
22791 connection.waypoints[connection.waypoints.length - 1] = context.oldDockingPoint;
22797 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ReplaceShapeHandler.js": [function(require, module, exports) {
22800 var forEach = require('lodash/collection/forEach');
22804 * A handler that implements reversible replacing of shapes. Internally the old
22805 * shape will be removed and the new shape will be added.
22814 function ReplaceShapeHandler(modeling, rules) {
22815 this._modeling = modeling;
22816 this._rules = rules;
22819 ReplaceShapeHandler.$inject = ['modeling', 'rules'];
22821 module.exports = ReplaceShapeHandler;
22825 // //// api /////////////////////////////////////////
22829 * Replaces a shape with an replacement Element.
22831 * The newData object should contain type, x, y.
22833 * If possible also the incoming/outgoing connection will be restored.
22838 ReplaceShapeHandler.prototype.preExecute = function(context) {
22840 var modeling = this._modeling,
22841 rules = this._rules;
22843 var oldShape = context.oldShape,
22844 newData = context.newData,
22848 // (1) place a new shape at the given position
22855 newShape = context.newShape = context.newShape || modeling.createShape(newData, position, oldShape.parent);
22858 // (2) reconnect connections to the new shape (where allowed)
22860 var incoming = oldShape.incoming.slice(),
22861 outgoing = oldShape.outgoing.slice();
22863 forEach(incoming, function(connection) {
22864 var waypoints = connection.waypoints,
22865 docking = waypoints[waypoints.length - 1],
22866 allowed = rules.allowed('connection.reconnectEnd', {
22867 source: connection.source,
22869 connection: connection
22873 modeling.reconnectEnd(connection, newShape, docking);
22877 forEach(outgoing, function(connection) {
22878 var waypoints = connection.waypoints,
22879 docking = waypoints[0],
22880 allowed = rules.allowed('connection.reconnectStart', {
22882 target: connection.target,
22883 connection: connection
22887 modeling.reconnectStart(connection, newShape, docking);
22893 ReplaceShapeHandler.prototype.postExecute = function(context) {
22894 var modeling = this._modeling;
22896 var oldShape = context.oldShape;
22898 modeling.removeShape(oldShape);
22902 ReplaceShapeHandler.prototype.execute = function(context) {};
22904 ReplaceShapeHandler.prototype.revert = function(context) {};
22907 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
22909 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\ResizeShapeHandler.js": [function(require, module, exports) {
22912 var assign = require('lodash/object/assign'),
22913 forEach = require('lodash/collection/forEach');
22917 * A handler that implements reversible resizing of shapes.
22920 function ResizeShapeHandler(modeling) {
22921 this._modeling = modeling;
22924 ResizeShapeHandler.$inject = ['modeling'];
22926 module.exports = ResizeShapeHandler;
22929 * { shape: {....} newBounds: { width: 20, height: 40, x: 5, y: 10 }
22932 ResizeShapeHandler.prototype.execute = function(context) {
22934 var shape = context.shape,
22935 newBounds = context.newBounds;
22937 if (newBounds.x === undefined || newBounds.y === undefined ||
22938 newBounds.width === undefined || newBounds.height === undefined) {
22939 throw new Error('newBounds must have {x, y, width, height} properties');
22942 if (newBounds.width < 10 || newBounds.height < 10) {
22943 throw new Error('width and height cannot be less than 10px');
22946 // save old bbox in context
22947 context.oldBounds = {
22948 width: shape.width,
22949 height: shape.height,
22956 width: newBounds.width,
22957 height: newBounds.height,
22965 ResizeShapeHandler.prototype.postExecute = function(context) {
22967 var shape = context.shape;
22969 var modeling = this._modeling;
22971 forEach(shape.incoming, function(c) {
22972 modeling.layoutConnection(c, {
22977 forEach(shape.outgoing, function(c) {
22978 modeling.layoutConnection(c, {
22985 ResizeShapeHandler.prototype.revert = function(context) {
22987 var shape = context.shape,
22988 oldBounds = context.oldBounds;
22990 // restore previous bbox
22992 width: oldBounds.width,
22993 height: oldBounds.height,
23002 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
23003 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
23005 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\SpaceToolHandler.js": [function(require, module, exports) {
23008 var forEach = require('lodash/collection/forEach');
23010 var SpaceUtil = require('../../space-tool/SpaceUtil');
23013 * A handler that implements reversible creating and removing of space.
23015 * It executes in two phases:
23017 * (1) resize all affected resizeShapes (2) move all affected moveShapes
23019 function SpaceToolHandler(modeling) {
23020 this._modeling = modeling;
23023 SpaceToolHandler.$inject = ['modeling'];
23025 module.exports = SpaceToolHandler;
23028 SpaceToolHandler.prototype.preExecute = function(context) {
23031 var modeling = this._modeling,
23032 resizingShapes = context.resizingShapes,
23033 delta = context.delta,
23034 direction = context.direction;
23036 forEach(resizingShapes, function(shape) {
23037 var newBounds = SpaceUtil.resizeBounds(shape, direction, delta);
23039 modeling.resizeShape(shape, newBounds);
23043 SpaceToolHandler.prototype.postExecute = function(context) {
23045 var modeling = this._modeling,
23046 movingShapes = context.movingShapes,
23047 delta = context.delta;
23049 modeling.moveShapes(movingShapes, delta);
23052 SpaceToolHandler.prototype.execute = function(context) {};
23053 SpaceToolHandler.prototype.revert = function(context) {};
23056 "../../space-tool/SpaceUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceUtil.js",
23057 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
23059 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateAnchorsHandler.js": [function(require, module, exports) {
23062 var forEach = require('lodash/collection/forEach'),
23063 assign = require('lodash/object/assign');
23067 * Update the anchors of
23069 function UpdateAnchorsHandler() {}
23071 module.exports = UpdateAnchorsHandler;
23074 UpdateAnchorsHandler.prototype.execute = function(context) {
23076 // update connection anchors
23077 return this.updateAnchors(context.element, context.delta);
23080 UpdateAnchorsHandler.prototype.revert = function(context) {
23082 var delta = context.delta,
23088 // revert update connection anchors
23089 return this.updateAnchors(context.element, revertedDelta);
23093 * Update anchors on the element according to the delta movement.
23095 * @param {djs.model.Element}
23100 * @return Array<djs.model.Connection>
23102 UpdateAnchorsHandler.prototype.updateAnchors = function(element, delta) {
23104 function add(point, delta) {
23106 x: point.x + delta.x,
23107 y: point.y + delta.y
23111 function updateAnchor(waypoint) {
23112 var original = waypoint.original;
23114 waypoint.original = assign(original || {}, add(original || waypoint, delta));
23119 forEach(element.incoming, function(c) {
23120 var waypoints = c.waypoints;
23121 updateAnchor(waypoints[waypoints.length - 1]);
23126 forEach(element.outgoing, function(c) {
23127 var waypoints = c.waypoints;
23128 updateAnchor(waypoints[0]);
23136 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
23137 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
23139 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\UpdateWaypointsHandler.js": [function(require, module, exports) {
23142 function UpdateWaypointsHandler() {}
23144 module.exports = UpdateWaypointsHandler;
23146 UpdateWaypointsHandler.prototype.execute = function(context) {
23148 var connection = context.connection,
23149 newWaypoints = context.newWaypoints;
23151 context.oldWaypoints = connection.waypoints;
23153 connection.waypoints = newWaypoints;
23158 UpdateWaypointsHandler.prototype.revert = function(context) {
23160 var connection = context.connection,
23161 oldWaypoints = context.oldWaypoints;
23163 connection.waypoints = oldWaypoints;
23168 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\cmd\\helper\\MoveHelper.js": [function(require, module, exports) {
23171 var forEach = require('lodash/collection/forEach');
23173 var Elements = require('../../../../util/Elements');
23177 * A helper that is able to carry out serialized move operations on multiple
23180 * @param {Modeling}
23183 function MoveHelper(modeling) {
23184 this._modeling = modeling;
23187 module.exports = MoveHelper;
23190 * Move the specified elements and all children by the given delta.
23192 * This moves all enclosed connections, too and layouts all affected external
23196 * <djs.model.Base>} elements
23199 * @param {djs.model.Base}
23200 * newParent applied to the first level of shapes
23202 * @return {Array<djs.model.Base>} list of touched elements
23204 MoveHelper.prototype.moveRecursive = function(elements, delta, newParent) {
23205 return this.moveClosure(this.getClosure(elements), delta, newParent);
23209 * Move the given closure of elmements
23211 MoveHelper.prototype.moveClosure = function(closure, delta, newParent) {
23213 var modeling = this._modeling;
23215 var allShapes = closure.allShapes,
23216 allConnections = closure.allConnections,
23217 enclosedConnections = closure.enclosedConnections,
23218 topLevel = closure.topLevel;
23221 forEach(allShapes, function(s) {
23223 modeling.moveShape(s, delta, topLevel[s.id] && newParent, {
23229 // move all child connections / layout external connections
23230 forEach(allConnections, function(c) {
23232 var startMoved = !!allShapes[c.source.id],
23233 endMoved = !!allShapes[c.target.id];
23235 if (enclosedConnections[c.id] &&
23236 startMoved && endMoved) {
23237 modeling.moveConnection(c, delta, topLevel[c.id] && newParent, {
23238 updateAnchors: false
23241 modeling.layoutConnection(c, {
23242 startChanged: startMoved,
23243 endChanged: endMoved
23250 * Returns the closure for the selected elements
23253 * <djs.model.Base>} elements
23254 * @return {Object} closure
23256 MoveHelper.prototype.getClosure = function(elements) {
23257 return Elements.getClosure(elements);
23261 "../../../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
23262 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
23264 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\index.js": [function(require, module, exports) {
23267 require('../../command'),
23268 require('../change-support'),
23269 require('../rules')
23271 __init__: ['modeling'],
23272 modeling: ['type', require('./Modeling')],
23273 layouter: ['type', require('../../layout/BaseLayouter')]
23277 "../../command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
23278 "../../layout/BaseLayouter": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\BaseLayouter.js",
23279 "../change-support": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\change-support\\index.js",
23280 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
23281 "./Modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\Modeling.js"
23283 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\Move.js": [function(require, module, exports) {
23286 var assign = require('lodash/object/assign'),
23287 filter = require('lodash/collection/filter'),
23288 groupBy = require('lodash/collection/groupBy');
23291 var LOW_PRIORITY = 500,
23292 HIGH_PRIORITY = 1500;
23294 var getOriginalEvent = require('../../util/Event').getOriginal;
23296 var round = Math.round;
23300 * Return a filtered list of elements that do not contain those nested into
23304 * <djs.model.Base>} elements
23306 * @return {Array<djs.model.Base>} filtered
23308 function removeNested(elements) {
23310 var ids = groupBy(elements, 'id');
23312 return filter(elements, function(element) {
23313 while (!!(element = element.parent)) {
23314 if (ids[element.id]) {
23326 * A plugin that makes shapes draggable / droppable.
23328 * @param {EventBus}
23330 * @param {Dragging}
23332 * @param {Modeling}
23334 * @param {Selection}
23339 function MoveEvents(eventBus, dragging, modeling, selection, rules) {
23343 function canMove(shapes, delta, target) {
23345 return rules.allowed('shapes.move', {
23355 // assign a high priority to this handler to setup the environment
23356 // others may hook up later, e.g. at default priority and modify
23357 // the move environment
23359 eventBus.on('shape.move.start', HIGH_PRIORITY, function(event) {
23361 var context = event.context,
23362 shape = event.shape,
23363 shapes = selection.get().slice();
23365 // move only single shape shape if the dragged element
23366 // is not part of the current selection
23367 if (shapes.indexOf(shape) === -1) {
23371 // ensure we remove nested elements in the collection
23372 shapes = removeNested(shapes);
23374 // attach shapes to drag context
23380 // check if we can move the elements
23381 if (!canMove(shapes)) {
23382 // suppress move operation
23383 event.stopPropagation();
23389 // assign a low priority to this handler
23390 // to let others modify the move event before we update
23393 eventBus.on('shape.move.move', LOW_PRIORITY, function(event) {
23395 var context = event.context,
23396 shapes = context.shapes,
23397 hover = event.hover,
23404 // check if we can move the elements
23405 canExecute = canMove(shapes, delta, hover);
23407 context.delta = delta;
23408 context.canExecute = canExecute;
23410 // simply ignore move over
23411 if (canExecute === null) {
23412 context.target = null;
23417 context.target = hover;
23420 eventBus.on('shape.move.end', function(event) {
23422 var context = event.context;
23424 var delta = context.delta,
23425 canExecute = context.canExecute;
23431 // ensure we have actual pixel values deltas
23432 // (important when zoom level was > 1 during move)
23433 delta.x = round(delta.x);
23434 delta.y = round(delta.y);
23436 modeling.moveShapes(context.shapes, delta, context.target);
23442 eventBus.on('element.mousedown', function(event) {
23444 var originalEvent = getOriginalEvent(event);
23446 if (!originalEvent) {
23447 throw new Error('must supply DOM mousedown event');
23450 start(originalEvent, event.element);
23454 function start(event, element, activate) {
23456 // do not move connections or the root element
23457 if (element.waypoints || !element.parent) {
23461 dragging.activate(event, 'shape.move', {
23462 cursor: 'grabbing',
23463 autoActivate: activate,
23473 this.start = start;
23476 MoveEvents.$inject = ['eventBus', 'dragging', 'modeling', 'selection', 'rules'];
23478 module.exports = MoveEvents;
23481 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
23482 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
23483 "lodash/collection/groupBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js",
23484 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
23486 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\MoveVisuals.js": [function(require, module, exports) {
23489 var flatten = require('lodash/array/flatten'),
23490 forEach = require('lodash/collection/forEach'),
23491 filter = require('lodash/collection/filter'),
23492 find = require('lodash/collection/find'),
23493 map = require('lodash/collection/map');
23495 var Elements = require('../../util/Elements');
23497 var LOW_PRIORITY = 500;
23499 var MARKER_DRAGGING = 'djs-dragging',
23500 MARKER_OK = 'drop-ok',
23501 MARKER_NOT_OK = 'drop-not-ok';
23505 * A plugin that makes shapes draggable / droppable.
23507 * @param {EventBus}
23509 * @param {ElementRegistry}
23516 function MoveVisuals(eventBus, elementRegistry, canvas, styles) {
23518 function getGfx(e) {
23519 return elementRegistry.getGraphics(e);
23522 function getVisualDragShapes(shapes) {
23524 var elements = Elements.selfAndDirectChildren(shapes, true);
23525 var filteredElements = removeEdges(elements);
23527 return filteredElements;
23530 function getAllDraggedElements(shapes) {
23531 var allShapes = Elements.selfAndAllChildren(shapes, true);
23533 var allConnections = map(allShapes, function(shape) {
23534 return (shape.incoming || []).concat(shape.outgoing || []);
23537 return flatten(allShapes.concat(allConnections), true);
23540 function addDragger(shape, dragGroup) {
23541 var gfx = getGfx(shape);
23542 var dragger = gfx.clone();
23543 var bbox = gfx.getBBox();
23545 dragger.attr(styles.cls('djs-dragger', [], {
23550 dragGroup.add(dragger);
23553 // assign a low priority to this handler
23554 // to let others modify the move context before
23557 eventBus.on('shape.move.start', LOW_PRIORITY, function(event) {
23559 var context = event.context,
23560 dragShapes = context.shapes;
23562 var dragGroup = canvas.getDefaultLayer().group().attr(styles.cls('djs-drag-group', ['no-events']));
23564 var visuallyDraggedShapes = getVisualDragShapes(dragShapes);
23566 visuallyDraggedShapes.forEach(function(shape) {
23567 addDragger(shape, dragGroup);
23571 // cache all dragged elements / gfx
23572 // so that we can quickly undo their state changes later
23573 var allDraggedElements = context.allDraggedElements = getAllDraggedElements(dragShapes);
23575 // add dragging marker
23576 forEach(allDraggedElements, function(e) {
23577 canvas.addMarker(e, MARKER_DRAGGING);
23580 context.dragGroup = dragGroup;
23583 // assign a low priority to this handler
23584 // to let others modify the move context before
23587 eventBus.on('shape.move.move', LOW_PRIORITY, function(event) {
23589 var context = event.context,
23590 dragGroup = context.dragGroup,
23591 target = context.target;
23594 canvas.addMarker(target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
23597 dragGroup.translate(event.dx, event.dy);
23600 eventBus.on(['shape.move.out', 'shape.move.cleanup'], function(event) {
23601 var context = event.context;
23603 if (context.target) {
23604 canvas.removeMarker(context.target, context.canExecute ? MARKER_OK : MARKER_NOT_OK);
23608 eventBus.on('shape.move.cleanup', function(event) {
23610 var context = event.context,
23611 allDraggedElements = context.allDraggedElements,
23612 dragGroup = context.dragGroup;
23615 // remove dragging marker
23616 forEach(allDraggedElements, function(e) {
23617 canvas.removeMarker(e, MARKER_DRAGGING);
23621 dragGroup.remove();
23626 // returns elements minus all connections
23627 // where source or target is not elements
23628 function removeEdges(elements) {
23630 var filteredElements = filter(elements, function(element) {
23632 if (!element.waypoints) { // shapes
23634 } else { // connections
23635 var srcFound = find(elements, element.source);
23636 var targetFound = find(elements, element.target);
23638 return srcFound && targetFound;
23642 return filteredElements;
23645 MoveVisuals.$inject = ['eventBus', 'elementRegistry', 'canvas', 'styles'];
23647 module.exports = MoveVisuals;
23650 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
23651 "lodash/array/flatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\flatten.js",
23652 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
23653 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
23654 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
23655 "lodash/collection/map": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js"
23657 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\index.js": [function(require, module, exports) {
23660 require('../interaction-events'),
23661 require('../selection'),
23662 require('../outline'),
23663 require('../rules'),
23664 require('../dragging')
23666 __init__: ['move', 'moveVisuals'],
23667 move: ['type', require('./Move')],
23668 moveVisuals: ['type', require('./MoveVisuals')]
23672 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
23673 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
23674 "../outline": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\index.js",
23675 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
23676 "../selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js",
23677 "./Move": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\Move.js",
23678 "./MoveVisuals": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\move\\MoveVisuals.js"
23680 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\Outline.js": [function(require, module, exports) {
23683 var Snap = require('../../../vendor/snapsvg');
23684 var getBBox = require('../../util/Elements').getBBox;
23690 * A plugin that adds an outline to shapes and connections that may be activated
23691 * and styled via CSS classes.
23693 * @param {EventBus}
23694 * events the event bus
23696 function Outline(eventBus, styles, elementRegistry) {
23698 var OUTLINE_OFFSET = 6;
23700 var OUTLINE_STYLE = styles.cls('djs-outline', ['no-fill']);
23702 function createOutline(gfx, bounds) {
23703 return Snap.create('rect', OUTLINE_STYLE).prependTo(gfx);
23706 function updateShapeOutline(outline, bounds) {
23709 x: -OUTLINE_OFFSET,
23710 y: -OUTLINE_OFFSET,
23711 width: bounds.width + OUTLINE_OFFSET * 2,
23712 height: bounds.height + OUTLINE_OFFSET * 2
23716 function updateConnectionOutline(outline, connection) {
23718 var bbox = getBBox(connection);
23721 x: bbox.x - OUTLINE_OFFSET,
23722 y: bbox.y - OUTLINE_OFFSET,
23723 width: bbox.width + OUTLINE_OFFSET * 2,
23724 height: bbox.height + OUTLINE_OFFSET * 2
23728 eventBus.on(['shape.added', 'shape.changed'], function(event) {
23729 var element = event.element,
23732 var outline = gfx.select('.djs-outline');
23735 outline = createOutline(gfx, element);
23738 updateShapeOutline(outline, element);
23741 eventBus.on(['connection.added', 'connection.changed'], function(event) {
23742 var element = event.element,
23745 var outline = gfx.select('.djs-outline');
23748 outline = createOutline(gfx, element);
23751 updateConnectionOutline(outline, element);
23758 Outline.$inject = ['eventBus', 'styles', 'elementRegistry'];
23760 module.exports = Outline;
23763 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
23764 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js"
23766 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\index.js": [function(require, module, exports) {
23770 __init__: ['outline'],
23771 outline: ['type', require('./Outline')]
23774 "./Outline": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\Outline.js"
23776 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\Overlays.js": [function(require, module, exports) {
23779 var isArray = require('lodash/lang/isArray'),
23780 isString = require('lodash/lang/isString'),
23781 isObject = require('lodash/lang/isObject'),
23782 assign = require('lodash/object/assign'),
23783 forEach = require('lodash/collection/forEach'),
23784 filter = require('lodash/collection/filter'),
23785 debounce = require('lodash/function/debounce');
23787 var domify = require('min-dom/lib/domify'),
23788 domClasses = require('min-dom/lib/classes'),
23789 domRemove = require('min-dom/lib/remove');
23791 var getBBox = require('../../util/Elements').getBBox;
23793 // document wide unique overlay ids
23794 var ids = new(require('../../util/IdGenerator'))('ov');
23797 function createRoot(parent) {
23798 var root = domify('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />');
23799 parent.insertBefore(root, parent.firstChild);
23805 function setPosition(el, x, y) {
23812 function setVisible(el, visible) {
23813 el.style.display = visible === false ? 'none' : '';
23817 * A service that allows users to attach overlays to diagram elements.
23819 * The overlay service will take care of overlay positioning during updates.
23822 * // add a pink badge on the top left of the shape overlays.add(someShape, {
23823 * position: { top: -5, left: -5 }, html: '<div style="width: 10px; background:
23824 * fuchsia; color: white;">0</div>' });
23825 * // or add via shape id
23827 * overlays.add('some-element-id', { position: { top: -5, left: -5 } html: '<div
23828 * style="width: 10px; background: fuchsia; color: white;">0</div>' });
23829 * // or add with optional type
23831 * overlays.add(someShape, 'badge', { position: { top: -5, left: -5 } html: '<div
23832 * style="width: 10px; background: fuchsia; color: white;">0</div>' });
23834 * // remove an overlay
23836 * var id = overlays.add(...); overlays.remove(id);
23838 * @param {EventBus}
23842 * @param {ElementRegistry}
23845 function Overlays(config, eventBus, canvas, elementRegistry) {
23847 this._eventBus = eventBus;
23848 this._canvas = canvas;
23849 this._elementRegistry = elementRegistry;
23853 this._overlayDefaults = {
23861 * Mapping overlayId -> overlay
23863 this._overlays = {};
23866 * Mapping elementId -> overlay container
23868 this._overlayContainers = {};
23870 // root html element for all overlays
23871 this._overlayRoot = createRoot(canvas.getContainer());
23873 this._init(config);
23877 Overlays.$inject = ['config.overlays', 'eventBus', 'canvas', 'elementRegistry'];
23879 module.exports = Overlays;
23883 * Returns the overlay with the specified id or a list of overlays for an
23884 * element with a given type.
23887 * // return the single overlay with the given id overlays.get('some-id');
23888 * // return all overlays for the shape overlays.get({ element: someShape });
23889 * // return all overlays on shape with type 'badge' overlays.get({ element:
23890 * someShape, type: 'badge' });
23891 * // shape can also be specified as id overlays.get({ element: 'element-id',
23892 * type: 'badge' });
23899 * @param {String|djs.model.Base}
23904 * @return {Object|Array<Object>} the overlay(s)
23906 Overlays.prototype.get = function(search) {
23908 if (isString(search)) {
23914 if (search.element) {
23915 var container = this._getOverlayContainer(search.element, true);
23917 // return a list of overlays when searching by element (+type)
23919 return search.type ? filter(container.overlays, {
23921 }) : container.overlays.slice();
23927 return filter(this._overlays, {
23931 // return single element when searching by id
23932 return search.id ? this._overlays[search.id] : null;
23937 * Adds a HTML overlay to an element.
23939 * @param {String|djs.model.Base}
23940 * element attach overlay to this shape
23942 * [type] optional type to assign to the overlay
23944 * overlay the overlay configuration
23946 * @param {String|DOMElement}
23947 * overlay.html html element to use as an overlay
23949 * [overlay.show] show configuration
23951 * [overlay.show.minZoom] minimal zoom level to show the overlay
23953 * [overlay.show.maxZoom] maximum zoom level to show the overlay
23955 * overlay.position where to attach the overlay
23957 * [overlay.position.left] relative to element bbox left attachment
23959 * [overlay.position.top] relative to element bbox top attachment
23961 * [overlay.position.bottom] relative to element bbox bottom
23964 * [overlay.position.right] relative to element bbox right attachment
23966 * @return {String} id that may be used to reference the overlay for update or
23969 Overlays.prototype.add = function(element, type, overlay) {
23971 if (isObject(type)) {
23977 element = this._elementRegistry.get(element);
23980 if (!overlay.position) {
23981 throw new Error('must specifiy overlay position');
23984 if (!overlay.html) {
23985 throw new Error('must specifiy overlay html');
23989 throw new Error('invalid element specified');
23992 var id = this._ids.next();
23994 overlay = assign({}, this._overlayDefaults, overlay, {
24001 this._addOverlay(overlay);
24008 * Remove an overlay with the given id or all overlays matching the given
24011 * @see Overlays#get for filter options.
24018 Overlays.prototype.remove = function(filter) {
24020 var overlays = this.get(filter) || [];
24022 if (!isArray(overlays)) {
24023 overlays = [overlays];
24028 forEach(overlays, function(overlay) {
24030 var container = self._getOverlayContainer(overlay.element, true);
24033 domRemove(overlay.html);
24034 domRemove(overlay.htmlContainer);
24036 delete overlay.htmlContainer;
24037 delete overlay.element;
24039 delete self._overlays[overlay.id];
24043 var idx = container.overlays.indexOf(overlay);
24045 container.overlays.splice(idx, 1);
24053 Overlays.prototype.show = function() {
24054 setVisible(this._overlayRoot);
24058 Overlays.prototype.hide = function() {
24059 setVisible(this._overlayRoot, false);
24063 Overlays.prototype._updateOverlayContainer = function(container) {
24064 var element = container.element,
24065 html = container.html;
24067 // update container left,top according to the elements x,y coordinates
24068 // this ensures we can attach child elements relative to this container
24073 if (element.waypoints) {
24074 var bbox = getBBox(element);
24079 setPosition(html, x, y);
24083 Overlays.prototype._updateOverlay = function(overlay) {
24085 var position = overlay.position,
24086 htmlContainer = overlay.htmlContainer,
24087 element = overlay.element;
24089 // update overlay html relative to shape because
24090 // it is already positioned on the element
24093 var left = position.left,
24094 top = position.top;
24096 if (position.right !== undefined) {
24100 if (element.waypoints) {
24101 width = getBBox(element).width;
24103 width = element.width;
24106 left = position.right * -1 + width;
24109 if (position.bottom !== undefined) {
24113 if (element.waypoints) {
24114 height = getBBox(element).height;
24116 height = element.height;
24119 top = position.bottom * -1 + height;
24122 setPosition(htmlContainer, left || 0, top || 0);
24126 Overlays.prototype._createOverlayContainer = function(element) {
24127 var html = domify('<div class="djs-overlays djs-overlays-' + element.id + '" style="position: absolute" />');
24129 this._overlayRoot.appendChild(html);
24137 this._updateOverlayContainer(container);
24143 Overlays.prototype._updateRoot = function(viewbox) {
24144 var a = viewbox.scale || 1;
24145 var d = viewbox.scale || 1;
24147 var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
24149 this._overlayRoot.style.transform = matrix;
24150 this._overlayRoot.style['-ms-transform'] = matrix;
24154 Overlays.prototype._getOverlayContainer = function(element, raw) {
24155 var id = (element && element.id) || element;
24157 var container = this._overlayContainers[id];
24158 if (!container && !raw) {
24159 container = this._overlayContainers[id] = this._createOverlayContainer(element);
24166 Overlays.prototype._addOverlay = function(overlay) {
24168 var id = overlay.id,
24169 element = overlay.element,
24170 html = overlay.html,
24174 // unwrap jquery (for those who need it)
24176 html = html.get(0);
24179 // create proper html elements from
24180 // overlay HTML strings
24181 if (isString(html)) {
24182 html = domify(html);
24185 overlayContainer = this._getOverlayContainer(element);
24187 htmlContainer = domify('<div class="djs-overlay" data-overlay-id="' + id + '" style="position: absolute">');
24189 htmlContainer.appendChild(html);
24191 if (overlay.type) {
24192 domClasses(htmlContainer).add('djs-overlay-' + overlay.type);
24195 overlay.htmlContainer = htmlContainer;
24197 overlayContainer.overlays.push(overlay);
24198 overlayContainer.html.appendChild(htmlContainer);
24200 this._overlays[id] = overlay;
24202 this._updateOverlay(overlay);
24205 Overlays.prototype._updateOverlayVisibilty = function(viewbox) {
24207 forEach(this._overlays, function(overlay) {
24208 var show = overlay.show,
24209 htmlContainer = overlay.htmlContainer,
24213 if (show.minZoom > viewbox.scale ||
24214 show.maxZoom < viewbox.scale) {
24218 setVisible(htmlContainer, visible);
24223 Overlays.prototype._init = function(config) {
24225 var eventBus = this._eventBus;
24230 // scroll/zoom integration
24232 var updateViewbox = function(viewbox) {
24233 self._updateRoot(viewbox);
24234 self._updateOverlayVisibilty(viewbox);
24239 if (!config || config.deferUpdate !== false) {
24240 updateViewbox = debounce(updateViewbox, 300);
24243 eventBus.on('canvas.viewbox.changed', function(event) {
24245 updateViewbox(event.viewbox);
24249 // remove integration
24251 eventBus.on(['shape.remove', 'connection.remove'], function(e) {
24252 var overlays = self.get({
24256 forEach(overlays, function(o) {
24262 // move integration
24267 var element = e.element;
24269 var container = self._getOverlayContainer(element, true);
24272 forEach(container.overlays, function(overlay) {
24273 self._updateOverlay(overlay);
24276 self._updateOverlayContainer(container);
24281 // marker integration, simply add them on the overlays as classes, too.
24283 eventBus.on('element.marker.update', function(e) {
24284 var container = self._getOverlayContainer(e.element, true);
24286 domClasses(container.html)[e.add ? 'add' : 'remove'](e.marker);
24292 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
24293 "../../util/IdGenerator": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\IdGenerator.js",
24294 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
24295 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
24296 "lodash/function/debounce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js",
24297 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
24298 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
24299 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
24300 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
24301 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
24302 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
24303 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js"
24305 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\index.js": [function(require, module, exports) {
24307 __init__: ['overlays'],
24308 overlays: ['type', require('./Overlays')]
24311 "./Overlays": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\overlays\\Overlays.js"
24313 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\Palette.js": [function(require, module, exports) {
24316 var isFunction = require('lodash/lang/isFunction'),
24317 forEach = require('lodash/collection/forEach');
24319 var domify = require('min-dom/lib/domify'),
24320 domQuery = require('min-dom/lib/query'),
24321 domAttr = require('min-dom/lib/attr'),
24322 domClear = require('min-dom/lib/clear'),
24323 domClasses = require('min-dom/lib/classes'),
24324 domMatches = require('min-dom/lib/matches'),
24325 domDelegate = require('min-dom/lib/delegate'),
24326 domEvent = require('min-dom/lib/event');
24329 var toggleSelector = '.djs-palette-toggle',
24330 entrySelector = '.entry',
24331 elementSelector = toggleSelector + ', ' + entrySelector;
24335 * A palette containing modeling elements.
24337 function Palette(eventBus, canvas) {
24339 this._eventBus = eventBus;
24340 this._canvas = canvas;
24342 this._providers = [];
24345 Palette.$inject = ['eventBus', 'canvas'];
24347 module.exports = Palette;
24351 * Register a provider with the palette
24353 * @param {PaletteProvider}
24356 Palette.prototype.registerProvider = function(provider) {
24357 this._providers.push(provider);
24359 if (!this._container) {
24368 * Returns the palette entries for a given element
24370 * @return {Array<PaletteEntryDescriptor>} list of entries
24372 Palette.prototype.getEntries = function() {
24376 // loop through all providers and their entries.
24377 // group entries by id so that overriding an entry is possible
24378 forEach(this._providers, function(provider) {
24379 var e = provider.getPaletteEntries();
24381 forEach(e, function(entry, id) {
24382 entries[id] = entry;
24393 Palette.prototype._init = function() {
24394 var parent = this._canvas.getContainer(),
24395 container = this._container = domify(Palette.HTML_MARKUP),
24398 parent.appendChild(container);
24400 domDelegate.bind(container, elementSelector, 'click', function(event) {
24402 var target = event.delegateTarget;
24404 if (domMatches(target, toggleSelector)) {
24405 return self.toggle();
24408 self.trigger('click', event);
24411 // prevent drag propagation
24412 domEvent.bind(container, 'mousedown', function(event) {
24413 event.stopPropagation();
24416 // prevent drag propagation
24417 domDelegate.bind(container, entrySelector, 'dragstart', function(event) {
24418 self.trigger('dragstart', event);
24421 this._eventBus.fire('palette.create', {
24427 Palette.prototype._update = function() {
24429 var entriesContainer = domQuery('.djs-palette-entries', this._container),
24430 entries = this._entries = this.getEntries();
24432 domClear(entriesContainer);
24434 forEach(entries, function(entry, id) {
24436 var grouping = entry.group || 'default';
24438 var container = domQuery('[data-group=' + grouping + ']', entriesContainer);
24440 container = domify('<div class="group" data-group="' + grouping + '"></div>');
24441 entriesContainer.appendChild(container);
24444 var html = entry.html || (
24446 '<hr class="separator" />' :
24447 '<div class="entry" draggable="true"></div>');
24450 var control = domify(html);
24451 // alert("Control ::" + control + " HTML :: " + html);
24453 container.appendChild(control);
24455 if (!entry.separator) {
24456 domAttr(control, 'data-action', id);
24459 domAttr(control, 'title', entry.title);
24464 if (entry.className) {
24465 domClasses(control).add(entry.className);
24468 if (entry.imageUrl) {
24469 control.appendChild(domify('<img src="' + entry.imageUrl + '">'));
24473 // alert("Entry Title :: " + entry.title + " Entry HTML :: " + html);
24476 // open after update
24482 * Trigger an action available on the palette
24489 Palette.prototype.trigger = function(action, event, autoActivate) {
24491 var entries = this._entries,
24495 button = event.delegateTarget || event.target;
24498 return event.preventDefault();
24502 entry = entries[domAttr(button, 'data-action')];
24503 handler = entry.action;
24505 originalEvent = event.originalEvent || event;
24507 // simple action (via callback function)
24508 if (isFunction(handler)) {
24509 if (action === 'click') {
24510 return handler(originalEvent, autoActivate);
24513 if (handler[action]) {
24514 return handler[action](originalEvent, autoActivate);
24518 // silence other actions
24519 event.preventDefault();
24524 * Close the palette
24526 Palette.prototype.close = function() {
24527 domClasses(this._container).remove('open');
24534 Palette.prototype.open = function() {
24535 domClasses(this._container).add('open');
24539 Palette.prototype.toggle = function(open) {
24540 if (this.isOpen()) {
24549 * Return true if the palette is opened.
24555 * if (palette.isOpen()) { // yes, we are open }
24557 * @return {boolean} true if palette is opened
24559 Palette.prototype.isOpen = function() {
24560 return this._container && domClasses(this._container).has('open');
24564 /* markup definition */
24566 Palette.HTML_MARKUP =
24567 '<div class="djs-palette">' +
24568 '<div class="djs-palette-entries"></div>' +
24569 '<div class="djs-palette-toggle"></div>' +
24572 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
24573 "lodash/lang/isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js",
24574 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
24575 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
24576 "min-dom/lib/clear": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js",
24577 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js",
24578 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
24579 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
24580 "min-dom/lib/matches": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\matches.js",
24581 "min-dom/lib/query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\query.js"
24583 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\index.js": [function(require, module, exports) {
24585 __init__: ['palette'],
24586 palette: ['type', require('./Palette')]
24590 "./Palette": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\palette\\Palette.js"
24592 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\PopupMenu.js": [function(require, module, exports) {
24595 var forEach = require('lodash/collection/forEach'),
24596 assign = require('lodash/object/assign'),
24597 domEvent = require('min-dom/lib/event'),
24598 domify = require('min-dom/lib/domify'),
24599 domClasses = require('min-dom/lib/classes'),
24600 domAttr = require('min-dom/lib/attr'),
24601 domRemove = require('min-dom/lib/remove');
24604 function PopupMenu(eventBus, canvas) {
24606 this._eventBus = eventBus;
24607 this._canvas = canvas;
24608 this._instances = {};
24611 PopupMenu.$inject = ['eventBus', 'canvas'];
24613 module.exports = PopupMenu;
24615 PopupMenu.prototype.open = function(name, position, entries, options) {
24618 canvas = this._canvas,
24619 instances = outer._instances;
24621 // return existing instance
24622 if (instances[name]) {
24623 return instances[name];
24626 var parent = canvas.getContainer();
24628 // ------------------------
24629 function PopupMenuInstance() {
24633 self._actions = {};
24634 self.name = name || 'popup-menu';
24637 entryClassName: 'entry'
24639 assign(_options, options);
24642 var container = this._container = domify('<div class="djs-popup">');
24644 assign(container.style, {
24645 position: 'absolute',
24646 left: position.x + 'px',
24647 top: position.y + 'px'
24649 domClasses(container).add(name);
24652 forEach(entries, function(entry) {
24654 var entryContainer = domify('<div>');
24655 domClasses(entryContainer).add(entry.className || _options.entryClassName);
24656 domClasses(entryContainer).add('djs-popup-entry');
24659 domAttr(entryContainer, 'style', entry.style);
24662 if (entry.action) {
24663 domAttr(entryContainer, 'data-action', entry.action.name);
24664 self._actions[entry.action.name] = entry.action.handler;
24667 var title = domify('<span>');
24668 title.textContent = entry.label;
24669 entryContainer.appendChild(title);
24671 container.appendChild(entryContainer);
24675 domEvent.bind(container, 'click', function(event) {
24676 self.trigger(event);
24681 // apply canvas zoom level
24682 var zoom = canvas.zoom();
24684 container.style.transformOrigin = 'top left';
24685 container.style.transform = 'scale(' + zoom + ')';
24688 parent.appendChild(container);
24691 this.bindHandlers();
24694 PopupMenuInstance.prototype.close = function() {
24695 this.unbindHandlers();
24696 domRemove(this._container);
24697 delete outer._instances[this.name];
24700 PopupMenuInstance.prototype.bindHandlers = function() {
24703 eventBus = outer._eventBus;
24705 this._closeHandler = function() {
24709 eventBus.once('contextPad.close', this._closeHandler);
24710 eventBus.once('canvas.viewbox.changed', this._closeHandler);
24713 PopupMenuInstance.prototype.unbindHandlers = function() {
24715 var eventBus = outer._eventBus;
24717 eventBus.off('contextPad.close', this._closeHandler);
24718 eventBus.off('canvas.viewbox.changed', this._closeHandler);
24721 PopupMenuInstance.prototype.trigger = function(event) {
24723 var element = event.target,
24724 actionName = element.getAttribute('data-action') ||
24725 element.parentNode.getAttribute('data-action');
24727 var action = this._actions[actionName];
24734 // silence other actions
24735 event.preventDefault();
24738 var instance = outer._instances[name] = new PopupMenuInstance(position, entries, parent, options);
24744 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
24745 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
24746 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
24747 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
24748 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
24749 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js",
24750 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js"
24752 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\index.js": [function(require, module, exports) {
24756 __init__: ['popupMenu'],
24757 popupMenu: ['type', require('./PopupMenu')]
24761 "./PopupMenu": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\popup-menu\\PopupMenu.js"
24763 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\Replace.js": [function(require, module, exports) {
24768 * Service that allow replacing of elements.
24774 function Replace(modeling) {
24776 this._modeling = modeling;
24779 module.exports = Replace;
24781 Replace.$inject = ['modeling'];
24785 * oldElement - Element to be replaced
24787 * newElementData - Containing information about the new Element, for
24788 * example height, width, type.
24790 * options - Custom options that will be attached to the context. It
24791 * can be used to inject data that is needed in the command chain.
24792 * For example it could be used in
24793 * eventbus.on('commandStack.shape.replace.postExecute') to change
24794 * shape attributes after shape creation.
24796 Replace.prototype.replaceElement = function(oldElement, newElementData, options) {
24798 var modeling = this._modeling;
24800 var newElement = null;
24802 if (oldElement.waypoints) {
24804 // modeling.replaceConnection
24806 // set center of element for modeling API
24807 // if no new width / height is given use old elements size
24808 newElementData.x = oldElement.x + (newElementData.width || oldElement.width) / 2;
24809 newElementData.y = oldElement.y + (newElementData.height || oldElement.height) / 2;
24811 newElement = modeling.replaceShape(oldElement, newElementData, options);
24818 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\index.js": [function(require, module, exports) {
24822 __init__: ['replace'],
24823 replace: ['type', require('./Replace')]
24827 "./Replace": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\replace\\Replace.js"
24829 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\Resize.js": [function(require, module, exports) {
24832 var forEach = require('lodash/collection/forEach'),
24833 filter = require('lodash/collection/filter'),
24834 pick = require('lodash/object/pick');
24836 var ResizeUtil = require('./ResizeUtil'),
24837 domEvent = require('min-dom/lib/event'),
24838 Elements = require('../../util/Elements');
24840 var isPrimaryButton = require('../../util/Mouse').isPrimaryButton;
24842 var round = Math.round;
24844 var Snap = require('../../../vendor/snapsvg');
24846 var HANDLE_OFFSET = -2,
24848 HANDLE_HIT_SIZE = 20;
24850 var MARKER_RESIZING = 'djs-resizing',
24851 MARKER_RESIZE_NOT_OK = 'resize-not-ok',
24852 CLS_RESIZER = 'djs-resizer';
24856 * Implements resize on shapes by
24857 * * adding resize handles, * creating a visual during resize * checking resize
24858 * rules * committing a change once finished
24862 * It's possible to customize the resizing behaviour by intercepting
24863 * 'resize.start' and providing the following parameters through the 'context':
24864 * * minDimensions ({ width, height }) - Minimum shape dimensions *
24865 * childrenBoxPadding (number) - Gap between the minimum bounding box and the
24870 * eventBus.on('resize.start', 1500, function(event) { var context =
24873 * context.minDimensions = { width: 140, height: 120 };
24874 * context.childrenBoxPadding = 30; });
24877 function Resize(eventBus, elementRegistry, rules, modeling, canvas, selection, dragging) {
24879 function canResize(context) {
24880 var ctx = pick(context, ['newBounds', 'shape', 'delta', 'direction']);
24881 return rules.allowed('shape.resize', ctx);
24885 // resizing implementation //////////////////////////////////
24888 * A helper that realizes the resize visuals
24891 create: function(context) {
24892 var container = canvas.getDefaultLayer(),
24893 shape = context.shape,
24896 frame = context.frame = Snap.create('rect', {
24897 class: 'djs-resize-overlay',
24898 width: shape.width + 10,
24899 height: shape.height + 10,
24904 frame.appendTo(container);
24907 update: function(context) {
24908 var frame = context.frame,
24909 bounds = context.newBounds;
24911 if (bounds.width > 5) {
24914 width: bounds.width
24918 if (bounds.height > 5) {
24921 height: bounds.height
24925 frame[context.canExecute ? 'removeClass' : 'addClass'](MARKER_RESIZE_NOT_OK);
24928 remove: function(context) {
24929 if (context.frame) {
24930 context.frame.remove();
24935 function computeMinBoundaryBox(context) {
24937 var shape = context.shape,
24938 direction = context.direction,
24939 minDimensions = context.minDimensions || {},
24940 childrenBoxPadding = context.childrenBoxPadding || 20,
24944 // grab all the shapes that are NOT labels or connections
24945 children = filter(shape.children, function(child) {
24947 if (child.waypoints) {
24952 if (child.type === 'label') {
24959 // compute a minimum bounding box
24960 // around the existing children
24961 if (children.length) {
24962 minBoundaryBox = Elements.getBBox(children);
24964 // add a gap between the minBoundaryBox and the resizable container
24965 minBoundaryBox.width += childrenBoxPadding * 2;
24966 minBoundaryBox.height += childrenBoxPadding * 2;
24967 minBoundaryBox.x -= childrenBoxPadding;
24968 minBoundaryBox.y -= childrenBoxPadding;
24970 minBoundaryBox = ResizeUtil.getMinResizeBounds(direction, shape, {
24971 width: minDimensions.width || 10,
24972 height: minDimensions.height || 10
24976 return minBoundaryBox;
24979 eventBus.on('resize.start', function(event) {
24981 var context = event.context,
24982 shape = context.shape,
24983 minBoundaryBox = context.minBoundaryBox;
24985 if (minBoundaryBox === undefined) {
24986 context.minBoundaryBox = computeMinBoundaryBox(context);
24989 // add resizable indicator
24990 canvas.addMarker(shape, MARKER_RESIZING);
24992 visuals.create(context);
24995 eventBus.on('resize.move', function(event) {
24997 var context = event.context,
24998 shape = context.shape,
24999 direction = context.direction,
25000 minBoundaryBox = context.minBoundaryBox,
25008 context.delta = delta;
25010 context.newBounds = ResizeUtil.resizeBounds(shape, direction, delta);
25012 if (minBoundaryBox) {
25013 context.newBounds = ResizeUtil.ensureMinBounds(context.newBounds, minBoundaryBox);
25016 // update + cache executable state
25017 context.canExecute = canResize(context);
25019 // update resize frame visuals
25020 visuals.update(context);
25023 eventBus.on('resize.end', function(event) {
25024 var context = event.context,
25025 shape = context.shape;
25027 var newBounds = context.newBounds;
25030 // ensure we have actual pixel values for new bounds
25031 // (important when zoom level was > 1 during move)
25032 newBounds.x = round(newBounds.x);
25033 newBounds.y = round(newBounds.y);
25034 newBounds.width = round(newBounds.width);
25035 newBounds.height = round(newBounds.height);
25037 // perform the actual resize
25038 if (context.canExecute) {
25039 modeling.resizeShape(shape, context.newBounds);
25043 eventBus.on('resize.cleanup', function(event) {
25045 var context = event.context,
25046 shape = context.shape;
25048 // remove resizable indicator
25049 canvas.removeMarker(shape, MARKER_RESIZING);
25051 // remove frame + destroy context
25052 visuals.remove(context);
25056 function activate(event, shape, direction) {
25058 dragging.activate(event, 'resize', {
25059 autoActivate: true,
25060 cursor: 'resize-' + (/nw|se/.test(direction) ? 'nwse' : 'nesw'),
25064 direction: direction,
25071 function makeDraggable(element, gfx, direction) {
25073 function listener(event) {
25074 // only trigger on left mouse button
25075 if (isPrimaryButton(event)) {
25076 activate(event, element, direction);
25080 domEvent.bind(gfx.node, 'mousedown', listener);
25081 domEvent.bind(gfx.node, 'touchstart', listener);
25084 function __createResizer(gfx, x, y, rotation, direction) {
25086 var group = gfx.group().addClass(CLS_RESIZER).addClass(CLS_RESIZER + '-' + direction);
25088 var origin = -HANDLE_SIZE + HANDLE_OFFSET;
25090 // Create four drag indicators on the outline
25091 group.rect(origin, origin, HANDLE_SIZE, HANDLE_SIZE).addClass(CLS_RESIZER + '-visual');
25092 group.rect(origin, origin, HANDLE_HIT_SIZE, HANDLE_HIT_SIZE).addClass(CLS_RESIZER + '-hit');
25094 var matrix = new Snap.Matrix().translate(x, y).rotate(rotation, 0, 0);
25095 group.transform(matrix);
25100 function createResizer(element, gfx, direction) {
25104 if (direction === 'nw') {
25105 resizer = __createResizer(gfx, 0, 0, 0, direction);
25106 } else if (direction === 'ne') {
25107 resizer = __createResizer(gfx, element.width, 0, 90, direction);
25108 } else if (direction === 'se') {
25109 resizer = __createResizer(gfx, element.width, element.height, 180, direction);
25111 resizer = __createResizer(gfx, 0, element.height, 270, direction);
25114 makeDraggable(element, resizer, direction);
25117 // resize handles implementation ///////////////////////////////
25119 function addResize(shape) {
25127 var gfx = elementRegistry.getGraphics(shape);
25129 createResizer(shape, gfx, 'nw');
25130 createResizer(shape, gfx, 'ne');
25131 createResizer(shape, gfx, 'se');
25132 createResizer(shape, gfx, 'sw');
25135 function removeResize(shape) {
25137 var gfx = elementRegistry.getGraphics(shape);
25138 var resizers = gfx.selectAll('.' + CLS_RESIZER);
25140 forEach(resizers, function(resizer) {
25145 eventBus.on('selection.changed', function(e) {
25147 var oldSelection = e.oldSelection,
25148 newSelection = e.newSelection;
25150 // remove old selection markers
25151 forEach(oldSelection, removeResize);
25153 // add new selection markers ONLY if single selection
25154 if (newSelection.length === 1) {
25155 forEach(newSelection, addResize);
25159 eventBus.on('shape.changed', function(e) {
25160 var shape = e.element;
25162 removeResize(shape);
25164 if (selection.isSelected(shape)) {
25172 this.activate = activate;
25175 Resize.$inject = ['eventBus', 'elementRegistry', 'rules', 'modeling', 'canvas', 'selection', 'dragging'];
25177 module.exports = Resize;
25180 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
25181 "../../util/Elements": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js",
25182 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
25183 "./ResizeUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\ResizeUtil.js",
25184 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
25185 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
25186 "lodash/object/pick": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js",
25187 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
25189 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\ResizeUtil.js": [function(require, module, exports) {
25193 * Resize the given bounds by the specified delta from a given anchor point.
25196 * bounds the bounding box that should be resized
25198 * direction in which the element is resized (nw, ne, se, sw)
25200 * delta of the resize operation
25202 * @return {Bounds} resized bounding box
25204 module.exports.resizeBounds = function(bounds, direction, delta) {
25209 switch (direction) {
25215 width: bounds.width - dx,
25216 height: bounds.height - dy
25223 width: bounds.width - dx,
25224 height: bounds.height + dy
25231 width: bounds.width + dx,
25232 height: bounds.height - dy
25239 width: bounds.width + dx,
25240 height: bounds.height + dy
25244 throw new Error('unrecognized direction: ' + direction);
25248 module.exports.reattachPoint = function(bounds, newBounds, point) {
25250 var sx = bounds.width / newBounds.width,
25251 sy = bounds.height / newBounds.height;
25254 x: Math.round((newBounds.x + newBounds.width / 2)) - Math.floor(((bounds.x + bounds.width / 2) - point.x) / sx),
25255 y: Math.round((newBounds.y + newBounds.height / 2)) - Math.floor(((bounds.y + bounds.height / 2) - point.y) / sy)
25260 module.exports.ensureMinBounds = function(currentBounds, minBounds) {
25262 x: Math.min(currentBounds.x, minBounds.x),
25263 y: Math.min(currentBounds.y, minBounds.y)
25266 var bottomRight = {
25267 x: Math.max(currentBounds.x + currentBounds.width, minBounds.x + minBounds.width),
25268 y: Math.max(currentBounds.y + currentBounds.height, minBounds.y + minBounds.height)
25274 width: bottomRight.x - topLeft.x,
25275 height: bottomRight.y - topLeft.y
25280 module.exports.getMinResizeBounds = function(direction, currentBounds, minDimensions) {
25282 switch (direction) {
25285 x: currentBounds.x + currentBounds.width - minDimensions.width,
25286 y: currentBounds.y + currentBounds.height - minDimensions.height,
25287 width: minDimensions.width,
25288 height: minDimensions.height
25292 x: currentBounds.x + currentBounds.width - minDimensions.width,
25293 y: currentBounds.y,
25294 width: minDimensions.width,
25295 height: minDimensions.height
25299 x: currentBounds.x,
25300 y: currentBounds.y + currentBounds.height - minDimensions.height,
25301 width: minDimensions.width,
25302 height: minDimensions.height
25306 x: currentBounds.x,
25307 y: currentBounds.y,
25308 width: minDimensions.width,
25309 height: minDimensions.height
25312 throw new Error('unrecognized direction: ' + direction);
25319 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\index.js": [function(require, module, exports) {
25322 require('../modeling'),
25323 require('../rules'),
25324 require('../dragging')
25326 __init__: ['resize'],
25327 resize: ['type', require('./Resize')]
25331 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
25332 "../modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\index.js",
25333 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
25334 "./Resize": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\resize\\Resize.js"
25336 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\RuleProvider.js": [function(require, module, exports) {
25339 var inherits = require('inherits');
25341 var CommandInterceptor = require('../../command/CommandInterceptor');
25344 * A basic provider that may be extended to implement modeling rules.
25346 * Extensions should implement the init method to actually add their custom
25347 * modeling checks. Checks may be added via the #addRule(action, fn) method.
25349 * @param {EventBus}
25352 function RuleProvider(eventBus) {
25353 CommandInterceptor.call(this, eventBus);
25358 RuleProvider.$inject = ['eventBus'];
25360 inherits(RuleProvider, CommandInterceptor);
25362 module.exports = RuleProvider;
25366 * Adds a modeling rule for the given action, implemented through a callback
25369 * The function will receive the modeling specific action context to perform its
25370 * check. It must return false or null to disallow the action from happening.
25372 * Returning <code>null</code> may encode simply ignoring the action.
25376 * ResizableRules.prototype.init = function() {
25378 * this.addRule('shape.resize', function(context) {
25380 * var shape = context.shape;
25382 * if (!context.newBounds) { // check general resizability if (!shape.resizable) {
25383 * return false; } } else { // element must have minimum size of 10*10 points
25384 * return context.newBounds.width > 10 && context.newBounds.height > 10; } }); };
25386 * @param {String|Array
25387 * <String>} actions the identifier for the modeling action to check
25388 * @param {Function}
25389 * fn the callback function that performs the actual check
25391 RuleProvider.prototype.addRule = function(actions, fn) {
25395 if (typeof actions === 'string') {
25396 actions = [actions];
25399 actions.forEach(function(action) {
25401 self.canExecute(action, function(context, action, event) {
25402 return fn(context);
25407 "../../command/CommandInterceptor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\CommandInterceptor.js",
25408 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js"
25410 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\Rules.js": [function(require, module, exports) {
25414 * A service that provides rules for certain diagram actions.
25416 * @param {CommandStack}
25419 function Rules(commandStack) {
25420 this._commandStack = commandStack;
25423 Rules.$inject = ['commandStack'];
25425 module.exports = Rules;
25429 * This method can be queried to ask whether certain modeling actions are
25433 * action the action to be checked
25435 * [context] the context to check the action in
25437 * @return {Boolean} returns true, false or null depending on whether the
25438 * operation is allowed, not allowed or should be ignored.
25440 Rules.prototype.allowed = function(action, context) {
25441 var allowed = this._commandStack.canExecute(action, context);
25443 // map undefined to true, i.e. no rules
25444 return allowed === undefined ? true : allowed;
25447 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js": [function(require, module, exports) {
25449 __depends__: [require('../../command')],
25450 __init__: ['rules'],
25451 rules: ['type', require('./Rules')]
25455 "../../command": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\command\\index.js",
25456 "./Rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\Rules.js"
25458 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\Selection.js": [function(require, module, exports) {
25461 var isArray = require('lodash/lang/isArray'),
25462 forEach = require('lodash/collection/forEach');
25466 * A service that offers the current selection in a diagram. Offers the api to
25467 * control the selection, too.
25471 * @param {EventBus}
25472 * eventBus the event bus
25474 function Selection(eventBus) {
25476 this._eventBus = eventBus;
25478 this._selectedElements = [];
25482 eventBus.on(['shape.remove', 'connection.remove'], function(e) {
25483 var element = e.element;
25484 self.deselect(element);
25488 Selection.$inject = ['eventBus'];
25490 module.exports = Selection;
25493 Selection.prototype.deselect = function(element) {
25494 var selectedElements = this._selectedElements;
25496 var idx = selectedElements.indexOf(element);
25499 var oldSelection = selectedElements.slice();
25501 selectedElements.splice(idx, 1);
25503 this._eventBus.fire('selection.changed', {
25504 oldSelection: oldSelection,
25505 newSelection: selectedElements
25511 Selection.prototype.get = function() {
25512 return this._selectedElements;
25515 Selection.prototype.isSelected = function(element) {
25516 return this._selectedElements.indexOf(element) !== -1;
25521 * This method selects one or more elements on the diagram.
25523 * By passing an additional add parameter you can decide whether or not the
25524 * element(s) should be added to the already existing selection or not.
25526 * @method Selection#select
25528 * @param {Object|Object[]}
25529 * elements element or array of elements to be selected
25531 * [add] whether the element(s) should be appended to the current
25532 * selection, defaults to false
25534 Selection.prototype.select = function(elements, add) {
25535 var selectedElements = this._selectedElements,
25536 oldSelection = selectedElements.slice();
25538 if (!isArray(elements)) {
25539 elements = elements ? [elements] : [];
25542 // selection may be cleared by passing an empty array or null
25545 forEach(elements, function(element) {
25546 if (selectedElements.indexOf(element) !== -1) {
25547 // already selected
25550 selectedElements.push(element);
25554 this._selectedElements = selectedElements = elements.slice();
25556 this._eventBus.fire('selection.changed', {
25557 oldSelection: oldSelection,
25558 newSelection: selectedElements
25563 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
25564 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
25566 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionBehavior.js": [function(require, module, exports) {
25569 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier;
25572 function SelectionBehavior(eventBus, selection, canvas) {
25574 eventBus.on('create.end', 500, function(e) {
25575 if (e.context.canExecute) {
25576 selection.select(e.shape);
25580 eventBus.on('connect.end', 500, function(e) {
25581 if (e.context.canExecute && e.context.target) {
25582 selection.select(e.context.target);
25586 eventBus.on('shape.move.end', 500, function(e) {
25587 selection.select(e.context.shapes);
25590 eventBus.on('element.keydown', function(event) {
25591 alert("Key Down Elements ");
25593 // Shift + click selection
25594 eventBus.on('element.click', function(event) {
25596 var element = event.element;
25598 // do not select the root element
25600 if (element === canvas.getRootElement()) {
25604 var isSelected = selection.isSelected(element),
25605 isMultiSelect = selection.get().length > 1;
25607 // mouse-event: SELECTION_KEY
25608 var add = hasPrimaryModifier(event);
25610 // select OR deselect element in multi selection
25611 if (isSelected && isMultiSelect) {
25613 return selection.deselect(element);
25615 return selection.select(element);
25619 selection.select(element, add);
25621 selection.deselect(element);
25627 SelectionBehavior.$inject = ['eventBus', 'selection', 'canvas'];
25629 module.exports = SelectionBehavior;
25632 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js"
25634 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionVisuals.js": [function(require, module, exports) {
25637 var forEach = require('lodash/collection/forEach');
25639 var MARKER_HOVER = 'hover',
25640 MARKER_SELECTED = 'selected';
25644 * A plugin that adds a visible selection UI to shapes and connections by
25645 * appending the <code>hover</code> and <code>selected</code> classes to
25650 * Makes elements selectable, too.
25652 * @param {EventBus}
25654 * @param {SelectionService}
25659 function SelectionVisuals(events, canvas, selection, graphicsFactory, styles) {
25661 this._multiSelectionBox = null;
25663 function addMarker(e, cls) {
25664 canvas.addMarker(e, cls);
25667 function removeMarker(e, cls) {
25668 canvas.removeMarker(e, cls);
25671 events.on('element.hover', function(event) {
25672 addMarker(event.element, MARKER_HOVER);
25675 events.on('element.out', function(event) {
25676 removeMarker(event.element, MARKER_HOVER);
25679 events.on('selection.changed', function(event) {
25681 function deselect(s) {
25682 removeMarker(s, MARKER_SELECTED);
25685 function select(s) {
25686 addMarker(s, MARKER_SELECTED);
25689 var oldSelection = event.oldSelection,
25690 newSelection = event.newSelection;
25692 forEach(oldSelection, function(e) {
25693 if (newSelection.indexOf(e) === -1) {
25698 forEach(newSelection, function(e) {
25699 if (oldSelection.indexOf(e) === -1) {
25706 SelectionVisuals.$inject = [
25714 module.exports = SelectionVisuals;
25717 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
25719 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\index.js": [function(require, module, exports) {
25721 __init__: ['selectionVisuals', 'selectionBehavior'],
25723 require('../interaction-events'),
25724 require('../outline')
25726 selection: ['type', require('./Selection')],
25727 selectionVisuals: ['type', require('./SelectionVisuals')],
25728 selectionBehavior: ['type', require('./SelectionBehavior')]
25732 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
25733 "../outline": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\outline\\index.js",
25734 "./Selection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\Selection.js",
25735 "./SelectionBehavior": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionBehavior.js",
25736 "./SelectionVisuals": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\selection\\SelectionVisuals.js"
25738 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapContext.js": [function(require, module, exports) {
25741 var forEach = require('lodash/collection/forEach');
25743 var snapTo = require('./SnapUtil').snapTo;
25747 * A snap context, containing the (possibly incomplete) mappings of drop targets
25748 * (to identify the snapping) to computed snap points.
25750 function SnapContext() {
25753 * Map<String, SnapPoints> mapping drop targets to a list of possible
25758 this._targets = {};
25761 * Map<String, Point> initial positioning of element regarding various snap
25766 this._snapOrigins = {};
25769 * List of snap locations
25771 * @type {Array<String>}
25773 this._snapLocations = [];
25776 * Map<String, Array<Point>> of default snapping locations
25780 this._defaultSnaps = {};
25784 SnapContext.prototype.getSnapOrigin = function(snapLocation) {
25785 return this._snapOrigins[snapLocation];
25789 SnapContext.prototype.setSnapOrigin = function(snapLocation, initialValue) {
25790 this._snapOrigins[snapLocation] = initialValue;
25792 if (this._snapLocations.indexOf(snapLocation) === -1) {
25793 this._snapLocations.push(snapLocation);
25798 SnapContext.prototype.addDefaultSnap = function(type, point) {
25800 var snapValues = this._defaultSnaps[type];
25803 snapValues = this._defaultSnaps[type] = [];
25806 snapValues.push(point);
25810 * Return a number of initialized snaps, i.e. snap locations such as top-left,
25811 * mid, bottom-right and so forth.
25813 * @return {Array<String>} snapLocations
25815 SnapContext.prototype.getSnapLocations = function() {
25816 return this._snapLocations;
25820 * Set the snap locations for this context.
25822 * The order of locations determines precedence.
25825 * <String>} snapLocations
25827 SnapContext.prototype.setSnapLocations = function(snapLocations) {
25828 this._snapLocations = snapLocations;
25832 * Get snap points for a given target
25834 * @param {Element|String}
25837 SnapContext.prototype.pointsForTarget = function(target) {
25839 var targetId = target.id || target;
25841 var snapPoints = this._targets[targetId];
25844 snapPoints = this._targets[targetId] = new SnapPoints();
25845 snapPoints.initDefaults(this._defaultSnaps);
25851 module.exports = SnapContext;
25855 * Creates the snap points and initializes them with the given default values.
25858 * <String, Array<Point>>} [defaultPoints]
25860 function SnapPoints(defaultSnaps) {
25863 * Map<String, Map<(x|y), Array<Number>>> mapping snap locations, i.e.
25864 * top-left, bottom-right, center to actual snap values.
25868 this._snapValues = {};
25871 SnapPoints.prototype.add = function(snapLocation, point) {
25873 var snapValues = this._snapValues[snapLocation];
25876 snapValues = this._snapValues[snapLocation] = {
25882 if (snapValues.x.indexOf(point.x) === -1) {
25883 snapValues.x.push(point.x);
25886 if (snapValues.y.indexOf(point.y) === -1) {
25887 snapValues.y.push(point.y);
25892 SnapPoints.prototype.snap = function(point, snapLocation, axis, tolerance) {
25893 var snappingValues = this._snapValues[snapLocation];
25895 return snappingValues && snapTo(point[axis], snappingValues[axis], tolerance);
25899 * Initialize a number of default snapping points.
25904 SnapPoints.prototype.initDefaults = function(defaultSnaps) {
25908 forEach(defaultSnaps || {}, function(snapPoints, snapLocation) {
25909 forEach(snapPoints, function(point) {
25910 self.add(snapLocation, point);
25915 "./SnapUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js",
25916 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
25918 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js": [function(require, module, exports) {
25921 var abs = Math.abs,
25922 round = Math.round;
25926 * Snap value to a collection of reference values.
25935 * @return {Number} the value we snapped to or null, if none snapped
25937 function snapTo(value, values, tolerance) {
25938 tolerance = tolerance === undefined ? 10 : tolerance;
25940 var idx, snapValue;
25942 for (idx = 0; idx < values.length; idx++) {
25943 snapValue = values[idx];
25945 if (abs(snapValue - value) <= tolerance) {
25952 module.exports.snapTo = snapTo;
25955 function topLeft(bounds) {
25962 module.exports.topLeft = topLeft;
25965 function mid(bounds, defaultValue) {
25967 if (!bounds || isNaN(bounds.x) || isNaN(bounds.y)) {
25968 return defaultValue;
25972 x: round(bounds.x + bounds.width / 2),
25973 y: round(bounds.y + bounds.height / 2)
25977 module.exports.mid = mid;
25980 function bottomRight(bounds) {
25982 x: bounds.x + bounds.width,
25983 y: bounds.y + bounds.height
25987 module.exports.bottomRight = bottomRight;
25989 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\Snapping.js": [function(require, module, exports) {
25992 var filter = require('lodash/collection/filter'),
25993 forEach = require('lodash/collection/forEach'),
25994 debounce = require('lodash/function/debounce');
25997 var mid = require('./SnapUtil').mid;
25999 var SnapContext = require('./SnapContext');
26002 * A general purpose snapping component for diagram elements.
26004 * @param {EventBus}
26009 function Snapping(eventBus, canvas) {
26011 this._canvas = canvas;
26015 eventBus.on(['shape.move.start', 'create.start'], function(event) {
26016 self.initSnap(event);
26019 eventBus.on(['shape.move.move', 'shape.move.end', 'create.move', 'create.end'], function(event) {
26020 if (event.snapped) {
26027 eventBus.on(['shape.move.cleanup', 'create.cleanup'], function(event) {
26031 // delay hide by 1000 seconds since last match
26032 this._asyncHide = debounce(this.hide, 1000);
26035 Snapping.$inject = ['eventBus', 'canvas'];
26037 module.exports = Snapping;
26040 Snapping.prototype.initSnap = function(event) {
26042 var context = event.context,
26043 shape = context.shape,
26044 snapContext = context.snapContext;
26046 if (!snapContext) {
26047 snapContext = context.snapContext = new SnapContext();
26050 var snapMid = mid(shape, event);
26052 snapContext.setSnapOrigin('mid', {
26053 x: snapMid.x - event.x,
26054 y: snapMid.y - event.y
26057 return snapContext;
26061 Snapping.prototype.snap = function(event) {
26063 var context = event.context,
26064 snapContext = context.snapContext,
26065 shape = context.shape,
26066 target = context.target,
26067 snapLocations = snapContext.getSnapLocations();
26073 var snapPoints = snapContext.pointsForTarget(target);
26075 if (!snapPoints.initialized) {
26076 this.addTargetSnaps(snapPoints, shape, target);
26078 snapPoints.initialized = true;
26084 forEach(snapLocations, function(location) {
26086 var snapOrigin = snapContext.getSnapOrigin(location);
26088 var snapCurrent = {
26089 x: event.x + snapOrigin.x,
26090 y: event.y + snapOrigin.y
26093 // snap on both axis, if not snapped already
26094 forEach(['x', 'y'], function(axis) {
26095 var locationSnapping;
26097 if (!snapping[axis]) {
26098 locationSnapping = snapPoints.snap(snapCurrent, location, axis, 7);
26100 if (locationSnapping !== undefined) {
26102 value: locationSnapping,
26103 originValue: locationSnapping - snapOrigin[axis]
26109 // no more need to snap, drop out of interation
26110 if (snapping.x && snapping.y) {
26116 // show snap visuals
26118 this.showSnapLine('vertical', snapping.x && snapping.x.value);
26119 this.showSnapLine('horizontal', snapping.y && snapping.y.value);
26122 // adjust event { x, y, dx, dy } and mark as snapping
26127 cx = event.x - snapping.x.originValue;
26129 event.x = snapping.x.originValue;
26130 event.dx = event.dx - cx;
26132 event.snapped = true;
26136 cy = event.y - snapping.y.originValue;
26138 event.y = snapping.y.originValue;
26139 event.dy = event.dy - cy;
26141 event.snapped = true;
26146 Snapping.prototype._createLine = function(orientation) {
26148 var root = this._canvas.getLayer('snap');
26150 var line = root.path('M0,0 L0,0').addClass('djs-snap-line');
26153 update: function(position) {
26155 if (position === undefined) {
26160 if (orientation === 'horizontal') {
26162 path: 'M-100000,' + position + ' L+100000,' + position,
26167 path: 'M ' + position + ',-100000 L ' + position + ', +100000',
26177 Snapping.prototype._createSnapLines = function() {
26179 this._snapLines = {
26180 horizontal: this._createLine('horizontal'),
26181 vertical: this._createLine('vertical')
26185 Snapping.prototype.showSnapLine = function(orientation, position) {
26187 var line = this.getSnapLine(orientation);
26190 line.update(position);
26196 Snapping.prototype.getSnapLine = function(orientation) {
26197 if (!this._snapLines) {
26198 this._createSnapLines();
26201 return this._snapLines[orientation];
26204 Snapping.prototype.hide = function() {
26205 forEach(this._snapLines, function(l) {
26210 Snapping.prototype.addTargetSnaps = function(snapPoints, shape, target) {
26212 var siblings = this.getSiblings(shape, target);
26214 forEach(siblings, function(s) {
26215 snapPoints.add('mid', mid(s));
26220 Snapping.prototype.getSiblings = function(element, target) {
26222 // snap to all non connection siblings
26223 return target && filter(target.children, function(e) {
26224 return !e.hidden && !e.labelTarget && !e.waypoints && e !== element;
26228 "./SnapContext": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapContext.js",
26229 "./SnapUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\snapping\\SnapUtil.js",
26230 "lodash/collection/filter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js",
26231 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
26232 "lodash/function/debounce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js"
26234 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceTool.js": [function(require, module, exports) {
26237 var SpaceUtil = require('./SpaceUtil');
26239 var Cursor = require('../../util/Cursor');
26241 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier;
26243 var abs = Math.abs,
26244 round = Math.round;
26246 var HIGH_PRIORITY = 1500;
26249 * A tool that allows users to create and remove space in a diagram.
26251 * The tool needs to be activated manually via
26252 * {@link SpaceTool#activate(MouseEvent)}.
26254 function SpaceTool(eventBus, dragging, elementRegistry, modeling, rules) {
26256 function canResize(shape) {
26260 return rules.allowed('shape.resize', ctx);
26263 function activateSelection(event, autoActivate) {
26264 dragging.activate(event, 'spaceTool.selection', {
26265 cursor: 'crosshair',
26266 autoActivate: autoActivate,
26275 function activateMakeSpace(event) {
26276 dragging.activate(event, 'spaceTool', {
26277 autoActivate: true,
26278 cursor: 'crosshair',
26286 eventBus.on('spaceTool.selection.end', function(event) {
26287 setTimeout(function() {
26288 activateMakeSpace(event.originalEvent);
26293 var AXIS_TO_DIMENSION = {
26303 function initializeMakeSpace(event, context) {
26305 var axis = abs(event.dx) > abs(event.dy) ? 'x' : 'y',
26306 offset = event['d' + axis],
26307 // start point of create space operation
26308 spacePos = event[axis] - offset,
26309 // list of moving shapes
26311 // list of resizing shapes
26312 resizingShapes = [];
26314 if (abs(offset) < 5) {
26318 // inverts the offset to choose the shapes
26319 // on the opposite side of the resizer if
26320 // a key modifier is pressed
26321 if (hasPrimaryModifier(event)) {
26325 // collect all elements that need to be moved _AND_
26326 // resized given on the initial create space position
26327 elementRegistry.forEach(function(shape) {
26328 var shapeStart = shape[[axis]],
26329 shapeEnd = shapeStart + shape[AXIS_TO_DIMENSION[axis]];
26331 // checking if it's root
26332 if (!shape.parent) {
26336 // checking if it's a shape
26337 if (shape.waypoints) {
26341 // shape after spacePos
26342 if (offset > 0 && shapeStart > spacePos) {
26343 return movingShapes.push(shape);
26346 // shape before spacePos
26347 if (offset < 0 && shapeEnd < spacePos) {
26348 return movingShapes.push(shape);
26351 // shape on top of spacePos, resize only if allowed
26352 if (shapeStart < spacePos && shapeEnd > spacePos && canResize(shape)) {
26353 return resizingShapes.push(shape);
26357 // store data in context
26358 context.axis = axis;
26359 context.direction = SpaceUtil.getDirection(axis, offset);
26360 context.movingShapes = movingShapes;
26361 context.resizingShapes = resizingShapes;
26363 Cursor.set('resize-' + (axis === 'x' ? 'ew' : 'ns'));
26369 eventBus.on('spaceTool.move', HIGH_PRIORITY, function(event) {
26371 var context = event.context;
26373 if (!context.initialized) {
26374 context.initialized = initializeMakeSpace(event, context);
26379 eventBus.on('spaceTool.end', function(event) {
26381 var context = event.context,
26382 axis = context.axis,
26383 direction = context.direction,
26384 movingShapes = context.movingShapes,
26385 resizingShapes = context.resizingShapes;
26387 // skip if create space has not been initialized yet
26388 if (!context.initialized) {
26393 x: round(event.dx),
26396 delta[AXIS_INVERTED[axis]] = 0;
26398 return modeling.createSpace(movingShapes, resizingShapes, delta, direction);
26402 this.activateSelection = activateSelection;
26403 this.activateMakeSpace = activateMakeSpace;
26406 SpaceTool.$inject = ['eventBus', 'dragging', 'elementRegistry', 'modeling', 'rules'];
26408 module.exports = SpaceTool;
26411 "../../util/Cursor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js",
26412 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
26413 "./SpaceUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceUtil.js"
26415 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceToolVisuals.js": [function(require, module, exports) {
26418 var forEach = require('lodash/collection/forEach');
26421 var MARKER_DRAGGING = 'djs-dragging';
26425 * A plugin that makes shapes draggable / droppable.
26427 * @param {EventBus}
26429 * @param {ElementRegistry}
26437 function SpaceToolVisuals(eventBus, elementRegistry, canvas, styles) {
26439 function getGfx(e) {
26440 return elementRegistry.getGraphics(e);
26443 function addDragger(shape, dragGroup) {
26444 var gfx = getGfx(shape);
26445 var dragger = gfx.clone();
26446 var bbox = gfx.getBBox();
26448 dragger.attr(styles.cls('djs-dragger', [], {
26453 dragGroup.add(dragger);
26456 eventBus.on('spaceTool.selection.start', function(event) {
26457 var space = canvas.getLayer('space'),
26458 context = event.context;
26460 var orientation = {
26461 x: 'M 0,-10000 L 0,10000',
26462 y: 'M -10000,0 L 10000,0'
26465 var crosshairGroup = space.group().attr(styles.cls('djs-crosshair-group', ['no-events']));
26467 crosshairGroup.path(orientation.x).addClass('djs-crosshair');
26468 crosshairGroup.path(orientation.y).addClass('djs-crosshair');
26470 context.crosshairGroup = crosshairGroup;
26473 eventBus.on('spaceTool.selection.move', function(event) {
26474 var crosshairGroup = event.context.crosshairGroup;
26476 crosshairGroup.translate(event.x, event.y);
26479 eventBus.on('spaceTool.selection.cleanup', function(event) {
26480 var context = event.context,
26481 crosshairGroup = context.crosshairGroup;
26483 if (crosshairGroup) {
26484 crosshairGroup.remove();
26489 // assign a low priority to this handler
26490 // to let others modify the move context before
26492 eventBus.on('spaceTool.move', function(event) {
26494 * TODO (Ricardo): extend connections while adding space
26497 var context = event.context,
26498 line = context.line,
26499 axis = context.axis,
26500 dragShapes = context.movingShapes;
26502 if (!context.initialized) {
26506 if (!context.dragGroup) {
26507 var spaceLayer = canvas.getLayer('space');
26508 line = spaceLayer.path('M0,0 L0,0').addClass('djs-crosshair');
26510 context.line = line;
26511 var dragGroup = canvas.getDefaultLayer().group().attr(styles.cls('djs-drag-group', ['no-events']));
26514 forEach(dragShapes, function(shape) {
26515 addDragger(shape, dragGroup);
26516 canvas.addMarker(shape, MARKER_DRAGGING);
26519 context.dragGroup = dragGroup;
26522 var orientation = {
26523 x: 'M' + event.x + ', -10000 L' + event.x + ', 10000',
26524 y: 'M -10000, ' + event.y + ' L 10000, ' + event.y
26528 path: orientation[axis],
26540 delta[opposite[context.axis]] = 0;
26542 context.dragGroup.translate(delta.x, delta.y);
26545 eventBus.on('spaceTool.cleanup', function(event) {
26547 var context = event.context,
26548 shapes = context.movingShapes,
26549 line = context.line,
26550 dragGroup = context.dragGroup;
26552 // remove dragging marker
26553 forEach(shapes, function(e) {
26554 canvas.removeMarker(e, MARKER_DRAGGING);
26559 dragGroup.remove();
26564 SpaceToolVisuals.$inject = ['eventBus', 'elementRegistry', 'canvas', 'styles'];
26566 module.exports = SpaceToolVisuals;
26569 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js"
26571 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceUtil.js": [function(require, module, exports) {
26575 * Get Resize direction given axis + offset
26582 * @return {String} (e|w|n|s)
26584 function getDirection(axis, offset) {
26586 if (axis === 'x') {
26596 if (axis === 'y') {
26609 module.exports.getDirection = getDirection;
26612 * Resize the given bounds by the specified delta from a given anchor point.
26615 * bounds the bounding box that should be resized
26617 * direction in which the element is resized (n, s, e, w)
26619 * delta of the resize operation
26621 * @return {Bounds} resized bounding box
26623 module.exports.resizeBounds = function(bounds, direction, delta) {
26628 switch (direction) {
26634 width: bounds.width,
26635 height: bounds.height - dy
26642 width: bounds.width,
26643 height: bounds.height + dy
26650 width: bounds.width - dx,
26651 height: bounds.height
26658 width: bounds.width + dx,
26659 height: bounds.height
26663 throw new Error('unrecognized direction: ' + direction);
26667 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\index.js": [function(require, module, exports) {
26669 __init__: ['spaceToolVisuals'],
26670 __depends__: [require('../dragging'), require('../modeling'), require('../rules')],
26671 spaceTool: ['type', require('./SpaceTool')],
26672 spaceToolVisuals: ['type', require('./SpaceToolVisuals')]
26676 "../dragging": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\dragging\\index.js",
26677 "../modeling": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\modeling\\index.js",
26678 "../rules": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\rules\\index.js",
26679 "./SpaceTool": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceTool.js",
26680 "./SpaceToolVisuals": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\space-tool\\SpaceToolVisuals.js"
26682 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\Tooltips.js": [function(require, module, exports) {
26685 var isString = require('lodash/lang/isString'),
26686 assign = require('lodash/object/assign'),
26687 forEach = require('lodash/collection/forEach'),
26688 debounce = require('lodash/function/debounce');
26690 var domify = require('min-dom/lib/domify'),
26691 domAttr = require('min-dom/lib/attr'),
26692 domClasses = require('min-dom/lib/classes'),
26693 domRemove = require('min-dom/lib/remove'),
26694 domDelegate = require('min-dom/lib/delegate');
26697 // document wide unique tooltip ids
26698 var ids = new(require('../../util/IdGenerator'))('tt');
26701 function createRoot(parent) {
26702 var root = domify('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />');
26703 parent.insertBefore(root, parent.firstChild);
26709 function setPosition(el, x, y) {
26716 function setVisible(el, visible) {
26717 el.style.display = visible === false ? 'none' : '';
26721 var tooltipClass = 'djs-tooltip',
26722 tooltipSelector = '.' + tooltipClass;
26725 * A service that allows users to render tool tips on the diagram.
26727 * The tooltip service will take care of updating the tooltip positioning during
26728 * navigation + zooming.
26733 * // add a pink badge on the top left of the shape tooltips.add({ position: {
26734 * x: 50, y: 100 }, html: '<div style="width: 10px; background: fuchsia; color:
26735 * white;">0</div>' });
26736 * // or with optional life span tooltips.add({ position: { top: -5, left: -5 },
26737 * html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>',
26739 * // remove a tool tip var id = tooltips.add(...); tooltips.remove(id); ```
26743 * @param {EventBus}
26748 function Tooltips(config, eventBus, canvas) {
26750 this._eventBus = eventBus;
26751 this._canvas = canvas;
26755 this._tooltipDefaults = {
26763 * Mapping tooltipId -> tooltip
26765 this._tooltips = {};
26767 // root html element for all tooltips
26768 this._tooltipRoot = createRoot(canvas.getContainer());
26773 domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mousedown', function(event) {
26774 event.stopPropagation();
26777 domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mouseover', function(event) {
26778 self.trigger('mouseover', event);
26781 domDelegate.bind(this._tooltipRoot, tooltipSelector, 'mouseout', function(event) {
26782 self.trigger('mouseout', event);
26785 this._init(config);
26789 Tooltips.$inject = ['config.tooltips', 'eventBus', 'canvas'];
26791 module.exports = Tooltips;
26795 * Adds a HTML tooltip to the diagram
26798 * tooltip the tooltip configuration
26800 * @param {String|DOMElement}
26801 * tooltip.html html element to use as an tooltip
26803 * [tooltip.show] show configuration
26805 * [tooltip.show.minZoom] minimal zoom level to show the tooltip
26807 * [tooltip.show.maxZoom] maximum zoom level to show the tooltip
26809 * tooltip.position where to attach the tooltip
26811 * [tooltip.position.left] relative to element bbox left attachment
26813 * [tooltip.position.top] relative to element bbox top attachment
26815 * [tooltip.position.bottom] relative to element bbox bottom
26818 * [tooltip.position.right] relative to element bbox right attachment
26820 * [tooltip.timeout=-1]
26822 * @return {String} id that may be used to reference the tooltip for update or
26825 Tooltips.prototype.add = function(tooltip) {
26827 if (!tooltip.position) {
26828 throw new Error('must specifiy tooltip position');
26831 if (!tooltip.html) {
26832 throw new Error('must specifiy tooltip html');
26835 var id = this._ids.next();
26837 tooltip = assign({}, this._tooltipDefaults, tooltip, {
26841 this._addTooltip(tooltip);
26843 if (tooltip.timeout) {
26844 this.setTimeout(tooltip);
26850 Tooltips.prototype.trigger = function(action, event) {
26852 var node = event.delegateTarget || event.target;
26854 var tooltip = this.get(domAttr(node, 'data-tooltip-id'));
26860 if (action === 'mouseover' && tooltip.timeout) {
26861 this.clearTimeout(tooltip);
26864 if (action === 'mouseout' && tooltip.timeout) {
26865 // cut timeout after mouse out
26866 tooltip.timeout = 1000;
26868 this.setTimeout(tooltip);
26871 console.log('mouse leave', event);
26875 * Get a tooltip with the given id
26880 Tooltips.prototype.get = function(id) {
26882 if (typeof id !== 'string') {
26886 return this._tooltips[id];
26889 Tooltips.prototype.clearTimeout = function(tooltip) {
26891 tooltip = this.get(tooltip);
26897 var removeTimer = tooltip.removeTimer;
26900 clearTimeout(removeTimer);
26901 tooltip.removeTimer = null;
26905 Tooltips.prototype.setTimeout = function(tooltip) {
26907 tooltip = this.get(tooltip);
26913 this.clearTimeout(tooltip);
26917 tooltip.removeTimer = setTimeout(function() {
26918 self.remove(tooltip);
26919 }, tooltip.timeout);
26923 * Remove an tooltip with the given id
26928 Tooltips.prototype.remove = function(id) {
26930 var tooltip = this.get(id);
26933 domRemove(tooltip.html);
26934 domRemove(tooltip.htmlContainer);
26936 delete tooltip.htmlContainer;
26938 delete this._tooltips[tooltip.id];
26943 Tooltips.prototype.show = function() {
26944 setVisible(this._tooltipRoot);
26948 Tooltips.prototype.hide = function() {
26949 setVisible(this._tooltipRoot, false);
26953 Tooltips.prototype._updateRoot = function(viewbox) {
26954 var a = viewbox.scale || 1;
26955 var d = viewbox.scale || 1;
26957 var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
26959 this._tooltipRoot.style.transform = matrix;
26960 this._tooltipRoot.style['-ms-transform'] = matrix;
26964 Tooltips.prototype._addTooltip = function(tooltip) {
26966 var id = tooltip.id,
26967 html = tooltip.html,
26969 tooltipRoot = this._tooltipRoot;
26971 // unwrap jquery (for those who need it)
26973 html = html.get(0);
26976 // create proper html elements from
26977 // tooltip HTML strings
26978 if (isString(html)) {
26979 html = domify(html);
26982 htmlContainer = domify('<div data-tooltip-id="' + id + '" class="' + tooltipClass + '" style="position: absolute">');
26984 htmlContainer.appendChild(html);
26986 if (tooltip.type) {
26987 domClasses(htmlContainer).add('djs-tooltip-' + tooltip.type);
26990 if (tooltip.className) {
26991 domClasses(htmlContainer).add(tooltip.className);
26994 tooltip.htmlContainer = htmlContainer;
26996 tooltipRoot.appendChild(htmlContainer);
26998 this._tooltips[id] = tooltip;
27000 this._updateTooltip(tooltip);
27004 Tooltips.prototype._updateTooltip = function(tooltip) {
27006 var position = tooltip.position,
27007 htmlContainer = tooltip.htmlContainer;
27009 // update overlay html based on tooltip x, y
27011 setPosition(htmlContainer, position.x, position.y);
27015 Tooltips.prototype._updateTooltipVisibilty = function(viewbox) {
27017 forEach(this._tooltips, function(tooltip) {
27018 var show = tooltip.show,
27019 htmlContainer = tooltip.htmlContainer,
27023 if (show.minZoom > viewbox.scale ||
27024 show.maxZoom < viewbox.scale) {
27028 setVisible(htmlContainer, visible);
27033 Tooltips.prototype._init = function(config) {
27038 // scroll/zoom integration
27040 var updateViewbox = function(viewbox) {
27041 self._updateRoot(viewbox);
27042 self._updateTooltipVisibilty(viewbox);
27047 if (!config || config.deferUpdate !== false) {
27048 updateViewbox = debounce(updateViewbox, 300);
27051 this._eventBus.on('canvas.viewbox.changed', function(event) {
27053 updateViewbox(event.viewbox);
27058 "../../util/IdGenerator": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\IdGenerator.js",
27059 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
27060 "lodash/function/debounce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js",
27061 "lodash/lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
27062 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
27063 "min-dom/lib/attr": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js",
27064 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js",
27065 "min-dom/lib/delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js",
27066 "min-dom/lib/domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js",
27067 "min-dom/lib/remove": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js"
27069 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\index.js": [function(require, module, exports) {
27071 __init__: ['tooltips'],
27072 tooltips: ['type', require('./Tooltips')]
27075 "./Tooltips": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\tooltips\\Tooltips.js"
27077 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchFix.js": [function(require, module, exports) {
27080 function TouchFix(canvas, eventBus) {
27084 eventBus.on('canvas.init', function(e) {
27085 self.addBBoxMarker(e.svg);
27089 TouchFix.$inject = ['canvas', 'eventBus'];
27091 module.exports = TouchFix;
27095 * Safari mobile (iOS 7) does not fire touchstart event in <SVG> element if
27096 * there is no shape between 0,0 and viewport elements origin.
27098 * So touchstart event is only fired when the <g class="viewport"> element was
27099 * hit. Putting an element over and below the 'viewport' fixes that behavior.
27101 TouchFix.prototype.addBBoxMarker = function(paper) {
27103 var markerStyle = {
27105 class: 'outer-bound-marker'
27108 paper.rect(-10000, -10000, 10, 10).attr(markerStyle);
27109 paper.rect(10000, 10000, 10, 10).attr(markerStyle);
27113 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchInteractionEvents.js": [function(require, module, exports) {
27116 var forEach = require('lodash/collection/forEach'),
27117 domEvent = require('min-dom/lib/event'),
27118 domClosest = require('min-dom/lib/closest'),
27119 Hammer = require('hammerjs'),
27120 Snap = require('../../../vendor/snapsvg'),
27121 Event = require('../../util/Event');
27123 var MIN_ZOOM = 0.2,
27126 var mouseEvents = [
27137 console.log.apply(console, arguments);
27141 function get(service, injector) {
27143 return injector.get(service);
27149 function createTouchRecognizer(node) {
27151 function stopEvent(event) {
27152 Event.stopEvent(event, true);
27155 function stopMouse(event) {
27157 forEach(mouseEvents, function(e) {
27158 domEvent.bind(node, e, stopEvent, true);
27162 function allowMouse(event) {
27163 setTimeout(function() {
27164 forEach(mouseEvents, function(e) {
27165 domEvent.unbind(node, e, stopEvent, true);
27170 domEvent.bind(node, 'touchstart', stopMouse, true);
27171 domEvent.bind(node, 'touchend', allowMouse, true);
27172 domEvent.bind(node, 'touchcancel', allowMouse, true);
27174 // A touch event recognizer that handles
27175 // touch events only (we know, we can already handle
27176 // mouse events out of the box)
27178 var recognizer = new Hammer.Manager(node, {
27179 inputClass: Hammer.TouchInput,
27184 var tap = new Hammer.Tap();
27185 var pan = new Hammer.Pan({
27188 var press = new Hammer.Press();
27189 var pinch = new Hammer.Pinch();
27191 var doubleTap = new Hammer.Tap({
27192 event: 'doubletap',
27196 pinch.requireFailure(pan);
27197 pinch.requireFailure(press);
27199 recognizer.add([pan, press, pinch, doubleTap, tap]);
27201 recognizer.reset = function(force) {
27202 var recognizers = this.recognizers,
27203 session = this.session;
27205 if (session.stopped) {
27209 log('recognizer', 'stop');
27211 recognizer.stop(force);
27213 setTimeout(function() {
27216 log('recognizer', 'reset');
27217 for (i = 0; !!(r = recognizers[i]); i++) {
27219 r.state = 8; // FAILED STATE
27222 session.curRecognizer = null;
27226 recognizer.on('hammer.input', function(event) {
27227 if (event.srcEvent.defaultPrevented) {
27228 recognizer.reset(true);
27236 * A plugin that provides touch events for elements.
27238 * @param {EventBus}
27240 * @param {InteractionEvents}
27241 * interactionEvents
27243 function TouchInteractionEvents(injector, canvas, eventBus, elementRegistry, interactionEvents, snap) {
27245 // optional integrations
27246 var dragging = get('dragging', injector),
27247 move = get('move', injector),
27248 contextPad = get('contextPad', injector),
27249 palette = get('palette', injector);
27251 // the touch recognizer
27254 function handler(type) {
27256 return function(event) {
27257 log('element', type, event);
27259 interactionEvents.fire(type, event);
27263 function getGfx(target) {
27264 var node = domClosest(target, 'svg, .djs-element', true);
27265 return node && new Snap(node);
27268 function initEvents(svg) {
27270 // touch recognizer
27271 recognizer = createTouchRecognizer(svg);
27273 recognizer.on('doubletap', handler('element.dblclick'));
27275 recognizer.on('tap', handler('element.click'));
27277 function startGrabCanvas(event) {
27279 log('canvas', 'grab start');
27284 function update(e) {
27286 var dx = e.deltaX - lx,
27287 dy = e.deltaY - ly;
27299 recognizer.off('panmove', update);
27300 recognizer.off('panend', end);
27301 recognizer.off('pancancel', end);
27303 log('canvas', 'grab end');
27306 recognizer.on('panmove', update);
27307 recognizer.on('panend', end);
27308 recognizer.on('pancancel', end);
27311 function startGrab(event) {
27313 var gfx = getGfx(event.target),
27314 element = gfx && elementRegistry.get(gfx);
27317 if (move && canvas.getRootElement() !== element) {
27318 log('element', 'move start', element, event, true);
27319 return move.start(event, element, true);
27321 startGrabCanvas(event);
27325 function startZoom(e) {
27327 log('canvas', 'zoom start');
27329 var zoom = canvas.zoom(),
27332 function update(e) {
27334 var ratio = 1 - (1 - e.scale) / 1.50,
27335 newZoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, ratio * zoom));
27337 canvas.zoom(newZoom, mid);
27339 Event.stopEvent(e, true);
27343 recognizer.off('pinchmove', update);
27344 recognizer.off('pinchend', end);
27345 recognizer.off('pinchcancel', end);
27347 recognizer.reset(true);
27349 log('canvas', 'zoom end');
27352 recognizer.on('pinchmove', update);
27353 recognizer.on('pinchend', end);
27354 recognizer.on('pinchcancel', end);
27357 recognizer.on('panstart', startGrab);
27358 recognizer.on('press', startGrab);
27360 recognizer.on('pinchstart', startZoom);
27365 // simulate hover during dragging
27366 eventBus.on('drag.move', function(event) {
27368 var position = Event.toPoint(event.originalEvent);
27370 var node = document.elementFromPoint(position.x, position.y),
27371 gfx = getGfx(node),
27372 element = gfx && elementRegistry.get(gfx);
27374 if (element !== event.hover) {
27376 dragging.out(event);
27385 event.hover = element;
27386 event.hoverGfx = gfx;
27394 eventBus.on('contextPad.create', function(event) {
27395 var node = event.pad.html;
27397 // touch recognizer
27398 var padRecognizer = createTouchRecognizer(node);
27400 padRecognizer.on('panstart', function(event) {
27401 log('context-pad', 'panstart', event);
27402 contextPad.trigger('dragstart', event, true);
27405 padRecognizer.on('press', function(event) {
27406 log('context-pad', 'press', event);
27407 contextPad.trigger('dragstart', event, true);
27410 padRecognizer.on('tap', function(event) {
27411 log('context-pad', 'tap', event);
27412 contextPad.trigger('click', event);
27418 eventBus.on('palette.create', function(event) {
27419 var node = event.html;
27421 // touch recognizer
27422 var padRecognizer = createTouchRecognizer(node);
27424 padRecognizer.on('panstart', function(event) {
27425 log('palette', 'panstart', event);
27426 palette.trigger('dragstart', event, true);
27429 padRecognizer.on('press', function(event) {
27430 log('palette', 'press', event);
27431 palette.trigger('dragstart', event, true);
27434 padRecognizer.on('tap', function(event) {
27435 log('palette', 'tap', event);
27436 palette.trigger('click', event);
27441 eventBus.on('canvas.init', function(event) {
27442 initEvents(event.svg.node);
27447 TouchInteractionEvents.$inject = [
27452 'interactionEvents',
27456 module.exports = TouchInteractionEvents;
27458 "../../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
27459 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
27460 "hammerjs": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\hammerjs\\hammer.js",
27461 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
27462 "min-dom/lib/closest": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\closest.js",
27463 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
27465 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\index.js": [function(require, module, exports) {
27467 __depends__: [require('../interaction-events')],
27468 __init__: ['touchInteractionEvents'],
27469 touchInteractionEvents: ['type', require('./TouchInteractionEvents')],
27470 touchFix: ['type', require('./TouchFix')]
27473 "../interaction-events": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\interaction-events\\index.js",
27474 "./TouchFix": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchFix.js",
27475 "./TouchInteractionEvents": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\TouchInteractionEvents.js"
27477 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\BaseLayouter.js": [function(require, module, exports) {
27480 var LayoutUtil = require('./LayoutUtil');
27484 * A base connection layouter implementation that layouts the connection by
27485 * directly connecting mid(source) + mid(target).
27487 function BaseLayouter() {}
27489 module.exports = BaseLayouter;
27493 * Return the new layouted waypoints for the given connection.
27495 * @param {djs.model.Connection}
27500 * [hints.movedStart=false]
27502 * [hints.movedEnd=false]
27504 * @return {Array<Point>} the layouted connection waypoints
27506 BaseLayouter.prototype.layoutConnection = function(connection, hints) {
27508 LayoutUtil.getMidPoint(connection.source),
27509 LayoutUtil.getMidPoint(connection.target)
27514 "./LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js"
27516 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\CroppingConnectionDocking.js": [function(require, module, exports) {
27519 var assign = require('lodash/object/assign');
27521 var LayoutUtil = require('./LayoutUtil');
27524 function dockingToPoint(docking) {
27525 // use the dockings actual point and
27526 // retain the original docking
27528 original: docking.point.original || docking.point
27529 }, docking.actual);
27534 * A {@link ConnectionDocking} that crops connection waypoints based on the
27535 * path(s) of the connection source and target.
27537 * @param {djs.core.ElementRegistry}
27540 function CroppingConnectionDocking(elementRegistry, renderer) {
27541 this._elementRegistry = elementRegistry;
27542 this._renderer = renderer;
27545 CroppingConnectionDocking.$inject = ['elementRegistry', 'renderer'];
27547 module.exports = CroppingConnectionDocking;
27551 * @inheritDoc ConnectionDocking#getCroppedWaypoints
27553 CroppingConnectionDocking.prototype.getCroppedWaypoints = function(connection, source, target) {
27555 source = source || connection.source;
27556 target = target || connection.target;
27558 var sourceDocking = this.getDockingPoint(connection, source, true),
27559 targetDocking = this.getDockingPoint(connection, target);
27561 var croppedWaypoints = connection.waypoints.slice(sourceDocking.idx + 1, targetDocking.idx);
27563 croppedWaypoints.unshift(dockingToPoint(sourceDocking));
27564 croppedWaypoints.push(dockingToPoint(targetDocking));
27566 return croppedWaypoints;
27570 * Return the connection docking point on the specified shape
27572 * @inheritDoc ConnectionDocking#getDockingPoint
27574 CroppingConnectionDocking.prototype.getDockingPoint = function(connection, shape, dockStart) {
27576 var waypoints = connection.waypoints,
27581 dockingIdx = dockStart ? 0 : waypoints.length - 1;
27582 dockingPoint = waypoints[dockingIdx];
27584 croppedPoint = this._getIntersection(shape, connection, dockStart);
27587 point: dockingPoint,
27588 actual: croppedPoint || dockingPoint,
27594 // //// helper methods ///////////////////////////////////////////////////
27596 CroppingConnectionDocking.prototype._getIntersection = function(shape, connection, takeFirst) {
27598 var shapePath = this._getShapePath(shape),
27599 connectionPath = this._getConnectionPath(connection);
27601 return LayoutUtil.getElementLineIntersection(shapePath, connectionPath, takeFirst);
27604 CroppingConnectionDocking.prototype._getConnectionPath = function(connection) {
27605 return this._renderer.getConnectionPath(connection);
27608 CroppingConnectionDocking.prototype._getShapePath = function(shape) {
27609 return this._renderer.getShapePath(shape);
27612 CroppingConnectionDocking.prototype._getGfx = function(element) {
27613 return this._elementRegistry.getGraphics(element);
27616 "./LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js",
27617 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js"
27619 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js": [function(require, module, exports) {
27622 var isArray = require('lodash/lang/isArray'),
27623 sortBy = require('lodash/collection/sortBy');
27625 var Snap = require('../../vendor/snapsvg');
27628 * Returns whether two points are in a horizontal or vertical line.
27635 * @return {String|Boolean} returns false if the points are not aligned or 'h|v'
27636 * if they are aligned horizontally / vertically.
27638 function pointsAligned(a, b) {
27649 module.exports.pointsAligned = pointsAligned;
27652 function roundPoint(point) {
27655 x: Math.round(point.x),
27656 y: Math.round(point.y)
27660 module.exports.roundPoint = roundPoint;
27663 function pointsEqual(a, b) {
27664 return a.x === b.x && a.y === b.y;
27667 module.exports.pointsEqual = pointsEqual;
27670 function pointDistance(a, b) {
27671 return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
27674 module.exports.pointDistance = pointDistance;
27677 function asTRBL(bounds) {
27680 right: bounds.x + (bounds.width || 0),
27681 bottom: bounds.y + (bounds.height || 0),
27686 module.exports.asTRBL = asTRBL;
27689 function getMidPoint(bounds) {
27690 return roundPoint({
27691 x: bounds.x + bounds.width / 2,
27692 y: bounds.y + bounds.height / 2
27696 module.exports.getMidPoint = getMidPoint;
27699 // //// orientation utils //////////////////////////////
27701 function getOrientation(rect, reference, pointDistance) {
27703 pointDistance = pointDistance || 0;
27705 var rectOrientation = asTRBL(rect),
27706 referenceOrientation = asTRBL(reference);
27708 var top = rectOrientation.bottom + pointDistance <= referenceOrientation.top,
27709 right = rectOrientation.left - pointDistance >= referenceOrientation.right,
27710 bottom = rectOrientation.top - pointDistance >= referenceOrientation.bottom,
27711 left = rectOrientation.right + pointDistance <= referenceOrientation.left;
27713 var vertical = top ? 'top' : (bottom ? 'bottom' : null),
27714 horizontal = left ? 'left' : (right ? 'right' : null);
27716 if (horizontal && vertical) {
27717 return vertical + '-' + horizontal;
27719 if (horizontal || vertical) {
27720 return horizontal || vertical;
27722 return 'intersect';
27726 module.exports.getOrientation = getOrientation;
27729 function hasAnyOrientation(rect, reference, pointDistance, locations) {
27731 if (isArray(pointDistance)) {
27732 locations = pointDistance;
27736 var orientation = getOrientation(rect, reference, pointDistance);
27738 return locations.indexOf(orientation) !== -1;
27741 module.exports.hasAnyOrientation = hasAnyOrientation;
27744 // //// intersection utils //////////////////////////////
27746 function getElementLineIntersection(elementPath, linePath, cropStart) {
27748 var intersections = getIntersections(elementPath, linePath);
27750 // recognize intersections
27751 // only one -> choose
27752 // two close together -> choose first
27753 // two or more distinct -> pull out appropriate one
27754 // none -> ok (fallback to point itself)
27755 if (intersections.length === 1) {
27756 return roundPoint(intersections[0]);
27757 } else if (intersections.length === 2 && pointDistance(intersections[0], intersections[1]) < 1) {
27758 return roundPoint(intersections[0]);
27759 } else if (intersections.length > 1) {
27761 // sort by intersections based on connection segment +
27762 // distance from start
27763 intersections = sortBy(intersections, function(i) {
27764 var distance = Math.floor(i.t2 * 100) || 1;
27766 distance = 100 - distance;
27768 distance = (distance < 10 ? '0' : '') + distance;
27770 // create a sort string that makes sure we sort
27771 // line segment ASC + line segment position DESC (for cropStart)
27772 // line segment ASC + line segment position ASC (for cropEnd)
27773 return i.segment2 + '#' + distance;
27776 return roundPoint(intersections[cropStart ? 0 : intersections.length - 1]);
27782 module.exports.getElementLineIntersection = getElementLineIntersection;
27785 function getIntersections(a, b) {
27786 return Snap.path.intersection(a, b);
27789 module.exports.getIntersections = getIntersections;
27791 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
27792 "lodash/collection/sortBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\sortBy.js",
27793 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
27795 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\ManhattanLayout.js": [function(require, module, exports) {
27798 var isArray = require('lodash/lang/isArray'),
27799 find = require('lodash/collection/find');
27801 var LayoutUtil = require('./LayoutUtil'),
27802 Geometry = require('../util/Geometry');
27804 var MIN_DISTANCE = 20;
27808 * Returns the mid points for a manhattan connection between two points.
27812 * [a]----[x] | [x]--->[b]
27821 * @return {Array<Point>}
27823 module.exports.getMidPoints = function(a, b, directions) {
27825 directions = directions || 'h:h';
27829 // one point, next to a
27830 if (directions === 'h:v') {
27836 // one point, above a
27837 if (directions === 'v:h') {
27843 // vertical edge xmid
27844 if (directions === 'h:h') {
27845 xmid = Math.round((b.x - a.x) / 2 + a.x);
27855 // horizontal edge ymid
27856 if (directions === 'v:v') {
27857 ymid = Math.round((b.y - a.y) / 2 + a.y);
27868 'unknown directions: <' + directions + '>: ' +
27869 'directions must be specified as {a direction}:{b direction} (direction in h|v)');
27875 * Create a connection between the two points according to the manhattan layout
27876 * (only horizontal and vertical) edges.
27884 * [directions='h:h'] specifies manhattan directions for each point
27885 * as {adirection}:{bdirection}. A directionfor a point is either `h`
27886 * (horizontal) or `v` (vertical)
27888 * @return {Array<Point>}
27890 module.exports.connectPoints = function(a, b, directions) {
27894 if (!LayoutUtil.pointsAligned(a, b)) {
27895 points = this.getMidPoints(a, b, directions);
27906 * Connect two rectangles using a manhattan layouted connection.
27909 * source source rectangle
27911 * target target rectangle
27913 * [start] source docking
27915 * [end] target docking
27917 * @return {Array<Point>} connection points
27919 module.exports.connectRectangles = function(source, target, start, end, options) {
27921 options = options || {};
27923 var orientation = LayoutUtil.getOrientation(source, target, MIN_DISTANCE);
27925 var directions = this.getDirections(source, target, options.preferVertical);
27927 start = start || LayoutUtil.getMidPoint(source);
27928 end = end || LayoutUtil.getMidPoint(target);
27930 // overlapping elements
27935 if (directions === 'h:h') {
27937 switch (orientation) {
27940 case 'bottom-right':
27948 x: target.x + target.width,
27954 case 'bottom-left':
27957 x: source.x + source.width,
27969 if (directions === 'v:v') {
27971 switch (orientation) {
27978 y: source.y + source.height
27986 case 'bottom-left':
27988 case 'bottom-right':
27997 y: target.y + target.height
28003 return this.connectPoints(start, end, directions);
28007 * Repair the connection between two rectangles, of which one has been updated.
28018 * <Point>} waypoints
28022 * hints.preferStraight
28024 * hints.preferVertical
28026 * hints.startChanged
28030 * @return {Array<Point>} repaired waypoints
28032 module.exports.repairConnection = function(source, target, start, end, waypoints, hints) {
28034 if (isArray(start)) {
28038 start = LayoutUtil.getMidPoint(source);
28039 end = LayoutUtil.getMidPoint(target);
28042 hints = hints || {};
28045 var repairedWaypoints;
28047 // just layout non-existing or simple connections
28048 // attempt to render straight lines, if required
28049 if (!waypoints || waypoints.length < 3) {
28051 if (hints.preferStraight) {
28052 // attempt to layout a straight line
28053 repairedWaypoints = this.layoutStraight(source, target, start, end, hints);
28056 // check if we layout from start or end
28057 if (hints.endChanged) {
28058 repairedWaypoints = this._repairConnectionSide(target, source, end, waypoints.slice().reverse());
28059 repairedWaypoints = repairedWaypoints && repairedWaypoints.reverse();
28061 if (hints.startChanged) {
28062 repairedWaypoints = this._repairConnectionSide(source, target, start, waypoints);
28064 // or whether nothing seems to have changed
28066 repairedWaypoints = waypoints;
28070 // simply reconnect if nothing else worked
28071 if (!repairedWaypoints) {
28072 return this.connectRectangles(source, target, start, end, hints);
28075 return repairedWaypoints;
28078 function max(a, b) {
28079 return Math.max(a, b);
28082 function min(a, b) {
28083 return Math.min(a, b);
28086 function inRange(a, start, end) {
28087 return a >= start && a <= end;
28090 module.exports.layoutStraight = function(source, target, start, end, hints) {
28092 var startX, endX, x,
28095 startX = max(source.x + 10, target.x + 10);
28096 endX = min(source.x + source.width - 10, target.x + target.width - 10);
28098 if (startX < endX) {
28100 if (source.width === target.width) {
28102 if (hints.endChanged && inRange(end.x, startX, endX)) {
28105 if (inRange(start.x, startX, endX)) {
28110 if (x === undefined) {
28111 if (source.width < target.width && inRange(start.x, startX, endX)) {
28114 if (source.width > target.width && inRange(end.x, startX, endX)) {
28117 x = (startX + endX) / 2;
28122 startY = max(source.y + 10, target.y + 10);
28123 endY = min(source.y + source.height - 10, target.y + target.height - 10);
28125 if (startY < endY) {
28127 if (source.height === target.height) {
28128 if (hints.endChanged && inRange(end.y, startY, endY)) {
28131 if (inRange(start.y, startY, endY)) {
28136 if (y === undefined) {
28137 if (source.height <= target.height && inRange(start.y, startY, endY)) {
28140 if (target.height <= source.height && inRange(end.y, startY, endY)) {
28143 y = (startY + endY) / 2;
28148 // cannot layout straight
28149 if (x === undefined && y === undefined) {
28154 x: x !== undefined ? x : start.x,
28155 y: y !== undefined ? y : start.y
28157 x: x !== undefined ? x : end.x,
28158 y: y !== undefined ? y : end.y
28164 * Repair a connection from one side that moved.
28173 * <Point>} points originalPoints from moved to other
28175 * @return {Array<Point>} the repaired points between the two rectangles
28177 module.exports._repairConnectionSide = function(moved, other, newDocking, points) {
28179 function needsRelayout(moved, other, points) {
28181 if (points.length < 3) {
28185 if (points.length > 4) {
28189 // relayout if two points overlap
28190 // this is most likely due to
28191 return !!find(points, function(p, idx) {
28192 var q = points[idx - 1];
28194 return q && Geometry.distance(p, q) < 3;
28198 function repairBendpoint(candidate, oldPeer, newPeer) {
28200 var alignment = LayoutUtil.pointsAligned(oldPeer, candidate);
28202 switch (alignment) {
28204 // repair vertical alignment
28210 // repair horizontal alignment
28223 function removeOverlapping(points, a, b) {
28226 for (i = points.length - 2; i !== 0; i--) {
28228 // intersects (?) break, remove all bendpoints up to this one and
28230 if (Geometry.pointInRect(points[i], a, MIN_DISTANCE) ||
28231 Geometry.pointInRect(points[i], b, MIN_DISTANCE)) {
28233 // return sliced old connection
28234 return points.slice(i);
28242 // (0) only repair what has layoutable bendpoints
28244 // (1) if only one bendpoint and on shape moved onto other shapes axis
28245 // (horizontally / vertically), relayout
28247 if (needsRelayout(moved, other, points)) {
28251 var oldDocking = points[0],
28252 newPoints = points.slice(),
28255 // (2) repair only last line segment and only if it was layouted before
28257 newPoints[0] = newDocking;
28258 newPoints[1] = repairBendpoint(newPoints[1], oldDocking, newDocking);
28261 // (3) if shape intersects with any bendpoint after repair,
28262 // remove all segments up to this bendpoint and repair from there
28264 slicedPoints = removeOverlapping(newPoints, moved, other);
28265 if (slicedPoints !== newPoints) {
28266 return this._repairConnectionSide(moved, other, newDocking, slicedPoints);
28273 * Returns the default manhattan directions connecting two rectangles.
28284 module.exports.getDirections = function(source, target, preferVertical) {
28285 var orientation = LayoutUtil.getOrientation(source, target, MIN_DISTANCE);
28287 switch (orientation) {
28300 return preferVertical ? 'v:v' : 'h:h';
28304 "../util/Geometry": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js",
28305 "./LayoutUtil": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\layout\\LayoutUtil.js",
28306 "lodash/collection/find": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js",
28307 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
28309 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\model\\index.js": [function(require, module, exports) {
28312 var assign = require('lodash/object/assign'),
28313 inherits = require('inherits');
28315 var Refs = require('object-refs');
28317 var parentRefs = new Refs({
28324 labelRefs = new Refs({
28328 name: 'labelTarget'
28330 outgoingRefs = new Refs({
28336 incomingRefs = new Refs({
28344 * @namespace djs.model
28348 * @memberOf djs.model
28352 * The basic graphical representation
28361 * The object that backs up the shape
28363 * @name Base#businessObject
28366 Object.defineProperty(this, 'businessObject', {
28373 * @name Base#parent
28376 parentRefs.bind(this, 'parent');
28382 labelRefs.bind(this, 'label');
28385 * The list of outgoing connections
28387 * @name Base#outgoing
28388 * @type Array<Connection>
28390 outgoingRefs.bind(this, 'outgoing');
28393 * The list of outgoing connections
28395 * @name Base#incoming
28396 * @type Array<Connection>
28398 incomingRefs.bind(this, 'incoming');
28403 * A graphical object
28414 * The list of children
28416 * @name Shape#children
28417 * @type Array<Base>
28419 parentRefs.bind(this, 'children');
28422 inherits(Shape, Base);
28426 * A root graphical object
28437 inherits(Root, Shape);
28441 * A label for an element
28452 * The labeled element
28454 * @name Label#labelTarget
28457 labelRefs.bind(this, 'labelTarget');
28460 inherits(Label, Shape);
28464 * A connection between two elements
28471 function Connection() {
28475 * The element this connection originates from
28477 * @name Connection#source
28480 outgoingRefs.bind(this, 'source');
28483 * The element this connection points to
28485 * @name Connection#target
28488 incomingRefs.bind(this, 'target');
28491 inherits(Connection, Base);
28495 connection: Connection,
28502 * Creates a new model element of the specified type
28508 * var shape1 = Model.create('shape', { x: 10, y: 10, width: 100, height: 100
28509 * }); var shape2 = Model.create('shape', { x: 210, y: 210, width: 100, height:
28512 * var connection = Model.create('connection', { waypoints: [ { x: 110, y: 55 },
28513 * {x: 210, y: 55 } ] });
28516 * type lower-cased model name
28518 * attrs attributes to initialize the new model instance with
28520 * @return {Base} the new model instance
28522 module.exports.create = function(type, attrs) {
28523 var Type = types[type];
28525 throw new Error('unknown type: <' + type + '>');
28527 return assign(new Type(), attrs);
28531 module.exports.Base = Base;
28532 module.exports.Root = Root;
28533 module.exports.Shape = Shape;
28534 module.exports.Connection = Connection;
28535 module.exports.Label = Label;
28537 "inherits": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js",
28538 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
28539 "object-refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\index.js"
28541 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\movecanvas\\MoveCanvas.js": [function(require, module, exports) {
28544 var Cursor = require('../../util/Cursor'),
28545 ClickTrap = require('../../util/ClickTrap'),
28546 domEvent = require('min-dom/lib/event'),
28547 Event = require('../../util/Event');
28549 function substract(p1, p2) {
28556 function length(point) {
28557 return Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2));
28561 var THRESHOLD = 15;
28564 function MoveCanvas(eventBus, canvas) {
28566 var container = canvas._container,
28570 function handleMove(event) {
28572 var start = context.start,
28573 position = Event.toPoint(event),
28574 delta = substract(position, start);
28576 if (!context.dragging && length(delta) > THRESHOLD) {
28577 context.dragging = true;
28579 // prevent mouse click in this
28580 // interaction sequence
28581 ClickTrap.install();
28583 Cursor.set('move');
28586 if (context.dragging) {
28588 var lastPosition = context.last || context.start;
28590 delta = substract(position, lastPosition);
28597 context.last = position;
28601 event.preventDefault();
28605 function handleEnd(event) {
28606 domEvent.unbind(document, 'mousemove', handleMove);
28607 domEvent.unbind(document, 'mouseup', handleEnd);
28614 Event.stopEvent(event);
28617 function handleStart(event) {
28619 // reject non-left left mouse button or modifier key
28620 if (event.button || event.ctrlKey || event.shiftKey || event.altKey) {
28625 start: Event.toPoint(event)
28628 domEvent.bind(document, 'mousemove', handleMove);
28629 domEvent.bind(document, 'mouseup', handleEnd);
28632 Event.stopEvent(event);
28635 domEvent.bind(container, 'mousedown', handleStart);
28639 MoveCanvas.$inject = ['eventBus', 'canvas'];
28641 module.exports = MoveCanvas;
28644 "../../util/ClickTrap": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\ClickTrap.js",
28645 "../../util/Cursor": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js",
28646 "../../util/Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
28647 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
28649 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\movecanvas\\index.js": [function(require, module, exports) {
28651 __init__: ['moveCanvas'],
28652 moveCanvas: ['type', require('./MoveCanvas')]
28655 "./MoveCanvas": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\movecanvas\\MoveCanvas.js"
28657 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\touch\\index.js": [function(require, module, exports) {
28659 __depends__: [require('../../features/touch')]
28662 "../../features/touch": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\features\\touch\\index.js"
28664 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\zoomscroll\\ZoomScroll.js": [function(require, module, exports) {
28667 var domEvent = require('min-dom/lib/event');
28669 var hasPrimaryModifier = require('../../util/Mouse').hasPrimaryModifier,
28670 hasSecondaryModifier = require('../../util/Mouse').hasSecondaryModifier;
28672 var isMac = require('../../util/Platform').isMac;
28675 function ZoomScroll(events, canvas) {
28676 var $canvas = $(canvas.getContainer()), //canvas.getContainer()
28677 $controls = $('<div></div>'),
28678 $zoomOut = $('<div><span class="glyphicon glyphicon-zoom-out"></span></div>'),
28679 $zoomIn = $('<div><span class="glyphicon glyphicon-zoom-in"></span></div>'),
28680 $zoomFit = $('<div><span class="glyphicon glyphicon-fullscreen"></span></div>'),
28684 $canvas.append($controls);
28685 $controls.append($zoomIn);
28686 $controls.append($zoomOut);
28687 $controls.append($zoomFit);
28689 $controls.addClass('zoom-controls');
28690 $zoomOut.addClass('zoom zoom-out');
28691 $zoomIn.addClass('zoom zoom-in');
28692 $zoomFit.addClass('zoom zoom-fit');
28694 $zoomOut.attr('title', 'Zoom out');
28695 $zoomIn.attr('title', 'Zoom in');
28696 $zoomFit.attr('title', 'Fit to viewport');
28698 // set initial zoom level
28699 //canvas.zoom( zlevel, 'auto' );
28701 // update our zoom level on viewbox change
28702 events.on('canvas.viewbox.changed', function(evt) {
28703 zlevel = evt.viewbox.scale;
28706 // define click handlers for controls
28707 $zoomFit.on('click', function() {
28708 canvas.zoom('fit-viewport', 'auto');
28711 $zoomOut.on('click', function() {
28712 zlevel = Math.max(zlevel - zstep, zstep);
28713 canvas.zoom(zlevel, 'auto');
28716 $zoomIn.on('click', function() {
28717 zlevel = Math.min(zlevel + zstep, 7);
28718 canvas.zoom(zlevel, 'auto');
28721 $(".TCS").click(function() {
28722 console.log($(this).data("stuff"));
28723 var modelElements = $(this).data("stuff").modelElements;
28724 var modelName = $(this).data("model").name;
28725 var hElements = [];
28726 modelElements.forEach(function(mElement) {
28727 if (hElements.indexOf(mElement.elementID) == -1) {
28728 hElements.push(mElement.elementID);
28731 highlightPath(hElements);
28734 function highlightPath(hElements) {
28736 var elementRegistry = canvas._elementRegistry;
28737 //console.log(elementRegistry);
28738 hElements.forEach(function(hElement) {
28740 //console.log(hElement);
28741 var activityShape = elementRegistry.get(hElement);
28742 var outgoing = activityShape.incoming;
28744 if (canvas.hasMarker(hElement, 'highlight')) {
28745 canvas.removeMarker(hElement, 'highlight');
28746 outgoing.forEach(function(flow) {
28747 var outgoingGfx = elementRegistry.getGraphics(flow.id);
28748 if (hElements.indexOf(flow.id) != -1) {
28749 outgoingGfx.select('path').attr({
28755 canvas.addMarker(hElement, 'highlight');
28756 outgoing.forEach(function(flow) {
28757 var outgoingGfx = elementRegistry.getGraphics(flow.id);
28758 if (hElements.indexOf(flow.id) != -1) {
28759 outgoingGfx.select('path').attr({
28766 //console.log(err);
28773 var elementRegistry = canvas._elementRegistry;
28774 elementRegistry.forEach(function(hElement) {
28776 canvas.removeMarker(hElement, 'highlight');
28777 var outgoing = hElement.incoming;
28778 outgoing.forEach(function(flow) {
28779 var outgoingGfx = elementRegistry.getGraphics(flow.id);
28780 outgoingGfx.select('path').attr({
28790 //console.log('endzoom');
28798 function cap(scale) {
28799 return Math.max(RANGE.min, Math.min(RANGE.max, scale));
28803 canvas.zoom('fit-viewport');
28806 function zoom(direction, position) {
28808 var currentZoom = canvas.zoom();
28809 var factor = Math.pow(1 + Math.abs(direction), direction > 0 ? 1 : -1);
28811 canvas.zoom(cap(currentZoom * factor), position);
28814 function scroll(delta) {
28815 canvas.scroll(delta);
28818 function init(element) {
28820 domEvent.bind(element, 'wheel', function(event) {
28823 event.preventDefault();
28825 // mouse-event: SELECTION_KEY
28826 // mouse-event: AND_KEY
28827 var isVerticalScroll = hasPrimaryModifier(event),
28828 isHorizontalScroll = hasSecondaryModifier(event);
28832 if (isVerticalScroll || isHorizontalScroll) {
28835 factor = event.deltaMode === 0 ? 1.25 : 50;
28837 factor = event.deltaMode === 0 ? 1 / 40 : 1 / 2;
28842 if (isHorizontalScroll) {
28843 delta.dx = (factor * (event.deltaX || event.deltaY));
28845 delta.dy = (factor * event.deltaY);
28850 factor = (event.deltaMode === 0 ? 1 / 40 : 1 / 2);
28852 var elementRect = element.getBoundingClientRect();
28855 x: event.clientX - elementRect.left,
28856 y: event.clientY - elementRect.top
28859 // zoom in relative to diagram {x,y} coordinates
28860 zoom(event.deltaY * factor / (-5), offset);
28866 events.on('canvas.init', function(e) {
28867 init(canvas._container);
28872 this.reset = reset;
28876 ZoomScroll.$inject = ['eventBus', 'canvas'];
28878 module.exports = ZoomScroll;
28882 "../../util/Mouse": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js",
28883 "../../util/Platform": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Platform.js",
28884 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
28886 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\zoomscroll\\index.js": [function(require, module, exports) {
28888 __init__: ['zoomScroll'],
28889 zoomScroll: ['type', require('./ZoomScroll')]
28892 "./ZoomScroll": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\navigation\\zoomscroll\\ZoomScroll.js"
28894 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\ClickTrap.js": [function(require, module, exports) {
28897 var domEvent = require('min-dom/lib/event'),
28898 stopEvent = require('./Event').stopEvent;
28900 function trap(event) {
28906 function toggle(active) {
28907 domEvent[active ? 'bind' : 'unbind'](document.body, 'click', trap, true);
28911 * Installs a click trap that prevents a ghost click following a dragging
28914 * @return {Function} a function to immediately remove the installed trap.
28916 function install() {
28920 return function() {
28925 module.exports.install = install;
28927 "./Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
28928 "min-dom/lib/event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js"
28930 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Collections.js": [function(require, module, exports) {
28934 * Failsafe remove an element from a collection
28937 * <Object>} [collection]
28941 * @return {Object} the element that got removed or undefined
28943 module.exports.remove = function(collection, element) {
28945 if (!collection || !element) {
28949 var idx = collection.indexOf(element);
28954 collection.splice(idx, 1);
28960 * Fail save add an element to the given connection, ensuring it does not yet
28964 * <Object>} collection
28970 module.exports.add = function(collection, element, idx) {
28972 if (!collection || !element) {
28980 var currentIdx = collection.indexOf(element);
28982 if (currentIdx !== -1) {
28984 if (currentIdx === idx) {
28985 // nothing to do, position has not changed
28990 // remove from current position
28991 collection.splice(currentIdx, 1);
28993 // already exists in collection
29000 // insert at specified position
29001 collection.splice(idx, 0, element);
29004 collection.push(element);
29010 * Fail get the index of an element in a collection.
29013 * <Object>} collection
29017 * @return {Number} the index or -1 if collection or element do not exist or the
29018 * element is not contained.
29020 module.exports.indexOf = function(collection, element) {
29022 if (!collection || !element) {
29026 return collection.indexOf(element);
29030 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Cursor.js": [function(require, module, exports) {
29033 var domClasses = require('min-dom/lib/classes');
29035 var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
29038 module.exports.set = function(mode) {
29039 var classes = domClasses(document.body);
29041 classes.removeMatching(CURSOR_CLS_PATTERN);
29044 classes.add('djs-cursor-' + mode);
29048 module.exports.unset = function() {
29052 "min-dom/lib/classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js"
29054 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Elements.js": [function(require, module, exports) {
29057 var isArray = require('lodash/lang/isArray'),
29058 isNumber = require('lodash/lang/isNumber'),
29059 groupBy = require('lodash/collection/groupBy'),
29060 forEach = require('lodash/collection/forEach');
29063 * Adds an element to a collection and returns true if the element was added.
29066 * <Object>} elements
29072 function add(elements, e, unique) {
29073 var canAdd = !unique || elements.indexOf(e) === -1;
29082 function eachElement(elements, fn, depth) {
29084 depth = depth || 0;
29086 forEach(elements, function(s, i) {
29087 var filter = fn(s, i, depth);
29089 if (isArray(filter) && filter.length) {
29090 eachElement(filter, fn, depth + 1);
29096 * Collects self + child elements up to a given depth from a list of elements.
29099 * <djs.model.Base>} elements the elements to select the children
29102 * unique whether to return a unique result set (no duplicates)
29104 * maxDepth the depth to search through or -1 for infinite
29106 * @return {Array<djs.model.Base>} found elements
29108 function selfAndChildren(elements, unique, maxDepth) {
29110 processedChildren = [];
29112 eachElement(elements, function(element, i, depth) {
29113 add(result, element, unique);
29115 var children = element.children;
29117 // max traversal depth not reached yet
29118 if (maxDepth === -1 || depth < maxDepth) {
29120 // children exist && children not yet processed
29121 if (children && add(processedChildren, children, unique)) {
29131 * Return self + direct children for a number of elements
29134 * <djs.model.Base>} elements to query
29136 * allowDuplicates to allow duplicates in the result set
29138 * @return {Array<djs.model.Base>} the collected elements
29140 function selfAndDirectChildren(elements, allowDuplicates) {
29141 return selfAndChildren(elements, !allowDuplicates, 1);
29145 * Return self + ALL children for a number of elements
29148 * <djs.model.Base>} elements to query
29150 * allowDuplicates to allow duplicates in the result set
29152 * @return {Array<djs.model.Base>} the collected elements
29154 function selfAndAllChildren(elements, allowDuplicates) {
29155 return selfAndChildren(elements, !allowDuplicates, -1);
29159 * Gets the the closure fo all selected elements, their connections and
29162 * <djs.model.Base>} elements
29163 * @return {Object} enclosure
29165 function getClosure(elements) {
29167 // original elements passed to this function
29168 var topLevel = groupBy(elements, function(e) {
29172 var allShapes = {},
29173 allConnections = {},
29174 enclosedElements = {},
29175 enclosedConnections = {};
29177 function handleConnection(c) {
29178 if (topLevel[c.source.id] && topLevel[c.target.id]) {
29179 topLevel[c.id] = c;
29182 // not enclosed as a child, but maybe logically
29183 // (connecting two moved elements?)
29184 if (allShapes[c.source.id] && allShapes[c.target.id]) {
29185 enclosedConnections[c.id] = enclosedElements[c.id] = c;
29188 allConnections[c.id] = c;
29191 function handleElement(element) {
29193 enclosedElements[element.id] = element;
29195 if (element.waypoints) {
29196 // remember connection
29197 enclosedConnections[element.id] = allConnections[element.id] = element;
29200 allShapes[element.id] = element;
29202 // remember all connections
29203 forEach(element.incoming, handleConnection);
29205 forEach(element.outgoing, handleConnection);
29207 // recurse into children
29208 return element.children;
29212 eachElement(elements, handleElement);
29215 allShapes: allShapes,
29216 allConnections: allConnections,
29217 topLevel: topLevel,
29218 enclosedConnections: enclosedConnections,
29219 enclosedElements: enclosedElements
29224 * Returns the surrounding bbox for all elements in the array or the element
29227 function getBBox(elements, stopRecursion) {
29229 stopRecursion = !!stopRecursion;
29230 if (!isArray(elements)) {
29231 elements = [elements];
29239 forEach(elements, function(element) {
29241 // If element is a connection the bbox must be computed first
29242 var bbox = element;
29243 if (element.waypoints && !stopRecursion) {
29244 bbox = getBBox(element.waypoints, true);
29249 height = bbox.height || 0,
29250 width = bbox.width || 0;
29252 if (x < minX || minX === undefined) {
29255 if (y < minY || minY === undefined) {
29259 if ((x + width) > maxX || maxX === undefined) {
29262 if ((y + height) > maxY || maxY === undefined) {
29270 height: maxY - minY,
29277 * Returns all elements that are enclosed from the bounding box.
29280 * <Object>} elements List of Elements to search through
29282 * bbox the enclosing bbox.
29284 * <li>If bbox.(width|height) is not specified the method returns
29285 * all elements with element.x/y > bbox.x/y </li>
29286 * <li>If only bbox.x or bbox.y is specified, method return all
29287 * elements with e.x > bbox.x or e.y > bbox.y.</li>
29291 function getEnclosedElements(elements, bbox) {
29293 var filteredElements = {};
29295 forEach(elements, function(element) {
29303 if (!isNumber(bbox.y) && (e.x > bbox.x)) {
29304 filteredElements[element.id] = element;
29306 if (!isNumber(bbox.x) && (e.y > bbox.y)) {
29307 filteredElements[element.id] = element;
29309 if (e.x > bbox.x && e.y > bbox.y) {
29310 if (isNumber(bbox.width) && isNumber(bbox.height) &&
29311 e.width + e.x < bbox.width + bbox.x &&
29312 e.height + e.y < bbox.height + bbox.y) {
29314 filteredElements[element.id] = element;
29315 } else if (!isNumber(bbox.width) || !isNumber(bbox.height)) {
29316 filteredElements[element.id] = element;
29321 return filteredElements;
29326 module.exports.eachElement = eachElement;
29327 module.exports.selfAndDirectChildren = selfAndDirectChildren;
29328 module.exports.selfAndAllChildren = selfAndAllChildren;
29329 module.exports.getBBox = getBBox;
29330 module.exports.getEnclosedElements = getEnclosedElements;
29332 module.exports.getClosure = getClosure;
29335 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
29336 "lodash/collection/groupBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js",
29337 "lodash/lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
29338 "lodash/lang/isNumber": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js"
29340 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js": [function(require, module, exports) {
29343 function __preventDefault(event) {
29344 return event && event.preventDefault();
29347 function __stopPropagation(event, immediate) {
29352 if (event.stopPropagation) {
29353 event.stopPropagation();
29356 if (immediate && event.stopImmediatePropagation) {
29357 event.stopImmediatePropagation();
29362 function getOriginal(event) {
29363 return event.originalEvent || event.srcEvent;
29366 module.exports.getOriginal = getOriginal;
29369 function stopEvent(event, immediate) {
29370 stopPropagation(event, immediate);
29371 preventDefault(event);
29374 module.exports.stopEvent = stopEvent;
29377 function preventDefault(event) {
29378 __preventDefault(event);
29379 __preventDefault(getOriginal(event));
29382 module.exports.preventDefault = preventDefault;
29385 function stopPropagation(event, immediate) {
29386 __stopPropagation(event, immediate);
29387 __stopPropagation(getOriginal(event), immediate);
29390 module.exports.stopPropagation = stopPropagation;
29393 function toPoint(event) {
29395 if (event.pointers && event.pointers.length) {
29396 event = event.pointers[0];
29399 if (event.touches && event.touches.length) {
29400 event = event.touches[0];
29409 module.exports.toPoint = toPoint;
29412 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Geometry.js": [function(require, module, exports) {
29416 * Computes the distance between two points
29423 * @return {Number} distance
29425 var distance = module.exports.distance = function(p, q) {
29426 return Math.sqrt(Math.pow(q.x - p.x, 2) + Math.pow(q.y - p.y, 2));
29430 * Returns true if the point r is on the line between p and y
29439 * @return {Boolean}
29441 module.exports.pointsOnLine = function(p, q, r) {
29443 if (!p || !q || !r) {
29447 var val = (q.x - p.x) * (r.y - p.y) - (q.y - p.y) * (r.x - p.x),
29448 dist = distance(p, q);
29450 // @see http://stackoverflow.com/a/907491/412190
29451 return Math.abs(val / dist) < 5;
29454 module.exports.pointInRect = function(p, rect, tolerance) {
29455 tolerance = tolerance || 0;
29457 return p.x > rect.x - tolerance &&
29458 p.y > rect.y - tolerance &&
29459 p.x < rect.x + rect.width + tolerance &&
29460 p.y < rect.y + rect.height + tolerance;
29463 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\GraphicsUtil.js": [function(require, module, exports) {
29467 * SVGs for elements are generated by the {@link GraphicsFactory}.
29469 * This utility gives quick access to the important semantic parts of an
29474 * Returns the visual part of a diagram element
29477 * <SVGElement>} gfx
29479 * @return {Snap<SVGElement>}
29481 function getVisual(gfx) {
29482 return gfx.select('.djs-visual');
29486 * Returns the children for a given diagram element.
29489 * <SVGElement>} gfx
29490 * @return {Snap<SVGElement>}
29492 function getChildren(gfx) {
29493 return gfx.parent().children()[1];
29497 * Returns the visual bbox of an element
29500 * <SVGElement>} gfx
29504 function getBBox(gfx) {
29505 return getVisual(gfx).select('*').getBBox();
29509 module.exports.getVisual = getVisual;
29510 module.exports.getChildren = getChildren;
29511 module.exports.getBBox = getBBox;
29513 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\IdGenerator.js": [function(require, module, exports) {
29517 * Util that provides unique IDs.
29519 * @class djs.util.IdGenerator
29521 * @memberOf djs.util
29523 * The ids can be customized via a given prefix and contain a random value to
29524 * avoid collisions.
29527 * prefix a prefix to prepend to generated ids (for better
29530 function IdGenerator(prefix) {
29533 this._prefix = (prefix ? prefix + '-' : '') + Math.floor(Math.random() * 1000000000) + '-';
29536 module.exports = IdGenerator;
29539 * Returns a next unique ID.
29541 * @method djs.util.IdGenerator#next
29543 * @returns {String} the id
29545 IdGenerator.prototype.next = function() {
29546 return this._prefix + (++this._counter);
29550 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Mouse.js": [function(require, module, exports) {
29553 var getOriginalEvent = require('./Event').getOriginal;
29555 var isMac = require('./Platform').isMac;
29558 function isPrimaryButton(event) {
29559 // button === 0 -> left áka primary mouse button
29560 return !(getOriginalEvent(event) || event).button;
29563 module.exports.isPrimaryButton = isPrimaryButton;
29565 module.exports.isMac = isMac;
29567 module.exports.hasPrimaryModifier = function(event) {
29568 var originalEvent = getOriginalEvent(event) || event;
29570 if (!isPrimaryButton(event)) {
29574 // Use alt as primary modifier key for mac OS
29576 return originalEvent.altKey;
29578 return originalEvent.ctrlKey;
29583 module.exports.hasSecondaryModifier = function(event) {
29584 var originalEvent = getOriginalEvent(event) || event;
29586 return isPrimaryButton(event) && originalEvent.shiftKey;
29590 "./Event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Event.js",
29591 "./Platform": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Platform.js"
29593 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Platform.js": [function(require, module, exports) {
29596 module.exports.isMac = function isMac() {
29597 return (/mac/i).test(navigator.platform);
29600 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\lib\\util\\Text.js": [function(require, module, exports) {
29603 var isObject = require('lodash/lang/isObject'),
29604 assign = require('lodash/object/assign'),
29605 forEach = require('lodash/collection/forEach'),
29606 reduce = require('lodash/collection/reduce'),
29607 merge = require('lodash/object/merge');
29609 var Snap = require('../../vendor/snapsvg');
29611 var DEFAULT_BOX_PADDING = 0;
29613 var DEFAULT_LABEL_SIZE = {
29619 function parseAlign(align) {
29621 var parts = align.split('-');
29624 horizontal: parts[0] || 'center',
29625 vertical: parts[1] || 'top'
29629 function parsePadding(padding) {
29631 if (isObject(padding)) {
29648 function getTextBBox(text, fakeText) {
29649 fakeText.textContent = text;
29650 return fakeText.getBBox();
29655 * Layout the next line and return the layouted element.
29657 * Alters the lines passed.
29661 * @return {Object} the line descriptor, an object { width, height, text }
29663 function layoutNext(lines, maxWidth, fakeText) {
29665 var originalLine = lines.shift(),
29666 fitLine = originalLine;
29671 textBBox = getTextBBox(fitLine, fakeText);
29673 textBBox.width = fitLine ? textBBox.width : 0;
29676 if (fitLine === ' ' || fitLine === '' || textBBox.width < Math.round(maxWidth) || fitLine.length < 4) {
29677 return fit(lines, fitLine, originalLine, textBBox);
29681 fitLine = shortenLine(fitLine, textBBox.width, maxWidth);
29685 function fit(lines, fitLine, originalLine, textBBox) {
29686 if (fitLine.length < originalLine.length) {
29687 var nextLine = lines[0] || '',
29688 remainder = originalLine.slice(fitLine.length).trim();
29690 if (/-\s*$/.test(remainder)) {
29691 nextLine = remainder.replace(/-\s*$/, '') + nextLine.replace(/^\s+/, '');
29693 nextLine = remainder + ' ' + nextLine;
29696 lines[0] = nextLine;
29699 width: textBBox.width,
29700 height: textBBox.height,
29707 * Shortens a line based on spacing and hyphens. Returns the shortened result on
29713 * maxLength the maximum characters of the string
29714 * @return {String} the shortened string
29716 function semanticShorten(line, maxLength) {
29717 var parts = line.split(/(\s|-)/g),
29719 shortenedParts = [],
29722 // try to shorten via spaces + hyphens
29723 if (parts.length > 1) {
29724 while ((part = parts.shift())) {
29725 if (part.length + length < maxLength) {
29726 shortenedParts.push(part);
29727 length += part.length;
29729 // remove previous part, too if hyphen does not fit anymore
29730 if (part === '-') {
29731 shortenedParts.pop();
29739 return shortenedParts.join('');
29743 function shortenLine(line, width, maxWidth) {
29744 var length = Math.max(line.length * (maxWidth / width), 1);
29746 // try to shorten semantically (i.e. based on spaces and hyphens)
29747 var shortenedLine = semanticShorten(line, length);
29749 if (!shortenedLine) {
29751 // force shorten by cutting the long word
29752 shortenedLine = line.slice(0, Math.max(Math.round(length - 1), 1));
29755 return shortenedLine;
29760 * Creates a new label utility
29764 * @param {Dimensions}
29773 function Text(config) {
29775 this._config = assign({}, {
29776 size: DEFAULT_LABEL_SIZE,
29777 padding: DEFAULT_BOX_PADDING,
29779 align: 'center-top'
29785 * Create a label in the parent node.
29787 * @method Text#createText
29789 * @param {SVGElement}
29790 * parent the parent to draw the label on
29792 * text the text to render on the label
29796 * options.align how to align in the bounding box. Any of {
29797 * 'center-middle', 'center-top' }, defaults to 'center-top'.
29799 * options.style style to be applied to the text
29801 * @return {SVGText} the text element created
29803 Text.prototype.createText = function(parent, text, options) {
29805 var box = merge({}, this._config.size, options.box || {}),
29806 style = merge({}, this._config.style, options.style || {}),
29807 align = parseAlign(options.align || this._config.align),
29808 padding = parsePadding(options.padding !== undefined ? options.padding : this._config.padding);
29810 var lines = text.split(/\r?\n/g),
29813 var maxWidth = box.width - padding.left - padding.right;
29815 // FF regression: ensure text is shown during rendering
29816 // by attaching it directly to the body
29817 var fakeText = parent.paper.text(0, 0, '').attr(style).node;
29819 while (lines.length) {
29820 layouted.push(layoutNext(lines, maxWidth, fakeText));
29823 var totalHeight = reduce(layouted, function(sum, line, idx) {
29824 return sum + line.height;
29827 // the y position of the next line
29830 switch (align.vertical) {
29832 y = (box.height - totalHeight) / 2 - layouted[0].height / 4;
29839 var textElement = parent.text().attr(style);
29841 forEach(layouted, function(line) {
29844 switch (align.horizontal) {
29850 x = (maxWidth - padding.right - line.width);
29855 x = Math.max(((maxWidth - line.width) / 2 + padding.left), 0);
29859 var tspan = Snap.create('tspan', {
29863 tspan.textContent = line.text;
29865 textElement.append(tspan);
29868 // remove fake text
29869 fakeText.parentNode.removeChild(fakeText);
29871 return textElement;
29875 module.exports = Text;
29877 "../../vendor/snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js",
29878 "lodash/collection/forEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js",
29879 "lodash/collection/reduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js",
29880 "lodash/lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
29881 "lodash/object/assign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js",
29882 "lodash/object/merge": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\merge.js"
29884 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\annotation.js": [function(require, module, exports) {
29886 var isArray = function(obj) {
29887 return Object.prototype.toString.call(obj) === '[object Array]';
29890 var annotate = function() {
29891 var args = Array.prototype.slice.call(arguments);
29893 if (args.length === 1 && isArray(args[0])) {
29897 var fn = args.pop();
29905 // Current limitations:
29906 // - can't put into "function arg" comments
29907 // function /* (no parenthesis like this) */ (){}
29908 // function abc( /* xx (no parenthesis like this) */ a, b) {}
29910 // Just put the comment before function or inside:
29911 // /* (((this is fine))) */ function(a, b) {}
29912 // function abc(a) { /* (((this is fine))) */}
29914 var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
29915 var FN_ARG = /\/\*([^\*]*)\*\//m;
29917 var parse = function(fn) {
29918 if (typeof fn !== 'function') {
29919 throw new Error('Cannot annotate "' + fn + '". Expected a function!');
29922 var match = fn.toString().match(FN_ARGS);
29923 return match[1] && match[1].split(',').map(function(arg) {
29924 match = arg.match(FN_ARG);
29925 return match ? match[1].trim() : arg.trim();
29930 exports.annotate = annotate;
29931 exports.parse = parse;
29932 exports.isArray = isArray;
29935 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\index.js": [function(require, module, exports) {
29937 annotate: require('./annotation').annotate,
29938 Module: require('./module'),
29939 Injector: require('./injector')
29943 "./annotation": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\annotation.js",
29944 "./injector": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\injector.js",
29945 "./module": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\module.js"
29947 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\injector.js": [function(require, module, exports) {
29948 var Module = require('./module');
29949 var autoAnnotate = require('./annotation').parse;
29950 var annotate = require('./annotation').annotate;
29951 var isArray = require('./annotation').isArray;
29954 var Injector = function(modules, parent) {
29955 parent = parent || {
29956 get: function(name) {
29957 currentlyResolving.push(name);
29958 throw error('No provider for "' + name + '"!');
29962 var currentlyResolving = [];
29963 var providers = this._providers = Object.create(parent._providers || null);
29964 var instances = this._instances = Object.create(null);
29966 var self = instances.injector = this;
29968 var error = function(msg) {
29969 var stack = currentlyResolving.join(' -> ');
29970 currentlyResolving.length = 0;
29971 return new Error(stack ? msg + ' (Resolving: ' + stack + ')' : msg);
29974 var get = function(name) {
29975 if (!providers[name] && name.indexOf('.') !== -1) {
29976 var parts = name.split('.');
29977 var pivot = get(parts.shift());
29979 while (parts.length) {
29980 pivot = pivot[parts.shift()];
29986 if (Object.hasOwnProperty.call(instances, name)) {
29987 return instances[name];
29990 if (Object.hasOwnProperty.call(providers, name)) {
29991 if (currentlyResolving.indexOf(name) !== -1) {
29992 currentlyResolving.push(name);
29993 throw error('Cannot resolve circular dependency!');
29996 currentlyResolving.push(name);
29997 instances[name] = providers[name][0](providers[name][1]);
29998 currentlyResolving.pop();
30000 return instances[name];
30003 return parent.get(name);
30006 var instantiate = function(Type) {
30007 var instance = Object.create(Type.prototype);
30008 var returned = invoke(Type, instance);
30010 return typeof returned === 'object' ? returned : instance;
30013 var invoke = function(fn, context) {
30014 if (typeof fn !== 'function') {
30016 fn = annotate(fn.slice());
30018 throw new Error('Cannot invoke "' + fn + '". Expected a function!');
30022 var inject = fn.$inject && fn.$inject || autoAnnotate(fn);
30023 var dependencies = inject.map(function(dep) {
30027 // TODO(vojta): optimize without apply
30028 return fn.apply(context, dependencies);
30032 var createPrivateInjectorFactory = function(privateChildInjector) {
30033 return annotate(function(key) {
30034 return privateChildInjector.get(key);
30038 var createChild = function(modules, forceNewInstances) {
30039 if (forceNewInstances && forceNewInstances.length) {
30040 var fromParentModule = Object.create(null);
30041 var matchedScopes = Object.create(null);
30043 var privateInjectorsCache = [];
30044 var privateChildInjectors = [];
30045 var privateChildFactories = [];
30049 var privateChildInjector;
30050 var privateChildInjectorFactory;
30051 for (var name in providers) {
30052 provider = providers[name];
30054 if (forceNewInstances.indexOf(name) !== -1) {
30055 if (provider[2] === 'private') {
30056 cacheIdx = privateInjectorsCache.indexOf(provider[3]);
30057 if (cacheIdx === -1) {
30058 privateChildInjector = provider[3].createChild([], forceNewInstances);
30059 privateChildInjectorFactory = createPrivateInjectorFactory(privateChildInjector);
30060 privateInjectorsCache.push(provider[3]);
30061 privateChildInjectors.push(privateChildInjector);
30062 privateChildFactories.push(privateChildInjectorFactory);
30063 fromParentModule[name] = [privateChildInjectorFactory, name, 'private', privateChildInjector];
30065 fromParentModule[name] = [privateChildFactories[cacheIdx], name, 'private', privateChildInjectors[cacheIdx]];
30068 fromParentModule[name] = [provider[2], provider[1]];
30070 matchedScopes[name] = true;
30073 if ((provider[2] === 'factory' || provider[2] === 'type') && provider[1].$scope) {
30074 forceNewInstances.forEach(function(scope) {
30075 if (provider[1].$scope.indexOf(scope) !== -1) {
30076 fromParentModule[name] = [provider[2], provider[1]];
30077 matchedScopes[scope] = true;
30083 forceNewInstances.forEach(function(scope) {
30084 if (!matchedScopes[scope]) {
30085 throw new Error('No provider for "' + scope + '". Cannot use provider from the parent!');
30089 modules.unshift(fromParentModule);
30092 return new Injector(modules, self);
30098 value: function(value) {
30103 modules.forEach(function(module) {
30105 function arrayUnwrap(type, value) {
30106 if (type !== 'value' && isArray(value)) {
30107 value = annotate(value.slice());
30113 // TODO(vojta): handle wrong inputs (modules)
30114 if (module instanceof Module) {
30115 module.forEach(function(provider) {
30116 var name = provider[0];
30117 var type = provider[1];
30118 var value = provider[2];
30120 providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
30122 } else if (typeof module === 'object') {
30123 if (module.__exports__) {
30124 var clonedModule = Object.keys(module).reduce(function(m, key) {
30125 if (key.substring(0, 2) !== '__') {
30126 m[key] = module[key];
30129 }, Object.create(null));
30131 var privateInjector = new Injector((module.__modules__ || []).concat([clonedModule]), self);
30132 var getFromPrivateInjector = annotate(function(key) {
30133 return privateInjector.get(key);
30135 module.__exports__.forEach(function(key) {
30136 providers[key] = [getFromPrivateInjector, key, 'private', privateInjector];
30139 Object.keys(module).forEach(function(name) {
30140 if (module[name][2] === 'private') {
30141 providers[name] = module[name];
30145 var type = module[name][0];
30146 var value = module[name][1];
30148 providers[name] = [factoryMap[type], arrayUnwrap(type, value), type];
30156 this.invoke = invoke;
30157 this.instantiate = instantiate;
30158 this.createChild = createChild;
30161 module.exports = Injector;
30164 "./annotation": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\annotation.js",
30165 "./module": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\module.js"
30167 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\didi\\lib\\module.js": [function(require, module, exports) {
30168 var Module = function() {
30169 var providers = [];
30171 this.factory = function(name, factory) {
30172 providers.push([name, 'factory', factory]);
30176 this.value = function(name, value) {
30177 providers.push([name, 'value', value]);
30181 this.type = function(name, type) {
30182 providers.push([name, 'type', type]);
30186 this.forEach = function(iterator) {
30187 providers.forEach(iterator);
30191 module.exports = Module;
30194 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\eve\\eve.js": [function(require, module, exports) {
30195 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
30197 // Licensed under the Apache License, Version 2.0 (the "License");
30198 // you may not use this file except in compliance with the License.
30199 // You may obtain a copy of the License at
30201 // http://www.apache.org/licenses/LICENSE-2.0
30203 // Unless required by applicable law or agreed to in writing, software
30204 // distributed under the License is distributed on an "AS IS" BASIS,
30205 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30206 // See the License for the specific language governing permissions and
30207 // limitations under the License.
30208 // ��������������������������������������������������������������
30210 // � Eve 0.4.2 - JavaScript Events Library � \\
30211 // ��������������������������������������������������������������
30213 // � Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) �
30215 // ��������������������������������������������������������������
30219 var version = "0.4.2",
30220 has = "hasOwnProperty",
30221 separator = /[\.\/]/,
30222 comaseparator = /\s*,\s*/,
30224 fun = function() {},
30225 numsort = function(a, b) {
30233 firstDefined = function() {
30234 for (var i = 0, ii = this.length; i < ii; i++) {
30235 if (typeof this[i] != "undefined") {
30240 lastDefined = function() {
30241 var i = this.length;
30243 if (typeof this[i] != "undefined") {
30251 * Fires event with given `name`, given scope and other parameters.
30253 * - name (string) name of the *event*, dot (`.`) or slash (`/`) separated -
30254 * scope (object) context for the event handlers - varargs (...) the rest of
30255 * arguments will be sent to event handlers
30256 * = (object) array of returned values from the listeners. Array has two
30257 * methods `.firstDefined()` and `.lastDefined()` to get first or last not
30258 * `undefined` value. \
30260 eve = function(name, scope) {
30261 name = String(name);
30264 args = Array.prototype.slice.call(arguments, 2),
30265 listeners = eve.listeners(name),
30272 ce = current_event,
30274 out.firstDefined = firstDefined;
30275 out.lastDefined = lastDefined;
30276 current_event = name;
30278 for (var i = 0, ii = listeners.length; i < ii; i++)
30279 if ("zIndex" in listeners[i]) {
30280 indexed.push(listeners[i].zIndex);
30281 if (listeners[i].zIndex < 0) {
30282 queue[listeners[i].zIndex] = listeners[i];
30285 indexed.sort(numsort);
30286 while (indexed[z] < 0) {
30287 l = queue[indexed[z++]];
30288 out.push(l.apply(scope, args));
30294 for (i = 0; i < ii; i++) {
30296 if ("zIndex" in l) {
30297 if (l.zIndex == indexed[z]) {
30298 out.push(l.apply(scope, args));
30304 l = queue[indexed[z]];
30305 l && out.push(l.apply(scope, args));
30311 queue[l.zIndex] = l;
30314 out.push(l.apply(scope, args));
30321 current_event = ce;
30324 // Undocumented. Debug only.
30325 eve._events = events;
30327 * \ eve.listeners [ method ]
30329 * Internal method which gives you array of all event handlers that will be
30330 * triggered by the given `name`.
30332 * - name (string) name of the event, dot (`.`) or slash (`/`) separated
30333 * = (array) array of event handlers \
30335 eve.listeners = function(name) {
30336 var names = name.split(separator),
30348 for (i = 0, ii = names.length; i < ii; i++) {
30350 for (j = 0, jj = es.length; j < jj; j++) {
30352 items = [e[names[i]], e[wildcard]];
30358 out = out.concat(item.f || []);
30368 * \ eve.on [ method ] * Binds given event handler with a given name. You
30369 * can use wildcards “`*`� for the names: | eve.on("*.under.*",
30370 * f); | eve("mouse.under.floor"); // triggers f Use @eve to trigger the
30371 * listener. * > Arguments * - name (string) name of the event, dot (`.`) or
30372 * slash (`/`) separated, with optional wildcards - f (function) event
30373 * handler function * = (function) returned function accepts a single
30374 * numeric parameter that represents z-index of the handler. It is an
30375 * optional feature and only used when you need to ensure that some subset
30376 * of handlers will be invoked in a given order, despite of the order of
30377 * assignment. > Example: | eve.on("mouse", eatIt)(2); | eve.on("mouse",
30378 * scream); | eve.on("mouse", catchIt)(1); This will ensure that `catchIt`
30379 * function will be called before `eatIt`.
30381 * If you want to put your handler before non-indexed handlers, specify a
30382 * negative value. Note: I assume most of the time you don’t need to
30383 * worry about z-index, but it’s nice to have this feature
30384 * “just in case�. \
30386 eve.on = function(name, f) {
30387 name = String(name);
30388 if (typeof f != "function") {
30389 return function() {};
30391 var names = name.split(comaseparator);
30392 for (var i = 0, ii = names.length; i < ii; i++) {
30394 var names = name.split(separator),
30397 for (var i = 0, ii = names.length; i < ii; i++) {
30399 e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {
30404 for (i = 0, ii = e.f.length; i < ii; i++)
30408 }!exist && e.f.push(f);
30411 return function(zIndex) {
30412 if (+zIndex == +zIndex) {
30413 f.zIndex = +zIndex;
30418 * \ eve.f [ method ] * Returns function that will fire given event with
30419 * optional arguments. Arguments that will be passed to the result function
30420 * will be also concated to the list of final arguments. | el.onclick =
30421 * eve.f("click", 1, 2); | eve.on("click", function (a, b, c) { |
30422 * console.log(a, b, c); // 1, 2, [event object] | }); > Arguments - event
30423 * (string) event name - varargs (…) and any other arguments =
30424 * (function) possible event handler function \
30426 eve.f = function(event) {
30427 var attrs = [].slice.call(arguments, 1);
30428 return function() {
30429 eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0)));
30433 * \ eve.stop [ method ] * Is used inside an event handler to stop the
30434 * event, preventing any subsequent listeners from firing. \
30436 eve.stop = function() {
30440 * \ eve.nt [ method ] * Could be used inside event handler to figure out
30441 * actual name of the event. * > Arguments * - subname (string) #optional
30442 * subname of the event * = (string) name of the event, if `subname` is not
30443 * specified or = (boolean) `true`, if current event’s name contains
30446 eve.nt = function(subname) {
30448 return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event);
30450 return current_event;
30453 * \ eve.nts [ method ] * Could be used inside event handler to figure out
30454 * actual name of the event. * * = (array) names of the event \
30456 eve.nts = function() {
30457 return current_event.split(separator);
30460 * \ eve.off [ method ] * Removes given function from the list of event
30461 * listeners assigned to given name. If no arguments specified all the
30462 * events will be cleared. * > Arguments * - name (string) name of the
30463 * event, dot (`.`) or slash (`/`) separated, with optional wildcards - f
30464 * (function) event handler function \
30467 * \ eve.unbind [ method ] * See @eve.off \
30469 eve.off = eve.unbind = function(name, f) {
30471 eve._events = events = {
30476 var names = name.split(comaseparator);
30477 if (names.length > 1) {
30478 for (var i = 0, ii = names.length; i < ii; i++) {
30479 eve.off(names[i], f);
30483 names = name.split(separator);
30489 for (i = 0, ii = names.length; i < ii; i++) {
30490 for (j = 0; j < cur.length; j += splice.length - 2) {
30493 if (names[i] != wildcard) {
30495 splice.push(e[names[i]]);
30500 splice.push(e[key]);
30503 cur.splice.apply(cur, splice);
30506 for (i = 0, ii = cur.length; i < ii; i++) {
30511 for (j = 0, jj = e.f.length; j < jj; j++)
30515 }!e.f.length && delete e.f;
30518 if (e.n[has](key) && e.n[key].f) {
30519 var funcs = e.n[key].f;
30520 for (j = 0, jj = funcs.length; j < jj; j++)
30521 if (funcs[j] == f) {
30522 funcs.splice(j, 1);
30524 }!funcs.length && delete e.n[key].f;
30529 if (e.n[has](key) && e.n[key].f) {
30538 * \ eve.once [ method ] * Binds given event handler with a given name to
30539 * only run once then unbind itself. | eve.once("login", f); | eve("login"); //
30540 * triggers f | eve("login"); // no listeners Use @eve to trigger the
30541 * listener. * > Arguments * - name (string) name of the event, dot (`.`) or
30542 * slash (`/`) separated, with optional wildcards - f (function) event
30543 * handler function * = (function) same return function as @eve.on \
30545 eve.once = function(name, f) {
30546 var f2 = function() {
30547 eve.unbind(name, f2);
30548 return f.apply(this, arguments);
30550 return eve.on(name, f2);
30553 * \ eve.version [ property (string) ] * Current version of the library. \
30555 eve.version = version;
30556 eve.toString = function() {
30557 return "You are running Eve " + version;
30559 (typeof module != "undefined" && module.exports) ? (module.exports = eve) : (typeof define === "function" && define.amd ? (define("eve", [], function() {
30561 })) : (glob.eve = eve));
30565 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\hammerjs\\hammer.js": [function(require, module, exports) {
30567 * ! Hammer.JS - v2.0.4 - 2014-09-28 http://hammerjs.github.io/
30569 * Copyright (c) 2014 Jorik Tangelder; Licensed under the MIT license
30571 (function(window, document, exportName, undefined) {
30574 var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o'];
30575 var TEST_ELEMENT = document.createElement('div');
30577 var TYPE_FUNCTION = 'function';
30579 var round = Math.round;
30580 var abs = Math.abs;
30581 var now = Date.now;
30584 * set a timeout with a given scope
30586 * @param {Function}
30592 * @returns {number}
30594 function setTimeoutContext(fn, timeout, context) {
30595 return setTimeout(bindFn(fn, context), timeout);
30599 * if the argument is an array, we want to execute the fn on each entry if it
30600 * aint an array we don't want to do a thing. this is used by all the methods
30601 * that accept a single and array argument.
30609 * @returns {Boolean}
30611 function invokeArrayArg(arg, fn, context) {
30612 if (Array.isArray(arg)) {
30613 each(arg, context[fn], context);
30620 * walk objects and arrays
30624 * @param {Function}
30629 function each(obj, iterator, context) {
30637 obj.forEach(iterator, context);
30638 } else if (obj.length !== undefined) {
30640 while (i < obj.length) {
30641 iterator.call(context, obj[i], i, obj);
30646 obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
30652 * extend object. means that properties in dest will be overwritten by the ones
30661 * @returns {Object} dest
30663 function extend(dest, src, merge) {
30664 var keys = Object.keys(src);
30666 while (i < keys.length) {
30667 if (!merge || (merge && dest[keys[i]] === undefined)) {
30668 dest[keys[i]] = src[keys[i]];
30676 * merge the values from src in the dest. means that properties that exist in
30677 * dest will not be overwritten by src
30683 * @returns {Object} dest
30685 function merge(dest, src) {
30686 return extend(dest, src, true);
30690 * simple class inheritance
30692 * @param {Function}
30694 * @param {Function}
30699 function inherit(child, base, properties) {
30700 var baseP = base.prototype,
30703 childP = child.prototype = Object.create(baseP);
30704 childP.constructor = child;
30705 childP._super = baseP;
30708 extend(childP, properties);
30713 * simple function bind
30715 * @param {Function}
30719 * @returns {Function}
30721 function bindFn(fn, context) {
30722 return function boundFn() {
30723 return fn.apply(context, arguments);
30728 * let a boolean value also be a function that must return a boolean this first
30729 * item in args will be used as the context
30731 * @param {Boolean|Function}
30735 * @returns {Boolean}
30737 function boolOrFn(val, args) {
30738 if (typeof val == TYPE_FUNCTION) {
30739 return val.apply(args ? args[0] || undefined : undefined, args);
30745 * use the val2 when val1 is undefined
30753 function ifUndefined(val1, val2) {
30754 return (val1 === undefined) ? val2 : val1;
30758 * addEventListener with multiple events at once
30760 * @param {EventTarget}
30764 * @param {Function}
30767 function addEventListeners(target, types, handler) {
30768 each(splitStr(types), function(type) {
30769 target.addEventListener(type, handler, false);
30774 * removeEventListener with multiple events at once
30776 * @param {EventTarget}
30780 * @param {Function}
30783 function removeEventListeners(target, types, handler) {
30784 each(splitStr(types), function(type) {
30785 target.removeEventListener(type, handler, false);
30790 * find if a node is in the given parent
30792 * @method hasParent
30793 * @param {HTMLElement}
30795 * @param {HTMLElement}
30797 * @return {Boolean} found
30799 function hasParent(node, parent) {
30801 if (node == parent) {
30804 node = node.parentNode;
30810 * small indexOf wrapper
30816 * @returns {Boolean} found
30818 function inStr(str, find) {
30819 return str.indexOf(find) > -1;
30823 * split string on whitespace
30827 * @returns {Array} words
30829 function splitStr(str) {
30830 return str.trim().split(/\s+/g);
30834 * find if a array contains the object using indexOf or a simple polyFill
30842 * @return {Boolean|Number} false when not found, or the index
30844 function inArray(src, find, findByKey) {
30845 if (src.indexOf && !findByKey) {
30846 return src.indexOf(find);
30849 while (i < src.length) {
30850 if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
30860 * convert array-like objects to real arrays
30866 function toArray(obj) {
30867 return Array.prototype.slice.call(obj, 0);
30871 * unique array with objects based on a key (like 'id') or just by the array's
30875 * src [{id:1},{id:2},{id:1}]
30880 * @returns {Array} [{id:1},{id:2}]
30882 function uniqueArray(src, key, sort) {
30887 while (i < src.length) {
30888 var val = key ? src[i][key] : src[i];
30889 if (inArray(values, val) < 0) {
30890 results.push(src[i]);
30898 results = results.sort();
30900 results = results.sort(function sortUniqueArray(a, b) {
30901 return a[key] > b[key];
30910 * get the prefixed property
30916 * @returns {String|Undefined} prefixed
30918 function prefixed(obj, property) {
30920 var camelProp = property[0].toUpperCase() + property.slice(1);
30923 while (i < VENDOR_PREFIXES.length) {
30924 prefix = VENDOR_PREFIXES[i];
30925 prop = (prefix) ? prefix + camelProp : property;
30938 * @returns {number} uniqueId
30942 function uniqueId() {
30943 return _uniqueId++;
30947 * get the window object of an element
30949 * @param {HTMLElement}
30951 * @returns {DocumentView|Window}
30953 function getWindowForElement(element) {
30954 var doc = element.ownerDocument;
30955 return (doc.defaultView || doc.parentWindow);
30958 var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
30960 var SUPPORT_TOUCH = ('ontouchstart' in window);
30961 var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
30962 var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
30964 var INPUT_TYPE_TOUCH = 'touch';
30965 var INPUT_TYPE_PEN = 'pen';
30966 var INPUT_TYPE_MOUSE = 'mouse';
30967 var INPUT_TYPE_KINECT = 'kinect';
30969 var COMPUTE_INTERVAL = 25;
30971 var INPUT_START = 1;
30972 var INPUT_MOVE = 2;
30974 var INPUT_CANCEL = 8;
30976 var DIRECTION_NONE = 1;
30977 var DIRECTION_LEFT = 2;
30978 var DIRECTION_RIGHT = 4;
30979 var DIRECTION_UP = 8;
30980 var DIRECTION_DOWN = 16;
30982 var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
30983 var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
30984 var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
30986 var PROPS_XY = ['x', 'y'];
30987 var PROPS_CLIENT_XY = ['clientX', 'clientY'];
30990 * create new input type manager
30994 * @param {Function}
30999 function Input(manager, callback) {
31001 this.manager = manager;
31002 this.callback = callback;
31003 this.element = manager.element;
31004 this.target = manager.options.inputTarget;
31006 // smaller wrapper around the handler, for the scope and the enabled state
31008 // so when disabled the input events are completely bypassed.
31009 this.domHandler = function(ev) {
31010 if (boolOrFn(manager.options.enable, [manager])) {
31019 Input.prototype = {
31021 * should handle the inputEvent data and trigger the callback
31025 handler: function() {},
31031 this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
31032 this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
31033 this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
31037 * unbind the events
31039 destroy: function() {
31040 this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
31041 this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
31042 this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
31047 * create new input type manager called by the Manager constructor
31053 function createInputInstance(manager) {
31055 var inputClass = manager.options.inputClass;
31059 } else if (SUPPORT_POINTER_EVENTS) {
31060 Type = PointerEventInput;
31061 } else if (SUPPORT_ONLY_TOUCH) {
31063 } else if (!SUPPORT_TOUCH) {
31066 Type = TouchMouseInput;
31068 return new(Type)(manager, inputHandler);
31072 * handle input events
31081 function inputHandler(manager, eventType, input) {
31082 var pointersLen = input.pointers.length;
31083 var changedPointersLen = input.changedPointers.length;
31084 var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
31085 var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));
31087 input.isFirst = !!isFirst;
31088 input.isFinal = !!isFinal;
31091 manager.session = {};
31094 // source event is the normalized value of the domEvents
31095 // like 'touchstart, mouseup, pointerdown'
31096 input.eventType = eventType;
31098 // compute scale, rotation etc
31099 computeInputData(manager, input);
31101 // emit secret event
31102 manager.emit('hammer.input', input);
31104 manager.recognize(input);
31105 manager.session.prevInput = input;
31109 * extend the data with some usable properties like scale, rotate, velocity etc
31116 function computeInputData(manager, input) {
31117 var session = manager.session;
31118 var pointers = input.pointers;
31119 var pointersLength = pointers.length;
31121 // store the first input to calculate the distance and direction
31122 if (!session.firstInput) {
31123 session.firstInput = simpleCloneInputData(input);
31126 // to compute scale and rotation we need to store the multiple touches
31127 if (pointersLength > 1 && !session.firstMultiple) {
31128 session.firstMultiple = simpleCloneInputData(input);
31129 } else if (pointersLength === 1) {
31130 session.firstMultiple = false;
31133 var firstInput = session.firstInput;
31134 var firstMultiple = session.firstMultiple;
31135 var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
31137 var center = input.center = getCenter(pointers);
31138 input.timeStamp = now();
31139 input.deltaTime = input.timeStamp - firstInput.timeStamp;
31141 input.angle = getAngle(offsetCenter, center);
31142 input.distance = getDistance(offsetCenter, center);
31144 computeDeltaXY(session, input);
31145 input.offsetDirection = getDirection(input.deltaX, input.deltaY);
31147 input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
31148 input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
31150 computeIntervalInputData(session, input);
31152 // find the correct target
31153 var target = manager.element;
31154 if (hasParent(input.srcEvent.target, target)) {
31155 target = input.srcEvent.target;
31157 input.target = target;
31160 function computeDeltaXY(session, input) {
31161 var center = input.center;
31162 var offset = session.offsetDelta || {};
31163 var prevDelta = session.prevDelta || {};
31164 var prevInput = session.prevInput || {};
31166 if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
31167 prevDelta = session.prevDelta = {
31168 x: prevInput.deltaX || 0,
31169 y: prevInput.deltaY || 0
31172 offset = session.offsetDelta = {
31178 input.deltaX = prevDelta.x + (center.x - offset.x);
31179 input.deltaY = prevDelta.y + (center.y - offset.y);
31183 * velocity is calculated every x ms
31190 function computeIntervalInputData(session, input) {
31191 var last = session.lastInterval || input,
31192 deltaTime = input.timeStamp - last.timeStamp,
31193 velocity, velocityX, velocityY, direction;
31195 if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
31196 var deltaX = last.deltaX - input.deltaX;
31197 var deltaY = last.deltaY - input.deltaY;
31199 var v = getVelocity(deltaTime, deltaX, deltaY);
31202 velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
31203 direction = getDirection(deltaX, deltaY);
31205 session.lastInterval = input;
31207 // use latest velocity info if it doesn't overtake a minimum period
31208 velocity = last.velocity;
31209 velocityX = last.velocityX;
31210 velocityY = last.velocityY;
31211 direction = last.direction;
31214 input.velocity = velocity;
31215 input.velocityX = velocityX;
31216 input.velocityY = velocityY;
31217 input.direction = direction;
31221 * create a simple clone from the input used for storage of firstInput and
31226 * @returns {Object} clonedInputData
31228 function simpleCloneInputData(input) {
31229 // make a simple copy of the pointers because we will get a reference if we
31231 // we only need clientXY for the calculations
31234 while (i < input.pointers.length) {
31236 clientX: round(input.pointers[i].clientX),
31237 clientY: round(input.pointers[i].clientY)
31244 pointers: pointers,
31245 center: getCenter(pointers),
31246 deltaX: input.deltaX,
31247 deltaY: input.deltaY
31252 * get the center of all the pointers
31256 * @return {Object} center contains `x` and `y` properties
31258 function getCenter(pointers) {
31259 var pointersLength = pointers.length;
31261 // no need to loop when only one touch
31262 if (pointersLength === 1) {
31264 x: round(pointers[0].clientX),
31265 y: round(pointers[0].clientY)
31272 while (i < pointersLength) {
31273 x += pointers[i].clientX;
31274 y += pointers[i].clientY;
31279 x: round(x / pointersLength),
31280 y: round(y / pointersLength)
31285 * calculate the velocity between two points. unit is in px per ms.
31293 * @return {Object} velocity `x` and `y`
31295 function getVelocity(deltaTime, x, y) {
31297 x: x / deltaTime || 0,
31298 y: y / deltaTime || 0
31303 * get the direction between two points
31309 * @return {Number} direction
31311 function getDirection(x, y) {
31313 return DIRECTION_NONE;
31316 if (abs(x) >= abs(y)) {
31317 return x > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
31319 return y > 0 ? DIRECTION_UP : DIRECTION_DOWN;
31323 * calculate the absolute distance between two points
31330 * [props] containing x and y keys
31331 * @return {Number} distance
31333 function getDistance(p1, p2, props) {
31337 var x = p2[props[0]] - p1[props[0]],
31338 y = p2[props[1]] - p1[props[1]];
31340 return Math.sqrt((x * x) + (y * y));
31344 * calculate the angle between two coordinates
31351 * [props] containing x and y keys
31352 * @return {Number} angle
31354 function getAngle(p1, p2, props) {
31358 var x = p2[props[0]] - p1[props[0]],
31359 y = p2[props[1]] - p1[props[1]];
31360 return Math.atan2(y, x) * 180 / Math.PI;
31364 * calculate the rotation degrees between two pointersets
31367 * start array of pointers
31369 * end array of pointers
31370 * @return {Number} rotation
31372 function getRotation(start, end) {
31373 return getAngle(end[1], end[0], PROPS_CLIENT_XY) - getAngle(start[1], start[0], PROPS_CLIENT_XY);
31377 * calculate the scale factor between two pointersets no scale is 1, and goes
31378 * down to 0 when pinched together, and bigger when pinched out
31381 * start array of pointers
31383 * end array of pointers
31384 * @return {Number} scale
31386 function getScale(start, end) {
31387 return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
31390 var MOUSE_INPUT_MAP = {
31391 mousedown: INPUT_START,
31392 mousemove: INPUT_MOVE,
31396 var MOUSE_ELEMENT_EVENTS = 'mousedown';
31397 var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
31400 * Mouse events input
31405 function MouseInput() {
31406 this.evEl = MOUSE_ELEMENT_EVENTS;
31407 this.evWin = MOUSE_WINDOW_EVENTS;
31409 this.allow = true; // used by Input.TouchMouse to disable mouse events
31410 this.pressed = false; // mousedown state
31412 Input.apply(this, arguments);
31415 inherit(MouseInput, Input, {
31417 * handle mouse events
31422 handler: function MEhandler(ev) {
31423 var eventType = MOUSE_INPUT_MAP[ev.type];
31425 // on start we want to have the left mouse button down
31426 if (eventType & INPUT_START && ev.button === 0) {
31427 this.pressed = true;
31430 if (eventType & INPUT_MOVE && ev.which !== 1) {
31431 eventType = INPUT_END;
31434 // mouse must be down, and mouse events are allowed (see the TouchMouse
31436 if (!this.pressed || !this.allow) {
31440 if (eventType & INPUT_END) {
31441 this.pressed = false;
31444 this.callback(this.manager, eventType, {
31446 changedPointers: [ev],
31447 pointerType: INPUT_TYPE_MOUSE,
31453 var POINTER_INPUT_MAP = {
31454 pointerdown: INPUT_START,
31455 pointermove: INPUT_MOVE,
31456 pointerup: INPUT_END,
31457 pointercancel: INPUT_CANCEL,
31458 pointerout: INPUT_CANCEL
31461 // in IE10 the pointer types is defined as an enum
31462 var IE10_POINTER_TYPE_ENUM = {
31463 2: INPUT_TYPE_TOUCH,
31465 4: INPUT_TYPE_MOUSE,
31466 5: INPUT_TYPE_KINECT // see
31467 // https://twitter.com/jacobrossi/status/480596438489890816
31470 var POINTER_ELEMENT_EVENTS = 'pointerdown';
31471 var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
31473 // IE10 has prefixed support, and case-sensitive
31474 if (window.MSPointerEvent) {
31475 POINTER_ELEMENT_EVENTS = 'MSPointerDown';
31476 POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
31480 * Pointer events input
31485 function PointerEventInput() {
31486 this.evEl = POINTER_ELEMENT_EVENTS;
31487 this.evWin = POINTER_WINDOW_EVENTS;
31489 Input.apply(this, arguments);
31491 this.store = (this.manager.session.pointerEvents = []);
31494 inherit(PointerEventInput, Input, {
31496 * handle mouse events
31501 handler: function PEhandler(ev) {
31502 var store = this.store;
31503 var removePointer = false;
31505 var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
31506 var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
31507 var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
31509 var isTouch = (pointerType == INPUT_TYPE_TOUCH);
31511 // get index of the event in the store
31512 var storeIndex = inArray(store, ev.pointerId, 'pointerId');
31514 // start and mouse must be down
31515 if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
31516 if (storeIndex < 0) {
31518 storeIndex = store.length - 1;
31520 } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
31521 removePointer = true;
31524 // it not found, so the pointer hasn't been down (so it's probably a
31526 if (storeIndex < 0) {
31530 // update the event in the store
31531 store[storeIndex] = ev;
31533 this.callback(this.manager, eventType, {
31535 changedPointers: [ev],
31536 pointerType: pointerType,
31540 if (removePointer) {
31541 // remove from the store
31542 store.splice(storeIndex, 1);
31547 var SINGLE_TOUCH_INPUT_MAP = {
31548 touchstart: INPUT_START,
31549 touchmove: INPUT_MOVE,
31550 touchend: INPUT_END,
31551 touchcancel: INPUT_CANCEL
31554 var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
31555 var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
31558 * Touch events input
31563 function SingleTouchInput() {
31564 this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
31565 this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
31566 this.started = false;
31568 Input.apply(this, arguments);
31571 inherit(SingleTouchInput, Input, {
31572 handler: function TEhandler(ev) {
31573 var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
31575 // should we handle the touch events?
31576 if (type === INPUT_START) {
31577 this.started = true;
31580 if (!this.started) {
31584 var touches = normalizeSingleTouches.call(this, ev, type);
31586 // when done, reset the started state
31587 if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
31588 this.started = false;
31591 this.callback(this.manager, type, {
31592 pointers: touches[0],
31593 changedPointers: touches[1],
31594 pointerType: INPUT_TYPE_TOUCH,
31601 * @this {TouchInput}
31606 * @returns {undefined|Array} [all, changed]
31608 function normalizeSingleTouches(ev, type) {
31609 var all = toArray(ev.touches);
31610 var changed = toArray(ev.changedTouches);
31612 if (type & (INPUT_END | INPUT_CANCEL)) {
31613 all = uniqueArray(all.concat(changed), 'identifier', true);
31616 return [all, changed];
31619 var TOUCH_INPUT_MAP = {
31620 touchstart: INPUT_START,
31621 touchmove: INPUT_MOVE,
31622 touchend: INPUT_END,
31623 touchcancel: INPUT_CANCEL
31626 var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
31629 * Multi-user touch events input
31634 function TouchInput() {
31635 this.evTarget = TOUCH_TARGET_EVENTS;
31636 this.targetIds = {};
31638 Input.apply(this, arguments);
31641 inherit(TouchInput, Input, {
31642 handler: function MTEhandler(ev) {
31643 var type = TOUCH_INPUT_MAP[ev.type];
31644 var touches = getTouches.call(this, ev, type);
31649 this.callback(this.manager, type, {
31650 pointers: touches[0],
31651 changedPointers: touches[1],
31652 pointerType: INPUT_TYPE_TOUCH,
31659 * @this {TouchInput}
31664 * @returns {undefined|Array} [all, changed]
31666 function getTouches(ev, type) {
31667 var allTouches = toArray(ev.touches);
31668 var targetIds = this.targetIds;
31670 // when there is only one touch, the process can be simplified
31671 if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
31672 targetIds[allTouches[0].identifier] = true;
31673 return [allTouches, allTouches];
31678 changedTouches = toArray(ev.changedTouches),
31679 changedTargetTouches = [],
31680 target = this.target;
31682 // get target touches from touches
31683 targetTouches = allTouches.filter(function(touch) {
31684 return hasParent(touch.target, target);
31688 if (type === INPUT_START) {
31690 while (i < targetTouches.length) {
31691 targetIds[targetTouches[i].identifier] = true;
31696 // filter changed touches to only contain touches that exist in the
31697 // collected target ids
31699 while (i < changedTouches.length) {
31700 if (targetIds[changedTouches[i].identifier]) {
31701 changedTargetTouches.push(changedTouches[i]);
31704 // cleanup removed touches
31705 if (type & (INPUT_END | INPUT_CANCEL)) {
31706 delete targetIds[changedTouches[i].identifier];
31711 if (!changedTargetTouches.length) {
31716 // merge targetTouches with changedTargetTouches so it contains ALL
31717 // touches, including 'end' and 'cancel'
31718 uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
31719 changedTargetTouches
31724 * Combined touch and mouse input
31726 * Touch has a higher priority then mouse, and while touching no mouse events
31727 * are allowed. This because touch devices also emit mouse events while doing a
31733 function TouchMouseInput() {
31734 Input.apply(this, arguments);
31736 var handler = bindFn(this.handler, this);
31737 this.touch = new TouchInput(this.manager, handler);
31738 this.mouse = new MouseInput(this.manager, handler);
31741 inherit(TouchMouseInput, Input, {
31743 * handle mouse and touch events
31752 handler: function TMEhandler(manager, inputEvent, inputData) {
31753 var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
31754 isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
31756 // when we're in a touch event, so block all upcoming mouse events
31757 // most mobile browser also emit mouseevents, right after touchstart
31759 this.mouse.allow = false;
31760 } else if (isMouse && !this.mouse.allow) {
31764 // reset the allowMouse when we're done
31765 if (inputEvent & (INPUT_END | INPUT_CANCEL)) {
31766 this.mouse.allow = true;
31769 this.callback(manager, inputEvent, inputData);
31773 * remove the event listeners
31775 destroy: function destroy() {
31776 this.touch.destroy();
31777 this.mouse.destroy();
31781 var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
31782 var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
31784 // magical touchAction value
31785 var TOUCH_ACTION_COMPUTE = 'compute';
31786 var TOUCH_ACTION_AUTO = 'auto';
31787 var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
31788 var TOUCH_ACTION_NONE = 'none';
31789 var TOUCH_ACTION_PAN_X = 'pan-x';
31790 var TOUCH_ACTION_PAN_Y = 'pan-y';
31793 * Touch Action sets the touchAction property or uses the js alternative
31801 function TouchAction(manager, value) {
31802 this.manager = manager;
31806 TouchAction.prototype = {
31808 * set the touchAction value on the element or enable the polyfill
31813 set: function(value) {
31814 // find out the touch-action by the event handlers
31815 if (value == TOUCH_ACTION_COMPUTE) {
31816 value = this.compute();
31819 if (NATIVE_TOUCH_ACTION) {
31820 this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
31822 this.actions = value.toLowerCase().trim();
31826 * just re-set the touchAction value
31828 update: function() {
31829 this.set(this.manager.options.touchAction);
31833 * compute the value for the touchAction property based on the recognizer's
31836 * @returns {String} value
31838 compute: function() {
31840 each(this.manager.recognizers, function(recognizer) {
31841 if (boolOrFn(recognizer.options.enable, [recognizer])) {
31842 actions = actions.concat(recognizer.getTouchAction());
31845 return cleanTouchActions(actions.join(' '));
31849 * this method is called on each input cycle and provides the preventing of
31850 * the browser behavior
31855 preventDefaults: function(input) {
31856 // not needed with native support for the touchAction property
31857 if (NATIVE_TOUCH_ACTION) {
31861 var srcEvent = input.srcEvent;
31862 var direction = input.offsetDirection;
31864 // if the touch action did prevented once this session
31865 if (this.manager.session.prevented) {
31866 srcEvent.preventDefault();
31870 var actions = this.actions;
31871 var hasNone = inStr(actions, TOUCH_ACTION_NONE);
31872 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
31873 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
31876 (hasPanY && direction & DIRECTION_HORIZONTAL) ||
31877 (hasPanX && direction & DIRECTION_VERTICAL)) {
31878 return this.preventSrc(srcEvent);
31883 * call preventDefault to prevent the browser's default behavior (scrolling
31889 preventSrc: function(srcEvent) {
31890 this.manager.session.prevented = true;
31891 srcEvent.preventDefault();
31896 * when the touchActions are collected they are not a valid value, so we need to
31897 * clean things up. *
31903 function cleanTouchActions(actions) {
31905 if (inStr(actions, TOUCH_ACTION_NONE)) {
31906 return TOUCH_ACTION_NONE;
31909 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
31910 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
31912 // pan-x and pan-y can be combined
31913 if (hasPanX && hasPanY) {
31914 return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y;
31918 if (hasPanX || hasPanY) {
31919 return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
31923 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
31924 return TOUCH_ACTION_MANIPULATION;
31927 return TOUCH_ACTION_AUTO;
31931 * Recognizer flow explained; * All recognizers have the initial state of
31932 * POSSIBLE when a input session starts. The definition of a input session is
31933 * from the first input until the last input, with all it's movement in it. *
31934 * Example session for mouse-input: mousedown -> mousemove -> mouseup
31936 * On each recognizing cycle (see Manager.recognize) the .recognize() method is
31937 * executed which determines with state it should be.
31939 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals
31940 * ENDED), it is reset to POSSIBLE to give it another change on the next cycle.
31942 * Possible | +-----+---------------+ | | +-----+-----+ | | | | Failed Cancelled |
31943 * +-------+------+ | | Recognized Began | Changed | Ended/Recognized
31945 var STATE_POSSIBLE = 1;
31946 var STATE_BEGAN = 2;
31947 var STATE_CHANGED = 4;
31948 var STATE_ENDED = 8;
31949 var STATE_RECOGNIZED = STATE_ENDED;
31950 var STATE_CANCELLED = 16;
31951 var STATE_FAILED = 32;
31954 * Recognizer Every recognizer needs to extend from this class.
31960 function Recognizer(options) {
31961 this.id = uniqueId();
31963 this.manager = null;
31964 this.options = merge(options || {}, this.defaults);
31966 // default is enable true
31967 this.options.enable = ifUndefined(this.options.enable, true);
31969 this.state = STATE_POSSIBLE;
31971 this.simultaneous = {};
31972 this.requireFail = [];
31975 Recognizer.prototype = {
31987 * @return {Recognizer}
31989 set: function(options) {
31990 extend(this.options, options);
31992 // also update the touchAction, in case something changed about the
31993 // directions/enabled state
31994 this.manager && this.manager.touchAction.update();
31999 * recognize simultaneous with an other recognizer.
32001 * @param {Recognizer}
32003 * @returns {Recognizer} this
32005 recognizeWith: function(otherRecognizer) {
32006 if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
32010 var simultaneous = this.simultaneous;
32011 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
32012 if (!simultaneous[otherRecognizer.id]) {
32013 simultaneous[otherRecognizer.id] = otherRecognizer;
32014 otherRecognizer.recognizeWith(this);
32020 * drop the simultaneous link. it doesnt remove the link on the other
32023 * @param {Recognizer}
32025 * @returns {Recognizer} this
32027 dropRecognizeWith: function(otherRecognizer) {
32028 if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
32032 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
32033 delete this.simultaneous[otherRecognizer.id];
32038 * recognizer can only run when an other is failing
32040 * @param {Recognizer}
32042 * @returns {Recognizer} this
32044 requireFailure: function(otherRecognizer) {
32045 if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
32049 var requireFail = this.requireFail;
32050 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
32051 if (inArray(requireFail, otherRecognizer) === -1) {
32052 requireFail.push(otherRecognizer);
32053 otherRecognizer.requireFailure(this);
32059 * drop the requireFailure link. it does not remove the link on the other
32062 * @param {Recognizer}
32064 * @returns {Recognizer} this
32066 dropRequireFailure: function(otherRecognizer) {
32067 if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
32071 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
32072 var index = inArray(this.requireFail, otherRecognizer);
32074 this.requireFail.splice(index, 1);
32080 * has require failures boolean
32082 * @returns {boolean}
32084 hasRequireFailures: function() {
32085 return this.requireFail.length > 0;
32089 * if the recognizer can recognize simultaneous with an other recognizer
32091 * @param {Recognizer}
32093 * @returns {Boolean}
32095 canRecognizeWith: function(otherRecognizer) {
32096 return !!this.simultaneous[otherRecognizer.id];
32100 * You should use `tryEmit` instead of `emit` directly to check that all the
32101 * needed recognizers has failed before emitting.
32106 emit: function(input) {
32108 var state = this.state;
32110 function emit(withState) {
32111 self.manager.emit(self.options.event + (withState ? stateStr(state) : ''), input);
32114 // 'panstart' and 'panmove'
32115 if (state < STATE_ENDED) {
32119 emit(); // simple 'eventName' events
32121 // panend and pancancel
32122 if (state >= STATE_ENDED) {
32128 * Check that all the require failure recognizers has failed, if true, it
32129 * emits a gesture event, otherwise, setup the state to FAILED.
32134 tryEmit: function(input) {
32135 if (this.canEmit()) {
32136 return this.emit(input);
32138 // it's failing anyway
32139 this.state = STATE_FAILED;
32145 * @returns {boolean}
32147 canEmit: function() {
32149 while (i < this.requireFail.length) {
32150 if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
32159 * update the recognizer
32164 recognize: function(inputData) {
32165 // make a new copy of the inputData
32166 // so we can change the inputData without messing up the other
32168 var inputDataClone = extend({}, inputData);
32170 // is is enabled and allow recognizing?
32171 if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
32173 this.state = STATE_FAILED;
32177 // reset when we've reached the end
32178 if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
32179 this.state = STATE_POSSIBLE;
32182 this.state = this.process(inputDataClone);
32184 // the recognizer has recognized a gesture
32185 // so trigger an event
32186 if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
32187 this.tryEmit(inputDataClone);
32192 * return the state of the recognizer the actual recognizing happens in this
32198 * @returns {Const} STATE
32200 process: function(inputData) {}, // jshint ignore:line
32203 * return the preferred touch-action
32208 getTouchAction: function() {},
32211 * called when the gesture isn't allowed to recognize like when another is
32212 * being recognized or it is disabled
32216 reset: function() {}
32220 * get a usable string, used as event postfix
32224 * @returns {String} state
32226 function stateStr(state) {
32227 if (state & STATE_CANCELLED) {
32229 } else if (state & STATE_ENDED) {
32231 } else if (state & STATE_CHANGED) {
32233 } else if (state & STATE_BEGAN) {
32240 * direction cons to string
32244 * @returns {String}
32246 function directionStr(direction) {
32247 if (direction == DIRECTION_DOWN) {
32249 } else if (direction == DIRECTION_UP) {
32251 } else if (direction == DIRECTION_LEFT) {
32253 } else if (direction == DIRECTION_RIGHT) {
32260 * get a recognizer by name if it is bound to a manager
32262 * @param {Recognizer|String}
32264 * @param {Recognizer}
32266 * @returns {Recognizer}
32268 function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
32269 var manager = recognizer.manager;
32271 return manager.get(otherRecognizer);
32273 return otherRecognizer;
32277 * This recognizer is just used as a base for the simple attribute recognizers.
32280 * @extends Recognizer
32282 function AttrRecognizer() {
32283 Recognizer.apply(this, arguments);
32286 inherit(AttrRecognizer, Recognizer, {
32289 * @memberof AttrRecognizer
32300 * Used to check if it the recognizer receives valid input, like
32301 * input.distance > 10.
32303 * @memberof AttrRecognizer
32306 * @returns {Boolean} recognized
32308 attrTest: function(input) {
32309 var optionPointers = this.options.pointers;
32310 return optionPointers === 0 || input.pointers.length === optionPointers;
32314 * Process the input and return the state for the recognizer
32316 * @memberof AttrRecognizer
32319 * @returns {*} State
32321 process: function(input) {
32322 var state = this.state;
32323 var eventType = input.eventType;
32325 var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
32326 var isValid = this.attrTest(input);
32328 // on cancel input and we've recognized before, return STATE_CANCELLED
32329 if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
32330 return state | STATE_CANCELLED;
32331 } else if (isRecognized || isValid) {
32332 if (eventType & INPUT_END) {
32333 return state | STATE_ENDED;
32334 } else if (!(state & STATE_BEGAN)) {
32335 return STATE_BEGAN;
32337 return state | STATE_CHANGED;
32339 return STATE_FAILED;
32344 * Pan Recognized when the pointer is down and moved in the allowed direction.
32347 * @extends AttrRecognizer
32349 function PanRecognizer() {
32350 AttrRecognizer.apply(this, arguments);
32356 inherit(PanRecognizer, AttrRecognizer, {
32359 * @memberof PanRecognizer
32365 direction: DIRECTION_ALL
32368 getTouchAction: function() {
32369 var direction = this.options.direction;
32371 if (direction & DIRECTION_HORIZONTAL) {
32372 actions.push(TOUCH_ACTION_PAN_Y);
32374 if (direction & DIRECTION_VERTICAL) {
32375 actions.push(TOUCH_ACTION_PAN_X);
32380 directionTest: function(input) {
32381 var options = this.options;
32382 var hasMoved = true;
32383 var distance = input.distance;
32384 var direction = input.direction;
32385 var x = input.deltaX;
32386 var y = input.deltaY;
32389 if (!(direction & options.direction)) {
32390 if (options.direction & DIRECTION_HORIZONTAL) {
32391 direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
32392 hasMoved = x != this.pX;
32393 distance = Math.abs(input.deltaX);
32395 direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
32396 hasMoved = y != this.pY;
32397 distance = Math.abs(input.deltaY);
32400 input.direction = direction;
32401 return hasMoved && distance > options.threshold && direction & options.direction;
32404 attrTest: function(input) {
32405 return AttrRecognizer.prototype.attrTest.call(this, input) &&
32406 (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
32409 emit: function(input) {
32410 this.pX = input.deltaX;
32411 this.pY = input.deltaY;
32413 var direction = directionStr(input.direction);
32415 this.manager.emit(this.options.event + direction, input);
32418 this._super.emit.call(this, input);
32423 * Pinch Recognized when two or more pointers are moving toward (zoom-in) or
32424 * away from each other (zoom-out).
32427 * @extends AttrRecognizer
32429 function PinchRecognizer() {
32430 AttrRecognizer.apply(this, arguments);
32433 inherit(PinchRecognizer, AttrRecognizer, {
32436 * @memberof PinchRecognizer
32444 getTouchAction: function() {
32445 return [TOUCH_ACTION_NONE];
32448 attrTest: function(input) {
32449 return this._super.attrTest.call(this, input) &&
32450 (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
32453 emit: function(input) {
32454 this._super.emit.call(this, input);
32455 if (input.scale !== 1) {
32456 var inOut = input.scale < 1 ? 'in' : 'out';
32457 this.manager.emit(this.options.event + inOut, input);
32463 * Press Recognized when the pointer is down for x ms without any movement.
32466 * @extends Recognizer
32468 function PressRecognizer() {
32469 Recognizer.apply(this, arguments);
32471 this._timer = null;
32472 this._input = null;
32475 inherit(PressRecognizer, Recognizer, {
32478 * @memberof PressRecognizer
32483 time: 500, // minimal time of the pointer to be pressed
32484 threshold: 5 // a minimal movement is ok, but keep it low
32487 getTouchAction: function() {
32488 return [TOUCH_ACTION_AUTO];
32491 process: function(input) {
32492 var options = this.options;
32493 var validPointers = input.pointers.length === options.pointers;
32494 var validMovement = input.distance < options.threshold;
32495 var validTime = input.deltaTime > options.time;
32497 this._input = input;
32499 // we only allow little movement
32500 // and we've reached an end event, so a tap is possible
32501 if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
32503 } else if (input.eventType & INPUT_START) {
32505 this._timer = setTimeoutContext(function() {
32506 this.state = STATE_RECOGNIZED;
32508 }, options.time, this);
32509 } else if (input.eventType & INPUT_END) {
32510 return STATE_RECOGNIZED;
32512 return STATE_FAILED;
32515 reset: function() {
32516 clearTimeout(this._timer);
32519 emit: function(input) {
32520 if (this.state !== STATE_RECOGNIZED) {
32524 if (input && (input.eventType & INPUT_END)) {
32525 this.manager.emit(this.options.event + 'up', input);
32527 this._input.timeStamp = now();
32528 this.manager.emit(this.options.event, this._input);
32534 * Rotate Recognized when two or more pointer are moving in a circular motion.
32537 * @extends AttrRecognizer
32539 function RotateRecognizer() {
32540 AttrRecognizer.apply(this, arguments);
32543 inherit(RotateRecognizer, AttrRecognizer, {
32546 * @memberof RotateRecognizer
32554 getTouchAction: function() {
32555 return [TOUCH_ACTION_NONE];
32558 attrTest: function(input) {
32559 return this._super.attrTest.call(this, input) &&
32560 (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
32565 * Swipe Recognized when the pointer is moving fast (velocity), with enough
32566 * distance in the allowed direction.
32569 * @extends AttrRecognizer
32571 function SwipeRecognizer() {
32572 AttrRecognizer.apply(this, arguments);
32575 inherit(SwipeRecognizer, AttrRecognizer, {
32578 * @memberof SwipeRecognizer
32584 direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
32588 getTouchAction: function() {
32589 return PanRecognizer.prototype.getTouchAction.call(this);
32592 attrTest: function(input) {
32593 var direction = this.options.direction;
32596 if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
32597 velocity = input.velocity;
32598 } else if (direction & DIRECTION_HORIZONTAL) {
32599 velocity = input.velocityX;
32600 } else if (direction & DIRECTION_VERTICAL) {
32601 velocity = input.velocityY;
32604 return this._super.attrTest.call(this, input) &&
32605 direction & input.direction &&
32606 input.distance > this.options.threshold &&
32607 abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
32610 emit: function(input) {
32611 var direction = directionStr(input.direction);
32613 this.manager.emit(this.options.event + direction, input);
32616 this.manager.emit(this.options.event, input);
32621 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps
32622 * are recognized if they occur between the given interval and position. The
32623 * delay option can be used to recognize multi-taps without firing a single tap.
32625 * The eventData from the emitted event contains the property `tapCount`, which
32626 * contains the amount of multi-taps being recognized.
32629 * @extends Recognizer
32631 function TapRecognizer() {
32632 Recognizer.apply(this, arguments);
32634 // previous time and center,
32635 // used for tap counting
32636 this.pTime = false;
32637 this.pCenter = false;
32639 this._timer = null;
32640 this._input = null;
32644 inherit(TapRecognizer, Recognizer, {
32647 * @memberof PinchRecognizer
32653 interval: 300, // max time between the multi-tap taps
32654 time: 250, // max time of the pointer to be down (like finger on the
32656 threshold: 2, // a minimal movement is ok, but keep it low
32657 posThreshold: 10 // a multi-tap can be a bit off the initial position
32660 getTouchAction: function() {
32661 return [TOUCH_ACTION_MANIPULATION];
32664 process: function(input) {
32665 var options = this.options;
32667 var validPointers = input.pointers.length === options.pointers;
32668 var validMovement = input.distance < options.threshold;
32669 var validTouchTime = input.deltaTime < options.time;
32673 if ((input.eventType & INPUT_START) && (this.count === 0)) {
32674 return this.failTimeout();
32677 // we only allow little movement
32678 // and we've reached an end event, so a tap is possible
32679 if (validMovement && validTouchTime && validPointers) {
32680 if (input.eventType != INPUT_END) {
32681 return this.failTimeout();
32684 var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
32685 var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
32687 this.pTime = input.timeStamp;
32688 this.pCenter = input.center;
32690 if (!validMultiTap || !validInterval) {
32696 this._input = input;
32698 // if tap count matches we have recognized it,
32699 // else it has began recognizing...
32700 var tapCount = this.count % options.taps;
32701 if (tapCount === 0) {
32702 // no failing requirements, immediately trigger the tap event
32703 // or wait as long as the multitap interval to trigger
32704 if (!this.hasRequireFailures()) {
32705 return STATE_RECOGNIZED;
32707 this._timer = setTimeoutContext(function() {
32708 this.state = STATE_RECOGNIZED;
32710 }, options.interval, this);
32711 return STATE_BEGAN;
32715 return STATE_FAILED;
32718 failTimeout: function() {
32719 this._timer = setTimeoutContext(function() {
32720 this.state = STATE_FAILED;
32721 }, this.options.interval, this);
32722 return STATE_FAILED;
32725 reset: function() {
32726 clearTimeout(this._timer);
32730 if (this.state == STATE_RECOGNIZED) {
32731 this._input.tapCount = this.count;
32732 this.manager.emit(this.options.event, this._input);
32738 * Simple way to create an manager with a default set of recognizers.
32740 * @param {HTMLElement}
32746 function Hammer(element, options) {
32747 options = options || {};
32748 options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
32749 return new Manager(element, options);
32755 Hammer.VERSION = '2.0.4';
32762 Hammer.defaults = {
32764 * set if DOM events are being triggered. But this is slower and unused by
32765 * simple implementations, so disabled by default.
32773 * The value for the touchAction property/fallback. When set to `compute` it
32774 * will magically set the correct value based on the added recognizers.
32779 touchAction: TOUCH_ACTION_COMPUTE,
32788 * EXPERIMENTAL FEATURE -- can be removed/changed Change the parent input
32789 * target element. If Null, then it is being set the to main element.
32791 * @type {Null|EventTarget}
32797 * force an input class
32799 * @type {Null|Function}
32805 * Default recognizer setup when calling `Hammer()` When creating a new
32806 * Manager these will be skipped.
32811 // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
32812 [RotateRecognizer, {
32815 [PinchRecognizer, {
32820 [SwipeRecognizer, {
32821 direction: DIRECTION_HORIZONTAL
32824 direction: DIRECTION_HORIZONTAL
32830 event: 'doubletap',
32839 * Some CSS properties can be used to improve the working of Hammer. Add
32840 * them to this method and they will be set when creating a new Manager.
32846 * Disables text selection to improve the dragging gesture. Mainly for
32847 * desktop browsers.
32852 userSelect: 'none',
32855 * Disable the Windows Phone grippers when pressing an element.
32860 touchSelect: 'none',
32863 * Disables the default callout shown when you touch and hold a touch
32864 * target. On iOS, when you touch and hold a touch target such as a
32865 * link, Safari displays a callout containing information about the
32866 * link. This property allows you to disable that callout.
32871 touchCallout: 'none',
32874 * Specifies whether zooming is enabled. Used by IE10>
32879 contentZooming: 'none',
32882 * Specifies that an entire element should be draggable instead of its
32883 * contents. Mainly for desktop browsers.
32891 * Overrides the highlight color shown when the user taps a link or a
32892 * JavaScript clickable element in iOS. This property obeys the alpha
32893 * value, if specified.
32896 * @default 'rgba(0,0,0,0)'
32898 tapHighlightColor: 'rgba(0,0,0,0)'
32903 var FORCED_STOP = 2;
32908 * @param {HTMLElement}
32914 function Manager(element, options) {
32915 options = options || {};
32917 this.options = merge(options, Hammer.defaults);
32918 this.options.inputTarget = this.options.inputTarget || element;
32920 this.handlers = {};
32922 this.recognizers = [];
32924 this.element = element;
32925 this.input = createInputInstance(this);
32926 this.touchAction = new TouchAction(this, this.options.touchAction);
32928 toggleCssProps(this, true);
32930 each(options.recognizers, function(item) {
32931 var recognizer = this.add(new(item[0])(item[1]));
32932 item[2] && recognizer.recognizeWith(item[2]);
32933 item[3] && recognizer.requireFailure(item[3]);
32937 Manager.prototype = {
32943 * @returns {Manager}
32945 set: function(options) {
32946 extend(this.options, options);
32948 // Options that need a little more setup
32949 if (options.touchAction) {
32950 this.touchAction.update();
32952 if (options.inputTarget) {
32953 // Clean up existing event listeners and reinitialize
32954 this.input.destroy();
32955 this.input.target = options.inputTarget;
32962 * stop recognizing for this session. This session will be discarded, when a
32963 * new [input]start event is fired. When forced, the recognizer cycle is
32964 * stopped immediately.
32969 stop: function(force) {
32970 this.session.stopped = force ? FORCED_STOP : STOP;
32974 * run the recognizers! called by the inputHandler function on every
32975 * movement of the pointers (touches) it walks through all the recognizers
32976 * and tries to detect the gesture that is being made
32981 recognize: function(inputData) {
32982 var session = this.session;
32983 if (session.stopped) {
32987 // run the touch-action polyfill
32988 this.touchAction.preventDefaults(inputData);
32991 var recognizers = this.recognizers;
32993 // this holds the recognizer that is being recognized.
32994 // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or
32996 // if no recognizer is detecting a thing, it is set to `null`
32997 var curRecognizer = session.curRecognizer;
32999 // reset when the last recognizer is recognized
33000 // or when we're in a new session
33001 if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
33002 curRecognizer = session.curRecognizer = null;
33006 while (i < recognizers.length) {
33007 recognizer = recognizers[i];
33009 // find out if we are allowed try to recognize the input for this
33011 // 1. allow if the session is NOT forced stopped (see the .stop()
33013 // 2. allow if we still haven't recognized a gesture in this
33014 // session, or the this recognizer is the one
33015 // that is being recognized.
33016 // 3. allow if the recognizer is allowed to run simultaneous with
33017 // the current recognized recognizer.
33018 // this can be setup with the `recognizeWith()` method on the
33020 if (session.stopped !== FORCED_STOP && ( // 1
33021 !curRecognizer || recognizer == curRecognizer || // 2
33022 recognizer.canRecognizeWith(curRecognizer))) { // 3
33023 recognizer.recognize(inputData);
33025 recognizer.reset();
33028 // if the recognizer has been recognizing the input as a valid
33029 // gesture, we want to store this one as the
33030 // current active recognizer. but only if we don't already have an
33031 // active recognizer
33032 if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
33033 curRecognizer = session.curRecognizer = recognizer;
33040 * get a recognizer by its event name.
33042 * @param {Recognizer|String}
33044 * @returns {Recognizer|Null}
33046 get: function(recognizer) {
33047 if (recognizer instanceof Recognizer) {
33051 var recognizers = this.recognizers;
33052 for (var i = 0; i < recognizers.length; i++) {
33053 if (recognizers[i].options.event == recognizer) {
33054 return recognizers[i];
33061 * add a recognizer to the manager existing recognizers with the same event
33062 * name will be removed
33064 * @param {Recognizer}
33066 * @returns {Recognizer|Manager}
33068 add: function(recognizer) {
33069 if (invokeArrayArg(recognizer, 'add', this)) {
33074 var existing = this.get(recognizer.options.event);
33076 this.remove(existing);
33079 this.recognizers.push(recognizer);
33080 recognizer.manager = this;
33082 this.touchAction.update();
33087 * remove a recognizer by name or instance
33089 * @param {Recognizer|String}
33091 * @returns {Manager}
33093 remove: function(recognizer) {
33094 if (invokeArrayArg(recognizer, 'remove', this)) {
33098 var recognizers = this.recognizers;
33099 recognizer = this.get(recognizer);
33100 recognizers.splice(inArray(recognizers, recognizer), 1);
33102 this.touchAction.update();
33111 * @param {Function}
33113 * @returns {EventEmitter} this
33115 on: function(events, handler) {
33116 var handlers = this.handlers;
33117 each(splitStr(events), function(event) {
33118 handlers[event] = handlers[event] || [];
33119 handlers[event].push(handler);
33125 * unbind event, leave emit blank to remove all handlers
33129 * @param {Function}
33131 * @returns {EventEmitter} this
33133 off: function(events, handler) {
33134 var handlers = this.handlers;
33135 each(splitStr(events), function(event) {
33137 delete handlers[event];
33139 handlers[event].splice(inArray(handlers[event], handler), 1);
33146 * emit event to the listeners
33153 emit: function(event, data) {
33154 // we also want to trigger dom events
33155 if (this.options.domEvents) {
33156 triggerDomEvent(event, data);
33159 // no handlers, so skip it all
33160 var handlers = this.handlers[event] && this.handlers[event].slice();
33161 if (!handlers || !handlers.length) {
33166 data.preventDefault = function() {
33167 data.srcEvent.preventDefault();
33171 while (i < handlers.length) {
33178 * destroy the manager and unbinds all events it doesn't unbind dom events,
33179 * that is the user own responsibility
33181 destroy: function() {
33182 this.element && toggleCssProps(this, false);
33184 this.handlers = {};
33186 this.input.destroy();
33187 this.element = null;
33192 * add/remove the css properties as defined in manager.options.cssProps
33199 function toggleCssProps(manager, add) {
33200 var element = manager.element;
33201 each(manager.options.cssProps, function(value, name) {
33202 element.style[prefixed(element.style, name)] = add ? value : '';
33207 * trigger dom event
33214 function triggerDomEvent(event, data) {
33215 var gestureEvent = document.createEvent('Event');
33216 gestureEvent.initEvent(event, true, true);
33217 gestureEvent.gesture = data;
33218 data.target.dispatchEvent(gestureEvent);
33222 INPUT_START: INPUT_START,
33223 INPUT_MOVE: INPUT_MOVE,
33224 INPUT_END: INPUT_END,
33225 INPUT_CANCEL: INPUT_CANCEL,
33227 STATE_POSSIBLE: STATE_POSSIBLE,
33228 STATE_BEGAN: STATE_BEGAN,
33229 STATE_CHANGED: STATE_CHANGED,
33230 STATE_ENDED: STATE_ENDED,
33231 STATE_RECOGNIZED: STATE_RECOGNIZED,
33232 STATE_CANCELLED: STATE_CANCELLED,
33233 STATE_FAILED: STATE_FAILED,
33235 DIRECTION_NONE: DIRECTION_NONE,
33236 DIRECTION_LEFT: DIRECTION_LEFT,
33237 DIRECTION_RIGHT: DIRECTION_RIGHT,
33238 DIRECTION_UP: DIRECTION_UP,
33239 DIRECTION_DOWN: DIRECTION_DOWN,
33240 DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
33241 DIRECTION_VERTICAL: DIRECTION_VERTICAL,
33242 DIRECTION_ALL: DIRECTION_ALL,
33246 TouchAction: TouchAction,
33248 TouchInput: TouchInput,
33249 MouseInput: MouseInput,
33250 PointerEventInput: PointerEventInput,
33251 TouchMouseInput: TouchMouseInput,
33252 SingleTouchInput: SingleTouchInput,
33254 Recognizer: Recognizer,
33255 AttrRecognizer: AttrRecognizer,
33256 Tap: TapRecognizer,
33257 Pan: PanRecognizer,
33258 Swipe: SwipeRecognizer,
33259 Pinch: PinchRecognizer,
33260 Rotate: RotateRecognizer,
33261 Press: PressRecognizer,
33263 on: addEventListeners,
33264 off: removeEventListeners,
33273 if (typeof define == TYPE_FUNCTION && define.amd) {
33274 define(function() {
33277 } else if (typeof module != 'undefined' && module.exports) {
33278 module.exports = Hammer;
33280 window[exportName] = Hammer;
33283 })(window, document, 'Hammer');
33286 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\inherits\\inherits_browser.js": [function(require, module, exports) {
33287 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\inherits\\inherits_browser.js"][0].apply(exports, arguments)
33289 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\attr.js": [function(require, module, exports) {
33291 * Set attribute `name` to `val`, or get attr `name`.
33302 module.exports = function(el, name, val) {
33304 if (arguments.length == 2) {
33305 return el.getAttribute(name);
33309 if (val === null) {
33310 return el.removeAttribute(name);
33314 el.setAttribute(name, val);
33319 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\classes.js": [function(require, module, exports) {
33320 module.exports = require('component-classes');
33322 "component-classes": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-classes\\index.js"
33324 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\clear.js": [function(require, module, exports) {
33325 module.exports = function(el) {
33329 while (el.childNodes.length) {
33330 c = el.childNodes[0];
33337 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\closest.js": [function(require, module, exports) {
33338 module.exports = require('component-closest');
33340 "component-closest": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-closest\\index.js"
33342 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\delegate.js": [function(require, module, exports) {
33343 module.exports = require('component-delegate');
33345 "component-delegate": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-delegate\\index.js"
33347 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\domify.js": [function(require, module, exports) {
33348 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\domify.js"][0].apply(exports, arguments)
33350 "domify": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\domify\\index.js"
33352 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\event.js": [function(require, module, exports) {
33353 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\event.js"][0].apply(exports, arguments)
33355 "component-event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js"
33357 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\matches.js": [function(require, module, exports) {
33358 module.exports = require('component-matches-selector');
33360 "component-matches-selector": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-matches-selector\\index.js"
33362 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\query.js": [function(require, module, exports) {
33363 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\query.js"][0].apply(exports, arguments)
33365 "component-query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js"
33367 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\lib\\remove.js": [function(require, module, exports) {
33368 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\lib\\remove.js"][0].apply(exports, arguments)
33370 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-classes\\index.js": [function(require, module, exports) {
33372 * Module dependencies.
33375 var index = require('indexof');
33378 * Whitespace regexp.
33384 * toString reference.
33387 var toString = Object.prototype.toString;
33390 * Wrap `el` in a `ClassList`.
33394 * @return {ClassList}
33398 module.exports = function(el) {
33399 return new ClassList(el);
33403 * Initialize a new ClassList for `el`.
33410 function ClassList(el) {
33411 if (!el || !el.nodeType) {
33412 throw new Error('A DOM element reference is required');
33415 this.list = el.classList;
33419 * Add class `name` if not already present.
33423 * @return {ClassList}
33427 ClassList.prototype.add = function(name) {
33430 this.list.add(name);
33435 var arr = this.array();
33436 var i = index(arr, name);
33437 if (!~i) arr.push(name);
33438 this.el.className = arr.join(' ');
33443 * Remove class `name` when present, or pass a regular expression to remove any
33446 * @param {String|RegExp}
33448 * @return {ClassList}
33452 ClassList.prototype.remove = function(name) {
33453 if ('[object RegExp]' == toString.call(name)) {
33454 return this.removeMatching(name);
33459 this.list.remove(name);
33464 var arr = this.array();
33465 var i = index(arr, name);
33466 if (~i) arr.splice(i, 1);
33467 this.el.className = arr.join(' ');
33472 * Remove all classes matching `re`.
33476 * @return {ClassList}
33480 ClassList.prototype.removeMatching = function(re) {
33481 var arr = this.array();
33482 for (var i = 0; i < arr.length; i++) {
33483 if (re.test(arr[i])) {
33484 this.remove(arr[i]);
33491 * Toggle class `name`, can force state via `force`.
33493 * For browsers that support classList, but do not support `force` yet, the
33494 * mistake will be detected and corrected.
33500 * @return {ClassList}
33504 ClassList.prototype.toggle = function(name, force) {
33507 if ("undefined" !== typeof force) {
33508 if (force !== this.list.toggle(name, force)) {
33509 this.list.toggle(name); // toggle again to correct
33512 this.list.toggle(name);
33518 if ("undefined" !== typeof force) {
33525 if (this.has(name)) {
33536 * Return an array of classes.
33542 ClassList.prototype.array = function() {
33543 var className = this.el.getAttribute('class') || '';
33544 var str = className.replace(/^\s+|\s+$/g, '');
33545 var arr = str.split(re);
33546 if ('' === arr[0]) arr.shift();
33551 * Check if class `name` is present.
33555 * @return {ClassList}
33559 ClassList.prototype.has =
33560 ClassList.prototype.contains = function(name) {
33561 return this.list ? this.list.contains(name) : !!~index(this.array(), name);
33565 "indexof": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-classes\\node_modules\\component-indexof\\index.js"
33567 "\\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) {
33568 module.exports = function(arr, obj) {
33569 if (arr.indexOf) return arr.indexOf(obj);
33570 for (var i = 0; i < arr.length; ++i) {
33571 if (arr[i] === obj) return i;
33576 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-closest\\index.js": [function(require, module, exports) {
33577 var matches = require('matches-selector')
33579 module.exports = function(element, selector, checkYoSelf, root) {
33580 element = checkYoSelf ? {
33581 parentNode: element
33584 root = root || document
33586 // Make sure `element !== document` and `element != null`
33587 // otherwise we get an illegal invocation
33588 while ((element = element.parentNode) && element !== document) {
33589 if (matches(element, selector))
33591 // After `matches` on the edge case that
33592 // the selector matches the root
33593 // (when the root is not the document)
33594 if (element === root)
33600 "matches-selector": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-matches-selector\\index.js"
33602 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-delegate\\index.js": [function(require, module, exports) {
33604 * Module dependencies.
33607 var closest = require('closest'),
33608 event = require('event');
33611 * Delegate event `type` to `selector` and invoke `fn(e)`. A callback function
33612 * is returned which may be passed to `.unbind()`.
33620 * @param {Function}
33624 * @return {Function}
33628 exports.bind = function(el, selector, type, fn, capture) {
33629 return event.bind(el, type, function(e) {
33630 var target = e.target || e.srcElement;
33631 e.delegateTarget = closest(target, selector, true, el);
33632 if (e.delegateTarget) fn.call(el, e);
33637 * Unbind event `type`'s callback `fn`.
33643 * @param {Function}
33650 exports.unbind = function(el, type, fn, capture) {
33651 event.unbind(el, type, fn, capture);
33655 "closest": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-closest\\index.js",
33656 "event": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js"
33658 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-event\\index.js": [function(require, module, exports) {
33659 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)
33661 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-matches-selector\\index.js": [function(require, module, exports) {
33663 * Module dependencies.
33666 var query = require('query');
33669 * Element prototype.
33672 var proto = Element.prototype;
33678 var vendor = proto.matches || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector;
33681 * Expose `match()`.
33684 module.exports = match;
33687 * Match `el` to `selector`.
33693 * @return {Boolean}
33697 function match(el, selector) {
33698 if (!el || el.nodeType !== 1) return false;
33699 if (vendor) return vendor.call(el, selector);
33700 var nodes = query.all(selector, el.parentNode);
33701 for (var i = 0; i < nodes.length; ++i) {
33702 if (nodes[i] == el) return true;
33708 "query": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js"
33710 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\component-query\\index.js": [function(require, module, exports) {
33711 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)
33713 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\min-dom\\node_modules\\domify\\index.js": [function(require, module, exports) {
33714 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\min-dom\\node_modules\\domify\\index.js"][0].apply(exports, arguments)
33716 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\index.js": [function(require, module, exports) {
33717 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\index.js"][0].apply(exports, arguments)
33719 "./lib/collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\collection.js",
33720 "./lib/refs": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\refs.js"
33722 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\collection.js": [function(require, module, exports) {
33723 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\collection.js"][0].apply(exports, arguments)
33725 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\refs.js": [function(require, module, exports) {
33726 arguments[4]["\\bpmn-js-examples-master\\modeler\\node_modules\\bpmn-js\\node_modules\\object-refs\\lib\\refs.js"][0].apply(exports, arguments)
33728 "./collection": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\object-refs\\lib\\collection.js"
33730 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\snapsvg\\dist\\snap.svg.js": [function(require, module, exports) {
33733 // Copyright (c) 2013 – 2014 Adobe Systems Incorporated. All rights
33736 // Licensed under the Apache License, Version 2.0 (the "License");
33737 // you may not use this file except in compliance with the License.
33738 // You may obtain a copy of the License at
33740 // http://www.apache.org/licenses/LICENSE-2.0
33742 // Unless required by applicable law or agreed to in writing, software
33743 // distributed under the License is distributed on an "AS IS" BASIS,
33744 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33745 // See the License for the specific language governing permissions and
33746 // limitations under the License.
33748 // build: 2014-09-08
33750 (function(glob, factory) {
33752 if (typeof define === "function" && define.amd) {
33753 // Define as an anonymous module
33754 define(["eve"], function(eve) {
33755 return factory(glob, eve);
33757 } else if (typeof exports !== 'undefined') {
33758 // Next for Node.js or CommonJS
33759 var eve = require('eve');
33760 module.exports = factory(glob, eve);
33762 // Browser globals (glob is window)
33763 // Snap adds itself to window
33764 factory(glob, glob.eve);
33766 }(window || this, function(window, eve) {
33768 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
33770 // Licensed under the Apache License, Version 2.0 (the "License");
33771 // you may not use this file except in compliance with the License.
33772 // You may obtain a copy of the License at
33774 // http://www.apache.org/licenses/LICENSE-2.0
33776 // Unless required by applicable law or agreed to in writing, software
33777 // distributed under the License is distributed on an "AS IS" BASIS,
33778 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33779 // See the License for the specific language governing permissions and
33780 // limitations under the License.
33781 var mina = (function(eve) {
33782 var animations = {},
33783 requestAnimFrame = window.requestAnimationFrame ||
33784 window.webkitRequestAnimationFrame ||
33785 window.mozRequestAnimationFrame ||
33786 window.oRequestAnimationFrame ||
33787 window.msRequestAnimationFrame ||
33788 function(callback) {
33789 setTimeout(callback, 16);
33791 isArray = Array.isArray || function(a) {
33792 return a instanceof Array ||
33793 Object.prototype.toString.call(a) == "[object Array]";
33796 idprefix = "M" + (+new Date).toString(36),
33798 return idprefix + (idgen++).toString(36);
33800 diff = function(a, b, A, B) {
33803 for (var i = 0, ii = a.length; i < ii; i++) {
33804 res[i] = diff(a[i], b, A[i], B);
33808 var dif = (A - a) / (B - b);
33809 return function(bb) {
33810 return a + dif * (bb - b);
33813 timer = Date.now || function() {
33816 sta = function(val) {
33821 var ds = a.s - val;
33826 speed = function(val) {
33833 duration = function(val) {
33838 a.s = a.s * val / a.dur;
33841 stopit = function() {
33843 delete animations[a.id];
33845 eve("mina.stop." + a.id, a);
33847 pause = function() {
33852 delete animations[a.id];
33854 a.pdif = a.get() - a.b;
33856 resume = function() {
33861 a.b = a.get() - a.pdif;
33863 animations[a.id] = a;
33865 update = function() {
33868 if (isArray(a.start)) {
33870 for (var j = 0, jj = a.start.length; j < jj; j++) {
33871 res[j] = +a.start[j] +
33872 (a.end[j] - a.start[j]) * a.easing(a.s);
33875 res = +a.start + (a.end - a.start) * a.easing(a.s);
33879 frame = function() {
33881 for (var i in animations)
33882 if (animations.hasOwnProperty(i)) {
33883 var a = animations[i],
33887 a.s = (b - a.b) / (a.dur / a.spd);
33889 delete animations[i];
33893 setTimeout(function() {
33894 eve("mina.finish." + a.id, a);
33900 len && requestAnimFrame(frame);
33903 * \ mina [ method ] * Generic animation of numbers * - a (number) start
33904 * _slave_ number - A (number) end _slave_ number - b (number) start
33905 * _master_ number (start time in general case) - B (number) end _master_
33906 * number (end time in gereal case) - get (function) getter of _master_
33907 * number (see @mina.time) - set (function) setter of _slave_ number -
33908 * easing (function) #optional easing function, default is @mina.linear =
33909 * (object) animation descriptor o { o id (string) animation id, o start
33910 * (number) start _slave_ number, o end (number) end _slave_ number, o b
33911 * (number) start _master_ number, o s (number) animation status (0..1), o
33912 * dur (number) animation duration, o spd (number) animation speed, o get
33913 * (function) getter of _master_ number (see @mina.time), o set (function)
33914 * setter of _slave_ number, o easing (function) easing function, default is
33915 * @mina.linear, o status (function) status getter/setter, o speed
33916 * (function) speed getter/setter, o duration (function) duration
33917 * getter/setter, o stop (function) animation stopper o pause (function)
33918 * pauses the animation o resume (function) resumes the animation o update
33919 * (function) calles setter with the right value of the animation o } \
33921 mina = function(a, A, b, B, get, set, easing) {
33932 easing: easing || mina.linear,
33935 duration: duration,
33941 animations[anim.id] = anim;
33944 for (i in animations)
33945 if (animations.hasOwnProperty(i)) {
33951 len == 1 && requestAnimFrame(frame);
33955 * \ mina.time [ method ] * Returns the current time. Equivalent to: |
33956 * function () { | return (new Date).getTime(); | } \
33960 * \ mina.getById [ method ] * Returns an animation by its id - id (string)
33961 * animation's id = (object) See @mina \
33963 mina.getById = function(id) {
33964 return animations[id] || null;
33968 * \ mina.linear [ method ] * Default linear easing - n (number) input 0..1 =
33969 * (number) output 0..1 \
33971 mina.linear = function(n) {
33975 * \ mina.easeout [ method ] * Easeout easing - n (number) input 0..1 =
33976 * (number) output 0..1 \
33978 mina.easeout = function(n) {
33979 return Math.pow(n, 1.7);
33982 * \ mina.easein [ method ] * Easein easing - n (number) input 0..1 =
33983 * (number) output 0..1 \
33985 mina.easein = function(n) {
33986 return Math.pow(n, .48);
33989 * \ mina.easeinout [ method ] * Easeinout easing - n (number) input 0..1 =
33990 * (number) output 0..1 \
33992 mina.easeinout = function(n) {
33999 var q = .48 - n / 1.04,
34000 Q = Math.sqrt(.1734 + q * q),
34002 X = Math.pow(Math.abs(x), 1 / 3) * (x < 0 ? -1 : 1),
34004 Y = Math.pow(Math.abs(y), 1 / 3) * (y < 0 ? -1 : 1),
34006 return (1 - t) * 3 * t * t + t * t * t;
34009 * \ mina.backin [ method ] * Backin easing - n (number) input 0..1 =
34010 * (number) output 0..1 \
34012 mina.backin = function(n) {
34017 return n * n * ((s + 1) * n - s);
34020 * \ mina.backout [ method ] * Backout easing - n (number) input 0..1 =
34021 * (number) output 0..1 \
34023 mina.backout = function(n) {
34029 return n * n * ((s + 1) * n + s) + 1;
34032 * \ mina.elastic [ method ] * Elastic easing - n (number) input 0..1 =
34033 * (number) output 0..1 \
34035 mina.elastic = function(n) {
34039 return Math.pow(2, -10 * n) * Math.sin((n - .075) *
34040 (2 * Math.PI) / .3) + 1;
34043 * \ mina.bounce [ method ] * Bounce easing - n (number) input 0..1 =
34044 * (number) output 0..1 \
34046 mina.bounce = function(n) {
34055 l = s * n * n + .75;
34057 if (n < (2.5 / p)) {
34059 l = s * n * n + .9375;
34062 l = s * n * n + .984375;
34068 window.mina = mina;
34070 })(typeof eve == "undefined" ? function() {} : eve);
34071 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
34073 // Licensed under the Apache License, Version 2.0 (the "License");
34074 // you may not use this file except in compliance with the License.
34075 // You may obtain a copy of the License at
34077 // http://www.apache.org/licenses/LICENSE-2.0
34079 // Unless required by applicable law or agreed to in writing, software
34080 // distributed under the License is distributed on an "AS IS" BASIS,
34081 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34082 // See the License for the specific language governing permissions and
34083 // limitations under the License.
34085 var Snap = (function(root) {
34086 Snap.version = "0.3.0";
34088 * \ Snap [ method ] * Creates a drawing surface or wraps existing SVG element. * -
34089 * width (number|string) width of surface - height (number|string) height of
34090 * surface or - DOM (SVGElement) element to be wrapped into Snap structure or -
34091 * array (array) array of elements (will return set of elements) or - query
34092 * (string) CSS query selector = (object) @Element \
34094 function Snap(w, h) {
34099 if (is(w, "array") && Snap.set) {
34100 return Snap.set.apply(Snap, w);
34102 if (w instanceof Element) {
34106 w = glob.doc.querySelector(w);
34110 w = w == null ? "100%" : w;
34111 h = h == null ? "100%" : h;
34112 return new Paper(w, h);
34114 Snap.toString = function() {
34115 return "Snap v" + this.version;
34120 doc: root.window.document
34122 Snap._.glob = glob;
34123 var has = "hasOwnProperty",
34125 toFloat = parseFloat,
34133 round = math.round,
34136 objectToString = Object.prototype.toString,
34137 ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
34138 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,
34139 bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
34140 reURLValue = /^url\(#?([^)]+)\)$/,
34141 separator = Snap._.separator = /[,\s]+/,
34142 whitespace = /[\s]/g,
34143 commaSpaces = /[\s]*,[\s]*/,
34148 pathCommand = /([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig,
34149 tCommand = /([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/ig,
34150 pathValues = /(-?\d*\.?\d*(?:e[\-+]?\\d+)?)[\s]*,?[\s]*/ig,
34152 idprefix = "S" + (+new Date).toString(36),
34153 ID = function(el) {
34154 return (el && el.type ? el.type : E) + idprefix + (idgen++).toString(36);
34156 xlink = "http://www.w3.org/1999/xlink",
34157 xmlns = "http://www.w3.org/2000/svg",
34159 URL = Snap.url = function(url) {
34160 return "url('#" + url + "')";
34163 function $(el, attr) {
34165 if (el == "#text") {
34166 el = glob.doc.createTextNode(attr.text || "");
34168 if (typeof el == "string") {
34171 if (typeof attr == "string") {
34172 if (attr.substring(0, 6) == "xlink:") {
34173 return el.getAttributeNS(xlink, attr.substring(6));
34175 if (attr.substring(0, 4) == "xml:") {
34176 return el.getAttributeNS(xmlns, attr.substring(4));
34178 return el.getAttribute(attr);
34180 for (var key in attr)
34181 if (attr[has](key)) {
34182 var val = Str(attr[key]);
34184 if (key.substring(0, 6) == "xlink:") {
34185 el.setAttributeNS(xlink, key.substring(6), val);
34186 } else if (key.substring(0, 4) == "xml:") {
34187 el.setAttributeNS(xmlns, key.substring(4), val);
34189 el.setAttribute(key, val);
34192 el.removeAttribute(key);
34196 el = glob.doc.createElementNS(xmlns, el);
34203 function getAttrs(el) {
34204 var attrs = el.attributes,
34207 for (var i = 0; i < attrs.length; i++) {
34208 if (attrs[i].namespaceURI == xlink) {
34213 name += attrs[i].name;
34214 out[name] = attrs[i].textContent;
34219 function is(o, type) {
34220 type = Str.prototype.toLowerCase.call(type);
34221 if (type == "finite") {
34222 return isFinite(o);
34224 if (type == "array" &&
34225 (o instanceof Array || Array.isArray && Array.isArray(o))) {
34228 return (type == "null" && o === null) ||
34229 (type == typeof o && o !== null) ||
34230 (type == "object" && o === Object(o)) ||
34231 objectToString.call(o).slice(8, -1).toLowerCase() == type;
34234 * \ Snap.format [ method ] * Replaces construction of type `{<name>}` to the
34235 * corresponding argument * - token (string) string to format - json (object)
34236 * object which properties are used as a replacement = (string) formatted string >
34237 * Usage | // this draws a rectangular shape equivalent to "M10,20h40v50h-40z" |
34238 * paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative
34239 * width']}z", { | x: 10, | y: 20, | dim: { | width: 40, | height: 50, |
34240 * "negative width": -40 | } | })); \
34242 Snap.format = (function() {
34243 var tokenRegex = /\{([^\}]+)\}/g,
34244 objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, // matches
34253 replacer = function(all, key, obj) {
34255 key.replace(objNotationRegex, function(all, name, quote, quotedName, isFunc) {
34256 name = name || quotedName;
34261 typeof res == "function" && isFunc && (res = res());
34264 res = (res == null || res == obj ? all : res) + "";
34267 return function(str, obj) {
34268 return Str(str).replace(tokenRegex, function(all, key) {
34269 return replacer(all, key, obj);
34274 function clone(obj) {
34275 if (typeof obj == "function" || Object(obj) !== obj) {
34278 var res = new obj.constructor;
34279 for (var key in obj)
34280 if (obj[has](key)) {
34281 res[key] = clone(obj[key]);
34285 Snap._.clone = clone;
34287 function repush(array, item) {
34288 for (var i = 0, ii = array.length; i < ii; i++)
34289 if (array[i] === item) {
34290 return array.push(array.splice(i, 1)[0]);
34294 function cacher(f, scope, postprocessor) {
34296 var arg = Array.prototype.slice.call(arguments, 0),
34297 args = arg.join("\u2400"),
34298 cache = newf.cache = newf.cache || {},
34299 count = newf.count = newf.count || [];
34300 if (cache[has](args)) {
34301 repush(count, args);
34302 return postprocessor ? postprocessor(cache[args]) : cache[args];
34304 count.length >= 1e3 && delete cache[count.shift()];
34306 cache[args] = f.apply(scope, arg);
34307 return postprocessor ? postprocessor(cache[args]) : cache[args];
34311 Snap._.cacher = cacher;
34313 function angle(x1, y1, x2, y2, x3, y3) {
34320 return (180 + math.atan2(-y, -x) * 180 / PI + 360) % 360;
34322 return angle(x1, y1, x3, y3) - angle(x2, y2, x3, y3);
34326 function rad(deg) {
34327 return deg % 360 * PI / 180;
34330 function deg(rad) {
34331 return rad * 180 / PI % 360;
34335 return this.x + S + this.y;
34338 function x_y_w_h() {
34339 return this.x + S + this.y + S + this.width + " \xd7 " + this.height;
34343 * \ Snap.rad [ method ] * Transform angle to radians - deg (number) angle in
34344 * degrees = (number) angle in radians \
34348 * \ Snap.deg [ method ] * Transform angle to degrees - rad (number) angle in
34349 * radians = (number) angle in degrees \
34353 * \ Snap.angle [ method ] * Returns an angle between two or three points >
34354 * Parameters - x1 (number) x coord of first point - y1 (number) y coord of
34355 * first point - x2 (number) x coord of second point - y2 (number) y coord of
34356 * second point - x3 (number) #optional x coord of third point - y3 (number)
34357 * #optional y coord of third point = (number) angle in degrees \
34359 Snap.angle = angle;
34361 * \ Snap.is [ method ] * Handy replacement for the `typeof` operator - o
34362 * (…) any object or primitive - type (string) name of the type, e.g.,
34363 * `string`, `function`, `number`, etc. = (boolean) `true` if given value is of
34368 * \ Snap.snapTo [ method ] * Snaps given value to given grid - values
34369 * (array|number) given array of values or step of the grid - value (number)
34370 * value to adjust - tolerance (number) #optional maximum distance to the target
34371 * value that would trigger the snap. Default is `10`. = (number) adjusted value \
34373 Snap.snapTo = function(values, value, tolerance) {
34374 tolerance = is(tolerance, "finite") ? tolerance : 10;
34375 if (is(values, "array")) {
34376 var i = values.length;
34378 if (abs(values[i] - value) <= tolerance) {
34383 var rem = value % values;
34384 if (rem < tolerance) {
34385 return value - rem;
34387 if (rem > values - tolerance) {
34388 return value - rem + values;
34395 * \ Snap.getRGB [ method ] * Parses color string as RGB object - color (string)
34396 * color string in one of the following formats: # <ul> # <li>Color name (<code>red</code>,
34397 * <code>green</code>, <code>cornflowerblue</code>, etc)</li> # <li>#•••
34398 * � shortened HTML color: (<code>#000</code>, <code>#fc0</code>,
34399 * etc.)</li> # <li>#•••••• � full
34400 * length HTML color: (<code>#000000</code>, <code>#bd2300</code>)</li> #
34401 * <li>rgb(•••, •••, •••)
34402 * � red, green and blue channels values: (<code>rgb(200, 100, 0)</code>)</li> #
34403 * <li>rgba(•••, •••,
34404 * •••, •••) � also with opacity</li> #
34405 * <li>rgb(•••%, •••%,
34406 * •••%) � same as above, but in %: (<code>rgb(100%, 175%, 0%)</code>)</li> #
34407 * <li>rgba(•••%, •••%,
34408 * •••%, •••%) � also with opacity</li> #
34409 * <li>hsb(•••, •••, •••)
34410 * � hue, saturation and brightness values: (<code>hsb(0.5, 0.25, 1)</code>)</li> #
34411 * <li>hsba(•••, •••,
34412 * •••, •••) � also with opacity</li> #
34413 * <li>hsb(•••%, •••%,
34414 * •••%) � same as above, but in %</li> # <li>hsba(•••%,
34415 * •••%, •••%, •••%)
34416 * � also with opacity</li> # <li>hsl(•••,
34417 * •••, •••) � hue, saturation and
34418 * luminosity values: (<code>hsb(0.5, 0.25, 0.5)</code>)</li> #
34419 * <li>hsla(•••, •••,
34420 * •••, •••) � also with opacity</li> #
34421 * <li>hsl(•••%, •••%,
34422 * •••%) � same as above, but in %</li> # <li>hsla(•••%,
34423 * •••%, •••%, •••%)
34424 * � also with opacity</li> # </ul> Note that `%` can be used any time:
34425 * `rgb(20%, 255, 50%)`. = (object) RGB object in the following format: o { o r
34426 * (number) red, o g (number) green, o b (number) blue, o hex (string) color in
34427 * HTML/CSS format: #••••••, o error
34428 * (boolean) true if string can't be parsed o } \
34430 Snap.getRGB = cacher(function(colour) {
34431 if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) {
34438 toString: rgbtoString
34441 if (colour == "none") {
34447 toString: rgbtoString
34449 }!(hsrg[has](colour.toLowerCase().substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour));
34457 toString: rgbtoString
34467 rgb = colour.match(colourRegExp);
34470 blue = toInt(rgb[2].substring(5), 16);
34471 green = toInt(rgb[2].substring(3, 5), 16);
34472 red = toInt(rgb[2].substring(1, 3), 16);
34475 blue = toInt((t = rgb[3].charAt(3)) + t, 16);
34476 green = toInt((t = rgb[3].charAt(2)) + t, 16);
34477 red = toInt((t = rgb[3].charAt(1)) + t, 16);
34480 values = rgb[4].split(commaSpaces);
34481 red = toFloat(values[0]);
34482 values[0].slice(-1) == "%" && (red *= 2.55);
34483 green = toFloat(values[1]);
34484 values[1].slice(-1) == "%" && (green *= 2.55);
34485 blue = toFloat(values[2]);
34486 values[2].slice(-1) == "%" && (blue *= 2.55);
34487 rgb[1].toLowerCase().slice(0, 4) == "rgba" && (opacity = toFloat(values[3]));
34488 values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
34491 values = rgb[5].split(commaSpaces);
34492 red = toFloat(values[0]);
34493 values[0].slice(-1) == "%" && (red /= 100);
34494 green = toFloat(values[1]);
34495 values[1].slice(-1) == "%" && (green /= 100);
34496 blue = toFloat(values[2]);
34497 values[2].slice(-1) == "%" && (blue /= 100);
34498 (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
34499 rgb[1].toLowerCase().slice(0, 4) == "hsba" && (opacity = toFloat(values[3]));
34500 values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
34501 return Snap.hsb2rgb(red, green, blue, opacity);
34504 values = rgb[6].split(commaSpaces);
34505 red = toFloat(values[0]);
34506 values[0].slice(-1) == "%" && (red /= 100);
34507 green = toFloat(values[1]);
34508 values[1].slice(-1) == "%" && (green /= 100);
34509 blue = toFloat(values[2]);
34510 values[2].slice(-1) == "%" && (blue /= 100);
34511 (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360);
34512 rgb[1].toLowerCase().slice(0, 4) == "hsla" && (opacity = toFloat(values[3]));
34513 values[3] && values[3].slice(-1) == "%" && (opacity /= 100);
34514 return Snap.hsl2rgb(red, green, blue, opacity);
34516 red = mmin(math.round(red), 255);
34517 green = mmin(math.round(green), 255);
34518 blue = mmin(math.round(blue), 255);
34519 opacity = mmin(mmax(opacity, 0), 1);
34524 toString: rgbtoString
34526 rgb.hex = "#" + (16777216 | blue | (green << 8) | (red << 16)).toString(16).slice(1);
34527 rgb.opacity = is(opacity, "finite") ? opacity : 1;
34536 toString: rgbtoString
34539 // SIERRA It seems odd that the following 3 conversion methods are not expressed
34540 // as .this2that(), like the others.
34542 * \ Snap.hsb [ method ] * Converts HSB values to a hex representation of the
34543 * color - h (number) hue - s (number) saturation - b (number) value or
34544 * brightness = (string) hex representation of the color \
34546 Snap.hsb = cacher(function(h, s, b) {
34547 return Snap.hsb2rgb(h, s, b).hex;
34550 * \ Snap.hsl [ method ] * Converts HSL values to a hex representation of the
34551 * color - h (number) hue - s (number) saturation - l (number) luminosity =
34552 * (string) hex representation of the color \
34554 Snap.hsl = cacher(function(h, s, l) {
34555 return Snap.hsl2rgb(h, s, l).hex;
34558 * \ Snap.rgb [ method ] * Converts RGB values to a hex representation of the
34559 * color - r (number) red - g (number) green - b (number) blue = (string) hex
34560 * representation of the color \
34562 Snap.rgb = cacher(function(r, g, b, o) {
34563 if (is(o, "finite")) {
34564 var round = math.round;
34565 return "rgba(" + [round(r), round(g), round(b), +o.toFixed(2)] + ")";
34567 return "#" + (16777216 | b | (g << 8) | (r << 16)).toString(16).slice(1);
34569 var toHex = function(color) {
34570 var i = glob.doc.getElementsByTagName("head")[0] || glob.doc.getElementsByTagName("svg")[0],
34571 red = "rgb(255, 0, 0)";
34572 toHex = cacher(function(color) {
34573 if (color.toLowerCase() == "red") {
34576 i.style.color = red;
34577 i.style.color = color;
34578 var out = glob.doc.defaultView.getComputedStyle(i, E).getPropertyValue("color");
34579 return out == red ? null : out;
34581 return toHex(color);
34583 hsbtoString = function() {
34584 return "hsb(" + [this.h, this.s, this.b] + ")";
34586 hsltoString = function() {
34587 return "hsl(" + [this.h, this.s, this.l] + ")";
34589 rgbtoString = function() {
34590 return this.opacity == 1 || this.opacity == null ?
34592 "rgba(" + [this.r, this.g, this.b, this.opacity] + ")";
34594 prepareRGB = function(r, g, b) {
34595 if (g == null && is(r, "object") && "r" in r && "g" in r && "b" in r) {
34600 if (g == null && is(r, string)) {
34601 var clr = Snap.getRGB(r);
34606 if (r > 1 || g > 1 || b > 1) {
34614 packageRGB = function(r, g, b, o) {
34615 r = math.round(r * 255);
34616 g = math.round(g * 255);
34617 b = math.round(b * 255);
34622 opacity: is(o, "finite") ? o : 1,
34623 hex: Snap.rgb(r, g, b),
34624 toString: rgbtoString
34626 is(o, "finite") && (rgb.opacity = o);
34629 // SIERRA Clarify if Snap does not support consolidated HSLA/RGBA colors. E.g.,
34630 // can you specify a semi-transparent value for Snap.filter.shadow()?
34632 * \ Snap.color [ method ] * Parses the color string and returns an object
34633 * featuring the color's component values - clr (string) color string in one of
34634 * the supported formats (see @Snap.getRGB) = (object) Combined RGB/HSB object
34635 * in the following format: o { o r (number) red, o g (number) green, o b
34636 * (number) blue, o hex (string) color in HTML/CSS format:
34637 * #••••••, o error (boolean) `true` if
34638 * string can't be parsed, o h (number) hue, o s (number) saturation, o v
34639 * (number) value (brightness), o l (number) lightness o } \
34641 Snap.color = function(clr) {
34643 if (is(clr, "object") && "h" in clr && "s" in clr && "b" in clr) {
34644 rgb = Snap.hsb2rgb(clr);
34650 } else if (is(clr, "object") && "h" in clr && "s" in clr && "l" in clr) {
34651 rgb = Snap.hsl2rgb(clr);
34658 if (is(clr, "string")) {
34659 clr = Snap.getRGB(clr);
34661 if (is(clr, "object") && "r" in clr && "g" in clr && "b" in clr && !("error" in clr)) {
34662 rgb = Snap.rgb2hsl(clr);
34666 rgb = Snap.rgb2hsb(clr);
34672 clr.r = clr.g = clr.b = clr.h = clr.s = clr.v = clr.l = -1;
34676 clr.toString = rgbtoString;
34680 * \ Snap.hsb2rgb [ method ] * Converts HSB values to an RGB object - h (number)
34681 * hue - s (number) saturation - v (number) value or brightness = (object) RGB
34682 * object in the following format: o { o r (number) red, o g (number) green, o b
34683 * (number) blue, o hex (string) color in HTML/CSS format:
34684 * #•••••• o } \
34686 Snap.hsb2rgb = function(h, s, v, o) {
34687 if (is(h, "object") && "h" in h && "s" in h && "b" in h) {
34695 h = (h % 360) / 60;
34697 X = C * (1 - abs(h % 2 - 1));
34701 R += [C, X, 0, 0, X, C][h];
34702 G += [X, C, C, X, 0, 0][h];
34703 B += [0, 0, X, C, C, X][h];
34704 return packageRGB(R, G, B, o);
34707 * \ Snap.hsl2rgb [ method ] * Converts HSL values to an RGB object - h (number)
34708 * hue - s (number) saturation - l (number) luminosity = (object) RGB object in
34709 * the following format: o { o r (number) red, o g (number) green, o b (number)
34710 * blue, o hex (string) color in HTML/CSS format:
34711 * #•••••• o } \
34713 Snap.hsl2rgb = function(h, s, l, o) {
34714 if (is(h, "object") && "h" in h && "s" in h && "l" in h) {
34719 if (h > 1 || s > 1 || l > 1) {
34726 h = (h % 360) / 60;
34727 C = 2 * s * (l < .5 ? l : 1 - l);
34728 X = C * (1 - abs(h % 2 - 1));
34729 R = G = B = l - C / 2;
34732 R += [C, X, 0, 0, X, C][h];
34733 G += [X, C, C, X, 0, 0][h];
34734 B += [0, 0, X, C, C, X][h];
34735 return packageRGB(R, G, B, o);
34738 * \ Snap.rgb2hsb [ method ] * Converts RGB values to an HSB object - r (number)
34739 * red - g (number) green - b (number) blue = (object) HSB object in the
34740 * following format: o { o h (number) hue, o s (number) saturation, o b (number)
34743 Snap.rgb2hsb = function(r, g, b) {
34744 b = prepareRGB(r, g, b);
34751 C = V - mmin(r, g, b);
34752 H = (C == 0 ? null :
34753 V == r ? (g - b) / C :
34754 V == g ? (b - r) / C + 2 :
34757 H = ((H + 360) % 6) * 60 / 360;
34758 S = C == 0 ? 0 : C / V;
34763 toString: hsbtoString
34767 * \ Snap.rgb2hsl [ method ] * Converts RGB values to an HSL object - r (number)
34768 * red - g (number) green - b (number) blue = (object) HSL object in the
34769 * following format: o { o h (number) hue, o s (number) saturation, o l (number)
34772 Snap.rgb2hsl = function(r, g, b) {
34773 b = prepareRGB(r, g, b);
34778 var H, S, L, M, m, C;
34782 H = (C == 0 ? null :
34783 M == r ? (g - b) / C :
34784 M == g ? (b - r) / C + 2 :
34786 H = ((H + 360) % 6) * 60 / 360;
34789 L < .5 ? C / (2 * L) :
34795 toString: hsltoString
34800 // SIERRA Snap.parsePathString(): By _array of arrays,_ I assume you mean a
34801 // format like this for two separate segments? [ ["M10,10","L90,90"],
34802 // ["M90,10","L10,90"] ] Otherwise how is each command structured?
34804 * \ Snap.parsePathString [ method ] * Utility method * Parses given path string
34805 * into an array of arrays of path segments - pathString (string|array) path
34806 * string or array of segments (in the last case it is returned straight away) =
34807 * (array) array of segments \
34809 Snap.parsePathString = function(pathString) {
34813 var pth = Snap.path(pathString);
34815 return Snap.path.clone(pth.arr);
34818 var paramCounts = {
34834 if (is(pathString, "array") && is(pathString[0], "array")) { // rough
34836 data = Snap.path.clone(pathString);
34838 if (!data.length) {
34839 Str(pathString).replace(pathCommand, function(a, b, c) {
34841 name = b.toLowerCase();
34842 c.replace(pathValues, function(a, b) {
34843 b && params.push(+b);
34845 if (name == "m" && params.length > 2) {
34846 data.push([b].concat(params.splice(0, 2)));
34848 b = b == "m" ? "l" : "L";
34850 if (name == "o" && params.length == 1) {
34851 data.push([b, params[0]]);
34854 data.push([b].concat(params));
34856 while (params.length >= paramCounts[name]) {
34857 data.push([b].concat(params.splice(0, paramCounts[name])));
34858 if (!paramCounts[name]) {
34864 data.toString = Snap.path.toString;
34865 pth.arr = Snap.path.clone(data);
34869 * \ Snap.parseTransformString [ method ] * Utility method * Parses given
34870 * transform string into an array of transformations - TString (string|array)
34871 * transform string or array of transformations (in the last case it is returned
34872 * straight away) = (array) array of transformations \
34874 var parseTransformString = Snap.parseTransformString = function(TString) {
34878 var paramCounts = {
34885 if (is(TString, "array") && is(TString[0], "array")) { // rough assumption
34886 data = Snap.path.clone(TString);
34888 if (!data.length) {
34889 Str(TString).replace(tCommand, function(a, b, c) {
34891 name = b.toLowerCase();
34892 c.replace(pathValues, function(a, b) {
34893 b && params.push(+b);
34895 data.push([b].concat(params));
34898 data.toString = Snap.path.toString;
34902 function svgTransform2string(tstr) {
34904 tstr = tstr.replace(/(?:^|\s)(\w+)\(([^)]+)\)/g, function(all, name, params) {
34905 params = params.split(/\s*,\s*|\s+/);
34906 if (name == "rotate" && params.length == 1) {
34909 if (name == "scale") {
34910 if (params.length > 2) {
34911 params = params.slice(0, 2);
34912 } else if (params.length == 2) {
34915 if (params.length == 1) {
34916 params.push(params[0], 0, 0);
34919 if (name == "skewX") {
34920 res.push(["m", 1, 0, math.tan(rad(params[0])), 1, 0, 0]);
34921 } else if (name == "skewY") {
34922 res.push(["m", 1, math.tan(rad(params[0])), 0, 1, 0, 0]);
34924 res.push([name.charAt(0)].concat(params));
34930 Snap._.svgTransform2string = svgTransform2string;
34931 Snap._.rgTransform = /^[a-z][\s]*-?\.?\d/i;
34933 function transform2matrix(tstr, bbox) {
34934 var tdata = parseTransformString(tstr),
34935 m = new Snap.Matrix;
34937 for (var i = 0, ii = tdata.length; i < ii; i++) {
34940 command = Str(t[0]).toLowerCase(),
34941 absolute = t[0] != command,
34942 inver = absolute ? m.invert() : 0,
34948 if (command == "t" && tlen == 2) {
34949 m.translate(t[1], 0);
34950 } else if (command == "t" && tlen == 3) {
34952 x1 = inver.x(0, 0);
34953 y1 = inver.y(0, 0);
34954 x2 = inver.x(t[1], t[2]);
34955 y2 = inver.y(t[1], t[2]);
34956 m.translate(x2 - x1, y2 - y1);
34958 m.translate(t[1], t[2]);
34960 } else if (command == "r") {
34963 m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2);
34964 } else if (tlen == 4) {
34966 x2 = inver.x(t[2], t[3]);
34967 y2 = inver.y(t[2], t[3]);
34968 m.rotate(t[1], x2, y2);
34970 m.rotate(t[1], t[2], t[3]);
34973 } else if (command == "s") {
34974 if (tlen == 2 || tlen == 3) {
34976 m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2);
34977 } else if (tlen == 4) {
34979 x2 = inver.x(t[2], t[3]);
34980 y2 = inver.y(t[2], t[3]);
34981 m.scale(t[1], t[1], x2, y2);
34983 m.scale(t[1], t[1], t[2], t[3]);
34985 } else if (tlen == 5) {
34987 x2 = inver.x(t[3], t[4]);
34988 y2 = inver.y(t[3], t[4]);
34989 m.scale(t[1], t[2], x2, y2);
34991 m.scale(t[1], t[2], t[3], t[4]);
34994 } else if (command == "m" && tlen == 7) {
34995 m.add(t[1], t[2], t[3], t[4], t[5], t[6]);
35001 Snap._.transform2matrix = transform2matrix;
35002 Snap._unit2px = unit2px;
35003 var contains = glob.doc.contains || glob.doc.compareDocumentPosition ?
35005 var adown = a.nodeType == 9 ? a.documentElement : a,
35006 bup = b && b.parentNode;
35007 return a == bup || !!(bup && bup.nodeType == 1 && (
35009 adown.contains(bup) :
35010 a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
35025 function getSomeDefs(el) {
35026 var p = (el.node.ownerSVGElement && wrap(el.node.ownerSVGElement)) ||
35027 (el.node.parentNode && wrap(el.node.parentNode)) ||
35028 Snap.select("svg") ||
35030 pdefs = p.select("defs"),
35031 defs = pdefs == null ? false : pdefs.node;
35033 defs = make("defs", p.node).node;
35038 function getSomeSVG(el) {
35039 return el.node.ownerSVGElement && wrap(el.node.ownerSVGElement) || Snap.select("svg");
35041 Snap._.getSomeDefs = getSomeDefs;
35042 Snap._.getSomeSVG = getSomeSVG;
35044 function unit2px(el, name, value) {
35045 var svg = getSomeSVG(el).node,
35047 mgr = svg.querySelector(".svg---mgr");
35055 "class": "svg---mgr",
35058 svg.appendChild(mgr);
35061 function getW(val) {
35072 return mgr.getBBox().width;
35078 function getH(val) {
35089 return mgr.getBBox().height;
35095 function set(nam, f) {
35096 if (name == null) {
35097 out[nam] = f(el.attr(nam) || 0);
35098 } else if (nam == name) {
35099 out = f(value == null ? el.attr(nam) || 0 : value);
35107 set("width", getW);
35108 set("height", getH);
35132 set("markerWidth", getW);
35134 set("markerHeight", getH);
35136 case "radialGradient":
35147 svg.removeChild(mgr);
35151 * \ Snap.select [ method ] * Wraps a DOM element specified by CSS selector as
35152 * @Element - query (string) CSS selector of the element = (Element) the current
35155 Snap.select = function(query) {
35156 query = Str(query).replace(/([^\\]):/g, "$1\\:");
35157 return wrap(glob.doc.querySelector(query));
35160 * \ Snap.selectAll [ method ] * Wraps DOM elements specified by CSS selector as
35161 * set or array of @Element - query (string) CSS selector of the element =
35162 * (Element) the current element \
35164 Snap.selectAll = function(query) {
35165 var nodelist = glob.doc.querySelectorAll(query),
35166 set = (Snap.set || Array)();
35167 for (var i = 0; i < nodelist.length; i++) {
35168 set.push(wrap(nodelist[i]));
35173 function add2group(list) {
35174 if (!is(list, "array")) {
35175 list = Array.prototype.slice.call(arguments, 0);
35180 while (this[i]) delete this[i++];
35181 for (i = 0; i < list.length; i++) {
35182 if (list[i].type == "set") {
35183 list[i].forEach(function(el) {
35184 node.appendChild(el.node);
35187 node.appendChild(list[i].node);
35190 var children = node.childNodes;
35191 for (i = 0; i < children.length; i++) {
35192 this[j++] = wrap(children[i]);
35196 // Hub garbage collector every 10s
35197 setInterval(function() {
35198 for (var key in hub)
35199 if (hub[has](key)) {
35202 if (el.type != "svg" && !node.ownerSVGElement || el.type == "svg" && (!node.parentNode || "ownerSVGElement" in node.parentNode && !node.ownerSVGElement)) {
35208 function Element(el) {
35209 if (el.snap in hub) {
35210 return hub[el.snap];
35214 svg = el.ownerSVGElement;
35217 * \ Element.node [ property (object) ] * Gives you a reference to the DOM
35218 * object, so you can assign event handlers or just mess around. > Usage | //
35219 * draw a circle at coordinate 10,10 with radius of 10 | var c =
35220 * paper.circle(10, 10, 10); | c.node.onclick = function () { |
35221 * c.attr("fill", "red"); | }; \
35225 this.paper = new Paper(svg);
35228 * \ Element.type [ property (string) ] * SVG tag name of the given element. \
35230 this.type = el.tagName;
35231 var id = this.id = ID(this);
35238 if (this.type == "g") {
35239 this.add = add2group;
35247 for (var method in Paper.prototype)
35248 if (Paper.prototype[has](method)) {
35249 this[method] = Paper.prototype[method];
35254 * \ Element.attr [ method ] * Gets or sets given attributes of the element. * -
35255 * params (object) contains key-value pairs of attributes you want to set or -
35256 * param (string) name of the attribute = (Element) the current element or =
35257 * (string) value of attribute > Usage | el.attr({ | fill: "#fc0", | stroke:
35258 * "#000", | strokeWidth: 2, // CamelCase... | "fill-opacity": 0.5, // or
35259 * dash-separated names | width: "*=2" // prefixed values | }); |
35260 * console.log(el.attr("fill")); // #fc0 Prefixed values in format `"+=10"`
35261 * supported. All four operations (`+`, `-`, `*` and `/`) could be used.
35262 * Optionally you can use units for `+` and `-`: `"+=2em"`. \
35264 Element.prototype.attr = function(params, value) {
35270 if (is(params, "string")) {
35271 if (arguments.length > 1) {
35273 json[params] = value;
35276 return eve("snap.util.getattr." + params, el).firstDefined();
35279 for (var att in params) {
35280 if (params[has](att)) {
35281 eve("snap.util.attr." + att, el, params[att]);
35287 * \ Snap.parse [ method ] * Parses SVG fragment and converts it into a
35288 * @Fragment * - svg (string) SVG string = (Fragment) the @Fragment \
35290 Snap.parse = function(svg) {
35291 var f = glob.doc.createDocumentFragment(),
35293 div = glob.doc.createElement("div");
35295 if (!svg.match(/^\s*<\s*svg(?:\s|>)/)) {
35296 svg = "<svg>" + svg + "</svg>";
35299 div.innerHTML = svg;
35300 svg = div.getElementsByTagName("svg")[0];
35305 while (svg.firstChild) {
35306 f.appendChild(svg.firstChild);
35311 return new Fragment(f);
35314 function Fragment(frag) {
35317 // SIERRA Snap.fragment() could especially use a code example
35319 * \ Snap.fragment [ method ] * Creates a DOM fragment from a given list of
35320 * elements or strings * - varargs (…) SVG string = (Fragment) the
35323 Snap.fragment = function() {
35324 var args = Array.prototype.slice.call(arguments, 0),
35325 f = glob.doc.createDocumentFragment();
35326 for (var i = 0, ii = args.length; i < ii; i++) {
35327 var item = args[i];
35328 if (item.node && item.node.nodeType) {
35329 f.appendChild(item.node);
35331 if (item.nodeType) {
35332 f.appendChild(item);
35334 if (typeof item == "string") {
35335 f.appendChild(Snap.parse(item).node);
35338 return new Fragment(f);
35341 function make(name, parent) {
35343 parent.appendChild(res);
35344 var el = wrap(res);
35348 function Paper(w, h) {
35352 proto = Paper.prototype;
35353 if (w && w.tagName == "svg") {
35354 if (w.snap in hub) {
35355 return hub[w.snap];
35357 var doc = w.ownerDocument;
35358 res = new Element(w);
35359 desc = w.getElementsByTagName("desc")[0];
35360 defs = w.getElementsByTagName("defs")[0];
35363 desc.appendChild(doc.createTextNode("Created with Snap"));
35364 res.node.appendChild(desc);
35368 res.node.appendChild(defs);
35371 for (var key in proto)
35372 if (proto[has](key)) {
35373 res[key] = proto[key];
35375 res.paper = res.root = res;
35377 res = make("svg", glob.doc.body);
35388 function wrap(dom) {
35392 if (dom instanceof Element || dom instanceof Fragment) {
35395 if (dom.tagName && dom.tagName.toLowerCase() == "svg") {
35396 return new Paper(dom);
35398 if (dom.tagName && dom.tagName.toLowerCase() == "object" && dom.type == "image/svg+xml") {
35399 return new Paper(dom.contentDocument.getElementsByTagName("svg")[0]);
35401 return new Element(dom);
35404 Snap._.make = make;
35405 Snap._.wrap = wrap;
35407 * \ Paper.el [ method ] * Creates an element on paper with a given name and no
35408 * attributes * - name (string) tag name - attr (object) attributes = (Element)
35409 * the current element > Usage | var c = paper.circle(10, 10, 10); // is the
35410 * same as... | var c = paper.el("circle").attr({ | cx: 10, | cy: 10, | r: 10 |
35411 * }); | // and the same as | var c = paper.el("circle", { | cx: 10, | cy: 10, |
35414 Paper.prototype.el = function(name, attr) {
35415 var el = make(name, this.node);
35416 attr && el.attr(attr);
35420 eve.on("snap.util.getattr", function() {
35421 var att = eve.nt();
35422 att = att.substring(att.lastIndexOf(".") + 1);
35423 var css = att.replace(/[A-Z]/g, function(letter) {
35424 return "-" + letter.toLowerCase();
35426 if (cssAttr[has](css)) {
35427 return this.node.ownerDocument.defaultView.getComputedStyle(this.node, null).getPropertyValue(css);
35429 return $(this.node, att);
35433 "alignment-baseline": 0,
35434 "baseline-shift": 0,
35439 "color-interpolation": 0,
35440 "color-interpolation-filters": 0,
35441 "color-profile": 0,
35442 "color-rendering": 0,
35446 "dominant-baseline": 0,
35447 "enable-background": 0,
35453 "flood-opacity": 0,
35457 "font-size-adjust": 0,
35462 "glyph-orientation-horizontal": 0,
35463 "glyph-orientation-vertical": 0,
35464 "image-rendering": 0,
35466 "letter-spacing": 0,
35467 "lighting-color": 0,
35475 "pointer-events": 0,
35476 "shape-rendering": 0,
35480 "stroke-dasharray": 0,
35481 "stroke-dashoffset": 0,
35482 "stroke-linecap": 0,
35483 "stroke-linejoin": 0,
35484 "stroke-miterlimit": 0,
35485 "stroke-opacity": 0,
35488 "text-decoration": 0,
35489 "text-rendering": 0,
35496 eve.on("snap.util.attr", function(value) {
35497 var att = eve.nt(),
35499 att = att.substring(att.lastIndexOf(".") + 1);
35501 var style = att.replace(/-(\w)/gi, function(all, letter) {
35502 return letter.toUpperCase();
35504 css = att.replace(/[A-Z]/g, function(letter) {
35505 return "-" + letter.toLowerCase();
35507 if (cssAttr[has](css)) {
35508 this.node.style[style] = value == null ? E : value;
35510 $(this.node, attr);
35513 (function(proto) {}(Paper.prototype));
35517 * \ Snap.ajax [ method ] * Simple implementation of Ajax * - url (string) URL -
35518 * postData (object|string) data for post request - callback (function) callback -
35519 * scope (object) #optional scope of callback or - url (string) URL - callback
35520 * (function) callback - scope (object) #optional scope of callback =
35521 * (XMLHttpRequest) the XMLHttpRequest object, just in case \
35523 Snap.ajax = function(url, postData, callback, scope) {
35524 var req = new XMLHttpRequest,
35527 if (is(postData, "function")) {
35529 callback = postData;
35531 } else if (is(postData, "object")) {
35533 for (var key in postData)
35534 if (postData.hasOwnProperty(key)) {
35535 pd.push(encodeURIComponent(key) + "=" + encodeURIComponent(postData[key]));
35537 postData = pd.join("&");
35539 req.open((postData ? "POST" : "GET"), url, true);
35541 req.setRequestHeader("X-Requested-With", "XMLHttpRequest");
35542 req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
35545 eve.once("snap.ajax." + id + ".0", callback);
35546 eve.once("snap.ajax." + id + ".200", callback);
35547 eve.once("snap.ajax." + id + ".304", callback);
35549 req.onreadystatechange = function() {
35550 if (req.readyState != 4) return;
35551 eve("snap.ajax." + id + "." + req.status, scope, req);
35553 if (req.readyState == 4) {
35556 req.send(postData);
35561 * \ Snap.load [ method ] * Loads external SVG file as a @Fragment (see
35562 * @Snap.ajax for more advanced AJAX) * - url (string) URL - callback (function)
35563 * callback - scope (object) #optional scope of callback \
35565 Snap.load = function(url, callback, scope) {
35566 Snap.ajax(url, function(req) {
35567 var f = Snap.parse(req.responseText);
35568 scope ? callback.call(scope, f) : callback(f);
35571 var getOffset = function(elem) {
35572 var box = elem.getBoundingClientRect(),
35573 doc = elem.ownerDocument,
35575 docElem = doc.documentElement,
35576 clientTop = docElem.clientTop || body.clientTop || 0,
35577 clientLeft = docElem.clientLeft || body.clientLeft || 0,
35578 top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop) - clientTop,
35579 left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft;
35586 * \ Snap.getElementByPoint [ method ] * Returns you topmost element under given
35587 * point. * = (object) Snap element object - x (number) x coordinate from the
35588 * top left corner of the window - y (number) y coordinate from the top left
35589 * corner of the window > Usage | Snap.getElementByPoint(mouseX,
35590 * mouseY).attr({stroke: "#f00"}); \
35592 Snap.getElementByPoint = function(x, y) {
35594 svg = paper.canvas,
35595 target = glob.doc.elementFromPoint(x, y);
35596 if (glob.win.opera && target.tagName == "svg") {
35597 var so = getOffset(target),
35598 sr = target.createSVGRect();
35601 sr.width = sr.height = 1;
35602 var hits = target.getIntersectionList(sr, null);
35604 target = hits[hits.length - 1];
35610 return wrap(target);
35613 * \ Snap.plugin [ method ] * Let you write plugins. You pass in a function with
35614 * four arguments, like this: | Snap.plugin(function (Snap, Element, Paper,
35615 * global, Fragment) { | Snap.newmethod = function () {}; |
35616 * Element.prototype.newmethod = function () {}; | Paper.prototype.newmethod =
35617 * function () {}; | }); Inside the function you have access to all main objects
35618 * (and their prototypes). This allow you to extend anything you want. * - f
35619 * (function) your plugin body \
35621 Snap.plugin = function(f) {
35622 f(Snap, Element, Paper, glob, Fragment);
35624 glob.win.Snap = Snap;
35626 }(window || this));
35627 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
35629 // Licensed under the Apache License, Version 2.0 (the "License");
35630 // you may not use this file except in compliance with the License.
35631 // You may obtain a copy of the License at
35633 // http://www.apache.org/licenses/LICENSE-2.0
35635 // Unless required by applicable law or agreed to in writing, software
35636 // distributed under the License is distributed on an "AS IS" BASIS,
35637 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35638 // See the License for the specific language governing permissions and
35639 // limitations under the License.
35640 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
35641 var elproto = Element.prototype,
35644 unit2px = Snap._unit2px,
35646 make = Snap._.make,
35647 getSomeDefs = Snap._.getSomeDefs,
35648 has = "hasOwnProperty",
35649 wrap = Snap._.wrap;
35651 * \ Element.getBBox [ method ] * Returns the bounding box descriptor for
35652 * the given element * = (object) bounding box descriptor: o { o cx:
35653 * (number) x of the center, o cy: (number) x of the center, o h: (number)
35654 * height, o height: (number) height, o path: (string) path command for the
35655 * box, o r0: (number) radius of a circle that fully encloses the box, o r1:
35656 * (number) radius of the smallest circle that can be enclosed, o r2:
35657 * (number) radius of the largest circle that can be enclosed, o vb:
35658 * (string) box as a viewbox command, o w: (number) width, o width: (number)
35659 * width, o x2: (number) x of the right side, o x: (number) x of the left
35660 * side, o y2: (number) y of the bottom edge, o y: (number) y of the top
35663 elproto.getBBox = function(isWithoutTransform) {
35664 if (!Snap.Matrix || !Snap.path) {
35665 return this.node.getBBox();
35668 m = new Snap.Matrix;
35670 return Snap._.box();
35672 while (el.type == "use") {
35673 if (!isWithoutTransform) {
35674 m = m.add(el.transform().localMatrix.translate(el.attr("x") || 0, el.attr("y") || 0));
35679 var href = el.attr("xlink:href");
35680 el = el.original = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
35684 pathfinder = Snap.path.get[el.type] || Snap.path.get.deflt;
35686 if (isWithoutTransform) {
35687 _.bboxwt = pathfinder ? Snap.path.getBBox(el.realPath = pathfinder(el)) : Snap._.box(el.node.getBBox());
35688 return Snap._.box(_.bboxwt);
35690 el.realPath = pathfinder(el);
35691 el.matrix = el.transform().localMatrix;
35692 _.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
35693 return Snap._.box(_.bbox);
35696 // Firefox doesn’t give you bbox of hidden element
35697 return Snap._.box();
35700 var propString = function() {
35701 return this.string;
35704 function extractTransform(el, tstr) {
35705 if (tstr == null) {
35706 var doReturn = true;
35707 if (el.type == "linearGradient" || el.type == "radialGradient") {
35708 tstr = el.node.getAttribute("gradientTransform");
35709 } else if (el.type == "pattern") {
35710 tstr = el.node.getAttribute("patternTransform");
35712 tstr = el.node.getAttribute("transform");
35715 return new Snap.Matrix;
35717 tstr = Snap._.svgTransform2string(tstr);
35719 if (!Snap._.rgTransform.test(tstr)) {
35720 tstr = Snap._.svgTransform2string(tstr);
35722 tstr = Str(tstr).replace(/\.{3}|\u2026/g, el._.transform || E);
35724 if (is(tstr, "array")) {
35725 tstr = Snap.path ? Snap.path.toString.call(tstr) : Str(tstr);
35727 el._.transform = tstr;
35729 var m = Snap._.transform2matrix(tstr, el.getBBox(1));
35737 * \ Element.transform [ method ] * Gets or sets transformation of the
35738 * element * - tstr (string) transform string in Snap or SVG format =
35739 * (Element) the current element or = (object) transformation descriptor: o {
35740 * o string (string) transform string, o globalMatrix (Matrix) matrix of all
35741 * transformations applied to element or its parents, o localMatrix (Matrix)
35742 * matrix of transformations applied only to the element, o diffMatrix
35743 * (Matrix) matrix of difference between global and local transformations, o
35744 * global (string) global transformation as string, o local (string) local
35745 * transformation as string, o toString (function) returns `string` property
35748 elproto.transform = function(tstr) {
35750 if (tstr == null) {
35752 global = new Snap.Matrix(this.node.getCTM()),
35753 local = extractTransform(this),
35755 m = new Snap.Matrix,
35757 localString = local.toTransformString(),
35758 string = Str(local) == Str(this.matrix) ?
35759 Str(_.transform) : localString;
35760 while (papa.type != "svg" && (papa = papa.parent())) {
35761 ms.push(extractTransform(papa));
35769 globalMatrix: global,
35771 localMatrix: local,
35772 diffMatrix: global.clone().add(local.invert()),
35773 global: global.toTransformString(),
35774 total: m.toTransformString(),
35775 local: localString,
35776 toString: propString
35779 if (tstr instanceof Snap.Matrix) {
35780 this.matrix = tstr;
35781 this._.transform = tstr.toTransformString();
35783 extractTransform(this, tstr);
35787 if (this.type == "linearGradient" || this.type == "radialGradient") {
35789 gradientTransform: this.matrix
35791 } else if (this.type == "pattern") {
35793 patternTransform: this.matrix
35797 transform: this.matrix
35805 * \ Element.parent [ method ] * Returns the element's parent * = (Element)
35806 * the parent element \
35808 elproto.parent = function() {
35809 return wrap(this.node.parentNode);
35812 * \ Element.append [ method ] * Appends the given element to current one * -
35813 * el (Element|Set) element to append = (Element) the parent element \
35816 * \ Element.add [ method ] * See @Element.append \
35818 elproto.append = elproto.add = function(el) {
35820 if (el.type == "set") {
35822 el.forEach(function(el) {
35828 this.node.appendChild(el.node);
35829 el.paper = this.paper;
35834 * \ Element.appendTo [ method ] * Appends the current element to the given
35835 * one * - el (Element) parent element to append to = (Element) the child
35838 elproto.appendTo = function(el) {
35846 * \ Element.prepend [ method ] * Prepends the given element to the current
35847 * one * - el (Element) element to prepend = (Element) the parent element \
35849 elproto.prepend = function(el) {
35851 if (el.type == "set") {
35854 el.forEach(function(el) {
35865 var parent = el.parent();
35866 this.node.insertBefore(el.node, this.node.firstChild);
35867 this.add && this.add();
35868 el.paper = this.paper;
35869 this.parent() && this.parent().add();
35870 parent && parent.add();
35875 * \ Element.prependTo [ method ] * Prepends the current element to the
35876 * given one * - el (Element) parent element to prepend to = (Element) the
35879 elproto.prependTo = function(el) {
35885 * \ Element.before [ method ] * Inserts given element before the current
35886 * one * - el (Element) element to insert = (Element) the parent element \
35888 elproto.before = function(el) {
35889 if (el.type == "set") {
35891 el.forEach(function(el) {
35892 var parent = el.parent();
35893 it.node.parentNode.insertBefore(el.node, it.node);
35894 parent && parent.add();
35896 this.parent().add();
35900 var parent = el.parent();
35901 this.node.parentNode.insertBefore(el.node, this.node);
35902 this.parent() && this.parent().add();
35903 parent && parent.add();
35904 el.paper = this.paper;
35908 * \ Element.after [ method ] * Inserts given element after the current one * -
35909 * el (Element) element to insert = (Element) the parent element \
35911 elproto.after = function(el) {
35913 var parent = el.parent();
35914 if (this.node.nextSibling) {
35915 this.node.parentNode.insertBefore(el.node, this.node.nextSibling);
35917 this.node.parentNode.appendChild(el.node);
35919 this.parent() && this.parent().add();
35920 parent && parent.add();
35921 el.paper = this.paper;
35925 * \ Element.insertBefore [ method ] * Inserts the element after the given
35926 * one * - el (Element) element next to whom insert to = (Element) the
35929 elproto.insertBefore = function(el) {
35931 var parent = this.parent();
35932 el.node.parentNode.insertBefore(this.node, el.node);
35933 this.paper = el.paper;
35934 parent && parent.add();
35935 el.parent() && el.parent().add();
35939 * \ Element.insertAfter [ method ] * Inserts the element after the given
35940 * one * - el (Element) element next to whom insert to = (Element) the
35943 elproto.insertAfter = function(el) {
35945 var parent = this.parent();
35946 el.node.parentNode.insertBefore(this.node, el.node.nextSibling);
35947 this.paper = el.paper;
35948 parent && parent.add();
35949 el.parent() && el.parent().add();
35953 * \ Element.remove [ method ] * Removes element from the DOM = (Element)
35954 * the detached element \
35956 elproto.remove = function() {
35957 var parent = this.parent();
35958 this.node.parentNode && this.node.parentNode.removeChild(this.node);
35960 this.removed = true;
35961 parent && parent.add();
35965 * \ Element.select [ method ] * Gathers the nested @Element matching the
35966 * given set of CSS selectors * - query (string) CSS selector = (Element)
35967 * result of query selection \
35969 elproto.select = function(query) {
35970 query = Str(query).replace(/([^\\]):/g, "$1\\:");
35971 return wrap(this.node.querySelector(query));
35974 * \ Element.selectAll [ method ] * Gathers nested @Element objects matching
35975 * the given set of CSS selectors * - query (string) CSS selector =
35976 * (Set|array) result of query selection \
35978 elproto.selectAll = function(query) {
35979 var nodelist = this.node.querySelectorAll(query),
35980 set = (Snap.set || Array)();
35981 for (var i = 0; i < nodelist.length; i++) {
35982 set.push(wrap(nodelist[i]));
35987 * \ Element.asPX [ method ] * Returns given attribute of the element as a
35988 * `px` value (not %, em, etc.) * - attr (string) attribute name - value
35989 * (string) #optional attribute value = (Element) result of query selection \
35991 elproto.asPX = function(attr, value) {
35992 if (value == null) {
35993 value = this.attr(attr);
35995 return +unit2px(this, attr, value);
35997 // SIERRA Element.use(): I suggest adding a note about how to access the
35998 // original element the returned <use> instantiates. It's a part of SVG with
35999 // which ordinary web developers may be least familiar.
36001 * \ Element.use [ method ] * Creates a `<use>` element linked to the
36002 * current element * = (Element) the `<use>` element \
36004 elproto.use = function() {
36013 if (this.type == "linearGradient" || this.type == "radialGradient" ||
36014 this.type == "pattern") {
36015 use = make(this.type, this.node.parentNode);
36017 use = make("use", this.node.parentNode);
36020 "xlink:href": "#" + id
36022 use.original = this;
36026 function fixids(el) {
36027 var els = el.selectAll("*"),
36029 url = /^\s*url\(("|'|)(.*)\1\)\s*$/,
36033 function urltest(it, name) {
36034 var val = $(it.node, name);
36035 val = val && val.match(url);
36036 val = val && val[2];
36037 if (val && val.charAt() == "#") {
36038 val = val.substring(1);
36043 uses[val] = (uses[val] || []).concat(function(id) {
36045 attr[name] = URL(id);
36051 function linktest(it) {
36052 var val = $(it.node, "xlink:href");
36053 if (val && val.charAt() == "#") {
36054 val = val.substring(1);
36059 uses[val] = (uses[val] || []).concat(function(id) {
36060 it.attr("xlink:href", "#" + id);
36064 for (var i = 0, ii = els.length; i < ii; i++) {
36066 urltest(it, "fill");
36067 urltest(it, "stroke");
36068 urltest(it, "filter");
36069 urltest(it, "mask");
36070 urltest(it, "clip-path");
36072 var oldid = $(it.node, "id");
36083 for (i = 0, ii = ids.length; i < ii; i++) {
36084 var fs = uses[ids[i].old];
36086 for (var j = 0, jj = fs.length; j < jj; j++) {
36093 * \ Element.clone [ method ] * Creates a clone of the element and inserts
36094 * it after the element * = (Element) the clone \
36096 elproto.clone = function() {
36097 var clone = wrap(this.node.cloneNode(true));
36098 if ($(clone.node, "id")) {
36104 clone.insertAfter(this);
36108 * \ Element.toDefs [ method ] * Moves element to the shared `<defs>` area * =
36109 * (Element) the element \
36111 elproto.toDefs = function() {
36112 var defs = getSomeDefs(this);
36113 defs.appendChild(this.node);
36117 * \ Element.toPattern [ method ] * Creates a `<pattern>` element from the
36118 * current element * To create a pattern you have to specify the pattern
36119 * rect: - x (string|number) - y (string|number) - width (string|number) -
36120 * height (string|number) = (Element) the `<pattern>` element You can use
36121 * pattern later on as an argument for `fill` attribute: | var p =
36122 * paper.path("M10-5-10,15M15,0,0,15M0-5-20,15").attr({ | fill: "none", |
36123 * stroke: "#bada55", | strokeWidth: 5 | }).pattern(0, 0, 10, 10), | c =
36124 * paper.circle(200, 200, 100); | c.attr({ | fill: p | }); \
36126 elproto.pattern = elproto.toPattern = function(x, y, width, height) {
36127 var p = make("pattern", getSomeDefs(this));
36129 x = this.getBBox();
36131 if (is(x, "object") && "x" in x) {
36142 patternUnits: "userSpaceOnUse",
36144 viewBox: [x, y, width, height].join(" ")
36146 p.node.appendChild(this.node);
36149 // SIERRA Element.marker(): clarify what a reference point is. E.g., helps you
36150 // offset the object from its edge such as when centering it over a path.
36151 // SIERRA Element.marker(): I suggest the method should accept default reference
36152 // point values. Perhaps centered with (refX = width/2) and (refY = height/2)?
36153 // Also, couldn't it assume the element's current _width_ and _height_? And
36154 // please specify what _x_ and _y_ mean: offsets? If so, from where? Couldn't
36155 // they also be assigned default values?
36157 * \ Element.marker [ method ] * Creates a `<marker>` element from the
36158 * current element * To create a marker you have to specify the bounding
36159 * rect and reference point: - x (number) - y (number) - width (number) -
36160 * height (number) - refX (number) - refY (number) = (Element) the `<marker>`
36161 * element You can specify the marker later as an argument for
36162 * `marker-start`, `marker-end`, `marker-mid`, and `marker` attributes. The
36163 * `marker` attribute places the marker at every point along the path, and
36164 * `marker-mid` places them at every point except the start and end. \
36166 // TODO add usage for markers
36167 elproto.marker = function(x, y, width, height, refX, refY) {
36168 var p = make("marker", getSomeDefs(this));
36170 x = this.getBBox();
36172 if (is(x, "object") && "x" in x) {
36176 refX = x.refX || x.cx;
36177 refY = x.refY || x.cy;
36181 viewBox: [x, y, width, height].join(" "),
36182 markerWidth: width,
36183 markerHeight: height,
36189 p.node.appendChild(this.node);
36193 function slice(from, to, f) {
36194 return function(arr) {
36195 var res = arr.slice(from, to);
36196 if (res.length == 1) {
36199 return f ? f(res) : res;
36202 var Animation = function(attr, ms, easing, callback) {
36203 if (typeof easing == "function" && !easing.length) {
36205 easing = mina.linear;
36209 easing && (this.easing = easing);
36210 callback && (this.callback = callback);
36212 Snap._.Animation = Animation;
36214 * \ Snap.animation [ method ] * Creates an animation object * - attr
36215 * (object) attributes of final destination - duration (number) duration of
36216 * the animation, in milliseconds - easing (function) #optional one of
36217 * easing functions of @mina or custom one - callback (function) #optional
36218 * callback function that fires when animation ends = (object) animation
36221 Snap.animation = function(attr, ms, easing, callback) {
36222 return new Animation(attr, ms, easing, callback);
36225 * \ Element.inAnim [ method ] * Returns a set of animations that may be
36226 * able to manipulate the current element * = (object) in format: o { o anim
36227 * (object) animation object, o mina (object) @mina object, o curStatus
36228 * (number) 0..1 � status of the animation: 0 � just started,
36229 * 1 � just finished, o status (function) gets or sets the status of
36230 * the animation, o stop (function) stops the animation o } \
36232 elproto.inAnim = function() {
36235 for (var id in el.anims)
36236 if (el.anims[has](id)) {
36239 anim: new Animation(a._attrs, a.dur, a.easing, a._callback),
36241 curStatus: a.status(),
36242 status: function(val) {
36243 return a.status(val);
36254 * \ Snap.animate [ method ] * Runs generic animation of one number into
36255 * another with a caring function * - from (number|array) number or array of
36256 * numbers - to (number|array) number or array of numbers - setter
36257 * (function) caring function that accepts one number argument - duration
36258 * (number) duration, in milliseconds - easing (function) #optional easing
36259 * function from @mina or custom - callback (function) #optional callback
36260 * function to execute when animation ends = (object) animation object in
36261 * @mina format o { o id (string) animation id, consider it read-only, o
36262 * duration (function) gets or sets the duration of the animation, o easing
36263 * (function) easing, o speed (function) gets or sets the speed of the
36264 * animation, o status (function) gets or sets the status of the animation,
36265 * o stop (function) stops the animation o } | var rect = Snap().rect(0, 0,
36266 * 10, 10); | Snap.animate(0, 10, function (val) { | rect.attr({ | x: val |
36267 * }); | }, 1000); | // in given context is equivalent to | rect.animate({x:
36270 Snap.animate = function(from, to, setter, ms, easing, callback) {
36271 if (typeof easing == "function" && !easing.length) {
36273 easing = mina.linear;
36275 var now = mina.time(),
36276 anim = mina(from, to, now, now + ms, mina.time, setter, easing);
36277 callback && eve.once("mina.finish." + anim.id, callback);
36281 * \ Element.stop [ method ] * Stops all the animations for the current
36282 * element * = (Element) the current element \
36284 elproto.stop = function() {
36285 var anims = this.inAnim();
36286 for (var i = 0, ii = anims.length; i < ii; i++) {
36292 * \ Element.animate [ method ] * Animates the given attributes of the
36293 * element * - attrs (object) key-value pairs of destination attributes -
36294 * duration (number) duration of the animation in milliseconds - easing
36295 * (function) #optional easing function from @mina or custom - callback
36296 * (function) #optional callback function that executes when the animation
36297 * ends = (Element) the current element \
36299 elproto.animate = function(attrs, ms, easing, callback) {
36300 if (typeof easing == "function" && !easing.length) {
36302 easing = mina.linear;
36304 if (attrs instanceof Animation) {
36305 callback = attrs.callback;
36306 easing = attrs.easing;
36308 attrs = attrs.attr;
36315 for (var key in attrs)
36316 if (attrs[has](key)) {
36318 eq = el.equal(key, Str(attrs[key]));
36323 from = +el.attr(key);
36326 var len = is(from, "array") ? from.length : 1;
36327 keys[key] = slice(fkeys.length, fkeys.length + len, f);
36328 fkeys = fkeys.concat(from);
36329 tkeys = tkeys.concat(to);
36331 var now = mina.time(),
36332 anim = mina(fkeys, tkeys, now, now + ms, mina.time, function(val) {
36334 for (var key in keys)
36335 if (keys[has](key)) {
36336 attr[key] = keys[key](val);
36340 el.anims[anim.id] = anim;
36341 anim._attrs = attrs;
36342 anim._callback = callback;
36343 eve("snap.animcreated." + el.id, anim);
36344 eve.once("mina.finish." + anim.id, function() {
36345 delete el.anims[anim.id];
36346 callback && callback.call(el);
36348 eve.once("mina.stop." + anim.id, function() {
36349 delete el.anims[anim.id];
36355 * \ Element.data [ method ] * Adds or retrieves given value associated with
36356 * given key. (Don’t confuse with `data-` attributes)
36358 * See also @Element.removeData - key (string) key to store data - value
36359 * (any) #optional value to store = (object) @Element or, if value is not
36360 * specified: = (any) value > Usage | for (var i = 0, i < 5, i++) { |
36361 * paper.circle(10 + 15 * i, 10, 10) | .attr({fill: "#000"}) | .data("i", i) |
36362 * .click(function () { | alert(this.data("i")); | }); | } \
36364 elproto.data = function(key, value) {
36365 var data = eldata[this.id] = eldata[this.id] || {};
36366 if (arguments.length == 0) {
36367 eve("snap.data.get." + this.id, this, data, null);
36370 if (arguments.length == 1) {
36371 if (Snap.is(key, "object")) {
36374 this.data(i, key[i]);
36378 eve("snap.data.get." + this.id, this, data[key], key);
36382 eve("snap.data.set." + this.id, this, value, key);
36386 * \ Element.removeData [ method ] * Removes value associated with an
36387 * element by given key. If key is not provided, removes all the data of the
36388 * element. - key (string) #optional key = (object) @Element \
36390 elproto.removeData = function(key) {
36392 eldata[this.id] = {};
36394 eldata[this.id] && delete eldata[this.id][key];
36399 * \ Element.outerSVG [ method ] * Returns SVG code for the element,
36400 * equivalent to HTML's `outerHTML`.
36402 * See also @Element.innerSVG = (string) SVG code for the element \
36405 * \ Element.toString [ method ] * See @Element.outerSVG \
36407 elproto.outerSVG = elproto.toString = toString(1);
36409 * \ Element.innerSVG [ method ] * Returns SVG code for the element's
36410 * contents, equivalent to HTML's `innerHTML` = (string) SVG code for the
36413 elproto.innerSVG = toString();
36415 function toString(type) {
36416 return function() {
36417 var res = type ? "<" + this.type : "",
36418 attr = this.node.attributes,
36419 chld = this.node.childNodes;
36421 for (var i = 0, ii = attr.length; i < ii; i++) {
36422 res += " " + attr[i].name + '="' +
36423 attr[i].value.replace(/"/g, '\\"') + '"';
36427 type && (res += ">");
36428 for (i = 0, ii = chld.length; i < ii; i++) {
36429 if (chld[i].nodeType == 3) {
36430 res += chld[i].nodeValue;
36431 } else if (chld[i].nodeType == 1) {
36432 res += wrap(chld[i]).toString();
36435 type && (res += "</" + this.type + ">");
36437 type && (res += "/>");
36442 elproto.toDataURL = function() {
36443 if (window && window.btoa) {
36444 var bb = this.getBBox(),
36445 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>', {
36446 x: +bb.x.toFixed(3),
36447 y: +bb.y.toFixed(3),
36448 width: +bb.width.toFixed(3),
36449 height: +bb.height.toFixed(3),
36450 contents: this.outerSVG()
36452 return "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(svg)));
36456 * \ Fragment.select [ method ] * See @Element.select \
36458 Fragment.prototype.select = elproto.select;
36460 * \ Fragment.selectAll [ method ] * See @Element.selectAll \
36462 Fragment.prototype.selectAll = elproto.selectAll;
36465 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
36467 // Licensed under the Apache License, Version 2.0 (the "License");
36468 // you may not use this file except in compliance with the License.
36469 // You may obtain a copy of the License at
36471 // http://www.apache.org/licenses/LICENSE-2.0
36473 // Unless required by applicable law or agreed to in writing, software
36474 // distributed under the License is distributed on an "AS IS" BASIS,
36475 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36476 // See the License for the specific language governing permissions and
36477 // limitations under the License.
36478 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
36479 var objectToString = Object.prototype.toString,
36484 function Matrix(a, b, c, d, e, f) {
36485 if (b == null && objectToString.call(a) == "[object SVGMatrix]") {
36510 (function(matrixproto) {
36512 * \ Matrix.add [ method ] * Adds the given matrix to existing one - a
36513 * (number) - b (number) - c (number) - d (number) - e (number) - f
36514 * (number) or - matrix (object) @Matrix \
36516 matrixproto.add = function(a, b, c, d, e, f) {
36523 [this.a, this.c, this.e],
36524 [this.b, this.d, this.f],
36534 if (a && a instanceof Matrix) {
36542 for (x = 0; x < 3; x++) {
36543 for (y = 0; y < 3; y++) {
36545 for (z = 0; z < 3; z++) {
36546 res += m[x][z] * matrix[z][y];
36551 this.a = out[0][0];
36552 this.b = out[1][0];
36553 this.c = out[0][1];
36554 this.d = out[1][1];
36555 this.e = out[0][2];
36556 this.f = out[1][2];
36560 * \ Matrix.invert [ method ] * Returns an inverted version of the
36561 * matrix = (object) @Matrix \
36563 matrixproto.invert = function() {
36565 x = me.a * me.d - me.b * me.c;
36566 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);
36569 * \ Matrix.clone [ method ] * Returns a copy of the matrix = (object)
36572 matrixproto.clone = function() {
36573 return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
36576 * \ Matrix.translate [ method ] * Translate the matrix - x (number)
36577 * horizontal offset distance - y (number) vertical offset distance \
36579 matrixproto.translate = function(x, y) {
36580 return this.add(1, 0, 0, 1, x, y);
36583 * \ Matrix.scale [ method ] * Scales the matrix - x (number) amount to
36584 * be scaled, with `1` resulting in no change - y (number) #optional
36585 * amount to scale along the vertical axis. (Otherwise `x` applies to
36586 * both axes.) - cx (number) #optional horizontal origin point from
36587 * which to scale - cy (number) #optional vertical origin point from
36588 * which to scale Default cx, cy is the middle point of the element. \
36590 matrixproto.scale = function(x, y, cx, cy) {
36591 y == null && (y = x);
36592 (cx || cy) && this.add(1, 0, 0, 1, cx, cy);
36593 this.add(x, 0, 0, y, 0, 0);
36594 (cx || cy) && this.add(1, 0, 0, 1, -cx, -cy);
36598 * \ Matrix.rotate [ method ] * Rotates the matrix - a (number) angle of
36599 * rotation, in degrees - x (number) horizontal origin point from which
36600 * to rotate - y (number) vertical origin point from which to rotate \
36602 matrixproto.rotate = function(a, x, y) {
36606 var cos = +math.cos(a).toFixed(9),
36607 sin = +math.sin(a).toFixed(9);
36608 this.add(cos, sin, -sin, cos, x, y);
36609 return this.add(1, 0, 0, 1, -x, -y);
36612 * \ Matrix.x [ method ] * Returns x coordinate for given point after
36613 * transformation described by the matrix. See also @Matrix.y - x
36614 * (number) - y (number) = (number) x \
36616 matrixproto.x = function(x, y) {
36617 return x * this.a + y * this.c + this.e;
36620 * \ Matrix.y [ method ] * Returns y coordinate for given point after
36621 * transformation described by the matrix. See also @Matrix.x - x
36622 * (number) - y (number) = (number) y \
36624 matrixproto.y = function(x, y) {
36625 return x * this.b + y * this.d + this.f;
36627 matrixproto.get = function(i) {
36628 return +this[Str.fromCharCode(97 + i)].toFixed(4);
36630 matrixproto.toString = function() {
36631 return "matrix(" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + ")";
36633 matrixproto.offset = function() {
36634 return [this.e.toFixed(4), this.f.toFixed(4)];
36638 return a[0] * a[0] + a[1] * a[1];
36641 function normalize(a) {
36642 var mag = math.sqrt(norm(a));
36643 a[0] && (a[0] /= mag);
36644 a[1] && (a[1] /= mag);
36647 * \ Matrix.determinant [ method ] * Finds determinant of the given
36648 * matrix. = (number) determinant \
36650 matrixproto.determinant = function() {
36651 return this.a * this.d - this.b * this.c;
36654 * \ Matrix.split [ method ] * Splits matrix into primitive
36655 * transformations = (object) in format: o dx (number) translation by x
36656 * o dy (number) translation by y o scalex (number) scale by x o scaley
36657 * (number) scale by y o shear (number) shear o rotate (number) rotation
36658 * in deg o isSimple (boolean) could it be represented via simple
36659 * transformations \
36661 matrixproto.split = function() {
36672 out.scalex = math.sqrt(norm(row[0]));
36675 out.shear = row[0][0] * row[1][0] + row[0][1] * row[1][1];
36676 row[1] = [row[1][0] - row[0][0] * out.shear, row[1][1] - row[0][1] * out.shear];
36678 out.scaley = math.sqrt(norm(row[1]));
36680 out.shear /= out.scaley;
36682 if (this.determinant() < 0) {
36683 out.scalex = -out.scalex;
36687 var sin = -row[0][1],
36690 out.rotate = Snap.deg(math.acos(cos));
36692 out.rotate = 360 - out.rotate;
36695 out.rotate = Snap.deg(math.asin(sin));
36698 out.isSimple = !+out.shear.toFixed(9) && (out.scalex.toFixed(9) == out.scaley.toFixed(9) || !out.rotate);
36699 out.isSuperSimple = !+out.shear.toFixed(9) && out.scalex.toFixed(9) == out.scaley.toFixed(9) && !out.rotate;
36700 out.noRotation = !+out.shear.toFixed(9) && !out.rotate;
36704 * \ Matrix.toTransformString [ method ] * Returns transform string that
36705 * represents given matrix = (string) transform string \
36707 matrixproto.toTransformString = function(shorter) {
36708 var s = shorter || this.split();
36709 if (!+s.shear.toFixed(9)) {
36710 s.scalex = +s.scalex.toFixed(4);
36711 s.scaley = +s.scaley.toFixed(4);
36712 s.rotate = +s.rotate.toFixed(4);
36713 return (s.dx || s.dy ? "t" + [+s.dx.toFixed(4), +s.dy.toFixed(4)] : E) +
36714 (s.scalex != 1 || s.scaley != 1 ? "s" + [s.scalex, s.scaley, 0, 0] : E) +
36715 (s.rotate ? "r" + [+s.rotate.toFixed(4), 0, 0] : E);
36717 return "m" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)];
36720 })(Matrix.prototype);
36722 * \ Snap.Matrix [ method ] * Matrix constructor, extend on your own risk.
36723 * To create matrices use @Snap.matrix. \
36725 Snap.Matrix = Matrix;
36727 * \ Snap.matrix [ method ] * Utility method * Returns a matrix based on the
36728 * given parameters - a (number) - b (number) - c (number) - d (number) - e
36729 * (number) - f (number) or - svgMatrix (SVGMatrix) = (object) @Matrix \
36731 Snap.matrix = function(a, b, c, d, e, f) {
36732 return new Matrix(a, b, c, d, e, f);
36735 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
36737 // Licensed under the Apache License, Version 2.0 (the "License");
36738 // you may not use this file except in compliance with the License.
36739 // You may obtain a copy of the License at
36741 // http://www.apache.org/licenses/LICENSE-2.0
36743 // Unless required by applicable law or agreed to in writing, software
36744 // distributed under the License is distributed on an "AS IS" BASIS,
36745 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36746 // See the License for the specific language governing permissions and
36747 // limitations under the License.
36748 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
36749 var has = "hasOwnProperty",
36750 make = Snap._.make,
36751 wrap = Snap._.wrap,
36753 getSomeDefs = Snap._.getSomeDefs,
36754 reURLValue = /^url\(#?([^)]+)\)$/,
36758 separator = Snap._.separator,
36760 // Attributes event handlers
36761 eve.on("snap.util.attr.mask", function(value) {
36762 if (value instanceof Element || value instanceof Fragment) {
36764 if (value instanceof Fragment && value.node.childNodes.length == 1) {
36765 value = value.node.firstChild;
36766 getSomeDefs(this).appendChild(value);
36767 value = wrap(value);
36769 if (value.type == "mask") {
36772 mask = make("mask", getSomeDefs(this));
36773 mask.node.appendChild(value.node);
36774 }!mask.node.id && $(mask.node, {
36782 (function(clipIt) {
36783 eve.on("snap.util.attr.clip", clipIt);
36784 eve.on("snap.util.attr.clip-path", clipIt);
36785 eve.on("snap.util.attr.clipPath", clipIt);
36786 }(function(value) {
36787 if (value instanceof Element || value instanceof Fragment) {
36789 if (value.type == "clipPath") {
36792 clip = make("clipPath", getSomeDefs(this));
36793 clip.node.appendChild(value.node);
36794 !clip.node.id && $(clip.node, {
36799 "clip-path": URL(clip.node.id || clip.id)
36804 function fillStroke(name) {
36805 return function(value) {
36807 if (value instanceof Fragment && value.node.childNodes.length == 1 &&
36808 (value.node.firstChild.tagName == "radialGradient" ||
36809 value.node.firstChild.tagName == "linearGradient" ||
36810 value.node.firstChild.tagName == "pattern")) {
36811 value = value.node.firstChild;
36812 getSomeDefs(this).appendChild(value);
36813 value = wrap(value);
36815 if (value instanceof Element) {
36816 if (value.type == "radialGradient" || value.type == "linearGradient" || value.type == "pattern") {
36817 if (!value.node.id) {
36822 var fill = URL(value.node.id);
36824 fill = value.attr(name);
36827 fill = Snap.color(value);
36829 var grad = Snap(getSomeDefs(this).ownerSVGElement).gradient(value);
36831 if (!grad.node.id) {
36836 fill = URL(grad.node.id);
36845 attrs[name] = fill;
36846 $(this.node, attrs);
36847 this.node.style[name] = E;
36850 eve.on("snap.util.attr.fill", fillStroke("fill"));
36851 eve.on("snap.util.attr.stroke", fillStroke("stroke"));
36852 var gradrg = /^([lr])(?:\(([^)]*)\))?(.*)$/i;
36853 eve.on("snap.util.grad.parse", function parseGrad(string) {
36854 string = Str(string);
36855 var tokens = string.match(gradrg);
36859 var type = tokens[1],
36860 params = tokens[2],
36862 params = params.split(/\s*,\s*/).map(function(el) {
36863 return +el == el ? +el : el;
36865 if (params.length == 1 && params[0] == 0) {
36868 stops = stops.split("-");
36869 stops = stops.map(function(el) {
36870 el = el.split(":");
36875 out.offset = parseFloat(el[1]);
36886 eve.on("snap.util.attr.d", function(value) {
36888 if (is(value, "array") && is(value[0], "array")) {
36889 value = Snap.path.toString.call(value);
36891 value = Str(value);
36892 if (value.match(/[ruo]/i)) {
36893 value = Snap.path.toAbsolute(value);
36899 eve.on("snap.util.attr.#text", function(value) {
36901 value = Str(value);
36902 var txt = glob.doc.createTextNode(value);
36903 while (this.node.firstChild) {
36904 this.node.removeChild(this.node.firstChild);
36906 this.node.appendChild(txt);
36908 eve.on("snap.util.attr.path", function(value) {
36914 eve.on("snap.util.attr.class", function(value) {
36916 this.node.className.baseVal = value;
36918 eve.on("snap.util.attr.viewBox", function(value) {
36920 if (is(value, "object") && "x" in value) {
36921 vb = [value.x, value.y, value.width, value.height].join(" ");
36922 } else if (is(value, "array")) {
36923 vb = value.join(" ");
36932 eve.on("snap.util.attr.transform", function(value) {
36933 this.transform(value);
36936 eve.on("snap.util.attr.r", function(value) {
36937 if (this.type == "rect") {
36945 eve.on("snap.util.attr.textpath", function(value) {
36947 if (this.type == "text") {
36949 if (!value && this.textPath) {
36950 tp = this.textPath;
36951 while (tp.node.firstChild) {
36952 this.node.appendChild(tp.node.firstChild);
36955 delete this.textPath;
36958 if (is(value, "string")) {
36959 var defs = getSomeDefs(this),
36960 path = wrap(defs.parentNode).path(value);
36961 defs.appendChild(path.node);
36967 value = wrap(value);
36968 if (value instanceof Element) {
36969 id = value.attr("id");
36979 tp = this.textPath;
36983 "xlink:href": "#" + id
36986 tp = $("textPath", {
36987 "xlink:href": "#" + id
36989 while (node.firstChild) {
36990 tp.appendChild(node.firstChild);
36992 node.appendChild(tp);
36993 this.textPath = wrap(tp);
36998 eve.on("snap.util.attr.text", function(value) {
36999 if (this.type == "text") {
37002 tuner = function(chunk) {
37003 var out = $("tspan");
37004 if (is(chunk, "array")) {
37005 for (var i = 0; i < chunk.length; i++) {
37006 out.appendChild(tuner(chunk[i]));
37009 out.appendChild(glob.doc.createTextNode(chunk));
37011 out.normalize && out.normalize();
37014 while (node.firstChild) {
37015 node.removeChild(node.firstChild);
37017 var tuned = tuner(value);
37018 while (tuned.firstChild) {
37019 node.appendChild(tuned.firstChild);
37025 function setFontSize(value) {
37027 if (value == +value) {
37030 this.node.style.fontSize = value;
37032 eve.on("snap.util.attr.fontSize", setFontSize)(-1);
37033 eve.on("snap.util.attr.font-size", setFontSize)(-1);
37036 eve.on("snap.util.getattr.transform", function() {
37038 return this.transform();
37040 eve.on("snap.util.getattr.textpath", function() {
37042 return this.textPath;
37046 function getter(end) {
37047 return function() {
37049 var style = glob.doc.defaultView.getComputedStyle(this.node, null).getPropertyValue("marker-" + end);
37050 if (style == "none") {
37053 return Snap(glob.doc.getElementById(style.match(reURLValue)[1]));
37058 function setter(end) {
37059 return function(value) {
37061 var name = "marker" + end.charAt(0).toUpperCase() + end.substring(1);
37062 if (value == "" || !value) {
37063 this.node.style[name] = "none";
37066 if (value.type == "marker") {
37067 var id = value.node.id;
37073 this.node.style[name] = URL(id);
37078 eve.on("snap.util.getattr.marker-end", getter("end"))(-1);
37079 eve.on("snap.util.getattr.markerEnd", getter("end"))(-1);
37080 eve.on("snap.util.getattr.marker-start", getter("start"))(-1);
37081 eve.on("snap.util.getattr.markerStart", getter("start"))(-1);
37082 eve.on("snap.util.getattr.marker-mid", getter("mid"))(-1);
37083 eve.on("snap.util.getattr.markerMid", getter("mid"))(-1);
37084 eve.on("snap.util.attr.marker-end", setter("end"))(-1);
37085 eve.on("snap.util.attr.markerEnd", setter("end"))(-1);
37086 eve.on("snap.util.attr.marker-start", setter("start"))(-1);
37087 eve.on("snap.util.attr.markerStart", setter("start"))(-1);
37088 eve.on("snap.util.attr.marker-mid", setter("mid"))(-1);
37089 eve.on("snap.util.attr.markerMid", setter("mid"))(-1);
37091 eve.on("snap.util.getattr.r", function() {
37092 if (this.type == "rect" && $(this.node, "rx") == $(this.node, "ry")) {
37094 return $(this.node, "rx");
37098 function textExtract(node) {
37100 var children = node.childNodes;
37101 for (var i = 0, ii = children.length; i < ii; i++) {
37102 var chi = children[i];
37103 if (chi.nodeType == 3) {
37104 out.push(chi.nodeValue);
37106 if (chi.tagName == "tspan") {
37107 if (chi.childNodes.length == 1 && chi.firstChild.nodeType == 3) {
37108 out.push(chi.firstChild.nodeValue);
37110 out.push(textExtract(chi));
37116 eve.on("snap.util.getattr.text", function() {
37117 if (this.type == "text" || this.type == "tspan") {
37119 var out = textExtract(this.node);
37120 return out.length == 1 ? out[0] : out;
37123 eve.on("snap.util.getattr.#text", function() {
37124 return this.node.textContent;
37126 eve.on("snap.util.getattr.viewBox", function() {
37128 var vb = $(this.node, "viewBox");
37130 vb = vb.split(separator);
37131 return Snap._.box(+vb[0], +vb[1], +vb[2], +vb[3]);
37136 eve.on("snap.util.getattr.points", function() {
37137 var p = $(this.node, "points");
37140 return p.split(separator);
37145 eve.on("snap.util.getattr.path", function() {
37146 var p = $(this.node, "d");
37150 eve.on("snap.util.getattr.class", function() {
37151 return this.node.className.baseVal;
37154 function getFontSize() {
37156 return this.node.style.fontSize;
37158 eve.on("snap.util.getattr.fontSize", getFontSize)(-1);
37159 eve.on("snap.util.getattr.font-size", getFontSize)(-1);
37162 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
37164 // Licensed under the Apache License, Version 2.0 (the "License");
37165 // you may not use this file except in compliance with the License.
37166 // You may obtain a copy of the License at
37168 // http://www.apache.org/licenses/LICENSE-2.0
37170 // Unless required by applicable law or agreed to in writing, software
37171 // distributed under the License is distributed on an "AS IS" BASIS,
37172 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37173 // See the License for the specific language governing permissions and
37174 // limitations under the License.
37175 Snap.plugin(function(Snap, Element, Paper, glob, Fragment) {
37176 var proto = Paper.prototype,
37179 * \ Paper.rect [ method ]
37181 * Draws a rectangle * - x (number) x coordinate of the top left corner - y
37182 * (number) y coordinate of the top left corner - width (number) width -
37183 * height (number) height - rx (number) #optional horizontal radius for
37184 * rounded corners, default is 0 - ry (number) #optional vertical radius for
37185 * rounded corners, default is rx or 0 = (object) the `rect` element * >
37186 * Usage | // regular rectangle | var c = paper.rect(10, 10, 50, 50); | //
37187 * rectangle with rounded corners | var c = paper.rect(40, 40, 50, 50, 10); \
37189 proto.rect = function(x, y, w, h, rx, ry) {
37194 if (is(x, "object") && x == "[object Object]") {
37196 } else if (x != null) {
37208 return this.el("rect", attr);
37211 * \ Paper.circle [ method ] * Draws a circle * - x (number) x coordinate of
37212 * the centre - y (number) y coordinate of the centre - r (number) radius =
37213 * (object) the `circle` element * > Usage | var c = paper.circle(50, 50,
37216 proto.circle = function(cx, cy, r) {
37218 if (is(cx, "object") && cx == "[object Object]") {
37220 } else if (cx != null) {
37227 return this.el("circle", attr);
37230 var preload = (function() {
37231 function onerror() {
37232 this.parentNode.removeChild(this);
37234 return function(src, f) {
37235 var img = glob.doc.createElement("img"),
37236 body = glob.doc.body;
37237 img.style.cssText = "position:absolute;left:-9999em;top:-9999em";
37238 img.onload = function() {
37240 img.onload = img.onerror = null;
37241 body.removeChild(img);
37243 img.onerror = onerror;
37244 body.appendChild(img);
37250 * \ Paper.image [ method ] * Places an image on the surface * - src
37251 * (string) URI of the source image - x (number) x offset position - y
37252 * (number) y offset position - width (number) width of the image - height
37253 * (number) height of the image = (object) the `image` element or = (object)
37254 * Snap element object with type `image` * > Usage | var c =
37255 * paper.image("apple.png", 10, 10, 80, 80); \
37257 proto.image = function(src, x, y, width, height) {
37258 var el = this.el("image");
37259 if (is(src, "object") && "src" in src) {
37261 } else if (src != null) {
37264 preserveAspectRatio: "none"
37266 if (x != null && y != null) {
37270 if (width != null && height != null) {
37272 set.height = height;
37274 preload(src, function() {
37275 Snap._.$(el.node, {
37276 width: this.offsetWidth,
37277 height: this.offsetHeight
37281 Snap._.$(el.node, set);
37286 * \ Paper.ellipse [ method ] * Draws an ellipse * - x (number) x coordinate
37287 * of the centre - y (number) y coordinate of the centre - rx (number)
37288 * horizontal radius - ry (number) vertical radius = (object) the `ellipse`
37289 * element * > Usage | var c = paper.ellipse(50, 50, 40, 20); \
37291 proto.ellipse = function(cx, cy, rx, ry) {
37293 if (is(cx, "object") && cx == "[object Object]") {
37295 } else if (cx != null) {
37303 return this.el("ellipse", attr);
37305 // SIERRA Paper.path(): Unclear from the link what a Catmull-Rom curveto is,
37306 // and why it would make life any easier.
37308 * \ Paper.path [ method ] * Creates a `<path>` element using the given
37309 * string as the path's definition - pathString (string) #optional path
37310 * string in SVG format Path string consists of one-letter commands,
37311 * followed by comma seprarated arguments in numerical form. Example: |
37312 * "M10,20L30,40" This example features two commands: `M`, with arguments
37313 * `(10, 20)` and `L` with arguments `(30, 40)`. Uppercase letter commands
37314 * express coordinates in absolute terms, while lowercase commands express
37315 * them in relative terms from the most recently declared coordinates.
37316 * # <p>Here is short list of commands available, for more details see <a
37317 * href="http://www.w3.org/TR/SVG/paths.html#PathData" title="Details of a
37318 * path's data attribute's format are described in the SVG
37319 * specification.">SVG path string format</a> or <a
37320 * href="https://developer.mozilla.org/en/SVG/Tutorial/Paths">article about
37321 * path strings at MDN</a>.</p> # <table><thead><tr><th>Command</th><th>Name</th><th>Parameters</th></tr></thead><tbody> #
37322 * <tr><td>M</td><td>moveto</td><td>(x y)+</td></tr> # <tr><td>Z</td><td>closepath</td><td>(none)</td></tr> #
37323 * <tr><td>L</td><td>lineto</td><td>(x y)+</td></tr> # <tr><td>H</td><td>horizontal
37324 * lineto</td><td>x+</td></tr> # <tr><td>V</td><td>vertical lineto</td><td>y+</td></tr> #
37325 * <tr><td>C</td><td>curveto</td><td>(x1 y1 x2 y2 x y)+</td></tr> #
37326 * <tr><td>S</td><td>smooth curveto</td><td>(x2 y2 x y)+</td></tr> #
37327 * <tr><td>Q</td><td>quadratic Bézier curveto</td><td>(x1 y1 x
37328 * y)+</td></tr> # <tr><td>T</td><td>smooth quadratic Bézier
37329 * curveto</td><td>(x y)+</td></tr> # <tr><td>A</td><td>elliptical
37330 * arc</td><td>(rx ry x-axis-rotation large-arc-flag sweep-flag x y)+</td></tr> #
37331 * <tr><td>R</td><td><a
37332 * href="http://en.wikipedia.org/wiki/Catmull–Rom_spline#Catmull.E2.80.93Rom_spline">Catmull-Rom
37333 * curveto</a>*</td><td>x1 y1 (x y)+</td></tr></tbody></table> *
37334 * _Catmull-Rom curveto_ is a not standard SVG command and added to make
37335 * life easier. Note: there is a special case when a path consists of only
37336 * three commands: `M10,10R…z`. In this case the path connects back to
37337 * its starting point. > Usage | var c = paper.path("M10 10L90 90"); | //
37338 * draw a diagonal line: | // move to 10,10, line to 90,90 \
37340 proto.path = function(d) {
37342 if (is(d, "object") && !is(d, "array")) {
37349 return this.el("path", attr);
37352 * \ Paper.g [ method ] * Creates a group element * - varargs (…)
37353 * #optional elements to nest within the group = (object) the `g` element * >
37354 * Usage | var c1 = paper.circle(), | c2 = paper.rect(), | g = paper.g(c2,
37355 * c1); // note that the order of elements is different or | var c1 =
37356 * paper.circle(), | c2 = paper.rect(), | g = paper.g(); | g.add(c2, c1); \
37359 * \ Paper.group [ method ] * See @Paper.g \
37361 proto.group = proto.g = function(first) {
37364 if (arguments.length == 1 && first && !first.type) {
37366 } else if (arguments.length) {
37367 el.add(Array.prototype.slice.call(arguments, 0));
37372 * \ Paper.svg [ method ] * Creates a nested SVG element. - x (number)
37373 * @optional X of the element - y (number) @optional Y of the element -
37374 * width (number) @optional width of the element - height (number) @optional
37375 * height of the element - vbx (number) @optional viewbox X - vby (number)
37376 * @optional viewbox Y - vbw (number) @optional viewbox width - vbh (number)
37377 * @optional viewbox height * = (object) the `svg` element * \
37379 proto.svg = function(x, y, width, height, vbx, vby, vbw, vbh) {
37381 if (is(x, "object") && y == null) {
37390 if (width != null) {
37391 attrs.width = width;
37393 if (height != null) {
37394 attrs.height = height;
37396 if (vbx != null && vby != null && vbw != null && vbh != null) {
37397 attrs.viewBox = [vbx, vby, vbw, vbh];
37400 return this.el("svg", attrs);
37403 * \ Paper.mask [ method ] * Equivalent in behaviour to @Paper.g, except
37404 * it’s a mask. * = (object) the `mask` element * \
37406 proto.mask = function(first) {
37408 el = this.el("mask");
37409 if (arguments.length == 1 && first && !first.type) {
37411 } else if (arguments.length) {
37412 el.add(Array.prototype.slice.call(arguments, 0));
37417 * \ Paper.ptrn [ method ] * Equivalent in behaviour to @Paper.g, except
37418 * it’s a pattern. - x (number) @optional X of the element - y
37419 * (number) @optional Y of the element - width (number) @optional width of
37420 * the element - height (number) @optional height of the element - vbx
37421 * (number) @optional viewbox X - vby (number) @optional viewbox Y - vbw
37422 * (number) @optional viewbox width - vbh (number) @optional viewbox height * =
37423 * (object) the `pattern` element * \
37425 proto.ptrn = function(x, y, width, height, vx, vy, vw, vh) {
37426 if (is(x, "object")) {
37430 patternUnits: "userSpaceOnUse"
37438 if (width != null) {
37439 attr.width = width;
37441 if (height != null) {
37442 attr.height = height;
37444 if (vx != null && vy != null && vw != null && vh != null) {
37445 attr.viewBox = [vx, vy, vw, vh];
37448 return this.el("pattern", attr);
37451 * \ Paper.use [ method ] * Creates a <use> element. - id (string) @optional
37452 * id of element to link or - id (Element) @optional element to link * =
37453 * (object) the `use` element * \
37455 proto.use = function(id) {
37457 if (id instanceof Element) {
37458 if (!id.attr("id")) {
37463 id = id.attr("id");
37465 if (String(id).charAt() == "#") {
37466 id = id.substring(1);
37468 return this.el("use", {
37469 "xlink:href": "#" + id
37472 return Element.prototype.use.call(this);
37476 * \ Paper.symbol [ method ] * Creates a <symbol> element. - vbx (number)
37477 * @optional viewbox X - vby (number) @optional viewbox Y - vbw (number)
37478 * @optional viewbox width - vbh (number) @optional viewbox height =
37479 * (object) the `symbol` element * \
37481 proto.symbol = function(vx, vy, vw, vh) {
37483 if (vx != null && vy != null && vw != null && vh != null) {
37484 attr.viewBox = [vx, vy, vw, vh];
37487 return this.el("symbol", attr);
37490 * \ Paper.text [ method ] * Draws a text string * - x (number) x coordinate
37491 * position - y (number) y coordinate position - text (string|array) The
37492 * text string to draw or array of strings to nest within separate `<tspan>`
37493 * elements = (object) the `text` element * > Usage | var t1 =
37494 * paper.text(50, 50, "Snap"); | var t2 = paper.text(50, 50,
37495 * ["S","n","a","p"]); | // Text path usage | t1.attr({textpath:
37496 * "M10,10L100,100"}); | // or | var pth = paper.path("M10,10L100,100"); |
37497 * t1.attr({textpath: pth}); \
37499 proto.text = function(x, y, text) {
37501 if (is(x, "object")) {
37503 } else if (x != null) {
37510 return this.el("text", attr);
37513 * \ Paper.line [ method ] * Draws a line * - x1 (number) x coordinate
37514 * position of the start - y1 (number) y coordinate position of the start -
37515 * x2 (number) x coordinate position of the end - y2 (number) y coordinate
37516 * position of the end = (object) the `line` element * > Usage | var t1 =
37517 * paper.line(50, 50, 100, 100); \
37519 proto.line = function(x1, y1, x2, y2) {
37521 if (is(x1, "object")) {
37523 } else if (x1 != null) {
37531 return this.el("line", attr);
37534 * \ Paper.polyline [ method ] * Draws a polyline * - points (array) array
37535 * of points or - varargs (…) points = (object) the `polyline` element * >
37536 * Usage | var p1 = paper.polyline([10, 10, 100, 100]); | var p2 =
37537 * paper.polyline(10, 10, 100, 100); \
37539 proto.polyline = function(points) {
37540 if (arguments.length > 1) {
37541 points = Array.prototype.slice.call(arguments, 0);
37544 if (is(points, "object") && !is(points, "array")) {
37546 } else if (points != null) {
37551 return this.el("polyline", attr);
37554 * \ Paper.polygon [ method ] * Draws a polygon. See @Paper.polyline \
37556 proto.polygon = function(points) {
37557 if (arguments.length > 1) {
37558 points = Array.prototype.slice.call(arguments, 0);
37561 if (is(points, "object") && !is(points, "array")) {
37563 } else if (points != null) {
37568 return this.el("polygon", attr);
37573 // gradients' helpers
37574 function Gstops() {
37575 return this.selectAll("stop");
37578 function GaddStop(color, offset) {
37579 var stop = $("stop"),
37581 offset: +offset + "%"
37583 color = Snap.color(color);
37584 attr["stop-color"] = color.hex;
37585 if (color.opacity < 1) {
37586 attr["stop-opacity"] = color.opacity;
37589 this.node.appendChild(stop);
37593 function GgetBBox() {
37594 if (this.type == "linearGradient") {
37595 var x1 = $(this.node, "x1") || 0,
37596 x2 = $(this.node, "x2") || 1,
37597 y1 = $(this.node, "y1") || 0,
37598 y2 = $(this.node, "y2") || 0;
37599 return Snap._.box(x1, y1, math.abs(x2 - x1), math.abs(y2 - y1));
37601 var cx = this.node.cx || .5,
37602 cy = this.node.cy || .5,
37603 r = this.node.r || 0;
37604 return Snap._.box(cx - r, cy - r, r * 2, r * 2);
37608 function gradient(defs, str) {
37609 var grad = eve("snap.util.grad.parse", null, str).firstDefined(),
37614 grad.params.unshift(defs);
37615 if (grad.type.toLowerCase() == "l") {
37616 el = gradientLinear.apply(0, grad.params);
37618 el = gradientRadial.apply(0, grad.params);
37620 if (grad.type != grad.type.toLowerCase()) {
37622 gradientUnits: "userSpaceOnUse"
37625 var stops = grad.stops,
37626 len = stops.length,
37630 function seed(i, end) {
37631 var step = (end - start) / (i - j);
37632 for (var k = j; k < i; k++) {
37633 stops[k].offset = +(+start + step * (k - j)).toFixed(2);
37639 for (var i = 0; i < len; i++)
37640 if ("offset" in stops[i]) {
37641 seed(i, stops[i].offset);
37643 stops[len].offset = stops[len].offset || 100;
37644 seed(len, stops[len].offset);
37645 for (i = 0; i <= len; i++) {
37646 var stop = stops[i];
37647 el.addStop(stop.color, stop.offset);
37652 function gradientLinear(defs, x1, y1, x2, y2) {
37653 var el = Snap._.make("linearGradient", defs);
37655 el.addStop = GaddStop;
37656 el.getBBox = GgetBBox;
37668 function gradientRadial(defs, cx, cy, r, fx, fy) {
37669 var el = Snap._.make("radialGradient", defs);
37671 el.addStop = GaddStop;
37672 el.getBBox = GgetBBox;
37680 if (fx != null && fy != null) {
37689 * \ Paper.gradient [ method ] * Creates a gradient element * - gradient
37690 * (string) gradient descriptor > Gradient Descriptor The gradient
37691 * descriptor is an expression formatted as follows: `<type>(<coords>)<colors>`.
37692 * The `<type>` can be either linear or radial. The uppercase `L` or
37693 * `R` letters indicate absolute coordinates offset from the SVG
37694 * surface. Lowercase `l` or `r` letters indicate coordinates calculated
37695 * relative to the element to which the gradient is applied. Coordinates
37696 * specify a linear gradient vector as `x1`, `y1`, `x2`, `y2`, or a
37697 * radial gradient as `cx`, `cy`, `r` and optional `fx`, `fy` specifying
37698 * a focal point away from the center of the circle. Specify `<colors>`
37699 * as a list of dash-separated CSS color values. Each color may be
37700 * followed by a custom offset value, separated with a colon character. >
37701 * Examples Linear gradient, relative from top-left corner to
37702 * bottom-right corner, from black through red to white: | var g =
37703 * paper.gradient("l(0, 0, 1, 1)#000-#f00-#fff"); Linear gradient,
37704 * absolute from (0, 0) to (100, 100), from black through red at 25% to
37705 * white: | var g = paper.gradient("L(0, 0, 100,
37706 * 100)#000-#f00:25-#fff"); Radial gradient, relative from the center of
37707 * the element with radius half the width, from black to white: | var g =
37708 * paper.gradient("r(0.5, 0.5, 0.5)#000-#fff"); To apply the gradient: |
37709 * paper.circle(50, 50, 40).attr({ | fill: g | }); = (object) the
37710 * `gradient` element \
37712 proto.gradient = function(str) {
37713 return gradient(this.defs, str);
37715 proto.gradientLinear = function(x1, y1, x2, y2) {
37716 return gradientLinear(this.defs, x1, y1, x2, y2);
37718 proto.gradientRadial = function(cx, cy, r, fx, fy) {
37719 return gradientRadial(this.defs, cx, cy, r, fx, fy);
37722 * \ Paper.toString [ method ] * Returns SVG code for the @Paper =
37723 * (string) SVG code for the @Paper \
37725 proto.toString = function() {
37726 var doc = this.node.ownerDocument,
37727 f = doc.createDocumentFragment(),
37728 d = doc.createElement("div"),
37729 svg = this.node.cloneNode(true),
37732 d.appendChild(svg);
37734 xmlns: "http://www.w3.org/2000/svg"
37737 f.removeChild(f.firstChild);
37741 * \ Paper.toDataURL [ method ] * Returns SVG code for the @Paper as
37742 * Data URI string. = (string) Data URI string \
37744 proto.toDataURL = function() {
37745 if (window && window.btoa) {
37746 return "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(this)));
37750 * \ Paper.clear [ method ] * Removes all child nodes of the paper,
37753 proto.clear = function() {
37754 var node = this.node.firstChild,
37757 next = node.nextSibling;
37758 if (node.tagName != "defs") {
37759 node.parentNode.removeChild(node);
37771 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
37773 // Licensed under the Apache License, Version 2.0 (the "License");
37774 // you may not use this file except in compliance with the License.
37775 // You may obtain a copy of the License at
37777 // http://www.apache.org/licenses/LICENSE-2.0
37779 // Unless required by applicable law or agreed to in writing, software
37780 // distributed under the License is distributed on an "AS IS" BASIS,
37781 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37782 // See the License for the specific language governing permissions and
37783 // limitations under the License.
37784 Snap.plugin(function(Snap, Element, Paper, glob) {
37785 var elproto = Element.prototype,
37787 clone = Snap._.clone,
37788 has = "hasOwnProperty",
37789 p2s = /,?([a-z]),?/gi,
37790 toFloat = parseFloat,
37798 function paths(ps) {
37799 var p = paths.ps = paths.ps || {};
37807 setTimeout(function() {
37809 if (p[has](key) && key != ps) {
37811 !p[key].sleep && delete p[key];
37817 function box(x, y, width, height) {
37819 x = y = width = height = 0;
37837 cy: y + height / 2,
37838 r1: math.min(width, height) / 2,
37839 r2: math.max(width, height) / 2,
37840 r0: math.sqrt(width * width + height * height) / 2,
37841 path: rectPath(x, y, width, height),
37842 vb: [x, y, width, height].join(" ")
37846 function toString() {
37847 return this.join(",").replace(p2s, "$1");
37850 function pathClone(pathArray) {
37851 var res = clone(pathArray);
37852 res.toString = toString;
37856 function getPointAtSegmentLength(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) {
37857 if (length == null) {
37858 return bezlen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y);
37860 return findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y,
37861 getTotLen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length));
37865 function getLengthFactory(istotal, subpath) {
37867 return +(+val).toFixed(3);
37869 return Snap._.cacher(function(path, length, onlystart) {
37870 if (path instanceof Element) {
37871 path = path.attr("d");
37873 path = path2curve(path);
37874 var x, y, p, l, sp = "",
37878 for (var i = 0, ii = path.length; i < ii; i++) {
37884 l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
37885 if (len + l > length) {
37886 if (subpath && !subpaths.start) {
37887 point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
37889 "C" + O(point.start.x),
37899 subpaths.start = sp;
37902 O(point.y) + "C" + O(point.n.x),
37914 if (!istotal && !subpath) {
37915 point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len);
37923 sp += p.shift() + p;
37926 point = istotal ? len : subpath ? subpaths : findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1);
37928 }, null, Snap._.clone);
37930 var getTotalLength = getLengthFactory(1),
37931 getPointAtLength = getLengthFactory(),
37932 getSubpathsAtLength = getLengthFactory(0, 1);
37934 function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
37940 x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x,
37941 y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y,
37942 mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),
37943 my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),
37944 nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),
37945 ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),
37946 ax = t1 * p1x + t * c1x,
37947 ay = t1 * p1y + t * c1y,
37948 cx = t1 * c2x + t * p2x,
37949 cy = t1 * c2y + t * p2y,
37950 alpha = (90 - math.atan2(mx - nx, my - ny) * 180 / PI);
37951 // (mx > nx || my < ny) && (alpha += 180);
37975 function bezierBBox(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
37976 if (!Snap.is(p1x, "array")) {
37977 p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
37979 var bbox = curveDim.apply(null, p1x);
37983 bbox.max.x - bbox.min.x,
37984 bbox.max.y - bbox.min.y
37988 function isPointInsideBBox(bbox, x, y) {
37989 return x >= bbox.x &&
37990 x <= bbox.x + bbox.width &&
37992 y <= bbox.y + bbox.height;
37995 function isBBoxIntersect(bbox1, bbox2) {
37996 bbox1 = box(bbox1);
37997 bbox2 = box(bbox2);
37998 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);
38001 function base3(t, p1, p2, p3, p4) {
38002 var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4,
38003 t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
38004 return t * t2 - 3 * p1 + 3 * p2;
38007 function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
38011 z = z > 1 ? 1 : z < 0 ? 0 : z;
38014 Tvalues = [-.1252, .1252, -.3678, .3678, -.5873, .5873, -.7699, .7699, -.9041, .9041, -.9816, .9816],
38015 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],
38017 for (var i = 0; i < n; i++) {
38018 var ct = z2 * Tvalues[i] + z2,
38019 xbase = base3(ct, x1, x2, x3, x4),
38020 ybase = base3(ct, y1, y2, y3, y4),
38021 comb = xbase * xbase + ybase * ybase;
38022 sum += Cvalues[i] * math.sqrt(comb);
38027 function getTotLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) {
38028 if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) {
38036 l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);
38037 while (abs(l - ll) > e) {
38039 t2 += (l < ll ? 1 : -1) * step;
38040 l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2);
38045 function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
38047 mmax(x1, x2) < mmin(x3, x4) ||
38048 mmin(x1, x2) > mmax(x3, x4) ||
38049 mmax(y1, y2) < mmin(y3, y4) ||
38050 mmin(y1, y2) > mmax(y3, y4)
38054 var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4),
38055 ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4),
38056 denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
38058 if (!denominator) {
38061 var px = nx / denominator,
38062 py = ny / denominator,
38063 px2 = +px.toFixed(2),
38064 py2 = +py.toFixed(2);
38066 px2 < +mmin(x1, x2).toFixed(2) ||
38067 px2 > +mmax(x1, x2).toFixed(2) ||
38068 px2 < +mmin(x3, x4).toFixed(2) ||
38069 px2 > +mmax(x3, x4).toFixed(2) ||
38070 py2 < +mmin(y1, y2).toFixed(2) ||
38071 py2 > +mmax(y1, y2).toFixed(2) ||
38072 py2 < +mmin(y3, y4).toFixed(2) ||
38073 py2 > +mmax(y3, y4).toFixed(2)
38083 function inter(bez1, bez2) {
38084 return interHelper(bez1, bez2);
38087 function interCount(bez1, bez2) {
38088 return interHelper(bez1, bez2, 1);
38091 function interHelper(bez1, bez2, justCount) {
38092 var bbox1 = bezierBBox(bez1),
38093 bbox2 = bezierBBox(bez2);
38094 if (!isBBoxIntersect(bbox1, bbox2)) {
38095 return justCount ? 0 : [];
38097 var l1 = bezlen.apply(0, bez1),
38098 l2 = bezlen.apply(0, bez2),
38104 res = justCount ? 0 : [];
38105 for (var i = 0; i < n1 + 1; i++) {
38106 var p = findDotsAtSegment.apply(0, bez1.concat(i / n1));
38113 for (i = 0; i < n2 + 1; i++) {
38114 p = findDotsAtSegment.apply(0, bez2.concat(i / n2));
38121 for (i = 0; i < n1; i++) {
38122 for (var j = 0; j < n2; j++) {
38124 di1 = dots1[i + 1],
38126 dj1 = dots2[j + 1],
38127 ci = abs(di1.x - di.x) < .001 ? "y" : "x",
38128 cj = abs(dj1.x - dj.x) < .001 ? "y" : "x",
38129 is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
38131 if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) {
38134 xy[is.x.toFixed(4)] = is.y.toFixed(4);
38135 var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t),
38136 t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
38137 if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
38155 function pathIntersection(path1, path2) {
38156 return interPathHelper(path1, path2);
38159 function pathIntersectionNumber(path1, path2) {
38160 return interPathHelper(path1, path2, 1);
38163 function interPathHelper(path1, path2, justCount) {
38164 path1 = path2curve(path1);
38165 path2 = path2curve(path2);
38166 var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2,
38167 res = justCount ? 0 : [];
38168 for (var i = 0, ii = path1.length; i < ii; i++) {
38170 if (pi[0] == "M") {
38174 if (pi[0] == "C") {
38175 bez1 = [x1, y1].concat(pi.slice(1));
38179 bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
38183 for (var j = 0, jj = path2.length; j < jj; j++) {
38185 if (pj[0] == "M") {
38189 if (pj[0] == "C") {
38190 bez2 = [x2, y2].concat(pj.slice(1));
38194 bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];
38198 var intr = interHelper(bez1, bez2, justCount);
38202 for (var k = 0, kk = intr.length; k < kk; k++) {
38203 intr[k].segment1 = i;
38204 intr[k].segment2 = j;
38205 intr[k].bez1 = bez1;
38206 intr[k].bez2 = bez2;
38208 res = res.concat(intr);
38217 function isPointInsidePath(path, x, y) {
38218 var bbox = pathBBox(path);
38219 return isPointInsideBBox(bbox, x, y) &&
38220 interPathHelper(path, [
38222 ["H", bbox.x2 + 10]
38226 function pathBBox(path) {
38227 var pth = paths(path);
38229 return clone(pth.bbox);
38234 path = path2curve(path);
38240 for (var i = 0, ii = path.length; i < ii; i++) {
38248 var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]);
38249 X = X.concat(dim.min.x, dim.max.x);
38250 Y = Y.concat(dim.min.y, dim.max.y);
38255 var xmin = mmin.apply(0, X),
38256 ymin = mmin.apply(0, Y),
38257 xmax = mmax.apply(0, X),
38258 ymax = mmax.apply(0, Y),
38259 bb = box(xmin, ymin, xmax - xmin, ymax - ymin);
38260 pth.bbox = clone(bb);
38264 function rectPath(x, y, w, h, r) {
38267 ["M", +x + (+r), y],
38268 ["l", w - r * 2, 0],
38269 ["a", r, r, 0, 0, 1, r, r],
38270 ["l", 0, h - r * 2],
38271 ["a", r, r, 0, 0, 1, -r, r],
38272 ["l", r * 2 - w, 0],
38273 ["a", r, r, 0, 0, 1, -r, -r],
38274 ["l", 0, r * 2 - h],
38275 ["a", r, r, 0, 0, 1, r, -r],
38286 res.toString = toString;
38290 function ellipsePath(x, y, rx, ry, a) {
38291 if (a == null && ry == null) {
38299 var rad = Math.PI / 180,
38300 x1 = x + rx * Math.cos(-ry * rad),
38301 x2 = x + rx * Math.cos(-a * rad),
38302 y1 = y + rx * Math.sin(-ry * rad),
38303 y2 = y + rx * Math.sin(-a * rad),
38306 ["A", rx, rx, 0, +(a - ry > 180), 0, x2, y2]
38312 ["a", rx, ry, 0, 1, 1, 0, 2 * ry],
38313 ["a", rx, ry, 0, 1, 1, 0, -2 * ry],
38317 res.toString = toString;
38320 var unit2px = Snap._unit2px,
38322 path: function(el) {
38323 return el.attr("path");
38325 circle: function(el) {
38326 var attr = unit2px(el);
38327 return ellipsePath(attr.cx, attr.cy, attr.r);
38329 ellipse: function(el) {
38330 var attr = unit2px(el);
38331 return ellipsePath(attr.cx || 0, attr.cy || 0, attr.rx, attr.ry);
38333 rect: function(el) {
38334 var attr = unit2px(el);
38335 return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height, attr.rx, attr.ry);
38337 image: function(el) {
38338 var attr = unit2px(el);
38339 return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height);
38341 line: function(el) {
38342 return "M" + [el.attr("x1") || 0, el.attr("y1") || 0, el.attr("x2"), el.attr("y2")];
38344 polyline: function(el) {
38345 return "M" + el.attr("points");
38347 polygon: function(el) {
38348 return "M" + el.attr("points") + "z";
38350 deflt: function(el) {
38351 var bbox = el.node.getBBox();
38352 return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
38356 function pathToRelative(pathArray) {
38357 var pth = paths(pathArray),
38358 lowerCase = String.prototype.toLowerCase;
38360 return pathClone(pth.rel);
38362 if (!Snap.is(pathArray, "array") || !Snap.is(pathArray && pathArray[0], "array")) {
38363 pathArray = Snap.parsePathString(pathArray);
38371 if (pathArray[0][0] == "M") {
38372 x = pathArray[0][1];
38373 y = pathArray[0][2];
38377 res.push(["M", x, y]);
38379 for (var i = start, ii = pathArray.length; i < ii; i++) {
38380 var r = res[i] = [],
38382 if (pa[0] != lowerCase.call(pa[0])) {
38383 r[0] = lowerCase.call(pa[0]);
38391 r[6] = +(pa[6] - x).toFixed(3);
38392 r[7] = +(pa[7] - y).toFixed(3);
38395 r[1] = +(pa[1] - y).toFixed(3);
38401 for (var j = 1, jj = pa.length; j < jj; j++) {
38402 r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3);
38407 if (pa[0] == "m") {
38411 for (var k = 0, kk = pa.length; k < kk; k++) {
38415 var len = res[i].length;
38416 switch (res[i][0]) {
38422 x += +res[i][len - 1];
38425 y += +res[i][len - 1];
38428 x += +res[i][len - 2];
38429 y += +res[i][len - 1];
38432 res.toString = toString;
38433 pth.rel = pathClone(res);
38437 function pathToAbsolute(pathArray) {
38438 var pth = paths(pathArray);
38440 return pathClone(pth.abs);
38442 if (!is(pathArray, "array") || !is(pathArray && pathArray[0], "array")) { // rough
38444 pathArray = Snap.parsePathString(pathArray);
38446 if (!pathArray || !pathArray.length) {
38458 if (pathArray[0][0] == "M") {
38459 x = +pathArray[0][1];
38460 y = +pathArray[0][2];
38464 res[0] = ["M", x, y];
38466 var crz = pathArray.length == 3 &&
38467 pathArray[0][0] == "M" &&
38468 pathArray[1][0].toUpperCase() == "R" &&
38469 pathArray[2][0].toUpperCase() == "Z";
38470 for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {
38474 if (pa0 != pa0.toUpperCase()) {
38475 r[0] = pa0.toUpperCase();
38493 var dots = [x, y].concat(pa.slice(1));
38494 for (var j = 2, jj = dots.length; j < jj; j++) {
38495 dots[j] = +dots[j] + x;
38496 dots[++j] = +dots[j] + y;
38499 res = res.concat(catmullRom2bezier(dots, crz));
38503 dots = ellipsePath(x, y, pa[1], pa[2]);
38504 dots.push(dots[0]);
38505 res = res.concat(dots);
38509 res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
38510 r = ["U"].concat(res[res.length - 1].slice(-2));
38516 for (j = 1, jj = pa.length; j < jj; j++) {
38517 r[j] = +pa[j] + ((j % 2) ? x : y);
38520 } else if (pa0 == "R") {
38521 dots = [x, y].concat(pa.slice(1));
38523 res = res.concat(catmullRom2bezier(dots, crz));
38524 r = ["R"].concat(pa.slice(-2));
38525 } else if (pa0 == "O") {
38527 dots = ellipsePath(x, y, pa[1], pa[2]);
38528 dots.push(dots[0]);
38529 res = res.concat(dots);
38530 } else if (pa0 == "U") {
38532 res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
38533 r = ["U"].concat(res[res.length - 1].slice(-2));
38535 for (var k = 0, kk = pa.length; k < kk; k++) {
38539 pa0 = pa0.toUpperCase();
38553 mx = r[r.length - 2];
38554 my = r[r.length - 1];
38556 x = r[r.length - 2];
38557 y = r[r.length - 1];
38561 res.toString = toString;
38562 pth.abs = pathClone(res);
38566 function l2c(x1, y1, x2, y2) {
38567 return [x1, y1, x2, y2, x2, y2];
38570 function q2c(x1, y1, ax, ay, x2, y2) {
38574 _13 * x1 + _23 * ax,
38575 _13 * y1 + _23 * ay,
38576 _13 * x2 + _23 * ax,
38577 _13 * y2 + _23 * ay,
38583 function a2c(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
38584 // for more information of where this math came from visit:
38585 // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
38586 var _120 = PI * 120 / 180,
38587 rad = PI / 180 * (+angle || 0),
38590 rotate = Snap._.cacher(function(x, y, rad) {
38591 var X = x * math.cos(rad) - y * math.sin(rad),
38592 Y = x * math.sin(rad) + y * math.cos(rad);
38599 xy = rotate(x1, y1, -rad);
38602 xy = rotate(x2, y2, -rad);
38605 var cos = math.cos(PI / 180 * angle),
38606 sin = math.sin(PI / 180 * angle),
38609 var h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
38617 k = (large_arc_flag == sweep_flag ? -1 : 1) *
38618 math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))),
38619 cx = k * rx * y / ry + (x1 + x2) / 2,
38620 cy = k * -ry * x / rx + (y1 + y2) / 2,
38621 f1 = math.asin(((y1 - cy) / ry).toFixed(9)),
38622 f2 = math.asin(((y2 - cy) / ry).toFixed(9));
38624 f1 = x1 < cx ? PI - f1 : f1;
38625 f2 = x2 < cx ? PI - f2 : f2;
38626 f1 < 0 && (f1 = PI * 2 + f1);
38627 f2 < 0 && (f2 = PI * 2 + f2);
38628 if (sweep_flag && f1 > f2) {
38631 if (!sweep_flag && f2 > f1) {
38641 if (abs(df) > _120) {
38645 f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
38646 x2 = cx + rx * math.cos(f2);
38647 y2 = cy + ry * math.sin(f2);
38648 res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
38651 var c1 = math.cos(f1),
38655 t = math.tan(df / 4),
38656 hx = 4 / 3 * rx * t,
38657 hy = 4 / 3 * ry * t,
38659 m2 = [x1 + hx * s1, y1 - hy * c1],
38660 m3 = [x2 + hx * s2, y2 - hy * c2],
38662 m2[0] = 2 * m1[0] - m2[0];
38663 m2[1] = 2 * m1[1] - m2[1];
38665 return [m2, m3, m4].concat(res);
38667 res = [m2, m3, m4].concat(res).join().split(",");
38669 for (var i = 0, ii = res.length; i < ii; i++) {
38670 newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
38676 function findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
38679 x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x,
38680 y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y
38684 // Returns bounding box of cubic bezier curve.
38686 // http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
38687 // Original version: NISHIO Hirokazu
38688 // Modifications: https://github.com/timo22345
38689 function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {
38695 a, b, c, t, t1, t2, b2ac, sqrtb2ac;
38696 for (var i = 0; i < 2; ++i) {
38698 b = 6 * x0 - 12 * x1 + 6 * x2;
38699 a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
38700 c = 3 * x1 - 3 * x0;
38702 b = 6 * y0 - 12 * y1 + 6 * y2;
38703 a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
38704 c = 3 * y1 - 3 * y0;
38706 if (abs(a) < 1e-12) {
38707 if (abs(b) < 1e-12) {
38711 if (0 < t && t < 1) {
38716 b2ac = b * b - 4 * c * a;
38717 sqrtb2ac = math.sqrt(b2ac);
38721 t1 = (-b + sqrtb2ac) / (2 * a);
38722 if (0 < t1 && t1 < 1) {
38725 t2 = (-b - sqrtb2ac) / (2 * a);
38726 if (0 < t2 && t2 < 1) {
38731 var x, y, j = tvalues.length,
38737 bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);
38738 bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);
38741 bounds[0][jlen] = x0;
38742 bounds[1][jlen] = y0;
38743 bounds[0][jlen + 1] = x3;
38744 bounds[1][jlen + 1] = y3;
38745 bounds[0].length = bounds[1].length = jlen + 2;
38750 x: mmin.apply(0, bounds[0]),
38751 y: mmin.apply(0, bounds[1])
38754 x: mmax.apply(0, bounds[0]),
38755 y: mmax.apply(0, bounds[1])
38760 function path2curve(path, path2) {
38761 var pth = !path2 && paths(path);
38762 if (!path2 && pth.curve) {
38763 return pathClone(pth.curve);
38765 var p = pathToAbsolute(path),
38766 p2 = path2 && pathToAbsolute(path2),
38787 processPath = function(path, d, pcom) {
38790 return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
38794 }) && (d.qx = d.qy = null);
38801 path = ["C"].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));
38804 if (pcom == "C" || pcom == "S") { // In "S" case we
38805 // have to take into
38807 // previous command
38809 nx = d.x * 2 - d.bx; // And reflect the
38811 ny = d.y * 2 - d.by; // command's control
38812 // point relative to
38815 } else { // or some else or
38820 path = ["C", nx, ny].concat(path.slice(1));
38823 if (pcom == "Q" || pcom == "T") { // In "T" case we
38824 // have to take into
38826 // previous command
38828 d.qx = d.x * 2 - d.qx; // And make a
38831 d.qy = d.y * 2 - d.qy; // to case "S".
38832 } else { // or something else
38837 path = ["C"].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
38842 path = ["C"].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
38845 path = ["C"].concat(l2c(d.x, d.y, path[1], path[2]));
38848 path = ["C"].concat(l2c(d.x, d.y, path[1], d.y));
38851 path = ["C"].concat(l2c(d.x, d.y, d.x, path[1]));
38854 path = ["C"].concat(l2c(d.x, d.y, d.X, d.Y));
38859 fixArc = function(pp, i) {
38860 if (pp[i].length > 7) {
38863 while (pi.length) {
38864 pcoms1[i] = "A"; // if created multiple C:s, their
38865 // original seg is saved
38866 p2 && (pcoms2[i] = "A"); // the same as above
38867 pp.splice(i++, 0, ["C"].concat(pi.splice(0, 6)));
38870 ii = mmax(p.length, p2 && p2.length || 0);
38873 fixM = function(path1, path2, a1, a2, i) {
38874 if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
38875 path2.splice(i, 0, ["M", a2.x, a2.y]);
38878 a1.x = path1[i][1];
38879 a1.y = path1[i][2];
38880 ii = mmax(p.length, p2 && p2.length || 0);
38883 pcoms1 = [], // path commands of original path p
38884 pcoms2 = [], // path commands of original path p2
38885 pfirst = "", // temporary holder for original path command
38886 pcom = ""; // holder for previous path command of original path
38887 for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) {
38888 p[i] && (pfirst = p[i][0]); // save current path command
38890 if (pfirst != "C") // C is not saved yet, because it may be result
38893 pcoms1[i] = pfirst; // Save current path command
38894 i && (pcom = pcoms1[i - 1]); // Get previous path command
38897 p[i] = processPath(p[i], attrs, pcom); // Previous path command is
38898 // inputted to processPath
38900 if (pcoms1[i] != "A" && pfirst == "C") pcoms1[i] = "C"; // A is the
38903 // which may produce multiple C:s
38904 // so we have to make sure that C is also C in original path
38906 fixArc(p, i); // fixArc adds also the right amount of A:s to
38909 if (p2) { // the same procedures is done to p2
38910 p2[i] && (pfirst = p2[i][0]);
38911 if (pfirst != "C") {
38912 pcoms2[i] = pfirst;
38913 i && (pcom = pcoms2[i - 1]);
38915 p2[i] = processPath(p2[i], attrs2, pcom);
38917 if (pcoms2[i] != "A" && pfirst == "C") {
38923 fixM(p, p2, attrs, attrs2, i);
38924 fixM(p2, p, attrs2, attrs, i);
38926 seg2 = p2 && p2[i],
38927 seglen = seg.length,
38928 seg2len = p2 && seg2.length;
38929 attrs.x = seg[seglen - 2];
38930 attrs.y = seg[seglen - 1];
38931 attrs.bx = toFloat(seg[seglen - 4]) || attrs.x;
38932 attrs.by = toFloat(seg[seglen - 3]) || attrs.y;
38933 attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x);
38934 attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y);
38935 attrs2.x = p2 && seg2[seg2len - 2];
38936 attrs2.y = p2 && seg2[seg2len - 1];
38939 pth.curve = pathClone(p);
38941 return p2 ? [p, p2] : p;
38944 function mapPath(path, matrix) {
38948 var x, y, i, j, ii, jj, pathi;
38949 path = path2curve(path);
38950 for (i = 0, ii = path.length; i < ii; i++) {
38952 for (j = 1, jj = pathi.length; j < jj; j += 2) {
38953 x = matrix.x(pathi[j], pathi[j + 1]);
38954 y = matrix.y(pathi[j], pathi[j + 1]);
38962 // http://schepers.cc/getting-to-the-point
38963 function catmullRom2bezier(crp, z) {
38965 for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {
38985 } else if (iLen - 4 == i) {
38990 } else if (iLen - 2 == i) {
39001 if (iLen - 4 == i) {
39010 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,
39023 * \ Snap.path.getTotalLength [ method ] * Returns the length of the given
39024 * path in pixels * - path (string) SVG path string * = (number) length \
39026 Snap.path.getTotalLength = getTotalLength;
39028 * \ Snap.path.getPointAtLength [ method ] * Returns the coordinates of the
39029 * point located at the given length along the given path * - path (string)
39030 * SVG path string - length (number) length, in pixels, from the start of
39031 * the path, excluding non-rendering jumps * = (object) representation of
39032 * the point: o { o x: (number) x coordinate, o y: (number) y coordinate, o
39033 * alpha: (number) angle of derivative o } \
39035 Snap.path.getPointAtLength = getPointAtLength;
39037 * \ Snap.path.getSubpath [ method ] * Returns the subpath of a given path
39038 * between given start and end lengths * - path (string) SVG path string -
39039 * from (number) length, in pixels, from the start of the path to the start
39040 * of the segment - to (number) length, in pixels, from the start of the
39041 * path to the end of the segment * = (string) path string definition for
39044 Snap.path.getSubpath = function(path, from, to) {
39045 if (this.getTotalLength(path) - to < 1e-6) {
39046 return getSubpathsAtLength(path, from).end;
39048 var a = getSubpathsAtLength(path, to, 1);
39049 return from ? getSubpathsAtLength(a, from).end : a;
39052 * \ Element.getTotalLength [ method ] * Returns the length of the path in
39053 * pixels (only works for `path` elements) = (number) length \
39055 elproto.getTotalLength = function() {
39056 if (this.node.getTotalLength) {
39057 return this.node.getTotalLength();
39060 // SIERRA Element.getPointAtLength()/Element.getTotalLength(): If a <path>
39061 // is broken into different segments, is the jump distance to the new
39062 // coordinates set by the _M_ or _m_ commands calculated as part of the
39063 // path's total length?
39065 * \ Element.getPointAtLength [ method ] * Returns coordinates of the point
39066 * located at the given length on the given path (only works for `path`
39067 * elements) * - length (number) length, in pixels, from the start of the
39068 * path, excluding non-rendering jumps * = (object) representation of the
39069 * point: o { o x: (number) x coordinate, o y: (number) y coordinate, o
39070 * alpha: (number) angle of derivative o } \
39072 elproto.getPointAtLength = function(length) {
39073 return getPointAtLength(this.attr("d"), length);
39075 // SIERRA Element.getSubpath(): Similar to the problem for
39076 // Element.getPointAtLength(). Unclear how this would work for a segmented
39077 // path. Overall, the concept of _subpath_ and what I'm calling a _segment_
39078 // (series of non-_M_ or _Z_ commands) is unclear.
39080 * \ Element.getSubpath [ method ] * Returns subpath of a given element from
39081 * given start and end lengths (only works for `path` elements) * - from
39082 * (number) length, in pixels, from the start of the path to the start of
39083 * the segment - to (number) length, in pixels, from the start of the path
39084 * to the end of the segment * = (string) path string definition for the
39087 elproto.getSubpath = function(from, to) {
39088 return Snap.path.getSubpath(this.attr("d"), from, to);
39092 * \ Snap.path.findDotsAtSegment [ method ] * Utility method * Finds dot
39093 * coordinates on the given cubic beziér curve at the given t - p1x
39094 * (number) x of the first point of the curve - p1y (number) y of the first
39095 * point of the curve - c1x (number) x of the first anchor of the curve -
39096 * c1y (number) y of the first anchor of the curve - c2x (number) x of the
39097 * second anchor of the curve - c2y (number) y of the second anchor of the
39098 * curve - p2x (number) x of the second point of the curve - p2y (number) y
39099 * of the second point of the curve - t (number) position on the curve
39100 * (0..1) = (object) point information in format: o { o x: (number) x
39101 * coordinate of the point, o y: (number) y coordinate of the point, o m: {
39102 * o x: (number) x coordinate of the left anchor, o y: (number) y coordinate
39103 * of the left anchor o }, o n: { o x: (number) x coordinate of the right
39104 * anchor, o y: (number) y coordinate of the right anchor o }, o start: { o
39105 * x: (number) x coordinate of the start of the curve, o y: (number) y
39106 * coordinate of the start of the curve o }, o end: { o x: (number) x
39107 * coordinate of the end of the curve, o y: (number) y coordinate of the end
39108 * of the curve o }, o alpha: (number) angle of the curve derivative at the
39111 Snap.path.findDotsAtSegment = findDotsAtSegment;
39113 * \ Snap.path.bezierBBox [ method ] * Utility method * Returns the bounding
39114 * box of a given cubic beziér curve - p1x (number) x of the first point
39115 * of the curve - p1y (number) y of the first point of the curve - c1x
39116 * (number) x of the first anchor of the curve - c1y (number) y of the first
39117 * anchor of the curve - c2x (number) x of the second anchor of the curve -
39118 * c2y (number) y of the second anchor of the curve - p2x (number) x of the
39119 * second point of the curve - p2y (number) y of the second point of the
39120 * curve or - bez (array) array of six points for beziér curve = (object)
39121 * bounding box o { o x: (number) x coordinate of the left top point of the
39122 * box, o y: (number) y coordinate of the left top point of the box, o x2:
39123 * (number) x coordinate of the right bottom point of the box, o y2:
39124 * (number) y coordinate of the right bottom point of the box, o width:
39125 * (number) width of the box, o height: (number) height of the box o } \
39127 Snap.path.bezierBBox = bezierBBox;
39129 * \ Snap.path.isPointInsideBBox [ method ] * Utility method * Returns
39130 * `true` if given point is inside bounding box - bbox (string) bounding box -
39131 * x (string) x coordinate of the point - y (string) y coordinate of the
39132 * point = (boolean) `true` if point is inside \
39134 Snap.path.isPointInsideBBox = isPointInsideBBox;
39136 * \ Snap.path.isBBoxIntersect [ method ] * Utility method * Returns `true`
39137 * if two bounding boxes intersect - bbox1 (string) first bounding box -
39138 * bbox2 (string) second bounding box = (boolean) `true` if bounding boxes
39141 Snap.path.isBBoxIntersect = isBBoxIntersect;
39143 * \ Snap.path.intersection [ method ] * Utility method * Finds
39144 * intersections of two paths - path1 (string) path string - path2 (string)
39145 * path string = (array) dots of intersection o [ o { o x: (number) x
39146 * coordinate of the point, o y: (number) y coordinate of the point, o t1:
39147 * (number) t value for segment of path1, o t2: (number) t value for segment
39148 * of path2, o segment1: (number) order number for segment of path1, o
39149 * segment2: (number) order number for segment of path2, o bez1: (array)
39150 * eight coordinates representing beziér curve for the segment of path1,
39151 * o bez2: (array) eight coordinates representing beziér curve for the
39152 * segment of path2 o } o ] \
39154 Snap.path.intersection = pathIntersection;
39155 Snap.path.intersectionNumber = pathIntersectionNumber;
39157 * \ Snap.path.isPointInside [ method ] * Utility method * Returns `true` if
39158 * given point is inside a given closed path.
39160 * Note: fill mode doesn’t affect the result of this method. - path
39161 * (string) path string - x (number) x of the point - y (number) y of the
39162 * point = (boolean) `true` if point is inside the path \
39164 Snap.path.isPointInside = isPointInsidePath;
39166 * \ Snap.path.getBBox [ method ] * Utility method * Returns the bounding
39167 * box of a given path - path (string) path string = (object) bounding box o {
39168 * o x: (number) x coordinate of the left top point of the box, o y:
39169 * (number) y coordinate of the left top point of the box, o x2: (number) x
39170 * coordinate of the right bottom point of the box, o y2: (number) y
39171 * coordinate of the right bottom point of the box, o width: (number) width
39172 * of the box, o height: (number) height of the box o } \
39174 Snap.path.getBBox = pathBBox;
39175 Snap.path.get = getPath;
39177 * \ Snap.path.toRelative [ method ] * Utility method * Converts path
39178 * coordinates into relative values - path (string) path string = (array)
39181 Snap.path.toRelative = pathToRelative;
39183 * \ Snap.path.toAbsolute [ method ] * Utility method * Converts path
39184 * coordinates into absolute values - path (string) path string = (array)
39187 Snap.path.toAbsolute = pathToAbsolute;
39189 * \ Snap.path.toCubic [ method ] * Utility method * Converts path to a new
39190 * path where all segments are cubic beziér curves - pathString
39191 * (string|array) path string or array of segments = (array) array of
39194 Snap.path.toCubic = path2curve;
39196 * \ Snap.path.map [ method ] * Transform the path string with the given
39197 * matrix - path (string) path string - matrix (object) see @Matrix =
39198 * (string) transformed path string \
39200 Snap.path.map = mapPath;
39201 Snap.path.toString = toString;
39202 Snap.path.clone = pathClone;
39204 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
39206 // Licensed under the Apache License, Version 2.0 (the "License");
39207 // you may not use this file except in compliance with the License.
39208 // You may obtain a copy of the License at
39210 // http://www.apache.org/licenses/LICENSE-2.0
39212 // Unless required by applicable law or agreed to in writing, software
39213 // distributed under the License is distributed on an "AS IS" BASIS,
39214 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39215 // See the License for the specific language governing permissions and
39216 // limitations under the License.
39217 Snap.plugin(function(Snap, Element, Paper, glob) {
39218 var elproto = Element.prototype,
39219 has = "hasOwnProperty",
39220 supportsTouch = "createTouch" in glob.doc,
39222 "click", "dblclick", "mousedown", "mousemove", "mouseout",
39223 "mouseover", "mouseup", "touchstart", "touchmove", "touchend",
39224 "touchcancel", "keyup"
39227 mousedown: "touchstart",
39228 mousemove: "touchmove",
39229 mouseup: "touchend"
39231 getScroll = function(xy, el) {
39232 var name = xy == "y" ? "scrollTop" : "scrollLeft",
39233 doc = el && el.node ? el.node.ownerDocument : glob.doc;
39234 return doc[name in doc.documentElement ? "documentElement" : "body"][name];
39236 preventDefault = function() {
39237 this.returnValue = false;
39239 preventTouch = function() {
39240 return this.originalEvent.preventDefault();
39242 stopPropagation = function() {
39243 this.cancelBubble = true;
39245 stopTouch = function() {
39246 return this.originalEvent.stopPropagation();
39248 addEvent = (function() {
39249 if (glob.doc.addEventListener) {
39250 return function(obj, type, fn, element) {
39251 var realName = supportsTouch && touchMap[type] ? touchMap[type] : type,
39253 var scrollY = getScroll("y", element),
39254 scrollX = getScroll("x", element);
39255 if (supportsTouch && touchMap[has](type)) {
39256 for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) {
39257 if (e.targetTouches[i].target == obj || obj.contains(e.targetTouches[i].target)) {
39259 e = e.targetTouches[i];
39260 e.originalEvent = olde;
39261 e.preventDefault = preventTouch;
39262 e.stopPropagation = stopTouch;
39267 var x = e.clientX + scrollX,
39268 y = e.clientY + scrollY;
39269 return fn.call(element, e, x, y);
39272 if (type !== realName) {
39273 obj.addEventListener(type, f, false);
39276 obj.addEventListener(realName, f, false);
39278 return function() {
39279 if (type !== realName) {
39280 obj.removeEventListener(type, f, false);
39283 obj.removeEventListener(realName, f, false);
39287 } else if (glob.doc.attachEvent) {
39288 return function(obj, type, fn, element) {
39289 var f = function(e) {
39290 e = e || element.node.ownerDocument.window.event;
39291 var scrollY = getScroll("y", element),
39292 scrollX = getScroll("x", element),
39293 x = e.clientX + scrollX,
39294 y = e.clientY + scrollY;
39295 e.preventDefault = e.preventDefault || preventDefault;
39296 e.stopPropagation = e.stopPropagation || stopPropagation;
39297 return fn.call(element, e, x, y);
39299 obj.attachEvent("on" + type, f);
39300 var detacher = function() {
39301 obj.detachEvent("on" + type, f);
39309 dragMove = function(e) {
39312 scrollY = getScroll("y"),
39313 scrollX = getScroll("x"),
39318 if (supportsTouch) {
39319 var i = e.touches && e.touches.length,
39322 touch = e.touches[i];
39323 if (touch.identifier == dragi.el._drag.id || dragi.el.node.contains(touch.target)) {
39326 (e.originalEvent ? e.originalEvent : e).preventDefault();
39331 e.preventDefault();
39333 var node = dragi.el.node,
39335 next = node.nextSibling,
39336 parent = node.parentNode,
39337 display = node.style.display;
39338 // glob.win.opera && parent.removeChild(node);
39339 // node.style.display = "none";
39340 // o = dragi.el.paper.getElementByPoint(x, y);
39341 // node.style.display = display;
39342 // glob.win.opera && (next ? parent.insertBefore(node, next) :
39343 // parent.appendChild(node));
39344 // o && eve("snap.drag.over." + dragi.el.id, dragi.el, o);
39347 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);
39350 dragUp = function(e) {
39351 Snap.unmousemove(dragMove).unmouseup(dragUp);
39352 var i = drag.length,
39356 dragi.el._drag = {};
39357 eve("snap.drag.end." + dragi.el.id, dragi.end_scope || dragi.start_scope || dragi.move_scope || dragi.el, e);
39362 * \ Element.click [ method ] * Adds a click event handler to the element -
39363 * handler (function) handler for the event = (object) @Element \
39366 * \ Element.unclick [ method ] * Removes a click event handler from the
39367 * element - handler (function) handler for the event = (object) @Element \
39371 * \ Element.dblclick [ method ] * Adds a double click event handler to the
39372 * element - handler (function) handler for the event = (object) @Element \
39375 * \ Element.undblclick [ method ] * Removes a double click event handler
39376 * from the element - handler (function) handler for the event = (object)
39381 * \ Element.mousedown [ method ] * Adds a mousedown event handler to the
39382 * element - handler (function) handler for the event = (object) @Element \
39385 * \ Element.unmousedown [ method ] * Removes a mousedown event handler from
39386 * the element - handler (function) handler for the event = (object)
39391 * \ Element.mousemove [ method ] * Adds a mousemove event handler to the
39392 * element - handler (function) handler for the event = (object) @Element \
39395 * \ Element.unmousemove [ method ] * Removes a mousemove event handler from
39396 * the element - handler (function) handler for the event = (object)
39401 * \ Element.mouseout [ method ] * Adds a mouseout event handler to the
39402 * element - handler (function) handler for the event = (object) @Element \
39405 * \ Element.unmouseout [ method ] * Removes a mouseout event handler from
39406 * the element - handler (function) handler for the event = (object)
39411 * \ Element.mouseover [ method ] * Adds a mouseover event handler to the
39412 * element - handler (function) handler for the event = (object) @Element \
39415 * \ Element.unmouseover [ method ] * Removes a mouseover event handler from
39416 * the element - handler (function) handler for the event = (object)
39421 * \ Element.mouseup [ method ] * Adds a mouseup event handler to the
39422 * element - handler (function) handler for the event = (object) @Element \
39425 * \ Element.unmouseup [ method ] * Removes a mouseup event handler from the
39426 * element - handler (function) handler for the event = (object) @Element \
39430 * \ Element.touchstart [ method ] * Adds a touchstart event handler to the
39431 * element - handler (function) handler for the event = (object) @Element \
39434 * \ Element.untouchstart [ method ] * Removes a touchstart event handler
39435 * from the element - handler (function) handler for the event = (object)
39440 * \ Element.touchmove [ method ] * Adds a touchmove event handler to the
39441 * element - handler (function) handler for the event = (object) @Element \
39444 * \ Element.untouchmove [ method ] * Removes a touchmove event handler from
39445 * the element - handler (function) handler for the event = (object)
39450 * \ Element.touchend [ method ] * Adds a touchend event handler to the
39451 * element - handler (function) handler for the event = (object) @Element \
39454 * \ Element.untouchend [ method ] * Removes a touchend event handler from
39455 * the element - handler (function) handler for the event = (object)
39460 * \ Element.touchcancel [ method ] * Adds a touchcancel event handler to
39461 * the element - handler (function) handler for the event = (object)
39465 * \ Element.untouchcancel [ method ] * Removes a touchcancel event handler
39466 * from the element - handler (function) handler for the event = (object)
39469 for (var i = events.length; i--;) {
39470 (function(eventName) {
39471 Snap[eventName] = elproto[eventName] = function(fn, scope) {
39472 if (Snap.is(fn, "function")) {
39473 this.events = this.events || [];
39477 unbind: addEvent(this.node || document, eventName, fn, scope || this)
39482 Snap["un" + eventName] =
39483 elproto["un" + eventName] = function(fn) {
39484 var events = this.events || [],
39487 if (events[l].name == eventName &&
39488 (events[l].f == fn || !fn)) {
39489 events[l].unbind();
39490 events.splice(l, 1);
39491 !events.length && delete this.events;
39499 * \ Element.hover [ method ] * Adds hover event handlers to the element -
39500 * f_in (function) handler for hover in - f_out (function) handler for hover
39501 * out - icontext (object) #optional context for hover in handler - ocontext
39502 * (object) #optional context for hover out handler = (object) @Element \
39504 elproto.hover = function(f_in, f_out, scope_in, scope_out) {
39505 return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in);
39508 * \ Element.unhover [ method ] * Removes hover event handlers from the
39509 * element - f_in (function) handler for hover in - f_out (function) handler
39510 * for hover out = (object) @Element \
39512 elproto.unhover = function(f_in, f_out) {
39513 return this.unmouseover(f_in).unmouseout(f_out);
39515 var draggable = [];
39516 // SIERRA unclear what _context_ refers to for starting, ending, moving the
39518 // SIERRA Element.drag(): _x position of the mouse_: Where are the x/y
39519 // values offset from?
39520 // SIERRA Element.drag(): much of this member's doc appears to be duplicated
39521 // for some reason.
39522 // SIERRA Unclear about this sentence: _Additionally following drag events
39523 // will be triggered: drag.start.<id> on start, drag.end.<id> on end and
39524 // drag.move.<id> on every move._ Is there a global _drag_ object to which
39525 // you can assign handlers keyed by an element's ID?
39527 * \ Element.drag [ method ] * Adds event handlers for an element's drag
39528 * gesture * - onmove (function) handler for moving - onstart (function)
39529 * handler for drag start - onend (function) handler for drag end - mcontext
39530 * (object) #optional context for moving handler - scontext (object)
39531 * #optional context for drag start handler - econtext (object) #optional
39532 * context for drag end handler Additionaly following `drag` events are
39533 * triggered: `drag.start.<id>` on start, `drag.end.<id>` on end and
39534 * `drag.move.<id>` on every move. When element is dragged over another
39535 * element `drag.over.<id>` fires as well.
39537 * Start event and start handler are called in specified context or in
39538 * context of the element with following parameters: o x (number) x position
39539 * of the mouse o y (number) y position of the mouse o event (object) DOM
39540 * event object Move event and move handler are called in specified context
39541 * or in context of the element with following parameters: o dx (number)
39542 * shift by x from the start point o dy (number) shift by y from the start
39543 * point o x (number) x position of the mouse o y (number) y position of the
39544 * mouse o event (object) DOM event object End event and end handler are
39545 * called in specified context or in context of the element with following
39546 * parameters: o event (object) DOM event object = (object) @Element \
39548 elproto.drag = function(onmove, onstart, onend, move_scope, start_scope, end_scope) {
39549 if (!arguments.length) {
39551 return this.drag(function(dx, dy) {
39553 transform: origTransform + (origTransform ? "T" : "t") + [dx, dy]
39556 origTransform = this.transform().local;
39560 function start(e, x, y) {
39561 (e.originalEvent || e).preventDefault();
39564 this._drag.id = e.identifier;
39565 !drag.length && Snap.mousemove(dragMove).mouseup(dragUp);
39568 move_scope: move_scope,
39569 start_scope: start_scope,
39570 end_scope: end_scope
39572 onstart && eve.on("snap.drag.start." + this.id, onstart);
39573 onmove && eve.on("snap.drag.move." + this.id, onmove);
39574 onend && eve.on("snap.drag.end." + this.id, onend);
39575 eve("snap.drag.start." + this.id, start_scope || move_scope || this, x, y, e);
39582 this.mousedown(start);
39586 * Element.onDragOver [ method ] * Shortcut to assign event handler for
39587 * `drag.over.<id>` event, where `id` is the element's `id` (see
39588 * @Element.id) - f (function) handler for event, first argument would be
39589 * the element you are dragging over \
39591 // elproto.onDragOver = function (f) {
39592 // f ? eve.on("snap.drag.over." + this.id, f) : eve.unbind("snap.drag.over."
39596 * \ Element.undrag [ method ] * Removes all drag event handlers from the
39599 elproto.undrag = function() {
39600 var i = draggable.length;
39602 if (draggable[i].el == this) {
39603 this.unmousedown(draggable[i].start);
39604 draggable.splice(i, 1);
39605 eve.unbind("snap.drag.*." + this.id);
39606 }!draggable.length && Snap.unmousemove(dragMove).unmouseup(dragUp);
39610 // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
39612 // Licensed under the Apache License, Version 2.0 (the "License");
39613 // you may not use this file except in compliance with the License.
39614 // You may obtain a copy of the License at
39616 // http://www.apache.org/licenses/LICENSE-2.0
39618 // Unless required by applicable law or agreed to in writing, software
39619 // distributed under the License is distributed on an "AS IS" BASIS,
39620 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39621 // See the License for the specific language governing permissions and
39622 // limitations under the License.
39623 Snap.plugin(function(Snap, Element, Paper, glob) {
39624 var elproto = Element.prototype,
39625 pproto = Paper.prototype,
39626 rgurl = /^\s*url\((.+)\)/,
39631 * \ Paper.filter [ method ] * Creates a `<filter>` element * - filstr
39632 * (string) SVG fragment of filter provided as a string = (object) @Element
39633 * Note: It is recommended to use filters embedded into the page inside an
39634 * empty SVG element. > Usage | var f = paper.filter('<feGaussianBlur
39635 * stdDeviation="2"/>'), | c = paper.circle(10, 10, 10).attr({ | filter: f |
39638 pproto.filter = function(filstr) {
39640 if (paper.type != "svg") {
39641 paper = paper.paper;
39643 var f = Snap.parse(Str(filstr)),
39645 width = paper.node.offsetWidth,
39646 height = paper.node.offsetHeight,
39647 filter = $("filter");
39650 filterUnits: "userSpaceOnUse"
39652 filter.appendChild(f.node);
39653 paper.defs.appendChild(filter);
39654 return new Element(filter);
39657 eve.on("snap.util.getattr.filter", function() {
39659 var p = $(this.node, "filter");
39661 var match = Str(p).match(rgurl);
39662 return match && Snap.select(match[1]);
39665 eve.on("snap.util.attr.filter", function(value) {
39666 if (value instanceof Element && value.type == "filter") {
39668 var id = value.node.id;
39676 filter: Snap.url(id)
39679 if (!value || value == "none") {
39681 this.node.removeAttribute("filter");
39685 * \ Snap.filter.blur [ method ] * Returns an SVG markup string for the blur
39686 * filter * - x (number) amount of horizontal blur, in pixels - y (number)
39687 * #optional amount of vertical blur, in pixels = (string) filter
39688 * representation > Usage | var f = paper.filter(Snap.filter.blur(5, 10)), |
39689 * c = paper.circle(10, 10, 10).attr({ | filter: f | }); \
39691 Snap.filter.blur = function(x, y) {
39695 var def = y == null ? x : [x, y];
39696 return Snap.format('\<feGaussianBlur stdDeviation="{def}"/>', {
39700 Snap.filter.blur.toString = function() {
39704 * \ Snap.filter.shadow [ method ] * Returns an SVG markup string for the
39705 * shadow filter * - dx (number) #optional horizontal shift of the shadow,
39706 * in pixels - dy (number) #optional vertical shift of the shadow, in pixels -
39707 * blur (number) #optional amount of blur - color (string) #optional color
39708 * of the shadow - opacity (number) #optional `0..1` opacity of the shadow
39709 * or - dx (number) #optional horizontal shift of the shadow, in pixels - dy
39710 * (number) #optional vertical shift of the shadow, in pixels - color
39711 * (string) #optional color of the shadow - opacity (number) #optional
39712 * `0..1` opacity of the shadow which makes blur default to `4`. Or - dx
39713 * (number) #optional horizontal shift of the shadow, in pixels - dy
39714 * (number) #optional vertical shift of the shadow, in pixels - opacity
39715 * (number) #optional `0..1` opacity of the shadow = (string) filter
39716 * representation > Usage | var f = paper.filter(Snap.filter.shadow(0, 2,
39717 * 3)), | c = paper.circle(10, 10, 10).attr({ | filter: f | }); \
39719 Snap.filter.shadow = function(dx, dy, blur, color, opacity) {
39720 if (typeof blur == "string") {
39725 if (typeof color != "string") {
39729 color = color || "#000";
39730 if (blur == null) {
39733 if (opacity == null) {
39743 color = Snap.color(color);
39744 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>', {
39752 Snap.filter.shadow.toString = function() {
39756 * \ Snap.filter.grayscale [ method ] * Returns an SVG markup string for the
39757 * grayscale filter * - amount (number) amount of filter (`0..1`) = (string)
39758 * filter representation \
39760 Snap.filter.grayscale = function(amount) {
39761 if (amount == null) {
39764 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"/>', {
39765 a: 0.2126 + 0.7874 * (1 - amount),
39766 b: 0.7152 - 0.7152 * (1 - amount),
39767 c: 0.0722 - 0.0722 * (1 - amount),
39768 d: 0.2126 - 0.2126 * (1 - amount),
39769 e: 0.7152 + 0.2848 * (1 - amount),
39770 f: 0.0722 - 0.0722 * (1 - amount),
39771 g: 0.2126 - 0.2126 * (1 - amount),
39772 h: 0.0722 + 0.9278 * (1 - amount)
39775 Snap.filter.grayscale.toString = function() {
39779 * \ Snap.filter.sepia [ method ] * Returns an SVG markup string for the
39780 * sepia filter * - amount (number) amount of filter (`0..1`) = (string)
39781 * filter representation \
39783 Snap.filter.sepia = function(amount) {
39784 if (amount == null) {
39787 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"/>', {
39788 a: 0.393 + 0.607 * (1 - amount),
39789 b: 0.769 - 0.769 * (1 - amount),
39790 c: 0.189 - 0.189 * (1 - amount),
39791 d: 0.349 - 0.349 * (1 - amount),
39792 e: 0.686 + 0.314 * (1 - amount),
39793 f: 0.168 - 0.168 * (1 - amount),
39794 g: 0.272 - 0.272 * (1 - amount),
39795 h: 0.534 - 0.534 * (1 - amount),
39796 i: 0.131 + 0.869 * (1 - amount)
39799 Snap.filter.sepia.toString = function() {
39803 * \ Snap.filter.saturate [ method ] * Returns an SVG markup string for the
39804 * saturate filter * - amount (number) amount of filter (`0..1`) = (string)
39805 * filter representation \
39807 Snap.filter.saturate = function(amount) {
39808 if (amount == null) {
39811 return Snap.format('<feColorMatrix type="saturate" values="{amount}"/>', {
39815 Snap.filter.saturate.toString = function() {
39819 * \ Snap.filter.hueRotate [ method ] * Returns an SVG markup string for the
39820 * hue-rotate filter * - angle (number) angle of rotation = (string) filter
39823 Snap.filter.hueRotate = function(angle) {
39824 angle = angle || 0;
39825 return Snap.format('<feColorMatrix type="hueRotate" values="{angle}"/>', {
39829 Snap.filter.hueRotate.toString = function() {
39833 * \ Snap.filter.invert [ method ] * Returns an SVG markup string for the
39834 * invert filter * - amount (number) amount of filter (`0..1`) = (string)
39835 * filter representation \
39837 Snap.filter.invert = function(amount) {
39838 if (amount == null) {
39841 return Snap.format('<feComponentTransfer><feFuncR type="table" tableValues="{amount} {amount2}"/><feFuncG type="table" tableValues="{amount} {amount2}"/><feFuncB type="table" tableValues="{amount} {amount2}"/></feComponentTransfer>', {
39843 amount2: 1 - amount
39846 Snap.filter.invert.toString = function() {
39850 * \ Snap.filter.brightness [ method ] * Returns an SVG markup string for
39851 * the brightness filter * - amount (number) amount of filter (`0..1`) =
39852 * (string) filter representation \
39854 Snap.filter.brightness = function(amount) {
39855 if (amount == null) {
39858 return Snap.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}"/><feFuncG type="linear" slope="{amount}"/><feFuncB type="linear" slope="{amount}"/></feComponentTransfer>', {
39862 Snap.filter.brightness.toString = function() {
39866 * \ Snap.filter.contrast [ method ] * Returns an SVG markup string for the
39867 * contrast filter * - amount (number) amount of filter (`0..1`) = (string)
39868 * filter representation \
39870 Snap.filter.contrast = function(amount) {
39871 if (amount == null) {
39874 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>', {
39876 amount2: .5 - amount / 2
39879 Snap.filter.contrast.toString = function() {
39887 "eve": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\eve\\eve.js"
39889 "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\vendor\\snapsvg.js": [function(require, module, exports) {
39892 var snapsvg = module.exports = require('snapsvg');
39894 snapsvg.plugin(function(Snap, Element) {
39897 * \ Element.children [ method ] * Returns array of all the children of the
39898 * element. = (array) array of Elements \
39900 Element.prototype.children = function() {
39902 ch = this.node.childNodes;
39903 for (var i = 0, ii = ch.length; i < ii; i++) {
39904 out[i] = new Snap(ch[i]);
39912 * @class ClassPlugin
39914 * Extends snapsvg with methods to add and remove classes
39916 snapsvg.plugin(function(Snap, Element, Paper, global) {
39918 function split(str) {
39919 return str.split(/\s+/);
39922 function join(array) {
39923 return array.join(' ');
39926 function getClasses(e) {
39927 return split(e.attr('class') || '');
39930 function setClasses(e, classes) {
39931 e.attr('class', join(classes));
39935 * @method snapsvg.Element#addClass
39939 * e.attr('class', 'selector');
39941 * e.addClass('foo bar'); // adds classes foo and bar e.attr('class'); // ->
39942 * 'selector foo bar'
39944 * e.addClass('fooBar'); e.attr('class'); // -> 'selector foo bar fooBar'
39947 * cls classes to be added to the element
39949 * @return {snapsvg.Element} the element (this)
39951 Element.prototype.addClass = function(cls) {
39952 var current = getClasses(this),
39956 for (i = 0, e; !!(e = add[i]); i++) {
39957 if (current.indexOf(e) === -1) {
39962 setClasses(this, current);
39968 * @method snapsvg.Element#hasClass
39971 * cls the class to query for
39972 * @return {Boolean} returns true if the element has the given class
39974 Element.prototype.hasClass = function(cls) {
39976 throw new Error('[snapsvg] syntax: hasClass(clsStr)');
39979 return getClasses(this).indexOf(cls) !== -1;
39983 * @method snapsvg.Element#removeClass
39987 * e.attr('class', 'foo bar');
39989 * e.removeClass('foo'); e.attr('class'); // -> 'bar'
39991 * e.removeClass('foo bar'); // removes classes foo and bar e.attr('class'); // -> ''
39994 * cls classes to be removed from element
39996 * @return {snapsvg.Element} the element (this)
39998 Element.prototype.removeClass = function(cls) {
39999 var current = getClasses(this),
40000 remove = split(cls),
40003 for (i = 0, e; !!(e = remove[i]); i++) {
40004 idx = current.indexOf(e);
40007 // remove element from array
40008 current.splice(idx, 1);
40012 setClasses(this, current);
40020 * @class TranslatePlugin
40022 * Extends snapsvg with methods to translate elements
40024 snapsvg.plugin(function(Snap, Element, Paper, global) {
40027 * @method snapsvg.Element#translate
40031 * e.translate(10, 20);
40032 * // sets transform matrix to translate(10, 20)
40034 * @param {Number} x translation @param {Number} y translation
40036 * @return {snapsvg.Element} the element (this)
40038 Element.prototype.translate = function(x, y) {
40039 var matrix = new Snap.Matrix();
40040 matrix.translate(x, y);
40041 return this.transform(matrix);
40047 * @class CreatePlugin
40049 * Create an svg element without attaching it to the dom
40051 snapsvg.plugin(function(Snap) {
40053 Snap.create = function(name, attrs) {
40054 return Snap._.wrap(Snap._.$(name, attrs));
40060 * @class CreatSnapAtPlugin
40062 * Extends snap.svg with a method to create a SVG element at a specific position
40065 snapsvg.plugin(function(Snap, Element, Paper, global) {
40068 * @method snapsvg.createSnapAt
40072 * snapsvg.createSnapAt(parentNode, 200, 200);
40074 * @param {Number} width of svg @param {Number} height of svg @param
40075 * {Object} parentNode svg Element will be child of this
40077 * @return {snapsvg.Element} the newly created wrapped SVG element instance
40079 Snap.createSnapAt = function(width, height, parentNode) {
40081 var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
40082 svg.setAttribute('width', width);
40083 svg.setAttribute('height', height);
40085 parentNode = document.body;
40087 parentNode.appendChild(svg);
40089 return new Snap(svg);
40093 "snapsvg": "\\bpmn-js-examples-master\\modeler\\node_modules\\diagram-js\\node_modules\\snapsvg\\dist\\snap.svg.js"
40095 "\\bpmn-js-examples-master\\modeler\\node_modules\\jquery\\dist\\jquery.js": [function(require, module, exports) {
40097 * ! jQuery JavaScript Library v2.1.4 http://jquery.com/
40099 * Includes Sizzle.js http://sizzlejs.com/
40101 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors Released
40102 * under the MIT license http://jquery.org/license
40104 * Date: 2015-04-28T16:01Z
40107 (function(global, factory) {
40109 if (typeof module === "object" && typeof module.exports === "object") {
40110 // For CommonJS and CommonJS-like environments where a proper `window`
40111 // is present, execute the factory and get jQuery.
40112 // For environments that do not have a `window` with a `document`
40113 // (such as Node.js), expose a factory as module.exports.
40114 // This accentuates the need for the creation of a real `window`.
40115 // e.g. var jQuery = require("jquery")(window);
40116 // See ticket #14549 for more info.
40117 module.exports = global.document ?
40118 factory(global, true) :
40121 throw new Error("jQuery requires a window with a document");
40129 // Pass this if window is not defined yet
40130 }(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
40132 // Support: Firefox 18+
40133 // Can't be in strict mode, several libs including ASP.NET trace
40134 // the stack via arguments.caller.callee and Firefox dies if
40135 // you try to trace through "use strict" call chains. (#13335)
40140 var slice = arr.slice;
40142 var concat = arr.concat;
40144 var push = arr.push;
40146 var indexOf = arr.indexOf;
40148 var class2type = {};
40150 var toString = class2type.toString;
40152 var hasOwn = class2type.hasOwnProperty;
40159 // Use the correct document accordingly with window argument (sandbox)
40160 document = window.document,
40164 // Define a local copy of jQuery
40165 jQuery = function(selector, context) {
40166 // The jQuery object is actually just the init constructor 'enhanced'
40167 // Need init if jQuery is called (just allow error to be thrown if not
40169 return new jQuery.fn.init(selector, context);
40172 // Support: Android<4.1
40173 // Make sure we trim BOM and NBSP
40174 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
40176 // Matches dashed string for camelizing
40177 rmsPrefix = /^-ms-/,
40178 rdashAlpha = /-([\da-z])/gi,
40180 // Used by jQuery.camelCase as callback to replace()
40181 fcamelCase = function(all, letter) {
40182 return letter.toUpperCase();
40185 jQuery.fn = jQuery.prototype = {
40186 // The current version of jQuery being used
40189 constructor: jQuery,
40191 // Start with an empty selector
40194 // The default length of a jQuery object is 0
40197 toArray: function() {
40198 return slice.call(this);
40201 // Get the Nth element in the matched element set OR
40202 // Get the whole matched element set as a clean array
40203 get: function(num) {
40204 return num != null ?
40206 // Return just the one element from the set
40207 (num < 0 ? this[num + this.length] : this[num]) :
40209 // Return all the elements in a clean array
40213 // Take an array of elements and push it onto the stack
40214 // (returning the new matched element set)
40215 pushStack: function(elems) {
40217 // Build a new jQuery matched element set
40218 var ret = jQuery.merge(this.constructor(), elems);
40220 // Add the old object onto the stack (as a reference)
40221 ret.prevObject = this;
40222 ret.context = this.context;
40224 // Return the newly-formed element set
40228 // Execute a callback for every element in the matched set.
40229 // (You can seed the arguments with an array of args, but this is
40230 // only used internally.)
40231 each: function(callback, args) {
40232 return jQuery.each(this, callback, args);
40235 map: function(callback) {
40236 return this.pushStack(jQuery.map(this, function(elem, i) {
40237 return callback.call(elem, i, elem);
40241 slice: function() {
40242 return this.pushStack(slice.apply(this, arguments));
40245 first: function() {
40250 return this.eq(-1);
40254 var len = this.length,
40255 j = +i + (i < 0 ? len : 0);
40256 return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
40260 return this.prevObject || this.constructor(null);
40263 // For internal use only.
40264 // Behaves like an Array's method, not like a jQuery method.
40270 jQuery.extend = jQuery.fn.extend = function() {
40271 var options, name, src, copy, copyIsArray, clone,
40272 target = arguments[0] || {},
40274 length = arguments.length,
40277 // Handle a deep copy situation
40278 if (typeof target === "boolean") {
40281 // Skip the boolean and the target
40282 target = arguments[i] || {};
40286 // Handle case when target is a string or something (possible in deep copy)
40287 if (typeof target !== "object" && !jQuery.isFunction(target)) {
40291 // Extend jQuery itself if only one argument is passed
40292 if (i === length) {
40297 for (; i < length; i++) {
40298 // Only deal with non-null/undefined values
40299 if ((options = arguments[i]) != null) {
40300 // Extend the base object
40301 for (name in options) {
40302 src = target[name];
40303 copy = options[name];
40305 // Prevent never-ending loop
40306 if (target === copy) {
40310 // Recurse if we're merging plain objects or arrays
40311 if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
40313 copyIsArray = false;
40314 clone = src && jQuery.isArray(src) ? src : [];
40317 clone = src && jQuery.isPlainObject(src) ? src : {};
40320 // Never move original objects, clone them
40321 target[name] = jQuery.extend(deep, clone, copy);
40323 // Don't bring in undefined values
40324 } else if (copy !== undefined) {
40325 target[name] = copy;
40331 // Return the modified object
40336 // Unique for each copy of jQuery on the page
40337 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
40339 // Assume jQuery is ready without the ready module
40342 error: function(msg) {
40343 throw new Error(msg);
40346 noop: function() {},
40348 isFunction: function(obj) {
40349 return jQuery.type(obj) === "function";
40352 isArray: Array.isArray,
40354 isWindow: function(obj) {
40355 return obj != null && obj === obj.window;
40358 isNumeric: function(obj) {
40359 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
40360 // ...but misinterprets leading-number strings, particularly hex
40361 // literals ("0x...")
40362 // subtraction forces infinities to NaN
40363 // adding 1 corrects loss of precision from parseFloat (#15100)
40364 return !jQuery.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0;
40367 isPlainObject: function(obj) {
40368 // Not plain objects:
40369 // - Any object or value whose internal [[Class]] property is not
40370 // "[object Object]"
40373 if (jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
40377 if (obj.constructor &&
40378 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
40382 // If the function hasn't returned already, we're confident that
40383 // |obj| is a plain object, created by {} or constructed with new Object
40387 isEmptyObject: function(obj) {
40389 for (name in obj) {
40395 type: function(obj) {
40399 // Support: Android<4.0, iOS<6 (functionish RegExp)
40400 return typeof obj === "object" || typeof obj === "function" ?
40401 class2type[toString.call(obj)] || "object" :
40405 // Evaluates a script in a global context
40406 globalEval: function(code) {
40410 code = jQuery.trim(code);
40413 // If the code includes a valid, prologue position
40414 // strict mode pragma, execute code by injecting a
40415 // script tag into the document.
40416 if (code.indexOf("use strict") === 1) {
40417 script = document.createElement("script");
40418 script.text = code;
40419 document.head.appendChild(script).parentNode.removeChild(script);
40421 // Otherwise, avoid the DOM node creation, insertion
40422 // and removal by using an indirect global eval
40428 // Convert dashed to camelCase; used by the css and data modules
40429 // Support: IE9-11+
40430 // Microsoft forgot to hump their vendor prefix (#9572)
40431 camelCase: function(string) {
40432 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
40435 nodeName: function(elem, name) {
40436 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
40439 // args is for internal usage only
40440 each: function(obj, callback, args) {
40443 length = obj.length,
40444 isArray = isArraylike(obj);
40448 for (; i < length; i++) {
40449 value = callback.apply(obj[i], args);
40451 if (value === false) {
40457 value = callback.apply(obj[i], args);
40459 if (value === false) {
40465 // A special, fast, case for the most common use of each
40468 for (; i < length; i++) {
40469 value = callback.call(obj[i], i, obj[i]);
40471 if (value === false) {
40477 value = callback.call(obj[i], i, obj[i]);
40479 if (value === false) {
40489 // Support: Android<4.1
40490 trim: function(text) {
40491 return text == null ?
40493 (text + "").replace(rtrim, "");
40496 // results is for internal usage only
40497 makeArray: function(arr, results) {
40498 var ret = results || [];
40501 if (isArraylike(Object(arr))) {
40503 typeof arr === "string" ? [arr] : arr
40506 push.call(ret, arr);
40513 inArray: function(elem, arr, i) {
40514 return arr == null ? -1 : indexOf.call(arr, elem, i);
40517 merge: function(first, second) {
40518 var len = +second.length,
40522 for (; j < len; j++) {
40523 first[i++] = second[j];
40531 grep: function(elems, callback, invert) {
40532 var callbackInverse,
40535 length = elems.length,
40536 callbackExpect = !invert;
40538 // Go through the array, only saving the items
40539 // that pass the validator function
40540 for (; i < length; i++) {
40541 callbackInverse = !callback(elems[i], i);
40542 if (callbackInverse !== callbackExpect) {
40543 matches.push(elems[i]);
40550 // arg is for internal usage only
40551 map: function(elems, callback, arg) {
40554 length = elems.length,
40555 isArray = isArraylike(elems),
40558 // Go through the array, translating each of the items to their new
40561 for (; i < length; i++) {
40562 value = callback(elems[i], i, arg);
40564 if (value != null) {
40569 // Go through every key on the object,
40572 value = callback(elems[i], i, arg);
40574 if (value != null) {
40580 // Flatten any nested arrays
40581 return concat.apply([], ret);
40584 // A global GUID counter for objects
40587 // Bind a function to a context, optionally partially applying any
40589 proxy: function(fn, context) {
40590 var tmp, args, proxy;
40592 if (typeof context === "string") {
40598 // Quick check to determine if target is callable, in the spec
40599 // this throws a TypeError, but we will just return undefined.
40600 if (!jQuery.isFunction(fn)) {
40605 args = slice.call(arguments, 2);
40606 proxy = function() {
40607 return fn.apply(context || this, args.concat(slice.call(arguments)));
40610 // Set the guid of unique handler to the same of original handler, so it
40612 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
40619 // jQuery.support is not used in Core but other projects attach their
40620 // properties to it so it needs to exist.
40624 // Populate the class2type map
40625 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
40626 class2type["[object " + name + "]"] = name.toLowerCase();
40629 function isArraylike(obj) {
40631 // Support: iOS 8.2 (not reproducible in simulator)
40632 // `in` check used to prevent JIT error (gh-2145)
40633 // hasOwn isn't used here due to false negatives
40634 // regarding Nodelist length in IE
40635 var length = "length" in obj && obj.length,
40636 type = jQuery.type(obj);
40638 if (type === "function" || jQuery.isWindow(obj)) {
40642 if (obj.nodeType === 1 && length) {
40646 return type === "array" || length === 0 ||
40647 typeof length === "number" && length > 0 && (length - 1) in obj;
40651 * ! Sizzle CSS Selector Engine v2.2.0-pre http://sizzlejs.com/
40653 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors Released
40654 * under the MIT license http://jquery.org/license
40658 (function(window) {
40672 // Local document vars
40682 // Instance-specific data
40683 expando = "sizzle" + 1 * new Date(),
40684 preferredDoc = window.document,
40687 classCache = createCache(),
40688 tokenCache = createCache(),
40689 compilerCache = createCache(),
40690 sortOrder = function(a, b) {
40692 hasDuplicate = true;
40697 // General-purpose constants
40698 MAX_NEGATIVE = 1 << 31,
40700 // Instance methods
40701 hasOwn = ({}).hasOwnProperty,
40704 push_native = arr.push,
40707 // Use a stripped-down indexOf as it's faster than native
40708 // http://jsperf.com/thor-indexof-vs-for/5
40709 indexOf = function(list, elem) {
40712 for (; i < len; i++) {
40713 if (list[i] === elem) {
40720 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
40722 // Regular expressions
40724 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
40725 whitespace = "[\\x20\\t\\r\\n\\f]",
40726 // http://www.w3.org/TR/css3-syntax/#characters
40727 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
40729 // Loosely modeled on CSS identifier characters
40730 // An unquoted value should be a CSS identifier
40731 // http://www.w3.org/TR/css3-selectors/#attribute-selectors
40733 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
40734 identifier = characterEncoding.replace("w", "w#"),
40736 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
40737 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
40738 // Operator (capture 2)
40739 "*([*^$|!~]?=)" + whitespace +
40740 // "Attribute values must be CSS identifiers [capture 5] or strings
40741 // [capture 3 or capture 4]"
40742 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
40745 pseudos = ":(" + characterEncoding + ")(?:\\((" +
40746 // To reduce the number of selectors needing tokenize in the preFilter,
40747 // prefer arguments:
40748 // 1. quoted (capture 3; capture 4 or capture 5)
40749 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
40750 // 2. simple (capture 6)
40751 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
40752 // 3. anything else (capture 2)
40756 // Leading and non-escaped trailing whitespace, capturing some
40757 // non-whitespace characters preceding the latter
40758 rwhitespace = new RegExp(whitespace + "+", "g"),
40759 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
40761 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
40762 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
40764 rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
40766 rpseudo = new RegExp(pseudos),
40767 ridentifier = new RegExp("^" + identifier + "$"),
40770 "ID": new RegExp("^#(" + characterEncoding + ")"),
40771 "CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
40772 "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
40773 "ATTR": new RegExp("^" + attributes),
40774 "PSEUDO": new RegExp("^" + pseudos),
40775 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
40776 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
40777 "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
40778 "bool": new RegExp("^(?:" + booleans + ")$", "i"),
40779 // For use in libraries implementing .is()
40780 // We use this for POS matching in `select`
40781 "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
40782 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
40785 rinputs = /^(?:input|select|textarea|button)$/i,
40786 rheader = /^h\d$/i,
40788 rnative = /^[^{]+\{\s*\[native \w/,
40790 // Easily-parseable/retrievable ID or TAG or CLASS selectors
40791 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
40796 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
40797 runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
40798 funescape = function(_, escaped, escapedWhitespace) {
40799 var high = "0x" + escaped - 0x10000;
40800 // NaN means non-codepoint
40801 // Support: Firefox<24
40802 // Workaround erroneous numeric interpretation of +"0x"
40803 return high !== high || escapedWhitespace ?
40807 String.fromCharCode(high + 0x10000) :
40808 // Supplemental Plane codepoint (surrogate pair)
40809 String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
40812 // Used for iframes
40813 // See setDocument()
40814 // Removing the function wrapper causes a "Permission Denied"
40816 unloadHandler = function() {
40820 // Optimize for push.apply( _, NodeList )
40823 (arr = slice.call(preferredDoc.childNodes)),
40824 preferredDoc.childNodes
40826 // Support: Android<4.0
40827 // Detect silently failing push.apply
40828 arr[preferredDoc.childNodes.length].nodeType;
40831 apply: arr.length ?
40833 // Leverage slice if possible
40834 function(target, els) {
40835 push_native.apply(target, slice.call(els));
40839 // Otherwise append directly
40840 function(target, els) {
40841 var j = target.length,
40843 // Can't trust NodeList.length
40844 while ((target[j++] = els[i++])) {}
40845 target.length = j - 1;
40850 function Sizzle(selector, context, results, seed) {
40851 var match, elem, m, nodeType,
40853 i, groups, old, nid, newContext, newSelector;
40855 if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
40856 setDocument(context);
40859 context = context || document;
40860 results = results || [];
40861 nodeType = context.nodeType;
40863 if (typeof selector !== "string" || !selector ||
40864 nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
40869 if (!seed && documentIsHTML) {
40871 // Try to shortcut find operations when possible (e.g., not under
40872 // DocumentFragment)
40873 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
40874 // Speed-up: Sizzle("#ID")
40875 if ((m = match[1])) {
40876 if (nodeType === 9) {
40877 elem = context.getElementById(m);
40878 // Check parentNode to catch when Blackberry 4.6 returns
40879 // nodes that are no longer in the document (jQuery #6963)
40880 if (elem && elem.parentNode) {
40881 // Handle the case where IE, Opera, and Webkit return
40883 // by name instead of ID
40884 if (elem.id === m) {
40885 results.push(elem);
40892 // Context is not a document
40893 if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) &&
40894 contains(context, elem) && elem.id === m) {
40895 results.push(elem);
40900 // Speed-up: Sizzle("TAG")
40901 } else if (match[2]) {
40902 push.apply(results, context.getElementsByTagName(selector));
40905 // Speed-up: Sizzle(".CLASS")
40906 } else if ((m = match[3]) && support.getElementsByClassName) {
40907 push.apply(results, context.getElementsByClassName(m));
40913 if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
40914 nid = old = expando;
40915 newContext = context;
40916 newSelector = nodeType !== 1 && selector;
40918 // qSA works strangely on Element-rooted queries
40919 // We can work around this by specifying an extra ID on the root
40920 // and working up from there (Thanks to Andrew Dupont for the
40922 // IE 8 doesn't work on object elements
40923 if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
40924 groups = tokenize(selector);
40926 if ((old = context.getAttribute("id"))) {
40927 nid = old.replace(rescape, "\\$&");
40929 context.setAttribute("id", nid);
40931 nid = "[id='" + nid + "'] ";
40935 groups[i] = nid + toSelector(groups[i]);
40937 newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
40938 newSelector = groups.join(",");
40943 push.apply(results,
40944 newContext.querySelectorAll(newSelector)
40947 } catch (qsaError) {} finally {
40949 context.removeAttribute("id");
40957 return select(selector.replace(rtrim, "$1"), context, results, seed);
40961 * Create key-value caches of limited size
40963 * @returns {Function(string, Object)} Returns the Object data after storing it
40964 * on itself with property name the (space-suffixed) string and (if the
40965 * cache is larger than Expr.cacheLength) deleting the oldest entry
40967 function createCache() {
40970 function cache(key, value) {
40971 // Use (key + " ") to avoid collision with native prototype properties
40972 // (see Issue #157)
40973 if (keys.push(key + " ") > Expr.cacheLength) {
40974 // Only keep the most recent entries
40975 delete cache[keys.shift()];
40977 return (cache[key + " "] = value);
40983 * Mark a function for special use by Sizzle
40985 * @param {Function}
40986 * fn The function to mark
40988 function markFunction(fn) {
40989 fn[expando] = true;
40994 * Support testing using an element
40996 * @param {Function}
40997 * fn Passed the created div and expects a boolean result
40999 function assert(fn) {
41000 var div = document.createElement("div");
41007 // Remove from its parent by default
41008 if (div.parentNode) {
41009 div.parentNode.removeChild(div);
41011 // release memory in IE
41017 * Adds the same handler for all of the specified attrs
41020 * attrs Pipe-separated list of attributes
41021 * @param {Function}
41022 * handler The method that will be applied
41024 function addHandle(attrs, handler) {
41025 var arr = attrs.split("|"),
41029 Expr.attrHandle[arr[i]] = handler;
41034 * Checks document order of two siblings
41040 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a
41043 function siblingCheck(a, b) {
41045 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
41046 (~b.sourceIndex || MAX_NEGATIVE) -
41047 (~a.sourceIndex || MAX_NEGATIVE);
41049 // Use IE sourceIndex if available on both nodes
41054 // Check if b follows a
41056 while ((cur = cur.nextSibling)) {
41067 * Returns a function to use in pseudos for input types
41072 function createInputPseudo(type) {
41073 return function(elem) {
41074 var name = elem.nodeName.toLowerCase();
41075 return name === "input" && elem.type === type;
41080 * Returns a function to use in pseudos for buttons
41085 function createButtonPseudo(type) {
41086 return function(elem) {
41087 var name = elem.nodeName.toLowerCase();
41088 return (name === "input" || name === "button") && elem.type === type;
41093 * Returns a function to use in pseudos for positionals
41095 * @param {Function}
41098 function createPositionalPseudo(fn) {
41099 return markFunction(function(argument) {
41100 argument = +argument;
41101 return markFunction(function(seed, matches) {
41103 matchIndexes = fn([], seed.length, argument),
41104 i = matchIndexes.length;
41106 // Match elements found at the specified indexes
41108 if (seed[(j = matchIndexes[i])]) {
41109 seed[j] = !(matches[j] = seed[j]);
41117 * Checks a node for validity as a Sizzle context
41119 * @param {Element|Object=}
41121 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a
41124 function testContext(context) {
41125 return context && typeof context.getElementsByTagName !== "undefined" && context;
41128 // Expose support vars for convenience
41129 support = Sizzle.support = {};
41132 * Detects XML nodes
41134 * @param {Element|Object}
41135 * elem An element or a document
41136 * @returns {Boolean} True iff elem is a non-HTML XML node
41138 isXML = Sizzle.isXML = function(elem) {
41139 // documentElement is verified for cases where it doesn't yet exist
41140 // (such as loading iframes in IE - #4833)
41141 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
41142 return documentElement ? documentElement.nodeName !== "HTML" : false;
41146 * Sets document-related variables once based on the current document
41148 * @param {Element|Object}
41149 * [doc] An element or document object to use to set the document
41150 * @returns {Object} Returns the current document
41152 setDocument = Sizzle.setDocument = function(node) {
41153 var hasCompare, parent,
41154 doc = node ? node.ownerDocument || node : preferredDoc;
41156 // If no document and documentElement is available, return
41157 if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
41161 // Set our document
41163 docElem = doc.documentElement;
41164 parent = doc.defaultView;
41167 // If iframe document is assigned to "document" variable and if iframe has
41169 // IE will throw "permission denied" error when accessing "document"
41170 // variable, see jQuery #13936
41171 // IE6-8 do not support the defaultView property so parent will be undefined
41172 if (parent && parent !== parent.top) {
41173 // IE11 does not have attachEvent, so all must suffer
41174 if (parent.addEventListener) {
41175 parent.addEventListener("unload", unloadHandler, false);
41176 } else if (parent.attachEvent) {
41177 parent.attachEvent("onunload", unloadHandler);
41183 * ----------------------------------------------------------------------
41185 documentIsHTML = !isXML(doc);
41189 * ----------------------------------------------------------------------
41193 // Verify that getAttribute really returns attributes and not properties
41194 // (excepting IE8 booleans)
41195 support.attributes = assert(function(div) {
41196 div.className = "i";
41197 return !div.getAttribute("className");
41200 /***************************************************************************
41202 * ----------------------------------------------------------------------
41205 // Check if getElementsByTagName("*") returns only elements
41206 support.getElementsByTagName = assert(function(div) {
41207 div.appendChild(doc.createComment(""));
41208 return !div.getElementsByTagName("*").length;
41212 support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
41215 // Check if getElementById returns elements by name
41216 // The broken getElementById methods don't pick up programatically-set
41218 // so use a roundabout getElementsByName test
41219 support.getById = assert(function(div) {
41220 docElem.appendChild(div).id = expando;
41221 return !doc.getElementsByName || !doc.getElementsByName(expando).length;
41224 // ID find and filter
41225 if (support.getById) {
41226 Expr.find["ID"] = function(id, context) {
41227 if (typeof context.getElementById !== "undefined" && documentIsHTML) {
41228 var m = context.getElementById(id);
41229 // Check parentNode to catch when Blackberry 4.6 returns
41230 // nodes that are no longer in the document #6963
41231 return m && m.parentNode ? [m] : [];
41234 Expr.filter["ID"] = function(id) {
41235 var attrId = id.replace(runescape, funescape);
41236 return function(elem) {
41237 return elem.getAttribute("id") === attrId;
41242 // getElementById is not reliable as a find shortcut
41243 delete Expr.find["ID"];
41245 Expr.filter["ID"] = function(id) {
41246 var attrId = id.replace(runescape, funescape);
41247 return function(elem) {
41248 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
41249 return node && node.value === attrId;
41255 Expr.find["TAG"] = support.getElementsByTagName ?
41256 function(tag, context) {
41257 if (typeof context.getElementsByTagName !== "undefined") {
41258 return context.getElementsByTagName(tag);
41260 // DocumentFragment nodes don't have gEBTN
41261 } else if (support.qsa) {
41262 return context.querySelectorAll(tag);
41266 function(tag, context) {
41270 // By happy coincidence, a (broken) gEBTN appears on
41271 // DocumentFragment nodes too
41272 results = context.getElementsByTagName(tag);
41274 // Filter out possible comments
41276 while ((elem = results[i++])) {
41277 if (elem.nodeType === 1) {
41288 Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
41289 if (documentIsHTML) {
41290 return context.getElementsByClassName(className);
41295 * QSA/matchesSelector
41296 * ----------------------------------------------------------------------
41299 // QSA and matchesSelector support
41301 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
41302 rbuggyMatches = [];
41304 // qSa(:focus) reports false when true (Chrome 21)
41305 // We allow this because of a bug in IE8/9 that throws an error
41306 // whenever `document.activeElement` is accessed on an iframe
41307 // So, we allow :focus to pass through QSA all the time to avoid the IE
41309 // See http://bugs.jquery.com/ticket/13378
41312 if ((support.qsa = rnative.test(doc.querySelectorAll))) {
41314 // Regex strategy adopted from Diego Perini
41315 assert(function(div) {
41316 // Select is set to empty string on purpose
41317 // This is to test IE's treatment of not explicitly
41318 // setting a boolean content attribute,
41319 // since its presence should be enough
41320 // http://bugs.jquery.com/ticket/12359
41321 docElem.appendChild(div).innerHTML = "<a id='" + expando + "'></a>" +
41322 "<select id='" + expando + "-\f]' msallowcapture=''>" +
41323 "<option selected=''></option></select>";
41325 // Support: IE8, Opera 11-12.16
41326 // Nothing should be selected when empty strings follow ^= or $= or
41328 // The test attribute must be unknown in Opera but "safe" for WinRT
41329 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
41330 if (div.querySelectorAll("[msallowcapture^='']").length) {
41331 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
41335 // Boolean attributes and "value" are not treated correctly
41336 if (!div.querySelectorAll("[selected]").length) {
41337 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
41340 // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+,
41341 // PhantomJS<1.9.7+
41342 if (!div.querySelectorAll("[id~=" + expando + "-]").length) {
41343 rbuggyQSA.push("~=");
41346 // Webkit/Opera - :checked should return selected option elements
41347 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
41348 // IE8 throws error here and will not see later tests
41349 if (!div.querySelectorAll(":checked").length) {
41350 rbuggyQSA.push(":checked");
41353 // Support: Safari 8+, iOS 8+
41354 // https://bugs.webkit.org/show_bug.cgi?id=136851
41355 // In-page `selector#id sibing-combinator selector` fails
41356 if (!div.querySelectorAll("a#" + expando + "+*").length) {
41357 rbuggyQSA.push(".#.+[+~]");
41361 assert(function(div) {
41362 // Support: Windows 8 Native Apps
41363 // The type and name attributes are restricted during .innerHTML
41365 var input = doc.createElement("input");
41366 input.setAttribute("type", "hidden");
41367 div.appendChild(input).setAttribute("name", "D");
41370 // Enforce case-sensitivity of name attribute
41371 if (div.querySelectorAll("[name=d]").length) {
41372 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
41375 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements
41376 // are still enabled)
41377 // IE8 throws error here and will not see later tests
41378 if (!div.querySelectorAll(":enabled").length) {
41379 rbuggyQSA.push(":enabled", ":disabled");
41382 // Opera 10-11 does not throw on post-comma invalid pseudos
41383 div.querySelectorAll("*,:x");
41384 rbuggyQSA.push(",.*:");
41388 if ((support.matchesSelector = rnative.test((matches = docElem.matches ||
41389 docElem.webkitMatchesSelector ||
41390 docElem.mozMatchesSelector ||
41391 docElem.oMatchesSelector ||
41392 docElem.msMatchesSelector)))) {
41394 assert(function(div) {
41395 // Check to see if it's possible to do matchesSelector
41396 // on a disconnected node (IE 9)
41397 support.disconnectedMatch = matches.call(div, "div");
41399 // This should fail with an exception
41400 // Gecko does not error, returns false instead
41401 matches.call(div, "[s!='']:x");
41402 rbuggyMatches.push("!=", pseudos);
41406 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
41407 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
41411 * ----------------------------------------------------------------------
41413 hasCompare = rnative.test(docElem.compareDocumentPosition);
41415 // Element contains another
41416 // Purposefully does not implement inclusive descendent
41417 // As in, an element does not contain itself
41418 contains = hasCompare || rnative.test(docElem.contains) ?
41420 var adown = a.nodeType === 9 ? a.documentElement : a,
41421 bup = b && b.parentNode;
41422 return a === bup || !!(bup && bup.nodeType === 1 && (
41424 adown.contains(bup) :
41425 a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
41430 while ((b = b.parentNode)) {
41441 * ----------------------------------------------------------------------
41444 // Document order sorting
41445 sortOrder = hasCompare ?
41448 // Flag for duplicate removal
41450 hasDuplicate = true;
41454 // Sort on method existence if only one input has
41455 // compareDocumentPosition
41456 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
41461 // Calculate position if both inputs belong to the same document
41462 compare = (a.ownerDocument || a) === (b.ownerDocument || b) ?
41463 a.compareDocumentPosition(b) :
41465 // Otherwise we know they are disconnected
41468 // Disconnected nodes
41470 (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
41472 // Choose the first element that is related to our preferred
41474 if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
41477 if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
41481 // Maintain original order
41483 (indexOf(sortInput, a) - indexOf(sortInput, b)) :
41487 return compare & 4 ? -1 : 1;
41490 // Exit early if the nodes are identical
41492 hasDuplicate = true;
41498 aup = a.parentNode,
41499 bup = b.parentNode,
41503 // Parentless nodes are either documents or disconnected
41504 if (!aup || !bup) {
41505 return a === doc ? -1 :
41510 (indexOf(sortInput, a) - indexOf(sortInput, b)) :
41513 // If the nodes are siblings, we can do a quick check
41514 } else if (aup === bup) {
41515 return siblingCheck(a, b);
41518 // Otherwise we need full lists of their ancestors for comparison
41520 while ((cur = cur.parentNode)) {
41524 while ((cur = cur.parentNode)) {
41528 // Walk down the tree looking for a discrepancy
41529 while (ap[i] === bp[i]) {
41534 // Do a sibling check if the nodes have a common ancestor
41535 siblingCheck(ap[i], bp[i]) :
41537 // Otherwise nodes in our document sort first
41538 ap[i] === preferredDoc ? -1 :
41539 bp[i] === preferredDoc ? 1 :
41546 Sizzle.matches = function(expr, elements) {
41547 return Sizzle(expr, null, null, elements);
41550 Sizzle.matchesSelector = function(elem, expr) {
41551 // Set document vars if needed
41552 if ((elem.ownerDocument || elem) !== document) {
41556 // Make sure that attribute selectors are quoted
41557 expr = expr.replace(rattributeQuotes, "='$1']");
41559 if (support.matchesSelector && documentIsHTML &&
41560 (!rbuggyMatches || !rbuggyMatches.test(expr)) &&
41561 (!rbuggyQSA || !rbuggyQSA.test(expr))) {
41564 var ret = matches.call(elem, expr);
41566 // IE 9's matchesSelector returns false on disconnected nodes
41567 if (ret || support.disconnectedMatch ||
41568 // As well, disconnected nodes are said to be in a document
41569 // fragment in IE 9
41570 elem.document && elem.document.nodeType !== 11) {
41576 return Sizzle(expr, document, null, [elem]).length > 0;
41579 Sizzle.contains = function(context, elem) {
41580 // Set document vars if needed
41581 if ((context.ownerDocument || context) !== document) {
41582 setDocument(context);
41584 return contains(context, elem);
41587 Sizzle.attr = function(elem, name) {
41588 // Set document vars if needed
41589 if ((elem.ownerDocument || elem) !== document) {
41593 var fn = Expr.attrHandle[name.toLowerCase()],
41594 // Don't get fooled by Object.prototype properties (jQuery #13807)
41595 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?
41596 fn(elem, name, !documentIsHTML) :
41599 return val !== undefined ?
41601 support.attributes || !documentIsHTML ?
41602 elem.getAttribute(name) :
41603 (val = elem.getAttributeNode(name)) && val.specified ?
41608 Sizzle.error = function(msg) {
41609 throw new Error("Syntax error, unrecognized expression: " + msg);
41613 * Document sorting and removing duplicates
41615 * @param {ArrayLike}
41618 Sizzle.uniqueSort = function(results) {
41624 // Unless we *know* we can detect duplicates, assume their presence
41625 hasDuplicate = !support.detectDuplicates;
41626 sortInput = !support.sortStable && results.slice(0);
41627 results.sort(sortOrder);
41629 if (hasDuplicate) {
41630 while ((elem = results[i++])) {
41631 if (elem === results[i]) {
41632 j = duplicates.push(i);
41636 results.splice(duplicates[j], 1);
41640 // Clear input after sorting to release objects
41641 // See https://github.com/jquery/sizzle/pull/225
41648 * Utility function for retrieving the text value of an array of DOM nodes
41650 * @param {Array|Element}
41653 getText = Sizzle.getText = function(elem) {
41657 nodeType = elem.nodeType;
41660 // If no nodeType, this is expected to be an array
41661 while ((node = elem[i++])) {
41662 // Do not traverse comment nodes
41663 ret += getText(node);
41665 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
41666 // Use textContent for elements
41667 // innerText usage removed for consistency of new lines (jQuery #11153)
41668 if (typeof elem.textContent === "string") {
41669 return elem.textContent;
41671 // Traverse its children
41672 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
41673 ret += getText(elem);
41676 } else if (nodeType === 3 || nodeType === 4) {
41677 return elem.nodeValue;
41679 // Do not include comment or processing instruction nodes
41684 Expr = Sizzle.selectors = {
41686 // Can be adjusted by the user
41689 createPseudo: markFunction,
41706 dir: "previousSibling",
41710 dir: "previousSibling"
41715 "ATTR": function(match) {
41716 match[1] = match[1].replace(runescape, funescape);
41718 // Move the given value to match[3] whether quoted or unquoted
41719 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
41721 if (match[2] === "~=") {
41722 match[3] = " " + match[3] + " ";
41725 return match.slice(0, 4);
41728 "CHILD": function(match) {
41730 * matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what
41731 * (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4
41732 * xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component
41733 * 6 x of xn-component 7 sign of y-component 8 y of y-component
41735 match[1] = match[1].toLowerCase();
41737 if (match[1].slice(0, 3) === "nth") {
41738 // nth-* requires argument
41740 Sizzle.error(match[0]);
41743 // numeric x and y parameters for Expr.filter.CHILD
41744 // remember that false/true cast respectively to 0/1
41745 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
41746 match[5] = +((match[7] + match[8]) || match[3] === "odd");
41748 // other types prohibit arguments
41749 } else if (match[3]) {
41750 Sizzle.error(match[0]);
41756 "PSEUDO": function(match) {
41758 unquoted = !match[6] && match[2];
41760 if (matchExpr["CHILD"].test(match[0])) {
41764 // Accept quoted arguments as-is
41766 match[2] = match[4] || match[5] || "";
41768 // Strip excess characters from unquoted arguments
41769 } else if (unquoted && rpseudo.test(unquoted) &&
41770 // Get excess from tokenize (recursively)
41771 (excess = tokenize(unquoted, true)) &&
41772 // advance to the next closing parenthesis
41773 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
41775 // excess is a negative index
41776 match[0] = match[0].slice(0, excess);
41777 match[2] = unquoted.slice(0, excess);
41780 // Return only captures needed by the pseudo filter method (type and
41782 return match.slice(0, 3);
41788 "TAG": function(nodeNameSelector) {
41789 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
41790 return nodeNameSelector === "*" ?
41795 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
41799 "CLASS": function(className) {
41800 var pattern = classCache[className + " "];
41803 (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) &&
41804 classCache(className, function(elem) {
41805 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
41809 "ATTR": function(name, operator, check) {
41810 return function(elem) {
41811 var result = Sizzle.attr(elem, name);
41813 if (result == null) {
41814 return operator === "!=";
41822 return operator === "=" ? result === check :
41823 operator === "!=" ? result !== check :
41824 operator === "^=" ? check && result.indexOf(check) === 0 :
41825 operator === "*=" ? check && result.indexOf(check) > -1 :
41826 operator === "$=" ? check && result.slice(-check.length) === check :
41827 operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 :
41828 operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" :
41833 "CHILD": function(type, what, argument, first, last) {
41834 var simple = type.slice(0, 3) !== "nth",
41835 forward = type.slice(-4) !== "last",
41836 ofType = what === "of-type";
41838 return first === 1 && last === 0 ?
41840 // Shortcut for :nth-*(n)
41842 return !!elem.parentNode;
41845 function(elem, context, xml) {
41846 var cache, outerCache, node, diff, nodeIndex, start,
41847 dir = simple !== forward ? "nextSibling" : "previousSibling",
41848 parent = elem.parentNode,
41849 name = ofType && elem.nodeName.toLowerCase(),
41850 useCache = !xml && !ofType;
41854 // :(first|last|only)-(child|of-type)
41858 while ((node = node[dir])) {
41859 if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
41863 // Reverse direction for :only-* (if we haven't
41865 start = dir = type === "only" && !start && "nextSibling";
41870 start = [forward ? parent.firstChild : parent.lastChild];
41872 // non-xml :nth-child(...) stores cache data on `parent`
41873 if (forward && useCache) {
41874 // Seek `elem` from a previously-cached index
41875 outerCache = parent[expando] || (parent[expando] = {});
41876 cache = outerCache[type] || [];
41877 nodeIndex = cache[0] === dirruns && cache[1];
41878 diff = cache[0] === dirruns && cache[2];
41879 node = nodeIndex && parent.childNodes[nodeIndex];
41881 while ((node = ++nodeIndex && node && node[dir] ||
41883 // Fallback to seeking `elem` from the start
41884 (diff = nodeIndex = 0) || start.pop())) {
41886 // When found, cache indexes on `parent` and
41888 if (node.nodeType === 1 && ++diff && node === elem) {
41889 outerCache[type] = [dirruns, nodeIndex, diff];
41894 // Use previously-cached element index if available
41895 } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
41898 // xml :nth-child(...) or :nth-last-child(...) or
41899 // :nth(-last)?-of-type(...)
41901 // Use the same loop as above to seek `elem` from
41903 while ((node = ++nodeIndex && node && node[dir] ||
41904 (diff = nodeIndex = 0) || start.pop())) {
41906 if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
41907 // Cache the index of each encountered
41910 (node[expando] || (node[expando] = {}))[type] = [dirruns, diff];
41913 if (node === elem) {
41920 // Incorporate the offset, then check against cycle size
41922 return diff === first || (diff % first === 0 && diff / first >= 0);
41927 "PSEUDO": function(pseudo, argument) {
41928 // pseudo-class names are case-insensitive
41929 // http://www.w3.org/TR/selectors/#pseudo-classes
41930 // Prioritize by case sensitivity in case custom pseudos are added
41931 // with uppercase letters
41932 // Remember that setFilters inherits from pseudos
41934 fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||
41935 Sizzle.error("unsupported pseudo: " + pseudo);
41937 // The user may use createPseudo to indicate that
41938 // arguments are needed to create the filter function
41939 // just as Sizzle does
41941 return fn(argument);
41944 // But maintain support for old signatures
41945 if (fn.length > 1) {
41946 args = [pseudo, pseudo, "", argument];
41947 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?
41948 markFunction(function(seed, matches) {
41950 matched = fn(seed, argument),
41951 i = matched.length;
41953 idx = indexOf(seed, matched[i]);
41954 seed[idx] = !(matches[idx] = matched[i]);
41958 return fn(elem, 0, args);
41967 // Potentially complex pseudos
41968 "not": markFunction(function(selector) {
41969 // Trim the selector passed to compile
41970 // to avoid treating leading and trailing
41971 // spaces as combinators
41974 matcher = compile(selector.replace(rtrim, "$1"));
41976 return matcher[expando] ?
41977 markFunction(function(seed, matches, context, xml) {
41979 unmatched = matcher(seed, null, xml, []),
41982 // Match elements unmatched by `matcher`
41984 if ((elem = unmatched[i])) {
41985 seed[i] = !(matches[i] = elem);
41989 function(elem, context, xml) {
41991 matcher(input, null, xml, results);
41992 // Don't keep the element (issue #299)
41994 return !results.pop();
41998 "has": markFunction(function(selector) {
41999 return function(elem) {
42000 return Sizzle(selector, elem).length > 0;
42004 "contains": markFunction(function(text) {
42005 text = text.replace(runescape, funescape);
42006 return function(elem) {
42007 return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
42011 // "Whether an element is represented by a :lang() selector
42012 // is based solely on the element's language value
42013 // being equal to the identifier C,
42014 // or beginning with the identifier C immediately followed by "-".
42015 // The matching of C against the element's language value is performed
42016 // case-insensitively.
42017 // The identifier C does not have to be a valid language name."
42018 // http://www.w3.org/TR/selectors/#lang-pseudo
42019 "lang": markFunction(function(lang) {
42020 // lang value must be a valid identifier
42021 if (!ridentifier.test(lang || "")) {
42022 Sizzle.error("unsupported lang: " + lang);
42024 lang = lang.replace(runescape, funescape).toLowerCase();
42025 return function(elem) {
42028 if ((elemLang = documentIsHTML ?
42030 elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
42032 elemLang = elemLang.toLowerCase();
42033 return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
42035 } while ((elem = elem.parentNode) && elem.nodeType === 1);
42041 "target": function(elem) {
42042 var hash = window.location && window.location.hash;
42043 return hash && hash.slice(1) === elem.id;
42046 "root": function(elem) {
42047 return elem === docElem;
42050 "focus": function(elem) {
42051 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
42054 // Boolean properties
42055 "enabled": function(elem) {
42056 return elem.disabled === false;
42059 "disabled": function(elem) {
42060 return elem.disabled === true;
42063 "checked": function(elem) {
42064 // In CSS3, :checked should return both checked and selected
42066 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
42067 var nodeName = elem.nodeName.toLowerCase();
42068 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
42071 "selected": function(elem) {
42072 // Accessing this property makes selected-by-default
42073 // options in Safari work properly
42074 if (elem.parentNode) {
42075 elem.parentNode.selectedIndex;
42078 return elem.selected === true;
42082 "empty": function(elem) {
42083 // http://www.w3.org/TR/selectors/#empty-pseudo
42084 // :empty is negated by element (1) or content nodes (text: 3;
42085 // cdata: 4; entity ref: 5),
42086 // but not by others (comment: 8; processing instruction: 7; etc.)
42087 // nodeType < 6 works because attributes (2) do not appear as
42089 for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
42090 if (elem.nodeType < 6) {
42097 "parent": function(elem) {
42098 return !Expr.pseudos["empty"](elem);
42101 // Element/input types
42102 "header": function(elem) {
42103 return rheader.test(elem.nodeName);
42106 "input": function(elem) {
42107 return rinputs.test(elem.nodeName);
42110 "button": function(elem) {
42111 var name = elem.nodeName.toLowerCase();
42112 return name === "input" && elem.type === "button" || name === "button";
42115 "text": function(elem) {
42117 return elem.nodeName.toLowerCase() === "input" &&
42118 elem.type === "text" &&
42121 // New HTML5 attribute values (e.g., "search") appear with
42122 // elem.type === "text"
42123 ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
42126 // Position-in-collection
42127 "first": createPositionalPseudo(function() {
42131 "last": createPositionalPseudo(function(matchIndexes, length) {
42132 return [length - 1];
42135 "eq": createPositionalPseudo(function(matchIndexes, length, argument) {
42136 return [argument < 0 ? argument + length : argument];
42139 "even": createPositionalPseudo(function(matchIndexes, length) {
42141 for (; i < length; i += 2) {
42142 matchIndexes.push(i);
42144 return matchIndexes;
42147 "odd": createPositionalPseudo(function(matchIndexes, length) {
42149 for (; i < length; i += 2) {
42150 matchIndexes.push(i);
42152 return matchIndexes;
42155 "lt": createPositionalPseudo(function(matchIndexes, length, argument) {
42156 var i = argument < 0 ? argument + length : argument;
42157 for (; --i >= 0;) {
42158 matchIndexes.push(i);
42160 return matchIndexes;
42163 "gt": createPositionalPseudo(function(matchIndexes, length, argument) {
42164 var i = argument < 0 ? argument + length : argument;
42165 for (; ++i < length;) {
42166 matchIndexes.push(i);
42168 return matchIndexes;
42173 Expr.pseudos["nth"] = Expr.pseudos["eq"];
42175 // Add button/input type pseudos
42183 Expr.pseudos[i] = createInputPseudo(i);
42189 Expr.pseudos[i] = createButtonPseudo(i);
42192 // Easy API for creating new setFilters
42193 function setFilters() {}
42194 setFilters.prototype = Expr.filters = Expr.pseudos;
42195 Expr.setFilters = new setFilters();
42197 tokenize = Sizzle.tokenize = function(selector, parseOnly) {
42198 var matched, match, tokens, type,
42199 soFar, groups, preFilters,
42200 cached = tokenCache[selector + " "];
42203 return parseOnly ? 0 : cached.slice(0);
42208 preFilters = Expr.preFilter;
42212 // Comma and first run
42213 if (!matched || (match = rcomma.exec(soFar))) {
42215 // Don't consume trailing commas as valid
42216 soFar = soFar.slice(match[0].length) || soFar;
42218 groups.push((tokens = []));
42224 if ((match = rcombinators.exec(soFar))) {
42225 matched = match.shift();
42228 // Cast descendant combinators to space
42229 type: match[0].replace(rtrim, " ")
42231 soFar = soFar.slice(matched.length);
42235 for (type in Expr.filter) {
42236 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||
42237 (match = preFilters[type](match)))) {
42238 matched = match.shift();
42244 soFar = soFar.slice(matched.length);
42253 // Return the length of the invalid excess
42254 // if we're just parsing
42255 // Otherwise, throw an error or return tokens
42259 Sizzle.error(selector) :
42260 // Cache the tokens
42261 tokenCache(selector, groups).slice(0);
42264 function toSelector(tokens) {
42266 len = tokens.length,
42268 for (; i < len; i++) {
42269 selector += tokens[i].value;
42274 function addCombinator(matcher, combinator, base) {
42275 var dir = combinator.dir,
42276 checkNonElements = base && dir === "parentNode",
42279 return combinator.first ?
42280 // Check against closest ancestor/preceding element
42281 function(elem, context, xml) {
42282 while ((elem = elem[dir])) {
42283 if (elem.nodeType === 1 || checkNonElements) {
42284 return matcher(elem, context, xml);
42289 // Check against all ancestor/preceding elements
42290 function(elem, context, xml) {
42291 var oldCache, outerCache,
42292 newCache = [dirruns, doneName];
42294 // We can't set arbitrary data on XML nodes, so they don't benefit
42295 // from dir caching
42297 while ((elem = elem[dir])) {
42298 if (elem.nodeType === 1 || checkNonElements) {
42299 if (matcher(elem, context, xml)) {
42305 while ((elem = elem[dir])) {
42306 if (elem.nodeType === 1 || checkNonElements) {
42307 outerCache = elem[expando] || (elem[expando] = {});
42308 if ((oldCache = outerCache[dir]) &&
42309 oldCache[0] === dirruns && oldCache[1] === doneName) {
42311 // Assign to newCache so results back-propagate to
42312 // previous elements
42313 return (newCache[2] = oldCache[2]);
42315 // Reuse newcache so results back-propagate to
42316 // previous elements
42317 outerCache[dir] = newCache;
42319 // A match means we're done; a fail means we have to
42321 if ((newCache[2] = matcher(elem, context, xml))) {
42331 function elementMatcher(matchers) {
42332 return matchers.length > 1 ?
42333 function(elem, context, xml) {
42334 var i = matchers.length;
42336 if (!matchers[i](elem, context, xml)) {
42345 function multipleContexts(selector, contexts, results) {
42347 len = contexts.length;
42348 for (; i < len; i++) {
42349 Sizzle(selector, contexts[i], results);
42354 function condense(unmatched, map, filter, context, xml) {
42358 len = unmatched.length,
42359 mapped = map != null;
42361 for (; i < len; i++) {
42362 if ((elem = unmatched[i])) {
42363 if (!filter || filter(elem, context, xml)) {
42364 newUnmatched.push(elem);
42372 return newUnmatched;
42375 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
42376 if (postFilter && !postFilter[expando]) {
42377 postFilter = setMatcher(postFilter);
42379 if (postFinder && !postFinder[expando]) {
42380 postFinder = setMatcher(postFinder, postSelector);
42382 return markFunction(function(seed, results, context, xml) {
42386 preexisting = results.length,
42388 // Get initial elements from seed or context
42389 elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
42391 // Prefilter to get matcher input, preserving a map for seed-results
42393 matcherIn = preFilter && (seed || !selector) ?
42394 condense(elems, preMap, preFilter, context, xml) :
42397 matcherOut = matcher ?
42398 // If we have a postFinder, or filtered seed, or non-seed
42399 // postFilter or preexisting results,
42400 postFinder || (seed ? preFilter : preexisting || postFilter) ?
42402 // ...intermediate processing is necessary
42405 // ...otherwise use results directly
42409 // Find primary matches
42411 matcher(matcherIn, matcherOut, context, xml);
42414 // Apply postFilter
42416 temp = condense(matcherOut, postMap);
42417 postFilter(temp, [], context, xml);
42419 // Un-match failing elements by moving them back to matcherIn
42422 if ((elem = temp[i])) {
42423 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
42429 if (postFinder || preFilter) {
42431 // Get the final matcherOut by condensing this intermediate
42432 // into postFinder contexts
42434 i = matcherOut.length;
42436 if ((elem = matcherOut[i])) {
42437 // Restore matcherIn since elem is not yet a final
42439 temp.push((matcherIn[i] = elem));
42442 postFinder(null, (matcherOut = []), temp, xml);
42445 // Move matched elements from seed to results to keep them
42447 i = matcherOut.length;
42449 if ((elem = matcherOut[i]) &&
42450 (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
42452 seed[temp] = !(results[temp] = elem);
42457 // Add elements to results, through postFinder if defined
42459 matcherOut = condense(
42460 matcherOut === results ?
42461 matcherOut.splice(preexisting, matcherOut.length) :
42465 postFinder(null, results, matcherOut, xml);
42467 push.apply(results, matcherOut);
42473 function matcherFromTokens(tokens) {
42474 var checkContext, matcher, j,
42475 len = tokens.length,
42476 leadingRelative = Expr.relative[tokens[0].type],
42477 implicitRelative = leadingRelative || Expr.relative[" "],
42478 i = leadingRelative ? 1 : 0,
42480 // The foundational matcher ensures that elements are reachable from
42481 // top-level context(s)
42482 matchContext = addCombinator(function(elem) {
42483 return elem === checkContext;
42484 }, implicitRelative, true),
42485 matchAnyContext = addCombinator(function(elem) {
42486 return indexOf(checkContext, elem) > -1;
42487 }, implicitRelative, true),
42488 matchers = [function(elem, context, xml) {
42489 var ret = (!leadingRelative && (xml || context !== outermostContext)) || (
42490 (checkContext = context).nodeType ?
42491 matchContext(elem, context, xml) :
42492 matchAnyContext(elem, context, xml));
42493 // Avoid hanging onto element (issue #299)
42494 checkContext = null;
42498 for (; i < len; i++) {
42499 if ((matcher = Expr.relative[tokens[i].type])) {
42500 matchers = [addCombinator(elementMatcher(matchers), matcher)];
42502 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
42504 // Return special upon seeing a positional matcher
42505 if (matcher[expando]) {
42506 // Find the next relative operator (if any) for proper handling
42508 for (; j < len; j++) {
42509 if (Expr.relative[tokens[j].type]) {
42514 i > 1 && elementMatcher(matchers),
42515 i > 1 && toSelector(
42516 // If the preceding token was a descendant combinator,
42517 // insert an implicit any-element `*`
42518 tokens.slice(0, i - 1).concat({
42519 value: tokens[i - 2].type === " " ? "*" : ""
42521 ).replace(rtrim, "$1"),
42523 i < j && matcherFromTokens(tokens.slice(i, j)),
42524 j < len && matcherFromTokens((tokens = tokens.slice(j))),
42525 j < len && toSelector(tokens)
42528 matchers.push(matcher);
42532 return elementMatcher(matchers);
42535 function matcherFromGroupMatchers(elementMatchers, setMatchers) {
42536 var bySet = setMatchers.length > 0,
42537 byElement = elementMatchers.length > 0,
42538 superMatcher = function(seed, context, xml, results, outermost) {
42539 var elem, j, matcher,
42542 unmatched = seed && [],
42544 contextBackup = outermostContext,
42545 // We must always have either seed elements or outermost context
42546 elems = seed || byElement && Expr.find["TAG"]("*", outermost),
42547 // Use integer dirruns iff this is the outermost matcher
42548 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
42549 len = elems.length;
42552 outermostContext = context !== document && context;
42555 // Add elements passing elementMatchers directly to results
42556 // Keep `i` a string if there are no elements so `matchedCount` will
42558 // Support: IE<9, Safari
42559 // Tolerate NodeList properties (IE: "length"; Safari: <number>)
42560 // matching elements by id
42561 for (; i !== len && (elem = elems[i]) != null; i++) {
42562 if (byElement && elem) {
42564 while ((matcher = elementMatchers[j++])) {
42565 if (matcher(elem, context, xml)) {
42566 results.push(elem);
42571 dirruns = dirrunsUnique;
42575 // Track unmatched elements for set filters
42577 // They will have gone through all possible matchers
42578 if ((elem = !matcher && elem)) {
42582 // Lengthen the array for every element, matched or not
42584 unmatched.push(elem);
42589 // Apply set filters to unmatched elements
42591 if (bySet && i !== matchedCount) {
42593 while ((matcher = setMatchers[j++])) {
42594 matcher(unmatched, setMatched, context, xml);
42598 // Reintegrate element matches to eliminate the need for
42600 if (matchedCount > 0) {
42602 if (!(unmatched[i] || setMatched[i])) {
42603 setMatched[i] = pop.call(results);
42608 // Discard index placeholder values to get only actual
42610 setMatched = condense(setMatched);
42613 // Add matches to results
42614 push.apply(results, setMatched);
42616 // Seedless set matches succeeding multiple successful matchers
42617 // stipulate sorting
42618 if (outermost && !seed && setMatched.length > 0 &&
42619 (matchedCount + setMatchers.length) > 1) {
42621 Sizzle.uniqueSort(results);
42625 // Override manipulation of globals by nested matchers
42627 dirruns = dirrunsUnique;
42628 outermostContext = contextBackup;
42635 markFunction(superMatcher) :
42639 compile = Sizzle.compile = function(selector, match /* Internal Use Only */ ) {
42642 elementMatchers = [],
42643 cached = compilerCache[selector + " "];
42646 // Generate a function of recursive functions that can be used to check
42649 match = tokenize(selector);
42653 cached = matcherFromTokens(match[i]);
42654 if (cached[expando]) {
42655 setMatchers.push(cached);
42657 elementMatchers.push(cached);
42661 // Cache the compiled function
42662 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
42664 // Save selector and tokenization
42665 cached.selector = selector;
42671 * A low-level selection function that works with Sizzle's compiled selector
42674 * @param {String|Function}
42675 * selector A selector or a pre-compiled selector function built with
42682 * [seed] A set of elements to match against
42684 select = Sizzle.select = function(selector, context, results, seed) {
42685 var i, tokens, token, type, find,
42686 compiled = typeof selector === "function" && selector,
42687 match = !seed && tokenize((selector = compiled.selector || selector));
42689 results = results || [];
42691 // Try to minimize operations if there is no seed and only one group
42692 if (match.length === 1) {
42694 // Take a shortcut and set the context if the root selector is an ID
42695 tokens = match[0] = match[0].slice(0);
42696 if (tokens.length > 2 && (token = tokens[0]).type === "ID" &&
42697 support.getById && context.nodeType === 9 && documentIsHTML &&
42698 Expr.relative[tokens[1].type]) {
42700 context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
42704 // Precompiled matchers will still verify ancestry, so step up a
42706 } else if (compiled) {
42707 context = context.parentNode;
42710 selector = selector.slice(tokens.shift().value.length);
42713 // Fetch a seed set for right-to-left matching
42714 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
42718 // Abort if we hit a combinator
42719 if (Expr.relative[(type = token.type)]) {
42722 if ((find = Expr.find[type])) {
42723 // Search, expanding context for leading sibling combinators
42725 token.matches[0].replace(runescape, funescape),
42726 rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
42729 // If seed is empty or no tokens remain, we can return early
42730 tokens.splice(i, 1);
42731 selector = seed.length && toSelector(tokens);
42733 push.apply(results, seed);
42743 // Compile and execute a filtering function if one is not provided
42744 // Provide `match` to avoid retokenization if we modified the selector above
42745 (compiled || compile(selector, match))(
42747 context, !documentIsHTML,
42749 rsibling.test(selector) && testContext(context.parentNode) || context
42754 // One-time assignments
42757 support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
42759 // Support: Chrome 14-35+
42760 // Always assume duplicates if they aren't passed to the comparison function
42761 support.detectDuplicates = !!hasDuplicate;
42763 // Initialize against the default document
42766 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
42767 // Detached nodes confoundingly follow *each other*
42768 support.sortDetached = assert(function(div1) {
42769 // Should return 1, but returns 4 (following)
42770 return div1.compareDocumentPosition(document.createElement("div")) & 1;
42774 // Prevent attribute/property "interpolation"
42775 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
42776 if (!assert(function(div) {
42777 div.innerHTML = "<a href='#'></a>";
42778 return div.firstChild.getAttribute("href") === "#";
42780 addHandle("type|href|height|width", function(elem, name, isXML) {
42782 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
42788 // Use defaultValue in place of getAttribute("value")
42789 if (!support.attributes || !assert(function(div) {
42790 div.innerHTML = "<input/>";
42791 div.firstChild.setAttribute("value", "");
42792 return div.firstChild.getAttribute("value") === "";
42794 addHandle("value", function(elem, name, isXML) {
42795 if (!isXML && elem.nodeName.toLowerCase() === "input") {
42796 return elem.defaultValue;
42802 // Use getAttributeNode to fetch booleans when getAttribute lies
42803 if (!assert(function(div) {
42804 return div.getAttribute("disabled") == null;
42806 addHandle(booleans, function(elem, name, isXML) {
42809 return elem[name] === true ? name.toLowerCase() :
42810 (val = elem.getAttributeNode(name)) && val.specified ?
42823 jQuery.find = Sizzle;
42824 jQuery.expr = Sizzle.selectors;
42825 jQuery.expr[":"] = jQuery.expr.pseudos;
42826 jQuery.unique = Sizzle.uniqueSort;
42827 jQuery.text = Sizzle.getText;
42828 jQuery.isXMLDoc = Sizzle.isXML;
42829 jQuery.contains = Sizzle.contains;
42833 var rneedsContext = jQuery.expr.match.needsContext;
42835 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
42839 var risSimple = /^.[^:#\[\.,]*$/;
42841 // Implement the identical functionality for filter and not
42842 function winnow(elements, qualifier, not) {
42843 if (jQuery.isFunction(qualifier)) {
42844 return jQuery.grep(elements, function(elem, i) {
42846 return !!qualifier.call(elem, i, elem) !== not;
42851 if (qualifier.nodeType) {
42852 return jQuery.grep(elements, function(elem) {
42853 return (elem === qualifier) !== not;
42858 if (typeof qualifier === "string") {
42859 if (risSimple.test(qualifier)) {
42860 return jQuery.filter(qualifier, elements, not);
42863 qualifier = jQuery.filter(qualifier, elements);
42866 return jQuery.grep(elements, function(elem) {
42867 return (indexOf.call(qualifier, elem) >= 0) !== not;
42871 jQuery.filter = function(expr, elems, not) {
42872 var elem = elems[0];
42875 expr = ":not(" + expr + ")";
42878 return elems.length === 1 && elem.nodeType === 1 ?
42879 jQuery.find.matchesSelector(elem, expr) ? [elem] : [] :
42880 jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
42881 return elem.nodeType === 1;
42886 find: function(selector) {
42892 if (typeof selector !== "string") {
42893 return this.pushStack(jQuery(selector).filter(function() {
42894 for (i = 0; i < len; i++) {
42895 if (jQuery.contains(self[i], this)) {
42902 for (i = 0; i < len; i++) {
42903 jQuery.find(selector, self[i], ret);
42906 // Needed because $( selector, context ) becomes $( context ).find(
42908 ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
42909 ret.selector = this.selector ? this.selector + " " + selector : selector;
42912 filter: function(selector) {
42913 return this.pushStack(winnow(this, selector || [], false));
42915 not: function(selector) {
42916 return this.pushStack(winnow(this, selector || [], true));
42918 is: function(selector) {
42922 // If this is a positional/relative selector, check membership in
42923 // the returned set
42924 // so $("p:first").is("p:last") won't return true for a doc with two
42926 typeof selector === "string" && rneedsContext.test(selector) ?
42935 // Initialize a jQuery object
42938 // A central reference to the root jQuery(document)
42941 // A simple way to check for HTML strings
42942 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
42943 // Strict HTML recognition (#11290: must start with <)
42944 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
42946 init = jQuery.fn.init = function(selector, context) {
42949 // HANDLE: $(""), $(null), $(undefined), $(false)
42954 // Handle HTML strings
42955 if (typeof selector === "string") {
42956 if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
42957 // Assume that strings that start and end with <> are HTML and
42958 // skip the regex check
42959 match = [null, selector, null];
42962 match = rquickExpr.exec(selector);
42965 // Match html or make sure no context is specified for #id
42966 if (match && (match[1] || !context)) {
42968 // HANDLE: $(html) -> $(array)
42970 context = context instanceof jQuery ? context[0] : context;
42972 // Option to run scripts is true for back-compat
42973 // Intentionally let the error be thrown if parseHTML is not
42975 jQuery.merge(this, jQuery.parseHTML(
42977 context && context.nodeType ? context.ownerDocument || context : document,
42981 // HANDLE: $(html, props)
42982 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
42983 for (match in context) {
42984 // Properties of context are called as methods if
42986 if (jQuery.isFunction(this[match])) {
42987 this[match](context[match]);
42989 // ...and otherwise set as attributes
42991 this.attr(match, context[match]);
43000 elem = document.getElementById(match[2]);
43002 // Support: Blackberry 4.6
43003 // gEBID returns nodes no longer in the document (#6963)
43004 if (elem && elem.parentNode) {
43005 // Inject the element directly into the jQuery object
43010 this.context = document;
43011 this.selector = selector;
43015 // HANDLE: $(expr, $(...))
43016 } else if (!context || context.jquery) {
43017 return (context || rootjQuery).find(selector);
43019 // HANDLE: $(expr, context)
43020 // (which is just equivalent to: $(context).find(expr)
43022 return this.constructor(context).find(selector);
43025 // HANDLE: $(DOMElement)
43026 } else if (selector.nodeType) {
43027 this.context = this[0] = selector;
43031 // HANDLE: $(function)
43032 // Shortcut for document ready
43033 } else if (jQuery.isFunction(selector)) {
43034 return typeof rootjQuery.ready !== "undefined" ?
43035 rootjQuery.ready(selector) :
43036 // Execute immediately if ready is not present
43040 if (selector.selector !== undefined) {
43041 this.selector = selector.selector;
43042 this.context = selector.context;
43045 return jQuery.makeArray(selector, this);
43048 // Give the init function the jQuery prototype for later instantiation
43049 init.prototype = jQuery.fn;
43051 // Initialize central reference
43052 rootjQuery = jQuery(document);
43055 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
43056 // Methods guaranteed to produce a unique set when starting from a unique
43058 guaranteedUnique = {
43066 dir: function(elem, dir, until) {
43068 truncate = until !== undefined;
43070 while ((elem = elem[dir]) && elem.nodeType !== 9) {
43071 if (elem.nodeType === 1) {
43072 if (truncate && jQuery(elem).is(until)) {
43075 matched.push(elem);
43081 sibling: function(n, elem) {
43084 for (; n; n = n.nextSibling) {
43085 if (n.nodeType === 1 && n !== elem) {
43095 has: function(target) {
43096 var targets = jQuery(target, this),
43097 l = targets.length;
43099 return this.filter(function() {
43101 for (; i < l; i++) {
43102 if (jQuery.contains(this, targets[i])) {
43109 closest: function(selectors, context) {
43114 pos = rneedsContext.test(selectors) || typeof selectors !== "string" ?
43115 jQuery(selectors, context || this.context) :
43118 for (; i < l; i++) {
43119 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
43120 // Always skip document fragments
43121 if (cur.nodeType < 11 && (pos ?
43122 pos.index(cur) > -1 :
43124 // Don't pass non-elements to Sizzle
43125 cur.nodeType === 1 &&
43126 jQuery.find.matchesSelector(cur, selectors))) {
43134 return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched);
43137 // Determine the position of an element within the set
43138 index: function(elem) {
43140 // No argument, return index in parent
43142 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1;
43145 // Index in selector
43146 if (typeof elem === "string") {
43147 return indexOf.call(jQuery(elem), this[0]);
43150 // Locate the position of the desired element
43151 return indexOf.call(this,
43153 // If it receives a jQuery object, the first element is used
43154 elem.jquery ? elem[0] : elem
43158 add: function(selector, context) {
43159 return this.pushStack(
43161 jQuery.merge(this.get(), jQuery(selector, context))
43166 addBack: function(selector) {
43167 return this.add(selector == null ?
43168 this.prevObject : this.prevObject.filter(selector)
43173 function sibling(cur, dir) {
43174 while ((cur = cur[dir]) && cur.nodeType !== 1) {}
43179 parent: function(elem) {
43180 var parent = elem.parentNode;
43181 return parent && parent.nodeType !== 11 ? parent : null;
43183 parents: function(elem) {
43184 return jQuery.dir(elem, "parentNode");
43186 parentsUntil: function(elem, i, until) {
43187 return jQuery.dir(elem, "parentNode", until);
43189 next: function(elem) {
43190 return sibling(elem, "nextSibling");
43192 prev: function(elem) {
43193 return sibling(elem, "previousSibling");
43195 nextAll: function(elem) {
43196 return jQuery.dir(elem, "nextSibling");
43198 prevAll: function(elem) {
43199 return jQuery.dir(elem, "previousSibling");
43201 nextUntil: function(elem, i, until) {
43202 return jQuery.dir(elem, "nextSibling", until);
43204 prevUntil: function(elem, i, until) {
43205 return jQuery.dir(elem, "previousSibling", until);
43207 siblings: function(elem) {
43208 return jQuery.sibling((elem.parentNode || {}).firstChild, elem);
43210 children: function(elem) {
43211 return jQuery.sibling(elem.firstChild);
43213 contents: function(elem) {
43214 return elem.contentDocument || jQuery.merge([], elem.childNodes);
43216 }, function(name, fn) {
43217 jQuery.fn[name] = function(until, selector) {
43218 var matched = jQuery.map(this, fn, until);
43220 if (name.slice(-5) !== "Until") {
43224 if (selector && typeof selector === "string") {
43225 matched = jQuery.filter(selector, matched);
43228 if (this.length > 1) {
43229 // Remove duplicates
43230 if (!guaranteedUnique[name]) {
43231 jQuery.unique(matched);
43234 // Reverse order for parents* and prev-derivatives
43235 if (rparentsprev.test(name)) {
43240 return this.pushStack(matched);
43243 var rnotwhite = (/\S+/g);
43247 // String to Object options format cache
43248 var optionsCache = {};
43250 // Convert String-formatted options into Object-formatted ones and store in
43252 function createOptions(options) {
43253 var object = optionsCache[options] = {};
43254 jQuery.each(options.match(rnotwhite) || [], function(_, flag) {
43255 object[flag] = true;
43261 * Create a callback list using the following parameters:
43263 * options: an optional list of space-separated options that will change how the
43264 * callback list behaves or a more traditional option object
43266 * By default a callback list will act like an event callback list and can be
43267 * "fired" multiple times.
43269 * Possible options:
43271 * once: will ensure the callback list can only be fired once (like a Deferred)
43273 * memory: will keep track of previous values and will call any callback added
43274 * after the list has been fired right away with the latest "memorized" values
43275 * (like a Deferred)
43277 * unique: will ensure a callback can only be added once (no duplicate in the
43280 * stopOnFalse: interrupt callings when a callback returns false
43283 jQuery.Callbacks = function(options) {
43285 // Convert options from String-formatted to Object-formatted if needed
43286 // (we check in cache first)
43287 options = typeof options === "string" ?
43288 (optionsCache[options] || createOptions(options)) :
43289 jQuery.extend({}, options);
43291 var // Last fire value (for non-forgettable lists)
43293 // Flag to know if list was already fired
43295 // Flag to know if list is currently firing
43297 // First callback to fire (used internally by add and fireWith)
43299 // End of the loop when firing
43301 // Index of currently firing callback (modified by remove if needed)
43303 // Actual callback list
43305 // Stack of fire calls for repeatable lists
43306 stack = !options.once && [],
43308 fire = function(data) {
43309 memory = options.memory && data;
43311 firingIndex = firingStart || 0;
43313 firingLength = list.length;
43315 for (; list && firingIndex < firingLength; firingIndex++) {
43316 if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
43317 memory = false; // To prevent further calls using add
43324 if (stack.length) {
43325 fire(stack.shift());
43327 } else if (memory) {
43334 // Actual Callbacks object
43336 // Add a callback or a collection of callbacks to the list
43339 // First, we save the current length
43340 var start = list.length;
43341 (function add(args) {
43342 jQuery.each(args, function(_, arg) {
43343 var type = jQuery.type(arg);
43344 if (type === "function") {
43345 if (!options.unique || !self.has(arg)) {
43348 } else if (arg && arg.length && type !== "string") {
43349 // Inspect recursively
43354 // Do we need to add the callbacks to the
43355 // current firing batch?
43357 firingLength = list.length;
43358 // With memory, if we're not firing then
43359 // we should call right away
43360 } else if (memory) {
43361 firingStart = start;
43367 // Remove a callback from the list
43368 remove: function() {
43370 jQuery.each(arguments, function(_, arg) {
43372 while ((index = jQuery.inArray(arg, list, index)) > -1) {
43373 list.splice(index, 1);
43374 // Handle firing indexes
43376 if (index <= firingLength) {
43379 if (index <= firingIndex) {
43388 // Check if a given callback is in the list.
43389 // If no argument is given, return whether or not list has callbacks
43391 has: function(fn) {
43392 return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length);
43394 // Remove all callbacks from the list
43395 empty: function() {
43400 // Have the list do nothing anymore
43401 disable: function() {
43402 list = stack = memory = undefined;
43406 disabled: function() {
43409 // Lock the list in its current state
43418 locked: function() {
43421 // Call all callbacks with the given context and arguments
43422 fireWith: function(context, args) {
43423 if (list && (!fired || stack)) {
43425 args = [context, args.slice ? args.slice() : args];
43434 // Call all the callbacks with the given arguments
43436 self.fireWith(this, arguments);
43439 // To know if the callbacks have already been called at least once
43440 fired: function() {
43451 Deferred: function(func) {
43453 // action, add listener, listener list, final state
43454 ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
43455 ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
43456 ["notify", "progress", jQuery.Callbacks("memory")]
43460 state: function() {
43463 always: function() {
43464 deferred.done(arguments).fail(arguments);
43467 then: function( /* fnDone, fnFail, fnProgress */ ) {
43468 var fns = arguments;
43469 return jQuery.Deferred(function(newDefer) {
43470 jQuery.each(tuples, function(i, tuple) {
43471 var fn = jQuery.isFunction(fns[i]) && fns[i];
43472 // deferred[ done | fail | progress ] for forwarding
43473 // actions to newDefer
43474 deferred[tuple[1]](function() {
43475 var returned = fn && fn.apply(this, arguments);
43476 if (returned && jQuery.isFunction(returned.promise)) {
43478 .done(newDefer.resolve)
43479 .fail(newDefer.reject)
43480 .progress(newDefer.notify);
43482 newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments);
43489 // Get a promise for this deferred
43490 // If obj is provided, the promise aspect is added to the object
43491 promise: function(obj) {
43492 return obj != null ? jQuery.extend(obj, promise) : promise;
43497 // Keep pipe for back-compat
43498 promise.pipe = promise.then;
43500 // Add list-specific methods
43501 jQuery.each(tuples, function(i, tuple) {
43502 var list = tuple[2],
43503 stateString = tuple[3];
43505 // promise[ done | fail | progress ] = list.add
43506 promise[tuple[1]] = list.add;
43510 list.add(function() {
43511 // state = [ resolved | rejected ]
43512 state = stateString;
43514 // [ reject_list | resolve_list ].disable; progress_list.lock
43515 }, tuples[i ^ 1][2].disable, tuples[2][2].lock);
43518 // deferred[ resolve | reject | notify ]
43519 deferred[tuple[0]] = function() {
43520 deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
43523 deferred[tuple[0] + "With"] = list.fireWith;
43526 // Make the deferred a promise
43527 promise.promise(deferred);
43529 // Call given func if any
43531 func.call(deferred, deferred);
43539 when: function(subordinate /* , ..., subordinateN */ ) {
43541 resolveValues = slice.call(arguments),
43542 length = resolveValues.length,
43544 // the count of uncompleted subordinates
43545 remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0,
43547 // the master Deferred. If resolveValues consist of only a single
43548 // Deferred, just use that.
43549 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
43551 // Update function for both resolve and progress values
43552 updateFunc = function(i, contexts, values) {
43553 return function(value) {
43554 contexts[i] = this;
43555 values[i] = arguments.length > 1 ? slice.call(arguments) : value;
43556 if (values === progressValues) {
43557 deferred.notifyWith(contexts, values);
43558 } else if (!(--remaining)) {
43559 deferred.resolveWith(contexts, values);
43564 progressValues, progressContexts, resolveContexts;
43566 // Add listeners to Deferred subordinates; treat others as resolved
43568 progressValues = new Array(length);
43569 progressContexts = new Array(length);
43570 resolveContexts = new Array(length);
43571 for (; i < length; i++) {
43572 if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
43573 resolveValues[i].promise()
43574 .done(updateFunc(i, resolveContexts, resolveValues))
43575 .fail(deferred.reject)
43576 .progress(updateFunc(i, progressContexts, progressValues));
43583 // If we're not waiting on anything, resolve the master
43585 deferred.resolveWith(resolveContexts, resolveValues);
43588 return deferred.promise();
43593 // The deferred used on DOM ready
43596 jQuery.fn.ready = function(fn) {
43597 // Add the callback
43598 jQuery.ready.promise().done(fn);
43604 // Is the DOM ready to be used? Set to true once it occurs.
43607 // A counter to track how many items to wait for before
43608 // the ready event fires. See #6781
43611 // Hold (or release) the ready event
43612 holdReady: function(hold) {
43614 jQuery.readyWait++;
43616 jQuery.ready(true);
43620 // Handle when the DOM is ready
43621 ready: function(wait) {
43623 // Abort if there are pending holds or we're already ready
43624 if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
43628 // Remember that the DOM is ready
43629 jQuery.isReady = true;
43631 // If a normal DOM Ready event fired, decrement, and wait if need be
43632 if (wait !== true && --jQuery.readyWait > 0) {
43636 // If there are functions bound, to execute
43637 readyList.resolveWith(document, [jQuery]);
43639 // Trigger any bound ready events
43640 if (jQuery.fn.triggerHandler) {
43641 jQuery(document).triggerHandler("ready");
43642 jQuery(document).off("ready");
43648 * The ready event handler and self cleanup method
43650 function completed() {
43651 document.removeEventListener("DOMContentLoaded", completed, false);
43652 window.removeEventListener("load", completed, false);
43656 jQuery.ready.promise = function(obj) {
43659 readyList = jQuery.Deferred();
43661 // Catch cases where $(document).ready() is called after the browser
43662 // event has already occurred.
43663 // We once tried to use readyState "interactive" here, but it caused
43664 // issues like the one
43665 // discovered by ChrisS here:
43666 // http://bugs.jquery.com/ticket/12282#comment:15
43667 if (document.readyState === "complete") {
43668 // Handle it asynchronously to allow scripts the opportunity to
43670 setTimeout(jQuery.ready);
43674 // Use the handy event callback
43675 document.addEventListener("DOMContentLoaded", completed, false);
43677 // A fallback to window.onload, that will always work
43678 window.addEventListener("load", completed, false);
43681 return readyList.promise(obj);
43684 // Kick off the DOM ready check even if the user does not
43685 jQuery.ready.promise();
43690 // Multifunctional method to get and set values of a collection
43691 // The value/s can optionally be executed if it's a function
43692 var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) {
43694 len = elems.length,
43695 bulk = key == null;
43697 // Sets many values
43698 if (jQuery.type(key) === "object") {
43701 jQuery.access(elems, fn, i, key[i], true, emptyGet, raw);
43705 } else if (value !== undefined) {
43708 if (!jQuery.isFunction(value)) {
43713 // Bulk operations run against the entire set
43715 fn.call(elems, value);
43718 // ...except when executing function values
43721 fn = function(elem, key, value) {
43722 return bulk.call(jQuery(elem), value);
43728 for (; i < len; i++) {
43729 fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
43740 len ? fn(elems[0], key) : emptyGet;
43745 * Determines whether an object can have data
43747 jQuery.acceptData = function(owner) {
43750 // - Node.ELEMENT_NODE
43751 // - Node.DOCUMENT_NODE
43755 return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType);
43760 // Support: Android<4,
43761 // Old WebKit does not have Object.preventExtensions/freeze method,
43762 // return new empty object instead with no [[set]] accessor
43763 Object.defineProperty(this.cache = {}, 0, {
43769 this.expando = jQuery.expando + Data.uid++;
43773 Data.accepts = jQuery.acceptData;
43776 key: function(owner) {
43777 // We can accept data for non-element nodes in modern browsers,
43778 // but we should not, see #8335.
43779 // Always return the key for a frozen object.
43780 if (!Data.accepts(owner)) {
43784 var descriptor = {},
43785 // Check if the owner object already has a cache key
43786 unlock = owner[this.expando];
43788 // If not, create one
43790 unlock = Data.uid++;
43792 // Secure it in a non-enumerable, non-writable property
43794 descriptor[this.expando] = {
43797 Object.defineProperties(owner, descriptor);
43799 // Support: Android<4
43800 // Fallback to a less secure definition
43802 descriptor[this.expando] = unlock;
43803 jQuery.extend(owner, descriptor);
43807 // Ensure the cache object
43808 if (!this.cache[unlock]) {
43809 this.cache[unlock] = {};
43814 set: function(owner, data, value) {
43816 // There may be an unlock assigned to this node,
43817 // if there is no entry for this "owner", create one inline
43818 // and set the unlock as though an owner entry had always existed
43819 unlock = this.key(owner),
43820 cache = this.cache[unlock];
43822 // Handle: [ owner, key, value ] args
43823 if (typeof data === "string") {
43824 cache[data] = value;
43826 // Handle: [ owner, { properties } ] args
43828 // Fresh assignments by object are shallow copied
43829 if (jQuery.isEmptyObject(cache)) {
43830 jQuery.extend(this.cache[unlock], data);
43831 // Otherwise, copy the properties one-by-one to the cache object
43833 for (prop in data) {
43834 cache[prop] = data[prop];
43840 get: function(owner, key) {
43841 // Either a valid cache is found, or will be created.
43842 // New caches will be created and the unlock returned,
43843 // allowing direct access to the newly created
43844 // empty data object. A valid owner object must be provided.
43845 var cache = this.cache[this.key(owner)];
43847 return key === undefined ?
43848 cache : cache[key];
43850 access: function(owner, key, value) {
43852 // In cases where either:
43854 // 1. No key was specified
43855 // 2. A string key was specified, but no value provided
43857 // Take the "read" path and allow the get method to determine
43858 // which value to return, respectively either:
43860 // 1. The entire cache object
43861 // 2. The data stored at the key
43863 if (key === undefined ||
43864 ((key && typeof key === "string") && value === undefined)) {
43866 stored = this.get(owner, key);
43868 return stored !== undefined ?
43869 stored : this.get(owner, jQuery.camelCase(key));
43872 // [*]When the key is not a string, or both a key and value
43873 // are specified, set or extend (existing objects) with either:
43875 // 1. An object of properties
43876 // 2. A key and value
43878 this.set(owner, key, value);
43880 // Since the "set" path can have two possible entry points
43881 // return the expected data based on which path was taken[*]
43882 return value !== undefined ? value : key;
43884 remove: function(owner, key) {
43885 var i, name, camel,
43886 unlock = this.key(owner),
43887 cache = this.cache[unlock];
43889 if (key === undefined) {
43890 this.cache[unlock] = {};
43893 // Support array or space separated string of keys
43894 if (jQuery.isArray(key)) {
43895 // If "name" is an array of keys...
43896 // When data is initially created, via ("key", "val") signature,
43897 // keys will be converted to camelCase.
43898 // Since there is no way to tell _how_ a key was added, remove
43899 // both plain key and camelCase key. #12786
43900 // This will only penalize the array argument path.
43901 name = key.concat(key.map(jQuery.camelCase));
43903 camel = jQuery.camelCase(key);
43904 // Try the string as a key before any manipulation
43905 if (key in cache) {
43906 name = [key, camel];
43908 // If a key with the spaces exists, use it.
43909 // Otherwise, create an array by matching non-whitespace
43911 name = name in cache ? [name] : (name.match(rnotwhite) || []);
43917 delete cache[name[i]];
43921 hasData: function(owner) {
43922 return !jQuery.isEmptyObject(
43923 this.cache[owner[this.expando]] || {}
43926 discard: function(owner) {
43927 if (owner[this.expando]) {
43928 delete this.cache[owner[this.expando]];
43932 var data_priv = new Data();
43934 var data_user = new Data();
43938 // Implementation Summary
43940 // 1. Enforce API surface and semantic compatibility with 1.9.x branch
43941 // 2. Improve the module's maintainability by reducing the storage
43942 // paths to a single mechanism.
43943 // 3. Use the same single mechanism to support "private" and "user" data.
43944 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
43945 // 5. Avoid exposing implementation details on user objects (eg. expando
43947 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
43949 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
43950 rmultiDash = /([A-Z])/g;
43952 function dataAttr(elem, key, data) {
43955 // If nothing was found internally, try to fetch any
43956 // data from the HTML5 data-* attribute
43957 if (data === undefined && elem.nodeType === 1) {
43958 name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
43959 data = elem.getAttribute(name);
43961 if (typeof data === "string") {
43963 data = data === "true" ? true :
43964 data === "false" ? false :
43965 data === "null" ? null :
43966 // Only convert to a number if it doesn't change the string
43967 +data + "" === data ? +data :
43968 rbrace.test(data) ? jQuery.parseJSON(data) :
43972 // Make sure we set the data so it isn't changed later
43973 data_user.set(elem, key, data);
43982 hasData: function(elem) {
43983 return data_user.hasData(elem) || data_priv.hasData(elem);
43986 data: function(elem, name, data) {
43987 return data_user.access(elem, name, data);
43990 removeData: function(elem, name) {
43991 data_user.remove(elem, name);
43994 // TODO: Now that all calls to _data and _removeData have been replaced
43995 // with direct calls to data_priv methods, these can be deprecated.
43996 _data: function(elem, name, data) {
43997 return data_priv.access(elem, name, data);
44000 _removeData: function(elem, name) {
44001 data_priv.remove(elem, name);
44006 data: function(key, value) {
44009 attrs = elem && elem.attributes;
44012 if (key === undefined) {
44014 data = data_user.get(elem);
44016 if (elem.nodeType === 1 && !data_priv.get(elem, "hasDataAttrs")) {
44021 // The attrs elements can be null (#14894)
44023 name = attrs[i].name;
44024 if (name.indexOf("data-") === 0) {
44025 name = jQuery.camelCase(name.slice(5));
44026 dataAttr(elem, name, data[name]);
44030 data_priv.set(elem, "hasDataAttrs", true);
44037 // Sets multiple values
44038 if (typeof key === "object") {
44039 return this.each(function() {
44040 data_user.set(this, key);
44044 return access(this, function(value) {
44046 camelKey = jQuery.camelCase(key);
44048 // The calling jQuery object (element matches) is not empty
44049 // (and therefore has an element appears at this[ 0 ]) and the
44050 // `value` parameter was not undefined. An empty jQuery object
44051 // will result in `undefined` for elem = this[ 0 ] which will
44052 // throw an exception if an attempt to read a data cache is made.
44053 if (elem && value === undefined) {
44054 // Attempt to get data from the cache
44055 // with the key as-is
44056 data = data_user.get(elem, key);
44057 if (data !== undefined) {
44061 // Attempt to get data from the cache
44062 // with the key camelized
44063 data = data_user.get(elem, camelKey);
44064 if (data !== undefined) {
44068 // Attempt to "discover" the data in
44069 // HTML5 custom data-* attrs
44070 data = dataAttr(elem, camelKey, undefined);
44071 if (data !== undefined) {
44075 // We tried really hard, but the data doesn't exist.
44080 this.each(function() {
44081 // First, attempt to store a copy or reference of any
44082 // data that might've been store with a camelCased key.
44083 var data = data_user.get(this, camelKey);
44085 // For HTML5 data-* attribute interop, we have to
44086 // store property names with dashes in a camelCase form.
44087 // This might not apply to all properties...*
44088 data_user.set(this, camelKey, value);
44090 // *... In the case of properties that might _actually_
44091 // have dashes, we need to also store a copy of that
44092 // unchanged property.
44093 if (key.indexOf("-") !== -1 && data !== undefined) {
44094 data_user.set(this, key, value);
44097 }, null, value, arguments.length > 1, null, true);
44100 removeData: function(key) {
44101 return this.each(function() {
44102 data_user.remove(this, key);
44109 queue: function(elem, type, data) {
44113 type = (type || "fx") + "queue";
44114 queue = data_priv.get(elem, type);
44116 // Speed up dequeue by getting out quickly if this is just a lookup
44118 if (!queue || jQuery.isArray(data)) {
44119 queue = data_priv.access(elem, type, jQuery.makeArray(data));
44124 return queue || [];
44128 dequeue: function(elem, type) {
44129 type = type || "fx";
44131 var queue = jQuery.queue(elem, type),
44132 startLength = queue.length,
44133 fn = queue.shift(),
44134 hooks = jQuery._queueHooks(elem, type),
44135 next = function() {
44136 jQuery.dequeue(elem, type);
44139 // If the fx queue is dequeued, always remove the progress sentinel
44140 if (fn === "inprogress") {
44141 fn = queue.shift();
44147 // Add a progress sentinel to prevent the fx queue from being
44148 // automatically dequeued
44149 if (type === "fx") {
44150 queue.unshift("inprogress");
44153 // Clear up the last queue stop function
44155 fn.call(elem, next, hooks);
44158 if (!startLength && hooks) {
44159 hooks.empty.fire();
44163 // Not public - generate a queueHooks object, or return the current one
44164 _queueHooks: function(elem, type) {
44165 var key = type + "queueHooks";
44166 return data_priv.get(elem, key) || data_priv.access(elem, key, {
44167 empty: jQuery.Callbacks("once memory").add(function() {
44168 data_priv.remove(elem, [type + "queue", key]);
44175 queue: function(type, data) {
44178 if (typeof type !== "string") {
44184 if (arguments.length < setter) {
44185 return jQuery.queue(this[0], type);
44188 return data === undefined ?
44190 this.each(function() {
44191 var queue = jQuery.queue(this, type, data);
44193 // Ensure a hooks for this queue
44194 jQuery._queueHooks(this, type);
44196 if (type === "fx" && queue[0] !== "inprogress") {
44197 jQuery.dequeue(this, type);
44201 dequeue: function(type) {
44202 return this.each(function() {
44203 jQuery.dequeue(this, type);
44206 clearQueue: function(type) {
44207 return this.queue(type || "fx", []);
44209 // Get a promise resolved when queues of a certain type
44210 // are emptied (fx is the type by default)
44211 promise: function(type, obj) {
44214 defer = jQuery.Deferred(),
44217 resolve = function() {
44219 defer.resolveWith(elements, [elements]);
44223 if (typeof type !== "string") {
44227 type = type || "fx";
44230 tmp = data_priv.get(elements[i], type + "queueHooks");
44231 if (tmp && tmp.empty) {
44233 tmp.empty.add(resolve);
44237 return defer.promise(obj);
44240 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
44242 var cssExpand = ["Top", "Right", "Bottom", "Left"];
44244 var isHidden = function(elem, el) {
44245 // isHidden might be called from jQuery#filter function;
44246 // in that case, element will be second argument
44248 return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem);
44251 var rcheckableType = (/^(?:checkbox|radio)$/i);
44256 var fragment = document.createDocumentFragment(),
44257 div = fragment.appendChild(document.createElement("div")),
44258 input = document.createElement("input");
44260 // Support: Safari<=5.1
44261 // Check state lost if the name is set (#11217)
44262 // Support: Windows Web Apps (WWA)
44263 // `name` and `type` must use .setAttribute for WWA (#14901)
44264 input.setAttribute("type", "radio");
44265 input.setAttribute("checked", "checked");
44266 input.setAttribute("name", "t");
44268 div.appendChild(input);
44270 // Support: Safari<=5.1, Android<4.2
44271 // Older WebKit doesn't clone checked state correctly in fragments
44272 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
44274 // Support: IE<=11+
44275 // Make sure textarea (and checkbox) defaultValue is properly cloned
44276 div.innerHTML = "<textarea>x</textarea>";
44277 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
44279 var strundefined = typeof undefined;
44283 support.focusinBubbles = "onfocusin" in window;
44287 rkeyEvent = /^key/,
44288 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
44289 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
44290 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
44292 function returnTrue() {
44296 function returnFalse() {
44300 function safeActiveElement() {
44302 return document.activeElement;
44307 * Helper functions for managing events -- not part of the public interface.
44308 * Props to Dean Edwards' addEvent library for many of the ideas.
44314 add: function(elem, types, handler, data, selector) {
44316 var handleObjIn, eventHandle, tmp,
44317 events, t, handleObj,
44318 special, handlers, type, namespaces, origType,
44319 elemData = data_priv.get(elem);
44321 // Don't attach events to noData or text/comment nodes (but allow plain
44327 // Caller can pass in an object of custom data in lieu of the handler
44328 if (handler.handler) {
44329 handleObjIn = handler;
44330 handler = handleObjIn.handler;
44331 selector = handleObjIn.selector;
44334 // Make sure that the handler has a unique ID, used to find/remove it
44336 if (!handler.guid) {
44337 handler.guid = jQuery.guid++;
44340 // Init the element's event structure and main handler, if this is the
44342 if (!(events = elemData.events)) {
44343 events = elemData.events = {};
44345 if (!(eventHandle = elemData.handle)) {
44346 eventHandle = elemData.handle = function(e) {
44347 // Discard the second event of a jQuery.event.trigger() and
44348 // when an event is called after a page has unloaded
44349 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
44350 jQuery.event.dispatch.apply(elem, arguments) : undefined;
44354 // Handle multiple events separated by a space
44355 types = (types || "").match(rnotwhite) || [""];
44358 tmp = rtypenamespace.exec(types[t]) || [];
44359 type = origType = tmp[1];
44360 namespaces = (tmp[2] || "").split(".").sort();
44362 // There *must* be a type, no attaching namespace-only handlers
44367 // If event changes its type, use the special event handlers for the
44369 special = jQuery.event.special[type] || {};
44371 // If selector defined, determine special event api type, otherwise
44373 type = (selector ? special.delegateType : special.bindType) || type;
44375 // Update special based on newly reset type
44376 special = jQuery.event.special[type] || {};
44378 // handleObj is passed to all event handlers
44379 handleObj = jQuery.extend({
44381 origType: origType,
44384 guid: handler.guid,
44385 selector: selector,
44386 needsContext: selector && jQuery.expr.match.needsContext.test(selector),
44387 namespace: namespaces.join(".")
44390 // Init the event handler queue if we're the first
44391 if (!(handlers = events[type])) {
44392 handlers = events[type] = [];
44393 handlers.delegateCount = 0;
44395 // Only use addEventListener if the special events handler
44397 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
44398 if (elem.addEventListener) {
44399 elem.addEventListener(type, eventHandle, false);
44405 special.add.call(elem, handleObj);
44407 if (!handleObj.handler.guid) {
44408 handleObj.handler.guid = handler.guid;
44412 // Add to the element's handler list, delegates in front
44414 handlers.splice(handlers.delegateCount++, 0, handleObj);
44416 handlers.push(handleObj);
44419 // Keep track of which events have ever been used, for event
44421 jQuery.event.global[type] = true;
44426 // Detach an event or set of events from an element
44427 remove: function(elem, types, handler, selector, mappedTypes) {
44429 var j, origCount, tmp,
44430 events, t, handleObj,
44431 special, handlers, type, namespaces, origType,
44432 elemData = data_priv.hasData(elem) && data_priv.get(elem);
44434 if (!elemData || !(events = elemData.events)) {
44438 // Once for each type.namespace in types; type may be omitted
44439 types = (types || "").match(rnotwhite) || [""];
44442 tmp = rtypenamespace.exec(types[t]) || [];
44443 type = origType = tmp[1];
44444 namespaces = (tmp[2] || "").split(".").sort();
44446 // Unbind all events (on this namespace, if provided) for the
44449 for (type in events) {
44450 jQuery.event.remove(elem, type + types[t], handler, selector, true);
44455 special = jQuery.event.special[type] || {};
44456 type = (selector ? special.delegateType : special.bindType) || type;
44457 handlers = events[type] || [];
44458 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
44460 // Remove matching events
44461 origCount = j = handlers.length;
44463 handleObj = handlers[j];
44465 if ((mappedTypes || origType === handleObj.origType) &&
44466 (!handler || handler.guid === handleObj.guid) &&
44467 (!tmp || tmp.test(handleObj.namespace)) &&
44468 (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
44469 handlers.splice(j, 1);
44471 if (handleObj.selector) {
44472 handlers.delegateCount--;
44474 if (special.remove) {
44475 special.remove.call(elem, handleObj);
44480 // Remove generic event handler if we removed something and no more
44482 // (avoids potential for endless recursion during removal of special
44484 if (origCount && !handlers.length) {
44485 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
44486 jQuery.removeEvent(elem, type, elemData.handle);
44489 delete events[type];
44493 // Remove the expando if it's no longer used
44494 if (jQuery.isEmptyObject(events)) {
44495 delete elemData.handle;
44496 data_priv.remove(elem, "events");
44500 trigger: function(event, data, elem, onlyHandlers) {
44502 var i, cur, tmp, bubbleType, ontype, handle, special,
44503 eventPath = [elem || document],
44504 type = hasOwn.call(event, "type") ? event.type : event,
44505 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
44507 cur = tmp = elem = elem || document;
44509 // Don't do events on text and comment nodes
44510 if (elem.nodeType === 3 || elem.nodeType === 8) {
44514 // focus/blur morphs to focusin/out; ensure we're not firing them right
44516 if (rfocusMorph.test(type + jQuery.event.triggered)) {
44520 if (type.indexOf(".") >= 0) {
44521 // Namespaced trigger; create a regexp to match event type in
44523 namespaces = type.split(".");
44524 type = namespaces.shift();
44527 ontype = type.indexOf(":") < 0 && "on" + type;
44529 // Caller can pass in a jQuery.Event object, Object, or just an event
44531 event = event[jQuery.expando] ?
44533 new jQuery.Event(type, typeof event === "object" && event);
44535 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always
44537 event.isTrigger = onlyHandlers ? 2 : 3;
44538 event.namespace = namespaces.join(".");
44539 event.namespace_re = event.namespace ?
44540 new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") :
44543 // Clean up the event in case it is being reused
44544 event.result = undefined;
44545 if (!event.target) {
44546 event.target = elem;
44549 // Clone any incoming data and prepend the event, creating the handler
44551 data = data == null ? [event] :
44552 jQuery.makeArray(data, [event]);
44554 // Allow special events to draw outside the lines
44555 special = jQuery.event.special[type] || {};
44556 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
44560 // Determine event propagation path in advance, per W3C events spec
44562 // Bubble up to document, then to window; watch for a global
44563 // ownerDocument var (#9724)
44564 if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
44566 bubbleType = special.delegateType || type;
44567 if (!rfocusMorph.test(bubbleType + type)) {
44568 cur = cur.parentNode;
44570 for (; cur; cur = cur.parentNode) {
44571 eventPath.push(cur);
44575 // Only add window if we got to document (e.g., not plain obj or
44577 if (tmp === (elem.ownerDocument || document)) {
44578 eventPath.push(tmp.defaultView || tmp.parentWindow || window);
44582 // Fire handlers on the event path
44584 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
44586 event.type = i > 1 ?
44588 special.bindType || type;
44591 handle = (data_priv.get(cur, "events") || {})[event.type] && data_priv.get(cur, "handle");
44593 handle.apply(cur, data);
44597 handle = ontype && cur[ontype];
44598 if (handle && handle.apply && jQuery.acceptData(cur)) {
44599 event.result = handle.apply(cur, data);
44600 if (event.result === false) {
44601 event.preventDefault();
44607 // If nobody prevented the default action, do it now
44608 if (!onlyHandlers && !event.isDefaultPrevented()) {
44610 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) &&
44611 jQuery.acceptData(elem)) {
44613 // Call a native DOM method on the target with the same name
44614 // name as the event.
44615 // Don't do default actions on window, that's where global
44616 // variables be (#6170)
44617 if (ontype && jQuery.isFunction(elem[type]) && !jQuery.isWindow(elem)) {
44619 // Don't re-trigger an onFOO event when we call its FOO()
44621 tmp = elem[ontype];
44624 elem[ontype] = null;
44627 // Prevent re-triggering of the same event, since we already
44628 // bubbled it above
44629 jQuery.event.triggered = type;
44631 jQuery.event.triggered = undefined;
44634 elem[ontype] = tmp;
44640 return event.result;
44643 dispatch: function(event) {
44645 // Make a writable jQuery.Event from the native event object
44646 event = jQuery.event.fix(event);
44648 var i, j, ret, matched, handleObj,
44650 args = slice.call(arguments),
44651 handlers = (data_priv.get(this, "events") || {})[event.type] || [],
44652 special = jQuery.event.special[event.type] || {};
44654 // Use the fix-ed jQuery.Event rather than the (read-only) native event
44656 event.delegateTarget = this;
44658 // Call the preDispatch hook for the mapped type, and let it bail if
44660 if (special.preDispatch && special.preDispatch.call(this, event) === false) {
44664 // Determine handlers
44665 handlerQueue = jQuery.event.handlers.call(this, event, handlers);
44667 // Run delegates first; they may want to stop propagation beneath us
44669 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
44670 event.currentTarget = matched.elem;
44673 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
44675 // Triggered event must either 1) have no namespace, or 2) have
44677 // a subset or equal to those in the bound event (both can have
44679 if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
44681 event.handleObj = handleObj;
44682 event.data = handleObj.data;
44684 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler)
44685 .apply(matched.elem, args);
44687 if (ret !== undefined) {
44688 if ((event.result = ret) === false) {
44689 event.preventDefault();
44690 event.stopPropagation();
44697 // Call the postDispatch hook for the mapped type
44698 if (special.postDispatch) {
44699 special.postDispatch.call(this, event);
44702 return event.result;
44705 handlers: function(event, handlers) {
44706 var i, matches, sel, handleObj,
44708 delegateCount = handlers.delegateCount,
44709 cur = event.target;
44711 // Find delegate handlers
44712 // Black-hole SVG <use> instance trees (#13180)
44713 // Avoid non-left-click bubbling in Firefox (#3861)
44714 if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
44716 for (; cur !== this; cur = cur.parentNode || this) {
44718 // Don't process clicks on disabled elements (#6911, #8165,
44720 if (cur.disabled !== true || event.type !== "click") {
44722 for (i = 0; i < delegateCount; i++) {
44723 handleObj = handlers[i];
44725 // Don't conflict with Object.prototype properties
44727 sel = handleObj.selector + " ";
44729 if (matches[sel] === undefined) {
44730 matches[sel] = handleObj.needsContext ?
44731 jQuery(sel, this).index(cur) >= 0 :
44732 jQuery.find(sel, this, null, [cur]).length;
44734 if (matches[sel]) {
44735 matches.push(handleObj);
44738 if (matches.length) {
44739 handlerQueue.push({
44748 // Add the remaining (directly-bound) handlers
44749 if (delegateCount < handlers.length) {
44750 handlerQueue.push({
44752 handlers: handlers.slice(delegateCount)
44756 return handlerQueue;
44759 // Includes some event props shared by KeyEvent and MouseEvent
44760 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
44765 props: "char charCode key keyCode".split(" "),
44766 filter: function(event, original) {
44768 // Add which for key events
44769 if (event.which == null) {
44770 event.which = original.charCode != null ? original.charCode : original.keyCode;
44778 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
44779 filter: function(event, original) {
44780 var eventDoc, doc, body,
44781 button = original.button;
44783 // Calculate pageX/Y if missing and clientX/Y available
44784 if (event.pageX == null && original.clientX != null) {
44785 eventDoc = event.target.ownerDocument || document;
44786 doc = eventDoc.documentElement;
44787 body = eventDoc.body;
44789 event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
44790 event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
44793 // Add which for click: 1 === left; 2 === middle; 3 === right
44794 // Note: button is not normalized, so don't use it
44795 if (!event.which && button !== undefined) {
44796 event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
44803 fix: function(event) {
44804 if (event[jQuery.expando]) {
44808 // Create a writable copy of the event object and normalize some
44812 originalEvent = event,
44813 fixHook = this.fixHooks[type];
44816 this.fixHooks[type] = fixHook =
44817 rmouseEvent.test(type) ? this.mouseHooks :
44818 rkeyEvent.test(type) ? this.keyHooks : {};
44820 copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
44822 event = new jQuery.Event(originalEvent);
44827 event[prop] = originalEvent[prop];
44830 // Support: Cordova 2.5 (WebKit) (#13255)
44831 // All events should have a target; Cordova deviceready doesn't
44832 if (!event.target) {
44833 event.target = document;
44836 // Support: Safari 6.0+, Chrome<28
44837 // Target should not be a text node (#504, #13143)
44838 if (event.target.nodeType === 3) {
44839 event.target = event.target.parentNode;
44842 return fixHook.filter ? fixHook.filter(event, originalEvent) : event;
44847 // Prevent triggered image.load events from bubbling to window.load
44851 // Fire native event if possible so blur/focus sequence is correct
44852 trigger: function() {
44853 if (this !== safeActiveElement() && this.focus) {
44858 delegateType: "focusin"
44861 trigger: function() {
44862 if (this === safeActiveElement() && this.blur) {
44867 delegateType: "focusout"
44870 // For checkbox, fire native event so checked state will be right
44871 trigger: function() {
44872 if (this.type === "checkbox" && this.click && jQuery.nodeName(this, "input")) {
44878 // For cross-browser consistency, don't fire native .click() on
44880 _default: function(event) {
44881 return jQuery.nodeName(event.target, "a");
44886 postDispatch: function(event) {
44888 // Support: Firefox 20+
44889 // Firefox doesn't alert if the returnValue field is not set.
44890 if (event.result !== undefined && event.originalEvent) {
44891 event.originalEvent.returnValue = event.result;
44897 simulate: function(type, elem, event, bubble) {
44898 // Piggyback on a donor event to simulate a different one.
44899 // Fake originalEvent to avoid donor's stopPropagation, but if the
44900 // simulated event prevents default then we do the same on the donor.
44901 var e = jQuery.extend(
44902 new jQuery.Event(),
44910 jQuery.event.trigger(e, null, elem);
44912 jQuery.event.dispatch.call(elem, e);
44914 if (e.isDefaultPrevented()) {
44915 event.preventDefault();
44920 jQuery.removeEvent = function(elem, type, handle) {
44921 if (elem.removeEventListener) {
44922 elem.removeEventListener(type, handle, false);
44926 jQuery.Event = function(src, props) {
44927 // Allow instantiation without the 'new' keyword
44928 if (!(this instanceof jQuery.Event)) {
44929 return new jQuery.Event(src, props);
44933 if (src && src.type) {
44934 this.originalEvent = src;
44935 this.type = src.type;
44937 // Events bubbling up the document may have been marked as prevented
44938 // by a handler lower down the tree; reflect the correct value.
44939 this.isDefaultPrevented = src.defaultPrevented ||
44940 src.defaultPrevented === undefined &&
44941 // Support: Android<4.0
44942 src.returnValue === false ?
44951 // Put explicitly provided properties onto the event object
44953 jQuery.extend(this, props);
44956 // Create a timestamp if incoming event doesn't have one
44957 this.timeStamp = src && src.timeStamp || jQuery.now();
44959 // Mark it as fixed
44960 this[jQuery.expando] = true;
44963 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language
44965 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
44966 jQuery.Event.prototype = {
44967 isDefaultPrevented: returnFalse,
44968 isPropagationStopped: returnFalse,
44969 isImmediatePropagationStopped: returnFalse,
44971 preventDefault: function() {
44972 var e = this.originalEvent;
44974 this.isDefaultPrevented = returnTrue;
44976 if (e && e.preventDefault) {
44977 e.preventDefault();
44980 stopPropagation: function() {
44981 var e = this.originalEvent;
44983 this.isPropagationStopped = returnTrue;
44985 if (e && e.stopPropagation) {
44986 e.stopPropagation();
44989 stopImmediatePropagation: function() {
44990 var e = this.originalEvent;
44992 this.isImmediatePropagationStopped = returnTrue;
44994 if (e && e.stopImmediatePropagation) {
44995 e.stopImmediatePropagation();
44998 this.stopPropagation();
45002 // Create mouseenter/leave events using mouseover/out and event-time checks
45003 // Support: Chrome 15+
45005 mouseenter: "mouseover",
45006 mouseleave: "mouseout",
45007 pointerenter: "pointerover",
45008 pointerleave: "pointerout"
45009 }, function(orig, fix) {
45010 jQuery.event.special[orig] = {
45014 handle: function(event) {
45017 related = event.relatedTarget,
45018 handleObj = event.handleObj;
45020 // For mousenter/leave call the handler if related is outside the
45022 // NB: No relatedTarget if the mouse left/entered the browser window
45023 if (!related || (related !== target && !jQuery.contains(target, related))) {
45024 event.type = handleObj.origType;
45025 ret = handleObj.handler.apply(this, arguments);
45033 // Support: Firefox, Chrome, Safari
45034 // Create "bubbling" focus and blur events
45035 if (!support.focusinBubbles) {
45039 }, function(orig, fix) {
45041 // Attach a single capturing handler on the document while someone wants
45042 // focusin/focusout
45043 var handler = function(event) {
45044 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true);
45047 jQuery.event.special[fix] = {
45048 setup: function() {
45049 var doc = this.ownerDocument || this,
45050 attaches = data_priv.access(doc, fix);
45053 doc.addEventListener(orig, handler, true);
45055 data_priv.access(doc, fix, (attaches || 0) + 1);
45057 teardown: function() {
45058 var doc = this.ownerDocument || this,
45059 attaches = data_priv.access(doc, fix) - 1;
45062 doc.removeEventListener(orig, handler, true);
45063 data_priv.remove(doc, fix);
45066 data_priv.access(doc, fix, attaches);
45075 on: function(types, selector, data, fn, /* INTERNAL */ one) {
45078 // Types can be a map of types/handlers
45079 if (typeof types === "object") {
45080 // ( types-Object, selector, data )
45081 if (typeof selector !== "string") {
45082 // ( types-Object, data )
45083 data = data || selector;
45084 selector = undefined;
45086 for (type in types) {
45087 this.on(type, selector, data, types[type], one);
45092 if (data == null && fn == null) {
45095 data = selector = undefined;
45096 } else if (fn == null) {
45097 if (typeof selector === "string") {
45098 // ( types, selector, fn )
45102 // ( types, data, fn )
45105 selector = undefined;
45108 if (fn === false) {
45116 fn = function(event) {
45117 // Can use an empty set, since event contains the info
45118 jQuery().off(event);
45119 return origFn.apply(this, arguments);
45121 // Use same guid so caller can remove using origFn
45122 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
45124 return this.each(function() {
45125 jQuery.event.add(this, types, fn, data, selector);
45128 one: function(types, selector, data, fn) {
45129 return this.on(types, selector, data, fn, 1);
45131 off: function(types, selector, fn) {
45132 var handleObj, type;
45133 if (types && types.preventDefault && types.handleObj) {
45134 // ( event ) dispatched jQuery.Event
45135 handleObj = types.handleObj;
45136 jQuery(types.delegateTarget).off(
45137 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
45138 handleObj.selector,
45143 if (typeof types === "object") {
45144 // ( types-object [, selector] )
45145 for (type in types) {
45146 this.off(type, selector, types[type]);
45150 if (selector === false || typeof selector === "function") {
45151 // ( types [, fn] )
45153 selector = undefined;
45155 if (fn === false) {
45158 return this.each(function() {
45159 jQuery.event.remove(this, types, fn, selector);
45163 trigger: function(type, data) {
45164 return this.each(function() {
45165 jQuery.event.trigger(type, data, this);
45168 triggerHandler: function(type, data) {
45169 var elem = this[0];
45171 return jQuery.event.trigger(type, data, elem, true);
45178 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
45179 rtagName = /<([\w:]+)/,
45180 rhtml = /<|&#?\w+;/,
45181 rnoInnerhtml = /<(?:script|style|link)/i,
45182 // checked="checked" or checked
45183 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
45184 rscriptType = /^$|\/(?:java|ecma)script/i,
45185 rscriptTypeMasked = /^true\/(.*)/,
45186 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
45188 // We have to close these tags to support XHTML (#13200)
45192 option: [1, "<select multiple='multiple'>", "</select>"],
45194 thead: [1, "<table>", "</table>"],
45195 col: [2, "<table><colgroup>", "</colgroup></table>"],
45196 tr: [2, "<table><tbody>", "</tbody></table>"],
45197 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
45199 _default: [0, "", ""]
45203 wrapMap.optgroup = wrapMap.option;
45205 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
45206 wrapMap.th = wrapMap.td;
45208 // Support: 1.x compatibility
45209 // Manipulating tables requires a tbody
45210 function manipulationTarget(elem, content) {
45211 return jQuery.nodeName(elem, "table") &&
45212 jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr") ?
45214 elem.getElementsByTagName("tbody")[0] ||
45215 elem.appendChild(elem.ownerDocument.createElement("tbody")) :
45219 // Replace/restore the type attribute of script elements for safe DOM
45221 function disableScript(elem) {
45222 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
45226 function restoreScript(elem) {
45227 var match = rscriptTypeMasked.exec(elem.type);
45230 elem.type = match[1];
45232 elem.removeAttribute("type");
45238 // Mark scripts as having already been evaluated
45239 function setGlobalEval(elems, refElements) {
45243 for (; i < l; i++) {
45245 elems[i], "globalEval", !refElements || data_priv.get(refElements[i], "globalEval")
45250 function cloneCopyEvent(src, dest) {
45251 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
45253 if (dest.nodeType !== 1) {
45257 // 1. Copy private data: events, handlers, etc.
45258 if (data_priv.hasData(src)) {
45259 pdataOld = data_priv.access(src);
45260 pdataCur = data_priv.set(dest, pdataOld);
45261 events = pdataOld.events;
45264 delete pdataCur.handle;
45265 pdataCur.events = {};
45267 for (type in events) {
45268 for (i = 0, l = events[type].length; i < l; i++) {
45269 jQuery.event.add(dest, type, events[type][i]);
45275 // 2. Copy user data
45276 if (data_user.hasData(src)) {
45277 udataOld = data_user.access(src);
45278 udataCur = jQuery.extend({}, udataOld);
45280 data_user.set(dest, udataCur);
45284 function getAll(context, tag) {
45285 var ret = context.getElementsByTagName ? context.getElementsByTagName(tag || "*") :
45286 context.querySelectorAll ? context.querySelectorAll(tag || "*") : [];
45288 return tag === undefined || tag && jQuery.nodeName(context, tag) ?
45289 jQuery.merge([context], ret) :
45293 // Fix IE bugs, see support tests
45294 function fixInput(src, dest) {
45295 var nodeName = dest.nodeName.toLowerCase();
45297 // Fails to persist the checked state of a cloned checkbox or radio button.
45298 if (nodeName === "input" && rcheckableType.test(src.type)) {
45299 dest.checked = src.checked;
45301 // Fails to return the selected option to the default selected state when
45303 } else if (nodeName === "input" || nodeName === "textarea") {
45304 dest.defaultValue = src.defaultValue;
45309 clone: function(elem, dataAndEvents, deepDataAndEvents) {
45310 var i, l, srcElements, destElements,
45311 clone = elem.cloneNode(true),
45312 inPage = jQuery.contains(elem.ownerDocument, elem);
45314 // Fix IE cloning issues
45315 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) &&
45316 !jQuery.isXMLDoc(elem)) {
45318 // We eschew Sizzle here for performance reasons:
45319 // http://jsperf.com/getall-vs-sizzle/2
45320 destElements = getAll(clone);
45321 srcElements = getAll(elem);
45323 for (i = 0, l = srcElements.length; i < l; i++) {
45324 fixInput(srcElements[i], destElements[i]);
45328 // Copy the events from the original to the clone
45329 if (dataAndEvents) {
45330 if (deepDataAndEvents) {
45331 srcElements = srcElements || getAll(elem);
45332 destElements = destElements || getAll(clone);
45334 for (i = 0, l = srcElements.length; i < l; i++) {
45335 cloneCopyEvent(srcElements[i], destElements[i]);
45338 cloneCopyEvent(elem, clone);
45342 // Preserve script evaluation history
45343 destElements = getAll(clone, "script");
45344 if (destElements.length > 0) {
45345 setGlobalEval(destElements, !inPage && getAll(elem, "script"));
45348 // Return the cloned set
45352 buildFragment: function(elems, context, scripts, selection) {
45353 var elem, tmp, tag, wrap, contains, j,
45354 fragment = context.createDocumentFragment(),
45359 for (; i < l; i++) {
45362 if (elem || elem === 0) {
45364 // Add nodes directly
45365 if (jQuery.type(elem) === "object") {
45366 // Support: QtWebKit, PhantomJS
45367 // push.apply(_, arraylike) throws on ancient WebKit
45368 jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
45370 // Convert non-html into a text node
45371 } else if (!rhtml.test(elem)) {
45372 nodes.push(context.createTextNode(elem));
45374 // Convert html into DOM nodes
45376 tmp = tmp || fragment.appendChild(context.createElement("div"));
45378 // Deserialize a standard representation
45379 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
45380 wrap = wrapMap[tag] || wrapMap._default;
45381 tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
45383 // Descend through wrappers to the right content
45386 tmp = tmp.lastChild;
45389 // Support: QtWebKit, PhantomJS
45390 // push.apply(_, arraylike) throws on ancient WebKit
45391 jQuery.merge(nodes, tmp.childNodes);
45393 // Remember the top-level container
45394 tmp = fragment.firstChild;
45396 // Ensure the created nodes are orphaned (#12392)
45397 tmp.textContent = "";
45402 // Remove wrapper from fragment
45403 fragment.textContent = "";
45406 while ((elem = nodes[i++])) {
45408 // #4087 - If origin and destination elements are the same, and this
45410 // that element, do not do anything
45411 if (selection && jQuery.inArray(elem, selection) !== -1) {
45415 contains = jQuery.contains(elem.ownerDocument, elem);
45417 // Append to fragment
45418 tmp = getAll(fragment.appendChild(elem), "script");
45420 // Preserve script evaluation history
45422 setGlobalEval(tmp);
45425 // Capture executables
45428 while ((elem = tmp[j++])) {
45429 if (rscriptType.test(elem.type || "")) {
45430 scripts.push(elem);
45439 cleanData: function(elems) {
45440 var data, elem, type, key,
45441 special = jQuery.event.special,
45445 (elem = elems[i]) !== undefined; i++) {
45446 if (jQuery.acceptData(elem)) {
45447 key = elem[data_priv.expando];
45449 if (key && (data = data_priv.cache[key])) {
45451 for (type in data.events) {
45452 if (special[type]) {
45453 jQuery.event.remove(elem, type);
45455 // This is a shortcut to avoid jQuery.event.remove's
45458 jQuery.removeEvent(elem, type, data.handle);
45462 if (data_priv.cache[key]) {
45463 // Discard any remaining `private` data
45464 delete data_priv.cache[key];
45468 // Discard any remaining `user` data
45469 delete data_user.cache[elem[data_user.expando]];
45475 text: function(value) {
45476 return access(this, function(value) {
45477 return value === undefined ?
45478 jQuery.text(this) :
45479 this.empty().each(function() {
45480 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
45481 this.textContent = value;
45484 }, null, value, arguments.length);
45487 append: function() {
45488 return this.domManip(arguments, function(elem) {
45489 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
45490 var target = manipulationTarget(this, elem);
45491 target.appendChild(elem);
45496 prepend: function() {
45497 return this.domManip(arguments, function(elem) {
45498 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
45499 var target = manipulationTarget(this, elem);
45500 target.insertBefore(elem, target.firstChild);
45505 before: function() {
45506 return this.domManip(arguments, function(elem) {
45507 if (this.parentNode) {
45508 this.parentNode.insertBefore(elem, this);
45513 after: function() {
45514 return this.domManip(arguments, function(elem) {
45515 if (this.parentNode) {
45516 this.parentNode.insertBefore(elem, this.nextSibling);
45521 remove: function(selector, keepData /* Internal Use Only */ ) {
45523 elems = selector ? jQuery.filter(selector, this) : this,
45527 (elem = elems[i]) != null; i++) {
45528 if (!keepData && elem.nodeType === 1) {
45529 jQuery.cleanData(getAll(elem));
45532 if (elem.parentNode) {
45533 if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
45534 setGlobalEval(getAll(elem, "script"));
45536 elem.parentNode.removeChild(elem);
45543 empty: function() {
45548 (elem = this[i]) != null; i++) {
45549 if (elem.nodeType === 1) {
45551 // Prevent memory leaks
45552 jQuery.cleanData(getAll(elem, false));
45554 // Remove any remaining nodes
45555 elem.textContent = "";
45562 clone: function(dataAndEvents, deepDataAndEvents) {
45563 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
45564 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
45566 return this.map(function() {
45567 return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
45571 html: function(value) {
45572 return access(this, function(value) {
45573 var elem = this[0] || {},
45577 if (value === undefined && elem.nodeType === 1) {
45578 return elem.innerHTML;
45581 // See if we can take a shortcut and just use innerHTML
45582 if (typeof value === "string" && !rnoInnerhtml.test(value) &&
45583 !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
45585 value = value.replace(rxhtmlTag, "<$1></$2>");
45588 for (; i < l; i++) {
45589 elem = this[i] || {};
45591 // Remove element nodes and prevent memory leaks
45592 if (elem.nodeType === 1) {
45593 jQuery.cleanData(getAll(elem, false));
45594 elem.innerHTML = value;
45600 // If using innerHTML throws an exception, use the fallback
45606 this.empty().append(value);
45608 }, null, value, arguments.length);
45611 replaceWith: function() {
45612 var arg = arguments[0];
45614 // Make the changes, replacing each context element with the new content
45615 this.domManip(arguments, function(elem) {
45616 arg = this.parentNode;
45618 jQuery.cleanData(getAll(this));
45621 arg.replaceChild(elem, this);
45625 // Force removal if there was no new content (e.g., from empty
45627 return arg && (arg.length || arg.nodeType) ? this : this.remove();
45630 detach: function(selector) {
45631 return this.remove(selector, true);
45634 domManip: function(args, callback) {
45636 // Flatten any nested arrays
45637 args = concat.apply([], args);
45639 var fragment, first, scripts, hasScripts, node, doc,
45645 isFunction = jQuery.isFunction(value);
45647 // We can't cloneNode fragments that contain checked, in WebKit
45649 (l > 1 && typeof value === "string" &&
45650 !support.checkClone && rchecked.test(value))) {
45651 return this.each(function(index) {
45652 var self = set.eq(index);
45654 args[0] = value.call(this, index, self.html());
45656 self.domManip(args, callback);
45661 fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
45662 first = fragment.firstChild;
45664 if (fragment.childNodes.length === 1) {
45669 scripts = jQuery.map(getAll(fragment, "script"), disableScript);
45670 hasScripts = scripts.length;
45672 // Use the original fragment for the last item instead of the
45673 // first because it can end up
45674 // being emptied incorrectly in certain situations (#8070).
45675 for (; i < l; i++) {
45678 if (i !== iNoClone) {
45679 node = jQuery.clone(node, true, true);
45681 // Keep references to cloned scripts for later
45684 // Support: QtWebKit
45685 // jQuery.merge because push.apply(_, arraylike)
45687 jQuery.merge(scripts, getAll(node, "script"));
45691 callback.call(this[i], node, i);
45695 doc = scripts[scripts.length - 1].ownerDocument;
45697 // Reenable scripts
45698 jQuery.map(scripts, restoreScript);
45700 // Evaluate executable scripts on first document insertion
45701 for (i = 0; i < hasScripts; i++) {
45703 if (rscriptType.test(node.type || "") &&
45704 !data_priv.access(node, "globalEval") && jQuery.contains(doc, node)) {
45707 // Optional AJAX dependency, but won't run
45708 // scripts if not present
45709 if (jQuery._evalUrl) {
45710 jQuery._evalUrl(node.src);
45713 jQuery.globalEval(node.textContent.replace(rcleanScript, ""));
45726 appendTo: "append",
45727 prependTo: "prepend",
45728 insertBefore: "before",
45729 insertAfter: "after",
45730 replaceAll: "replaceWith"
45731 }, function(name, original) {
45732 jQuery.fn[name] = function(selector) {
45735 insert = jQuery(selector),
45736 last = insert.length - 1,
45739 for (; i <= last; i++) {
45740 elems = i === last ? this : this.clone(true);
45741 jQuery(insert[i])[original](elems);
45743 // Support: QtWebKit
45744 // .get() because push.apply(_, arraylike) throws
45745 push.apply(ret, elems.get());
45748 return this.pushStack(ret);
45757 * Retrieve the actual display of a element
45760 * name nodeName of the element
45762 * doc Document object
45764 // Called only from within defaultDisplay
45765 function actualDisplay(name, doc) {
45767 elem = jQuery(doc.createElement(name)).appendTo(doc.body),
45769 // getDefaultComputedStyle might be reliably used only on attached
45771 display = window.getDefaultComputedStyle && (style = window.getDefaultComputedStyle(elem[0])) ?
45773 // Use of this method is a temporary fix (more like optimization)
45774 // until something better comes along,
45775 // since it was removed from specification and supported only in FF
45776 style.display : jQuery.css(elem[0], "display");
45778 // We don't have any data stored on the element,
45779 // so use "detach" method as fast way to get rid of the element
45786 * Try to determine the default display value of an element
45791 function defaultDisplay(nodeName) {
45792 var doc = document,
45793 display = elemdisplay[nodeName];
45796 display = actualDisplay(nodeName, doc);
45798 // If the simple way fails, read from inside an iframe
45799 if (display === "none" || !display) {
45801 // Use the already-created iframe if possible
45802 iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
45804 // Always write a new HTML skeleton so Webkit and Firefox don't
45806 doc = iframe[0].contentDocument;
45812 display = actualDisplay(nodeName, doc);
45816 // Store the correct default display
45817 elemdisplay[nodeName] = display;
45822 var rmargin = (/^margin/);
45824 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
45826 var getStyles = function(elem) {
45827 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
45828 // IE throws on elements created in popups
45829 // FF meanwhile throws on frame elements through
45830 // "defaultView.getComputedStyle"
45831 if (elem.ownerDocument.defaultView.opener) {
45832 return elem.ownerDocument.defaultView.getComputedStyle(elem, null);
45835 return window.getComputedStyle(elem, null);
45840 function curCSS(elem, name, computed) {
45841 var width, minWidth, maxWidth, ret,
45842 style = elem.style;
45844 computed = computed || getStyles(elem);
45847 // getPropertyValue is only needed for .css('filter') (#12537)
45849 ret = computed.getPropertyValue(name) || computed[name];
45854 if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
45855 ret = jQuery.style(elem, name);
45858 // Support: iOS < 6
45859 // A tribute to the "awesome hack by Dean Edwards"
45860 // iOS < 6 (at least) returns percentage for a larger set of values, but
45861 // width seems to be reliably pixels
45862 // this is against the CSSOM draft spec:
45863 // http://dev.w3.org/csswg/cssom/#resolved-values
45864 if (rnumnonpx.test(ret) && rmargin.test(name)) {
45866 // Remember the original values
45867 width = style.width;
45868 minWidth = style.minWidth;
45869 maxWidth = style.maxWidth;
45871 // Put in the new values to get a computed value out
45872 style.minWidth = style.maxWidth = style.width = ret;
45873 ret = computed.width;
45875 // Revert the changed values
45876 style.width = width;
45877 style.minWidth = minWidth;
45878 style.maxWidth = maxWidth;
45882 return ret !== undefined ?
45884 // IE returns zIndex value as an integer.
45890 function addGetHookIf(conditionFn, hookFn) {
45891 // Define the hook, we'll check on the first run if it's really needed.
45894 if (conditionFn()) {
45895 // Hook not needed (or it's not possible to use it due
45896 // to missing dependency), remove it.
45901 // Hook needed; redefine it so that the support test is not executed
45903 return (this.get = hookFn).apply(this, arguments);
45910 var pixelPositionVal, boxSizingReliableVal,
45911 docElem = document.documentElement,
45912 container = document.createElement("div"),
45913 div = document.createElement("div");
45919 // Support: IE9-11+
45920 // Style of cloned element affects source element cloned (#8908)
45921 div.style.backgroundClip = "content-box";
45922 div.cloneNode(true).style.backgroundClip = "";
45923 support.clearCloneStyle = div.style.backgroundClip === "content-box";
45925 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
45926 "position:absolute";
45927 container.appendChild(div);
45929 // Executing both pixelPosition & boxSizingReliable tests require only one
45931 // so they're executed at the same time to save the second computation.
45932 function computePixelPositionAndBoxSizingReliable() {
45933 div.style.cssText =
45934 // Support: Firefox<29, Android 2.3
45935 // Vendor-prefix box-sizing
45936 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
45937 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
45938 "border:1px;padding:1px;width:4px;position:absolute";
45939 div.innerHTML = "";
45940 docElem.appendChild(container);
45942 var divStyle = window.getComputedStyle(div, null);
45943 pixelPositionVal = divStyle.top !== "1%";
45944 boxSizingReliableVal = divStyle.width === "4px";
45946 docElem.removeChild(container);
45949 // Support: node.js jsdom
45950 // Don't assume that getComputedStyle is a property of the global object
45951 if (window.getComputedStyle) {
45952 jQuery.extend(support, {
45953 pixelPosition: function() {
45955 // This test is executed only once but we still do memoizing
45956 // since we can use the boxSizingReliable pre-computing.
45957 // No need to check if the test was already performed, though.
45958 computePixelPositionAndBoxSizingReliable();
45959 return pixelPositionVal;
45961 boxSizingReliable: function() {
45962 if (boxSizingReliableVal == null) {
45963 computePixelPositionAndBoxSizingReliable();
45965 return boxSizingReliableVal;
45967 reliableMarginRight: function() {
45969 // Support: Android 2.3
45970 // Check if div with explicit width and no margin-right
45972 // gets computed margin-right based on width of container.
45974 // WebKit Bug 13343 - getComputedStyle returns wrong value for
45976 // This support function is only executed once so no memoizing
45979 marginDiv = div.appendChild(document.createElement("div"));
45981 // Reset CSS: box-sizing; display; margin; border; padding
45982 marginDiv.style.cssText = div.style.cssText =
45983 // Support: Firefox<29, Android 2.3
45984 // Vendor-prefix box-sizing
45985 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
45986 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
45987 marginDiv.style.marginRight = marginDiv.style.width = "0";
45988 div.style.width = "1px";
45989 docElem.appendChild(container);
45991 ret = !parseFloat(window.getComputedStyle(marginDiv, null).marginRight);
45993 docElem.removeChild(container);
45994 div.removeChild(marginDiv);
46003 // A method for quickly swapping in/out CSS properties to get correct
46005 jQuery.swap = function(elem, options, callback, args) {
46009 // Remember the old values, and insert the new ones
46010 for (name in options) {
46011 old[name] = elem.style[name];
46012 elem.style[name] = options[name];
46015 ret = callback.apply(elem, args || []);
46017 // Revert the old values
46018 for (name in options) {
46019 elem.style[name] = old[name];
46027 // Swappable if display is none or starts with table except "table",
46028 // "table-cell", or "table-caption"
46029 // See here for display values:
46030 // https://developer.mozilla.org/en-US/docs/CSS/display
46031 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
46032 rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
46033 rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
46036 position: "absolute",
46037 visibility: "hidden",
46040 cssNormalTransform = {
46041 letterSpacing: "0",
46045 cssPrefixes = ["Webkit", "O", "Moz", "ms"];
46047 // Return a css property mapped to a potentially vendor prefixed property
46048 function vendorPropName(style, name) {
46050 // Shortcut for names that are not vendor prefixed
46051 if (name in style) {
46055 // Check for vendor prefixed names
46056 var capName = name[0].toUpperCase() + name.slice(1),
46058 i = cssPrefixes.length;
46061 name = cssPrefixes[i] + capName;
46062 if (name in style) {
46070 function setPositiveNumber(elem, value, subtract) {
46071 var matches = rnumsplit.exec(value);
46073 // Guard against undefined "subtract", e.g., when used as in cssHooks
46074 Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") :
46078 function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
46079 var i = extra === (isBorderBox ? "border" : "content") ?
46080 // If we already have the right measurement, avoid augmentation
46082 // Otherwise initialize for horizontal or vertical properties
46083 name === "width" ? 1 : 0,
46087 for (; i < 4; i += 2) {
46088 // Both box models exclude margin, so add it if we want it
46089 if (extra === "margin") {
46090 val += jQuery.css(elem, extra + cssExpand[i], true, styles);
46094 // border-box includes padding, so remove it if we want content
46095 if (extra === "content") {
46096 val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
46099 // At this point, extra isn't border nor margin, so remove border
46100 if (extra !== "margin") {
46101 val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
46104 // At this point, extra isn't content, so add padding
46105 val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
46107 // At this point, extra isn't content nor padding, so add border
46108 if (extra !== "padding") {
46109 val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
46117 function getWidthOrHeight(elem, name, extra) {
46119 // Start with offset property, which is equivalent to the border-box value
46120 var valueIsBorderBox = true,
46121 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
46122 styles = getStyles(elem),
46123 isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
46125 // Some non-html elements return undefined for offsetWidth, so check for
46127 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
46128 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
46129 if (val <= 0 || val == null) {
46130 // Fall back to computed then uncomputed css if necessary
46131 val = curCSS(elem, name, styles);
46132 if (val < 0 || val == null) {
46133 val = elem.style[name];
46136 // Computed unit is not pixels. Stop here and return.
46137 if (rnumnonpx.test(val)) {
46141 // Check for style in case a browser which returns unreliable values
46142 // for getComputedStyle silently falls back to the reliable elem.style
46143 valueIsBorderBox = isBorderBox &&
46144 (support.boxSizingReliable() || val === elem.style[name]);
46146 // Normalize "", auto, and prepare for extra
46147 val = parseFloat(val) || 0;
46150 // Use the active box-sizing model to add/subtract irrelevant styles
46152 augmentWidthOrHeight(
46155 extra || (isBorderBox ? "border" : "content"),
46162 function showHide(elements, show) {
46163 var display, elem, hidden,
46166 length = elements.length;
46168 for (; index < length; index++) {
46169 elem = elements[index];
46174 values[index] = data_priv.get(elem, "olddisplay");
46175 display = elem.style.display;
46177 // Reset the inline display of this element to learn if it is
46178 // being hidden by cascaded rules or not
46179 if (!values[index] && display === "none") {
46180 elem.style.display = "";
46183 // Set elements which have been overridden with display: none
46184 // in a stylesheet to whatever the default browser style is
46185 // for such an element
46186 if (elem.style.display === "" && isHidden(elem)) {
46187 values[index] = data_priv.access(elem, "olddisplay", defaultDisplay(elem.nodeName));
46190 hidden = isHidden(elem);
46192 if (display !== "none" || !hidden) {
46193 data_priv.set(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"));
46198 // Set the display of most of the elements in a second loop
46199 // to avoid the constant reflow
46200 for (index = 0; index < length; index++) {
46201 elem = elements[index];
46205 if (!show || elem.style.display === "none" || elem.style.display === "") {
46206 elem.style.display = show ? values[index] || "" : "none";
46215 // Add in style property hooks for overriding the default
46216 // behavior of getting and setting a style property
46219 get: function(elem, computed) {
46222 // We should always get a number back from opacity
46223 var ret = curCSS(elem, "opacity");
46224 return ret === "" ? "1" : ret;
46230 // Don't automatically add "px" to these possibly-unitless properties
46232 "columnCount": true,
46233 "fillOpacity": true,
46235 "flexShrink": true,
46236 "fontWeight": true,
46237 "lineHeight": true,
46246 // Add in properties whose names you wish to fix before
46247 // setting or getting the value
46249 "float": "cssFloat"
46252 // Get and set the style property on a DOM Node
46253 style: function(elem, name, value, extra) {
46255 // Don't set styles on text and comment nodes
46256 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
46260 // Make sure that we're working with the right name
46261 var ret, type, hooks,
46262 origName = jQuery.camelCase(name),
46263 style = elem.style;
46265 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName));
46267 // Gets hook for the prefixed version, then unprefixed version
46268 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
46270 // Check if we're setting a value
46271 if (value !== undefined) {
46272 type = typeof value;
46274 // Convert "+=" or "-=" to relative numbers (#7345)
46275 if (type === "string" && (ret = rrelNum.exec(value))) {
46276 value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name));
46281 // Make sure that null and NaN values aren't set (#7116)
46282 if (value == null || value !== value) {
46286 // If a number, add 'px' to the (except for certain CSS properties)
46287 if (type === "number" && !jQuery.cssNumber[origName]) {
46291 // Support: IE9-11+
46292 // background-* props affect original clone's values
46293 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
46294 style[name] = "inherit";
46297 // If a hook was provided, use that value, otherwise just set the
46299 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
46300 style[name] = value;
46304 // If a hook was provided get the non-computed value from there
46305 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
46309 // Otherwise just get the value from the style object
46310 return style[name];
46314 css: function(elem, name, extra, styles) {
46315 var val, num, hooks,
46316 origName = jQuery.camelCase(name);
46318 // Make sure that we're working with the right name
46319 name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName));
46321 // Try prefixed name followed by the unprefixed name
46322 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
46324 // If a hook was provided get the computed value from there
46325 if (hooks && "get" in hooks) {
46326 val = hooks.get(elem, true, extra);
46329 // Otherwise, if a way to get the computed value exists, use that
46330 if (val === undefined) {
46331 val = curCSS(elem, name, styles);
46334 // Convert "normal" to computed value
46335 if (val === "normal" && name in cssNormalTransform) {
46336 val = cssNormalTransform[name];
46339 // Make numeric if forced or a qualifier was provided and val looks
46341 if (extra === "" || extra) {
46342 num = parseFloat(val);
46343 return extra === true || jQuery.isNumeric(num) ? num || 0 : val;
46349 jQuery.each(["height", "width"], function(i, name) {
46350 jQuery.cssHooks[name] = {
46351 get: function(elem, computed, extra) {
46354 // Certain elements can have dimension info if we invisibly show
46356 // but it must have a current display style that would benefit
46357 return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ?
46358 jQuery.swap(elem, cssShow, function() {
46359 return getWidthOrHeight(elem, name, extra);
46361 getWidthOrHeight(elem, name, extra);
46365 set: function(elem, value, extra) {
46366 var styles = extra && getStyles(elem);
46367 return setPositiveNumber(elem, value, extra ?
46368 augmentWidthOrHeight(
46372 jQuery.css(elem, "boxSizing", false, styles) === "border-box",
46380 // Support: Android 2.3
46381 jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight,
46382 function(elem, computed) {
46384 return jQuery.swap(elem, {
46385 "display": "inline-block"
46387 curCSS, [elem, "marginRight"]);
46392 // These hooks are used by animate to expand properties
46397 }, function(prefix, suffix) {
46398 jQuery.cssHooks[prefix + suffix] = {
46399 expand: function(value) {
46403 // Assumes a single number if not a string
46404 parts = typeof value === "string" ? value.split(" ") : [value];
46406 for (; i < 4; i++) {
46407 expanded[prefix + cssExpand[i] + suffix] =
46408 parts[i] || parts[i - 2] || parts[0];
46415 if (!rmargin.test(prefix)) {
46416 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
46421 css: function(name, value) {
46422 return access(this, function(elem, name, value) {
46427 if (jQuery.isArray(name)) {
46428 styles = getStyles(elem);
46431 for (; i < len; i++) {
46432 map[name[i]] = jQuery.css(elem, name[i], false, styles);
46438 return value !== undefined ?
46439 jQuery.style(elem, name, value) :
46440 jQuery.css(elem, name);
46441 }, name, value, arguments.length > 1);
46444 return showHide(this, true);
46447 return showHide(this);
46449 toggle: function(state) {
46450 if (typeof state === "boolean") {
46451 return state ? this.show() : this.hide();
46454 return this.each(function() {
46455 if (isHidden(this)) {
46456 jQuery(this).show();
46458 jQuery(this).hide();
46465 function Tween(elem, options, prop, end, easing) {
46466 return new Tween.prototype.init(elem, options, prop, end, easing);
46468 jQuery.Tween = Tween;
46470 Tween.prototype = {
46471 constructor: Tween,
46472 init: function(elem, options, prop, end, easing, unit) {
46475 this.easing = easing || "swing";
46476 this.options = options;
46477 this.start = this.now = this.cur();
46479 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
46482 var hooks = Tween.propHooks[this.prop];
46484 return hooks && hooks.get ?
46486 Tween.propHooks._default.get(this);
46488 run: function(percent) {
46490 hooks = Tween.propHooks[this.prop];
46492 if (this.options.duration) {
46493 this.pos = eased = jQuery.easing[this.easing](
46494 percent, this.options.duration * percent, 0, 1, this.options.duration
46497 this.pos = eased = percent;
46499 this.now = (this.end - this.start) * eased + this.start;
46501 if (this.options.step) {
46502 this.options.step.call(this.elem, this.now, this);
46505 if (hooks && hooks.set) {
46508 Tween.propHooks._default.set(this);
46514 Tween.prototype.init.prototype = Tween.prototype;
46516 Tween.propHooks = {
46518 get: function(tween) {
46521 if (tween.elem[tween.prop] != null &&
46522 (!tween.elem.style || tween.elem.style[tween.prop] == null)) {
46523 return tween.elem[tween.prop];
46526 // Passing an empty string as a 3rd parameter to .css will
46528 // attempt a parseFloat and fallback to a string if the parse fails.
46529 // Simple values such as "10px" are parsed to Float;
46530 // complex values such as "rotate(1rad)" are returned as-is.
46531 result = jQuery.css(tween.elem, tween.prop, "");
46532 // Empty strings, null, undefined and "auto" are converted to 0.
46533 return !result || result === "auto" ? 0 : result;
46535 set: function(tween) {
46536 // Use step hook for back compat.
46537 // Use cssHook if its there.
46538 // Use .style if available and use plain properties where available.
46539 if (jQuery.fx.step[tween.prop]) {
46540 jQuery.fx.step[tween.prop](tween);
46541 } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
46542 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
46544 tween.elem[tween.prop] = tween.now;
46551 // Panic based approach to setting things on disconnected nodes
46552 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
46553 set: function(tween) {
46554 if (tween.elem.nodeType && tween.elem.parentNode) {
46555 tween.elem[tween.prop] = tween.now;
46561 linear: function(p) {
46564 swing: function(p) {
46565 return 0.5 - Math.cos(p * Math.PI) / 2;
46569 jQuery.fx = Tween.prototype.init;
46571 // Back Compat <1.8 extension point
46572 jQuery.fx.step = {};
46579 rfxtypes = /^(?:toggle|show|hide)$/,
46580 rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
46581 rrun = /queueHooks$/,
46582 animationPrefilters = [defaultPrefilter],
46584 "*": [function(prop, value) {
46585 var tween = this.createTween(prop, value),
46586 target = tween.cur(),
46587 parts = rfxnum.exec(value),
46588 unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
46590 // Starting value computation is required for potential unit
46592 start = (jQuery.cssNumber[prop] || unit !== "px" && +target) &&
46593 rfxnum.exec(jQuery.css(tween.elem, prop)),
46595 maxIterations = 20;
46597 if (start && start[3] !== unit) {
46598 // Trust units reported by jQuery.css
46599 unit = unit || start[3];
46601 // Make sure we update the tween properties later on
46602 parts = parts || [];
46604 // Iteratively approximate from a nonzero starting point
46605 start = +target || 1;
46608 // If previous iteration zeroed out, double until we get
46610 // Use string for doubling so we don't accidentally see
46611 // scale as unchanged below
46612 scale = scale || ".5";
46614 // Adjust and apply
46615 start = start / scale;
46616 jQuery.style(tween.elem, prop, start + unit);
46618 // Update scale, tolerating zero or NaN from tween.cur(),
46619 // break the loop if scale is unchanged or perfect, or if we've
46621 } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations);
46624 // Update tween properties
46626 start = tween.start = +start || +target || 0;
46628 // If a +=/-= token was provided, we're doing a relative
46630 tween.end = parts[1] ?
46631 start + (parts[1] + 1) * parts[2] :
46639 // Animations created synchronously will run synchronously
46640 function createFxNow() {
46641 setTimeout(function() {
46644 return (fxNow = jQuery.now());
46647 // Generate parameters to create a standard animation
46648 function genFx(type, includeWidth) {
46655 // If we include width, step value is 1 to do all cssExpand values,
46656 // otherwise step value is 2 to skip over Left and Right
46657 includeWidth = includeWidth ? 1 : 0;
46658 for (; i < 4; i += 2 - includeWidth) {
46659 which = cssExpand[i];
46660 attrs["margin" + which] = attrs["padding" + which] = type;
46663 if (includeWidth) {
46664 attrs.opacity = attrs.width = type;
46670 function createTween(value, prop, animation) {
46672 collection = (tweeners[prop] || []).concat(tweeners["*"]),
46674 length = collection.length;
46675 for (; index < length; index++) {
46676 if ((tween = collection[index].call(animation, prop, value))) {
46678 // We're done with this property
46684 function defaultPrefilter(elem, props, opts) {
46685 /* jshint validthis: true */
46686 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
46689 style = elem.style,
46690 hidden = elem.nodeType && isHidden(elem),
46691 dataShow = data_priv.get(elem, "fxshow");
46693 // Handle queue: false promises
46695 hooks = jQuery._queueHooks(elem, "fx");
46696 if (hooks.unqueued == null) {
46697 hooks.unqueued = 0;
46698 oldfire = hooks.empty.fire;
46699 hooks.empty.fire = function() {
46700 if (!hooks.unqueued) {
46707 anim.always(function() {
46708 // Ensure the complete handler is called before this completes
46709 anim.always(function() {
46711 if (!jQuery.queue(elem, "fx").length) {
46712 hooks.empty.fire();
46718 // Height/width overflow pass
46719 if (elem.nodeType === 1 && ("height" in props || "width" in props)) {
46720 // Make sure that nothing sneaks out
46721 // Record all 3 overflow attributes because IE9-10 do not
46722 // change the overflow attribute when overflowX and
46723 // overflowY are set to the same value
46724 opts.overflow = [style.overflow, style.overflowX, style.overflowY];
46726 // Set display property to inline-block for height/width
46727 // animations on inline elements that are having width/height animated
46728 display = jQuery.css(elem, "display");
46730 // Test default display if display is currently "none"
46731 checkDisplay = display === "none" ?
46732 data_priv.get(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
46734 if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
46735 style.display = "inline-block";
46739 if (opts.overflow) {
46740 style.overflow = "hidden";
46741 anim.always(function() {
46742 style.overflow = opts.overflow[0];
46743 style.overflowX = opts.overflow[1];
46744 style.overflowY = opts.overflow[2];
46749 for (prop in props) {
46750 value = props[prop];
46751 if (rfxtypes.exec(value)) {
46752 delete props[prop];
46753 toggle = toggle || value === "toggle";
46754 if (value === (hidden ? "hide" : "show")) {
46756 // If there is dataShow left over from a stopped hide or show
46757 // and we are going to proceed with show, we should pretend to
46759 if (value === "show" && dataShow && dataShow[prop] !== undefined) {
46765 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
46767 // Any non-fx value stops us from restoring the original display value
46769 display = undefined;
46773 if (!jQuery.isEmptyObject(orig)) {
46775 if ("hidden" in dataShow) {
46776 hidden = dataShow.hidden;
46779 dataShow = data_priv.access(elem, "fxshow", {});
46782 // Store state if its toggle - enables .stop().toggle() to "reverse"
46784 dataShow.hidden = !hidden;
46787 jQuery(elem).show();
46789 anim.done(function() {
46790 jQuery(elem).hide();
46793 anim.done(function() {
46796 data_priv.remove(elem, "fxshow");
46797 for (prop in orig) {
46798 jQuery.style(elem, prop, orig[prop]);
46801 for (prop in orig) {
46802 tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
46804 if (!(prop in dataShow)) {
46805 dataShow[prop] = tween.start;
46807 tween.end = tween.start;
46808 tween.start = prop === "width" || prop === "height" ? 1 : 0;
46813 // If this is a noop like .hide().hide(), restore an overwritten display
46815 } else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
46816 style.display = display;
46820 function propFilter(props, specialEasing) {
46821 var index, name, easing, value, hooks;
46823 // camelCase, specialEasing and expand cssHook pass
46824 for (index in props) {
46825 name = jQuery.camelCase(index);
46826 easing = specialEasing[name];
46827 value = props[index];
46828 if (jQuery.isArray(value)) {
46830 value = props[index] = value[0];
46833 if (index !== name) {
46834 props[name] = value;
46835 delete props[index];
46838 hooks = jQuery.cssHooks[name];
46839 if (hooks && "expand" in hooks) {
46840 value = hooks.expand(value);
46841 delete props[name];
46843 // Not quite $.extend, this won't overwrite existing keys.
46844 // Reusing 'index' because we have the correct "name"
46845 for (index in value) {
46846 if (!(index in props)) {
46847 props[index] = value[index];
46848 specialEasing[index] = easing;
46852 specialEasing[name] = easing;
46857 function Animation(elem, properties, options) {
46861 length = animationPrefilters.length,
46862 deferred = jQuery.Deferred().always(function() {
46863 // Don't match elem in the :animated selector
46866 tick = function() {
46870 var currentTime = fxNow || createFxNow(),
46871 remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
46872 // Support: Android 2.3
46873 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )`
46875 temp = remaining / animation.duration || 0,
46876 percent = 1 - temp,
46878 length = animation.tweens.length;
46880 for (; index < length; index++) {
46881 animation.tweens[index].run(percent);
46884 deferred.notifyWith(elem, [animation, percent, remaining]);
46886 if (percent < 1 && length) {
46889 deferred.resolveWith(elem, [animation]);
46893 animation = deferred.promise({
46895 props: jQuery.extend({}, properties),
46896 opts: jQuery.extend(true, {
46899 originalProperties: properties,
46900 originalOptions: options,
46901 startTime: fxNow || createFxNow(),
46902 duration: options.duration,
46904 createTween: function(prop, end) {
46905 var tween = jQuery.Tween(elem, animation.opts, prop, end,
46906 animation.opts.specialEasing[prop] || animation.opts.easing);
46907 animation.tweens.push(tween);
46910 stop: function(gotoEnd) {
46912 // If we are going to the end, we want to run all the tweens
46913 // otherwise we skip this part
46914 length = gotoEnd ? animation.tweens.length : 0;
46919 for (; index < length; index++) {
46920 animation.tweens[index].run(1);
46923 // Resolve when we played the last frame; otherwise, reject
46925 deferred.resolveWith(elem, [animation, gotoEnd]);
46927 deferred.rejectWith(elem, [animation, gotoEnd]);
46932 props = animation.props;
46934 propFilter(props, animation.opts.specialEasing);
46936 for (; index < length; index++) {
46937 result = animationPrefilters[index].call(animation, elem, props, animation.opts);
46943 jQuery.map(props, createTween, animation);
46945 if (jQuery.isFunction(animation.opts.start)) {
46946 animation.opts.start.call(elem, animation);
46950 jQuery.extend(tick, {
46953 queue: animation.opts.queue
46957 // attach callbacks from options
46958 return animation.progress(animation.opts.progress)
46959 .done(animation.opts.done, animation.opts.complete)
46960 .fail(animation.opts.fail)
46961 .always(animation.opts.always);
46964 jQuery.Animation = jQuery.extend(Animation, {
46966 tweener: function(props, callback) {
46967 if (jQuery.isFunction(props)) {
46971 props = props.split(" ");
46976 length = props.length;
46978 for (; index < length; index++) {
46979 prop = props[index];
46980 tweeners[prop] = tweeners[prop] || [];
46981 tweeners[prop].unshift(callback);
46985 prefilter: function(callback, prepend) {
46987 animationPrefilters.unshift(callback);
46989 animationPrefilters.push(callback);
46994 jQuery.speed = function(speed, easing, fn) {
46995 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
46996 complete: fn || !fn && easing ||
46997 jQuery.isFunction(speed) && speed,
46999 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
47002 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
47003 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
47005 // Normalize opt.queue - true/undefined/null -> "fx"
47006 if (opt.queue == null || opt.queue === true) {
47011 opt.old = opt.complete;
47013 opt.complete = function() {
47014 if (jQuery.isFunction(opt.old)) {
47015 opt.old.call(this);
47019 jQuery.dequeue(this, opt.queue);
47027 fadeTo: function(speed, to, easing, callback) {
47029 // Show any hidden elements after setting opacity to 0
47030 return this.filter(isHidden).css("opacity", 0).show()
47032 // Animate to the value specified
47035 }, speed, easing, callback);
47037 animate: function(prop, speed, easing, callback) {
47038 var empty = jQuery.isEmptyObject(prop),
47039 optall = jQuery.speed(speed, easing, callback),
47040 doAnimation = function() {
47041 // Operate on a copy of prop so per-property easing won't be
47043 var anim = Animation(this, jQuery.extend({}, prop), optall);
47045 // Empty animations, or finishing resolves immediately
47046 if (empty || data_priv.get(this, "finish")) {
47050 doAnimation.finish = doAnimation;
47052 return empty || optall.queue === false ?
47053 this.each(doAnimation) :
47054 this.queue(optall.queue, doAnimation);
47056 stop: function(type, clearQueue, gotoEnd) {
47057 var stopQueue = function(hooks) {
47058 var stop = hooks.stop;
47063 if (typeof type !== "string") {
47064 gotoEnd = clearQueue;
47068 if (clearQueue && type !== false) {
47069 this.queue(type || "fx", []);
47072 return this.each(function() {
47073 var dequeue = true,
47074 index = type != null && type + "queueHooks",
47075 timers = jQuery.timers,
47076 data = data_priv.get(this);
47079 if (data[index] && data[index].stop) {
47080 stopQueue(data[index]);
47083 for (index in data) {
47084 if (data[index] && data[index].stop && rrun.test(index)) {
47085 stopQueue(data[index]);
47090 for (index = timers.length; index--;) {
47091 if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
47092 timers[index].anim.stop(gotoEnd);
47094 timers.splice(index, 1);
47098 // Start the next in the queue if the last step wasn't forced.
47099 // Timers currently will call their complete callbacks, which
47100 // will dequeue but only if they were gotoEnd.
47101 if (dequeue || !gotoEnd) {
47102 jQuery.dequeue(this, type);
47106 finish: function(type) {
47107 if (type !== false) {
47108 type = type || "fx";
47110 return this.each(function() {
47112 data = data_priv.get(this),
47113 queue = data[type + "queue"],
47114 hooks = data[type + "queueHooks"],
47115 timers = jQuery.timers,
47116 length = queue ? queue.length : 0;
47118 // Enable finishing flag on private data
47119 data.finish = true;
47121 // Empty the queue first
47122 jQuery.queue(this, type, []);
47124 if (hooks && hooks.stop) {
47125 hooks.stop.call(this, true);
47128 // Look for any active animations, and finish them
47129 for (index = timers.length; index--;) {
47130 if (timers[index].elem === this && timers[index].queue === type) {
47131 timers[index].anim.stop(true);
47132 timers.splice(index, 1);
47136 // Look for any animations in the old queue and finish them
47137 for (index = 0; index < length; index++) {
47138 if (queue[index] && queue[index].finish) {
47139 queue[index].finish.call(this);
47143 // Turn off finishing flag
47144 delete data.finish;
47149 jQuery.each(["toggle", "show", "hide"], function(i, name) {
47150 var cssFn = jQuery.fn[name];
47151 jQuery.fn[name] = function(speed, easing, callback) {
47152 return speed == null || typeof speed === "boolean" ?
47153 cssFn.apply(this, arguments) :
47154 this.animate(genFx(name, true), speed, easing, callback);
47158 // Generate shortcuts for custom animations
47160 slideDown: genFx("show"),
47161 slideUp: genFx("hide"),
47162 slideToggle: genFx("toggle"),
47172 }, function(name, props) {
47173 jQuery.fn[name] = function(speed, easing, callback) {
47174 return this.animate(props, speed, easing, callback);
47178 jQuery.timers = [];
47179 jQuery.fx.tick = function() {
47182 timers = jQuery.timers;
47184 fxNow = jQuery.now();
47186 for (; i < timers.length; i++) {
47188 // Checks the timer has not already been removed
47189 if (!timer() && timers[i] === timer) {
47190 timers.splice(i--, 1);
47194 if (!timers.length) {
47200 jQuery.fx.timer = function(timer) {
47201 jQuery.timers.push(timer);
47205 jQuery.timers.pop();
47209 jQuery.fx.interval = 13;
47211 jQuery.fx.start = function() {
47213 timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval);
47217 jQuery.fx.stop = function() {
47218 clearInterval(timerId);
47222 jQuery.fx.speeds = {
47230 // Based off of the plugin by Clint Helfers, with permission.
47231 // http://blindsignals.com/index.php/2009/07/jquery-delay/
47232 jQuery.fn.delay = function(time, type) {
47233 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
47234 type = type || "fx";
47236 return this.queue(type, function(next, hooks) {
47237 var timeout = setTimeout(next, time);
47238 hooks.stop = function() {
47239 clearTimeout(timeout);
47246 var input = document.createElement("input"),
47247 select = document.createElement("select"),
47248 opt = select.appendChild(document.createElement("option"));
47250 input.type = "checkbox";
47252 // Support: iOS<=5.1, Android<=4.2+
47253 // Default value for a checkbox should be "on"
47254 support.checkOn = input.value !== "";
47256 // Support: IE<=11+
47257 // Must access selectedIndex to make default options select
47258 support.optSelected = opt.selected;
47260 // Support: Android<=2.3
47261 // Options inside disabled selects are incorrectly marked as disabled
47262 select.disabled = true;
47263 support.optDisabled = !opt.disabled;
47265 // Support: IE<=11+
47266 // An input loses its value after becoming a radio
47267 input = document.createElement("input");
47269 input.type = "radio";
47270 support.radioValue = input.value === "t";
47274 var nodeHook, boolHook,
47275 attrHandle = jQuery.expr.attrHandle;
47278 attr: function(name, value) {
47279 return access(this, jQuery.attr, name, value, arguments.length > 1);
47282 removeAttr: function(name) {
47283 return this.each(function() {
47284 jQuery.removeAttr(this, name);
47290 attr: function(elem, name, value) {
47292 nType = elem.nodeType;
47294 // don't get/set attributes on text, comment and attribute nodes
47295 if (!elem || nType === 3 || nType === 8 || nType === 2) {
47299 // Fallback to prop when attributes are not supported
47300 if (typeof elem.getAttribute === strundefined) {
47301 return jQuery.prop(elem, name, value);
47304 // All attributes are lowercase
47305 // Grab necessary hook if one is defined
47306 if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
47307 name = name.toLowerCase();
47308 hooks = jQuery.attrHooks[name] ||
47309 (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook);
47312 if (value !== undefined) {
47314 if (value === null) {
47315 jQuery.removeAttr(elem, name);
47317 } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
47321 elem.setAttribute(name, value + "");
47325 } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
47329 ret = jQuery.find.attr(elem, name);
47331 // Non-existent attributes return null, we normalize to undefined
47332 return ret == null ?
47338 removeAttr: function(elem, value) {
47339 var name, propName,
47341 attrNames = value && value.match(rnotwhite);
47343 if (attrNames && elem.nodeType === 1) {
47344 while ((name = attrNames[i++])) {
47345 propName = jQuery.propFix[name] || name;
47347 // Boolean attributes get special treatment (#10870)
47348 if (jQuery.expr.match.bool.test(name)) {
47349 // Set corresponding property to false
47350 elem[propName] = false;
47353 elem.removeAttribute(name);
47360 set: function(elem, value) {
47361 if (!support.radioValue && value === "radio" &&
47362 jQuery.nodeName(elem, "input")) {
47363 var val = elem.value;
47364 elem.setAttribute("type", value);
47375 // Hooks for boolean attributes
47377 set: function(elem, value, name) {
47378 if (value === false) {
47379 // Remove boolean attributes when set to false
47380 jQuery.removeAttr(elem, name);
47382 elem.setAttribute(name, name);
47387 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
47388 var getter = attrHandle[name] || jQuery.find.attr;
47390 attrHandle[name] = function(elem, name, isXML) {
47393 // Avoid an infinite loop by temporarily removing this function from
47395 handle = attrHandle[name];
47396 attrHandle[name] = ret;
47397 ret = getter(elem, name, isXML) != null ?
47398 name.toLowerCase() :
47400 attrHandle[name] = handle;
47409 var rfocusable = /^(?:input|select|textarea|button)$/i;
47412 prop: function(name, value) {
47413 return access(this, jQuery.prop, name, value, arguments.length > 1);
47416 removeProp: function(name) {
47417 return this.each(function() {
47418 delete this[jQuery.propFix[name] || name];
47426 "class": "className"
47429 prop: function(elem, name, value) {
47430 var ret, hooks, notxml,
47431 nType = elem.nodeType;
47433 // Don't get/set properties on text, comment and attribute nodes
47434 if (!elem || nType === 3 || nType === 8 || nType === 2) {
47438 notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
47441 // Fix name and attach hooks
47442 name = jQuery.propFix[name] || name;
47443 hooks = jQuery.propHooks[name];
47446 if (value !== undefined) {
47447 return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ?
47449 (elem[name] = value);
47452 return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ?
47460 get: function(elem) {
47461 return elem.hasAttribute("tabindex") || rfocusable.test(elem.nodeName) || elem.href ?
47469 if (!support.optSelected) {
47470 jQuery.propHooks.selected = {
47471 get: function(elem) {
47472 var parent = elem.parentNode;
47473 if (parent && parent.parentNode) {
47474 parent.parentNode.selectedIndex;
47493 jQuery.propFix[this.toLowerCase()] = this;
47499 var rclass = /[\t\r\n\f]/g;
47502 addClass: function(value) {
47503 var classes, elem, cur, clazz, j, finalValue,
47504 proceed = typeof value === "string" && value,
47508 if (jQuery.isFunction(value)) {
47509 return this.each(function(j) {
47510 jQuery(this).addClass(value.call(this, j, this.className));
47515 // The disjunction here is for better compressibility (see
47517 classes = (value || "").match(rnotwhite) || [];
47519 for (; i < len; i++) {
47521 cur = elem.nodeType === 1 && (elem.className ?
47522 (" " + elem.className + " ").replace(rclass, " ") :
47528 while ((clazz = classes[j++])) {
47529 if (cur.indexOf(" " + clazz + " ") < 0) {
47530 cur += clazz + " ";
47534 // only assign if different to avoid unneeded rendering.
47535 finalValue = jQuery.trim(cur);
47536 if (elem.className !== finalValue) {
47537 elem.className = finalValue;
47546 removeClass: function(value) {
47547 var classes, elem, cur, clazz, j, finalValue,
47548 proceed = arguments.length === 0 || typeof value === "string" && value,
47552 if (jQuery.isFunction(value)) {
47553 return this.each(function(j) {
47554 jQuery(this).removeClass(value.call(this, j, this.className));
47558 classes = (value || "").match(rnotwhite) || [];
47560 for (; i < len; i++) {
47562 // This expression is here for better compressibility (see
47564 cur = elem.nodeType === 1 && (elem.className ?
47565 (" " + elem.className + " ").replace(rclass, " ") :
47571 while ((clazz = classes[j++])) {
47572 // Remove *all* instances
47573 while (cur.indexOf(" " + clazz + " ") >= 0) {
47574 cur = cur.replace(" " + clazz + " ", " ");
47578 // Only assign if different to avoid unneeded rendering.
47579 finalValue = value ? jQuery.trim(cur) : "";
47580 if (elem.className !== finalValue) {
47581 elem.className = finalValue;
47590 toggleClass: function(value, stateVal) {
47591 var type = typeof value;
47593 if (typeof stateVal === "boolean" && type === "string") {
47594 return stateVal ? this.addClass(value) : this.removeClass(value);
47597 if (jQuery.isFunction(value)) {
47598 return this.each(function(i) {
47599 jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal);
47603 return this.each(function() {
47604 if (type === "string") {
47605 // Toggle individual class names
47608 self = jQuery(this),
47609 classNames = value.match(rnotwhite) || [];
47611 while ((className = classNames[i++])) {
47612 // Check each className given, space separated list
47613 if (self.hasClass(className)) {
47614 self.removeClass(className);
47616 self.addClass(className);
47620 // Toggle whole class name
47621 } else if (type === strundefined || type === "boolean") {
47622 if (this.className) {
47623 // store className if set
47624 data_priv.set(this, "__className__", this.className);
47627 // If the element has a class name or if we're passed `false`,
47628 // then remove the whole classname (if there was one, the above
47630 // Otherwise bring back whatever was previously saved (if
47632 // falling back to the empty string if nothing was stored.
47633 this.className = this.className || value === false ? "" : data_priv.get(this, "__className__") || "";
47638 hasClass: function(selector) {
47639 var className = " " + selector + " ",
47642 for (; i < l; i++) {
47643 if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
47655 var rreturn = /\r/g;
47658 val: function(value) {
47659 var hooks, ret, isFunction,
47662 if (!arguments.length) {
47664 hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
47666 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
47672 return typeof ret === "string" ?
47673 // Handle most common string cases
47674 ret.replace(rreturn, "") :
47675 // Handle cases where value is null/undef or number
47676 ret == null ? "" : ret;
47682 isFunction = jQuery.isFunction(value);
47684 return this.each(function(i) {
47687 if (this.nodeType !== 1) {
47692 val = value.call(this, i, jQuery(this).val());
47697 // Treat null/undefined as ""; convert numbers to string
47701 } else if (typeof val === "number") {
47704 } else if (jQuery.isArray(val)) {
47705 val = jQuery.map(val, function(value) {
47706 return value == null ? "" : value + "";
47710 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
47712 // If set returns undefined, fall back to normal setting
47713 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
47723 get: function(elem) {
47724 var val = jQuery.find.attr(elem, "value");
47725 return val != null ?
47727 // Support: IE10-11+
47728 // option.text throws exceptions (#14686, #14858)
47729 jQuery.trim(jQuery.text(elem));
47733 get: function(elem) {
47735 options = elem.options,
47736 index = elem.selectedIndex,
47737 one = elem.type === "select-one" || index < 0,
47738 values = one ? null : [],
47739 max = one ? index + 1 : options.length,
47744 // Loop through all the selected options
47745 for (; i < max; i++) {
47746 option = options[i];
47748 // IE6-9 doesn't update selected after form reset (#2551)
47749 if ((option.selected || i === index) &&
47750 // Don't return options that are disabled or in a
47751 // disabled optgroup
47752 (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
47753 (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
47755 // Get the specific value for the option
47756 value = jQuery(option).val();
47758 // We don't need an array for one selects
47763 // Multi-Selects return an array
47764 values.push(value);
47771 set: function(elem, value) {
47772 var optionSet, option,
47773 options = elem.options,
47774 values = jQuery.makeArray(value),
47775 i = options.length;
47778 option = options[i];
47779 if ((option.selected = jQuery.inArray(option.value, values) >= 0)) {
47784 // Force browsers to behave consistently when non-matching value
47787 elem.selectedIndex = -1;
47795 // Radios and checkboxes getter/setter
47796 jQuery.each(["radio", "checkbox"], function() {
47797 jQuery.valHooks[this] = {
47798 set: function(elem, value) {
47799 if (jQuery.isArray(value)) {
47800 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0);
47804 if (!support.checkOn) {
47805 jQuery.valHooks[this].get = function(elem) {
47806 return elem.getAttribute("value") === null ? "on" : elem.value;
47814 // Return jQuery for attributes-only inclusion
47817 jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " +
47818 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
47819 "change select submit keydown keypress keyup error contextmenu").split(" "), function(i, name) {
47821 // Handle event binding
47822 jQuery.fn[name] = function(data, fn) {
47823 return arguments.length > 0 ?
47824 this.on(name, null, data, fn) :
47825 this.trigger(name);
47830 hover: function(fnOver, fnOut) {
47831 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
47834 bind: function(types, data, fn) {
47835 return this.on(types, null, data, fn);
47837 unbind: function(types, fn) {
47838 return this.off(types, null, fn);
47841 delegate: function(selector, types, data, fn) {
47842 return this.on(types, selector, data, fn);
47844 undelegate: function(selector, types, fn) {
47845 // ( namespace ) or ( selector, types [, fn] )
47846 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
47851 var nonce = jQuery.now();
47853 var rquery = (/\?/);
47857 // Support: Android 2.3
47858 // Workaround failure to string-cast null input
47859 jQuery.parseJSON = function(data) {
47860 return JSON.parse(data + "");
47864 // Cross-browser xml parsing
47865 jQuery.parseXML = function(data) {
47867 if (!data || typeof data !== "string") {
47873 tmp = new DOMParser();
47874 xml = tmp.parseFromString(data, "text/xml");
47879 if (!xml || xml.getElementsByTagName("parsererror").length) {
47880 jQuery.error("Invalid XML: " + data);
47888 rts = /([?&])_=[^&]*/,
47889 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
47890 // #7653, #8125, #8152: local protocol detection
47891 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
47892 rnoContent = /^(?:GET|HEAD)$/,
47893 rprotocol = /^\/\//,
47894 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
47897 * Prefilters 1) They are useful to introduce custom dataTypes (see
47898 * ajax/jsonp.js for an example) 2) These are called: - BEFORE asking for a
47899 * transport - AFTER param serialization (s.data is a string if
47900 * s.processData is true) 3) key is the dataType 4) the catchall symbol "*"
47901 * can be used 5) execution will start with transport dataType and THEN
47902 * continue down to "*" if needed
47907 * Transports bindings 1) key is the dataType 2) the catchall symbol "*" can
47908 * be used 3) selection will start with transport dataType and THEN go to
47913 // Avoid comment-prolog char sequence (#10098); must appease lint and evade
47915 allTypes = "*/".concat("*"),
47917 // Document location
47918 ajaxLocation = window.location.href,
47920 // Segment location into parts
47921 ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
47923 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
47924 function addToPrefiltersOrTransports(structure) {
47926 // dataTypeExpression is optional and defaults to "*"
47927 return function(dataTypeExpression, func) {
47929 if (typeof dataTypeExpression !== "string") {
47930 func = dataTypeExpression;
47931 dataTypeExpression = "*";
47936 dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
47938 if (jQuery.isFunction(func)) {
47939 // For each dataType in the dataTypeExpression
47940 while ((dataType = dataTypes[i++])) {
47941 // Prepend if requested
47942 if (dataType[0] === "+") {
47943 dataType = dataType.slice(1) || "*";
47944 (structure[dataType] = structure[dataType] || []).unshift(func);
47946 // Otherwise append
47948 (structure[dataType] = structure[dataType] || []).push(func);
47955 // Base inspection function for prefilters and transports
47956 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
47958 var inspected = {},
47959 seekingTransport = (structure === transports);
47961 function inspect(dataType) {
47963 inspected[dataType] = true;
47964 jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
47965 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
47966 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
47967 options.dataTypes.unshift(dataTypeOrTransport);
47968 inspect(dataTypeOrTransport);
47970 } else if (seekingTransport) {
47971 return !(selected = dataTypeOrTransport);
47977 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
47980 // A special extend for ajax options
47981 // that takes "flat" options (not to be deep extended)
47983 function ajaxExtend(target, src) {
47985 flatOptions = jQuery.ajaxSettings.flatOptions || {};
47988 if (src[key] !== undefined) {
47989 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];
47993 jQuery.extend(true, target, deep);
48000 * Handles responses to an ajax request: - finds the right dataType (mediates
48001 * between content-type and expected dataType) - returns the corresponding
48004 function ajaxHandleResponses(s, jqXHR, responses) {
48006 var ct, type, finalDataType, firstDataType,
48007 contents = s.contents,
48008 dataTypes = s.dataTypes;
48010 // Remove auto dataType and get content-type in the process
48011 while (dataTypes[0] === "*") {
48013 if (ct === undefined) {
48014 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
48018 // Check if we're dealing with a known content-type
48020 for (type in contents) {
48021 if (contents[type] && contents[type].test(ct)) {
48022 dataTypes.unshift(type);
48028 // Check to see if we have a response for the expected dataType
48029 if (dataTypes[0] in responses) {
48030 finalDataType = dataTypes[0];
48032 // Try convertible dataTypes
48033 for (type in responses) {
48034 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
48035 finalDataType = type;
48038 if (!firstDataType) {
48039 firstDataType = type;
48042 // Or just use first one
48043 finalDataType = finalDataType || firstDataType;
48046 // If we found a dataType
48047 // We add the dataType to the list if needed
48048 // and return the corresponding response
48049 if (finalDataType) {
48050 if (finalDataType !== dataTypes[0]) {
48051 dataTypes.unshift(finalDataType);
48053 return responses[finalDataType];
48058 * Chain conversions given the request and the original response Also sets the
48059 * responseXXX fields on the jqXHR instance
48061 function ajaxConvert(s, response, jqXHR, isSuccess) {
48062 var conv2, current, conv, tmp, prev,
48064 // Work with a copy of dataTypes in case we need to modify it for
48066 dataTypes = s.dataTypes.slice();
48068 // Create converters map with lowercased keys
48069 if (dataTypes[1]) {
48070 for (conv in s.converters) {
48071 converters[conv.toLowerCase()] = s.converters[conv];
48075 current = dataTypes.shift();
48077 // Convert to each sequential dataType
48080 if (s.responseFields[current]) {
48081 jqXHR[s.responseFields[current]] = response;
48084 // Apply the dataFilter if provided
48085 if (!prev && isSuccess && s.dataFilter) {
48086 response = s.dataFilter(response, s.dataType);
48090 current = dataTypes.shift();
48094 // There's only work to do if current dataType is non-auto
48095 if (current === "*") {
48099 // Convert response if prev dataType is non-auto and differs from
48101 } else if (prev !== "*" && prev !== current) {
48103 // Seek a direct converter
48104 conv = converters[prev + " " + current] || converters["* " + current];
48106 // If none found, seek a pair
48108 for (conv2 in converters) {
48110 // If conv2 outputs current
48111 tmp = conv2.split(" ");
48112 if (tmp[1] === current) {
48114 // If prev can be converted to accepted input
48115 conv = converters[prev + " " + tmp[0]] ||
48116 converters["* " + tmp[0]];
48118 // Condense equivalence converters
48119 if (conv === true) {
48120 conv = converters[conv2];
48122 // Otherwise, insert the intermediate dataType
48123 } else if (converters[conv2] !== true) {
48125 dataTypes.unshift(tmp[1]);
48133 // Apply converter (if not an equivalence)
48134 if (conv !== true) {
48136 // Unless errors are allowed to bubble, catch and return
48138 if (conv && s["throws"]) {
48139 response = conv(response);
48142 response = conv(response);
48145 state: "parsererror",
48146 error: conv ? e : "No conversion from " + prev + " to " + current
48163 // Counter for holding the number of active queries
48166 // Last-Modified header cache for next request
48173 isLocal: rlocalProtocol.test(ajaxLocParts[1]),
48177 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
48179 * timeout: 0, data: null, dataType: null, username: null, password:
48180 * null, cache: null, throws: false, traditional: false, headers: {},
48185 text: "text/plain",
48187 xml: "application/xml, text/xml",
48188 json: "application/json, text/javascript"
48198 xml: "responseXML",
48199 text: "responseText",
48200 json: "responseJSON"
48204 // Keys separate source (or catchall "*") and destination types with a
48208 // Convert anything to text
48211 // Text to html (true = no transformation)
48214 // Evaluate text as a json expression
48215 "text json": jQuery.parseJSON,
48217 // Parse text as xml
48218 "text xml": jQuery.parseXML
48221 // For options that shouldn't be deep extended:
48222 // you can add your own custom options here if
48223 // and when you create one that shouldn't be
48224 // deep extended (see ajaxExtend)
48231 // Creates a full fledged settings object into target
48232 // with both ajaxSettings and settings fields.
48233 // If target is omitted, writes into ajaxSettings.
48234 ajaxSetup: function(target, settings) {
48237 // Building a settings object
48238 ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
48240 // Extending ajaxSettings
48241 ajaxExtend(jQuery.ajaxSettings, target);
48244 ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
48245 ajaxTransport: addToPrefiltersOrTransports(transports),
48248 ajax: function(url, options) {
48250 // If url is an object, simulate pre-1.5 signature
48251 if (typeof url === "object") {
48256 // Force options to be an object
48257 options = options || {};
48260 // URL without anti-cache param
48262 // Response headers
48263 responseHeadersString,
48267 // Cross-domain detection vars
48269 // To know if global events are to be dispatched
48273 // Create the final options object
48274 s = jQuery.ajaxSetup({}, options),
48275 // Callbacks context
48276 callbackContext = s.context || s,
48277 // Context for global events is callbackContext if it is a DOM node
48278 // or jQuery collection
48279 globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ?
48280 jQuery(callbackContext) :
48283 deferred = jQuery.Deferred(),
48284 completeDeferred = jQuery.Callbacks("once memory"),
48285 // Status-dependent callbacks
48286 statusCode = s.statusCode || {},
48287 // Headers (they are sent all at once)
48288 requestHeaders = {},
48289 requestHeadersNames = {},
48292 // Default abort message
48293 strAbort = "canceled",
48298 // Builds headers hashtable if needed
48299 getResponseHeader: function(key) {
48302 if (!responseHeaders) {
48303 responseHeaders = {};
48304 while ((match = rheaders.exec(responseHeadersString))) {
48305 responseHeaders[match[1].toLowerCase()] = match[2];
48308 match = responseHeaders[key.toLowerCase()];
48310 return match == null ? null : match;
48314 getAllResponseHeaders: function() {
48315 return state === 2 ? responseHeadersString : null;
48318 // Caches the header
48319 setRequestHeader: function(name, value) {
48320 var lname = name.toLowerCase();
48322 name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
48323 requestHeaders[name] = value;
48328 // Overrides response content-type header
48329 overrideMimeType: function(type) {
48336 // Status-dependent callbacks
48337 statusCode: function(map) {
48341 for (code in map) {
48342 // Lazy-add the new callback in a way that
48343 // preserves old ones
48344 statusCode[code] = [statusCode[code], map[code]];
48347 // Execute the appropriate callbacks
48348 jqXHR.always(map[jqXHR.status]);
48354 // Cancel the request
48355 abort: function(statusText) {
48356 var finalText = statusText || strAbort;
48358 transport.abort(finalText);
48360 done(0, finalText);
48365 // Attach deferreds
48366 deferred.promise(jqXHR).complete = completeDeferred.add;
48367 jqXHR.success = jqXHR.done;
48368 jqXHR.error = jqXHR.fail;
48370 // Remove hash character (#7531: and string promotion)
48371 // Add protocol if not provided (prefilters might expect it)
48372 // Handle falsy url in the settings object (#10093: consistency with old
48374 // We also use the url parameter if available
48375 s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "")
48376 .replace(rprotocol, ajaxLocParts[1] + "//");
48378 // Alias method option to type as per ticket #12004
48379 s.type = options.method || options.type || s.method || s.type;
48381 // Extract dataTypes list
48382 s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
48384 // A cross-domain request is in order when we have a protocol:host:port
48386 if (s.crossDomain == null) {
48387 parts = rurl.exec(s.url.toLowerCase());
48388 s.crossDomain = !!(parts &&
48389 (parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] ||
48390 (parts[3] || (parts[1] === "http:" ? "80" : "443")) !==
48391 (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? "80" : "443")))
48395 // Convert data if not already a string
48396 if (s.data && s.processData && typeof s.data !== "string") {
48397 s.data = jQuery.param(s.data, s.traditional);
48400 // Apply prefilters
48401 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
48403 // If request was aborted inside a prefilter, stop there
48408 // We can fire global events as of now if asked to
48409 // Don't fire events if jQuery.event is undefined in an AMD-usage
48410 // scenario (#15118)
48411 fireGlobals = jQuery.event && s.global;
48413 // Watch for a new set of requests
48414 if (fireGlobals && jQuery.active++ === 0) {
48415 jQuery.event.trigger("ajaxStart");
48418 // Uppercase the type
48419 s.type = s.type.toUpperCase();
48421 // Determine if request has content
48422 s.hasContent = !rnoContent.test(s.type);
48424 // Save the URL in case we're toying with the If-Modified-Since
48425 // and/or If-None-Match header later on
48428 // More options handling for requests with no content
48429 if (!s.hasContent) {
48431 // If data is available, append data to url
48433 cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
48434 // #9682: remove data so that it's not used in an eventual retry
48438 // Add anti-cache in url if needed
48439 if (s.cache === false) {
48440 s.url = rts.test(cacheURL) ?
48442 // If there is already a '_' parameter, set its value
48443 cacheURL.replace(rts, "$1_=" + nonce++) :
48445 // Otherwise add one to the end
48446 cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++;
48450 // Set the If-Modified-Since and/or If-None-Match header, if in
48451 // ifModified mode.
48452 if (s.ifModified) {
48453 if (jQuery.lastModified[cacheURL]) {
48454 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
48456 if (jQuery.etag[cacheURL]) {
48457 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
48461 // Set the correct header, if data is being sent
48462 if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
48463 jqXHR.setRequestHeader("Content-Type", s.contentType);
48466 // Set the Accepts header for the server, depending on the dataType
48467 jqXHR.setRequestHeader(
48469 s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?
48470 s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") :
48474 // Check for headers option
48475 for (i in s.headers) {
48476 jqXHR.setRequestHeader(i, s.headers[i]);
48479 // Allow custom headers/mimetypes and early abort
48480 if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
48481 // Abort if not done already and return
48482 return jqXHR.abort();
48485 // Aborting is no longer a cancellation
48486 strAbort = "abort";
48488 // Install callbacks on deferreds
48498 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
48500 // If no transport, we auto-abort
48502 done(-1, "No Transport");
48504 jqXHR.readyState = 1;
48506 // Send global event
48508 globalEventContext.trigger("ajaxSend", [jqXHR, s]);
48511 if (s.async && s.timeout > 0) {
48512 timeoutTimer = setTimeout(function() {
48513 jqXHR.abort("timeout");
48519 transport.send(requestHeaders, done);
48521 // Propagate exception as error if not done
48524 // Simply rethrow otherwise
48531 // Callback for when everything is done
48532 function done(status, nativeStatusText, responses, headers) {
48533 var isSuccess, success, error, response, modified,
48534 statusText = nativeStatusText;
48541 // State is "done" now
48544 // Clear timeout if it exists
48545 if (timeoutTimer) {
48546 clearTimeout(timeoutTimer);
48549 // Dereference transport for early garbage collection
48550 // (no matter how long the jqXHR object will be used)
48551 transport = undefined;
48553 // Cache response headers
48554 responseHeadersString = headers || "";
48557 jqXHR.readyState = status > 0 ? 4 : 0;
48559 // Determine if successful
48560 isSuccess = status >= 200 && status < 300 || status === 304;
48562 // Get response data
48564 response = ajaxHandleResponses(s, jqXHR, responses);
48567 // Convert no matter what (that way responseXXX fields are always
48569 response = ajaxConvert(s, response, jqXHR, isSuccess);
48571 // If successful, handle type chaining
48574 // Set the If-Modified-Since and/or If-None-Match header, if in
48575 // ifModified mode.
48576 if (s.ifModified) {
48577 modified = jqXHR.getResponseHeader("Last-Modified");
48579 jQuery.lastModified[cacheURL] = modified;
48581 modified = jqXHR.getResponseHeader("etag");
48583 jQuery.etag[cacheURL] = modified;
48588 if (status === 204 || s.type === "HEAD") {
48589 statusText = "nocontent";
48592 } else if (status === 304) {
48593 statusText = "notmodified";
48595 // If we have data, let's convert it
48597 statusText = response.state;
48598 success = response.data;
48599 error = response.error;
48600 isSuccess = !error;
48603 // Extract error from statusText and normalize for non-aborts
48604 error = statusText;
48605 if (status || !statusText) {
48606 statusText = "error";
48613 // Set data for the fake xhr object
48614 jqXHR.status = status;
48615 jqXHR.statusText = (nativeStatusText || statusText) + "";
48619 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
48621 deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
48624 // Status-dependent callbacks
48625 jqXHR.statusCode(statusCode);
48626 statusCode = undefined;
48629 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
48633 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
48636 globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
48637 // Handle the global AJAX counter
48638 if (!(--jQuery.active)) {
48639 jQuery.event.trigger("ajaxStop");
48647 getJSON: function(url, data, callback) {
48648 return jQuery.get(url, data, callback, "json");
48651 getScript: function(url, callback) {
48652 return jQuery.get(url, undefined, callback, "script");
48656 jQuery.each(["get", "post"], function(i, method) {
48657 jQuery[method] = function(url, data, callback, type) {
48658 // Shift arguments if data argument was omitted
48659 if (jQuery.isFunction(data)) {
48660 type = type || callback;
48665 return jQuery.ajax({
48676 jQuery._evalUrl = function(url) {
48677 return jQuery.ajax({
48680 dataType: "script",
48689 wrapAll: function(html) {
48692 if (jQuery.isFunction(html)) {
48693 return this.each(function(i) {
48694 jQuery(this).wrapAll(html.call(this, i));
48700 // The elements to wrap the target around
48701 wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
48703 if (this[0].parentNode) {
48704 wrap.insertBefore(this[0]);
48707 wrap.map(function() {
48710 while (elem.firstElementChild) {
48711 elem = elem.firstElementChild;
48721 wrapInner: function(html) {
48722 if (jQuery.isFunction(html)) {
48723 return this.each(function(i) {
48724 jQuery(this).wrapInner(html.call(this, i));
48728 return this.each(function() {
48729 var self = jQuery(this),
48730 contents = self.contents();
48732 if (contents.length) {
48733 contents.wrapAll(html);
48741 wrap: function(html) {
48742 var isFunction = jQuery.isFunction(html);
48744 return this.each(function(i) {
48745 jQuery(this).wrapAll(isFunction ? html.call(this, i) : html);
48749 unwrap: function() {
48750 return this.parent().each(function() {
48751 if (!jQuery.nodeName(this, "body")) {
48752 jQuery(this).replaceWith(this.childNodes);
48759 jQuery.expr.filters.hidden = function(elem) {
48760 // Support: Opera <= 12.12
48761 // Opera reports offsetWidths and offsetHeights less than zero on some
48763 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
48765 jQuery.expr.filters.visible = function(elem) {
48766 return !jQuery.expr.filters.hidden(elem);
48773 rbracket = /\[\]$/,
48775 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
48776 rsubmittable = /^(?:input|select|textarea|keygen)/i;
48778 function buildParams(prefix, obj, traditional, add) {
48781 if (jQuery.isArray(obj)) {
48782 // Serialize array item.
48783 jQuery.each(obj, function(i, v) {
48784 if (traditional || rbracket.test(prefix)) {
48785 // Treat each array item as a scalar.
48789 // Item is non-scalar (array or object), encode its numeric
48791 buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add);
48795 } else if (!traditional && jQuery.type(obj) === "object") {
48796 // Serialize object item.
48797 for (name in obj) {
48798 buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
48802 // Serialize scalar item.
48807 // Serialize an array of form elements or a set of
48808 // key/values into a query string
48809 jQuery.param = function(a, traditional) {
48812 add = function(key, value) {
48813 // If value is a function, invoke it and return its value
48814 value = jQuery.isFunction(value) ? value() : (value == null ? "" : value);
48815 s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
48818 // Set traditional to true for jQuery <= 1.3.2 behavior.
48819 if (traditional === undefined) {
48820 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
48823 // If an array was passed in, assume that it is an array of form elements.
48824 if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
48825 // Serialize the form elements
48826 jQuery.each(a, function() {
48827 add(this.name, this.value);
48831 // If traditional, encode the "old" way (the way 1.3.2 or older
48832 // did it), otherwise encode params recursively.
48833 for (prefix in a) {
48834 buildParams(prefix, a[prefix], traditional, add);
48838 // Return the resulting serialization
48839 return s.join("&").replace(r20, "+");
48843 serialize: function() {
48844 return jQuery.param(this.serializeArray());
48846 serializeArray: function() {
48847 return this.map(function() {
48848 // Can add propHook for "elements" to filter or add form elements
48849 var elements = jQuery.prop(this, "elements");
48850 return elements ? jQuery.makeArray(elements) : this;
48852 .filter(function() {
48853 var type = this.type;
48855 // Use .is( ":disabled" ) so that fieldset[disabled] works
48856 return this.name && !jQuery(this).is(":disabled") &&
48857 rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) &&
48858 (this.checked || !rcheckableType.test(type));
48860 .map(function(i, elem) {
48861 var val = jQuery(this).val();
48863 return val == null ?
48865 jQuery.isArray(val) ?
48866 jQuery.map(val, function(val) {
48869 value: val.replace(rCRLF, "\r\n")
48873 value: val.replace(rCRLF, "\r\n")
48880 jQuery.ajaxSettings.xhr = function() {
48882 return new XMLHttpRequest();
48888 xhrSuccessStatus = {
48889 // file protocol always yields status code 0, assume 200
48892 // #1450: sometimes IE returns 1223 when it should be 204
48895 xhrSupported = jQuery.ajaxSettings.xhr();
48898 // Open requests must be manually aborted on unload (#5280)
48899 // See https://support.microsoft.com/kb/2856746 for more info
48900 if (window.attachEvent) {
48901 window.attachEvent("onunload", function() {
48902 for (var key in xhrCallbacks) {
48903 xhrCallbacks[key]();
48908 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
48909 support.ajax = xhrSupported = !!xhrSupported;
48911 jQuery.ajaxTransport(function(options) {
48914 // Cross domain only allowed if supported through XMLHttpRequest
48915 if (support.cors || xhrSupported && !options.crossDomain) {
48917 send: function(headers, complete) {
48919 xhr = options.xhr(),
48922 xhr.open(options.type, options.url, options.async, options.username, options.password);
48924 // Apply custom fields if provided
48925 if (options.xhrFields) {
48926 for (i in options.xhrFields) {
48927 xhr[i] = options.xhrFields[i];
48931 // Override mime type if needed
48932 if (options.mimeType && xhr.overrideMimeType) {
48933 xhr.overrideMimeType(options.mimeType);
48936 // X-Requested-With header
48937 // For cross-domain requests, seeing as conditions for a
48939 // akin to a jigsaw puzzle, we simply never set it to be sure.
48940 // (it can always be set on a per-request basis or even using
48942 // For same-domain requests, won't change header if already
48944 if (!options.crossDomain && !headers["X-Requested-With"]) {
48945 headers["X-Requested-With"] = "XMLHttpRequest";
48949 for (i in headers) {
48950 xhr.setRequestHeader(i, headers[i]);
48954 callback = function(type) {
48955 return function() {
48957 delete xhrCallbacks[id];
48958 callback = xhr.onload = xhr.onerror = null;
48960 if (type === "abort") {
48962 } else if (type === "error") {
48964 // file: protocol always yields status 0;
48965 // see #8605, #14207
48971 xhrSuccessStatus[xhr.status] || xhr.status,
48974 // Accessing binary-data responseText throws
48977 typeof xhr.responseText === "string" ? {
48978 text: xhr.responseText
48980 xhr.getAllResponseHeaders()
48987 // Listen to events
48988 xhr.onload = callback();
48989 xhr.onerror = callback("error");
48991 // Create the abort callback
48992 callback = xhrCallbacks[id] = callback("abort");
48995 // Do send the request (this may raise an exception)
48996 xhr.send(options.hasContent && options.data || null);
48998 // #14683: Only rethrow if this hasn't been notified as an
49006 abort: function() {
49018 // Install script dataType
49021 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
49024 script: /(?:java|ecma)script/
49027 "text script": function(text) {
49028 jQuery.globalEval(text);
49034 // Handle cache's special case and crossDomain
49035 jQuery.ajaxPrefilter("script", function(s) {
49036 if (s.cache === undefined) {
49039 if (s.crossDomain) {
49044 // Bind script tag hack transport
49045 jQuery.ajaxTransport("script", function(s) {
49046 // This transport only deals with cross domain requests
49047 if (s.crossDomain) {
49048 var script, callback;
49050 send: function(_, complete) {
49051 script = jQuery("<script>").prop({
49053 charset: s.scriptCharset,
49057 callback = function(evt) {
49061 complete(evt.type === "error" ? 404 : 200, evt.type);
49065 document.head.appendChild(script[0]);
49067 abort: function() {
49079 var oldCallbacks = [],
49080 rjsonp = /(=)\?(?=&|$)|\?\?/;
49082 // Default jsonp settings
49085 jsonpCallback: function() {
49086 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
49087 this[callback] = true;
49092 // Detect, normalize options and install callbacks for jsonp requests
49093 jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
49095 var callbackName, overwritten, responseContainer,
49096 jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ?
49098 typeof s.data === "string" && !(s.contentType || "").indexOf("application/x-www-form-urlencoded") && rjsonp.test(s.data) && "data"
49101 // Handle iff the expected data type is "jsonp" or we have a parameter to
49103 if (jsonProp || s.dataTypes[0] === "jsonp") {
49105 // Get callback name, remembering preexisting value associated with it
49106 callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ?
49107 s.jsonpCallback() :
49110 // Insert callback into url or form data
49112 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
49113 } else if (s.jsonp !== false) {
49114 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
49117 // Use data converter to retrieve json after script execution
49118 s.converters["script json"] = function() {
49119 if (!responseContainer) {
49120 jQuery.error(callbackName + " was not called");
49122 return responseContainer[0];
49125 // force json dataType
49126 s.dataTypes[0] = "json";
49128 // Install callback
49129 overwritten = window[callbackName];
49130 window[callbackName] = function() {
49131 responseContainer = arguments;
49134 // Clean-up function (fires after converters)
49135 jqXHR.always(function() {
49136 // Restore preexisting value
49137 window[callbackName] = overwritten;
49139 // Save back as free
49140 if (s[callbackName]) {
49141 // make sure that re-using the options doesn't screw things
49143 s.jsonpCallback = originalSettings.jsonpCallback;
49145 // save the callback name for future use
49146 oldCallbacks.push(callbackName);
49149 // Call if it was a function and we have a response
49150 if (responseContainer && jQuery.isFunction(overwritten)) {
49151 overwritten(responseContainer[0]);
49154 responseContainer = overwritten = undefined;
49157 // Delegate to script
49165 // data: string of html
49166 // context (optional): If specified, the fragment will be created in this
49167 // context, defaults to document
49168 // keepScripts (optional): If true, will include scripts passed in the html
49170 jQuery.parseHTML = function(data, context, keepScripts) {
49171 if (!data || typeof data !== "string") {
49174 if (typeof context === "boolean") {
49175 keepScripts = context;
49178 context = context || document;
49180 var parsed = rsingleTag.exec(data),
49181 scripts = !keepScripts && [];
49185 return [context.createElement(parsed[1])];
49188 parsed = jQuery.buildFragment([data], context, scripts);
49190 if (scripts && scripts.length) {
49191 jQuery(scripts).remove();
49194 return jQuery.merge([], parsed.childNodes);
49198 // Keep a copy of the old load method
49199 var _load = jQuery.fn.load;
49202 * Load a url into a page
49204 jQuery.fn.load = function(url, params, callback) {
49205 if (typeof url !== "string" && _load) {
49206 return _load.apply(this, arguments);
49209 var selector, type, response,
49211 off = url.indexOf(" ");
49214 selector = jQuery.trim(url.slice(off));
49215 url = url.slice(0, off);
49218 // If it's a function
49219 if (jQuery.isFunction(params)) {
49221 // We assume that it's the callback
49223 params = undefined;
49225 // Otherwise, build a param string
49226 } else if (params && typeof params === "object") {
49230 // If we have elements to modify, make the request
49231 if (self.length > 0) {
49235 // if "type" variable is undefined, then "GET" method will be used
49239 }).done(function(responseText) {
49241 // Save response for use in complete callback
49242 response = arguments;
49244 self.html(selector ?
49246 // If a selector was specified, locate the right elements in a
49248 // Exclude scripts to avoid IE 'Permission Denied' errors
49249 jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
49251 // Otherwise use the full result
49254 }).complete(callback && function(jqXHR, status) {
49255 self.each(callback, response || [jqXHR.responseText, status, jqXHR]);
49265 // Attach a bunch of functions for handling common AJAX events
49266 jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) {
49267 jQuery.fn[type] = function(fn) {
49268 return this.on(type, fn);
49275 jQuery.expr.filters.animated = function(elem) {
49276 return jQuery.grep(jQuery.timers, function(fn) {
49277 return elem === fn.elem;
49284 var docElem = window.document.documentElement;
49287 * Gets a window from an element
49289 function getWindow(elem) {
49290 return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
49294 setOffset: function(elem, options, i) {
49295 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
49296 position = jQuery.css(elem, "position"),
49297 curElem = jQuery(elem),
49300 // Set position first, in-case top/left are set even on static elem
49301 if (position === "static") {
49302 elem.style.position = "relative";
49305 curOffset = curElem.offset();
49306 curCSSTop = jQuery.css(elem, "top");
49307 curCSSLeft = jQuery.css(elem, "left");
49308 calculatePosition = (position === "absolute" || position === "fixed") &&
49309 (curCSSTop + curCSSLeft).indexOf("auto") > -1;
49311 // Need to be able to calculate position if either
49312 // top or left is auto and position is either absolute or fixed
49313 if (calculatePosition) {
49314 curPosition = curElem.position();
49315 curTop = curPosition.top;
49316 curLeft = curPosition.left;
49319 curTop = parseFloat(curCSSTop) || 0;
49320 curLeft = parseFloat(curCSSLeft) || 0;
49323 if (jQuery.isFunction(options)) {
49324 options = options.call(elem, i, curOffset);
49327 if (options.top != null) {
49328 props.top = (options.top - curOffset.top) + curTop;
49330 if (options.left != null) {
49331 props.left = (options.left - curOffset.left) + curLeft;
49334 if ("using" in options) {
49335 options.using.call(elem, props);
49338 curElem.css(props);
49344 offset: function(options) {
49345 if (arguments.length) {
49346 return options === undefined ?
49348 this.each(function(i) {
49349 jQuery.offset.setOffset(this, options, i);
49359 doc = elem && elem.ownerDocument;
49365 docElem = doc.documentElement;
49367 // Make sure it's not a disconnected DOM node
49368 if (!jQuery.contains(docElem, elem)) {
49372 // Support: BlackBerry 5, iOS 3 (original iPhone)
49373 // If we don't have gBCR, just use 0,0 rather than error
49374 if (typeof elem.getBoundingClientRect !== strundefined) {
49375 box = elem.getBoundingClientRect();
49377 win = getWindow(doc);
49379 top: box.top + win.pageYOffset - docElem.clientTop,
49380 left: box.left + win.pageXOffset - docElem.clientLeft
49384 position: function() {
49389 var offsetParent, offset,
49396 // Fixed elements are offset from window (parentOffset = {top:0, left:
49397 // 0}, because it is its only offset parent
49398 if (jQuery.css(elem, "position") === "fixed") {
49399 // Assume getBoundingClientRect is there when computed position is
49401 offset = elem.getBoundingClientRect();
49404 // Get *real* offsetParent
49405 offsetParent = this.offsetParent();
49407 // Get correct offsets
49408 offset = this.offset();
49409 if (!jQuery.nodeName(offsetParent[0], "html")) {
49410 parentOffset = offsetParent.offset();
49413 // Add offsetParent borders
49414 parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
49415 parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true);
49418 // Subtract parent offsets and element margins
49420 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
49421 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
49425 offsetParent: function() {
49426 return this.map(function() {
49427 var offsetParent = this.offsetParent || docElem;
49429 while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) {
49430 offsetParent = offsetParent.offsetParent;
49433 return offsetParent || docElem;
49438 // Create scrollLeft and scrollTop methods
49440 scrollLeft: "pageXOffset",
49441 scrollTop: "pageYOffset"
49442 }, function(method, prop) {
49443 var top = "pageYOffset" === prop;
49445 jQuery.fn[method] = function(val) {
49446 return access(this, function(elem, method, val) {
49447 var win = getWindow(elem);
49449 if (val === undefined) {
49450 return win ? win[prop] : elem[method];
49454 win.scrollTo(!top ? val : window.pageXOffset,
49455 top ? val : window.pageYOffset
49459 elem[method] = val;
49461 }, method, val, arguments.length, null);
49465 // Support: Safari<7+, Chrome<37+
49466 // Add the top/left cssHooks using jQuery.fn.position
49467 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
49468 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
49469 // getComputedStyle returns percent when specified for top/left/bottom/right;
49470 // rather than make the css module depend on the offset module, just check for
49472 jQuery.each(["top", "left"], function(i, prop) {
49473 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition,
49474 function(elem, computed) {
49476 computed = curCSS(elem, prop);
49477 // If curCSS returns percentage, fallback to offset
49478 return rnumnonpx.test(computed) ?
49479 jQuery(elem).position()[prop] + "px" :
49487 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth
49492 }, function(name, type) {
49494 padding: "inner" + name,
49497 }, function(defaultExtra, funcName) {
49498 // Margin is only for outerHeight, outerWidth
49499 jQuery.fn[funcName] = function(margin, value) {
49500 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
49501 extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
49503 return access(this, function(elem, type, value) {
49506 if (jQuery.isWindow(elem)) {
49507 // As of 5/8/2012 this will yield incorrect results for
49508 // Mobile Safari, but there
49509 // isn't a whole lot we can do. See pull request at this URL
49511 // https://github.com/jquery/jquery/pull/764
49512 return elem.document.documentElement["client" + name];
49515 // Get document width or height
49516 if (elem.nodeType === 9) {
49517 doc = elem.documentElement;
49519 // Either scroll[Width/Height] or offset[Width/Height] or
49520 // client[Width/Height],
49521 // whichever is greatest
49523 elem.body["scroll" + name], doc["scroll" + name],
49524 elem.body["offset" + name], doc["offset" + name],
49525 doc["client" + name]
49529 return value === undefined ?
49530 // Get width or height on the element, requesting but not
49531 // forcing parseFloat
49532 jQuery.css(elem, type, extra) :
49534 // Set width or height on the element
49535 jQuery.style(elem, type, value, extra);
49536 }, type, chainable ? margin : undefined, chainable, null);
49542 // The number of elements contained in the matched element set
49543 jQuery.fn.size = function() {
49544 return this.length;
49547 jQuery.fn.andSelf = jQuery.fn.addBack;
49552 // Register as a named AMD module, since jQuery can be concatenated with other
49553 // files that may use define, but not via a proper concatenation script that
49554 // understands anonymous AMD modules. A named AMD is safest and most robust
49555 // way to register. Lowercase jquery is used because AMD module names are
49556 // derived from file names, and jQuery is normally delivered in a lowercase
49557 // file name. Do this after creating the global so that if an AMD module wants
49558 // to call noConflict to hide this version of jQuery, it will work.
49560 // Note that for maximum portability, libraries that are not jQuery should
49561 // declare themselves as anonymous modules, and avoid setting a global if an
49562 // AMD loader is present. jQuery is a special case. For more information, see
49563 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
49565 if (typeof define === "function" && define.amd) {
49566 define("jquery", [], function() {
49575 // Map over jQuery in case of overwrite
49576 _jQuery = window.jQuery,
49578 // Map over the $ in case of overwrite
49581 jQuery.noConflict = function(deep) {
49582 if (window.$ === jQuery) {
49586 if (deep && window.jQuery === jQuery) {
49587 window.jQuery = _jQuery;
49593 // Expose jQuery and $ identifiers, even in AMD
49594 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
49595 // and CommonJS for browser emulators (#13566)
49596 if (typeof noGlobal === strundefined) {
49597 window.jQuery = window.$ = jQuery;
49608 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\flatten.js": [function(require, module, exports) {
49609 var baseFlatten = require('../internal/baseFlatten'),
49610 isIterateeCall = require('../internal/isIterateeCall');
49613 * Flattens a nested array. If `isDeep` is `true` the array is recursively
49614 * flattened, otherwise it's only flattened a single level.
49620 * array The array to flatten.
49622 * [isDeep] Specify a deep flatten.
49623 * @param- {Object} [guard] Enables use as a callback for functions like
49625 * @returns {Array} Returns the new flattened array.
49628 * _.flatten([1, [2, 3, [4]]]); // => [1, 2, 3, [4]]
49629 * // using `isDeep` _.flatten([1, [2, 3, [4]]], true); // => [1, 2, 3, 4]
49631 function flatten(array, isDeep, guard) {
49632 var length = array ? array.length : 0;
49633 if (guard && isIterateeCall(array, isDeep, guard)) {
49636 return length ? baseFlatten(array, isDeep) : [];
49639 module.exports = flatten;
49642 "../internal/baseFlatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js",
49643 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js"
49645 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\last.js": [function(require, module, exports) {
49647 * Gets the last element of `array`.
49653 * array The array to query.
49654 * @returns {*} Returns the last element of `array`.
49657 * _.last([1, 2, 3]); // => 3
49659 function last(array) {
49660 var length = array ? array.length : 0;
49661 return length ? array[length - 1] : undefined;
49664 module.exports = last;
49667 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\uniq.js": [function(require, module, exports) {
49668 var baseCallback = require('../internal/baseCallback'),
49669 baseUniq = require('../internal/baseUniq'),
49670 isIterateeCall = require('../internal/isIterateeCall'),
49671 sortedUniq = require('../internal/sortedUniq');
49674 * Creates a duplicate-free version of an array, using
49675 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
49676 * for equality comparisons, in which only the first occurence of each element
49677 * is kept. Providing `true` for `isSorted` performs a faster search algorithm
49678 * for sorted arrays. If an iteratee function is provided it's invoked for each
49679 * element in the array to generate the criterion by which uniqueness is
49680 * computed. The `iteratee` is bound to `thisArg` and invoked with three
49681 * arguments: (value, index, array).
49683 * If a property name is provided for `iteratee` the created `_.property` style
49684 * callback returns the property value of the given element.
49686 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49687 * style callback returns `true` for elements that have a matching property
49688 * value, else `false`.
49690 * If an object is provided for `iteratee` the created `_.matches` style
49691 * callback returns `true` for elements that have the properties of the given
49692 * object, else `false`.
49699 * array The array to inspect.
49701 * [isSorted] Specify the array is sorted.
49702 * @param {Function|Object|string}
49703 * [iteratee] The function invoked per iteration.
49705 * [thisArg] The `this` binding of `iteratee`.
49706 * @returns {Array} Returns the new duplicate-value-free array.
49709 * _.uniq([2, 1, 2]); // => [2, 1]
49710 * // using `isSorted` _.uniq([1, 1, 2], true); // => [1, 2]
49711 * // using an iteratee function _.uniq([1, 2.5, 1.5, 2], function(n) { return
49712 * this.floor(n); }, Math); // => [1, 2.5]
49713 * // using the `_.property` callback shorthand _.uniq([{ 'x': 1 }, { 'x': 2 }, {
49714 * 'x': 1 }], 'x'); // => [{ 'x': 1 }, { 'x': 2 }]
49716 function uniq(array, isSorted, iteratee, thisArg) {
49717 var length = array ? array.length : 0;
49721 if (isSorted != null && typeof isSorted != 'boolean') {
49722 thisArg = iteratee;
49723 iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
49726 iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3);
49727 return (isSorted) ? sortedUniq(array, iteratee) : baseUniq(array, iteratee);
49730 module.exports = uniq;
49733 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
49734 "../internal/baseUniq": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseUniq.js",
49735 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
49736 "../internal/sortedUniq": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\sortedUniq.js"
49738 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\unique.js": [function(require, module, exports) {
49739 module.exports = require('./uniq');
49742 "./uniq": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\uniq.js"
49744 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\chain\\lodash.js": [function(require, module, exports) {
49745 var LazyWrapper = require('../internal/LazyWrapper'),
49746 LodashWrapper = require('../internal/LodashWrapper'),
49747 baseLodash = require('../internal/baseLodash'),
49748 isArray = require('../lang/isArray'),
49749 isObjectLike = require('../internal/isObjectLike'),
49750 wrapperClone = require('../internal/wrapperClone');
49752 /** Used for native method references. */
49753 var objectProto = Object.prototype;
49755 /** Used to check objects for own properties. */
49756 var hasOwnProperty = objectProto.hasOwnProperty;
49759 * Creates a `lodash` object which wraps `value` to enable implicit chaining.
49760 * Methods that operate on and return arrays, collections, and functions can be
49761 * chained together. Methods that retrieve a single value or may return a
49762 * primitive value will automatically end the chain returning the unwrapped
49763 * value. Explicit chaining may be enabled using `_.chain`. The execution of
49764 * chained methods is lazy, that is, execution is deferred until `_#value` is
49765 * implicitly or explicitly called.
49767 * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
49768 * fusion is an optimization strategy which merge iteratee calls; this can help
49769 * to avoid the creation of intermediate data structures and greatly reduce the
49770 * number of iteratee executions.
49772 * Chaining is supported in custom builds as long as the `_#value` method is
49773 * directly or indirectly included in the build.
49775 * In addition to lodash methods, wrappers have `Array` and `String` methods.
49777 * The wrapper `Array` methods are: `concat`, `join`, `pop`, `push`, `reverse`,
49778 * `shift`, `slice`, `sort`, `splice`, and `unshift`
49780 * The wrapper `String` methods are: `replace` and `split`
49782 * The wrapper methods that support shortcut fusion are: `compact`, `drop`,
49783 * `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `first`, `initial`,
49784 * `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, `slice`, `take`,
49785 * `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, and `where`
49787 * The chainable wrapper methods are: `after`, `ary`, `assign`, `at`, `before`,
49788 * `bind`, `bindAll`, `bindKey`, `callback`, `chain`, `chunk`, `commit`,
49789 * `compact`, `concat`, `constant`, `countBy`, `create`, `curry`, `debounce`,
49790 * `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, `drop`,
49791 * `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, `filter`, `flatten`,
49792 * `flattenDeep`, `flow`, `flowRight`, `forEach`, `forEachRight`, `forIn`,
49793 * `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`,
49794 * `initial`, `intersection`, `invert`, `invoke`, `keys`, `keysIn`, `map`,
49795 * `mapKeys`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`,
49796 * `method`, `methodOf`, `mixin`, `modArgs`, `negate`, `omit`, `once`, `pairs`,
49797 * `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`, `property`,
49798 * `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`,
49799 * `rest`, `restParam`, `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`,
49800 * `sortByAll`, `sortByOrder`, `splice`, `spread`, `take`, `takeRight`,
49801 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`,
49802 * `toPlainObject`, `transform`, `union`, `uniq`, `unshift`, `unzip`,
49803 * `unzipWith`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`,
49804 * `zipObject`, `zipWith`
49806 * The wrapper methods that are **not** chainable by default are: `add`,
49807 * `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`, `deburr`,
49808 * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
49809 * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
49810 * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
49811 * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
49812 * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
49813 * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
49814 * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
49815 * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
49816 * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
49817 * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
49818 * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
49819 * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
49820 * `unescape`, `uniqueId`, `value`, and `words`
49822 * The wrapper method `sample` will return a wrapped value when `n` is provided,
49823 * otherwise an unwrapped value is returned.
49829 * value The value to wrap in a `lodash` instance.
49830 * @returns {Object} Returns the new `lodash` wrapper instance.
49833 * var wrapped = _([1, 2, 3]);
49834 * // returns an unwrapped value wrapped.reduce(function(total, n) { return
49835 * total + n; }); // => 6
49836 * // returns a wrapped value var squares = wrapped.map(function(n) { return n *
49839 * _.isArray(squares); // => false
49841 * _.isArray(squares.value()); // => true
49843 function lodash(value) {
49844 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
49845 if (value instanceof LodashWrapper) {
49848 if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
49849 return wrapperClone(value);
49852 return new LodashWrapper(value);
49855 // Ensure wrappers are instances of `baseLodash`.
49856 lodash.prototype = baseLodash.prototype;
49858 module.exports = lodash;
49861 "../internal/LazyWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js",
49862 "../internal/LodashWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LodashWrapper.js",
49863 "../internal/baseLodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js",
49864 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js",
49865 "../internal/wrapperClone": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\wrapperClone.js",
49866 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
49868 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\every.js": [function(require, module, exports) {
49869 var arrayEvery = require('../internal/arrayEvery'),
49870 baseCallback = require('../internal/baseCallback'),
49871 baseEvery = require('../internal/baseEvery'),
49872 isArray = require('../lang/isArray'),
49873 isIterateeCall = require('../internal/isIterateeCall');
49876 * Checks if `predicate` returns truthy for **all** elements of `collection`.
49877 * The predicate is bound to `thisArg` and invoked with three arguments: (value,
49878 * index|key, collection).
49880 * If a property name is provided for `predicate` the created `_.property` style
49881 * callback returns the property value of the given element.
49883 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49884 * style callback returns `true` for elements that have a matching property
49885 * value, else `false`.
49887 * If an object is provided for `predicate` the created `_.matches` style
49888 * callback returns `true` for elements that have the properties of the given
49889 * object, else `false`.
49894 * @category Collection
49895 * @param {Array|Object|string}
49896 * collection The collection to iterate over.
49897 * @param {Function|Object|string}
49898 * [predicate=_.identity] The function invoked per iteration.
49900 * [thisArg] The `this` binding of `predicate`.
49901 * @returns {boolean} Returns `true` if all elements pass the predicate check,
49905 * _.every([true, 1, null, 'yes'], Boolean); // => false
49907 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
49908 * 'active': false } ];
49909 * // using the `_.matches` callback shorthand _.every(users, { 'user':
49910 * 'barney', 'active': false }); // => false
49911 * // using the `_.matchesProperty` callback shorthand _.every(users, 'active',
49912 * false); // => true
49913 * // using the `_.property` callback shorthand _.every(users, 'active'); // =>
49916 function every(collection, predicate, thisArg) {
49917 var func = isArray(collection) ? arrayEvery : baseEvery;
49918 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
49919 predicate = undefined;
49921 if (typeof predicate != 'function' || thisArg !== undefined) {
49922 predicate = baseCallback(predicate, thisArg, 3);
49924 return func(collection, predicate);
49927 module.exports = every;
49930 "../internal/arrayEvery": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEvery.js",
49931 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
49932 "../internal/baseEvery": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEvery.js",
49933 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
49934 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
49936 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\filter.js": [function(require, module, exports) {
49937 var arrayFilter = require('../internal/arrayFilter'),
49938 baseCallback = require('../internal/baseCallback'),
49939 baseFilter = require('../internal/baseFilter'),
49940 isArray = require('../lang/isArray');
49943 * Iterates over elements of `collection`, returning an array of all elements
49944 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
49945 * invoked with three arguments: (value, index|key, collection).
49947 * If a property name is provided for `predicate` the created `_.property` style
49948 * callback returns the property value of the given element.
49950 * If a value is also provided for `thisArg` the created `_.matchesProperty`
49951 * style callback returns `true` for elements that have a matching property
49952 * value, else `false`.
49954 * If an object is provided for `predicate` the created `_.matches` style
49955 * callback returns `true` for elements that have the properties of the given
49956 * object, else `false`.
49961 * @category Collection
49962 * @param {Array|Object|string}
49963 * collection The collection to iterate over.
49964 * @param {Function|Object|string}
49965 * [predicate=_.identity] The function invoked per iteration.
49967 * [thisArg] The `this` binding of `predicate`.
49968 * @returns {Array} Returns the new filtered array.
49971 * _.filter([4, 5, 6], function(n) { return n % 2 == 0; }); // => [4, 6]
49973 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
49974 * 'fred', 'age': 40, 'active': false } ];
49975 * // using the `_.matches` callback shorthand _.pluck(_.filter(users, { 'age':
49976 * 36, 'active': true }), 'user'); // => ['barney']
49977 * // using the `_.matchesProperty` callback shorthand _.pluck(_.filter(users,
49978 * 'active', false), 'user'); // => ['fred']
49979 * // using the `_.property` callback shorthand _.pluck(_.filter(users,
49980 * 'active'), 'user'); // => ['barney']
49982 function filter(collection, predicate, thisArg) {
49983 var func = isArray(collection) ? arrayFilter : baseFilter;
49984 predicate = baseCallback(predicate, thisArg, 3);
49985 return func(collection, predicate);
49988 module.exports = filter;
49991 "../internal/arrayFilter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayFilter.js",
49992 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
49993 "../internal/baseFilter": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFilter.js",
49994 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
49996 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\find.js": [function(require, module, exports) {
49997 var baseEach = require('../internal/baseEach'),
49998 createFind = require('../internal/createFind');
50001 * Iterates over elements of `collection`, returning the first element
50002 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
50003 * invoked with three arguments: (value, index|key, collection).
50005 * If a property name is provided for `predicate` the created `_.property` style
50006 * callback returns the property value of the given element.
50008 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50009 * style callback returns `true` for elements that have a matching property
50010 * value, else `false`.
50012 * If an object is provided for `predicate` the created `_.matches` style
50013 * callback returns `true` for elements that have the properties of the given
50014 * object, else `false`.
50019 * @category Collection
50020 * @param {Array|Object|string}
50021 * collection The collection to search.
50022 * @param {Function|Object|string}
50023 * [predicate=_.identity] The function invoked per iteration.
50025 * [thisArg] The `this` binding of `predicate`.
50026 * @returns {*} Returns the matched element, else `undefined`.
50029 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
50030 * 'fred', 'age': 40, 'active': false }, { 'user': 'pebbles', 'age': 1,
50031 * 'active': true } ];
50033 * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); // =>
50035 * // using the `_.matches` callback shorthand _.result(_.find(users, { 'age':
50036 * 1, 'active': true }), 'user'); // => 'pebbles'
50037 * // using the `_.matchesProperty` callback shorthand _.result(_.find(users,
50038 * 'active', false), 'user'); // => 'fred'
50039 * // using the `_.property` callback shorthand _.result(_.find(users,
50040 * 'active'), 'user'); // => 'barney'
50042 var find = createFind(baseEach);
50044 module.exports = find;
50047 "../internal/baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
50048 "../internal/createFind": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createFind.js"
50050 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\forEach.js": [function(require, module, exports) {
50051 var arrayEach = require('../internal/arrayEach'),
50052 baseEach = require('../internal/baseEach'),
50053 createForEach = require('../internal/createForEach');
50056 * Iterates over elements of `collection` invoking `iteratee` for each element.
50057 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
50058 * (value, index|key, collection). Iteratee functions may exit iteration early
50059 * by explicitly returning `false`.
50061 * **Note:** As with other "Collections" methods, objects with a "length"
50062 * property are iterated like arrays. To avoid this behavior `_.forIn` or
50063 * `_.forOwn` may be used for object iteration.
50068 * @category Collection
50069 * @param {Array|Object|string}
50070 * collection The collection to iterate over.
50071 * @param {Function}
50072 * [iteratee=_.identity] The function invoked per iteration.
50074 * [thisArg] The `this` binding of `iteratee`.
50075 * @returns {Array|Object|string} Returns `collection`.
50078 * _([1, 2]).forEach(function(n) { console.log(n); }).value(); // => logs each
50079 * value from left to right and returns the array
50081 * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { console.log(n, key); }); // =>
50082 * logs each value-key pair and returns the object (iteration order is not
50085 var forEach = createForEach(arrayEach, baseEach);
50087 module.exports = forEach;
50090 "../internal/arrayEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEach.js",
50091 "../internal/baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
50092 "../internal/createForEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createForEach.js"
50094 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\groupBy.js": [function(require, module, exports) {
50095 var createAggregator = require('../internal/createAggregator');
50097 /** Used for native method references. */
50098 var objectProto = Object.prototype;
50100 /** Used to check objects for own properties. */
50101 var hasOwnProperty = objectProto.hasOwnProperty;
50104 * Creates an object composed of keys generated from the results of running each
50105 * element of `collection` through `iteratee`. The corresponding value of each
50106 * key is an array of the elements responsible for generating the key. The
50107 * `iteratee` is bound to `thisArg` and invoked with three arguments: (value,
50108 * index|key, collection).
50110 * If a property name is provided for `iteratee` the created `_.property` style
50111 * callback returns the property value of the given element.
50113 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50114 * style callback returns `true` for elements that have a matching property
50115 * value, else `false`.
50117 * If an object is provided for `iteratee` the created `_.matches` style
50118 * callback returns `true` for elements that have the properties of the given
50119 * object, else `false`.
50123 * @category Collection
50124 * @param {Array|Object|string}
50125 * collection The collection to iterate over.
50126 * @param {Function|Object|string}
50127 * [iteratee=_.identity] The function invoked per iteration.
50129 * [thisArg] The `this` binding of `iteratee`.
50130 * @returns {Object} Returns the composed aggregate object.
50133 * _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); }); // => {
50134 * '4': [4.2], '6': [6.1, 6.4] }
50136 * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); // => {
50137 * '4': [4.2], '6': [6.1, 6.4] }
50138 * // using the `_.property` callback shorthand _.groupBy(['one', 'two',
50139 * 'three'], 'length'); // => { '3': ['one', 'two'], '5': ['three'] }
50141 var groupBy = createAggregator(function(result, value, key) {
50142 if (hasOwnProperty.call(result, key)) {
50143 result[key].push(value);
50145 result[key] = [value];
50149 module.exports = groupBy;
50152 "../internal/createAggregator": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAggregator.js"
50154 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\includes.js": [function(require, module, exports) {
50155 var baseIndexOf = require('../internal/baseIndexOf'),
50156 getLength = require('../internal/getLength'),
50157 isArray = require('../lang/isArray'),
50158 isIterateeCall = require('../internal/isIterateeCall'),
50159 isLength = require('../internal/isLength'),
50160 isString = require('../lang/isString'),
50161 values = require('../object/values');
50164 * Native method references for those with the same name as other `lodash`
50167 var nativeMax = Math.max;
50170 * Checks if `target` is in `collection` using
50171 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
50172 * for equality comparisons. If `fromIndex` is negative, it's used as the offset
50173 * from the end of `collection`.
50177 * @alias contains, include
50178 * @category Collection
50179 * @param {Array|Object|string}
50180 * collection The collection to search.
50182 * target The value to search for.
50184 * [fromIndex=0] The index to search from.
50185 * @param- {Object} [guard] Enables use as a callback for functions like
50187 * @returns {boolean} Returns `true` if a matching element is found, else
50191 * _.includes([1, 2, 3], 1); // => true
50193 * _.includes([1, 2, 3], 1, 2); // => false
50195 * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); // => true
50197 * _.includes('pebbles', 'eb'); // => true
50199 function includes(collection, target, fromIndex, guard) {
50200 var length = collection ? getLength(collection) : 0;
50201 if (!isLength(length)) {
50202 collection = values(collection);
50203 length = collection.length;
50205 if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
50208 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
50210 return (typeof collection == 'string' || !isArray(collection) && isString(collection)) ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) : (!!length && baseIndexOf(collection, target, fromIndex) > -1);
50213 module.exports = includes;
50216 "../internal/baseIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js",
50217 "../internal/getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
50218 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
50219 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
50220 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
50221 "../lang/isString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js",
50222 "../object/values": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\values.js"
50224 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\map.js": [function(require, module, exports) {
50225 var arrayMap = require('../internal/arrayMap'),
50226 baseCallback = require('../internal/baseCallback'),
50227 baseMap = require('../internal/baseMap'),
50228 isArray = require('../lang/isArray');
50231 * Creates an array of values by running each element in `collection` through
50232 * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
50233 * arguments: (value, index|key, collection).
50235 * If a property name is provided for `iteratee` the created `_.property` style
50236 * callback returns the property value of the given element.
50238 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50239 * style callback returns `true` for elements that have a matching property
50240 * value, else `false`.
50242 * If an object is provided for `iteratee` the created `_.matches` style
50243 * callback returns `true` for elements that have the properties of the given
50244 * object, else `false`.
50246 * Many lodash methods are guarded to work as iteratees for methods like
50247 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
50249 * The guarded methods are: `ary`, `callback`, `chunk`, `clone`, `create`,
50250 * `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, `flatten`,
50251 * `invert`, `max`, `min`, `parseInt`, `slice`, `sortBy`, `take`, `takeRight`,
50252 * `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `random`, `range`,
50253 * `sample`, `some`, `sum`, `uniq`, and `words`
50258 * @category Collection
50259 * @param {Array|Object|string}
50260 * collection The collection to iterate over.
50261 * @param {Function|Object|string}
50262 * [iteratee=_.identity] The function invoked per iteration.
50264 * [thisArg] The `this` binding of `iteratee`.
50265 * @returns {Array} Returns the new mapped array.
50268 * function timesThree(n) { return n * 3; }
50270 * _.map([1, 2], timesThree); // => [3, 6]
50272 * _.map({ 'a': 1, 'b': 2 }, timesThree); // => [3, 6] (iteration order is not
50275 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
50276 * // using the `_.property` callback shorthand _.map(users, 'user'); // =>
50277 * ['barney', 'fred']
50279 function map(collection, iteratee, thisArg) {
50280 var func = isArray(collection) ? arrayMap : baseMap;
50281 iteratee = baseCallback(iteratee, thisArg, 3);
50282 return func(collection, iteratee);
50285 module.exports = map;
50288 "../internal/arrayMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayMap.js",
50289 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
50290 "../internal/baseMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMap.js",
50291 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
50293 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\reduce.js": [function(require, module, exports) {
50294 var arrayReduce = require('../internal/arrayReduce'),
50295 baseEach = require('../internal/baseEach'),
50296 createReduce = require('../internal/createReduce');
50299 * Reduces `collection` to a value which is the accumulated result of running
50300 * each element in `collection` through `iteratee`, where each successive
50301 * invocation is supplied the return value of the previous. If `accumulator` is
50302 * not provided the first element of `collection` is used as the initial value.
50303 * The `iteratee` is bound to `thisArg` and invoked with four arguments:
50304 * (accumulator, value, index|key, collection).
50306 * Many lodash methods are guarded to work as iteratees for methods like
50307 * `_.reduce`, `_.reduceRight`, and `_.transform`.
50309 * The guarded methods are: `assign`, `defaults`, `defaultsDeep`, `includes`,
50310 * `merge`, `sortByAll`, and `sortByOrder`
50314 * @alias foldl, inject
50315 * @category Collection
50316 * @param {Array|Object|string}
50317 * collection The collection to iterate over.
50318 * @param {Function}
50319 * [iteratee=_.identity] The function invoked per iteration.
50321 * [accumulator] The initial value.
50323 * [thisArg] The `this` binding of `iteratee`.
50324 * @returns {*} Returns the accumulated value.
50327 * _.reduce([1, 2], function(total, n) { return total + n; }); // => 3
50329 * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { result[key] = n * 3;
50330 * return result; }, {}); // => { 'a': 3, 'b': 6 } (iteration order is not
50333 var reduce = createReduce(arrayReduce, baseEach);
50335 module.exports = reduce;
50338 "../internal/arrayReduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayReduce.js",
50339 "../internal/baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
50340 "../internal/createReduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createReduce.js"
50342 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\size.js": [function(require, module, exports) {
50343 var getLength = require('../internal/getLength'),
50344 isLength = require('../internal/isLength'),
50345 keys = require('../object/keys');
50348 * Gets the size of `collection` by returning its length for array-like values
50349 * or the number of own enumerable properties for objects.
50353 * @category Collection
50354 * @param {Array|Object|string}
50355 * collection The collection to inspect.
50356 * @returns {number} Returns the size of `collection`.
50359 * _.size([1, 2, 3]); // => 3
50361 * _.size({ 'a': 1, 'b': 2 }); // => 2
50363 * _.size('pebbles'); // => 7
50365 function size(collection) {
50366 var length = collection ? getLength(collection) : 0;
50367 return isLength(length) ? length : keys(collection).length;
50370 module.exports = size;
50373 "../internal/getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
50374 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
50375 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
50377 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\some.js": [function(require, module, exports) {
50378 var arraySome = require('../internal/arraySome'),
50379 baseCallback = require('../internal/baseCallback'),
50380 baseSome = require('../internal/baseSome'),
50381 isArray = require('../lang/isArray'),
50382 isIterateeCall = require('../internal/isIterateeCall');
50385 * Checks if `predicate` returns truthy for **any** element of `collection`. The
50386 * function returns as soon as it finds a passing value and does not iterate
50387 * over the entire collection. The predicate is bound to `thisArg` and invoked
50388 * with three arguments: (value, index|key, collection).
50390 * If a property name is provided for `predicate` the created `_.property` style
50391 * callback returns the property value of the given element.
50393 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50394 * style callback returns `true` for elements that have a matching property
50395 * value, else `false`.
50397 * If an object is provided for `predicate` the created `_.matches` style
50398 * callback returns `true` for elements that have the properties of the given
50399 * object, else `false`.
50404 * @category Collection
50405 * @param {Array|Object|string}
50406 * collection The collection to iterate over.
50407 * @param {Function|Object|string}
50408 * [predicate=_.identity] The function invoked per iteration.
50410 * [thisArg] The `this` binding of `predicate`.
50411 * @returns {boolean} Returns `true` if any element passes the predicate check,
50415 * _.some([null, 0, 'yes', false], Boolean); // => true
50417 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
50418 * 'active': false } ];
50419 * // using the `_.matches` callback shorthand _.some(users, { 'user':
50420 * 'barney', 'active': false }); // => false
50421 * // using the `_.matchesProperty` callback shorthand _.some(users, 'active',
50422 * false); // => true
50423 * // using the `_.property` callback shorthand _.some(users, 'active'); // =>
50426 function some(collection, predicate, thisArg) {
50427 var func = isArray(collection) ? arraySome : baseSome;
50428 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
50429 predicate = undefined;
50431 if (typeof predicate != 'function' || thisArg !== undefined) {
50432 predicate = baseCallback(predicate, thisArg, 3);
50434 return func(collection, predicate);
50437 module.exports = some;
50440 "../internal/arraySome": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arraySome.js",
50441 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
50442 "../internal/baseSome": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSome.js",
50443 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js",
50444 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js"
50446 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\collection\\sortBy.js": [function(require, module, exports) {
50447 var baseCallback = require('../internal/baseCallback'),
50448 baseMap = require('../internal/baseMap'),
50449 baseSortBy = require('../internal/baseSortBy'),
50450 compareAscending = require('../internal/compareAscending'),
50451 isIterateeCall = require('../internal/isIterateeCall');
50454 * Creates an array of elements, sorted in ascending order by the results of
50455 * running each element in a collection through `iteratee`. This method performs
50456 * a stable sort, that is, it preserves the original sort order of equal
50457 * elements. The `iteratee` is bound to `thisArg` and invoked with three
50458 * arguments: (value, index|key, collection).
50460 * If a property name is provided for `iteratee` the created `_.property` style
50461 * callback returns the property value of the given element.
50463 * If a value is also provided for `thisArg` the created `_.matchesProperty`
50464 * style callback returns `true` for elements that have a matching property
50465 * value, else `false`.
50467 * If an object is provided for `iteratee` the created `_.matches` style
50468 * callback returns `true` for elements that have the properties of the given
50469 * object, else `false`.
50473 * @category Collection
50474 * @param {Array|Object|string}
50475 * collection The collection to iterate over.
50476 * @param {Function|Object|string}
50477 * [iteratee=_.identity] The function invoked per iteration.
50479 * [thisArg] The `this` binding of `iteratee`.
50480 * @returns {Array} Returns the new sorted array.
50483 * _.sortBy([1, 2, 3], function(n) { return Math.sin(n); }); // => [3, 1, 2]
50485 * _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math); // => [3, 1,
50488 * var users = [ { 'user': 'fred' }, { 'user': 'pebbles' }, { 'user': 'barney' } ];
50489 * // using the `_.property` callback shorthand _.pluck(_.sortBy(users,
50490 * 'user'), 'user'); // => ['barney', 'fred', 'pebbles']
50492 function sortBy(collection, iteratee, thisArg) {
50493 if (collection == null) {
50496 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
50497 iteratee = undefined;
50500 iteratee = baseCallback(iteratee, thisArg, 3);
50502 var result = baseMap(collection, function(value, key, collection) {
50504 'criteria': iteratee(value, key, collection),
50509 return baseSortBy(result, compareAscending);
50512 module.exports = sortBy;
50515 "../internal/baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
50516 "../internal/baseMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMap.js",
50517 "../internal/baseSortBy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSortBy.js",
50518 "../internal/compareAscending": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\compareAscending.js",
50519 "../internal/isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js"
50521 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\date\\now.js": [function(require, module, exports) {
50522 var getNative = require('../internal/getNative');
50525 * Native method references for those with the same name as other `lodash`
50528 var nativeNow = getNative(Date, 'now');
50531 * Gets the number of milliseconds that have elapsed since the Unix epoch (1
50532 * January 1970 00:00:00 UTC).
50539 * _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now()); // =>
50540 * logs the number of milliseconds it took for the deferred function to be
50543 var now = nativeNow || function() {
50544 return new Date().getTime();
50547 module.exports = now;
50550 "../internal/getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
50552 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\bind.js": [function(require, module, exports) {
50553 var createWrapper = require('../internal/createWrapper'),
50554 replaceHolders = require('../internal/replaceHolders'),
50555 restParam = require('./restParam');
50557 /** Used to compose bitmasks for wrapper metadata. */
50562 * Creates a function that invokes `func` with the `this` binding of `thisArg`
50563 * and prepends any additional `_.bind` arguments to those provided to the bound
50566 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
50567 * may be used as a placeholder for partially applied arguments.
50569 * **Note:** Unlike native `Function#bind` this method does not set the "length"
50570 * property of bound functions.
50574 * @category Function
50575 * @param {Function}
50576 * func The function to bind.
50578 * thisArg The `this` binding of `func`.
50580 * [partials] The arguments to be partially applied.
50581 * @returns {Function} Returns the new bound function.
50584 * var greet = function(greeting, punctuation) { return greeting + ' ' +
50585 * this.user + punctuation; };
50587 * var object = { 'user': 'fred' };
50589 * var bound = _.bind(greet, object, 'hi'); bound('!'); // => 'hi fred!'
50590 * // using placeholders var bound = _.bind(greet, object, _, '!');
50591 * bound('hi'); // => 'hi fred!'
50593 var bind = restParam(function(func, thisArg, partials) {
50594 var bitmask = BIND_FLAG;
50595 if (partials.length) {
50596 var holders = replaceHolders(partials, bind.placeholder);
50597 bitmask |= PARTIAL_FLAG;
50599 return createWrapper(func, bitmask, thisArg, partials, holders);
50602 // Assign default placeholders.
50603 bind.placeholder = {};
50605 module.exports = bind;
50608 "../internal/createWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createWrapper.js",
50609 "../internal/replaceHolders": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js",
50610 "./restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js"
50612 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\debounce.js": [function(require, module, exports) {
50613 var isObject = require('../lang/isObject'),
50614 now = require('../date/now');
50616 /** Used as the `TypeError` message for "Functions" methods. */
50617 var FUNC_ERROR_TEXT = 'Expected a function';
50620 * Native method references for those with the same name as other `lodash`
50623 var nativeMax = Math.max;
50626 * Creates a debounced function that delays invoking `func` until after `wait`
50627 * milliseconds have elapsed since the last time the debounced function was
50628 * invoked. The debounced function comes with a `cancel` method to cancel
50629 * delayed invocations. Provide an options object to indicate that `func` should
50630 * be invoked on the leading and/or trailing edge of the `wait` timeout.
50631 * Subsequent calls to the debounced function return the result of the last
50632 * `func` invocation.
50634 * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
50635 * on the trailing edge of the timeout only if the the debounced function is
50636 * invoked more than once during the `wait` timeout.
50638 * See [David Corbacho's
50639 * article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
50640 * for details over the differences between `_.debounce` and `_.throttle`.
50644 * @category Function
50645 * @param {Function}
50646 * func The function to debounce.
50648 * [wait=0] The number of milliseconds to delay.
50650 * [options] The options object.
50652 * [options.leading=false] Specify invoking on the leading edge of
50655 * [options.maxWait] The maximum time `func` is allowed to be delayed
50656 * before it's invoked.
50658 * [options.trailing=true] Specify invoking on the trailing edge of
50660 * @returns {Function} Returns the new debounced function.
50662 * // avoid costly calculations while the window size is in flux
50663 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
50664 * // invoke `sendMail` when the click event is fired, debouncing subsequent
50665 * calls jQuery('#postbox').on('click', _.debounce(sendMail, 300, { 'leading':
50666 * true, 'trailing': false }));
50667 * // ensure `batchLog` is invoked once after 1 second of debounced calls var
50668 * source = new EventSource('/stream'); jQuery(source).on('message',
50669 * _.debounce(batchLog, 250, { 'maxWait': 1000 }));
50670 * // cancel a debounced call var todoChanges = _.debounce(batchLog, 1000);
50671 * Object.observe(models.todo, todoChanges);
50673 * Object.observe(models, function(changes) { if (_.find(changes, { 'user':
50674 * 'todo', 'type': 'delete'})) { todoChanges.cancel(); } }, ['delete']);
50675 * // ...at some point `models.todo` is changed models.todo.completed = true;
50676 * // ...before 1 second has passed `models.todo` is deleted // which cancels
50677 * the debounced `todoChanges` call delete models.todo;
50679 function debounce(func, wait, options) {
50691 if (typeof func != 'function') {
50692 throw new TypeError(FUNC_ERROR_TEXT);
50694 wait = wait < 0 ? 0 : (+wait || 0);
50695 if (options === true) {
50696 var leading = true;
50698 } else if (isObject(options)) {
50699 leading = !!options.leading;
50700 maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
50701 trailing = 'trailing' in options ? !!options.trailing : trailing;
50704 function cancel() {
50706 clearTimeout(timeoutId);
50708 if (maxTimeoutId) {
50709 clearTimeout(maxTimeoutId);
50712 maxTimeoutId = timeoutId = trailingCall = undefined;
50715 function complete(isCalled, id) {
50719 maxTimeoutId = timeoutId = trailingCall = undefined;
50721 lastCalled = now();
50722 result = func.apply(thisArg, args);
50723 if (!timeoutId && !maxTimeoutId) {
50724 args = thisArg = undefined;
50729 function delayed() {
50730 var remaining = wait - (now() - stamp);
50731 if (remaining <= 0 || remaining > wait) {
50732 complete(trailingCall, maxTimeoutId);
50734 timeoutId = setTimeout(delayed, remaining);
50738 function maxDelayed() {
50739 complete(trailing, timeoutId);
50742 function debounced() {
50746 trailingCall = trailing && (timeoutId || !leading);
50748 if (maxWait === false) {
50749 var leadingCall = leading && !timeoutId;
50751 if (!maxTimeoutId && !leading) {
50752 lastCalled = stamp;
50754 var remaining = maxWait - (stamp - lastCalled),
50755 isCalled = remaining <= 0 || remaining > maxWait;
50758 if (maxTimeoutId) {
50759 maxTimeoutId = clearTimeout(maxTimeoutId);
50761 lastCalled = stamp;
50762 result = func.apply(thisArg, args);
50763 } else if (!maxTimeoutId) {
50764 maxTimeoutId = setTimeout(maxDelayed, remaining);
50767 if (isCalled && timeoutId) {
50768 timeoutId = clearTimeout(timeoutId);
50769 } else if (!timeoutId && wait !== maxWait) {
50770 timeoutId = setTimeout(delayed, wait);
50774 result = func.apply(thisArg, args);
50776 if (isCalled && !timeoutId && !maxTimeoutId) {
50777 args = thisArg = undefined;
50781 debounced.cancel = cancel;
50785 module.exports = debounce;
50788 "../date/now": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\date\\now.js",
50789 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
50791 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\defer.js": [function(require, module, exports) {
50792 var baseDelay = require('../internal/baseDelay'),
50793 restParam = require('./restParam');
50796 * Defers invoking the `func` until the current call stack has cleared. Any
50797 * additional arguments are provided to `func` when it's invoked.
50801 * @category Function
50802 * @param {Function}
50803 * func The function to defer.
50805 * [args] The arguments to invoke the function with.
50806 * @returns {number} Returns the timer id.
50809 * _.defer(function(text) { console.log(text); }, 'deferred'); // logs
50810 * 'deferred' after one or more milliseconds
50812 var defer = restParam(function(func, args) {
50813 return baseDelay(func, 1, args);
50816 module.exports = defer;
50819 "../internal/baseDelay": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDelay.js",
50820 "./restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js"
50822 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js": [function(require, module, exports) {
50823 /** Used as the `TypeError` message for "Functions" methods. */
50824 var FUNC_ERROR_TEXT = 'Expected a function';
50827 * Native method references for those with the same name as other `lodash`
50830 var nativeMax = Math.max;
50833 * Creates a function that invokes `func` with the `this` binding of the created
50834 * function and arguments from `start` and beyond provided as an array.
50836 * **Note:** This method is based on the [rest
50837 * parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
50841 * @category Function
50842 * @param {Function}
50843 * func The function to apply a rest parameter to.
50845 * [start=func.length-1] The start position of the rest parameter.
50846 * @returns {Function} Returns the new function.
50849 * var say = _.restParam(function(what, names) { return what + ' ' +
50850 * _.initial(names).join(', ') + (_.size(names) > 1 ? ', & ' : '') +
50851 * _.last(names); });
50853 * say('hello', 'fred', 'barney', 'pebbles'); // => 'hello fred, barney, &
50856 function restParam(func, start) {
50857 if (typeof func != 'function') {
50858 throw new TypeError(FUNC_ERROR_TEXT);
50860 start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
50861 return function() {
50862 var args = arguments,
50864 length = nativeMax(args.length - start, 0),
50865 rest = Array(length);
50867 while (++index < length) {
50868 rest[index] = args[start + index];
50872 return func.call(this, rest);
50874 return func.call(this, args[0], rest);
50876 return func.call(this, args[0], args[1], rest);
50878 var otherArgs = Array(start + 1);
50880 while (++index < start) {
50881 otherArgs[index] = args[index];
50883 otherArgs[start] = rest;
50884 return func.apply(this, otherArgs);
50888 module.exports = restParam;
50891 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\index.js": [function(require, module, exports) {
50892 (function(global) {
50894 * @license lodash 3.10.1 (Custom Build) <https://lodash.com/> Build: `lodash
50895 * modern -d -o ./index.js` Copyright 2012-2015 The Dojo Foundation
50896 * <http://dojofoundation.org/> Based on Underscore.js 1.8.3
50897 * <http://underscorejs.org/LICENSE> Copyright 2009-2015 Jeremy
50898 * Ashkenas, DocumentCloud and Investigative Reporters & Editors
50899 * Available under MIT license <https://lodash.com/license>
50904 /** Used as a safe reference for `undefined` in pre-ES5 environments. */
50907 /** Used as the semantic version number. */
50908 var VERSION = '3.10.1';
50910 /** Used to compose bitmasks for wrapper metadata. */
50913 CURRY_BOUND_FLAG = 4,
50915 CURRY_RIGHT_FLAG = 16,
50917 PARTIAL_RIGHT_FLAG = 64,
50921 /** Used as default options for `_.trunc`. */
50922 var DEFAULT_TRUNC_LENGTH = 30,
50923 DEFAULT_TRUNC_OMISSION = '...';
50925 /** Used to detect when a function becomes hot. */
50926 var HOT_COUNT = 150,
50929 /** Used as the size to enable large array optimizations. */
50930 var LARGE_ARRAY_SIZE = 200;
50932 /** Used to indicate the type of lazy iteratees. */
50933 var LAZY_FILTER_FLAG = 1,
50936 /** Used as the `TypeError` message for "Functions" methods. */
50937 var FUNC_ERROR_TEXT = 'Expected a function';
50939 /** Used as the internal argument placeholder. */
50940 var PLACEHOLDER = '__lodash_placeholder__';
50942 /** `Object#toString` result references. */
50943 var argsTag = '[object Arguments]',
50944 arrayTag = '[object Array]',
50945 boolTag = '[object Boolean]',
50946 dateTag = '[object Date]',
50947 errorTag = '[object Error]',
50948 funcTag = '[object Function]',
50949 mapTag = '[object Map]',
50950 numberTag = '[object Number]',
50951 objectTag = '[object Object]',
50952 regexpTag = '[object RegExp]',
50953 setTag = '[object Set]',
50954 stringTag = '[object String]',
50955 weakMapTag = '[object WeakMap]';
50957 var arrayBufferTag = '[object ArrayBuffer]',
50958 float32Tag = '[object Float32Array]',
50959 float64Tag = '[object Float64Array]',
50960 int8Tag = '[object Int8Array]',
50961 int16Tag = '[object Int16Array]',
50962 int32Tag = '[object Int32Array]',
50963 uint8Tag = '[object Uint8Array]',
50964 uint8ClampedTag = '[object Uint8ClampedArray]',
50965 uint16Tag = '[object Uint16Array]',
50966 uint32Tag = '[object Uint32Array]';
50968 /** Used to match empty string literals in compiled template source. */
50969 var reEmptyStringLeading = /\b__p \+= '';/g,
50970 reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
50971 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
50973 /** Used to match HTML entities and HTML characters. */
50974 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
50975 reUnescapedHtml = /[&<>"'`]/g,
50976 reHasEscapedHtml = RegExp(reEscapedHtml.source),
50977 reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
50979 /** Used to match template delimiters. */
50980 var reEscape = /<%-([\s\S]+?)%>/g,
50981 reEvaluate = /<%([\s\S]+?)%>/g,
50982 reInterpolate = /<%=([\s\S]+?)%>/g;
50984 /** Used to match property names within property paths. */
50985 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
50986 reIsPlainProp = /^\w*$/,
50987 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
50990 * Used to match `RegExp` [syntax
50991 * characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns) and
50992 * those outlined by
50993 * [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
50995 var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
50996 reHasRegExpChars = RegExp(reRegExpChars.source);
50999 * Used to match [combining diacritical
51000 * marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
51002 var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
51004 /** Used to match backslashes in property paths. */
51005 var reEscapeChar = /\\(\\)?/g;
51008 * Used to match [ES template
51009 * delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).
51011 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
51013 /** Used to match `RegExp` flags from their coerced string values. */
51014 var reFlags = /\w*$/;
51016 /** Used to detect hexadecimal string values. */
51017 var reHasHexPrefix = /^0[xX]/;
51019 /** Used to detect host constructors (Safari > 5). */
51020 var reIsHostCtor = /^\[object .+?Constructor\]$/;
51022 /** Used to detect unsigned integer values. */
51023 var reIsUint = /^\d+$/;
51026 * Used to match latin-1 supplementary letters (excluding mathematical
51029 var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
51031 /** Used to ensure capturing order of template delimiters. */
51032 var reNoMatch = /($^)/;
51034 /** Used to match unescaped characters in compiled string literals. */
51035 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
51037 /** Used to match words to create compound words. */
51038 var reWords = (function() {
51039 var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
51040 lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
51042 return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
51045 /** Used to assign default `context` object properties. */
51046 var contextProps = [
51047 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
51048 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
51049 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',
51050 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
51051 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'
51054 /** Used to make template sourceURLs easier to identify. */
51055 var templateCounter = -1;
51057 /** Used to identify `toStringTag` values of typed arrays. */
51058 var typedArrayTags = {};
51059 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
51060 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
51061 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
51062 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
51063 typedArrayTags[uint32Tag] = true;
51064 typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
51065 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
51066 typedArrayTags[dateTag] = typedArrayTags[errorTag] =
51067 typedArrayTags[funcTag] = typedArrayTags[mapTag] =
51068 typedArrayTags[numberTag] = typedArrayTags[objectTag] =
51069 typedArrayTags[regexpTag] = typedArrayTags[setTag] =
51070 typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
51072 /** Used to identify `toStringTag` values supported by `_.clone`. */
51073 var cloneableTags = {};
51074 cloneableTags[argsTag] = cloneableTags[arrayTag] =
51075 cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
51076 cloneableTags[dateTag] = cloneableTags[float32Tag] =
51077 cloneableTags[float64Tag] = cloneableTags[int8Tag] =
51078 cloneableTags[int16Tag] = cloneableTags[int32Tag] =
51079 cloneableTags[numberTag] = cloneableTags[objectTag] =
51080 cloneableTags[regexpTag] = cloneableTags[stringTag] =
51081 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
51082 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
51083 cloneableTags[errorTag] = cloneableTags[funcTag] =
51084 cloneableTags[mapTag] = cloneableTags[setTag] =
51085 cloneableTags[weakMapTag] = false;
51087 /** Used to map latin-1 supplementary letters to basic latin letters. */
51088 var deburredLetters = {
51153 /** Used to map characters to HTML entities. */
51154 var htmlEscapes = {
51163 /** Used to map HTML entities to characters. */
51164 var htmlUnescapes = {
51173 /** Used to determine if values are of the language type `Object`. */
51174 var objectTypes = {
51179 /** Used to escape characters for inclusion in compiled regexes. */
51180 var regexpEscapes = {
51211 /** Used to escape characters for inclusion in compiled string literals. */
51212 var stringEscapes = {
51221 /** Detect free variable `exports`. */
51222 var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
51224 /** Detect free variable `module`. */
51225 var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
51227 /** Detect free variable `global` from Node.js. */
51228 var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
51230 /** Detect free variable `self`. */
51231 var freeSelf = objectTypes[typeof self] && self && self.Object && self;
51233 /** Detect free variable `window`. */
51234 var freeWindow = objectTypes[typeof window] && window && window.Object && window;
51236 /** Detect the popular CommonJS extension `module.exports`. */
51237 var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
51240 * Used as a reference to the global object.
51242 * The `this` value is used if it's the global object to avoid
51243 * Greasemonkey's restricted `window` object, otherwise the `window` object
51246 var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
51248 /*--------------------------------------------------------------------------*/
51251 * The base implementation of `compareAscending` which compares values and
51252 * sorts them in ascending order without guaranteeing a stable sort.
51256 * value The value to compare.
51258 * other The other value to compare.
51259 * @returns {number} Returns the sort order indicator for `value`.
51261 function baseCompareAscending(value, other) {
51262 if (value !== other) {
51263 var valIsNull = value === null,
51264 valIsUndef = value === undefined,
51265 valIsReflexive = value === value;
51267 var othIsNull = other === null,
51268 othIsUndef = other === undefined,
51269 othIsReflexive = other === other;
51271 if ((value > other && !othIsNull) || !valIsReflexive ||
51272 (valIsNull && !othIsUndef && othIsReflexive) ||
51273 (valIsUndef && othIsReflexive)) {
51276 if ((value < other && !valIsNull) || !othIsReflexive ||
51277 (othIsNull && !valIsUndef && valIsReflexive) ||
51278 (othIsUndef && valIsReflexive)) {
51286 * The base implementation of `_.findIndex` and `_.findLastIndex` without
51287 * support for callback shorthands and `this` binding.
51291 * array The array to search.
51292 * @param {Function}
51293 * predicate The function invoked per iteration.
51295 * [fromRight] Specify iterating from right to left.
51296 * @returns {number} Returns the index of the matched value, else `-1`.
51298 function baseFindIndex(array, predicate, fromRight) {
51299 var length = array.length,
51300 index = fromRight ? length : -1;
51302 while ((fromRight ? index-- : ++index < length)) {
51303 if (predicate(array[index], index, array)) {
51311 * The base implementation of `_.indexOf` without support for binary
51316 * array The array to search.
51318 * value The value to search for.
51320 * fromIndex The index to search from.
51321 * @returns {number} Returns the index of the matched value, else `-1`.
51323 function baseIndexOf(array, value, fromIndex) {
51324 if (value !== value) {
51325 return indexOfNaN(array, fromIndex);
51327 var index = fromIndex - 1,
51328 length = array.length;
51330 while (++index < length) {
51331 if (array[index] === value) {
51339 * The base implementation of `_.isFunction` without support for
51340 * environments with incorrect `typeof` results.
51344 * value The value to check.
51345 * @returns {boolean} Returns `true` if `value` is correctly classified,
51348 function baseIsFunction(value) {
51349 // Avoid a Chakra JIT bug in compatibility modes of IE 11.
51350 // See https://github.com/jashkenas/underscore/issues/1621 for more details.
51351 return typeof value == 'function' || false;
51355 * Converts `value` to a string if it's not one. An empty string is returned
51356 * for `null` or `undefined` values.
51360 * value The value to process.
51361 * @returns {string} Returns the string.
51363 function baseToString(value) {
51364 return value == null ? '' : (value + '');
51368 * Used by `_.trim` and `_.trimLeft` to get the index of the first character
51369 * of `string` that is not found in `chars`.
51373 * string The string to inspect.
51375 * chars The characters to find.
51376 * @returns {number} Returns the index of the first character not found in
51379 function charsLeftIndex(string, chars) {
51381 length = string.length;
51383 while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}
51388 * Used by `_.trim` and `_.trimRight` to get the index of the last character
51389 * of `string` that is not found in `chars`.
51393 * string The string to inspect.
51395 * chars The characters to find.
51396 * @returns {number} Returns the index of the last character not found in
51399 function charsRightIndex(string, chars) {
51400 var index = string.length;
51402 while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
51407 * Used by `_.sortBy` to compare transformed elements of a collection and
51408 * stable sort them in ascending order.
51412 * object The object to compare.
51414 * other The other object to compare.
51415 * @returns {number} Returns the sort order indicator for `object`.
51417 function compareAscending(object, other) {
51418 return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
51422 * Used by `_.sortByOrder` to compare multiple properties of a value to
51423 * another and stable sort them.
51425 * If `orders` is unspecified, all valuess are sorted in ascending order.
51426 * Otherwise, a value is sorted in ascending order if its corresponding
51427 * order is "asc", and descending if "desc".
51431 * object The object to compare.
51433 * other The other object to compare.
51434 * @param {boolean[]}
51435 * orders The order to sort by for each property.
51436 * @returns {number} Returns the sort order indicator for `object`.
51438 function compareMultiple(object, other, orders) {
51440 objCriteria = object.criteria,
51441 othCriteria = other.criteria,
51442 length = objCriteria.length,
51443 ordersLength = orders.length;
51445 while (++index < length) {
51446 var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
51448 if (index >= ordersLength) {
51451 var order = orders[index];
51452 return result * ((order === 'asc' || order === true) ? 1 : -1);
51455 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
51456 // that causes it, under certain circumstances, to provide the same value
51458 // `object` and `other`. See
51459 // https://github.com/jashkenas/underscore/pull/1247
51460 // for more details.
51462 // This also ensures a stable sort in V8 and other engines.
51463 // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
51464 return object.index - other.index;
51468 * Used by `_.deburr` to convert latin-1 supplementary letters to basic
51473 * letter The matched letter to deburr.
51474 * @returns {string} Returns the deburred letter.
51476 function deburrLetter(letter) {
51477 return deburredLetters[letter];
51481 * Used by `_.escape` to convert characters to HTML entities.
51485 * chr The matched character to escape.
51486 * @returns {string} Returns the escaped character.
51488 function escapeHtmlChar(chr) {
51489 return htmlEscapes[chr];
51493 * Used by `_.escapeRegExp` to escape characters for inclusion in compiled
51498 * chr The matched character to escape.
51500 * leadingChar The capture group for a leading character.
51502 * whitespaceChar The capture group for a whitespace character.
51503 * @returns {string} Returns the escaped character.
51505 function escapeRegExpChar(chr, leadingChar, whitespaceChar) {
51507 chr = regexpEscapes[chr];
51508 } else if (whitespaceChar) {
51509 chr = stringEscapes[chr];
51515 * Used by `_.template` to escape characters for inclusion in compiled
51520 * chr The matched character to escape.
51521 * @returns {string} Returns the escaped character.
51523 function escapeStringChar(chr) {
51524 return '\\' + stringEscapes[chr];
51528 * Gets the index at which the first occurrence of `NaN` is found in
51533 * array The array to search.
51535 * fromIndex The index to search from.
51537 * [fromRight] Specify iterating from right to left.
51538 * @returns {number} Returns the index of the matched `NaN`, else `-1`.
51540 function indexOfNaN(array, fromIndex, fromRight) {
51541 var length = array.length,
51542 index = fromIndex + (fromRight ? 0 : -1);
51544 while ((fromRight ? index-- : ++index < length)) {
51545 var other = array[index];
51546 if (other !== other) {
51554 * Checks if `value` is object-like.
51558 * value The value to check.
51559 * @returns {boolean} Returns `true` if `value` is object-like, else
51562 function isObjectLike(value) {
51563 return !!value && typeof value == 'object';
51567 * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
51568 * character code is whitespace.
51572 * charCode The character code to inspect.
51573 * @returns {boolean} Returns `true` if `charCode` is whitespace, else
51576 function isSpace(charCode) {
51577 return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
51578 (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
51582 * Replaces all `placeholder` elements in `array` with an internal
51583 * placeholder and returns an array of their indexes.
51587 * array The array to modify.
51589 * placeholder The placeholder to replace.
51590 * @returns {Array} Returns the new array of placeholder indexes.
51592 function replaceHolders(array, placeholder) {
51594 length = array.length,
51598 while (++index < length) {
51599 if (array[index] === placeholder) {
51600 array[index] = PLACEHOLDER;
51601 result[++resIndex] = index;
51608 * An implementation of `_.uniq` optimized for sorted arrays without support
51609 * for callback shorthands and `this` binding.
51613 * array The array to inspect.
51614 * @param {Function}
51615 * [iteratee] The function invoked per iteration.
51616 * @returns {Array} Returns the new duplicate-value-free array.
51618 function sortedUniq(array, iteratee) {
51621 length = array.length,
51625 while (++index < length) {
51626 var value = array[index],
51627 computed = iteratee ? iteratee(value, index, array) : value;
51629 if (!index || seen !== computed) {
51631 result[++resIndex] = value;
51638 * Used by `_.trim` and `_.trimLeft` to get the index of the first
51639 * non-whitespace character of `string`.
51643 * string The string to inspect.
51644 * @returns {number} Returns the index of the first non-whitespace
51647 function trimmedLeftIndex(string) {
51649 length = string.length;
51651 while (++index < length && isSpace(string.charCodeAt(index))) {}
51656 * Used by `_.trim` and `_.trimRight` to get the index of the last
51657 * non-whitespace character of `string`.
51661 * string The string to inspect.
51662 * @returns {number} Returns the index of the last non-whitespace character.
51664 function trimmedRightIndex(string) {
51665 var index = string.length;
51667 while (index-- && isSpace(string.charCodeAt(index))) {}
51672 * Used by `_.unescape` to convert HTML entities to characters.
51676 * chr The matched character to unescape.
51677 * @returns {string} Returns the unescaped character.
51679 function unescapeHtmlChar(chr) {
51680 return htmlUnescapes[chr];
51683 /*--------------------------------------------------------------------------*/
51686 * Create a new pristine `lodash` function using the given `context` object.
51690 * @category Utility
51692 * [context=root] The context object.
51693 * @returns {Function} Returns a new `lodash` function.
51696 * _.mixin({ 'foo': _.constant('foo') });
51698 * var lodash = _.runInContext(); lodash.mixin({ 'bar':
51699 * lodash.constant('bar') });
51701 * _.isFunction(_.foo); // => true _.isFunction(_.bar); // => false
51703 * lodash.isFunction(lodash.foo); // => false lodash.isFunction(lodash.bar); // =>
51705 * // using `context` to mock `Date#getTime` use in `_.now` var mock =
51706 * _.runInContext({ 'Date': function() { return { 'getTime': getTimeMock }; }
51708 * // or creating a suped-up `defer` in Node.js var defer =
51709 * _.runInContext({ 'setTimeout': setImmediate }).defer;
51711 function runInContext(context) {
51712 // Avoid issues with some ES3 environments that attempt to use values, named
51713 // after built-in constructors like `Object`, for the creation of literals.
51714 // ES5 clears this up by stating that literals must use built-in
51716 // See https://es5.github.io/#x11.1.5 for more details.
51717 context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
51719 /** Native constructor references. */
51720 var Array = context.Array,
51721 Date = context.Date,
51722 Error = context.Error,
51723 Function = context.Function,
51724 Math = context.Math,
51725 Number = context.Number,
51726 Object = context.Object,
51727 RegExp = context.RegExp,
51728 String = context.String,
51729 TypeError = context.TypeError;
51731 /** Used for native method references. */
51732 var arrayProto = Array.prototype,
51733 objectProto = Object.prototype,
51734 stringProto = String.prototype;
51736 /** Used to resolve the decompiled source of functions. */
51737 var fnToString = Function.prototype.toString;
51739 /** Used to check objects for own properties. */
51740 var hasOwnProperty = objectProto.hasOwnProperty;
51742 /** Used to generate unique IDs. */
51746 * Used to resolve the
51747 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
51750 var objToString = objectProto.toString;
51752 /** Used to restore the original `_` reference in `_.noConflict`. */
51753 var oldDash = root._;
51755 /** Used to detect if a method is native. */
51756 var reIsNative = RegExp('^' +
51757 fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
51758 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
51761 /** Native method references. */
51762 var ArrayBuffer = context.ArrayBuffer,
51763 clearTimeout = context.clearTimeout,
51764 parseFloat = context.parseFloat,
51766 propertyIsEnumerable = objectProto.propertyIsEnumerable,
51767 Set = getNative(context, 'Set'),
51768 setTimeout = context.setTimeout,
51769 splice = arrayProto.splice,
51770 Uint8Array = context.Uint8Array,
51771 WeakMap = getNative(context, 'WeakMap');
51774 * Native method references for those with the same name as other `lodash`
51777 var nativeCeil = Math.ceil,
51778 nativeCreate = getNative(Object, 'create'),
51779 nativeFloor = Math.floor,
51780 nativeIsArray = getNative(Array, 'isArray'),
51781 nativeIsFinite = context.isFinite,
51782 nativeKeys = getNative(Object, 'keys'),
51783 nativeMax = Math.max,
51784 nativeMin = Math.min,
51785 nativeNow = getNative(Date, 'now'),
51786 nativeParseInt = context.parseInt,
51787 nativeRandom = Math.random;
51789 /** Used as references for `-Infinity` and `Infinity`. */
51790 var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
51791 POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
51793 /** Used as references for the maximum length and index of an array. */
51794 var MAX_ARRAY_LENGTH = 4294967295,
51795 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
51796 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
51799 * Used as the [maximum
51800 * length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
51801 * of an array-like value.
51803 var MAX_SAFE_INTEGER = 9007199254740991;
51805 /** Used to store function metadata. */
51806 var metaMap = WeakMap && new WeakMap;
51808 /** Used to lookup unminified function names. */
51809 var realNames = {};
51811 /*------------------------------------------------------------------------*/
51814 * Creates a `lodash` object which wraps `value` to enable implicit
51815 * chaining. Methods that operate on and return arrays, collections, and
51816 * functions can be chained together. Methods that retrieve a single value
51817 * or may return a primitive value will automatically end the chain
51818 * returning the unwrapped value. Explicit chaining may be enabled using
51819 * `_.chain`. The execution of chained methods is lazy, that is, execution
51820 * is deferred until `_#value` is implicitly or explicitly called.
51822 * Lazy evaluation allows several methods to support shortcut fusion.
51823 * Shortcut fusion is an optimization strategy which merge iteratee calls;
51824 * this can help to avoid the creation of intermediate data structures and
51825 * greatly reduce the number of iteratee executions.
51827 * Chaining is supported in custom builds as long as the `_#value` method is
51828 * directly or indirectly included in the build.
51830 * In addition to lodash methods, wrappers have `Array` and `String`
51833 * The wrapper `Array` methods are: `concat`, `join`, `pop`, `push`,
51834 * `reverse`, `shift`, `slice`, `sort`, `splice`, and `unshift`
51836 * The wrapper `String` methods are: `replace` and `split`
51838 * The wrapper methods that support shortcut fusion are: `compact`, `drop`,
51839 * `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `first`, `initial`,
51840 * `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, `slice`, `take`,
51841 * `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, and `where`
51843 * The chainable wrapper methods are: `after`, `ary`, `assign`, `at`,
51844 * `before`, `bind`, `bindAll`, `bindKey`, `callback`, `chain`, `chunk`,
51845 * `commit`, `compact`, `concat`, `constant`, `countBy`, `create`, `curry`,
51846 * `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`,
51847 * `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, `filter`,
51848 * `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, `forEachRight`,
51849 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`,
51850 * `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
51851 * `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
51852 * `memoize`, `merge`, `method`, `methodOf`, `mixin`, `modArgs`, `negate`,
51853 * `omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`,
51854 * `plant`, `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`,
51855 * `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`, `reverse`,
51856 * `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`,
51857 * `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`,
51858 * `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
51859 * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
51860 * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`,
51863 * The wrapper methods that are **not** chainable by default are: `add`,
51864 * `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
51865 * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`,
51866 * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`,
51867 * `findWhere`, `first`, `floor`, `get`, `gt`, `gte`, `has`, `identity`,
51868 * `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, `isBoolean`,
51869 * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`
51870 * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`,
51871 * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`,
51872 * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lt`, `lte`,
51873 * `max`, `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`,
51874 * `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
51875 * `round`, `runInContext`, `shift`, `size`, `snakeCase`, `some`,
51876 * `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`, `sum`,
51877 * `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`,
51878 * `uniqueId`, `value`, and `words`
51880 * The wrapper method `sample` will return a wrapped value when `n` is
51881 * provided, otherwise an unwrapped value is returned.
51887 * value The value to wrap in a `lodash` instance.
51888 * @returns {Object} Returns the new `lodash` wrapper instance.
51891 * var wrapped = _([1, 2, 3]);
51892 * // returns an unwrapped value wrapped.reduce(function(total, n) { return
51893 * total + n; }); // => 6
51894 * // returns a wrapped value var squares = wrapped.map(function(n) {
51895 * return n * n; });
51897 * _.isArray(squares); // => false
51899 * _.isArray(squares.value()); // => true
51901 function lodash(value) {
51902 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
51903 if (value instanceof LodashWrapper) {
51906 if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
51907 return wrapperClone(value);
51910 return new LodashWrapper(value);
51914 * The function whose prototype all chaining wrappers inherit from.
51918 function baseLodash() {
51919 // No operation performed.
51923 * The base constructor for creating `lodash` wrapper objects.
51927 * value The value to wrap.
51929 * [chainAll] Enable chaining for all wrapper methods.
51931 * [actions=[]] Actions to peform to resolve the unwrapped value.
51933 function LodashWrapper(value, chainAll, actions) {
51934 this.__wrapped__ = value;
51935 this.__actions__ = actions || [];
51936 this.__chain__ = !!chainAll;
51940 * An object environment feature flags.
51946 var support = lodash.support = {};
51949 * By default, the template delimiters used by lodash are like those in
51950 * embedded Ruby (ERB). Change the following template settings to use
51951 * alternative delimiters.
51957 lodash.templateSettings = {
51960 * Used to detect `data` property values to be HTML-escaped.
51962 * @memberOf _.templateSettings
51965 'escape': reEscape,
51968 * Used to detect code to be evaluated.
51970 * @memberOf _.templateSettings
51973 'evaluate': reEvaluate,
51976 * Used to detect `data` property values to inject.
51978 * @memberOf _.templateSettings
51981 'interpolate': reInterpolate,
51984 * Used to reference the data object in the template text.
51986 * @memberOf _.templateSettings
51992 * Used to import variables into the compiled template.
51994 * @memberOf _.templateSettings
52000 * A reference to the `lodash` function.
52002 * @memberOf _.templateSettings.imports
52009 /*------------------------------------------------------------------------*/
52012 * Creates a lazy wrapper object which wraps `value` to enable lazy
52017 * value The value to wrap.
52019 function LazyWrapper(value) {
52020 this.__wrapped__ = value;
52021 this.__actions__ = [];
52023 this.__filtered__ = false;
52024 this.__iteratees__ = [];
52025 this.__takeCount__ = POSITIVE_INFINITY;
52026 this.__views__ = [];
52030 * Creates a clone of the lazy wrapper object.
52034 * @memberOf LazyWrapper
52035 * @returns {Object} Returns the cloned `LazyWrapper` object.
52037 function lazyClone() {
52038 var result = new LazyWrapper(this.__wrapped__);
52039 result.__actions__ = arrayCopy(this.__actions__);
52040 result.__dir__ = this.__dir__;
52041 result.__filtered__ = this.__filtered__;
52042 result.__iteratees__ = arrayCopy(this.__iteratees__);
52043 result.__takeCount__ = this.__takeCount__;
52044 result.__views__ = arrayCopy(this.__views__);
52049 * Reverses the direction of lazy iteration.
52053 * @memberOf LazyWrapper
52054 * @returns {Object} Returns the new reversed `LazyWrapper` object.
52056 function lazyReverse() {
52057 if (this.__filtered__) {
52058 var result = new LazyWrapper(this);
52059 result.__dir__ = -1;
52060 result.__filtered__ = true;
52062 result = this.clone();
52063 result.__dir__ *= -1;
52069 * Extracts the unwrapped value from its lazy wrapper.
52073 * @memberOf LazyWrapper
52074 * @returns {*} Returns the unwrapped value.
52076 function lazyValue() {
52077 var array = this.__wrapped__.value(),
52078 dir = this.__dir__,
52079 isArr = isArray(array),
52081 arrLength = isArr ? array.length : 0,
52082 view = getView(0, arrLength, this.__views__),
52083 start = view.start,
52085 length = end - start,
52086 index = isRight ? end : (start - 1),
52087 iteratees = this.__iteratees__,
52088 iterLength = iteratees.length,
52090 takeCount = nativeMin(length, this.__takeCount__);
52092 if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
52093 return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
52098 while (length-- && resIndex < takeCount) {
52101 var iterIndex = -1,
52102 value = array[index];
52104 while (++iterIndex < iterLength) {
52105 var data = iteratees[iterIndex],
52106 iteratee = data.iteratee,
52108 computed = iteratee(value);
52110 if (type == LAZY_MAP_FLAG) {
52112 } else if (!computed) {
52113 if (type == LAZY_FILTER_FLAG) {
52120 result[resIndex++] = value;
52125 /*------------------------------------------------------------------------*/
52128 * Creates a cache object to store key/value pairs.
52133 * @memberOf _.memoize
52135 function MapCache() {
52136 this.__data__ = {};
52140 * Removes `key` and its value from the cache.
52144 * @memberOf _.memoize.Cache
52146 * key The key of the value to remove.
52147 * @returns {boolean} Returns `true` if the entry was removed successfully,
52150 function mapDelete(key) {
52151 return this.has(key) && delete this.__data__[key];
52155 * Gets the cached value for `key`.
52159 * @memberOf _.memoize.Cache
52161 * key The key of the value to get.
52162 * @returns {*} Returns the cached value.
52164 function mapGet(key) {
52165 return key == '__proto__' ? undefined : this.__data__[key];
52169 * Checks if a cached value for `key` exists.
52173 * @memberOf _.memoize.Cache
52175 * key The key of the entry to check.
52176 * @returns {boolean} Returns `true` if an entry for `key` exists, else
52179 function mapHas(key) {
52180 return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
52184 * Sets `value` to `key` of the cache.
52188 * @memberOf _.memoize.Cache
52190 * key The key of the value to cache.
52192 * value The value to cache.
52193 * @returns {Object} Returns the cache object.
52195 function mapSet(key, value) {
52196 if (key != '__proto__') {
52197 this.__data__[key] = value;
52202 /*------------------------------------------------------------------------*/
52206 * Creates a cache object to store unique values.
52210 * [values] The values to cache.
52212 function SetCache(values) {
52213 var length = values ? values.length : 0;
52216 'hash': nativeCreate(null),
52220 this.push(values[length]);
52225 * Checks if `value` is in `cache` mimicking the return signature of
52226 * `_.indexOf` by returning `0` if the value is found, else `-1`.
52230 * cache The cache to search.
52232 * value The value to search for.
52233 * @returns {number} Returns `0` if `value` is found, else `-1`.
52235 function cacheIndexOf(cache, value) {
52236 var data = cache.data,
52237 result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
52239 return result ? 0 : -1;
52243 * Adds `value` to the cache.
52247 * @memberOf SetCache
52249 * value The value to cache.
52251 function cachePush(value) {
52252 var data = this.data;
52253 if (typeof value == 'string' || isObject(value)) {
52254 data.set.add(value);
52256 data.hash[value] = true;
52260 /*------------------------------------------------------------------------*/
52263 * Creates a new array joining `array` with `other`.
52267 * array The array to join.
52269 * other The other array to join.
52270 * @returns {Array} Returns the new concatenated array.
52272 function arrayConcat(array, other) {
52274 length = array.length,
52276 othLength = other.length,
52277 result = Array(length + othLength);
52279 while (++index < length) {
52280 result[index] = array[index];
52282 while (++othIndex < othLength) {
52283 result[index++] = other[othIndex];
52289 * Copies the values of `source` to `array`.
52293 * source The array to copy values from.
52295 * [array=[]] The array to copy values to.
52296 * @returns {Array} Returns `array`.
52298 function arrayCopy(source, array) {
52300 length = source.length;
52302 array || (array = Array(length));
52303 while (++index < length) {
52304 array[index] = source[index];
52310 * A specialized version of `_.forEach` for arrays without support for
52311 * callback shorthands and `this` binding.
52315 * array The array to iterate over.
52316 * @param {Function}
52317 * iteratee The function invoked per iteration.
52318 * @returns {Array} Returns `array`.
52320 function arrayEach(array, iteratee) {
52322 length = array.length;
52324 while (++index < length) {
52325 if (iteratee(array[index], index, array) === false) {
52333 * A specialized version of `_.forEachRight` for arrays without support for
52334 * callback shorthands and `this` binding.
52338 * array The array to iterate over.
52339 * @param {Function}
52340 * iteratee The function invoked per iteration.
52341 * @returns {Array} Returns `array`.
52343 function arrayEachRight(array, iteratee) {
52344 var length = array.length;
52347 if (iteratee(array[length], length, array) === false) {
52355 * A specialized version of `_.every` for arrays without support for
52356 * callback shorthands and `this` binding.
52360 * array The array to iterate over.
52361 * @param {Function}
52362 * predicate The function invoked per iteration.
52363 * @returns {boolean} Returns `true` if all elements pass the predicate
52364 * check, else `false`.
52366 function arrayEvery(array, predicate) {
52368 length = array.length;
52370 while (++index < length) {
52371 if (!predicate(array[index], index, array)) {
52379 * A specialized version of `baseExtremum` for arrays which invokes
52380 * `iteratee` with one argument: (value).
52384 * array The array to iterate over.
52385 * @param {Function}
52386 * iteratee The function invoked per iteration.
52387 * @param {Function}
52388 * comparator The function used to compare values.
52390 * exValue The initial extremum value.
52391 * @returns {*} Returns the extremum value.
52393 function arrayExtremum(array, iteratee, comparator, exValue) {
52395 length = array.length,
52396 computed = exValue,
52399 while (++index < length) {
52400 var value = array[index],
52401 current = +iteratee(value);
52403 if (comparator(current, computed)) {
52404 computed = current;
52412 * A specialized version of `_.filter` for arrays without support for
52413 * callback shorthands and `this` binding.
52417 * array The array to iterate over.
52418 * @param {Function}
52419 * predicate The function invoked per iteration.
52420 * @returns {Array} Returns the new filtered array.
52422 function arrayFilter(array, predicate) {
52424 length = array.length,
52428 while (++index < length) {
52429 var value = array[index];
52430 if (predicate(value, index, array)) {
52431 result[++resIndex] = value;
52438 * A specialized version of `_.map` for arrays without support for callback
52439 * shorthands and `this` binding.
52443 * array The array to iterate over.
52444 * @param {Function}
52445 * iteratee The function invoked per iteration.
52446 * @returns {Array} Returns the new mapped array.
52448 function arrayMap(array, iteratee) {
52450 length = array.length,
52451 result = Array(length);
52453 while (++index < length) {
52454 result[index] = iteratee(array[index], index, array);
52460 * Appends the elements of `values` to `array`.
52464 * array The array to modify.
52466 * values The values to append.
52467 * @returns {Array} Returns `array`.
52469 function arrayPush(array, values) {
52471 length = values.length,
52472 offset = array.length;
52474 while (++index < length) {
52475 array[offset + index] = values[index];
52481 * A specialized version of `_.reduce` for arrays without support for
52482 * callback shorthands and `this` binding.
52486 * array The array to iterate over.
52487 * @param {Function}
52488 * iteratee The function invoked per iteration.
52490 * [accumulator] The initial value.
52492 * [initFromArray] Specify using the first element of `array` as
52493 * the initial value.
52494 * @returns {*} Returns the accumulated value.
52496 function arrayReduce(array, iteratee, accumulator, initFromArray) {
52498 length = array.length;
52500 if (initFromArray && length) {
52501 accumulator = array[++index];
52503 while (++index < length) {
52504 accumulator = iteratee(accumulator, array[index], index, array);
52506 return accumulator;
52510 * A specialized version of `_.reduceRight` for arrays without support for
52511 * callback shorthands and `this` binding.
52515 * array The array to iterate over.
52516 * @param {Function}
52517 * iteratee The function invoked per iteration.
52519 * [accumulator] The initial value.
52521 * [initFromArray] Specify using the last element of `array` as
52522 * the initial value.
52523 * @returns {*} Returns the accumulated value.
52525 function arrayReduceRight(array, iteratee, accumulator, initFromArray) {
52526 var length = array.length;
52527 if (initFromArray && length) {
52528 accumulator = array[--length];
52531 accumulator = iteratee(accumulator, array[length], length, array);
52533 return accumulator;
52537 * A specialized version of `_.some` for arrays without support for callback
52538 * shorthands and `this` binding.
52542 * array The array to iterate over.
52543 * @param {Function}
52544 * predicate The function invoked per iteration.
52545 * @returns {boolean} Returns `true` if any element passes the predicate
52546 * check, else `false`.
52548 function arraySome(array, predicate) {
52550 length = array.length;
52552 while (++index < length) {
52553 if (predicate(array[index], index, array)) {
52561 * A specialized version of `_.sum` for arrays without support for callback
52562 * shorthands and `this` binding..
52566 * array The array to iterate over.
52567 * @param {Function}
52568 * iteratee The function invoked per iteration.
52569 * @returns {number} Returns the sum.
52571 function arraySum(array, iteratee) {
52572 var length = array.length,
52576 result += +iteratee(array[length]) || 0;
52582 * Used by `_.defaults` to customize its `_.assign` use.
52586 * objectValue The destination object property value.
52588 * sourceValue The source object property value.
52589 * @returns {*} Returns the value to assign to the destination object.
52591 function assignDefaults(objectValue, sourceValue) {
52592 return objectValue === undefined ? sourceValue : objectValue;
52596 * Used by `_.template` to customize its `_.assign` use.
52598 * **Note:** This function is like `assignDefaults` except that it ignores
52599 * inherited property values when checking if a property is `undefined`.
52603 * objectValue The destination object property value.
52605 * sourceValue The source object property value.
52607 * key The key associated with the object and source values.
52609 * object The destination object.
52610 * @returns {*} Returns the value to assign to the destination object.
52612 function assignOwnDefaults(objectValue, sourceValue, key, object) {
52613 return (objectValue === undefined || !hasOwnProperty.call(object, key)) ? sourceValue : objectValue;
52617 * A specialized version of `_.assign` for customizing assigned values
52618 * without support for argument juggling, multiple sources, and `this`
52619 * binding `customizer` functions.
52623 * object The destination object.
52625 * source The source object.
52626 * @param {Function}
52627 * customizer The function to customize assigned values.
52628 * @returns {Object} Returns `object`.
52630 function assignWith(object, source, customizer) {
52632 props = keys(source),
52633 length = props.length;
52635 while (++index < length) {
52636 var key = props[index],
52637 value = object[key],
52638 result = customizer(value, source[key], key, object, source);
52640 if ((result === result ? (result !== value) : (value === value)) ||
52641 (value === undefined && !(key in object))) {
52642 object[key] = result;
52649 * The base implementation of `_.assign` without support for argument
52650 * juggling, multiple sources, and `customizer` functions.
52654 * object The destination object.
52656 * source The source object.
52657 * @returns {Object} Returns `object`.
52659 function baseAssign(object, source) {
52660 return source == null ? object : baseCopy(source, keys(source), object);
52664 * The base implementation of `_.at` without support for string collections
52665 * and individual key arguments.
52668 * @param {Array|Object}
52669 * collection The collection to iterate over.
52670 * @param {number[]|string[]}
52671 * props The property names or indexes of elements to pick.
52672 * @returns {Array} Returns the new array of picked elements.
52674 function baseAt(collection, props) {
52676 isNil = collection == null,
52677 isArr = !isNil && isArrayLike(collection),
52678 length = isArr ? collection.length : 0,
52679 propsLength = props.length,
52680 result = Array(propsLength);
52682 while (++index < propsLength) {
52683 var key = props[index];
52685 result[index] = isIndex(key, length) ? collection[key] : undefined;
52687 result[index] = isNil ? undefined : collection[key];
52694 * Copies properties of `source` to `object`.
52698 * source The object to copy properties from.
52700 * props The property names to copy.
52702 * [object={}] The object to copy properties to.
52703 * @returns {Object} Returns `object`.
52705 function baseCopy(source, props, object) {
52706 object || (object = {});
52709 length = props.length;
52711 while (++index < length) {
52712 var key = props[index];
52713 object[key] = source[key];
52719 * The base implementation of `_.callback` which supports specifying the
52720 * number of arguments to provide to `func`.
52724 * [func=_.identity] The value to convert to a callback.
52726 * [thisArg] The `this` binding of `func`.
52728 * [argCount] The number of arguments to provide to `func`.
52729 * @returns {Function} Returns the callback.
52731 function baseCallback(func, thisArg, argCount) {
52732 var type = typeof func;
52733 if (type == 'function') {
52734 return thisArg === undefined ? func : bindCallback(func, thisArg, argCount);
52736 if (func == null) {
52739 if (type == 'object') {
52740 return baseMatches(func);
52742 return thisArg === undefined ? property(func) : baseMatchesProperty(func, thisArg);
52746 * The base implementation of `_.clone` without support for argument
52747 * juggling and `this` binding `customizer` functions.
52751 * value The value to clone.
52753 * [isDeep] Specify a deep clone.
52754 * @param {Function}
52755 * [customizer] The function to customize cloning values.
52757 * [key] The key of `value`.
52759 * [object] The object `value` belongs to.
52761 * [stackA=[]] Tracks traversed source objects.
52763 * [stackB=[]] Associates clones with source counterparts.
52764 * @returns {*} Returns the cloned value.
52766 function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
52769 result = object ? customizer(value, key, object) : customizer(value);
52771 if (result !== undefined) {
52774 if (!isObject(value)) {
52777 var isArr = isArray(value);
52779 result = initCloneArray(value);
52781 return arrayCopy(value, result);
52784 var tag = objToString.call(value),
52785 isFunc = tag == funcTag;
52787 if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
52788 result = initCloneObject(isFunc ? {} : value);
52790 return baseAssign(result, value);
52793 return cloneableTags[tag] ? initCloneByTag(value, tag, isDeep) : (object ? value : {});
52796 // Check for circular references and return its corresponding clone.
52797 stackA || (stackA = []);
52798 stackB || (stackB = []);
52800 var length = stackA.length;
52802 if (stackA[length] == value) {
52803 return stackB[length];
52806 // Add the source value to the stack of traversed objects and associate
52807 // it with its clone.
52808 stackA.push(value);
52809 stackB.push(result);
52811 // Recursively populate clone (susceptible to call stack limits).
52812 (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
52813 result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
52819 * The base implementation of `_.create` without support for assigning
52820 * properties to the created object.
52824 * prototype The object to inherit from.
52825 * @returns {Object} Returns the new object.
52827 var baseCreate = (function() {
52828 function object() {}
52829 return function(prototype) {
52830 if (isObject(prototype)) {
52831 object.prototype = prototype;
52832 var result = new object;
52833 object.prototype = undefined;
52835 return result || {};
52840 * The base implementation of `_.delay` and `_.defer` which accepts an index
52841 * of where to slice the arguments to provide to `func`.
52844 * @param {Function}
52845 * func The function to delay.
52847 * wait The number of milliseconds to delay invocation.
52849 * args The arguments provide to `func`.
52850 * @returns {number} Returns the timer id.
52852 function baseDelay(func, wait, args) {
52853 if (typeof func != 'function') {
52854 throw new TypeError(FUNC_ERROR_TEXT);
52856 return setTimeout(function() {
52857 func.apply(undefined, args);
52862 * The base implementation of `_.difference` which accepts a single array of
52863 * values to exclude.
52867 * array The array to inspect.
52869 * values The values to exclude.
52870 * @returns {Array} Returns the new array of filtered values.
52872 function baseDifference(array, values) {
52873 var length = array ? array.length : 0,
52880 indexOf = getIndexOf(),
52881 isCommon = indexOf == baseIndexOf,
52882 cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
52883 valuesLength = values.length;
52886 indexOf = cacheIndexOf;
52891 while (++index < length) {
52892 var value = array[index];
52894 if (isCommon && value === value) {
52895 var valuesIndex = valuesLength;
52896 while (valuesIndex--) {
52897 if (values[valuesIndex] === value) {
52901 result.push(value);
52902 } else if (indexOf(values, value, 0) < 0) {
52903 result.push(value);
52910 * The base implementation of `_.forEach` without support for callback
52911 * shorthands and `this` binding.
52914 * @param {Array|Object|string}
52915 * collection The collection to iterate over.
52916 * @param {Function}
52917 * iteratee The function invoked per iteration.
52918 * @returns {Array|Object|string} Returns `collection`.
52920 var baseEach = createBaseEach(baseForOwn);
52923 * The base implementation of `_.forEachRight` without support for callback
52924 * shorthands and `this` binding.
52927 * @param {Array|Object|string}
52928 * collection The collection to iterate over.
52929 * @param {Function}
52930 * iteratee The function invoked per iteration.
52931 * @returns {Array|Object|string} Returns `collection`.
52933 var baseEachRight = createBaseEach(baseForOwnRight, true);
52936 * The base implementation of `_.every` without support for callback
52937 * shorthands and `this` binding.
52940 * @param {Array|Object|string}
52941 * collection The collection to iterate over.
52942 * @param {Function}
52943 * predicate The function invoked per iteration.
52944 * @returns {boolean} Returns `true` if all elements pass the predicate
52945 * check, else `false`
52947 function baseEvery(collection, predicate) {
52949 baseEach(collection, function(value, index, collection) {
52950 result = !!predicate(value, index, collection);
52957 * Gets the extremum value of `collection` invoking `iteratee` for each
52958 * value in `collection` to generate the criterion by which the value is
52959 * ranked. The `iteratee` is invoked with three arguments: (value,
52960 * index|key, collection).
52963 * @param {Array|Object|string}
52964 * collection The collection to iterate over.
52965 * @param {Function}
52966 * iteratee The function invoked per iteration.
52967 * @param {Function}
52968 * comparator The function used to compare values.
52970 * exValue The initial extremum value.
52971 * @returns {*} Returns the extremum value.
52973 function baseExtremum(collection, iteratee, comparator, exValue) {
52974 var computed = exValue,
52977 baseEach(collection, function(value, index, collection) {
52978 var current = +iteratee(value, index, collection);
52979 if (comparator(current, computed) || (current === exValue && current === result)) {
52980 computed = current;
52988 * The base implementation of `_.fill` without an iteratee call guard.
52992 * array The array to fill.
52994 * value The value to fill `array` with.
52996 * [start=0] The start position.
52998 * [end=array.length] The end position.
52999 * @returns {Array} Returns `array`.
53001 function baseFill(array, value, start, end) {
53002 var length = array.length;
53004 start = start == null ? 0 : (+start || 0);
53006 start = -start > length ? 0 : (length + start);
53008 end = (end === undefined || end > length) ? length : (+end || 0);
53012 length = start > end ? 0 : (end >>> 0);
53015 while (start < length) {
53016 array[start++] = value;
53022 * The base implementation of `_.filter` without support for callback
53023 * shorthands and `this` binding.
53026 * @param {Array|Object|string}
53027 * collection The collection to iterate over.
53028 * @param {Function}
53029 * predicate The function invoked per iteration.
53030 * @returns {Array} Returns the new filtered array.
53032 function baseFilter(collection, predicate) {
53034 baseEach(collection, function(value, index, collection) {
53035 if (predicate(value, index, collection)) {
53036 result.push(value);
53043 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and
53044 * `_.findLastKey`, without support for callback shorthands and `this`
53045 * binding, which iterates over `collection` using the provided `eachFunc`.
53048 * @param {Array|Object|string}
53049 * collection The collection to search.
53050 * @param {Function}
53051 * predicate The function invoked per iteration.
53052 * @param {Function}
53053 * eachFunc The function to iterate over `collection`.
53055 * [retKey] Specify returning the key of the found element
53056 * instead of the element itself.
53057 * @returns {*} Returns the found element or its key, else `undefined`.
53059 function baseFind(collection, predicate, eachFunc, retKey) {
53061 eachFunc(collection, function(value, key, collection) {
53062 if (predicate(value, key, collection)) {
53063 result = retKey ? key : value;
53071 * The base implementation of `_.flatten` with added support for restricting
53072 * flattening and specifying the start index.
53076 * array The array to flatten.
53078 * [isDeep] Specify a deep flatten.
53080 * [isStrict] Restrict flattening to arrays-like objects.
53082 * [result=[]] The initial result value.
53083 * @returns {Array} Returns the new flattened array.
53085 function baseFlatten(array, isDeep, isStrict, result) {
53086 result || (result = []);
53089 length = array.length;
53091 while (++index < length) {
53092 var value = array[index];
53093 if (isObjectLike(value) && isArrayLike(value) &&
53094 (isStrict || isArray(value) || isArguments(value))) {
53096 // Recursively flatten arrays (susceptible to call stack limits).
53097 baseFlatten(value, isDeep, isStrict, result);
53099 arrayPush(result, value);
53101 } else if (!isStrict) {
53102 result[result.length] = value;
53109 * The base implementation of `baseForIn` and `baseForOwn` which iterates
53110 * over `object` properties returned by `keysFunc` invoking `iteratee` for
53111 * each property. Iteratee functions may exit iteration early by explicitly
53112 * returning `false`.
53116 * object The object to iterate over.
53117 * @param {Function}
53118 * iteratee The function invoked per iteration.
53119 * @param {Function}
53120 * keysFunc The function to get the keys of `object`.
53121 * @returns {Object} Returns `object`.
53123 var baseFor = createBaseFor();
53126 * This function is like `baseFor` except that it iterates over properties
53127 * in the opposite order.
53131 * object The object to iterate over.
53132 * @param {Function}
53133 * iteratee The function invoked per iteration.
53134 * @param {Function}
53135 * keysFunc The function to get the keys of `object`.
53136 * @returns {Object} Returns `object`.
53138 var baseForRight = createBaseFor(true);
53141 * The base implementation of `_.forIn` without support for callback
53142 * shorthands and `this` binding.
53146 * object The object to iterate over.
53147 * @param {Function}
53148 * iteratee The function invoked per iteration.
53149 * @returns {Object} Returns `object`.
53151 function baseForIn(object, iteratee) {
53152 return baseFor(object, iteratee, keysIn);
53156 * The base implementation of `_.forOwn` without support for callback
53157 * shorthands and `this` binding.
53161 * object The object to iterate over.
53162 * @param {Function}
53163 * iteratee The function invoked per iteration.
53164 * @returns {Object} Returns `object`.
53166 function baseForOwn(object, iteratee) {
53167 return baseFor(object, iteratee, keys);
53171 * The base implementation of `_.forOwnRight` without support for callback
53172 * shorthands and `this` binding.
53176 * object The object to iterate over.
53177 * @param {Function}
53178 * iteratee The function invoked per iteration.
53179 * @returns {Object} Returns `object`.
53181 function baseForOwnRight(object, iteratee) {
53182 return baseForRight(object, iteratee, keys);
53186 * The base implementation of `_.functions` which creates an array of
53187 * `object` function property names filtered from those provided.
53191 * object The object to inspect.
53193 * props The property names to filter.
53194 * @returns {Array} Returns the new array of filtered property names.
53196 function baseFunctions(object, props) {
53198 length = props.length,
53202 while (++index < length) {
53203 var key = props[index];
53204 if (isFunction(object[key])) {
53205 result[++resIndex] = key;
53212 * The base implementation of `get` without support for string paths and
53217 * object The object to query.
53219 * path The path of the property to get.
53221 * [pathKey] The key representation of path.
53222 * @returns {*} Returns the resolved value.
53224 function baseGet(object, path, pathKey) {
53225 if (object == null) {
53228 if (pathKey !== undefined && pathKey in toObject(object)) {
53232 length = path.length;
53234 while (object != null && index < length) {
53235 object = object[path[index++]];
53237 return (index && index == length) ? object : undefined;
53241 * The base implementation of `_.isEqual` without support for `this` binding
53242 * `customizer` functions.
53246 * value The value to compare.
53248 * other The other value to compare.
53249 * @param {Function}
53250 * [customizer] The function to customize comparing values.
53252 * [isLoose] Specify performing partial comparisons.
53254 * [stackA] Tracks traversed `value` objects.
53256 * [stackB] Tracks traversed `other` objects.
53257 * @returns {boolean} Returns `true` if the values are equivalent, else
53260 function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
53261 if (value === other) {
53264 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
53265 return value !== value && other !== other;
53267 return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
53271 * A specialized version of `baseIsEqual` for arrays and objects which
53272 * performs deep comparisons and tracks traversed objects enabling objects
53273 * with circular references to be compared.
53277 * object The object to compare.
53279 * other The other object to compare.
53280 * @param {Function}
53281 * equalFunc The function to determine equivalents of values.
53282 * @param {Function}
53283 * [customizer] The function to customize comparing objects.
53285 * [isLoose] Specify performing partial comparisons.
53287 * [stackA=[]] Tracks traversed `value` objects.
53289 * [stackB=[]] Tracks traversed `other` objects.
53290 * @returns {boolean} Returns `true` if the objects are equivalent, else
53293 function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
53294 var objIsArr = isArray(object),
53295 othIsArr = isArray(other),
53300 objTag = objToString.call(object);
53301 if (objTag == argsTag) {
53302 objTag = objectTag;
53303 } else if (objTag != objectTag) {
53304 objIsArr = isTypedArray(object);
53308 othTag = objToString.call(other);
53309 if (othTag == argsTag) {
53310 othTag = objectTag;
53311 } else if (othTag != objectTag) {
53312 othIsArr = isTypedArray(other);
53315 var objIsObj = objTag == objectTag,
53316 othIsObj = othTag == objectTag,
53317 isSameTag = objTag == othTag;
53319 if (isSameTag && !(objIsArr || objIsObj)) {
53320 return equalByTag(object, other, objTag);
53323 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
53324 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
53326 if (objIsWrapped || othIsWrapped) {
53327 return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
53333 // Assume cyclic values are equal.
53334 // For more information on detecting circular references see
53335 // https://es5.github.io/#JO.
53336 stackA || (stackA = []);
53337 stackB || (stackB = []);
53339 var length = stackA.length;
53341 if (stackA[length] == object) {
53342 return stackB[length] == other;
53345 // Add `object` and `other` to the stack of traversed objects.
53346 stackA.push(object);
53347 stackB.push(other);
53349 var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
53358 * The base implementation of `_.isMatch` without support for callback
53359 * shorthands and `this` binding.
53363 * object The object to inspect.
53365 * matchData The propery names, values, and compare flags to
53367 * @param {Function}
53368 * [customizer] The function to customize comparing objects.
53369 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
53371 function baseIsMatch(object, matchData, customizer) {
53372 var index = matchData.length,
53374 noCustomizer = !customizer;
53376 if (object == null) {
53379 object = toObject(object);
53381 var data = matchData[index];
53382 if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object)) {
53386 while (++index < length) {
53387 data = matchData[index];
53389 objValue = object[key],
53390 srcValue = data[1];
53392 if (noCustomizer && data[2]) {
53393 if (objValue === undefined && !(key in object)) {
53397 var result = customizer ? customizer(objValue, srcValue, key) : undefined;
53398 if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
53407 * The base implementation of `_.map` without support for callback
53408 * shorthands and `this` binding.
53411 * @param {Array|Object|string}
53412 * collection The collection to iterate over.
53413 * @param {Function}
53414 * iteratee The function invoked per iteration.
53415 * @returns {Array} Returns the new mapped array.
53417 function baseMap(collection, iteratee) {
53419 result = isArrayLike(collection) ? Array(collection.length) : [];
53421 baseEach(collection, function(value, key, collection) {
53422 result[++index] = iteratee(value, key, collection);
53428 * The base implementation of `_.matches` which does not clone `source`.
53432 * source The object of property values to match.
53433 * @returns {Function} Returns the new function.
53435 function baseMatches(source) {
53436 var matchData = getMatchData(source);
53437 if (matchData.length == 1 && matchData[0][2]) {
53438 var key = matchData[0][0],
53439 value = matchData[0][1];
53441 return function(object) {
53442 if (object == null) {
53445 return object[key] === value && (value !== undefined || (key in toObject(object)));
53448 return function(object) {
53449 return baseIsMatch(object, matchData);
53454 * The base implementation of `_.matchesProperty` which does not clone
53459 * path The path of the property to get.
53461 * srcValue The value to compare.
53462 * @returns {Function} Returns the new function.
53464 function baseMatchesProperty(path, srcValue) {
53465 var isArr = isArray(path),
53466 isCommon = isKey(path) && isStrictComparable(srcValue),
53467 pathKey = (path + '');
53469 path = toPath(path);
53470 return function(object) {
53471 if (object == null) {
53475 object = toObject(object);
53476 if ((isArr || !isCommon) && !(key in object)) {
53477 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
53478 if (object == null) {
53482 object = toObject(object);
53484 return object[key] === srcValue ? (srcValue !== undefined || (key in object)) : baseIsEqual(srcValue, object[key], undefined, true);
53489 * The base implementation of `_.merge` without support for argument
53490 * juggling, multiple sources, and `this` binding `customizer` functions.
53494 * object The destination object.
53496 * source The source object.
53497 * @param {Function}
53498 * [customizer] The function to customize merged values.
53500 * [stackA=[]] Tracks traversed source objects.
53502 * [stackB=[]] Associates values with source counterparts.
53503 * @returns {Object} Returns `object`.
53505 function baseMerge(object, source, customizer, stackA, stackB) {
53506 if (!isObject(object)) {
53509 var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
53510 props = isSrcArr ? undefined : keys(source);
53512 arrayEach(props || source, function(srcValue, key) {
53515 srcValue = source[key];
53517 if (isObjectLike(srcValue)) {
53518 stackA || (stackA = []);
53519 stackB || (stackB = []);
53520 baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
53522 var value = object[key],
53523 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
53524 isCommon = result === undefined;
53529 if ((result !== undefined || (isSrcArr && !(key in object))) &&
53530 (isCommon || (result === result ? (result !== value) : (value === value)))) {
53531 object[key] = result;
53539 * A specialized version of `baseMerge` for arrays and objects which
53540 * performs deep merges and tracks traversed objects enabling objects with
53541 * circular references to be merged.
53545 * object The destination object.
53547 * source The source object.
53549 * key The key of the value to merge.
53550 * @param {Function}
53551 * mergeFunc The function to merge values.
53552 * @param {Function}
53553 * [customizer] The function to customize merged values.
53555 * [stackA=[]] Tracks traversed source objects.
53557 * [stackB=[]] Associates values with source counterparts.
53558 * @returns {boolean} Returns `true` if the objects are equivalent, else
53561 function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
53562 var length = stackA.length,
53563 srcValue = source[key];
53566 if (stackA[length] == srcValue) {
53567 object[key] = stackB[length];
53571 var value = object[key],
53572 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
53573 isCommon = result === undefined;
53577 if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
53578 result = isArray(value) ? value : (isArrayLike(value) ? arrayCopy(value) : []);
53579 } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
53580 result = isArguments(value) ? toPlainObject(value) : (isPlainObject(value) ? value : {});
53585 // Add the source value to the stack of traversed objects and associate
53586 // it with its merged value.
53587 stackA.push(srcValue);
53588 stackB.push(result);
53591 // Recursively merge objects and arrays (susceptible to call stack
53593 object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
53594 } else if (result === result ? (result !== value) : (value === value)) {
53595 object[key] = result;
53600 * The base implementation of `_.property` without support for deep paths.
53604 * key The key of the property to get.
53605 * @returns {Function} Returns the new function.
53607 function baseProperty(key) {
53608 return function(object) {
53609 return object == null ? undefined : object[key];
53614 * A specialized version of `baseProperty` which supports deep paths.
53617 * @param {Array|string}
53618 * path The path of the property to get.
53619 * @returns {Function} Returns the new function.
53621 function basePropertyDeep(path) {
53622 var pathKey = (path + '');
53623 path = toPath(path);
53624 return function(object) {
53625 return baseGet(object, path, pathKey);
53630 * The base implementation of `_.pullAt` without support for individual
53631 * index arguments and capturing the removed elements.
53635 * array The array to modify.
53636 * @param {number[]}
53637 * indexes The indexes of elements to remove.
53638 * @returns {Array} Returns `array`.
53640 function basePullAt(array, indexes) {
53641 var length = array ? indexes.length : 0;
53643 var index = indexes[length];
53644 if (index != previous && isIndex(index)) {
53645 var previous = index;
53646 splice.call(array, index, 1);
53653 * The base implementation of `_.random` without support for argument
53654 * juggling and returning floating-point numbers.
53658 * min The minimum possible value.
53660 * max The maximum possible value.
53661 * @returns {number} Returns the random number.
53663 function baseRandom(min, max) {
53664 return min + nativeFloor(nativeRandom() * (max - min + 1));
53668 * The base implementation of `_.reduce` and `_.reduceRight` without support
53669 * for callback shorthands and `this` binding, which iterates over
53670 * `collection` using the provided `eachFunc`.
53673 * @param {Array|Object|string}
53674 * collection The collection to iterate over.
53675 * @param {Function}
53676 * iteratee The function invoked per iteration.
53678 * accumulator The initial value.
53680 * initFromCollection Specify using the first or last element of
53681 * `collection` as the initial value.
53682 * @param {Function}
53683 * eachFunc The function to iterate over `collection`.
53684 * @returns {*} Returns the accumulated value.
53686 function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
53687 eachFunc(collection, function(value, index, collection) {
53688 accumulator = initFromCollection ? (initFromCollection = false, value) : iteratee(accumulator, value, index, collection);
53690 return accumulator;
53694 * The base implementation of `setData` without support for hot loop
53698 * @param {Function}
53699 * func The function to associate metadata with.
53701 * data The metadata.
53702 * @returns {Function} Returns `func`.
53704 var baseSetData = !metaMap ? identity : function(func, data) {
53705 metaMap.set(func, data);
53710 * The base implementation of `_.slice` without an iteratee call guard.
53714 * array The array to slice.
53716 * [start=0] The start position.
53718 * [end=array.length] The end position.
53719 * @returns {Array} Returns the slice of `array`.
53721 function baseSlice(array, start, end) {
53723 length = array.length;
53725 start = start == null ? 0 : (+start || 0);
53727 start = -start > length ? 0 : (length + start);
53729 end = (end === undefined || end > length) ? length : (+end || 0);
53733 length = start > end ? 0 : ((end - start) >>> 0);
53736 var result = Array(length);
53737 while (++index < length) {
53738 result[index] = array[index + start];
53744 * The base implementation of `_.some` without support for callback
53745 * shorthands and `this` binding.
53748 * @param {Array|Object|string}
53749 * collection The collection to iterate over.
53750 * @param {Function}
53751 * predicate The function invoked per iteration.
53752 * @returns {boolean} Returns `true` if any element passes the predicate
53753 * check, else `false`.
53755 function baseSome(collection, predicate) {
53758 baseEach(collection, function(value, index, collection) {
53759 result = predicate(value, index, collection);
53766 * The base implementation of `_.sortBy` which uses `comparer` to define the
53767 * sort order of `array` and replaces criteria objects with their
53768 * corresponding values.
53772 * array The array to sort.
53773 * @param {Function}
53774 * comparer The function to define sort order.
53775 * @returns {Array} Returns `array`.
53777 function baseSortBy(array, comparer) {
53778 var length = array.length;
53780 array.sort(comparer);
53782 array[length] = array[length].value;
53788 * The base implementation of `_.sortByOrder` without param guards.
53791 * @param {Array|Object|string}
53792 * collection The collection to iterate over.
53793 * @param {Function[]|Object[]|string[]}
53794 * iteratees The iteratees to sort by.
53795 * @param {boolean[]}
53796 * orders The sort orders of `iteratees`.
53797 * @returns {Array} Returns the new sorted array.
53799 function baseSortByOrder(collection, iteratees, orders) {
53800 var callback = getCallback(),
53803 iteratees = arrayMap(iteratees, function(iteratee) {
53804 return callback(iteratee);
53807 var result = baseMap(collection, function(value) {
53808 var criteria = arrayMap(iteratees, function(iteratee) {
53809 return iteratee(value);
53812 'criteria': criteria,
53818 return baseSortBy(result, function(object, other) {
53819 return compareMultiple(object, other, orders);
53824 * The base implementation of `_.sum` without support for callback
53825 * shorthands and `this` binding.
53828 * @param {Array|Object|string}
53829 * collection The collection to iterate over.
53830 * @param {Function}
53831 * iteratee The function invoked per iteration.
53832 * @returns {number} Returns the sum.
53834 function baseSum(collection, iteratee) {
53836 baseEach(collection, function(value, index, collection) {
53837 result += +iteratee(value, index, collection) || 0;
53843 * The base implementation of `_.uniq` without support for callback
53844 * shorthands and `this` binding.
53848 * array The array to inspect.
53849 * @param {Function}
53850 * [iteratee] The function invoked per iteration.
53851 * @returns {Array} Returns the new duplicate-value-free array.
53853 function baseUniq(array, iteratee) {
53855 indexOf = getIndexOf(),
53856 length = array.length,
53857 isCommon = indexOf == baseIndexOf,
53858 isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
53859 seen = isLarge ? createCache() : null,
53863 indexOf = cacheIndexOf;
53867 seen = iteratee ? [] : result;
53870 while (++index < length) {
53871 var value = array[index],
53872 computed = iteratee ? iteratee(value, index, array) : value;
53874 if (isCommon && value === value) {
53875 var seenIndex = seen.length;
53876 while (seenIndex--) {
53877 if (seen[seenIndex] === computed) {
53882 seen.push(computed);
53884 result.push(value);
53885 } else if (indexOf(seen, computed, 0) < 0) {
53886 if (iteratee || isLarge) {
53887 seen.push(computed);
53889 result.push(value);
53896 * The base implementation of `_.values` and `_.valuesIn` which creates an
53897 * array of `object` property values corresponding to the property names of
53902 * object The object to query.
53904 * props The property names to get values for.
53905 * @returns {Object} Returns the array of property values.
53907 function baseValues(object, props) {
53909 length = props.length,
53910 result = Array(length);
53912 while (++index < length) {
53913 result[index] = object[props[index]];
53919 * The base implementation of `_.dropRightWhile`, `_.dropWhile`,
53920 * `_.takeRightWhile`, and `_.takeWhile` without support for callback
53921 * shorthands and `this` binding.
53925 * array The array to query.
53926 * @param {Function}
53927 * predicate The function invoked per iteration.
53929 * [isDrop] Specify dropping elements instead of taking them.
53931 * [fromRight] Specify iterating from right to left.
53932 * @returns {Array} Returns the slice of `array`.
53934 function baseWhile(array, predicate, isDrop, fromRight) {
53935 var length = array.length,
53936 index = fromRight ? length : -1;
53938 while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
53939 return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
53943 * The base implementation of `wrapperValue` which returns the result of
53944 * performing a sequence of actions on the unwrapped `value`, where each
53945 * successive action is supplied the return value of the previous.
53949 * value The unwrapped value.
53951 * actions Actions to peform to resolve the unwrapped value.
53952 * @returns {*} Returns the resolved value.
53954 function baseWrapperValue(value, actions) {
53955 var result = value;
53956 if (result instanceof LazyWrapper) {
53957 result = result.value();
53960 length = actions.length;
53962 while (++index < length) {
53963 var action = actions[index];
53964 result = action.func.apply(action.thisArg, arrayPush([result], action.args));
53970 * Performs a binary search of `array` to determine the index at which
53971 * `value` should be inserted into `array` in order to maintain its sort
53976 * array The sorted array to inspect.
53978 * value The value to evaluate.
53980 * [retHighest] Specify returning the highest qualified index.
53981 * @returns {number} Returns the index at which `value` should be inserted
53984 function binaryIndex(array, value, retHighest) {
53986 high = array ? array.length : low;
53988 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
53989 while (low < high) {
53990 var mid = (low + high) >>> 1,
53991 computed = array[mid];
53993 if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
54001 return binaryIndexBy(array, value, identity, retHighest);
54005 * This function is like `binaryIndex` except that it invokes `iteratee` for
54006 * `value` and each element of `array` to compute their sort ranking. The
54007 * iteratee is invoked with one argument; (value).
54011 * array The sorted array to inspect.
54013 * value The value to evaluate.
54014 * @param {Function}
54015 * iteratee The function invoked per iteration.
54017 * [retHighest] Specify returning the highest qualified index.
54018 * @returns {number} Returns the index at which `value` should be inserted
54021 function binaryIndexBy(array, value, iteratee, retHighest) {
54022 value = iteratee(value);
54025 high = array ? array.length : 0,
54026 valIsNaN = value !== value,
54027 valIsNull = value === null,
54028 valIsUndef = value === undefined;
54030 while (low < high) {
54031 var mid = nativeFloor((low + high) / 2),
54032 computed = iteratee(array[mid]),
54033 isDef = computed !== undefined,
54034 isReflexive = computed === computed;
54037 var setLow = isReflexive || retHighest;
54038 } else if (valIsNull) {
54039 setLow = isReflexive && isDef && (retHighest || computed != null);
54040 } else if (valIsUndef) {
54041 setLow = isReflexive && (retHighest || isDef);
54042 } else if (computed == null) {
54045 setLow = retHighest ? (computed <= value) : (computed < value);
54053 return nativeMin(high, MAX_ARRAY_INDEX);
54057 * A specialized version of `baseCallback` which only supports `this`
54058 * binding and specifying the number of arguments to provide to `func`.
54061 * @param {Function}
54062 * func The function to bind.
54064 * thisArg The `this` binding of `func`.
54066 * [argCount] The number of arguments to provide to `func`.
54067 * @returns {Function} Returns the callback.
54069 function bindCallback(func, thisArg, argCount) {
54070 if (typeof func != 'function') {
54073 if (thisArg === undefined) {
54076 switch (argCount) {
54078 return function(value) {
54079 return func.call(thisArg, value);
54082 return function(value, index, collection) {
54083 return func.call(thisArg, value, index, collection);
54086 return function(accumulator, value, index, collection) {
54087 return func.call(thisArg, accumulator, value, index, collection);
54090 return function(value, other, key, object, source) {
54091 return func.call(thisArg, value, other, key, object, source);
54094 return function() {
54095 return func.apply(thisArg, arguments);
54100 * Creates a clone of the given array buffer.
54103 * @param {ArrayBuffer}
54104 * buffer The array buffer to clone.
54105 * @returns {ArrayBuffer} Returns the cloned array buffer.
54107 function bufferClone(buffer) {
54108 var result = new ArrayBuffer(buffer.byteLength),
54109 view = new Uint8Array(result);
54111 view.set(new Uint8Array(buffer));
54116 * Creates an array that is the composition of partially applied arguments,
54117 * placeholders, and provided arguments into a single array of arguments.
54120 * @param {Array|Object}
54121 * args The provided arguments.
54123 * partials The arguments to prepend to those provided.
54125 * holders The `partials` placeholder indexes.
54126 * @returns {Array} Returns the new array of composed arguments.
54128 function composeArgs(args, partials, holders) {
54129 var holdersLength = holders.length,
54131 argsLength = nativeMax(args.length - holdersLength, 0),
54133 leftLength = partials.length,
54134 result = Array(leftLength + argsLength);
54136 while (++leftIndex < leftLength) {
54137 result[leftIndex] = partials[leftIndex];
54139 while (++argsIndex < holdersLength) {
54140 result[holders[argsIndex]] = args[argsIndex];
54142 while (argsLength--) {
54143 result[leftIndex++] = args[argsIndex++];
54149 * This function is like `composeArgs` except that the arguments composition
54150 * is tailored for `_.partialRight`.
54153 * @param {Array|Object}
54154 * args The provided arguments.
54156 * partials The arguments to append to those provided.
54158 * holders The `partials` placeholder indexes.
54159 * @returns {Array} Returns the new array of composed arguments.
54161 function composeArgsRight(args, partials, holders) {
54162 var holdersIndex = -1,
54163 holdersLength = holders.length,
54165 argsLength = nativeMax(args.length - holdersLength, 0),
54167 rightLength = partials.length,
54168 result = Array(argsLength + rightLength);
54170 while (++argsIndex < argsLength) {
54171 result[argsIndex] = args[argsIndex];
54173 var offset = argsIndex;
54174 while (++rightIndex < rightLength) {
54175 result[offset + rightIndex] = partials[rightIndex];
54177 while (++holdersIndex < holdersLength) {
54178 result[offset + holders[holdersIndex]] = args[argsIndex++];
54184 * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition`
54188 * @param {Function}
54189 * setter The function to set keys and values of the accumulator
54191 * @param {Function}
54192 * [initializer] The function to initialize the accumulator
54194 * @returns {Function} Returns the new aggregator function.
54196 function createAggregator(setter, initializer) {
54197 return function(collection, iteratee, thisArg) {
54198 var result = initializer ? initializer() : {};
54199 iteratee = getCallback(iteratee, thisArg, 3);
54201 if (isArray(collection)) {
54203 length = collection.length;
54205 while (++index < length) {
54206 var value = collection[index];
54207 setter(result, value, iteratee(value, index, collection), collection);
54210 baseEach(collection, function(value, key, collection) {
54211 setter(result, value, iteratee(value, key, collection), collection);
54219 * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
54222 * @param {Function}
54223 * assigner The function to assign values.
54224 * @returns {Function} Returns the new assigner function.
54226 function createAssigner(assigner) {
54227 return restParam(function(object, sources) {
54229 length = object == null ? 0 : sources.length,
54230 customizer = length > 2 ? sources[length - 2] : undefined,
54231 guard = length > 2 ? sources[2] : undefined,
54232 thisArg = length > 1 ? sources[length - 1] : undefined;
54234 if (typeof customizer == 'function') {
54235 customizer = bindCallback(customizer, thisArg, 5);
54238 customizer = typeof thisArg == 'function' ? thisArg : undefined;
54239 length -= (customizer ? 1 : 0);
54241 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
54242 customizer = length < 3 ? undefined : customizer;
54245 while (++index < length) {
54246 var source = sources[index];
54248 assigner(object, source, customizer);
54256 * Creates a `baseEach` or `baseEachRight` function.
54259 * @param {Function}
54260 * eachFunc The function to iterate over a collection.
54262 * [fromRight] Specify iterating from right to left.
54263 * @returns {Function} Returns the new base function.
54265 function createBaseEach(eachFunc, fromRight) {
54266 return function(collection, iteratee) {
54267 var length = collection ? getLength(collection) : 0;
54268 if (!isLength(length)) {
54269 return eachFunc(collection, iteratee);
54271 var index = fromRight ? length : -1,
54272 iterable = toObject(collection);
54274 while ((fromRight ? index-- : ++index < length)) {
54275 if (iteratee(iterable[index], index, iterable) === false) {
54284 * Creates a base function for `_.forIn` or `_.forInRight`.
54288 * [fromRight] Specify iterating from right to left.
54289 * @returns {Function} Returns the new base function.
54291 function createBaseFor(fromRight) {
54292 return function(object, iteratee, keysFunc) {
54293 var iterable = toObject(object),
54294 props = keysFunc(object),
54295 length = props.length,
54296 index = fromRight ? length : -1;
54298 while ((fromRight ? index-- : ++index < length)) {
54299 var key = props[index];
54300 if (iteratee(iterable[key], key, iterable) === false) {
54309 * Creates a function that wraps `func` and invokes it with the `this`
54310 * binding of `thisArg`.
54313 * @param {Function}
54314 * func The function to bind.
54316 * [thisArg] The `this` binding of `func`.
54317 * @returns {Function} Returns the new bound function.
54319 function createBindWrapper(func, thisArg) {
54320 var Ctor = createCtorWrapper(func);
54322 function wrapper() {
54323 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
54324 return fn.apply(thisArg, arguments);
54330 * Creates a `Set` cache object to optimize linear searches of large arrays.
54334 * [values] The values to cache.
54335 * @returns {null|Object} Returns the new cache object if `Set` is
54336 * supported, else `null`.
54338 function createCache(values) {
54339 return (nativeCreate && Set) ? new SetCache(values) : null;
54343 * Creates a function that produces compound words out of the words in a
54347 * @param {Function}
54348 * callback The function to combine each word.
54349 * @returns {Function} Returns the new compounder function.
54351 function createCompounder(callback) {
54352 return function(string) {
54354 array = words(deburr(string)),
54355 length = array.length,
54358 while (++index < length) {
54359 result = callback(result, array[index], index);
54366 * Creates a function that produces an instance of `Ctor` regardless of
54367 * whether it was invoked as part of a `new` expression or by `call` or
54371 * @param {Function}
54372 * Ctor The constructor to wrap.
54373 * @returns {Function} Returns the new wrapped function.
54375 function createCtorWrapper(Ctor) {
54376 return function() {
54377 // Use a `switch` statement to work with class constructors.
54379 // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
54380 // for more details.
54381 var args = arguments;
54382 switch (args.length) {
54386 return new Ctor(args[0]);
54388 return new Ctor(args[0], args[1]);
54390 return new Ctor(args[0], args[1], args[2]);
54392 return new Ctor(args[0], args[1], args[2], args[3]);
54394 return new Ctor(args[0], args[1], args[2], args[3], args[4]);
54396 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
54398 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
54400 var thisBinding = baseCreate(Ctor.prototype),
54401 result = Ctor.apply(thisBinding, args);
54403 // Mimic the constructor's `return` behavior.
54404 // See https://es5.github.io/#x13.2.2 for more details.
54405 return isObject(result) ? result : thisBinding;
54410 * Creates a `_.curry` or `_.curryRight` function.
54414 * flag The curry bit flag.
54415 * @returns {Function} Returns the new curry function.
54417 function createCurry(flag) {
54418 function curryFunc(func, arity, guard) {
54419 if (guard && isIterateeCall(func, arity, guard)) {
54422 var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);
54423 result.placeholder = curryFunc.placeholder;
54430 * Creates a `_.defaults` or `_.defaultsDeep` function.
54433 * @param {Function}
54434 * assigner The function to assign values.
54435 * @param {Function}
54436 * customizer The function to customize assigned values.
54437 * @returns {Function} Returns the new defaults function.
54439 function createDefaults(assigner, customizer) {
54440 return restParam(function(args) {
54441 var object = args[0];
54442 if (object == null) {
54445 args.push(customizer);
54446 return assigner.apply(undefined, args);
54451 * Creates a `_.max` or `_.min` function.
54454 * @param {Function}
54455 * comparator The function used to compare values.
54457 * exValue The initial extremum value.
54458 * @returns {Function} Returns the new extremum function.
54460 function createExtremum(comparator, exValue) {
54461 return function(collection, iteratee, thisArg) {
54462 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
54463 iteratee = undefined;
54465 iteratee = getCallback(iteratee, thisArg, 3);
54466 if (iteratee.length == 1) {
54467 collection = isArray(collection) ? collection : toIterable(collection);
54468 var result = arrayExtremum(collection, iteratee, comparator, exValue);
54469 if (!(collection.length && result === exValue)) {
54473 return baseExtremum(collection, iteratee, comparator, exValue);
54478 * Creates a `_.find` or `_.findLast` function.
54481 * @param {Function}
54482 * eachFunc The function to iterate over a collection.
54484 * [fromRight] Specify iterating from right to left.
54485 * @returns {Function} Returns the new find function.
54487 function createFind(eachFunc, fromRight) {
54488 return function(collection, predicate, thisArg) {
54489 predicate = getCallback(predicate, thisArg, 3);
54490 if (isArray(collection)) {
54491 var index = baseFindIndex(collection, predicate, fromRight);
54492 return index > -1 ? collection[index] : undefined;
54494 return baseFind(collection, predicate, eachFunc);
54499 * Creates a `_.findIndex` or `_.findLastIndex` function.
54503 * [fromRight] Specify iterating from right to left.
54504 * @returns {Function} Returns the new find function.
54506 function createFindIndex(fromRight) {
54507 return function(array, predicate, thisArg) {
54508 if (!(array && array.length)) {
54511 predicate = getCallback(predicate, thisArg, 3);
54512 return baseFindIndex(array, predicate, fromRight);
54517 * Creates a `_.findKey` or `_.findLastKey` function.
54520 * @param {Function}
54521 * objectFunc The function to iterate over an object.
54522 * @returns {Function} Returns the new find function.
54524 function createFindKey(objectFunc) {
54525 return function(object, predicate, thisArg) {
54526 predicate = getCallback(predicate, thisArg, 3);
54527 return baseFind(object, predicate, objectFunc, true);
54532 * Creates a `_.flow` or `_.flowRight` function.
54536 * [fromRight] Specify iterating from right to left.
54537 * @returns {Function} Returns the new flow function.
54539 function createFlow(fromRight) {
54540 return function() {
54542 length = arguments.length,
54543 index = fromRight ? length : -1,
54545 funcs = Array(length);
54547 while ((fromRight ? index-- : ++index < length)) {
54548 var func = funcs[leftIndex++] = arguments[index];
54549 if (typeof func != 'function') {
54550 throw new TypeError(FUNC_ERROR_TEXT);
54552 if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
54553 wrapper = new LodashWrapper([], true);
54556 index = wrapper ? -1 : length;
54557 while (++index < length) {
54558 func = funcs[index];
54560 var funcName = getFuncName(func),
54561 data = funcName == 'wrapper' ? getData(func) : undefined;
54563 if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
54564 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
54566 wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
54569 return function() {
54570 var args = arguments,
54573 if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
54574 return wrapper.plant(value).value();
54577 result = length ? funcs[index].apply(this, args) : value;
54579 while (++index < length) {
54580 result = funcs[index].call(this, result);
54588 * Creates a function for `_.forEach` or `_.forEachRight`.
54591 * @param {Function}
54592 * arrayFunc The function to iterate over an array.
54593 * @param {Function}
54594 * eachFunc The function to iterate over a collection.
54595 * @returns {Function} Returns the new each function.
54597 function createForEach(arrayFunc, eachFunc) {
54598 return function(collection, iteratee, thisArg) {
54599 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee) : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
54604 * Creates a function for `_.forIn` or `_.forInRight`.
54607 * @param {Function}
54608 * objectFunc The function to iterate over an object.
54609 * @returns {Function} Returns the new each function.
54611 function createForIn(objectFunc) {
54612 return function(object, iteratee, thisArg) {
54613 if (typeof iteratee != 'function' || thisArg !== undefined) {
54614 iteratee = bindCallback(iteratee, thisArg, 3);
54616 return objectFunc(object, iteratee, keysIn);
54621 * Creates a function for `_.forOwn` or `_.forOwnRight`.
54624 * @param {Function}
54625 * objectFunc The function to iterate over an object.
54626 * @returns {Function} Returns the new each function.
54628 function createForOwn(objectFunc) {
54629 return function(object, iteratee, thisArg) {
54630 if (typeof iteratee != 'function' || thisArg !== undefined) {
54631 iteratee = bindCallback(iteratee, thisArg, 3);
54633 return objectFunc(object, iteratee);
54638 * Creates a function for `_.mapKeys` or `_.mapValues`.
54642 * [isMapKeys] Specify mapping keys instead of values.
54643 * @returns {Function} Returns the new map function.
54645 function createObjectMapper(isMapKeys) {
54646 return function(object, iteratee, thisArg) {
54648 iteratee = getCallback(iteratee, thisArg, 3);
54650 baseForOwn(object, function(value, key, object) {
54651 var mapped = iteratee(value, key, object);
54652 key = isMapKeys ? mapped : key;
54653 value = isMapKeys ? value : mapped;
54654 result[key] = value;
54661 * Creates a function for `_.padLeft` or `_.padRight`.
54665 * [fromRight] Specify padding from the right.
54666 * @returns {Function} Returns the new pad function.
54668 function createPadDir(fromRight) {
54669 return function(string, length, chars) {
54670 string = baseToString(string);
54671 return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
54676 * Creates a `_.partial` or `_.partialRight` function.
54680 * flag The partial bit flag.
54681 * @returns {Function} Returns the new partial function.
54683 function createPartial(flag) {
54684 var partialFunc = restParam(function(func, partials) {
54685 var holders = replaceHolders(partials, partialFunc.placeholder);
54686 return createWrapper(func, flag, undefined, partials, holders);
54688 return partialFunc;
54692 * Creates a function for `_.reduce` or `_.reduceRight`.
54695 * @param {Function}
54696 * arrayFunc The function to iterate over an array.
54697 * @param {Function}
54698 * eachFunc The function to iterate over a collection.
54699 * @returns {Function} Returns the new each function.
54701 function createReduce(arrayFunc, eachFunc) {
54702 return function(collection, iteratee, accumulator, thisArg) {
54703 var initFromArray = arguments.length < 3;
54704 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee, accumulator, initFromArray) : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
54709 * Creates a function that wraps `func` and invokes it with optional `this`
54710 * binding of, partial application, and currying.
54713 * @param {Function|string}
54714 * func The function or method name to reference.
54716 * bitmask The bitmask of flags. See `createWrapper` for more
54719 * [thisArg] The `this` binding of `func`.
54721 * [partials] The arguments to prepend to those provided to the
54724 * [holders] The `partials` placeholder indexes.
54726 * [partialsRight] The arguments to append to those provided to
54727 * the new function.
54729 * [holdersRight] The `partialsRight` placeholder indexes.
54731 * [argPos] The argument positions of the new function.
54733 * [ary] The arity cap of `func`.
54735 * [arity] The arity of `func`.
54736 * @returns {Function} Returns the new wrapped function.
54738 function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
54739 var isAry = bitmask & ARY_FLAG,
54740 isBind = bitmask & BIND_FLAG,
54741 isBindKey = bitmask & BIND_KEY_FLAG,
54742 isCurry = bitmask & CURRY_FLAG,
54743 isCurryBound = bitmask & CURRY_BOUND_FLAG,
54744 isCurryRight = bitmask & CURRY_RIGHT_FLAG,
54745 Ctor = isBindKey ? undefined : createCtorWrapper(func);
54747 function wrapper() {
54748 // Avoid `arguments` object use disqualifying optimizations by
54749 // converting it to an array before providing it to other functions.
54750 var length = arguments.length,
54752 args = Array(length);
54755 args[index] = arguments[index];
54758 args = composeArgs(args, partials, holders);
54760 if (partialsRight) {
54761 args = composeArgsRight(args, partialsRight, holdersRight);
54763 if (isCurry || isCurryRight) {
54764 var placeholder = wrapper.placeholder,
54765 argsHolders = replaceHolders(args, placeholder);
54767 length -= argsHolders.length;
54768 if (length < arity) {
54769 var newArgPos = argPos ? arrayCopy(argPos) : undefined,
54770 newArity = nativeMax(arity - length, 0),
54771 newsHolders = isCurry ? argsHolders : undefined,
54772 newHoldersRight = isCurry ? undefined : argsHolders,
54773 newPartials = isCurry ? args : undefined,
54774 newPartialsRight = isCurry ? undefined : args;
54776 bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
54777 bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
54779 if (!isCurryBound) {
54780 bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
54782 var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
54783 result = createHybridWrapper.apply(undefined, newData);
54785 if (isLaziable(func)) {
54786 setData(result, newData);
54788 result.placeholder = placeholder;
54792 var thisBinding = isBind ? thisArg : this,
54793 fn = isBindKey ? thisBinding[func] : func;
54796 args = reorder(args, argPos);
54798 if (isAry && ary < args.length) {
54801 if (this && this !== root && this instanceof wrapper) {
54802 fn = Ctor || createCtorWrapper(func);
54804 return fn.apply(thisBinding, args);
54810 * Creates the padding required for `string` based on the given `length`.
54811 * The `chars` string is truncated if the number of characters exceeds
54816 * string The string to create padding for.
54818 * [length=0] The padding length.
54820 * [chars=' '] The string used as padding.
54821 * @returns {string} Returns the pad for `string`.
54823 function createPadding(string, length, chars) {
54824 var strLength = string.length;
54827 if (strLength >= length || !nativeIsFinite(length)) {
54830 var padLength = length - strLength;
54831 chars = chars == null ? ' ' : (chars + '');
54832 return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);
54836 * Creates a function that wraps `func` and invokes it with the optional
54837 * `this` binding of `thisArg` and the `partials` prepended to those
54838 * provided to the wrapper.
54841 * @param {Function}
54842 * func The function to partially apply arguments to.
54844 * bitmask The bitmask of flags. See `createWrapper` for more
54847 * thisArg The `this` binding of `func`.
54849 * partials The arguments to prepend to those provided to the new
54851 * @returns {Function} Returns the new bound function.
54853 function createPartialWrapper(func, bitmask, thisArg, partials) {
54854 var isBind = bitmask & BIND_FLAG,
54855 Ctor = createCtorWrapper(func);
54857 function wrapper() {
54858 // Avoid `arguments` object use disqualifying optimizations by
54859 // converting it to an array before providing it `func`.
54860 var argsIndex = -1,
54861 argsLength = arguments.length,
54863 leftLength = partials.length,
54864 args = Array(leftLength + argsLength);
54866 while (++leftIndex < leftLength) {
54867 args[leftIndex] = partials[leftIndex];
54869 while (argsLength--) {
54870 args[leftIndex++] = arguments[++argsIndex];
54872 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
54873 return fn.apply(isBind ? thisArg : this, args);
54879 * Creates a `_.ceil`, `_.floor`, or `_.round` function.
54883 * methodName The name of the `Math` method to use when rounding.
54884 * @returns {Function} Returns the new round function.
54886 function createRound(methodName) {
54887 var func = Math[methodName];
54888 return function(number, precision) {
54889 precision = precision === undefined ? 0 : (+precision || 0);
54891 precision = pow(10, precision);
54892 return func(number * precision) / precision;
54894 return func(number);
54899 * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
54903 * [retHighest] Specify returning the highest qualified index.
54904 * @returns {Function} Returns the new index function.
54906 function createSortedIndex(retHighest) {
54907 return function(array, value, iteratee, thisArg) {
54908 var callback = getCallback(iteratee);
54909 return (iteratee == null && callback === baseCallback) ? binaryIndex(array, value, retHighest) : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);
54914 * Creates a function that either curries or invokes `func` with optional
54915 * `this` binding and partially applied arguments.
54918 * @param {Function|string}
54919 * func The function or method name to reference.
54921 * bitmask The bitmask of flags. The bitmask may be composed of
54922 * the following flags: 1 - `_.bind` 2 - `_.bindKey` 4 -
54923 * `_.curry` or `_.curryRight` of a bound function 8 - `_.curry`
54924 * 16 - `_.curryRight` 32 - `_.partial` 64 - `_.partialRight` 128 -
54925 * `_.rearg` 256 - `_.ary`
54927 * [thisArg] The `this` binding of `func`.
54929 * [partials] The arguments to be partially applied.
54931 * [holders] The `partials` placeholder indexes.
54933 * [argPos] The argument positions of the new function.
54935 * [ary] The arity cap of `func`.
54937 * [arity] The arity of `func`.
54938 * @returns {Function} Returns the new wrapped function.
54940 function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
54941 var isBindKey = bitmask & BIND_KEY_FLAG;
54942 if (!isBindKey && typeof func != 'function') {
54943 throw new TypeError(FUNC_ERROR_TEXT);
54945 var length = partials ? partials.length : 0;
54947 bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
54948 partials = holders = undefined;
54950 length -= (holders ? holders.length : 0);
54951 if (bitmask & PARTIAL_RIGHT_FLAG) {
54952 var partialsRight = partials,
54953 holdersRight = holders;
54955 partials = holders = undefined;
54957 var data = isBindKey ? undefined : getData(func),
54958 newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
54961 mergeData(newData, data);
54962 bitmask = newData[1];
54963 arity = newData[9];
54965 newData[9] = arity == null ? (isBindKey ? 0 : func.length) : (nativeMax(arity - length, 0) || 0);
54967 if (bitmask == BIND_FLAG) {
54968 var result = createBindWrapper(newData[0], newData[2]);
54969 } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
54970 result = createPartialWrapper.apply(undefined, newData);
54972 result = createHybridWrapper.apply(undefined, newData);
54974 var setter = data ? baseSetData : setData;
54975 return setter(result, newData);
54979 * A specialized version of `baseIsEqualDeep` for arrays with support for
54980 * partial deep comparisons.
54984 * array The array to compare.
54986 * other The other array to compare.
54987 * @param {Function}
54988 * equalFunc The function to determine equivalents of values.
54989 * @param {Function}
54990 * [customizer] The function to customize comparing arrays.
54992 * [isLoose] Specify performing partial comparisons.
54994 * [stackA] Tracks traversed `value` objects.
54996 * [stackB] Tracks traversed `other` objects.
54997 * @returns {boolean} Returns `true` if the arrays are equivalent, else
55000 function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
55002 arrLength = array.length,
55003 othLength = other.length;
55005 if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
55008 // Ignore non-index properties.
55009 while (++index < arrLength) {
55010 var arrValue = array[index],
55011 othValue = other[index],
55012 result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
55014 if (result !== undefined) {
55020 // Recursively compare arrays (susceptible to call stack limits).
55022 if (!arraySome(other, function(othValue) {
55023 return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
55027 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
55035 * A specialized version of `baseIsEqualDeep` for comparing objects of the
55036 * same `toStringTag`.
55038 * **Note:** This function only supports comparing values with tags of
55039 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
55043 * object The object to compare.
55045 * other The other object to compare.
55047 * tag The `toStringTag` of the objects to compare.
55048 * @returns {boolean} Returns `true` if the objects are equivalent, else
55051 function equalByTag(object, other, tag) {
55055 // Coerce dates and booleans to numbers, dates to milliseconds and
55057 // to `1` or `0` treating invalid dates coerced to `NaN` as not
55059 return +object == +other;
55062 return object.name == other.name && object.message == other.message;
55065 // Treat `NaN` vs. `NaN` as equal.
55066 return (object != +object) ? other != +other : object == +other;
55070 // Coerce regexes to strings and treat strings primitives and string
55071 // objects as equal. See https://es5.github.io/#x15.10.6.4 for more
55073 return object == (other + '');
55079 * A specialized version of `baseIsEqualDeep` for objects with support for
55080 * partial deep comparisons.
55084 * object The object to compare.
55086 * other The other object to compare.
55087 * @param {Function}
55088 * equalFunc The function to determine equivalents of values.
55089 * @param {Function}
55090 * [customizer] The function to customize comparing values.
55092 * [isLoose] Specify performing partial comparisons.
55094 * [stackA] Tracks traversed `value` objects.
55096 * [stackB] Tracks traversed `other` objects.
55097 * @returns {boolean} Returns `true` if the objects are equivalent, else
55100 function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
55101 var objProps = keys(object),
55102 objLength = objProps.length,
55103 othProps = keys(other),
55104 othLength = othProps.length;
55106 if (objLength != othLength && !isLoose) {
55109 var index = objLength;
55111 var key = objProps[index];
55112 if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
55116 var skipCtor = isLoose;
55117 while (++index < objLength) {
55118 key = objProps[index];
55119 var objValue = object[key],
55120 othValue = other[key],
55121 result = customizer ? customizer(isLoose ? othValue : objValue, isLoose ? objValue : othValue, key) : undefined;
55123 // Recursively compare objects (susceptible to call stack limits).
55124 if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
55127 skipCtor || (skipCtor = key == 'constructor');
55130 var objCtor = object.constructor,
55131 othCtor = other.constructor;
55133 // Non `Object` object instances with different constructors are not
55135 if (objCtor != othCtor &&
55136 ('constructor' in object && 'constructor' in other) &&
55137 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
55138 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
55146 * Gets the appropriate "callback" function. If the `_.callback` method is
55147 * customized this function returns the custom method, otherwise it returns
55148 * the `baseCallback` function. If arguments are provided the chosen
55149 * function is invoked with them and its result is returned.
55152 * @returns {Function} Returns the chosen function or its result.
55154 function getCallback(func, thisArg, argCount) {
55155 var result = lodash.callback || callback;
55156 result = result === callback ? baseCallback : result;
55157 return argCount ? result(func, thisArg, argCount) : result;
55161 * Gets metadata for `func`.
55164 * @param {Function}
55165 * func The function to query.
55166 * @returns {*} Returns the metadata for `func`.
55168 var getData = !metaMap ? noop : function(func) {
55169 return metaMap.get(func);
55173 * Gets the name of `func`.
55176 * @param {Function}
55177 * func The function to query.
55178 * @returns {string} Returns the function name.
55180 function getFuncName(func) {
55181 var result = func.name,
55182 array = realNames[result],
55183 length = array ? array.length : 0;
55186 var data = array[length],
55187 otherFunc = data.func;
55188 if (otherFunc == null || otherFunc == func) {
55196 * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
55197 * customized this function returns the custom method, otherwise it returns
55198 * the `baseIndexOf` function. If arguments are provided the chosen function
55199 * is invoked with them and its result is returned.
55202 * @returns {Function|number} Returns the chosen function or its result.
55204 function getIndexOf(collection, target, fromIndex) {
55205 var result = lodash.indexOf || indexOf;
55206 result = result === indexOf ? baseIndexOf : result;
55207 return collection ? result(collection, target, fromIndex) : result;
55211 * Gets the "length" property value of `object`.
55213 * **Note:** This function is used to avoid a [JIT
55214 * bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects Safari
55215 * on at least iOS 8.1-8.3 ARM64.
55219 * object The object to query.
55220 * @returns {*} Returns the "length" value.
55222 var getLength = baseProperty('length');
55225 * Gets the propery names, values, and compare flags of `object`.
55229 * object The object to query.
55230 * @returns {Array} Returns the match data of `object`.
55232 function getMatchData(object) {
55233 var result = pairs(object),
55234 length = result.length;
55237 result[length][2] = isStrictComparable(result[length][1]);
55243 * Gets the native function at `key` of `object`.
55247 * object The object to query.
55249 * key The key of the method to get.
55250 * @returns {*} Returns the function if it's native, else `undefined`.
55252 function getNative(object, key) {
55253 var value = object == null ? undefined : object[key];
55254 return isNative(value) ? value : undefined;
55258 * Gets the view, applying any `transforms` to the `start` and `end`
55263 * start The start of the view.
55265 * end The end of the view.
55267 * transforms The transformations to apply to the view.
55268 * @returns {Object} Returns an object containing the `start` and `end`
55269 * positions of the view.
55271 function getView(start, end, transforms) {
55273 length = transforms.length;
55275 while (++index < length) {
55276 var data = transforms[index],
55279 switch (data.type) {
55287 end = nativeMin(end, start + size);
55290 start = nativeMax(start, end - size);
55301 * Initializes an array clone.
55305 * array The array to clone.
55306 * @returns {Array} Returns the initialized clone.
55308 function initCloneArray(array) {
55309 var length = array.length,
55310 result = new array.constructor(length);
55312 // Add array properties assigned by `RegExp#exec`.
55313 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
55314 result.index = array.index;
55315 result.input = array.input;
55321 * Initializes an object clone.
55325 * object The object to clone.
55326 * @returns {Object} Returns the initialized clone.
55328 function initCloneObject(object) {
55329 var Ctor = object.constructor;
55330 if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
55337 * Initializes an object clone based on its `toStringTag`.
55339 * **Note:** This function only supports cloning values with tags of
55340 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
55344 * object The object to clone.
55346 * tag The `toStringTag` of the object to clone.
55348 * [isDeep] Specify a deep clone.
55349 * @returns {Object} Returns the initialized clone.
55351 function initCloneByTag(object, tag, isDeep) {
55352 var Ctor = object.constructor;
55354 case arrayBufferTag:
55355 return bufferClone(object);
55359 return new Ctor(+object);
55367 case uint8ClampedTag:
55370 var buffer = object.buffer;
55371 return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
55375 return new Ctor(object);
55378 var result = new Ctor(object.source, reFlags.exec(object));
55379 result.lastIndex = object.lastIndex;
55385 * Invokes the method at `path` on `object`.
55389 * object The object to query.
55390 * @param {Array|string}
55391 * path The path of the method to invoke.
55393 * args The arguments to invoke the method with.
55394 * @returns {*} Returns the result of the invoked method.
55396 function invokePath(object, path, args) {
55397 if (object != null && !isKey(path, object)) {
55398 path = toPath(path);
55399 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
55402 var func = object == null ? object : object[path];
55403 return func == null ? undefined : func.apply(object, args);
55407 * Checks if `value` is array-like.
55411 * value The value to check.
55412 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
55414 function isArrayLike(value) {
55415 return value != null && isLength(getLength(value));
55419 * Checks if `value` is a valid array-like index.
55423 * value The value to check.
55425 * [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
55426 * @returns {boolean} Returns `true` if `value` is a valid index, else
55429 function isIndex(value, length) {
55430 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
55431 length = length == null ? MAX_SAFE_INTEGER : length;
55432 return value > -1 && value % 1 == 0 && value < length;
55436 * Checks if the provided arguments are from an iteratee call.
55440 * value The potential iteratee value argument.
55442 * index The potential iteratee index or key argument.
55444 * object The potential iteratee object argument.
55445 * @returns {boolean} Returns `true` if the arguments are from an iteratee
55446 * call, else `false`.
55448 function isIterateeCall(value, index, object) {
55449 if (!isObject(object)) {
55452 var type = typeof index;
55453 if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) {
55454 var other = object[index];
55455 return value === value ? (value === other) : (other !== other);
55461 * Checks if `value` is a property name and not a property path.
55465 * value The value to check.
55467 * [object] The object to query keys on.
55468 * @returns {boolean} Returns `true` if `value` is a property name, else
55471 function isKey(value, object) {
55472 var type = typeof value;
55473 if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
55476 if (isArray(value)) {
55479 var result = !reIsDeepProp.test(value);
55480 return result || (object != null && value in toObject(object));
55484 * Checks if `func` has a lazy counterpart.
55487 * @param {Function}
55488 * func The function to check.
55489 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else
55492 function isLaziable(func) {
55493 var funcName = getFuncName(func);
55494 if (!(funcName in LazyWrapper.prototype)) {
55497 var other = lodash[funcName];
55498 if (func === other) {
55501 var data = getData(other);
55502 return !!data && func === data[0];
55506 * Checks if `value` is a valid array-like length.
55508 * **Note:** This function is based on
55509 * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
55513 * value The value to check.
55514 * @returns {boolean} Returns `true` if `value` is a valid length, else
55517 function isLength(value) {
55518 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
55522 * Checks if `value` is suitable for strict equality comparisons, i.e.
55527 * value The value to check.
55528 * @returns {boolean} Returns `true` if `value` if suitable for strict
55529 * equality comparisons, else `false`.
55531 function isStrictComparable(value) {
55532 return value === value && !isObject(value);
55536 * Merges the function metadata of `source` into `data`.
55538 * Merging metadata reduces the number of wrappers required to invoke a
55539 * function. This is possible because methods like `_.bind`, `_.curry`, and
55540 * `_.partial` may be applied regardless of execution order. Methods like
55541 * `_.ary` and `_.rearg` augment function arguments, making the order in
55542 * which they are executed important, preventing the merging of metadata.
55543 * However, we make an exception for a safe common case where curried
55544 * functions have `_.ary` and or `_.rearg` applied.
55548 * data The destination metadata.
55550 * source The source metadata.
55551 * @returns {Array} Returns `data`.
55553 function mergeData(data, source) {
55554 var bitmask = data[1],
55555 srcBitmask = source[1],
55556 newBitmask = bitmask | srcBitmask,
55557 isCommon = newBitmask < ARY_FLAG;
55560 (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
55561 (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
55562 (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
55564 // Exit early if metadata can't be merged.
55565 if (!(isCommon || isCombo)) {
55568 // Use source `thisArg` if available.
55569 if (srcBitmask & BIND_FLAG) {
55570 data[2] = source[2];
55571 // Set when currying a bound function.
55572 newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
55574 // Compose partial arguments.
55575 var value = source[3];
55577 var partials = data[3];
55578 data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
55579 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
55581 // Compose partial right arguments.
55584 partials = data[5];
55585 data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
55586 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
55588 // Use source `argPos` if available.
55591 data[7] = arrayCopy(value);
55593 // Use source `ary` if it's smaller.
55594 if (srcBitmask & ARY_FLAG) {
55595 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
55597 // Use source `arity` if one is not provided.
55598 if (data[9] == null) {
55599 data[9] = source[9];
55601 // Use source `func` and merge bitmasks.
55602 data[0] = source[0];
55603 data[1] = newBitmask;
55609 * Used by `_.defaultsDeep` to customize its `_.merge` use.
55613 * objectValue The destination object property value.
55615 * sourceValue The source object property value.
55616 * @returns {*} Returns the value to assign to the destination object.
55618 function mergeDefaults(objectValue, sourceValue) {
55619 return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);
55623 * A specialized version of `_.pick` which picks `object` properties
55624 * specified by `props`.
55628 * object The source object.
55629 * @param {string[]}
55630 * props The property names to pick.
55631 * @returns {Object} Returns the new object.
55633 function pickByArray(object, props) {
55634 object = toObject(object);
55637 length = props.length,
55640 while (++index < length) {
55641 var key = props[index];
55642 if (key in object) {
55643 result[key] = object[key];
55650 * A specialized version of `_.pick` which picks `object` properties
55651 * `predicate` returns truthy for.
55655 * object The source object.
55656 * @param {Function}
55657 * predicate The function invoked per iteration.
55658 * @returns {Object} Returns the new object.
55660 function pickByCallback(object, predicate) {
55662 baseForIn(object, function(value, key, object) {
55663 if (predicate(value, key, object)) {
55664 result[key] = value;
55671 * Reorder `array` according to the specified indexes where the element at
55672 * the first index is assigned as the first element, the element at the
55673 * second index is assigned as the second element, and so on.
55677 * array The array to reorder.
55679 * indexes The arranged array indexes.
55680 * @returns {Array} Returns `array`.
55682 function reorder(array, indexes) {
55683 var arrLength = array.length,
55684 length = nativeMin(indexes.length, arrLength),
55685 oldArray = arrayCopy(array);
55688 var index = indexes[length];
55689 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
55695 * Sets metadata for `func`.
55697 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
55698 * period of time, it will trip its breaker and transition to an identity
55699 * function to avoid garbage collection pauses in V8. See [V8 issue
55700 * 2070](https://code.google.com/p/v8/issues/detail?id=2070) for more
55704 * @param {Function}
55705 * func The function to associate metadata with.
55707 * data The metadata.
55708 * @returns {Function} Returns `func`.
55710 var setData = (function() {
55714 return function(key, value) {
55716 remaining = HOT_SPAN - (stamp - lastCalled);
55718 lastCalled = stamp;
55719 if (remaining > 0) {
55720 if (++count >= HOT_COUNT) {
55726 return baseSetData(key, value);
55731 * A fallback implementation of `Object.keys` which creates an array of the
55732 * own enumerable property names of `object`.
55736 * object The object to query.
55737 * @returns {Array} Returns the array of property names.
55739 function shimKeys(object) {
55740 var props = keysIn(object),
55741 propsLength = props.length,
55742 length = propsLength && object.length;
55744 var allowIndexes = !!length && isLength(length) &&
55745 (isArray(object) || isArguments(object));
55750 while (++index < propsLength) {
55751 var key = props[index];
55752 if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
55760 * Converts `value` to an array-like object if it's not one.
55764 * value The value to process.
55765 * @returns {Array|Object} Returns the array-like object.
55767 function toIterable(value) {
55768 if (value == null) {
55771 if (!isArrayLike(value)) {
55772 return values(value);
55774 return isObject(value) ? value : Object(value);
55778 * Converts `value` to an object if it's not one.
55782 * value The value to process.
55783 * @returns {Object} Returns the object.
55785 function toObject(value) {
55786 return isObject(value) ? value : Object(value);
55790 * Converts `value` to property path array if it's not one.
55794 * value The value to process.
55795 * @returns {Array} Returns the property path array.
55797 function toPath(value) {
55798 if (isArray(value)) {
55802 baseToString(value).replace(rePropName, function(match, number, quote, string) {
55803 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
55809 * Creates a clone of `wrapper`.
55813 * wrapper The wrapper to clone.
55814 * @returns {Object} Returns the cloned wrapper.
55816 function wrapperClone(wrapper) {
55817 return wrapper instanceof LazyWrapper ? wrapper.clone() : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
55820 /*------------------------------------------------------------------------*/
55823 * Creates an array of elements split into groups the length of `size`. If
55824 * `collection` can't be split evenly, the final chunk will be the remaining
55831 * array The array to process.
55833 * [size=1] The length of each chunk.
55834 * @param- {Object} [guard] Enables use as a callback for functions like
55836 * @returns {Array} Returns the new array containing chunks.
55839 * _.chunk(['a', 'b', 'c', 'd'], 2); // => [['a', 'b'], ['c', 'd']]
55841 * _.chunk(['a', 'b', 'c', 'd'], 3); // => [['a', 'b', 'c'], ['d']]
55843 function chunk(array, size, guard) {
55844 if (guard ? isIterateeCall(array, size, guard) : size == null) {
55847 size = nativeMax(nativeFloor(size) || 1, 1);
55850 length = array ? array.length : 0,
55852 result = Array(nativeCeil(length / size));
55854 while (index < length) {
55855 result[++resIndex] = baseSlice(array, index, (index += size));
55861 * Creates an array with all falsey values removed. The values `false`,
55862 * `null`, `0`, `""`, `undefined`, and `NaN` are falsey.
55868 * array The array to compact.
55869 * @returns {Array} Returns the new array of filtered values.
55872 * _.compact([0, 1, false, 2, '', 3]); // => [1, 2, 3]
55874 function compact(array) {
55876 length = array ? array.length : 0,
55880 while (++index < length) {
55881 var value = array[index];
55883 result[++resIndex] = value;
55890 * Creates an array of unique `array` values not included in the other
55891 * provided arrays using
55892 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
55893 * for equality comparisons.
55899 * array The array to inspect.
55900 * @param {...Array}
55901 * [values] The arrays of values to exclude.
55902 * @returns {Array} Returns the new array of filtered values.
55905 * _.difference([1, 2, 3], [4, 2]); // => [1, 3]
55907 var difference = restParam(function(array, values) {
55908 return (isObjectLike(array) && isArrayLike(array)) ? baseDifference(array, baseFlatten(values, false, true)) : [];
55912 * Creates a slice of `array` with `n` elements dropped from the beginning.
55918 * array The array to query.
55920 * [n=1] The number of elements to drop.
55921 * @param- {Object} [guard] Enables use as a callback for functions like
55923 * @returns {Array} Returns the slice of `array`.
55926 * _.drop([1, 2, 3]); // => [2, 3]
55928 * _.drop([1, 2, 3], 2); // => [3]
55930 * _.drop([1, 2, 3], 5); // => []
55932 * _.drop([1, 2, 3], 0); // => [1, 2, 3]
55934 function drop(array, n, guard) {
55935 var length = array ? array.length : 0;
55939 if (guard ? isIterateeCall(array, n, guard) : n == null) {
55942 return baseSlice(array, n < 0 ? 0 : n);
55946 * Creates a slice of `array` with `n` elements dropped from the end.
55952 * array The array to query.
55954 * [n=1] The number of elements to drop.
55955 * @param- {Object} [guard] Enables use as a callback for functions like
55957 * @returns {Array} Returns the slice of `array`.
55960 * _.dropRight([1, 2, 3]); // => [1, 2]
55962 * _.dropRight([1, 2, 3], 2); // => [1]
55964 * _.dropRight([1, 2, 3], 5); // => []
55966 * _.dropRight([1, 2, 3], 0); // => [1, 2, 3]
55968 function dropRight(array, n, guard) {
55969 var length = array ? array.length : 0;
55973 if (guard ? isIterateeCall(array, n, guard) : n == null) {
55976 n = length - (+n || 0);
55977 return baseSlice(array, 0, n < 0 ? 0 : n);
55981 * Creates a slice of `array` excluding elements dropped from the end.
55982 * Elements are dropped until `predicate` returns falsey. The predicate is
55983 * bound to `thisArg` and invoked with three arguments: (value, index,
55986 * If a property name is provided for `predicate` the created `_.property`
55987 * style callback returns the property value of the given element.
55989 * If a value is also provided for `thisArg` the created `_.matchesProperty`
55990 * style callback returns `true` for elements that have a matching property
55991 * value, else `false`.
55993 * If an object is provided for `predicate` the created `_.matches` style
55994 * callback returns `true` for elements that match the properties of the
55995 * given object, else `false`.
56001 * array The array to query.
56002 * @param {Function|Object|string}
56003 * [predicate=_.identity] The function invoked per iteration.
56005 * [thisArg] The `this` binding of `predicate`.
56006 * @returns {Array} Returns the slice of `array`.
56009 * _.dropRightWhile([1, 2, 3], function(n) { return n > 1; }); // => [1]
56011 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
56012 * 'active': false }, { 'user': 'pebbles', 'active': false } ];
56013 * // using the `_.matches` callback shorthand
56014 * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }),
56015 * 'user'); // => ['barney', 'fred']
56016 * // using the `_.matchesProperty` callback shorthand
56017 * _.pluck(_.dropRightWhile(users, 'active', false), 'user'); // =>
56019 * // using the `_.property` callback shorthand
56020 * _.pluck(_.dropRightWhile(users, 'active'), 'user'); // => ['barney',
56021 * 'fred', 'pebbles']
56023 function dropRightWhile(array, predicate, thisArg) {
56024 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true) : [];
56028 * Creates a slice of `array` excluding elements dropped from the beginning.
56029 * Elements are dropped until `predicate` returns falsey. The predicate is
56030 * bound to `thisArg` and invoked with three arguments: (value, index,
56033 * If a property name is provided for `predicate` the created `_.property`
56034 * style callback returns the property value of the given element.
56036 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56037 * style callback returns `true` for elements that have a matching property
56038 * value, else `false`.
56040 * If an object is provided for `predicate` the created `_.matches` style
56041 * callback returns `true` for elements that have the properties of the
56042 * given object, else `false`.
56048 * array The array to query.
56049 * @param {Function|Object|string}
56050 * [predicate=_.identity] The function invoked per iteration.
56052 * [thisArg] The `this` binding of `predicate`.
56053 * @returns {Array} Returns the slice of `array`.
56056 * _.dropWhile([1, 2, 3], function(n) { return n < 3; }); // => [3]
56058 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
56059 * 'active': false }, { 'user': 'pebbles', 'active': true } ];
56060 * // using the `_.matches` callback shorthand _.pluck(_.dropWhile(users, {
56061 * 'user': 'barney', 'active': false }), 'user'); // => ['fred', 'pebbles']
56062 * // using the `_.matchesProperty` callback shorthand
56063 * _.pluck(_.dropWhile(users, 'active', false), 'user'); // => ['pebbles']
56064 * // using the `_.property` callback shorthand _.pluck(_.dropWhile(users,
56065 * 'active'), 'user'); // => ['barney', 'fred', 'pebbles']
56067 function dropWhile(array, predicate, thisArg) {
56068 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3), true) : [];
56072 * Fills elements of `array` with `value` from `start` up to, but not
56073 * including, `end`.
56075 * **Note:** This method mutates `array`.
56081 * array The array to fill.
56083 * value The value to fill `array` with.
56085 * [start=0] The start position.
56087 * [end=array.length] The end position.
56088 * @returns {Array} Returns `array`.
56091 * var array = [1, 2, 3];
56093 * _.fill(array, 'a'); console.log(array); // => ['a', 'a', 'a']
56095 * _.fill(Array(3), 2); // => [2, 2, 2]
56097 * _.fill([4, 6, 8], '*', 1, 2); // => [4, '*', 8]
56099 function fill(array, value, start, end) {
56100 var length = array ? array.length : 0;
56104 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
56108 return baseFill(array, value, start, end);
56112 * This method is like `_.find` except that it returns the index of the
56113 * first element `predicate` returns truthy for instead of the element
56116 * If a property name is provided for `predicate` the created `_.property`
56117 * style callback returns the property value of the given element.
56119 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56120 * style callback returns `true` for elements that have a matching property
56121 * value, else `false`.
56123 * If an object is provided for `predicate` the created `_.matches` style
56124 * callback returns `true` for elements that have the properties of the
56125 * given object, else `false`.
56131 * array The array to search.
56132 * @param {Function|Object|string}
56133 * [predicate=_.identity] The function invoked per iteration.
56135 * [thisArg] The `this` binding of `predicate`.
56136 * @returns {number} Returns the index of the found element, else `-1`.
56139 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
56140 * 'active': false }, { 'user': 'pebbles', 'active': true } ];
56142 * _.findIndex(users, function(chr) { return chr.user == 'barney'; }); // =>
56144 * // using the `_.matches` callback shorthand _.findIndex(users, { 'user':
56145 * 'fred', 'active': false }); // => 1
56146 * // using the `_.matchesProperty` callback shorthand _.findIndex(users,
56147 * 'active', false); // => 0
56148 * // using the `_.property` callback shorthand _.findIndex(users,
56149 * 'active'); // => 2
56151 var findIndex = createFindIndex();
56154 * This method is like `_.findIndex` except that it iterates over elements
56155 * of `collection` from right to left.
56157 * If a property name is provided for `predicate` the created `_.property`
56158 * style callback returns the property value of the given element.
56160 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56161 * style callback returns `true` for elements that have a matching property
56162 * value, else `false`.
56164 * If an object is provided for `predicate` the created `_.matches` style
56165 * callback returns `true` for elements that have the properties of the
56166 * given object, else `false`.
56172 * array The array to search.
56173 * @param {Function|Object|string}
56174 * [predicate=_.identity] The function invoked per iteration.
56176 * [thisArg] The `this` binding of `predicate`.
56177 * @returns {number} Returns the index of the found element, else `-1`.
56180 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
56181 * 'active': false }, { 'user': 'pebbles', 'active': false } ];
56183 * _.findLastIndex(users, function(chr) { return chr.user == 'pebbles'; }); // =>
56185 * // using the `_.matches` callback shorthand _.findLastIndex(users, {
56186 * 'user': 'barney', 'active': true }); // => 0
56187 * // using the `_.matchesProperty` callback shorthand
56188 * _.findLastIndex(users, 'active', false); // => 2
56189 * // using the `_.property` callback shorthand _.findLastIndex(users,
56190 * 'active'); // => 0
56192 var findLastIndex = createFindIndex(true);
56195 * Gets the first element of `array`.
56202 * array The array to query.
56203 * @returns {*} Returns the first element of `array`.
56206 * _.first([1, 2, 3]); // => 1
56208 * _.first([]); // => undefined
56210 function first(array) {
56211 return array ? array[0] : undefined;
56215 * Flattens a nested array. If `isDeep` is `true` the array is recursively
56216 * flattened, otherwise it is only flattened a single level.
56222 * array The array to flatten.
56224 * [isDeep] Specify a deep flatten.
56225 * @param- {Object} [guard] Enables use as a callback for functions like
56227 * @returns {Array} Returns the new flattened array.
56230 * _.flatten([1, [2, 3, [4]]]); // => [1, 2, 3, [4]]
56231 * // using `isDeep` _.flatten([1, [2, 3, [4]]], true); // => [1, 2, 3, 4]
56233 function flatten(array, isDeep, guard) {
56234 var length = array ? array.length : 0;
56235 if (guard && isIterateeCall(array, isDeep, guard)) {
56238 return length ? baseFlatten(array, isDeep) : [];
56242 * Recursively flattens a nested array.
56248 * array The array to recursively flatten.
56249 * @returns {Array} Returns the new flattened array.
56252 * _.flattenDeep([1, [2, 3, [4]]]); // => [1, 2, 3, 4]
56254 function flattenDeep(array) {
56255 var length = array ? array.length : 0;
56256 return length ? baseFlatten(array, true) : [];
56260 * Gets the index at which the first occurrence of `value` is found in
56262 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56263 * for equality comparisons. If `fromIndex` is negative, it is used as the
56264 * offset from the end of `array`. If `array` is sorted providing `true` for
56265 * `fromIndex` performs a faster binary search.
56271 * array The array to search.
56273 * value The value to search for.
56274 * @param {boolean|number}
56275 * [fromIndex=0] The index to search from or `true` to perform a
56276 * binary search on a sorted array.
56277 * @returns {number} Returns the index of the matched value, else `-1`.
56280 * _.indexOf([1, 2, 1, 2], 2); // => 1
56281 * // using `fromIndex` _.indexOf([1, 2, 1, 2], 2, 2); // => 3
56282 * // performing a binary search _.indexOf([1, 1, 2, 2], 2, true); // => 2
56284 function indexOf(array, value, fromIndex) {
56285 var length = array ? array.length : 0;
56289 if (typeof fromIndex == 'number') {
56290 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
56291 } else if (fromIndex) {
56292 var index = binaryIndex(array, value);
56293 if (index < length &&
56294 (value === value ? (value === array[index]) : (array[index] !== array[index]))) {
56299 return baseIndexOf(array, value, fromIndex || 0);
56303 * Gets all but the last element of `array`.
56309 * array The array to query.
56310 * @returns {Array} Returns the slice of `array`.
56313 * _.initial([1, 2, 3]); // => [1, 2]
56315 function initial(array) {
56316 return dropRight(array, 1);
56320 * Creates an array of unique values that are included in all of the
56321 * provided arrays using
56322 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56323 * for equality comparisons.
56328 * @param {...Array}
56329 * [arrays] The arrays to inspect.
56330 * @returns {Array} Returns the new array of shared values.
56331 * @example _.intersection([1, 2], [4, 2], [2, 1]); // => [2]
56333 var intersection = restParam(function(arrays) {
56334 var othLength = arrays.length,
56335 othIndex = othLength,
56336 caches = Array(length),
56337 indexOf = getIndexOf(),
56338 isCommon = indexOf == baseIndexOf,
56341 while (othIndex--) {
56342 var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
56343 caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
56345 var array = arrays[0],
56347 length = array ? array.length : 0,
56351 while (++index < length) {
56352 value = array[index];
56353 if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
56354 var othIndex = othLength;
56355 while (--othIndex) {
56356 var cache = caches[othIndex];
56357 if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
56364 result.push(value);
56371 * Gets the last element of `array`.
56377 * array The array to query.
56378 * @returns {*} Returns the last element of `array`.
56381 * _.last([1, 2, 3]); // => 3
56383 function last(array) {
56384 var length = array ? array.length : 0;
56385 return length ? array[length - 1] : undefined;
56389 * This method is like `_.indexOf` except that it iterates over elements of
56390 * `array` from right to left.
56396 * array The array to search.
56398 * value The value to search for.
56399 * @param {boolean|number}
56400 * [fromIndex=array.length-1] The index to search from or `true`
56401 * to perform a binary search on a sorted array.
56402 * @returns {number} Returns the index of the matched value, else `-1`.
56405 * _.lastIndexOf([1, 2, 1, 2], 2); // => 3
56406 * // using `fromIndex` _.lastIndexOf([1, 2, 1, 2], 2, 2); // => 1
56407 * // performing a binary search _.lastIndexOf([1, 1, 2, 2], 2, true); // =>
56410 function lastIndexOf(array, value, fromIndex) {
56411 var length = array ? array.length : 0;
56415 var index = length;
56416 if (typeof fromIndex == 'number') {
56417 index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;
56418 } else if (fromIndex) {
56419 index = binaryIndex(array, value, true) - 1;
56420 var other = array[index];
56421 if (value === value ? (value === other) : (other !== other)) {
56426 if (value !== value) {
56427 return indexOfNaN(array, index, true);
56430 if (array[index] === value) {
56438 * Removes all provided values from `array` using
56439 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56440 * for equality comparisons.
56442 * **Note:** Unlike `_.without`, this method mutates `array`.
56448 * array The array to modify.
56450 * [values] The values to remove.
56451 * @returns {Array} Returns `array`.
56454 * var array = [1, 2, 3, 1, 2, 3];
56456 * _.pull(array, 2, 3); console.log(array); // => [1, 1]
56459 var args = arguments,
56462 if (!(array && array.length)) {
56466 indexOf = getIndexOf(),
56467 length = args.length;
56469 while (++index < length) {
56471 value = args[index];
56473 while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
56474 splice.call(array, fromIndex, 1);
56481 * Removes elements from `array` corresponding to the given indexes and
56482 * returns an array of the removed elements. Indexes may be specified as an
56483 * array of indexes or as individual arguments.
56485 * **Note:** Unlike `_.at`, this method mutates `array`.
56491 * array The array to modify.
56492 * @param {...(number|number[])}
56493 * [indexes] The indexes of elements to remove, specified as
56494 * individual indexes or arrays of indexes.
56495 * @returns {Array} Returns the new array of removed elements.
56498 * var array = [5, 10, 15, 20]; var evens = _.pullAt(array, 1, 3);
56500 * console.log(array); // => [5, 15]
56502 * console.log(evens); // => [10, 20]
56504 var pullAt = restParam(function(array, indexes) {
56505 indexes = baseFlatten(indexes);
56507 var result = baseAt(array, indexes);
56508 basePullAt(array, indexes.sort(baseCompareAscending));
56513 * Removes all elements from `array` that `predicate` returns truthy for and
56514 * returns an array of the removed elements. The predicate is bound to
56515 * `thisArg` and invoked with three arguments: (value, index, array).
56517 * If a property name is provided for `predicate` the created `_.property`
56518 * style callback returns the property value of the given element.
56520 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56521 * style callback returns `true` for elements that have a matching property
56522 * value, else `false`.
56524 * If an object is provided for `predicate` the created `_.matches` style
56525 * callback returns `true` for elements that have the properties of the
56526 * given object, else `false`.
56528 * **Note:** Unlike `_.filter`, this method mutates `array`.
56534 * array The array to modify.
56535 * @param {Function|Object|string}
56536 * [predicate=_.identity] The function invoked per iteration.
56538 * [thisArg] The `this` binding of `predicate`.
56539 * @returns {Array} Returns the new array of removed elements.
56542 * var array = [1, 2, 3, 4]; var evens = _.remove(array, function(n) {
56543 * return n % 2 == 0; });
56545 * console.log(array); // => [1, 3]
56547 * console.log(evens); // => [2, 4]
56549 function remove(array, predicate, thisArg) {
56551 if (!(array && array.length)) {
56556 length = array.length;
56558 predicate = getCallback(predicate, thisArg, 3);
56559 while (++index < length) {
56560 var value = array[index];
56561 if (predicate(value, index, array)) {
56562 result.push(value);
56563 indexes.push(index);
56566 basePullAt(array, indexes);
56571 * Gets all but the first element of `array`.
56578 * array The array to query.
56579 * @returns {Array} Returns the slice of `array`.
56582 * _.rest([1, 2, 3]); // => [2, 3]
56584 function rest(array) {
56585 return drop(array, 1);
56589 * Creates a slice of `array` from `start` up to, but not including, `end`.
56591 * **Note:** This method is used instead of `Array#slice` to support node
56592 * lists in IE < 9 and to ensure dense arrays are returned.
56598 * array The array to slice.
56600 * [start=0] The start position.
56602 * [end=array.length] The end position.
56603 * @returns {Array} Returns the slice of `array`.
56605 function slice(array, start, end) {
56606 var length = array ? array.length : 0;
56610 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
56614 return baseSlice(array, start, end);
56618 * Uses a binary search to determine the lowest index at which `value`
56619 * should be inserted into `array` in order to maintain its sort order. If
56620 * an iteratee function is provided it is invoked for `value` and each
56621 * element of `array` to compute their sort ranking. The iteratee is bound
56622 * to `thisArg` and invoked with one argument; (value).
56624 * If a property name is provided for `iteratee` the created `_.property`
56625 * style callback returns the property value of the given element.
56627 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56628 * style callback returns `true` for elements that have a matching property
56629 * value, else `false`.
56631 * If an object is provided for `iteratee` the created `_.matches` style
56632 * callback returns `true` for elements that have the properties of the
56633 * given object, else `false`.
56639 * array The sorted array to inspect.
56641 * value The value to evaluate.
56642 * @param {Function|Object|string}
56643 * [iteratee=_.identity] The function invoked per iteration.
56645 * [thisArg] The `this` binding of `iteratee`.
56646 * @returns {number} Returns the index at which `value` should be inserted
56650 * _.sortedIndex([30, 50], 40); // => 1
56652 * _.sortedIndex([4, 4, 5, 5], 5); // => 2
56654 * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
56655 * // using an iteratee function _.sortedIndex(['thirty', 'fifty'],
56656 * 'forty', function(word) { return this.data[word]; }, dict); // => 1
56657 * // using the `_.property` callback shorthand _.sortedIndex([{ 'x': 30 }, {
56658 * 'x': 50 }], { 'x': 40 }, 'x'); // => 1
56660 var sortedIndex = createSortedIndex();
56663 * This method is like `_.sortedIndex` except that it returns the highest
56664 * index at which `value` should be inserted into `array` in order to
56665 * maintain its sort order.
56671 * array The sorted array to inspect.
56673 * value The value to evaluate.
56674 * @param {Function|Object|string}
56675 * [iteratee=_.identity] The function invoked per iteration.
56677 * [thisArg] The `this` binding of `iteratee`.
56678 * @returns {number} Returns the index at which `value` should be inserted
56682 * _.sortedLastIndex([4, 4, 5, 5], 5); // => 4
56684 var sortedLastIndex = createSortedIndex(true);
56687 * Creates a slice of `array` with `n` elements taken from the beginning.
56693 * array The array to query.
56695 * [n=1] The number of elements to take.
56696 * @param- {Object} [guard] Enables use as a callback for functions like
56698 * @returns {Array} Returns the slice of `array`.
56701 * _.take([1, 2, 3]); // => [1]
56703 * _.take([1, 2, 3], 2); // => [1, 2]
56705 * _.take([1, 2, 3], 5); // => [1, 2, 3]
56707 * _.take([1, 2, 3], 0); // => []
56709 function take(array, n, guard) {
56710 var length = array ? array.length : 0;
56714 if (guard ? isIterateeCall(array, n, guard) : n == null) {
56717 return baseSlice(array, 0, n < 0 ? 0 : n);
56721 * Creates a slice of `array` with `n` elements taken from the end.
56727 * array The array to query.
56729 * [n=1] The number of elements to take.
56730 * @param- {Object} [guard] Enables use as a callback for functions like
56732 * @returns {Array} Returns the slice of `array`.
56735 * _.takeRight([1, 2, 3]); // => [3]
56737 * _.takeRight([1, 2, 3], 2); // => [2, 3]
56739 * _.takeRight([1, 2, 3], 5); // => [1, 2, 3]
56741 * _.takeRight([1, 2, 3], 0); // => []
56743 function takeRight(array, n, guard) {
56744 var length = array ? array.length : 0;
56748 if (guard ? isIterateeCall(array, n, guard) : n == null) {
56751 n = length - (+n || 0);
56752 return baseSlice(array, n < 0 ? 0 : n);
56756 * Creates a slice of `array` with elements taken from the end. Elements are
56757 * taken until `predicate` returns falsey. The predicate is bound to
56758 * `thisArg` and invoked with three arguments: (value, index, array).
56760 * If a property name is provided for `predicate` the created `_.property`
56761 * style callback returns the property value of the given element.
56763 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56764 * style callback returns `true` for elements that have a matching property
56765 * value, else `false`.
56767 * If an object is provided for `predicate` the created `_.matches` style
56768 * callback returns `true` for elements that have the properties of the
56769 * given object, else `false`.
56775 * array The array to query.
56776 * @param {Function|Object|string}
56777 * [predicate=_.identity] The function invoked per iteration.
56779 * [thisArg] The `this` binding of `predicate`.
56780 * @returns {Array} Returns the slice of `array`.
56783 * _.takeRightWhile([1, 2, 3], function(n) { return n > 1; }); // => [2, 3]
56785 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
56786 * 'active': false }, { 'user': 'pebbles', 'active': false } ];
56787 * // using the `_.matches` callback shorthand
56788 * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }),
56789 * 'user'); // => ['pebbles']
56790 * // using the `_.matchesProperty` callback shorthand
56791 * _.pluck(_.takeRightWhile(users, 'active', false), 'user'); // => ['fred',
56793 * // using the `_.property` callback shorthand
56794 * _.pluck(_.takeRightWhile(users, 'active'), 'user'); // => []
56796 function takeRightWhile(array, predicate, thisArg) {
56797 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true) : [];
56801 * Creates a slice of `array` with elements taken from the beginning.
56802 * Elements are taken until `predicate` returns falsey. The predicate is
56803 * bound to `thisArg` and invoked with three arguments: (value, index,
56806 * If a property name is provided for `predicate` the created `_.property`
56807 * style callback returns the property value of the given element.
56809 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56810 * style callback returns `true` for elements that have a matching property
56811 * value, else `false`.
56813 * If an object is provided for `predicate` the created `_.matches` style
56814 * callback returns `true` for elements that have the properties of the
56815 * given object, else `false`.
56821 * array The array to query.
56822 * @param {Function|Object|string}
56823 * [predicate=_.identity] The function invoked per iteration.
56825 * [thisArg] The `this` binding of `predicate`.
56826 * @returns {Array} Returns the slice of `array`.
56829 * _.takeWhile([1, 2, 3], function(n) { return n < 3; }); // => [1, 2]
56831 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
56832 * 'active': false}, { 'user': 'pebbles', 'active': true } ];
56833 * // using the `_.matches` callback shorthand _.pluck(_.takeWhile(users, {
56834 * 'user': 'barney', 'active': false }), 'user'); // => ['barney']
56835 * // using the `_.matchesProperty` callback shorthand
56836 * _.pluck(_.takeWhile(users, 'active', false), 'user'); // => ['barney',
56838 * // using the `_.property` callback shorthand _.pluck(_.takeWhile(users,
56839 * 'active'), 'user'); // => []
56841 function takeWhile(array, predicate, thisArg) {
56842 return (array && array.length) ? baseWhile(array, getCallback(predicate, thisArg, 3)) : [];
56846 * Creates an array of unique values, in order, from all of the provided
56848 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56849 * for equality comparisons.
56854 * @param {...Array}
56855 * [arrays] The arrays to inspect.
56856 * @returns {Array} Returns the new array of combined values.
56859 * _.union([1, 2], [4, 2], [2, 1]); // => [1, 2, 4]
56861 var union = restParam(function(arrays) {
56862 return baseUniq(baseFlatten(arrays, false, true));
56866 * Creates a duplicate-free version of an array, using
56867 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
56868 * for equality comparisons, in which only the first occurence of each
56869 * element is kept. Providing `true` for `isSorted` performs a faster search
56870 * algorithm for sorted arrays. If an iteratee function is provided it is
56871 * invoked for each element in the array to generate the criterion by which
56872 * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked
56873 * with three arguments: (value, index, array).
56875 * If a property name is provided for `iteratee` the created `_.property`
56876 * style callback returns the property value of the given element.
56878 * If a value is also provided for `thisArg` the created `_.matchesProperty`
56879 * style callback returns `true` for elements that have a matching property
56880 * value, else `false`.
56882 * If an object is provided for `iteratee` the created `_.matches` style
56883 * callback returns `true` for elements that have the properties of the
56884 * given object, else `false`.
56891 * array The array to inspect.
56893 * [isSorted] Specify the array is sorted.
56894 * @param {Function|Object|string}
56895 * [iteratee] The function invoked per iteration.
56897 * [thisArg] The `this` binding of `iteratee`.
56898 * @returns {Array} Returns the new duplicate-value-free array.
56901 * _.uniq([2, 1, 2]); // => [2, 1]
56902 * // using `isSorted` _.uniq([1, 1, 2], true); // => [1, 2]
56903 * // using an iteratee function _.uniq([1, 2.5, 1.5, 2], function(n) {
56904 * return this.floor(n); }, Math); // => [1, 2.5]
56905 * // using the `_.property` callback shorthand _.uniq([{ 'x': 1 }, { 'x':
56906 * 2 }, { 'x': 1 }], 'x'); // => [{ 'x': 1 }, { 'x': 2 }]
56908 function uniq(array, isSorted, iteratee, thisArg) {
56909 var length = array ? array.length : 0;
56913 if (isSorted != null && typeof isSorted != 'boolean') {
56914 thisArg = iteratee;
56915 iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;
56918 var callback = getCallback();
56919 if (!(iteratee == null && callback === baseCallback)) {
56920 iteratee = callback(iteratee, thisArg, 3);
56922 return (isSorted && getIndexOf() == baseIndexOf) ? sortedUniq(array, iteratee) : baseUniq(array, iteratee);
56926 * This method is like `_.zip` except that it accepts an array of grouped
56927 * elements and creates an array regrouping the elements to their pre-zip
56934 * array The array of grouped elements to process.
56935 * @returns {Array} Returns the new array of regrouped elements.
56938 * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); // =>
56939 * [['fred', 30, true], ['barney', 40, false]]
56941 * _.unzip(zipped); // => [['fred', 'barney'], [30, 40], [true, false]]
56943 function unzip(array) {
56944 if (!(array && array.length)) {
56950 array = arrayFilter(array, function(group) {
56951 if (isArrayLike(group)) {
56952 length = nativeMax(group.length, length);
56956 var result = Array(length);
56957 while (++index < length) {
56958 result[index] = arrayMap(array, baseProperty(index));
56964 * This method is like `_.unzip` except that it accepts an iteratee to
56965 * specify how regrouped values should be combined. The `iteratee` is bound
56966 * to `thisArg` and invoked with four arguments: (accumulator, value, index,
56973 * array The array of grouped elements to process.
56974 * @param {Function}
56975 * [iteratee] The function to combine regrouped values.
56977 * [thisArg] The `this` binding of `iteratee`.
56978 * @returns {Array} Returns the new array of regrouped elements.
56981 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); // => [[1, 10, 100],
56984 * _.unzipWith(zipped, _.add); // => [3, 30, 300]
56986 function unzipWith(array, iteratee, thisArg) {
56987 var length = array ? array.length : 0;
56991 var result = unzip(array);
56992 if (iteratee == null) {
56995 iteratee = bindCallback(iteratee, thisArg, 4);
56996 return arrayMap(result, function(group) {
56997 return arrayReduce(group, iteratee, undefined, true);
57002 * Creates an array excluding all provided values using
57003 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
57004 * for equality comparisons.
57010 * array The array to filter.
57012 * [values] The values to exclude.
57013 * @returns {Array} Returns the new array of filtered values.
57016 * _.without([1, 2, 1, 3], 1, 2); // => [3]
57018 var without = restParam(function(array, values) {
57019 return isArrayLike(array) ? baseDifference(array, values) : [];
57023 * Creates an array of unique values that is the [symmetric
57024 * difference](https://en.wikipedia.org/wiki/Symmetric_difference) of the
57030 * @param {...Array}
57031 * [arrays] The arrays to inspect.
57032 * @returns {Array} Returns the new array of values.
57035 * _.xor([1, 2], [4, 2]); // => [1, 4]
57039 length = arguments.length;
57041 while (++index < length) {
57042 var array = arguments[index];
57043 if (isArrayLike(array)) {
57044 var result = result ? arrayPush(baseDifference(result, array), baseDifference(array, result)) : array;
57047 return result ? baseUniq(result) : [];
57051 * Creates an array of grouped elements, the first of which contains the
57052 * first elements of the given arrays, the second of which contains the
57053 * second elements of the given arrays, and so on.
57058 * @param {...Array}
57059 * [arrays] The arrays to process.
57060 * @returns {Array} Returns the new array of grouped elements.
57063 * _.zip(['fred', 'barney'], [30, 40], [true, false]); // => [['fred', 30,
57064 * true], ['barney', 40, false]]
57066 var zip = restParam(unzip);
57069 * The inverse of `_.pairs`; this method returns an object composed from
57070 * arrays of property names and values. Provide either a single two
57071 * dimensional array, e.g. `[[key1, value1], [key2, value2]]` or two arrays,
57072 * one of property names and one of corresponding values.
57079 * props The property names.
57081 * [values=[]] The property values.
57082 * @returns {Object} Returns the new object.
57085 * _.zipObject([['fred', 30], ['barney', 40]]); // => { 'fred': 30,
57088 * _.zipObject(['fred', 'barney'], [30, 40]); // => { 'fred': 30, 'barney':
57091 function zipObject(props, values) {
57093 length = props ? props.length : 0,
57096 if (length && !values && !isArray(props[0])) {
57099 while (++index < length) {
57100 var key = props[index];
57102 result[key] = values[index];
57104 result[key[0]] = key[1];
57111 * This method is like `_.zip` except that it accepts an iteratee to specify
57112 * how grouped values should be combined. The `iteratee` is bound to
57113 * `thisArg` and invoked with four arguments: (accumulator, value, index,
57119 * @param {...Array}
57120 * [arrays] The arrays to process.
57121 * @param {Function}
57122 * [iteratee] The function to combine grouped values.
57124 * [thisArg] The `this` binding of `iteratee`.
57125 * @returns {Array} Returns the new array of grouped elements.
57128 * _.zipWith([1, 2], [10, 20], [100, 200], _.add); // => [111, 222]
57130 var zipWith = restParam(function(arrays) {
57131 var length = arrays.length,
57132 iteratee = length > 2 ? arrays[length - 2] : undefined,
57133 thisArg = length > 1 ? arrays[length - 1] : undefined;
57135 if (length > 2 && typeof iteratee == 'function') {
57138 iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
57139 thisArg = undefined;
57141 arrays.length = length;
57142 return unzipWith(arrays, iteratee, thisArg);
57145 /*------------------------------------------------------------------------*/
57148 * Creates a `lodash` object that wraps `value` with explicit method
57149 * chaining enabled.
57155 * value The value to wrap.
57156 * @returns {Object} Returns the new `lodash` wrapper instance.
57159 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
57160 * 40 }, { 'user': 'pebbles', 'age': 1 } ];
57162 * var youngest = _.chain(users) .sortBy('age') .map(function(chr) { return
57163 * chr.user + ' is ' + chr.age; }) .first() .value(); // => 'pebbles is 1'
57165 function chain(value) {
57166 var result = lodash(value);
57167 result.__chain__ = true;
57172 * This method invokes `interceptor` and returns `value`. The interceptor is
57173 * bound to `thisArg` and invoked with one argument; (value). The purpose of
57174 * this method is to "tap into" a method chain in order to perform
57175 * operations on intermediate results within the chain.
57181 * value The value to provide to `interceptor`.
57182 * @param {Function}
57183 * interceptor The function to invoke.
57185 * [thisArg] The `this` binding of `interceptor`.
57186 * @returns {*} Returns `value`.
57189 * _([1, 2, 3]) .tap(function(array) { array.pop(); }) .reverse() .value(); // =>
57192 function tap(value, interceptor, thisArg) {
57193 interceptor.call(thisArg, value);
57198 * This method is like `_.tap` except that it returns the result of
57205 * value The value to provide to `interceptor`.
57206 * @param {Function}
57207 * interceptor The function to invoke.
57209 * [thisArg] The `this` binding of `interceptor`.
57210 * @returns {*} Returns the result of `interceptor`.
57213 * _(' abc ') .chain() .trim() .thru(function(value) { return [value]; })
57214 * .value(); // => ['abc']
57216 function thru(value, interceptor, thisArg) {
57217 return interceptor.call(thisArg, value);
57221 * Enables explicit method chaining on the wrapper object.
57226 * @returns {Object} Returns the new `lodash` wrapper instance.
57229 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
57231 * // without explicit chaining _(users).first(); // => { 'user': 'barney',
57233 * // with explicit chaining _(users).chain() .first() .pick('user')
57234 * .value(); // => { 'user': 'barney' }
57236 function wrapperChain() {
57237 return chain(this);
57241 * Executes the chained sequence and returns the wrapped result.
57246 * @returns {Object} Returns the new `lodash` wrapper instance.
57249 * var array = [1, 2]; var wrapped = _(array).push(3);
57251 * console.log(array); // => [1, 2]
57253 * wrapped = wrapped.commit(); console.log(array); // => [1, 2, 3]
57255 * wrapped.last(); // => 3
57257 * console.log(array); // => [1, 2, 3]
57259 function wrapperCommit() {
57260 return new LodashWrapper(this.value(), this.__chain__);
57264 * Creates a new array joining a wrapped array with any additional arrays
57271 * [values] The values to concatenate.
57272 * @returns {Array} Returns the new concatenated array.
57275 * var array = [1]; var wrapped = _(array).concat(2, [3], [[4]]);
57277 * console.log(wrapped.value()); // => [1, 2, 3, [4]]
57279 * console.log(array); // => [1]
57281 var wrapperConcat = restParam(function(values) {
57282 values = baseFlatten(values);
57283 return this.thru(function(array) {
57284 return arrayConcat(isArray(array) ? array : [toObject(array)], values);
57289 * Creates a clone of the chained sequence planting `value` as the wrapped
57295 * @returns {Object} Returns the new `lodash` wrapper instance.
57298 * var array = [1, 2]; var wrapped = _(array).map(function(value) { return
57299 * Math.pow(value, 2); });
57301 * var other = [3, 4]; var otherWrapped = wrapped.plant(other);
57303 * otherWrapped.value(); // => [9, 16]
57305 * wrapped.value(); // => [1, 4]
57307 function wrapperPlant(value) {
57311 while (parent instanceof baseLodash) {
57312 var clone = wrapperClone(parent);
57314 previous.__wrapped__ = clone;
57318 var previous = clone;
57319 parent = parent.__wrapped__;
57321 previous.__wrapped__ = value;
57326 * Reverses the wrapped array so the first element becomes the last, the
57327 * second element becomes the second to last, and so on.
57329 * **Note:** This method mutates the wrapped array.
57334 * @returns {Object} Returns the new reversed `lodash` wrapper instance.
57337 * var array = [1, 2, 3];
57339 * _(array).reverse().value() // => [3, 2, 1]
57341 * console.log(array); // => [3, 2, 1]
57343 function wrapperReverse() {
57344 var value = this.__wrapped__;
57346 var interceptor = function(value) {
57347 return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
57349 if (value instanceof LazyWrapper) {
57350 var wrapped = value;
57351 if (this.__actions__.length) {
57352 wrapped = new LazyWrapper(this);
57354 wrapped = wrapped.reverse();
57355 wrapped.__actions__.push({
57357 'args': [interceptor],
57358 'thisArg': undefined
57360 return new LodashWrapper(wrapped, this.__chain__);
57362 return this.thru(interceptor);
57366 * Produces the result of coercing the unwrapped value to a string.
57371 * @returns {string} Returns the coerced string value.
57374 * _([1, 2, 3]).toString(); // => '1,2,3'
57376 function wrapperToString() {
57377 return (this.value() + '');
57381 * Executes the chained sequence to extract the unwrapped value.
57385 * @alias run, toJSON, valueOf
57387 * @returns {*} Returns the resolved unwrapped value.
57390 * _([1, 2, 3]).value(); // => [1, 2, 3]
57392 function wrapperValue() {
57393 return baseWrapperValue(this.__wrapped__, this.__actions__);
57396 /*------------------------------------------------------------------------*/
57399 * Creates an array of elements corresponding to the given keys, or indexes,
57400 * of `collection`. Keys may be specified as individual arguments or as
57405 * @category Collection
57406 * @param {Array|Object|string}
57407 * collection The collection to iterate over.
57408 * @param {...(number|number[]|string|string[])}
57409 * [props] The property names or indexes of elements to pick,
57410 * specified individually or in arrays.
57411 * @returns {Array} Returns the new array of picked elements.
57414 * _.at(['a', 'b', 'c'], [0, 2]); // => ['a', 'c']
57416 * _.at(['barney', 'fred', 'pebbles'], 0, 2); // => ['barney', 'pebbles']
57418 var at = restParam(function(collection, props) {
57419 return baseAt(collection, baseFlatten(props));
57423 * Creates an object composed of keys generated from the results of running
57424 * each element of `collection` through `iteratee`. The corresponding value
57425 * of each key is the number of times the key was returned by `iteratee`.
57426 * The `iteratee` is bound to `thisArg` and invoked with three arguments:
57427 * (value, index|key, collection).
57429 * If a property name is provided for `iteratee` the created `_.property`
57430 * style callback returns the property value of the given element.
57432 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57433 * style callback returns `true` for elements that have a matching property
57434 * value, else `false`.
57436 * If an object is provided for `iteratee` the created `_.matches` style
57437 * callback returns `true` for elements that have the properties of the
57438 * given object, else `false`.
57442 * @category Collection
57443 * @param {Array|Object|string}
57444 * collection The collection to iterate over.
57445 * @param {Function|Object|string}
57446 * [iteratee=_.identity] The function invoked per iteration.
57448 * [thisArg] The `this` binding of `iteratee`.
57449 * @returns {Object} Returns the composed aggregate object.
57452 * _.countBy([4.3, 6.1, 6.4], function(n) { return Math.floor(n); }); // => {
57455 * _.countBy([4.3, 6.1, 6.4], function(n) { return this.floor(n); }, Math); // => {
57458 * _.countBy(['one', 'two', 'three'], 'length'); // => { '3': 2, '5': 1 }
57460 var countBy = createAggregator(function(result, value, key) {
57461 hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);
57465 * Checks if `predicate` returns truthy for **all** elements of
57466 * `collection`. The predicate is bound to `thisArg` and invoked with three
57467 * arguments: (value, index|key, collection).
57469 * If a property name is provided for `predicate` the created `_.property`
57470 * style callback returns the property value of the given element.
57472 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57473 * style callback returns `true` for elements that have a matching property
57474 * value, else `false`.
57476 * If an object is provided for `predicate` the created `_.matches` style
57477 * callback returns `true` for elements that have the properties of the
57478 * given object, else `false`.
57483 * @category Collection
57484 * @param {Array|Object|string}
57485 * collection The collection to iterate over.
57486 * @param {Function|Object|string}
57487 * [predicate=_.identity] The function invoked per iteration.
57489 * [thisArg] The `this` binding of `predicate`.
57490 * @returns {boolean} Returns `true` if all elements pass the predicate
57491 * check, else `false`.
57494 * _.every([true, 1, null, 'yes'], Boolean); // => false
57496 * var users = [ { 'user': 'barney', 'active': false }, { 'user': 'fred',
57497 * 'active': false } ];
57498 * // using the `_.matches` callback shorthand _.every(users, { 'user':
57499 * 'barney', 'active': false }); // => false
57500 * // using the `_.matchesProperty` callback shorthand _.every(users,
57501 * 'active', false); // => true
57502 * // using the `_.property` callback shorthand _.every(users, 'active'); // =>
57505 function every(collection, predicate, thisArg) {
57506 var func = isArray(collection) ? arrayEvery : baseEvery;
57507 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
57508 predicate = undefined;
57510 if (typeof predicate != 'function' || thisArg !== undefined) {
57511 predicate = getCallback(predicate, thisArg, 3);
57513 return func(collection, predicate);
57517 * Iterates over elements of `collection`, returning an array of all
57518 * elements `predicate` returns truthy for. The predicate is bound to
57519 * `thisArg` and invoked with three arguments: (value, index|key,
57522 * If a property name is provided for `predicate` the created `_.property`
57523 * style callback returns the property value of the given element.
57525 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57526 * style callback returns `true` for elements that have a matching property
57527 * value, else `false`.
57529 * If an object is provided for `predicate` the created `_.matches` style
57530 * callback returns `true` for elements that have the properties of the
57531 * given object, else `false`.
57536 * @category Collection
57537 * @param {Array|Object|string}
57538 * collection The collection to iterate over.
57539 * @param {Function|Object|string}
57540 * [predicate=_.identity] The function invoked per iteration.
57542 * [thisArg] The `this` binding of `predicate`.
57543 * @returns {Array} Returns the new filtered array.
57546 * _.filter([4, 5, 6], function(n) { return n % 2 == 0; }); // => [4, 6]
57548 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
57549 * 'fred', 'age': 40, 'active': false } ];
57550 * // using the `_.matches` callback shorthand _.pluck(_.filter(users, {
57551 * 'age': 36, 'active': true }), 'user'); // => ['barney']
57552 * // using the `_.matchesProperty` callback shorthand
57553 * _.pluck(_.filter(users, 'active', false), 'user'); // => ['fred']
57554 * // using the `_.property` callback shorthand _.pluck(_.filter(users,
57555 * 'active'), 'user'); // => ['barney']
57557 function filter(collection, predicate, thisArg) {
57558 var func = isArray(collection) ? arrayFilter : baseFilter;
57559 predicate = getCallback(predicate, thisArg, 3);
57560 return func(collection, predicate);
57564 * Iterates over elements of `collection`, returning the first element
57565 * `predicate` returns truthy for. The predicate is bound to `thisArg` and
57566 * invoked with three arguments: (value, index|key, collection).
57568 * If a property name is provided for `predicate` the created `_.property`
57569 * style callback returns the property value of the given element.
57571 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57572 * style callback returns `true` for elements that have a matching property
57573 * value, else `false`.
57575 * If an object is provided for `predicate` the created `_.matches` style
57576 * callback returns `true` for elements that have the properties of the
57577 * given object, else `false`.
57582 * @category Collection
57583 * @param {Array|Object|string}
57584 * collection The collection to search.
57585 * @param {Function|Object|string}
57586 * [predicate=_.identity] The function invoked per iteration.
57588 * [thisArg] The `this` binding of `predicate`.
57589 * @returns {*} Returns the matched element, else `undefined`.
57592 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
57593 * 'fred', 'age': 40, 'active': false }, { 'user': 'pebbles', 'age': 1,
57594 * 'active': true } ];
57596 * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); // =>
57598 * // using the `_.matches` callback shorthand _.result(_.find(users, {
57599 * 'age': 1, 'active': true }), 'user'); // => 'pebbles'
57600 * // using the `_.matchesProperty` callback shorthand
57601 * _.result(_.find(users, 'active', false), 'user'); // => 'fred'
57602 * // using the `_.property` callback shorthand _.result(_.find(users,
57603 * 'active'), 'user'); // => 'barney'
57605 var find = createFind(baseEach);
57608 * This method is like `_.find` except that it iterates over elements of
57609 * `collection` from right to left.
57613 * @category Collection
57614 * @param {Array|Object|string}
57615 * collection The collection to search.
57616 * @param {Function|Object|string}
57617 * [predicate=_.identity] The function invoked per iteration.
57619 * [thisArg] The `this` binding of `predicate`.
57620 * @returns {*} Returns the matched element, else `undefined`.
57623 * _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; }); // => 3
57625 var findLast = createFind(baseEachRight, true);
57628 * Performs a deep comparison between each element in `collection` and the
57629 * source object, returning the first element that has equivalent property
57632 * **Note:** This method supports comparing arrays, booleans, `Date`
57633 * objects, numbers, `Object` objects, regexes, and strings. Objects are
57634 * compared by their own, not inherited, enumerable properties. For
57635 * comparing a single own or inherited property value see
57636 * `_.matchesProperty`.
57640 * @category Collection
57641 * @param {Array|Object|string}
57642 * collection The collection to search.
57644 * source The object of property values to match.
57645 * @returns {*} Returns the matched element, else `undefined`.
57648 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
57649 * 'fred', 'age': 40, 'active': false } ];
57651 * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); // =>
57654 * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); // =>
57657 function findWhere(collection, source) {
57658 return find(collection, baseMatches(source));
57662 * Iterates over elements of `collection` invoking `iteratee` for each
57663 * element. The `iteratee` is bound to `thisArg` and invoked with three
57664 * arguments: (value, index|key, collection). Iteratee functions may exit
57665 * iteration early by explicitly returning `false`.
57667 * **Note:** As with other "Collections" methods, objects with a "length"
57668 * property are iterated like arrays. To avoid this behavior `_.forIn` or
57669 * `_.forOwn` may be used for object iteration.
57674 * @category Collection
57675 * @param {Array|Object|string}
57676 * collection The collection to iterate over.
57677 * @param {Function}
57678 * [iteratee=_.identity] The function invoked per iteration.
57680 * [thisArg] The `this` binding of `iteratee`.
57681 * @returns {Array|Object|string} Returns `collection`.
57684 * _([1, 2]).forEach(function(n) { console.log(n); }).value(); // => logs
57685 * each value from left to right and returns the array
57687 * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { console.log(n, key); }); // =>
57688 * logs each value-key pair and returns the object (iteration order is not
57691 var forEach = createForEach(arrayEach, baseEach);
57694 * This method is like `_.forEach` except that it iterates over elements of
57695 * `collection` from right to left.
57700 * @category Collection
57701 * @param {Array|Object|string}
57702 * collection The collection to iterate over.
57703 * @param {Function}
57704 * [iteratee=_.identity] The function invoked per iteration.
57706 * [thisArg] The `this` binding of `iteratee`.
57707 * @returns {Array|Object|string} Returns `collection`.
57710 * _([1, 2]).forEachRight(function(n) { console.log(n); }).value(); // =>
57711 * logs each value from right to left and returns the array
57713 var forEachRight = createForEach(arrayEachRight, baseEachRight);
57716 * Creates an object composed of keys generated from the results of running
57717 * each element of `collection` through `iteratee`. The corresponding value
57718 * of each key is an array of the elements responsible for generating the
57719 * key. The `iteratee` is bound to `thisArg` and invoked with three
57720 * arguments: (value, index|key, collection).
57722 * If a property name is provided for `iteratee` the created `_.property`
57723 * style callback returns the property value of the given element.
57725 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57726 * style callback returns `true` for elements that have a matching property
57727 * value, else `false`.
57729 * If an object is provided for `iteratee` the created `_.matches` style
57730 * callback returns `true` for elements that have the properties of the
57731 * given object, else `false`.
57735 * @category Collection
57736 * @param {Array|Object|string}
57737 * collection The collection to iterate over.
57738 * @param {Function|Object|string}
57739 * [iteratee=_.identity] The function invoked per iteration.
57741 * [thisArg] The `this` binding of `iteratee`.
57742 * @returns {Object} Returns the composed aggregate object.
57745 * _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); }); // => {
57746 * '4': [4.2], '6': [6.1, 6.4] }
57748 * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); // => {
57749 * '4': [4.2], '6': [6.1, 6.4] }
57750 * // using the `_.property` callback shorthand _.groupBy(['one', 'two',
57751 * 'three'], 'length'); // => { '3': ['one', 'two'], '5': ['three'] }
57753 var groupBy = createAggregator(function(result, value, key) {
57754 if (hasOwnProperty.call(result, key)) {
57755 result[key].push(value);
57757 result[key] = [value];
57762 * Checks if `value` is in `collection` using
57763 * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
57764 * for equality comparisons. If `fromIndex` is negative, it is used as the
57765 * offset from the end of `collection`.
57769 * @alias contains, include
57770 * @category Collection
57771 * @param {Array|Object|string}
57772 * collection The collection to search.
57774 * target The value to search for.
57776 * [fromIndex=0] The index to search from.
57777 * @param- {Object} [guard] Enables use as a callback for functions like
57779 * @returns {boolean} Returns `true` if a matching element is found, else
57783 * _.includes([1, 2, 3], 1); // => true
57785 * _.includes([1, 2, 3], 1, 2); // => false
57787 * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); // => true
57789 * _.includes('pebbles', 'eb'); // => true
57791 function includes(collection, target, fromIndex, guard) {
57792 var length = collection ? getLength(collection) : 0;
57793 if (!isLength(length)) {
57794 collection = values(collection);
57795 length = collection.length;
57797 if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
57800 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
57802 return (typeof collection == 'string' || !isArray(collection) && isString(collection)) ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) : (!!length && getIndexOf(collection, target, fromIndex) > -1);
57806 * Creates an object composed of keys generated from the results of running
57807 * each element of `collection` through `iteratee`. The corresponding value
57808 * of each key is the last element responsible for generating the key. The
57809 * iteratee function is bound to `thisArg` and invoked with three arguments:
57810 * (value, index|key, collection).
57812 * If a property name is provided for `iteratee` the created `_.property`
57813 * style callback returns the property value of the given element.
57815 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57816 * style callback returns `true` for elements that have a matching property
57817 * value, else `false`.
57819 * If an object is provided for `iteratee` the created `_.matches` style
57820 * callback returns `true` for elements that have the properties of the
57821 * given object, else `false`.
57825 * @category Collection
57826 * @param {Array|Object|string}
57827 * collection The collection to iterate over.
57828 * @param {Function|Object|string}
57829 * [iteratee=_.identity] The function invoked per iteration.
57831 * [thisArg] The `this` binding of `iteratee`.
57832 * @returns {Object} Returns the composed aggregate object.
57835 * var keyData = [ { 'dir': 'left', 'code': 97 }, { 'dir': 'right', 'code':
57838 * _.indexBy(keyData, 'dir'); // => { 'left': { 'dir': 'left', 'code': 97 },
57839 * 'right': { 'dir': 'right', 'code': 100 } }
57841 * _.indexBy(keyData, function(object) { return
57842 * String.fromCharCode(object.code); }); // => { 'a': { 'dir': 'left',
57843 * 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
57845 * _.indexBy(keyData, function(object) { return
57846 * this.fromCharCode(object.code); }, String); // => { 'a': { 'dir': 'left',
57847 * 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
57849 var indexBy = createAggregator(function(result, value, key) {
57850 result[key] = value;
57854 * Invokes the method at `path` of each element in `collection`, returning
57855 * an array of the results of each invoked method. Any additional arguments
57856 * are provided to each invoked method. If `methodName` is a function it is
57857 * invoked for, and `this` bound to, each element in `collection`.
57861 * @category Collection
57862 * @param {Array|Object|string}
57863 * collection The collection to iterate over.
57864 * @param {Array|Function|string}
57865 * path The path of the method to invoke or the function invoked
57868 * [args] The arguments to invoke the method with.
57869 * @returns {Array} Returns the array of results.
57872 * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); // => [[1, 5, 7], [1, 2, 3]]
57874 * _.invoke([123, 456], String.prototype.split, ''); // => [['1', '2', '3'],
57877 var invoke = restParam(function(collection, path, args) {
57879 isFunc = typeof path == 'function',
57880 isProp = isKey(path),
57881 result = isArrayLike(collection) ? Array(collection.length) : [];
57883 baseEach(collection, function(value) {
57884 var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
57885 result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
57891 * Creates an array of values by running each element in `collection`
57892 * through `iteratee`. The `iteratee` is bound to `thisArg` and invoked with
57893 * three arguments: (value, index|key, collection).
57895 * If a property name is provided for `iteratee` the created `_.property`
57896 * style callback returns the property value of the given element.
57898 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57899 * style callback returns `true` for elements that have a matching property
57900 * value, else `false`.
57902 * If an object is provided for `iteratee` the created `_.matches` style
57903 * callback returns `true` for elements that have the properties of the
57904 * given object, else `false`.
57906 * Many lodash methods are guarded to work as iteratees for methods like
57907 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
57909 * The guarded methods are: `ary`, `callback`, `chunk`, `clone`, `create`,
57910 * `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, `flatten`,
57911 * `invert`, `max`, `min`, `parseInt`, `slice`, `sortBy`, `take`,
57912 * `takeRight`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
57913 * `random`, `range`, `sample`, `some`, `sum`, `uniq`, and `words`
57918 * @category Collection
57919 * @param {Array|Object|string}
57920 * collection The collection to iterate over.
57921 * @param {Function|Object|string}
57922 * [iteratee=_.identity] The function invoked per iteration.
57924 * [thisArg] The `this` binding of `iteratee`.
57925 * @returns {Array} Returns the new mapped array.
57928 * function timesThree(n) { return n * 3; }
57930 * _.map([1, 2], timesThree); // => [3, 6]
57932 * _.map({ 'a': 1, 'b': 2 }, timesThree); // => [3, 6] (iteration order is
57935 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
57936 * // using the `_.property` callback shorthand _.map(users, 'user'); // =>
57937 * ['barney', 'fred']
57939 function map(collection, iteratee, thisArg) {
57940 var func = isArray(collection) ? arrayMap : baseMap;
57941 iteratee = getCallback(iteratee, thisArg, 3);
57942 return func(collection, iteratee);
57946 * Creates an array of elements split into two groups, the first of which
57947 * contains elements `predicate` returns truthy for, while the second of
57948 * which contains elements `predicate` returns falsey for. The predicate is
57949 * bound to `thisArg` and invoked with three arguments: (value, index|key,
57952 * If a property name is provided for `predicate` the created `_.property`
57953 * style callback returns the property value of the given element.
57955 * If a value is also provided for `thisArg` the created `_.matchesProperty`
57956 * style callback returns `true` for elements that have a matching property
57957 * value, else `false`.
57959 * If an object is provided for `predicate` the created `_.matches` style
57960 * callback returns `true` for elements that have the properties of the
57961 * given object, else `false`.
57965 * @category Collection
57966 * @param {Array|Object|string}
57967 * collection The collection to iterate over.
57968 * @param {Function|Object|string}
57969 * [predicate=_.identity] The function invoked per iteration.
57971 * [thisArg] The `this` binding of `predicate`.
57972 * @returns {Array} Returns the array of grouped elements.
57975 * _.partition([1, 2, 3], function(n) { return n % 2; }); // => [[1, 3],
57978 * _.partition([1.2, 2.3, 3.4], function(n) { return this.floor(n) % 2; },
57979 * Math); // => [[1.2, 3.4], [2.3]]
57981 * var users = [ { 'user': 'barney', 'age': 36, 'active': false }, { 'user':
57982 * 'fred', 'age': 40, 'active': true }, { 'user': 'pebbles', 'age': 1,
57983 * 'active': false } ];
57985 * var mapper = function(array) { return _.pluck(array, 'user'); };
57986 * // using the `_.matches` callback shorthand _.map(_.partition(users, {
57987 * 'age': 1, 'active': false }), mapper); // => [['pebbles'], ['barney',
57989 * // using the `_.matchesProperty` callback shorthand
57990 * _.map(_.partition(users, 'active', false), mapper); // => [['barney',
57991 * 'pebbles'], ['fred']]
57992 * // using the `_.property` callback shorthand _.map(_.partition(users,
57993 * 'active'), mapper); // => [['fred'], ['barney', 'pebbles']]
57995 var partition = createAggregator(function(result, value, key) {
57996 result[key ? 0 : 1].push(value);
58005 * Gets the property value of `path` from all elements in `collection`.
58009 * @category Collection
58010 * @param {Array|Object|string}
58011 * collection The collection to iterate over.
58012 * @param {Array|string}
58013 * path The path of the property to pluck.
58014 * @returns {Array} Returns the property values.
58017 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
58020 * _.pluck(users, 'user'); // => ['barney', 'fred']
58022 * var userIndex = _.indexBy(users, 'user'); _.pluck(userIndex, 'age'); // =>
58023 * [36, 40] (iteration order is not guaranteed)
58025 function pluck(collection, path) {
58026 return map(collection, property(path));
58030 * Reduces `collection` to a value which is the accumulated result of
58031 * running each element in `collection` through `iteratee`, where each
58032 * successive invocation is supplied the return value of the previous. If
58033 * `accumulator` is not provided the first element of `collection` is used
58034 * as the initial value. The `iteratee` is bound to `thisArg` and invoked
58035 * with four arguments: (accumulator, value, index|key, collection).
58037 * Many lodash methods are guarded to work as iteratees for methods like
58038 * `_.reduce`, `_.reduceRight`, and `_.transform`.
58040 * The guarded methods are: `assign`, `defaults`, `defaultsDeep`,
58041 * `includes`, `merge`, `sortByAll`, and `sortByOrder`
58045 * @alias foldl, inject
58046 * @category Collection
58047 * @param {Array|Object|string}
58048 * collection The collection to iterate over.
58049 * @param {Function}
58050 * [iteratee=_.identity] The function invoked per iteration.
58052 * [accumulator] The initial value.
58054 * [thisArg] The `this` binding of `iteratee`.
58055 * @returns {*} Returns the accumulated value.
58058 * _.reduce([1, 2], function(total, n) { return total + n; }); // => 3
58060 * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { result[key] = n *
58061 * 3; return result; }, {}); // => { 'a': 3, 'b': 6 } (iteration order is
58064 var reduce = createReduce(arrayReduce, baseEach);
58067 * This method is like `_.reduce` except that it iterates over elements of
58068 * `collection` from right to left.
58073 * @category Collection
58074 * @param {Array|Object|string}
58075 * collection The collection to iterate over.
58076 * @param {Function}
58077 * [iteratee=_.identity] The function invoked per iteration.
58079 * [accumulator] The initial value.
58081 * [thisArg] The `this` binding of `iteratee`.
58082 * @returns {*} Returns the accumulated value.
58085 * var array = [[0, 1], [2, 3], [4, 5]];
58087 * _.reduceRight(array, function(flattened, other) { return
58088 * flattened.concat(other); }, []); // => [4, 5, 2, 3, 0, 1]
58090 var reduceRight = createReduce(arrayReduceRight, baseEachRight);
58093 * The opposite of `_.filter`; this method returns the elements of
58094 * `collection` that `predicate` does **not** return truthy for.
58098 * @category Collection
58099 * @param {Array|Object|string}
58100 * collection The collection to iterate over.
58101 * @param {Function|Object|string}
58102 * [predicate=_.identity] The function invoked per iteration.
58104 * [thisArg] The `this` binding of `predicate`.
58105 * @returns {Array} Returns the new filtered array.
58108 * _.reject([1, 2, 3, 4], function(n) { return n % 2 == 0; }); // => [1, 3]
58110 * var users = [ { 'user': 'barney', 'age': 36, 'active': false }, { 'user':
58111 * 'fred', 'age': 40, 'active': true } ];
58112 * // using the `_.matches` callback shorthand _.pluck(_.reject(users, {
58113 * 'age': 40, 'active': true }), 'user'); // => ['barney']
58114 * // using the `_.matchesProperty` callback shorthand
58115 * _.pluck(_.reject(users, 'active', false), 'user'); // => ['fred']
58116 * // using the `_.property` callback shorthand _.pluck(_.reject(users,
58117 * 'active'), 'user'); // => ['barney']
58119 function reject(collection, predicate, thisArg) {
58120 var func = isArray(collection) ? arrayFilter : baseFilter;
58121 predicate = getCallback(predicate, thisArg, 3);
58122 return func(collection, function(value, index, collection) {
58123 return !predicate(value, index, collection);
58128 * Gets a random element or `n` random elements from a collection.
58132 * @category Collection
58133 * @param {Array|Object|string}
58134 * collection The collection to sample.
58136 * [n] The number of elements to sample.
58137 * @param- {Object} [guard] Enables use as a callback for functions like
58139 * @returns {*} Returns the random sample(s).
58142 * _.sample([1, 2, 3, 4]); // => 2
58144 * _.sample([1, 2, 3, 4], 2); // => [3, 1]
58146 function sample(collection, n, guard) {
58147 if (guard ? isIterateeCall(collection, n, guard) : n == null) {
58148 collection = toIterable(collection);
58149 var length = collection.length;
58150 return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
58153 result = toArray(collection),
58154 length = result.length,
58155 lastIndex = length - 1;
58157 n = nativeMin(n < 0 ? 0 : (+n || 0), length);
58158 while (++index < n) {
58159 var rand = baseRandom(index, lastIndex),
58160 value = result[rand];
58162 result[rand] = result[index];
58163 result[index] = value;
58170 * Creates an array of shuffled values, using a version of the [Fisher-Yates
58171 * shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
58175 * @category Collection
58176 * @param {Array|Object|string}
58177 * collection The collection to shuffle.
58178 * @returns {Array} Returns the new shuffled array.
58181 * _.shuffle([1, 2, 3, 4]); // => [4, 1, 3, 2]
58183 function shuffle(collection) {
58184 return sample(collection, POSITIVE_INFINITY);
58188 * Gets the size of `collection` by returning its length for array-like
58189 * values or the number of own enumerable properties for objects.
58193 * @category Collection
58194 * @param {Array|Object|string}
58195 * collection The collection to inspect.
58196 * @returns {number} Returns the size of `collection`.
58199 * _.size([1, 2, 3]); // => 3
58201 * _.size({ 'a': 1, 'b': 2 }); // => 2
58203 * _.size('pebbles'); // => 7
58205 function size(collection) {
58206 var length = collection ? getLength(collection) : 0;
58207 return isLength(length) ? length : keys(collection).length;
58211 * Checks if `predicate` returns truthy for **any** element of `collection`.
58212 * The function returns as soon as it finds a passing value and does not
58213 * iterate over the entire collection. The predicate is bound to `thisArg`
58214 * and invoked with three arguments: (value, index|key, collection).
58216 * If a property name is provided for `predicate` the created `_.property`
58217 * style callback returns the property value of the given element.
58219 * If a value is also provided for `thisArg` the created `_.matchesProperty`
58220 * style callback returns `true` for elements that have a matching property
58221 * value, else `false`.
58223 * If an object is provided for `predicate` the created `_.matches` style
58224 * callback returns `true` for elements that have the properties of the
58225 * given object, else `false`.
58230 * @category Collection
58231 * @param {Array|Object|string}
58232 * collection The collection to iterate over.
58233 * @param {Function|Object|string}
58234 * [predicate=_.identity] The function invoked per iteration.
58236 * [thisArg] The `this` binding of `predicate`.
58237 * @returns {boolean} Returns `true` if any element passes the predicate
58238 * check, else `false`.
58241 * _.some([null, 0, 'yes', false], Boolean); // => true
58243 * var users = [ { 'user': 'barney', 'active': true }, { 'user': 'fred',
58244 * 'active': false } ];
58245 * // using the `_.matches` callback shorthand _.some(users, { 'user':
58246 * 'barney', 'active': false }); // => false
58247 * // using the `_.matchesProperty` callback shorthand _.some(users,
58248 * 'active', false); // => true
58249 * // using the `_.property` callback shorthand _.some(users, 'active'); // =>
58252 function some(collection, predicate, thisArg) {
58253 var func = isArray(collection) ? arraySome : baseSome;
58254 if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
58255 predicate = undefined;
58257 if (typeof predicate != 'function' || thisArg !== undefined) {
58258 predicate = getCallback(predicate, thisArg, 3);
58260 return func(collection, predicate);
58264 * Creates an array of elements, sorted in ascending order by the results of
58265 * running each element in a collection through `iteratee`. This method
58266 * performs a stable sort, that is, it preserves the original sort order of
58267 * equal elements. The `iteratee` is bound to `thisArg` and invoked with
58268 * three arguments: (value, index|key, collection).
58270 * If a property name is provided for `iteratee` the created `_.property`
58271 * style callback returns the property value of the given element.
58273 * If a value is also provided for `thisArg` the created `_.matchesProperty`
58274 * style callback returns `true` for elements that have a matching property
58275 * value, else `false`.
58277 * If an object is provided for `iteratee` the created `_.matches` style
58278 * callback returns `true` for elements that have the properties of the
58279 * given object, else `false`.
58283 * @category Collection
58284 * @param {Array|Object|string}
58285 * collection The collection to iterate over.
58286 * @param {Function|Object|string}
58287 * [iteratee=_.identity] The function invoked per iteration.
58289 * [thisArg] The `this` binding of `iteratee`.
58290 * @returns {Array} Returns the new sorted array.
58293 * _.sortBy([1, 2, 3], function(n) { return Math.sin(n); }); // => [3, 1, 2]
58295 * _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math); // => [3,
58298 * var users = [ { 'user': 'fred' }, { 'user': 'pebbles' }, { 'user':
58300 * // using the `_.property` callback shorthand _.pluck(_.sortBy(users,
58301 * 'user'), 'user'); // => ['barney', 'fred', 'pebbles']
58303 function sortBy(collection, iteratee, thisArg) {
58304 if (collection == null) {
58307 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
58308 iteratee = undefined;
58311 iteratee = getCallback(iteratee, thisArg, 3);
58313 var result = baseMap(collection, function(value, key, collection) {
58315 'criteria': iteratee(value, key, collection),
58320 return baseSortBy(result, compareAscending);
58324 * This method is like `_.sortBy` except that it can sort by multiple
58325 * iteratees or property names.
58327 * If a property name is provided for an iteratee the created `_.property`
58328 * style callback returns the property value of the given element.
58330 * If an object is provided for an iteratee the created `_.matches` style
58331 * callback returns `true` for elements that have the properties of the
58332 * given object, else `false`.
58336 * @category Collection
58337 * @param {Array|Object|string}
58338 * collection The collection to iterate over.
58339 * @param {...(Function|Function[]|Object|Object[]|string|string[])}
58340 * iteratees The iteratees to sort by, specified as individual
58341 * values or arrays of values.
58342 * @returns {Array} Returns the new sorted array.
58345 * var users = [ { 'user': 'fred', 'age': 48 }, { 'user': 'barney', 'age':
58346 * 36 }, { 'user': 'fred', 'age': 42 }, { 'user': 'barney', 'age': 34 } ];
58348 * _.map(_.sortByAll(users, ['user', 'age']), _.values); // => [['barney',
58349 * 34], ['barney', 36], ['fred', 42], ['fred', 48]]
58351 * _.map(_.sortByAll(users, 'user', function(chr) { return
58352 * Math.floor(chr.age / 10); }), _.values); // => [['barney', 36],
58353 * ['barney', 34], ['fred', 48], ['fred', 42]]
58355 var sortByAll = restParam(function(collection, iteratees) {
58356 if (collection == null) {
58359 var guard = iteratees[2];
58360 if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {
58361 iteratees.length = 1;
58363 return baseSortByOrder(collection, baseFlatten(iteratees), []);
58367 * This method is like `_.sortByAll` except that it allows specifying the
58368 * sort orders of the iteratees to sort by. If `orders` is unspecified, all
58369 * values are sorted in ascending order. Otherwise, a value is sorted in
58370 * ascending order if its corresponding order is "asc", and descending if
58373 * If a property name is provided for an iteratee the created `_.property`
58374 * style callback returns the property value of the given element.
58376 * If an object is provided for an iteratee the created `_.matches` style
58377 * callback returns `true` for elements that have the properties of the
58378 * given object, else `false`.
58382 * @category Collection
58383 * @param {Array|Object|string}
58384 * collection The collection to iterate over.
58385 * @param {Function[]|Object[]|string[]}
58386 * iteratees The iteratees to sort by.
58387 * @param {boolean[]}
58388 * [orders] The sort orders of `iteratees`.
58389 * @param- {Object} [guard] Enables use as a callback for functions like
58391 * @returns {Array} Returns the new sorted array.
58394 * var users = [ { 'user': 'fred', 'age': 48 }, { 'user': 'barney', 'age':
58395 * 34 }, { 'user': 'fred', 'age': 42 }, { 'user': 'barney', 'age': 36 } ];
58396 * // sort by `user` in ascending order and by `age` in descending order
58397 * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values); // =>
58398 * [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
58400 function sortByOrder(collection, iteratees, orders, guard) {
58401 if (collection == null) {
58404 if (guard && isIterateeCall(iteratees, orders, guard)) {
58405 orders = undefined;
58407 if (!isArray(iteratees)) {
58408 iteratees = iteratees == null ? [] : [iteratees];
58410 if (!isArray(orders)) {
58411 orders = orders == null ? [] : [orders];
58413 return baseSortByOrder(collection, iteratees, orders);
58417 * Performs a deep comparison between each element in `collection` and the
58418 * source object, returning an array of all elements that have equivalent
58421 * **Note:** This method supports comparing arrays, booleans, `Date`
58422 * objects, numbers, `Object` objects, regexes, and strings. Objects are
58423 * compared by their own, not inherited, enumerable properties. For
58424 * comparing a single own or inherited property value see
58425 * `_.matchesProperty`.
58429 * @category Collection
58430 * @param {Array|Object|string}
58431 * collection The collection to search.
58433 * source The object of property values to match.
58434 * @returns {Array} Returns the new filtered array.
58437 * var users = [ { 'user': 'barney', 'age': 36, 'active': false, 'pets':
58438 * ['hoppy'] }, { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby
58439 * puss', 'dino'] } ];
58441 * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); // =>
58444 * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); // => ['fred']
58446 function where(collection, source) {
58447 return filter(collection, baseMatches(source));
58450 /*------------------------------------------------------------------------*/
58453 * Gets the number of milliseconds that have elapsed since the Unix epoch (1
58454 * January 1970 00:00:00 UTC).
58461 * _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now()); // =>
58462 * logs the number of milliseconds it took for the deferred function to be
58465 var now = nativeNow || function() {
58466 return new Date().getTime();
58469 /*------------------------------------------------------------------------*/
58472 * The opposite of `_.before`; this method creates a function that invokes
58473 * `func` once it is called `n` or more times.
58477 * @category Function
58479 * n The number of calls before `func` is invoked.
58480 * @param {Function}
58481 * func The function to restrict.
58482 * @returns {Function} Returns the new restricted function.
58485 * var saves = ['profile', 'settings'];
58487 * var done = _.after(saves.length, function() { console.log('done
58490 * _.forEach(saves, function(type) { asyncSave({ 'type': type, 'complete':
58491 * done }); }); // => logs 'done saving!' after the two async saves have
58494 function after(n, func) {
58495 if (typeof func != 'function') {
58496 if (typeof n == 'function') {
58501 throw new TypeError(FUNC_ERROR_TEXT);
58504 n = nativeIsFinite(n = +n) ? n : 0;
58505 return function() {
58507 return func.apply(this, arguments);
58513 * Creates a function that accepts up to `n` arguments ignoring any
58514 * additional arguments.
58518 * @category Function
58519 * @param {Function}
58520 * func The function to cap arguments for.
58522 * [n=func.length] The arity cap.
58523 * @param- {Object} [guard] Enables use as a callback for functions like
58525 * @returns {Function} Returns the new function.
58528 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); // => [6, 8, 10]
58530 function ary(func, n, guard) {
58531 if (guard && isIterateeCall(func, n, guard)) {
58534 n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
58535 return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
58539 * Creates a function that invokes `func`, with the `this` binding and
58540 * arguments of the created function, while it is called less than `n`
58541 * times. Subsequent calls to the created function return the result of the
58542 * last `func` invocation.
58546 * @category Function
58548 * n The number of calls at which `func` is no longer invoked.
58549 * @param {Function}
58550 * func The function to restrict.
58551 * @returns {Function} Returns the new restricted function.
58554 * jQuery('#add').on('click', _.before(5, addContactToList)); // => allows
58555 * adding up to 4 contacts to the list
58557 function before(n, func) {
58559 if (typeof func != 'function') {
58560 if (typeof n == 'function') {
58565 throw new TypeError(FUNC_ERROR_TEXT);
58568 return function() {
58570 result = func.apply(this, arguments);
58580 * Creates a function that invokes `func` with the `this` binding of
58581 * `thisArg` and prepends any additional `_.bind` arguments to those
58582 * provided to the bound function.
58584 * The `_.bind.placeholder` value, which defaults to `_` in monolithic
58585 * builds, may be used as a placeholder for partially applied arguments.
58587 * **Note:** Unlike native `Function#bind` this method does not set the
58588 * "length" property of bound functions.
58592 * @category Function
58593 * @param {Function}
58594 * func The function to bind.
58596 * thisArg The `this` binding of `func`.
58598 * [partials] The arguments to be partially applied.
58599 * @returns {Function} Returns the new bound function.
58602 * var greet = function(greeting, punctuation) { return greeting + ' ' +
58603 * this.user + punctuation; };
58605 * var object = { 'user': 'fred' };
58607 * var bound = _.bind(greet, object, 'hi'); bound('!'); // => 'hi fred!'
58608 * // using placeholders var bound = _.bind(greet, object, _, '!');
58609 * bound('hi'); // => 'hi fred!'
58611 var bind = restParam(function(func, thisArg, partials) {
58612 var bitmask = BIND_FLAG;
58613 if (partials.length) {
58614 var holders = replaceHolders(partials, bind.placeholder);
58615 bitmask |= PARTIAL_FLAG;
58617 return createWrapper(func, bitmask, thisArg, partials, holders);
58621 * Binds methods of an object to the object itself, overwriting the existing
58622 * method. Method names may be specified as individual arguments or as
58623 * arrays of method names. If no method names are provided all enumerable
58624 * function properties, own and inherited, of `object` are bound.
58626 * **Note:** This method does not set the "length" property of bound
58631 * @category Function
58633 * object The object to bind and assign the bound methods to.
58634 * @param {...(string|string[])}
58635 * [methodNames] The object method names to bind, specified as
58636 * individual method names or arrays of method names.
58637 * @returns {Object} Returns `object`.
58640 * var view = { 'label': 'docs', 'onClick': function() {
58641 * console.log('clicked ' + this.label); } };
58643 * _.bindAll(view); jQuery('#docs').on('click', view.onClick); // => logs
58644 * 'clicked docs' when the element is clicked
58646 var bindAll = restParam(function(object, methodNames) {
58647 methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);
58650 length = methodNames.length;
58652 while (++index < length) {
58653 var key = methodNames[index];
58654 object[key] = createWrapper(object[key], BIND_FLAG, object);
58660 * Creates a function that invokes the method at `object[key]` and prepends
58661 * any additional `_.bindKey` arguments to those provided to the bound
58664 * This method differs from `_.bind` by allowing bound functions to
58665 * reference methods that may be redefined or don't yet exist. See [Peter
58667 * article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
58668 * for more details.
58670 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
58671 * builds, may be used as a placeholder for partially applied arguments.
58675 * @category Function
58677 * object The object the method belongs to.
58679 * key The key of the method.
58681 * [partials] The arguments to be partially applied.
58682 * @returns {Function} Returns the new bound function.
58685 * var object = { 'user': 'fred', 'greet': function(greeting, punctuation) {
58686 * return greeting + ' ' + this.user + punctuation; } };
58688 * var bound = _.bindKey(object, 'greet', 'hi'); bound('!'); // => 'hi
58691 * object.greet = function(greeting, punctuation) { return greeting + 'ya ' +
58692 * this.user + punctuation; };
58694 * bound('!'); // => 'hiya fred!'
58695 * // using placeholders var bound = _.bindKey(object, 'greet', _, '!');
58696 * bound('hi'); // => 'hiya fred!'
58698 var bindKey = restParam(function(object, key, partials) {
58699 var bitmask = BIND_FLAG | BIND_KEY_FLAG;
58700 if (partials.length) {
58701 var holders = replaceHolders(partials, bindKey.placeholder);
58702 bitmask |= PARTIAL_FLAG;
58704 return createWrapper(key, bitmask, object, partials, holders);
58708 * Creates a function that accepts one or more arguments of `func` that when
58709 * called either invokes `func` returning its result, if all `func`
58710 * arguments have been provided, or returns a function that accepts one or
58711 * more of the remaining `func` arguments, and so on. The arity of `func`
58712 * may be specified if `func.length` is not sufficient.
58714 * The `_.curry.placeholder` value, which defaults to `_` in monolithic
58715 * builds, may be used as a placeholder for provided arguments.
58717 * **Note:** This method does not set the "length" property of curried
58722 * @category Function
58723 * @param {Function}
58724 * func The function to curry.
58726 * [arity=func.length] The arity of `func`.
58727 * @param- {Object} [guard] Enables use as a callback for functions like
58729 * @returns {Function} Returns the new curried function.
58732 * var abc = function(a, b, c) { return [a, b, c]; };
58734 * var curried = _.curry(abc);
58736 * curried(1)(2)(3); // => [1, 2, 3]
58738 * curried(1, 2)(3); // => [1, 2, 3]
58740 * curried(1, 2, 3); // => [1, 2, 3]
58741 * // using placeholders curried(1)(_, 3)(2); // => [1, 2, 3]
58743 var curry = createCurry(CURRY_FLAG);
58746 * This method is like `_.curry` except that arguments are applied to `func`
58747 * in the manner of `_.partialRight` instead of `_.partial`.
58749 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
58750 * builds, may be used as a placeholder for provided arguments.
58752 * **Note:** This method does not set the "length" property of curried
58757 * @category Function
58758 * @param {Function}
58759 * func The function to curry.
58761 * [arity=func.length] The arity of `func`.
58762 * @param- {Object} [guard] Enables use as a callback for functions like
58764 * @returns {Function} Returns the new curried function.
58767 * var abc = function(a, b, c) { return [a, b, c]; };
58769 * var curried = _.curryRight(abc);
58771 * curried(3)(2)(1); // => [1, 2, 3]
58773 * curried(2, 3)(1); // => [1, 2, 3]
58775 * curried(1, 2, 3); // => [1, 2, 3]
58776 * // using placeholders curried(3)(1, _)(2); // => [1, 2, 3]
58778 var curryRight = createCurry(CURRY_RIGHT_FLAG);
58781 * Creates a debounced function that delays invoking `func` until after
58782 * `wait` milliseconds have elapsed since the last time the debounced
58783 * function was invoked. The debounced function comes with a `cancel` method
58784 * to cancel delayed invocations. Provide an options object to indicate that
58785 * `func` should be invoked on the leading and/or trailing edge of the
58786 * `wait` timeout. Subsequent calls to the debounced function return the
58787 * result of the last `func` invocation.
58789 * **Note:** If `leading` and `trailing` options are `true`, `func` is
58790 * invoked on the trailing edge of the timeout only if the the debounced
58791 * function is invoked more than once during the `wait` timeout.
58793 * See [David Corbacho's
58794 * article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
58795 * for details over the differences between `_.debounce` and `_.throttle`.
58799 * @category Function
58800 * @param {Function}
58801 * func The function to debounce.
58803 * [wait=0] The number of milliseconds to delay.
58805 * [options] The options object.
58807 * [options.leading=false] Specify invoking on the leading edge
58810 * [options.maxWait] The maximum time `func` is allowed to be
58811 * delayed before it is invoked.
58813 * [options.trailing=true] Specify invoking on the trailing edge
58815 * @returns {Function} Returns the new debounced function.
58817 * // avoid costly calculations while the window size is in flux
58818 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
58819 * // invoke `sendMail` when the click event is fired, debouncing
58820 * subsequent calls jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
58821 * 'leading': true, 'trailing': false }));
58822 * // ensure `batchLog` is invoked once after 1 second of debounced calls
58823 * var source = new EventSource('/stream'); jQuery(source).on('message',
58824 * _.debounce(batchLog, 250, { 'maxWait': 1000 }));
58825 * // cancel a debounced call var todoChanges = _.debounce(batchLog, 1000);
58826 * Object.observe(models.todo, todoChanges);
58828 * Object.observe(models, function(changes) { if (_.find(changes, { 'user':
58829 * 'todo', 'type': 'delete'})) { todoChanges.cancel(); } }, ['delete']);
58830 * // ...at some point `models.todo` is changed models.todo.completed =
58832 * // ...before 1 second has passed `models.todo` is deleted // which
58833 * cancels the debounced `todoChanges` call delete models.todo;
58835 function debounce(func, wait, options) {
58847 if (typeof func != 'function') {
58848 throw new TypeError(FUNC_ERROR_TEXT);
58850 wait = wait < 0 ? 0 : (+wait || 0);
58851 if (options === true) {
58852 var leading = true;
58854 } else if (isObject(options)) {
58855 leading = !!options.leading;
58856 maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
58857 trailing = 'trailing' in options ? !!options.trailing : trailing;
58860 function cancel() {
58862 clearTimeout(timeoutId);
58864 if (maxTimeoutId) {
58865 clearTimeout(maxTimeoutId);
58868 maxTimeoutId = timeoutId = trailingCall = undefined;
58871 function complete(isCalled, id) {
58875 maxTimeoutId = timeoutId = trailingCall = undefined;
58877 lastCalled = now();
58878 result = func.apply(thisArg, args);
58879 if (!timeoutId && !maxTimeoutId) {
58880 args = thisArg = undefined;
58885 function delayed() {
58886 var remaining = wait - (now() - stamp);
58887 if (remaining <= 0 || remaining > wait) {
58888 complete(trailingCall, maxTimeoutId);
58890 timeoutId = setTimeout(delayed, remaining);
58894 function maxDelayed() {
58895 complete(trailing, timeoutId);
58898 function debounced() {
58902 trailingCall = trailing && (timeoutId || !leading);
58904 if (maxWait === false) {
58905 var leadingCall = leading && !timeoutId;
58907 if (!maxTimeoutId && !leading) {
58908 lastCalled = stamp;
58910 var remaining = maxWait - (stamp - lastCalled),
58911 isCalled = remaining <= 0 || remaining > maxWait;
58914 if (maxTimeoutId) {
58915 maxTimeoutId = clearTimeout(maxTimeoutId);
58917 lastCalled = stamp;
58918 result = func.apply(thisArg, args);
58919 } else if (!maxTimeoutId) {
58920 maxTimeoutId = setTimeout(maxDelayed, remaining);
58923 if (isCalled && timeoutId) {
58924 timeoutId = clearTimeout(timeoutId);
58925 } else if (!timeoutId && wait !== maxWait) {
58926 timeoutId = setTimeout(delayed, wait);
58930 result = func.apply(thisArg, args);
58932 if (isCalled && !timeoutId && !maxTimeoutId) {
58933 args = thisArg = undefined;
58937 debounced.cancel = cancel;
58942 * Defers invoking the `func` until the current call stack has cleared. Any
58943 * additional arguments are provided to `func` when it is invoked.
58947 * @category Function
58948 * @param {Function}
58949 * func The function to defer.
58951 * [args] The arguments to invoke the function with.
58952 * @returns {number} Returns the timer id.
58955 * _.defer(function(text) { console.log(text); }, 'deferred'); // logs
58956 * 'deferred' after one or more milliseconds
58958 var defer = restParam(function(func, args) {
58959 return baseDelay(func, 1, args);
58963 * Invokes `func` after `wait` milliseconds. Any additional arguments are
58964 * provided to `func` when it is invoked.
58968 * @category Function
58969 * @param {Function}
58970 * func The function to delay.
58972 * wait The number of milliseconds to delay invocation.
58974 * [args] The arguments to invoke the function with.
58975 * @returns {number} Returns the timer id.
58978 * _.delay(function(text) { console.log(text); }, 1000, 'later'); // => logs
58979 * 'later' after one second
58981 var delay = restParam(function(func, wait, args) {
58982 return baseDelay(func, wait, args);
58986 * Creates a function that returns the result of invoking the provided
58987 * functions with the `this` binding of the created function, where each
58988 * successive invocation is supplied the return value of the previous.
58992 * @category Function
58993 * @param {...Function}
58994 * [funcs] Functions to invoke.
58995 * @returns {Function} Returns the new function.
58998 * function square(n) { return n * n; }
59000 * var addSquare = _.flow(_.add, square); addSquare(1, 2); // => 9
59002 var flow = createFlow();
59005 * This method is like `_.flow` except that it creates a function that
59006 * invokes the provided functions from right to left.
59010 * @alias backflow, compose
59011 * @category Function
59012 * @param {...Function}
59013 * [funcs] Functions to invoke.
59014 * @returns {Function} Returns the new function.
59017 * function square(n) { return n * n; }
59019 * var addSquare = _.flowRight(square, _.add); addSquare(1, 2); // => 9
59021 var flowRight = createFlow(true);
59024 * Creates a function that memoizes the result of `func`. If `resolver` is
59025 * provided it determines the cache key for storing the result based on the
59026 * arguments provided to the memoized function. By default, the first
59027 * argument provided to the memoized function is coerced to a string and
59028 * used as the cache key. The `func` is invoked with the `this` binding of
59029 * the memoized function.
59031 * **Note:** The cache is exposed as the `cache` property on the memoized
59032 * function. Its creation may be customized by replacing the
59033 * `_.memoize.Cache` constructor with one whose instances implement the
59034 * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
59035 * method interface of `get`, `has`, and `set`.
59039 * @category Function
59040 * @param {Function}
59041 * func The function to have its output memoized.
59042 * @param {Function}
59043 * [resolver] The function to resolve the cache key.
59044 * @returns {Function} Returns the new memoizing function.
59047 * var upperCase = _.memoize(function(string) { return string.toUpperCase();
59050 * upperCase('fred'); // => 'FRED'
59051 * // modifying the result cache upperCase.cache.set('fred', 'BARNEY');
59052 * upperCase('fred'); // => 'BARNEY'
59053 * // replacing `_.memoize.Cache` var object = { 'user': 'fred' }; var
59054 * other = { 'user': 'barney' }; var identity = _.memoize(_.identity);
59056 * identity(object); // => { 'user': 'fred' } identity(other); // => {
59059 * _.memoize.Cache = WeakMap; var identity = _.memoize(_.identity);
59061 * identity(object); // => { 'user': 'fred' } identity(other); // => {
59062 * 'user': 'barney' }
59064 function memoize(func, resolver) {
59065 if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
59066 throw new TypeError(FUNC_ERROR_TEXT);
59068 var memoized = function() {
59069 var args = arguments,
59070 key = resolver ? resolver.apply(this, args) : args[0],
59071 cache = memoized.cache;
59073 if (cache.has(key)) {
59074 return cache.get(key);
59076 var result = func.apply(this, args);
59077 memoized.cache = cache.set(key, result);
59080 memoized.cache = new memoize.Cache;
59085 * Creates a function that runs each argument through a corresponding
59086 * transform function.
59090 * @category Function
59091 * @param {Function}
59092 * func The function to wrap.
59093 * @param {...(Function|Function[])}
59094 * [transforms] The functions to transform arguments, specified
59095 * as individual functions or arrays of functions.
59096 * @returns {Function} Returns the new function.
59099 * function doubled(n) { return n * 2; }
59101 * function square(n) { return n * n; }
59103 * var modded = _.modArgs(function(x, y) { return [x, y]; }, square,
59106 * modded(1, 2); // => [1, 4]
59108 * modded(5, 10); // => [25, 20]
59110 var modArgs = restParam(function(func, transforms) {
59111 transforms = baseFlatten(transforms);
59112 if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {
59113 throw new TypeError(FUNC_ERROR_TEXT);
59115 var length = transforms.length;
59116 return restParam(function(args) {
59117 var index = nativeMin(args.length, length);
59119 args[index] = transforms[index](args[index]);
59121 return func.apply(this, args);
59126 * Creates a function that negates the result of the predicate `func`. The
59127 * `func` predicate is invoked with the `this` binding and arguments of the
59128 * created function.
59132 * @category Function
59133 * @param {Function}
59134 * predicate The predicate to negate.
59135 * @returns {Function} Returns the new function.
59138 * function isEven(n) { return n % 2 == 0; }
59140 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); // => [1, 3, 5]
59142 function negate(predicate) {
59143 if (typeof predicate != 'function') {
59144 throw new TypeError(FUNC_ERROR_TEXT);
59146 return function() {
59147 return !predicate.apply(this, arguments);
59152 * Creates a function that is restricted to invoking `func` once. Repeat
59153 * calls to the function return the value of the first call. The `func` is
59154 * invoked with the `this` binding and arguments of the created function.
59158 * @category Function
59159 * @param {Function}
59160 * func The function to restrict.
59161 * @returns {Function} Returns the new restricted function.
59164 * var initialize = _.once(createApplication); initialize(); initialize(); //
59165 * `initialize` invokes `createApplication` once
59167 function once(func) {
59168 return before(2, func);
59172 * Creates a function that invokes `func` with `partial` arguments prepended
59173 * to those provided to the new function. This method is like `_.bind`
59174 * except it does **not** alter the `this` binding.
59176 * The `_.partial.placeholder` value, which defaults to `_` in monolithic
59177 * builds, may be used as a placeholder for partially applied arguments.
59179 * **Note:** This method does not set the "length" property of partially
59180 * applied functions.
59184 * @category Function
59185 * @param {Function}
59186 * func The function to partially apply arguments to.
59188 * [partials] The arguments to be partially applied.
59189 * @returns {Function} Returns the new partially applied function.
59192 * var greet = function(greeting, name) { return greeting + ' ' + name; };
59194 * var sayHelloTo = _.partial(greet, 'hello'); sayHelloTo('fred'); // =>
59196 * // using placeholders var greetFred = _.partial(greet, _, 'fred');
59197 * greetFred('hi'); // => 'hi fred'
59199 var partial = createPartial(PARTIAL_FLAG);
59202 * This method is like `_.partial` except that partially applied arguments
59203 * are appended to those provided to the new function.
59205 * The `_.partialRight.placeholder` value, which defaults to `_` in
59206 * monolithic builds, may be used as a placeholder for partially applied
59209 * **Note:** This method does not set the "length" property of partially
59210 * applied functions.
59214 * @category Function
59215 * @param {Function}
59216 * func The function to partially apply arguments to.
59218 * [partials] The arguments to be partially applied.
59219 * @returns {Function} Returns the new partially applied function.
59222 * var greet = function(greeting, name) { return greeting + ' ' + name; };
59224 * var greetFred = _.partialRight(greet, 'fred'); greetFred('hi'); // => 'hi
59226 * // using placeholders var sayHelloTo = _.partialRight(greet, 'hello',
59227 * _); sayHelloTo('fred'); // => 'hello fred'
59229 var partialRight = createPartial(PARTIAL_RIGHT_FLAG);
59232 * Creates a function that invokes `func` with arguments arranged according
59233 * to the specified indexes where the argument value at the first index is
59234 * provided as the first argument, the argument value at the second index is
59235 * provided as the second argument, and so on.
59239 * @category Function
59240 * @param {Function}
59241 * func The function to rearrange arguments for.
59242 * @param {...(number|number[])}
59243 * indexes The arranged argument indexes, specified as individual
59244 * indexes or arrays of indexes.
59245 * @returns {Function} Returns the new function.
59248 * var rearged = _.rearg(function(a, b, c) { return [a, b, c]; }, 2, 0, 1);
59250 * rearged('b', 'c', 'a') // => ['a', 'b', 'c']
59252 * var map = _.rearg(_.map, [1, 0]); map(function(n) { return n * 3; }, [1,
59253 * 2, 3]); // => [3, 6, 9]
59255 var rearg = restParam(function(func, indexes) {
59256 return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
59260 * Creates a function that invokes `func` with the `this` binding of the
59261 * created function and arguments from `start` and beyond provided as an
59264 * **Note:** This method is based on the [rest
59265 * parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
59269 * @category Function
59270 * @param {Function}
59271 * func The function to apply a rest parameter to.
59273 * [start=func.length-1] The start position of the rest
59275 * @returns {Function} Returns the new function.
59278 * var say = _.restParam(function(what, names) { return what + ' ' +
59279 * _.initial(names).join(', ') + (_.size(names) > 1 ? ', & ' : '') +
59280 * _.last(names); });
59282 * say('hello', 'fred', 'barney', 'pebbles'); // => 'hello fred, barney, &
59285 function restParam(func, start) {
59286 if (typeof func != 'function') {
59287 throw new TypeError(FUNC_ERROR_TEXT);
59289 start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
59290 return function() {
59291 var args = arguments,
59293 length = nativeMax(args.length - start, 0),
59294 rest = Array(length);
59296 while (++index < length) {
59297 rest[index] = args[start + index];
59301 return func.call(this, rest);
59303 return func.call(this, args[0], rest);
59305 return func.call(this, args[0], args[1], rest);
59307 var otherArgs = Array(start + 1);
59309 while (++index < start) {
59310 otherArgs[index] = args[index];
59312 otherArgs[start] = rest;
59313 return func.apply(this, otherArgs);
59318 * Creates a function that invokes `func` with the `this` binding of the
59319 * created function and an array of arguments much like
59320 * [`Function#apply`](https://es5.github.io/#x15.3.4.3).
59322 * **Note:** This method is based on the [spread
59323 * operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).
59327 * @category Function
59328 * @param {Function}
59329 * func The function to spread arguments over.
59330 * @returns {Function} Returns the new function.
59333 * var say = _.spread(function(who, what) { return who + ' says ' + what;
59336 * say(['fred', 'hello']); // => 'fred says hello'
59337 * // with a Promise var numbers = Promise.all([ Promise.resolve(40),
59338 * Promise.resolve(36) ]);
59340 * numbers.then(_.spread(function(x, y) { return x + y; })); // => a Promise
59343 function spread(func) {
59344 if (typeof func != 'function') {
59345 throw new TypeError(FUNC_ERROR_TEXT);
59347 return function(array) {
59348 return func.apply(this, array);
59353 * Creates a throttled function that only invokes `func` at most once per
59354 * every `wait` milliseconds. The throttled function comes with a `cancel`
59355 * method to cancel delayed invocations. Provide an options object to
59356 * indicate that `func` should be invoked on the leading and/or trailing
59357 * edge of the `wait` timeout. Subsequent calls to the throttled function
59358 * return the result of the last `func` call.
59360 * **Note:** If `leading` and `trailing` options are `true`, `func` is
59361 * invoked on the trailing edge of the timeout only if the the throttled
59362 * function is invoked more than once during the `wait` timeout.
59364 * See [David Corbacho's
59365 * article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
59366 * for details over the differences between `_.throttle` and `_.debounce`.
59370 * @category Function
59371 * @param {Function}
59372 * func The function to throttle.
59374 * [wait=0] The number of milliseconds to throttle invocations
59377 * [options] The options object.
59379 * [options.leading=true] Specify invoking on the leading edge of
59382 * [options.trailing=true] Specify invoking on the trailing edge
59384 * @returns {Function} Returns the new throttled function.
59386 * // avoid excessively updating the position while scrolling
59387 * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
59388 * // invoke `renewToken` when the click event is fired, but not more than
59389 * once every 5 minutes jQuery('.interactive').on('click',
59390 * _.throttle(renewToken, 300000, { 'trailing': false }));
59391 * // cancel a trailing throttled call jQuery(window).on('popstate',
59392 * throttled.cancel);
59394 function throttle(func, wait, options) {
59395 var leading = true,
59398 if (typeof func != 'function') {
59399 throw new TypeError(FUNC_ERROR_TEXT);
59401 if (options === false) {
59403 } else if (isObject(options)) {
59404 leading = 'leading' in options ? !!options.leading : leading;
59405 trailing = 'trailing' in options ? !!options.trailing : trailing;
59407 return debounce(func, wait, {
59408 'leading': leading,
59410 'trailing': trailing
59415 * Creates a function that provides `value` to the wrapper function as its
59416 * first argument. Any additional arguments provided to the function are
59417 * appended to those provided to the wrapper function. The wrapper is
59418 * invoked with the `this` binding of the created function.
59422 * @category Function
59424 * value The value to wrap.
59425 * @param {Function}
59426 * wrapper The wrapper function.
59427 * @returns {Function} Returns the new function.
59430 * var p = _.wrap(_.escape, function(func, text) { return '
59431 * <p>' + func(text) + '
59434 * p('fred, barney, & pebbles'); // => '
59436 * fred, barney, & pebbles
59439 function wrap(value, wrapper) {
59440 wrapper = wrapper == null ? identity : wrapper;
59441 return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);
59444 /*------------------------------------------------------------------------*/
59447 * Creates a clone of `value`. If `isDeep` is `true` nested objects are
59448 * cloned, otherwise they are assigned by reference. If `customizer` is
59449 * provided it is invoked to produce the cloned values. If `customizer`
59450 * returns `undefined` cloning is handled by the method instead. The
59451 * `customizer` is bound to `thisArg` and invoked with two argument; (value [,
59452 * index|key, object]).
59454 * **Note:** This method is loosely based on the [structured clone
59455 * algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
59456 * The enumerable properties of `arguments` objects and objects created by
59457 * constructors other than `Object` are cloned to plain `Object` objects. An
59458 * empty object is returned for uncloneable values such as functions, DOM
59459 * nodes, Maps, Sets, and WeakMaps.
59465 * value The value to clone.
59467 * [isDeep] Specify a deep clone.
59468 * @param {Function}
59469 * [customizer] The function to customize cloning values.
59471 * [thisArg] The `this` binding of `customizer`.
59472 * @returns {*} Returns the cloned value.
59475 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
59477 * var shallow = _.clone(users); shallow[0] === users[0]; // => true
59479 * var deep = _.clone(users, true); deep[0] === users[0]; // => false
59480 * // using a customizer callback var el = _.clone(document.body,
59481 * function(value) { if (_.isElement(value)) { return
59482 * value.cloneNode(false); } });
59484 * el === document.body // => false el.nodeName // => BODY
59485 * el.childNodes.length; // => 0
59487 function clone(value, isDeep, customizer, thisArg) {
59488 if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
59490 } else if (typeof isDeep == 'function') {
59491 thisArg = customizer;
59492 customizer = isDeep;
59495 return typeof customizer == 'function' ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1)) : baseClone(value, isDeep);
59499 * Creates a deep clone of `value`. If `customizer` is provided it is
59500 * invoked to produce the cloned values. If `customizer` returns `undefined`
59501 * cloning is handled by the method instead. The `customizer` is bound to
59502 * `thisArg` and invoked with two argument; (value [, index|key, object]).
59504 * **Note:** This method is loosely based on the [structured clone
59505 * algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
59506 * The enumerable properties of `arguments` objects and objects created by
59507 * constructors other than `Object` are cloned to plain `Object` objects. An
59508 * empty object is returned for uncloneable values such as functions, DOM
59509 * nodes, Maps, Sets, and WeakMaps.
59515 * value The value to deep clone.
59516 * @param {Function}
59517 * [customizer] The function to customize cloning values.
59519 * [thisArg] The `this` binding of `customizer`.
59520 * @returns {*} Returns the deep cloned value.
59523 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
59525 * var deep = _.cloneDeep(users); deep[0] === users[0]; // => false
59526 * // using a customizer callback var el = _.cloneDeep(document.body,
59527 * function(value) { if (_.isElement(value)) { return value.cloneNode(true); }
59530 * el === document.body // => false el.nodeName // => BODY
59531 * el.childNodes.length; // => 20
59533 function cloneDeep(value, customizer, thisArg) {
59534 return typeof customizer == 'function' ? baseClone(value, true, bindCallback(customizer, thisArg, 1)) : baseClone(value, true);
59538 * Checks if `value` is greater than `other`.
59544 * value The value to compare.
59546 * other The other value to compare.
59547 * @returns {boolean} Returns `true` if `value` is greater than `other`,
59551 * _.gt(3, 1); // => true
59553 * _.gt(3, 3); // => false
59555 * _.gt(1, 3); // => false
59557 function gt(value, other) {
59558 return value > other;
59562 * Checks if `value` is greater than or equal to `other`.
59568 * value The value to compare.
59570 * other The other value to compare.
59571 * @returns {boolean} Returns `true` if `value` is greater than or equal to
59572 * `other`, else `false`.
59575 * _.gte(3, 1); // => true
59577 * _.gte(3, 3); // => true
59579 * _.gte(1, 3); // => false
59581 function gte(value, other) {
59582 return value >= other;
59586 * Checks if `value` is classified as an `arguments` object.
59592 * value The value to check.
59593 * @returns {boolean} Returns `true` if `value` is correctly classified,
59597 * _.isArguments(function() { return arguments; }()); // => true
59599 * _.isArguments([1, 2, 3]); // => false
59601 function isArguments(value) {
59602 return isObjectLike(value) && isArrayLike(value) &&
59603 hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
59607 * Checks if `value` is classified as an `Array` object.
59613 * value The value to check.
59614 * @returns {boolean} Returns `true` if `value` is correctly classified,
59618 * _.isArray([1, 2, 3]); // => true
59620 * _.isArray(function() { return arguments; }()); // => false
59622 var isArray = nativeIsArray || function(value) {
59623 return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
59627 * Checks if `value` is classified as a boolean primitive or object.
59633 * value The value to check.
59634 * @returns {boolean} Returns `true` if `value` is correctly classified,
59638 * _.isBoolean(false); // => true
59640 * _.isBoolean(null); // => false
59642 function isBoolean(value) {
59643 return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
59647 * Checks if `value` is classified as a `Date` object.
59653 * value The value to check.
59654 * @returns {boolean} Returns `true` if `value` is correctly classified,
59658 * _.isDate(new Date); // => true
59660 * _.isDate('Mon April 23 2012'); // => false
59662 function isDate(value) {
59663 return isObjectLike(value) && objToString.call(value) == dateTag;
59667 * Checks if `value` is a DOM element.
59673 * value The value to check.
59674 * @returns {boolean} Returns `true` if `value` is a DOM element, else
59678 * _.isElement(document.body); // => true
59680 * _.isElement('<body>'); // => false
59682 function isElement(value) {
59683 return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
59687 * Checks if `value` is empty. A value is considered empty unless it is an
59688 * `arguments` object, array, string, or jQuery-like collection with a
59689 * length greater than `0` or an object with own enumerable properties.
59694 * @param {Array|Object|string}
59695 * value The value to inspect.
59696 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
59699 * _.isEmpty(null); // => true
59701 * _.isEmpty(true); // => true
59703 * _.isEmpty(1); // => true
59705 * _.isEmpty([1, 2, 3]); // => false
59707 * _.isEmpty({ 'a': 1 }); // => false
59709 function isEmpty(value) {
59710 if (value == null) {
59713 if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
59714 (isObjectLike(value) && isFunction(value.splice)))) {
59715 return !value.length;
59717 return !keys(value).length;
59721 * Performs a deep comparison between two values to determine if they are
59722 * equivalent. If `customizer` is provided it is invoked to compare values.
59723 * If `customizer` returns `undefined` comparisons are handled by the method
59724 * instead. The `customizer` is bound to `thisArg` and invoked with three
59725 * arguments: (value, other [, index|key]).
59727 * **Note:** This method supports comparing arrays, booleans, `Date`
59728 * objects, numbers, `Object` objects, regexes, and strings. Objects are
59729 * compared by their own, not inherited, enumerable properties. Functions
59730 * and DOM nodes are **not** supported. Provide a customizer function to
59731 * extend support for comparing other values.
59738 * value The value to compare.
59740 * other The other value to compare.
59741 * @param {Function}
59742 * [customizer] The function to customize value comparisons.
59744 * [thisArg] The `this` binding of `customizer`.
59745 * @returns {boolean} Returns `true` if the values are equivalent, else
59749 * var object = { 'user': 'fred' }; var other = { 'user': 'fred' };
59751 * object == other; // => false
59753 * _.isEqual(object, other); // => true
59754 * // using a customizer callback var array = ['hello', 'goodbye']; var
59755 * other = ['hi', 'goodbye'];
59757 * _.isEqual(array, other, function(value, other) { if (_.every([value,
59758 * other], RegExp.prototype.test, /^h(?:i|ello)$/)) { return true; } }); // =>
59761 function isEqual(value, other, customizer, thisArg) {
59762 customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
59763 var result = customizer ? customizer(value, other) : undefined;
59764 return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
59768 * Checks if `value` is an `Error`, `EvalError`, `RangeError`,
59769 * `ReferenceError`, `SyntaxError`, `TypeError`, or `URIError` object.
59775 * value The value to check.
59776 * @returns {boolean} Returns `true` if `value` is an error object, else
59780 * _.isError(new Error); // => true
59782 * _.isError(Error); // => false
59784 function isError(value) {
59785 return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
59789 * Checks if `value` is a finite primitive number.
59791 * **Note:** This method is based on
59792 * [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).
59798 * value The value to check.
59799 * @returns {boolean} Returns `true` if `value` is a finite number, else
59803 * _.isFinite(10); // => true
59805 * _.isFinite('10'); // => false
59807 * _.isFinite(true); // => false
59809 * _.isFinite(Object(10)); // => false
59811 * _.isFinite(Infinity); // => false
59813 function isFinite(value) {
59814 return typeof value == 'number' && nativeIsFinite(value);
59818 * Checks if `value` is classified as a `Function` object.
59824 * value The value to check.
59825 * @returns {boolean} Returns `true` if `value` is correctly classified,
59829 * _.isFunction(_); // => true
59831 * _.isFunction(/abc/); // => false
59833 function isFunction(value) {
59834 // The use of `Object#toString` avoids issues with the `typeof` operator
59835 // in older versions of Chrome and Safari which return 'function' for
59837 // and Safari 8 equivalents which return 'object' for typed array
59839 return isObject(value) && objToString.call(value) == funcTag;
59843 * Checks if `value` is the [language type](https://es5.github.io/#x8) of
59844 * `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and
59845 * `new String('')`)
59851 * value The value to check.
59852 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
59855 * _.isObject({}); // => true
59857 * _.isObject([1, 2, 3]); // => true
59859 * _.isObject(1); // => false
59861 function isObject(value) {
59862 // Avoid a V8 JIT bug in Chrome 19-20.
59863 // See https://code.google.com/p/v8/issues/detail?id=2291 for more
59865 var type = typeof value;
59866 return !!value && (type == 'object' || type == 'function');
59870 * Performs a deep comparison between `object` and `source` to determine if
59871 * `object` contains equivalent property values. If `customizer` is provided
59872 * it is invoked to compare values. If `customizer` returns `undefined`
59873 * comparisons are handled by the method instead. The `customizer` is bound
59874 * to `thisArg` and invoked with three arguments: (value, other, index|key).
59876 * **Note:** This method supports comparing properties of arrays, booleans,
59877 * `Date` objects, numbers, `Object` objects, regexes, and strings.
59878 * Functions and DOM nodes are **not** supported. Provide a customizer
59879 * function to extend support for comparing other values.
59885 * object The object to inspect.
59887 * source The object of property values to match.
59888 * @param {Function}
59889 * [customizer] The function to customize value comparisons.
59891 * [thisArg] The `this` binding of `customizer`.
59892 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
59895 * var object = { 'user': 'fred', 'age': 40 };
59897 * _.isMatch(object, { 'age': 40 }); // => true
59899 * _.isMatch(object, { 'age': 36 }); // => false
59900 * // using a customizer callback var object = { 'greeting': 'hello' }; var
59901 * source = { 'greeting': 'hi' };
59903 * _.isMatch(object, source, function(value, other) { return _.every([value,
59904 * other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; }); // =>
59907 function isMatch(object, source, customizer, thisArg) {
59908 customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
59909 return baseIsMatch(object, getMatchData(source), customizer);
59913 * Checks if `value` is `NaN`.
59915 * **Note:** This method is not the same as
59916 * [`isNaN`](https://es5.github.io/#x15.1.2.4) which returns `true` for
59917 * `undefined` and other non-numeric values.
59923 * value The value to check.
59924 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
59927 * _.isNaN(NaN); // => true
59929 * _.isNaN(new Number(NaN)); // => true
59931 * isNaN(undefined); // => true
59933 * _.isNaN(undefined); // => false
59935 function isNaN(value) {
59936 // An `NaN` primitive is the only value that is not equal to itself.
59937 // Perform the `toStringTag` check first to avoid errors with some host
59939 return isNumber(value) && value != +value;
59943 * Checks if `value` is a native function.
59949 * value The value to check.
59950 * @returns {boolean} Returns `true` if `value` is a native function, else
59954 * _.isNative(Array.prototype.push); // => true
59956 * _.isNative(_); // => false
59958 function isNative(value) {
59959 if (value == null) {
59962 if (isFunction(value)) {
59963 return reIsNative.test(fnToString.call(value));
59965 return isObjectLike(value) && reIsHostCtor.test(value);
59969 * Checks if `value` is `null`.
59975 * value The value to check.
59976 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
59979 * _.isNull(null); // => true
59981 * _.isNull(void 0); // => false
59983 function isNull(value) {
59984 return value === null;
59988 * Checks if `value` is classified as a `Number` primitive or object.
59990 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
59991 * classified as numbers, use the `_.isFinite` method.
59997 * value The value to check.
59998 * @returns {boolean} Returns `true` if `value` is correctly classified,
60002 * _.isNumber(8.4); // => true
60004 * _.isNumber(NaN); // => true
60006 * _.isNumber('8.4'); // => false
60008 function isNumber(value) {
60009 return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
60013 * Checks if `value` is a plain object, that is, an object created by the
60014 * `Object` constructor or one with a `[[Prototype]]` of `null`.
60016 * **Note:** This method assumes objects created by the `Object` constructor
60017 * have no inherited enumerable properties.
60023 * value The value to check.
60024 * @returns {boolean} Returns `true` if `value` is a plain object, else
60028 * function Foo() { this.a = 1; }
60030 * _.isPlainObject(new Foo); // => false
60032 * _.isPlainObject([1, 2, 3]); // => false
60034 * _.isPlainObject({ 'x': 0, 'y': 0 }); // => true
60036 * _.isPlainObject(Object.create(null)); // => true
60038 function isPlainObject(value) {
60041 // Exit early for non `Object` objects.
60042 if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
60043 (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
60046 // IE < 9 iterates inherited properties before own properties. If the
60048 // iterated property is an object's own property then there are no
60050 // enumerable properties.
60052 // In most environments an object's own properties are iterated before
60053 // its inherited properties. If the last iterated property is an
60055 // own property then there are no inherited enumerable properties.
60056 baseForIn(value, function(subValue, key) {
60059 return result === undefined || hasOwnProperty.call(value, result);
60063 * Checks if `value` is classified as a `RegExp` object.
60069 * value The value to check.
60070 * @returns {boolean} Returns `true` if `value` is correctly classified,
60074 * _.isRegExp(/abc/); // => true
60076 * _.isRegExp('/abc/'); // => false
60078 function isRegExp(value) {
60079 return isObject(value) && objToString.call(value) == regexpTag;
60083 * Checks if `value` is classified as a `String` primitive or object.
60089 * value The value to check.
60090 * @returns {boolean} Returns `true` if `value` is correctly classified,
60094 * _.isString('abc'); // => true
60096 * _.isString(1); // => false
60098 function isString(value) {
60099 return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
60103 * Checks if `value` is classified as a typed array.
60109 * value The value to check.
60110 * @returns {boolean} Returns `true` if `value` is correctly classified,
60114 * _.isTypedArray(new Uint8Array); // => true
60116 * _.isTypedArray([]); // => false
60118 function isTypedArray(value) {
60119 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
60123 * Checks if `value` is `undefined`.
60129 * value The value to check.
60130 * @returns {boolean} Returns `true` if `value` is `undefined`, else
60134 * _.isUndefined(void 0); // => true
60136 * _.isUndefined(null); // => false
60138 function isUndefined(value) {
60139 return value === undefined;
60143 * Checks if `value` is less than `other`.
60149 * value The value to compare.
60151 * other The other value to compare.
60152 * @returns {boolean} Returns `true` if `value` is less than `other`, else
60156 * _.lt(1, 3); // => true
60158 * _.lt(3, 3); // => false
60160 * _.lt(3, 1); // => false
60162 function lt(value, other) {
60163 return value < other;
60167 * Checks if `value` is less than or equal to `other`.
60173 * value The value to compare.
60175 * other The other value to compare.
60176 * @returns {boolean} Returns `true` if `value` is less than or equal to
60177 * `other`, else `false`.
60180 * _.lte(1, 3); // => true
60182 * _.lte(3, 3); // => true
60184 * _.lte(3, 1); // => false
60186 function lte(value, other) {
60187 return value <= other;
60191 * Converts `value` to an array.
60197 * value The value to convert.
60198 * @returns {Array} Returns the converted array.
60201 * (function() { return _.toArray(arguments).slice(1); }(1, 2, 3)); // =>
60204 function toArray(value) {
60205 var length = value ? getLength(value) : 0;
60206 if (!isLength(length)) {
60207 return values(value);
60212 return arrayCopy(value);
60216 * Converts `value` to a plain object flattening inherited enumerable
60217 * properties of `value` to own properties of the plain object.
60223 * value The value to convert.
60224 * @returns {Object} Returns the converted plain object.
60227 * function Foo() { this.b = 2; }
60229 * Foo.prototype.c = 3;
60231 * _.assign({ 'a': 1 }, new Foo); // => { 'a': 1, 'b': 2 }
60233 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); // => { 'a': 1, 'b': 2,
60236 function toPlainObject(value) {
60237 return baseCopy(value, keysIn(value));
60240 /*------------------------------------------------------------------------*/
60243 * Recursively merges own enumerable properties of the source object(s),
60244 * that don't resolve to `undefined` into the destination object. Subsequent
60245 * sources overwrite property assignments of previous sources. If
60246 * `customizer` is provided it is invoked to produce the merged values of
60247 * the destination and source properties. If `customizer` returns
60248 * `undefined` merging is handled by the method instead. The `customizer` is
60249 * bound to `thisArg` and invoked with five arguments: (objectValue,
60250 * sourceValue, key, object, source).
60256 * object The destination object.
60257 * @param {...Object}
60258 * [sources] The source objects.
60259 * @param {Function}
60260 * [customizer] The function to customize assigned values.
60262 * [thisArg] The `this` binding of `customizer`.
60263 * @returns {Object} Returns `object`.
60266 * var users = { 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] };
60268 * var ages = { 'data': [{ 'age': 36 }, { 'age': 40 }] };
60270 * _.merge(users, ages); // => { 'data': [{ 'user': 'barney', 'age': 36 }, {
60271 * 'user': 'fred', 'age': 40 }] }
60272 * // using a customizer callback var object = { 'fruits': ['apple'],
60273 * 'vegetables': ['beet'] };
60275 * var other = { 'fruits': ['banana'], 'vegetables': ['carrot'] };
60277 * _.merge(object, other, function(a, b) { if (_.isArray(a)) { return
60278 * a.concat(b); } }); // => { 'fruits': ['apple', 'banana'], 'vegetables':
60279 * ['beet', 'carrot'] }
60281 var merge = createAssigner(baseMerge);
60284 * Assigns own enumerable properties of source object(s) to the destination
60285 * object. Subsequent sources overwrite property assignments of previous
60286 * sources. If `customizer` is provided it is invoked to produce the
60287 * assigned values. The `customizer` is bound to `thisArg` and invoked with
60288 * five arguments: (objectValue, sourceValue, key, object, source).
60290 * **Note:** This method mutates `object` and is based on
60291 * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
60298 * object The destination object.
60299 * @param {...Object}
60300 * [sources] The source objects.
60301 * @param {Function}
60302 * [customizer] The function to customize assigned values.
60304 * [thisArg] The `this` binding of `customizer`.
60305 * @returns {Object} Returns `object`.
60308 * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); // => {
60309 * 'user': 'fred', 'age': 40 }
60310 * // using a customizer callback var defaults = _.partialRight(_.assign,
60311 * function(value, other) { return _.isUndefined(value) ? other : value; });
60313 * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); // => {
60314 * 'user': 'barney', 'age': 36 }
60316 var assign = createAssigner(function(object, source, customizer) {
60317 return customizer ? assignWith(object, source, customizer) : baseAssign(object, source);
60321 * Creates an object that inherits from the given `prototype` object. If a
60322 * `properties` object is provided its own enumerable properties are
60323 * assigned to the created object.
60329 * prototype The object to inherit from.
60331 * [properties] The properties to assign to the object.
60332 * @param- {Object} [guard] Enables use as a callback for functions like
60334 * @returns {Object} Returns the new object.
60337 * function Shape() { this.x = 0; this.y = 0; }
60339 * function Circle() { Shape.call(this); }
60341 * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle });
60343 * var circle = new Circle; circle instanceof Circle; // => true
60345 * circle instanceof Shape; // => true
60347 function create(prototype, properties, guard) {
60348 var result = baseCreate(prototype);
60349 if (guard && isIterateeCall(prototype, properties, guard)) {
60350 properties = undefined;
60352 return properties ? baseAssign(result, properties) : result;
60356 * Assigns own enumerable properties of source object(s) to the destination
60357 * object for all destination properties that resolve to `undefined`. Once a
60358 * property is set, additional values of the same property are ignored.
60360 * **Note:** This method mutates `object`.
60366 * object The destination object.
60367 * @param {...Object}
60368 * [sources] The source objects.
60369 * @returns {Object} Returns `object`.
60372 * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); // => {
60373 * 'user': 'barney', 'age': 36 }
60375 var defaults = createDefaults(assign, assignDefaults);
60378 * This method is like `_.defaults` except that it recursively assigns
60379 * default properties.
60381 * **Note:** This method mutates `object`.
60387 * object The destination object.
60388 * @param {...Object}
60389 * [sources] The source objects.
60390 * @returns {Object} Returns `object`.
60393 * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name':
60394 * 'fred', 'age': 36 } }); // => { 'user': { 'name': 'barney', 'age': 36 } }
60397 var defaultsDeep = createDefaults(merge, mergeDefaults);
60400 * This method is like `_.find` except that it returns the key of the first
60401 * element `predicate` returns truthy for instead of the element itself.
60403 * If a property name is provided for `predicate` the created `_.property`
60404 * style callback returns the property value of the given element.
60406 * If a value is also provided for `thisArg` the created `_.matchesProperty`
60407 * style callback returns `true` for elements that have a matching property
60408 * value, else `false`.
60410 * If an object is provided for `predicate` the created `_.matches` style
60411 * callback returns `true` for elements that have the properties of the
60412 * given object, else `false`.
60418 * object The object to search.
60419 * @param {Function|Object|string}
60420 * [predicate=_.identity] The function invoked per iteration.
60422 * [thisArg] The `this` binding of `predicate`.
60423 * @returns {string|undefined} Returns the key of the matched element, else
60427 * var users = { 'barney': { 'age': 36, 'active': true }, 'fred': { 'age':
60428 * 40, 'active': false }, 'pebbles': { 'age': 1, 'active': true } };
60430 * _.findKey(users, function(chr) { return chr.age < 40; }); // => 'barney'
60431 * (iteration order is not guaranteed)
60432 * // using the `_.matches` callback shorthand _.findKey(users, { 'age': 1,
60433 * 'active': true }); // => 'pebbles'
60434 * // using the `_.matchesProperty` callback shorthand _.findKey(users,
60435 * 'active', false); // => 'fred'
60436 * // using the `_.property` callback shorthand _.findKey(users, 'active'); // =>
60439 var findKey = createFindKey(baseForOwn);
60442 * This method is like `_.findKey` except that it iterates over elements of
60443 * a collection in the opposite order.
60445 * If a property name is provided for `predicate` the created `_.property`
60446 * style callback returns the property value of the given element.
60448 * If a value is also provided for `thisArg` the created `_.matchesProperty`
60449 * style callback returns `true` for elements that have a matching property
60450 * value, else `false`.
60452 * If an object is provided for `predicate` the created `_.matches` style
60453 * callback returns `true` for elements that have the properties of the
60454 * given object, else `false`.
60460 * object The object to search.
60461 * @param {Function|Object|string}
60462 * [predicate=_.identity] The function invoked per iteration.
60464 * [thisArg] The `this` binding of `predicate`.
60465 * @returns {string|undefined} Returns the key of the matched element, else
60469 * var users = { 'barney': { 'age': 36, 'active': true }, 'fred': { 'age':
60470 * 40, 'active': false }, 'pebbles': { 'age': 1, 'active': true } };
60472 * _.findLastKey(users, function(chr) { return chr.age < 40; }); // =>
60473 * returns `pebbles` assuming `_.findKey` returns `barney`
60474 * // using the `_.matches` callback shorthand _.findLastKey(users, {
60475 * 'age': 36, 'active': true }); // => 'barney'
60476 * // using the `_.matchesProperty` callback shorthand _.findLastKey(users,
60477 * 'active', false); // => 'fred'
60478 * // using the `_.property` callback shorthand _.findLastKey(users,
60479 * 'active'); // => 'pebbles'
60481 var findLastKey = createFindKey(baseForOwnRight);
60484 * Iterates over own and inherited enumerable properties of an object
60485 * invoking `iteratee` for each property. The `iteratee` is bound to
60486 * `thisArg` and invoked with three arguments: (value, key, object).
60487 * Iteratee functions may exit iteration early by explicitly returning
60494 * object The object to iterate over.
60495 * @param {Function}
60496 * [iteratee=_.identity] The function invoked per iteration.
60498 * [thisArg] The `this` binding of `iteratee`.
60499 * @returns {Object} Returns `object`.
60502 * function Foo() { this.a = 1; this.b = 2; }
60504 * Foo.prototype.c = 3;
60506 * _.forIn(new Foo, function(value, key) { console.log(key); }); // => logs
60507 * 'a', 'b', and 'c' (iteration order is not guaranteed)
60509 var forIn = createForIn(baseFor);
60512 * This method is like `_.forIn` except that it iterates over properties of
60513 * `object` in the opposite order.
60519 * object The object to iterate over.
60520 * @param {Function}
60521 * [iteratee=_.identity] The function invoked per iteration.
60523 * [thisArg] The `this` binding of `iteratee`.
60524 * @returns {Object} Returns `object`.
60527 * function Foo() { this.a = 1; this.b = 2; }
60529 * Foo.prototype.c = 3;
60531 * _.forInRight(new Foo, function(value, key) { console.log(key); }); // =>
60532 * logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
60534 var forInRight = createForIn(baseForRight);
60537 * Iterates over own enumerable properties of an object invoking `iteratee`
60538 * for each property. The `iteratee` is bound to `thisArg` and invoked with
60539 * three arguments: (value, key, object). Iteratee functions may exit
60540 * iteration early by explicitly returning `false`.
60546 * object The object to iterate over.
60547 * @param {Function}
60548 * [iteratee=_.identity] The function invoked per iteration.
60550 * [thisArg] The `this` binding of `iteratee`.
60551 * @returns {Object} Returns `object`.
60554 * function Foo() { this.a = 1; this.b = 2; }
60556 * Foo.prototype.c = 3;
60558 * _.forOwn(new Foo, function(value, key) { console.log(key); }); // => logs
60559 * 'a' and 'b' (iteration order is not guaranteed)
60561 var forOwn = createForOwn(baseForOwn);
60564 * This method is like `_.forOwn` except that it iterates over properties of
60565 * `object` in the opposite order.
60571 * object The object to iterate over.
60572 * @param {Function}
60573 * [iteratee=_.identity] The function invoked per iteration.
60575 * [thisArg] The `this` binding of `iteratee`.
60576 * @returns {Object} Returns `object`.
60579 * function Foo() { this.a = 1; this.b = 2; }
60581 * Foo.prototype.c = 3;
60583 * _.forOwnRight(new Foo, function(value, key) { console.log(key); }); // =>
60584 * logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
60586 var forOwnRight = createForOwn(baseForOwnRight);
60589 * Creates an array of function property names from all enumerable
60590 * properties, own and inherited, of `object`.
60597 * object The object to inspect.
60598 * @returns {Array} Returns the new array of property names.
60601 * _.functions(_); // => ['after', 'ary', 'assign', ...]
60603 function functions(object) {
60604 return baseFunctions(object, keysIn(object));
60608 * Gets the property value at `path` of `object`. If the resolved value is
60609 * `undefined` the `defaultValue` is used in its place.
60615 * object The object to query.
60616 * @param {Array|string}
60617 * path The path of the property to get.
60619 * [defaultValue] The value returned if the resolved value is
60621 * @returns {*} Returns the resolved value.
60624 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
60626 * _.get(object, 'a[0].b.c'); // => 3
60628 * _.get(object, ['a', '0', 'b', 'c']); // => 3
60630 * _.get(object, 'a.b.c', 'default'); // => 'default'
60632 function get(object, path, defaultValue) {
60633 var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
60634 return result === undefined ? defaultValue : result;
60638 * Checks if `path` is a direct property.
60644 * object The object to query.
60645 * @param {Array|string}
60646 * path The path to check.
60647 * @returns {boolean} Returns `true` if `path` is a direct property, else
60651 * var object = { 'a': { 'b': { 'c': 3 } } };
60653 * _.has(object, 'a'); // => true
60655 * _.has(object, 'a.b.c'); // => true
60657 * _.has(object, ['a', 'b', 'c']); // => true
60659 function has(object, path) {
60660 if (object == null) {
60663 var result = hasOwnProperty.call(object, path);
60664 if (!result && !isKey(path)) {
60665 path = toPath(path);
60666 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
60667 if (object == null) {
60671 result = hasOwnProperty.call(object, path);
60673 return result || (isLength(object.length) && isIndex(path, object.length) &&
60674 (isArray(object) || isArguments(object)));
60678 * Creates an object composed of the inverted keys and values of `object`.
60679 * If `object` contains duplicate values, subsequent values overwrite
60680 * property assignments of previous values unless `multiValue` is `true`.
60686 * object The object to invert.
60688 * [multiValue] Allow multiple values per key.
60689 * @param- {Object} [guard] Enables use as a callback for functions like
60691 * @returns {Object} Returns the new inverted object.
60694 * var object = { 'a': 1, 'b': 2, 'c': 1 };
60696 * _.invert(object); // => { '1': 'c', '2': 'b' }
60697 * // with `multiValue` _.invert(object, true); // => { '1': ['a', 'c'],
60700 function invert(object, multiValue, guard) {
60701 if (guard && isIterateeCall(object, multiValue, guard)) {
60702 multiValue = undefined;
60705 props = keys(object),
60706 length = props.length,
60709 while (++index < length) {
60710 var key = props[index],
60711 value = object[key];
60714 if (hasOwnProperty.call(result, value)) {
60715 result[value].push(key);
60717 result[value] = [key];
60720 result[value] = key;
60727 * Creates an array of the own enumerable property names of `object`.
60729 * **Note:** Non-object values are coerced to objects. See the [ES
60730 * spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) for
60737 * object The object to query.
60738 * @returns {Array} Returns the array of property names.
60741 * function Foo() { this.a = 1; this.b = 2; }
60743 * Foo.prototype.c = 3;
60745 * _.keys(new Foo); // => ['a', 'b'] (iteration order is not guaranteed)
60747 * _.keys('hi'); // => ['0', '1']
60749 var keys = !nativeKeys ? shimKeys : function(object) {
60750 var Ctor = object == null ? undefined : object.constructor;
60751 if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
60752 (typeof object != 'function' && isArrayLike(object))) {
60753 return shimKeys(object);
60755 return isObject(object) ? nativeKeys(object) : [];
60759 * Creates an array of the own and inherited enumerable property names of
60762 * **Note:** Non-object values are coerced to objects.
60768 * object The object to query.
60769 * @returns {Array} Returns the array of property names.
60772 * function Foo() { this.a = 1; this.b = 2; }
60774 * Foo.prototype.c = 3;
60776 * _.keysIn(new Foo); // => ['a', 'b', 'c'] (iteration order is not
60779 function keysIn(object) {
60780 if (object == null) {
60783 if (!isObject(object)) {
60784 object = Object(object);
60786 var length = object.length;
60787 length = (length && isLength(length) &&
60788 (isArray(object) || isArguments(object)) && length) || 0;
60790 var Ctor = object.constructor,
60792 isProto = typeof Ctor == 'function' && Ctor.prototype === object,
60793 result = Array(length),
60794 skipIndexes = length > 0;
60796 while (++index < length) {
60797 result[index] = (index + '');
60799 for (var key in object) {
60800 if (!(skipIndexes && isIndex(key, length)) &&
60801 !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
60809 * The opposite of `_.mapValues`; this method creates an object with the
60810 * same values as `object` and keys generated by running each own enumerable
60811 * property of `object` through `iteratee`.
60817 * object The object to iterate over.
60818 * @param {Function|Object|string}
60819 * [iteratee=_.identity] The function invoked per iteration.
60821 * [thisArg] The `this` binding of `iteratee`.
60822 * @returns {Object} Returns the new mapped object.
60825 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { return key + value;
60826 * }); // => { 'a1': 1, 'b2': 2 }
60828 var mapKeys = createObjectMapper(true);
60831 * Creates an object with the same keys as `object` and values generated by
60832 * running each own enumerable property of `object` through `iteratee`. The
60833 * iteratee function is bound to `thisArg` and invoked with three arguments:
60834 * (value, key, object).
60836 * If a property name is provided for `iteratee` the created `_.property`
60837 * style callback returns the property value of the given element.
60839 * If a value is also provided for `thisArg` the created `_.matchesProperty`
60840 * style callback returns `true` for elements that have a matching property
60841 * value, else `false`.
60843 * If an object is provided for `iteratee` the created `_.matches` style
60844 * callback returns `true` for elements that have the properties of the
60845 * given object, else `false`.
60851 * object The object to iterate over.
60852 * @param {Function|Object|string}
60853 * [iteratee=_.identity] The function invoked per iteration.
60855 * [thisArg] The `this` binding of `iteratee`.
60856 * @returns {Object} Returns the new mapped object.
60859 * _.mapValues({ 'a': 1, 'b': 2 }, function(n) { return n * 3; }); // => {
60862 * var users = { 'fred': { 'user': 'fred', 'age': 40 }, 'pebbles': { 'user':
60863 * 'pebbles', 'age': 1 } };
60864 * // using the `_.property` callback shorthand _.mapValues(users, 'age'); // => {
60865 * 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
60867 var mapValues = createObjectMapper();
60870 * The opposite of `_.pick`; this method creates an object composed of the
60871 * own and inherited enumerable properties of `object` that are not omitted.
60877 * object The source object.
60878 * @param {Function|...(string|string[])}
60879 * [predicate] The function invoked per iteration or property
60880 * names to omit, specified as individual property names or
60881 * arrays of property names.
60883 * [thisArg] The `this` binding of `predicate`.
60884 * @returns {Object} Returns the new object.
60887 * var object = { 'user': 'fred', 'age': 40 };
60889 * _.omit(object, 'age'); // => { 'user': 'fred' }
60891 * _.omit(object, _.isNumber); // => { 'user': 'fred' }
60893 var omit = restParam(function(object, props) {
60894 if (object == null) {
60897 if (typeof props[0] != 'function') {
60898 var props = arrayMap(baseFlatten(props), String);
60899 return pickByArray(object, baseDifference(keysIn(object), props));
60901 var predicate = bindCallback(props[0], props[1], 3);
60902 return pickByCallback(object, function(value, key, object) {
60903 return !predicate(value, key, object);
60908 * Creates a two dimensional array of the key-value pairs for `object`, e.g.
60909 * `[[key1, value1], [key2, value2]]`.
60915 * object The object to query.
60916 * @returns {Array} Returns the new array of key-value pairs.
60919 * _.pairs({ 'barney': 36, 'fred': 40 }); // => [['barney', 36], ['fred',
60920 * 40]] (iteration order is not guaranteed)
60922 function pairs(object) {
60923 object = toObject(object);
60926 props = keys(object),
60927 length = props.length,
60928 result = Array(length);
60930 while (++index < length) {
60931 var key = props[index];
60932 result[index] = [key, object[key]];
60938 * Creates an object composed of the picked `object` properties. Property
60939 * names may be specified as individual arguments or as arrays of property
60940 * names. If `predicate` is provided it is invoked for each property of
60941 * `object` picking the properties `predicate` returns truthy for. The
60942 * predicate is bound to `thisArg` and invoked with three arguments: (value,
60949 * object The source object.
60950 * @param {Function|...(string|string[])}
60951 * [predicate] The function invoked per iteration or property
60952 * names to pick, specified as individual property names or
60953 * arrays of property names.
60955 * [thisArg] The `this` binding of `predicate`.
60956 * @returns {Object} Returns the new object.
60959 * var object = { 'user': 'fred', 'age': 40 };
60961 * _.pick(object, 'user'); // => { 'user': 'fred' }
60963 * _.pick(object, _.isString); // => { 'user': 'fred' }
60965 var pick = restParam(function(object, props) {
60966 if (object == null) {
60969 return typeof props[0] == 'function' ? pickByCallback(object, bindCallback(props[0], props[1], 3)) : pickByArray(object, baseFlatten(props));
60973 * This method is like `_.get` except that if the resolved value is a
60974 * function it is invoked with the `this` binding of its parent object and
60975 * its result is returned.
60981 * object The object to query.
60982 * @param {Array|string}
60983 * path The path of the property to resolve.
60985 * [defaultValue] The value returned if the resolved value is
60987 * @returns {*} Returns the resolved value.
60990 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
60992 * _.result(object, 'a[0].b.c1'); // => 3
60994 * _.result(object, 'a[0].b.c2'); // => 4
60996 * _.result(object, 'a.b.c', 'default'); // => 'default'
60998 * _.result(object, 'a.b.c', _.constant('default')); // => 'default'
61000 function result(object, path, defaultValue) {
61001 var result = object == null ? undefined : object[path];
61002 if (result === undefined) {
61003 if (object != null && !isKey(path, object)) {
61004 path = toPath(path);
61005 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
61006 result = object == null ? undefined : object[last(path)];
61008 result = result === undefined ? defaultValue : result;
61010 return isFunction(result) ? result.call(object) : result;
61014 * Sets the property value of `path` on `object`. If a portion of `path`
61015 * does not exist it is created.
61021 * object The object to augment.
61022 * @param {Array|string}
61023 * path The path of the property to set.
61025 * value The value to set.
61026 * @returns {Object} Returns `object`.
61029 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
61031 * _.set(object, 'a[0].b.c', 4); console.log(object.a[0].b.c); // => 4
61033 * _.set(object, 'x[0].y.z', 5); console.log(object.x[0].y.z); // => 5
61035 function set(object, path, value) {
61036 if (object == null) {
61039 var pathKey = (path + '');
61040 path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);
61043 length = path.length,
61044 lastIndex = length - 1,
61047 while (nested != null && ++index < length) {
61048 var key = path[index];
61049 if (isObject(nested)) {
61050 if (index == lastIndex) {
61051 nested[key] = value;
61052 } else if (nested[key] == null) {
61053 nested[key] = isIndex(path[index + 1]) ? [] : {};
61056 nested = nested[key];
61062 * An alternative to `_.reduce`; this method transforms `object` to a new
61063 * `accumulator` object which is the result of running each of its own
61064 * enumerable properties through `iteratee`, with each invocation
61065 * potentially mutating the `accumulator` object. The `iteratee` is bound to
61066 * `thisArg` and invoked with four arguments: (accumulator, value, key,
61067 * object). Iteratee functions may exit iteration early by explicitly
61068 * returning `false`.
61073 * @param {Array|Object}
61074 * object The object to iterate over.
61075 * @param {Function}
61076 * [iteratee=_.identity] The function invoked per iteration.
61078 * [accumulator] The custom accumulator value.
61080 * [thisArg] The `this` binding of `iteratee`.
61081 * @returns {*} Returns the accumulated value.
61084 * _.transform([2, 3, 4], function(result, n) { result.push(n *= n); return
61085 * n % 2 == 0; }); // => [4, 9]
61087 * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) { result[key] =
61088 * n * 3; }); // => { 'a': 3, 'b': 6 }
61090 function transform(object, iteratee, accumulator, thisArg) {
61091 var isArr = isArray(object) || isTypedArray(object);
61092 iteratee = getCallback(iteratee, thisArg, 4);
61094 if (accumulator == null) {
61095 if (isArr || isObject(object)) {
61096 var Ctor = object.constructor;
61098 accumulator = isArray(object) ? new Ctor : [];
61100 accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
61106 (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
61107 return iteratee(accumulator, value, index, object);
61109 return accumulator;
61113 * Creates an array of the own enumerable property values of `object`.
61115 * **Note:** Non-object values are coerced to objects.
61121 * object The object to query.
61122 * @returns {Array} Returns the array of property values.
61125 * function Foo() { this.a = 1; this.b = 2; }
61127 * Foo.prototype.c = 3;
61129 * _.values(new Foo); // => [1, 2] (iteration order is not guaranteed)
61131 * _.values('hi'); // => ['h', 'i']
61133 function values(object) {
61134 return baseValues(object, keys(object));
61138 * Creates an array of the own and inherited enumerable property values of
61141 * **Note:** Non-object values are coerced to objects.
61147 * object The object to query.
61148 * @returns {Array} Returns the array of property values.
61151 * function Foo() { this.a = 1; this.b = 2; }
61153 * Foo.prototype.c = 3;
61155 * _.valuesIn(new Foo); // => [1, 2, 3] (iteration order is not guaranteed)
61157 function valuesIn(object) {
61158 return baseValues(object, keysIn(object));
61161 /*------------------------------------------------------------------------*/
61164 * Checks if `n` is between `start` and up to but not including, `end`. If
61165 * `end` is not specified it is set to `start` with `start` then set to `0`.
61171 * n The number to check.
61173 * [start=0] The start of the range.
61175 * end The end of the range.
61176 * @returns {boolean} Returns `true` if `n` is in the range, else `false`.
61179 * _.inRange(3, 2, 4); // => true
61181 * _.inRange(4, 8); // => true
61183 * _.inRange(4, 2); // => false
61185 * _.inRange(2, 2); // => false
61187 * _.inRange(1.2, 2); // => true
61189 * _.inRange(5.2, 4); // => false
61191 function inRange(value, start, end) {
61192 start = +start || 0;
61193 if (end === undefined) {
61199 return value >= nativeMin(start, end) && value < nativeMax(start, end);
61203 * Produces a random number between `min` and `max` (inclusive). If only one
61204 * argument is provided a number between `0` and the given number is
61205 * returned. If `floating` is `true`, or either `min` or `max` are floats, a
61206 * floating-point number is returned instead of an integer.
61212 * [min=0] The minimum possible value.
61214 * [max=1] The maximum possible value.
61216 * [floating] Specify returning a floating-point number.
61217 * @returns {number} Returns the random number.
61220 * _.random(0, 5); // => an integer between 0 and 5
61222 * _.random(5); // => also an integer between 0 and 5
61224 * _.random(5, true); // => a floating-point number between 0 and 5
61226 * _.random(1.2, 5.2); // => a floating-point number between 1.2 and 5.2
61228 function random(min, max, floating) {
61229 if (floating && isIterateeCall(min, max, floating)) {
61230 max = floating = undefined;
61232 var noMin = min == null,
61233 noMax = max == null;
61235 if (floating == null) {
61236 if (noMax && typeof min == 'boolean') {
61239 } else if (typeof max == 'boolean') {
61244 if (noMin && noMax) {
61255 if (floating || min % 1 || max % 1) {
61256 var rand = nativeRandom();
61257 return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max);
61259 return baseRandom(min, max);
61262 /*------------------------------------------------------------------------*/
61265 * Converts `string` to [camel
61266 * case](https://en.wikipedia.org/wiki/CamelCase).
61272 * [string=''] The string to convert.
61273 * @returns {string} Returns the camel cased string.
61276 * _.camelCase('Foo Bar'); // => 'fooBar'
61278 * _.camelCase('--foo-bar'); // => 'fooBar'
61280 * _.camelCase('__foo_bar__'); // => 'fooBar'
61282 var camelCase = createCompounder(function(result, word, index) {
61283 word = word.toLowerCase();
61284 return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
61288 * Capitalizes the first character of `string`.
61294 * [string=''] The string to capitalize.
61295 * @returns {string} Returns the capitalized string.
61298 * _.capitalize('fred'); // => 'Fred'
61300 function capitalize(string) {
61301 string = baseToString(string);
61302 return string && (string.charAt(0).toUpperCase() + string.slice(1));
61306 * Deburrs `string` by converting [latin-1 supplementary
61307 * letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
61308 * to basic latin letters and removing [combining diacritical
61309 * marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
61315 * [string=''] The string to deburr.
61316 * @returns {string} Returns the deburred string.
61319 * _.deburr('déjàvu'); // => 'deja vu'
61321 function deburr(string) {
61322 string = baseToString(string);
61323 return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
61327 * Checks if `string` ends with the given target string.
61333 * [string=''] The string to search.
61335 * [target] The string to search for.
61337 * [position=string.length] The position to search from.
61338 * @returns {boolean} Returns `true` if `string` ends with `target`, else
61342 * _.endsWith('abc', 'c'); // => true
61344 * _.endsWith('abc', 'b'); // => false
61346 * _.endsWith('abc', 'b', 2); // => true
61348 function endsWith(string, target, position) {
61349 string = baseToString(string);
61350 target = (target + '');
61352 var length = string.length;
61353 position = position === undefined ? length : nativeMin(position < 0 ? 0 : (+position || 0), length);
61355 position -= target.length;
61356 return position >= 0 && string.indexOf(target, position) == position;
61360 * Converts the characters "&", "<", ">", '"', "'", and "\`", in `string`
61361 * to their corresponding HTML entities.
61363 * **Note:** No other characters are escaped. To escape additional
61364 * characters use a third-party library like [_he_](https://mths.be/he).
61366 * Though the ">" character is escaped for symmetry, characters like ">" and
61367 * "/" don't need escaping in HTML and have no special meaning unless
61368 * they're part of a tag or unquoted attribute value. See [Mathias Bynens's
61369 * article](https://mathiasbynens.be/notes/ambiguous-ampersands) (under
61370 * "semi-related fun fact") for more details.
61372 * Backticks are escaped because in Internet Explorer < 9, they can break
61373 * out of attribute values or HTML comments. See
61374 * [#59](https://html5sec.org/#59), [#102](https://html5sec.org/#102),
61375 * [#108](https://html5sec.org/#108), and [#133](https://html5sec.org/#133)
61376 * of the [HTML5 Security Cheatsheet](https://html5sec.org/) for more
61379 * When working with HTML you should always [quote attribute
61380 * values](http://wonko.com/post/html-escaping) to reduce XSS vectors.
61386 * [string=''] The string to escape.
61387 * @returns {string} Returns the escaped string.
61390 * _.escape('fred, barney, & pebbles'); // => 'fred, barney, & pebbles'
61392 function escape(string) {
61393 // Reset `lastIndex` because in IE < 9 `String#replace` does not.
61394 string = baseToString(string);
61395 return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
61399 * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|",
61400 * "?", "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
61406 * [string=''] The string to escape.
61407 * @returns {string} Returns the escaped string.
61410 * _.escapeRegExp('[lodash](https://lodash.com/)'); // =>
61411 * '\[lodash\]\(https:\/\/lodash\.com\/\)'
61413 function escapeRegExp(string) {
61414 string = baseToString(string);
61415 return (string && reHasRegExpChars.test(string)) ? string.replace(reRegExpChars, escapeRegExpChar) : (string || '(?:)');
61419 * Converts `string` to [kebab
61420 * case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
61426 * [string=''] The string to convert.
61427 * @returns {string} Returns the kebab cased string.
61430 * _.kebabCase('Foo Bar'); // => 'foo-bar'
61432 * _.kebabCase('fooBar'); // => 'foo-bar'
61434 * _.kebabCase('__foo_bar__'); // => 'foo-bar'
61436 var kebabCase = createCompounder(function(result, word, index) {
61437 return result + (index ? '-' : '') + word.toLowerCase();
61441 * Pads `string` on the left and right sides if it's shorter than `length`.
61442 * Padding characters are truncated if they can't be evenly divided by
61449 * [string=''] The string to pad.
61451 * [length=0] The padding length.
61453 * [chars=' '] The string used as padding.
61454 * @returns {string} Returns the padded string.
61457 * _.pad('abc', 8); // => ' abc '
61459 * _.pad('abc', 8, '_-'); // => '_-abc_-_'
61461 * _.pad('abc', 3); // => 'abc'
61463 function pad(string, length, chars) {
61464 string = baseToString(string);
61467 var strLength = string.length;
61468 if (strLength >= length || !nativeIsFinite(length)) {
61471 var mid = (length - strLength) / 2,
61472 leftLength = nativeFloor(mid),
61473 rightLength = nativeCeil(mid);
61475 chars = createPadding('', rightLength, chars);
61476 return chars.slice(0, leftLength) + string + chars;
61480 * Pads `string` on the left side if it's shorter than `length`. Padding
61481 * characters are truncated if they exceed `length`.
61487 * [string=''] The string to pad.
61489 * [length=0] The padding length.
61491 * [chars=' '] The string used as padding.
61492 * @returns {string} Returns the padded string.
61495 * _.padLeft('abc', 6); // => ' abc'
61497 * _.padLeft('abc', 6, '_-'); // => '_-_abc'
61499 * _.padLeft('abc', 3); // => 'abc'
61501 var padLeft = createPadDir();
61504 * Pads `string` on the right side if it's shorter than `length`. Padding
61505 * characters are truncated if they exceed `length`.
61511 * [string=''] The string to pad.
61513 * [length=0] The padding length.
61515 * [chars=' '] The string used as padding.
61516 * @returns {string} Returns the padded string.
61519 * _.padRight('abc', 6); // => 'abc '
61521 * _.padRight('abc', 6, '_-'); // => 'abc_-_'
61523 * _.padRight('abc', 3); // => 'abc'
61525 var padRight = createPadDir(true);
61528 * Converts `string` to an integer of the specified radix. If `radix` is
61529 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
61530 * hexadecimal, in which case a `radix` of `16` is used.
61532 * **Note:** This method aligns with the [ES5
61533 * implementation](https://es5.github.io/#E) of `parseInt`.
61539 * string The string to convert.
61541 * [radix] The radix to interpret `value` by.
61542 * @param- {Object} [guard] Enables use as a callback for functions like
61544 * @returns {number} Returns the converted integer.
61547 * _.parseInt('08'); // => 8
61549 * _.map(['6', '08', '10'], _.parseInt); // => [6, 8, 10]
61551 function parseInt(string, radix, guard) {
61552 // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
61553 // Chrome fails to trim leading <BOM> whitespace characters.
61554 // See https://code.google.com/p/v8/issues/detail?id=3109 for more
61556 if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
61558 } else if (radix) {
61561 string = trim(string);
61562 return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
61566 * Repeats the given string `n` times.
61572 * [string=''] The string to repeat.
61574 * [n=0] The number of times to repeat the string.
61575 * @returns {string} Returns the repeated string.
61578 * _.repeat('*', 3); // => '***'
61580 * _.repeat('abc', 2); // => 'abcabc'
61582 * _.repeat('abc', 0); // => ''
61584 function repeat(string, n) {
61586 string = baseToString(string);
61588 if (n < 1 || !string || !nativeIsFinite(n)) {
61591 // Leverage the exponentiation by squaring algorithm for a faster
61593 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more
61599 n = nativeFloor(n / 2);
61607 * Converts `string` to [snake
61608 * case](https://en.wikipedia.org/wiki/Snake_case).
61614 * [string=''] The string to convert.
61615 * @returns {string} Returns the snake cased string.
61618 * _.snakeCase('Foo Bar'); // => 'foo_bar'
61620 * _.snakeCase('fooBar'); // => 'foo_bar'
61622 * _.snakeCase('--foo-bar'); // => 'foo_bar'
61624 var snakeCase = createCompounder(function(result, word, index) {
61625 return result + (index ? '_' : '') + word.toLowerCase();
61629 * Converts `string` to [start
61630 * case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
61636 * [string=''] The string to convert.
61637 * @returns {string} Returns the start cased string.
61640 * _.startCase('--foo-bar'); // => 'Foo Bar'
61642 * _.startCase('fooBar'); // => 'Foo Bar'
61644 * _.startCase('__foo_bar__'); // => 'Foo Bar'
61646 var startCase = createCompounder(function(result, word, index) {
61647 return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
61651 * Checks if `string` starts with the given target string.
61657 * [string=''] The string to search.
61659 * [target] The string to search for.
61661 * [position=0] The position to search from.
61662 * @returns {boolean} Returns `true` if `string` starts with `target`, else
61666 * _.startsWith('abc', 'a'); // => true
61668 * _.startsWith('abc', 'b'); // => false
61670 * _.startsWith('abc', 'b', 1); // => true
61672 function startsWith(string, target, position) {
61673 string = baseToString(string);
61674 position = position == null ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length);
61676 return string.lastIndexOf(target, position) == position;
61680 * Creates a compiled template function that can interpolate data properties
61681 * in "interpolate" delimiters, HTML-escape interpolated data properties in
61682 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters.
61683 * Data properties may be accessed as free variables in the template. If a
61684 * setting object is provided it takes precedence over `_.templateSettings`
61687 * **Note:** In the development build `_.template` utilizes
61688 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
61689 * for easier debugging.
61691 * For more information on precompiling templates see [lodash's custom
61692 * builds documentation](https://lodash.com/custom-builds).
61694 * For more information on Chrome extension sandboxes see [Chrome's
61696 * documentation](https://developer.chrome.com/extensions/sandboxingEval).
61702 * [string=''] The template string.
61704 * [options] The options object.
61706 * [options.escape] The HTML "escape" delimiter.
61708 * [options.evaluate] The "evaluate" delimiter.
61710 * [options.imports] An object to import into the template as
61713 * [options.interpolate] The "interpolate" delimiter.
61715 * [options.sourceURL] The sourceURL of the template's compiled
61718 * [options.variable] The data object variable name.
61719 * @param- {Object} [otherOptions] Enables the legacy `options` param
61721 * @returns {Function} Returns the compiled template function.
61723 * // using the "interpolate" delimiter to create a compiled
61724 * template var compiled = _.template('hello <%= user %>!'); compiled({
61725 * 'user': 'fred' }); // => 'hello fred!'
61726 * // using the HTML "escape" delimiter to escape data property values var
61727 * compiled = _.template('<b><%- value %></b>'); compiled({ 'value': '<script>'
61728 * }); // => '<b><script></b>'
61729 * // using the "evaluate" delimiter to execute JavaScript and generate
61730 * HTML var compiled = _.template('<% _.forEach(users, function(user) { %>
61731 * <li><%- user %></li><% }); %>'); compiled({ 'users': ['fred',
61732 * 'barney'] }); // => '
61735 * // using the internal `print` function in "evaluate" delimiters var
61736 * compiled = _.template('<% print("hello " + user); %>!'); compiled({
61737 * 'user': 'barney' }); // => 'hello barney!'
61738 * // using the ES delimiter as an alternative to the default "interpolate"
61739 * delimiter var compiled = _.template('hello ${ user }!'); compiled({
61740 * 'user': 'pebbles' }); // => 'hello pebbles!'
61741 * // using custom template delimiters _.templateSettings.interpolate =
61742 * /{{([\s\S]+?)}}/g; var compiled = _.template('hello {{ user }}!');
61743 * compiled({ 'user': 'mustache' }); // => 'hello mustache!'
61744 * // using backslashes to treat delimiters as plain text var compiled =
61745 * _.template('<%= "\\<%- value %\\>" %>'); compiled({ 'value': 'ignored'
61746 * }); // => '<%- value %>'
61747 * // using the `imports` option to import `jQuery` as `jq` var text = '<%
61748 * jq.each(users, function(user) { %>
61749 * <li><%- user %></li><% }); %>'; var compiled = _.template(text, {
61750 * 'imports': { 'jq': jQuery } }); compiled({ 'users': ['fred', 'barney']
61754 * // using the `sourceURL` option to specify a custom sourceURL for the
61755 * template var compiled = _.template('hello <%= user %>!', { 'sourceURL':
61756 * '/basic/greeting.jst' }); compiled(data); // => find the source of
61757 * "greeting.jst" under the Sources tab or Resources panel of the web
61759 * // using the `variable` option to ensure a with-statement isn't used in
61760 * the compiled template var compiled = _.template('hi <%= data.user %>!', {
61761 * 'variable': 'data' }); compiled.source; // => function(data) { // var
61762 * __t, __p = ''; // __p += 'hi ' + ((__t = ( data.user )) == null ? '' :
61763 * __t) + '!'; // return __p; // }
61764 * // using the `source` property to inline compiled templates for
61765 * meaningful // line numbers in error messages and a stack trace
61766 * fs.writeFileSync(path.join(cwd, 'jst.js'), '\ var JST = {\ "main": ' +
61767 * _.template(mainText).source + '\ };\ ');
61769 function template(string, options, otherOptions) {
61770 // Based on John Resig's `tmpl` implementation
61771 // (http://ejohn.org/blog/javascript-micro-templating/)
61772 // and Laura Doktorova's doT.js (https://github.com/olado/doT).
61773 var settings = lodash.templateSettings;
61775 if (otherOptions && isIterateeCall(string, options, otherOptions)) {
61776 options = otherOptions = undefined;
61778 string = baseToString(string);
61779 options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
61781 var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
61782 importsKeys = keys(imports),
61783 importsValues = baseValues(imports, importsKeys);
61788 interpolate = options.interpolate || reNoMatch,
61789 source = "__p += '";
61791 // Compile the regexp to match each delimiter.
61792 var reDelimiters = RegExp(
61793 (options.escape || reNoMatch).source + '|' +
61794 interpolate.source + '|' +
61795 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
61796 (options.evaluate || reNoMatch).source + '|$', 'g');
61798 // Use a sourceURL for easier debugging.
61799 var sourceURL = '//# sourceURL=' +
61800 ('sourceURL' in options ? options.sourceURL : ('lodash.templateSources[' + (++templateCounter) + ']')) + '\n';
61802 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
61803 interpolateValue || (interpolateValue = esTemplateValue);
61805 // Escape characters that can't be included in string literals.
61806 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
61808 // Replace delimiters with snippets.
61811 source += "' +\n__e(" + escapeValue + ") +\n'";
61813 if (evaluateValue) {
61814 isEvaluating = true;
61815 source += "';\n" + evaluateValue + ";\n__p += '";
61817 if (interpolateValue) {
61818 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
61820 index = offset + match.length;
61822 // The JS engine embedded in Adobe products requires returning the
61824 // string in order to produce the correct `offset` value.
61830 // If `variable` is not specified wrap a with-statement around the
61832 // code to add the data object to the top of the scope chain.
61833 var variable = options.variable;
61835 source = 'with (obj) {\n' + source + '\n}\n';
61837 // Cleanup code by stripping empty strings.
61838 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
61839 .replace(reEmptyStringMiddle, '$1')
61840 .replace(reEmptyStringTrailing, '$1;');
61842 // Frame code as the function body.
61843 source = 'function(' + (variable || 'obj') + ') {\n' +
61844 (variable ? '' : 'obj || (obj = {});\n') +
61845 "var __t, __p = ''" +
61846 (isEscaping ? ', __e = _.escape' : '') +
61847 (isEvaluating ? ', __j = Array.prototype.join;\n' +
61848 "function print() { __p += __j.call(arguments, '') }\n" : ';\n'
61853 var result = attempt(function() {
61854 return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues);
61857 // Provide the compiled function's source by its `toString` method or
61858 // the `source` property as a convenience for inlining compiled
61860 result.source = source;
61861 if (isError(result)) {
61868 * Removes leading and trailing whitespace or specified characters from
61875 * [string=''] The string to trim.
61877 * [chars=whitespace] The characters to trim.
61878 * @param- {Object} [guard] Enables use as a callback for functions like
61880 * @returns {string} Returns the trimmed string.
61883 * _.trim(' abc '); // => 'abc'
61885 * _.trim('-_-abc-_-', '_-'); // => 'abc'
61887 * _.map([' foo ', ' bar '], _.trim); // => ['foo', 'bar']
61889 function trim(string, chars, guard) {
61890 var value = string;
61891 string = baseToString(string);
61895 if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
61896 return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1);
61898 chars = (chars + '');
61899 return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1);
61903 * Removes leading whitespace or specified characters from `string`.
61909 * [string=''] The string to trim.
61911 * [chars=whitespace] The characters to trim.
61912 * @param- {Object} [guard] Enables use as a callback for functions like
61914 * @returns {string} Returns the trimmed string.
61917 * _.trimLeft(' abc '); // => 'abc '
61919 * _.trimLeft('-_-abc-_-', '_-'); // => 'abc-_-'
61921 function trimLeft(string, chars, guard) {
61922 var value = string;
61923 string = baseToString(string);
61927 if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
61928 return string.slice(trimmedLeftIndex(string));
61930 return string.slice(charsLeftIndex(string, (chars + '')));
61934 * Removes trailing whitespace or specified characters from `string`.
61940 * [string=''] The string to trim.
61942 * [chars=whitespace] The characters to trim.
61943 * @param- {Object} [guard] Enables use as a callback for functions like
61945 * @returns {string} Returns the trimmed string.
61948 * _.trimRight(' abc '); // => ' abc'
61950 * _.trimRight('-_-abc-_-', '_-'); // => '-_-abc'
61952 function trimRight(string, chars, guard) {
61953 var value = string;
61954 string = baseToString(string);
61958 if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
61959 return string.slice(0, trimmedRightIndex(string) + 1);
61961 return string.slice(0, charsRightIndex(string, (chars + '')) + 1);
61965 * Truncates `string` if it's longer than the given maximum string length.
61966 * The last characters of the truncated string are replaced with the
61967 * omission string which defaults to "...".
61973 * [string=''] The string to truncate.
61974 * @param {Object|number}
61975 * [options] The options object or maximum string length.
61977 * [options.length=30] The maximum string length.
61979 * [options.omission='...'] The string to indicate text is
61981 * @param {RegExp|string}
61982 * [options.separator] The separator pattern to truncate to.
61983 * @param- {Object} [guard] Enables use as a callback for functions like
61985 * @returns {string} Returns the truncated string.
61988 * _.trunc('hi-diddly-ho there, neighborino'); // => 'hi-diddly-ho there,
61991 * _.trunc('hi-diddly-ho there, neighborino', 24); // => 'hi-diddly-ho
61994 * _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' '
61995 * }); // => 'hi-diddly-ho there,...'
61997 * _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator':
61998 * /,? +/ }); // => 'hi-diddly-ho there...'
62000 * _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' [...]' }); // =>
62001 * 'hi-diddly-ho there, neig [...]'
62003 function trunc(string, options, guard) {
62004 if (guard && isIterateeCall(string, options, guard)) {
62005 options = undefined;
62007 var length = DEFAULT_TRUNC_LENGTH,
62008 omission = DEFAULT_TRUNC_OMISSION;
62010 if (options != null) {
62011 if (isObject(options)) {
62012 var separator = 'separator' in options ? options.separator : separator;
62013 length = 'length' in options ? (+options.length || 0) : length;
62014 omission = 'omission' in options ? baseToString(options.omission) : omission;
62016 length = +options || 0;
62019 string = baseToString(string);
62020 if (length >= string.length) {
62023 var end = length - omission.length;
62027 var result = string.slice(0, end);
62028 if (separator == null) {
62029 return result + omission;
62031 if (isRegExp(separator)) {
62032 if (string.slice(end).search(separator)) {
62035 substring = string.slice(0, end);
62037 if (!separator.global) {
62038 separator = RegExp(separator.source, (reFlags.exec(separator) || '') + 'g');
62040 separator.lastIndex = 0;
62041 while ((match = separator.exec(substring))) {
62042 newEnd = match.index;
62044 result = result.slice(0, newEnd == null ? end : newEnd);
62046 } else if (string.indexOf(separator, end) != end) {
62047 var index = result.lastIndexOf(separator);
62049 result = result.slice(0, index);
62052 return result + omission;
62056 * The inverse of `_.escape`; this method converts the HTML entities
62057 * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to
62058 * their corresponding characters.
62060 * **Note:** No other HTML entities are unescaped. To unescape additional
62061 * HTML entities use a third-party library like [_he_](https://mths.be/he).
62067 * [string=''] The string to unescape.
62068 * @returns {string} Returns the unescaped string.
62071 * _.unescape('fred, barney, & pebbles'); // => 'fred, barney, &
62074 function unescape(string) {
62075 string = baseToString(string);
62076 return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
62080 * Splits `string` into an array of its words.
62086 * [string=''] The string to inspect.
62087 * @param {RegExp|string}
62088 * [pattern] The pattern to match words.
62089 * @param- {Object} [guard] Enables use as a callback for functions like
62091 * @returns {Array} Returns the words of `string`.
62094 * _.words('fred, barney, & pebbles'); // => ['fred', 'barney', 'pebbles']
62096 * _.words('fred, barney, & pebbles', /[^, ]+/g); // => ['fred', 'barney',
62099 function words(string, pattern, guard) {
62100 if (guard && isIterateeCall(string, pattern, guard)) {
62101 pattern = undefined;
62103 string = baseToString(string);
62104 return string.match(pattern || reWords) || [];
62107 /*------------------------------------------------------------------------*/
62110 * Attempts to invoke `func`, returning either the result or the caught
62111 * error object. Any additional arguments are provided to `func` when it is
62116 * @category Utility
62117 * @param {Function}
62118 * func The function to attempt.
62119 * @returns {*} Returns the `func` result or error object.
62121 * // avoid throwing errors for invalid selectors var elements =
62122 * _.attempt(function(selector) { return
62123 * document.querySelectorAll(selector); }, '>_>');
62125 * if (_.isError(elements)) { elements = []; }
62127 var attempt = restParam(function(func, args) {
62129 return func.apply(undefined, args);
62131 return isError(e) ? e : new Error(e);
62136 * Creates a function that invokes `func` with the `this` binding of
62137 * `thisArg` and arguments of the created function. If `func` is a property
62138 * name the created callback returns the property value for a given element.
62139 * If `func` is an object the created callback returns `true` for elements
62140 * that contain the equivalent object properties, otherwise it returns
62146 * @category Utility
62148 * [func=_.identity] The value to convert to a callback.
62150 * [thisArg] The `this` binding of `func`.
62151 * @param- {Object} [guard] Enables use as a callback for functions like
62153 * @returns {Function} Returns the callback.
62156 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
62158 * // wrap to create custom callback shorthands _.callback =
62159 * _.wrap(_.callback, function(callback, func, thisArg) { var match =
62160 * /^(.+?)__([gl]t)(.+)$/.exec(func); if (!match) { return callback(func,
62161 * thisArg); } return function(object) { return match[2] == 'gt' ?
62162 * object[match[1]] > match[3] : object[match[1]] < match[3]; }; });
62164 * _.filter(users, 'age__gt36'); // => [{ 'user': 'fred', 'age': 40 }]
62166 function callback(func, thisArg, guard) {
62167 if (guard && isIterateeCall(func, thisArg, guard)) {
62168 thisArg = undefined;
62170 return isObjectLike(func) ? matches(func) : baseCallback(func, thisArg);
62174 * Creates a function that returns `value`.
62178 * @category Utility
62180 * value The value to return from the new function.
62181 * @returns {Function} Returns the new function.
62184 * var object = { 'user': 'fred' }; var getter = _.constant(object);
62186 * getter() === object; // => true
62188 function constant(value) {
62189 return function() {
62195 * This method returns the first argument provided to it.
62199 * @category Utility
62202 * @returns {*} Returns `value`.
62205 * var object = { 'user': 'fred' };
62207 * _.identity(object) === object; // => true
62209 function identity(value) {
62214 * Creates a function that performs a deep comparison between a given object
62215 * and `source`, returning `true` if the given object has equivalent
62216 * property values, else `false`.
62218 * **Note:** This method supports comparing arrays, booleans, `Date`
62219 * objects, numbers, `Object` objects, regexes, and strings. Objects are
62220 * compared by their own, not inherited, enumerable properties. For
62221 * comparing a single own or inherited property value see
62222 * `_.matchesProperty`.
62226 * @category Utility
62228 * source The object of property values to match.
62229 * @returns {Function} Returns the new function.
62232 * var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user':
62233 * 'fred', 'age': 40, 'active': false } ];
62235 * _.filter(users, _.matches({ 'age': 40, 'active': false })); // => [{
62236 * 'user': 'fred', 'age': 40, 'active': false }]
62238 function matches(source) {
62239 return baseMatches(baseClone(source, true));
62243 * Creates a function that compares the property value of `path` on a given
62244 * object to `value`.
62246 * **Note:** This method supports comparing arrays, booleans, `Date`
62247 * objects, numbers, `Object` objects, regexes, and strings. Objects are
62248 * compared by their own, not inherited, enumerable properties.
62252 * @category Utility
62253 * @param {Array|string}
62254 * path The path of the property to get.
62256 * srcValue The value to match.
62257 * @returns {Function} Returns the new function.
62260 * var users = [ { 'user': 'barney' }, { 'user': 'fred' } ];
62262 * _.find(users, _.matchesProperty('user', 'fred')); // => { 'user': 'fred' }
62264 function matchesProperty(path, srcValue) {
62265 return baseMatchesProperty(path, baseClone(srcValue, true));
62269 * Creates a function that invokes the method at `path` on a given object.
62270 * Any additional arguments are provided to the invoked method.
62274 * @category Utility
62275 * @param {Array|string}
62276 * path The path of the method to invoke.
62278 * [args] The arguments to invoke the method with.
62279 * @returns {Function} Returns the new function.
62282 * var objects = [ { 'a': { 'b': { 'c': _.constant(2) } } }, { 'a': { 'b': {
62283 * 'c': _.constant(1) } } } ];
62285 * _.map(objects, _.method('a.b.c')); // => [2, 1]
62287 * _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); // =>
62290 var method = restParam(function(path, args) {
62291 return function(object) {
62292 return invokePath(object, path, args);
62297 * The opposite of `_.method`; this method creates a function that invokes
62298 * the method at a given path on `object`. Any additional arguments are
62299 * provided to the invoked method.
62303 * @category Utility
62305 * object The object to query.
62307 * [args] The arguments to invoke the method with.
62308 * @returns {Function} Returns the new function.
62311 * var array = _.times(3, _.constant), object = { 'a': array, 'b': array,
62314 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); // => [2, 0]
62316 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); // => [2, 0]
62318 var methodOf = restParam(function(object, args) {
62319 return function(path) {
62320 return invokePath(object, path, args);
62325 * Adds all own enumerable function properties of a source object to the
62326 * destination object. If `object` is a function then methods are added to
62327 * its prototype as well.
62329 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
62330 * avoid conflicts caused by modifying the original.
62334 * @category Utility
62335 * @param {Function|Object}
62336 * [object=lodash] The destination object.
62338 * source The object of functions to add.
62340 * [options] The options object.
62342 * [options.chain=true] Specify whether the functions added are
62344 * @returns {Function|Object} Returns `object`.
62347 * function vowels(string) { return _.filter(string, function(v) { return
62348 * /[aeiou]/i.test(v); }); }
62350 * _.mixin({ 'vowels': vowels }); _.vowels('fred'); // => ['e']
62352 * _('fred').vowels().value(); // => ['e']
62354 * _.mixin({ 'vowels': vowels }, { 'chain': false }); _('fred').vowels(); // =>
62357 function mixin(object, source, options) {
62358 if (options == null) {
62359 var isObj = isObject(source),
62360 props = isObj ? keys(source) : undefined,
62361 methodNames = (props && props.length) ? baseFunctions(source, props) : undefined;
62363 if (!(methodNames ? methodNames.length : isObj)) {
62364 methodNames = false;
62370 if (!methodNames) {
62371 methodNames = baseFunctions(source, keys(source));
62375 isFunc = isFunction(object),
62376 length = methodNames.length;
62378 if (options === false) {
62380 } else if (isObject(options) && 'chain' in options) {
62381 chain = options.chain;
62383 while (++index < length) {
62384 var methodName = methodNames[index],
62385 func = source[methodName];
62387 object[methodName] = func;
62389 object.prototype[methodName] = (function(func) {
62390 return function() {
62391 var chainAll = this.__chain__;
62392 if (chain || chainAll) {
62393 var result = object(this.__wrapped__),
62394 actions = result.__actions__ = arrayCopy(this.__actions__);
62401 result.__chain__ = chainAll;
62404 return func.apply(object, arrayPush([this.value()], arguments));
62413 * Reverts the `_` variable to its previous value and returns a reference to
62414 * the `lodash` function.
62418 * @category Utility
62419 * @returns {Function} Returns the `lodash` function.
62422 * var lodash = _.noConflict();
62424 function noConflict() {
62430 * A no-operation function that returns `undefined` regardless of the
62431 * arguments it receives.
62435 * @category Utility
62438 * var object = { 'user': 'fred' };
62440 * _.noop(object) === undefined; // => true
62443 // No operation performed.
62447 * Creates a function that returns the property value at `path` on a given
62452 * @category Utility
62453 * @param {Array|string}
62454 * path The path of the property to get.
62455 * @returns {Function} Returns the new function.
62458 * var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ];
62460 * _.map(objects, _.property('a.b.c')); // => [2, 1]
62462 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); // =>
62465 function property(path) {
62466 return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
62470 * The opposite of `_.property`; this method creates a function that returns
62471 * the property value at a given path on `object`.
62475 * @category Utility
62477 * object The object to query.
62478 * @returns {Function} Returns the new function.
62481 * var array = [0, 1, 2], object = { 'a': array, 'b': array, 'c': array };
62483 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); // => [2, 0]
62485 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); // => [2, 0]
62487 function propertyOf(object) {
62488 return function(path) {
62489 return baseGet(object, toPath(path), path + '');
62494 * Creates an array of numbers (positive and/or negative) progressing from
62495 * `start` up to, but not including, `end`. If `end` is not specified it is
62496 * set to `start` with `start` then set to `0`. If `end` is less than
62497 * `start` a zero-length range is created unless a negative `step` is
62502 * @category Utility
62504 * [start=0] The start of the range.
62506 * end The end of the range.
62508 * [step=1] The value to increment or decrement by.
62509 * @returns {Array} Returns the new array of numbers.
62512 * _.range(4); // => [0, 1, 2, 3]
62514 * _.range(1, 5); // => [1, 2, 3, 4]
62516 * _.range(0, 20, 5); // => [0, 5, 10, 15]
62518 * _.range(0, -4, -1); // => [0, -1, -2, -3]
62520 * _.range(1, 4, 0); // => [1, 1, 1]
62522 * _.range(0); // => []
62524 function range(start, end, step) {
62525 if (step && isIterateeCall(start, end, step)) {
62526 end = step = undefined;
62528 start = +start || 0;
62529 step = step == null ? 1 : (+step || 0);
62537 // Use `Array(length)` so engines like Chakra and V8 avoid slower modes.
62538 // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details.
62540 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
62541 result = Array(length);
62543 while (++index < length) {
62544 result[index] = start;
62551 * Invokes the iteratee function `n` times, returning an array of the
62552 * results of each invocation. The `iteratee` is bound to `thisArg` and
62553 * invoked with one argument; (index).
62557 * @category Utility
62559 * n The number of times to invoke `iteratee`.
62560 * @param {Function}
62561 * [iteratee=_.identity] The function invoked per iteration.
62563 * [thisArg] The `this` binding of `iteratee`.
62564 * @returns {Array} Returns the array of results.
62567 * var diceRolls = _.times(3, _.partial(_.random, 1, 6, false)); // => [3,
62570 * _.times(3, function(n) { mage.castSpell(n); }); // => invokes
62571 * `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
62573 * _.times(3, function(n) { this.cast(n); }, mage); // => also invokes
62574 * `mage.castSpell(n)` three times
62576 function times(n, iteratee, thisArg) {
62577 n = nativeFloor(n);
62579 // Exit early to avoid a JSC JIT bug in Safari 8
62580 // where `Array(0)` is treated as `Array(1)`.
62581 if (n < 1 || !nativeIsFinite(n)) {
62585 result = Array(nativeMin(n, MAX_ARRAY_LENGTH));
62587 iteratee = bindCallback(iteratee, thisArg, 1);
62588 while (++index < n) {
62589 if (index < MAX_ARRAY_LENGTH) {
62590 result[index] = iteratee(index);
62599 * Generates a unique ID. If `prefix` is provided the ID is appended to it.
62603 * @category Utility
62605 * [prefix] The value to prefix the ID with.
62606 * @returns {string} Returns the unique ID.
62609 * _.uniqueId('contact_'); // => 'contact_104'
62611 * _.uniqueId(); // => '105'
62613 function uniqueId(prefix) {
62614 var id = ++idCounter;
62615 return baseToString(prefix) + id;
62618 /*------------------------------------------------------------------------*/
62621 * Adds two numbers.
62627 * augend The first number to add.
62629 * addend The second number to add.
62630 * @returns {number} Returns the sum.
62633 * _.add(6, 4); // => 10
62635 function add(augend, addend) {
62636 return (+augend || 0) + (+addend || 0);
62640 * Calculates `n` rounded up to `precision`.
62646 * n The number to round up.
62648 * [precision=0] The precision to round up to.
62649 * @returns {number} Returns the rounded up number.
62652 * _.ceil(4.006); // => 5
62654 * _.ceil(6.004, 2); // => 6.01
62656 * _.ceil(6040, -2); // => 6100
62658 var ceil = createRound('ceil');
62661 * Calculates `n` rounded down to `precision`.
62667 * n The number to round down.
62669 * [precision=0] The precision to round down to.
62670 * @returns {number} Returns the rounded down number.
62673 * _.floor(4.006); // => 4
62675 * _.floor(0.046, 2); // => 0.04
62677 * _.floor(4060, -2); // => 4000
62679 var floor = createRound('floor');
62682 * Gets the maximum value of `collection`. If `collection` is empty or
62683 * falsey `-Infinity` is returned. If an iteratee function is provided it is
62684 * invoked for each value in `collection` to generate the criterion by which
62685 * the value is ranked. The `iteratee` is bound to `thisArg` and invoked
62686 * with three arguments: (value, index, collection).
62688 * If a property name is provided for `iteratee` the created `_.property`
62689 * style callback returns the property value of the given element.
62691 * If a value is also provided for `thisArg` the created `_.matchesProperty`
62692 * style callback returns `true` for elements that have a matching property
62693 * value, else `false`.
62695 * If an object is provided for `iteratee` the created `_.matches` style
62696 * callback returns `true` for elements that have the properties of the
62697 * given object, else `false`.
62702 * @param {Array|Object|string}
62703 * collection The collection to iterate over.
62704 * @param {Function|Object|string}
62705 * [iteratee] The function invoked per iteration.
62707 * [thisArg] The `this` binding of `iteratee`.
62708 * @returns {*} Returns the maximum value.
62711 * _.max([4, 2, 8, 6]); // => 8
62713 * _.max([]); // => -Infinity
62715 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
62718 * _.max(users, function(chr) { return chr.age; }); // => { 'user': 'fred',
62720 * // using the `_.property` callback shorthand _.max(users, 'age'); // => {
62721 * 'user': 'fred', 'age': 40 }
62723 var max = createExtremum(gt, NEGATIVE_INFINITY);
62726 * Gets the minimum value of `collection`. If `collection` is empty or
62727 * falsey `Infinity` is returned. If an iteratee function is provided it is
62728 * invoked for each value in `collection` to generate the criterion by which
62729 * the value is ranked. The `iteratee` is bound to `thisArg` and invoked
62730 * with three arguments: (value, index, collection).
62732 * If a property name is provided for `iteratee` the created `_.property`
62733 * style callback returns the property value of the given element.
62735 * If a value is also provided for `thisArg` the created `_.matchesProperty`
62736 * style callback returns `true` for elements that have a matching property
62737 * value, else `false`.
62739 * If an object is provided for `iteratee` the created `_.matches` style
62740 * callback returns `true` for elements that have the properties of the
62741 * given object, else `false`.
62746 * @param {Array|Object|string}
62747 * collection The collection to iterate over.
62748 * @param {Function|Object|string}
62749 * [iteratee] The function invoked per iteration.
62751 * [thisArg] The `this` binding of `iteratee`.
62752 * @returns {*} Returns the minimum value.
62755 * _.min([4, 2, 8, 6]); // => 2
62757 * _.min([]); // => Infinity
62759 * var users = [ { 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age':
62762 * _.min(users, function(chr) { return chr.age; }); // => { 'user':
62763 * 'barney', 'age': 36 }
62764 * // using the `_.property` callback shorthand _.min(users, 'age'); // => {
62765 * 'user': 'barney', 'age': 36 }
62767 var min = createExtremum(lt, POSITIVE_INFINITY);
62770 * Calculates `n` rounded to `precision`.
62776 * n The number to round.
62778 * [precision=0] The precision to round to.
62779 * @returns {number} Returns the rounded number.
62782 * _.round(4.006); // => 4
62784 * _.round(4.006, 2); // => 4.01
62786 * _.round(4060, -2); // => 4100
62788 var round = createRound('round');
62791 * Gets the sum of the values in `collection`.
62796 * @param {Array|Object|string}
62797 * collection The collection to iterate over.
62798 * @param {Function|Object|string}
62799 * [iteratee] The function invoked per iteration.
62801 * [thisArg] The `this` binding of `iteratee`.
62802 * @returns {number} Returns the sum.
62805 * _.sum([4, 6]); // => 10
62807 * _.sum({ 'a': 4, 'b': 6 }); // => 10
62809 * var objects = [ { 'n': 4 }, { 'n': 6 } ];
62811 * _.sum(objects, function(object) { return object.n; }); // => 10
62812 * // using the `_.property` callback shorthand _.sum(objects, 'n'); // =>
62815 function sum(collection, iteratee, thisArg) {
62816 if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
62817 iteratee = undefined;
62819 iteratee = getCallback(iteratee, thisArg, 3);
62820 return iteratee.length == 1 ? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee) : baseSum(collection, iteratee);
62823 /*------------------------------------------------------------------------*/
62825 // Ensure wrappers are instances of `baseLodash`.
62826 lodash.prototype = baseLodash.prototype;
62828 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
62829 LodashWrapper.prototype.constructor = LodashWrapper;
62831 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
62832 LazyWrapper.prototype.constructor = LazyWrapper;
62834 // Add functions to the `Map` cache.
62835 MapCache.prototype['delete'] = mapDelete;
62836 MapCache.prototype.get = mapGet;
62837 MapCache.prototype.has = mapHas;
62838 MapCache.prototype.set = mapSet;
62840 // Add functions to the `Set` cache.
62841 SetCache.prototype.push = cachePush;
62843 // Assign cache to `_.memoize`.
62844 memoize.Cache = MapCache;
62846 // Add functions that return wrapped values when chaining.
62847 lodash.after = after;
62849 lodash.assign = assign;
62851 lodash.before = before;
62852 lodash.bind = bind;
62853 lodash.bindAll = bindAll;
62854 lodash.bindKey = bindKey;
62855 lodash.callback = callback;
62856 lodash.chain = chain;
62857 lodash.chunk = chunk;
62858 lodash.compact = compact;
62859 lodash.constant = constant;
62860 lodash.countBy = countBy;
62861 lodash.create = create;
62862 lodash.curry = curry;
62863 lodash.curryRight = curryRight;
62864 lodash.debounce = debounce;
62865 lodash.defaults = defaults;
62866 lodash.defaultsDeep = defaultsDeep;
62867 lodash.defer = defer;
62868 lodash.delay = delay;
62869 lodash.difference = difference;
62870 lodash.drop = drop;
62871 lodash.dropRight = dropRight;
62872 lodash.dropRightWhile = dropRightWhile;
62873 lodash.dropWhile = dropWhile;
62874 lodash.fill = fill;
62875 lodash.filter = filter;
62876 lodash.flatten = flatten;
62877 lodash.flattenDeep = flattenDeep;
62878 lodash.flow = flow;
62879 lodash.flowRight = flowRight;
62880 lodash.forEach = forEach;
62881 lodash.forEachRight = forEachRight;
62882 lodash.forIn = forIn;
62883 lodash.forInRight = forInRight;
62884 lodash.forOwn = forOwn;
62885 lodash.forOwnRight = forOwnRight;
62886 lodash.functions = functions;
62887 lodash.groupBy = groupBy;
62888 lodash.indexBy = indexBy;
62889 lodash.initial = initial;
62890 lodash.intersection = intersection;
62891 lodash.invert = invert;
62892 lodash.invoke = invoke;
62893 lodash.keys = keys;
62894 lodash.keysIn = keysIn;
62896 lodash.mapKeys = mapKeys;
62897 lodash.mapValues = mapValues;
62898 lodash.matches = matches;
62899 lodash.matchesProperty = matchesProperty;
62900 lodash.memoize = memoize;
62901 lodash.merge = merge;
62902 lodash.method = method;
62903 lodash.methodOf = methodOf;
62904 lodash.mixin = mixin;
62905 lodash.modArgs = modArgs;
62906 lodash.negate = negate;
62907 lodash.omit = omit;
62908 lodash.once = once;
62909 lodash.pairs = pairs;
62910 lodash.partial = partial;
62911 lodash.partialRight = partialRight;
62912 lodash.partition = partition;
62913 lodash.pick = pick;
62914 lodash.pluck = pluck;
62915 lodash.property = property;
62916 lodash.propertyOf = propertyOf;
62917 lodash.pull = pull;
62918 lodash.pullAt = pullAt;
62919 lodash.range = range;
62920 lodash.rearg = rearg;
62921 lodash.reject = reject;
62922 lodash.remove = remove;
62923 lodash.rest = rest;
62924 lodash.restParam = restParam;
62926 lodash.shuffle = shuffle;
62927 lodash.slice = slice;
62928 lodash.sortBy = sortBy;
62929 lodash.sortByAll = sortByAll;
62930 lodash.sortByOrder = sortByOrder;
62931 lodash.spread = spread;
62932 lodash.take = take;
62933 lodash.takeRight = takeRight;
62934 lodash.takeRightWhile = takeRightWhile;
62935 lodash.takeWhile = takeWhile;
62937 lodash.throttle = throttle;
62938 lodash.thru = thru;
62939 lodash.times = times;
62940 lodash.toArray = toArray;
62941 lodash.toPlainObject = toPlainObject;
62942 lodash.transform = transform;
62943 lodash.union = union;
62944 lodash.uniq = uniq;
62945 lodash.unzip = unzip;
62946 lodash.unzipWith = unzipWith;
62947 lodash.values = values;
62948 lodash.valuesIn = valuesIn;
62949 lodash.where = where;
62950 lodash.without = without;
62951 lodash.wrap = wrap;
62954 lodash.zipObject = zipObject;
62955 lodash.zipWith = zipWith;
62958 lodash.backflow = flowRight;
62959 lodash.collect = map;
62960 lodash.compose = flowRight;
62961 lodash.each = forEach;
62962 lodash.eachRight = forEachRight;
62963 lodash.extend = assign;
62964 lodash.iteratee = callback;
62965 lodash.methods = functions;
62966 lodash.object = zipObject;
62967 lodash.select = filter;
62968 lodash.tail = rest;
62969 lodash.unique = uniq;
62971 // Add functions to `lodash.prototype`.
62972 mixin(lodash, lodash);
62974 /*------------------------------------------------------------------------*/
62976 // Add functions that return unwrapped values when chaining.
62978 lodash.attempt = attempt;
62979 lodash.camelCase = camelCase;
62980 lodash.capitalize = capitalize;
62981 lodash.ceil = ceil;
62982 lodash.clone = clone;
62983 lodash.cloneDeep = cloneDeep;
62984 lodash.deburr = deburr;
62985 lodash.endsWith = endsWith;
62986 lodash.escape = escape;
62987 lodash.escapeRegExp = escapeRegExp;
62988 lodash.every = every;
62989 lodash.find = find;
62990 lodash.findIndex = findIndex;
62991 lodash.findKey = findKey;
62992 lodash.findLast = findLast;
62993 lodash.findLastIndex = findLastIndex;
62994 lodash.findLastKey = findLastKey;
62995 lodash.findWhere = findWhere;
62996 lodash.first = first;
62997 lodash.floor = floor;
63002 lodash.identity = identity;
63003 lodash.includes = includes;
63004 lodash.indexOf = indexOf;
63005 lodash.inRange = inRange;
63006 lodash.isArguments = isArguments;
63007 lodash.isArray = isArray;
63008 lodash.isBoolean = isBoolean;
63009 lodash.isDate = isDate;
63010 lodash.isElement = isElement;
63011 lodash.isEmpty = isEmpty;
63012 lodash.isEqual = isEqual;
63013 lodash.isError = isError;
63014 lodash.isFinite = isFinite;
63015 lodash.isFunction = isFunction;
63016 lodash.isMatch = isMatch;
63017 lodash.isNaN = isNaN;
63018 lodash.isNative = isNative;
63019 lodash.isNull = isNull;
63020 lodash.isNumber = isNumber;
63021 lodash.isObject = isObject;
63022 lodash.isPlainObject = isPlainObject;
63023 lodash.isRegExp = isRegExp;
63024 lodash.isString = isString;
63025 lodash.isTypedArray = isTypedArray;
63026 lodash.isUndefined = isUndefined;
63027 lodash.kebabCase = kebabCase;
63028 lodash.last = last;
63029 lodash.lastIndexOf = lastIndexOf;
63034 lodash.noConflict = noConflict;
63035 lodash.noop = noop;
63038 lodash.padLeft = padLeft;
63039 lodash.padRight = padRight;
63040 lodash.parseInt = parseInt;
63041 lodash.random = random;
63042 lodash.reduce = reduce;
63043 lodash.reduceRight = reduceRight;
63044 lodash.repeat = repeat;
63045 lodash.result = result;
63046 lodash.round = round;
63047 lodash.runInContext = runInContext;
63048 lodash.size = size;
63049 lodash.snakeCase = snakeCase;
63050 lodash.some = some;
63051 lodash.sortedIndex = sortedIndex;
63052 lodash.sortedLastIndex = sortedLastIndex;
63053 lodash.startCase = startCase;
63054 lodash.startsWith = startsWith;
63056 lodash.template = template;
63057 lodash.trim = trim;
63058 lodash.trimLeft = trimLeft;
63059 lodash.trimRight = trimRight;
63060 lodash.trunc = trunc;
63061 lodash.unescape = unescape;
63062 lodash.uniqueId = uniqueId;
63063 lodash.words = words;
63066 lodash.all = every;
63068 lodash.contains = includes;
63069 lodash.eq = isEqual;
63070 lodash.detect = find;
63071 lodash.foldl = reduce;
63072 lodash.foldr = reduceRight;
63073 lodash.head = first;
63074 lodash.include = includes;
63075 lodash.inject = reduce;
63077 mixin(lodash, (function() {
63079 baseForOwn(lodash, function(func, methodName) {
63080 if (!lodash.prototype[methodName]) {
63081 source[methodName] = func;
63087 /*------------------------------------------------------------------------*/
63089 // Add functions capable of returning wrapped and unwrapped values when
63091 lodash.sample = sample;
63093 lodash.prototype.sample = function(n) {
63094 if (!this.__chain__ && n == null) {
63095 return sample(this.value());
63097 return this.thru(function(value) {
63098 return sample(value, n);
63102 /*------------------------------------------------------------------------*/
63105 * The semantic version number.
63111 lodash.VERSION = VERSION;
63113 // Assign default placeholders.
63114 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
63115 lodash[methodName].placeholder = lodash;
63118 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
63119 arrayEach(['drop', 'take'], function(methodName, index) {
63120 LazyWrapper.prototype[methodName] = function(n) {
63121 var filtered = this.__filtered__;
63122 if (filtered && !index) {
63123 return new LazyWrapper(this);
63125 n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0);
63127 var result = this.clone();
63129 result.__takeCount__ = nativeMin(result.__takeCount__, n);
63131 result.__views__.push({
63133 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
63139 LazyWrapper.prototype[methodName + 'Right'] = function(n) {
63140 return this.reverse()[methodName](n).reverse();
63144 // Add `LazyWrapper` methods that accept an `iteratee` value.
63145 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
63146 var type = index + 1,
63147 isFilter = type != LAZY_MAP_FLAG;
63149 LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
63150 var result = this.clone();
63151 result.__iteratees__.push({
63152 'iteratee': getCallback(iteratee, thisArg, 1),
63155 result.__filtered__ = result.__filtered__ || isFilter;
63160 // Add `LazyWrapper` methods for `_.first` and `_.last`.
63161 arrayEach(['first', 'last'], function(methodName, index) {
63162 var takeName = 'take' + (index ? 'Right' : '');
63164 LazyWrapper.prototype[methodName] = function() {
63165 return this[takeName](1).value()[0];
63169 // Add `LazyWrapper` methods for `_.initial` and `_.rest`.
63170 arrayEach(['initial', 'rest'], function(methodName, index) {
63171 var dropName = 'drop' + (index ? '' : 'Right');
63173 LazyWrapper.prototype[methodName] = function() {
63174 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
63178 // Add `LazyWrapper` methods for `_.pluck` and `_.where`.
63179 arrayEach(['pluck', 'where'], function(methodName, index) {
63180 var operationName = index ? 'filter' : 'map',
63181 createCallback = index ? baseMatches : property;
63183 LazyWrapper.prototype[methodName] = function(value) {
63184 return this[operationName](createCallback(value));
63188 LazyWrapper.prototype.compact = function() {
63189 return this.filter(identity);
63192 LazyWrapper.prototype.reject = function(predicate, thisArg) {
63193 predicate = getCallback(predicate, thisArg, 1);
63194 return this.filter(function(value) {
63195 return !predicate(value);
63199 LazyWrapper.prototype.slice = function(start, end) {
63200 start = start == null ? 0 : (+start || 0);
63203 if (result.__filtered__ && (start > 0 || end < 0)) {
63204 return new LazyWrapper(result);
63207 result = result.takeRight(-start);
63208 } else if (start) {
63209 result = result.drop(start);
63211 if (end !== undefined) {
63213 result = end < 0 ? result.dropRight(-end) : result.take(end - start);
63218 LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) {
63219 return this.reverse().takeWhile(predicate, thisArg).reverse();
63222 LazyWrapper.prototype.toArray = function() {
63223 return this.take(POSITIVE_INFINITY);
63226 // Add `LazyWrapper` methods to `lodash.prototype`.
63227 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
63228 var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName),
63229 retUnwrapped = /^(?:first|last)$/.test(methodName),
63230 lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName];
63235 lodash.prototype[methodName] = function() {
63236 var args = retUnwrapped ? [1] : arguments,
63237 chainAll = this.__chain__,
63238 value = this.__wrapped__,
63239 isHybrid = !!this.__actions__.length,
63240 isLazy = value instanceof LazyWrapper,
63241 iteratee = args[0],
63242 useLazy = isLazy || isArray(value);
63244 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
63245 // Avoid lazy use if the iteratee has a "length" value other than
63247 isLazy = useLazy = false;
63249 var interceptor = function(value) {
63250 return (retUnwrapped && chainAll) ? lodashFunc(value, 1)[0] : lodashFunc.apply(undefined, arrayPush([value], args));
63255 'args': [interceptor],
63256 'thisArg': undefined
63258 onlyLazy = isLazy && !isHybrid;
63260 if (retUnwrapped && !chainAll) {
63262 value = value.clone();
63263 value.__actions__.push(action);
63264 return func.call(value);
63266 return lodashFunc.call(undefined, this.value())[0];
63268 if (!retUnwrapped && useLazy) {
63269 value = onlyLazy ? value : new LazyWrapper(this);
63270 var result = func.apply(value, args);
63271 result.__actions__.push(action);
63272 return new LodashWrapper(result, chainAll);
63274 return this.thru(interceptor);
63278 // Add `Array` and `String` methods to `lodash.prototype`.
63279 arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
63280 var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName],
63281 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
63282 retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName);
63284 lodash.prototype[methodName] = function() {
63285 var args = arguments;
63286 if (retUnwrapped && !this.__chain__) {
63287 return func.apply(this.value(), args);
63289 return this[chainName](function(value) {
63290 return func.apply(value, args);
63295 // Map minified function names to their real names.
63296 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
63297 var lodashFunc = lodash[methodName];
63299 var key = lodashFunc.name,
63300 names = realNames[key] || (realNames[key] = []);
63303 'name': methodName,
63309 realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{
63314 // Add functions to the lazy wrapper.
63315 LazyWrapper.prototype.clone = lazyClone;
63316 LazyWrapper.prototype.reverse = lazyReverse;
63317 LazyWrapper.prototype.value = lazyValue;
63319 // Add chaining functions to the `lodash` wrapper.
63320 lodash.prototype.chain = wrapperChain;
63321 lodash.prototype.commit = wrapperCommit;
63322 lodash.prototype.concat = wrapperConcat;
63323 lodash.prototype.plant = wrapperPlant;
63324 lodash.prototype.reverse = wrapperReverse;
63325 lodash.prototype.toString = wrapperToString;
63326 lodash.prototype.run = lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
63328 // Add function aliases to the `lodash` wrapper.
63329 lodash.prototype.collect = lodash.prototype.map;
63330 lodash.prototype.head = lodash.prototype.first;
63331 lodash.prototype.select = lodash.prototype.filter;
63332 lodash.prototype.tail = lodash.prototype.rest;
63337 /*--------------------------------------------------------------------------*/
63340 var _ = runInContext();
63342 // Some AMD build optimizers like r.js check for condition patterns like the
63344 if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
63345 // Expose lodash to the global object when an AMD loader is present to avoid
63346 // errors in cases where lodash is loaded by a script tag and not intended
63347 // as an AMD module. See http://requirejs.org/docs/errors.html#mismatch for
63351 // Define as an anonymous module so, through path mapping, it can be
63352 // referenced as the "underscore" module.
63353 define(function() {
63357 // Check for `exports` after `define` in case a build optimizer adds an
63358 // `exports` object.
63359 else if (freeExports && freeModule) {
63360 // Export for Node.js or RingoJS.
63361 if (moduleExports) {
63362 (freeModule.exports = _)._ = _;
63364 // Export for Rhino with CommonJS support.
63369 // Export for a browser or Rhino.
63374 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
63376 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js": [function(require, module, exports) {
63377 var baseCreate = require('./baseCreate'),
63378 baseLodash = require('./baseLodash');
63380 /** Used as references for `-Infinity` and `Infinity`. */
63381 var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
63384 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
63388 * value The value to wrap.
63390 function LazyWrapper(value) {
63391 this.__wrapped__ = value;
63392 this.__actions__ = [];
63394 this.__filtered__ = false;
63395 this.__iteratees__ = [];
63396 this.__takeCount__ = POSITIVE_INFINITY;
63397 this.__views__ = [];
63400 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
63401 LazyWrapper.prototype.constructor = LazyWrapper;
63403 module.exports = LazyWrapper;
63406 "./baseCreate": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js",
63407 "./baseLodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js"
63409 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LodashWrapper.js": [function(require, module, exports) {
63410 var baseCreate = require('./baseCreate'),
63411 baseLodash = require('./baseLodash');
63414 * The base constructor for creating `lodash` wrapper objects.
63418 * value The value to wrap.
63420 * [chainAll] Enable chaining for all wrapper methods.
63422 * [actions=[]] Actions to peform to resolve the unwrapped value.
63424 function LodashWrapper(value, chainAll, actions) {
63425 this.__wrapped__ = value;
63426 this.__actions__ = actions || [];
63427 this.__chain__ = !!chainAll;
63430 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
63431 LodashWrapper.prototype.constructor = LodashWrapper;
63433 module.exports = LodashWrapper;
63436 "./baseCreate": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js",
63437 "./baseLodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js"
63439 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\SetCache.js": [function(require, module, exports) {
63440 (function(global) {
63441 var cachePush = require('./cachePush'),
63442 getNative = require('./getNative');
63444 /** Native method references. */
63445 var Set = getNative(global, 'Set');
63448 * Native method references for those with the same name as other `lodash`
63451 var nativeCreate = getNative(Object, 'create');
63455 * Creates a cache object to store unique values.
63459 * [values] The values to cache.
63461 function SetCache(values) {
63462 var length = values ? values.length : 0;
63465 'hash': nativeCreate(null),
63469 this.push(values[length]);
63473 // Add functions to the `Set` cache.
63474 SetCache.prototype.push = cachePush;
63476 module.exports = SetCache;
63478 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
63480 "./cachePush": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cachePush.js",
63481 "./getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
63483 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js": [function(require, module, exports) {
63485 * Copies the values of `source` to `array`.
63489 * source The array to copy values from.
63491 * [array=[]] The array to copy values to.
63492 * @returns {Array} Returns `array`.
63494 function arrayCopy(source, array) {
63496 length = source.length;
63498 array || (array = Array(length));
63499 while (++index < length) {
63500 array[index] = source[index];
63505 module.exports = arrayCopy;
63508 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEach.js": [function(require, module, exports) {
63510 * A specialized version of `_.forEach` for arrays without support for callback
63511 * shorthands and `this` binding.
63515 * array The array to iterate over.
63516 * @param {Function}
63517 * iteratee The function invoked per iteration.
63518 * @returns {Array} Returns `array`.
63520 function arrayEach(array, iteratee) {
63522 length = array.length;
63524 while (++index < length) {
63525 if (iteratee(array[index], index, array) === false) {
63532 module.exports = arrayEach;
63535 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEvery.js": [function(require, module, exports) {
63537 * A specialized version of `_.every` for arrays without support for callback
63538 * shorthands and `this` binding.
63542 * array The array to iterate over.
63543 * @param {Function}
63544 * predicate The function invoked per iteration.
63545 * @returns {boolean} Returns `true` if all elements pass the predicate check,
63548 function arrayEvery(array, predicate) {
63550 length = array.length;
63552 while (++index < length) {
63553 if (!predicate(array[index], index, array)) {
63560 module.exports = arrayEvery;
63563 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayFilter.js": [function(require, module, exports) {
63565 * A specialized version of `_.filter` for arrays without support for callback
63566 * shorthands and `this` binding.
63570 * array The array to iterate over.
63571 * @param {Function}
63572 * predicate The function invoked per iteration.
63573 * @returns {Array} Returns the new filtered array.
63575 function arrayFilter(array, predicate) {
63577 length = array.length,
63581 while (++index < length) {
63582 var value = array[index];
63583 if (predicate(value, index, array)) {
63584 result[++resIndex] = value;
63590 module.exports = arrayFilter;
63593 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayMap.js": [function(require, module, exports) {
63595 * A specialized version of `_.map` for arrays without support for callback
63596 * shorthands and `this` binding.
63600 * array The array to iterate over.
63601 * @param {Function}
63602 * iteratee The function invoked per iteration.
63603 * @returns {Array} Returns the new mapped array.
63605 function arrayMap(array, iteratee) {
63607 length = array.length,
63608 result = Array(length);
63610 while (++index < length) {
63611 result[index] = iteratee(array[index], index, array);
63616 module.exports = arrayMap;
63619 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayPush.js": [function(require, module, exports) {
63621 * Appends the elements of `values` to `array`.
63625 * array The array to modify.
63627 * values The values to append.
63628 * @returns {Array} Returns `array`.
63630 function arrayPush(array, values) {
63632 length = values.length,
63633 offset = array.length;
63635 while (++index < length) {
63636 array[offset + index] = values[index];
63641 module.exports = arrayPush;
63644 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayReduce.js": [function(require, module, exports) {
63646 * A specialized version of `_.reduce` for arrays without support for callback
63647 * shorthands and `this` binding.
63651 * array The array to iterate over.
63652 * @param {Function}
63653 * iteratee The function invoked per iteration.
63655 * [accumulator] The initial value.
63657 * [initFromArray] Specify using the first element of `array` as the
63659 * @returns {*} Returns the accumulated value.
63661 function arrayReduce(array, iteratee, accumulator, initFromArray) {
63663 length = array.length;
63665 if (initFromArray && length) {
63666 accumulator = array[++index];
63668 while (++index < length) {
63669 accumulator = iteratee(accumulator, array[index], index, array);
63671 return accumulator;
63674 module.exports = arrayReduce;
63677 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arraySome.js": [function(require, module, exports) {
63679 * A specialized version of `_.some` for arrays without support for callback
63680 * shorthands and `this` binding.
63684 * array The array to iterate over.
63685 * @param {Function}
63686 * predicate The function invoked per iteration.
63687 * @returns {boolean} Returns `true` if any element passes the predicate check,
63690 function arraySome(array, predicate) {
63692 length = array.length;
63694 while (++index < length) {
63695 if (predicate(array[index], index, array)) {
63702 module.exports = arraySome;
63705 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\assignWith.js": [function(require, module, exports) {
63706 var keys = require('../object/keys');
63709 * A specialized version of `_.assign` for customizing assigned values without
63710 * support for argument juggling, multiple sources, and `this` binding
63711 * `customizer` functions.
63715 * object The destination object.
63717 * source The source object.
63718 * @param {Function}
63719 * customizer The function to customize assigned values.
63720 * @returns {Object} Returns `object`.
63722 function assignWith(object, source, customizer) {
63724 props = keys(source),
63725 length = props.length;
63727 while (++index < length) {
63728 var key = props[index],
63729 value = object[key],
63730 result = customizer(value, source[key], key, object, source);
63732 if ((result === result ? (result !== value) : (value === value)) ||
63733 (value === undefined && !(key in object))) {
63734 object[key] = result;
63740 module.exports = assignWith;
63743 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
63745 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseAssign.js": [function(require, module, exports) {
63746 var baseCopy = require('./baseCopy'),
63747 keys = require('../object/keys');
63750 * The base implementation of `_.assign` without support for argument juggling,
63751 * multiple sources, and `customizer` functions.
63755 * object The destination object.
63757 * source The source object.
63758 * @returns {Object} Returns `object`.
63760 function baseAssign(object, source) {
63761 return source == null ? object : baseCopy(source, keys(source), object);
63764 module.exports = baseAssign;
63767 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
63768 "./baseCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCopy.js"
63770 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js": [function(require, module, exports) {
63771 var baseMatches = require('./baseMatches'),
63772 baseMatchesProperty = require('./baseMatchesProperty'),
63773 bindCallback = require('./bindCallback'),
63774 identity = require('../utility/identity'),
63775 property = require('../utility/property');
63778 * The base implementation of `_.callback` which supports specifying the number
63779 * of arguments to provide to `func`.
63783 * [func=_.identity] The value to convert to a callback.
63785 * [thisArg] The `this` binding of `func`.
63787 * [argCount] The number of arguments to provide to `func`.
63788 * @returns {Function} Returns the callback.
63790 function baseCallback(func, thisArg, argCount) {
63791 var type = typeof func;
63792 if (type == 'function') {
63793 return thisArg === undefined ? func : bindCallback(func, thisArg, argCount);
63795 if (func == null) {
63798 if (type == 'object') {
63799 return baseMatches(func);
63801 return thisArg === undefined ? property(func) : baseMatchesProperty(func, thisArg);
63804 module.exports = baseCallback;
63807 "../utility/identity": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js",
63808 "../utility/property": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\property.js",
63809 "./baseMatches": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatches.js",
63810 "./baseMatchesProperty": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatchesProperty.js",
63811 "./bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js"
63813 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCompareAscending.js": [function(require, module, exports) {
63815 * The base implementation of `compareAscending` which compares values and sorts
63816 * them in ascending order without guaranteeing a stable sort.
63820 * value The value to compare.
63822 * other The other value to compare.
63823 * @returns {number} Returns the sort order indicator for `value`.
63825 function baseCompareAscending(value, other) {
63826 if (value !== other) {
63827 var valIsNull = value === null,
63828 valIsUndef = value === undefined,
63829 valIsReflexive = value === value;
63831 var othIsNull = other === null,
63832 othIsUndef = other === undefined,
63833 othIsReflexive = other === other;
63835 if ((value > other && !othIsNull) || !valIsReflexive ||
63836 (valIsNull && !othIsUndef && othIsReflexive) ||
63837 (valIsUndef && othIsReflexive)) {
63840 if ((value < other && !valIsNull) || !othIsReflexive ||
63841 (othIsNull && !valIsUndef && valIsReflexive) ||
63842 (othIsUndef && valIsReflexive)) {
63849 module.exports = baseCompareAscending;
63852 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCopy.js": [function(require, module, exports) {
63854 * Copies properties of `source` to `object`.
63858 * source The object to copy properties from.
63860 * props The property names to copy.
63862 * [object={}] The object to copy properties to.
63863 * @returns {Object} Returns `object`.
63865 function baseCopy(source, props, object) {
63866 object || (object = {});
63869 length = props.length;
63871 while (++index < length) {
63872 var key = props[index];
63873 object[key] = source[key];
63878 module.exports = baseCopy;
63881 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js": [function(require, module, exports) {
63882 var isObject = require('../lang/isObject');
63885 * The base implementation of `_.create` without support for assigning
63886 * properties to the created object.
63890 * prototype The object to inherit from.
63891 * @returns {Object} Returns the new object.
63893 var baseCreate = (function() {
63894 function object() {}
63895 return function(prototype) {
63896 if (isObject(prototype)) {
63897 object.prototype = prototype;
63898 var result = new object;
63899 object.prototype = undefined;
63901 return result || {};
63905 module.exports = baseCreate;
63908 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
63910 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDelay.js": [function(require, module, exports) {
63911 /** Used as the `TypeError` message for "Functions" methods. */
63912 var FUNC_ERROR_TEXT = 'Expected a function';
63915 * The base implementation of `_.delay` and `_.defer` which accepts an index of
63916 * where to slice the arguments to provide to `func`.
63919 * @param {Function}
63920 * func The function to delay.
63922 * wait The number of milliseconds to delay invocation.
63924 * args The arguments provide to `func`.
63925 * @returns {number} Returns the timer id.
63927 function baseDelay(func, wait, args) {
63928 if (typeof func != 'function') {
63929 throw new TypeError(FUNC_ERROR_TEXT);
63931 return setTimeout(function() {
63932 func.apply(undefined, args);
63936 module.exports = baseDelay;
63939 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDifference.js": [function(require, module, exports) {
63940 var baseIndexOf = require('./baseIndexOf'),
63941 cacheIndexOf = require('./cacheIndexOf'),
63942 createCache = require('./createCache');
63944 /** Used as the size to enable large array optimizations. */
63945 var LARGE_ARRAY_SIZE = 200;
63948 * The base implementation of `_.difference` which accepts a single array of
63949 * values to exclude.
63953 * array The array to inspect.
63955 * values The values to exclude.
63956 * @returns {Array} Returns the new array of filtered values.
63958 function baseDifference(array, values) {
63959 var length = array ? array.length : 0,
63966 indexOf = baseIndexOf,
63968 cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,
63969 valuesLength = values.length;
63972 indexOf = cacheIndexOf;
63977 while (++index < length) {
63978 var value = array[index];
63980 if (isCommon && value === value) {
63981 var valuesIndex = valuesLength;
63982 while (valuesIndex--) {
63983 if (values[valuesIndex] === value) {
63987 result.push(value);
63988 } else if (indexOf(values, value, 0) < 0) {
63989 result.push(value);
63995 module.exports = baseDifference;
63998 "./baseIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js",
63999 "./cacheIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cacheIndexOf.js",
64000 "./createCache": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCache.js"
64002 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js": [function(require, module, exports) {
64003 var baseForOwn = require('./baseForOwn'),
64004 createBaseEach = require('./createBaseEach');
64007 * The base implementation of `_.forEach` without support for callback
64008 * shorthands and `this` binding.
64011 * @param {Array|Object|string}
64012 * collection The collection to iterate over.
64013 * @param {Function}
64014 * iteratee The function invoked per iteration.
64015 * @returns {Array|Object|string} Returns `collection`.
64017 var baseEach = createBaseEach(baseForOwn);
64019 module.exports = baseEach;
64022 "./baseForOwn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForOwn.js",
64023 "./createBaseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseEach.js"
64025 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEvery.js": [function(require, module, exports) {
64026 var baseEach = require('./baseEach');
64029 * The base implementation of `_.every` without support for callback shorthands
64030 * and `this` binding.
64033 * @param {Array|Object|string}
64034 * collection The collection to iterate over.
64035 * @param {Function}
64036 * predicate The function invoked per iteration.
64037 * @returns {boolean} Returns `true` if all elements pass the predicate check,
64040 function baseEvery(collection, predicate) {
64042 baseEach(collection, function(value, index, collection) {
64043 result = !!predicate(value, index, collection);
64049 module.exports = baseEvery;
64052 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
64054 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFilter.js": [function(require, module, exports) {
64055 var baseEach = require('./baseEach');
64058 * The base implementation of `_.filter` without support for callback shorthands
64059 * and `this` binding.
64062 * @param {Array|Object|string}
64063 * collection The collection to iterate over.
64064 * @param {Function}
64065 * predicate The function invoked per iteration.
64066 * @returns {Array} Returns the new filtered array.
64068 function baseFilter(collection, predicate) {
64070 baseEach(collection, function(value, index, collection) {
64071 if (predicate(value, index, collection)) {
64072 result.push(value);
64078 module.exports = baseFilter;
64081 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
64083 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFind.js": [function(require, module, exports) {
64085 * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and
64086 * `_.findLastKey`, without support for callback shorthands and `this` binding,
64087 * which iterates over `collection` using the provided `eachFunc`.
64090 * @param {Array|Object|string}
64091 * collection The collection to search.
64092 * @param {Function}
64093 * predicate The function invoked per iteration.
64094 * @param {Function}
64095 * eachFunc The function to iterate over `collection`.
64097 * [retKey] Specify returning the key of the found element instead of
64098 * the element itself.
64099 * @returns {*} Returns the found element or its key, else `undefined`.
64101 function baseFind(collection, predicate, eachFunc, retKey) {
64103 eachFunc(collection, function(value, key, collection) {
64104 if (predicate(value, key, collection)) {
64105 result = retKey ? key : value;
64112 module.exports = baseFind;
64115 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFindIndex.js": [function(require, module, exports) {
64117 * The base implementation of `_.findIndex` and `_.findLastIndex` without
64118 * support for callback shorthands and `this` binding.
64122 * array The array to search.
64123 * @param {Function}
64124 * predicate The function invoked per iteration.
64126 * [fromRight] Specify iterating from right to left.
64127 * @returns {number} Returns the index of the matched value, else `-1`.
64129 function baseFindIndex(array, predicate, fromRight) {
64130 var length = array.length,
64131 index = fromRight ? length : -1;
64133 while ((fromRight ? index-- : ++index < length)) {
64134 if (predicate(array[index], index, array)) {
64141 module.exports = baseFindIndex;
64144 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js": [function(require, module, exports) {
64145 var arrayPush = require('./arrayPush'),
64146 isArguments = require('../lang/isArguments'),
64147 isArray = require('../lang/isArray'),
64148 isArrayLike = require('./isArrayLike'),
64149 isObjectLike = require('./isObjectLike');
64152 * The base implementation of `_.flatten` with added support for restricting
64153 * flattening and specifying the start index.
64157 * array The array to flatten.
64159 * [isDeep] Specify a deep flatten.
64161 * [isStrict] Restrict flattening to arrays-like objects.
64163 * [result=[]] The initial result value.
64164 * @returns {Array} Returns the new flattened array.
64166 function baseFlatten(array, isDeep, isStrict, result) {
64167 result || (result = []);
64170 length = array.length;
64172 while (++index < length) {
64173 var value = array[index];
64174 if (isObjectLike(value) && isArrayLike(value) &&
64175 (isStrict || isArray(value) || isArguments(value))) {
64177 // Recursively flatten arrays (susceptible to call stack limits).
64178 baseFlatten(value, isDeep, isStrict, result);
64180 arrayPush(result, value);
64182 } else if (!isStrict) {
64183 result[result.length] = value;
64189 module.exports = baseFlatten;
64192 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
64193 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64194 "./arrayPush": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayPush.js",
64195 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
64196 "./isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
64198 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFor.js": [function(require, module, exports) {
64199 var createBaseFor = require('./createBaseFor');
64202 * The base implementation of `baseForIn` and `baseForOwn` which iterates over
64203 * `object` properties returned by `keysFunc` invoking `iteratee` for each
64204 * property. Iteratee functions may exit iteration early by explicitly returning
64209 * object The object to iterate over.
64210 * @param {Function}
64211 * iteratee The function invoked per iteration.
64212 * @param {Function}
64213 * keysFunc The function to get the keys of `object`.
64214 * @returns {Object} Returns `object`.
64216 var baseFor = createBaseFor();
64218 module.exports = baseFor;
64221 "./createBaseFor": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseFor.js"
64223 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForIn.js": [function(require, module, exports) {
64224 var baseFor = require('./baseFor'),
64225 keysIn = require('../object/keysIn');
64228 * The base implementation of `_.forIn` without support for callback shorthands
64229 * and `this` binding.
64233 * object The object to iterate over.
64234 * @param {Function}
64235 * iteratee The function invoked per iteration.
64236 * @returns {Object} Returns `object`.
64238 function baseForIn(object, iteratee) {
64239 return baseFor(object, iteratee, keysIn);
64242 module.exports = baseForIn;
64245 "../object/keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js",
64246 "./baseFor": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFor.js"
64248 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForOwn.js": [function(require, module, exports) {
64249 var baseFor = require('./baseFor'),
64250 keys = require('../object/keys');
64253 * The base implementation of `_.forOwn` without support for callback shorthands
64254 * and `this` binding.
64258 * object The object to iterate over.
64259 * @param {Function}
64260 * iteratee The function invoked per iteration.
64261 * @returns {Object} Returns `object`.
64263 function baseForOwn(object, iteratee) {
64264 return baseFor(object, iteratee, keys);
64267 module.exports = baseForOwn;
64270 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
64271 "./baseFor": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFor.js"
64273 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseGet.js": [function(require, module, exports) {
64274 var toObject = require('./toObject');
64277 * The base implementation of `get` without support for string paths and default
64282 * object The object to query.
64284 * path The path of the property to get.
64286 * [pathKey] The key representation of path.
64287 * @returns {*} Returns the resolved value.
64289 function baseGet(object, path, pathKey) {
64290 if (object == null) {
64293 if (pathKey !== undefined && pathKey in toObject(object)) {
64297 length = path.length;
64299 while (object != null && index < length) {
64300 object = object[path[index++]];
64302 return (index && index == length) ? object : undefined;
64305 module.exports = baseGet;
64308 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
64310 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js": [function(require, module, exports) {
64311 var indexOfNaN = require('./indexOfNaN');
64314 * The base implementation of `_.indexOf` without support for binary searches.
64318 * array The array to search.
64320 * value The value to search for.
64322 * fromIndex The index to search from.
64323 * @returns {number} Returns the index of the matched value, else `-1`.
64325 function baseIndexOf(array, value, fromIndex) {
64326 if (value !== value) {
64327 return indexOfNaN(array, fromIndex);
64329 var index = fromIndex - 1,
64330 length = array.length;
64332 while (++index < length) {
64333 if (array[index] === value) {
64340 module.exports = baseIndexOf;
64343 "./indexOfNaN": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\indexOfNaN.js"
64345 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqual.js": [function(require, module, exports) {
64346 var baseIsEqualDeep = require('./baseIsEqualDeep'),
64347 isObject = require('../lang/isObject'),
64348 isObjectLike = require('./isObjectLike');
64351 * The base implementation of `_.isEqual` without support for `this` binding
64352 * `customizer` functions.
64356 * value The value to compare.
64358 * other The other value to compare.
64359 * @param {Function}
64360 * [customizer] The function to customize comparing values.
64362 * [isLoose] Specify performing partial comparisons.
64364 * [stackA] Tracks traversed `value` objects.
64366 * [stackB] Tracks traversed `other` objects.
64367 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
64369 function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
64370 if (value === other) {
64373 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
64374 return value !== value && other !== other;
64376 return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
64379 module.exports = baseIsEqual;
64382 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
64383 "./baseIsEqualDeep": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqualDeep.js",
64384 "./isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
64386 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqualDeep.js": [function(require, module, exports) {
64387 var equalArrays = require('./equalArrays'),
64388 equalByTag = require('./equalByTag'),
64389 equalObjects = require('./equalObjects'),
64390 isArray = require('../lang/isArray'),
64391 isTypedArray = require('../lang/isTypedArray');
64393 /** `Object#toString` result references. */
64394 var argsTag = '[object Arguments]',
64395 arrayTag = '[object Array]',
64396 objectTag = '[object Object]';
64398 /** Used for native method references. */
64399 var objectProto = Object.prototype;
64401 /** Used to check objects for own properties. */
64402 var hasOwnProperty = objectProto.hasOwnProperty;
64405 * Used to resolve the
64406 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
64409 var objToString = objectProto.toString;
64412 * A specialized version of `baseIsEqual` for arrays and objects which performs
64413 * deep comparisons and tracks traversed objects enabling objects with circular
64414 * references to be compared.
64418 * object The object to compare.
64420 * other The other object to compare.
64421 * @param {Function}
64422 * equalFunc The function to determine equivalents of values.
64423 * @param {Function}
64424 * [customizer] The function to customize comparing objects.
64426 * [isLoose] Specify performing partial comparisons.
64428 * [stackA=[]] Tracks traversed `value` objects.
64430 * [stackB=[]] Tracks traversed `other` objects.
64431 * @returns {boolean} Returns `true` if the objects are equivalent, else
64434 function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
64435 var objIsArr = isArray(object),
64436 othIsArr = isArray(other),
64441 objTag = objToString.call(object);
64442 if (objTag == argsTag) {
64443 objTag = objectTag;
64444 } else if (objTag != objectTag) {
64445 objIsArr = isTypedArray(object);
64449 othTag = objToString.call(other);
64450 if (othTag == argsTag) {
64451 othTag = objectTag;
64452 } else if (othTag != objectTag) {
64453 othIsArr = isTypedArray(other);
64456 var objIsObj = objTag == objectTag,
64457 othIsObj = othTag == objectTag,
64458 isSameTag = objTag == othTag;
64460 if (isSameTag && !(objIsArr || objIsObj)) {
64461 return equalByTag(object, other, objTag);
64464 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
64465 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
64467 if (objIsWrapped || othIsWrapped) {
64468 return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
64474 // Assume cyclic values are equal.
64475 // For more information on detecting circular references see
64476 // https://es5.github.io/#JO.
64477 stackA || (stackA = []);
64478 stackB || (stackB = []);
64480 var length = stackA.length;
64482 if (stackA[length] == object) {
64483 return stackB[length] == other;
64486 // Add `object` and `other` to the stack of traversed objects.
64487 stackA.push(object);
64488 stackB.push(other);
64490 var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
64498 module.exports = baseIsEqualDeep;
64501 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64502 "../lang/isTypedArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js",
64503 "./equalArrays": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalArrays.js",
64504 "./equalByTag": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalByTag.js",
64505 "./equalObjects": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalObjects.js"
64507 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsMatch.js": [function(require, module, exports) {
64508 var baseIsEqual = require('./baseIsEqual'),
64509 toObject = require('./toObject');
64512 * The base implementation of `_.isMatch` without support for callback
64513 * shorthands and `this` binding.
64517 * object The object to inspect.
64519 * matchData The propery names, values, and compare flags to match.
64520 * @param {Function}
64521 * [customizer] The function to customize comparing objects.
64522 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
64524 function baseIsMatch(object, matchData, customizer) {
64525 var index = matchData.length,
64527 noCustomizer = !customizer;
64529 if (object == null) {
64532 object = toObject(object);
64534 var data = matchData[index];
64535 if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object)) {
64539 while (++index < length) {
64540 data = matchData[index];
64542 objValue = object[key],
64543 srcValue = data[1];
64545 if (noCustomizer && data[2]) {
64546 if (objValue === undefined && !(key in object)) {
64550 var result = customizer ? customizer(objValue, srcValue, key) : undefined;
64551 if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
64559 module.exports = baseIsMatch;
64562 "./baseIsEqual": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqual.js",
64563 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
64565 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseLodash.js": [function(require, module, exports) {
64567 * The function whose prototype all chaining wrappers inherit from.
64571 function baseLodash() {
64572 // No operation performed.
64575 module.exports = baseLodash;
64578 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMap.js": [function(require, module, exports) {
64579 var baseEach = require('./baseEach'),
64580 isArrayLike = require('./isArrayLike');
64583 * The base implementation of `_.map` without support for callback shorthands
64584 * and `this` binding.
64587 * @param {Array|Object|string}
64588 * collection The collection to iterate over.
64589 * @param {Function}
64590 * iteratee The function invoked per iteration.
64591 * @returns {Array} Returns the new mapped array.
64593 function baseMap(collection, iteratee) {
64595 result = isArrayLike(collection) ? Array(collection.length) : [];
64597 baseEach(collection, function(value, key, collection) {
64598 result[++index] = iteratee(value, key, collection);
64603 module.exports = baseMap;
64606 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js",
64607 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js"
64609 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatches.js": [function(require, module, exports) {
64610 var baseIsMatch = require('./baseIsMatch'),
64611 getMatchData = require('./getMatchData'),
64612 toObject = require('./toObject');
64615 * The base implementation of `_.matches` which does not clone `source`.
64619 * source The object of property values to match.
64620 * @returns {Function} Returns the new function.
64622 function baseMatches(source) {
64623 var matchData = getMatchData(source);
64624 if (matchData.length == 1 && matchData[0][2]) {
64625 var key = matchData[0][0],
64626 value = matchData[0][1];
64628 return function(object) {
64629 if (object == null) {
64632 return object[key] === value && (value !== undefined || (key in toObject(object)));
64635 return function(object) {
64636 return baseIsMatch(object, matchData);
64640 module.exports = baseMatches;
64643 "./baseIsMatch": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsMatch.js",
64644 "./getMatchData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getMatchData.js",
64645 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
64647 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMatchesProperty.js": [function(require, module, exports) {
64648 var baseGet = require('./baseGet'),
64649 baseIsEqual = require('./baseIsEqual'),
64650 baseSlice = require('./baseSlice'),
64651 isArray = require('../lang/isArray'),
64652 isKey = require('./isKey'),
64653 isStrictComparable = require('./isStrictComparable'),
64654 last = require('../array/last'),
64655 toObject = require('./toObject'),
64656 toPath = require('./toPath');
64659 * The base implementation of `_.matchesProperty` which does not clone
64664 * path The path of the property to get.
64666 * srcValue The value to compare.
64667 * @returns {Function} Returns the new function.
64669 function baseMatchesProperty(path, srcValue) {
64670 var isArr = isArray(path),
64671 isCommon = isKey(path) && isStrictComparable(srcValue),
64672 pathKey = (path + '');
64674 path = toPath(path);
64675 return function(object) {
64676 if (object == null) {
64680 object = toObject(object);
64681 if ((isArr || !isCommon) && !(key in object)) {
64682 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
64683 if (object == null) {
64687 object = toObject(object);
64689 return object[key] === srcValue ? (srcValue !== undefined || (key in object)) : baseIsEqual(srcValue, object[key], undefined, true);
64693 module.exports = baseMatchesProperty;
64696 "../array/last": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\array\\last.js",
64697 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64698 "./baseGet": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseGet.js",
64699 "./baseIsEqual": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIsEqual.js",
64700 "./baseSlice": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSlice.js",
64701 "./isKey": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isKey.js",
64702 "./isStrictComparable": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isStrictComparable.js",
64703 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js",
64704 "./toPath": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toPath.js"
64706 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMerge.js": [function(require, module, exports) {
64707 var arrayEach = require('./arrayEach'),
64708 baseMergeDeep = require('./baseMergeDeep'),
64709 isArray = require('../lang/isArray'),
64710 isArrayLike = require('./isArrayLike'),
64711 isObject = require('../lang/isObject'),
64712 isObjectLike = require('./isObjectLike'),
64713 isTypedArray = require('../lang/isTypedArray'),
64714 keys = require('../object/keys');
64717 * The base implementation of `_.merge` without support for argument juggling,
64718 * multiple sources, and `this` binding `customizer` functions.
64722 * object The destination object.
64724 * source The source object.
64725 * @param {Function}
64726 * [customizer] The function to customize merged values.
64728 * [stackA=[]] Tracks traversed source objects.
64730 * [stackB=[]] Associates values with source counterparts.
64731 * @returns {Object} Returns `object`.
64733 function baseMerge(object, source, customizer, stackA, stackB) {
64734 if (!isObject(object)) {
64737 var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
64738 props = isSrcArr ? undefined : keys(source);
64740 arrayEach(props || source, function(srcValue, key) {
64743 srcValue = source[key];
64745 if (isObjectLike(srcValue)) {
64746 stackA || (stackA = []);
64747 stackB || (stackB = []);
64748 baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
64750 var value = object[key],
64751 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
64752 isCommon = result === undefined;
64757 if ((result !== undefined || (isSrcArr && !(key in object))) &&
64758 (isCommon || (result === result ? (result !== value) : (value === value)))) {
64759 object[key] = result;
64766 module.exports = baseMerge;
64769 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64770 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
64771 "../lang/isTypedArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js",
64772 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js",
64773 "./arrayEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayEach.js",
64774 "./baseMergeDeep": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMergeDeep.js",
64775 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
64776 "./isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
64778 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMergeDeep.js": [function(require, module, exports) {
64779 var arrayCopy = require('./arrayCopy'),
64780 isArguments = require('../lang/isArguments'),
64781 isArray = require('../lang/isArray'),
64782 isArrayLike = require('./isArrayLike'),
64783 isPlainObject = require('../lang/isPlainObject'),
64784 isTypedArray = require('../lang/isTypedArray'),
64785 toPlainObject = require('../lang/toPlainObject');
64788 * A specialized version of `baseMerge` for arrays and objects which performs
64789 * deep merges and tracks traversed objects enabling objects with circular
64790 * references to be merged.
64794 * object The destination object.
64796 * source The source object.
64798 * key The key of the value to merge.
64799 * @param {Function}
64800 * mergeFunc The function to merge values.
64801 * @param {Function}
64802 * [customizer] The function to customize merged values.
64804 * [stackA=[]] Tracks traversed source objects.
64806 * [stackB=[]] Associates values with source counterparts.
64807 * @returns {boolean} Returns `true` if the objects are equivalent, else
64810 function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
64811 var length = stackA.length,
64812 srcValue = source[key];
64815 if (stackA[length] == srcValue) {
64816 object[key] = stackB[length];
64820 var value = object[key],
64821 result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
64822 isCommon = result === undefined;
64826 if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
64827 result = isArray(value) ? value : (isArrayLike(value) ? arrayCopy(value) : []);
64828 } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
64829 result = isArguments(value) ? toPlainObject(value) : (isPlainObject(value) ? value : {});
64834 // Add the source value to the stack of traversed objects and associate
64835 // it with its merged value.
64836 stackA.push(srcValue);
64837 stackB.push(result);
64840 // Recursively merge objects and arrays (susceptible to call stack limits).
64841 object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
64842 } else if (result === result ? (result !== value) : (value === value)) {
64843 object[key] = result;
64847 module.exports = baseMergeDeep;
64850 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
64851 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
64852 "../lang/isPlainObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isPlainObject.js",
64853 "../lang/isTypedArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js",
64854 "../lang/toPlainObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\toPlainObject.js",
64855 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
64856 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js"
64858 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseProperty.js": [function(require, module, exports) {
64860 * The base implementation of `_.property` without support for deep paths.
64864 * key The key of the property to get.
64865 * @returns {Function} Returns the new function.
64867 function baseProperty(key) {
64868 return function(object) {
64869 return object == null ? undefined : object[key];
64873 module.exports = baseProperty;
64876 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\basePropertyDeep.js": [function(require, module, exports) {
64877 var baseGet = require('./baseGet'),
64878 toPath = require('./toPath');
64881 * A specialized version of `baseProperty` which supports deep paths.
64884 * @param {Array|string}
64885 * path The path of the property to get.
64886 * @returns {Function} Returns the new function.
64888 function basePropertyDeep(path) {
64889 var pathKey = (path + '');
64890 path = toPath(path);
64891 return function(object) {
64892 return baseGet(object, path, pathKey);
64896 module.exports = basePropertyDeep;
64899 "./baseGet": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseGet.js",
64900 "./toPath": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toPath.js"
64902 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseReduce.js": [function(require, module, exports) {
64904 * The base implementation of `_.reduce` and `_.reduceRight` without support for
64905 * callback shorthands and `this` binding, which iterates over `collection`
64906 * using the provided `eachFunc`.
64909 * @param {Array|Object|string}
64910 * collection The collection to iterate over.
64911 * @param {Function}
64912 * iteratee The function invoked per iteration.
64914 * accumulator The initial value.
64916 * initFromCollection Specify using the first or last element of
64917 * `collection` as the initial value.
64918 * @param {Function}
64919 * eachFunc The function to iterate over `collection`.
64920 * @returns {*} Returns the accumulated value.
64922 function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
64923 eachFunc(collection, function(value, index, collection) {
64924 accumulator = initFromCollection ? (initFromCollection = false, value) : iteratee(accumulator, value, index, collection);
64926 return accumulator;
64929 module.exports = baseReduce;
64932 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSetData.js": [function(require, module, exports) {
64933 var identity = require('../utility/identity'),
64934 metaMap = require('./metaMap');
64937 * The base implementation of `setData` without support for hot loop detection.
64940 * @param {Function}
64941 * func The function to associate metadata with.
64943 * data The metadata.
64944 * @returns {Function} Returns `func`.
64946 var baseSetData = !metaMap ? identity : function(func, data) {
64947 metaMap.set(func, data);
64951 module.exports = baseSetData;
64954 "../utility/identity": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js",
64955 "./metaMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\metaMap.js"
64957 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSlice.js": [function(require, module, exports) {
64959 * The base implementation of `_.slice` without an iteratee call guard.
64963 * array The array to slice.
64965 * [start=0] The start position.
64967 * [end=array.length] The end position.
64968 * @returns {Array} Returns the slice of `array`.
64970 function baseSlice(array, start, end) {
64972 length = array.length;
64974 start = start == null ? 0 : (+start || 0);
64976 start = -start > length ? 0 : (length + start);
64978 end = (end === undefined || end > length) ? length : (+end || 0);
64982 length = start > end ? 0 : ((end - start) >>> 0);
64985 var result = Array(length);
64986 while (++index < length) {
64987 result[index] = array[index + start];
64992 module.exports = baseSlice;
64995 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSome.js": [function(require, module, exports) {
64996 var baseEach = require('./baseEach');
64999 * The base implementation of `_.some` without support for callback shorthands
65000 * and `this` binding.
65003 * @param {Array|Object|string}
65004 * collection The collection to iterate over.
65005 * @param {Function}
65006 * predicate The function invoked per iteration.
65007 * @returns {boolean} Returns `true` if any element passes the predicate check,
65010 function baseSome(collection, predicate) {
65013 baseEach(collection, function(value, index, collection) {
65014 result = predicate(value, index, collection);
65020 module.exports = baseSome;
65023 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
65025 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSortBy.js": [function(require, module, exports) {
65027 * The base implementation of `_.sortBy` which uses `comparer` to define the
65028 * sort order of `array` and replaces criteria objects with their corresponding
65033 * array The array to sort.
65034 * @param {Function}
65035 * comparer The function to define sort order.
65036 * @returns {Array} Returns `array`.
65038 function baseSortBy(array, comparer) {
65039 var length = array.length;
65041 array.sort(comparer);
65043 array[length] = array[length].value;
65048 module.exports = baseSortBy;
65051 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseToString.js": [function(require, module, exports) {
65053 * Converts `value` to a string if it's not one. An empty string is returned for
65054 * `null` or `undefined` values.
65058 * value The value to process.
65059 * @returns {string} Returns the string.
65061 function baseToString(value) {
65062 return value == null ? '' : (value + '');
65065 module.exports = baseToString;
65068 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseUniq.js": [function(require, module, exports) {
65069 var baseIndexOf = require('./baseIndexOf'),
65070 cacheIndexOf = require('./cacheIndexOf'),
65071 createCache = require('./createCache');
65073 /** Used as the size to enable large array optimizations. */
65074 var LARGE_ARRAY_SIZE = 200;
65077 * The base implementation of `_.uniq` without support for callback shorthands
65078 * and `this` binding.
65082 * array The array to inspect.
65083 * @param {Function}
65084 * [iteratee] The function invoked per iteration.
65085 * @returns {Array} Returns the new duplicate free array.
65087 function baseUniq(array, iteratee) {
65089 indexOf = baseIndexOf,
65090 length = array.length,
65092 isLarge = isCommon && length >= LARGE_ARRAY_SIZE,
65093 seen = isLarge ? createCache() : null,
65097 indexOf = cacheIndexOf;
65101 seen = iteratee ? [] : result;
65104 while (++index < length) {
65105 var value = array[index],
65106 computed = iteratee ? iteratee(value, index, array) : value;
65108 if (isCommon && value === value) {
65109 var seenIndex = seen.length;
65110 while (seenIndex--) {
65111 if (seen[seenIndex] === computed) {
65116 seen.push(computed);
65118 result.push(value);
65119 } else if (indexOf(seen, computed, 0) < 0) {
65120 if (iteratee || isLarge) {
65121 seen.push(computed);
65123 result.push(value);
65129 module.exports = baseUniq;
65132 "./baseIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseIndexOf.js",
65133 "./cacheIndexOf": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cacheIndexOf.js",
65134 "./createCache": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCache.js"
65136 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseValues.js": [function(require, module, exports) {
65138 * The base implementation of `_.values` and `_.valuesIn` which creates an array
65139 * of `object` property values corresponding to the property names of `props`.
65143 * object The object to query.
65145 * props The property names to get values for.
65146 * @returns {Object} Returns the array of property values.
65148 function baseValues(object, props) {
65150 length = props.length,
65151 result = Array(length);
65153 while (++index < length) {
65154 result[index] = object[props[index]];
65159 module.exports = baseValues;
65162 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js": [function(require, module, exports) {
65163 var identity = require('../utility/identity');
65166 * A specialized version of `baseCallback` which only supports `this` binding
65167 * and specifying the number of arguments to provide to `func`.
65170 * @param {Function}
65171 * func The function to bind.
65173 * thisArg The `this` binding of `func`.
65175 * [argCount] The number of arguments to provide to `func`.
65176 * @returns {Function} Returns the callback.
65178 function bindCallback(func, thisArg, argCount) {
65179 if (typeof func != 'function') {
65182 if (thisArg === undefined) {
65185 switch (argCount) {
65187 return function(value) {
65188 return func.call(thisArg, value);
65191 return function(value, index, collection) {
65192 return func.call(thisArg, value, index, collection);
65195 return function(accumulator, value, index, collection) {
65196 return func.call(thisArg, accumulator, value, index, collection);
65199 return function(value, other, key, object, source) {
65200 return func.call(thisArg, value, other, key, object, source);
65203 return function() {
65204 return func.apply(thisArg, arguments);
65208 module.exports = bindCallback;
65211 "../utility/identity": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js"
65213 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cacheIndexOf.js": [function(require, module, exports) {
65214 var isObject = require('../lang/isObject');
65217 * Checks if `value` is in `cache` mimicking the return signature of `_.indexOf`
65218 * by returning `0` if the value is found, else `-1`.
65222 * cache The cache to search.
65224 * value The value to search for.
65225 * @returns {number} Returns `0` if `value` is found, else `-1`.
65227 function cacheIndexOf(cache, value) {
65228 var data = cache.data,
65229 result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
65231 return result ? 0 : -1;
65234 module.exports = cacheIndexOf;
65237 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
65239 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\cachePush.js": [function(require, module, exports) {
65240 var isObject = require('../lang/isObject');
65243 * Adds `value` to the cache.
65247 * @memberOf SetCache
65249 * value The value to cache.
65251 function cachePush(value) {
65252 var data = this.data;
65253 if (typeof value == 'string' || isObject(value)) {
65254 data.set.add(value);
65256 data.hash[value] = true;
65260 module.exports = cachePush;
65263 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
65265 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\compareAscending.js": [function(require, module, exports) {
65266 var baseCompareAscending = require('./baseCompareAscending');
65269 * Used by `_.sortBy` to compare transformed elements of a collection and stable
65270 * sort them in ascending order.
65274 * object The object to compare.
65276 * other The other object to compare.
65277 * @returns {number} Returns the sort order indicator for `object`.
65279 function compareAscending(object, other) {
65280 return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
65283 module.exports = compareAscending;
65286 "./baseCompareAscending": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCompareAscending.js"
65288 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgs.js": [function(require, module, exports) {
65290 * Native method references for those with the same name as other `lodash`
65293 var nativeMax = Math.max;
65296 * Creates an array that is the composition of partially applied arguments,
65297 * placeholders, and provided arguments into a single array of arguments.
65300 * @param {Array|Object}
65301 * args The provided arguments.
65303 * partials The arguments to prepend to those provided.
65305 * holders The `partials` placeholder indexes.
65306 * @returns {Array} Returns the new array of composed arguments.
65308 function composeArgs(args, partials, holders) {
65309 var holdersLength = holders.length,
65311 argsLength = nativeMax(args.length - holdersLength, 0),
65313 leftLength = partials.length,
65314 result = Array(leftLength + argsLength);
65316 while (++leftIndex < leftLength) {
65317 result[leftIndex] = partials[leftIndex];
65319 while (++argsIndex < holdersLength) {
65320 result[holders[argsIndex]] = args[argsIndex];
65322 while (argsLength--) {
65323 result[leftIndex++] = args[argsIndex++];
65328 module.exports = composeArgs;
65331 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgsRight.js": [function(require, module, exports) {
65333 * Native method references for those with the same name as other `lodash`
65336 var nativeMax = Math.max;
65339 * This function is like `composeArgs` except that the arguments composition is
65340 * tailored for `_.partialRight`.
65343 * @param {Array|Object}
65344 * args The provided arguments.
65346 * partials The arguments to append to those provided.
65348 * holders The `partials` placeholder indexes.
65349 * @returns {Array} Returns the new array of composed arguments.
65351 function composeArgsRight(args, partials, holders) {
65352 var holdersIndex = -1,
65353 holdersLength = holders.length,
65355 argsLength = nativeMax(args.length - holdersLength, 0),
65357 rightLength = partials.length,
65358 result = Array(argsLength + rightLength);
65360 while (++argsIndex < argsLength) {
65361 result[argsIndex] = args[argsIndex];
65363 var offset = argsIndex;
65364 while (++rightIndex < rightLength) {
65365 result[offset + rightIndex] = partials[rightIndex];
65367 while (++holdersIndex < holdersLength) {
65368 result[offset + holders[holdersIndex]] = args[argsIndex++];
65373 module.exports = composeArgsRight;
65376 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAggregator.js": [function(require, module, exports) {
65377 var baseCallback = require('./baseCallback'),
65378 baseEach = require('./baseEach'),
65379 isArray = require('../lang/isArray');
65382 * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.
65385 * @param {Function}
65386 * setter The function to set keys and values of the accumulator
65388 * @param {Function}
65389 * [initializer] The function to initialize the accumulator object.
65390 * @returns {Function} Returns the new aggregator function.
65392 function createAggregator(setter, initializer) {
65393 return function(collection, iteratee, thisArg) {
65394 var result = initializer ? initializer() : {};
65395 iteratee = baseCallback(iteratee, thisArg, 3);
65397 if (isArray(collection)) {
65399 length = collection.length;
65401 while (++index < length) {
65402 var value = collection[index];
65403 setter(result, value, iteratee(value, index, collection), collection);
65406 baseEach(collection, function(value, key, collection) {
65407 setter(result, value, iteratee(value, key, collection), collection);
65414 module.exports = createAggregator;
65417 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65418 "./baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
65419 "./baseEach": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseEach.js"
65421 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAssigner.js": [function(require, module, exports) {
65422 var bindCallback = require('./bindCallback'),
65423 isIterateeCall = require('./isIterateeCall'),
65424 restParam = require('../function/restParam');
65427 * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
65430 * @param {Function}
65431 * assigner The function to assign values.
65432 * @returns {Function} Returns the new assigner function.
65434 function createAssigner(assigner) {
65435 return restParam(function(object, sources) {
65437 length = object == null ? 0 : sources.length,
65438 customizer = length > 2 ? sources[length - 2] : undefined,
65439 guard = length > 2 ? sources[2] : undefined,
65440 thisArg = length > 1 ? sources[length - 1] : undefined;
65442 if (typeof customizer == 'function') {
65443 customizer = bindCallback(customizer, thisArg, 5);
65446 customizer = typeof thisArg == 'function' ? thisArg : undefined;
65447 length -= (customizer ? 1 : 0);
65449 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
65450 customizer = length < 3 ? undefined : customizer;
65453 while (++index < length) {
65454 var source = sources[index];
65456 assigner(object, source, customizer);
65463 module.exports = createAssigner;
65466 "../function/restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js",
65467 "./bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js",
65468 "./isIterateeCall": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js"
65470 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseEach.js": [function(require, module, exports) {
65471 var getLength = require('./getLength'),
65472 isLength = require('./isLength'),
65473 toObject = require('./toObject');
65476 * Creates a `baseEach` or `baseEachRight` function.
65479 * @param {Function}
65480 * eachFunc The function to iterate over a collection.
65482 * [fromRight] Specify iterating from right to left.
65483 * @returns {Function} Returns the new base function.
65485 function createBaseEach(eachFunc, fromRight) {
65486 return function(collection, iteratee) {
65487 var length = collection ? getLength(collection) : 0;
65488 if (!isLength(length)) {
65489 return eachFunc(collection, iteratee);
65491 var index = fromRight ? length : -1,
65492 iterable = toObject(collection);
65494 while ((fromRight ? index-- : ++index < length)) {
65495 if (iteratee(iterable[index], index, iterable) === false) {
65503 module.exports = createBaseEach;
65506 "./getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
65507 "./isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
65508 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
65510 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBaseFor.js": [function(require, module, exports) {
65511 var toObject = require('./toObject');
65514 * Creates a base function for `_.forIn` or `_.forInRight`.
65518 * [fromRight] Specify iterating from right to left.
65519 * @returns {Function} Returns the new base function.
65521 function createBaseFor(fromRight) {
65522 return function(object, iteratee, keysFunc) {
65523 var iterable = toObject(object),
65524 props = keysFunc(object),
65525 length = props.length,
65526 index = fromRight ? length : -1;
65528 while ((fromRight ? index-- : ++index < length)) {
65529 var key = props[index];
65530 if (iteratee(iterable[key], key, iterable) === false) {
65538 module.exports = createBaseFor;
65541 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
65543 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBindWrapper.js": [function(require, module, exports) {
65544 (function(global) {
65545 var createCtorWrapper = require('./createCtorWrapper');
65548 * Creates a function that wraps `func` and invokes it with the `this` binding
65552 * @param {Function}
65553 * func The function to bind.
65555 * [thisArg] The `this` binding of `func`.
65556 * @returns {Function} Returns the new bound function.
65558 function createBindWrapper(func, thisArg) {
65559 var Ctor = createCtorWrapper(func);
65561 function wrapper() {
65562 var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
65563 return fn.apply(thisArg, arguments);
65568 module.exports = createBindWrapper;
65570 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65572 "./createCtorWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js"
65574 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCache.js": [function(require, module, exports) {
65575 (function(global) {
65576 var SetCache = require('./SetCache'),
65577 getNative = require('./getNative');
65579 /** Native method references. */
65580 var Set = getNative(global, 'Set');
65583 * Native method references for those with the same name as other `lodash`
65586 var nativeCreate = getNative(Object, 'create');
65589 * Creates a `Set` cache object to optimize linear searches of large arrays.
65593 * [values] The values to cache.
65594 * @returns {null|Object} Returns the new cache object if `Set` is supported,
65597 function createCache(values) {
65598 return (nativeCreate && Set) ? new SetCache(values) : null;
65601 module.exports = createCache;
65603 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65605 "./SetCache": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\SetCache.js",
65606 "./getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
65608 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js": [function(require, module, exports) {
65609 var baseCreate = require('./baseCreate'),
65610 isObject = require('../lang/isObject');
65613 * Creates a function that produces an instance of `Ctor` regardless of whether
65614 * it was invoked as part of a `new` expression or by `call` or `apply`.
65617 * @param {Function}
65618 * Ctor The constructor to wrap.
65619 * @returns {Function} Returns the new wrapped function.
65621 function createCtorWrapper(Ctor) {
65622 return function() {
65623 // Use a `switch` statement to work with class constructors.
65625 // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
65626 // for more details.
65627 var args = arguments;
65628 switch (args.length) {
65632 return new Ctor(args[0]);
65634 return new Ctor(args[0], args[1]);
65636 return new Ctor(args[0], args[1], args[2]);
65638 return new Ctor(args[0], args[1], args[2], args[3]);
65640 return new Ctor(args[0], args[1], args[2], args[3], args[4]);
65642 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
65644 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
65646 var thisBinding = baseCreate(Ctor.prototype),
65647 result = Ctor.apply(thisBinding, args);
65649 // Mimic the constructor's `return` behavior.
65650 // See https://es5.github.io/#x13.2.2 for more details.
65651 return isObject(result) ? result : thisBinding;
65655 module.exports = createCtorWrapper;
65658 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
65659 "./baseCreate": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCreate.js"
65661 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createFind.js": [function(require, module, exports) {
65662 var baseCallback = require('./baseCallback'),
65663 baseFind = require('./baseFind'),
65664 baseFindIndex = require('./baseFindIndex'),
65665 isArray = require('../lang/isArray');
65668 * Creates a `_.find` or `_.findLast` function.
65671 * @param {Function}
65672 * eachFunc The function to iterate over a collection.
65674 * [fromRight] Specify iterating from right to left.
65675 * @returns {Function} Returns the new find function.
65677 function createFind(eachFunc, fromRight) {
65678 return function(collection, predicate, thisArg) {
65679 predicate = baseCallback(predicate, thisArg, 3);
65680 if (isArray(collection)) {
65681 var index = baseFindIndex(collection, predicate, fromRight);
65682 return index > -1 ? collection[index] : undefined;
65684 return baseFind(collection, predicate, eachFunc);
65688 module.exports = createFind;
65691 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65692 "./baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
65693 "./baseFind": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFind.js",
65694 "./baseFindIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFindIndex.js"
65696 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createForEach.js": [function(require, module, exports) {
65697 var bindCallback = require('./bindCallback'),
65698 isArray = require('../lang/isArray');
65701 * Creates a function for `_.forEach` or `_.forEachRight`.
65704 * @param {Function}
65705 * arrayFunc The function to iterate over an array.
65706 * @param {Function}
65707 * eachFunc The function to iterate over a collection.
65708 * @returns {Function} Returns the new each function.
65710 function createForEach(arrayFunc, eachFunc) {
65711 return function(collection, iteratee, thisArg) {
65712 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee) : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
65716 module.exports = createForEach;
65719 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65720 "./bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js"
65722 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createHybridWrapper.js": [function(require, module, exports) {
65723 (function(global) {
65724 var arrayCopy = require('./arrayCopy'),
65725 composeArgs = require('./composeArgs'),
65726 composeArgsRight = require('./composeArgsRight'),
65727 createCtorWrapper = require('./createCtorWrapper'),
65728 isLaziable = require('./isLaziable'),
65729 reorder = require('./reorder'),
65730 replaceHolders = require('./replaceHolders'),
65731 setData = require('./setData');
65733 /** Used to compose bitmasks for wrapper metadata. */
65736 CURRY_BOUND_FLAG = 4,
65738 CURRY_RIGHT_FLAG = 16,
65740 PARTIAL_RIGHT_FLAG = 64,
65744 * Native method references for those with the same name as other `lodash`
65747 var nativeMax = Math.max;
65750 * Creates a function that wraps `func` and invokes it with optional `this`
65751 * binding of, partial application, and currying.
65754 * @param {Function|string}
65755 * func The function or method name to reference.
65757 * bitmask The bitmask of flags. See `createWrapper` for more
65760 * [thisArg] The `this` binding of `func`.
65762 * [partials] The arguments to prepend to those provided to the new
65765 * [holders] The `partials` placeholder indexes.
65767 * [partialsRight] The arguments to append to those provided to the
65770 * [holdersRight] The `partialsRight` placeholder indexes.
65772 * [argPos] The argument positions of the new function.
65774 * [ary] The arity cap of `func`.
65776 * [arity] The arity of `func`.
65777 * @returns {Function} Returns the new wrapped function.
65779 function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
65780 var isAry = bitmask & ARY_FLAG,
65781 isBind = bitmask & BIND_FLAG,
65782 isBindKey = bitmask & BIND_KEY_FLAG,
65783 isCurry = bitmask & CURRY_FLAG,
65784 isCurryBound = bitmask & CURRY_BOUND_FLAG,
65785 isCurryRight = bitmask & CURRY_RIGHT_FLAG,
65786 Ctor = isBindKey ? undefined : createCtorWrapper(func);
65788 function wrapper() {
65789 // Avoid `arguments` object use disqualifying optimizations by
65790 // converting it to an array before providing it to other functions.
65791 var length = arguments.length,
65793 args = Array(length);
65796 args[index] = arguments[index];
65799 args = composeArgs(args, partials, holders);
65801 if (partialsRight) {
65802 args = composeArgsRight(args, partialsRight, holdersRight);
65804 if (isCurry || isCurryRight) {
65805 var placeholder = wrapper.placeholder,
65806 argsHolders = replaceHolders(args, placeholder);
65808 length -= argsHolders.length;
65809 if (length < arity) {
65810 var newArgPos = argPos ? arrayCopy(argPos) : undefined,
65811 newArity = nativeMax(arity - length, 0),
65812 newsHolders = isCurry ? argsHolders : undefined,
65813 newHoldersRight = isCurry ? undefined : argsHolders,
65814 newPartials = isCurry ? args : undefined,
65815 newPartialsRight = isCurry ? undefined : args;
65817 bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
65818 bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
65820 if (!isCurryBound) {
65821 bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
65823 var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
65824 result = createHybridWrapper.apply(undefined, newData);
65826 if (isLaziable(func)) {
65827 setData(result, newData);
65829 result.placeholder = placeholder;
65833 var thisBinding = isBind ? thisArg : this,
65834 fn = isBindKey ? thisBinding[func] : func;
65837 args = reorder(args, argPos);
65839 if (isAry && ary < args.length) {
65842 if (this && this !== global && this instanceof wrapper) {
65843 fn = Ctor || createCtorWrapper(func);
65845 return fn.apply(thisBinding, args);
65850 module.exports = createHybridWrapper;
65852 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65854 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
65855 "./composeArgs": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgs.js",
65856 "./composeArgsRight": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgsRight.js",
65857 "./createCtorWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js",
65858 "./isLaziable": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLaziable.js",
65859 "./reorder": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\reorder.js",
65860 "./replaceHolders": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js",
65861 "./setData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\setData.js"
65863 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createPartialWrapper.js": [function(require, module, exports) {
65864 (function(global) {
65865 var createCtorWrapper = require('./createCtorWrapper');
65867 /** Used to compose bitmasks for wrapper metadata. */
65871 * Creates a function that wraps `func` and invokes it with the optional `this`
65872 * binding of `thisArg` and the `partials` prepended to those provided to the
65876 * @param {Function}
65877 * func The function to partially apply arguments to.
65879 * bitmask The bitmask of flags. See `createWrapper` for more
65882 * thisArg The `this` binding of `func`.
65884 * partials The arguments to prepend to those provided to the new
65886 * @returns {Function} Returns the new bound function.
65888 function createPartialWrapper(func, bitmask, thisArg, partials) {
65889 var isBind = bitmask & BIND_FLAG,
65890 Ctor = createCtorWrapper(func);
65892 function wrapper() {
65893 // Avoid `arguments` object use disqualifying optimizations by
65894 // converting it to an array before providing it `func`.
65895 var argsIndex = -1,
65896 argsLength = arguments.length,
65898 leftLength = partials.length,
65899 args = Array(leftLength + argsLength);
65901 while (++leftIndex < leftLength) {
65902 args[leftIndex] = partials[leftIndex];
65904 while (argsLength--) {
65905 args[leftIndex++] = arguments[++argsIndex];
65907 var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func;
65908 return fn.apply(isBind ? thisArg : this, args);
65913 module.exports = createPartialWrapper;
65915 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
65917 "./createCtorWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createCtorWrapper.js"
65919 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createReduce.js": [function(require, module, exports) {
65920 var baseCallback = require('./baseCallback'),
65921 baseReduce = require('./baseReduce'),
65922 isArray = require('../lang/isArray');
65925 * Creates a function for `_.reduce` or `_.reduceRight`.
65928 * @param {Function}
65929 * arrayFunc The function to iterate over an array.
65930 * @param {Function}
65931 * eachFunc The function to iterate over a collection.
65932 * @returns {Function} Returns the new each function.
65934 function createReduce(arrayFunc, eachFunc) {
65935 return function(collection, iteratee, accumulator, thisArg) {
65936 var initFromArray = arguments.length < 3;
65937 return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee, accumulator, initFromArray) : baseReduce(collection, baseCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
65941 module.exports = createReduce;
65944 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
65945 "./baseCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCallback.js",
65946 "./baseReduce": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseReduce.js"
65948 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createWrapper.js": [function(require, module, exports) {
65949 var baseSetData = require('./baseSetData'),
65950 createBindWrapper = require('./createBindWrapper'),
65951 createHybridWrapper = require('./createHybridWrapper'),
65952 createPartialWrapper = require('./createPartialWrapper'),
65953 getData = require('./getData'),
65954 mergeData = require('./mergeData'),
65955 setData = require('./setData');
65957 /** Used to compose bitmasks for wrapper metadata. */
65961 PARTIAL_RIGHT_FLAG = 64;
65963 /** Used as the `TypeError` message for "Functions" methods. */
65964 var FUNC_ERROR_TEXT = 'Expected a function';
65967 * Native method references for those with the same name as other `lodash`
65970 var nativeMax = Math.max;
65973 * Creates a function that either curries or invokes `func` with optional `this`
65974 * binding and partially applied arguments.
65977 * @param {Function|string}
65978 * func The function or method name to reference.
65980 * bitmask The bitmask of flags. The bitmask may be composed of the
65981 * following flags: 1 - `_.bind` 2 - `_.bindKey` 4 - `_.curry` or
65982 * `_.curryRight` of a bound function 8 - `_.curry` 16 -
65983 * `_.curryRight` 32 - `_.partial` 64 - `_.partialRight` 128 -
65984 * `_.rearg` 256 - `_.ary`
65986 * [thisArg] The `this` binding of `func`.
65988 * [partials] The arguments to be partially applied.
65990 * [holders] The `partials` placeholder indexes.
65992 * [argPos] The argument positions of the new function.
65994 * [ary] The arity cap of `func`.
65996 * [arity] The arity of `func`.
65997 * @returns {Function} Returns the new wrapped function.
65999 function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
66000 var isBindKey = bitmask & BIND_KEY_FLAG;
66001 if (!isBindKey && typeof func != 'function') {
66002 throw new TypeError(FUNC_ERROR_TEXT);
66004 var length = partials ? partials.length : 0;
66006 bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
66007 partials = holders = undefined;
66009 length -= (holders ? holders.length : 0);
66010 if (bitmask & PARTIAL_RIGHT_FLAG) {
66011 var partialsRight = partials,
66012 holdersRight = holders;
66014 partials = holders = undefined;
66016 var data = isBindKey ? undefined : getData(func),
66017 newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
66020 mergeData(newData, data);
66021 bitmask = newData[1];
66022 arity = newData[9];
66024 newData[9] = arity == null ? (isBindKey ? 0 : func.length) : (nativeMax(arity - length, 0) || 0);
66026 if (bitmask == BIND_FLAG) {
66027 var result = createBindWrapper(newData[0], newData[2]);
66028 } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
66029 result = createPartialWrapper.apply(undefined, newData);
66031 result = createHybridWrapper.apply(undefined, newData);
66033 var setter = data ? baseSetData : setData;
66034 return setter(result, newData);
66037 module.exports = createWrapper;
66040 "./baseSetData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSetData.js",
66041 "./createBindWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createBindWrapper.js",
66042 "./createHybridWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createHybridWrapper.js",
66043 "./createPartialWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createPartialWrapper.js",
66044 "./getData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getData.js",
66045 "./mergeData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\mergeData.js",
66046 "./setData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\setData.js"
66048 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalArrays.js": [function(require, module, exports) {
66049 var arraySome = require('./arraySome');
66052 * A specialized version of `baseIsEqualDeep` for arrays with support for
66053 * partial deep comparisons.
66057 * array The array to compare.
66059 * other The other array to compare.
66060 * @param {Function}
66061 * equalFunc The function to determine equivalents of values.
66062 * @param {Function}
66063 * [customizer] The function to customize comparing arrays.
66065 * [isLoose] Specify performing partial comparisons.
66067 * [stackA] Tracks traversed `value` objects.
66069 * [stackB] Tracks traversed `other` objects.
66070 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
66072 function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
66074 arrLength = array.length,
66075 othLength = other.length;
66077 if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
66080 // Ignore non-index properties.
66081 while (++index < arrLength) {
66082 var arrValue = array[index],
66083 othValue = other[index],
66084 result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
66086 if (result !== undefined) {
66092 // Recursively compare arrays (susceptible to call stack limits).
66094 if (!arraySome(other, function(othValue) {
66095 return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
66099 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
66106 module.exports = equalArrays;
66109 "./arraySome": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arraySome.js"
66111 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalByTag.js": [function(require, module, exports) {
66112 /** `Object#toString` result references. */
66113 var boolTag = '[object Boolean]',
66114 dateTag = '[object Date]',
66115 errorTag = '[object Error]',
66116 numberTag = '[object Number]',
66117 regexpTag = '[object RegExp]',
66118 stringTag = '[object String]';
66121 * A specialized version of `baseIsEqualDeep` for comparing objects of the same
66124 * **Note:** This function only supports comparing values with tags of
66125 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
66129 * object The object to compare.
66131 * other The other object to compare.
66133 * tag The `toStringTag` of the objects to compare.
66134 * @returns {boolean} Returns `true` if the objects are equivalent, else
66137 function equalByTag(object, other, tag) {
66141 // Coerce dates and booleans to numbers, dates to milliseconds and
66143 // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
66144 return +object == +other;
66147 return object.name == other.name && object.message == other.message;
66150 // Treat `NaN` vs. `NaN` as equal.
66151 return (object != +object) ? other != +other : object == +other;
66155 // Coerce regexes to strings and treat strings primitives and string
66156 // objects as equal. See https://es5.github.io/#x15.10.6.4 for more
66158 return object == (other + '');
66163 module.exports = equalByTag;
66166 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\equalObjects.js": [function(require, module, exports) {
66167 var keys = require('../object/keys');
66169 /** Used for native method references. */
66170 var objectProto = Object.prototype;
66172 /** Used to check objects for own properties. */
66173 var hasOwnProperty = objectProto.hasOwnProperty;
66176 * A specialized version of `baseIsEqualDeep` for objects with support for
66177 * partial deep comparisons.
66181 * object The object to compare.
66183 * other The other object to compare.
66184 * @param {Function}
66185 * equalFunc The function to determine equivalents of values.
66186 * @param {Function}
66187 * [customizer] The function to customize comparing values.
66189 * [isLoose] Specify performing partial comparisons.
66191 * [stackA] Tracks traversed `value` objects.
66193 * [stackB] Tracks traversed `other` objects.
66194 * @returns {boolean} Returns `true` if the objects are equivalent, else
66197 function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
66198 var objProps = keys(object),
66199 objLength = objProps.length,
66200 othProps = keys(other),
66201 othLength = othProps.length;
66203 if (objLength != othLength && !isLoose) {
66206 var index = objLength;
66208 var key = objProps[index];
66209 if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
66213 var skipCtor = isLoose;
66214 while (++index < objLength) {
66215 key = objProps[index];
66216 var objValue = object[key],
66217 othValue = other[key],
66218 result = customizer ? customizer(isLoose ? othValue : objValue, isLoose ? objValue : othValue, key) : undefined;
66220 // Recursively compare objects (susceptible to call stack limits).
66221 if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
66224 skipCtor || (skipCtor = key == 'constructor');
66227 var objCtor = object.constructor,
66228 othCtor = other.constructor;
66230 // Non `Object` object instances with different constructors are not equal.
66231 if (objCtor != othCtor &&
66232 ('constructor' in object && 'constructor' in other) &&
66233 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
66234 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
66241 module.exports = equalObjects;
66244 "../object/keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
66246 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getData.js": [function(require, module, exports) {
66247 var metaMap = require('./metaMap'),
66248 noop = require('../utility/noop');
66251 * Gets metadata for `func`.
66254 * @param {Function}
66255 * func The function to query.
66256 * @returns {*} Returns the metadata for `func`.
66258 var getData = !metaMap ? noop : function(func) {
66259 return metaMap.get(func);
66262 module.exports = getData;
66265 "../utility/noop": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\noop.js",
66266 "./metaMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\metaMap.js"
66268 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getFuncName.js": [function(require, module, exports) {
66269 var realNames = require('./realNames');
66272 * Gets the name of `func`.
66275 * @param {Function}
66276 * func The function to query.
66277 * @returns {string} Returns the function name.
66279 function getFuncName(func) {
66280 var result = (func.name + ''),
66281 array = realNames[result],
66282 length = array ? array.length : 0;
66285 var data = array[length],
66286 otherFunc = data.func;
66287 if (otherFunc == null || otherFunc == func) {
66294 module.exports = getFuncName;
66297 "./realNames": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\realNames.js"
66299 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js": [function(require, module, exports) {
66300 var baseProperty = require('./baseProperty');
66303 * Gets the "length" property value of `object`.
66305 * **Note:** This function is used to avoid a [JIT
66306 * bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects Safari on
66307 * at least iOS 8.1-8.3 ARM64.
66311 * object The object to query.
66312 * @returns {*} Returns the "length" value.
66314 var getLength = baseProperty('length');
66316 module.exports = getLength;
66319 "./baseProperty": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseProperty.js"
66321 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getMatchData.js": [function(require, module, exports) {
66322 var isStrictComparable = require('./isStrictComparable'),
66323 pairs = require('../object/pairs');
66326 * Gets the propery names, values, and compare flags of `object`.
66330 * object The object to query.
66331 * @returns {Array} Returns the match data of `object`.
66333 function getMatchData(object) {
66334 var result = pairs(object),
66335 length = result.length;
66338 result[length][2] = isStrictComparable(result[length][1]);
66343 module.exports = getMatchData;
66346 "../object/pairs": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pairs.js",
66347 "./isStrictComparable": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isStrictComparable.js"
66349 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js": [function(require, module, exports) {
66350 var isNative = require('../lang/isNative');
66353 * Gets the native function at `key` of `object`.
66357 * object The object to query.
66359 * key The key of the method to get.
66360 * @returns {*} Returns the function if it's native, else `undefined`.
66362 function getNative(object, key) {
66363 var value = object == null ? undefined : object[key];
66364 return isNative(value) ? value : undefined;
66367 module.exports = getNative;
66370 "../lang/isNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNative.js"
66372 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\indexOfNaN.js": [function(require, module, exports) {
66374 * Gets the index at which the first occurrence of `NaN` is found in `array`.
66378 * array The array to search.
66380 * fromIndex The index to search from.
66382 * [fromRight] Specify iterating from right to left.
66383 * @returns {number} Returns the index of the matched `NaN`, else `-1`.
66385 function indexOfNaN(array, fromIndex, fromRight) {
66386 var length = array.length,
66387 index = fromIndex + (fromRight ? 0 : -1);
66389 while ((fromRight ? index-- : ++index < length)) {
66390 var other = array[index];
66391 if (other !== other) {
66398 module.exports = indexOfNaN;
66401 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js": [function(require, module, exports) {
66402 var getLength = require('./getLength'),
66403 isLength = require('./isLength');
66406 * Checks if `value` is array-like.
66410 * value The value to check.
66411 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
66413 function isArrayLike(value) {
66414 return value != null && isLength(getLength(value));
66417 module.exports = isArrayLike;
66420 "./getLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getLength.js",
66421 "./isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js"
66423 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js": [function(require, module, exports) {
66424 /** Used to detect unsigned integer values. */
66425 var reIsUint = /^\d+$/;
66428 * Used as the [maximum
66429 * length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
66430 * of an array-like value.
66432 var MAX_SAFE_INTEGER = 9007199254740991;
66435 * Checks if `value` is a valid array-like index.
66439 * value The value to check.
66441 * [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
66442 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
66444 function isIndex(value, length) {
66445 value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
66446 length = length == null ? MAX_SAFE_INTEGER : length;
66447 return value > -1 && value % 1 == 0 && value < length;
66450 module.exports = isIndex;
66453 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIterateeCall.js": [function(require, module, exports) {
66454 var isArrayLike = require('./isArrayLike'),
66455 isIndex = require('./isIndex'),
66456 isObject = require('../lang/isObject');
66459 * Checks if the provided arguments are from an iteratee call.
66463 * value The potential iteratee value argument.
66465 * index The potential iteratee index or key argument.
66467 * object The potential iteratee object argument.
66468 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
66471 function isIterateeCall(value, index, object) {
66472 if (!isObject(object)) {
66475 var type = typeof index;
66476 if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) {
66477 var other = object[index];
66478 return value === value ? (value === other) : (other !== other);
66483 module.exports = isIterateeCall;
66486 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js",
66487 "./isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
66488 "./isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js"
66490 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isKey.js": [function(require, module, exports) {
66491 var isArray = require('../lang/isArray'),
66492 toObject = require('./toObject');
66494 /** Used to match property names within property paths. */
66495 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
66496 reIsPlainProp = /^\w*$/;
66499 * Checks if `value` is a property name and not a property path.
66503 * value The value to check.
66505 * [object] The object to query keys on.
66506 * @returns {boolean} Returns `true` if `value` is a property name, else
66509 function isKey(value, object) {
66510 var type = typeof value;
66511 if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
66514 if (isArray(value)) {
66517 var result = !reIsDeepProp.test(value);
66518 return result || (object != null && value in toObject(object));
66521 module.exports = isKey;
66524 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
66525 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
66527 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLaziable.js": [function(require, module, exports) {
66528 var LazyWrapper = require('./LazyWrapper'),
66529 getData = require('./getData'),
66530 getFuncName = require('./getFuncName'),
66531 lodash = require('../chain/lodash');
66534 * Checks if `func` has a lazy counterpart.
66537 * @param {Function}
66538 * func The function to check.
66539 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else
66542 function isLaziable(func) {
66543 var funcName = getFuncName(func),
66544 other = lodash[funcName];
66546 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
66549 if (func === other) {
66552 var data = getData(other);
66553 return !!data && func === data[0];
66556 module.exports = isLaziable;
66559 "../chain/lodash": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\chain\\lodash.js",
66560 "./LazyWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js",
66561 "./getData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getData.js",
66562 "./getFuncName": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getFuncName.js"
66564 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js": [function(require, module, exports) {
66566 * Used as the [maximum
66567 * length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
66568 * of an array-like value.
66570 var MAX_SAFE_INTEGER = 9007199254740991;
66573 * Checks if `value` is a valid array-like length.
66575 * **Note:** This function is based on
66576 * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
66580 * value The value to check.
66581 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
66583 function isLength(value) {
66584 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
66587 module.exports = isLength;
66590 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js": [function(require, module, exports) {
66592 * Checks if `value` is object-like.
66596 * value The value to check.
66597 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
66599 function isObjectLike(value) {
66600 return !!value && typeof value == 'object';
66603 module.exports = isObjectLike;
66606 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isStrictComparable.js": [function(require, module, exports) {
66607 var isObject = require('../lang/isObject');
66610 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
66614 * value The value to check.
66615 * @returns {boolean} Returns `true` if `value` if suitable for strict equality
66616 * comparisons, else `false`.
66618 function isStrictComparable(value) {
66619 return value === value && !isObject(value);
66622 module.exports = isStrictComparable;
66625 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
66627 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\mergeData.js": [function(require, module, exports) {
66628 var arrayCopy = require('./arrayCopy'),
66629 composeArgs = require('./composeArgs'),
66630 composeArgsRight = require('./composeArgsRight'),
66631 replaceHolders = require('./replaceHolders');
66633 /** Used to compose bitmasks for wrapper metadata. */
66635 CURRY_BOUND_FLAG = 4,
66640 /** Used as the internal argument placeholder. */
66641 var PLACEHOLDER = '__lodash_placeholder__';
66644 * Native method references for those with the same name as other `lodash`
66647 var nativeMin = Math.min;
66650 * Merges the function metadata of `source` into `data`.
66652 * Merging metadata reduces the number of wrappers required to invoke a
66653 * function. This is possible because methods like `_.bind`, `_.curry`, and
66654 * `_.partial` may be applied regardless of execution order. Methods like
66655 * `_.ary` and `_.rearg` augment function arguments, making the order in which
66656 * they are executed important, preventing the merging of metadata. However, we
66657 * make an exception for a safe common case where curried functions have `_.ary`
66658 * and or `_.rearg` applied.
66662 * data The destination metadata.
66664 * source The source metadata.
66665 * @returns {Array} Returns `data`.
66667 function mergeData(data, source) {
66668 var bitmask = data[1],
66669 srcBitmask = source[1],
66670 newBitmask = bitmask | srcBitmask,
66671 isCommon = newBitmask < ARY_FLAG;
66674 (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
66675 (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
66676 (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
66678 // Exit early if metadata can't be merged.
66679 if (!(isCommon || isCombo)) {
66682 // Use source `thisArg` if available.
66683 if (srcBitmask & BIND_FLAG) {
66684 data[2] = source[2];
66685 // Set when currying a bound function.
66686 newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
66688 // Compose partial arguments.
66689 var value = source[3];
66691 var partials = data[3];
66692 data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
66693 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
66695 // Compose partial right arguments.
66698 partials = data[5];
66699 data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
66700 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
66702 // Use source `argPos` if available.
66705 data[7] = arrayCopy(value);
66707 // Use source `ary` if it's smaller.
66708 if (srcBitmask & ARY_FLAG) {
66709 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
66711 // Use source `arity` if one is not provided.
66712 if (data[9] == null) {
66713 data[9] = source[9];
66715 // Use source `func` and merge bitmasks.
66716 data[0] = source[0];
66717 data[1] = newBitmask;
66722 module.exports = mergeData;
66725 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
66726 "./composeArgs": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgs.js",
66727 "./composeArgsRight": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\composeArgsRight.js",
66728 "./replaceHolders": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js"
66730 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\metaMap.js": [function(require, module, exports) {
66731 (function(global) {
66732 var getNative = require('./getNative');
66734 /** Native method references. */
66735 var WeakMap = getNative(global, 'WeakMap');
66737 /** Used to store function metadata. */
66738 var metaMap = WeakMap && new WeakMap;
66740 module.exports = metaMap;
66742 }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
66744 "./getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js"
66746 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByArray.js": [function(require, module, exports) {
66747 var toObject = require('./toObject');
66750 * A specialized version of `_.pick` which picks `object` properties specified
66755 * object The source object.
66756 * @param {string[]}
66757 * props The property names to pick.
66758 * @returns {Object} Returns the new object.
66760 function pickByArray(object, props) {
66761 object = toObject(object);
66764 length = props.length,
66767 while (++index < length) {
66768 var key = props[index];
66769 if (key in object) {
66770 result[key] = object[key];
66776 module.exports = pickByArray;
66779 "./toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js"
66781 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByCallback.js": [function(require, module, exports) {
66782 var baseForIn = require('./baseForIn');
66785 * A specialized version of `_.pick` which picks `object` properties `predicate`
66786 * returns truthy for.
66790 * object The source object.
66791 * @param {Function}
66792 * predicate The function invoked per iteration.
66793 * @returns {Object} Returns the new object.
66795 function pickByCallback(object, predicate) {
66797 baseForIn(object, function(value, key, object) {
66798 if (predicate(value, key, object)) {
66799 result[key] = value;
66805 module.exports = pickByCallback;
66808 "./baseForIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForIn.js"
66810 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\realNames.js": [function(require, module, exports) {
66811 /** Used to lookup unminified function names. */
66812 var realNames = {};
66814 module.exports = realNames;
66817 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\reorder.js": [function(require, module, exports) {
66818 var arrayCopy = require('./arrayCopy'),
66819 isIndex = require('./isIndex');
66822 * Native method references for those with the same name as other `lodash`
66825 var nativeMin = Math.min;
66828 * Reorder `array` according to the specified indexes where the element at the
66829 * first index is assigned as the first element, the element at the second index
66830 * is assigned as the second element, and so on.
66834 * array The array to reorder.
66836 * indexes The arranged array indexes.
66837 * @returns {Array} Returns `array`.
66839 function reorder(array, indexes) {
66840 var arrLength = array.length,
66841 length = nativeMin(indexes.length, arrLength),
66842 oldArray = arrayCopy(array);
66845 var index = indexes[length];
66846 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
66851 module.exports = reorder;
66854 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js",
66855 "./isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js"
66857 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\replaceHolders.js": [function(require, module, exports) {
66858 /** Used as the internal argument placeholder. */
66859 var PLACEHOLDER = '__lodash_placeholder__';
66862 * Replaces all `placeholder` elements in `array` with an internal placeholder
66863 * and returns an array of their indexes.
66867 * array The array to modify.
66869 * placeholder The placeholder to replace.
66870 * @returns {Array} Returns the new array of placeholder indexes.
66872 function replaceHolders(array, placeholder) {
66874 length = array.length,
66878 while (++index < length) {
66879 if (array[index] === placeholder) {
66880 array[index] = PLACEHOLDER;
66881 result[++resIndex] = index;
66887 module.exports = replaceHolders;
66890 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\setData.js": [function(require, module, exports) {
66891 var baseSetData = require('./baseSetData'),
66892 now = require('../date/now');
66894 /** Used to detect when a function becomes hot. */
66895 var HOT_COUNT = 150,
66899 * Sets metadata for `func`.
66901 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
66902 * period of time, it will trip its breaker and transition to an identity
66903 * function to avoid garbage collection pauses in V8. See [V8 issue
66904 * 2070](https://code.google.com/p/v8/issues/detail?id=2070) for more details.
66907 * @param {Function}
66908 * func The function to associate metadata with.
66910 * data The metadata.
66911 * @returns {Function} Returns `func`.
66913 var setData = (function() {
66917 return function(key, value) {
66919 remaining = HOT_SPAN - (stamp - lastCalled);
66921 lastCalled = stamp;
66922 if (remaining > 0) {
66923 if (++count >= HOT_COUNT) {
66929 return baseSetData(key, value);
66933 module.exports = setData;
66936 "../date/now": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\date\\now.js",
66937 "./baseSetData": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseSetData.js"
66939 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\shimKeys.js": [function(require, module, exports) {
66940 var isArguments = require('../lang/isArguments'),
66941 isArray = require('../lang/isArray'),
66942 isIndex = require('./isIndex'),
66943 isLength = require('./isLength'),
66944 keysIn = require('../object/keysIn');
66946 /** Used for native method references. */
66947 var objectProto = Object.prototype;
66949 /** Used to check objects for own properties. */
66950 var hasOwnProperty = objectProto.hasOwnProperty;
66953 * A fallback implementation of `Object.keys` which creates an array of the own
66954 * enumerable property names of `object`.
66958 * object The object to query.
66959 * @returns {Array} Returns the array of property names.
66961 function shimKeys(object) {
66962 var props = keysIn(object),
66963 propsLength = props.length,
66964 length = propsLength && object.length;
66966 var allowIndexes = !!length && isLength(length) &&
66967 (isArray(object) || isArguments(object));
66972 while (++index < propsLength) {
66973 var key = props[index];
66974 if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
66981 module.exports = shimKeys;
66984 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
66985 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
66986 "../object/keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js",
66987 "./isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js",
66988 "./isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js"
66990 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\sortedUniq.js": [function(require, module, exports) {
66992 * An implementation of `_.uniq` optimized for sorted arrays without support for
66993 * callback shorthands and `this` binding.
66997 * array The array to inspect.
66998 * @param {Function}
66999 * [iteratee] The function invoked per iteration.
67000 * @returns {Array} Returns the new duplicate free array.
67002 function sortedUniq(array, iteratee) {
67005 length = array.length,
67009 while (++index < length) {
67010 var value = array[index],
67011 computed = iteratee ? iteratee(value, index, array) : value;
67013 if (!index || seen !== computed) {
67015 result[++resIndex] = value;
67021 module.exports = sortedUniq;
67024 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js": [function(require, module, exports) {
67025 var isObject = require('../lang/isObject');
67028 * Converts `value` to an object if it's not one.
67032 * value The value to process.
67033 * @returns {Object} Returns the object.
67035 function toObject(value) {
67036 return isObject(value) ? value : Object(value);
67039 module.exports = toObject;
67042 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
67044 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toPath.js": [function(require, module, exports) {
67045 var baseToString = require('./baseToString'),
67046 isArray = require('../lang/isArray');
67048 /** Used to match property names within property paths. */
67049 var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
67051 /** Used to match backslashes in property paths. */
67052 var reEscapeChar = /\\(\\)?/g;
67055 * Converts `value` to property path array if it's not one.
67059 * value The value to process.
67060 * @returns {Array} Returns the property path array.
67062 function toPath(value) {
67063 if (isArray(value)) {
67067 baseToString(value).replace(rePropName, function(match, number, quote, string) {
67068 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
67073 module.exports = toPath;
67076 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
67077 "./baseToString": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseToString.js"
67079 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\wrapperClone.js": [function(require, module, exports) {
67080 var LazyWrapper = require('./LazyWrapper'),
67081 LodashWrapper = require('./LodashWrapper'),
67082 arrayCopy = require('./arrayCopy');
67085 * Creates a clone of `wrapper`.
67089 * wrapper The wrapper to clone.
67090 * @returns {Object} Returns the cloned wrapper.
67092 function wrapperClone(wrapper) {
67093 return wrapper instanceof LazyWrapper ? wrapper.clone() : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
67096 module.exports = wrapperClone;
67099 "./LazyWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LazyWrapper.js",
67100 "./LodashWrapper": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\LodashWrapper.js",
67101 "./arrayCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayCopy.js"
67103 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js": [function(require, module, exports) {
67104 var isArrayLike = require('../internal/isArrayLike'),
67105 isObjectLike = require('../internal/isObjectLike');
67107 /** Used for native method references. */
67108 var objectProto = Object.prototype;
67110 /** Used to check objects for own properties. */
67111 var hasOwnProperty = objectProto.hasOwnProperty;
67113 /** Native method references. */
67114 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
67117 * Checks if `value` is classified as an `arguments` object.
67123 * value The value to check.
67124 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67128 * _.isArguments(function() { return arguments; }()); // => true
67130 * _.isArguments([1, 2, 3]); // => false
67132 function isArguments(value) {
67133 return isObjectLike(value) && isArrayLike(value) &&
67134 hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
67137 module.exports = isArguments;
67140 "../internal/isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
67141 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67143 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js": [function(require, module, exports) {
67144 var getNative = require('../internal/getNative'),
67145 isLength = require('../internal/isLength'),
67146 isObjectLike = require('../internal/isObjectLike');
67148 /** `Object#toString` result references. */
67149 var arrayTag = '[object Array]';
67151 /** Used for native method references. */
67152 var objectProto = Object.prototype;
67155 * Used to resolve the
67156 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67159 var objToString = objectProto.toString;
67162 * Native method references for those with the same name as other `lodash`
67165 var nativeIsArray = getNative(Array, 'isArray');
67168 * Checks if `value` is classified as an `Array` object.
67174 * value The value to check.
67175 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67179 * _.isArray([1, 2, 3]); // => true
67181 * _.isArray(function() { return arguments; }()); // => false
67183 var isArray = nativeIsArray || function(value) {
67184 return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
67187 module.exports = isArray;
67190 "../internal/getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js",
67191 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
67192 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67194 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js": [function(require, module, exports) {
67195 var isObject = require('./isObject');
67197 /** `Object#toString` result references. */
67198 var funcTag = '[object Function]';
67200 /** Used for native method references. */
67201 var objectProto = Object.prototype;
67204 * Used to resolve the
67205 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67208 var objToString = objectProto.toString;
67211 * Checks if `value` is classified as a `Function` object.
67217 * value The value to check.
67218 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67222 * _.isFunction(_); // => true
67224 * _.isFunction(/abc/); // => false
67226 function isFunction(value) {
67227 // The use of `Object#toString` avoids issues with the `typeof` operator
67228 // in older versions of Chrome and Safari which return 'function' for
67230 // and Safari 8 which returns 'object' for typed array constructors.
67231 return isObject(value) && objToString.call(value) == funcTag;
67234 module.exports = isFunction;
67237 "./isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
67239 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNative.js": [function(require, module, exports) {
67240 var isFunction = require('./isFunction'),
67241 isObjectLike = require('../internal/isObjectLike');
67243 /** Used to detect host constructors (Safari > 5). */
67244 var reIsHostCtor = /^\[object .+?Constructor\]$/;
67246 /** Used for native method references. */
67247 var objectProto = Object.prototype;
67249 /** Used to resolve the decompiled source of functions. */
67250 var fnToString = Function.prototype.toString;
67252 /** Used to check objects for own properties. */
67253 var hasOwnProperty = objectProto.hasOwnProperty;
67255 /** Used to detect if a method is native. */
67256 var reIsNative = RegExp('^' +
67257 fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
67258 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
67262 * Checks if `value` is a native function.
67268 * value The value to check.
67269 * @returns {boolean} Returns `true` if `value` is a native function, else
67273 * _.isNative(Array.prototype.push); // => true
67275 * _.isNative(_); // => false
67277 function isNative(value) {
67278 if (value == null) {
67281 if (isFunction(value)) {
67282 return reIsNative.test(fnToString.call(value));
67284 return isObjectLike(value) && reIsHostCtor.test(value);
67287 module.exports = isNative;
67290 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js",
67291 "./isFunction": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isFunction.js"
67293 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isNumber.js": [function(require, module, exports) {
67294 var isObjectLike = require('../internal/isObjectLike');
67296 /** `Object#toString` result references. */
67297 var numberTag = '[object Number]';
67299 /** Used for native method references. */
67300 var objectProto = Object.prototype;
67303 * Used to resolve the
67304 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67307 var objToString = objectProto.toString;
67310 * Checks if `value` is classified as a `Number` primitive or object.
67312 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
67313 * as numbers, use the `_.isFinite` method.
67319 * value The value to check.
67320 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67324 * _.isNumber(8.4); // => true
67326 * _.isNumber(NaN); // => true
67328 * _.isNumber('8.4'); // => false
67330 function isNumber(value) {
67331 return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
67334 module.exports = isNumber;
67337 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67339 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js": [function(require, module, exports) {
67341 * Checks if `value` is the [language type](https://es5.github.io/#x8) of
67342 * `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and
67343 * `new String('')`)
67349 * value The value to check.
67350 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
67353 * _.isObject({}); // => true
67355 * _.isObject([1, 2, 3]); // => true
67357 * _.isObject(1); // => false
67359 function isObject(value) {
67360 // Avoid a V8 JIT bug in Chrome 19-20.
67361 // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
67362 var type = typeof value;
67363 return !!value && (type == 'object' || type == 'function');
67366 module.exports = isObject;
67369 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isPlainObject.js": [function(require, module, exports) {
67370 var baseForIn = require('../internal/baseForIn'),
67371 isArguments = require('./isArguments'),
67372 isObjectLike = require('../internal/isObjectLike');
67374 /** `Object#toString` result references. */
67375 var objectTag = '[object Object]';
67377 /** Used for native method references. */
67378 var objectProto = Object.prototype;
67380 /** Used to check objects for own properties. */
67381 var hasOwnProperty = objectProto.hasOwnProperty;
67384 * Used to resolve the
67385 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67388 var objToString = objectProto.toString;
67391 * Checks if `value` is a plain object, that is, an object created by the
67392 * `Object` constructor or one with a `[[Prototype]]` of `null`.
67394 * **Note:** This method assumes objects created by the `Object` constructor
67395 * have no inherited enumerable properties.
67401 * value The value to check.
67402 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
67405 * function Foo() { this.a = 1; }
67407 * _.isPlainObject(new Foo); // => false
67409 * _.isPlainObject([1, 2, 3]); // => false
67411 * _.isPlainObject({ 'x': 0, 'y': 0 }); // => true
67413 * _.isPlainObject(Object.create(null)); // => true
67415 function isPlainObject(value) {
67418 // Exit early for non `Object` objects.
67419 if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||
67420 (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
67423 // IE < 9 iterates inherited properties before own properties. If the first
67424 // iterated property is an object's own property then there are no inherited
67425 // enumerable properties.
67427 // In most environments an object's own properties are iterated before
67428 // its inherited properties. If the last iterated property is an object's
67429 // own property then there are no inherited enumerable properties.
67430 baseForIn(value, function(subValue, key) {
67433 return result === undefined || hasOwnProperty.call(value, result);
67436 module.exports = isPlainObject;
67439 "../internal/baseForIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseForIn.js",
67440 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js",
67441 "./isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js"
67443 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isString.js": [function(require, module, exports) {
67444 var isObjectLike = require('../internal/isObjectLike');
67446 /** `Object#toString` result references. */
67447 var stringTag = '[object String]';
67449 /** Used for native method references. */
67450 var objectProto = Object.prototype;
67453 * Used to resolve the
67454 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67457 var objToString = objectProto.toString;
67460 * Checks if `value` is classified as a `String` primitive or object.
67466 * value The value to check.
67467 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67471 * _.isString('abc'); // => true
67473 * _.isString(1); // => false
67475 function isString(value) {
67476 return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
67479 module.exports = isString;
67482 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67484 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isTypedArray.js": [function(require, module, exports) {
67485 var isLength = require('../internal/isLength'),
67486 isObjectLike = require('../internal/isObjectLike');
67488 /** `Object#toString` result references. */
67489 var argsTag = '[object Arguments]',
67490 arrayTag = '[object Array]',
67491 boolTag = '[object Boolean]',
67492 dateTag = '[object Date]',
67493 errorTag = '[object Error]',
67494 funcTag = '[object Function]',
67495 mapTag = '[object Map]',
67496 numberTag = '[object Number]',
67497 objectTag = '[object Object]',
67498 regexpTag = '[object RegExp]',
67499 setTag = '[object Set]',
67500 stringTag = '[object String]',
67501 weakMapTag = '[object WeakMap]';
67503 var arrayBufferTag = '[object ArrayBuffer]',
67504 float32Tag = '[object Float32Array]',
67505 float64Tag = '[object Float64Array]',
67506 int8Tag = '[object Int8Array]',
67507 int16Tag = '[object Int16Array]',
67508 int32Tag = '[object Int32Array]',
67509 uint8Tag = '[object Uint8Array]',
67510 uint8ClampedTag = '[object Uint8ClampedArray]',
67511 uint16Tag = '[object Uint16Array]',
67512 uint32Tag = '[object Uint32Array]';
67514 /** Used to identify `toStringTag` values of typed arrays. */
67515 var typedArrayTags = {};
67516 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
67517 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
67518 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
67519 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
67520 typedArrayTags[uint32Tag] = true;
67521 typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
67522 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
67523 typedArrayTags[dateTag] = typedArrayTags[errorTag] =
67524 typedArrayTags[funcTag] = typedArrayTags[mapTag] =
67525 typedArrayTags[numberTag] = typedArrayTags[objectTag] =
67526 typedArrayTags[regexpTag] = typedArrayTags[setTag] =
67527 typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
67529 /** Used for native method references. */
67530 var objectProto = Object.prototype;
67533 * Used to resolve the
67534 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
67537 var objToString = objectProto.toString;
67540 * Checks if `value` is classified as a typed array.
67546 * value The value to check.
67547 * @returns {boolean} Returns `true` if `value` is correctly classified, else
67551 * _.isTypedArray(new Uint8Array); // => true
67553 * _.isTypedArray([]); // => false
67555 function isTypedArray(value) {
67556 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
67559 module.exports = isTypedArray;
67562 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
67563 "../internal/isObjectLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isObjectLike.js"
67565 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\toPlainObject.js": [function(require, module, exports) {
67566 var baseCopy = require('../internal/baseCopy'),
67567 keysIn = require('../object/keysIn');
67570 * Converts `value` to a plain object flattening inherited enumerable properties
67571 * of `value` to own properties of the plain object.
67577 * value The value to convert.
67578 * @returns {Object} Returns the converted plain object.
67581 * function Foo() { this.b = 2; }
67583 * Foo.prototype.c = 3;
67585 * _.assign({ 'a': 1 }, new Foo); // => { 'a': 1, 'b': 2 }
67587 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); // => { 'a': 1, 'b': 2, 'c':
67590 function toPlainObject(value) {
67591 return baseCopy(value, keysIn(value));
67594 module.exports = toPlainObject;
67597 "../internal/baseCopy": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseCopy.js",
67598 "../object/keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js"
67600 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\assign.js": [function(require, module, exports) {
67601 var assignWith = require('../internal/assignWith'),
67602 baseAssign = require('../internal/baseAssign'),
67603 createAssigner = require('../internal/createAssigner');
67606 * Assigns own enumerable properties of source object(s) to the destination
67607 * object. Subsequent sources overwrite property assignments of previous
67608 * sources. If `customizer` is provided it's invoked to produce the assigned
67609 * values. The `customizer` is bound to `thisArg` and invoked with five
67610 * arguments: (objectValue, sourceValue, key, object, source).
67612 * **Note:** This method mutates `object` and is based on
67613 * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
67620 * object The destination object.
67621 * @param {...Object}
67622 * [sources] The source objects.
67623 * @param {Function}
67624 * [customizer] The function to customize assigned values.
67626 * [thisArg] The `this` binding of `customizer`.
67627 * @returns {Object} Returns `object`.
67630 * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); // => {
67631 * 'user': 'fred', 'age': 40 }
67632 * // using a customizer callback var defaults = _.partialRight(_.assign,
67633 * function(value, other) { return _.isUndefined(value) ? other : value; });
67635 * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); // => {
67636 * 'user': 'barney', 'age': 36 }
67638 var assign = createAssigner(function(object, source, customizer) {
67639 return customizer ? assignWith(object, source, customizer) : baseAssign(object, source);
67642 module.exports = assign;
67645 "../internal/assignWith": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\assignWith.js",
67646 "../internal/baseAssign": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseAssign.js",
67647 "../internal/createAssigner": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAssigner.js"
67649 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js": [function(require, module, exports) {
67650 var getNative = require('../internal/getNative'),
67651 isArrayLike = require('../internal/isArrayLike'),
67652 isObject = require('../lang/isObject'),
67653 shimKeys = require('../internal/shimKeys');
67656 * Native method references for those with the same name as other `lodash`
67659 var nativeKeys = getNative(Object, 'keys');
67662 * Creates an array of the own enumerable property names of `object`.
67664 * **Note:** Non-object values are coerced to objects. See the [ES
67665 * spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) for more
67672 * object The object to query.
67673 * @returns {Array} Returns the array of property names.
67676 * function Foo() { this.a = 1; this.b = 2; }
67678 * Foo.prototype.c = 3;
67680 * _.keys(new Foo); // => ['a', 'b'] (iteration order is not guaranteed)
67682 * _.keys('hi'); // => ['0', '1']
67684 var keys = !nativeKeys ? shimKeys : function(object) {
67685 var Ctor = object == null ? undefined : object.constructor;
67686 if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
67687 (typeof object != 'function' && isArrayLike(object))) {
67688 return shimKeys(object);
67690 return isObject(object) ? nativeKeys(object) : [];
67693 module.exports = keys;
67696 "../internal/getNative": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\getNative.js",
67697 "../internal/isArrayLike": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isArrayLike.js",
67698 "../internal/shimKeys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\shimKeys.js",
67699 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
67701 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js": [function(require, module, exports) {
67702 var isArguments = require('../lang/isArguments'),
67703 isArray = require('../lang/isArray'),
67704 isIndex = require('../internal/isIndex'),
67705 isLength = require('../internal/isLength'),
67706 isObject = require('../lang/isObject');
67708 /** Used for native method references. */
67709 var objectProto = Object.prototype;
67711 /** Used to check objects for own properties. */
67712 var hasOwnProperty = objectProto.hasOwnProperty;
67715 * Creates an array of the own and inherited enumerable property names of
67718 * **Note:** Non-object values are coerced to objects.
67724 * object The object to query.
67725 * @returns {Array} Returns the array of property names.
67728 * function Foo() { this.a = 1; this.b = 2; }
67730 * Foo.prototype.c = 3;
67732 * _.keysIn(new Foo); // => ['a', 'b', 'c'] (iteration order is not guaranteed)
67734 function keysIn(object) {
67735 if (object == null) {
67738 if (!isObject(object)) {
67739 object = Object(object);
67741 var length = object.length;
67742 length = (length && isLength(length) &&
67743 (isArray(object) || isArguments(object)) && length) || 0;
67745 var Ctor = object.constructor,
67747 isProto = typeof Ctor == 'function' && Ctor.prototype === object,
67748 result = Array(length),
67749 skipIndexes = length > 0;
67751 while (++index < length) {
67752 result[index] = (index + '');
67754 for (var key in object) {
67755 if (!(skipIndexes && isIndex(key, length)) &&
67756 !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
67763 module.exports = keysIn;
67766 "../internal/isIndex": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isIndex.js",
67767 "../internal/isLength": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isLength.js",
67768 "../lang/isArguments": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArguments.js",
67769 "../lang/isArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isArray.js",
67770 "../lang/isObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\lang\\isObject.js"
67772 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\merge.js": [function(require, module, exports) {
67773 var baseMerge = require('../internal/baseMerge'),
67774 createAssigner = require('../internal/createAssigner');
67777 * Recursively merges own enumerable properties of the source object(s), that
67778 * don't resolve to `undefined` into the destination object. Subsequent sources
67779 * overwrite property assignments of previous sources. If `customizer` is
67780 * provided it's invoked to produce the merged values of the destination and
67781 * source properties. If `customizer` returns `undefined` merging is handled by
67782 * the method instead. The `customizer` is bound to `thisArg` and invoked with
67783 * five arguments: (objectValue, sourceValue, key, object, source).
67789 * object The destination object.
67790 * @param {...Object}
67791 * [sources] The source objects.
67792 * @param {Function}
67793 * [customizer] The function to customize assigned values.
67795 * [thisArg] The `this` binding of `customizer`.
67796 * @returns {Object} Returns `object`.
67799 * var users = { 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] };
67801 * var ages = { 'data': [{ 'age': 36 }, { 'age': 40 }] };
67803 * _.merge(users, ages); // => { 'data': [{ 'user': 'barney', 'age': 36 }, {
67804 * 'user': 'fred', 'age': 40 }] }
67805 * // using a customizer callback var object = { 'fruits': ['apple'],
67806 * 'vegetables': ['beet'] };
67808 * var other = { 'fruits': ['banana'], 'vegetables': ['carrot'] };
67810 * _.merge(object, other, function(a, b) { if (_.isArray(a)) { return
67811 * a.concat(b); } }); // => { 'fruits': ['apple', 'banana'], 'vegetables':
67812 * ['beet', 'carrot'] }
67814 var merge = createAssigner(baseMerge);
67816 module.exports = merge;
67819 "../internal/baseMerge": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseMerge.js",
67820 "../internal/createAssigner": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\createAssigner.js"
67822 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\omit.js": [function(require, module, exports) {
67823 var arrayMap = require('../internal/arrayMap'),
67824 baseDifference = require('../internal/baseDifference'),
67825 baseFlatten = require('../internal/baseFlatten'),
67826 bindCallback = require('../internal/bindCallback'),
67827 keysIn = require('./keysIn'),
67828 pickByArray = require('../internal/pickByArray'),
67829 pickByCallback = require('../internal/pickByCallback'),
67830 restParam = require('../function/restParam');
67833 * The opposite of `_.pick`; this method creates an object composed of the own
67834 * and inherited enumerable properties of `object` that are not omitted.
67840 * object The source object.
67841 * @param {Function|...(string|string[])}
67842 * [predicate] The function invoked per iteration or property names
67843 * to omit, specified as individual property names or arrays of
67846 * [thisArg] The `this` binding of `predicate`.
67847 * @returns {Object} Returns the new object.
67850 * var object = { 'user': 'fred', 'age': 40 };
67852 * _.omit(object, 'age'); // => { 'user': 'fred' }
67854 * _.omit(object, _.isNumber); // => { 'user': 'fred' }
67856 var omit = restParam(function(object, props) {
67857 if (object == null) {
67860 if (typeof props[0] != 'function') {
67861 var props = arrayMap(baseFlatten(props), String);
67862 return pickByArray(object, baseDifference(keysIn(object), props));
67864 var predicate = bindCallback(props[0], props[1], 3);
67865 return pickByCallback(object, function(value, key, object) {
67866 return !predicate(value, key, object);
67870 module.exports = omit;
67873 "../function/restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js",
67874 "../internal/arrayMap": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\arrayMap.js",
67875 "../internal/baseDifference": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseDifference.js",
67876 "../internal/baseFlatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js",
67877 "../internal/bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js",
67878 "../internal/pickByArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByArray.js",
67879 "../internal/pickByCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByCallback.js",
67880 "./keysIn": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keysIn.js"
67882 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pairs.js": [function(require, module, exports) {
67883 var keys = require('./keys'),
67884 toObject = require('../internal/toObject');
67887 * Creates a two dimensional array of the key-value pairs for `object`, e.g.
67888 * `[[key1, value1], [key2, value2]]`.
67894 * object The object to query.
67895 * @returns {Array} Returns the new array of key-value pairs.
67898 * _.pairs({ 'barney': 36, 'fred': 40 }); // => [['barney', 36], ['fred', 40]]
67899 * (iteration order is not guaranteed)
67901 function pairs(object) {
67902 object = toObject(object);
67905 props = keys(object),
67906 length = props.length,
67907 result = Array(length);
67909 while (++index < length) {
67910 var key = props[index];
67911 result[index] = [key, object[key]];
67916 module.exports = pairs;
67919 "../internal/toObject": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\toObject.js",
67920 "./keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
67922 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\pick.js": [function(require, module, exports) {
67923 var baseFlatten = require('../internal/baseFlatten'),
67924 bindCallback = require('../internal/bindCallback'),
67925 pickByArray = require('../internal/pickByArray'),
67926 pickByCallback = require('../internal/pickByCallback'),
67927 restParam = require('../function/restParam');
67930 * Creates an object composed of the picked `object` properties. Property names
67931 * may be specified as individual arguments or as arrays of property names. If
67932 * `predicate` is provided it's invoked for each property of `object` picking
67933 * the properties `predicate` returns truthy for. The predicate is bound to
67934 * `thisArg` and invoked with three arguments: (value, key, object).
67940 * object The source object.
67941 * @param {Function|...(string|string[])}
67942 * [predicate] The function invoked per iteration or property names
67943 * to pick, specified as individual property names or arrays of
67946 * [thisArg] The `this` binding of `predicate`.
67947 * @returns {Object} Returns the new object.
67950 * var object = { 'user': 'fred', 'age': 40 };
67952 * _.pick(object, 'user'); // => { 'user': 'fred' }
67954 * _.pick(object, _.isString); // => { 'user': 'fred' }
67956 var pick = restParam(function(object, props) {
67957 if (object == null) {
67960 return typeof props[0] == 'function' ? pickByCallback(object, bindCallback(props[0], props[1], 3)) : pickByArray(object, baseFlatten(props));
67963 module.exports = pick;
67966 "../function/restParam": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\function\\restParam.js",
67967 "../internal/baseFlatten": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseFlatten.js",
67968 "../internal/bindCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\bindCallback.js",
67969 "../internal/pickByArray": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByArray.js",
67970 "../internal/pickByCallback": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\pickByCallback.js"
67972 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\values.js": [function(require, module, exports) {
67973 var baseValues = require('../internal/baseValues'),
67974 keys = require('./keys');
67977 * Creates an array of the own enumerable property values of `object`.
67979 * **Note:** Non-object values are coerced to objects.
67985 * object The object to query.
67986 * @returns {Array} Returns the array of property values.
67989 * function Foo() { this.a = 1; this.b = 2; }
67991 * Foo.prototype.c = 3;
67993 * _.values(new Foo); // => [1, 2] (iteration order is not guaranteed)
67995 * _.values('hi'); // => ['h', 'i']
67997 function values(object) {
67998 return baseValues(object, keys(object));
68001 module.exports = values;
68004 "../internal/baseValues": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseValues.js",
68005 "./keys": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\object\\keys.js"
68007 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\identity.js": [function(require, module, exports) {
68009 * This method returns the first argument provided to it.
68013 * @category Utility
68016 * @returns {*} Returns `value`.
68019 * var object = { 'user': 'fred' };
68021 * _.identity(object) === object; // => true
68023 function identity(value) {
68027 module.exports = identity;
68030 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\noop.js": [function(require, module, exports) {
68032 * A no-operation function that returns `undefined` regardless of the arguments
68037 * @category Utility
68040 * var object = { 'user': 'fred' };
68042 * _.noop(object) === undefined; // => true
68045 // No operation performed.
68048 module.exports = noop;
68051 "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\utility\\property.js": [function(require, module, exports) {
68052 var baseProperty = require('../internal/baseProperty'),
68053 basePropertyDeep = require('../internal/basePropertyDeep'),
68054 isKey = require('../internal/isKey');
68057 * Creates a function that returns the property value at `path` on a given
68062 * @category Utility
68063 * @param {Array|string}
68064 * path The path of the property to get.
68065 * @returns {Function} Returns the new function.
68068 * var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ];
68070 * _.map(objects, _.property('a.b.c')); // => [2, 1]
68072 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); // => [1,
68075 function property(path) {
68076 return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
68079 module.exports = property;
68082 "../internal/baseProperty": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\baseProperty.js",
68083 "../internal/basePropertyDeep": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\basePropertyDeep.js",
68084 "../internal/isKey": "\\bpmn-js-examples-master\\modeler\\node_modules\\lodash\\internal\\isKey.js"
68086 }, {}, ["\\bpmn-js-examples-master\\modeler\\app\\index.js"]);