text:
package com.all.client.view.components;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Point;
import java.awt.Rectangle;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.all.appControl.control.ViewEngine;
import com.all.client.view.LocalLibraryPanel;
import com.all.client.view.dnd.DraggedObject;
import com.all.client.view.dnd.MultiLayerDropTargetListener;
import com.all.client.view.dnd.MyMusicDropListener;
import com.all.core.actions.FileSystemValidatorLight;
import com.all.core.common.view.SynthFonts;
import com.all.i18n.Internationalizable;
import com.all.i18n.Messages;
import com.all.shared.model.ModelCollection;

@Component
public class MyMusicDnDPanel extends JPanel implements Internationalizable {

	private static final Dimension DROP_LABEL_SIZE = new Dimension(204, 23);
	private static final Dimension DROP_LABEL_SMALL_SIZE = new Dimension(204, 7);
	private static final Dimension ARROW_ICON_SIZE = new Dimension(96, 96);
	private static final Rectangle MY_MUSIC_DND_LABEL_BOUNDS = new Rectangle(0, 0, 184, 22);
	private static final Dimension MY_MUSIC_DND_LABEL_SIZE = new Dimension(204, 22);
	private static final Point LOCATION = new Point(0, 131);
	private static final Dimension SIZE = new Dimension(204, 184);
	private static final String MY_MUSIC_DND_PANEL = "myMusicDnDPanel";
	private static final long serialVersionUID = 1L;
	private JLabel myMusicDndLabel;
	private JLabel dropLabel;
	private JLabel dropSmallLabel;
	private JLabel arrowPanel;
	private LocalLibraryPanel localLibraryPanel;
	private MyMusicDropListener myMusicDropListener;

	@Autowired
	private ViewEngine viewEngine;

	public MyMusicDnDPanel() {
		init();
	}

	@Autowired
	public void setDragAndDrop(MultiLayerDropTargetListener multiLayerDropTargetListener,
			final LocalLibraryPanel localLibraryPanel) {

		this.localLibraryPanel = localLibraryPanel;

		myMusicDropListener = new MyMusicDropListener(viewEngine, getArrowPanel()) {
			@Override
			public void doDrop(FileSystemValidatorLight validator, Point location) {
				MyMusicDnDPanel.this.setVisible(false);
				super.doDrop(validator, location);
			}

			@Override
			public void doDrop(ModelCollection model, Point location) {
				MyMusicDnDPanel.this.setVisible(false);
				super.doDrop(model, location);
			}
		};

		multiLayerDropTargetListener.addDragListener(this, myMusicDropListener);
		multiLayerDropTargetListener.addDropListener(this, myMusicDropListener);
	}

	private void init() {
		this.setLayout(new GridBagLayout());
		this.setName(MY_MUSIC_DND_PANEL);
		this.setSize(SIZE);
		this.setPreferredSize(SIZE);
		this.setMinimumSize(SIZE);
		this.setMaximumSize(SIZE);
		this.setLocation(LOCATION);

		GridBagConstraints myMusicDnDLabelGridBagConstraints = new GridBagConstraints();
		myMusicDnDLabelGridBagConstraints.gridx = 0;
		myMusicDnDLabelGridBagConstraints.gridy = 0;
		myMusicDnDLabelGridBagConstraints.fill = GridBagConstraints.NONE;

		GridBagConstraints dropLabelConstraints = new GridBagConstraints();
		dropLabelConstraints.gridx = 0;
		dropLabelConstraints.gridy = 1;
		dropLabelConstraints.fill = GridBagConstraints.NONE;

		GridBagConstraints dropSmallLabelConstraints = new GridBagConstraints();
		dropSmallLabelConstraints.gridx = 0;
		dropSmallLabelConstraints.gridy = 2;
		dropSmallLabelConstraints.fill = GridBagConstraints.NONE;

		GridBagConstraints arrowConstraints = new GridBagConstraints();
		arrowConstraints.gridx = 0;
		arrowConstraints.gridy = 3;
		arrowConstraints.fill = GridBagConstraints.NONE;

		this.add(getMyMusicDndLabel(), myMusicDnDLabelGridBagConstraints);
		this.add(getDropLabel(), dropLabelConstraints);
		this.add(getDropSmallLabel(), dropSmallLabelConstraints);
		this.add(getArrowPanel(), arrowConstraints);
	}

	private JLabel getMyMusicDndLabel() {
		if (myMusicDndLabel == null) {
			myMusicDndLabel = new JLabel();
			myMusicDndLabel.setName(SynthFonts.BOLD_FONT12_GRAY77_77_77);
			myMusicDndLabel.setHorizontalAlignment(JLabel.CENTER);
			myMusicDndLabel.setVerticalAlignment(JLabel.TOP);
			myMusicDndLabel.setBounds(MY_MUSIC_DND_LABEL_BOUNDS);
			myMusicDndLabel.setSize(MY_MUSIC_DND_LABEL_SIZE);
			myMusicDndLabel.setPreferredSize(MY_MUSIC_DND_LABEL_SIZE);
			myMusicDndLabel.setMinimumSize(MY_MUSIC_DND_LABEL_SIZE);
			myMusicDndLabel.setMaximumSize(MY_MUSIC_DND_LABEL_SIZE);
		}
		return myMusicDndLabel;
	}

	private JLabel getDropLabel() {
		if (dropLabel == null) {
			dropLabel = new JLabel();
			dropLabel.setLocation(new Point(0, 23));
			dropLabel.setName(SynthFonts.BOLD_FONT23_PURPLE8130_60_165);
			dropLabel.setHorizontalAlignment(JLabel.CENTER);
			dropLabel.setSize(DROP_LABEL_SIZE);
			dropLabel.setPreferredSize(DROP_LABEL_SIZE);
			dropLabel.setMinimumSize(DROP_LABEL_SIZE);
			dropLabel.setMaximumSize(DROP_LABEL_SIZE);
		}
		return dropLabel;
	}

	private JLabel getDropSmallLabel() {
		if (dropSmallLabel == null) {
			dropSmallLabel = new JLabel();
			dropSmallLabel.setLocation(new Point(0, 45));
			dropSmallLabel.setName(SynthFonts.PLAIN_FONT12_PURPLE8130_60_165);
			dropSmallLabel.setHorizontalAlignment(JLabel.CENTER);
			dropSmallLabel.setSize(DROP_LABEL_SMALL_SIZE);
			dropSmallLabel.setPreferredSize(DROP_LABEL_SIZE);
			dropSmallLabel.setMinimumSize(DROP_LABEL_SIZE);
			dropSmallLabel.setMaximumSize(DROP_LABEL_SIZE);
		}
		return dropSmallLabel;
	}

	private JLabel getArrowPanel() {
		if (arrowPanel == null) {
			arrowPanel = new JLabel();
			arrowPanel.setIcon(UIManager.getDefaults().getIcon("icons.myMusicDndArrow"));
			arrowPanel.setBounds(44, 80, 96, 96);
			arrowPanel.setSize(ARROW_ICON_SIZE);
			arrowPanel.setPreferredSize(ARROW_ICON_SIZE);
			arrowPanel.setMinimumSize(ARROW_ICON_SIZE);
			arrowPanel.setMaximumSize(ARROW_ICON_SIZE);
			arrowPanel.setIconTextGap(0);
			arrowPanel.setAlignmentX(CENTER_ALIGNMENT);
			arrowPanel.setAlignmentY(CENTER_ALIGNMENT);
		}
		return arrowPanel;
	}

	@Override
	public void internationalize(Messages messages) {
		getMyMusicDndLabel().setText(messages.getMessage("previewPanel.dropPanel.mymusic.label"));
		getDropLabel().setText(messages.getMessage("previewPanel.dropPanel.mymusic.droplabel"));
		getDropSmallLabel().setText(messages.getMessage("previewPanel.dropPanel.mymusic.DropSmall"));
	}

	@Override
	public void removeMessages(Messages messages) {
		messages.remove(this);
	}

	@Override
	@Autowired
	public void setMessages(Messages messages) {
		messages.add(this);
	}

	@Override
	public void setVisible(boolean aFlag) {
		super.setVisible(aFlag);
		localLibraryPanel.setActiveMusicPanel(aFlag);
	}

	public boolean isDropable(DraggedObject dragObject) {
		return myMusicDropListener.isDropable(dragObject);
	}

}


text:
var // Expectation library:
	chai = require( 'chai' ),

	// Module to be tested:
	binsearch = require( './../lib' );

// VARIABLES //

var expect = chai.expect,
	assert = chai.assert;

// TESTS //

describe( 'binsearch', function tests() {
	'use strict';

	it( 'should export a function', function test() {
		expect( binsearch ).to.be.a( 'function' );
	});

	it( 'should require two input arguments: edge vector and value', function test() {
		expect( binsearch ).to.throw( Error );
		expect( function() { binsearch([]); } ).to.throw( Error );
	});

	it( 'should take a 1d array which defines the bin edges as its first argument', function test() {
		expect( badValue( '5' ) ).to.throw( Error );
		expect( badValue( 99 ) ).to.throw( Error );
		expect( badValue( {} ) ).to.throw( Error );
		expect( badValue( null ) ).to.throw( Error );
		expect( badValue( undefined ) ).to.throw( Error );
		expect( badValue( NaN ) ).to.throw( Error );

		function badValue( arr ) {
			return function() {
				binsearch( arr, 0 );
			};
		}
	});

	it( 'should take a numeric value as its second argument', function test() {
		expect( badValue( '5' ) ).to.throw( Error );
		expect( badValue( [] ) ).to.throw( Error );
		expect( badValue( {} ) ).to.throw( Error );
		expect( badValue( null ) ).to.throw( Error );
		expect( badValue( undefined ) ).to.throw( Error );
		expect( badValue( NaN ) ).to.throw( Error );

		function badValue( value ) {
			return function() {
				binsearch( [], value );
			};
		}
	});

	it( 'should return a bin index corresponding to the value\'s bin', function test() {
		var edges = [ 0.5, 1.5, 2.5, 3.5, 4.5, 5.5 ],
			value = 2;

		assert.strictEqual( binsearch( edges, value ), 1 );
	});

	it( 'should return -1 when a value is less than the min edge', function test() {
		var edges = [ 0.5, 1.5, 2.5, 3.5, 4.5, 5.5 ],
			value = 0;

		assert.strictEqual( binsearch( edges, value ), -1 );
	});

	it( 'should return the index of the max edge when a value is greater than the max edge', function test() {
		var edges = [ 0.5, 1.5, 2.5, 3.5, 4.5, 5.5 ],
			value = 6;

		assert.strictEqual( binsearch( edges, value ), 5 );
	});

});

redpajama_set_name: RedPajamaGithub


text:
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/Subject'), require('rxjs/add/operator/filter'), require('@angular/platform-browser')) :
        typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs/Subject', 'rxjs/add/operator/filter', '@angular/platform-browser'], factory) :
            (factory((global.angular2Modal = global.angular2Modal || {}), global.ng.core, global.Rx, global.rxjs_add_operator_filter, global.ng.platformBrowser));
}(this, (function (exports, _angular_core, rxjs_Subject, rxjs_add_operator_filter, _angular_platformBrowser) {
    'use strict';
    var PRIVATE_PREFIX = '$$';
    var RESERVED_REGEX = /^(\$\$).*/;
    function validateMethodName(name) {
        if (!name) {
            throw new Error("Illegal method name. Empty method name is not allowed");
        }
        else if (name in this) {
            throw new Error("A member name '" + name + "' already defined.");
        }
    }
    /**
     * Returns a list of assigned property names (non private)
     * @param subject
     * @returns {string[]}
     */
    function getAssignedPropertyNames(subject) {
        return Object.getOwnPropertyNames(subject)
            .filter(function (name) { return RESERVED_REGEX.test(name); })
            .map(function (name) { return name.substr(2); });
    }
    function privateKey(name) {
        return PRIVATE_PREFIX + name;
    }
    function objectDefinePropertyValue(obj, propertyName, value) {
        Object.defineProperty(obj, propertyName, {
            configurable: false,
            enumerable: false,
            writable: false,
            value: value
        });
    }
    /**
     * Given a FluentAssign instance, apply all of the supplied default values so calling
     * instance.toJSON will return those values (does not create a setter function)
     * @param instance
     * @param defaultValues
     */
    function applyDefaultValues(instance, defaultValues) {
        Object.getOwnPropertyNames(defaultValues)
            .forEach(function (name) { return instance[privateKey(name)] = defaultValues[name]; });
    }
    /**
     * Create a function for setting a value for a property on a given object.
     * @param obj The object to apply the key & setter on.
     * @param propertyName The name of the property on the object
     * @param writeOnce If true will allow writing once (default: false)
     *
     * Example:
     * let obj = new FluentAssign<any>;
     * setAssignMethod(obj, 'myProp');
     * obj.myProp('someValue');
     * const result = obj.toJSON();
     * console.log(result); //{ myProp: 'someValue' }
     *
     *
     * let obj = new FluentAssign<any>;
     * setAssignMethod(obj, 'myProp', true); // applying writeOnce
     * obj.myProp('someValue');
     * obj.myProp('someValue'); // ERROR: Overriding config property 'myProp' is not allowed.
     */
    function setAssignMethod(obj, propertyName, writeOnce) {
        var _this = this;
        if (writeOnce === void 0) {
            writeOnce = false;
        }
        validateMethodName.call(obj, propertyName);
        var key = privateKey(propertyName);
        objectDefinePropertyValue(obj, propertyName, function (value) {
            if (writeOnce && _this.hasOwnProperty(key)) {
                throw new Error("Overriding config property '" + propertyName + "' is not allowed.");
            }
            obj[key] = value;
            return obj;
        });
    }
    /**
     * Create a function for setting a value that is an alias to an other setter function.
     * @param obj The object to apply the key & setter on.
     * @param propertyName The name of the property on the object
     * @param srcPropertyName The name of the property on the object this alias points to
     * @param hard If true, will set a readonly property on the object that returns
     *        the value of the source property. Default: false
     *
     * Example:
     * let obj = new FluentAssign<any> ;
     * setAssignMethod(obj, 'myProp');
     * setAssignAlias(obj, 'myPropAlias', 'myProp');
     * obj.myPropAlias('someValue');
     * const result = obj.toJSON();
     * console.log(result); //{ myProp: 'someValue' }
     * result.myPropAlias // undefined
     *
     *
     * let obj = new FluentAssign<any> ;
     * setAssignMethod(obj, 'myProp');
     * setAssignAlias(obj, 'myPropAlias', 'myProp', true); // setting a hard alias.
     * obj.myPropAlias('someValue');
     * const result = obj.toJSON();
     * console.log(result); //{ myProp: 'someValue' }
     * result.myPropAlias // someValue
     */
    function setAssignAlias(obj, propertyName, srcPropertyName, hard) {
        if (hard === void 0) {
            hard = false;
        }
        validateMethodName.call(obj, propertyName);
        objectDefinePropertyValue(obj, propertyName, function (value) {
            obj[srcPropertyName](value);
            return obj;
        });
        if (hard === true) {
            var key = privateKey(propertyName), srcKey_1 = privateKey(srcPropertyName);
            Object.defineProperty(obj, key, {
                configurable: false,
                enumerable: false,
                get: function () { return obj[srcKey_1]; }
            });
        }
    }
    /**
     * Represent a fluent API factory wrapper for defining FluentAssign instances.
     */
    var FluentAssignFactory = (function () {
        function FluentAssignFactory(fluentAssign) {
            this._fluentAssign =
                fluentAssign instanceof FluentAssign ? fluentAssign : new FluentAssign();
        }
        /**
         * Create a setter method on the FluentAssign instance.
         * @param name The name of the setter function.
         * @param defaultValue If set (not undefined) set's the value on the instance immediately.
         * @returns {FluentAssignFactory}
         */
        FluentAssignFactory.prototype.setMethod = function (name, defaultValue) {
            if (defaultValue === void 0) {
                defaultValue = undefined;
            }
            setAssignMethod(this._fluentAssign, name);
            if (defaultValue !== undefined) {
                this._fluentAssign[name](defaultValue);
            }
            return this;
        };
        Object.defineProperty(FluentAssignFactory.prototype, "fluentAssign", {
            /**
             * The FluentAssign instance.
             * @returns {FluentAssign<T>}
             */
            get: function () {
                return this._fluentAssign;
            },
            enumerable: true,
            configurable: true
        });
        return FluentAssignFactory;
    }());
    /**
     * Represent an object where every property is a function representing an assignment function.
     * Calling each function with a value will assign the value to the object and return the object.
     * Calling 'toJSON' returns an object with the same properties but this time representing the
     * assigned values.
     *
     * This allows setting an object in a fluent API manner.
     * Example:
     let fluent = new FluentAssign<any>(undefined, ['some', 'went']);
     fluent.some('thing').went('wrong').toJSON();
     // { some: 'thing', went: 'wrong' }
     */
    var FluentAssign = (function () {
        /**
         *
         * @param defaultValues An object representing default values for the underlying object.
         * @param initialSetters A list of initial setters for this FluentAssign.
         * @param baseType the class/type to create a new base. optional, {} is used if not supplied.
         */
        function FluentAssign(defaultValues, initialSetters, baseType) {
            if (defaultValues === void 0) {
                defaultValues = undefined;
            }
            if (initialSetters === void 0) {
                initialSetters = undefined;
            }
            if (baseType === void 0) {
                baseType = undefined;
            }
            var _this = this;
            if (Array.isArray(defaultValues)) {
                defaultValues.forEach(function (d) { return applyDefaultValues(_this, d); });
            }
            else if (defaultValues) {
                applyDefaultValues(this, defaultValues);
            }
            if (Array.isArray(initialSetters)) {
                initialSetters.forEach(function (name) { return setAssignMethod(_this, name); });
            }
            if (baseType) {
                this.__fluent$base__ = baseType;
            }
        }
        /**
         * Returns a FluentAssignFactory<FluentAssign<T>> ready to define a FluentAssign type.
         * @param defaultValues An object representing default values for the instance.
         * @param initialSetters A list of initial setters for the instance.
         * @returns {FluentAssignFactory<T>}
         */
        FluentAssign.compose = function (defaultValues, initialSetters) {
            if (defaultValues === void 0) {
                defaultValues = undefined;
            }
            if (initialSetters === void 0) {
                initialSetters = undefined;
            }
            return FluentAssign.composeWith(new FluentAssign(defaultValues, initialSetters));
        };
        /**
         * Returns a FluentAssignFactory<Z> where Z is an instance of FluentAssign<?> or a derived
         * class of it.
         * @param fluentAssign An instance of FluentAssign<?> or a derived class of FluentAssign<?>.
         * @returns {any}
         */
        FluentAssign.composeWith = function (fluentAssign) {
            return new FluentAssignFactory(fluentAssign);
        };
        FluentAssign.prototype.toJSON = function () {
            var _this = this;
            return getAssignedPropertyNames(this)
                .reduce(function (obj, name) {
                var key = privateKey(name);
                // re-define property descriptors (we dont want their value)
                var propDesc = Object.getOwnPropertyDescriptor(_this, key);
                if (propDesc) {
                    Object.defineProperty(obj, name, propDesc);
                }
                else {
                    obj[name] = _this[key];
                }
                return obj;
            }, this.__fluent$base__ ? new this.__fluent$base__() : {});
        };
        return FluentAssign;
    }());
    /**
     * Simple object extend
     * @param m1
     * @param m2
     * @returns {{}}
     */
    /**
     * Simple object extend
     * @param m1
     * @param m2
     * @returns {{}}
     */ function extend(m1, m2) {
        var m = {};
        for (var attr in m1) {
            if (m1.hasOwnProperty(attr)) {
                m[attr] = m1[attr];
            }
        }
        for (var attr in m2) {
            if (m2.hasOwnProperty(attr)) {
                m[attr] = m2[attr];
            }
        }
        return m;
    }
    /**
     * Simple, not optimized, array union of unique values.
     * @param arr1
     * @param arr2
     * @returns {T[]|any[]|any[][]|any[]}
     */
    function arrayUnion(arr1, arr2) {
        return arr1
            .concat(arr2.filter(function (v) { return arr1.indexOf(v) === -1; }));
    }
    /**
     * Returns true if the config supports a given key.
     * @param key
     * @returns {boolean}
     */
    function supportsKey$1(keyCode, config) {
        if (!Array.isArray(config))
            return config === null ? false : true;
        return config.indexOf(keyCode) > -1;
    }
    /**
     * Given an object representing a key/value map of css properties, returns a valid css string
     * representing the object.
     * Example:
     * console.log(toStyleString({
     *     position: 'absolute',
     *     width: '100%',
     *     height: '100%',
     *     top: '0',
     *     left: '0',
     *     right: '0',
     *     bottom: '0'
     * }));
     * // position:absolute;width:100%;height:100%;top:0;left:0;right:0;bottom:0
     * @param obj
     * @returns {string}
     */
    var PromiseCompleter = (function () {
        function PromiseCompleter() {
            var _this = this;
            this.promise = new Promise(function (res, rej) {
                _this.resolve = res;
                _this.reject = rej;
            });
        }
        return PromiseCompleter;
    }());
    function noop() { }
    function createComponent(instructions) {
        var injector = getInjector(instructions);
        return instructions.vcRef.createComponent(injector.get(_angular_core.ComponentFactoryResolver).resolveComponentFactory(instructions.component), instructions.vcRef.length, injector, instructions.projectableNodes);
    }
    function getInjector(instructions) {
        var ctxInjector = instructions.injector || instructions.vcRef.parentInjector;
        return Array.isArray(instructions.bindings) && instructions.bindings.length > 0 ?
            _angular_core.ReflectiveInjector.fromResolvedProviders(instructions.bindings, ctxInjector) : ctxInjector;
    }
    var __extends = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var DialogBailOutError = (function (_super) {
        __extends(DialogBailOutError, _super);
        function DialogBailOutError(value) {
            var _this = _super.call(this) || this;
            if (!value) {
                value = 'Dialog was forced to close by an unknown source.';
            }
            _this.message = value;
            return _this;
        }
        return DialogBailOutError;
    }(Error));
    /**
     * API to an open modal window.
     */
    var DialogRef = (function () {
        function DialogRef(overlay, context) {
            this.overlay = overlay;
            this.context = context;
            this._resultDeferred = new PromiseCompleter();
            this._onDestroy = new rxjs_Subject.Subject();
            this.onDestroy = this._onDestroy.asObservable();
        }
        Object.defineProperty(DialogRef.prototype, "result", {
            /**
             * A Promise that is resolved on a close event and rejected on a dismiss event.
             * @returns {Promise<T>|any|*|Promise<any>}
             */
            get: function () {
                return this._resultDeferred.promise;
            },
            enumerable: true,
            configurable: true
        });
        /**
         * Set a close/dismiss guard
         * @param g
         */
        DialogRef.prototype.setCloseGuard = function (guard) {
            this.closeGuard = guard;
        };
        /**
         *  Close the modal with a return value, i.e: result.
         */
        DialogRef.prototype.close = function (result) {
            var _this = this;
            if (result === void 0) {
                result = null;
            }
            var _close = function () {
                _this.destroy();
                _this._resultDeferred.resolve(result);
            };
            this._fireHook('beforeClose')
                .then(function (value) { return value !== true && _close(); })
                .catch(_close);
        };
        /**
         *  Close the modal without a return value, i.e: cancelled.
         *  This call is automatically invoked when a user either:
         *  - Presses an exit keyboard key (if configured).
         *  - Clicks outside of the modal window (if configured).
         *  Usually, dismiss represent a Cancel button or a X button.
         */
        DialogRef.prototype.dismiss = function () {
            var _this = this;
            var _dismiss = function () {
                _this.destroy();
                _this._resultDeferred.promise.catch(function () { });
                _this._resultDeferred.reject();
            };
            this._fireHook('beforeDismiss')
                .then(function (value) { return value !== true && _dismiss(); })
                .catch(_dismiss);
        };
        /**
         * Gracefully close the overlay/dialog with a rejected result.
         * Does not trigger canDestroy on the overlay.
         */
        DialogRef.prototype.bailOut = function () {
            if (this.destroyed !== true) {
                this.destroyed = true;
                this._onDestroy.next(null);
                this._onDestroy.complete();
                this._resultDeferred.reject(new DialogBailOutError());
            }
        };
        DialogRef.prototype.destroy = function () {
            var _this = this;
            if (this.destroyed !== true) {
                this.destroyed = true;
                if (typeof this.overlayRef.instance.canDestroy === 'function') {
                    this.overlayRef.instance.canDestroy()
                        .catch(function () { })
                        .then(function () { return _this._destroy(); });
                }
                else {
                    this._destroy();
                }
            }
        };
        DialogRef.prototype._destroy = function () {
            this._onDestroy.next(null);
            this._onDestroy.complete();
            this.overlayRef.destroy();
        };
        DialogRef.prototype._fireHook = function (name) {
            var gurad = this.closeGuard, fn = gurad && typeof gurad[name] === 'function' && gurad[name];
            return Promise.resolve(fn ? fn.call(gurad) : false);
        };
        return DialogRef;
    }());
    (function (DROP_IN_TYPE) {
        DROP_IN_TYPE[DROP_IN_TYPE["alert"] = 0] = "alert";
        DROP_IN_TYPE[DROP_IN_TYPE["prompt"] = 1] = "prompt";
        DROP_IN_TYPE[DROP_IN_TYPE["confirm"] = 2] = "confirm";
    })(exports.DROP_IN_TYPE || (exports.DROP_IN_TYPE = {}));
    var OverlayRenderer = (function () {
        function OverlayRenderer() {
        }
        return OverlayRenderer;
    }());
    var vcRefCollection = {};
    function getVCRef(key) {
        return vcRefCollection[key] ? vcRefCollection[key].slice() : [];
    }
    function setVCRef(key, vcRef) {
        if (!vcRefCollection.hasOwnProperty(key)) {
            vcRefCollection[key] = [];
        }
        vcRefCollection[key].push(vcRef);
    }
    function delVCRef(key, vcRef) {
        if (!vcRef) {
            vcRefCollection[key] = [];
        }
        else {
            var coll = vcRefCollection[key] || [], idx = coll.indexOf(vcRef);
            if (idx > -1) {
                coll.splice(idx, 1);
            }
        }
    }
    /**
     * A Simple store that holds a reference to ViewContainerRef instances by a user defined key.
     * This, with the OverlayTarget directive makes it easy to block the overlay inside an element
     * without having to use the angular query boilerplate.
     * @type {{
     *  getVCRef: (function(string): ViewContainerRef),
     *  setVCRef: (function(string, ViewContainerRef): void),
     *  delVCRef: (function(string): void)
     *  }}
     */
    var vcRefStore = { getVCRef: getVCRef, setVCRef: setVCRef, delVCRef: delVCRef };
    var BASKET_GROUP = {};
    /**
     * A dumb stack implementation over an array.
     */
    var DialogRefStack = (function () {
        function DialogRefStack() {
            this._stack = [];
            this._stackMap = new Map();
        }
        Object.defineProperty(DialogRefStack.prototype, "length", {
            get: function () {
                return this._stack.length;
            },
            enumerable: true,
            configurable: true
        });
        DialogRefStack.prototype.push = function (dialogRef, group) {
            if (this._stack.indexOf(dialogRef) === -1) {
                this._stack.push(dialogRef);
                this._stackMap.set(dialogRef, group || BASKET_GROUP);
            }
        };
        /**
         * Push a DialogRef into the stack and manage it so when it's done
         * it will automatically kick itself out of the stack.
         * @param dialogRef
         */
        DialogRefStack.prototype.pushManaged = function (dialogRef, group) {
            var _this = this;
            this.push(dialogRef, group);
            dialogRef.onDestroy.subscribe(function () { return _this.remove(dialogRef); });
        };
        DialogRefStack.prototype.pop = function () {
            var dialogRef = this._stack.pop();
            this._stackMap.delete(dialogRef);
            return dialogRef;
        };
        /**
         * Remove a DialogRef from the stack.
         * @param dialogRef
         */
        DialogRefStack.prototype.remove = function (dialogRef) {
            var idx = this.indexOf(dialogRef);
            if (idx > -1) {
                this._stack.splice(idx, 1);
                this._stackMap.delete(dialogRef);
            }
        };
        DialogRefStack.prototype.index = function (index) {
            return this._stack[index];
        };
        DialogRefStack.prototype.indexOf = function (dialogRef) {
            return this._stack.indexOf(dialogRef);
        };
        DialogRefStack.prototype.groupOf = function (dialogRef) {
            return this._stackMap.get(dialogRef);
        };
        DialogRefStack.prototype.groupBy = function (group) {
            var arr = [];
            if (group) {
                this._stackMap.forEach(function (value, key) {
                    if (value === group) {
                        arr.push(key);
                    }
                });
            }
            return arr;
        };
        DialogRefStack.prototype.groupLength = function (group) {
            var count = 0;
            if (group) {
                this._stackMap.forEach(function (value, key) {
                    if (value === group) {
                        count++;
                    }
                });
            }
            return count;
        };
        return DialogRefStack;
    }());
    var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata$1 = (undefined && undefined.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(k, v);
    };
    var _stack = new DialogRefStack();
    exports.Overlay = (function () {
        function Overlay(_modalRenderer) {
            this._modalRenderer = _modalRenderer;
        }
        Object.defineProperty(Overlay.prototype, "stackLength", {
            get: function () {
                return _stack.length;
            },
            enumerable: true,
            configurable: true
        });
        /**
         * Check if a given DialogRef is the top most ref in the stack.
         * TODO: distinguish between body modal vs in element modal.
         * @param dialogRef
         * @returns {boolean}
         */
        Overlay.prototype.isTopMost = function (dialogRef) {
            return _stack.indexOf(dialogRef) === _stack.length - 1;
        };
        Overlay.prototype.stackPosition = function (dialogRef) {
            return _stack.indexOf(dialogRef);
        };
        Overlay.prototype.groupStackLength = function (dialogRef) {
            return _stack.groupLength(_stack.groupOf(dialogRef));
        };
        /**
         * Creates an overlay and returns a dialog ref.
         * @param config instructions how to create the overlay
         * @param group A token to associate the new overlay with, used for reference (stacks usually)
         * @returns {DialogRef<T>[]}
         */
        Overlay.prototype.open = function (config, group) {
            var _this = this;
            var viewContainer = config.viewContainer, containers = [];
            if (typeof viewContainer === 'string') {
                containers = vcRefStore.getVCRef(viewContainer);
            }
            else if (Array.isArray(viewContainer)) {
                containers = viewContainer;
            }
            else if (viewContainer) {
                containers = [viewContainer];
            }
            if (!containers || !containers[0]) {
                if (!this.defaultViewContainer) {
                    throw new Error('Default view container not set. Add the "defaultOverlayTarget" directive ' +
                        'to the application root component template (e.g: <span defaultOverlayTarget></span>. ' +
                        'You can also set it manually using the "Overlay" service "defaultViewContainer" property.');
                }
                containers = [this.defaultViewContainer];
            }
            return containers
                .map(function (vc) { return _this.createOverlay(config.renderer || _this._modalRenderer, vc, config, group); });
        };
        Overlay.prototype.createOverlay = function (renderer, vcRef, config, group) {
            if (config.context) {
                config.context.normalize();
            }
            var dialog = new DialogRef(this, config.context || {});
            dialog.inElement = config.context && !!config.context.inElement;
            var cmpRef = renderer.render(dialog, vcRef, config.injector);
            Object.defineProperty(dialog, 'overlayRef', { value: cmpRef });
            _stack.pushManaged(dialog, group);
            return dialog;
        };
        return Overlay;
    }());
    exports.Overlay = __decorate$2([
        _angular_core.Injectable(),
        __metadata$1("design:paramtypes", [OverlayRenderer])
    ], exports.Overlay);
    var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata = (undefined && undefined.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(k, v);
    };
    /**
     * A directive use to signal the overlay that the host of this directive
     * is a dialog boundary, i.e: over click outside of the element should close the modal
     * (if non blocking)
     */
    exports.OverlayDialogBoundary = (function () {
        function OverlayDialogBoundary(el, dialogRef) {
            if (dialogRef && el.nativeElement) {
                dialogRef.overlayRef.instance.setClickBoundary(el.nativeElement);
            }
        }
        return OverlayDialogBoundary;
    }());
    exports.OverlayDialogBoundary = __decorate$1([
        _angular_core.Directive({
            selector: '[overlayDialogBoundary]'
        }),
        __metadata("design:paramtypes", [_angular_core.ElementRef, DialogRef])
    ], exports.OverlayDialogBoundary);
    exports.OverlayTarget = (function () {
        function OverlayTarget(vcRef) {
            this.vcRef = vcRef;
        }
        Object.defineProperty(OverlayTarget.prototype, "targetKey", {
            set: function (value) {
                this._targetKey = value;
                if (value) {
                    vcRefStore.setVCRef(value, this.vcRef);
                }
            },
            enumerable: true,
            configurable: true
        });
        OverlayTarget.prototype.ngOnDestroy = function () {
            if (this._targetKey) {
                vcRefStore.delVCRef(this._targetKey, this.vcRef);
            }
        };
        return OverlayTarget;
    }());
    __decorate$1([
        _angular_core.Input('overlayTarget'),
        __metadata("design:type", String),
        __metadata("design:paramtypes", [String])
    ], exports.OverlayTarget.prototype, "targetKey", null);
    exports.OverlayTarget = __decorate$1([
        _angular_core.Directive({
            selector: '[overlayTarget]'
        }),
        __metadata("design:paramtypes", [_angular_core.ViewContainerRef])
    ], exports.OverlayTarget);
    var DefaultOverlayTarget = (function () {
        function DefaultOverlayTarget(overlay, vcRef) {
            this.overlay = overlay;
            overlay.defaultViewContainer = vcRef;
        }
        DefaultOverlayTarget.prototype.ngOnDestroy = function () {
            this.overlay.defaultViewContainer = undefined;
        };
        return DefaultOverlayTarget;
    }());
    DefaultOverlayTarget = __decorate$1([
        _angular_core.Directive({
            selector: '[defaultOverlayTarget]'
        }),
        __metadata("design:paramtypes", [exports.Overlay, _angular_core.ViewContainerRef])
    ], DefaultOverlayTarget);
    var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata$3 = (undefined && undefined.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(k, v);
    };
    // <template [dynCmp]="myCmp" [dynCmpBindings]="myBindings"></template>
    // <template [dynCmp]="ctx.component" [dynCmpBindings]="ctx.bindings" [dynCmpProjectables]="ctx.projectableNodes"></template>
    exports.SwapComponentDirective = (function () {
        function SwapComponentDirective(cfr, vcRef, tRef) {
            this.cfr = cfr;
            this.vcRef = vcRef;
            this.tRef = tRef;
            this.onCreate = new _angular_core.EventEmitter(false);
        }
        Object.defineProperty(SwapComponentDirective.prototype, "swapCmp", {
            set: function (component) {
                this.component = component;
                this.vcRef.clear();
                if (this.component) {
                    var injector = this.swapCmpInjector || this.vcRef.parentInjector;
                    if (Array.isArray(this.swapCmpBindings) && this.swapCmpBindings.length > 0) {
                        injector = _angular_core.ReflectiveInjector.fromResolvedProviders(this.swapCmpBindings, injector);
                    }
                    var cmpRef = this.vcRef.createComponent(this.cfr.resolveComponentFactory(component), this.vcRef.length, injector, this.swapCmpProjectables);
                    cmpRef.changeDetectorRef.detectChanges();
                    this.onCreate.emit(cmpRef);
                }
            },
            enumerable: true,
            configurable: true
        });
        return SwapComponentDirective;
    }());
    __decorate$4([
        _angular_core.Input(),
        __metadata$3("design:type", Array)
    ], exports.SwapComponentDirective.prototype, "swapCmpBindings", void 0);
    __decorate$4([
        _angular_core.Input(),
        __metadata$3("design:type", _angular_core.Injector)
    ], exports.SwapComponentDirective.prototype, "swapCmpInjector", void 0);
    __decorate$4([
        _angular_core.Input(),
        __metadata$3("design:type", Array)
    ], exports.SwapComponentDirective.prototype, "swapCmpProjectables", void 0);
    __decorate$4([
        _angular_core.Output(),
        __metadata$3("design:type", _angular_core.EventEmitter)
    ], exports.SwapComponentDirective.prototype, "onCreate", void 0);
    __decorate$4([
        _angular_core.Input(),
        __metadata$3("design:type", Object),
        __metadata$3("design:paramtypes", [Object])
    ], exports.SwapComponentDirective.prototype, "swapCmp", null);
    exports.SwapComponentDirective = __decorate$4([
        _angular_core.Directive({
            selector: '[swapCmp]'
        }),
        __metadata$3("design:paramtypes", [_angular_core.ComponentFactoryResolver,
            _angular_core.ViewContainerRef,
            _angular_core.TemplateRef])
    ], exports.SwapComponentDirective);
    var BROWSER_PREFIX = ['webkit', 'moz', 'MS', 'o', ''];
    function register(eventName, element, cb) {
        BROWSER_PREFIX.forEach(function (p) {
            element.addEventListener(p ? p + eventName : eventName.toLowerCase(), cb, false);
        });
    }
    /**
     * A base class for supporting dynamic components.
     * There are 3 main support areas:
     * 1 - Easy wrapper for dynamic styling via CSS classes and inline styles.
     * 2 - Easy wrapper for interception of transition/animation end events.
     * 3 - Easy wrapper for component creation and injection.
     *
     * Dynamic css is done via direct element manipulation (via renderer), it does not use change detection
     * or binding. This is to allow better control over animation.
     *
     * Animation support is limited, only transition/keyframes END even are notified.
     * The animation support is needed since currently the angular animation module is limited as well and
     * does not support CSS animation that are not pre-parsed and are not in the styles metadata of a component.
     *
     * Capabilities: Add/Remove styls, Add/Remove classes, listen to animation/transition end event,
     * add components
     */
    var BaseDynamicComponent = (function () {
        function BaseDynamicComponent(el, renderer) {
            this.el = el;
            this.renderer = renderer;
        }
        BaseDynamicComponent.prototype.activateAnimationListener = function () {
            var _this = this;
            if (this.animationEnd)
                return;
            this.animationEnd = new rxjs_Subject.Subject();
            this.animationEnd$ = this.animationEnd.asObservable();
            register('TransitionEnd', this.el.nativeElement, function (e) { return _this.onEnd(e); });
            register('AnimationEnd', this.el.nativeElement, function (e) { return _this.onEnd(e); });
        };
        /**
         * Set a specific inline style on the overlay host element.
         * @param prop The style key
         * @param value The value, undefined to remove
         * @returns {ModalOverlay}
         */
        BaseDynamicComponent.prototype.setStyle = function (prop, value) {
            this.renderer.setElementStyle(this.el.nativeElement, prop, value);
            return this;
        };
        BaseDynamicComponent.prototype.forceReflow = function () {
            this.el.nativeElement.offsetWidth;
        };
        BaseDynamicComponent.prototype.addClass = function (css, forceReflow) {
            var _this = this;
            if (forceReflow === void 0) {
                forceReflow = false;
            }
            css.split(' ')
                .forEach(function (c) { return _this.renderer.setElementClass(_this.el.nativeElement, c, true); });
            if (forceReflow)
                this.forceReflow();
        };
        BaseDynamicComponent.prototype.removeClass = function (css, forceReflow) {
            var _this = this;
            if (forceReflow === void 0) {
                forceReflow = false;
            }
            css.split(' ')
                .forEach(function (c) { return _this.renderer.setElementClass(_this.el.nativeElement, c, false); });
            if (forceReflow)
                this.forceReflow();
        };
        BaseDynamicComponent.prototype.ngOnDestroy = function () {
            if (this.animationEnd && !this.animationEnd.closed) {
                this.animationEnd.complete();
            }
        };
        BaseDynamicComponent.prototype.myAnimationEnd$ = function () {
            var _this = this;
            return this.animationEnd$
                .filter(function (e) { return e.target === _this.el.nativeElement; });
        };
        /**
         * Add a component, supply a view container ref.
         * Note: The components vcRef will result in a sibling.
         * @param component The component to add
         * @param vcRef The container to add to
         * @param bindings Bindings to use (added on top of the ViewContainerRef)
         * @returns {Promise<ComponentRef<any>>}
         */
        BaseDynamicComponent.prototype._addComponent = function (instructions) {
            var cmpRef = createComponent(instructions);
            cmpRef.changeDetectorRef.detectChanges();
            return cmpRef;
        };
        BaseDynamicComponent.prototype.onEnd = function (event) {
            if (!this.animationEnd.closed) {
                this.animationEnd.next(event);
            }
        };
        return BaseDynamicComponent;
    }());
    var __extends$2 = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata$4 = (undefined && undefined.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(k, v);
    };
    /**
     * Represents the modal backdrop shaped by CSS.
     */
    exports.CSSBackdrop = (function (_super) {
        __extends$2(CSSBackdrop, _super);
        function CSSBackdrop(el, renderer) {
            var _this = _super.call(this, el, renderer) || this;
            _this.activateAnimationListener();
            var style = {
                position: 'absolute',
                top: 0,
                left: 0,
                width: '100%',
                height: '100%'
            };
            Object.keys(style).forEach(function (k) { return _this.setStyle(k, style[k]); });
            return _this;
        }
        return CSSBackdrop;
    }(BaseDynamicComponent));
    exports.CSSBackdrop = __decorate$5([
        _angular_core.Component({
            selector: 'css-backdrop',
            host: {
                '[attr.class]': 'cssClass',
                '[attr.style]': 'styleStr'
            },
            encapsulation: _angular_core.ViewEncapsulation.None,
            template: ""
        }),
        __metadata$4("design:paramtypes", [_angular_core.ElementRef, _angular_core.Renderer])
    ], exports.CSSBackdrop);
    var __extends$3 = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata$5 = (undefined && undefined.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(k, v);
    };
    /**
     * A component that acts as a top level container for an open modal window.
     */
    exports.CSSDialogContainer = (function (_super) {
        __extends$3(CSSDialogContainer, _super);
        function CSSDialogContainer(dialog, el, renderer) {
            var _this = _super.call(this, el, renderer) || this;
            _this.dialog = dialog;
            _this.activateAnimationListener();
            return _this;
        }
        return CSSDialogContainer;
    }(BaseDynamicComponent));
    exports.CSSDialogContainer = __decorate$6([
        _angular_core.Component({
            selector: 'css-dialog-container',
            host: {
                'tabindex': '-1',
                'role': 'dialog'
            },
            encapsulation: _angular_core.ViewEncapsulation.None,
            template: "<ng-content></ng-content>"
        }),
        __metadata$5("design:paramtypes", [DialogRef,
            _angular_core.ElementRef, _angular_core.Renderer])
    ], exports.CSSDialogContainer);
    var __extends$1 = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata$2 = (undefined && undefined.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(k, v);
    };
    /**
     * Represents the modal overlay.
     */
    exports.ModalOverlay = (function (_super) {
        __extends$1(ModalOverlay, _super);
        function ModalOverlay(dialogRef, vcr, el, renderer) {
            var _this = _super.call(this, el, renderer) || this;
            _this.dialogRef = dialogRef;
            _this.vcr = vcr;
            _this.activateAnimationListener();
            return _this;
        }
        /**
         * @internal
         */
        ModalOverlay.prototype.getProjectables = function (content, bindings) {
            var nodes;
            if (typeof content === 'string') {
                nodes = [[this.renderer.createText(null, "" + content)]];
            }
            else if (content instanceof _angular_core.TemplateRef) {
                nodes = [
                    this.dialogRef.overlay.defaultViewContainer
                        .createEmbeddedView(content, { dialogRef: this.dialogRef }).rootNodes
                ];
            }
            else {
                nodes = [this.embedComponent({ component: content, bindings: bindings }).rootNodes];
            }
            return nodes;
        };
        ModalOverlay.prototype.embedComponent = function (config) {
            return this.vcr.createEmbeddedView(this.template, {
                $implicit: config
            });
        };
        ModalOverlay.prototype.addComponent = function (type, bindings, projectableNodes) {
            if (bindings === void 0) {
                bindings = [];
            }
            if (projectableNodes === void 0) {
                projectableNodes = [];
            }
            return _super.prototype._addComponent.call(this, {
                component: type,
                vcRef: this.innerVcr,
                bindings: bindings,
                projectableNodes: projectableNodes
            });
        };
        ModalOverlay.prototype.fullscreen = function () {
            var _this = this;
            var style = {
                position: 'fixed',
                top: 0,
                left: 0,
                bottom: 0,
                right: 0,
                'z-index': 1500
            };
            Object.keys(style).forEach(function (k) { return _this.setStyle(k, style[k]); });
        };
        ModalOverlay.prototype.insideElement = function () {
            var _this = this;
            var style = {
                position: 'absolute',
                overflow: 'hidden',
                width: '100%',
                height: '100%',
                top: 0,
                left: 0,
                bottom: 0,
                right: 0
            };
            Object.keys(style).forEach(function (k) { return _this.setStyle(k, style[k]); });
        };
        /**
         * Define an element that click inside it will not trigger modal close.
         * Since events bubble, clicking on a dialog will bubble up to the overlay, a plugin
         * must define an element that represent the dialog, the overlay will make sure no to close when
         * it was clicked.
         * @param element
         */
        ModalOverlay.prototype.setClickBoundary = function (element) {
            var _this = this;
            var target;
            var elListener = function (event) { return target = event.target; };
            var docListener = function (event) {
                if (_this.dialogRef.context.isBlocking || !_this.dialogRef.overlay.isTopMost(_this.dialogRef)) {
                    return;
                }
                var current = event.target;
                // on click, this will hit.
                if (current === target)
                    return;
                // on mouse down -> drag -> release the current might not be 'target', it might be
                // a sibling or a child (i.e: not part of the tree-up direction). It might also be a release
                // outside the dialog... so we compare to the boundary element
                do {
                    if (current === element) {
                        return;
                    }
                } while (current.parentNode && (current = current.parentNode));
                _this.dialogRef.dismiss();
            };
            this.dialogRef.onDestroy.subscribe(function () {
                element.removeEventListener('click', elListener, false);
                element.removeEventListener('touchstart', elListener, false);
                document.removeEventListener('click', docListener, false);
                document.removeEventListener('touchend', docListener, false);
            });
            setTimeout(function () {
                element.addEventListener('mousedown', elListener, false);
                element.addEventListener('touchstart', docListener, false);
                document.addEventListener('click', docListener, false);
                document.addEventListener('touchend', docListener, false);
            });
        };
        /**
         * Temp workaround for animation where destruction of the top level component does not
         * trigger child animations. Solution should be found either in animation module or in design
         * of the modal component tree.
         * @returns {Promise<void>}
         */
        ModalOverlay.prototype.canDestroy = function () {
            var completer = new PromiseCompleter();
            if (!Array.isArray(this.beforeDestroyHandlers)) {
                completer.resolve();
            }
            else {
                // run destroy notification but protect against halt.
                var id_1 = setTimeout(function () {
                    id_1 = null;
                    completer.reject();
                }, 1000);
                var resolve = function () {
                    if (id_1 === null)
                        return;
                    clearTimeout(id_1);
                    completer.resolve();
                };
                Promise.all(this.beforeDestroyHandlers.map(function (fn) { return fn(); }))
                    .then(resolve)
                    .catch(resolve);
            }
            return completer.promise;
        };
        /**
         * A handler running before destruction of the overlay
         * use to delay destruction due to animation.
         * This is part of the workaround for animation, see canDestroy.
         *
         * NOTE: There is no guarantee that the listeners will fire, use dialog.onDestory for that.
         * @param fn
         */
        ModalOverlay.prototype.beforeDestroy = function (fn) {
            if (!this.beforeDestroyHandlers) {
                this.beforeDestroyHandlers = [];
            }
            this.beforeDestroyHandlers.push(fn);
        };
        ModalOverlay.prototype.documentKeypress = function (event) {
            // check that this modal is the last in the stack.
            if (!this.dialogRef.overlay.isTopMost(this.dialogRef))
                return;
            if (supportsKey$1(event.keyCode, this.dialogRef.context.keyboard)) {
                this.dialogRef.dismiss();
            }
        };
        ModalOverlay.prototype.ngOnDestroy = function () {
            _super.prototype.ngOnDestroy.call(this);
            if (this.dialogRef.destroyed !== true) {
                // if we're here the overlay is destroyed by an external event that is not user invoked.
                // i.e: The user did no call dismiss or close and dialogRef.destroy() did not invoke.
                // this will happen when routing or killing an element containing a blocked overlay (ngIf)
                // we bail out, i.e gracefully shutting down.
                this.dialogRef.bailOut();
            }
        };
        return ModalOverlay;
    }(BaseDynamicComponent));
    __decorate$3([
        _angular_core.ViewChild('innerView', { read: _angular_core.ViewContainerRef }),
        __metadata$2("design:type", _angular_core.ViewContainerRef)
    ], exports.ModalOverlay.prototype, "innerVcr", void 0);
    __decorate$3([
        _angular_core.ViewChild('template'),
        __metadata$2("design:type", _angular_core.TemplateRef)
    ], exports.ModalOverlay.prototype, "template", void 0);
    exports.ModalOverlay = __decorate$3([
        _angular_core.Component({
            selector: 'modal-overlay',
            host: {
                '(body:keydown)': 'documentKeypress($event)'
            },
            encapsulation: _angular_core.ViewEncapsulation.None,
            template: "<template #innerView></template>\n<template #template let-ctx>\n    <template [swapCmp]=\"ctx.component\" [swapCmpBindings]=\"ctx.bindings\" [swapCmpProjectables]=\"ctx.projectableNodes\"></template>\n</template>\n"
        }),
        __metadata$2("design:paramtypes", [DialogRef,
            _angular_core.ViewContainerRef,
            _angular_core.ElementRef,
            _angular_core.Renderer])
    ], exports.ModalOverlay);
    var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    exports.DOMOverlayRenderer = (function () {
        function DOMOverlayRenderer() {
        }
        DOMOverlayRenderer.prototype.render = function (dialog, vcRef, injector) {
            var bindings = _angular_core.ReflectiveInjector.resolve([
                { provide: DialogRef, useValue: dialog }
            ]);
            var cmpRef = createComponent({
                component: exports.ModalOverlay,
                vcRef: vcRef,
                injector: injector,
                bindings: bindings
            });
            if (dialog.inElement) {
                vcRef.element.nativeElement.appendChild(cmpRef.location.nativeElement);
            }
            else {
                document.body.appendChild(cmpRef.location.nativeElement);
            }
            return cmpRef;
        };
        return DOMOverlayRenderer;
    }());
    exports.DOMOverlayRenderer = __decorate([
        _angular_core.Injectable()
    ], exports.DOMOverlayRenderer);
    var __extends$4 = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var UnsupportedDropInError = (function (_super) {
        __extends$4(UnsupportedDropInError, _super);
        function UnsupportedDropInError(dropInName) {
            var _this = _super.call(this) || this;
            _this.message = "Unsupported Drop-In " + dropInName;
            return _this;
        }
        return UnsupportedDropInError;
    }(Error));
    var Modal = (function () {
        function Modal(overlay) {
            this.overlay = overlay;
        }
        Modal.prototype.alert = function () {
            throw new UnsupportedDropInError('alert');
        };
        Modal.prototype.prompt = function () {
            throw new UnsupportedDropInError('prompt');
        };
        Modal.prototype.confirm = function () {
            throw new UnsupportedDropInError('confirm');
        };
        /**
         * Opens a modal window inside an existing component.
         * @param content The content to display, either string, template ref or a component.
         * @param config Additional settings.
         * @returns {Promise<DialogRef>}
         */
        Modal.prototype.open = function (content, config) {
            config = config || {};
            try {
                var dialogs = this.overlay.open(config, this.constructor);
                if (dialogs.length > 1) {
                    console.warn("Attempt to open more then 1 overlay detected.\n        Multiple modal copies are not supported at the moment, \n        only the first viewContainer will display.");
                }
                // TODO:  Currently supporting 1 view container, hence working on dialogs[0].
                //        upgrade to multiple containers.
                return Promise.resolve(this.create(dialogs[0], content, config.bindings));
            }
            catch (e) {
                return Promise.reject(e);
            }
        };
        Modal.prototype.createBackdrop = function (dialogRef, BackdropComponent) {
            var b = _angular_core.ReflectiveInjector.resolve([{ provide: DialogRef, useValue: dialogRef }]);
            return dialogRef.overlayRef.instance.addComponent(BackdropComponent, b);
        };
        Modal.prototype.createContainer = function (dialogRef, ContainerComponent, content, bindings) {
            var b = _angular_core.ReflectiveInjector.resolve([{ provide: DialogRef, useValue: dialogRef }])
                .concat(bindings || []);
            var nodes = dialogRef.overlayRef.instance.getProjectables(content, b);
            return dialogRef.overlayRef.instance.addComponent(ContainerComponent, b, nodes);
        };
        /**
         * A helper function for derived classes to create backdrop & container
         * @param dialogRef
         * @param backdrop
         * @param container
         * @returns { backdropRef: ComponentRef<B>, containerRef: ComponentRef<C> }
         *
         * @deprecated use createBackdrop and createContainer instead
         */
        Modal.prototype.createModal = function (dialogRef, backdrop, container) {
            var b = _angular_core.ReflectiveInjector.resolve([{ provide: DialogRef, useValue: dialogRef }]);
            return {
                backdropRef: dialogRef.overlayRef.instance.addComponent(backdrop, b),
                containerRef: dialogRef.overlayRef.instance.addComponent(container, b)
            };
        };
        return Modal;
    }());
    // heavily inspired by:
    // http://www.bennadel.com/blog/3025-creating-custom-dom-and-host-event-bindings-in-angular-2-beta-6.htm
    var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata$6 = (undefined && undefined.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
            return Reflect.metadata(k, v);
    };
    var eventMap = {
        clickOutside: 'click',
        mousedownOutside: 'mousedown',
        mouseupOutside: 'mouseup',
        mousemoveOutside: 'mousemove'
    };
    /**
     * An event handler factory for event handlers that bubble the event to a given handler
     * if the event target is not an ancestor of the given element.
     * @param element
     * @param handler
     * @returns {function(any): undefined}
     */
    function bubbleNonAncestorHandlerFactory(element, handler) {
        return function (event) {
            var current = event.target;
            do {
                if (current === element) {
                    return;
                }
            } while (current.parentNode && (current = current.parentNode));
            handler(event);
        };
    }
    var DOMOutsideEventPlugin = (function () {
        function DOMOutsideEventPlugin() {
            // TODO: use DI factory for this.
            if (!document || typeof document.addEventListener !== 'function') {
                this.addEventListener = noop;
            }
        }
        DOMOutsideEventPlugin.prototype.supports = function (eventName) {
            return eventMap.hasOwnProperty(eventName);
        };
        DOMOutsideEventPlugin.prototype.addEventListener = function (element, eventName, handler) {
            var zone = this.manager.getZone();
            // A Factory that registers the event on the document, instead of the element.
            // the handler is created at runtime, and it acts as a propagation/bubble predicate, it will
            // bubble up the event (i.e: execute our original event handler) only if the event targer
            // is an ancestor of our element.
            // The event is fired inside the angular zone so change detection can kick into action.
            var onceOnOutside = function () {
                var listener = bubbleNonAncestorHandlerFactory(element, function (evt) { return zone.runGuarded(function () { return handler(evt); }); });
                // mimic BrowserDomAdapter.onAndCancel
                document.addEventListener(eventMap[eventName], listener, false);
                return function () { return document.removeEventListener(eventMap[eventName], listener, false); };
            };
            // we run the event registration for the document in a different zone, this will make sure
            // change detection is off.
            // It turns out that if a component that use DOMOutsideEventPlugin is built from a click
            // event, we might get here before the event reached the document, causing a quick false
            // positive handling (when stopPropagation() was'nt invoked). To workaround this we wait
            // for the next vm turn and register.
            // Event registration returns a dispose function for that event, angular use it to clean
            // up after component get's destroyed. Since we need to return a dispose function
            // synchronously we have to put a wrapper for it since we will get it asynchronously,
            // i.e: after we need to return it.
            //
            return zone.runOutsideAngular(function () {
                var fn;
                setTimeout(function () { return fn = onceOnOutside(); }, 0);
                return function () { return fn(); };
            });
        };
        DOMOutsideEventPlugin.prototype.addGlobalEventListener = function (target, eventName, handler) {
            throw 'not supported';
        };
        return DOMOutsideEventPlugin;
    }());
    DOMOutsideEventPlugin = __decorate$7([
        _angular_core.Injectable(),
        __metadata$6("design:paramtypes", [])
    ], DOMOutsideEventPlugin);
    var __extends$5 = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var DEFAULT_VALUES = {
        inElement: false,
        isBlocking: true,
        keyboard: [27],
        supportsKey: function supportsKey(keyCode) {
            return this.keyboard.indexOf(keyCode) > -1;
        }
    };
    var DEFAULT_SETTERS = [
        'inElement',
        'isBlocking',
        'keyboard'
    ];
    var OverlayContext = (function () {
        function OverlayContext() {
        }
        OverlayContext.prototype.normalize = function () {
            if (this.isBlocking !== false)
                this.isBlocking = true;
            if (this.keyboard === null) {
                this.keyboard = [];
            }
            else if (typeof this.keyboard === 'number') {
                this.keyboard = [this.keyboard];
            }
            else if (!Array.isArray(this.keyboard)) {
                this.keyboard = DEFAULT_VALUES.keyboard;
            }
        };
        return OverlayContext;
    }());
    /**
     * A core context builder for a modal window instance, used to define the context upon
     * a modal choose it's behaviour.
     */
    var OverlayContextBuilder = (function (_super) {
        __extends$5(OverlayContextBuilder, _super);
        function OverlayContextBuilder(defaultValues, initialSetters, baseType) {
            if (defaultValues === void 0) {
                defaultValues = undefined;
            }
            if (initialSetters === void 0) {
                initialSetters = undefined;
            }
            if (baseType === void 0) {
                baseType = undefined;
            }
            return _super.call(this, extend(DEFAULT_VALUES, defaultValues || {}), arrayUnion(DEFAULT_SETTERS, initialSetters || []), baseType || OverlayContext // https://github.com/Microsoft/TypeScript/issues/7234
            ) || this;
        }
        /**
         * Returns an new OverlayConfig with a context property representing the data in this builder.
         * @param base A base configuration that the result will extend
         * @returns OverlayConfig
         */
        OverlayContextBuilder.prototype.toOverlayConfig = function (base) {
            return extend(base || {}, {
                context: this.toJSON()
            });
        };
        return OverlayContextBuilder;
    }(FluentAssign));
    /**
     * A helper to create an `OverlayConfig` on the fly.
     * Since `OverlayConfig` requires context it means a builder is needed, this process had some boilerplate.
     * When a quick, on the fly overlay config is needed use this helper to avoid that boilerplate.
     *
     * A builder is used as an API to allow setting the context and providing some operations around the modal.
     * When a developers knows the context before hand we can skip this step, this is what this factory is for.
     *
     * @param context The context for the modal
     * @param baseContextType Optional. The type/class of the context. This is the class used to init a new instance of the context
     * @param baseConfig A base configuration that the result will extend
     * @returns {OverlayConfig}
     */
    function overlayConfigFactory(context, baseContextType, baseConfig) {
        return new OverlayContextBuilder(context, undefined, baseContextType).toOverlayConfig(baseConfig);
    }
    var __extends$6 = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var DEFAULT_VALUES$1 = {};
    var DEFAULT_SETTERS$1 = [
        'message'
    ];
    var ModalContext = (function (_super) {
        __extends$6(ModalContext, _super);
        function ModalContext() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        return ModalContext;
    }(OverlayContext));
    /**
     * A core context builder for a modal window instance, used to define the context upon
     * a modal choose it's behaviour.
     */
    var ModalContextBuilder = (function (_super) {
        __extends$6(ModalContextBuilder, _super);
        function ModalContextBuilder(defaultValues, initialSetters, baseType) {
            if (defaultValues === void 0) {
                defaultValues = undefined;
            }
            if (initialSetters === void 0) {
                initialSetters = undefined;
            }
            if (baseType === void 0) {
                baseType = undefined;
            }
            return _super.call(this, extend(DEFAULT_VALUES$1, defaultValues || {}), arrayUnion(DEFAULT_SETTERS$1, initialSetters || []), baseType) || this;
        }
        return ModalContextBuilder;
    }(OverlayContextBuilder));
    var __extends$7 = (undefined && undefined.__extends) || function (d, b) {
        for (var p in b)
            if (b.hasOwnProperty(p))
                d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    var DEFAULT_SETTERS$2 = [
        'component'
    ];
    var ModalOpenContext = (function (_super) {
        __extends$7(ModalOpenContext, _super);
        function ModalOpenContext() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        return ModalOpenContext;
    }(ModalContext));
    /**
     * A Modal Context that knows about the modal service, and so can open a modal window on demand.
     * Use the fluent API to configure the preset and then invoke the 'open' method to open a modal
     * based on the context.
     */
    var ModalOpenContextBuilder = (function (_super) {
        __extends$7(ModalOpenContextBuilder, _super);
        function ModalOpenContextBuilder(defaultValues, initialSetters, baseType) {
            if (defaultValues === void 0) {
                defaultValues = undefined;
            }
            if (initialSetters === void 0) {
                initialSetters = undefined;
            }
            if (baseType === void 0) {
                baseType = undefined;
            }
            return _super.call(this, defaultValues || {}, arrayUnion(DEFAULT_SETTERS$2, initialSetters || []), baseType) || this;
        }
        /**
         * Hook to alter config and return bindings.
         * @param config
         */
        ModalOpenContextBuilder.prototype.$$beforeOpen = function (config) {
            return [];
        };
        /**
         * Open a modal window based on the configuration of this config instance.
         * @param viewContainer If set opens the modal inside the supplied viewContainer
         * @returns Promise<DialogRef>
         */
        ModalOpenContextBuilder.prototype.open = function (viewContainer) {
            var context = this.toJSON();
            if (!(context.modal instanceof Modal)) {
                return Promise.reject(new Error('Configuration Error: modal service not set.'));
            }
            var overlayConfig = {
                context: context,
                viewContainer: viewContainer,
                bindings: typeof this.$$beforeOpen === 'function' && this.$$beforeOpen(context)
            };
            return context.modal.open(context.component, overlayConfig);
        };
        return ModalOpenContextBuilder;
    }(ModalContextBuilder));
    var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
            r = Reflect.decorate(decorators, target, key, desc);
        else
            for (var i = decorators.length - 1; i >= 0; i--)
                if (d = decorators[i])
                    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    exports.ModalModule = ModalModule_1 = (function () {
        function ModalModule() {
        }
        /**
         * Returns a ModalModule pre-loaded with a list of dynamically inserted components.
         * Since dynamic components are not analysed by the angular compiler they must register manually
         * using entryComponents, this is an easy way to do it.
         * @param entryComponents A list of dynamically inserted components (dialog's).
         * @returns {{ngModule: ModalModule, providers: {provide: OpaqueToken, useValue: Array<Type|any[]>, multi: boolean}[]}}
         */
        ModalModule.withComponents = function (entryComponents) {
            return {
                ngModule: ModalModule_1,
                providers: [
                    { provide: _angular_core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: entryComponents, multi: true }
                ]
            };
        };
        /**
         * Returns a NgModule for use in the root Module.
         * @param entryComponents A list of dynamically inserted components (dialog's).
         * @returns ModuleWithProviders
         */
        ModalModule.forRoot = function (entryComponents) {
            return {
                ngModule: ModalModule_1,
                providers: [
                    exports.Overlay,
                    { provide: OverlayRenderer, useClass: exports.DOMOverlayRenderer },
                    { provide: _angular_platformBrowser.EVENT_MANAGER_PLUGINS, useClass: DOMOutsideEventPlugin, multi: true },
                    { provide: _angular_core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: entryComponents || [], multi: true }
                ]
            };
        };
        return ModalModule;
    }());
    exports.ModalModule = ModalModule_1 = __decorate$8([
        _angular_core.NgModule({
            declarations: [
                exports.ModalOverlay,
                exports.SwapComponentDirective,
                exports.CSSBackdrop,
                exports.CSSDialogContainer,
                exports.OverlayDialogBoundary,
                exports.OverlayTarget,
                DefaultOverlayTarget
            ],
            exports: [
                exports.CSSBackdrop,
                exports.CSSDialogContainer,
                exports.SwapComponentDirective,
                exports.OverlayDialogBoundary,
                exports.OverlayTarget,
                DefaultOverlayTarget
            ],
            entryComponents: [
                exports.ModalOverlay,
                exports.CSSBackdrop,
                exports.CSSDialogContainer
            ]
        })
    ], exports.ModalModule);
    var ModalModule_1;
    exports.extend = extend;
    exports.arrayUnion = arrayUnion;
    exports.PromiseCompleter = PromiseCompleter;
    exports.createComponent = createComponent;
    exports.DialogRef = DialogRef;
    exports.OverlayRenderer = OverlayRenderer;
    exports.Modal = Modal;
    exports.overlayConfigFactory = overlayConfigFactory;
    exports.OverlayContext = OverlayContext;
    exports.OverlayContextBuilder = OverlayContextBuilder;
    exports.DEFAULT_VALUES = DEFAULT_VALUES$1;
    exports.ModalContext = ModalContext;
    exports.ModalContextBuilder = ModalContextBuilder;
    exports.ModalOpenContext = ModalOpenContext;
    exports.ModalOpenContextBuilder = ModalOpenContextBuilder;
    exports.privateKey = privateKey;
    exports.setAssignMethod = setAssignMethod;
    exports.setAssignAlias = setAssignAlias;
    exports.FluentAssignFactory = FluentAssignFactory;
    exports.FluentAssign = FluentAssign;
    exports.DialogBailOutError = DialogBailOutError;
    exports.BaseDynamicComponent = BaseDynamicComponent;
    Object.defineProperty(exports, '__esModule', { value: true });
})));


text:
'use strict';

let angular = require('angular');

module.exports = angular.module('spinnaker.core.pipeline.stage.enableAsg.gce.executionDetails.controller', [
  require('angular-ui-router'),
  require('../../../../../delivery/details/executionDetailsSection.service.js'),
  require('../../../../../delivery/details/executionDetailsSectionNav.directive.js'),
])
  .controller('gceEnableAsgExecutionDetailsCtrl', function ($scope, $stateParams, executionDetailsSectionService) {

    $scope.configSections = ['enableServerGroupConfig', 'taskStatus'];

    function initialize() {
      executionDetailsSectionService.synchronizeSection($scope.configSections);
      $scope.detailsSection = $stateParams.details;
    }

    initialize();

    $scope.$on('$stateChangeSuccess', initialize, true);

  }).name;


text:
from .classification_model import ClassificationModel

concrete_models = {  # pylint: disable=invalid-name
        'ClassificationModel': ClassificationModel,
        }