/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010-2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/**
 * @license RequireJS i18n 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/i18n for details
 */

/*******************************************************************************
 * @license
 * Copyright (c) 2012, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors: IBM Corporation - initial API and implementation
 *******************************************************************************/

/**
 * @license RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */

/*******************************************************************************
 * @license
 * Copyright (c) 2010,2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2009, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors: IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors: IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/******************************************************************************* 
 * @license
 * Copyright (c) 2013, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation 
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: 
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation
 *		Silenio Quarti (IBM Corporation) - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011,2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors:  IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: 
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation
 *		Silenio Quarti (IBM Corporation) - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: Anton McConville - IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: Anton McConville - IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2009, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Andy Clement (vmware) - bug 344614
 *******************************************************************************/

/*******************************************************************************
 * @license Copyright (c) 2013 IBM Corporation and others. All rights
 *          reserved. This program and the accompanying materials are made
 *          available under the terms of the Eclipse Public License v1.0
 *          (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse
 *          Distribution License v1.0
 *          (http://www.eclipse.org/org/documents/edl-v10.html).
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: Anton McConville - IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2009, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others. 
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013 IBM Corporation and others. 
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: 
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation
 *		Silenio Quarti (IBM Corporation) - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: 
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation
 *		Silenio Quarti (IBM Corporation) - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 */

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: 
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation
 *		Silenio Quarti (IBM Corporation) - initial API and implementation
 *		Mihai Sucan (Mozilla Foundation) - fix for Bug#334583 Bug#348471 Bug#349485 Bug#350595 Bug#360726 Bug#361180 Bug#362835 Bug#362428 Bug#362286 Bug#354270 Bug#361474 Bug#363945 Bug#366312 Bug#370584
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2009, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:  IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 * 
 * Contributors: 
 *	IBM Corporation - initial API and implementation
 *	Adrian Aichner - regular expression capture group support in replace
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/******************************************************************************* 
 * @license
 * Copyright (c) 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation 
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors: IBM Corporation - initial API and implementation
 *               Alex Lakatos - fix for bug#369781
 ******************************************************************************/

/******************************************************************************* 
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation 
 ******************************************************************************/

/******************************************************************************* 
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2009, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors: IBM Corporation - _initial API and implementation
 *******************************************************************************/

/******************************************************************************* 
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others 
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 *
 * @license
 * Copyright (c) 2010, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010-2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation
 RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/text for details

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010,2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010,2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation 

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2011,2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:  IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation
 Andy Clement (vmware) - bug 344614

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation
 Copyright (c) 2013 IBM Corporation and others. All rights
 reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse
 Distribution License v1.0
 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others. 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation
 Mihai Sucan (Mozilla Foundation) - fix for Bug#334583 Bug#348471 Bug#349485 Bug#350595 Bug#360726 Bug#361180 Bug#362835 Bug#362428 Bug#362286 Bug#354270 Bug#361474 Bug#363945 Bug#366312 Bug#370584

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (IBM Corporation) - initial API and implementation

 Copyright (c) 2010, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:  IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: Anton McConville - IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved.
 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: 
 IBM Corporation - initial API and implementation
 Adrian Aichner - regular expression capture group support in replace

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation 

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation
 Alex Lakatos - fix for bug#369781

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors: IBM Corporation - initial API and implementation
 Alex Lakatos - fix for bug#369781

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation 

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation 

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - _initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 


 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2009, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others 
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation
 RequireJS i18n 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/i18n for details

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation
*/
(function(){function i(){for(var c=navigator.userAgent,f={browser:!1,version:!1},b=[{name:"Chrome/Chromium",regExp:/(?:chrome|crios|chromium)\/(\d+)/i,minVersion:24},{name:"Firefox",regExp:/firefox\/(\d+)/i,minVersion:17},{name:"Microsoft Internet Explorer",regExp:/msie\s(\d+)/i,minVersion:10},{name:"Microsoft Internet Explorer",regExp:/Trident\/(\d+)/i,minVersion:6},{name:"Safari",regExp:/version\/(\d+).*?safari/i,minVersion:6}],h=0;h<b.length;h++){var e=b[h],d=c.match(e.regExp);if(d){f.browser=
!0;f.version=d[1]>=e.minVersion;f.name=e.name;break}}return f}function k(){try{return"localStorage"in window&&window.localStorage!==null}catch(c){return!1}}function j(c){alert(c);throw Error("unsupported browser");}var g=i();if(g.browser)g.version||j("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+g.name+".\n");else if(k()&&!localStorage.skipBrowserCheck)if(confirm("Sorry, your browser is not supported. The latest version of Chrome, Firefox or Safari web browser is recommended.\nContinue anyway?"))localStorage.skipBrowserCheck=
1;else throw"unsupported browser";else k()||j("Sorry, your browser is not supported.\n\nTo use Orion, the latest version of the Chrome, Firefox, or Safari web browser is recommended.\n");return{isSupportedBrowser:i,supportsLocalStorage:k,throwBrowserAlert:j}})();define("orion/browserCompatibility",function(){});
(function(i,k){typeof define==="function"&&define.amd?define("orion/Deferred",k):typeof exports==="object"?module.exports=k():(i.orion=i.orion||{},i.orion.Deferred=k())})(this,function(){function i(){for(var b;b=c.shift();)b();f=!1}function k(b){c.push(b);f||(f=!0,setTimeout(i,0))}function j(b){return function(){b.apply(void 0,arguments)}}function g(){function b(){for(var d;d=f.shift();){var e=d.deferred,h=m==="fulfilled"?"resolve":"reject";if(typeof d[h]==="function")try{var b=(0,d[h])(a),g=b&&(typeof b===
"object"||typeof b==="function")&&b.then;if(typeof g==="function")if(b===e.promise)e.reject(new TypeError);else{var q=b.cancel;typeof q==="function"?e._protected(c).parentCancel=q.bind(b):delete e._protected(c).parentCancel;g.call(b,j(e.resolve),j(e.reject),j(e.progress))}else e.resolve(b)}catch(l){e.reject(l)}else e[h](a)}}function h(d){delete o.parentCancel;m="rejected";a=d;f.length&&k(b)}function e(d){function c(l){return function(a){u||(u=!0,l(a))}}var u=!1;delete o.parentCancel;try{var v=d&&
(typeof d==="object"||typeof d==="function")&&d.then;if(typeof v==="function")if(d===q)h(new TypeError);else{m="assumed";var t=d&&d.cancel;if(typeof t!=="function"){var w=new g,d=w.promise;try{v(w.resolve,w.reject,w.progress)}catch(l){w.reject(l)}t=d.cancel;v=d.then}a=d;v.call(d,c(e),c(h));o.parentCancel=t.bind(d)}else m="fulfilled",a=d,f.length&&k(b)}catch(r){c(h)(r)}}function d(){var a=o.parentCancel;if(a)delete o.parentCancel,a();else if(!m)a=Error("Cancel"),a.name="Cancel",h(a)}var a,m,f=[],q=
this,o={};Object.defineProperty(this,"_protected",{value:function(a){if(a!==c)throw Error("protected");return o}});this.resolve=function(a){m||e(a);return q};this.reject=function(a){m||h(a);return q};this.progress=function(a){m||f.forEach(function(d){if(d.progress)try{d.progress(a)}catch(e){}});return q.promise};this.cancel=function(){o.parentCancel?setTimeout(d,0):d();return q};this.then=function(a,d,e){a={resolve:a,reject:d,progress:e,deferred:new g};f.push(a);a.deferred._protected(c).parentCancel=
q.promise.cancel.bind(q);(m==="fulfilled"||m==="rejected")&&k(b);return a.deferred.promise};this.promise={then:q.then,cancel:q.cancel}}var c=[],f=!1;g.all=function(b,h){function e(d,e){c||(m[d]=e,--a===0&&f.resolve(m))}function d(a,d){if(!c){if(h)try{e(a,h(d));return}catch(m){d=m}f.reject(d)}}var a=b.length,m=[],c=!1,f=new g;f.then(void 0,function(){c=!0;b.forEach(function(a){a.cancel&&a.cancel()})});a===0?f.resolve(m):b.forEach(function(a,m){a.then(e.bind(void 0,m),d.bind(void 0,m))});return f.promise};
g.when=function(b,h,e,d){var a;if(!(b&&typeof b.then==="function"))a=new g,a.resolve(b),b=a.promise;return b.then(h,e,d)};return g});
define("orion/EventTarget",[],function(){function i(){this._namedListeners={}}i.prototype={dispatchEvent:function(i){if(!i.type)throw Error("unspecified type");var j=this._namedListeners[i.type];j&&j.forEach(function(g){try{typeof g==="function"?g(i):g.handleEvent(i)}catch(c){typeof console!=="undefined"&&console.log(c)}});return!i.defaultPrevented},addEventListener:function(i,j){if(typeof j==="function"||j.handleEvent)this._namedListeners[i]=this._namedListeners[i]||[],this._namedListeners[i].push(j)},
removeEventListener:function(i,j){var g=this._namedListeners[i];if(g)for(var c=0;c<g.length;c++)if(g[c]===j){g.length===1?delete this._namedListeners[i]:g.splice(c,1);break}}};i.prototype.constructor=i;i.attach=function(k){var j=new i;k.dispatchEvent=j.dispatchEvent.bind(j);k.addEventListener=j.addEventListener.bind(j);k.removeEventListener=j.removeEventListener.bind(j)};return i});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(i,k){function j(b,e,d){this._properties=d||{};this._properties["service.id"]=b;this._properties.objectClass=e;this._properties["service.names"]=e}function g(b,e,d){this._serviceId=b;this._serviceReference=e;this._internalRegistry=d}function c(b,e){function d(a){return function(){var d;try{if(!e())throw Error("Service was unregistered");var c=b[a].apply(b,Array.prototype.slice.call(arguments));if(c&&typeof c.then==="function")return c;
else d=new i,d.resolve(c)}catch(f){d=new i,d.reject(f)}return d.promise}}for(var a in b)typeof b[a]==="function"&&(this[a]=d(a))}function f(b,e){this.type=b;this.serviceReference=e}function b(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new k;var b=this;this._internalRegistry={isRegistered:function(e){return b._entries[e]?!0:!1},unregisterService:function(e){var d=b._entries[e];if(!d)throw Error("Service has already been unregistered: "+e);var a=d.reference;b._serviceEventTarget.dispatchEvent(new f("unregistering",
a));b._entries[e]=null;a.getProperty("objectClass").forEach(function(d){for(var e=b._namedReferences[d],c=0;c<e.length;c++)if(e[c]===a){e.length===1?delete b._namedReferences[d]:e.splice(c,1);break}})},modifyService:function(e){var d=b._entries[e];if(!d)throw Error("Service not found while trying to send modified event: "+e);b._serviceEventTarget.dispatchEvent(new f("modified",d.reference))}}}j.prototype={getPropertyKeys:function(){var b=[],e;for(e in this._properties)this._properties.hasOwnProperty(e)&&
b.push(e);return b},getProperty:function(b){return this._properties[b]}};j.prototype.constructor=j;g.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(b){var e=this._serviceReference._properties;this._serviceReference._properties=b||{};b["service.id"]=this._serviceId;
b.objectClass=e.objectClass;b["service.names"]=e["service.names"];this._internalRegistry.modifyService(this._serviceId)}};g.prototype.constructor=g;b.prototype={getService:function(b){var e;if(typeof b==="string")(b=this._namedReferences[b])&&b.some(function(d){e=this._entries[d.getProperty("service.id")].service;return!!e},this);else if(b=this._entries[b.getProperty("service.id")])e=b.service;return e||null},getServiceReferences:function(b){if(b)return this._namedReferences[b]?this._namedReferences[b]:
[];var e=[];this._entries.forEach(function(d){d&&e.push(d.reference)});return e},registerService:function(b,e,d){if(typeof e==="undefined"||e===null)throw Error("invalid service");typeof b==="string"?b=[b]:Array.isArray(b)||(b=[]);var a=this._entries.length,m=new j(a,b,d),n=this._namedReferences;b.forEach(function(a){n[a]=n[a]||[];n[a].push(m)});b=new c(e,this._internalRegistry.isRegistered.bind(null,a));this._entries.push({reference:m,service:b});b=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new f("registered",
m));return new g(a,m,b)},addEventListener:function(b,e){this._serviceEventTarget.addEventListener(b,e)},removeEventListener:function(b,e){this._serviceEventTarget.removeEventListener(b,e)}};b.prototype.constructor=b;return{ServiceRegistry:b}});
define("orion/xhr",["orion/Deferred"],function(i){function k(j,g,c,f){var b=typeof c.response!=="undefined"?c.response:c.responseText,h;try{h=c.status}catch(e){h=0}j={args:g,response:b,responseText:typeof b==="string"?b:null,status:h,url:j,xhr:c};if(typeof f!=="undefined")j.error=f;return j}return function(j,g,c){var c=c||{},f=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,b=new i,h=c.headers||{},e=c.log||!1,d;typeof h["X-Requested-With"]==="undefined"&&(h["X-Requested-With"]="XMLHttpRequest");
if(typeof c.data!=="undefined"&&(j==="POST"||j==="PUT"))d=c.data;var a=!1,m=!1;b.promise.then(void 0,function(d){a=!0;!m&&d instanceof Error&&d.name==="Cancel"&&f.abort()});f.onabort=function(){m=!0;if(!a){var d=Error("Cancel");d.name="Cancel";b.reject(d)}};f.onload=function(){var a=k(g,c,f);200<=f.status&&f.status<400?b.resolve(a):(b.reject(a),e&&typeof console!=="undefined"&&console.log(Error(f.statusText)))};f.onerror=function(){var a=k(g,c,f);b.reject(a);e&&typeof console!=="undefined"&&console.log(Error(f.statusText))};
f.onprogress=function(a){a.xhr=f;b.progress(a)};try{f.open(j,g,!0);if(typeof c.responseType==="string")f.responseType=c.responseType;if(typeof c.timeout==="number")if(typeof f.timeout==="number")f.timeout=c.timeout,f.addEventListener("timeout",function(){b.reject(k(g,c,f,"Timeout exceeded"))});else{var n=setTimeout(function(){b.reject(k(g,c,f,"Timeout exceeded"))},c.timeout);b.promise.then(clearTimeout.bind(null,n),clearTimeout.bind(null,n))}Object.keys(h).forEach(function(a){f.setRequestHeader(a,
h[a])});f.send(d||null)}catch(q){b.reject(k(g,c,f,q))}return b.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(i,k,j){function g(d,a){this._name=d;this._providers=a;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function c(d,a){return{get:function(e,b){if(a===0)return null;var h=localStorage.getItem(d+e);if(h===null)return null;h=JSON.parse(h);return b||a===-1||h._expires&&h._expires>(new Date).getTime()?(delete h._expires,h):null},set:function(e,b){if(a!==0){if(a!==-1)b._expires=(new Date).getTime()+
1E3*a;if(Object.keys(b).length===0)localStorage.removeItem(d+e);else{var h=JSON.stringify(b);localStorage.setItem(d+e,h);delete b._expires}}},remove:function(a){localStorage.removeItem(d+a)}}}function f(d){this._currentPromises={};this._cache=new c("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var a=d.getServiceReferences("orion.core.preference.provider");if(a.length>0)this._service=d.getService(a[0])}return!!this._service}}function b(d){this._location=
d;this._currentPromise=null;this._cache=new c("/orion/preferences/default",3600)}function h(){this._cache=new c("/orion/preferences/local",-1)}function e(d,a){this._userProvider=new f(d);this._localProvider=new h;a=a||"defaults.pref";a.indexOf("://")===-1&&(a=i.toUrl(a));this._defaultsProvider=new b(a);this._serviceRegistration=d.registerService("orion.core.preference",this)}g.prototype={_flush:function(){for(var d=[],a=0;a<this._stores.length;++a){var e=this._stores[a];this._dirty.indexOf(e)!==-1&&
d.push(this._providers[a].put(this._name,e));if(this._pendingDeletes[a]&&this._pendingDeletes[a].length>0){for(e=0;e<this._pendingDeletes[a].length;e++)d.push(this._providers[a].remove(this._name,this._pendingDeletes[a][e]));delete this._pendingDeletes[a]}}this._dirty=[];return k.all(d)},_scheduleFlush:function(d){d&&this._dirty.indexOf(d)===-1&&this._dirty.push(d);if(!this._flushPending)this._flushPending=!0,window.setTimeout(function(){if(this._flushPending)this._flushPending=!1,this._flush()}.bind(this),
0)},_getCached:function(){if(!this._cached){this._cached={};for(var d=0;d<this._stores.length;++d){var a=this._stores[d],e;for(e in a)a.hasOwnProperty(e)&&typeof this._cached[e]==="undefined"&&(this._cached[e]=a[e])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(d){return this._getCached()[d]},put:function(d,a){if(this._stores.length!==0){var e=this._stores[0];if(e[d]!==a)e[d]=a,this._cached=null,this._scheduleFlush(e)}},remove:function(d){for(var a=0;a<
this._stores.length;++a){var e=this._stores[a];if(e.hasOwnProperty(d))return delete e[d],this._pendingDeletes[a]||(this._pendingDeletes[a]=[]),this._pendingDeletes[a].push(d),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var d=0;d<this._stores.length;++d)this._stores[d]={},this._scheduleFlush(this._stores[d]);this._cached=null},sync:function(d){if(this._flushPending)return this._flushPending=!1,this._flush();for(var a=this,e=[],b=0;b<this._providers.length;++b)e.push(this._providers[b].get(this._name,
d).then(function(d){return function(e){a._stores[d]=e}}(b)));return k.all(e).then(function(){a._cached=null;a._getCached()})},flush:function(){this._flush()}};f.prototype={get:function(d,a){if(this._currentPromises[d])return this._currentPromises[d];var e=new k,b=null;a?this._cache.remove(d):b=this._cache.get(d);if(b!==null)e.resolve(b);else{this._currentPromises[d]=e;var h=this;this._service.get(d).then(function(a){h._cache.set(d,a);delete h._currentPromises[d];e.resolve(a)},function(a){a.status===
404?(a={},h._cache.set(d,a),delete h._currentPromises[d],e.resolve(a)):(delete h._currentPromises[d],e.resolve(h._cache.get(d,!0)||{}))})}return e},put:function(d,a){this._cache.set(d,a);return this._service.put(d,a)},remove:function(d,a){var e=this._cache.get(d);delete e[a];this._cache.set(d,e);return this._service.remove(d,a)}};b.prototype={get:function(d,a){if(this._currentPromise)return this._currentPromise;var e=new k,b=null;a?this._cache.remove(d):b=this._cache.get(d);if(b!==null)e.resolve(b);
else{this._currentPromise=e;var h=this;j("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=JSON.parse(a.response);h._cache.set(d,a[d]||{});h._currentPromise=null;e.resolve(a[d]||{})},function(a){a.xhr.status===401||a.xhr.status===404?(h._cache.set(d,{}),h._currentPromise=null,e.resolve({})):(h._currentPromise=null,a=h._cache.get(d,!0),a!==null?e.resolve(a[d]||{}):e.resolve({}))})}return e},put:function(){var d=new k;d.resolve();return d},remove:function(d,a){var e=
this._cache.get(d);delete e[a];this.put(d,e)}};h.prototype={get:function(d){var a=new k,d=this._cache.get(d);d!==null?a.resolve(d):a.resolve({});return a},put:function(d,a){var e=new k;this._cache.set(d,a);e.resolve();return e},remove:function(d,a){var e=this._cache.get(d);delete e[a];this.put(d,e)}};e.DEFAULT_SCOPE=1;e.LOCAL_SCOPE=2;e.USER_SCOPE=4;e.prototype={listenForChangedSettings:function(d,a,b){if(!a||typeof a!=="number"||a>7||a<1)b=a,a=e.DEFAULT_SCOPE|e.LOCAL_SCOPE|e.USER_SCOPE;window.addEventListener("storage",
b,!1);if((e.USER_SCOPE&a)!==0)return"/orion/preferences/user"+d;else if((e.LOCAL_SCOPE&a)!==0)return"/orion/preferences/local"+d;return"/orion/preferences/default"+d},getPreferences:function(d,a){if(!a||typeof a!=="number"||a>7||a<1)a=e.DEFAULT_SCOPE|e.LOCAL_SCOPE|e.USER_SCOPE;var b=[];e.USER_SCOPE&a&&this._userProvider.available()&&b.push(this._userProvider);e.LOCAL_SCOPE&a&&b.push(this._localProvider);e.DEFAULT_SCOPE&a&&b.push(this._defaultsProvider);var h=new g(d,b);return h.sync().then(function(){return h})},
getSetting:function(d,a,e){for(var b,h=0;h<d.length;h++)if(d[h].label===a)for(var c=0;c<d[h].data.length;c++)if(d[h].data[c].label===e){b=d[h].data[c].value;break}return b}};return{PreferencesService:e}});
(function(){function i(a){if(typeof a!=="string")throw new TypeError;}function k(a){return a?a.split("&"):[]}function j(a){return a.length===0?"":a.join("&")}function g(a){var l=/([^=]*)(?:=?)(.*)/.exec(a),a=l[1]?decodeURIComponent(l[1]):"",l=l[2]?decodeURIComponent(l[2]):"";return[a,l]}function c(a){var l=encodeURIComponent(a[0]);a[1]&&(l+="="+encodeURIComponent(a[1]));return l}function f(a,l){var d="",e=[],b=0;return{next:function(){if(d!==a.query)d=a.query,e=k(d);if(b<e.length){var r=g(e[b++]);
switch(l){case "keys":return r[0];case "values":return r[1];case "keys+values":return[r[0],r[1]];default:throw new TypeError;}}throw x;}}}function b(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function h(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function e(a){var l=[];a.split("/").forEach(function(a){a===".."?l.pop():a!=="."&&l.push(a)});return l.join("/")}function d(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function a(a,l){if(typeof a!==
"string")throw new TypeError;var a=d(a),b=o.exec(a);if(!b)return null;var r={};r.scheme=b[1]||"";if(r.scheme&&!s.test(r.scheme))return null;var m=b[2];if(m&&(m=p.exec(m),r.userinfo=m[1],r.host=m[2],r.port=m[3],r.port&&!u.test(r.port)))return null;r.path=b[3];r.query=b[4];r.fragment=b[5];if(!r.scheme&&l&&(r.scheme=l.scheme,!r.host&&l.host))r.userinfo=l.userinfo,r.host=l.host,r.port=l.port,r.pathRelative=!0;if(r.pathRelative)if(r.path){if(r.path[0]!=="/")b=/^(.*\/)[^\/]*$/.exec(l.path)[1]||"/",r.path=
b+r.path}else r.path=l.path;if(r.scheme)r.scheme=r.scheme.toLowerCase();if(r.port)r.port=h(r.port);if(r.host&&r.path)r.path=e(r.path);return r}function m(l,d){var e;if(d){d=d.href||d;e=a(d);if(!e||!e.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:e})}e=a(l,e);if(!e)throw new SyntaxError;Object.defineProperty(this,"_input",{value:l,writable:!0});Object.defineProperty(this,"_url",{value:e,writable:!0});var r=new b(this);Object.defineProperty(this,"query",{get:function(){return this._url?
r:null},enumerable:!0})}try{var n;if(typeof window.URL==="function"&&window.URL.length!==0&&(n=new window.URL("http://www.w3.org?q")).protocol==="http:"&&n.query)return}catch(q){}var o=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,p=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,s=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,u=/^\d*$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,t=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,w=/^([^?#\s]*)$/,l=/^([^\s]*)$/,r=/^\S*$/,y=/([^:]*):?(.*)/,x=typeof StopIteration!==
"undefined"?StopIteration:Error("Stop Iteration"),z={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(b.prototype,{get:{value:function(a){i(a);var l;k(this._url.query).some(function(d){d=g(d);if(d[0]===a)return l=d[1],!0});return l},enumerable:!0},set:{value:function(a,l){i(a);i(l);var d=k(this._url.query);d.some(function(e,b){var r=g(e);if(r[0]===a)return r[1]=l,d[b]=c(r),!0})||d.push(c([a,l]));this._url.query=j(d)},enumerable:!0},has:{value:function(a){i(a);
return k(this._url.query).some(function(l){if(g(l)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){i(a);var l=k(this._url.query),d=l.filter(function(l){return g(l)[0]!==a});return d.length!==l.length?(this._url.query=j(d),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,l){if(typeof a!=="function")throw new TypeError;var d=f(this._url,"keys+values");try{for(;;){var e=d.next();a.call(l,e[1],e[0],this)}}catch(b){if(b!==x)throw b;
}},enumerable:!0},keys:{value:function(){return f(this._url,"keys")},enumerable:!0},values:{value:function(){return f(this._url,"values")},enumerable:!0},items:{value:function(){return f(this._url,"keys+values")}},size:{get:function(){return k(this._url.query).length},enumerable:!0},getAll:{value:function(a){i(a);var l=[];k(this._url.query).forEach(function(d){d=g(d);d[0]===a&&l.push(d[1])});return l},enumerable:!0},append:{value:function(a,l){i(a);i(l);var d=k(this._url.query);d.push(c([a,l]));this._url.query=
j(d)},enumerable:!0}});Object.defineProperties(m.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var l=a.scheme?a.scheme+":":"";a.host&&(l+="//",a.userinfo&&(l+=a.userinfo+"@"),l+=a.host,a.port&&(l+=":"+a.port));l+=a.path;a.query&&(l+="?"+a.query);a.fragment&&(l+="#"+a.fragment);a=l}else a=this._input;return a},set:function(l){i(l);this._input=l;this._url=a(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){i(a);if(this._url&&(a=a.slice(-1)===":"?a.substring(0,a.length-1):a,a===""||s.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){i(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){i(a);if(this._url){var l=
y.exec(this._userinfo),a=[encodeURIComponent(a||"")];l[2]&&a.push(l[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){i(a);if(this._url){var l=[y.exec(this._userinfo)[1]||""];a&&l.push(encodeURIComponent(a));this._userinfo=l.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){i(a);if(this._url&&(a=t.exec(a)))this._url.host=a[1],this._url.port=h(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){i(a);if(this._url&&v.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===z[this.protocol]&&(a="");return a},set:function(a){i(a);if(this._url&&u.exec(a))this._url.port=h(a)},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){i(a);
if(this._url&&w.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?e(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){i(a);if(this._url&&(a&&a[0]==="?"&&(a=a.substring(1)),l.exec(a)))this._url.query=a},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){i(a);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),r.exec(a)))this._url.fragment=a},enumerable:!0}});
if((n=window.URL||window.webkitURL)&&n.createObjectURL)Object.defineProperty(m,"createObjectURL",{value:n.createObjectURL.bind(n),enumerable:!1}),Object.defineProperty(m,"revokeObjectURL",{value:n.revokeObjectURL.bind(n),enumerable:!1});window.URL=m})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(i,k){function j(a,d){var e=Object.keys(a),b=Object.keys(d);if(e.length!==b.length)return!1;e.sort();b.sort();for(var h=0,c=e.length;h<c;h++){var f=e[h];if(f!==b[h])return!1;var g=a[f],f=d[f];if(g!==f&&JSON.stringify(g)!==JSON.stringify(f))return!1}return!0}function g(a){if(a.indexOf("://")===-1)try{return(new URL(a,location.href)).href}catch(d){}return a}function c(a){var d=null,e={key:function(e){return(d=
d||Object.keys(a))[e]},getItem:function(d){return a[d]},setItem:function(e,b){a[e]=b;d=null},removeItem:function(e){delete a[e];d=null},clear:function(){(d=d||Object.keys(a)).forEach(function(d){delete a[d]}.bind(this));d=null}};Object.defineProperty(e,"length",{get:function(){return(d=d||Object.keys(a)).length}});return e}function f(a,d){if(d&&d instanceof XMLHttpRequest){var e,b;try{e=d.status,b=d.statusText}catch(h){e=0,b=""}return{status:e||0,statusText:b}}return d}function b(a){var d=a?JSON.parse(JSON.stringify(a,
f)):a;if(a instanceof Error)d.__isError=!0,d.message=d.message||a.message,d.name=d.name||a.name;return d}function h(a,d){this.type=a;this.plugin=d}function e(a,d){this.__objectId=a;this.__methods=d}function d(a,d,c){function f(a){J&&c.postMessage(a,J)}function g(a){if(!J)return(new i).reject(Error("plugin not connected"));a.id=String(R++);var l=new i;W[a.id]=l;l.then(null,function(l){D==="active"&&l instanceof Error&&l.name==="Cancel"&&f({requestId:a.id,method:"cancel",params:l.message?[l.message]:
[]})});var d=Object.prototype.toString;a.params.forEach(function(b,r){if(d.call(b)==="[object Object]"&&!(b instanceof e)){var h,c;for(h in b)d.call(b[h])==="[object Function]"&&(c=c||[],c.push(h));if(c){var m=N++;T[m]=b;h=function(){delete T[m]};l.then(h,h);a.params[r]=new e(m,c)}}});c.postMessage(a,J);return l.promise}function s(a,l){a||a===0?f({id:a,result:null,error:l}):console.log(l)}function u(a,l,d,e){e.forEach(function(a,l){if(a&&typeof a.__objectId!=="undefined"){var d={};a.__methods.forEach(function(l){d[l]=
function(){return g({objectId:a.__objectId,method:l,params:Array.prototype.slice.call(arguments)})}});e[l]=d}});var r=typeof a===void 0?null:{id:a,result:null,error:null};try{var h=d.apply(l,e);if(r)h&&typeof h.then==="function"?(P[a]=h,h.then(function(l){delete P[a];r.result=l;f(r)},function(l){if(P[a])delete P[a],r.error=b(l),f(r)},function(){f({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(r.result=h,f(r))}catch(c){if(r)r.error=b(c),f(r)}}function v(a){try{if(a.method){var l=
a.method,d=a.params||[];if("serviceId"in a){var e=I[a.serviceId];e||s(a.id,"service not found");l in e?u(a.id,e,e[l],d):s(a.id,"method not found")}else if("objectId"in a){var b=T[a.objectId];b||s(a.id,"object not found");l in b?u(a.id,b,b[l],d):s(a.id,"method not found")}else if("requestId"in a){var r=P[a.requestId];r&&l==="cancel"&&r.cancel&&r.cancel.apply(r,d)}else if("responseId"in a){var h=W[a.responseId];h&&l==="progress"&&h.progress&&h.progress.apply(h,d)}else if("plugin"===a.method){var m=
a.params[0];F({headers:m.headers,services:m.services}).then(function(){H&&H.resolve(y)})}else if("timeout"===a.method)H&&H.reject(a.error);else throw Error("Bad method: "+a.method);}else{var f=W[String(a.id)];delete W[String(a.id)];if(a.error){var n=c.handleServiceError(y,a.error);f.reject(n)}else f.resolve(a.result)}}catch(g){console.log("Plugin._messageHandler "+g)}}function t(a){var l={};if(a.methods&&(a.methods.forEach(function(d){l[d]=function(){var l={serviceId:a.serviceId,method:d,params:Array.prototype.slice.call(arguments)};
return D==="active"?g(l):y.start({"transient":!0}).then(function(){return g(l)})}}),l.addEventListener&&l.removeEventListener)){var d=new k,b=N++;T[b]={handleEvent:d.dispatchEvent.bind(d)};var r=new e(b,["handleEvent"]),h=l.addEventListener;l.addEventListener=function(a,l){d._namedListeners[a]||h(a,r);d.addEventListener(a,l)};var c=l.removeEventListener;l.removeEventListener=function(a,l){d.removeEventListener(a,l);d._namedListeners[a]||c(a,r)}}return l}function w(l){var d=JSON.parse(JSON.stringify(l.properties));
d.__plugin__=a;l=l.names||l.type||[];Array.isArray(l)||(l=[l]);d.objectClass=l;return d}function l(a){var l=t(a),d=w(a),d=c.registerService(a.names||a.type,l,d);K[a.serviceId]={registration:d,proxy:l}}function r(){c.persist(a,{created:x,headers:z,services:E,autostart:B,lastModified:G})}var y=this,d=d||{},x=d.created||(new Date).getTime(),z=d.headers||{},E=d.services||[],B=d.autostart,G=d.lastModified||0,D="installed",M,H,J,U,K={},R=0,N=0,P={},W={},T={},I={},F;this._persist=r;this._resolve=function(){D=
"resolved";c.dispatchEvent(new h("resolved",y))};this._getAutostart=function(){return B};this._getCreated=function(){return x};this.getLocation=function(){return a};this.getHeaders=function(){return JSON.parse(JSON.stringify(z))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return G};this.getServiceReferences=function(){var a=[];Object.keys(K).forEach(function(l){a.push(K[l].registration.getReference())});
return a};this.setParent=function(a){return U!==a?(U=a,y.stop({"transient":!0}).then(function(){if("started"===B)return y.start({"transient":!0});else if("lazy"===B)return y.start({lazy:!0,"transient":!0})})):(new i).resolve()};this.getState=function(){return D};this.start=function(d){if(D==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(M)return M.promise.then(this.start.bind(this,d));if(D==="active")return(new i).resolve();if(!d||!d.transient){var e=d&&d.lazy?"lazy":"started";
e!==B&&(B=e,r())}e=c.getState();if(e!=="starting"&&e!=="active")return d.transient?(new i).reject(Error("start transient error")):(new i).resolve();if(D==="installed")try{this._resolve()}catch(b){return(new i).reject(b)}D==="resolved"&&E.forEach(function(a){l(a)});if(d&&d.lazy)return D!=="starting"&&(D="starting",c.dispatchEvent(new h("lazy activation",y))),(new i).resolve();var f=new i;M=f;D="starting";c.dispatchEvent(new h("starting",y));H=new i;J=c.connect(a,v,U);H.then(function(){H=null;D="active";
c.dispatchEvent(new h("started",y));M=null;f.resolve()},function(){H=null;D="stopping";c.dispatchEvent(new h("stopping",y));Object.keys(K).forEach(function(a){K[a].registration.unregister();delete K[a]});c.disconnect(J);J=null;D="resolved";M=null;c.dispatchEvent(new h("stopped",y));f.reject(Error("plugin activation error"))});return f.promise};this.stop=function(a){if(D==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(M)return M.promise.then(this.stop.bind(this,a));if((!a||
!a.transient)&&"stopped"!==B)B="stopped",r();if(D!=="active"&&D!=="starting")return(new i).resolve();M=a=new i;D="stopping";c.dispatchEvent(new h("stopping",y));Object.keys(K).forEach(function(a){K[a].registration.unregister();delete K[a]});J&&(c.disconnect(J),J=null);D="resolved";M=null;c.dispatchEvent(new h("stopped",y));a.resolve();return a.promise};F=function(d){if(D==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(!d)return G===0&&(G=(new Date).getTime(),r()),c.loadManifest(a).then(F);
var e=z,b=E,f=B;z=d.headers||{};E=d.services||{};B=d.autostart||B;d.lastModified?G=d.lastModified:(G=(new Date).getTime(),r());if(j(z,e)&&j(E,b)&&B===f)return(new i).resolve();if(D==="active"||D==="starting"){var n=[];Object.keys(E).forEach(function(a){var d=E[a];n.push(a);var e=K[a];if(e){if(j(d.methods,Object.keys(e.proxy))){var a=w(d),b=e.registration.getReference(),r={};b.getPropertyKeys().forEach(function(a){r[a]=b.getProperty(a)});j(a,r)||e.registration.setProperties(a);return}e.registration.unregister();
delete K[a]}l(d)});Object.keys(K).forEach(function(a){n.indexOf(a)===-1&&(K[a].registration.unregister(),delete K[a])})}D==="active"&&(c.disconnect(J),H=new i,J=c.connect(a,v,U),H.then(function(){H=null},function(){H=null;D="stopping";c.dispatchEvent(new h("stopping"),y);Object.keys(K).forEach(function(a){K[a].registration.unregister();delete K[a]});c.disconnect(J);J=null;D="resolved";c.dispatchEvent(new h("stopped",y))}));return(new i).resolve()};this.update=function(a){return F(a).then(function(){c.dispatchEvent(new h("updated",
y))})};this.uninstall=function(){if(D==="uninstalled")return(new i).reject(Error("Plugin is uninstalled"));if(D==="active"||D==="starting"||D==="stopping")return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));c.removePlugin(this);D="uninstalled";c.dispatchEvent(new h("uninstalled",y));return(new i).resolve()}}var a=/^http[s]?/i;return{Plugin:d,PluginRegistry:function(e,b){function f(a){var l=a.source;v.some(function(d){if(l===d.target){try{var e;if(typeof d.useStructuredClone===
"undefined"){var b=typeof a.data!=="string";e=b?a.data:JSON.parse(a.data);d.useStructuredClone=b}else e=d.useStructuredClone?a.data:JSON.parse(a.data);d.handler(e)}catch(h){}return!0}})}var b=b||{},o=b.storage||localStorage;o.getItem||(o=c(o));var p="installed",s,j=[],v=[],t=new k,w={},l={registerService:e.registerService.bind(e),connect:function(a,l,d,e){function b(a){a=Error(a);a.name="timeout";l({method:"timeout",error:a})}var h={handler:l,url:a},c=setTimeout(b.bind(null,"Load timeout for: "+a),
e||15E3),m=document.createElement("iframe");m.name=a+"_"+(new Date).getTime();m.src=a;m.onload=function(){clearTimeout(c);c=setTimeout(b.bind(null,"Plugin handshake timeout for: "+a),5E3)};m.sandbox="allow-scripts allow-same-origin";m.style.width=m.style.height="100%";m.frameBorder=0;(d||s).appendChild(m);h.target=m.contentWindow;h.close=function(){clearTimeout(c);if(m){var a=m.parentNode;a&&a.removeChild(m);m=null}};v.push(h);return h},disconnect:function(a){for(var l=0;l<v.length;l++)if(a===v[l]){v.splice(l,
1);try{a.close()}catch(d){}break}},removePlugin:function(a){for(var l=0;l<j.length;l++)if(a===j[l]){j.splice(l,1);break}o.removeItem("plugin."+a.getLocation())},persist:function(a,l){o.setItem("plugin."+a,JSON.stringify(l))},postMessage:function(a,l){l.target.postMessage(l.useStructuredClone?a:JSON.stringify(a),l.url)},dispatchEvent:function(a){try{t.dispatchEvent(a)}catch(l){console&&console.log("PluginRegistry.dispatchEvent "+l)}},loadManifest:function(a){var d=new i,e=l.connect(a,function(a){e&&
a.method&&("manifest"===a.method||"plugin"===a.method?(a=a.params[0],l.disconnect(e),e=null,d.resolve(a)):"timeout"===a.method&&(l.disconnect(e),e=null,d.reject(a.error)))});return d.promise},getState:function(){return p},handleServiceError:function(l,d){if(d&&d.status===401){var e=l.getHeaders(),b=l.getName()||l.getLocation(),h=document.createElement("span");h.appendChild(document.createTextNode("Authentication required for: "+b+"."));if(e.login)h.appendChild(document.createTextNode(" ")),b=document.createElement("a"),
b.target="_blank",b.textContent="Login",b.href=e.login,a.test(b.href)?(h.appendChild(b),h.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+e.login);return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(h)}}if(d.__isError){var c=d,d=Error(c.message);Object.keys(c).forEach(function(a){d[a]=c[a]});delete d.__isError}return d}};this.getLocation=function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};
this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=l.getState;this.init=function(){if(!(p==="starting"||p==="active"||p==="stopping")){addEventListener("message",f,!1);for(var a=[],e=0,h=o.length;e<h;e++)a.push(o.key(e));a.forEach(function(a){if(a.indexOf("plugin.")===0){var e=a.substring(7),a=JSON.parse(o.getItem(a));a.created&&j.push(new d(e,a,l))}});j.sort(function(a,l){return a._getCreated()<l._getCreated()?-1:1});if(b.parent)s=b.parent;else{s=document.createElement("div");
if(!b.visible)s.style.display="none",s.style.visibility="hidden";document.body.appendChild(s)}b.plugins&&Object.keys(b.plugins).forEach(function(a){a=g(a);if(!this.getPlugin(a)){var e=b.plugins[a];typeof e!=="object"&&(e={});e.autostart=e.autostart||b.defaultAutostart||"lazy";j.push(new d(a,e,l))}}.bind(this));p="starting"}};this.start=function(){p!=="starting"&&this.init();if(p!=="starting")return(new i).reject("Cannot start framework. Framework is already "+p+".");var a=[],l=(new Date).getTime();
j.forEach(function(d){var e=d._getAutostart();d.getLastModified()===0?a.push(d.update().then(function(){if("started"===e)return d.start({"transient":!0});if("lazy"===e)return d.start({lazy:!0,"transient":!0});d._resolve()})):"started"===e?a.push(d.start({"transient":!0})):"lazy"===e?(a.push(d.start({lazy:!0,"transient":!0})),l>d.getLastModified()+864E5&&d.update()):d._resolve()});return i.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){p="active"})};this.stop=function(){if(p!==
"starting"&&p!=="active")return(new i).reject("Cannot stop registry. Registry is already "+p+".");p="stopping";var a=[];j.forEach(function(l){a.push(l.stop({"transient":!0}))});return i.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){if(!b.parent){var a=s.parentNode;a&&a.removeChild(s)}s=null;removeEventListener("message",f);p="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new i).reject("Cannot uninstall registry")};
this.installPlugin=function(a,e){var a=g(a),b=this.getPlugin(a);if(b)return(new i).resolve(b);if(w[a])return w[a];if(e)return b=new d(a,e,l),j.push(b),b._persist(),l.dispatchEvent(new h("installed",b)),(new i).resolve(b);var c=l.loadManifest(a).then(function(e){b=new d(a,e,l);j.push(b);b._persist();delete w[a];l.dispatchEvent(new h("installed",b));return b},function(l){delete w[a];throw l;});return w[a]=c};this.getPlugins=function(){return j.slice()};this.getPlugin=function(a){var l=null,a=g(a);j.some(function(d){if(a===
d.getLocation())return l=d,!0});return l};this.addEventListener=t.addEventListener.bind(t);this.removeEventListener=t.removeEventListener.bind(t);this.resolvePlugins=function(){var a=!0;j.forEach(function(l){a=a&&l._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function i(g,c){function f(a){var d=a.getProperty("service.id"),b=this.addingService(a);b&&(h[d]=a,e[d]=b)}function b(a){var d=a.getProperty("service.id"),b=e[d];delete h[d];delete e[d];this.removedService(a,b)}this.serviceRegistry=g;var h={},e={},d=k,a,m;this.close=function(){if(d!==j)throw"Already closed";d=k;g.removeEventListener("registered",a);g.removeEventListener("unregistering",m);m=a=null;var e=this;this.getServiceReferences().forEach(function(a){b.call(e,
a)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){var a=Object.keys(h);return!a.length?null:a.map(function(a){return h[a]})};this.open=function(){if(d!==k)throw"Already open";d=j;var e=this;a=function(a){if(a.serviceReference.getProperty("objectClass").indexOf(c)!==-1&&(f.call(e,a.serviceReference),typeof e.onServiceAdded==="function"))return e.onServiceAdded(a.serviceReference,e.serviceRegistry.getService(a.serviceReference))};m=function(a){a.serviceReference.getProperty("objectClass").indexOf(c)!==
-1&&b.call(e,a.serviceReference)};g.addEventListener("registered",a);g.addEventListener("unregistering",m);g.getServiceReferences(c).forEach(function(a){f.call(e,a);if(typeof e.onServiceAdded==="function")return e.onServiceAdded(a,g.getService(a))});if(typeof this.onOpen==="function")this.onOpen()}}var k=0,j=1;i.prototype={addingService:function(g){return this.serviceRegistry.getService(g)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return i});
define("orion/objects",[],function(){function i(i){for(var j=1;j<arguments.length;j++){var g=arguments[j],c;for(c in g)Object.prototype.hasOwnProperty.call(g,c)&&(i[c]=g[c])}return i}return{clone:function(k){if(Array.isArray(k))return Array.prototype.slice.call(k);var j=Object.create(Object.getPrototypeOf(k));i(j,k);return j},mixin:i,toArray:function(i){return Array.isArray(i)?i:[i]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(i,k,j){var g,c,f,b,h,e="pid";g=function(a,d,b){function h(a,e,b){e.forEach(function(h,l){try{var r=a[l].getProperty("__plugin__"),c=r&&d.getPlugin(r);(!r||c&&c.getState()==="active")&&e[l].updated(b)}catch(f){typeof console!=="undefined"&&console.log(f)}})}k.call(this,a,"orion.cm.managedservice");var c={},f={},g=function(d){var h=[];d.plugin.getServiceReferences().forEach(function(d){if(d.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var c=d.getProperty(e),d=a.getService(d);c&&d&&(c=(c=b._find(c))&&c.getProperties(),h.push(d.updated(c)))}});return i.all(h)};this.addingService=function(d){var b=d.getProperty(e),h=a.getService(d);if(!b||!h)return null;c[b]||(c[b]=[]);f[b]||(f[b]=[]);c[b].push(d);f[b].push(h);return h};this.onServiceAdded=function(a,d){var c=a.getProperty(e),c=b._find(c);h([a],[d],c&&c.getProperties())};this.onOpen=function(){d.addEventListener("started",g)};this.onClose=function(){d.removeEventListener("started",
g)};this.notifyUpdated=function(a){var d=a.getPid();h(c[d]||[],f[d]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();h(c[a]||[],f[a]||[],null)};this.removedService=function(a,d){var b=a.getProperty(e),h=c[b],l=f[b];h.length>1?h.splice(h.indexOf(a),1):delete c[b];l.length>1?l.splice(l.indexOf(d),1):delete f[b]}};c=function(){function a(a,d,e){this.store=new f(this,e);this.configAdmin=new b(this,this.store);this.tracker=new g(a,d,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(d){a.tracker.open();return d})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();b=function(){function a(a,d){this.factory=a;this.store=d}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var d="/cm/configurations";
f=function(){function a(a,b){this.factory=a;this.prefsService=b;this.configs=Object.create(null);this.pref=null;var c=this;this.initPromise=this.prefsService.getPreferences(d).then(function(a){c.pref=a;a.keys().forEach(function(d){if(!c.configs[d]){var b=a.get(d);typeof b==="object"&&b!==null&&Object.keys(b).length>0&&(b[e]=d,c.configs[d]=new h(c.factory,c,b))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var d=this._find(a);
d||(d=new h(this.factory,this,a),this.configs[a]=d);return d},list:function(){var a=this,d=[];this.pref.keys().forEach(function(e){(e=a._find(e))&&e.getProperties()!==null&&d.push(e)});return d},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,d){this.pref.put(a,d.getProperties(!0)||{})}};return a}();h=function(){function a(a,d){d=j.clone(d);delete d[e];a.properties=d}function d(b,h,c){this.factory=b;this.store=h;if(c!==null&&typeof c==="object")this.pid=c[e],a(this,
c);else if(typeof c==="string")this.pid=c,this.properties=null;else throw Error("Invalid pid/properties "+c);}d.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var d=null;if(this.properties&&(d=j.clone(this.properties),!a))d[e]=this.pid;return d},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(d){this._checkRemoved();a(this,d);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return d}();return{ConfigurationAdminFactory:c}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(i,k,j,g,c,f){var b;return{startup:function(){if(b)return b;b=new k;var h=new j.ServiceRegistry,e=new g.PreferencesService(h);return e.getPreferences("/plugins").then(function(d){var a={plugins:{}};d.keys().forEach(function(e){var b=i.toUrl(e);a.plugins[b]=d[e]});var m=new c.PluginRegistry(h,a);return m.start().then(function(){if(h.getServiceReferences("orion.core.preference.provider").length>
0)return e.getPreferences("/plugins",e.USER_SCOPE).then(function(a){var d=[];a.keys().forEach(function(a){a=i.toUrl(a);m.getPlugin(a)||d.push(m.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return k.all(d,function(a){console.log(a)})})}).then(function(){return(new f.ConfigurationAdminFactory(h,m,e)).getConfigurationAdmin().then(h.registerService.bind(h,"orion.cm.configadmin"))}).then(function(){var a=h.getService("orion.core.auth");
if(a){var d=a.getUser().then(function(d){if(d)localStorage.setItem("lastLogin",(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),e=localStorage.getItem("lastLogin");if(!e||e<(new Date).getTime()-9E5)return d}}).then(function(){var a={serviceRegistry:h,preferences:e,pluginRegistry:m};b.resolve(a);return a})})}}});
(function(){function i(c,f,b,h,e,d){f[c]&&(b.push(c),(f[c]===!0||f[c]===1)&&h.push(e+c+"/"+d))}function k(c,f,b,h,e){f=h+f+"/"+e;require._fileExists(c.toUrl(f+".js"))&&b.push(f)}function j(c,f,b){for(var h in f)f.hasOwnProperty(h)&&(!c.hasOwnProperty(h)||b)?c[h]=f[h]:typeof f[h]==="object"&&j(c[h],f[h],b)}var g=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(c){var f=c.config?c.config():{};return{version:"2.0.1+",load:function(b,h,e,d){d=d||{};if(d.locale)f.locale=d.locale;
var a=g.exec(b),c=a[1],n=a[4],q=a[5],o=n.split("-"),p=[],s={},u,v="";if(a[5])c=a[1],b=c+q;else{q=a[4];n=f.locale;if(!n)n=f.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase();o=n.split("-")}if(d.isBuild){p.push(b);k(h,"root",p,c,q);for(u=0;u<o.length;u++)d=o[u],v+=(v?"-":"")+d,k(h,v,p,c,q);h(p,function(){e()})}else h([b],function(a){var d=[],l;i("root",a,d,p,c,q);for(u=0;u<o.length;u++)l=o[u],v+=(v?"-":"")+l,i(v,a,d,p,c,q);h(p,function(){var l,
b,f;for(l=d.length-1;l>-1&&d[l];l--){f=d[l];b=a[f];if(b===!0||b===1)b=h(c+f+"/"+q);j(s,b)}e(s)})})}}})})();
define("orion/i18n",[],function(){return{load:function(i,k,j,g){var g=g||{},c=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,f=c.exec(i);if(f){if(!k.defined||k.defined(i))try{j(k(i));return}catch(b){}if(g.isBuild||g.isTest)j({});else if(k.specified&&!k.specified("orion/bootstrap"))j({});else{var h=f[1],e=f[3]?f[2]:"",d=f[3]||f[2];k(["orion/bootstrap"],function(a){a.startup().then(function(a){var b=a.serviceRegistry,a=b.getServiceReferences("orion.i18n.message");if(e)a.some(function(a){return i===a.getProperty("name")?
(b.getService(a).getMessageBundle().then(function(a){j(a)},function(){j({})}),!0):!1})||j({});else{var q={},o;a.forEach(function(a){var b=a.getProperty("name");if((f=c.exec(b))&&h===f[1]&&d===(f[3]||f[2]))if(e=f[3]?f[2]:""){if((a=g.locale||(typeof navigator!=="undefined"?navigator.language||navigator.userLanguage:null))&&a.toLowerCase().indexOf(e.toLowerCase())===0)q[e]=!0,(!k.specified||!k.specified(b))&&define(b,["orion/i18n!"+b],function(a){return a})}else o=a});!k.specified||!k.specified(i)?o?
b.getService(o).getMessageBundle().then(function(a){Object.keys(q).forEach(function(d){typeof a[d]==="undefined"&&(a[d]=q[d])});define(i,[],a);j(a)},function(){define(i,[],q);j(q)}):(define(i,[],q),j(q)):j(q)}})})}}else j(null)}}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/util",[],function(){var i=navigator.userAgent,k=i.indexOf("MSIE")!==-1||i.indexOf("Trident")!==-1?document.documentMode:void 0,j=parseFloat(i.split("Firefox/")[1]||i.split("Minefield/")[1])||void 0,g=i.indexOf("Opera")!==-1?parseFloat(i.split("Version/")[1]):void 0,c=parseFloat(i.split("Chrome/")[1])||void 0,f=i.indexOf("Safari")!==-1&&!c,b=parseFloat(i.split("WebKit/")[1])||void 0,h=i.indexOf("Android")!==-1,e=i.indexOf("iPad")!==-1,i=i.indexOf("iPhone")!==-1,d=e||i,a=navigator.platform.indexOf("Mac")!==
-1,m=navigator.platform.indexOf("Win")!==-1,n=navigator.platform.indexOf("Linux")!==-1,q="ontouchstart"in document.createElement("input");return{formatMessage:function(a){var d=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,e){return d[(e<<0)+1]})},createElement:function(a,d){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",d):a.createElement(d)},isIE:k,isFirefox:j,isOpera:g,isChrome:c,isSafari:f,isWebkit:b,isAndroid:h,isIPad:e,isIPhone:i,isIOS:d,isMac:a,isWindows:m,
isLinux:n,isTouch:q,platformDelimiter:m?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(i){function k(e,d){d||(d=document);return d.querySelectorAll(e)}function j(e){var d=e.tabIndex;d===0&&i.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[e.nodeName.toLowerCase()]&&!e.attributes.tabIndex&&(d=-1);return d}function g(e){if(j(e)>=0)return e;if(e.hasChildNodes())for(var d=0;d<e.childNodes.length;d++){var a=g(e.childNodes[d]);if(a)return a}return null}function c(e){if(j(e)>=
0)return e;if(e.hasChildNodes())for(var d=e.childNodes.length-1;d>=0;d--){var a=c(e.childNodes[d]);if(a)return a}return null}function f(e,d){if(e.nodeType===3){var a=b.exec(e.nodeValue);a&&a.length>1&&d(e,a)}if(e.hasChildNodes())for(a=0;a<e.childNodes.length;a++)f(e.childNodes[a],d)}var b=/\$\{([^\}]+)\}/,h=null;return{$:function(e,d){d||(d=document);return d.querySelector(e)},$$:k,$$array:function(e,d){return Array.prototype.slice.call(k(e,d))},node:function(e){var d=e;typeof e==="string"&&(d=document.getElementById(e));
return d},contains:function(e,d){if(!e||!d)return!1;if(e===d)return!0;var a=e.compareDocumentPosition(d);return Boolean(a&16)},bounds:function(e){e=e.getBoundingClientRect();return{left:e.left+document.documentElement.scrollLeft,top:e.top+document.documentElement.scrollTop,width:e.width,height:e.height}},empty:function(e){for(;e.hasChildNodes();)e.removeChild(e.firstChild)},firstTabbable:g,lastTabbable:c,stop:function(e){if(window.document.all)e.keyCode=0;e.preventDefault&&(e.preventDefault(),e.stopPropagation())},
processTextNodes:function(e,d){f(e,function(a,e){a.parentNode.replaceChild(document.createTextNode(d[e[1]]||e[1]),a)})},processDOMNodes:function(e,d){f(e,function(a,e){var b=d[e[1]];if(b){var h=document.createRange(),c=e.index;h.setStart(a,c);h.setEnd(a,c+e[0].length);h.deleteContents();h.insertNode(b)}})},addAutoDismiss:function(e,d){function a(a){h.forEach(function(d){var e=!1,b=d.excludeNodes.some(function(d){return document.body.contains(d)?(e=!0,d.contains(a.target)):!1});if(e&&!b)try{d.dismiss(a)}catch(h){typeof console!==
"undefined"&&console&&console.error(h&&h.message)}});h=h.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}h===null&&(h=[],document.addEventListener("click",a,!0),i.isIOS&&document.addEventListener("touchend",function(a){function d(){a.target.removeEventListener("click",d)}a.touches.length===0&&a.target.addEventListener("click",d)},!1));h.push({excludeNodes:e,dismiss:d})},setFramesEnabled:function(e){for(var d=document.getElementsByTagName("iframe"),a=
0;a<d.length;a++)d[a].parentNode.style.pointerEvents=e?"":"none"},removeAutoDismiss:function(e){h=h.filter(function(d){return e!==d.dismiss})},KEY:{BKSPC:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(i,k,j){function g(c){j.attach(this);this._init(c)}g.prototype={_init:function(c){this._dropdownNode=k.node(c.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=c.populate;this._selectionClass=c.selectionClass;this._parentDropdown=c.parentDropdown;this._positioningNode=c.positioningNode;if(!this._parentDropdown)for(var f=this._dropdownNode.parentNode;f&&document!==f;){if(f.classList&&
f.classList.contains("dropdownMenu")){this._parentDropdown=f.dropdown;break}f=f.parentNode}this._triggerNode=c.triggerNode?c.triggerNode:k.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!c.skipTriggerEventListeners){var b=this;this._triggerNode.addEventListener("click",function(h){b.toggle(h)&&k.stop(h)},!1);this._triggerNode.tagName.toLowerCase()==="span"&&this._triggerNode.addEventListener("keydown",function(h){if(h.keyCode===
k.KEY.ENTER||h.keyCode===k.KEY.SPACE)b.toggle(),k.stop(h)},!1)}this._dropdownNode.addEventListener("keydown",this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(c){var f=this;c.addEventListener("click",function(b){f.toggle(b)&&k.stop(b)},!1)},toggle:function(c){return this.isVisible()?this.close():this.open(c)},isVisible:function(){return this._isVisible},open:function(c){var f=!1;if(!this.isVisible()){this.dispatchEvent({type:"triggered",dropdown:this,event:c});k.setFramesEnabled(!1);this._populate&&
(this.empty(),this._populate(this._dropdownNode));var b=this.getItems();if(b.length>0){if(!this._hookedAutoDismiss)this._boundAutoDismiss?k.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),f=k.$$array(".dropdownSubMenu",this._dropdownNode),k.addAutoDismiss([this._triggerNode].concat(f),this._boundAutoDismiss),this._hookedAutoDismiss=!0;this._triggerNode.classList.add("dropdownTriggerOpen");this._selectionClass&&this._triggerNode.classList.add(this._selectionClass);
this._dropdownNode.classList.add("dropdownMenuOpen");this._isVisible=!0;this._positionDropdown(c);b[0].focus();f=!0;this._parentDropdown&&this._parentDropdown.submenuOpen(this)}}return f},_autoDismiss:function(c){if(this.close(!1)&&this._dropdownNode.contains(c.target))for(c=this._parentDropdown;c;)c.close(!1),c=c._parentDropdown},_positionDropdown:function(){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+
"px";else{var c=k.bounds(this._dropdownNode),f=k.bounds(document.body);if(c.left+c.width>f.left+f.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-c.width+"px";else{var b=k.bounds(this._boundingNode(this._triggerNode)),h=k.bounds(this._triggerNode);this._dropdownNode.style.left=h.left-b.left-c.width+h.width+"px"}c=c.top+c.height-(f.top+f.height);if(0<c)this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-c)+"px"}},_boundingNode:function(c){var f=
window.getComputedStyle(c,null);return f===null?c:f.getPropertyValue("position")==="absolute"||!c.parentNode||c===document.body?c:this._boundingNode(c.parentNode)},close:function(c){var f=!1;if(this.isVisible())this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),k.setFramesEnabled(!0),c&&this._triggerNode.focus(),this._isVisible=!1,f=!0;return f},getItems:function(){var c=
[],f=this;k.$$array("li:not(.dropdownSeparator) > .dropdownMenuItem",this._dropdownNode,!0).forEach(function(b){b.parentNode.parentNode===f._dropdownNode&&c.push(b)});c.forEach(function(b){if(!b._hasDropdownMouseover)b.addEventListener("mouseover",function(h){b.dropdown?b.dropdown.open(h):(f._closeSelectedSubmenu(),k.stop(h))}),b._hasDropdownMouseover=!0});return c},empty:function(){var c=this;k.$$array("li",this._dropdownNode).forEach(function(f){f.parentNode===c._dropdownNode&&f.parentNode.removeChild(f)});
this._hookedAutoDismiss=!1},_dropdownKeyDown:function(c){if(c.keyCode===k.KEY.UP||c.keyCode===k.KEY.DOWN||c.keyCode===k.KEY.RIGHT||c.keyCode===k.KEY.ENTER||c.keyCode===k.KEY.LEFT){var f=this.getItems(),b=document.activeElement;if(f.length&&f.length>0&&b){var h=f.indexOf(b);h<0&&(h=f.indexOf(b.parentNode));h>=0&&(c.keyCode===k.KEY.UP&&h>0?(h--,f[h].focus()):c.keyCode===k.KEY.DOWN&&h<f.length-1?(h++,f[h].focus()):c.keyCode===k.KEY.ENTER||c.keyCode===k.KEY.RIGHT?b.classList.contains("dropdownTrigger")&&
b.dropdown&&b.dropdown.open():c.keyCode===k.KEY.LEFT&&b.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&this.close(!0),k.stop(c))}}else c.keyCode===k.KEY.ESCAPE&&(this.close(!0),k.stop(c))},submenuOpen:function(c){if(c!==this._selectedSubmenu)this._closeSelectedSubmenu(),this._selectedSubmenu=c},_closeSelectedSubmenu:function(){for(var c=this._selectedSubmenu;c;)c.close(),c=c._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&k.removeAutoDismiss(this._boundAutoDismiss)}};
g.prototype.constructor=g;return{Dropdown:g}});
define("text",["module"],function(i){var k,j,g=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],c=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,f=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,b=typeof location!=="undefined"&&location.href,h=b&&location.protocol&&location.protocol.replace(/\:/,""),e=b&&location.hostname,d=b&&(location.port||void 0),a=[],m=i.config&&i.config()||{};k={version:"2.0.5",strip:function(a){if(a){var a=a.replace(c,""),d=a.match(f);d&&(a=d[1])}else a="";return a},
jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:m.createXhr||function(){var a,d,e;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else if(typeof ActiveXObject!=="undefined")for(d=0;d<3;d+=1){e=g[d];try{a=new ActiveXObject(e)}catch(b){}if(a){g=[e];break}}return a},parseName:function(a){var d,
e,b=!1,h=a.indexOf(".");d=a.indexOf("./")===0||a.indexOf("../")===0;h!==-1&&(!d||h>1)?(d=a.substring(0,h),e=a.substring(h+1,a.length)):d=a;a=e||d;h=a.indexOf("!");h!==-1&&(b=a.substring(h+1)==="strip",a=a.substring(0,h),e?e=a:d=a);return{moduleName:d,ext:e,strip:b}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,d,e,b){var h,c;h=k.xdRegExp.exec(a);if(!h)return!0;a=h[2];h=h[3];h=h.split(":");c=h[1];h=h[0];return(!a||a===d)&&(!h||h.toLowerCase()===e.toLowerCase())&&(!c&&!h||c===b)},finishLoad:function(d,
e,b,h){b=e?k.strip(b):b;m.isBuild&&(a[d]=b);h(b)},load:function(a,c,f,g){if(g.isBuild&&!g.inlineText)f();else{m.isBuild=g.isBuild;var s=k.parseName(a),g=s.moduleName+(s.ext?"."+s.ext:""),j=c.toUrl(g),v=m.useXhr||k.useXhr;!b||v(j,h,e,d)?k.get(j,function(d){k.finishLoad(a,s.strip,d,f)},function(a){f.error&&f.error(a)}):c([g],function(a){k.finishLoad(s.moduleName+"."+s.ext,s.strip,a,f)})}},write:function(d,e,b){if(a.hasOwnProperty(e)){var h=k.jsEscape(a[e]);b.asModule(d+"!"+e,"define(function () { return '"+
h+"';});\n")}},writeFile:function(a,d,e,b,h){var d=k.parseName(d),c=d.ext?"."+d.ext:"",m=d.moduleName+c,f=e.toUrl(d.moduleName+c)+".js";k.load(m,e,function(){var d=function(a){return b(f,a)};d.asModule=function(a,d){return b.asModule(a,f,d)};k.write(a,m,d,h)},h)}};if(m.env==="node"||!m.env&&typeof process!=="undefined"&&process.versions&&process.versions.node)j=require.nodeRequire("fs"),k.get=function(a,d){var e=j.readFileSync(a,"utf8");e.indexOf("\ufeff")===0&&(e=e.substring(1));d(e)};else if(m.env===
"xhr"||!m.env&&k.createXhr())k.get=function(a,d,e,b){var h=k.createXhr(),c;h.open("GET",a,!0);if(b)for(c in b)b.hasOwnProperty(c)&&h.setRequestHeader(c.toLowerCase(),b[c]);if(m.onXhr)m.onXhr(h,a);h.onreadystatechange=function(){var b;if(h.readyState===4)b=h.status,b>399&&b<600?(b=Error(a+" HTTP status: "+b),b.xhr=h,e(b)):d(h.responseText)};h.send(null)};else if(m.env==="rhino"||!m.env&&typeof Packages!=="undefined"&&typeof java!=="undefined")k.get=function(a,d){var e,b,h=new java.io.File(a),c=java.lang.System.getProperty("line.separator"),
h=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(h),"utf-8")),m="";try{e=new java.lang.StringBuffer;(b=h.readLine())&&b.length()&&b.charAt(0)===65279&&(b=b.substring(1));for(b!==null&&e.append(b);(b=h.readLine())!==null;)e.append(c),e.append(b);m=String(e.toString())}finally{h.close()}d(m)};return k});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'<button class="dropdownTrigger">${ButtonText}<\!--span class="dropdownArrowDown core-sprite-openarrow"></span--\></button><ul class="dropdownMenu"></ul>'});
define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'<button class="dropdownTrigger dropdownDefaultButton">${ButtonText}<span class="dropdownArrowDown core-sprite-openarrow"></span></button><ul class="dropdownMenu"></ul>'});define("text!orion/webui/submenutriggerbutton.html",[],function(){return'<li class="dropdownSubMenu"><span class="dropdownTrigger dropdownMenuItem" role="menuitem" tabindex="0"><span class="dropdownCommandName">${ButtonText}</span><span class="dropdownArrowRight core-sprite-closedarrow"></span></span><ul class="dropdownMenu"></ul></li>'});
define("text!orion/webui/checkedmenuitem.html",[],function(){return'<li><label class="dropdownMenuItem"><input class="checkedMenuItem" role="menuitem" type="checkbox" />${ItemText}</label></li>'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(i,k){function j(g){this._init(g)}j.prototype={_init:function(g){this._node=k.node(g.node);if(!this._node)throw"no dom node for tooltip found";this._position=g.position||["right","above","below","left"];this._text=g.text;this._hideDelay=g.hideDelay===void 0?200:g.hideDelay;this._tailSize=g.tailSize||10;this._trigger=g.trigger||"mouseover";this._afterShowing=g.afterShowing;this._afterHiding=g.afterHiding;var c=this;if(this._trigger===
"click")this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(b){b.target===c._node&&(c.show(),k.stop(b))},!1);else if(this._trigger==="mouseover"){this._showDelay=g.showDelay===void 0?500:g.showDelay;g=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(b){k.contains(c._node,b.target)&&(c.show(),k.stop(b))},!1);this._leaveHandler=function(b){k.contains(c._node,b.target)&&c.hide()};for(var f=0;f<g.length;f++)this._node.addEventListener(g[f],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text)this._tipTextContent=document.createElement("div"),this._tipTextContent.classList.add("textContent"),this._tipInner.appendChild(this._tipTextContent),this._tipTextContent.appendChild(document.createTextNode(this._text));this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var g=this;k.addAutoDismiss([this._tip,this._node],function(){g.hide()});if(this._trigger==="mouseover")this._tipInner.role="tooltip",this._tipInner.id="tooltip"+(new Date).getTime().toString(),this._node.setAttribute("aria-describedby",this._tipInner.id),this._tip.addEventListener("mouseover",function(){if(g._timeout)window.clearTimeout(g._timeout),g._timeout=null;g._tip.addEventListener("mouseout",function(c){k.contains(g._tip,c.target)&&(g.hide(),k.stop(c))},
!1)},!1)}return this._tip},_positionTip:function(g,c){this._makeTipNode();g==="left"?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var f=this._node,b;for(b=k.bounds(f);f&&!b.width&&!b.height;f=f.parentNode)b=k.bounds(f);var f=k.bounds(this._tipInner),h;switch(g){case "above":h=b.top-f.height-this._tailSize-1;b=b.left-this._tailSize;break;case "below":h=b.top+b.height+this._tailSize+1;b=b.left-this._tailSize;break;case "left":h=b.top-this._tailSize/2;b=b.left-f.width-
this._tailSize-1;break;default:h=b.top-this._tailSize/2,b=b.left+b.width+this._tailSize+1}var e=k.bounds(document.documentElement);if(h+f.height>e.height)if(c)h=e.height-f.height-1;else return!1;if(b+f.width>e.width)if(c)b=e.width-f.width-1;else return!1;if(b<0)if(c)b=4;else return!1;if(h<0)if(c)h=4;else return!1;if(this._tail&&this._tail.previousPosition!==g)this._tip.removeChild(this._tail),this._tail=null;if(!this._tail){this._tail=document.createElement("span");this._tail.classList.add("tooltipTailFrom"+
g);g==="above"||g==="left"?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner);if(g==="left")this._tail.style.left=f.width+"px";this._tail.previousPosition=g}this._tip.style.top=h+"px";this._tip.style.left=b+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing")){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._showDelay?this._timeout=
window.setTimeout(this._showImmediately.bind(this),this._showDelay):this._showImmediately()}},_showImmediately:function(){for(var g=!1,c=0;!g&&c<this._position.length;)g=this._positionTip(this._position[c]),c++;g||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(g){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;if(this._tip&&this._tip.classList.contains("tooltipShowing")){if(g===void 0)g=
this._hideDelay;var c=this;this._timeout=window.setTimeout(function(){c._tip.classList.remove("tooltipShowing");c._tip.removeAttribute("style");c._afterHiding&&c._afterHiding()},g)}},destroy:function(){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;if(this._tip)document.body.removeChild(this._tip),this._tail=this._tipTextContent=this._tipInner=this._tip=null;if(this._node){this._node.removeEventListener("click",this._clickHandler,!1);this._node.removeEventListener("mouseover",
this._mouseoverHandler,!1);for(var g=["mouseout","click"],c=0;c<g.length;c++)this._node.removeEventListener(g[c],this._leaveHandler,!1)}}};j.prototype.constructor=j;return{Tooltip:j}});
define("orion/commands","orion/util,orion/webui/littlelib,orion/webui/dropdown,text!orion/webui/dropdowntriggerbutton.html,text!orion/webui/dropdowntriggerbuttonwitharrow.html,text!orion/webui/submenutriggerbutton.html,text!orion/webui/checkedmenuitem.html,orion/webui/tooltip".split(","),function(i,k,j,g,c,f,b,h){function e(a){var l=a.invocation;if(l){var d=a.command;if(d.hrefCallback)return a=d.hrefCallback.call(l.handler||window,l),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;else if(l.commandRegistry)return l.commandRegistry._invoke(l),
!0;else if(d.onClick||d.callback)return window.setTimeout(function(){(d.onClick||d.callback).call(l.handler||window,l)},0),!0}return!1}function d(a,l){for(var d in l)if(l[d]&&l[d].keyBinding&&l[d].command&&l[d].keyBinding.match(a)){var b=l[d],h=b.keyBinding;if((!h.domScope||k.contains(k.node(h.domScope),a.target))&&e(b)){k.stop(a);break}}}function a(){var a={};if(v){var l,d,e;d=Object.keys(t);for(l=0;l<d.length;l++)e=d[l],a[e]=t[e];var b=v();d=Object.keys(b);for(l=0;l<d.length;l++)e=d[l],a[e]=b[e]}else a=
t;return a}function m(e){d(e,a())}function n(a,l){a=a||window.event;if(function(a){if(i.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(a.keyCode===65||a.keyCode===67||a.keyCode===86||a.keyCode===88||a.keyCode===90)?!0:!1;if(a.ctrlKey)return!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(a.keyCode===65||a.keyCode===67||a.keyCode===86||a.keyCode===88||a.keyCode===90)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return a["char"].length>0;else if(a.charCode||a.keyCode)switch(a=
a.charCode||a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return a>=32&&a<112||a>123}return!1}(a)){if(a.target.contentEditable==="true")return;var d=a.target.nodeName.toLowerCase();if(d==="input")switch(a.target.type.toLowerCase()){case "text":case "password":case "search":case "color":case "date":case "datetime":case "datetime-local":case "email":case "month":case "number":case "range":case "tel":case "time":case "url":case "week":return}else if(d==="textarea")return}l?l(a):m(a)}function q(){this._init()}
function o(a,l,d){l.classList.add("commandImage");var e;a.imageClass?a.addImageClassToElement?l.classList.add(a.imageClass):(e=document.createElement("span"),l.appendChild(e),e.classList.add(a.spriteClass),e.classList.add(a.imageClass)):(e=new Image,e.alt=a.name,e.name=d,e.id=d,e.src=a.image,l.appendChild(e));return e}function p(a,l){var d=document.createElement("span");d.classList.add("dropdownKeyBinding");d.appendChild(document.createTextNode(l));a.appendChild(d)}function s(a,l,d,e,b){this.commandRegistry=
b;this.handler=a;this.items=l;this.userData=d;this.command=e;if(e.parameters)this.parameters=e.parameters.makeCopy();this.id=e.id}function u(a){this._init(a)}var v=null,t={};q.prototype={setProxy:function(a){this.proxy=a},setKeyBindings:function(a){this.bindings=a},_init:function(){var a=this;document.addEventListener("keydown",function(l){return n(l,function(l){var d=a.proxy,e=a.bindings;if(e&&d)for(var b=0;b<e.length;b++)e[b].match(l)&&(d.processKey({type:l.type,keyCode:l.keyCode,altKey:l.altKey,
ctrlKey:l.ctrlKey,metaKey:l.metaKey,shiftKey:l.shiftKey}),k.stop(l))})})}};window.document.addEventListener("keydown",n,!1);s.prototype={collectsParameters:function(){return this.commandRegistry&&this.commandRegistry.collectsParameters()},makeCopy:function(a){var l=new s(this.handler,this.items,this.userData,this.command,this.commandRegistry);l.domNode=this.domNode;l.domParent=this.domParent;if(a)l.parameters=a.makeCopy();else if(this.parameters)l.parameters=this.parameters.makeCopy();return l}};
s.prototype.constructor=s;u.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;this.positioningNode=a.positioningNode;this.image=a.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.selectionClass=
a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters;this.isEditor=a.isEditor},populateChoicesMenu:function(a,l,d,e,b){var d=this.getChoices(l,d,e),h=d.some(function(a){return a.checked});d.forEach(function(d){if(d.name){var e=document.createElement("li");a.appendChild(e);var c=document.createElement("span");c.tabIndex=0;c.role="menuitem";c.classList.add("dropdownMenuItem");if(h){var r=document.createElement("span");r.classList.add("check");
r.appendChild(document.createTextNode(d.checked?"\u25cf":""));c.appendChild(r)}r=document.createTextNode(d.name);c.appendChild(r);e.appendChild(c);c.choice=d;c.addEventListener("click",function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,l)},!1);c.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,l)},!1)}else b._generateMenuSeparator(a)})},getChoices:function(a,l,d){return this.choiceCallback?
this.choiceCallback.call(l,a,d):null},makeChoiceCallback:function(a,l){return function(d){a.callback&&a.callback.call(a,l,d)}},hasImage:function(){return this.imageClass||this.image!=="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"}};u.prototype.constructor=u;return{Command:u,CommandInvocation:s,createDropdownMenu:function(a,l,d,e,b,h,m,f,n){a=k.node(a);if(!a)throw"no parent node was specified";
var q=document.createRange();q.selectNode(a);q=n?q.createContextualFragment(c):q.createContextualFragment(g);k.processTextNodes(q,{ButtonText:l});a.appendChild(q);var a=a.lastChild,s;n?(n=a.previousSibling,s=n.lastChild):n=a.previousSibling;e?n.classList.add(e):(n.classList.add("orionButton"),n.classList.add("commandButton"));if(b){if(!h)n.textContent="",n.setAttribute("aria-label",l);o({spriteClass:"commandSprite",imageClass:b},n,l);n.classList.add("orionButton")}n.dropdown=new j.Dropdown({dropdown:a,
populate:d,selectionClass:m,skipTriggerEventListeners:!!s,positioningNode:f});a.dropdown=n.dropdown;return{menuButton:n,menu:a,dropdown:n.dropdown,dropdownArrow:s}},createCheckedMenuItem:function(a,l,d,e){a=k.node(a);if(!a)throw"no parent node was specified";var h=document.createRange();h.selectNode(a);h=h.createContextualFragment(b);k.processTextNodes(h,{ItemText:l});a.appendChild(h);a=k.$(".checkedMenuItem",a.lastChild);a.checked=d;a.addEventListener("change",e,!1);return a},createCommandItem:function(a,
l,d,e,b,c,m){var f,c=c||!l.name&&l.hasImage();if(l.hrefCallback)f=document.createElement("a"),f.id=e,c&&l.hasImage()?o(l,f,e):(f.className="commandLink",f.appendChild(document.createTextNode(l.name))),m=l.hrefCallback.call(d.handler,d),m.then?m.then(function(a){f.href=a}):f.href=m?m:"#";else{f=document.createElement("button");f.className="orionButton";c?l.hasImage()?(o(l,f,e),l.name&&f.setAttribute("aria-label",l.name)):(f.classList.add("commandButton"),f.classList.add("commandMissingImageButton"),
f.appendChild(document.createTextNode(l.name))):(f.classList.add("commandButton"),e=document.createTextNode(l.name),f.appendChild(e));var g=m||l.callback;if(g)l.onClick=g,f.addEventListener("click",function(){g.call(d.handler,d)},!1)}a.nodeName.toLowerCase()==="ul"?(m=document.createElement("li"),a.appendChild(m),a=m):f.classList.add("commandMargins");a.appendChild(f);if(l.tooltip)f.commandTooltip=new h.Tooltip({node:f,text:l.tooltip,position:["above","below","right","left"]});b&&(t[l.id]={keyBinding:b,
command:l,invocation:d});return f},createCommandMenuItem:function(a,l,d,e,b,c){var m,f=a.dropdown;if(l.hrefCallback){m=document.createElement("a");var g=document.createElement("span");g.appendChild(document.createTextNode(l.name));g.classList.add("dropdownCommandName");m.appendChild(g);b=l.hrefCallback.call(d.handler,d);b.then?b.then(function(a){m.href=a}):m.href=b?b:"#";m.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&m.click()},!1)}else{m=document.createElement("span");
m.tabIndex=0;g=document.createElement("span");g.appendChild(document.createTextNode(l.name));g.classList.add("dropdownCommandName");m.appendChild(g);var n=b||l.callback;if(n)l.onClick=n,m.addEventListener("click",function(){f.close(!0);n.call(d.handler,d)},!1),m.addEventListener("keydown",function(a){if(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)a.preventDefault(),m.click()},!1)}m.className="dropdownMenuItem";m.role="menuitem";if(l.tooltip)m.commandTooltip=new h.Tooltip({node:m,text:l.tooltip,
position:["above","below","right","left"]});c&&p(m,c);c=document.createElement("li");a.appendChild(c);c.appendChild(m);e&&(t[l.id]={keyBinding:e,command:l,invocation:d});return m},executeBinding:e,setKeyBindingProvider:function(a){v=a},localKeyBindings:t,CommandsProxy:q,getKeyBindings:a,processKey:m,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:d}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Viewer":"Orion Markdown Viewer","Orion JSON Editor":"Orion JSON Editor",
"View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"I20140226-2325","LOG: ":"LOG: ",View:"View","no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ","Resource is out of sync with the server. Do you want to save it anyway?":"Resource is out of sync with the server. Do you want to save it anyway?",
Operations:"Operations","Operations running":"Operations running","Some operations finished with warning":"Some operations finished with warning","Some operations finished with error":"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Saved searches":"Saved searches","Recent searches":"Recent searches","Regular expression":"Regular expression",
"Search options":"Search options","Global search":"Global search","Orion Home":"Orion Home","Close notification":"Close notification","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site",
"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plugin","Generate a sample plugin for integrating with Orion.":"Generate a sample plugin for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* = any string, ? = any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/uiUtils",["orion/webui/littlelib"],function(i){function k(g){var c="",f=navigator.platform.indexOf("Mac")!==-1;f?(g.mod4&&(c+="\u2303"),g.mod3&&(c+="\u2325"),g.mod2&&(c+="\u21e7"),g.mod1&&(c+="\u2318")):(g.mod1&&(c+="Ctrl+"),g.mod2&&(c+="Shift+"),g.mod3&&(c+="Alt+"));if(g.alphaKey)return c+g.alphaKey;if(g.type==="keypress")return c+g.keyCode;for(var b in i.KEY)if(typeof(i.KEY[b]==="number")&&i.KEY[b]===g.keyCode){if(f)switch(i.KEY[b]){case i.KEY.BKSPC:b="\u232b";break;case i.KEY.TAB:b=
"\u21e5";break;case i.KEY.ENTER:b="\u23ce";break;case i.KEY.ESCAPE:b="\u238b";break;case i.KEY.SPACE:b="\u2423";break;case i.KEY.PAGEUP:b="\u21de";break;case i.KEY.PAGEDOWN:b="\u21df";break;case i.KEY.END:b="\u21f2";break;case i.KEY.HOME:b="\u21f1";break;case i.KEY.DEL:b="\u2326"}switch(i.KEY[b]){case i.KEY.DOWN:b="\u2193";break;case i.KEY.UP:b="\u2191";break;case i.KEY.RIGHT:b="\u2192";break;case i.KEY.LEFT:b="\u2190"}return c+b}var h;switch(g.keyCode){case 59:h=g.mod2?":":";";break;case 61:h=g.mod2?
"+":"=";break;case 188:h=g.mod2?"<":",";break;case 190:h=g.mod2?">":".";break;case 191:h=g.mod2?"?":"/";break;case 192:h=g.mod2?"~":"`";break;case 219:h=g.mod2?"{":"[";break;case 220:h=g.mod2?"|":"\\";break;case 221:h=g.mod2?"}":"]";break;case 222:h=g.mod2?'"':"'"}return h?c+h:g.keyCode>=112&&g.keyCode<=123?c+"F"+(g.keyCode-111):c+String.fromCharCode(g.keyCode)}function j(g){var c=window.navigator.platform.indexOf("Mac")!==-1;return c&&g.metaKey||!c&&g.ctrlKey}return{getUserKeyString:function(g){for(var c=
"",g=g.getKeys(),f=0;f<g.length;f++)f!==0&&(c+=" "),c+=k(g[f]);return c},getUserText:function(g){var c=g.id,f=g.refNode,b=g.hideRefNode,h=g.initialText,e=g.onComplete,d=g.onEditDestroy,a=g.selectTo,m=g.isInitialValid,g=g.insertAsChild,n=!1,q=function(a){return function(g){if(!n){var q=i.node(c),o=q.value;if(q)if(a&&g.keyCode===i.KEY.ESCAPE){if(b)f.style.display="inline";n=!0;q.parentNode.removeChild(q);d&&d()}else if(!(a&&g.keyCode!==i.KEY.ENTER)){if(o.length===0||!m&&o===h){if(b)f.style.display=
"inline"}else if(e(o),b&&f.parentNode)f.style.display="inline";n=!0;q.parentNode&&q.parentNode.removeChild(q);d&&d()}}}},o=document.createElement("input");o.id=c;o.value=h||"";g?f.appendChild(o):f.parentNode.insertBefore(o,f.nextSibling);o.classList.add("userEditBoxPrompt");if(b)f.style.display="none";o.addEventListener("keydown",q(!0),!1);o.addEventListener("blur",q(!1),!1);window.setTimeout(function(){o.focus();if(h){var d=i.node(c),e=a?h.indexOf(a):-1;if(e>0)if(d.createTextRange)d=d.createTextRange(),
d.collapse(!0),d.moveStart("character",0),d.moveEnd("character",e),d.select();else if(d.setSelectionRange)d.setSelectionRange(0,e);else{if(d.selectionStart!==void 0)d.selectionStart=0,d.selectionEnd=e}else d.select()}},0)},openInNewWindow:j,followLink:function(g,c){c&&j(c)?window.open(g):window.location=g},createButton:function(g,c){var f=document.createElement("button");f.className="orionButton commandButton commandMargins";f.addEventListener("click",function(b){c();i.stop(b)},!1);g&&f.appendChild(document.createTextNode(g));
return f},createDropdownButton:function(){},isFormElement:function(g){switch(g.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(i){function k(j,g){g||(g="orion.page.selection");this._serviceRegistry=j;i.attach(this);this._serviceRegistration=j.registerService(g,this);this._selections=null}k.prototype={getSelection:function(j){var g=this._getSingleSelection();typeof j==="function"&&j(g);return g},getSelections:function(j){var g=Array.isArray(this._selections)?this._selections.slice():[];typeof j==="function"&&j(g);return g},_getSingleSelection:function(){return this._selections&&
this._selections.length>0?this._selections[0]:null},setSelections:function(j){var g=this._selections;this._selections=Array.isArray(j)?j.length>0?j.slice():null:j?[j]:null;g!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};k.prototype.constructor=k;return{Selection:k}});
define("orion/explorers/navigationUtils",[],function(){function i(j,g){if(!k&&j)j.push({domNode:g}),g.tabIndex=-1,g.style.outline="none"}var k=navigator.userAgent.indexOf("iPad")!==-1;return{addNavGrid:function(j,g,c){j&&(j=j.getGridNavHolder(g,!0))&&i(j,c)},generateNavGrid:i,removeNavGrid:function(j,g){if(j)for(var c=0;c<j.length;c++)if(j[c].domNode===g){j.splice(c,1);break}}}});
define("orion/PageUtil",[],function(){var i=/^http[s]?/i;return{hash:function(){var i=window.location.href.split("#")[1];return i?"#"+i:""},matchResourceParameters:function(i){var i=i||window.location.toString(),j={resource:""},g=i.indexOf("#");if(g!==-1&&(i=i.substring(g+1),i.length!==0)){i=i.split(",");j.resource=decodeURIComponent(i[0]);for(g=1;g<i.length;g++){var c=/([^=]*)(=?)(.*)/.exec(i[g]),f=decodeURIComponent(c[1]||""),c=decodeURIComponent(c[3]||"");f!==""&&f!=="resource"&&(j[f]=c)}}return j},
validateURLScheme:function(k,j){var g=k;if(k.indexOf("://")===-1){var c=document.createElement("a");c.href=k;g=c.href}c=!1;return(c=j?j.some(function(c){return RegExp("^"+c+":","i").test(g)}):i.test(g))?k:(console.log("Illegal URL Scheme: '"+k+"'"),"")}}});
define("orion/commandRegistry","orion/commands,orion/explorers/navigationUtils,orion/PageUtil,orion/uiUtils,orion/webui/littlelib,orion/webui/dropdown,orion/webui/tooltip,text!orion/webui/checkedmenuitem.html,text!orion/webui/dropdowntriggerbutton.html,text!orion/webui/submenutriggerbutton.html".split(","),function(i,k,j,g,c,f,b,h,e,d){function a(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(a);this._parameterCollector=
null}function m(a,d){this.token=a;this.parameterName=d}function n(a,d,e){this.event=a;this.handler=d;this.capture=e||!1}function q(a,d,e,b,h,c){this.name=a;this.type=d;this.label=e;this.value=b;this.lines=h||1;this.eventListeners=Array.isArray(c)?c:c?[c]:[]}function o(a,d,e){this._storeParameters(a);this._hasOptionalParameters=d&&d.hasOptionalParameters;this._options=d;this.optionsRequested=!1;this.getParameters=e;this.clientCollect=d&&d.clientCollect}a.prototype={_init:function(a){this._selectionService=
a.selection;var d=this;i.setKeyBindingProvider(function(){return d._activeBindings})},processURL:function(a){for(var d in this._urlBindings)if(this._urlBindings[d]&&this._urlBindings[d].urlBinding&&this._urlBindings[d].command){var e=this._urlBindings[d].urlBinding.match(a);if(e){var b=this._urlBindings[d],h=b.command,c=b.invocation;if(c&&c.parameters&&h.callback){c.parameters.setValue(e.parameterName,e.parameterValue);var l=this;window.setTimeout(function(){l._invoke(c)},0);break}}}},findCommand:function(a){return this._commandList[a]},
runCommand:function(a,d,e,b){d?(a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(d):1)&&a.callback&&this._invoke(new i.CommandInvocation(e,d,null,a,this),b):(d=this._urlBindings[a])&&d.command&&d.command.callback&&this._invoke(d.invocation,b)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=a},openParameterCollector:function(a,d,e){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,
d,e))},confirm:function(a,d,e,b,h,c){var l=!1;if(this._parameterCollector&&!h){var r=this;this._parameterCollector.close();if(this._parameterCollector.open(a,function(a,h){var c=document.createElement("span");c.classList.add("parameterPrompt");c.textContent=d;a.appendChild(c);c=document.createElement("button");c.addEventListener("click",function(){l=!0;r._parameterCollector.close()},!1);h.appendChild(c);c.appendChild(document.createTextNode(e));c.className="dismissButton";var m=document.createElement("button");
m.addEventListener("click",function(){l=!1;r._parameterCollector.close()},!1);h.appendChild(m);m.appendChild(document.createTextNode(b));m.className="dismissButton";return c},function(){c(l)}))return}l=window.confirm(d);c(l)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(a,d){return this._collectAndInvoke(a.makeCopy(d),!1)},_collectAndInvoke:function(a,d){if(a)if(this._parameterCollector&&
a.parameters&&a.parameters.hasParameters()&&(d||a.parameters.shouldCollectParameters())){var e=!1;a.parameters.updateParameters(a);if(a.parameters.shouldCollectParameters()&&(e=this._parameterCollector.collectParameters(a),!e)){var h=new b.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),e=h.contentContainer();e.classList.add("parameterPopup");var c=window.document.activeElement,m=this._parameterCollector.getFillFunction(a,
function(){c&&c.focus();h.destroy()})(e);h.show();window.setTimeout(function(){m.focus();m.select()},0);e=!0}e||a.command.callback.call(a.handler||window,a)}else a.command.callback.call(a.handler||window,a);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(a){this._collectAndInvoke(a,!0)},showKeyBindings:function(a){function d(a){return function(){i.executeBinding(a)}}var e={},b,h,c=[],l;for(l in this._activeBindings)(h=
this._activeBindings[l])&&h.keyBinding&&h.command&&(h.command.name||h.command.tooltip)&&c.push(h);c.sort(function(a,l){return(a.command.name||a.command.tooltip).localeCompare(l.command.name||l.command.tooltip)});for(l=0;l<c.length;l++)h=c[l],h.keyBinding.scopeName?(e[h.keyBinding.scopeName]||(e[h.keyBinding.scopeName]=[]),e[h.keyBinding.scopeName].push(h)):(b=g.getUserKeyString(h.keyBinding),a.createItem(b,h.command.name||h.command.tooltip,d(h)));for(var r in e)e[r].length&&e[r].length>0&&(a.createHeader(r),
e[r].forEach(function(l){b=g.getUserKeyString(l.keyBinding);a.createItem(b,l.command.name||l.command.tooltip,d(l))}))},addCommand:function(a){this._commandList[a.id]=a;var d=this._pendingBindings[a.id];if(d){var e=this;d.forEach(function(d){e._addBinding(a,d.type,d.binding,d.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,d,e,b,h,c,l,r,m,f){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];h&&(a=this._createEntryForPath(a,
h));if(a[d]){if(b)a[d].title=b;if(e)a[d].position=e;if(l)a[d].imageClass=l;if(r)a[d].tooltip=r;if(m)a[d].selectionClass=m;f===!0?a[d].pretendDefaultActionId=!0:a[d].defaultActionId=f;a[d].emptyGroupMessage=c}else a[d]={title:b,position:e,emptyGroupMessage:c,imageClass:l,tooltip:r,selectionClass:m,defaultActionId:f===!0?null:f,pretendDefaultActionId:f===!0,children:{}},a.sortedContributions=null},_createEntryForPath:function(a,d){d&&d.split("/").forEach(function(d){if(d.length>1){if(!a[d])a[d]={position:0,
children:{}},a.sortedContributions=null;a=a[d].children}});return a},registerSelectionService:function(a,d){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=d},registerCommandContribution:function(a,d,e,b,h,c,l){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];b&&(a=this._createEntryForPath(a,b));a[d]={position:e};c&&((e=this._commandList[d])?this._addBinding(e,"key",c,
h):this._addPendingBinding(d,"key",c,h));l&&((e=this._commandList[d])?this._addBinding(e,"url",l,h):this._addPendingBinding(d,"url",l,h));a.sortedContributions=null},unregisterCommandContribution:function(a,d,e){if(this._contributionsByScopeId[a]){delete this._commandList[d];delete this._activeBindings[d];delete this._urlBindings[d];delete this._pendingBindings[d];var b=this._contributionsByScopeId[a];e&&e.split("/").forEach(function(a){if(a.length>1&&b[a])b=b[a].children});delete b[d];b.sortedContributions=
null}},_addBinding:function(a,d,e,b){if(!a.id)throw Error("No command id: "+a);d==="key"?this._activeBindings[a.id]={command:a,keyBinding:e,bindingOnly:b}:d==="url"&&(this._urlBindings[a.id]={command:a,urlBinding:e,bindingOnly:b})},_addPendingBinding:function(a,d,e,b){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:d,binding:e,bindingOnly:b})},_checkForTrailingSeparator:function(a,d,e){var b;if(d==="tool"||d==="button")if((b=a.childNodes.length>0?a.childNodes[a.childNodes.length-
1]:null)&&b.classList.contains("commandSeparator"))return e?(a.removeChild(b),!1):!0;if(d==="menu"&&(a=c.$$array("li > *",a),a.length>0&&a[a.length-1].classList.contains("dropdownSeparator")))if(b=a[a.length-1],e)b.parentNode.parentNode.removeChild(b.parentNode);else return!0;return!1},renderCommands:function(a,d,e,b,h,m,l){if(typeof a!=="string")throw"a scope id for rendering must be specified";d=c.node(d);if(!d)throw"no parent";var r=this._contributionsByScopeId[a];if(!e&&r){var e=r.localSelectionService||
this._selectionService,f=this;e&&e.getSelections(function(l){f.renderCommands(a,d,l,b,h,m)})}else r&&(this._render(r,d,e,b,h||"button",m,l),this._checkForTrailingSeparator(d,h,!0))},destroy:function(a){a=c.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var d=a.firstChild;d.commandTooltip&&d.commandTooltip.destroy();d.emptyGroupTooltip&&d.emptyGroupTooltip.destroy();this.destroy(d);a.removeChild(d)}},_render:function(a,d,e,h,c,m,l){var r=a.sortedContributions;if(!r){var r=[],f=!1,n;for(n in a)if(Object.prototype.hasOwnProperty.call(a,
n)){var q=a[n];if(q&&typeof q.position==="number")q.id=n,r.push(q),f=!0}if(f)r.sort(function(a,d){return a.position-d.position}),a.sortedContributions=r}var o=0,j=this;r.forEach(function(a){var r;if(!a.imageClass)a.imageClass=null;if(a.children&&Object.getOwnPropertyNames(a.children).length>0){var f=a.children;if(c==="tool"||c==="button")if(a.title){var y;if(a.defaultActionId)(f=j._commandList[a.defaultActionId])&&(f.visibleWhen?f.visibleWhen(e):1)?(y=new i.CommandInvocation(h,e,m,f,j),y.domParent=
d):a.pretendDefaultActionId=!0;f=j._createDropdownMenu(d,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass,null,y,a.pretendDefaultActionId);l&&k.generateNavGrid(l,f.menuButton);if(f)if(j._render(a.children,f.menu,e,h,"menu",m,l),j._checkForTrailingSeparator(f.menu,"menu",!0),f.menu.childNodes.length===0)if(a.emptyGroupMessage){if(!f.menuButton.emptyGroupTooltip)f.menuButton.emptyGroupTooltip=new b.Tooltip({node:f.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right",
"above","left"]})}else l&&k.removeNavGrid(l,f.menuButton),a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},a(f.menu),a(f.menuButton),a(f.destroyButton);else f.menuButton.style.visibility="visible"}else{var n;d.childNodes.length>0&&!j._checkForTrailingSeparator(d,c)&&(n=j.generateSeparatorImage(d));j._render(f,d,e,h,c,m,l);d.childNodes.length>0&&d.childNodes[d.childNodes.length-1]!==n&&(n=j.generateSeparatorImage(d))}else if(a.title){if(a=j._createDropdownMenu(d,a.title,!0,null,null,a.imageClass))j._render(f,
a.menu,e,h,"menu",m,l),j._checkForTrailingSeparator(a.menu,"menu",!0),a.menu.childNodes.length===0&&a.destroyButton&&d.removeChild(a.destroyButton)}else d.childNodes.length>0&&j._generateMenuSeparator(d),j._render(f,d,e,h,c,m,l),j._generateMenuSeparator(d)}else{var x=j._commandList[a.id],f=x?!0:!1;y=a=null;if(x){r=new i.CommandInvocation(h,e,m,x,j);r.domParent=d;n=f&&(x.visibleWhen?x.visibleWhen(e):!0);if(j._activeBindings[x.id]&&j._activeBindings[x.id].keyBinding)a=j._activeBindings[x.id],a.invocation=
n?r:null,a.bindingOnly&&(f=!1);if(j._urlBindings[x.id]&&j._urlBindings[x.id].urlBinding)y=j._urlBindings[x.id],y.invocation=n?r:null,y.bindingOnly&&(f=!1);f=f&&n}if(f)x.choiceCallback?(c==="tool"||c==="button"?(a=d,f=!1,d.nodeName.toLowerCase()==="ul"&&(a=document.createElement("li"),d.appendChild(a))):(a=d,f=!0),j._createDropdownMenu(a,x.name,f,function(a){x.populateChoicesMenu(a,e,h,m,j)}.bind(x),x.imageClass,x.tooltip||x.title,x.selectionClass,x.positioningNode)):(r.handler=r.handler||this,r.domParent=
d,f=function(){j._invoke(r)},c==="menu"?(y=null,a&&a.keyBinding&&(y=g.getUserKeyString(a.keyBinding)),a=i.createCommandMenuItem(d,x,r,null,f,y)):(a=c+x.id+o,a=i.createCommandItem(d,x,r,a,null,c==="tool",f)),k.generateNavGrid(l,a),r.domNode=a,o++)}})},_createDropdownMenu:function(a,e,h,m,g,n,l,r,y,x){a=c.node(a);if(!a||!c.contains(document.body,a))return null;var q,o,j=a;if(h)n=document.createRange(),n.selectNode(a),n=n.createContextualFragment(d),c.processTextNodes(n,{ButtonText:e}),a.appendChild(n),
o=a.lastChild,g=o.lastChild,e=g.previousSibling,e.dropdown=new f.Dropdown({dropdown:g,populate:m,parentDropdown:a.dropdown}),g.dropdown=e.dropdown;else{a.nodeName.toLowerCase()==="ul"&&(j=document.createElement("li"),a.appendChild(j),o=j);a=null;g&&(a="dropdownButtonWithIcon",n=n||e);var n=g?n||e:n,k=i.createDropdownMenu(j,e,m,a,g,!1,l,r,y||x);q=k.dropdownArrow;e=k.menuButton;if(q){if(y)y.domNode=k.menuButton;var D=this;e.onclick=function(a){var d=c.bounds(q);a.clientX>=d.left&&k.dropdown?k.dropdown.toggle(a):
D._invoke(y)};if(k.dropdown)e.onkeydown=function(a){c.KEY.DOWN===a.keyCode&&(k.dropdown.toggle(a),c.stop(a))}}var g=k.menu,M;(m=y&&y.command&&(y.command.tooltip||y.command.name))?M=y.command.tooltip||y.command.name:m&&(M=n);if(M)e.commandTooltip=new b.Tooltip({node:e,text:M,position:["above","below","right","left"]})}return{menuButton:e,menu:g,dropdown:e.dropdown,destroyButton:o,dropdownArrow:q}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,"menu")){var d=document.createElement("li");
d.classList.add("dropdownSeparator");var e=document.createElement("span");e.classList.add("dropdownSeparator");d.appendChild(e);a.appendChild(d)}},generateSeparatorImage:function(a){var d;d=a.nodeName.toLowerCase()==="ul"?document.createElement("li"):document.createElement("span");a.appendChild(d);d.classList.add("core-sprite-sep");d.classList.add("imageSprite");d.classList.add("commandSeparator");return d}};a.prototype.constructor=a;m.prototype={match:function(a){a=j.matchResourceParameters(a);return typeof a[this.token]!==
"undefined"?(this.parameterValue=a[this.token],this):null}};m.prototype.constructor=m;n.prototype.constructor=n;q.prototype={optionsRequested:function(){return this.optionsRequested}};q.prototype.constructor=q;o.prototype={_storeParameters:function(a){this.parameterTable=null;if(a){var d=this.parameterTable={};a.forEach(function(a){d[a.name]=a})}},updateParameters:function(a){typeof this.getParameters==="function"&&this._storeParameters(this.getParameters(a))},hasParameters:function(){return this.parameterTable!==
null},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(a){return this.parameterTable[a]},valueFor:function(a){return(a=this.parameterTable[a])?a.value:null},setValue:function(a,d){var e=this.parameterTable[a];if(e)e.value=d},forEach:function(a){for(var d in this.parameterTable)this.parameterTable[d].type&&this.parameterTable[d].name&&a(this.parameterTable[d])},makeCopy:function(){var a=[];this.forEach(function(d){d=new q(d.name,d.type,d.label,
d.value,d.lines,d.eventListeners);a.push(d)});var d=new o(a,this._options,this.getParameters);d.clientCollect=this.clientCollect;return d},hasOptionalParameters:function(){return this._hasOptionalParameters}};o.prototype.constructor=o;return{CommandRegistry:a,URLBinding:m,ParametersDescription:o,CommandParameter:q,CommandEventListener:n}});define("text!orion/banner/slideout.html",[],function(){return'<div id="slideContainer" class="slideParameters slideContainer">\n\t<span id="pageCommandParameters" class="layoutLeft parameters"></span>\n\t<span id="pageCommandDismiss" class="layoutRight parametersDismiss"></span>\n</div>'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(i,k,j){return{slideoutHTMLFragment:function(g){var c=document.createElement("div");c.innerHTML=j;var f=k.$("#slideContainer",c);f.id=g+f.id;f=k.$("#pageCommandParameters",c);f.id=g+f.id;f=k.$("#pageCommandDismiss",c);f.id=g+f.id;return c.innerHTML}}});
define("orion/section","orion/webui/littlelib,orion/selection,orion/commandRegistry,orion/commonHTMLFragments,orion/objects,orion/selection".split(","),function(i,k,j,g,c,f){function b(e,d){var a=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!d.id)throw Error("Missing required argument: id");this.id=d.id;if(!d.title)throw Error("Missing required argument: title");var b=d.useAuxStyle?["sectionWrapper",
"sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");e.appendChild(this.domNode);for(var h=0;h<b.length;h++)this.domNode.classList.add(b[h]);this.domNode.id=d.id;if(d.canHide)this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitleTwistie"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=
0,this.domNode.addEventListener("click",function(d){(d.target===a.titleNode||d.target===a.twistie)&&a._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(d){d.keyCode===i.KEY.ENTER&&(d.target===a.domNode||d.target===a.titleNode||d.target===a.twistie)&&a._changeExpandedState()},!1);if(d.iconClass){var c=document.createElement("span");c.classList.add("sectionIcon");this.domNode.appendChild(c);b=Array.isArray(d.iconClass)?d.iconClass:[d.iconClass];b.forEach(function(a){c.classList.add(a)})}d.headerClass&&
(b=Array.isArray(d.headerClass)?d.headerClass:[d.headerClass],b.forEach(function(a){this.domNode.classList.add(a)}.bind(this)));this.titleNode=document.createElement("div");this.titleNode.id=d.id+"Title";this.titleNode.classList.add("sectionAnchor");this.titleNode.classList.add("sectionTitle");this.titleNode.classList.add("layoutLeft");this.domNode.appendChild(this.titleNode);this.titleNode.textContent=d.title;if(typeof d.getItemCount==="function")b=document.createElement("div"),b.classList.add("layoutLeft"),
b.classList.add("sectionItemCount"),this.domNode.appendChild(b),b.textContent=d.getItemCount(this);this._progressNode=document.createElement("div");this._progressNode.id=d.id+"Progress";this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.visibility="hidden";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);b=document.createElement("div");b.id=d.id+
"FilterSearchBox";this.domNode.appendChild(b);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=d.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("ul");this.actionsNode.id=d.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("commandList");this.actionsNode.classList.add("sectionActions");
this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("ul");this.selectionNode.id=d.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);d.slideout&&(b=g.slideoutHTMLFragment(d.id),h=document.createRange(),h.selectNode(this.domNode),b=h.createContextualFragment(b),this.domNode.appendChild(b));this._contentParent=
document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);e.appendChild(this._contentParent);d.content&&this.setContent(d.content);this.hidden=d.hidden;if(typeof d.onExpandCollapse==="function")this._onExpandCollapse=d.onExpandCollapse;this._preferenceService=d.preferenceService;this._contentParent.style.display="none";this.domNode.classList.add("sectionWrapperClosed");
if(this._preferenceService){var f=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=a.get(f.id);if(a!==void 0)f.hidden=!a;if(!f.hidden)f._contentParent.style.display="block",f.domNode.classList.remove("sectionWrapperClosed");f._updateExpandedState(!f.hidden,!1)})}else{if(!this.hidden)this._contentParent.style.display="block",this.domNode.classList.remove("sectionWrapperClosed");this._updateExpandedState(!this.hidden,!1)}this._commandService=d.commandService;this._lastMonitor=
0;this._loading={}}function h(e){this._section=e;this._id=++e._lastMonitor}b.prototype={setTitle:function(e){this.titleNode.textContent=e},getHeaderElement:function(){return this.domNode},getTitleElement:function(){return this.titleNode},getActionElement:function(){return this._toolActionsNode},setContent:function(e){typeof e==="string"?this._contentParent.innerHTML=e:(this._contentParent.innerHTML="",this._contentParent.appendChild(e))},getContentElement:function(){return this._contentParent},embedExplorer:function(e,
d,a){this._contentParent.innerHTML="";if(!e.parent)e.parent=d;this._contentParent.appendChild(e.parent);e.section=this;c.mixin(e,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(a){if(!i.node(a)){var d=document.createElement("ul");d.id=a;d.classList.add("commandList");d.classList.add("layoutRight");this.section.actionsNode.appendChild(d)}}.bind(this))},getCommandsVisible:function(){return this.section.actionsNode.style.visibility!=="hidden"},setCommandsVisible:function(a){this.section.actionsNode.style.visibility=
a?"":"hidden";var d=a?null:"cursorOnly";this.renderer.selectionPolicy=d;var e=this.getNavHandler();e&&e.setSelectionPolicy(d);a?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(a){i.node(a)&&this.commandRegistry.destroy(a)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var a=this;this.actionsSections&&(this.actionsSections.forEach(function(d){delete a[d]}),delete this.actionsSections)},updateCommands:function(a){this.section.actionsNode&&
this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,a))},loaded:function(){var d=this;if(!this.selection&&!a)this.serviceRegistry||this.registry?(this.selection=new f.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(a){d.updateCommands(a.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry");var e=
this.registerCommands();!e||!e.then?d.updateCommands():e.then(function(){d.updateCommands()})}});if(e.renderer)e.renderer.section=this,c.mixin(e.renderer,{getCellHeaderElement:function(a){(a=Object.getPrototypeOf(this).getCellHeaderElement.call(this,a))&&this.section.setTitle(a.innerHTML);return null}})},createProgressMonitor:function(){return new h(this)},_setMonitorMessage:function(e,d){this._progressNode.style.visibility="visible";this._loading[e]=d;var a="",b;for(b in this._loading)a!==""&&(a+=
"\n"),a+=this._loading[b];this._progressNode.title=a},_monitorDone:function(e){delete this._loading[e];var e="",d;for(d in this._loading)e!==""&&(e+="\n"),e+=this._loading[d];this._progressNode.title=e;if(e==="")this._progressNode.style.visibility="hidden"},_changeExpandedState:function(){this.hidden?(this._contentParent.style.display="block",this.domNode.classList.remove("sectionWrapperClosed"),this.hidden=!1):(this._contentParent.style.display="none",this.domNode.classList.add("sectionWrapperClosed"),
this.hidden=!0);this._updateExpandedState(!this.hidden,!0)},_updateExpandedState:function(e,d){var a=this.twistie,b=this.id;a&&(a.classList.add(e?this._expandImageClass:this._collapseImageClass),a.classList.remove(e?this._collapseImageClass:this._expandImageClass));this._preferenceService&&d&&this._preferenceService.getPreferences("/window/views").then(function(a){a.put(b,e)});this._onExpandCollapse&&this._onExpandCollapse(e,this)}};b.prototype.constructor=b;h.prototype={begin:function(e){this.status=
e;this._section._setMonitorMessage(this.id,e)},worked:function(e){this.status=e;this._section._setMonitorMessage(this.id,e)},done:function(e){this.status=e;this._section._monitorDone(this.id)}};h.prototype.constructor=h;return{Section:b}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(i,k){function j(g){this._init(g)}j.prototype={_init:function(g){var c=g.parent,f=this,c=k.node(c);if(!c)throw i["no parent"];if(!g.model)throw i["no tree model"];if(!g.renderer)throw i["no renderer"];this._parent=c;this._treeModel=g.model;this._onComplete=g.onComplete;this._renderer=g.renderer;this._showRoot=g.showRoot===void 0?!1:g.showRoot;this._indent=g.indent===void 0?16:g.indent;this._onCollapse=g.onCollapse;
this._labelColumnIndex=g.labelColumnIndex===void 0?0:g.labelColumnIndex;this._id=g.id===void 0?"treetable":g.id;this._tableStyle=g.tableStyle;this._tableElement=g.tableElement||"table";this._tableBodyElement=g.tableBodyElement||"tbody";this._tableRowElement=g.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(b){f._showRoot?(b._depth=0,f._generate([b],0)):f._treeModel.getChildren(b,function(b){f.destroyed||f._generate(b,0)})})},destroy:function(){this.destroyed=!0},_generate:function(g,
c){k.empty(this._parent);var f=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(f);var b=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(b);b.id=this._id;this._tableStyle&&b.classList.add(this._tableStyle);this._renderer.initTable(b,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";g.length===0?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(g,c);b.appendChild(this._bodyElement);f.appendChild(b);this._parent.appendChild(f);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(g,c,f){for(var b=0;b<g.length;b++){var h=document.createElement(this._tableRowElement);h.id=this._treeModel.getId(g[b]);h._depth=c;h._item=g[b];this._renderer.render(g[b],h);h.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*c+"px";this._renderer.rowCallback&&this._renderer.rowCallback(h,g[b]);f?(this._bodyElement.insertBefore(h,f.nextSibling),f&&(f=h)):this._bodyElement.appendChild(h)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(g,c,f){var b=this._treeModel.getId(g),h;if(b===this._id)this._removeChildRows(b),this._generateChildren(c,0),this._rowsChanged();else{var e=k.node(b);e?(e._item=g,
e&&(f||e._expanded)?(this._removeChildRows(b),c?(e._expanded=!0,this._renderer.updateExpandVisuals(e,!0),this._generateChildren(c,e._depth+1,e),this._rowsChanged()):(h=this,this._renderer.updateExpandVisuals(e,"progress"),c=this._treeModel.getChildren(e._item,function(d){if(!h.destroyed&&(h._renderer.updateExpandVisuals(e,!0),!e._expanded))e._expanded=!0,h._generateChildren(d,e._depth+1,e),h._rowsChanged()}))):this._renderer.updateExpandVisuals(e,!1)):console.log(i["could not find table row "]+b)}},
getItem:function(g){var c=k.node(g);return c&&c._item?c._item:g},toggle:function(g){var c=k.node(g);c&&(c._expanded?this.collapse(g):this.expand(g))},isExpanded:function(g){g=typeof g==="string"?g:this._treeModel.getId(g);return(g=k.node(g))?g._expanded:!1},expand:function(g,c,f){var g=typeof g==="string"?g:this._treeModel.getId(g),b=k.node(g);if(b)if(b._expanded)c&&c.apply(h,f);else{var h=this;this._renderer.updateExpandVisuals(b,"progress");this._treeModel.getChildren(b._item,function(e){if(!h.destroyed){h._renderer.updateExpandVisuals(b,
!0);if(!b._expanded)b._expanded=!0,h._generateChildren(e,b._depth+1,b),h._rowsChanged();c&&c.apply(h,f)}})}},_removeChildRows:function(g){for(var c=g===this._id,f=!1,b=-1,h=[],e=k.$$array(".treeTableRow",this._parent),d=0;d<e.length;d++){var a=e[d];if(f)break;if(c)a._depth>b?h.push(a):f=!0;else if(a.id===g)c=!0,b=a._depth}for(g=0;g<h.length;g++)c=h[g],c.parentNode.removeChild(c)},collapse:function(g){var g=typeof g==="string"?g:this._treeModel.getId(g),c=k.node(g);if(c){if(!c._expanded)return;c._expanded=
!1;this._renderer.updateExpandVisuals(c,!1);this._removeChildRows(g);this._rowsChanged()}this._onCollapse&&this._onCollapse(c._item)},getIndent:function(){return this._indent}};j.prototype.constructor=j;return{TableTree:j}});
define("orion/treeModelIterator",[],function(){var i={};i.TreeModelIterator=function(){function i(j,g){this.firstLevelChildren=j;this.reset();this._init(g)}i.prototype={_init:function(j){if(j)this.isExpanded=j.isExpanded,this.isExpandable=j.isExpandable,this.forceExpandFunc=j.forceExpandFunc,this.getChildrenFunc=j.getChildrenFunc},topLevel:function(j){return j.parent?j.parent===this.root:!0},_getChildren:function(j){return typeof this.getChildrenFunc==="function"?this.getChildrenFunc(j):j?j.children:
null},_expanded:function(j){if(!j)return!0;var g=this._getChildren(j),g=g&&g.length>0;this.isExpanded&&g&&(g=this.isExpanded(j));return g},_expandable:function(j){return!j?!0:this.isExpandable?this.isExpandable(j):!1},_diveIn:function(j){return this._expanded(j)?(this.setCursor(this._getChildren(j)[0]),this.cursor()):null},_drillToLast:function(j){return this._expanded(j)?(j=this._getChildren(j),this._drillToLast(j[j.length-1])):j},_forward:function(j){if(!this._cursor)return null;var g=this._diveIn(this._cursor);
if(!g){if(j&&this._expandable(this._cursor)&&this.forceExpandFunc){var c=this;return this.forceExpandFunc(this._cursor,"first",function(f){f&&c.setCursor(f)})}(g=this._findSibling(this._cursor,!0))&&this.setCursor(g)}return g},_backward:function(j){if(!this._cursor)return null;var g=this._findSibling(this._cursor,!1);g&&g!==this._cursor.parent&&(g=this._drillToLast(g));if(j&&g&&this._expandable(g)&&this.forceExpandFunc&&g!==this._cursor.parent){var c=this;return this.forceExpandFunc(g,"last",function(f){f&&
c.setCursor(f)})}g&&this.setCursor(g);return g},_findSibling:function(j,g){for(var c=this.topLevel(j),f=this._getChildren(j.parent),f=c?this.firstLevelChildren:f,b=0;b<f.length;b++)if(f[b]===j)return b===0&&!g?c?null:j.parent:b===f.length-1&&g?c?null:this._findSibling(j.parent,g):g?f[b+1]:f[b-1];return null},_inParentChain:function(j,g){for(var c=j.parent;c;){if(c===g)return!0;c=c.parent}return!1},_getTopLevelParent:function(j){if(this.topLevel(j))return j;for(j=j.parent;j;){if(this.topLevel(j))return j;
j=j.parent}return null},_onCollapse:function(j){return this._expanded(j.parent)?j:this._onCollapse(j.parent)},_scan:function(j,g,c){this.setCursor(g);var f=[];for(f.push(g);;){if(this.iterate(j))f.push(this.cursor());else break;if(c===this.cursor())return f}return null},setCursor:function(j){this._prevCursor=this._cursor;this._cursor=j},setTree:function(j){this.firstLevelChildren=j;if(this.firstLevelChildren.length>0)this.root=this.firstLevelChildren[0].parent},scan:function(j,g){var c=this.cursor(),
f=this._scan(!0,j,g);f||(f=this._scan(!1,j,g));this.setCursor(c);return f},iterate:function(j,g){return j?this._forward(g):this._backward(g)},iterateOnTop:function(j,g){var c=this._findSibling(this._getTopLevelParent(this.cursor()),j);c?this.setCursor(c):g&&this.firstLevelChildren.length>0&&this.setCursor(j?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(j){if(!this._cursor)return null;return this._inParentChain(this._cursor,j)?(this.setCursor(j),
this._cursor):null},reset:function(){this.root=this._prevCursor=this._cursor=null;if(this.firstLevelChildren.length>0)this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}};return i}();return i});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(i,k,j){var g={},c=navigator.userAgent.indexOf("iPad")!==-1,f=window.navigator.platform.indexOf("Mac")!==-1;g.ExplorerNavHandler=function(){function b(b,e,d){this.explorer=b;this.model=this.explorer.model;this._navDict=e;this._listeners=[];this._selections=[];this._currentColumn=0;b=this._getEventListeningDiv();b.tabIndex=0;b.classList.add("selectionModelContainer");var a=this;this._modelIterator=
new k.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:d.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(d){return a.explorer.renderer.isExpandable(d)}:function(d){return a.isExpandable(d)},forceExpandFunc:this.explorer.forceExpandFunc?function(d,e,b){return a.explorer.forceExpandFunc(d,e,b)}:void 0});this._init(d);(!d||d.setFocus!==!1)&&b.focus();d=function(d){if(j.isFormElement(d.target))return!0;if(a.explorer.preventDefaultFunc&&a.explorer.preventDefaultFunc(d,
a._modelIterator.cursor()))return!0;if(d.keyCode===i.KEY.DOWN)return a.onDownArrow(d);else if(d.keyCode===i.KEY.UP)return a.onUpArrow(d);else if(d.keyCode===i.KEY.RIGHT)return a.onRightArrow(d);else if(d.keyCode===i.KEY.LEFT)return a.onLeftArrow(d);else if(d.keyCode===i.KEY.SPACE)return a.onSpace(d);else if(d.keyCode===i.KEY.ENTER)return a.onEnter(d)};b.addEventListener("keydown",d,!1);this._listeners.push({type:"keydown",listener:d});d=function(){if(a.explorer.onFocus)a.explorer.onFocus(!1);else a.toggleCursor(null,
!1)};b.addEventListener("blur",d,!1);this._listeners.push({type:"blur",listener:d});d=function(){if(a.explorer.onFocus)a.explorer.onFocus(!0);else a.toggleCursor(null,!0)};b.addEventListener("focus",d,!1);this._listeners.push({type:"focus",listener:d});this._parentDiv=b}b.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(b){this._linearGridMove=!1;if(b)this._selectionPolicy=b.selectionPolicy,this.gridClickSelectionPolicy=
b.gridClickSelectionPolicy||"none",this.preventDefaultFunc=b.preventDefaultFunc,this.postDefaultFunc=b.postDefaultFunc},_ctrlKeyOn:function(b){return f?b.metaKey:b.ctrlKey},removeListeners:function(){if(this._listeners)for(var b=0;b<this._listeners.length;b++)this._parentDiv.removeEventListener(this._listeners[b].type,this._listeners[b].listener,!1)},focus:function(){var b=this._getEventListeningDiv();b&&b.focus()},_getEventListeningDiv:function(b){return this.explorer.keyEventListeningDiv&&typeof this.explorer.keyEventListeningDiv===
"function"?this.explorer.keyEventListeningDiv(b):i.node(this.explorer._parentId)},isExpandable:function(b){return!b?!1:i.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)))?!0:!1},isExpanded:function(b){return!b?!1:this.explorer.myTree.isExpanded(this.model.getId(b))},refreshSelection:function(b,e){var d=this;this.explorer.selection&&this.explorer.selection.getSelections(function(a){d._clearSelection(e);for(var c=0;c<a.length;c++)d._selections.push(a[c]);d._selections.length>0?
d.cursorOn(d._selections[0],!0,!1,b):d.cursorOn(null,!1,!1,b);if(!(d._shiftSelectionAnchor&&d._inSelection(d._shiftSelectionAnchor)>=0))d._shiftSelectionAnchor=null})},refreshModel:function(b,e,d,a){this._currentColumn=0;this.topIterationNodes=[];this.model=e;this._navDict=b;if(this.model.getTopIterationNodes)this.topIterationNodes=this.model.getTopIterationNodes();else if(d)this.topIterationNodes=d;this._modelIterator.setTree(this.topIterationNodes);!a&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),
!1),this._modelIterator.reset());this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(b){for(var b=this.model.getId(b),e=0;e<this._selections.length;e++)if(b===this.model.getId(this._selections[e]))return e;return-1},_clearSelection:function(b){if(b)for(b=0;b<this._selections.length;b++)this._checkRow(this._selections[b],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(b){if(this._selectionPolicy!==
b)this._selectionPolicy=b,this._selectionPolicy==="cursorOnly"&&this._clearSelection(!0)},setSelection:function(b,e,d){if(this._selectionPolicy==="cursorOnly")e&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(b,!0);else if(this._isRowSelectable(b)){!e||this._selectionPolicy==="singleSelection"?(this._clearSelection(!0),this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b):(e=this._inSelection(b),e>=0?(this._checkRow(b,!0),this._selections.splice(e,1)):(this._checkRow(b,
!1),this._selections.push(b),this._lastSelection=b));if(d)this._shiftSelectionAnchor=this._lastSelection;this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))}},moveColumn:function(b,e){b||(b=this.currentModel());var d=this._getGridChildren(b);if(d&&d.length>1||e===0&&d){e!==0&&this.toggleCursor(b,!1);var a=this._currentColumn,c=!0;a+=e;a<0?(this._linearGridMove&&e!==0&&(this._modelIterator.iterate(!1)?b=this.currentModel():c=!1),
a=c?d.length-1:this._currentColumn):a>=d.length&&(this._linearGridMove&&e!==0&&(this._modelIterator.iterate(!0)?b=this.currentModel():c=!1),a=c?0:this._currentColumn);this._currentColumn=a;e!==0&&this.toggleCursor(b,!0);return!0}return!1},_getGridChildren:function(b){return this._navDict?this._navDict.getGridNavHolder(b):null},getCurrentGrid:function(b){b||(b=this.currentModel());return(b=this._getGridChildren(b))&&b.length>0?b[this._currentColumn]:null},getAriaContainerElement:function(b){for(var e=
this._parentDiv,d;b&&b!==e&&(d=b.getAttribute("role"))!=="grid"&&d!=="tree"&&d!=="treegrid";)b=b.parentNode;return b===e?null:b},toggleCursor:function(b,e){var d=this.getRowDiv(b),a=this.getCurrentGrid(b);a?(d&&(e?d.classList.add("treeIterationCursorRow"):d.classList.remove("treeIterationCursorRow")),a.domNode&&(d=this.getAriaContainerElement(a.domNode),e?(a.domNode.classList.add("treeIterationCursor"),d&&d.setAttribute("aria-activedescendant",a.domNode.id)):a.domNode.classList.remove("treeIterationCursor"))):
d&&(e?d.classList.add("treeIterationCursorRow_Dotted"):d.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(b,e,d,a){var c,f;if(b||e){if(f===this._modelIterator.cursor())return;c=this._modelIterator.cursor();f=b;this._modelIterator.setCursor(f)}else c=this._modelIterator.prevCursor(),f=this._modelIterator.cursor();if(c!==f||e)if(this.toggleCursor(c,!1),!e||f){this.moveColumn(null,0);this.toggleCursor(f,!0);if((b=this.getRowDiv())&&
!a){a=b.parentNode;for(e=document.documentElement;a&&a!==e;){var g=window.getComputedStyle(a,null);if(!g)break;g=g.getPropertyValue("overflow-y");if(g==="auto"||g==="scroll")break;a=a.parentNode}a&&(e=!0,b.offsetTop<=a.scrollTop?(e=!1,d===void 0&&(d=!1)):b.offsetTop+b.offsetHeight>=a.scrollTop+a.clientHeight&&(e=!1,d===void 0&&(d=!0)),e||b.scrollIntoView(!d))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(c,f)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var b=
[],e=0;e<this._selections.length;e++)b.push(this.model.getId(this._selections[e]));return b},getRowDiv:function(b){b=b?b:this._modelIterator.cursor();if(!b)return null;var b=this.model.getId(b),e=this._navDict.getValue(b);return e&&e.rowDomNode?e.rowDomNode:i.node(b)},iterate:function(b,e,d,a){var c=null;if(this.topIterationNodes&&this.topIterationNodes.length!==0)if(a){a=this.currentModel();for((c=this._modelIterator.iterate(b,e))&&this._setCursorOnItem(b,d);c&&c.isNotSelectable;)(c=this._modelIterator.iterate(b,
e))&&this._setCursorOnItem(b,d);c||(this.cursorOn(a,!0,!1,!0),this._setCursorOnItem(b,d))}else(c=this._modelIterator.iterate(b,e))&&this._setCursorOnItem(b,d)},_setCursorOnItem:function(b,e){this.cursorOn(null,!1,b);if(e){var d=this._inSelection(this._modelIterator.prevCursor()),a=this._inSelection(this._modelIterator.cursor());d>=0&&a>=0?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(b,e){if(this.explorer.renderer._useCheckboxSelection&&
this._selectionPolicy!=="singleSelection"){var d=this.getRowDiv(b);if(d){var a=i.node(this.explorer.renderer.getCheckBoxId(d.id)),c=e?!a.checked:!0;if(c!==a.checked)this.explorer.renderer.onCheck(d,a,c,!0)}}else this._select(b,e)},_select:function(b){b||(b=this._modelIterator.cursor());var e=this.getRowDiv(b);e&&(this._inSelection(b)<0?e.classList.add("checkedRow"):e.classList.remove("checkedRow"))},_onModelGrid:function(b,e){var d=this._getGridChildren(b);if(d)for(var a=0;a<d.length;a++)if(e.target===
d[a].domNode)return!0;return!1},onClick:function(b,e){if(this.isDisabled(this.getRowDiv(b)))i.stop(e);else{var d=i.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)));if(e.target!==d&&!(this.gridClickSelectionPolicy==="none"&&this._onModelGrid(b,e)))if(this.cursorOn(b,!0,!1,!0),c)this.setSelection(b,!0);else if(this._ctrlKeyOn(e))this.setSelection(b,!0,!0);else if(e.shiftKey&&this._shiftSelectionAnchor){if(d=this._modelIterator.scan(this._shiftSelectionAnchor,b)){this._clearSelection(!0);
for(var a=0;a<d.length;a++)this.setSelection(d[a],!0)}}else this.setSelection(b,!1,!0)}},onCollapse:function(b){this._modelIterator.collapse(b)&&this.cursorOn()},onUpArrow:function(b){this.iterate(!1,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},onDownArrow:function(b){this.iterate(!0,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},_shouldMoveColumn:function(b){var e=
this.currentModel(),d=this._getGridChildren(e);return d&&d.length>1?this.isExpandable(e)?this._ctrlKeyOn(b):!0:!1},onLeftArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,-1),b.preventDefault(),!0;var e=this._modelIterator.cursor();if(!e)return!1;if(this.isExpandable(e)&&this.isExpanded(e))return this.explorer.myTree.collapse(e),b.preventDefault(),!0;this._modelIterator.topLevel(e)?this.explorer.scopeUp&&typeof this.explorer.scopeUp==="function"&&this.explorer.scopeUp():(this.cursorOn(e.parent),
this.setSelection(e.parent,!1,!0))},onRightArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,1),b.preventDefault(),!0;var e=this._modelIterator.cursor();if(!e)return!1;if(this.isExpandable(e)&&!this.isExpanded(e))return this.explorer.myTree.expand(e),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(e)),b.preventDefault(),!1},_isRowSelectable:function(b){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(b):!0},onSpace:function(b){this.setSelection(this.currentModel(),
!0,!0);b.preventDefault()},onEnter:function(b){var e=this.getCurrentGrid(this._modelIterator.cursor());if(e)if(e.widget)if(typeof e.onClick==="function")e.onClick();else typeof e.widget.focus==="function"&&e.widget.focus();else{var d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(b),!1,!1,!1,0,null);e.domNode.dispatchEvent(d)}else if(e=this._modelIterator.cursor()){if(this.explorer.renderer.getRowActionElement&&(d=this.explorer.renderer.getRowActionElement(this.model.getId(e)),
d.href))this._ctrlKeyOn(b)?window.open(d.href):window.location.href=d.href;if(this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(b,e),b.preventDefault(),!1}},setIsNotSelectable:function(b,e){b.isNotSelectable=e},disableItem:function(b){var e=this.getRowDiv(b);this.isExpandable(b)&&this.isExpanded(b)&&(this._modelIterator.collapse(b),this.explorer.myTree.toggle(e.id));e.classList.remove("checkedRow");e.classList.add("disabledNavRow");this.setIsNotSelectable(b,!0)},
isDisabled:function(b){return b.classList.contains("disabledNavRow")},enableItem:function(b){var e=this.getRowDiv(b);e&&(e.classList.remove("disabledNavRow"),this.setIsNotSelectable(b,!1))}};return b}();g.ExplorerNavDict=function(){function b(b){this._dict={};this._model=b}b.prototype={addRow:function(b,e){this._dict[this._model.getId(b)]={model:b,rowDomNode:e}},getValue:function(b){return this._dict[b]},getGridNavHolder:function(b,e){if(!b)return null;var d=this._model.getId(b);if(this._dict[d]){if(!this._dict[d].gridChildren&&
e)this._dict[d].gridChildren=[];return this._dict[d].gridChildren}return null},initGridNavHolder:function(b){if(!b)return null;b=this._model.getId(b);if(this._dict[b])this._dict[b].gridChildren=null}};return b}();return g});
define("orion/explorers/explorer","i18n!orion/nls/messages,require,orion/webui/littlelib,orion/webui/treetable,orion/explorers/explorerNavHandler,orion/commands".split(","),function(i,k,j,g,c,f){var b={};b.Explorer=function(){function b(e,d,a,c){this.registry=e;this.renderer=a;this.selection=d;this.commandService=c;if(this.renderer)this.renderer.explorer=this;this.myTree=null}b.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(b,d){this.myTree&&this.myTree.refresh.bind(this.myTree)(b,d,!0)},updateCommands:function(b){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(b)},makeNewItemPlaceHolder:function(b,d,a,c){b=this.getRow(b);if(a)return b=b.childNodes[a],b.appendChild(document.createElement("br")),c=document.createElement("span"),c.id=d+"placeHolderRow",b.appendChild(c),{tempNode:c,refNode:c};if(b){var h=document.createElement("tr");
h.id=d+"placeHolderRow";a=document.createElement("td");a.id=d+"placeHolderCol";h.appendChild(a);c?(b.parentNode.insertBefore(h,b.nextSibling),b=parseInt(b.firstChild.style.paddingLeft),a.style.paddingLeft=this.myTree.getIndent()+b+"px"):b.appendChild(h);c=j.node(d+"placeHolderRow");b=j.node(d+"placeHolderCol");if(c&&b)return{tempNode:c,refNode:b}}return null},getRow:function(b){if(b=this.model.getId(b))return j.node(b)},collapseAll:function(){for(var b=this._navHandler.getTopLevelNodes(),d=0;d<b.length;d++)this.myTree.collapse(b[d])},
expandAll:function(b){if(b)this._expandRecursively(b);else if(this._navHandler)for(var b=this._navHandler.getTopLevelNodes(),d=0;d<b.length;d++)this._expandRecursively(b[d])},_expandRecursively:function(b){if(this._navHandler&&this._navHandler.isExpandable(b)){var d=this;this.myTree.expand(b,function(){d.model.getChildren(b,function(a){if(!(a===void 0||a===null))for(var b=a.length,e=0;e<b;e++)d._expandRecursively(a[e])})})}},createTree:function(b,d,a){b=typeof b==="string"?b:b.id||b;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var h=b+"innerTree",f=j.node(h);f&&j.empty(f);if(d)d.rootId=h;this.model=d;this._parentId=b;this._treeOptions=a;if(!a||a&&!a.noSelection)this.selectionPolicy=a?a.selectionPolicy:"",this._navDict=new c.ExplorerNavDict(this.model);this.myTree=new g.TableTree({id:h,model:d,parent:b,onComplete:a?a.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:a?!!a.showRoot:
!1,indent:a?a.indent:void 0,onCollapse:a?a.onCollapse:void 0,navHandlerFactory:a?a.navHandlerFactory:void 0,tableElement:a?a.tableElement:void 0,tableBodyElement:a?a.tableBodyElement:void 0,tableRowElement:a?a.tableRowElement:void 0});this.renderer._initializeUIState();this.selectionPolicy==="cursorOnly"&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var b=this.getNavHandler(),d=[];
if(b&&this.getNavDict())for(var a=b.getSelection(),c=0;c<a.length;c++){var h=b.getRowDiv(a[c]);h&&h.parentNode&&(h=this.getNavDict().getValue(this.model.getId(a[c])),h.model&&d.push(h.model))}this.selection.setSelections(d)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var b=this._treeOptions;if(!b||b&&!b.noSelection){if(!this.getNavHandler())this._navHandler=b&&b.navHandlerFactory&&typeof b.navHandlerFactory.createNavHandler===
"function"?b.navHandlerFactory.createNavHandler(this,this._navDict,b):new c.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:b?b.getChildrenFunc:null,setFocus:b&&b.setFocus,selectionPolicy:b?b.selectionPolicy:null});var d=this;this.model.getRoot(function(a){a instanceof Array?d.getNavHandler().refreshModel(d.getNavDict(),d.model,a):a.children&&a.children instanceof Array&&d.getNavHandler().refreshModel(d.getNavDict(),d.model,a.children);b&&b.setFocus&&d.getNavHandler().cursorOn(null,!1,!1,!0)})}},
_lastHash:null,checkbox:!1};return b}();b.createExplorerCommands=function(b,e){function d(a){return typeof a.getItemCount==="function"?a.getItemCount()>0?e?e(a):!0:!1:!1}var a=new f.Command({tooltip:i["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return d(a)},callback:function(a){a.items.expandAll()}}),c=new f.Command({tooltip:i["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",
groupId:"orion.explorerGroup",visibleWhen:function(a){return d(a)},callback:function(a){a.items.collapseAll()}});b.addCommand(a);b.addCommand(c)};b.ExplorerModel=function(){function b(e,d,a){this.rootPath=e;this.fetchItems=d;this.idPrefix=a||""}b.prototype={destroy:function(){this.destroyed=!0},getRoot:function(b){var d=this;this.fetchItems(this.rootPath).then(function(a){d.root=a;b(a)})},getChildren:function(b,d){b.Children?d(b.Children):b.ChildrenLocation?this.fetchItems(b.ChildrenLocation).then(function(a){b.Children=
a;d(a)}):d([])},getId:function(b){if(b.Location===this.root.Location)return this.rootId;for(var b=b.Location.replace(/[\\\/]/g,""),d=this.idPrefix,a=0;a<b.length;a++)d+=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?b.charCodeAt(a):b[a];return d}};return b}();b.ExplorerFlatModel=function(){function c(b,d,a){this.rootPath=b;this.fetchItems=d;this.root=a}c.prototype=new b.ExplorerModel;c.prototype.getRoot=function(b){if(this.root)b(this.root);else{var d=this;this.fetchItems(this.rootPath).then(function(a){d.root=
a;b(a)})}};c.prototype.getChildren=function(b,d){b===this.root?d(this.root):d([])};return c}();b.ExplorerRenderer=function(){function b(e,d){this.explorer=d;this._init(e);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}b.prototype={_init:function(b){if(b){this._useCheckboxSelection=b.checkbox===void 0?!1:b.checkbox;this.selectionPolicy=b.singleSelection?
"singleSelection":"";this._cachePrefix=b.cachePrefix;this.getCheckedFunc=b.getCheckedFunc;this.onCheckedFunc=b.onCheckedFunc;this._highlightSelection=!0;this._treeTableClass=b.treeTableClass||"treetable";if(b.highlightSelection===!1)this._highlightSelection=!1;if(!this.actionScopeId)this.actionScopeId=b.actionScopeId;if(!this.commandService)this.commandService=b.commandService}},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(b,d){this.tableTree=d;this.tableNode=
b;j.empty(b);this._treeTableClass&&b.classList.add(this._treeTableClass);this.renderTableHeader(b)},getActionsColumn:function(b,d,a,c,h){var a=a||"tool",f=document.createElement("td");f.id=d.id+"actionswrapper";c&&f.classList.add(c);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,f,b,this.explorer,a,null,h&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(b,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return f},initCheckboxColumn:function(){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(b,d){if(this._useCheckboxSelection){var a=document.createElement("td"),c=document.createElement("span");c.id=this.getCheckBoxId(d.id);c.classList.add("core-sprite-check");c.classList.add("selectionCheckmarkSprite");c.rowId=d.id;if(this.getCheckedFunc)c.checked=this.getCheckedFunc(b),c.checked?(this._highlightSelection&&d.classList.add("checkedRow"),c.classList.add("core-sprite-check_on")):
(this._highlightSelection&&d.classList.remove("checkedRow"),c.classList.remove("core-sprite-check_on"));a.appendChild(c);var h=this;c.addEventListener("click",function(a){h.onCheck(d,a.target,a.target.checked?!1:!0,!0)},!1);return a}},getCheckBoxId:function(b){return b+"selectedState"},onCheck:function(b,d,a,c,h){(d.checked=a)?d.classList.add("core-sprite-check_on"):d.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(d.rowId,a,c);this.explorer.getNavHandler()&&h&&this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(b.id).model,
!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var b=this.explorer.getNavHandler().getSelectionIds(),d=this._getUIStatePreferencePath();d&&window.sessionStorage&&(window.sessionStorage[d+"selection"]=JSON.stringify(b))}},_restoreSelections:function(b){var d=this.explorer.getNavDict(),a=this.explorer.getNavHandler();if(a&&d&&a.getSelectionPolicy()!=="cursorOnly"&&(b=window.sessionStorage[b+"selection"],typeof b==="string"&&(b=b.length>0?JSON.parse(b):null),b)){for(var c=[],a=0;a<
b.length;a++){var h=d.getValue(b[a]);if(h&&h.rowDomNode&&h.model&&(c.push(h.model),this._highlightSelection&&h.rowDomNode.classList.add("checkedRow"),h=j.node(this.getCheckBoxId(h.rowDomNode.id))))h.checked=!0,h.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(c),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(b){window.sessionStorage[b+"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(b){var d=
!1,a=window.sessionStorage[b+"expanded"];typeof a==="string"&&(a=a.length>0?JSON.parse(a):null);var c;if(a)for(c=0;c<a.length;c++)if(j.node(a[c])){this._expanded.push(a[c]);var h=this;this.tableTree.expand(a[c],function(){h._restoreSelections(b)});d=!0}return!d},_getUIStatePreferencePath:function(){if(this.explorer){var b=this.explorer.getRootPath();if(this._cachePrefix&&b)return"/"+this._cachePrefix+"/"+b.replace(/[^\.\:\-\_0-9A-Za-z]/g,"")+"/uiState"}return null},expandCollapseImageId:function(b){return b+
"__expand"},updateExpandVisuals:function(b,d){var a=j.node(this.expandCollapseImageId(b.id));a&&(a.classList.remove(this._expandImageClass),a.classList.remove(this._collapseImageClass),a.classList.remove(this._progressImageClass),a.classList.add(d==="progress"?this._progressImageClass:d?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(b,d,a,c){var h=document.createElement("span");h.id=this.expandCollapseImageId(b.id);d.appendChild(h);h.classList.add(this._twistieSpriteClass);
h.classList.add(this._collapseImageClass);if(a){var f=document.createElement("span");d.appendChild(f);f.classList.add(c||"imageSprite");f.classList.add(a)}var g=this;h.onclick=function(){if(!g.explorer.getNavHandler().isDisabled(b)){g.tableTree.toggle(b.id);if(g.tableTree.isExpanded(b.id))g._expanded.push(b.id),g.explorer.postUserExpand&&g.explorer.postUserExpand(b.id);else for(var a in g._expanded)if(g._expanded[a]===b.id){g._expanded.splice(a,1);break}(a=g._getUIStatePreferencePath())&&window.sessionStorage&&
g._storeExpansions(a)}};return h},render:function(b,d){d.classList.add("navRow");this.renderRow(b,d)},rowsChanged:function(){this.explorer.selectionPolicy!=="cursorOnly"&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());(j.$(".sectionTreeTable",this.tableNode.parentNode)||j.$(".treetable",this.tableNode.parentNode))&&j.$$array(".treeTableRow",this.tableNode).forEach(function(b,d){var a=!(d%2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",c=a==="darkSectionTreeTableRow"?"lightSectionTreeTableRow":
"darkSectionTreeTableRow";b.classList.add(a);b.classList.remove(c)})},updateCommands:function(){if(this.commandService)for(var b=j.$$array(".treeTableRow"),d=0;d<b.length;d++){var a=b[d],c=j.node(a.id+"actionswrapper");this.commandService.destroy(c);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,c,a._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=[];var b=this._getUIStatePreferencePath();b&&window.sessionStorage&&this._restoreExpansions(b)&&this._restoreSelections(b)}};
return b}();b.SelectionRenderer=function(){function c(b,d){this._init(b);this.explorer=d}c.prototype=new b.ExplorerRenderer;c.prototype.renderTableHeader=function(b){var d=document.createElement("thead"),a=document.createElement("tr");d.classList.add("navTableHeading");this._useCheckboxSelection&&a.appendChild(this.initCheckboxColumn(b));for(var c=0,h=this.getCellHeaderElement(c);h;)h.innerHTML.length>0&&h.classList.add("navColumn"),a.appendChild(h),h=this.getCellHeaderElement(++c);d.appendChild(a);
c>0&&b.appendChild(d)};c.prototype.renderRow=function(b,d){d.verticalAlign="baseline";d.classList.add("treeTableRow");var a=this.explorer.getNavDict();if(a){a.addRow(b,d);var c=this;d.addEventListener("click",function(a){if(c.explorer.getNavHandler())c.explorer.getNavHandler().onClick(b,a)},!1)}if(a=this.getCheckboxColumn(b,d))a.classList.add("checkColumn"),d.appendChild(a);for(var a=0,h=this.getCellElement(a,b,d);h;)d.appendChild(h),a===0?this.getPrimColumnStyle?h.classList.add(this.getPrimColumnStyle(b)):
h.classList.add("navColumn"):this.getSecondaryColumnStyle?h.classList.add(this.getSecondaryColumnStyle()):h.classList.add("secondaryColumn"),h=this.getCellElement(++a,b,d)};c.prototype.getCellHeaderElement=function(){};c.prototype.getCellElement=function(){};return c}();b.SimpleFlatModel=function(){function c(b,d,a){this.items=b;this.getKey=a;this.idPrefix=d;this.root={children:b}}c.prototype=new b.ExplorerModel;c.prototype.getRoot=function(b){b(this.root)};c.prototype.getId=function(b){for(var b=
this.getKey(b).replace(/[\\\/]/g,""),d="",a=0;a<b.length;a++)d+=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?b.charCodeAt(a):b[a];return this.idPrefix+d};c.prototype.getChildren=function(b,d){b===this.root?d(this.items):d([])};return c}();return b});
define("orion/URITemplate",[],function(){function i(a){this._text=a}function k(a){return a.replace("%25","%")}function j(a,b){if(b==="U")return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if(b==="U+R")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(d,k);if(b==="U+R-,")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function g(a,d,b){for(var e=
[],c=0;c<a.length;c++)typeof a[c]!=="undefined"&&e.push(j(a[c],d));return e.join(b)}function c(a,d,b,e){for(var c=Object.keys(a),h=[],f=0;f<c.length;f++)typeof a[c[f]]!=="undefined"&&h.push(j(c[f],d)+b+j(a[c[f]],d));return h.join(e)}function f(a){if(a.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=h[a[0]])?a=a.substring(1):this._operator=h.NUL;for(var d=[],b=a.split(","),c=0;c<b.length;c++){var f=b[c].match(e);if(f===null)throw Error("Bad VarSpec: "+a);d.push({name:f[1],
explode:!!f[2],prefix:f[3]?parseInt(f[3],10):-1})}this._varSpecList=d}function b(a){for(var d=[],b=0,e=a.indexOf("{",b);e!==-1;){d.push(new i(a.substring(b,e)));b=a.indexOf("}",e+1);if(b===-1)throw Error("Invalid template: "+a);d.push(new f(a.substring(e+1,b)));b+=1;e=a.indexOf("{",b)}d.push(new i(a.substring(b)));this._templateComponents=d}var h={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"&",named:!0,ifemp:"=",allow:"U"},"&":{first:"&",sep:"&",named:!0,ifemp:"=",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},e=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,d=/%25[0-9A-F][0-9A-F]/g;i.prototype={expand:function(){return encodeURI(this._text)}};
f.prototype={expand:function(a){for(var d=[],b=0;b<this._varSpecList.length;b++){var e=this._varSpecList[b],h=e.name,f=a[h],s=typeof f;if(s!=="undefined"&&f!==null){var i=d.length===0?this._operator.first:this._operator.sep;if(s==="string")this._operator.named&&(i+=j(h,"U+R"),i+=f.length===0?this._operator.ifemp:"="),e.prefix!==-1&&e.prefix<f.length&&(f=f.substring(0,e.prefix)),i+=j(f,this._operator.allow);else if(Array.isArray(f)){if(f.length===0)continue;e.explode?i+=g(f,this._operator.allow,this._operator.sep):
(e=g(f,this._operator.allow,","),this._operator.named&&(i+=j(h,"U+R"),i+=e.length===0?this._operator.ifemp:"="),i+=e)}else if(s==="object"){if(Object.keys(f).length===0)continue;e.explode?i+=c(f,this._operator.allow,"=",this._operator.sep):(e=c(f,this._operator.allow,",",","),this._operator.named&&(i+=j(h,"U+R"),i+=e.length===0?this._operator.ifemp:"="),i+=e)}else throw Error("bad param type: "+h+" : "+s);d.push(i)}}return d.join("")}};b.prototype={expand:function(a){for(var d=[],b=0;b<this._templateComponents.length;b++)d.push(this._templateComponents[b].expand(a));
return d.join("")}};return b});
define("orion/i18nUtil",["require","orion/Deferred"],function(i,k){function j(c){if(c=localStorage.getItem("orion/messageBundle/"+c))if(c=JSON.parse(c),c._expires&&c._expires>(new Date).getTime())return delete c._expires,c;return null}var g={};return{getMessageBundle:function(c){function f(a){a?i(["i18n!"+c],function(a){if(a){var d=c;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+d,JSON.stringify(a));delete a._expires}h.resolve(a)}):b(Error(c))}function b(a){h.reject(a)}
if(g[c])return g[c];var h=new k;g[c]=h;var e=j(c);if(e)return h.resolve(e),h;try{i([c],f,b)}catch(d){i(["orion/i18n!"+c],f,b)}return h},formatMessage:function(c){var f=arguments;return c.replace(/\$\{([^\}]+)\}/g,function(b,c){return f[(c<<0)+1]})}}});
define("orion/edit/editorContext",[],function(){return{getEditorContext:function(i){var k=Object.create(null);i.getServiceReferences("orion.edit.context").forEach(function(j){var g=i.getService(j);Object.keys(g).forEach(function(c){typeof g[c]==="function"&&(k[c]=g[c].bind(g))})});return k},getOptions:function(i){var k=Object.create(null);i.getServiceReferences("orion.edit.context").forEach(function(j){j.getPropertyKeys().forEach(function(g){g!=="service.id"&&g!=="service.names"&&g!=="objectClass"&&
(k[g]=j.getProperty(g))})});return k}}});
define("orion/keyBinding",["orion/util"],function(i){function k(g,c,f,b,h,e){this.type=e||"keydown";this.keyCode=typeof g==="string"&&this.type==="keydown"?g.toUpperCase().charCodeAt(0):g;this.mod1=c!==void 0&&c!==null?c:!1;this.mod2=f!==void 0&&f!==null?f:!1;this.mod3=b!==void 0&&b!==null?b:!1;this.mod4=h!==void 0&&h!==null?h:!1}function j(g){this.keys=g}k.prototype={getKeys:function(){return[this]},match:function(g,c){if(c!==void 0){if(c!==0)return!1}else if(g instanceof Array){if(g.length>1)return!1;
g=g[0]}return g.type!==this.type?!1:this.keyCode===g.keyCode||this.keyCode===String.fromCharCode(i.isOpera?g.which:g.charCode!==void 0?g.charCode:g.keyCode)?this.mod1!==(i.isMac?g.metaKey:g.ctrlKey)?!1:this.type==="keydown"&&this.mod2!==g.shiftKey?!1:this.mod3!==g.altKey?!1:i.isMac&&this.mod4!==g.ctrlKey?!1:!0:!1},equals:function(g){return!g?!1:this.keyCode!==g.keyCode?!1:this.mod1!==g.mod1?!1:this.mod2!==g.mod2?!1:this.mod3!==g.mod3?!1:this.mod4!==g.mod4?!1:this.type!==g.type?!1:!0}};j.prototype=
{getKeys:function(){return this.keys.slice(0)},match:function(g,c){var f=this.keys;if(c!==void 0)return c>f.length?!1:f[c].match(g)?c===f.length-1?!0:c+1:!1;else{g instanceof Array||(g=[g]);if(g.length>f.length)return!1;var b;for(b=0;b<g.length;b++)if(!f[b].match(g[b]))return!1;return b===f.length?!0:b}},equals:function(g){if(!g.keys)return!1;if(g.keys.length!==this.keys.length)return!1;for(var c=0;c<g.keys.length;c++)if(!g.keys[c].equals(this.keys[c]))return!1;return!0}};return{KeyBinding:k,KeyStroke:k,
KeySequence:j}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(i,k,j){function g(c,f){this._activeContainer=null;this._getElementsFunction=c;this._toolbarLayoutFunction=f}g.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&j.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&j.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();if(this._oldFocusNode)this._oldFocusNode.focus(),this._oldFocusNode=null}this._activeElements=null},open:function(c,f,b){typeof c==="string"&&(c=j.node(c));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===c)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(c))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=b;var h=f(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!h)return!1;this._activeElements.focusNode=h;c=j.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(c.length===0){f=this._activeElements.dismissArea||
this._activeElements.parameterArea;c=document.createElement("button");c.id="closebox";c.className="imageSprite core-sprite-close dismissButton";c.title=i.Close;f.appendChild(c);var e=this;c.addEventListener("click",function(){e.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);if(h)this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){h.focus();h.select&&h.select()},0);this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(c,f){j.$$array("input",f).forEach(function(b){b.type==="checkbox"?c.parameters.setValue(b.parameterName,b.checked):b.type!=="button"&&c.parameters.setValue(b.parameterName,b.value.trim())});j.$$array("textArea",f).forEach(function(b){c.parameters.setValue(b.parameterName,b.value.trim())});c.command.callback&&c.command.callback.call(c.handler,c)},collectParameters:function(c){return c.parameters?
(c.domNode&&c.domNode.classList.add("commandMarker"),this.open(c.domNode||c.domParent,this.getFillFunction(c))):!1},getFillFunction:function(c,f){var b=this;return function(h,e){var d=null,a=function(){f&&f();b.close()},m=function(d){d.keyCode===j.KEY.ENTER&&b._collectAndCall(c,h);if(d.keyCode===j.KEY.ESCAPE||d.keyCode===j.KEY.ENTER)a(),j.stop(d)};c.parameters.forEach(function(b){var e=null;if(b.label)e=document.createElement("label"),e.classList.add("parameterInput"),e.setAttribute("for",b.name+
"parameterCollector"),e.textContent=b.label,h.appendChild(e);var f=b.name+"parameterCollector",g,e=e||h;if(b.type==="text"&&typeof b.lines==="number"&&b.lines>1)g=document.createElement("textarea"),g.rows=b.lines,g.type="textarea",g.id=f,e.appendChild(g),m=function(d){d.keyCode===j.KEY.ESCAPE&&(a(),j.stop(d))};else if(b.type==="boolean"){if(g=document.createElement("input"),g.type="checkbox",g.id=f,e.appendChild(g),b.value)g.checked=!0}else if(g=document.createElement("input"),g.type=b.type,g.id=
f,e.appendChild(g),b.value)g.value=b.value;g.classList.add("parameterInput");g.setAttribute("speech","speech");g.setAttribute("x-webkit-speech","x-webkit-speech");g.parameterName=b.name;d||(d=g);b.eventListeners.length>0&&b.eventListeners.forEach(function(a){g.addEventListener(a.event,function(d){return a.handler(d,c)},a.capture)});g.addEventListener("keydown",m,!1)});var g=e;g||(g=document.createElement("span"),g.classList.add("layoutRight"),g.classList.add("parametersDismiss"),h.appendChild(g));
var q=function(a,d){var b=document.createElement("button");d.appendChild(b);a&&b.appendChild(document.createTextNode(a));b.classList.add("dismissButton");return b};if(c.parameters.hasOptionalParameters())c.parameters.optionsRequested=!1,q(i.More,g).addEventListener("click",function(){c.parameters.optionsRequested=!0;b._collectAndCall(c,h);a()},!1);q(i.Submit,g).addEventListener("click",function(){b._collectAndCall(c,h);a()},!1);g=q(null,g);g.id="closebox";g.classList.add("imageSprite");g.classList.add("core-sprite-close");
g.title=i.Close;g.addEventListener("click",function(){a()},!1);return d}}};g.prototype.constructor=g;return{CommandParameterCollector:g}});define("orion/regex",[],function(){return{escape:function(i){return i.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")},parse:function(i){return(i=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(i))?{pattern:i[1],flags:i[2]}:null}}});
define("orion/contentTypes",[],function(){function i(d,a){function b(a,d,e,c){var e=d.filename.indexOf(e)>=0,h;h=c.toLowerCase();h=d.extension.indexOf(h)!==-1;if(e||h){if(!(h=!a))e&&(c=c.toLowerCase(),e=a.extension.indexOf(c)!==-1),h=e;if(h)return d}return a}if(typeof d!=="string")return null;for(var e=d&&d.split(".").pop(),c=null,h=0;h<a.length;h++){var f=a[h];b(c,f,d,e)===f&&(c=f)}return c}function k(d){return d===null||typeof d==="undefined"?[]:Array.isArray(d)?d:[d]}function j(d){return k(d).map(function(a){return String.prototype.toLowerCase.call(a)})}
function g(d){return{id:d.id,name:d.name,image:d.image,imageClass:d.imageClass,"extends":d["extends"],extension:j(d.extension),filename:k(d.filename)}}function c(d){var a=Object.create(null);d.map(g).forEach(function(d){Object.prototype.hasOwnProperty.call(a,d.id)||(a[d.id]=d)});return a}function f(d){if(d&&d.registerService){this.serviceRegistry=d;for(var a=d.getServiceReferences(h).concat(d.getServiceReferences(e)),f=[],g=0;g<a.length;g++)for(var q=k(a[g].getProperty("contentTypes")),o=0;o<q.length;o++)f.push(q[o]);
this.map=c(f);d.registerService(b,this)}else if(Array.isArray(d))this.serviceRegistry=null,this.map=c(d);else throw Error("Invalid parameter");}var b="orion.core.contentTypeRegistry",h="orion.core.contenttype",e="orion.file.contenttype";f.prototype={getContentTypes:function(){var d=this.getContentTypesMap(),a=[],b;for(b in d)Object.prototype.hasOwnProperty.call(d,b)&&a.push(d[b]);return a},getContentTypesMap:function(){return this.map},getFileContentType:function(d){return i(d.Name,this.getContentTypes())},
getFilenameContentType:function(d){return i(d,this.getContentTypes())},getContentType:function(d){return this.map[d]||null},isExtensionOf:function(d,a){d=typeof d==="string"?this.getContentType(d):d;a=typeof a==="string"?this.getContentType(a):a;if(!d||!a)return!1;if(d.id===a.id)return!0;else for(var b=d,e={};b&&(b=this.getContentType(b["extends"]));){if(b.id===a.id)return!0;if(e[b.id])throw Error("Cycle: "+b.id);e[b.id]=!0}return!1},isSomeExtensionOf:function(d,a){for(var b=0;b<a.length;b++)if(this.isExtensionOf(d,
a[b]))return!0;return!1}};return{ContentTypeRegistry:f,getFilenameContentType:i}});
define("orion/PageLinks","require,orion/Deferred,orion/PageUtil,orion/URITemplate,orion/i18nUtil,orion/objects,orion/URL-shim".split(","),function(i,k,j,g,c,f){function b(){return i.toUrl?(new URL(i.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function h(a){var b={};a.getPropertyKeys().forEach(function(d){d!=="objectClass"&&d!=="service.names"&&d!=="service.id"&&d!=="__plugin__"&&(b[d]=a.getProperty(d))});return b}function e(a){return c.getMessageBundle(a.nls).then(function(d){a.textContent=
a.nameKey?d[a.nameKey]:a.name;return a},function(){a.textContent=a.nameKey||a.name;return a})}function d(a,d){var c=a.getServiceReferences(d||"orion.page.link"),f=j.matchResourceParameters(window.location.href),m={OrionHome:b(),Location:f.resource},n=[];c.forEach(function(a){a=h(a);if(a.uriTemplate&&(a.nls||a.name)){var d=(new g(a.uriTemplate)).expand(m),d=j.validateURLScheme(d);a.href=d;a.nls?n.push(e(a)):(a.textContent=a.name,n.push((new k).resolve(a)))}});return k.all(n)}function a(a){var d=this.categories=
Object.create(null);a.forEach(function(a){d[a.id]=a})}function m(a){this.allPageLinks=a;this.allPageLinks.sort(n)}function n(a,d){var b=a.textContent&&a.textContent.toLowerCase(),e=d.textContent&&d.textContent.toLowerCase();return b<e?-1:b>e?1:0}var q;f.mixin(a.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});f.mixin(m.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var d=a.href,a=
a.textContent,b=document.createElement("a");b.href=d;b.target="_self";b.classList.add("targetSelector");b.textContent=a;return b})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(d){var b;return!q?(b=[],d.getServiceReferences("orion.page.link.category").forEach(function(a){a=h(a);if(a.id&&(a.name||a.nameKey))a.nls?b.push(e(a)):(a.textContent=a.name,b.push((new k).resolve(a)))}),k.all(b).then(function(d){return q=new a(d)})):(new k).resolve(q)},getPageLinksInfo:function(a,
b){return d(a,b).then(function(a){return new m(a)})},getOrionHome:b}});
define("orion/extensionCommands","require,orion/Deferred,orion/commands,orion/regex,orion/contentTypes,orion/URITemplate,orion/i18nUtil,orion/URL-shim,orion/PageLinks,i18n!orion/edit/nls/messages".split(","),function(i,k,j,g,c,f,b,h,e,d){function a(a){var d={};a.getPropertyKeys().forEach(function(b){d[b]=a.getProperty(b)});return d}var m={},n=e.getOrionHome();m._cloneItemWithoutChildren=function s(a){if(a===null||typeof a!=="object")return a;var d=a.constructor(),b;for(b in a)b!=="children"&&b!==
"Children"&&(d[b]=s(a[b]));return d};m._getOpenWithNavCommandExtensions=function(a){function d(a,b){for(var l=a.getServiceReferences("orion.navigate.openWith"),e=[],c=[],h=0;h<l.length;h++){var r=l[h];if(r.getProperty("editor")===b.id){var f=r.getProperty("contentType");f instanceof Array?e=e.concat(f):e.push(f||"*/*");r=r.getProperty("excludedContentTypes");r instanceof Array?c=c.concat(r):r!==null&&typeof r!=="undefined"&&c.push(r)}}0===e.length&&(e=null);0===c.length&&(c=null);return{contentTypes:e,
excludedContentTypes:c}}for(var b=function(){for(var b=a.getServiceReferences("orion.edit.editor"),d=[],l=0;l<b.length;l++){var e=b[l],c=e.getProperty("id");d.push({id:c,"default":e.getProperty("default")||!1,name:e.getProperty("name"),nameKey:e.getProperty("nameKey"),nls:e.getProperty("nls"),uriTemplate:e.getProperty("orionTemplate")||e.getProperty("uriTemplate"),validationProperties:e.getProperty("validationProperties")||[]})}return d}(),e=[],c=0;c<b.length;c++){var l=b[c],h=d(a,l);e.push({properties:{name:l.name||
l.id,nameKey:l.nameKey,id:"eclipse.openWithCommand."+l.id,contentType:h.contentTypes,excludedContentTypes:h.excludedContentTypes,uriTemplate:l.uriTemplate,nls:l.nls,forceSingleItem:!0,isEditor:l["default"]?"default":"editor",validationProperties:l.validationProperties},service:{}})}return e};m._makeValidator=function(a,b,d,e){function h(a,b,d,l){var e=d.match,c,f;if((c=b.indexOf("["))>=0){if((f=b.indexOf("]"))<0)return!1;var m=b.substring(0,c),g;if(!(g=a[m])||!Array.isArray(g))return!1;c=b.substring(c+
1,f);c=parseInt(c,10);if(isNaN(c))return!1;c<0&&(c+=g.length);b=b.substring(f+1);b=m+":"+String(c)+b}if(b.indexOf("|")>=0)return c=b.substring(0,b.indexOf("|")),b=b.substring(b.indexOf("|")+1),h(a,c,d,l)?!0:h(a,b,d,l);else if(b.indexOf(":")>=0)return c=b.substring(0,b.indexOf(":")),b=b.substring(b.indexOf(":")+1),a[c]?h(a[c],b,d,l):!1;else{a:{var m=!1,n;if(b.charAt(0)==="!")d=typeof a[b.substring(1)]==="undefined";else if(typeof a[b]!=="undefined"){if(typeof e==="undefined")n=a[b],m=!0;else if(typeof e===
"string"){if(!typeof(a[b]==="string")){d=!1;break a}if(d.variableName){if(e=RegExp(e).exec(a[b]))n=e[0],n=d.variableMatchPosition==="before"?a[b].substring(0,e.index):d.variableMatchPosition==="after"?a[b].substring(e.index+n.length):d.variableMatchPosition==="only"?n:a[b],m=!0}else{d=RegExp(e).test(a[b]);break a}}else a[b]===e&&(n=a[b],m=!0);if(m&&d.variableName&&(l[d.variableName]=n,l.itemCached=a,d.replacements))for(a=0;a<d.replacements.length;a++)n=!1,d.replacements[a].pattern?l[d.variableName]=
l[d.variableName].replace(RegExp(d.replacements[a].pattern),d.replacements[a].replacement||""):n=!0,n&&window.console.log("Invalid replacements specified in validation property.  "+d.replacements[a]);d=m}else d=!1}return d}}function l(b,d,l){if(l.info.validationProperties)for(var e=0;e<l.info.validationProperties.length;e++){var f=l.info.validationProperties[e];if(typeof f.source!=="undefined"){if(!h(b,f.source,f,l))return!1}else return window.console.log("Invalid validationProperties in "+a.id+".  No source property specified."),
!1}var e=!0,m=d?c.getFilenameContentType(b.Name,d):null,m=m||{id:"application/octet-stream"};l.info.excludedContentTypes&&d&&(e=l.info.excludedContentTypes.every(function(a){a=a.replace(/([*?])/g,".$1");return-1!==m.id.search(a)?!1:!0}));e&&l.info.contentType&&d&&(e=l.info.contentType.some(function(a){a=a.replace(/([*?])/g,".$1");return-1!==m.id.search(a)?!0:!1}));return e}return{info:a,validationFunction:function(a){typeof e==="function"&&(a=e.call(this,a));if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||
this.info.uriTemplate)&&a.length!==1)return!1;if(a.length<1)return!1}else a=[a];for(var b=0;b<a.length;b++)if(!l(a[b],d,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var b={},d;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&(b[d]=a[d]);if(this.info.validationProperties)for(d=0;d<this.info.validationProperties.length;d++){var l=this.info.validationProperties[d];l.source&&l.variableName&&(this.itemCached===
a&&this[l.variableName]||h(a,l.source,l,this),a[l.variableName]?window.console.log("Variable name "+l.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):b[l.variableName]=this[l.variableName])}b.OrionHome=n;return(new f(this.info.uriTemplate)).expand(b)}return null}}};var q=d.UnnamedCommand;m._createCommandOptions=function(a,d,e,c,h,l){function f(b,r){var g=m._makeValidator(a,e,c,l);b.visibleWhen=g.validationFunction.bind(g);if(h)if(g.generatesURI.bind(g)())b.hrefCallback=
function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return g.getURI.bind(g)(a)};else{var y=a;b.callback=function(a){var l;if(y.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,l=m._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){l=[];for(var c=0;c<a.items.length;c++)l.push(m._cloneItemWithoutChildren(a.items[c]))}else l=m._cloneItemWithoutChildren(a.items);if(e)var h=e.getService("orion.page.progress");d.run?h?h.progress(d.run(l),"Running command: "+b.name):d.run(l):e&&
(h?h.progress(e.getService(d).run(l),"Running command: "+b.name):e.getService(d).run(l))}}r.resolve(b)}var g=new k;if(a.nls){var x=function(b){var d;b?(d=a.tooltipKey&&b[a.tooltipKey],b=a.nameKey&&b[a.nameKey]||a.name||q,d=d||a.tooltip||""):(b=a.name||a.nameKey||q,d=a.tooltip||a.tooltipKey||"");f({name:b,image:a.image,id:a.id||a.name,tooltip:d,isEditor:a.isEditor,showGlobally:a.showGlobally},g)};b.getMessageBundle(a.nls).then(x,x.bind(this,null))}else f({name:a.name,image:a.image,id:a.id||a.name,
tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},g);return g};m.getOpenWithCommand=function(a,b,d){for(var e,a=d||m.getOpenWithCommands(a),d=0;d<a.length;d++)if(a[d].visibleWhen(b)){var c=a[d].isEditor==="default";if(!e||c)if(e=a[d],c)break}return e};m.getOpenWithCommands=function(a){var b=[],d;for(d in a._commandList){var e=a._commandList[d];e.isEditor&&b.push(e)}return b};var o;m.createAndPlaceFileCommandsExtension=function(a,b,e,c,h,l){return m.createFileCommands(a,null,l?"all":
void 0,!!l,b).then(function(a){h&&0<a.length&&(b.addCommandGroup(e,"eclipse.openWith",1E3,d.OpenWith,h,null,null,null,"dropdownSelection"),b.addCommandGroup(e,"eclipse.fileCommandExtensions",1E3,d.OpenRelated,h));a.forEach(function(a){var d=null;h&&(d=a.isEditor?h+"/eclipse.openWith":h+"/eclipse.fileCommandExtensions");b.registerCommandContribution(e,a.id,c,d)});return{}})};m.createFileCommands=function(a,b,d,e,c){var d=d===void 0?"global":d,e=e===void 0?!0:e,l=[];m._cachedFileCommands||m._createCachedFileCommands(a);
(d==="all"||d==="global")&&m._cachedFileCommands.forEach(function(a){var b=a.properties;(d==="all"||b.forceSingleItem&&b.showGlobally)&&l.push(a)});return k.when(function(){var d=a.getService("orion.core.contentTypeRegistry")||b;return o||k.when(d.getContentTypes(),function(a){return o=a})}(),function(){if(e){if(!m._cachedOpenWithExtensions)m._cachedOpenWithExtensions=m._getOpenWithNavCommandExtensions(a,o);l=l.concat(m._cachedOpenWithExtensions);c._addedOpenWithCommands=e}var b=l.map(function(b){var d=
b.properties,b=b.service,l=c.findCommand(d.id||d.name);return l?(new k).resolve(l):m._createCommandOptions(d,b,a,o,!0).then(function(a){a=new j.Command(a);c.addCommand(a);return a})});return k.all(b,function(a){return{_error:a}}).then(function(a){return a})})};m._createCachedFileCommands=function(b){var d=b.getServiceReferences("orion.navigate.command");m._cachedFileCommands=[];for(var e=0;e<d.length;e++)if(d[e].getProperty("id")!=="orion.navigateFromMetadata"){var c=b.getService(d[e]),h=a(d[e]);
m._cachedFileCommands.push({properties:h,service:c})}};m.getFileCommandIds=function(){var a=[];if(m._cachedFileCommands)m._cachedFileCommands.length&&(a=m._cachedFileCommands.map(function(a){return a.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return a};m.createOpenWithCommands=function(a,b,d){return d&&d._addedOpenWithCommands?(new k).resolve(m.getOpenWithCommands(d)):m.createFileCommands(a,b,"none",!0,d)};return m});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(i,k){function j(g){this._init(g)}j.prototype={_init:function(g){var c=k.node(g.container);if(!c)throw"no parent container";this._container=c;c.classList.remove("currentLocation");this._id=g.id||"eclipse.breadcrumbs";this._resource=g.resource||null;this._rootSegmentName=g.rootSegmentName;this._workspaceRootSegmentName=g.workspaceRootSegmentName;this._workspaceRootURL=g.workspaceRootURL;this._makeHref=g.makeHref;this._makeFinalHref=
g.makeFinalHref;this._maxLength=g.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var g;if(this._resource&&this._resource.Parents&&!this._resource.skip){g=document.createElement("a");var c=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(g,c):g.href=i.toUrl("edit/edit.html")+"#"+c}else g=document.createElement("span");k.empty(g);g.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return g}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(g){var c=document.createElement("a");c.classList.add("breadcrumb");c.appendChild(document.createTextNode(g));return c},addSegmentHref:function(g,c){this._makeHref?this._makeHref(g,c.Location,c):g.href=i.toUrl("edit/edit.html")+"#"+c.ChildrenLocation},buildSegments:function(g,c){if(this._resource.Parents){var f=this._resource.Parents.slice(0),b,h;f&&(f=f.slice(0),c==="reverse"&&(f=f.reverse().slice(0)),
f.forEach(function(e){if(!e.skip)g?(h=g,g=null):h=e.Name,b=this.buildSegment(h),this.path+=e.Name,this.addSegmentHref(b,e),b.include=!1,this.segments.push(b)}.bind(this)))}},addDivider:function(){var g=document.createElement("span");g.appendChild(document.createTextNode(" / "));this.path+="/";g.classList.add("breadcrumbSeparator");this.append(g)},refresh:function(){(this.crumbs=k.node(this._id))?k.empty(this.crumbs):(this.crumbs=document.createElement("span"),this.crumbs.id=this._id,this._container.appendChild(this.crumbs),
this.dirty=document.createElement("span"),this.dirty.id="dirty",this.dirty.className="modifiedFileMarker",this._container.appendChild(this.dirty));this.crumbs.style.width="auto";this.crumbs.style.visibility="visible";this.crumbs.parentNode.className="currentLocation";this.crumbs.parentNode.style.width="auto"},append:function(g){this.crumbs.appendChild(g)},addTitle:function(g,c){var f=c||document.title;this.crumbs.childNodes.length===0&&(g=document.createElement("span"),g.appendChild(document.createTextNode(f)),
g.classList.add("breadcrumb"),g.classList.add("currentLocation"),this.append(g))},finalSegment:function(g,c){if(!this._resource.skip){var f;f=c?c:this._resource.Name;this._makeFinalHref?(g=this.buildSegment(f),this.addSegmentHref(g,this._resource)):(g=document.createElement("span"),g.appendChild(document.createTextNode(f)));g.classList.add("currentLocation");this.path+=this._resource.Name;this.append(g)}},firstSegment:function(g){if(g)if(this.append(g),this._resource&&this._resource.Parents&&!this._resource.skip)g.classList.add("breadcrumb"),
this.addDivider();else{if(!this._resource.skip)g.href="";g.classList.add("currentLocation")}},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(g){g.include===!0&&(this.append(g),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var g=this.segments.slice(0).reverse();g.forEach(function(c){this.append(c);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?c.include=!0:this.INCLUDE_FIRST_SECTION=
!1}.bind(this));this.segments=g.reverse()}},measure:function(){var g=this._container;g.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:g.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var g=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;if(c)this.addTitle(g,c);else if(this.finalSegment(g,c),this._resource&&this._resource.Parents&&(this.buildSegments(c,"reverse"),this.measureSegments(),this.firstSegment(g)),this.crumbs.offsetWidth>=
this.MAX_LENGTH)this.INCLUDE_FIRST_SECTION=!1},render:function(){this.refresh();var g=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;c?this.addTitle(g,c):(this.INCLUDE_FIRST_SECTION===!0&&this.firstSegment(g),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(g,c)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};j.prototype.constructor=j;return{BreadCrumbs:j}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(i,k,j){function g(c){k.attach(this);this._init(c)}g.prototype={_init:function(c){this._tracking=null;this._animationDelay=501;this._closeReversely=c.closeReversely;this.$node=j.node(c.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=j.node(c.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=j.node(c.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=c.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");if(c.toggle)this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),this._thumb.classList.add("splitThumb"),this._thumb.classList.add(this._vertical?"splitVerticalThumbLayout":"splitThumbLayout");this._closeByDefault=this.$node.getAttribute("data-initial-state")==="closed";if(typeof c.closeByDefault!=="undefined")this._closeByDefault=c.closeByDefault;this._initializeFromStoredSettings();
this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition();this.$node.style.visibility="visible";this.$mainNode.style.display="block";this.$sideNode.style.display="block";this.$node.addEventListener("mousedown",this._mouseDown.bind(this),!1);window.addEventListener("mouseup",this._mouseUp.bind(this),!1);window.addEventListener("resize",this._resize.bind(this),!1)},isClosed:function(){return this._closed},toggleSidePanel:function(){this._thumbDown()},openSidePanel:function(){this._closed||
this._thumbDown()},addResizeListener:function(c){this.addEventListener("resize",function(f){c(f.node)})},_initializeFromStoredSettings:function(){var c=localStorage.getItem(this._prefix+"/toggleState");this._closed=typeof c==="string"?c==="closed":this._closeByDefault;var c=j.bounds(this.$node.parentNode),f=j.bounds(this.$node),b;if(this._vertical)if(b=localStorage.getItem(this._prefix+"/yPosition")){if(this._splitTop=parseInt(b,10),this._splitTop>c.top+c.height-f.height)this._splitTop=c.top+c.height/
2}else{if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitTop=0}else if(b=localStorage.getItem(this._prefix+"/xPosition")){if(this._splitLeft=parseInt(b,10),this._splitLeft>c.left+c.width-f.width)this._splitLeft=c.left+c.width/2}else if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitLeft=0},_getSplitPosition:function(){var c=j.bounds(this.$node),f=j.bounds(this.$node.parentNode);return this.vertical?c.top-f.top:c.left-f.left},_adjustToSplitPosition:function(c){var f=
j.bounds(this.$node),b=j.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=f.height;if(c||!this._splitTop)this._splitTop=f.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);c=this._splitTop;this.$node.parentNode.style.position==="relative"&&(c=this._splitTop-b.top);this.$sideNode.style.height=c+"px";this.$sideNode.style.display="block";this.$node.style.top=c+"px"}else{this._splitWidth=f.width;if(c||!this._splitLeft)this._splitLeft=f.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);c=this._splitLeft;this.$node.parentNode.style.position==="relative"&&(c=this._splitLeft-b.left);this.$sideNode.style.width=c+"px";this.$sideNode.style.display="block";this.$node.style.left=c+"px"}this._resize()},_resize:function(c,f,b){var c=c||0,h=j.bounds(this.$node.parentNode),e=j.bounds(this.$node);this._vertical?(b===void 0&&(b=e.top-h.top),b+=e.height,this.$mainNode.style.top=b+"px"):(f===void 0&&(f=e.left-h.left),f+=e.width,this.$mainNode.style.left=f+"px");var d=
this;window.setTimeout(function(){d._notifyResizeListeners(d.$mainNode);d._notifyResizeListeners(d.$sideNode)},c)},_notifyResizeListeners:function(c){this.dispatchEvent({type:"resize",node:c})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(c,f){c||this._addAnimation();var b=this._splitTop,h=this._splitLeft;if(this._closed){if(this._closed=!1,!this._splitLeft&&!this._splitTop&&typeof this._initialSplit==="number")b=h=this._initialSplit}else if(this._closed=
!0,this._closeReversely){var e=j.bounds(this.$node.parentNode),d=j.bounds(this.$node);this._vertical?b=e.height-d.height:h=e.width-d.width}else b=h=0;this._vertical?(this.$sideNode.style.height=b+"px",this.$node.style.top=b+"px"):(this.$sideNode.style.width=h+"px",this.$node.style.left=h+"px");this._resize(this._animationDelay,h,b);c||this._removeAnimation();f||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var a=this;window.setTimeout(function(){a._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var c=this;window.setTimeout(function(){c.$sideNode.classList.remove(c._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");c.$mainNode.classList.remove(c._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");c.$node.classList.remove(c._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add(this._vertical?"sidePanelVerticalLayoutAnimation":
"sidePanelLayoutAnimation");this.$mainNode.classList.add(this._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");this.$node.classList.add(this._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},_mouseDown:function(c){if(c.target===this._thumb)return j.stop(c),this._thumbDown();if(!this._tracking)this.$node.classList.add("splitTracking"),this.$mainNode.classList.add("panelTracking"),this.$sideNode.classList.add("panelTracking"),this._tracking=this._mouseMove.bind(this),
window.addEventListener("mousemove",this._tracking),j.setFramesEnabled(!1),j.stop(c)},_mouseMove:function(c){if(this._tracking){var f=j.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=c.clientY;if(this._splitTop<f.top+5)this._splitTop=f.top+5;else if(this._splitTop>f.top+f.height-5)this._splitTop=f.top+f.height-5;var b=this._splitTop,b=this._splitTop-f.top;this.$node.style.top=b+"px"}else{this._splitLeft=c.clientX;if(this._splitLeft<f.left+5)this._splitLeft=f.left+5;else if(this._splitLeft>
f.left+f.width-5)this._splitLeft=f.left+f.width-5;b=this._splitLeft;b=this._splitLeft-2*f.left;this.$node.style.left=b+"px"}this._adjustToSplitPosition(!0);j.stop(c)}},_mouseUp:function(c){if(this._tracking)j.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),this.$sideNode.classList.remove("panelTracking"),j.stop(c)}};g.prototype.constructor=g;return{Splitter:g}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(i,k,j){function g(c){this.commandRegistry=c.commandRegistry;this.create();this._filterString="";this._providers=[]}g.prototype={addProvider:function(c){this._providers.push(c)},create:function(){var c=this._keyAssistDiv=document.createElement("div");c.id="keyAssist";c.style.display="none";c.classList.add("keyAssistFloat");c.setAttribute("role","menu");var f=this._keyAssistInput=document.createElement("input");
f.classList.add("keyAssistInput");f.type="text";f.placeholder=i["Filter bindings"];c.appendChild(f);var b=this._keyAssistContents=document.createElement("div");b.classList.add("keyAssistContents");if(j.isIOS||j.isAndroid)b.style.overflowY="auto";c.appendChild(b);var h=this._keyAssistTable=document.createElement("table");h.tabIndex=0;h.classList.add("keyAssistList");b.appendChild(h);document.body.appendChild(c);f.addEventListener("keydown",function(b){this._keyDown(b)}.bind(this));h.addEventListener("keydown",
function(b){this._keyDown(b)}.bind(this));f.addEventListener("input",function(){this.filterChanged()}.bind(this));b.addEventListener(j.isFirefox?"DOMMouseScroll":"mousewheel",function(b){this._scrollWheel(b)}.bind(this));document.addEventListener("keydown",function(b){b.keyCode===k.KEY.ESCAPE&&this.hide()}.bind(this));k.addAutoDismiss([c],function(){this.hide()}.bind(this))},createContents:function(){k.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var c=this._idCount=
this._keyAssistContents.scrollTop=0;c<this._providers.length;c++)this._providers[c].showKeyBindings(this);this.createHeader(i.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(c,f,b){if(this._filterString){var h=this._filterString.toLowerCase(),e;h!==this._filterString?(h=this._filterString,e=function(a){return a}):e=function(a){return a.toLowerCase()};if(e(f).indexOf(h)===-1&&e(c).indexOf(h)===-1&&e(this._lastHeader).indexOf(h)===-1)return}var d=this._keyAssistTable.insertRow(-1);
d.id="keyAssist-keyBinding-"+this._idCount++;d.setAttribute("role","menuitem");d._execute=b;d.classList.add("keyAssistItem");d.addEventListener("click",function(a){this._selectedRow=d;this.execute();a.preventDefault()}.bind(this));b=d.insertCell(-1);b.classList.add("keyAssistName");b.appendChild(document.createTextNode(f));b=d.insertCell(-1);b.classList.add("keyAssistAccel");b.appendChild(document.createTextNode(c))},createHeader:function(c){this._lastHeader=c;var f=this._keyAssistTable.insertRow(-1);
f.classList.add("keyAssistSection");var f=f.insertCell(-1),b=document.createElement("h2");b.appendChild(document.createTextNode(c));f.appendChild(b)},execute:function(){window.setTimeout(function(){this.hide();var c=this._selectedRow;this._selectedRow=null;c&&c._execute&&c._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var c=this._keyAssistInput.value;if(this._filterString!==c)this._filterString=
c,this.createContents()}.bind(this),100)},hide:function(){if(this.isVisible()){var c=document.activeElement,f=this._keyAssistDiv,c=f===c||(f.compareDocumentPosition(c)&16)!==0;f.style.display="none";c&&document.compareDocumentPosition(this._previousActiveElement)!==1&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return this._keyAssistDiv.style.display==="block"},removeProvider:function(c){c=this._providers.indexOf(c);c!==-1&&this._providers.splice(c,
1)},select:function(c){var f=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(f.length===0)this._selectedIndex=-1;else{var b=this._selectedIndex;b+=c?1:-1;b%=f.length;b<0&&(b=f.length-1);if(this._selectedIndex!==-1)c=f[this._selectedIndex],c.classList.remove("selected"),this._selectedRow=null;this._selectedIndex=b;if(this._selectedIndex!==-1){this._selectedRow=c=f[this._selectedIndex];c.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",c.id);this._keyAssistTable.focus();
var f=c.getBoundingClientRect(),h=this._keyAssistContents,e=h.getBoundingClientRect();c.offsetTop<h.scrollTop?b===0?h.scrollTop=0:c.scrollIntoView(!0):f.bottom>e.bottom&&c.scrollIntoView(!1)}}},show:function(){if(!this.isVisible())this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(this._keyAssistDiv.parentNode.clientHeight*0.75)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),
this._keyAssistInput.select()},_keyDown:function(c){if(c.keyCode===40)this.select(!0);else if(c.keyCode===38)this.select(!1);else if(c.keyCode===13)this.execute();else return;c.preventDefault()},_scrollWheel:function(c){var f=0,f=j.isIE||j.isOpera?-c.wheelDelta:j.isFirefox?c.detail*40:-c.wheelDeltaY,b=this._keyAssistContents,h=b.scrollTop;b.scrollTop+=f;if(h!==b.scrollTop)return c.preventDefault&&c.preventDefault(),!1}};return{KeyAssistPanel:g}});
define("orion/widgets/themes/ThemePreferences",[],function(){function i(i,j){this._preferences=i;this._themeData=j;var g=j.getThemeStorageInfo();this._themeVersion=g.version;var c=i.listenForChangedSettings(g.storage,2,function(f){f.key===c&&this.apply()}.bind(this))}i.prototype={_initialize:function(i,j,g){var c,f;this._themeVersion===void 0||g.get("version")===this._themeVersion?(c=g.get(i.styleset),(f=g.get("selected"))&&(f=JSON.parse(f))):f=c=null;c||(c=j.getStyles(),g.put(i.styleset,JSON.stringify(c)));
if(!f||f[i.selectedKey]===void 0)f=f||{},f[i.selectedKey]=i.defaultTheme,g.put("selected",JSON.stringify(f));g.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(i){var j=this._themeData,g=j.getThemeStorageInfo();this._preferences.getPreferences(g.storage,2).then(function(c){this._initialize(g,j,c);var f=JSON.parse(c.get("selected")),c=JSON.parse(c.get(g.styleset)),b;if(c)for(var h=0;h<c.length;h++)if(c[h].name===f[g.selectedKey]){b=c[h];break}i({style:b,styles:c})}.bind(this))},
setTheme:function(i,j){var g=this._themeData,c=g.getThemeStorageInfo();this._preferences.getPreferences(c.storage,2).then(function(f){this._initialize(c,g,f);var b=JSON.parse(f.get("selected"));i||(i=b[c.selectedKey]);b[c.selectedKey]=i;f.put("selected",JSON.stringify(b));j?f.put(c.styleset,JSON.stringify(j)):j=JSON.parse(f.get(c.styleset));for(var h=0;h<j.length;h++)if(j[h].name===b[c.selectedKey]){g.processSettings(j[h]);break}f.put("version",this._themeVersion)}.bind(this))},setFontSize:function(i){var j=
this._themeData,g=j.getThemeStorageInfo();this._preferences.getPreferences(g.storage,2).then(function(c){this._initialize(g,j,c);var f=JSON.parse(c.get("selected")),b=JSON.parse(c.get(g.styleset)),h;if(b)for(var e=0;e<b.length;e++)b[e].fontSize=i,b[e].name===f[g.selectedKey]&&(h=b[e]);c.put(g.styleset,JSON.stringify(b));j.processSettings(h)}.bind(this))}};return{ThemePreferences:i}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
"Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value","JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item",
"Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",
EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",
smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",
scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair <Angle> Brackets",
autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated","Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:",
"Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color","Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute",
"Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute","CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: "});
define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/editor/eventTarget",[],function(){function i(){}i.addMixin=function(k){var j=i.prototype,g;for(g in j)j.hasOwnProperty(g)&&(k[g]=j[g])};i.prototype={addEventListener:function(i,j,g){if(!this._eventTypes)this._eventTypes={};var c=this._eventTypes[i];c||(c=this._eventTypes[i]={level:0,listeners:[]});c.listeners.push({listener:j,useCapture:g})},dispatchEvent:function(i){var j=i.type;this._dispatchEvent("pre"+j,i);this._dispatchEvent(j,i);this._dispatchEvent("post"+j,i)},_dispatchEvent:function(i,
j){var g=this._eventTypes?this._eventTypes[i]:null;if(g){var c=g.listeners;try{if(g.level++,c)for(var f=0,b=c.length;f<b;f++)if(c[f]){var h=c[f].listener;typeof h==="function"?h.call(this,j):h.handleEvent&&typeof h.handleEvent==="function"&&h.handleEvent(j)}}finally{if(g.level--,g.compact&&g.level===0){for(f=c.length-1;f>=0;f--)c[f]||c.splice(f,1);c.length===0&&delete this._eventTypes[i];g.compact=!1}}}},isListening:function(i){return!this._eventTypes?!1:this._eventTypes[i]!==void 0},removeEventListener:function(i,
j,g){if(this._eventTypes){var c=this._eventTypes[i];if(c){for(var f=c.listeners,b=0,h=f.length;b<h;b++){var e=f[b];if(e&&e.listener===j&&e.useCapture===g){c.level!==0?(f[b]=null,c.compact=!0):f.splice(b,1);break}}f.length===0&&delete this._eventTypes[i]}}}};return{EventTarget:i}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(i,k,j){function g(c){c=c||{};this._document=c.document||document}var c={};g.getTheme=function(f){var f=f||"default",b=c[f];b||(b=c[f]=new g);return b};g.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(c,b){var h=this,e=h._themeClass;h._themeClass=c;this._load(c,b,function(){h.onThemeChanged({type:"ThemeChanged",oldValue:e,newValue:h.getThemeClass()})})},onThemeChanged:function(c){return this.dispatchEvent(c)},
buildStyleSheet:function(c,b){function h(b,a,h){a&&(e.push("."+c+" ."+b+" {"),e.push("\t"+(h?"background-color":"color")+": "+a+";"),e.push("}"))}var e=[];e.push("");e.push("."+c+" {");b.fontFamily&&e.push("\tfont-family: "+b.fontFamily+";");b.fontSize&&e.push("\tfont-size: "+b.fontSize+";");b.fontSize&&e.push("\tcolor: "+b.text+";");e.push("}");e.push("."+c+".textview {");b.background&&e.push("\tbackground-color: "+b.background+";");e.push("}");h("ruler.annotations",b.annotationRuler,!0);h("ruler.lines",
b.annotationRuler,!0);h("ruler.folding",b.annotationRuler,!0);h("ruler.overview",b.overviewRuler,!0);h("rulerLines",b.lineNumber,!1);h("rulerLines.even",b.lineNumberEven,!1);h("rulerLines.odd",b.lineNumberOdd,!1);h("annotationLine.currentLine",b.currentLine,!0);h("entity-name-tag",b.keyword,!1);h("entity-other-attribute-name",b.attribute,!1);h("string-quoted",b.string,!1);h("meta.annotation.currentLine",b.currentLine,!0);h("keyword",b.keyword,!1);h("string",b.string,!1);h("comment",b.comment,!1);
h("comment.block.documentation",b.comment,!1);h("keyword.other.documentation.markup",b.comment,!1);return e.join("\n")},_createStyle:function(c,b,h,e){var d=this._document,c="orion-theme-"+c,a=d.getElementById(c);if(a){if(e||a.firstChild.data===b)return;a.removeChild(a.firstChild);a.appendChild(d.createTextNode(b))}else e?(a=j.createElement(d,"link"),a.rel="stylesheet",a.type="text/css",a.href=b,a.addEventListener("load",function(){h()})):(a=j.createElement(d,"style"),a.appendChild(d.createTextNode(b))),
a.id=c,(d.getElementsByTagName("head")[0]||d.documentElement).appendChild(a);e||h()},_load:function(c,b,h){if(c)if(typeof b==="string")this._createStyle(c,b,h);else if(b=b.href,b.substring(b.length-4)!==".css"&&(b+=".css"),/^\//.test(b)||/[a-zA-Z0-9]+:\/\//i.test(b)||!i.toUrl)this._createStyle(c,b,h,!0);else{var e=this;i(["text!"+b],function(b){e._createStyle(c,b,h,!1)})}else h()}};k.EventTarget.addMixin(g.prototype);return{TextTheme:g}});
define("orion/widgets/themes/ThemeClass",[],function(){function i(i){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=i;this.classString="."+i+"{ "}i.prototype.className=null;i.prototype.classString=void 0;i.prototype.style=void 0;i.prototype.closeString=" }\n";i.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:i}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(i){function k(){}k.prototype.navbar="white";k.prototype.button="#777777";k.prototype.location="#EFEFEF";k.prototype.selection="#cedce7";k.prototype.sidepanel="#F7F7F7";k.prototype.mainpanel="white";k.prototype.navtext="#bfbfbf";k.prototype.content="#3087B3";k.prototype.search="#444";k.prototype.toolpanel="white";k.prototype.writeNavigationStyle=function(){var j="",g=[],c=new i.ThemeClass("orionPage");
c.style.backgroundColor="#fdfdfd";c.style.width="100%";c.style.height="100%";g.push(c);c=new i.ThemeClass("topRowBanner");c.style.margin="0";c.style.border="0";c.style.backgroundColor=this.navbar;c.style.height="16px";c.style.padding="10px";c.style.paddingLeft="6px";c.style.paddingRight="2px";c.style.borderBottom="none";c.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";c.style.zIndex="100";g.push(c);c=new i.ThemeClass("a");c.style.textDecoration="none";c.style.color=
this.content;g.push(c);c=new i.ThemeClass("navlink");c.style.display="inline-block";c.style.padding="2px";c.style.color=this.content;c.style.verticalAlign="bottom";g.push(c);c=new i.ThemeClass("primaryNav");c.style.color=this.navtext;c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.paddingTop="0";c.style.verticalAlign="baseline";g.push(c);c=new i.ThemeClass("primaryNav a");c.style.fontSize="8pt";c.style.color=this.navtext;c.style.marginRight="6px";c.style.marginLeft="6px";c.style.verticalAlign=
"baseline";c.style.textDecoration="none";g.push(c);c=new i.ThemeClass("primaryNav a:hover");c.style.color="#bfbfbf";c.style.cursor="hand";c.style.color="white";c.style.fontWeight="normal";g.push(c);for(var f in g)j+=g[f].toString();return j};k.prototype.writeLocationStyle=function(){var j="",g=[],c=new i.ThemeClass("titleArea");c.style.margin="0";c.style.paddingTop="5px";c.style.border="0";c.style.background=this.location;c.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";c.style.borderBottom="1px solid "+this.location;c.style.minHeight="20px";g.push(c);c=new i.ThemeClass("breadcrumb");c.style.fontSize="8pt";c.style.textDecoration="none";c.style.color="#f1f1f2;";c.style.paddingTop="2px";g.push(c);c=new i.ThemeClass("a.breadcrumb:hover");c.style.textDecoration="none";c.style.borderBottom="1px dotted";c.style.color="#F58B0F";c.style.cursor="pointer";g.push(c);c=new i.ThemeClass("breadcrumbSeparator");c.style.fontSize=
"8pt";c.style.textDecoration="none";c.style.color=this.separator;c.style.fontWeight="bold";g.push(c);c=new i.ThemeClass("currentLocation");c.style.fontWeight="bold";c.style.fontSize="8pt";c.style.color=this.breadcrumb;c.style.textDecoration="none";c.style.textWrap="normal";c.style.lineHeight="10pt";g.push(c);c=new i.ThemeClass("a.currentLocation:hover");c.style.fontWeight="bold";c.style.fontSize="10pt";c.style.color="#666666";c.style.textDecoration="none";c.style.borderBottom="0";g.push(c);c=new i.ThemeClass("navlinkonpage");
c.style.color=this.content;c.style.verticalAlign="middle";g.push(c);if(this.bannerProgress)c=new i.ThemeClass("topRowBanner .progressPane_running"),c.style.borderColor=this.bannerProgress,g.push(c);for(var f in g)j+=g[f].toString();return j};k.prototype.writeButtonStyle=function(){var j="",g=[],c=new i.ThemeClass("commandButton");c.style.color="#666";c.style.border="1px solid #dedede";c.style.backgroundColor="#ddd";c.style.textAlign="center";c.style.verticalAlign="middle";c.style.cursor="pointer";
c.style.display="inline-block";c.style.padding="4px 6px";c.style.borderRadius="3px";c.style.lineHeight="12px";c.style.fontSize="9pt";c.style.userSelect="none";g.push(c);c=new i.ThemeClass("commandButton:over");c.style.backgroundColor="#e6e6e6";c.style.border="1px solid #808080";g.push(c);c=new i.ThemeClass("commandMenu");c.style.color="#222";c.style.display="inline-block";c.style.verticalAlign="baseline";c.style.margin="0";c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.border="1px solid #dedede";
c.style.backgroundColor="#efefef";c.style.cursor="pointer";c.style.borderRadius="1px";g.push(c);c=new i.ThemeClass("commandMenuItem");c.style.border="0";c.style.padding="0";c.style.margin="0";g.push(c);for(var f in g)j+=g[f].toString();return j};k.prototype.writeMainStyle=function(){var j="",g=[],c=new i.ThemeClass("searchbox");c.style.backgroundImage="url(../images/core_sprites.png)";c.style.backgroundRepeat="no-repeat";c.style.backgroundPosition="4px -297px";c.style.width="12px";c.style.height=
"12px";c.style.backgroundColor=this.search;c.style.border="1px solid "+this.search;c.style.fontSize="11px";c.style.width="15em";c.style.height="16px";c.style.borderRadius="10px";c.style.color="#999";c.style.padding="0";c.style.paddingLeft="20px";c.style.marginLeft="5px";c.style.marginTop="6px !important";c.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";g.push(c);c=new i.ThemeClass("searchbox:focus");c.style.color="white";c.style.outline=
"none";g.push(c);c=new i.ThemeClass("checkedRow");c.style.cssText="background-color:"+this.selection+" !important;";g.push(c);c=new i.ThemeClass("navbar-item-selected");c.style.background=this.selection;c.style.color=this.content;g.push(c);c=new i.ThemeClass("auxpane");c.style.border="0";c.style.background=this.sidepanel;g.push(c);c=new i.ThemeClass("mainpane");c.style.background=this.mainpanel;c.style.border=0;g.push(c);c=new i.ThemeClass("mainToolbar");c.style.background=this.toolpanel;g.push(c);
for(var f in g)j+=g[f].toString();return j};k.prototype.render=function(){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};k.prototype.getSheet=function(i){i.navbar.value?(this.navbar=i.navbar.value,this.button=i.button.value,this.location=i.location.value,this.selection=i.selection.value,this.sidepanel=i.sidepanel.value,this.mainpanel=i.mainpanel.value,this.navtext=i.navtext.value,this.search=
i.search.value,this.content=i.content.value,this.toolpanel=i.toolpanel.value,this.bannerProgress=i.bannerProgress.value):(this.navbar=i.navbar,this.button=i.button,this.location=i.location,this.selection=i.selection,this.sidepanel=i.sidepanel,this.mainpanel=i.mainpanel,this.navtext=i.navtext,this.search=i.search,this.content=i.content,this.toolpanel=i.toolpanel,this.bannerProgress=i.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:k}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(i,k,j){function g(){}function c(){this.styles=[];var b=new g;b.name="Orion";b.navbar="white";b.button="#EFEFEF";b.location="#efefef";b.selection="FEC";b.sidepanel="#FBFBFB";b.mainpanel="white";b.toolpanel="white";b.navtext="#bfbfbf";b.content="#3087B3";b.search="#444";b.breadcrumb="#3087B3";b.separator="#333";b.bannerProgress="whitesmoke";
this.styles.push(b);b=new g;b.name="Orion2014";b.navbar="white";b.button="#EFEFEF";b.location="#EFEFEF";b.selection="FEC";b.sidepanel="#EEEEEE";b.mainpanel="#EEEEEE";b.toolpanel="#EEEEEE";b.navtext="#BFBFBF";b.content="#333333";b.search="#444444";b.breadcrumb="#333333";b.separator="#333333";b.bannerProgress="orange";this.styles.push(b);b=new g;b.name="Green Zone";b.navbar="seagreen";b.button="lavender";b.location="darkseagreen";b.selection="moccasin";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel=
"white";b.navtext="#FBFBFB";b.content="darkgreen";b.search="darkgreen";b.breadcrumb="#3087B3";b.separator="seagreen";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name="Pretty In Pink";b.navbar="plum";b.button="lavender";b.location="pink";b.selection="lavender";b.sidepanel="seashell";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumorchid";b.search="violet";b.breadcrumb="#3087B3";b.separator="plum";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name=
"Blue Monday";b.navbar="cornflowerblue";b.button="lavender";b.location="skyblue";b.selection="lavender";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="royalblue";b.search="royalblue";b.breadcrumb="#3087B3";b.separator="cornflowerblue";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name="Vanilla Skies";b.navbar="sandybrown";b.button="lemmonchiffon";b.location="cornsilk";b.selection="lemonchiffon";b.sidepanel="white";b.mainpanel="white";b.toolpanel=
"white";b.navtext="lemonchiffon";b.content="chocolate";b.search="moccasin";b.breadcrumb="#3087B3";b.separator="sandybrown";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name="Beetlejuice";b.navbar="indigo";b.button="slateblue";b.location="darkslateblue";b.selection="silver";b.sidepanel="lavender";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumslateblue";b.search="#444";b.breadcrumb="#3087B3";b.separator="indigo";b.bannerProgress="#F2F2F2";this.styles.push(b);
b=new g;b.name="Red";b.navbar="#CD2127";b.button="#777777";b.location="#D85F56";b.selection="lightcoral";b.sidepanel="#EFDAB2";b.mainpanel="#FDFADD";b.toolpanel="#FDFADD";b.navtext="#FBFBFB";b.content="darkred";b.search="#D85F56";b.breadcrumb="darkred";b.separator="#CD2127";b.bannerProgress="#F2F2F2";this.styles.push(b)}function f(){return this.styles}g.prototype.name="Orion";g.prototype.navbar="#404648";g.prototype.button="#EFEFEF";g.prototype.location="#333";g.prototype.breadcrumb="#3087B3";g.prototype.separator=
"#333";g.prototype.selection="FEC";g.prototype.sidepanel="#FBFBFB";g.prototype.mainpanel="white";g.prototype.toolpanel="white";g.prototype.navtext="#bfbfbf";g.prototype.content="#3087B3";g.prototype.search="#444";g.prototype.bannerProgress="white";c.prototype.styles=[];c.prototype.getStyles=f;c.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};c.prototype.getViewData=function(){var b={top:10,left:10,
width:350,height:350};b.shapes=[{type:"RECTANGLE",name:i["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:i["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:i["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:i["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",
name:i["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:i.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:i["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:i.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:i.Content,label:"/",x:78,y:60,family:"content",
fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:i.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:i["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:i.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:i["Button Text"],label:"Button",x:158,y:90,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"TRIANGLE",
name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:i["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:i["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:i["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:i["Line Color"],
x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:i["Side Panel"],x:10,y:71,width:140,height:289,family:"sidepanel",fill:"#FBFBFB",order:12},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:i["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},
{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"}];for(var c=0;c<3;c++)b.shapes.push({type:"TEXT",name:i.Content,label:"org.eclipse.orion.content",x:170,y:127+20*c,fill:"#3087B3",family:"content"});for(c=0;c<3;c++)b.shapes.push({type:"TEXT",name:i.Content,label:"Item",x:25,y:115+20*c,fill:"#3087B3",family:"content"});for(c=0;c<3;c++)b.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+c*20,x2:165,y2:124+c*20,x3:160,y3:127+c*20,family:"navbar",fill:"#333"});b.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return b};c.prototype.processSettings=function(b){var c=new j.ThemeSheetWriter;(new k.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",c.getSheet(b))};return{ThemeData:c,getStyles:f}});
define("orion/widgets/nls/root/messages",{"no input":"no input","no output":"no output","Choose a Folder":"Choose a Folder",OK:"OK",Profile:"Profile","Sign out":"Sign out","N/A":"N/A","logged in since ":"logged in since ","Sign in":"Sign in","Authentication required!":"Authentication required!","Name:":"Name:","Plug-ins":"Plug-ins"," <No available services or timed out, check URL and try reloading>":" <No available services or timed out, check URL and try reloading>",Properties:"Properties"," (Service Id: ":" (Service Id: ",
Services:"Services","SFTP Transfer":"SFTP Transfer","Remote host:":"Remote host:","Port:":"SFTP Port:","Remote path:":"Remote path:","User name:":"User name:","Password:":"Password:","Start Transfer":"Start Transfer","Location:":"Location:","orion.sftpConnections":"orion.sftpConnections","Drag a file here":"Drag a file here","unzip zips":"Unzip *.zip files","or if you prefer":"(or upload a file using the buttons below)",Upload:"Upload","Browse...":"Browse...","Import a file or zip":"Import a file or zip",
"Missing required argument: searchRenderer":"Missing required argument: searchRenderer","Missing required argument: favService":"Missing required argument: favService","Find File Named":"Find File Named","Type the name of a file to open (? = any character, * = any string):":"Type the name of a file to open (? = any character, * = any string):",Search:"Search","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","</a>":"</a>",">":">","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(i){function k(j,g,c){this.elements=c;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='<header class="UAHeader">Develop software from within the cloud</header>';this.elementNode=document.createElement("div");this.switchesContainer=document.createElement("div");this.switches=document.createElement("span");this.radioButtons=[];this.elementNode.className="UAContainer-body";
this.taskPanel.appendChild(this.elementNode);this.switchesContainer.className="UAContainer-switch-body";this.switches.className="UAContainer-switches";this.switchesContainer.innerHTML="";this.switchesContainer.appendChild(this.switches);this.taskPanel.appendChild(this.switchesContainer);g===!0?(this.container=document.createElement("div"),this.container.className="UAModal",this.container.appendChild(this.taskPanel),this.backdrop=document.createElement("div"),this.backdrop.className="UAModalBackground",
document.body.appendChild(this.backdrop),document.body.appendChild(this.container),i.addAutoDismiss([this.container],this.destroy.bind(this))):j.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}k.prototype.elementNode=null;k.prototype.switchesContainer=null;k.prototype.switches=null;k.prototype.radioButtons=null;k.prototype.chosenSwitch=null;k.prototype.addElement=
function(i){var g=document.createElement("span");g.className="UAContainer-icon";g.innerHTML='<span class="workingSpan"><img src="'+i.image+'" id="'+i.label+'ImageNode" alt="'+i.alt+'" height="64" width="64"></span><span class="UAIcon-label"><span class="UALabel" id="'+i.label+'LabelNode" >'+i.label+"</span></span>";g.onmouseover=function(){document.getElementById(i.label+"ImageNode").src=i.secondaryImage;document.getElementById(i.label+"LabelNode").className="UALabel-live";g.className="UAContainer-icon-live"};
g.onmouseout=function(){document.getElementById(i.label+"ImageNode").src=i.image;document.getElementById(i.label+"LabelNode").className="UALabel";g.className="UAContainer-icon"};var c=this;g.onclick=function(){c.showMedia(i)};this.elementNode.appendChild(g)};k.prototype.clearElements=function(){this.elementNode.innerHTML=""};k.prototype.showMedia=function(i){this.clearElements();this.addElement(i);var g=document.createElement("span");g.className="UAContainer-media";g.innerHTML='<div></div><div></div><span class="mediaSpan"><img src="'+
i.media+'" alt="'+i.alt+'" height="300" width="400"></span>';this.elementNode.appendChild(g);setTimeout(function(){g.style.opacity=1},100);i=document.getElementById(i.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=i.parentNode;i.className="chosenCircle"};k.prototype.createSwitch=function(i){var g;g=i?i.label+"switch":"indexSwitch";var c=document.createElement("span");c.className="workingSpan";c.innerHTML='<div class="circle" id ="'+g+'"></div>';var f=this;c.onclick=
i?function(){f.showMedia(i)}:function(){f.initialize();f.chosenSwitch.firstChild.className="circle";f.chosenSwitch=c;f.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(c);return this.radioButtons[this.radioButtons.length]=c};k.prototype.initialize=function(){this.clearElements();this.elements.forEach(this.addElement.bind(this))};k.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return k});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(i,k,j,g){function c(){}var f=null;c.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'<div class="dialog" role="dialog"><div class="dialogTitle"><span id="title" class="dialogTitleText layoutLeft"></span><button aria-label="Close" class="dismissButton layoutRight core-sprite-close imageSprite" id="closeDialog"></button></div><div id="dialogContent" class="dialogContent layoutBlock"></div><div id="buttons" class="dialogButtons"></div></div>',
_initialize:function(){var b=document.body;this.$frameParent=b;this.$$modalExclusions=this.$$modalExclusions||[];var c=document.createRange();c.selectNode(b);c=c.createContextualFragment(this.CONTAINERTEMPLATE);b.appendChild(c);this.$frame=b.lastChild;this.title&&j.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=j.$("#closeDialog",this.$frame);var e=this;this.$close.addEventListener("click",function(){e.hide()},!1);this.$parent=j.$(".dialogContent",this.$frame);
c=document.createRange();c.selectNode(this.$parent);b=c.createContextualFragment(this.TEMPLATE);this.messages&&j.processTextNodes(b,this.messages);this.$parent.appendChild(b);this.$buttonContainer=j.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(b){b.keyCode===j.KEY.ESCAPE?e.hide():b.keyCode===j.KEY.ENTER&&typeof e._defaultCallback==="function"&&e._defaultCallback()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent);
this.modal&&this._makeModal()},_makeButtons:function(){if(this.$buttonContainer&&Array.isArray(this.buttons)){var b=this;this.buttons.forEach(function(c){var e=g.createButton(c.text,c.callback);if(c.id)e.id=c.id,b["$"+e.id]=e;if(c.isDefault)b._defaultCallback=c.callback,b._defaultButton=e;b.$buttonContainer.appendChild(e)})}},_makeModal:function(){var b=this;this.$frame.addEventListener("blur",function(a){b.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var d=!j.contains(b.$frame,
a.target);if(d)for(var e=0;e<b.$$modalExclusions.length;e++)if(j.contains(b.$$modalExclusions[e],a.target)){d=!1;break}d&&(window.setTimeout(function(){(b.$lastFocusedElement||b.$parent).focus()},0),j.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);var c=this.$frameParent.childNodes,e=!1;this._addedBackdrop=[];for(var d=0;d<c.length;d++){for(var a=0;a<this.$$modalExclusions.length;a++)if(j.contains(this.$$modalExclusions[a],
c[d])){e=!0;break}!e&&c[d]!==b.$frame&&c[d].classList&&!c[d].classList.contains("tooltipContainer")&&(a=c[d],a.classList.contains("modalBackdrop")||(a.classList.add("modalBackdrop"),this._addedBackdrop.push(a)))}(c=j.lastTabbable(this.$buttonContainer)||j.lastTabbable(this.$parent))&&c.addEventListener("keydown",function(a){if(a.keyCode===j.KEY.TAB){var d=b._getFirstFocusField();d&&d!==a.target&&d.focus();j.stop(a)}},!1)},_addChildDialog:function(b){this.$$modalExclusions.push(b.$frame||b.$parent)},
_inModalExclusion:function(b){return this.$$modalExclusions.some(function(c){return b.$frame===c||b.$parent===c})},_bindElements:function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];e.id&&(this["$"+e.id]=e);this._bindElements(e)}},hide:function(b){!b&&f===this&&(f=null);typeof this._beforeHiding==="function"&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,
!0));this.$frame.classList.remove("dialogShowing");j.setFramesEnabled(!0);typeof this._afterHiding==="function"&&this._afterHiding();var c=this;this.keepAlive||window.setTimeout(function(){c.destroy()},0)},show:function(b){if(this.modal)if(f){if(!f._inModalExclusion(this)){this.hide(!0);return}}else f=this;typeof this._beforeShowing==="function"&&this._beforeShowing();j.setFramesEnabled(!1);var c=j.bounds(this.$frame),e=j.bounds(document.documentElement),d;b?(d=j.bounds(b),b=d.top+d.height+4,d=d.left+
4,b+c.height>e.height&&(b=Math.max(0,e.height-c.height-4)),d+c.width>e.width&&(d=Math.max(0,e.width-c.width-4))):(d=Math.max(0,(e.width-c.width)/2),b=Math.max(0,(e.height-c.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=b+"px";this.$frame.style.left=d+"px";this.$frame.classList.add("dialogShowing");typeof this._afterShowing==="function"&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return j.firstTabbable(this.$parent)||
this._defaultButton||j.firstTabbable(this.$buttonContainer)||this.$close},destroy:function(){if(this.$frame)f===this&&(f=null),j.setFramesEnabled(!0),this._addedBackdrop&&this._addedBackdrop.length>0&&this._addedBackdrop.forEach(function(b){b.classList.remove("modalBackdrop")}),this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0),this.$frameParent.removeChild(this.$frame),this.$parent=this.$frame=void 0}};c.prototype.constructor=
c;return{Dialog:c}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages,require,orion/webui/littlelib,orion/PageLinks,orion/widgets/userAssistance/UATaskPanel,orion/webui/dialog".split(","),function(i,k,j,g,c){function f(b){this._displaySignOut=!0;this._init(b)}f.prototype={_init:function(b){this._dropdownNode=j.node(b.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=b.dropdown;this._serviceRegistry=b.serviceRegistry;this.authenticatedServices={};this.unauthenticatedServices=
{};this._noSeparator=b.noSeparator;this._dropDownItemClass=b.dropDownItemClass;this._keyAssistClass=b.keyAssistClass;if(b.signOut!==void 0)this._displaySignOut=b.signOut},isSingleService:function(){return this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)===1},hasServices:function(){return this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)>0},length:function(b){var c=0,e;for(e in b)b.hasOwnProperty(e)&&c++;return c},_makeMenuItem:function(b,
c){var e=document.createElement("span");e.role="menuitem";e.tabIndex=0;var d=document.createTextNode(b);e.appendChild(d);typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&e.classList.add(this._dropDownItemClass):e.classList.add("dropdownMenuItem");e.addEventListener("click",c,!1);e.addEventListener("keydown",function(a){(a.keyCode===j.KEY.ENTER||a.keyCode===j.KEY.SPACE)&&c()},!1);return e},_renderAuthenticatedService:function(b){var c=this,e=this.authenticatedServices[b].authService;
if(e&&e.logout&&this._displaySignOut){var d=document.createElement("li"),a=this._makeMenuItem(i["Sign Out"],function(){e.logout().then(function(){c.addUserItem(b,e,c.authenticatedServices[b].label);localStorage.removeItem(b);localStorage.removeItem("lastLogin");for(var a=localStorage.length-1;a>=0;a--){var d=localStorage.key(a);d&&d.indexOf("/orion/preferences/user")===0&&localStorage.removeItem(d)}e.getAuthForm(window.location.href).then(function(a){window.location=a})})});d.appendChild(a);this._dropdownNode.appendChild(d)}},
renderServices:function(){function b(a){e[a]||(e[a]=c.createDocumentFragment());return e[a]}var c=document,e=[],d=this._serviceRegistry;g.getPageLinksInfo(d,"orion.page.link.user").then(function(a){this._dropdown?this._dropdown.empty():this._dropdownNode&&j.empty(this._dropdownNode);a.getAllLinks().forEach(function(a){var d,e;if(a.category&&(e=/user\.(\d+)/.exec(a.category)))d=parseInt(e[1],10);if(typeof d!=="number"||isNaN(d))d=1;d=b(d);e=c.createElement("li");var f=c.createElement("a");f.role="menuitem";
typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&f.classList.add(this._dropDownItemClass):f.classList.add("dropdownMenuItem");f.href=a.href;f.textContent=a.textContent;e.appendChild(f);d.appendChild(e);f.addEventListener("keydown",function(a){(a.keyCode===j.KEY.ENTER||a.keyCode===j.KEY.SPACE)&&f.click()},!1)}.bind(this));if(this.keyAssistFunction){var a=document.createElement("li"),f=this._makeMenuItem(i["Keyboard Shortcuts"],this.keyAssistFunction);typeof this._keyAssistClass===
"string"?this._keyAssistClass!==""&&f.classList.add(this._keyAssistClass):f.classList.add("key-assist-menuitem");a.appendChild(f);b(0).appendChild(a)}if(a=d.getServiceReferences("orion.page.getstarted")[0])f=a.getProperty("data"),a=document.createElement("li"),f=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,f)),a.appendChild(f),b(0).appendChild(a);var g=this;e.sort(function(a,b){return a-b}).forEach(function(a,b){if(b<e.length-1&&!this._noSeparator){var d=document.createElement("li");
d.classList.add("dropdownSeparator");var c=document.createElement("span");c.classList.add("dropdownSeparator");d.appendChild(c);a.appendChild(d)}g._dropdownNode.appendChild(a)}.bind(this));if(this.isSingleService())for(var q in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(q)&&this._renderAuthenticatedService(q,0)}.bind(this))},getStartedDialog:function(b){new c(null,!0,b)},setKeyAssist:function(b){this.keyAssistFunction=b;this.renderServices()},addUserItem:function(b,c,e,d){d?
(this.unauthenticatedServices[b]&&delete this.unauthenticatedServices[b],this.authenticatedServices[b]={authService:c,label:e,data:d}):(this.authenticatedServices[b]&&delete this.authenticatedServices[b],this.unauthenticatedServices[b]=this.unauthenticatedServices[b]?{authService:c,label:e,pending:this.unauthenticatedServices[b].pending}:{authService:c,label:e});this.renderServices()}};f.prototype.constructor=f;return{UserMenu:f}});
define("orion/crawler/nls/root/messages",{"Searching file:":"Searching file:","is not supported in this file system":"is not supported in this file system","${0} files found out of ${1}":"${0} files found out of ${1}","The search term on this location will not use indexed files.":"The search term on this location will not use indexed files.","It will take longer time. Do you want to proceed?":"It will take longer time. Do you want to proceed?","Search cancelled by user":"Search cancelled by user",
Cancel:"Cancel"});define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/searchUtils","i18n!orion/nls/messages,require,orion/regex,orion/commandRegistry,orion/PageUtil,orion/URITemplate".split(","),function(i,k,j,g,c,f){function b(b,d,a){var c="";a&&(c="^");if(c=j.parse("/"+c+b.searchStr+"/"))a=c.pattern,c=c.flags,c.indexOf("i")===-1&&!d.caseSensitive&&(c+="i"),b.regExp={pattern:a,flags:c},b.wildCard=!0}var h={ALL_FILE_TYPE:"*.*"};h.doSearch=function(b,d,a,c){if(b){var f=!0;a==="*"&&(a="");a===""&&(f=c&&c.type!==h.ALL_FILE_TYPE);if(f)a!==""&&h.addRecentSearch(d,
a,c?c.regEx:!1),b=b.createSearchParams(a,!1,!1,c),b=h.generateSearchHref(b),window.location=b}else window.alert(i["Can't search: no search service is available"])};h.generateSearchHelper=function(c,d){var a=c.keyword,f=a,g={};c.fileType&&c.fileType!==h.ALL_FILE_TYPE&&a===""&&(f="*."+c.fileType);if(c.regEx)g.searchStr=a,b(g,c,d);else{var q=a.indexOf("*")>-1,o=a.indexOf("?")>-1;q&&(a=a.split("*").join(".*"));o&&(a=a.split("?").join("."));!q&&!o&&!c.nameSearch?(g.searchStr=c.caseSensitive?a.split("\\").join(""):
a.split("\\").join("").toLowerCase(),g.wildCard=!1):(g.searchStr=c.caseSensitive?a:a.toLowerCase(),b(g,c,d),g.wildCard=!0)}g.searchStrLength=g.searchStr.length;return{params:c,inFileQuery:g,displayedSearchTerm:f}};h.convertSearchParams=function(b){if(b.rows!==void 0)b.rows=parseInt(b.rows,10);if(b.start!==void 0)b.start=parseInt(b.start,10);if(typeof b.regEx==="string")b.regEx=b.regEx.toLowerCase()==="true";if(typeof b.caseSensitive==="string")b.caseSensitive=b.caseSensitive.toLowerCase()==="true";
if(typeof b.nameSearch==="string")b.nameSearch=b.nameSearch.toLowerCase()==="true"};h.copySearchParams=function(b,d){var a={},c;for(c in b)if(b[c]!==void 0&&b[c]!==null&&(d||c!=="replace"))a[c]=b[c];return a};h.generateSearchHref=function(b){var d=k.toUrl("search/search.html"),b=h.copySearchParams(b,!0),a=b.resource;b.resource=void 0;return typeof b.keyword!=="undefined"?(new f(d+"#{,resource,params*}")).expand({resource:a,params:b}):(new f(d+"#{,resource}")).expand({resource:a})};h.generateFindURLBinding=
function(b,d,a,c,h){b={find:d.searchStr,regEx:d.wildCard?!0:void 0,caseSensitive:b.caseSensitive?!0:void 0,replaceWith:typeof c==="string"?c:void 0,atLine:typeof a==="number"?a:void 0};return h?b:","+(new f("{,params*}")).expand({params:b})};h.convertFindURLBinding=function(b){if(typeof b.regEx==="string")b.regEx=b.regEx.toLowerCase()==="true";if(typeof b.caseSensitive==="string")b.caseSensitive=b.caseSensitive.toLowerCase()==="true";if(typeof b.atLine==="string")b.atLine=parseInt(b.atLine,10)};h.replaceRegEx=
function(b,d,a){return b.replace(RegExp(d.pattern,d.flags),a)};h.replaceStringLiteral=function(b,d,a){d=j.parse("/"+d+"/gim");return h.replaceRegEx(b,d,a)};h.searchOnelineLiteral=function(b,d,a){var c;c=0;for(var h=!1,f=[];;)if(c=d.indexOf(b.searchStr,c),c<0)break;else{f.push({startIndex:c,length:b.searchStrLength});h=!0;if(a)break;c+=b.searchStrLength}return h?f:null};h.findRegExp=function(b,d,a,c){if(!d)return null;a=a||"";a+=(a.indexOf("g")===-1?"g":"")+(a.indexOf("m")===-1?"m":"");var h=null;
return(h=RegExp(d,a).exec(b.substring(c)))&&{startIndex:h.index+c,length:h[0].length}};h.searchOnelineRegEx=function(b,d,a){for(var c=0,f=!1,g=[];;)if(c=h.findRegExp(d,b.regExp.pattern,b.regExp.flags,c)){g.push(c);f=!0;if(a)break;c=c.startIndex+c.length}else break;return f?g:null};h.generateNewContents=function(b,d,a,c,f,g){if(c&&d){if(!b)a.contents=[];for(var o=0;o<d.length;o++){for(var i=d[o],j=!1,u=!1,v=[],t,w=0,l=0;l<c.children.length;l++)if(c.children[l].lineNumber-1===o){w=l;for(j=0;j<c.children[l].matches.length;j++)c.children[l+
j].checked!==!1&&v.push(j);u=v.length>0;t=c.children[l].matches;j=!0;break}if(j){if(u){v=h.replaceCheckedMatches(i,f,t,v,g);i=v.replacedStr;for(j=0;j<c.children[w].matches.length;j++)c.children[w+j].newMatches=v.newMatches}else for(j=0;j<c.children[w].matches.length;j++)c.children[w+j].newMatches=c.children[w+j].matches;b?a.contents[o]=i:a.contents.push(i)}else b||a.contents.push(i)}}};h.generateMatchContext=function(b,d,a){var c=[],h=b*2+1,f;d.length<=h?(f=0,b=d.length-1):(f=a-b,f<0?(f=0,b=f+h-1):
(b=a+b,b>d.length-1&&(b=d.length-1,f=b-h+1)));for(h=f;h<=b;h++)c.push({context:d[h],current:h===a});return c};h.splitFile=function(b){for(var d=0,a=0,c=0,h=0,f=[];;){d!==-1&&d<=c&&(d=b.indexOf("\r",c));a!==-1&&a<=c&&(a=b.indexOf("\n",c));if(a===-1&&d===-1){f.push(b.substring(h));break}var g=1;d!==-1&&a!==-1?d+1===a?(g=2,c=a+1):c=(d<a?d:a)+1:c=d!==-1?d+1:a+1;f.push(b.substring(h,c-g));h=c}return f};h.searchWithinFile=function(b,d,a,c,f,g){a=h.splitFile(a);if(f)d.contents=a;if(d){d.children=[];for(var o=
c=0;o<a.length;o++){var i=a[o];if(i&&i.length>0){var j=g?i:i.toLowerCase();if(j=b.wildCard?h.searchOnelineRegEx(b,j):h.searchOnelineLiteral(b,j)){var u,v=o+1;if(f)for(var t=0;t<j.length;t++)u=t+1,u={parent:d,checked:d.checked,type:"detail",matches:j,lineNumber:v,matchNumber:u,name:i,location:d.location+"-"+v+"-"+u},d.children.push(u);else u={parent:d,context:h.generateMatchContext(2,a,o),checked:d.checked,type:"detail",matches:j,lineNumber:v,name:i,location:d.location+"-"+v},d.children.push(u);c+=
j.length}}}d.totalMatches=c}};h.replaceCheckedMatches=function(b,d,a,c,h){for(var f=0,g="",i=[],j=0;j<a.length;j++){f!==a[j].startIndex&&(g+=b.substring(f,a[j].startIndex));if(a[j].length)h=a[j].length;for(var f=!1,u=0;u<c.length;u++)if(c[u]===j){f=!0;break}f?(i.push({startIndex:g.length,length:d.length}),g+=d):(i.push({startIndex:g.length,length:h}),g+=b.substring(a[j].startIndex,a[j].startIndex+h));f=a[j].startIndex+h}f<b.length&&(g+=b.substring(f));return{replacedStr:g,newMatches:i}};h.fullPathNameByMeta=
function(b){var d=b.length,a="";if(d>0)for(d-=1;d>-1;d--)a=a+(a===""?"":"/")+b[d].Name;return a};h.path2FolderName=function(b,d,a){return b.substring(0,b.length-d.length-(a?0:1))};h._storeRecentSearch=function(b,d,a,c){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b.put("recentSearch",d);a&&window.setTimeout(function(){a.dispatchEvent({type:"inputDataListChanged",deleting:c})}.bind(this),20)})};h.addRecentSearch=function(b,d,a){typeof d==="string"&&d&&
b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var f,c=c.get("recentSearch");typeof c==="string"&&(c=JSON.parse(c));if(c){for(f in c)if(c[f].name===d)return;c.length>=20&&c.splice(19,c.length-20+1)}else c=[];c.splice(0,0,{name:d,regEx:a});h._storeRecentSearch(b,c)})};h.removeRecentSearch=function(b,d,a){typeof d==="string"&&d&&b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var f,c=c.get("recentSearch");typeof c===
"string"&&(c=JSON.parse(c));if(c)for(f in c)if(c[f].name===d){c.splice(f,1);h._storeRecentSearch(b,c,a,!0);break}})};h.getSearches=function(b,d,a){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get(d);typeof b==="string"&&(b=JSON.parse(b));b&&a&&a(b)})};h.getMixedSearches=function(b,d,a,c){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){var e=b.get("recentSearch");typeof e==="string"&&(e=JSON.parse(e));d&&(b=
b.get("search"),typeof b==="string"&&(b=JSON.parse(b)),b&&b.forEach(function(b){if(a){var d=h.parseQueryStr(b.query);e.some(function(a){return d.searchStrTitle===a.name})||e.push({name:d.searchStrTitle,label:b.name})}else e.push({name:null,label:b.name,value:b.query})}));e&&c&&c(e)})};h.getOpenSearchPref=function(b,d){b.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");d(a&&a["links.newtab"]!=="undefined"?a["links.newtab"]?!0:!1:!1)})};
h.setOpenSearchPref=function(b,d){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",{openInNewTab:d})})};return h});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages,require,orion/i18nUtil,orion/searchUtils,orion/contentTypes,orion/Deferred".split(","),function(i,k,j,g,c,f){function b(b,c,d,a){this.registry=b;this.fileClient=c;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=a&&a.searchOnName;this._buildSkeletonOnly=a&&a.buildSkeletonOnly;this._fetchChildrenCallBack=a&&a.fetchChildrenCallBack;this._searchParams=d;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:g.generateSearchHelper(d);this._location=a&&a.location;this._childrenLocation=a&&a.childrenLocation?a.childrenLocation:this._location;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}b.prototype.search=function(b){var c=this.registry.getService("orion.core.contentTypeRegistry");
this._onSearchComplete=b;this._cancelled=!1;this._deferredArray=[];c.getContentTypes().then(function(b){this.contentTypesCache=b;var a=this;this._visitRecursively(this._childrenLocation).then(function(){a._cancelled||a._reportResult()}.bind(a),function(b){a._reportResult();a._statusService&&b.name==="Cancel"&&(console.log("Crawling search cancelled. Deferred array length : "+a._deferredArray.length),a._statusService.setProgressResult({Message:i["Search cancelled by user"],Severity:"Warning"}))}.bind(a))}.bind(this))};
b.prototype.searchName=function(b,c){if(b)this._searchParams=b,this.searchHelper=g.generateSearchHelper(b,!0);if(c)this.onSearchNameComplete=c;var d=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(this.fileSkeleton.length>0){for(var a=0;a<this.fileSkeleton.length;a++){var f=this.fileSkeleton[a].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this.searchHelper.inFileQuery,f,!0):g.searchOnelineLiteral(this.searchHelper.inFileQuery,f,!0))if(d.push(this.fileSkeleton[a]),
d.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:d.length,docs:d}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};b.prototype.buildSkeleton=function(b,c){this._buildingSkeleton=!0;var d=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var a=this;b();d.getContentTypes().then(function(b){a.contentTypesCache=b;a._visitRecursively(a._childrenLocation).then(function(){a._buildingSkeleton=!1;
c();a.searchHelper&&!a._buildSkeletonOnly&&a.searchName()})})};b.prototype._sort=function(b){b.sort(function(b,d){var a,c;if(this._searchParams.sort==="Path asc"){a=b.Location&&b.Location.toLowerCase();a=g.path2FolderName(a,b.Name&&b.Name.toLowerCase(),!0);c=d.Location&&d.Location.toLowerCase();c=g.path2FolderName(c,d.Name&&d.Name.toLowerCase(),!0);if(a<c)return-1;if(a>c)return 1}return this._sortOnNameSingle(b,d)}.bind(this))};b.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,
docs:this.fileLocations}})};b.prototype._sortOnNameSingle=function(b,c){var d=b.Name&&b.Name.toLowerCase(),a=c.Name&&c.Name.toLowerCase();return d<a?-1:d>a?1:0};b.prototype._onFileType=function(b){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===g.ALL_FILE_TYPE?!0:b.extension.indexOf(this.searchHelper.params.fileType)>=0:!0};b.prototype._visitRecursively=function(b){var e=[],d=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(b);return(d._progressService?this._progressService.progress(d.fileClient.fetchChildren(b),
"Crawling search for children of "+b):d.fileClient.fetchChildren(b)).then(function(a){for(var b=0;b<a.length;b++)if(a[b].Directory!==void 0&&a[b].Directory===!1)if(d._searchOnName)e.push(d._buildSingleSkeleton(a[b]));else if(d._buildSkeletonOnly)e.push(d._buildSingleSkeleton(a[b]));else{if(!d._cancelled){var h=c.getFilenameContentType(a[b].Name,d.contentTypesCache);if(h&&(h["extends"]==="text/plain"||h.id==="text/plain")&&d._onFileType(h))h=d._sniffSearch(a[b]),e.push(h),d._deferredArray.push(h)}}else if(a[b].Location)if(d._cancelled)break;
else h=d._visitRecursively(a[b].ChildrenLocation),e.push(h),d._deferredArray.push(h);return f.all(e)})};b.prototype._hitOnceWithinFile=function(b){b=this._searchParams.caseSensitive?b:b.toLowerCase();return this.searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this.searchHelper.inFileQuery,b,!0):g.searchOnelineLiteral(this.searchHelper.inFileQuery,b,!0)};b.prototype._reportSingleHit=function(b){if(!this._cancelled)b.LastModified=b.LocalTimeStamp,this.fileLocations.push(b),this._hitCounter++,
this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0)};b.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(b){b.cancel()})};b.prototype._sniffSearch=function(b){this._totalCounter++;var c=this;if(!this._cancelled)if(this.searchHelper.params.keyword==="")this._reportSingleHit(b),this._statusService&&this._statusService.setProgressResult({Message:j.formatMessage(i["${0} files found out of ${1}"],
this._hitCounter,this._totalCounter)});else return(c._progressService?c._progressService.progress(c.fileClient.read(b.Location),"Reading file "+b.Location):c.fileClient.read(b.Location)).then(function(d){c._hitOnceWithinFile(d)&&c._reportSingleHit(b);c._statusService&&c._statusService.setProgressResult({Message:j.formatMessage(i["${0} files found out of ${1}"],c._hitCounter,c._totalCounter)},i.Cancel)},function(b){b&&b.message&&b.message.toLowerCase()!=="cancel"&&console.error("Error loading file content: "+
b.message)})};b.prototype._buildSingleSkeleton=function(b){this._totalCounter++;this.fileSkeleton.push(b);this.searchHelper&&!this._buildSkeletonOnly&&this._totalCounter%100===0&&this.searchName();b=new f;b.resolve(this._totalCounter);return b};b.prototype.constructor=b;return{SearchCrawler:b}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages,orion/crawler/searchCrawler,orion/contentTypes,require,orion/webui/littlelib,orion/util,orion/webui/dialog".split(","),function(i,k,j,g,c,f,b){function h(b){this._init(b)}h.prototype=new b.Dialog;h.prototype.TEMPLATE='<div role="search"><div><label id="fileNameMessage" for="fileName">${Type the name of a file to open (? = any character, * = any string):}</label></div><div><input id="fileName" type="text" class="setting-control" style="width:90%;"/></div><div id="progress" style="padding: 2px 0 0; width: 100%;"><img src="'+
g.toUrl("../../../images/progress_running.gif")+'" class="progressPane_running_dialog" id="crawlingProgress"></img></div><div id="results" style="max-height:250px; height:auto; overflow-y:auto;" aria-live="off"></div><div id="statusbar"></div></div>';h.prototype._init=function(b){this.title=b.title||i["Find File Named"];this.modal=!0;this.messages=i;this._searcher=b.searcher;this._progress=b.progress;this._onHide=b.onHide;this._contentTypeService=new j.ContentTypeRegistry(this._searcher.registry);
if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=b.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=b.initialText;this._message=b.message;this._nameSearch=!0;if(b.nameSearch!==void 0)this._nameSearch=b.nameSearch;this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(i["Missing required argument: fileService"]);this._searchRenderer=b.searchRenderer;if(!this._searchRenderer||
typeof this._searchRenderer.makeRenderFunction!=="function")throw Error(i["Missing required argument: searchRenderer"]);this._initialize()};h.prototype._bindToDom=function(b){var d=this;d.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",i["FileName FolderName"]):this.$fileName.setAttribute("placeholder",i.Search);this.$fileName.addEventListener("input",function(){d._time=+new Date;d._timeoutId&&clearTimeout(d._timeoutId);d._timeoutId=setTimeout(d.checkSearch.bind(d),
0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===c.KEY.ENTER){var b=c.$("a",d.$results);if(b)c.stop(a),(f.isMac?a.metaKey:a.ctrlKey)?window.open(b.href):(window.location.href=b.href,d.hide())}},!1);b.addEventListener("keydown",function(a){var b,e,f;if(a.keyCode===c.KEY.DOWN||a.keyCode===c.KEY.UP)b=c.$$array("a",d.$results),e=document.activeElement,f=b.indexOf(e),a.keyCode===c.KEY.DOWN?f>=0?(e.classList.remove("treeIterationCursor"),b=f<b.length-1?b[f+1]:b[0],b.focus(),
b.classList.add("treeIterationCursor")):b.length>0&&(b=-1<b.length-1?b[0]:b[0],b.focus(),b.classList.add("treeIterationCursor")):f>=0?(e.classList.remove("treeIterationCursor"),e=d.$fileName,b=f>0?b[f-1]:e,b.focus(),f>0&&b.classList.add("treeIterationCursor")):b.length>0&&(b[b.length-1].focus(),b[b.length-1].classList.add("treeIterationCursor")),c.stop(a)});b.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(d._forceUseCrawler||!d._fileService.getService(d._searcher.getSearchLocation()).search){var a=
d._searchOnRoot?d._searcher.getSearchRootLocation():d._searcher.getChildrenLocation(),a=new k.SearchCrawler(d._searcher.registry,d._fileService,"",{searchOnName:!0,location:a});d._searcher.setCrawler(a);a.buildSkeleton(function(){d.$crawlingProgress.style.display="inline";d.$progress.appendChild(document.createTextNode(i["Building file skeleton..."]))},function(){d.$crawlingProgress.style.display="none";d.$progress.removeChild(d.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),
this.$fileNameMessage.appendChild(document.createTextNode(this._message)));if(this._initialText)this.$fileName.value=this._initialText,this.doSearch()};h.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var b=(new Date).getTime();b-this._time>this._searchDelay?(this._time=b,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};h.prototype._detectFolderKeyword=function(b){var d,a=b,c=null;if(this._nameSearch&&(d=/(\S+)\s*(.*)/,(b=d.exec(b))&&b.length===3))b[1]&&
(a=b[1]),b[2]&&(c=b[2]);return{keyword:a,folderKeyword:c}};h.prototype.doSearch=function(){var b=this.$fileName.value;if(b){var d=this._detectFolderKeyword(b),a=this._searcher.createSearchParams(d.keyword,this._nameSearch,this._searchOnRoot),h=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=h;var g=document.createElement("div");g.appendChild(document.createTextNode(this._nameSearch?i["Searching..."]:f.formatMessage(i["Searching for occurrences of"],
b)));c.empty(this.$results);this.$results.appendChild(g);this._searcher.search(a,d.folderKeyword,function(){h===this.currentSearch&&h.apply(null,arguments)}.bind(this))}};h.prototype.decorateResult=function(b){function d(b){b.button===0&&!b.ctrlKey&&!b.metaKey&&a.hide()}for(var a=this,b=c.$$array("a",b),f=0;f<b.length;f++)b[f].addEventListener("click",d,!1)};h.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};h.prototype._afterHiding=function(){this._onHide&&this._onHide()};h.prototype.constructor=
h;return{OpenResourceDialog:h}});define("text!orion/banner/banner.html",[],function(){return'<header id="banner" role="banner">\n\t<\!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\>\n\n\t<div id="staticBanner" class="layoutBlock topRowBanner"> <\!-- primaryNav --\>\n\t\t<div id="centralNavigationArea" style="position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"></div>\n\n\t\t<\!-- Static "Home" link. TODO delete this --\>\n\t\t<a id="home" class="layoutLeft "></a>\n\n\t\t<\!-- Left banner component: hamburger --\>\n\t\t<nav id="primaryNav" class="bannerLeftArea" style="z-index:2;" role="navigation">\n\t\t\t\t<button class="centralNavigation commandSprite core-sprite-hamburger" type="button"id="centralNavigation"></button>\n\t\t</nav>\n\n\t\t<\!-- Middle banner component: Breadcrumb bar --\>\n\t\t<div class="clear navigationBreadcrumb bannerMiddleArea" >\n\t\t\t<div id="location" class="currentLocation"></div>\n\t\t</div>\n\n\t\t<\!-- Right banner component: user identity --\>\n\t\t<div class="bannerRightArea" style="z-index:2;">\n\t\t\t<\!-- Global commands support. --\>\n\t\t\t<div id="globalActions" class="spacingLeft layoutLeft"></div>\n\n\t\t\t<\!-- Search. TODO delete this --\>\n\t\t\t<input type="text" id="search" autocomplete="off" class="layoutLeft spacingLeft searchbox" role="search" style="display:none;">\n\t\t\t<div id="searchOptions" class="layoutLeft" style="padding-top:1px;display:none;"></div>\n\n\t\t\t<\!-- User identity menu and Progress --\>\n\t\t\t<div id="userMenu" class="spacingRight layoutRight" style="color:#ccc;line-height:16px;">\n\t\t\t\t<div style="position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"></div>\n\n\t\t\t\t<\!-- Progress indicator --\>\n\t\t\t\t<img class="progressPane" id="progressPane" tabindex="0" role="progressbar"></img>\n\n\t\t\t\t<\!-- User identity menu --\>\n\t\t\t\t<span id="userTrigger" tabindex="0" role="button" class="dropdownTrigger" style="z-index:2;">\n\t\t\t\t</span>\n\t\t\t\t<ul id="userDropdown" class="dropdownMenu" role="menu"></ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\n\t<\!-- IDE notification messages go in here --\>\n\t<div id="notificationArea" class="notificationHide">\n\t\t<div class="layoutLeft" id="notifications" aria-live="assertive" aria-atomic="true"></div>\n\t\t<div class="layoutRight"><button aria-label="Close" class="dismissButton layoutRight core-sprite-close imageSprite" type="button" id="closeNotifications"></span></div>\n\t</div>\n</header>'});
define("text!orion/banner/footer.html",[],function(){return'<\!--\n<footer id="footerContent" class="layoutBlock footerLayout" role="contentinfo">\n\t<div class="logoFooter commandSprite core-sprite-orion-logo"></div>\n\t<div class="footerBlock">${Orion is in Beta. Please try it out but BEWARE your data may be lost.}</div>\n\t<div class="footerRightBlock">\n\t\t<ul>\n\t\t\t<li><a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Orion&version=5.0" target="_blank">${Report a Bug}</a>\n\t\t\t<li><a href="http://www.eclipse.org/legal/privacy.php" target="_blank">${Privacy Policy}</a></li>\n\t\t\t<li><a href="http://www.eclipse.org/legal/termsofuse.php" target="_blank">${Terms of Use}</a></li>\n\t\t\t<li><a href="http://www.eclipse.org/legal/copyright.php" target="_blank">${Copyright Agent}</a></li>\n\t\t</ul>\n\t</div>\n</footer>\n--\>'});
define("text!orion/banner/toolbar.html",[],function(){return'<ul class="layoutLeft commandList pageActions" id="pageActions"></ul>\n<ul class="layoutLeft commandList pageActions" id="selectionTools"></ul>\n<ul class="layoutLeft commandList pageActions" id="navActions"></ul>\n<div class="layoutLeft" style="padding-left:7px;padding-right:7px;margin-top:2px;" id="filterBox" style="visibility: hidden;"></div>\n<ul class="layoutRight commandList pageActions" id="settingsActions"></ul>\n<div class="layoutRight status" id="statusPane" role="status" aria-live="off"></div>\n<ul class="layoutRight commandList pageActions" id="pageNavigationActions"></ul>'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(i,k){function j(g,c,f){if(g=k.node(g))this._parent=g;else throw Error("Parent node of dropdown menu not found");this.options=f=f||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=f.selectionClass;g=document.createElement("div");g.classList.add("dropDownContainer");g.id=this.navDropDownId;g.style.display="none";this._parent.appendChild(g);this._dropdownMenu=g;if(c=k.node(c))this._triggerNode=
c;else throw"Trigger node of dropdown menu not found";if(this._triggerNode.style.visibility==="hidden")this._triggerNode.style.visibility="visible";if(!f.noClick)this._triggerNode.onclick=this.click.bind(this);this._dropdownMenu.addEventListener("keydown",function(b){b.keyCode===k.KEY.ESCAPE&&this.clearPanel()}.bind(this))}i.mixin(j.prototype,{click:function(){this._dropdownMenu.style.display==="none"?this.updateContent(this.getContentNode(),function(){k.setFramesEnabled(!1);this._dropdownMenu.style.display=
"";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=k.addAutoDismiss([this._triggerNode,this._dropdownMenu],this.clearPanel.bind(this));if(this.options.onShow)this.options.onShow()}.bind(this)):this.clearPanel()},clearPanel:function(){if(this.isVisible()&&(this._dropdownMenu.style.display="none",k.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(g){this._dropdownMenu.innerHTML=g},getContentNode:function(){return this._dropdownMenu},updateContent:function(g,c){c()},_positionDropdown:function(){this._dropdownMenu.style.right="";var g=k.bounds(this._dropdownMenu),c=k.bounds(document.body);if(g.left+g.width>c.left+c.width)g=k.bounds(this._boundingNode(this._triggerNode)),c=k.bounds(this._triggerNode),this._dropdownMenu.style.right=g.width-(c.left-g.left+c.width)+"px"},_boundingNode:function(g){var c=window.getComputedStyle(g,
null);return c===null?g:c.getPropertyValue("position")==="absolute"||!g.parentNode||g===document.body?g:this._boundingNode(g.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},isVisible:function(){return this._dropdownMenu.style.display!=="none"&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){if(this._parent)k.setFramesEnabled(!0),k.empty(this._parent),this._parent=this.select=null}});return j});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"Import local file...":"File System","Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}","Pasting ${0}":"Pasting ${0}",
"Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With",
"Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","Copy a file from a URL and optionally unzip it":"Copy a file from a URL and optionally unzip it","Unzip *.zip files:":"Unzip *.zip files:","Extracted from:":"Extracted from:","Did not drop ${0}.  Folder drop is not supported in this browser.":"Did not drop ${0}.  Folder drop is not supported in this browser.",
"You cannot copy files directly into the workspace.  Create a folder first.":"You cannot copy files directly into the workspace.  Create a folder first.","Unzip ${0}?":"Unzip ${0}?",NoFile:"Use the ${0} menu to create new files and folders. Click a file to start coding."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(i,k,j){function g(b,c,e){if(!b[c])throw c+i[" is not supported in this file system"];return b[c].apply(b,e)}function c(b,f,e,d){if(!b.readBlob)throw i["source file service does not support binary read"];if(!e.writeBlob)throw i["target file service does not support binary write"];if(f[f.length-1]!=="/")return g(b,"readBlob",[f]).then(function(a){return g(e,"writeBlob",[d,a])});var a=d.substring(0,
d.length-1),m=decodeURIComponent(a.substring(a.lastIndexOf("/")+1)),a=a.substring(0,a.lastIndexOf("/")+1);return g(e,"createFolder",[a,m]).then(function(){},function(){}).then(function(){return g(b,"fetchChildren",[f]).then(function(a){for(var f=[],h=0;h<a.length;++h){var g=a[h].Location,m=g;a[h].Directory&&(m=g.substring(0,g.length-1));m=decodeURIComponent(m.substring(m.lastIndexOf("/")+1));m=d+encodeURIComponent(m);a[h].Directory&&(m+="/");f[h]=c(b,g,e,m)}return k.all(f)})})}function f(b,c){function e(a){var b=
new k;b.reject(i["No Matching FileService for location:"]+a);return b}var d=b.getServiceReferences("orion.core.file"),a=d;if(c)for(var a=[],f=0;f<d.length;++f)c(d[f])&&a.push(d[f]);for(var g=[],q=[],o=[],p=[],s={fetchChildren:function(){var a=new k;a.resolve(p);return a},createWorkspace:function(){var a=new k;a.reject(i["no file service"]);return a},loadWorkspaces:function(){var a=new k;a.reject(i["no file service"]);return a},loadWorkspace:function(){var a=new k;window.setTimeout(function(){a.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:i["File Servers"],Location:"/",Children:p,ChildrenLocation:"/"})},100);return a},search:e,createProject:e,createFolder:e,createFile:e,deleteFile:e,moveFile:e,copyFile:e,read:e,write:e},d=0;d<a.length;++d)p[d]={Directory:!0,Length:0,LocalTimeStamp:0,Location:a[d].getProperty("top"),ChildrenLocation:a[d].getProperty("top"),Name:a[d].getProperty("Name")},f=a[d].getProperty("pattern")||a[d].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),f[0]!=="^"&&(f=
"^"+f),g[d]=RegExp(f),q[d]=b.getService(a[d]),o[d]=a[d].getProperty("Name"),a[d].getProperty("NameKey")&&a[d].getProperty("nls")&&j.getMessageBundle(a[d].getProperty("nls")).then(function(b,d){p[b].Name=d[a[b].getProperty("NameKey")];o[b]=d[a[b].getProperty("NameKey")]}.bind(this,d));this._getServiceIndex=function(a){if(a==="/")return-1;else if(!a||a.length&&a.length===0)return q[0]?0:-1;for(var b=0;b<g.length;++b)if(g[b].test(a))return b;throw i["No Matching FileService for location:"]+a;};this._getService=
function(a){a=this._getServiceIndex(a);return a===-1?s:q[a]};this._getServiceName=function(a){a=this._getServiceIndex(a);return a===-1?s.Name:o[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return a===-1?s.Location:p[a].Location}}f.prototype={getService:function(b){return this._getService(b)},fileServiceName:function(b){return this._getServiceName(b)},fileServiceRootURL:function(b){return this._getServiceRootURL(b)},fetchChildren:function(b){return g(this._getService(b),"fetchChildren",
arguments)},createWorkspace:function(b){return g(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return g(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(b){return g(this._getService(b),"loadWorkspace",arguments)},createProject:function(b,c,e,d){return g(this._getService(b),"createProject",arguments)},createFolder:function(b,c){return g(this._getService(b),"createFolder",arguments)},createFile:function(b,c){return g(this._getService(b),"createFile",
arguments)},deleteFile:function(b){return g(this._getService(b),"deleteFile",arguments)},moveFile:function(b,f,e){var d=this._getService(b),a=this._getService(f);if(d===a)return g(d,"moveFile",arguments);var m=b[b.length-1]==="/",n=f;n[n.length-1]!=="/"&&(n+="/");if(e)n+=encodeURIComponent(e);else{var q=b;m&&(q=q.substring(0,q.length-1));n+=q.substring(q.lastIndexOf("/")+1)}m&&n[n.length-1]!=="/"&&(n+="/");return c(d,b,a,n).then(function(){return g(d,"deleteFile",[b])})},copyFile:function(b,f,e){var d=
this._getService(b),a=this._getService(f);if(d===a)return g(d,"copyFile",arguments);var m=b[b.length-1]==="/",n=f;n[n.length-1]!=="/"&&(n+="/");if(e)n+=encodeURIComponent(e);else{var q=b;m&&(q=q.substring(0,q.length-1));n+=q.substring(q.lastIndexOf("/")+1)}m&&n[n.length-1]!=="/"&&(n+="/");return c(d,b,a,n)},read:function(b,c){return g(this._getService(b),"read",arguments)},readBlob:function(b){return g(this._getService(b),"readBlob",arguments)},write:function(b,c,e){return g(this._getService(b),"write",
arguments)},remoteImport:function(b,c){return g(this._getService(b),"remoteImport",arguments)},remoteExport:function(b,c){return g(this._getService(b),"remoteExport",arguments)},search:function(b){return g(this._getService(b.resource),"search",arguments)}};f.prototype.constructor=f;return{FileClient:f}});
define("orion/webui/SideMenu","orion/commands,orion/objects,orion/webui/littlelib,orion/PageLinks,orion/PageUtil,orion/URITemplate,orion/URL-shim,orion/util".split(","),function(i,k,j,g,c,f,b,h){function e(a,b){this.parentNode=j.node(a);this.contentNode=j.node(b);if(!this.parentNode)throw Error("Missing parentNode");this.menuitems=Object.create(null);this.categories=this.links=null;this.anchor=document.createElement("ul");this.anchor.classList.add("sideMenuList");this.parentNode.appendChild(this.anchor);
this.anchor.addEventListener("click",this._handleEvent.bind(this));this.anchor.addEventListener("touchstart",this._handleEvent.bind(this));this.anchor.addEventListener("focus",this._handleEvent.bind(this),!0);j.addAutoDismiss([this.anchor],this._expandMenu.bind(this,null))}function d(a){return!a.isRelatedLink}function a(a,b){var d=a.order,c=b.order;if(d<c)return-1;else if(c<d)return 1;return 0}function m(a,b){var d=a.source.order,c=b.source.order,d=typeof d==="number"?d:100,c=typeof c==="number"?
c:100;return d===c?a.textContent.localeCompare(b.textContent):d<c?-1:1}var n=h.isTouch;k.mixin(e.prototype,{LOCAL_STORAGE_NAME:"sideMenuNavigation",OPEN_STATE:"open",CLOSED_STATE:"closed",DEFAULT_STATE:"open",SIDE_MENU_OPEN_WIDTH:"40px",TRANSITION_DURATION_MS:301,addMenuItem:function(a,b,d){var c=this.anchor,a=this.createListItem(a,b);d&&a.classList.add("sideMenuItemActive");c.appendChild(a);this.menuitems[b]=a},setSideMenu:function(){var a=this.getDisplayState(),b=this.parentNode;if(b){if(a===this.CLOSED_STATE){this.setPageContentLeft("0");
if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._timeout=window.setTimeout(function(){b.style.display="none"},this.TRANSITION_DURATION_MS);b.classList.add("animating")}if(a===this.OPEN_STATE){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;b.classList.remove("animating");b.style.display="block";b.style.width=this.SIDE_MENU_OPEN_WIDTH;this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)}}},setPageContentLeft:function(a){var b=this.contentNode;if(b)b.style.left=
a},toggleSideMenu:function(){var a=this.getDisplayState(),b=this.contentNode;b&&b.classList.add("content-fixedHeight-animation");a=a===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;a===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,a);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];j.empty(this.anchor)},getMenuItems:function(){var a=this.menuitems;return Object.keys(a).map(function(b){return a[b]})},getMenuItem:function(a){return this.menuitems[a]},
getDisplayState:function(){var a=localStorage.getItem(this.LOCAL_STORAGE_NAME);if(!a)a=this.DEFAULT_STATE;return a},createListItem:function(a,b){var d=document.createElement("li");d.className=a;d.classList.add("sideMenuItem");d.categoryId=b;return d},setCategories:function(a){this.categories=a;this.links=Object.create(null)},setPageLinks:function(a){this.pageLinks=a;var b=this,d=a.createLinkElements();a.getAllLinks().forEach(function(a,c){var e=d[c];e.source=a;b._getLinksBin(a.category).push(e)});
this._renderLinks()},setRelatedLinks:function(a,b){this.relatedLinks=a;var c=this;Object.keys(this.links).forEach(function(a){var b=c._getLinksBin(a);c.links[a]=b.filter(d)});var e=document.createDocumentFragment();a.forEach(function(a){var b=a.relatedLink,d=c._getLinksBin(b.category),a=i.createCommandMenuItem(e,a.command,a.invocation);a.classList.remove("dropdownMenuItem");a.isRelatedLink=!0;a.source=b;d.push(a)});this._renderLinks(b)},_getLinksBin:function(a){if(a){var b=this.links;b[a]=b[a]||[];
return b[a]}else return[]},_sort:function(){var a=this.links;Object.keys(a).forEach(function(b){a[b].sort(m)})},_renderCategories:function(){var b=this.categories,d=this,e=new URL(window.location.href),h=c.matchResourceParameters();h.OrionHome=g.getOrionHome();var m=!1;this.clearMenuItems();b.getCategoryIDs().map(function(a){return b.getCategory(a)}).sort(a).forEach(function(a){var b=d._getLinksBin(a.id);b.length&&(m?d.addMenuItem(a.imageClass,a.id,!1):(b=b.some(function(a){if(!a.source.uriTemplate)return!1;
a=new f(a.source.uriTemplate);a=new URL(a.expand(h),window.location);return a.protocol===e.protocol&&a.host===e.host&&a.hostname===e.hostname&&a.port===e.port&&a.pathname===e.pathname&&a.search===e.search?m=!0:!1}),d.addMenuItem(a.imageClass,a.id,b)))})},_renderLinks:function(a){a=a||[];this._sort();this._renderCategories();var b=this,d=window.location.href;Object.keys(this.menuitems).forEach(function(c){var e=b.getMenuItem(c);if(e){for(var f=b._getLinksBin(c).slice(),f=f.filter(function(b){var c=
b.source;return a.indexOf(c.id)>=0||!c.default&&!c.force&&b.href===d?!1:!0}),f=f.filter(function(a){a=a.source;return!(f.length>1&&a.default&&!a.force)}),h=f.length-1;h>0;h--)f[h].href===f[h-1].href&&f.splice(h,1);if(f.length){e.appendChild(b._createCategoryElement(c,e,f[0]));var g=document.createElement("ul");g.className="sideMenuSubMenu";f.forEach(function(a){var b=document.createElement("li");b.className="sideMenuSubMenuItem";var d=document.createElement("a");d.href=a;d.className="sideMenuSubMenuItemLink";
var c=document.createElement("span");c.innerHTML=a.innerHTML;c.className="sideMenuSubMenuItemSpan";d.appendChild(c);b.appendChild(d);g.appendChild(b)});e.appendChild(g)}}})},_createCategoryElement:function(a,b,d){var a=this.categories.getCategory(a),c;n?(c=document.createElement("button"),c.type="button"):(c=document.createElement("a"),c.href=d.href);c.className+=a.imageClass;c.classList.add("submenu-trigger");c.tabIndex="0";b.classList.remove(a.imageClass);return c},_handleEvent:function(a){var b=
a.target,a=a.type==="focus";if(b.tagName!=="A"||a)b.classList.contains("submenu-trigger")&&(n||a)&&this._expandMenu(j.$(".sideMenuSubMenu",b.parentNode))},_expandMenu:function(a){this.getMenuItems().forEach(function(b){b=j.$(".sideMenuSubMenu",b);a!==b&&b.classList.remove("expanded")});a&&a.classList.toggle("expanded")}});return e});
define("orion/globalCommands","i18n!orion/nls/messages,require,orion/commonHTMLFragments,orion/keyBinding,orion/EventTarget,orion/commandRegistry,orion/commands,orion/parameterCollectors,orion/extensionCommands,orion/uiUtils,orion/keyBinding,orion/breadcrumbs,orion/webui/littlelib,orion/webui/splitter,orion/webui/dropdown,orion/webui/tooltip,orion/contentTypes,orion/URITemplate,orion/keyAssist,orion/PageUtil,orion/widgets/themes/ThemePreferences,orion/widgets/themes/container/ThemeData,orion/Deferred,orion/widgets/UserMenu,orion/PageLinks,orion/webui/dialogs/OpenResourceDialog,text!orion/banner/banner.html,text!orion/banner/footer.html,text!orion/banner/toolbar.html,orion/widgets/input/DropDownMenu,orion/util,orion/customGlobalCommands,orion/fileClient,orion/webui/SideMenu,orion/objects".split(","),function(i,
k,j,g,c,f,b,h,e,d,a,m,n,q,o,p,s,u,v,t,w,l,r,y,x,z,E,B,G,D,M,H,J,U,K){var R,N,P,W,T,I,F,C;function A(a,b){if(a.getLabel)return a.getLabel();else{var d=new r;d.resolve(b.properties.name);return d}}function L(a){n.node("progressPane").setAttribute("aria-label",i["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function Y(a,b){var d=a.getServiceReferences("orion.core.auth");Q=[];var l=R.apply(this,arguments);if(l)for(var c=
0;c<d.length;c++){var e=d[c],f=a.getService(e);A(f,e).then(function(a){f.getKey().then(function(b){Q.push(b);f.getUser().then(function(d){l.addUserItem(b,f,a,d)},function(d,c){l.addUserItem(b,f,a,c)});window.addEventListener("storage",function(){ia[b]!==localStorage.getItem(b)&&(ia[b]=localStorage.getItem(b),f.getUser().then(function(d){l.addUserItem(b,f,a,d)},function(){l.addUserItem(b,f,a)}))},!1)})})}}function X(a){return a}function S(a,d,l,c,f){function h(a){for(var b={},d=a.getPropertyKeys(),
l,c=0;c<d.length;c++)l=d[c],b[l]=a.getProperty(l);return b}function g(a,b){var d=null;a.some(function(a){return b===a.getProperty("id")?!!(d=a):!1});return d}function m(a){var l=a.command;if(!l.visibleWhen||l.visibleWhen(d))return a.invocation=new b.CommandInvocation(d,d,null,l,c),(new r).resolve(a);else if(typeof f==="function")return q||(q=f()),r.when(q,function(e){if(e&&d===fa&&(!l.visibleWhen||l.visibleWhen(e)))return a.invocation=new b.CommandInvocation(e,e,null,l,c),a});return(new r).resolve()}
function x(a,d,l){return l?(new r).resolve({relatedLink:a,command:l}):d.then(function(d){return{relatedLink:a,command:new b.Command(d)}})}var y=arguments,n,q,o=a&&a.getServiceReferences("orion.page.link.related");if(o&&o.length!==0){var i=this;r.when(function(){if(n)return n;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new s.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));return b.getContentTypes().then(function(a){return n=a})}(),function(){if(N.apply(i,y)){var b=
a.getServiceReferences("orion.navigate.command"),d=[];o.forEach(function(l){var f=h(l);if(f.id){var r;if((f.nls&&f.nameKey||f.name)&&f.uriTemplate)r=e._createCommandOptions(f,l,a,n,!0),d.push(x(f,r,null));else if(r=g(b,f.id)){var m=h(r),l={};K.mixin(l,m,f);(f=c.findCommand(f.id))?d.push(x(l,null,f)):(r=e._createCommandOptions(m,r,a,n,!0),d.push(x(l,r,null)))}}});r.all(d,X).then(function(a){a.sort(function(a,b){return a.command.name.localeCompare(b.command.name)});return r.all(a.map(m),X).then(function(b){var d=
[],b=b.filter(function(b,l){if(b)return!0;d.push(a[l]);return!1});P.call(i,c,b,d,l);W.apply(i,y)})})}})}}function Z(a){var b=n.node("globalActions");b&&(a.destroy(b),a.renderCommands(b.id,b,{},{},"tool"))}function ca(a){var b=window.getComputedStyle(a,null);return b===null?a:b.getPropertyValue("position")==="absolute"||!a.parentNode||a===document.body?a:ca(a.parentNode)}function ga(a){var b={},d=null;typeof a==="string"&&(a=n.node(a));a||(a=n.node("pageActions"));for(var l=a;l&&l.classList;){if(l.classList.contains("toolComposite")){d=
l;break}l=l.parentNode}if(a.classList.contains("commandMarker"))b.commandNode=a;if(d&&(b.slideContainer=n.$(".slideParameters",d),b.parameterArea=n.$(".parameters",d),b.dismissArea=n.$(".parametersDismiss",d),b.notifications=n.$("#notificationArea",d),d.parentNode&&(b.toolbarTarget=n.$(".toolbarTarget",d.parentNode),b.toolbarTarget)))a=n.bounds(b.toolbarTarget),l=n.bounds(ca(b.toolbarTarget.parentNode)),b.toolbarTargetY=a.top-l.top,b.toolbar=d;return b}function ha(a){if(a=a.slideContainer)if(a.style.left=
"",a.style.top="",a.classList.contains("slideContainerActive")){var b=n.bounds(a),d=n.bounds(a.parentNode);a.style.left=(d.width-b.width)/2+"px";a.style.top="0"}}var f=function(a){var b=document.createElement("a");b.href=a;return b.href}(k.toUrl("auth/NotifyAuthentication.html")),ia={},$=null;R=H.createMenuGenerator||function(a,b){if(n.node("userMenu")){var d=n.node("userDropdown"),l=new o.Dropdown({dropdown:d}),d=new y.UserMenu({dropdownNode:d,dropdown:l,serviceRegistry:a}),l=n.node("userTrigger");
new p.Tooltip({node:l,text:i.Options,position:["below","left"]});var l=document.getElementById("userTrigger"),c=l.className;c+=" imageSprite core-sprite-silhouette";l.className=c;d.setKeyAssist(b);return d}};N=H.beforeGenerateRelatedLinks||function(){return!0};P=H.addRelatedLinkCommands||function(a,b,d,l){this.sideMenu&&this.sideMenu.setRelatedLinks(b,l)};W=H.afterGenerateRelatedLinks||function(){};T=H.afterSetPageTarget||function(){};I=H.generateNavigationMenu||function(){var a=n.node("sideMenu");
if(a){var b=n.node("centralNavigation");new p.Tooltip({node:b,text:i.CentralNavTooltip,position:["right"]});$=this.sideMenu=new U(a,n.node("pageContent"));b.addEventListener("click",$.toggleSideMenu.bind($));(a=n.node("sideMenuToggle"))&&a.addEventListener("click",$.toggleSideMenu.bind($))}};F=H.afterGenerateNavigationMenu||function(){};C=H.afterGenerateBanner||function(){};var Q=[],fa,V=[],O,da=null,aa=null,ba=new c;return{generateBanner:function(a,d,c,e,f,m,y,o){function s(a){a.registerService("orion.cm.managedservice",
{updated:function(a){for(var a=a&&a["links.newtab"]!=="undefined"?a["links.newtab"]?"_blank":"_self":"_self",b=n.$$array(".targetSelector"),d=0;d<b.length;d++)b[d].target=a}},{pid:"nav.config"})}(new w.ThemePreferences(e,new l.ThemeData)).apply();var t=n.node(a);if(!t)throw i["could not find banner parent, id was "]+a;var p=document.createRange();p.selectNode(t);p=p.createContextualFragment(E);n.processTextNodes(p,i);t.firstChild?t.insertBefore(p,t.firstChild):t.appendChild(p);t=n.node("home");t.href=
k.toUrl("edit/edit.html");t.setAttribute("aria-label",i["Orion Home"]);n.node("progressPane").src=b.NO_IMAGE;if(t=n.node("pageToolbar"))t.classList.add("toolbarLayout"),t.innerHTML=G+j.slideoutHTMLFragment("mainToolbar");(t=n.node("closeNotifications"))&&t.setAttribute("aria-label",i["Close notification"]);if(M.isFirefox<=17&&(t=n.node("staticBanner")))t.style.width="100%",t.style.MozBoxSizing="border-box";if(t=n.node("footer"))t.innerHTML=B,n.processTextNodes(t,i);c.setParameterCollector(new h.CommandParameterCollector(ga,
ha));document.addEventListener("keydown",function(a){a.keyCode===n.KEY.ESCAPE&&(a=d.getService("orion.page.message"))&&a.setProgressMessage("")},!1);I.apply(this,arguments);F.apply(this,arguments);t=x.getCategoriesInfo(d);p=x.getPageLinksInfo(d,"orion.page.link");r.all([t,p]).then(function(a){if($){var b=a[1];$.setCategories(a[0]);$.setPageLinks(b);$.setSideMenu()}});if(t=n.$(".split")){var p=n.$(".sidePanelLayout"),u=n.$(".mainPanelLayout");if(p&&u)da={side:p,main:u},da.splitter=new q.Splitter({node:t,
sidePanel:p,mainPanel:u,toggle:!0,closeByDefault:o}),t=new b.Command({name:i["Toggle side panel"],tooltip:i["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){da.splitter.toggleSidePanel()}}),c.addCommand(t),c.registerCommandContribution("pageActions","orion.toggleSidePane",1,null,!0,new g.KeyBinding("l",M.isMac?!1:!0,!0,!1,M.isMac?!0:!1))}var D=!1,H=function(a,b){if(!D){var d=b.getService("orion.page.progress"),l=new z.OpenResourceDialog({searcher:a,progress:d,searchRenderer:a.defaultRenderer,
onHide:function(){D=!1}});window.setTimeout(function(){D=!0;l.show()},0)}},t=new b.Command({name:i["Find File Named..."],tooltip:i["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(){H(f,d)}});c.addCommand(t);c.registerCommandContribution("globalActions","orion.openResource",100,null,!0,new g.KeyBinding("f",!0,!0));t=new b.Command({name:i["Toggle banner and footer"],tooltip:i["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var a=
n.node("banner"),b=n.node("footer"),d=n.node("sideMenu"),l=n.$(".content-fixedHeight"),c=a.style.visibility==="hidden";c?(a.style.visibility="visible",b.style.visibility="visible",l.classList.remove("content-fixedHeight-maximized"),d&&d.classList.remove("sideMenu-maximized")):(a.style.visibility="hidden",b.style.visibility="hidden",l.classList.add("content-fixedHeight-maximized"),d&&d.classList.add("sideMenu-maximized"));ba.dispatchEvent({type:"toggleTrim",maximized:!c});return!0}});c.addCommand(t);
c.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new g.KeyBinding("m",!0,!0));t=new b.Command({name:i["System Configuration Details"],tooltip:i["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return k.toUrl("help/about.html")}});c.addCommand(t);c.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new g.KeyBinding(112,!0,!0));t=new b.Command({name:i["Background Operations"],tooltip:i["Background Operations Tooltip"],
id:"orion.backgroundOperations",hrefCallback:function(){return k.toUrl("operations/list.html")}});c.addCommand(t);c.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new g.KeyBinding("o",!0,!0));aa=new v.KeyAssistPanel({commandRegistry:c});t=new b.Command({name:i["Show Keys"],tooltip:i["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){aa.isVisible()?aa.hide():aa.show();return!0}});c.addCommand(t);c.registerCommandContribution("globalActions",
"orion.keyAssist",100,null,!0,new g.KeyBinding(191,!1,!0));Z(c);Y(d,t.callback);L(d);window.addEventListener("hashchange",function(){c.processURL(window.location.href)},!1);window.setTimeout(function(){s(d)},0);C.apply(this,arguments)},getToolbarElements:ga,getMainSplitter:function(){return da},getKeyAssist:function(){return aa},getGlobalEventTarget:function(){return ba},layoutToolbarElements:ha,setPageTarget:function(a){var b,d,l=a.breadcrumbRootName,c=a.serviceRegistry;a.target?(a.searchService&&
a.searchService.setLocationByMetaData(a.target),a.fileService&&!a.breadcrumbTarget&&(d=l?l+" ":"",d+=a.fileService.fileServiceName(a.target.Location),l=null),b=a.name||a.target.Name,fa=a.target,S.call(this,c,a.target,V,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||(l=l||a.task||a.name),b=a.name,S.call(this,c,{NoTarget:""},V,a.commandService,a.makeAlternate));(O=a.title)||(O=b?b+" - "+a.task:a.task);window.document.title=O;T.apply(this,arguments);if(b=a.breadCrumbContainer?n.node(a.breadCrumbContainer):
n.node("location")){n.empty(b);var e=c&&new J.FileClient(c),c=a.breadcrumbTarget||a.target,e=e&&c&&c.Location?e.fileServiceRootURL(c.Location):null;new m.BreadCrumbs({container:b,resource:c,rootSegmentName:l,workspaceRootSegmentName:d,workspaceRootURL:e,makeFinalHref:a.makeBreadcrumFinalLink,makeHref:a.makeBreadcrumbLink})}},setDirtyIndicator:function(a){if(O)O.charAt(0)==="*"&&!a&&(O=O.substring(1)),a&&O.charAt(0)!=="*"&&(O="*"+O),window.document.title=O;var b=n.node("dirty");if(b)b.textContent=
a?"*":""},setPageCommandExclusions:function(a){V=a},notifyAuthenticationSite:f}});
define("orion/outliner","i18n!orion/nls/messages,orion/Deferred,orion/webui/littlelib,orion/uiUtils,orion/section,orion/explorers/explorer,orion/commands,orion/URITemplate,orion/EventTarget,orion/i18nUtil,orion/edit/editorContext,orion/keyBinding,orion/globalCommands".split(","),function(i,k,j,g,c,f,b,h,e,d,a,m,n){function q(a,b,d,l){this.explorer=b;this._init(a);this.title=d;this.selectionService=l}function o(a,b,d){this.registry=a;this.renderer=new q({checkbox:!1,treeTableClass:"outlineExplorer"},
this,d,b)}function p(a,b){this.items=a;this.root={children:a};this.root.outlinerId=b;this.idItemMap={}}function s(a){this._init(a)}function u(a){this._serviceRegistry=a.serviceRegistry;this._preferences=a.preferences;e.attach(this);this._serviceRegistration=this._serviceRegistry.registerService("orion.edit.outline",this);this._outlinePref=this._preferences.getPreferences("/edit/outline");this._provider=new k;this._providerResolved=!1;this.filteredProviders=[]}q.prototype=new f.SelectionRenderer;q.prototype.constructor=
q;q.prototype.getLabelColumnIndex=function(){return 0};q.prototype.getCellElement=function(a,b,d){if(b){var l=document.createElement("span"),c=document.createElement("span"),a=document.createElement("span");d.appendChild(l);l.appendChild(c);l.appendChild(a);b.className&&(a.className+=b.className);b.children?this.getExpandImage(d,c):c.classList.add("outlineLeafIndent");d=document.createElement("span");if(b.labelPre||b.classNamePre)l=document.createElement("span"),d.appendChild(l),b.labelPre&&l.appendChild(document.createTextNode(b.labelPre)),
b.classNamePre&&(l.className+=b.classNamePre);b.label&&d.appendChild(document.createTextNode(b.label));if(b.labelPost||b.classNamePost)l=document.createElement("span"),d.appendChild(l),b.labelPost&&l.appendChild(document.createTextNode(b.labelPost)),b.classNamePost&&(l.className+=b.classNamePost);b.href?this._createLink(d,b.href,a):b.line||b.column||b.start?(l=(new h("#{,resource,params*}")).expand({resource:this.title,params:b}),this._createLink(d,l,a),b.outlineLink=l):a.appendChild(d)}};q.prototype._createLink=
function(a,b,d){var l=document.createElement("a");d.appendChild(l);l.classList.add("navlinkonpage");l.appendChild(a);this.selectionService?(l.style.cursor="pointer",l.addEventListener("click",function(a){this._followLink(a,b)}.bind(this),!1)):l.href=b;return l};q.prototype.performRowAction=function(a,b){this._followLink(a,b.outlineLink)};q.prototype._followLink=function(a,b){var d=this.selectionService;d&&(g.openInNewWindow(a)?g.followLink(b,a):d.setSelections(b))};o.prototype=new f.Explorer;o.prototype.constructor=
o;o.prototype.filterChanged=function(a){var b=this.getNavHandler(),d=null;if(a){var l="i",d=a.replace(/([.+^=!:${}()|\[\]\/\\])/g,"\\$1"),d=d.replace(/([*?])/g,".$1");/[A-Z]/.test(d)&&(l="");this._currentModifiedFilter=d=RegExp(d,l);this._previousUnmodifiedFilter?0!==a.indexOf(this._previousUnmodifiedFilter)&&this.expandAll():this.expandAll()}else this.expandAll(),this._currentModifiedFilter=null;b=b.getTopLevelNodes();for(l=0;l<b.length;l++)this._filterRecursively(b[l],d);this._previousUnmodifiedFilter=
a};o.prototype._filterRecursively=function(a,b){var d=this.getNavHandler(),l=this,c=d.getRowDiv(a),e=-1!==a.label.search(b);if(a.children&&d.isExpanded(a)){var f=!1;a.children.forEach(function(a){l._filterRecursively(a,b)&&(f=!0)});f||this.myTree.collapse(a)}var h=!b||f||e;b?(h?c.classList.remove("outlineRowHidden"):c.classList.add("outlineRowHidden"),e?c.classList.add("outlineRowMatchesFilter"):c.classList.remove("outlineRowMatchesFilter"),d.setIsNotSelectable(a,!e)):(c.classList.remove("outlineRowHidden"),
c.classList.remove("outlineRowMatchesFilter"),d.setIsNotSelectable(a,!1));return h};o.prototype.postUserExpand=function(a){if(this._currentModifiedFilter)a=this.getNavDict().getValue(a).model,this._expandRecursively(a),this._filterRecursively(a,this._currentModifiedFilter)};p.prototype.constructor=p;p.prototype.getRoot=function(a){a(this.root)};p.prototype.destroy=function(){};p.prototype.getId=function(a){if(a.outlinerId)return a.outlinerId;for(var b=a.label.replace(/[\\\/\.\:\-\_\s]/g,""),d=b,l=
0;this.idItemMap[d]&&this.idItemMap[d]!==a||j.node(d);)d=b+"["+l+"]",l+=1;this.idItemMap[d]=a;return a.outlinerId=d};p.prototype.getIdItemMap=function(){return this.idItemMap};p.prototype.getChildren=function(a,b){if(a.children){for(var d=0;d<a.children.length;d++)a.children[d].parent=a;b(a.children)}else b([])};p.prototype.doExpansions=function(a){for(var b=0;b<this.root.children.length;b++)this.root.children[b].children&&a.expand(this.root.children[b])};s.prototype={_init:function(a){var b=j.node(a.parent),
d=j.node(a.toolbar);if(!b)throw Error("no parent");if(!a.outlineService)throw Error("no outline service");this._parent=b;this._toolbar=d;this._serviceRegistry=a.serviceRegistry;this._contentTypeRegistry=a.contentTypeRegistry;this._outlineService=a.outlineService;this._commandService=a.commandService;this._selectionService=a.selectionService;this._inputManager=a.inputManager;this._sidebar=a.sidebar;var l=this;this._inputManager.addEventListener("InputChanged",function(a){l.setContentType(a.contentType,
a.location);if(l._editor!==a.editor&&(l._editor&&l._editor.removeEventListener("InputChanged",l._editorListener),l._editor=a.editor,l._editor))l._editor.addEventListener("InputChanged",l._editorListener=l.generateOutline.bind(l))});k.when(l._outlineService,function(a){a.addEventListener("outline",function(a){l.providerId=a.providerId;l._renderOutline(a.outline,a.title)})})},generateOutline:function(){this._isActive()&&(this._providerLookup||this._outlineService.emitOutline(this._inputManager))},setSelectedProvider:function(a){this.providerId=
a.getProperty("id");this.providerName=a.getProperty("name");this._outlineService.setProvider(a)},setOutlineProviders:function(a){var b=this.outlineProviders,d=this._isActive();this.outlineProviders=a;this._updateViewModes(b,this.outlineProviders);d&&this._selectNewProvider()},_renderOutline:function(a,b){var d=this._parent;j.empty(d);if(a=a instanceof Array?a:[a]){var l=new p(a);this.explorer=new o(this._serviceRegistry,this._selectionService,b);this.explorer.createTree(d,l,{selectionPolicy:"cursorOnly",
setFocus:!1});l.doExpansions(this.explorer.myTree)}},_selectNewProvider:function(){var a=this.outlineProviders,b=this,d=b._sidebar;a.every(function(a){return b.providerId!==a.getProperty("id")})&&((a=a[0])?d.setViewMode(this._viewModeId(a)):d.setViewMode(d.defaultViewMode))},_viewModeId:function(a){return"outline."+a.getProperty("id")},_updateViewModes:function(a,d){var c=this;a&&a.forEach(function(a){c._sidebar.removeViewMode(c._viewModeId(a))});d.forEach(function(a){c._sidebar.addViewMode(c._viewModeId(a),
{label:a.displayName||a.getProperty("name")||a.name+a.serviceId||"undefined",create:c.createViewMode.bind(c,a),destroy:c.destroyViewMode.bind(c,a)})});var l=c._sidebar;this._commandService.unregisterCommandContribution(this._toolbar.id,"orion.openOutline",null);if(d&&d[0]){var e=c._viewModeId(d[0]);this._commandService.addCommand(new b.Command({name:"Open Outliner",id:"orion.openOutline",callback:function(){var a=n.getMainSplitter();a.splitter.isClosed()&&a.splitter.toggleSidePanel();l.getActiveViewModeId()!==
e&&l.setViewMode(e);if(c._filterInput)c._previousActiveElement=document.activeElement,c._filterInput.select()}}));this._commandService.registerCommandContribution(this._toolbar.id,"orion.openOutline",1,null,!0,new m.KeyBinding("o",!0));this._commandService.renderCommands(this._toolbar.id,this._toolbar,{},{},"tool")}l.renderViewModeMenu()},_isActive:function(){var a=this._sidebar.getActiveViewModeId();if(!a)return!1;var b=this;return this.outlineProviders&&this.outlineProviders.some(function(d){return a===
b._viewModeId(d)})},createViewMode:function(a){this.setSelectedProvider(a);this._createFilterInput();this.generateOutline()},destroyViewMode:function(){if(this.explorer)this.explorer.destroy(),this.explorer=null},_createFilterInput:function(){var a=document.createElement("input");a.classList.add("outlineFilter");a.placeholder=i.Filter;a.type="text";a.addEventListener("input",function(){this._filterInputTimeout&&window.clearTimeout(this._filterInputTimeout);var b=this;this._filterInputTimeout=window.setTimeout(function(){b.explorer.filterChanged(a.value);
b._filterInputTimeout=null},200)}.bind(this));a.addEventListener("keydown",function(b){var d=null,l=null;b.keyCode===j.KEY.DOWN?(a.blur(),d=this.explorer.getNavHandler(),d.focus(),d.getTopLevelNodes()&&(l=d.getTopLevelNodes()[0],d.cursorOn(l,!1,!0),l.isNotSelectable&&d.iterate(!0,!1,!1,!0)),b.preventDefault&&b.preventDefault()):b.keyCode===j.KEY.ESCAPE&&this._previousActiveElement&&this._previousActiveElement.focus()}.bind(this),!1);this._toolbar.appendChild(a);this._filterInput=a},setContentType:function(a,
b){var c=this,l=this.filteredProviders=this._serviceRegistry.getServiceReferences("orion.edit.outliner").filter(function(d){var l=d.getProperty("contentType"),d=d.getProperty("pattern");if(l)return l.some(function(b){return c._contentTypeRegistry.isExtensionOf(a,b)});else if(d&&RegExp(d).test(b))return!0;return!1});this._providerLookup=!0;var e=l.map(function(a){if(a.getProperty("nameKey")&&a.getProperty("nls")){var b=new k;d.getMessageBundle(a.getProperty("nls")).then(function(a,b,d){a.displayName=
d[a.getProperty("nameKey")];b.resolve()}.bind(null,a,b),b.reject);return b}else return a.displayName=a.getProperty("name"),(new k).resolve()});k.all(e,function(a){return a}).then(function(){c._providerLookup=!1;c._outlineService.setOutlineProviders(l);c.setOutlineProviders(l);c.generateOutline()})}};s.prototype.constructor=s;u.prototype={setOutlineProviders:function(a){this.providers=a;var b=this;k.when(this._outlinePref,function(d){for(var l,c=0;c<a.length;c++)if(l=a[c],d.get("outlineProvider")===
a[c].getProperty("id"))break;l&&b.setProvider(l)})},setProvider:function(a){if(this._providerResolved)this._provider=new k;this._provider.resolve(a);this._providerResolved=!0;var b=a.getProperty("id");b&&this._outlinePref.then(function(a){a.put("outlineProvider",b)})},getProvider:function(){return this._provider.promise},emitOutline:function(b){var c=this;k.when(this.getProvider(),function(e){var l=b.getEditor(),f=l.getTitle(),h=c._serviceRegistry,g=h.getService("orion.page.progress"),m=h.getService(e),
n,q;if(n=m.computeOutline)l=b.getContentType(),q=[a.getEditorContext(h),{contentType:l&&l.id}];else if(n=m.getOutline)q=[l.getText(),f];g.progress(n.apply(m,q),d.formatMessage(i.OutlineProgress,f,e.displayName)).then(function(a){a&&c.dispatchEvent({type:"outline",outline:a,title:f,providerId:e.getProperty("id")})})})}};u.prototype.constructor=u;return{Outliner:s,OutlineService:u}});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(i){return{makeRelative:function(i){if(!i)return i;var j=window.location.protocol+"//"+window.location.host;return i.indexOf(j)===0?i.substring(j.length):i},isAtRoot:function(k){if(!k)return!1;if(k==="/workspace")return!0;var j=new URL(i.toUrl("workspace"),window.location.href);return(new URL(k,window.location.href)).href.indexOf(j.href)===0}}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages,orion/Deferred,orion/webui/littlelib,orion/i18nUtil,orion/fileUtils,orion/explorers/explorer,orion/EventTarget,orion/objects,orion/util".split(","),function(i,k,j,g,c,f,b,h,e){function d(a,b,d,c,e,f){this.registry=a;this.root=b;this.fileClient=d;this.idPrefix=c||"";this.excludeFiles=!!e;this.excludeFolders=!!f}function a(a){b.attach(this);this.registry=a.serviceRegistry;this.treeRoot=a.treeRoot;this.selection=a.selection;this.fileClient=
a.fileClient;this.excludeFiles=a.excludeFiles;this.excludeFolders=a.excludeFolders;this.navHandlerFactory=a.navHandlerFactory;this.parentId=a.parentId;this.renderer=a.rendererFactory(this);this.dragAndDrop=a.dragAndDrop;this.setFocus=a.setFocus;this.myTree=this.model=null;this._hookedDrag=this.checkbox=!1;var d=a.modelEventDispatcher?a.modelEventDispatcher:new b;this.modelEventDispatcher=d;var c=this;this._modelListeners={};"copy,copyMultiple,create,delete,deleteMultiple,import,move,moveMultiple".split(",").forEach(function(a){d.addEventListener(a,
c._modelListeners[a]=c.modelHandler[a].bind(c))});this._clickListener=function(a){if(a.target.tagName==="A"){for(a=a.target;a;){if(a._item)break;a=a.parentNode}if(a&&a._item)c.onLinkClick({type:"linkClick",item:a._item})}};(a=j.node(this.parentId))&&a.addEventListener("click",this._clickListener);var e=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&a["links.newtab"]!=="undefined"?a["links.newtab"]?"_blank":"_self":"_self";e.setTarget&&
e.setTarget(a)}},{pid:"nav.config"})}d.prototype=new f.ExplorerModel;h.mixin(d.prototype,{getRoot:function(a){a(this.root)},processParent:function(a,b){var d=a.Projects?[]:[a].concat(a.Parents||[]);if(this.excludeFiles||this.excludeFolders){var c=[],e;for(e in b)if(!(b[e].Directory?this.excludeFolders:this.excludeFiles))if(c.push(b[e]),b[e].parent=a,!b[e].Parents)b[e].Parents=d;b=c}else for(c in b)if(b[c].parent=a,!b[c].Parents)b[c].Parents=d;a.children=b;a.children.sort(function(a,b){var d=a.Directory;
if(d!==b.Directory)return d?-1:1;var d=a.Name&&a.Name.toLowerCase(),l=b.Name&&b.Name.toLowerCase();return d<l?-1:d>l?1:0});return b},getChildren:function(a,b){var d=this;if(a.children)b(a.children);else if(a.Directory!==void 0&&a.Directory===!1)b([]);else if(a.Children)b(d.processParent(a,a.Children));else if(a.Location){var c=null;this.registry&&(c=this.registry.getService("orion.page.progress"));(c?c.progress(this.fileClient.fetchChildren(a.ChildrenLocation),i["Fetching children of "]+a.Name):this.fileClient.fetchChildren(a.ChildrenLocation)).then(function(c){d.destroyed||
b(d.processParent(a,c))},function(){b([])})}else b([])},hasChildren:function(){var a=!1;this.root.Children&&(a=this.root.Children.length>0);return a}});d.prototype.constructor=d;var m,n;a.prototype=Object.create(f.Explorer.prototype);h.mixin(a.prototype,{destroy:function(){var a=this;Object.keys(this._modelListeners).forEach(function(b){a.modelEventDispatcher.removeEventListener(b,a._modelListeners[b])});var b=j.node(this.parentId);b&&b.removeEventListener("click",this._clickListener);f.Explorer.prototype.destroy.call(this)},
onLinkClick:function(a){this.dispatchEvent(a)},onModelCreate:function(a){return this.changedItem(a.parent,!0)},onModelCopy:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){var l;l=(a=a.parent)||b.treeRoot,a=l;d[a.Location]=a});return k.all(Object.keys(d).map(function(a){return b.changedItem(d[a],!0)}))},onModelMove:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){var c=b.treeRoot;if((c.Location||c.ContentLocation)===a.oldValue.Location){var e=b.treeRoot,a=a.newValue,a=
a.ChildrenLocation?a:this.fileClient.read(a.ContentLocation,!0);return k.when(a,function(a){b.dispatchEvent({type:"rootMoved",oldValue:e,newValue:a});b.loadResourceList(a)})}c=(c=a.oldValue.parent)||b.treeRoot;d[c.Location]=c;c=(c=a.parent)||b.treeRoot;d[c.Location]=c;if(a.oldValue.Directory&&a.newValue&&b.isExpanded(a.oldValue))d[a.newValue.Location]=a.newValue});return k.all(Object.keys(d).map(function(a){return b.changedItem(d[a],!0)}))},onModelDelete:function(a){var a=a.items||[a],b=this,d=b.treeRoot,
c;if(a.some(function(a){if(a.oldValue.Location===(d.Location||d.ContentLocation)){if(a.oldValue.Location!==(a.parent.Location||a.parent.ContentLocation))c=a.parent;return!0}return!1}))return this.loadResourceList(c);else{var e={};a.forEach(function(a){a=a.parent;e[a.Location]=a});return k.all(Object.keys(e).map(function(a){return b.changedItem(e[a],!0)}))}},modelHandler:{copy:function(a){return a.count?void 0:this.onModelCopy(a)},copyMultiple:function(a){return this.onModelCopy(a)},create:function(a){return this.onModelCreate(a)},
"delete":function(a){return a.count?void 0:this.onModelDelete(a)},deleteMultiple:function(a){return this.onModelDelete(a)},"import":function(a){return this.changedItem(a.target,!0)},move:function(a){return a.count?void 0:this.onModelMove(a)},moveMultiple:function(a){return this.onModelMove(a)}},_makeDropTarget:function(a,b,d){if(this.dragAndDrop){var f=this,h=this.dragAndDrop,k=function(a){m=a.target};if(d)this._oldDragStart&&b.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=
k;b.addEventListener("dragstart",k,!1);k=function(){m=null};if(d)this._oldDragEnd&&b.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=k;b.addEventListener("dragend",k,!1);k=function(a){b.classList.remove("dragOver");a.preventDefault();a.stopPropagation()};if(d)this._oldDragLeave&&b.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=k;b.addEventListener("dragleave",k,!1);k=function(a){if(m)n=a.dataTransfer.dropEffect=(e.isMac?a.altKey:a.ctrlKey)?"copy":"move";
else if(!e.isIE&&(a.dataTransfer.effectAllowed==="all"||a.dataTransfer.effectAllowed==="uninitialized"||a.dataTransfer.effectAllowed.indexOf("copy")>=0))a.dataTransfer.dropEffect="copy";b.classList.add("dragOver");j.stop(a)};if(d)this._oldDragEnter&&b.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=k;b.addEventListener("dragenter",k,!1);k=function(a){if(m)n=a.dataTransfer.dropEffect=(e.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!e.isIE&&(a.dataTransfer.effectAllowed===
"all"||a.dataTransfer.effectAllowed==="uninitialized"||a.dataTransfer.effectAllowed.indexOf("copy")>=0))a.dataTransfer.dropEffect="copy";j.stop(a)};if(d&&!this._oldDragOver)b.addEventListener("dragover",k,!1),this._oldDragOver=k;var t=null;f.registry&&(t=f.registry.getService("orion.page.progress"));var w=function(a){t?t.setProgressResult(a):window.console.log(a)},l=function(b,d,e,f,h,m){if(!e.Location&&e.fileMetadata)e=e.fileMetadata;d=d||"";if(b.isFile)c.isAtRoot(e.Location)?f.registry&&f.registry.getService("orion.page.message").setProgressResult({Severity:"Error",
Message:i["You cannot copy files directly into the workspace.  Create a folder first."]}):b.file(function(a){h(e,a,f,a.name.indexOf(".zip")===a.name.length-4&&window.confirm(g.formatMessage(i["Unzip ${0}?"],a.name)))});else if(b.isDirectory){var n=b.createReader(),o=function(a){n.readEntries(function(c){for(var e=0;e<c.length;e++)l(c[e],d+b.name+"/",a,f,h,m)})};c.isAtRoot(e.Location)?(t?t.progress(m.createProject(e.ChildrenLocation,b.name),g.formatMessage(i["Creating ${0}"],b.name)):m.createProject(e.ChildrenLocation,
b.name)).then(function(a){f.loadResourceList(f.treeRoot.Path,!0);(t?t.progress(m.read(a.ContentLocation,!0),i["Loading "]+a.name):m.read(a.ContentLocation,!0)).then(function(a){o(a)},w)},w):(t?t.progress(m.createFolder(e.Location,b.name),g.formatMessage(i["Creating ${0}"],b.name)):m.createFolder(e.Location,b.name)).then(function(b){f.modelEventDispatcher.dispatchEvent({type:"create",parent:a,newValue:b});o(b)},w)}},k=function(d){var e;b.classList.remove("dragOver");if(m){e=f.fileClient;for(var x=
m,z;x;){if(x._item){z=x._item;break}x=x.parentNode}if(!z)return;var p=n==="copy",x=p?e.copyFile:e.moveFile;(t?t.showWhile(x.apply(e,[z.Location,a.Location]),g.formatMessage(i[p?"Copying ${0}":"Moving ${0}"],z.Location)):x.apply(e,[z.Location,a.Location])).then(function(b){f.modelEventDispatcher.dispatchEvent({type:p?"copy":"move",oldValue:z,newValue:b,parent:a})},w)}else if(d.dataTransfer.items&&d.dataTransfer.items.length>0)for(e=0;e<d.dataTransfer.items.length;e++)x=null,typeof d.dataTransfer.items[e].getAsEntry===
"function"?x=d.dataTransfer.items[e].getAsEntry():typeof d.dataTransfer.items[e].webkitGetAsEntry==="function"&&(x=d.dataTransfer.items[e].webkitGetAsEntry()),x&&l(x,null,a,f,h,f.fileClient);else if(d.dataTransfer.files&&d.dataTransfer.files.length>0)for(e=0;e<d.dataTransfer.files.length;e++)x=d.dataTransfer.files[e],!x.size&&!x.type?f.registry&&f.registry.getService("orion.page.message").setProgressResult({Severity:"Error",Message:g.formatMessage(i["Did not drop ${0}.  Folder drop is not supported in this browser."],
x.name)}):c.isAtRoot(a.Location)?f.registry&&f.registry.getService("orion.page.message").setProgressResult({Severity:"Error",Message:i["You cannot copy files directly into the workspace.  Create a folder first."]}):h(a,x,f,x.name.indexOf(".zip")===x.name.length-4&&window.confirm(g.formatMessage(i["Unzip ${0}?"],x.name)));j.stop(d)};if(d)this._oldDrop&&b.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=k;b.addEventListener("drop",k,!1)}},createModel:function(){return new d(this.registry,
this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders)},changedItem:function(a,b){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,b);var d=this,c=new k;a.children=a.Children=null;this.model.getChildren(a,function(e){d.getNavHandler();d.myTree.refresh.bind(d.myTree)(a,e,b);c.resolve(e)});return c},showItem:function(a,b){var d=new k;if(!a||!this.model||!this.myTree||!this.myTree.showRoot&&a.Location===this.treeRoot.Location)return d.reject();
var c=this.getRow(a);if(c)d.resolve(c._item||a);else return a.Parents&&a.Parents.length>0?(a.Parents[0].Parents=a.Parents.slice(1),this.expandItem(a.Parents[0],b).then(function(b){var d=this.getRow(a);return!d?this.changedItem(b,!0).then(function(){var b=this.getRow(a);return b?b._item:(new k).reject()}.bind(this)):d._item||a}.bind(this))):b===void 0||b?this.reroot(a):d.reject();return d},expandItem:function(a,b){var d=new k;this.showItem(a,b).then(function(a){this.myTree.isExpanded(a)?d.resolve(a):
this.myTree.expand(this.model.getId(a),function(){d.resolve(a)})}.bind(this),d.reject);return d},reveal:function(a,b){return this.showItem(a,b).then(function(a){var b=this.getNavHandler();b&&(b.cursorOn(a,!0),b.setSelection(a));return a}.bind(this))},reroot:function(){return(new k).reject()},isExpanded:function(a){return this.renderer.tableTree.isExpanded(this.model.getId(a))},getNameNode:function(a){if(a=this.model.getId(a))return j.node(a+"NameLink")},scopeUp:function(){},scopeDown:function(){},
loadResourceList:function(a,b,d){a&&typeof a==="object"&&(a=a.ChildrenLocation||a.ContentLocation);a=c.makeRelative(a);if(!b&&a===this._lastPath)return(new k).resolve(this.treeRoot);this._lastPath=a;var e=this;return b||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),i["Loading "]+a).then(function(){e.treeRoot.Path=a;typeof d==="function"&&d();e.dispatchEvent({type:"rootChanged",root:e.treeRoot});return(new k).resolve(e.treeRoot)},function(a){e.treeRoot.Path=null;e.dispatchEvent({type:"rootChanged",
root:e.treeRoot});return(new k).reject(a)}):(new k).resolve(e.treeRoot)},load:function(a,b,d){var c=j.node(this.parentId),e=j.node("progress");if(!e)e=document.createElement("div"),e.id="progress",j.empty(c),c.appendChild(e);j.empty(e);var f=setTimeout(function(){j.empty(e);e.appendChild(document.createTextNode(b))},500),h=this;return k.when(a,function(a){clearTimeout(f);if(!h.destroyed){h.treeRoot={};for(var b in a)h.treeRoot[b]=a[b];h.model=h.createModel();if(h.dragAndDrop)h._hookedDrag?h._makeDropTarget(h.treeRoot,
c,!0):(a=(a=c&&("draggable"in c||"ondragstart"in c&&"ondrop"in c))&&!(!window.File||!window.FileList||!window.FileReader),h._hookedDrag=!0,a?h._makeDropTarget(h.treeRoot,c,!0):(h.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser.")));var e=new k;h.createTree(h.parentId,h.model,{onComplete:function(a){e.resolve(a)},navHandlerFactory:h.navHandlerFactory,setFocus:typeof h.setFocus==="undefined"?!0:h.setFocus,selectionPolicy:h.renderer.selectionPolicy,onCollapse:function(a){if(h.getNavHandler())h.getNavHandler().onCollapse(a)}});
return e.then(function(){if(typeof d==="function")try{d()}catch(a){h.registry&&h.registry.getService("orion.page.message").setErrorMessage(a)}if(typeof h.onchange==="function")h.onchange(h.treeRoot);return h.treeRoot})}},function(a){clearTimeout(f);h.registry&&h.registry.getService("orion.page.message").setProgressResult(a);return(new k).reject(a)})},onchange:function(){}});a.prototype.constructor=a;return{FileExplorer:a,FileModel:d}});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages,orion/Deferred,orion/explorers/explorer,orion/explorers/navigationUtils,orion/extensionCommands,orion/objects,orion/URITemplate,orion/webui/littlelib".split(","),function(i,k,j,g,c,f,b,h){function e(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function d(a,d,h,g,i,j,v,t,w){var d=f.clone(d),l;if(d.Directory)l=document.createElement("a"),
l.className="navlinkonpage",l.href=!a?m:(new b(a+"#{,resource,params*}")).expand({resource:d.ChildrenLocation}),d.Name&&l.appendChild(document.createTextNode(d.Name));else{i||(i=c.getOpenWithCommands(h));l=document.createElement("a");l.className="navlink targetSelector";j&&typeof j==="object"&&Object.keys(j).forEach(function(a){l[a]=j[a]});var r=null,y=null;if(r=t?t.holderDom:l)y=document.createElement("span"),y.className="core-sprite-file modelDecorationSprite thumbnail",r.appendChild(y);d.Name&&
l.appendChild(document.createTextNode(d.Name));var x=d.Location;if(v&&typeof v==="object")d.params={},f.mixin(d.params,v);(a=c.getOpenWithCommand(h,d,i))&&(x=a.hrefCallback({items:d}));k.when(g.getFileContentType(d),function(a){if(r){var b=r,c=y;if(a){var f,h=a.imageClass,g=a.image;if(h)f=document.createElement("span"),f.className+=h,f.classList.add("thumbnail");else if(g)f=document.createElement("img"),f.src=g,f.classList.add("thumbnail");f&&b.replaceChild(f,c)}}l.href=x;w&&typeof w.updateFileNode===
"function"&&w.updateFileNode(d,l,e(a))})}return l}function a(a,b,d,c){this.explorer=b;this.commandService=d;this.contentTypeService=c;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var m=new b("#{,resource,params*}");a.prototype=new j.SelectionRenderer;a.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};a.prototype.tableCallback=function(a){a.setAttribute("aria-label",i.Navigator);a.setAttribute("role","presentation")};a.prototype.rowCallback=
function(a){a.setAttribute("role","treeitem")};a.prototype.emptyCallback=function(a){var b=document.createElement("tr"),d=document.createElement("td");d.colSpan=this.oneColumn?1:3;var c=document.createElement("div");c.classList.add("noFile");c.textContent=i.NoFile;var e=document.createElement("span");e.appendChild(document.createTextNode(i.File));h.processDOMNodes(c,[e]);d.appendChild(c);b.appendChild(d);a.appendChild(b)};a.prototype.getCellHeaderElement=function(a){if(this.oneColumn&&a!==0)return null;
switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};a.prototype.setTarget=function(a){this.target=a};a.prototype.getFolderImage=function(){if(!this.showFolderImage)return null;var a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};a.prototype.createFolderNode=function(a){var b;this.showFolderLinks?(b=d(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&b.insertBefore(a,b.firstChild)):
(b=document.createElement("span"),b.textContent=a.Name);return b};a.prototype.updateFileNode=function(){};a.prototype.showFolderLinks=!0;a.prototype.getCellElement=function(a,b,e){switch(a){case 0:var a=document.createElement("td"),f=document.createElement("span");f.id=e.id+"MainCol";f.setAttribute("role","presentation");a.appendChild(f);a.setAttribute("role","presentation");f.className="mainNavColumn";var h;if(b.Directory)this.getExpandImage(e,f),h=this.createFolderNode(b),f.appendChild(h),this.explorer._makeDropTarget(b,
h),this.explorer._makeDropTarget(b,e);else{if(!this.openWithCommands)this.openWithCommands=c.getOpenWithCommands(this.commandService);h=d("",b,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this);f.appendChild(h)}if(h)h.id=e.id+"NameLink",h.nodeType===1&&(g.addNavGrid(this.explorer.getNavDict(),b,h),h.setAttribute("role","link"),h.setAttribute("tabindex","-1"));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,f,b,this.explorer,
"tool",null,!0);return a;case 1:if(this.oneColumn)return null;e=document.createElement("td");if(b.LocalTimeStamp)e.textContent=(new Date(b.LocalTimeStamp)).toLocaleString();return e;case 2:if(this.oneColumn)return null;e=document.createElement("td");if(!b.Directory&&typeof b.Length==="number")b=parseInt(b.Length,10)/1024,e.textContent=Math.ceil(b).toLocaleString()+" KB";e.style.textAlign="right";return e}};a.prototype.constructor=a;return{NavigatorRenderer:a,isImage:e,createLink:d}});
define("orion/compare/compareUtils",["orion/URITemplate"],function(i){var k=k||{};k.compareUtils=k.compareUtils||{};k.compareUtils.lookUpMapper=function(i,g,c){for(var f=0,b=0;b<i.length;b++){var h=i[b][g];h===0&&(h=1);if(c>=f&&c<f+h)return{mapperIndex:b,startFrom:f};if(b===i.length-1)break;f+=i[b][g]}return{mapperIndex:i.length-1,startFrom:f}};k.compareUtils.lookUpLineIndex=function(i,g,c){if(c===0)return 0;for(var f=0,b=0;b<c;b++)f+=i[b][g];return f};k.compareUtils.updateMapper=function(i,g,c,f,
b){if(f!==b&&(f>0||b>0)){var h=k.compareUtils.lookUpMapper(i,g,c);if(!(h.mapperIndex<0)){if(f>0)for(var e=c-h.startFrom,c=h.mapperIndex;c<i.length;c++){e=i[c][g]-e;if(f<=e){i[c][g]-=f;break}i[c][g]-=e;f-=e;e=0}b>0&&(i[h.mapperIndex][g]+=b)}}};k.compareUtils.overlapMapper=function(i,g,c,f,b){i=c+i[g]-1;i<c&&(i=c);b<f&&(b=f);return i<f||b<c?!1:!0};k.compareUtils.findFirstDiff=function(i,g,c,f){for(var b=0,h=null,e=0;e<i.length;e++){if(b>f)break;if(k.compareUtils.overlapMapper(i[e],g,b,c,f)&&(h={mapperIndex:e,
startFrom:b},i[e][2]!==0))break;b+=i[e][g]}return h};k.compareUtils.matchMapper=function(i,g,c,f){if(i.length===0)return c;var b=c+Math.round((f-c)/3),h=k.compareUtils.findFirstDiff(i,g,c,f),e=i[h.mapperIndex][g]===0?h.startFrom:h.startFrom+i[h.mapperIndex][g]-1,d=k.compareUtils.lookUpLineIndex(i,1-g,h.mapperIndex),a=h.startFrom-c;return i[h.mapperIndex][2]===0?d-a:b>=h.startFrom&&b<=e?d-Math.round((f-c)/3):b<h.startFrom?d-a:(i[h.mapperIndex][1-g]===0?d:d+i[h.mapperIndex][1-g]-1)-(e-c)};k.compareUtils.getMapperLineCount=
function(i){for(var g=0,c=0;c<i.length;c++)g+=Math.max(i[c][0],i[c][1]);return g};k.compareUtils.getAnnotationIndex=function(i,g){for(var c=0;c<i.length;c++)if(i[c][0]===g)return c;return-1};k.compareUtils.getAnnotationMapperIndex=function(i,g){return i[g][1]};k.compareUtils.getAnnotationIndexByMapper=function(i,g){for(var c=0;c<i.length;c++)if(i[c][1]===g)return{current:c,prev:c-1,next:c+1};return{current:-1,prev:-1,next:-1}};k.compareUtils.isMapperConflict=function(i,g){return g<0?!1:!i[g][3]?!1:
i[g][3]===1};k.compareUtils.mergeDiffBlocks=function(i,g,c,f,b,h){for(var e=0;e<g.length;e++){var d=g[e][0],a=c[g[e][1]];if(a[0]>0){for(var m="",n=0;n<a[0];n++)m=m+f[a[2]-1+n].substring(b)+h;a=i.getLineCount();d>=a&&(d=i.getLineEnd(a-1),n=i.getLineEnd(a-1,!0),d===n?(i.setText(h,d,d),d=a):d=a-1);d=i.getLineStart(d);i.setText(m,d,d)}}};k.compareUtils.generateCompareHref=function(j,g){var c=require.toUrl("compare/compare.html");if(!g.conflict)g.conflict=void 0;if(!g.readonly)g.readonly=void 0;return(new i(c+
"#{,resource,params*}")).expand({resource:j,params:g})};k.compareUtils.generateCompareTreeHref=function(j,g){var c=require.toUrl("compare-tree/compare-tree.html");return(new i(c+"#{,resource,params*}")).expand({resource:j,params:g})};return k.compareUtils});
define("orion/webui/dialogs/DirectoryPrompterDialog","i18n!orion/widgets/nls/messages,orion/webui/littlelib,orion/webui/dialog,orion/fileUtils,orion/selection,orion/explorers/navigationUtils,orion/explorers/explorer,orion/explorers/explorer-table".split(","),function(i,k,j,g,c,f,b,h){function e(a,b){this.explorer=b;this._init(a)}function d(a){this._init(a)}e.prototype=new b.SelectionRenderer;e.prototype.constructor=e;e.prototype.getLabelColumnIndex=function(){return 0};e.prototype.getCellElement=
function(a,b,d){a=document.createElement("td");d.appendChild(a);var c=document.createElement("span");c.id=d.id+"navSpan";a.appendChild(c);c.className="mainNavColumn singleNavColumn";this.getExpandImage(d,c);c.appendChild(document.createTextNode(b.Name))};d.prototype=new j.Dialog;d.prototype.TEMPLATE='<div id="message" style="width: 25em; padding-bottom: 5px;"></div><div id="directoryTree" class="explorerTreeClass" style="width:25em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"></div>';
d.prototype._init=function(a){this.title=a.title||i["Choose a Folder"];this.modal=!0;this.buttons=[{text:i.OK,isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._fileClient=a.fileClient;this._serviceRegistry=a.serviceRegistry;this._message=a.message||"";this._func=a.func;this._initialize()};d.prototype._bindToDom=function(){this.loadFolderList("/");this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";this.$directoryTree.focus()};
d.prototype.loadFolderList=function(a){a=g.makeRelative(a);this.selection=new c.Selection(this._serviceRegistry,"orion.directoryPrompter.selection");this.explorer=new h.FileExplorer({treeRoot:{children:[]},selection:this.selection,serviceRegistry:this._serviceRegistry,fileClient:this._fileClient,parentId:"directoryTree",excludeFiles:!0,rendererFactory:function(a){return new e({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"},a)}});this.explorer.loadResourceList(a,!0,null)};d.prototype.done=
function(){this.selection.getSelection(function(a){this.hide();this._func(a)}.bind(this))};d.prototype.constructor=d;return{DirectoryPrompterDialog:d}});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(i,k,j,g){function c(){}c.prototype={_initialize:function(c,b,h,e,d){this._tooltip=new g.Tooltip({node:c,hideDelay:d||0,afterShowing:this._afterShowingFunction(b).bind(this),afterHiding:h,trigger:e?e:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";c=document.createRange();c.selectNode(this.$parent);c=c.createContextualFragment(this.TEMPLATE);
this.messages&&j.processTextNodes(c,i);this.$parent.appendChild(c);var a=this._tooltip;this.$parent.addEventListener("keydown",function(b){b.keyCode===j.KEY.ESCAPE&&a.hide()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent)},_bindElements:function(c){for(var b=0;b<c.childNodes.length;b++){var h=c.childNodes[b];h.id&&(this["$"+h.id]=h);this._bindElements(h)}},_afterShowingFunction:function(c){return function(){c&&c.bind(this)();if(!this.customFocus){var b=
j.firstTabbable(this.$parent);b&&b.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};c.prototype.constructor=c;return{PopupDialog:c}});
define("orion/webui/dialogs/SFTPConnectionDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/popupdialog","orion/webui/dialog"],function(i,k,j,g){function c(b,c){this.messages=i;this._initialize(b);this._notify=c}function f(b){this._init(b)}localStorage.getItem("orion.sftpConnections")||localStorage.setItem("orion.sftpConnections",JSON.stringify({identifier:"name",label:i.name,items:[]}));c.prototype=new j.PopupDialog;c.prototype.TEMPLATE='<div><label for="sftpHost">${Remote host:}</label><input id="sftpHost" /></div><div><label for="sftpPort">${Port:}</label><input id="sftpPort" /></div><div><label for="sftpPath">${Remote path:}</label><input id="sftpPath" /></div><div><label for="sftpUser">${User name:}</label><input id="sftpUser" /></div><div class="layoutBlock layoutRight"><button id="addSftpConnection" class="dropdownTrigger orionButton commandButton">${Add}</button></div>';
c.prototype._bindToDom=function(){this.$addSftpConnection.addEventListener("click",function(){this._notify({name:this.$sftpUser.value+"@"+this.$sftpHost.value+":"+this.$sftpPort.value+this.$sftpPath.value});this.hide()}.bind(this),!1)};c.prototype.constructor=c;f.prototype=new g.Dialog;f.prototype.TEMPLATE='<div><div><label for="sftpPath">${Location:}</label></div><div><select id="sftpConnectionList" name="sftpConnectionList"></select><button id="newSftpConnection" style="margin-left: 16px;" class="dropdownTrigger orionButton commandButton">${New}<span class="dropdownArrowDown core-sprite-openarrow"></span></button></div><div><label for="sftpPassword">${Password:}</label></div><div><input id="sftpPassword" type="password" /></div><p>${If the same file exists in both the source and destination:}</p><input type="radio" name="overwriteOption" id="overwriteCancel" checked value="overwriteCancel" /><label for="overwriteCancel">${Cancel the transfer}</label><br /><input type="radio" name="overwriteOption" id="overwriteAll" value="overwriteAll" /><label for="overwriteAll">${Always overwrite destination}</label><br /><input type="radio" name="overwriteOption" id="overwriteOlder" value="overWriteOlder" /><label for="overwriteOlder">${Overwrite if source is newer}</label></div>';
f.prototype._init=function(b){this.title="SFTP Transfer";this.messages=i;this.modal=!0;this.buttons=[{text:i["Start Transfer"],callback:this.done.bind(this)}];this.sftpConnectionStoreData=JSON.parse(localStorage.getItem("orion.sftpConnections"));this._func=b.func;this._initialize()};f.prototype._bindToDom=function(){this.$sftpConnectionList.style.minWidth="220px";this._popupDialog=new c(this.$newSftpConnection,this.onAddConnection.bind(this));this._addChildDialog(this._popupDialog);this._populateSelect()};
f.prototype._afterHiding=function(){this._popupDialog.hide()};f.prototype.done=function(){var b=this.$sftpConnectionList.value.split("@"),c,e,d;if(b.length===2)d=b[0],e=b[1];else if(b.length===3)d=b[0]+"@"+b[1],e=b[2];else{this.hide();return}var a=e.indexOf(":");a<=0&&(c=22);var f=e.indexOf("/");f<=0||(c?b=e.substring(0,f):(b=e.substring(0,a),c=e.substring(a+1,f)),e=e.substring(f),this._func(b,c,e,d,this.$sftpPassword.value,this._computeOverwriteValue()));this.hide()};f.prototype._computeOverwriteValue=
function(){if(this.$overwriteCancel.checked)return"no-overwrite";else if(this.$overwriteOlder.checked)return"overwrite-older";return""};f.prototype._populateSelect=function(){k.empty(this.$sftpConnectionList);for(var b=0;b<this.sftpConnectionStoreData.items.length;b++){var c=this.sftpConnectionStoreData.items[b].name,e=document.createElement("option");e.appendChild(document.createTextNode(c));e.value=c;this.$sftpConnectionList.appendChild(e)}};f.prototype.onAddConnection=function(b){for(var c=!1,
e=0;e<this.sftpConnectionStoreData.items.length;e++)if(this.sftpConnectionStoreData.items[e].name===b.name){c=!0;break}if(!c)this.sftpConnectionStoreData.items.unshift(b),localStorage.setItem("orion.sftpConnections",JSON.stringify(this.sftpConnectionStoreData)),this._populateSelect(),this.$sftpConnectionList.value=b.name};f.prototype.constructor=f;return{SFTPConnectionDialog:f}});
define("orion/webui/dialogs/ImportDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/dialog","orion/util"],function(i,k,j,g){function c(c){this._init(c)}c.prototype=new j.Dialog;c.prototype.TEMPLATE='<div ondragover="event.preventDefault()"><div class="uploadContainer" id="uploadContainer"><div class="dottedOutline"><div id="dragArea" class="floatingSection"><div class="uploadInstruction">${Drag a file here}</div><div class="uploadOptions">(<input style="height: 20px;" class="uploadOptionsItem" id="unzipCheckbox" checked="true" type="checkbox"><label style="line-height: 20px;" class="uploadOptionsItem" for="${id}_unzipCheckbox">${unzip zips}</label>)</div><div class="tipInstruction">${or if you prefer}</div></div></div></div><div class="layoutBlock layoutRight"><input type="file" multiple name="selectedFile" id="selectedFile" class="uploadChooser" /><span id="uploadButton" role="button" class="commandButton disabled" tabindex="0">${Upload}</span></div></div>';
c.prototype._init=function(c){this.title=i["Import a file or zip"];this.messages=i;this.modal=!0;this._importLocation=c.importLocation;this._func=c.func;this._initialize()};c.prototype._bindToDom=function(){this.$uploadContainer.addEventListener("dragenter",this.dragEnter.bind(this),!1);this.$uploadContainer.addEventListener("dragover",this.dragOver.bind(this),!1);this.$uploadContainer.addEventListener("dragleave",this.dragLeave.bind(this),!1);this.$uploadContainer.addEventListener("drop",this.drop.bind(this),
!1);this.$selectedFile.addEventListener("change",this.checkUploadState.bind(this),!1);this.$uploadButton.addEventListener("click",this.uploadSelected.bind(this),!1)};c.prototype.handleReadyState=function(c,b){if(this.req.readyState===4){if(this.req.status===400){var h={};try{h=JSON.parse(this.req.responseText)}catch(e){}if(h.JsonData&&h.JsonData.ExistingFiles&&confirm(h.Message+"\nWould you like to retry the import with force overwriting?")){this.uploadFile.bind(this)(b,!0);return}}this.hide();this._func()}};
c.prototype.checkUploadState=function(){this.$selectedFile.files&&this.$selectedFile.files.length>0?this.$uploadButton.classList.remove(this.DISABLED):this.$uploadButton.classList.add(this.DISABLED)};c.prototype.uploadFile=function(c,b){var h=this.$unzipCheckbox.checked&&c.name.indexOf(".zip")===c.name.length-4;this.req=new XMLHttpRequest;this.req.open("post",b?this._importLocation+(this._importLocation.indexOf("?")>0?"&force=true":"?force=true"):this._importLocation,!0);this.req.setRequestHeader("X-Requested-With",
"XMLHttpRequest");this.req.setRequestHeader("Slug",c.name);h||this.req.setRequestHeader("X-Xfer-Options","raw");this.req.setRequestHeader("Content-Type",c.type);this.req.onreadystatechange=function(b){this.handleReadyState.bind(this)(b,c)}.bind(this);this.req.send(c)};c.prototype.uploadSelected=function(){if(!this.$uploadButton.classList.contains(this.DISABLED)&&this.$selectedFile.files&&this.$selectedFile.files.length>0)for(var c=0;c<this.$selectedFile.files.length;c++)this.uploadFile(this.$selectedFile.files[c])};
c.prototype.dragEnter=function(c){if(!g.isIE&&(c.dataTransfer.effectAllowed==="all"||c.dataTransfer.effectAllowed==="uninitialized"||c.dataTransfer.effectAllowed.indexOf("copy")>=0))c.dataTransfer.dropEffect="copy";k.stop(c)};c.prototype.dragLeave=function(c){k.stop(c)};c.prototype.dragOver=function(c){if(!g.isIE&&(c.dataTransfer.effectAllowed==="all"||c.dataTransfer.effectAllowed==="uninitialized"||c.dataTransfer.effectAllowed.indexOf("copy")>=0))c.dataTransfer.dropEffect="copy";k.stop(c)};c.prototype.drop=
function(c){k.stop(c);c=c.dataTransfer.files;if(c.length&&c.length>0)for(var b=0;b<c.length;b++)this.uploadFile(c[b])};c.prototype.constructor=c;return{ImportDialog:c}});
define("orion/fileCommands","i18n!orion/navigate/nls/messages,require,orion/webui/littlelib,orion/i18nUtil,orion/uiUtils,orion/fileUtils,orion/commands,orion/commandRegistry,orion/extensionCommands,orion/contentTypes,orion/compare/compareUtils,orion/Deferred,orion/webui/dialogs/DirectoryPrompterDialog,orion/webui/dialogs/SFTPConnectionDialog,orion/webui/dialogs/ImportDialog,orion/EventTarget".split(","),function(i,k,j,g,c,f,b,h,e,d,a,m,n,q,o,p){function s(a){var b=E;b&&typeof b.dispatchEvent==="function"&&
b.dispatchEvent(a)}function u(a){y?y.setProgressResult(a):window.console.log(a)}function v(a,b,d,l,e){var f,h=!0,r=!1;(b=a.makeNewItemPlaceHolder(b,d,null,!0))?(a=b.refNode,f=b.tempNode,h=!1,r=!0):a=j.node(d);a?c.getUserText({id:d+"EditBox",refNode:a,hideRefNode:h,initialText:l,onComplete:function(a){a&&e(a)},onEditDestroy:function(){try{f&&f.parentNode&&f.parentNode.removeChild(f)}catch(a){}},isInitialValid:!0,insertAsChild:r}):(d=window.prompt(l))&&e(d)}function t(a){if(!a)return{};Array.isArray(a)&&
(a=a.length===1?a[0]:{});return a}function w(a,b,d,c,l,e){y=d;if(c){var h;h=f.isAtRoot(a.treeRoot.ChildrenLocation)?a.treeRoot:y.progress(b.loadWorkspace(a.treeRoot.Location),"Loading workspace");m.when(h,function(a){a=b.createProject(a.ChildrenLocation,c);e&&(a=d.showWhile(a,e));a.then(function(a){d.progress(b.read(a.ContentLocation,!0),"Reading metadata of newly created project "+c).then(function(a){l&&l(a);s({type:"create",parent:h,newValue:a})},u)},u)},u)}}var l={},r=!1,y=null,x=null,z;l.setExplorer=
function(a){z=a};var E;l.getModelEventDispatcher=function(){E||(E=new p);return E};l.uploadFile=function(a,b,d,c,e){this.req=new XMLHttpRequest;this.req.open("post",e?a.ImportLocation+(a.ImportLocation.indexOf("?")>0?"&force=true":"?force=true"):a.ImportLocation,!0);this.req.setRequestHeader("X-Requested-With","XMLHttpRequest");this.req.setRequestHeader("Slug",b.name);c||this.req.setRequestHeader("X-Xfer-Options","raw");this.req.setRequestHeader("Content-Type",b.type);this.req.onreadystatechange=
function(){if(this.req.readyState===4){if(this.req.status===400){var e={};try{e=JSON.parse(this.req.responseText)}catch(f){}if(e.JsonData&&e.JsonData.ExistingFiles&&(d&&d.serviceRegistry?d.serviceRegistry.getService("orion.page.dialog").confirm:confirm)(e.Message+"\nWould you like to retry the import with force overwriting?")){l.uploadFile(a,b,d,c,!0);return}}s({type:"create",parent:a,newValue:null})}}.bind(this);this.req.send(b)};l.updateNavTools=function(a,b,d,c,l,e,f){function h(a,d){(Array.isArray(l)?
l:[l]).forEach(function(c){var l=j.node(c);l&&(c=b._contributionsByScopeId[c],a=a||c&&c.localSelectionService||b.getSelectionService(),c&&a&&a.getSelections(function(a){b.destroy(l);a=!a||Array.isArray(a)&&!a.length;f&&a?b.renderCommands(l.id,l,d,z,"button"):b.renderCommands(l.id,l,null,z,"button")}))})}z=d;if(c){if(d=j.node(c))b.destroy(d);else throw Error("could not find toolbar "+c);if(x&&e.Location!==x)b.closeParameterCollector(),x=e.Location;b.renderCommands(d.id,d,e,z,"button")}l&&h(null,z?
z.treeRoot:null);if(!r){r=!0;var g=a.getService("orion.page.selection");g.addEventListener("selectionChanged",function(){h(g,z?z.treeRoot:null)})}};var B=[],G=!1;l.getCutBuffer=function(){return G?B:null};l.isEqualToOrChildOf=function(a,b){if(a.Location===b.Location)return!0;else if(-1!==a.Location.indexOf(b.Location))return a.parent===b.parent?!1:!0;return!1};l.createFileCommands=function(e,r,x){function p(a){var a=f.makeRelative(a),a=a.split("#"),a=a[a.length-1],b=a.indexOf("/?");b>0&&(a=a.substring(0,
b+1));return a}function k(a){if(!z||!z.isCommandsVisible())return!1;a=t(a);return a.Location&&f.isAtRoot(a.Location)}function E(a,b,d){for(var a=Array.isArray(a)?a:[a],b=function(a){Array.isArray(a)||(a=[a]);var b=[],c=[],l=this;a.forEach(function(e){b.push((d?x.copyFile:x.moveFile).apply(x,[e.Location,l.path,e.Name]).then(function(b){c.push({oldValue:e,newValue:b,parent:l.item});F({type:d?"copy":"move",oldValue:e,newValue:b,parent:l.item,count:a.length})},u))});m.all(b).then(function(){F({type:d?
"copyMultiple":"moveMultiple",items:c})})},c=[],l=0;l<a.length;l++){if(a[l].parent&&a[l].parent.Location)a[l].parent.stripped=a[l].parent.stripped||p(a[l].parent.Location),c.indexOf(a[l].parent.stripped)!==-1||c.push(a[l].parent.stripped);if(a[l].Directory&&!d)a[l].stripped=a[l].stripped||p(a[l].Location),c.push(a[l].stripped)}for(var a=[],f=[],h=z.treeRoot.Children||(z.treeRoot.Workspace?z.treeRoot.Workspace.Children:{}),l=0;l<h.length;l++){var r=h[l];r.stripped=r.stripped||(r.Directory?p(r.Location):
null);r.stripped&&c.indexOf(r.stripped)===-1&&f.push(r)}f.sort(function(a,b){return a.stripped<b.stripped?-1:a.stripped>b.stripped?1:0});for(l=0;l<f.length;l++){for(var c=f[l],h=c.Name,r=c.stripped.split("/").length+1,o=0;o<r-2;o++)h="  "+h;a.push({name:h,path:c.stripped,item:c,callback:b})}f.length>0&&a.push({});a.push({name:i["Choose folder..."],callback:function(a){(new n.DirectoryPrompterDialog({title:i["Choose a Folder"],serviceRegistry:e,fileClient:x,func:function(b){if(b&&b.Location){Array.isArray(a)||
(a=[a]);var c=[],l=[];a.forEach(function(e){var f=b.Location,h=e.Name||null,r=d?x.copyFile:x.moveFile,m=g.formatMessage(d?i["Copying ${0}"]:i["Moving ${0}"],e.Location);d&&e.parent&&e.parent.Location===f&&((h=window.prompt(g.formatMessage(i["Enter a new name for '${0}'"],e.Name),g.formatMessage(i["Copy of ${0}"],e.Name)))||(f=null));f&&(f=r.apply(x,[e.Location,b.Location,h]),c.push(y.showWhile(f,m).then(function(c){l.push({oldValue:e,newValue:c,parent:b});F({type:d?"copy":"move",oldValue:e,newValue:c,
parent:b,count:a.length})},u)))});m.all(c).then(function(){F({type:d?"copyMultiple":"moveMultiple",items:l})})}}})).show()}});return a}function R(a){if(a.parent)return{item:a,parent:a.parent};else if(a.Parents&&a.Parents[0])return{item:a,parent:a.Parents[0]};return x.loadWorkspace(x.fileServiceRootURL(a.Location)).then(function(b){return m.when(b.Children||x.fetchChildren(b)).then(function(d){b.Children=d;d=b.Children.some(function(b){return b.Location===a.Location?(a=b,!0):!1});return{item:a,parent:d?
b:null}})})}function N(a){var b;Array.isArray(a)||(a=[a]);a.some(function(a){a=a.Directory?a:a.parent;if(b){if(b.Location!==a.Location)return b=null,!0}else b=a;return!1});return b&&f.isAtRoot(b.Location)?null:b}function P(a){return!z||!z.isCommandsVisible()?!1:N(a)}function W(a,b){var d=a.Location;m.when(R(a),function(c){a=c.item;var l=c.parent;l&&l.Projects&&l.Projects.some(function(b){return b.Id===a.Id?(d=b.Location,!0):!1});c=x.moveFile(d,l.Location,b);y.showWhile(c,g.formatMessage(i["Renaming ${0}"],
d)).then(function(b){if(!a.parent)a.parent=l;F({type:"move",oldValue:a,newValue:b,parent:l})},u)})}function T(a,b,d){var c=function(a){for(var d=0,c=b,a=a.filter(function(a){return 0===a.Name.indexOf(b)}).map(function(a){return a.Name});-1!==a.indexOf(c);)d++,c=b.concat(" (").concat(d).concat(")");return c};a.children?(a=c(a.children),d(a)):y.progress(x.fetchChildren(a.ChildrenLocation),i["Fetching children of "]+a.Name).then(function(a){a=c(a);d(a)},u)}function I(a,b,d){var c=function(a){if(a){var c=
x[d?"createFolder":"createFile"](b.Location,a);y.showWhile(c,g.formatMessage(i["Creating ${0}"],a)).then(function(a){F({type:"create",parent:b,newValue:a})},u)}};T(b,a,function(a){v(z,b,z.getRow(b),a,function(a){c(a)})})}y=e.getService("orion.page.progress");var F=s.bind(null),C=function(a){if(!z||!z.isCommandsVisible())return!1;var b=Array.isArray(a)?a:[a];if(b.length===0)return!1;for(var d=0;d<b.length;d++)if(a=b[d],!a.Location||a.Projects)return!1;return!0},A=new b.Command({name:i.Rename,tooltip:i["Rename the selected files or folders"],
imageClass:"core-sprite-rename",id:"eclipse.renameResource",visibleWhen:function(a){return!z||!z.isCommandsVisible()?!1:Array.isArray(a)?a.length===1&&a[0].Name:a.Location&&!a.Projects},parameters:new h.ParametersDescription(null,{},function(a){var a=Array.isArray(a.items)?a.items:[a.items],b=z.treeRoot;return a.some(function(a){return a===b})?[new h.CommandParameter("name","text",i["Name:"],b.Name)]:null}),callback:function(a){var b=t(a.items),d;if(a.parameters.hasParameters()&&(d=a.parameters.valueFor("name"))!==
null)W(b,d);else a:{d=z.getNameNode(b);if(!d){if(!a)break a;d=a.domParent||a.domNode}a=d.id+"EditBox";j.node(a)||c.getUserText({id:a,refNode:d,hideRefNode:!0,initialText:b.Name,onComplete:W.bind(null,b),selectTo:b.Directory?"":"."})}}});r.addCommand(A);var L=new d.ContentTypeRegistry(e),A=new b.Command({name:i["Compare with each other"],tooltip:i["Compare the selected 2 files with each other"],id:"eclipse.compareWithEachOther",visibleWhen:function(a){if(!z||!z.isCommandsVisible())return!1;if(Array.isArray(a))if(a.length===
2&&!a[0].Directory&&!a[1].Directory){var b=L.getFilenameContentType(a[0].Name),a=L.getFilenameContentType(a[1].Name);if(b&&(b["extends"]==="text/plain"||b.id==="text/plain")&&a&&(a["extends"]==="text/plain"||a.id==="text/plain"))return!0}else if(a.length===2&&a[0].Directory&&a[1].Directory)return!0;return!1},hrefCallback:function(b){return b.items[0].Directory&&b.items[1].Directory?a.generateCompareTreeHref(b.items[0].Location,{compareTo:b.items[1].Location,readonly:!0}):a.generateCompareHref(b.items[0].Location,
{compareTo:b.items[1].Location,readonly:!1,readonlyRight:!1})}});r.addCommand(A);A=new b.Command({name:i["Compare with..."],tooltip:i["Compare the selected folder with a specified folder"],id:"eclipse.compareWith",visibleWhen:function(a){return!z||!z.isCommandsVisible()?!1:Array.isArray(a)&&a.length===1&&a[0].Directory?!0:!1},callback:function(b){(new n.DirectoryPrompterDialog({title:i["Choose a Folder"],serviceRegistry:e,fileClient:x,func:function(d){d&&d.Location&&(d=a.generateCompareTreeHref(b.items[0].Location,
{compareTo:d.Location,readonly:!0}),window.open(d))}})).show()}});r.addCommand(A);A=new b.Command({name:i.Delete,imageClass:"core-sprite-delete",id:"eclipse.deleteFile",visibleWhen:C,callback:function(a){var b=Array.isArray(a.items)?a.items:[a.items],a=b.length===1?g.formatMessage(i["Are you sure you want to delete '${0}'?"],b[0].Name):g.formatMessage(i["Are you sure you want to delete these ${0} items?"],b.length);e.getService("orion.page.dialog").confirm(a,function(a){if(a){var d=[],a=b.map(function(a){var c=
a.Location;return m.when(R(a),function(e){a=e.item;var f=e.parent;f&&f.Projects&&(c=null,f.Projects.some(function(b){return b.Id===a.Id?(c=b.Location,!0):!1}));if(a.type==="ProjectRoot"&&f.ProjectLocation)c=f.ProjectLocation;if(!c)return(new m).resolve();e=x.deleteFile(c);return y.showWhile(e,g.formatMessage(i["Deleting ${0}"],c)).then(function(){d.push({oldValue:a,newValue:null,parent:f});B=B.filter(function(b){return!l.isEqualToOrChildOf(b,a)});F({type:"delete",oldValue:a,newValue:null,parent:f,
count:b.length})},u)})});m.all(a).then(function(){F({type:"deleteMultiple",items:d})},u)}})}});r.addCommand(A);A=new b.Command({name:i["Export as zip"],tooltip:i["Create a zip file of the folder contents and download it"],imageClass:"core-sprite-exportzip",id:"eclipse.downloadFile",visibleWhen:function(a){if(!z||!z.isCommandsVisible())return!1;a=t(a);return a.ExportLocation&&a.Directory},hrefCallback:function(a){return t(a.items).ExportLocation}});r.addCommand(A);var Y=function(a){a=N(a);if(!a||!a.Location)a=
z.treeRoot,a.Project&&(a=a.children[0]);return a},A=new b.Command({name:i["New File"],tooltip:i["Create a new file"],imageClass:"core-sprite-new_file",id:"eclipse.newFile",callback:function(a){a=Y(a.items);I(i["New File"],a,!1)},visibleWhen:P});r.addCommand(A);var X=new b.Command({name:i["New Folder"],tooltip:i["Create a new folder"],imageClass:"core-sprite-new_folder",id:"eclipse.newFolder",callback:function(a){a=Y(a.items);I(i["New Folder"],a,!0)},visibleWhen:function(a){return P(a)&&!f.isAtRoot(a.Location)}});
r.addCommand(X);A=new h.ParametersDescription([new h.CommandParameter("url","url",i["File URL:"],"URL"),new h.CommandParameter("unzip","boolean",i["Unzip *.zip files:"],!0)]);A=new b.Command({name:i["Import from HTTP..."],tooltip:i["Copy a file from a URL and optionally unzip it"],id:"orion.importZipURL",parameters:A,callback:function(a){var b=N(a.items),d=a.parameters&&a.parameters.valueFor("url");if(b&&d){var c=b.ImportLocation+(b.ImportLocation.indexOf("?")===-1?"?":"&")+"source="+d,a=a.parameters&&
a.parameters.valueFor("unzip")&&d.indexOf(".zip")===d.length-4?"":"raw",c=x.remoteImport(c,{OptionHeader:a});y.showWhile(c,g.formatMessage(i["Importing from ${0}"],d)).then(function(){F({type:"import",target:b})})}},visibleWhen:P});r.addCommand(A);A=new b.Command({name:i["New Folder"],imageClass:"core-sprite-new_folder",tooltip:i["Create an empty folder"],description:i["Create an empty folder on the Orion server.  You can import, upload, or create content in the editor."],id:"orion.new.project",callback:function(a){var b;
N(a.items)?X.callback(a):(b=t(a.items),T(b,i["New Folder"],function(a){v(z,b,z.getRow(b),a,function(a){w(z,x,y,a)})}))},visibleWhen:k});r.addCommand(A);A=new b.Command({name:i["Link to Server"],tooltip:i["Link to existing content on the server"],description:i["Create a folder that links to an existing folder on the server."],imageClass:"core-sprite-link",id:"orion.new.linkProject",parameters:new h.ParametersDescription([new h.CommandParameter("name","text","Name:","New Folder"),new h.CommandParameter("url",
"url",i["Server path:"],"")]),callback:function(a){var b=function(a,b){if(a&&b){var d=x.createProject(z.treeRoot.ChildrenLocation,a,b,!0);y.showWhile(d,g.formatMessage(i["Linking to ${0}"],b)).then(function(a){s({type:"create",parent:z.treeRoot,newValue:a})},u)}};a.parameters&&a.parameters.valueFor("name")&&a.parameters.valueFor("url")?b(a.parameters.valueFor("name"),a.parameters.valueFor("url")):u(i["The name and server location were not specified."])},visibleWhen:k});r.addCommand(A);A=new b.Command({name:i["Go Up"],
tooltip:i["Move up to the parent folder"],imageClass:"core-sprite-go-up",id:"eclipse.upFolder",callback:function(){typeof z.scopeUp==="function"&&z.scopeUp()},visibleWhen:function(a){if(!z||!z.isCommandsVisible())return!1;a=z.treeRoot;return a.Parents||a.type==="Project"}});r.addCommand(A);A=new b.Command({name:i["Go Into"],tooltip:i["Move into the selected folder"],imageClass:"core-sprite-go-down",id:"eclipse.downFolder",callback:function(a){typeof z.scopeDown==="function"&&z.scopeDown(a.items[0])},
visibleWhen:function(a){if(!z||!z.isCommandsVisible())return!1;if(typeof z.scopeDown!=="function")return!1;a=t(a);return a.Directory&&a.Location!==z.treeRoot.Location}});r.addCommand(A);A=new b.Command({name:i["Import local file..."],tooltip:i["Copy files and folders from your local file system"],imageClass:"core-sprite-importzip",id:"orion.import",callback:function(a){var b=N(a.items);(new o.ImportDialog({importLocation:b.ImportLocation,func:function(){F({type:"import",target:b})}})).show()},visibleWhen:P});
r.addCommand(A);A=new b.Command({name:i["SFTP from..."],tooltip:i["Copy files and folders from a specified SFTP connection"],imageClass:"core-sprite-transferin",id:"orion.importSFTP",callback:function(a){var b=N(a.items);(new q.SFTPConnectionDialog({func:function(a,d,c,l,e,f){d=x.remoteImport(b.ImportLocation,{OptionHeader:f?"sftp,"+f:"sftp",Host:a,Port:d,Path:c,UserName:l,Passphrase:e});y.showWhile(d,g.formatMessage(i["Importing from ${0}"],a)).then(function(a){F({type:"import",target:b});u(a)},
u)}})).show()},visibleWhen:P});r.addCommand(A);A=new b.Command({name:i["SFTP to..."],tooltip:i["Copy files and folders to a specified SFTP location"],imageClass:"core-sprite-transferout",id:"eclipse.exportSFTPCommand",callback:function(a){var b=t(a.items);(new q.SFTPConnectionDialog({func:function(a,d,c,l,e,f){d=x.remoteExport(b.ExportLocation,{OptionHeader:f?"sftp,"+f:"sftp",Host:a,Port:d,Path:c,UserName:l,Passphrase:e});y.showWhile(d,g.formatMessage(i.Exporting,a)).then(u,u)}})).show()},visibleWhen:function(a){if(!z||
!z.isCommandsVisible())return!1;a=t(a);return a.ExportLocation&&a.Directory}});r.addCommand(A);A=new b.Command({name:i["Copy to"],tooltip:"Copy files and folders to a specified location",id:"eclipse.copyFile",choiceCallback:function(a,b){return E(a,b,!0)},visibleWhen:C});r.addCommand(A);A=new b.Command({name:i["Move to"],tooltip:i["Move files and folders to a new location"],id:"eclipse.moveFile",choiceCallback:function(a,b){return E(a,b,!1)},visibleWhen:C});r.addCommand(A);var S=function(a){var b=
z.getNavHandler();G&&B.forEach(function(a){b.enableItem(a)});G=!1;B=a.items},A=new b.Command({name:i.Cut,id:"eclipse.cut",callback:function(a){var b=z.getNavHandler();S(a);B.length&&(G=!0,B.forEach(function(a){b.disableItem(a)}))},visibleWhen:C});r.addCommand(A);C=new b.Command({name:i.Copy,id:"eclipse.copySelections",callback:S,visibleWhen:C});r.addCommand(C);C=new b.Command({name:i.Paste,id:"eclipse.pasteSelections",visibleWhen:function(a){return!z||!z.isCommandsVisible()?!1:P(a)},callback:function(a){var b=
N(a.items);if(B.length>0&&b)if(f.isAtRoot(b.Location))u(i["Cannot paste into the root"]);else{var d=G?x.moveFile:x.copyFile,c=[],l=[];B.forEach(function(a){var e=a.Location,f=a.Name||null;if(e){var h=b.Location||b.ContentLocation,r=!1;if(a.parent&&a.parent.Location===h)r=!0;else{var m=b.Children||b.children;m&&(r=m.some(function(b){return b.Name===a.Name}))}r&&((f=window.prompt(g.formatMessage(i["Enter a new name for '${0}'"],a.Name),g.formatMessage(i["Copy of ${0}"],a.Name)))||(e=null));if(e){var f=
d.apply(x,[e,h,f]),n=G?"move":"copy";l.push(y.showWhile(f,g.formatMessage(i[G?"Moving ${0}":"Pasting ${0}"],e)).then(function(d){c.push({oldValue:a,newValue:d,parent:b});F({type:n,oldValue:a,newValue:d,parent:b,count:B.length})},u))}}});m.all(l).then(function(){F({type:G?"moveMultiple":"copyMultiple",items:c});if(G){var a=z.getNavHandler();B.forEach(function(b){a.enableItem(b)});B=[];G=!1}})}}});r.addCommand(C);return(new m).resolve()};l.createNewContentCommand=function(a,d,c,l,e,r,g){var l=c?[]:
[new h.CommandParameter("folderName","text",i["Folder name:"],d),new h.CommandParameter("url","url",i["Extracted from:"],l),new h.CommandParameter("unzip","boolean",i["Unzip *.zip files:"],!0)],m=null;l.length>0&&(m=new h.ParametersDescription(l));return new b.Command({name:d,parameters:m,id:a,callback:function(a){if(c)window.open(c);else if(a.parameters&&a.parameters.valueFor("folderName")){var b=a.parameters.valueFor("folderName");w(e,r,g,b,function(b){a.parameters.clientCollect=!0;a.commandRegistry.runCommand("orion.importZipURL",
b,e,a.parameters)})}else v(e,a.items,a.domNode.id,d,function(b){w(e,r,g,b,function(b){a.commandRegistry.runCommand("orion.importZipURL",b,e,a.parameters)})})},visibleWhen:function(a){if(!e||!e.isCommandsVisible())return!1;a=t(a);return a.Location&&f.isAtRoot(a.Location)}})};return l});
define("orion/widgets/projects/ProjectOptionalParametersDialog",["orion/webui/littlelib","orion/webui/dialog"],function(i,k){function j(g){this._init(g)}j.prototype=new k.Dialog;j.prototype.TEMPLATE='<div id="message" style="width: 25em; padding-bottom: 5px;"></div><div id="paramsArea"><table id="paramsTable"></table></div>';j.prototype._init=function(g){this.title=g.title;this._data=g.data;this._idPrefix="ParamInput_";this.modal=!0;this.buttons=[{text:"OK",isDefault:!0,callback:this.done.bind(this)}];
this.customFocus=!0;this._func=g.func;this._initialize()};j.prototype._bindToDom=function(){this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";var g=!0;if(this._data.parameters)for(var c in this._data.parameters.parameterTable){var f=this._data.parameters.parameterNamed(c),b=document.createElement("tr"),h=document.createElement("td"),e=document.createElement("label");e["for"]=c;e.appendChild(document.createTextNode(f.label));h.appendChild(e);
b.appendChild(h);h=document.createElement("td");f.type==="textarea"?e=document.createElement("textarea"):(e=document.createElement("input"),e.type=f.type);e.value=this._data.parameters.valueFor(c);e.id=this._idPrefix+c;h.appendChild(e);b.appendChild(h);this.$paramsTable.appendChild(b);g&&(e.focus(),g=!1)}if(this._data.parameters._options.optionalParams)for(g=0;g<this._data.parameters._options.optionalParams.length;g++){f=this._data.parameters._options.optionalParams[g];b=document.createElement("tr");
h=document.createElement("td");e=document.createElement("label");e["for"]=this._idPrefix+f.id;e.appendChild(document.createTextNode(f.name));h.appendChild(e);b.appendChild(h);h=document.createElement("td");f.type==="textarea"?e=document.createElement("textarea"):(e=document.createElement("input"),e.type=f.type);if(f.value)e.value=f.value;e.id=this._idPrefix+f.id;h.appendChild(e);b.appendChild(h);this.$paramsTable.appendChild(b)}};j.prototype.done=function(){if(this._data.parameters)for(var g in this._data.parameters.parameterTable)this._data.parameters.setValue(g,
i.node(this._idPrefix+g).value);if(this._data.parameters._options.optionalParams)for(g=0;g<this._data.parameters._options.optionalParams.length;g++){var c=this._data.parameters._options.optionalParams[g];c.value=i.node(this._idPrefix+c.id).value}this.hide();i.empty(this.$paramsTable);this._func()};j.prototype.constructor=j;return{ProjectOptionalParametersDialog:j}});
define("orion/editor/i18n",{load:function(i,k,j){k.specified&&k.specified("orion/bootstrap")?k(["orion/i18n!"+i],function(g){j(g)}):j({})}});
define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",matchingSearch:"Matching Search",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up",
pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down",
selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word",
deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point",
setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",
findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All",
collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode entered",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",lineColumn:"Line ${0} : Col ${1}",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right",
viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward",
vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character",
viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",replaceAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",nothingReplaced:"Nothing replaced",notFound:"Not found"});
define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(i,k){var j={root:k},g;for(g in i)i.hasOwnProperty(g)&&typeof j[g]==="undefined"&&(j[g]=i[g]);return j});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(i,k){function j(b,a,c){this.start=b;this.end=a;this._projectionModel=c;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function g(){}function c(b,a){var c=b.lastIndexOf("."),c=b.substring(c+1),e={title:i[c],style:{styleClass:"annotation "+c},html:"<div class='annotationHTML "+c+"'></div>",overviewStyle:{styleClass:"annotationOverview "+c}};a?e.lineStyle={styleClass:"annotationLine "+
c}:e.rangeStyle={styleClass:"annotationRange "+c};g.registerType(b,e)}function f(){}function b(b){this._annotations=[];var a=this;this._listener={onChanged:function(b){a._onChanged(b)}};this.setTextModel(b)}function h(b,a){this._view=b;this._annotationModel=a;var c=this;this._listener={onDestroy:function(a){c._onDestroy(a)},onLineStyle:function(a){c._onLineStyle(a)},onChanged:function(a){c._onAnnotationModelChanged(a)}};b.addEventListener("Destroy",this._listener.onDestroy);b.addEventListener("postLineStyle",
this._listener.onLineStyle);a.addEventListener("Changed",this._listener.onChanged)}j.prototype={_expandedHTML:"<div class='annotationHTML expanded'></div>",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"<div class='annotationHTML collapsed'></div>",_collapsedStyle:{styleClass:"annotation collapsed"},_collapse:function(){if(!this.expanded)return!1;this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);
return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},collapse:function(){if(this._collapse()){var b=this._projectionModel,a=b.getBaseModel();this._projection={annotation:this,start:a.getLineStart(a.getLineAtOffset(this.start)+1),end:a.getLineEnd(a.getLineAtOffset(this.end),!0)};b.addProjection(this._projection)}},expand:function(){this._expand()&&
this._projectionModel.removeProjection(this._projection)}};g.ANNOTATION_ERROR="orion.annotation.error";g.ANNOTATION_WARNING="orion.annotation.warning";g.ANNOTATION_TASK="orion.annotation.task";g.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";g.ANNOTATION_BOOKMARK="orion.annotation.bookmark";g.ANNOTATION_FOLDING="orion.annotation.folding";g.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";g.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";g.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";
g.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";g.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";g.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";g.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";g.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";g.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";g.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";g.ANNOTATION_BLAME="orion.annotation.blame";g.ANNOTATION_CURRENT_BLAME=
"orion.annotation.currentBlame";var e={};g.registerType=function(b,a){var c=a;if(typeof c!=="function")c=function(a,b,d){this.start=a;this.end=b;if(d!==void 0)this.title=d},c.prototype=a;c.prototype.type=b;e[b]=c;return b};g.createAnnotation=function(b,a,c,e){return new (this.getType(b))(a,c,e)};g.getType=function(b){return e[b]};c(g.ANNOTATION_ERROR);c(g.ANNOTATION_WARNING);c(g.ANNOTATION_TASK);c(g.ANNOTATION_BREAKPOINT);c(g.ANNOTATION_BOOKMARK);c(g.ANNOTATION_CURRENT_BRACKET);c(g.ANNOTATION_MATCHING_BRACKET);
c(g.ANNOTATION_CURRENT_SEARCH);c(g.ANNOTATION_MATCHING_SEARCH);c(g.ANNOTATION_READ_OCCURRENCE);c(g.ANNOTATION_WRITE_OCCURRENCE);c(g.ANNOTATION_SELECTED_LINKED_GROUP);c(g.ANNOTATION_CURRENT_LINKED_GROUP);c(g.ANNOTATION_LINKED_GROUP);c(g.ANNOTATION_CURRENT_LINE,!0);c(g.ANNOTATION_BLAME,!0);c(g.ANNOTATION_CURRENT_BLAME,!0);g.registerType(g.ANNOTATION_FOLDING,j);f.addMixin=function(b){var a=f.prototype,c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])};f.prototype={addAnnotationType:function(b){if(!this._annotationTypes)this._annotationTypes=
[];this._annotationTypes.push(b)},getAnnotationTypePriority:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===b)return a+1;return 0},getAnnotationsByType:function(b,a,c){b=b.getAnnotations(a,c);for(c=[];b.hasNext();)a=b.next(),this.getAnnotationTypePriority(a.type)!==0&&c.push(a);var e=this;c.sort(function(a,b){return e.getAnnotationTypePriority(a.type)-e.getAnnotationTypePriority(b.type)});return c},isAnnotationTypeVisible:function(b){return this.getAnnotationTypePriority(b)!==
0},removeAnnotationType:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===b){this._annotationTypes.splice(a,1);break}}};b.prototype={addAnnotation:function(b){if(b){var a=this._annotations,c=this._binarySearch(a,b.start);a.splice(c,0,b);b._annotationModel=this;this.onChanged({type:"Changed",added:[b],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(b,a){var c=this._annotations,e,f=0,h;h=b===
void 0&&a===void 0?function(){return f<c.length?c[f++]:null}:function(){for(;f<c.length;){var e=c[f++];if(b===e.start||(b>e.start?b<e.end:e.start<a))return e;if(e.start>=a)break}return null};e=h();return{next:function(){var a=e;a&&(e=h());return a},hasNext:function(){return e!==null}}},modifyAnnotation:function(b){if(b&&!(this._getAnnotationIndex(b)<0))this.onChanged({type:"Changed",added:[],removed:[],changed:[b]})},onChanged:function(b){return this.dispatchEvent(b)},removeAnnotations:function(b){var a=
this._annotations,c,e;if(b){c=[];for(e=a.length-1;e>=0;e--){var f=a[e];if(f.type===b)a.splice(e,1),c.splice(0,0,f),f._annotationModel=null}}else c=a;this.onChanged({type:"Changed",removed:c,added:[],changed:[]})},removeAnnotation:function(b){if(b){var a=this._getAnnotationIndex(b);if(!(a<0))b._annotationModel=null,this.onChanged({type:"Changed",removed:this._annotations.splice(a,1),added:[],changed:[]})}},replaceAnnotations:function(b,a){var c=this._annotations,e,f,h,g=[];if(b)for(e=b.length-1;e>=
0;e--)if(h=b[e],f=this._getAnnotationIndex(h),!(f<0))h._annotationModel=null,c.splice(f,1),g.splice(0,0,h);a||(a=[]);for(e=0;e<a.length;e++)h=a[e],f=this._binarySearch(c,h.start),h._annotationModel=this,c.splice(f,0,h);this.onChanged({type:"Changed",removed:g,added:a,changed:[]})},setTextModel:function(b){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=b)&&this._model.addEventListener("Changed",this._listener.onChanged)},_binarySearch:function(b,a){for(var c=
b.length,e=-1,f;c-e>1;)f=Math.floor((c+e)/2),a<=b[f].start?c=f:e=f;return c},_getAnnotationIndex:function(b){for(var a=this._annotations,c=this._binarySearch(a,b.start);c<a.length&&a[c].start===b.start;){if(a[c]===b)return c;c++}return-1},_onChanged:function(b){var a=b.start,c=b.removedCharCount,e=this._annotations,f=a+c;if(0<e.length){for(var h={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:b},b=b.addedCharCount-c,c=0;c<e.length;c++){var g=e[c];if(g.start>=f)g._oldStart=g.start,
g._oldEnd=g.end,g.start+=b,g.end+=b,h.changed.push(g);else if(!(g.end<=a))g.start<a&&f<g.end?(g._oldStart=g.start,g._oldEnd=g.end,g.end+=b,h.changed.push(g)):(e.splice(c,1),h.removed.push(g),g._annotationModel=null,g.expand&&g.expand(),c--)}if(h.added.length>0||h.removed.length>0||h.changed.length>0)this.onChanged(h)}}};k.EventTarget.addMixin(b.prototype);h.prototype={destroy:function(){var b=this._view;if(b)b.removeEventListener("Destroy",this._listener.onDestroy),b.removeEventListener("LineStyle",
this._listener.onLineStyle),this.view=null;(b=this._annotationModel)&&b.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var c;if(a.tagName&&!b.tagName)b.tagName=a.tagName;if(a.style){if(!b.style)b.style={};for(c in a.style)b.style[c]||(b.style[c]=a.style[c])}if(a.attributes){if(!b.attributes)b.attributes={};for(c in a.attributes)b.attributes[c]||
(b.attributes[c]=a.attributes[c])}}return b},_mergeStyleRanges:function(b,a){b||(b=[]);var c,e;for(e=0;e<b.length&&a;e++){var f=b[e];if(a.end<=f.start)break;if(!(a.start>=f.end)){c=this._mergeStyle({},f.style);c=this._mergeStyle(c,a.style);var h=[];h.push(e,1);a.start<f.start&&h.push({start:a.start,end:f.start,style:a.style});a.start>f.start&&h.push({start:f.start,end:a.start,style:f.style});h.push({start:Math.max(f.start,a.start),end:Math.min(f.end,a.end),style:c});a.end<f.end&&h.push({start:a.end,
end:f.end,style:f.style});a=a.end>f.end?{start:f.end,end:a.end,style:a.style}:null;Array.prototype.splice.apply(b,h)}}a&&(c=this._mergeStyle({},a.style),b.splice(e,0,{start:a.start,end:a.end,style:c}));return b},_onAnnotationModelChanged:function(b){function a(a,b){h.getBaseModel&&(a=h.mapOffset(a,!0),b=h.mapOffset(b,!0));a!==-1&&b!==-1&&e.redrawRange(a,b)}function c(b,d){for(var e=0;e<b.length;e++)if(f.isAnnotationTypeVisible(b[e].type)){var h=b[e];a(h.start,h.end);d&&h._oldStart!==void 0&&h._oldEnd&&
a(h._oldStart,h._oldEnd)}}var e=this._view;if(e){var f=this,h=e.getModel();c(b.added);c(b.removed);c(b.changed,!0)}},_onDestroy:function(){this.destroy()},_onLineStyle:function(b){var a=this._annotationModel,c=b.textView.getModel(),e=a.getTextModel(),f=b.lineStart,h=b.lineStart+b.lineText.length;e!==c&&(f=c.mapOffset(f),h=c.mapOffset(h));for(a=a.getAnnotations(f,h);a.hasNext();)if(f=a.next(),this.isAnnotationTypeVisible(f.type)){if(f.rangeStyle){var h=f.start,g=f.end;e!==c&&(h=c.mapOffset(h,!0),g=
c.mapOffset(g,!0));b.ranges=this._mergeStyleRanges(b.ranges,{start:h,end:g,style:f.rangeStyle})}if(f.lineStyle)b.style=this._mergeStyle({},b.style),b.style=this._mergeStyle(b.style,f.lineStyle)}}};f.addMixin(h.prototype);return{FoldingAnnotation:j,AnnotationType:g,AnnotationTypeList:f,AnnotationModel:b,AnnotationStyler:h}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate"],function(i,k,j){function g(c,f){for(var b=f.getFileMetadata(),h=c.getServiceReferences("orion.edit.blamer"),e=0;e<h.length;e++){var d=h[e],a={};a.validationProperties=d.getProperty("validationProperties");a.forceSingleItem=!0;a=i._makeValidator(a,c);if(a.validationFunction.bind(a)(b))return c.getService(d)}return null}return{isVisible:function(c,f){return!!g(c,f)&&!!c.getService("orion.core.blame")},getBlame:function(c,
f){var b=g(c,f);b&&b.doBlame(f.getInput()).then(function(b){for(var e=k.getOrionHome(),d=0;d<b.length;d++){var a=b[d],f=new j(a.CommitLink),g={};g.OrionHome=e;a.CommitLink=f.expand(g)}c.getService("orion.core.blame")._setAnnotations(b)})}}});
define("orion/editorCommands","i18n!orion/edit/nls/messages,orion/i18nUtil,orion/webui/littlelib,orion/webui/dialogs/OpenResourceDialog,orion/widgets/input/DropDownMenu,orion/Deferred,orion/URITemplate,orion/commands,orion/keyBinding,orion/commandRegistry,orion/extensionCommands,orion/contentTypes,orion/searchUtils,orion/PageUtil,orion/PageLinks,orion/editor/annotations,orion/blamer,orion/regex,orion/util,orion/edit/editorContext".split(","),function(i,k,j,g,c,f,b,h,e,d,a,m,n,q,o,p,s,u,v,t){function w(a){var d=
new b(a.uriTemplate),c=a.params||{};c.OrionHome=c.OrionHome||o.getOrionHome();var d=d.expand(c),c=document.createElement("div"),l=document.createElement("iframe");l.id=a.id;l.name=a.id;l.type="text/html";l.sandbox="allow-scripts allow-same-origin";l.frameborder=a.border!==void 0?a.border:1;l.src=d;l.className="delegatedUI";if(a.width)c.style.width=a.width,l.style.width=a.width;if(a.height)c.style.height=a.height,l.style.height=a.height;l.style.visibility="hidden";a.parent!==null&&(a.parent||window.document.body).appendChild(c);
c.appendChild(l);l.style.left=a.left||(window.innerWidth-parseInt(l.clientWidth,10))/2+"px";l.style.top=a.top||(window.innerHeight-parseInt(l.clientHeight,10))/2+"px";l.style.visibility="";window.addEventListener("message",function D(b){if(b.source===l.contentWindow&&typeof b.data==="string"&&(b=JSON.parse(b.data),b.pageService==="orion.page.delegatedUI"&&b.source===a.id)){if(b.cancelled)a.cancelled&&a.cancelled();else if(b.result)a.done&&a.done(b.result);else if(b.Status||b.status)a.status&&a.status(b.Status||
b.status);window.removeEventListener("message",D,!1);l.parentNode.removeChild(l)}},!1);return c}function l(a){this.serviceRegistry=a.serviceRegistry;this.commandService=a.commandRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.toolbarId=a.toolbarId;this.saveToolbarId=a.saveToolbarId;this.editToolbarId=a.editToolbarId;this.pageNavId=a.navToolbarId;this.isReadOnly=a.readonly;this._localSearcher=a.textSearcher;this._searcher=a.searcher;this.editorSettings=a.editorSettings;
this.localSettings=a.localSettings}var r={},y=null;r.createDelegatedUI=w;l.prototype={generateSimpleEditorCommands:function(a,b){this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a,b));this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a)},generateEditorCommands:function(a){this.generateBaseEditorCommands(a);this.generateExtraEditorCommands(a)},generateBaseEditorCommands:function(a){this.isReadOnly||(this._generateUndoStackCommands(a),
this._generateSaveCommand(a),this._generateEditCommands(a))},generateExtraEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a)},_generateSettingsCommand:function(a){var b=this,d=new h.Command({imageClass:"core-sprite-wrench",tooltip:i.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return a.installed},callback:function(l){var e=d.settingsDropDown;if(!e||
e.isDestroyed())e=d.settingsDropDown=new c(l.domNode.parentNode,l.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){e.focus()},onHide:function(){a.focus()}}),e.updateContent=b.localSettings.show.bind(b.localSettings),l=e.getContentNode(),l.tabIndex=l.style.marginTop=0;e.click()}});this.commandService.addCommand(d);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new e.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(a){this.commandService.addCommand(new h.Command({name:i.Undo,
id:"orion.undo",visibleWhen:function(){return a.installed},callback:function(){a.getUndoStack().undo()}}));this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.undo",400,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,new e.KeyBinding("z",!0));this.commandService.addCommand(new h.Command({name:i.Redo,id:"orion.redo",visibleWhen:function(){return a.installed},callback:function(){a.getUndoStack().redo()}}));this.commandService.registerCommandContribution(this.editToolbarId||
this.toolbarId,"orion.redo",401,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,v.isMac?new e.KeyBinding("z",!0,!0):new e.KeyBinding("y",!0))},_generateSearchFilesCommand:function(a){var b=this;if(b._searcher){var d=!1;this.commandService.addCommand(new h.Command({name:i.searchFiles,tooltip:i.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return a.installed},callback:function(){if(!d){var c=a.getSelection(),c=a.getText(c.start,c.end),l=b.serviceRegistry.getService("orion.page.progress"),
e=new g.OpenResourceDialog({searcher:b._searcher,progress:l,searchRenderer:b._searcher.defaultRenderer,nameSearch:!1,title:i.searchFiles,message:i.searchTerm,initialText:c,onHide:function(){d=!1;a.focus()}});window.setTimeout(function(){d=!0;e.show(j.node(b.toolbarId))},0)}}}));this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.searchFiles",1,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new e.KeyBinding("h",!0))}},_generateSaveCommand:function(a,
b){var d=this,c=b?b:"orion.save",l=new h.Command({name:i.Save,tooltip:i.saveFile,id:c,visibleWhen:function(){return!a.installed||d.inputManager.getReadOnly()?!1:!0},callback:function(){d.inputManager.save();return!0}});this.commandService.addCommand(l);this.commandService.registerCommandContribution(this.saveToolbarId||this.toolbarId,c,1,this.saveToolbarId?"orion.menuBarFileGroup/orion.saveGroup":null,!1,new e.KeyBinding("s",!0));a.getTextView&&a.getTextView()&&(a.getTextView().setKeyBinding(new e.KeyBinding("s",
!0),"save"),a.getTextView().setAction("save",l.callback,l))},_generateGotoLineCommnand:function(a){var b=this,c=new d.ParametersDescription([new d.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var b=a.getModel().getLineAtOffset(a.getCaretOffset())+1;return[new d.CommandParameter("line","number","Line:",b.toString())]}),c=new h.Command({name:i.gotoLine,tooltip:i.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return a.installed},parameters:c,callback:function(b){var d=
a.getModel();b.parameters&&b.parameters.valueFor("line")?b=b.parameters.valueFor("line"):(b=d.getLineAtOffset(a.getCaretOffset()),(b=prompt(i.gotoLinePrompt,b+1))&&(b=parseInt(b,10)));if(b)a.onGotoLine(b-1,0)}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.gotoLine",3,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new e.KeyBinding("l",!v.isMac,!1,!1,v.isMac),new d.URLBinding("gotoLine",
"line"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("gotoLine",function(d){if(d)return a.onGotoLine(d.line-1,0,void 0,d.callback),!0;b.commandService.runCommand("orion.gotoLine");return!0},c)},_generateFindCommnand:function(a){var b=this,c=new d.ParametersDescription([new d.CommandParameter("find","text","Find:")],{clientCollect:!0},function(){var c=a.getSelection(),l="";c.end>c.start&&(l=a.getModel().getText(c.start,c.end),b._localSearcher&&b._localSearcher.getOptions().regex&&(l=
u.escape(l)));return[new d.CommandParameter("find","text","Find:",l)]}),c=new h.Command({name:i.Find,tooltip:i.Find,id:"orion.editor.find",visibleWhen:function(){return a.installed},parameters:c,callback:function(d){if(b._localSearcher){var c="",l=null,e=a.getSelection();e.end>e.start&&d.parameters.valueFor("useEditorSelection")?(c=a.getModel().getText(e.start,e.end),b._localSearcher.getOptions().regex&&(c=u.escape(c))):d.parameters&&d.parameters.valueFor("find")&&(c=d.parameters.valueFor("find"),
l=q.matchResourceParameters(),n.convertFindURLBinding(l));if(l){b._localSearcher.setOptions({regex:l.regEx,caseInsensitive:!l.caseSensitive});d={};if(l.atLine)d.start=a.getModel().getLineStart(l.atLine-1);b._localSearcher.show({findString:c,replaceString:l.replaceWith});b._localSearcher.find(!0,d)}else b._localSearcher.show({findString:c});return!0}return!1}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.editor.find",0,
this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new e.KeyBinding("f",!0),new d.URLBinding("find","find"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("find",function(a){if(a)return b._localSearcher.show(a),!0;b.commandService.runCommand("orion.editor.find",null,null,new d.ParametersDescription([new d.CommandParameter("useEditorSelection","text","","true")],{clientCollect:!0}));return!0},c)},_generateBlame:function(a){var b=this;this.commandService.addCommand(new h.Command({name:i.Blame,
tooltip:i.BlameTooltip,id:"orion.edit.blame",parameters:new d.ParametersDescription([new d.CommandParameter("blame","boolean")],{clientCollect:!0}),visibleWhen:function(){return!a.installed?!1:s.isVisible(b.serviceRegistry,b.inputManager)},callback:function(d){for(var c=!1,l=a.getAnnotationModel().getAnnotations();l.hasNext();)if(l.next().type===p.AnnotationType.ANNOTATION_BLAME){c=!0;break}c=!c;d.parameters&&d.parameters.valueFor("blame")&&(c=d.parameters.valueFor("blame")==="true");c?s.getBlame(b.serviceRegistry,
b.inputManager):a.showBlame([])}}));this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",1,"orion.menuBarToolsGroup",!1,new e.KeyBinding("b",!0,!0),new d.URLBinding("blame","blame"))},_generateEditCommands:function(b){function d(a){if(!a)return null;var b=new e.KeyBinding;e.KeyBinding.apply(b,a);return b}function c(a,b){!b&&a&&typeof a.HTML!=="undefined"&&delete a.HTML;var d=l.serviceRegistry.getService("orion.page.message");d?d.setProgressResult(a):window.console.log(a)}
var l=this,r=this.toolbarId,g=this.serviceRegistry,n=g.getServiceReferences("orion.edit.command"),o=this.inputManager,q=g.getService("orion.page.progress"),s=function(a,d,e){var f=e.visibleWhen;e.visibleWhen=function(a){return!b.installed||l.inputManager.getReadOnly()?!1:!f||f(a)};e.callback=function(){b=this;var l=b.getSelection?b.getSelection():{start:0,end:0},e=b.getModel(),f=function(a){typeof a==="object"&&a?(a.text&&b.setText(a.text),a.selection&&(b.setSelection&&b.setSelection(a.selection.start,
a.selection.end,!0),b.focus())):typeof a==="string"&&(b.setText(a,l.start,l.end,!0),b.setSelection&&b.setSelection(l.start,l.start+a.length),b.focus())},h;d.execute?(e={contentType:o.getContentType(),input:o.getInput()},h=t.getEditorContext(g),h.openDelegatedUI=w,h.setStatus=c,e=d.execute(h,e),h=null):(e=d.run(e.getText(l.start,l.end),e.getText(),l,o.getInput()),h=function(b){if(b&&b.uriTemplate){var d={};d.uriTemplate=b.uriTemplate;d.params=o.getFileMetadata();d.id=a.id;d.width=b.width;d.height=
b.height;d.done=f;d.status=c;w(d)}else b&&(b.Status||b.status)?c(b.Status||b.status):f(b)});q.showWhile(e,k.formatMessage(i.running,a.name)).then(h);return!0};e.callback=e.callback.bind(b);return new h.Command(e)};f.when(function(a){if(y)return y;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new m.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));return b.getContentTypes().then(function(a){return y=a})}(this.serviceRegistry),function(){var c=[],e=100;n.forEach(function(f){var h=
f.getProperty("editor");if(!h||!(b.id&&h!==b.id)){for(var r=l.serviceRegistry.getService(f),g={},h=f.getPropertyKeys(),m=0;m<h.length;m++)g[h[m]]=f.getProperty(h[m]);g.forceSingleItem=!0;f=a._createCommandOptions(g,f,l.serviceRegistry,y,!1,function(){return o.getFileMetadata()});c.push(f);f.then(function(a){a=s(g,r,a);l.commandService.addCommand(a);l.commandService.registerCommandContribution(l.toolbarId,a.id,e,"orion.menuBarToolsGroup",!1,d(g.key))});e++}});f.all(c,function(a){return{_error:a}}).then(function(){var a;
if(a=o.getFileMetadata()){var d=j.node(r);d&&(l.commandService.destroy(d),l.commandService.renderCommands(d.id,d,a,b,"button"));if(d=j.node("pageNavigationActions"))l.commandService.destroy(d),l.commandService.renderCommands(d.id,d,b,b,"button")}})})}};r.EditorCommandFactory=l;return r});
define("orion/projectCommands","i18n!orion/navigate/nls/messages,orion/webui/littlelib,orion/commands,orion/Deferred,orion/webui/dialogs/DirectoryPrompterDialog,orion/commandRegistry,orion/i18nUtil,orion/webui/dialogs/ImportDialog,orion/widgets/projects/ProjectOptionalParametersDialog,orion/fileCommands,orion/editorCommands,orion/EventTarget,orion/URITemplate,orion/PageLinks,orion/objects".split(","),function(i,k,j,g,c,f,b,h,e,d,a,m,n,q,o){function p(a){if(!a)return{};Array.isArray(a)&&(a=a.length===
1?a[0]:{});return a}function s(a,b){if(!a)return null;for(var d=[],c=0;c<a.length;c++)d.push(new f.CommandParameter(a[c].id,a[c].type,a[c].name));return new f.ParametersDescription(d,{hasOptionalParameters:!!b,optionalParams:b})}function u(a,b,d){if(b.parameters&&b.parameters.optionsRequested)(new e.ProjectOptionalParametersDialog({title:d,data:b,func:function(){b.parameters.optionsRequested=!1;a(b)}.bind(this)})).show();else{d=b.oldParams||{};if(b.parameters)for(var c in b.parameters.parameterTable)d[c]=
b.parameters.valueFor(c);if(b.parameters&&b.parameters._options.optionalParams)for(var l=0;l<b.parameters._options.optionalParams.length;l++)c=b.parameters._options.optionalParams[l],d[c.id]=c.value;return d}}function v(a,b,d){!b&&a&&typeof a.HTML!=="undefined"&&delete a.HTML;y.setProgressResult(a);a.ToSave&&y.showWhile(d.projectClient.saveProjectLaunchConfiguration(d.project,a.ToSave.ConfigurationName,d.deployService.id,a.ToSave.Parameters,a.ToSave.Url,a.ToSave.ManageUrl,a.ToSave.Path,a.ToSave.UrlTitle,
a.ToSave.Type),"Saving configuration").then(function(a){t(d.project,d.deployService,a);x&&x.dispatchEvent({type:"create",newValue:a})},d.errorHandler)}function t(a,b,d){var c;window.sessionStorage&&(c=d?"orion.launchConfiguration.deploy."+d.ServiceId+d.Name:"orion.project.deploy."+b.id,window.sessionStorage[z+a]=c);x&&x.dispatchEvent({type:"changedDefault",newValue:c})}function w(b,d){if(x&&d.launchConfiguration)d.launchConfiguration.status={State:"PROGRESS"},x.dispatchEvent({type:"changeState",newValue:d.launchConfiguration});
t(d.project.Name,d.deployService,d.launchConfiguration);y.showWhile(d.deployService.deploy(d.project,b),d.deployService.name+" in progress",!0).then(function(b){if(b){if(b.UriTemplate){var c={};c.uriTemplate=b.UriTemplate;c.width=b.Width;c.height=b.Height;c.id=d.deployService.id;c.done=v;c.status=v;a.createDelegatedUI(c)}if(d.launchConfiguration&&(b.State||b.CheckState))d.launchConfiguration.status=b,x&&x.dispatchEvent({type:"changeState",newValue:d.launchConfiguration});b.ToSave&&y.showWhile(d.projectClient.saveProjectLaunchConfiguration(d.project,
b.ToSave.ConfigurationName,d.deployService.id,b.ToSave.Parameters,b.ToSave.Url,b.ToSave.ManageUrl,b.ToSave.Path,b.ToSave.UrlTitle,b.ToSave.Type),"Saving configuration").then(function(a){t(d.project.Name,d.deployService,a);x&&x.dispatchEvent({type:"create",newValue:a})},d.errorHandler);b={Severity:"Info",HTML:!0};b.Message='Use <a href="'+require.toUrl("edit/edit.html#"+d.project.ContentLocation)+'">Project</a> page to view and manage the application.';y.setProgressResult(b)}},function(a){a.Retry&&
a.Retry.parameters?(a.forceShowMessage&&d.errorHandler(a),d.data.parameters=s(a.Retry.parameters,a.Retry.optionalParameters),d.data.oldParams=b.Params,d.commandService.collectParameters(d.data)):d.errorHandler(a)})}function l(a,b,d,c,l,e,f,h){var r;r=c.actionComment?h?c.actionComment.replace(/\$\{([^\}]+)\}/g,function(a,b){return h[b]}):c.actionComment:"Getting content from "+c.type;y.showWhile(c.initDependency(l,h,e),r).then(function(b){a.addProjectDependency(e,b).then(function(){E&&E.dispatchEvent({type:"create",
newValue:b,project:e})},d)},function(a){if(a.Retry&&a.Retry.addParameters)f.parameters=s(a.Retry.addParameters,a.Retry.optionalParameters),f.oldParams=h,b.collectParameters(f);d(a)})}var r={},y,x;r.getLaunchConfigurationDispatcher=function(){x||(x=new m);return x};var z="lastProjectDeploy_";r.getDefaultLaunchCommand=function(a){return window.sessionStorage[z+a]};var E;r.getDependencyDispatcher=function(){E||(E=new m);return E};r.updateProjectNavCommands=function(a,b,d,c,l){function e(a){y?y.setProgressResult(a):
window.console.log(a)}for(var f=0;f<b.length;f++)(function(b){var f=new j.Command({name:"Deploy to "+b.Name,tooltip:"Deploy to "+b.Name,id:"orion.launchConfiguration.deploy."+b.ServiceId+b.Name,imageClass:"core-sprite-deploy",callback:function(f){var h=p(f.items);if(!f.oldParams)f.oldParams=b.Params;var r=u(arguments.callee,f,"Deploy "+h.Name);if(r){var g=o.clone(b);g.Params=r;c.getProjectDelpoyService(b.ServiceId,b.Type).then(function(r){r&&r.deploy&&l.loadWorkspace(h.Project.ContentLocation).then(function(){w(g,
{project:a.Project,deployService:r,data:f,errorHandler:e,projectClient:c,commandService:d,launchConfiguration:b})})})}},visibleWhen:function(b){return p(b).Project===a.Project}});d.addCommand(f)})(b[f])};r.createDependencyCommands=function(a,d,c,e,f){function h(a){y?y.setProgressResult(a):window.console.log(a)}function r(a){var b=new j.Command({name:a?"Start":"Stop",tooltip:a?"Start application":"Stop application",id:a?"orion.launchConfiguration.startApp":"orion.launchConfiguration.stopApp",imageClass:a?
"core-sprite-start":"core-sprite-stop",callback:function(b){var c=p(b.items);b.oldParams=c.Params;var l=u(arguments.callee,b,a?"Start application":"Stop application");l&&e.getProjectDelpoyService(c.ServiceId,c.Type).then(function(f){if(f&&(a?f.start:f.stop)){if(x)c.status={State:"PROGRESS"},x.dispatchEvent({type:"changeState",newValue:c});(a?f.start:f.stop)(l).then(function(a){c.status=a;x&&x.dispatchEvent({type:"changeState",newValue:c});a.ToSave&&y.showWhile(e.saveProjectLaunchConfiguration(c.project,
a.ToSave.ConfigurationName,f.id,a.ToSave.Parameters,a.ToSave.Url,a.ToSave.ManageUrl,a.ToSave.Path,a.ToSave.UrlTitle,a.ToSave.Type),"Saving configuration").then(function(a){t(c.project.Name,f,a);x&&x.dispatchEvent({type:"create",newValue:a})},h)},function(a){a.Retry?(b.parameters=s(a.Retry.parameters,a.Retry.optionalParameters),b.oldParams=l,d.collectParameters(b)):h(a)})}})},visibleWhen:function(b){b=p(b);return b.ServiceId&&b.Name&&b.status&&(a?b.status.State==="STOPPED":b.status.State==="STARTED")}});
d.addCommand(b)}y=a.getService("orion.page.progress");a=new j.Command({name:"Connect",tooltip:"Fetch content",id:"orion.project.dependency.connect",callback:function(a){var b=p(a.items),c=u(arguments.callee,a,"Fetch content of "+b.Dependency.Name);if(c){var f=e.getProjectHandler(b.Dependency.Type);f.then?f.then(function(f){l(e,d,h,f,b.Dependency,b.Project,a,c)}):l(e,d,h,f,b.Dependency,b.Project,a,c)}},visibleWhen:function(a){if(!a.Dependency||!a.Project||!a.disconnected)return!1;if(f)for(var b=0;b<
f.length;b++)if(f[b]===a.Dependency.Type)return!0;return!1}});d.addCommand(a);a=new j.Command({name:"Disconnect from project",tooltip:"Do not treat this folder as a part of the project",imageClass:"core-sprite-delete",id:"orion.project.dependency.disconnect",callback:function(a){var d=p(a.items);y.progress(e.removeProjectDependency(d.Project,d.Dependency),b.formatMessage("Removing ${0} from project ${1}",d.Dependency.Name,d.Project.Name)).then(function(){E&&E.dispatchEvent({type:"delete",oldValue:d.Dependency,
project:d.Project})})},visibleWhen:function(a){return!a.Dependency||!a.Project?!1:!0}});d.addCommand(a);a=new j.Command({name:"Check status",tooltip:"Check application status",id:"orion.launchConfiguration.checkStatus",callback:function(a){var b=p(a.items);if(a.parameters){var c=u(arguments.callee,a,"Check application state");c&&e.getProjectDelpoyService(b.ServiceId,b.Type).then(function(l){if(x)b.status={State:"PROGRESS"},x.dispatchEvent({type:"changeState",newValue:b});l&&l.getState&&l.getState(c).then(function(a){b.status=
a;x&&x.dispatchEvent({type:"changeState",newValue:b});b.project&&b.project.children&&b.project.children.forEach(function(a){if(b.ServiceId&&b.Name&&b.parametersRequested&&a.ServiceId===b.ServiceId&&a.Name!==b.Name&&x)a.status={CheckState:!0},x.dispatchEvent({type:"changeState",newValue:a})})},function(l){l.Retry?(a.parameters=s(l.Retry.parameters,l.Retry.optionalParameters),a.oldParams=c,d.collectParameters(a)):(h(l),b.status={error:l},x&&x.dispatchEvent({type:"changeState",newValue:b}))})})}else a.parameters=
s(b.parametersRequested,b.optionalParameters),a.oldParams=b.Params,d.collectParameters(a)},visibleWhen:function(a){a=p(a);return a.ServiceId&&a.Name&&a.parametersRequested}});d.addCommand(a);r(!0);r(!1);a=new j.Command({name:"Manage",tooltip:"Manage this application on remote server",id:"orion.launchConfiguration.manage",hrefCallback:function(a){var b=p(a.items);if(b.ManageUrl)return a=new n(b.ManageUrl),b=o.clone(b.Params),b.OrionHome=q.getOrionHome(),a=a.expand(b),a.indexOf("://")||(a="http://"+
a),a},visibleWhen:function(a){return p(a).ManageUrl}});d.addCommand(a);a=new j.Command({name:"Deploy",tooltip:"Deploy this application again",id:"orion.launchConfiguration.deploy",imageClass:"core-sprite-deploy",callback:function(a){var b=p(a.items);if(!a.oldParams)a.oldParams=b.Params;var l=u(arguments.callee,a,"Deploy "+b.Name);if(l){var f=o.clone(b);f.Params=l;e.getProjectDelpoyService(b.ServiceId,b.Type).then(function(l){l&&l.deploy&&c.loadWorkspace(b.project.ContentLocation).then(function(){w(f,
{project:b.project,deployService:l,data:a,errorHandler:h,projectClient:e,commandService:d,launchConfiguration:b})})})}},visibleWhen:function(a){a=p(a);return a.ServiceId&&a.Name}});d.addCommand(a)};r.getAddDependencyCommands=function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];c.isAddDependency&&b.push(c)}return b};r.getCreateProjectCommands=function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];c.isCreateProject&&b.push(c)}return b};r.getDeployProjectCommands=
function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];c.isDeployProject&&b.push(c)}return b};var B;r.setExplorer=function(a){B=a};r.createProjectCommands=function(a,b,e,m,x,n){function o(a){y?y.setProgressResult(a):window.console.log(a)}function z(a,b){var c=d.getModelEventDispatcher();b.ContentLocation?e.read(b.ContentLocation,!0).then(function(b){c.dispatchEvent({type:"create",parent:a,newValue:b})},function(){c.dispatchEvent({type:"create",parent:a,newValue:null})}):c.dispatchEvent({type:"create",
parent:a,newValue:null})}function q(a){return m.getProjectHandler(a).then(function(d){if(d.initDependency){var c={name:d.addDependencyName,id:"orion.project.adddependency."+a,tooltip:d.addDependencyTooltip,callback:function(a){new g;var c=p(a.items).Project,f=u(arguments.callee,a,d.addDependencyTooltip);if(f){var h=new g;d.paramsToDependencyDescription(f).then(function(a){a&&a.Location?e.loadWorkspace(c.WorkspaceLocation).then(function(b){for(var c=[],l=!1,e=0;e<b.Children.length;e++){if(l===!0)break;
var f=d.getDependencyDescription(b.Children[e]);c.push(f);(function(b,d){d.then(function(b){b&&b.Location===a.Location&&(l=!0,h.resolve(b))})})(e,f)}g.all(c).then(function(){l||h.resolve()})},h.reject):h.resolve()},o);y.showWhile(h,"Searching your workspace for matching content").then(function(e){e?m.addProjectDependency(c,e).then(function(){E&&E.dispatchEvent({type:"create",newValue:e,project:c})},o):l(m,b,o,d,{},c,a,f)})}},visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:a.type==="Project"||
B.treeRoot.type==="Project"}};c.parameters=s(d.addParameters,d.optionalParameters);c=new j.Command(c);c.isAddDependency=!0;b.addCommand(c)}})}function t(a){return m.getProjectHandler(a).then(function(d){if(d.initProject){var c={name:d.addProjectName,id:"orion.project.createproject."+a,tooltip:d.addProjectTooltip,callback:function(a){var c=arguments.callee,l=p(a.items),e=u(c,a,d.addProjectTooltip);e&&(c=d.actionComment?e?d.actionComment.replace(/\$\{([^\}]+)\}/g,function(a,b){return e[b]}):d.actionComment:
"Getting content from "+d.type,y.showWhile(d.initProject(e,{WorkspaceLocation:l.Location}),c).then(function(a){z(l,a)},function(d){if(d.Retry&&d.Retry.addParameters)a.parameters=s(d.Retry.addParameters,d.Retry.optionalParameters),a.oldParams=e,b.collectParameters(a);o(d)}))},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=p(a);return a.Location}};c.parameters=s(d.addParameters,d.optionalParameters);c=new j.Command(c);c.isCreateProject=!0;b.addCommand(c)}})}function k(a){var d={name:a.name,
tootlip:a.tooltip,id:"orion.project.deploy."+a.id,callback:function(d){var c=B.selection.getSelections(),l=c&&c.length>0?p(c):B.treeRoot,c=l.Project,l=l.Location?l.Location.replace(c.ContentLocation,""):"",e=u(arguments.callee,d,a.tooltip);e&&w({Params:e,Path:l},{project:c,deployService:a,data:d,errorHandler:o,projectClient:m,commandService:b})},visibleWhen:function(b){b=B.treeRoot;return!b.Project||!b.children||b.children.length===0?!1:m.matchesDeployService(b.children[0],a)}};d.parameters=s(a.parameters,
a.optionalParameters);d=new j.Command(d);d.isDeployProject=!0;b.addCommand(d)}y=a.getService("orion.page.progress");var x=x||[],v=new j.Command({name:"Associated Folder",tooltip:"Associate a folder from the workspace with this project.",id:"orion.project.addFolder",callback:function(b){var d=p(b.items).Project;(new c.DirectoryPrompterDialog({title:i["Choose a Folder"],serviceRegistry:a,fileClient:e,func:function(a){e.read(a.Location,!0).then(function(a){function b(){var c="",l=a.Name;if(a.Parents&&
a.Parents.length>0){for(var e=a.Parents.length-1;e>=0;e--)c+=a.Parents[e].Name,c+="/";l+=" ("+a.Parents[a.Parents.length-1].Name+")"}c+=a.Name;var f={Name:l,Type:"file",Location:c};m.addProjectDependency(d,{Name:l,Type:"file",Location:c}).then(function(){E&&E.dispatchEvent({type:"create",newValue:f,project:d})},o)}if(!a.Parents||a.Parents.length===0){for(var c=[],l=!1,e=0;e<x.length;e++){if(l)return;var f=m.getProjectHandler(x[e]).then(function(b){return b.getDependencyDescription(a)});c.push(f);
f.then(function(a){a&&(l=!0,m.addProjectDependency(d,a).then(function(){E&&E.dispatchEvent({type:"create",newValue:a,project:d})},o))})}g.all(c).then(function(){l||b()})}else b()},o)}})).show()},visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:a.type==="Project"||B.treeRoot.type==="Project"}});v.isAddDependency=!0;b.addCommand(v);v=new j.Command({name:"Convert to project",tooltip:"Convert this folder into a project",id:"orion.project.initProject",callback:function(a){var b=p(a.items);if(b){var d=
function(){m.initProject(b.Location).then(function(a){e.read(b.Location,!0).then(function(){B.changedItem(b,!0)},o);z(b,a)},o)};m.readProject(b).then(function(a){a?(y.setProgressResult({Message:"This folder is a project already.",Severity:"Warning"}),B.changedItem(b,!0)):d()},d)}},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;if((a=p(a))&&(a.parent&&a.parent.Projects||a.Parents&&a.Parents.length===0)){if(a.children)for(var b=0;b<a.children.length;b++)if(a.children[b].Name&&!a.children[b].Directory&&
a.children[b].Name.toLowerCase()==="project.json")return!1;return!0}return!1}});b.addCommand(v);for(var v=[],I=0;I<x.length;I++){var F=x[I];v.push(q(F));v.push(t(F))}I=new j.Command({name:"Readme File",tooltip:"Create a README.md file in this project",id:"orion.project.create.readme",callback:function(a){var b=p(a.items);y.progress(e.createFile(b.Project.ContentLocation,"README.md"),"Creating README.md").then(function(a){function c(){d.getModelEventDispatcher().dispatchEvent({type:"create",parent:b,
newValue:a})}b.Project?y.progress(e.write(a.Location,"# "+b.Project.Name),"Writing sample readme").then(function(){c()}):c()})},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=p(a);if(!a.Project||!a.Project.children||!a.Project.ContentLocation)return!1;for(var b=0;b<a.Project.children.length;b++)if(a.Project.children[b].Name&&a.Project.children[b].Name.toLowerCase()==="readme.md")return!1;return!0}});b.addCommand(I);I=new j.Command({name:"Basic",tooltip:"Create an empty project.",
id:"orion.project.create.basic",parameters:new f.ParametersDescription([new f.CommandParameter("name","text","Name: ")]),callback:function(a){var b=a.parameters.valueFor("name");b&&(a=p(a.items),e.loadWorkspace(e.fileServiceRootURL(a.Location)).then(function(a){y.progress(m.createProject(a.ChildrenLocation,{Name:b}),"Creating project "+b).then(function(b){z(a,b)})}))},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=p(a);return!!a.Location}});I.isCreateProject=!0;b.addCommand(I);I=
new j.Command({name:"File System",tooltip:"Create project from a local zipped file.",id:"orion.project.create.fromfile",parameters:new f.ParametersDescription([new f.CommandParameter("name","text","Name: ")]),callback:function(a){var b=a.parameters.valueFor("name");b&&(a=p(a.items),e.loadWorkspace(e.fileServiceRootURL(a.Location)).then(function(a){y.progress(m.createProject(a.ChildrenLocation,{Name:b}),"Creating project "+b).then(function(b){y.progress(e.read(b.ContentLocation,!0)).then(function(d){(new h.ImportDialog({importLocation:d.ImportLocation,
func:function(){z(a,b)}})).show()})})}))},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=p(a);return!!a.Location}});I.isCreateProject=!0;b.addCommand(I);I=new j.Command({name:"SFTP",tooltip:"Create a project from an SFTP site.",id:"orion.project.create.sftp",parameters:new f.ParametersDescription([new f.CommandParameter("name","text","Name:"),new f.CommandParameter("url","url","Url:")]),callback:function(a){var b=a.parameters.valueFor("name");if(b){var d=a.parameters.valueFor("url");
d&&(a=p(a.items),e.loadWorkspace(e.fileServiceRootURL(a.Location)).then(function(a){y.progress(m.createProject(a.ChildrenLocation,{Name:b,ContentLocation:d}),"Creating project "+b).then(function(b){z(a,b)})}))}},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=p(a);return!!a.Location}});I.isCreateProject=!0;b.addCommand(I);r.createDependencyCommands(a,b,e,m,x);if(n)for(I=0;I<n.length;I++){var C=n[I],F=new g;v.push(F);(function(a){m.getProjectDelpoyService(C).then(function(b){k(b);
a.resolve()})})(F)}return g.all(v)};return r});define("text!orion/webui/dropdownseparator.html",[],function(){return'<li class="dropdownSeparator"><span class="dropdownSeparator"></span></li>'});
define("orion/webui/contextmenu","orion/webui/littlelib,orion/webui/dropdown,orion/objects,orion/webui/tooltip,i18n!orion/nls/messages,text!orion/webui/dropdownseparator.html".split(","),function(i,k,j){function g(f){f.skipTriggerEventListeners=!0;c.call(this,f);this._initialize(f)}var c=k.Dropdown;g.prototype=Object.create(c.prototype);j.mixin(g.prototype,{_initialize:function(){if(!this._dropdownNode.dropdown)this._dropdownNode.dropdown=this;this._boundcontextmenuEventHandler=this._contextmenuEventHandler.bind(this);
this._boundContextMenuCloser=this._contextMenuCloser.bind(this);this._triggerNode.addEventListener("contextmenu",this._boundcontextmenuEventHandler,!0);window.addEventListener("contextmenu",this._boundContextMenuCloser,!1);this._triggerNode.addEventListener("click",this._boundContextMenuCloser,!1)},_contextMenuCloser:function(c){this.close(c)},_contextmenuEventHandler:function(c){this.open(c)?i.stop(c):this.close()}});g.prototype.constructor=g;g.prototype._positionDropdown=function(f){if(f){var b=
f.clientX,f=f.clientY;this._dropdownNode.style.position="fixed";this._dropdownNode.style.left=b+"px";this._dropdownNode.style.top=f+"px";var h=i.bounds(this._dropdownNode),e=h.width,h=h.height,d=i.bounds(document.body),e=b+e-(d.left+d.width);if(0<e)this._dropdownNode.style.left=Math.floor(b-e)+"px";b=f+h-(d.top+d.height);if(0<b)this._dropdownNode.style.top=Math.floor(f-b)+"px"}else c.prototype._positionDropdown.call(this)};g.prototype.destroy=function(){this._triggerNode.removeEventListener("contextmenu",
this._boundcontextmenuEventHandler,!0);this._triggerNode.removeEventListener("click",this._boundContextMenuCloser,!1);window.removeEventListener("contextmenu",this._boundContextMenuCloser,!1);this._dropdownNode.dropdown=null;c.prototype.destroy.call(this)};return{ContextMenu:g}});
define("orion/widgets/nav/common-nav","i18n!orion/edit/nls/messages,orion/objects,orion/webui/littlelib,orion/explorers/explorer-table,orion/explorers/navigatorRenderer,orion/explorers/explorerNavHandler,orion/keyBinding,orion/fileCommands,orion/projectCommands,orion/extensionCommands,orion/globalCommands,orion/selection,orion/URITemplate,orion/PageUtil,orion/Deferred,orion/webui/contextmenu".split(","),function(i,k,j,g,c,f,b,h,e,d,a,m,n,q,o,p){function s(b){b.setFocus=!1;b.cachePrefix=null;b.modelEventDispatcher=
h.getModelEventDispatcher();b.dragAndDrop=h.uploadFile;v.apply(this,arguments);this.preferences=b.preferences;this.commandRegistry=b.commandRegistry;this.editorInputManager=b.editorInputManager;this.progressService=b.progressService;this.sidebar=b.sidebar;var d=this.sidebarNavInputManager=b.sidebarNavInputManager;this.toolbarNode=b.toolbarNode;this.fileActionsScope="fileActions";this.editActionsScope="editActions";this.viewActionsScope="viewActions";this.toolsActionsScope="toolsActions";this.additionalActionsScope=
"extraActions";this._parentNode=j.node(this.parentId);this._sidebarContextMenuNode=document.createElement("ul");this._sidebarContextMenuNode.className="dropdownMenu";this._sidebarContextMenuNode.setAttribute("role","menu");this._sidebarContextMenuNode.id=this.parentId+"ContextMenu";this._parentNode.parentNode.insertBefore(this._sidebarContextMenuNode,this._parentNode);this.contextMenuActionsScope=this._sidebarContextMenuNode.id+"commonNavContextMenu";this.treeRoot={};var c=this;this.editorInputListener=
function(a){c.reveal(a.metadata)};this.editorInputManager.addEventListener("InputChanged",this.editorInputListener);if(d)d.reveal=function(a){c.reveal(a)};var l=this.modelEventDispatcher,e=this._modelListener=this.onFileModelChange.bind(this);["move","delete"].forEach(function(a){l.addEventListener(a,e)});this.selection=new m.Selection(this.registry,"commonNavFileSelection");this._selectionListener=function(a){c.updateCommands(a.selections);d&&c.sidebarNavInputManager.dispatchEvent(a)};this.selection.addEventListener("selectionChanged",
this._selectionListener);a.getMainSplitter().splitter.addEventListener("toggle",this._splitterToggleListener=function(){this.updateCommands()}.bind(this));this.commandsRegistered=this.registerCommands();this._createContextMenu()}function u(){w.apply(this,arguments)}var v=g.FileExplorer,t=b.KeyBinding,w=c.NavigatorRenderer,l=new n("#{,resource,params*}");s.prototype=Object.create(v.prototype);k.mixin(s.prototype,{onLinkClick:function(a){v.prototype.onLinkClick.call(this,a);this.sidebarNavInputManager.dispatchEvent(a);
var b=this.getNavHandler();if(b&&a.item.Directory)a=a.item,b.cursorOn(a),b.setSelection(a,!1),a=b._modelIterator.cursor(),b.isExpandable(a)&&(b.isExpanded(a)?this.myTree.collapse(a):this.myTree.expand(a))},onModelCreate:function(a){return v.prototype.onModelCreate.call(this,a).then(function(){this.sidebarNavInputManager.dispatchEvent(a)}.bind(this))},onFileModelChange:function(a){var b=a.oldValue,a=a.newValue,d=this.editorInputManager.getFileMetadata();if(d){var c;[d].concat(d.Parents||[]).some(function(a){return b.Location===
a.Location?(c=b,!0):!1});c&&this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:b.parent.Location,newInput:c.Location===d.Location?a&&a.ChildrenLocation||a&&a.ContentLocation||a&&a.Location||null:null})}},createActionSections:function(){var a=this;[].forEach(function(b){if(!a[b]){var d=document.createElement("ul");d.id=b;d.classList.add("commandList");d.classList.add("layoutLeft");d.classList.add("pageActions");a.toolbarNode.appendChild(d);a[b]=d}})},destroy:function(){var b=
this,d=this.modelEventDispatcher;["move","delete"].forEach(function(a){d.removeEventListener(a,b._modelListener)});v.prototype.destroy.call(this);[].forEach(function(a){delete b[a]});this.editorInputManager.removeEventListener("InputChanged",this.editorInputListener);this.selection.removeEventListener("selectionChanged",this._selectionListener);var c=a.getMainSplitter();c&&c.splitter.removeEventListener("toggle",this._splitterToggleListener);if(this._contextMenu)this._contextMenu.destroy(),this._contextMenu=
null;if(this._sidebarContextMenuNode)this._parentNode.parentNode.removeChild(this._sidebarContextMenuNode),this._sidebarContextMenuNode=null},display:function(a,b){return this.loadRoot(a,b).then(function(){this.updateCommands();return this.reveal(this.editorInputManager.getFileMetadata())}.bind(this))},loadRoot:function(a,b){a=a&&a.ChildrenLocation||a||"";return this.commandsRegistered.then(function(){return a&&typeof a==="object"?this.load(a):this.loadResourceList(a,b)}.bind(this))},scope:function(a){var a=
a&&a.ChildrenLocation||a||"",b=q.matchResourceParameters(),d=b.resource;delete b.resource;if(a){if(b.navigate===a)return;b.navigate=a}else delete b.navigate;window.location.href=l.expand({resource:d,params:b})},scopeUp:function(){var a=this.treeRoot,b=a.Parents&&a.Parents[0];this.scope(b?b.ChildrenLocation:this.fileClient.fileServiceRootURL(a.Location))},scopeDown:function(a){this.scope(a.ChildrenLocation)},isCommandsVisible:function(){var b=a.getMainSplitter();return b?!b.splitter.isClosed():!this.destroyed},
registerCommands:function(){var a=this.commandRegistry,b=this.registry,c=this.fileActionsScope,l=this.editActionsScope,f=this.viewActionsScope,h=this.contextMenuActionsScope,g=new t(113),m=new t(46),n=new t("x",!0),j=new t("c",!0),q=new t("v",!0),s=new t(38,!1,!1,!0),p=new t(40,!1,!1,!0);p.domScope=s.domScope=q.domScope=j.domScope=n.domScope=m.domScope=g.domScope="sidebar";p.scopeName=s.scopeName=q.scopeName=j.scopeName=n.scopeName=m.scopeName=g.scopeName=i.Navigator;a.registerCommandContribution(c,
"eclipse.newFile",1,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");a.registerCommandContribution(c,"eclipse.newFolder",2,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default",!1,null);a.registerCommandContribution(c,"orion.new.project",3,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");a.registerCommandContribution(c,"orion.new.linkProject",4,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");a.registerCommandContribution(c,"orion.import",
1,"orion.menuBarFileGroup/orion.importGroup");a.registerCommandContribution(c,"orion.importZipURL",2,"orion.menuBarFileGroup/orion.importGroup");a.registerCommandContribution(c,"orion.importSFTP",3,"orion.menuBarFileGroup/orion.importGroup");a.registerCommandContribution(c,"eclipse.downloadFile",1,"orion.menuBarFileGroup/orion.exportGroup");a.registerCommandContribution(c,"eclipse.exportSFTPCommand",2,"orion.menuBarFileGroup/orion.exportGroup");a.registerCommandContribution(l,"eclipse.renameResource",
1,"orion.menuBarEditGroup/orion.renameGroup",!1,g);a.registerCommandContribution(l,"eclipse.cut",2,"orion.menuBarEditGroup/orion.clipboardGroup",!1,n);a.registerCommandContribution(l,"eclipse.copySelections",3,"orion.menuBarEditGroup/orion.clipboardGroup",!1,j);a.registerCommandContribution(l,"eclipse.pasteSelections",4,"orion.menuBarEditGroup/orion.clipboardGroup",!1,q);a.registerCommandContribution(l,"eclipse.deleteFile",5,"orion.menuBarEditGroup/orion.deleteGroup",!1,m);a.registerCommandContribution(l,
"eclipse.compareWith",6,"orion.menuBarEditGroup/orion.compareGroup");a.registerCommandContribution(l,"eclipse.compareWithEachOther",7,"orion.menuBarEditGroup/orion.compareGroup");a.registerCommandContribution(f,"eclipse.downFolder",1,"orion.menuBarViewGroup",!1,p);a.registerCommandContribution(f,"eclipse.upFolder",0,"orion.menuBarViewGroup",!1,s);a.addCommandGroup(h,"orion.commonNavContextMenuEditGroup",100,null,null,null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.New",0,i.New,"orion.commonNavContextMenuEditGroup",
null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.OpenWith",1001,i.OpenWith,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.Extensions",1002,i.OpenRelated,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.ImportGroup",1003,i.Import,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.ExportGroup",1004,i.Export,"orion.commonNavContextMenuEditGroup",
null,null,null,"dropdownSelection");a.registerCommandContribution(h,"eclipse.newFile",1,"orion.commonNavContextMenuEditGroup/orion.New");a.registerCommandContribution(h,"eclipse.newFolder",2,"orion.commonNavContextMenuEditGroup/orion.New",!1,null);a.registerCommandContribution(h,"orion.new.project",3,"orion.commonNavContextMenuEditGroup/orion.New");a.registerCommandContribution(h,"orion.new.linkProject",4,"orion.commonNavContextMenuEditGroup/orion.New");a.registerCommandContribution(h,"eclipse.renameResource",
1,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.cut",2,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.copySelections",3,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.pasteSelections",4,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.deleteFile",5,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.compareWith",6,"orion.commonNavContextMenuEditGroup");
a.registerCommandContribution(h,"eclipse.compareWithEachOther",7,"orion.commonNavContextMenuEditGroup");a.registerCommandContribution(h,"orion.import",1,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");a.registerCommandContribution(h,"orion.importZipURL",2,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");a.registerCommandContribution(h,"orion.importSFTP",3,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");a.registerCommandContribution(h,"eclipse.downloadFile",1,"orion.commonNavContextMenuEditGroup/orion.ExportGroup");
a.registerCommandContribution(h,"eclipse.exportSFTPCommand",2,"orion.commonNavContextMenuEditGroup/orion.ExportGroup");a.addCommandGroup(f,"eclipse.openWith",1E3,i.OpenWith,"orion.menuBarViewGroup",null,null,null,"dropdownSelection");a.addCommandGroup(f,"eclipse.fileCommandExtensions",1E3,i.OpenRelated,"orion.menuBarViewGroup");d.getOpenWithCommands(a).forEach(function(b){a.registerCommandContribution(f,b.id,1,"orion.menuBarViewGroup/eclipse.openWith");a.registerCommandContribution(h,b.id,1,"orion.commonNavContextMenuEditGroup/orion.OpenWith")});
d.getFileCommandIds().forEach(function(b){a.registerCommandContribution(f,b,1,"orion.menuBarViewGroup/eclipse.fileCommandExtensions");a.registerCommandContribution(h,b,1,"orion.commonNavContextMenuEditGroup/orion.Extensions")});return b.getServiceReferences("orion.projects").length>0?this.preferences.getPreferences("/common-nav").then(function(b){b=b.get("showNewProjectCommands");if(b===void 0||b){a.addCommandGroup(c,"orion.projectsNewGroup",100,i.Project,"orion.menuBarFileGroup/orion.newContentGroup");
a.addCommandGroup(h,"orion.projectsNewGroup",100,i.Project,"orion.commonNavContextMenuEditGroup/orion.New");var d=0;e.getCreateProjectCommands(a).forEach(function(b){a.registerCommandContribution(c,b.id,d,"orion.menuBarFileGroup/orion.newContentGroup/orion.projectsNewGroup");a.registerCommandContribution(h,b.id,d,"orion.commonNavContextMenuEditGroup/orion.New/orion.projectsNewGroup");d++});a.registerCommandContribution(l,"orion.project.initProject",0,"orion.menuBarEditGroup")}}):(new o).resolve()},
updateCommands:function(){var a=this.isCommandsVisible();this.createActionSections();var b=this.commandRegistry,d=this.sidebar.menuBar;d.setActiveExplorer(this);d.updateCommands();b.registerSelectionService(this.contextMenuActionsScope,a?this.selection:null);this._sidebarContextMenuNode&&this._populateContextMenu(this._sidebarContextMenuNode)},_populateContextMenu:function(a){var b=this.selection.getSelections(),d=null;this.commandRegistry.destroy(a);if(!b||Array.isArray(b)&&!b.length)d=this.treeRoot;
this.commandRegistry.renderCommands(this.contextMenuActionsScope,a,d,this,"menu")},_createContextMenu:function(){var a=function(a){var b=this.getNavHandler(),d=this.getNavDict(),c=a.event,a=null;if(c.target){for(c=c.target;this._parentNode.contains(c);){if("TR"===c.nodeName){a=d.getValue(c.id);break}c=c.parentNode}a&&!b.isDisabled(a.rowDomNode)?-1===b.getSelection().indexOf(a.model)&&(b.cursorOn(a.model,!0,!1,!0),b.setSelection(a.model,!1,!0)):(this.selection.setSelections(null),b.refreshSelection(!0,
!0))}}.bind(this),b=new p.ContextMenu({dropdown:this._sidebarContextMenuNode,triggerNode:this._parentNode});b.addEventListener("triggered",a);this._contextMenu=b}});u.prototype=Object.create(w.prototype);k.mixin(u.prototype,{showFolderLinks:!0,oneColumn:!0,createFolderNode:function(a){var b=w.prototype.createFolderNode.call(this,a);this.showFolderLinks&&b.tagName==="A"?(b.href=l.expand({resource:a.Location}),b.classList.add("commonNavFolder")):b.classList.add("nav_fakelink");b.addEventListener("click",
function(){this.explorer.editorInputManager.cachedMetadata=a}.bind(this),!1);return b},updateFileNode:function(a,b,d){c.NavigatorRenderer.prototype.updateFileNode.call(this,a,b,d);b.addEventListener("click",function(){this.explorer.editorInputManager.cachedMetadata=a}.bind(this),!1)},rowCallback:function(a,b){w.prototype.rowCallback.call(this,a,b);var d=h.getCutBuffer();d&&d.some(function(a){return h.isEqualToOrChildOf(b,a)})&&this.explorer.getNavHandler().disableItem(b)},emptyCallback:function(){}});
return{CommonNavExplorer:s,CommonNavRenderer:u}});
define("orion/widgets/filesystem/filesystemSwitcher","i18n!orion/edit/nls/messages,orion/objects,orion/webui/littlelib,orion/i18nUtil,orion/commands,orion/URL-shim".split(","),function(i,k,j,g,c){function f(b){this.commandRegistry=b.commandRegistry;this.rootChangeListener=b.rootChangeListener;this.filesystemChangeDispatcher=b.filesystemChangeDispatcher;this.fileClient=b.fileClient;this.node=b.node;this.serviceRegistry=b.serviceRegistry;var c=this;this.listener=function(b){c.refresh(b.root)};this.rootChangeListener&&
this.rootChangeListener.addEventListener("rootChanged",this.listener);this.render()}k.mixin(f.prototype,{destroy:function(){this.rootChangeListener&&this.rootChangeListener.removeEventListener("rootChanged",this.listener);this.commandRegistry.destroy(this.node);j.empty(this.node);this.rootChangeListener=this.filesystemChangeDispatcher=this.listener=this.node=null},registerCommands:function(){if(!this.commandsRegistered){this.commandsRegistered=!0;var b=this.commandRegistry,f=this.serviceRegistry,
e=new c.Command({name:i.ChooseFS,imageClass:"core-sprite-openarrow",selectionClass:"dropdownSelection",tooltip:i.ChooseFSTooltip,id:"orion.nav.switchfs",visibleWhen:function(){return f.getServiceReferences("orion.core.file").length>1},choiceCallback:this._switchFsMenuCallback.bind(this)});b.addCommand(e);b.registerCommandContribution("orion.mininav","orion.nav.switchfs",1)}},_switchFsMenuCallback:function(){var b=this;return this.serviceRegistry.getServiceReferences("orion.core.file").map(function(c){var c=
c.getProperty("top"),e=b._fileServiceLabel(c,!0);return{checked:b.fileSystem===e,name:e,callback:b.setActiveFilesystem.bind(b,c)}})},render:function(){this.fsName=document.createElement("div");this.fsName.classList.add("filesystemName");this.fsName.classList.add("layoutLeft");this.menu=document.createElement("ul");this.menu.classList.add("filesystemSwitcher");this.menu.classList.add("commandList");this.menu.classList.add("layoutRight");this.menu.classList.add("pageActions");this.node.appendChild(this.fsName);
this.node.appendChild(this.menu);this.registerCommands();this.fsName.addEventListener("click",this._openMenu.bind(this))},_openMenu:function(){var b=j.$(".dropdownTrigger",this.menu);if(b){var c=document.createEvent("MouseEvents");c.initEvent("click",!0,!0);b.dispatchEvent(c)}},_fileServiceHostname:function(b){b=this.fileClient.fileServiceRootURL(b);b.indexOf("filesystem:")===0&&(b=b.substr(11));var c=b;try{c=(new URL(b,window.location.href)).hostname}catch(e){}return c},_fileServiceLabel:function(b,
c){var e=this.fileClient.fileServiceName(b),d=this._fileServiceHostname(b);if(c)return g.formatMessage(i.FSTitle,e,d);var a=document.createDocumentFragment();a.textContent=i.FSTitle;j.processDOMNodes(a,[document.createTextNode(e),document.createTextNode(d)]);return a},refresh:function(b){var c=b;if(b.ChildrenLocation)c=b.ChildrenLocation;j.empty(this.fsName);this.fileSystem=this._fileServiceLabel(c,!0);this.fsName.appendChild(this._fileServiceLabel(c));this.commandRegistry.destroy(this.menu);this.commandRegistry.renderCommands("orion.mininav",
this.menu,{},"menu")},setActiveFilesystem:function(b){var c=b;if(b.ChildrenLocation)c=b.ChildrenLocation;b=this.fileClient.fileServiceRootURL(c);this.filesystemChangeDispatcher&&this.filesystemChangeDispatcher.dispatchEvent({type:"filesystemChanged",newInput:b})}});return{FilesystemSwitcher:f}});
define("orion/widgets/nav/mini-nav","i18n!orion/edit/nls/messages,orion/objects,orion/webui/littlelib,orion/widgets/nav/common-nav,orion/fileCommands,orion/PageUtil,orion/Deferred,orion/widgets/filesystem/filesystemSwitcher,orion/URL-shim".split(","),function(i,k,j,g,c,f,b,h){function e(a){m.apply(this,arguments);var b=this.sidebarNavInputManager;if(b){var d=this;this.addEventListener("rootChanged",function(a){d.sidebarNavInputManager.dispatchEvent(a);d.sidebarNavInputManager.dispatchEvent({type:"InputChanged",
input:a.root.ChildrenLocation})});b.setInput=function(a){d.treeRoot&&d.treeRoot.ChildrenLocation!==a&&d.loadRoot(a).then(function(){d.updateCommands();var a=d.editorInputManager.getFileMetadata();d.reveal(a,!1)})}}}function d(){n.apply(this,arguments)}function a(a){this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebar=a.sidebar;
this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.lastRoot=this.explorer=this.fsToolbar=null;var b=this;this.sidebarNavInputManager.addEventListener("InputChanged",function(a){b.lastRoot=a.input})}var m=g.CommonNavExplorer,n=g.CommonNavRenderer;e.prototype=Object.create(m.prototype);k.mixin(e.prototype,{reroot:function(a){this.scope("");return this.loadRoot(this.fileClient.fileServiceRootURL(a.Location)).then(function(){return this.showItem(a,
!1)}.bind(this))}});d.prototype=Object.create(n.prototype);k.mixin(a.prototype,{label:i.Navigator,create:function(){var a=this;this.explorer=new e({preferences:this.preferences,commandRegistry:this.commandRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,sidebar:this.sidebar,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,rendererFactory:function(b){return new d({checkbox:!1,treeTableClass:"miniNavTreeTable",cachePrefix:"MiniNav"},b,a.commandRegistry,
a.contentTypeRegistry)},serviceRegistry:this.serviceRegistry,toolbarNode:this.toolbarNode});this.fsSwitcher=new h.FilesystemSwitcher({commandRegistry:this.commandRegistry,rootChangeListener:this.explorer,filesystemChangeDispatcher:this.explorer.sidebarNavInputManager,fileClient:this.fileClient,node:this.toolbarNode,serviceRegistry:this.serviceRegistry});var b=f.matchResourceParameters(),c=b.resource;this.explorer.display(b.navigate||this.lastRoot||this.fileClient.fileServiceRootURL(c||""))},destroy:function(){if(this.explorer)this.explorer.destroy(),
this.explorer=null;this.fsSwitcher&&this.fsSwitcher.destroy()}});return a});
define("orion/projectClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/extensionCommands"],function(i,k,j){function g(c){try{return c?JSON.parse(c):{}}catch(b){return{__TEXT__:String(c)}}}function c(c,b){this.serviceRegistry=c;this.fileClient=b;this.allProjectHandlersReferences=c.getServiceReferences("orion.project.handler");this.allProjectDeployReferences=c.getServiceReferences("orion.project.deploy");this._serviceRegistration=c.registerService("orion.project.client",this);this._launchConfigurationsDir=
"launchConfigurations"}c.prototype={_getProjectJsonData:function(c,b,h){for(var e=new k,d=0;d<b.length;d++)if(b[d].Name==="project.json")return this.fileClient.read(b[d].Location).then(function(a){var m=g(a);m.Name=m.Name||c.Name;m.ContentLocation=c.Location;m.WorkspaceLocation=h.Location;var i;h.Children.some(function(a){return a.Location===c.Location?(i=a.Id,!0):!1});h.Projects.some(function(a){return a.Id===i?(m.ProjectLocation=a.Location,!0):!1});m.ProjectJsonLocation=b[d].Location;e.resolve(m)},
function(a){e.reject(a)},function(a){e.progress(a)}),e;e.resolve(null);return e},readAllProjects:function(c){var b=new k;if(!c.Children)return b.resolve([]),b;for(var h=[],e=[],d=0;d<c.Children.length;d++){var a=new k;this.readProject(c.Children[d],c).then(a.resolve,function(){this.resolve(null)}.bind(a));e.push(a);a.then(function(a){a&&h.push(a)})}k.all(e).then(function(){b.resolve(h)});return b},readProject:function(c,b){function h(a,b,d){if(a.Parents&&a.Parents.length>0){var c=a.Parents[a.Parents.length-
1];c.Children?e._getProjectJsonData.bind(e)(c,c.Children,b).then(d.resolve,d.reject,d.progress):c.ChildrenLocation?this.fileClient.fetchChildren(c.ChildrenLocation).then(function(a){e._getProjectJsonData.bind(e)(c,a,b).then(d.resolve,d.reject,d.progress)},d.reject,d.progress):d.resolve(null)}else a.Children?e._getProjectJsonData.bind(e)(a,a.Children,b).then(d.resolve,d.reject,d.progress):a.ChildrenLocation?this.fileClient.fetchChildren(a.ChildrenLocation).then(function(c){e._getProjectJsonData.bind(e)(a,
c,b).then(d.resolve,d.reject,d.progress)},d.reject,d.progress):d.resolve(null);return d}var e=this,d=new k;b?h.call(e,c,b,d):this.fileClient.loadWorkspace().then(function(a){h.call(e,c,a,d)});return d},initProject:function(c,b){var h=this,e=new k;this.fileClient.createFile(c,"project.json").then(function(d){b?h.fileClient.write(d.Location,JSON.stringify(b)).then(function(){e.resolve({ContentLocation:c,projectMetadata:b})},e.reject,e.progress):e.resolve({fileMetadata:d})},e.reject,e.progress);return e},
createProject:function(c,b){return this.fileClient.createProject(c,b.Name,b.ContentLocation,!0).then(function(c){delete b.Name;return this.initProject(c.ContentLocation,b)}.bind(this),function(b){return b},function(b){return b})},getDependencyFileMetadata:function(c,b){function h(a,b){this.fileClient.fetchChildren(a).then(function(a){for(var g=0;g<a.length;g++)if(a[g].Name===b[0]){b.length===1?e.resolve(a[g]):h.bind(d)(a[g].ChildrenLocation,b.splice(1,b.length-1));return}e.reject(c.Location+" could not be found in your workspace")},
function(a){e.reject(a)})}var e=new k,d=this;if(c.Type==="file"){var a=c.Location.split("/");this.fileClient.loadWorkspace(b).then(function(b){for(var g=0;g<b.Children.length;g++)if(b.Children[g].Name===a[0]){a.length===1?e.resolve(b.Children[g]):h.bind(d)(b.Children[g].ChildrenLocation,a.splice(1,a.length-1));return}e.reject(c.Location+" could not be found in your workspace")},function(a){e.reject(a)})}else{var g=this.getProjectHandler(c.Type);if(g===null)return e.reject(c.Type+" is not supported."),
e;var i;g.validationProperties&&(i=j._makeValidator(g,this.serviceRegistry,[]));this.fileClient.loadWorkspace(b).then(function(a){for(var b=[],d=!1,h=0;h<a.Children.length;h++){if(d===!0)break;if(i&&i.validationFunction(a.Children[h])){var j=g.getDependencyDescription(a.Children[h]);b.push(j);(function(b,h){h.then(function(h){h&&h.Location===c.Location&&(d=!0,e.resolve(a.Children[b]))})})(h,j)}}k.all(b).then(function(){d||e.reject(c.Name+" could not be found in your workspace")})},e.reject)}return e},
addProjectDependency:function(c,b){var h=new k;this.fileClient.fetchChildren(c.ContentLocation).then(function(e){for(var d=0;d<e.length;d++)if(e[d].Name==="project.json"){this.fileClient.read(e[d].Location).then(function(a){try{var m=g(a);if(!m.Dependencies)m.Dependencies=[];for(a=0;a<m.Dependencies.length;a++)if(m.Dependencies[a].Location===b.Location){h.resolve(m);return}m.Dependencies.push(b);this.fileClient.write(e[d].Location,JSON.stringify(m)).then(function(){m.ContentLocation=c.ContentLocation;
m.Name=c.Name;h.resolve(m)},h.reject);h.resolve(m)}catch(i){h.reject(i)}}.bind(this),h.reject,h.progress);break}}.bind(this),h.reject);return h},removeProjectDependency:function(c,b){var h=new k;this.fileClient.fetchChildren(c.ContentLocation).then(function(e){for(var d=0;d<e.length;d++)if(e[d].Name==="project.json"){this.fileClient.read(e[d].Location).then(function(a){try{var m=g(a);if(!m.Dependencies)m.Dependencies=[];for(var i=m.Dependencies.length-1;i>=0;i--)m.Dependencies[i].Location===b.Location&&
m.Dependencies[i].Type===b.Type&&m.Dependencies.splice(i,1);this.fileClient.write(e[d].Location,JSON.stringify(m)).then(function(){m.ContentLocation=c.ContentLocation;m.Name=c.Name;h.resolve(m)},h.reject)}catch(j){h.reject(j)}}.bind(this),h.reject,h.progress);break}}.bind(this),h.reject);return h},changeProjectProperties:function(c,b){function h(d){this.fileClient.read(d).then(function(a){try{var h=g(a),i;for(i in b)h[i]=b[i];this.fileClient.write(d,JSON.stringify(h)).then(function(){h.ContentLocation=
c.ContentLocation;h.ProjectJsonLocation=d;h.Name=c.Name;e.resolve(h)},e.reject)}catch(j){e.reject(j)}}.bind(this),e.reject)}if(b){var e=new k;c.ProjectJsonLocation&&h.bind(this)(c.ProjectJsonLocation);return e}},getProjectHandlerTypes:function(){for(var c=[],b=0;b<this.allProjectHandlersReferences.length;b++)c.push(this.allProjectHandlersReferences[b].getProperty("type"));return c},_getProjectDeployService:function(c){var b=this.serviceRegistry.getService(c);b.id=c.getProperty("id");b.name=c.getProperty("name");
b.tooltip=c.getProperty("tooltip");b.parameters=c.getProperty("parameters");b.optionalParameters=c.getProperty("optionalParameters");b.validationProperties=c.getProperty("validationProperties");b.logLocationTemplate=c.getProperty("logLocationTemplate");return b},matchesDeployService:function(c,b){return j._makeValidator(b,this.serviceRegistry,[]).validationFunction(c)},getProjectDeployTypes:function(){for(var c=this.allProjectDeployReferences.sort(function(b,d){var a=b.getProperty("priorityForDefault")||
0,c=d.getProperty("priorityForDefault")||0;return a>c?-1:a<c?1:0}),b=[],h=0;h<c.length;h++)b.push(c[h].getProperty("id"));return b},getProjectDelpoyService:function(c,b){for(var h=0;h<this.allProjectDeployReferences.length;h++)if(this.allProjectDeployReferences[h].getProperty("id")===c)return this._getProjectDeployService(this.allProjectDeployReferences[h]);if(b)for(h=0;h<this.allProjectDeployReferences.length;h++){var e=this.allProjectDeployReferences[h].getProperty("deployTypes");if(e&&e.some(function(d){return b===
d}))return this._getProjectDeployService(this.allProjectDeployReferences[h])}},_getProjectHandlerService:function(c){var b=this.serviceRegistry.getService(c);b.id=c.getProperty("id");b.addParameters=c.getProperty("addParameters")||c.getProperty("addParamethers");b.optionalParameters=c.getProperty("optionalParameters")||c.getProperty("optionalParamethers");b.addDependencyName=c.getProperty("addDependencyName");b.addDependencyTooltip=c.getProperty("addDependencyTooltip");b.type=c.getProperty("type");
b.actionComment=c.getProperty("actionComment");b.addProjectName=c.getProperty("addProjectName");b.addProjectTooltip=c.getProperty("addProjectTooltip");b.validationProperties=c.getProperty("validationProperties");return b},getProjectHandler:function(c){for(var b=0;b<this.allProjectHandlersReferences.length;b++)if(this.allProjectHandlersReferences[b].getProperty("type")===c)return this._getProjectHandlerService(this.allProjectHandlersReferences[b])},getMatchingProjectHandlers:function(c){for(var b=
[],h=0;h<this.allProjectHandlersReferences.length;h++)j._makeValidator(this.allProjectHandlersReferences[h]._properties,this.serviceRegistry,[]).validationFunction(c)&&b.push(this._getProjectHandlerService(this.allProjectHandlersReferences[h]));return b},_getLaunchConfigurationsDir:function(c,b){var h=new k;c.ContentLocation?this.fileClient.fetchChildren(c.ContentLocation).then(function(e){for(var d=0;d<e.length;d++)if(e[d].Name&&e[d].Name===this._launchConfigurationsDir)return h.resolve(e[d]),h;
b?this.fileClient.createFolder(c.ContentLocation,this._launchConfigurationsDir).then(h.resolve,h.reject):h.resolve(null)}.bind(this),h.reject):h.reject();return h},getProjectLaunchConfigurations:function(c){var b=new k;this._getLaunchConfigurationsDir(c).then(function(h){if(!h)return b.resolve([]),b;if(h.Children){for(var e=[],d=0;d<h.Children.length;d++){var a=new k;e.push(a);(function(a){this.fileClient.read(h.Children[d].Location).then(function(b){try{b=JSON.parse(b),b.Name=b.Name||h.Name.replace(".launch",
""),b.project=c,a.resolve(b)}catch(d){console.error(d),a.resolve()}}.bind(this),function(b){console.error(b);a.resolve()})}).call(this,a)}k.all(e).then(function(a){if(!a||!a.length)b.resolve([]);else{for(var d=a.length-1;d>=0;d--)a[d]||a.splice(d,1);b.resolve(a)}},b.reject)}else{var g=arguments.callee.bind(this);this.fileClient.fetchChildren(h.ChildrenLocation).then(function(a){h.Children=a;g(h)}.bind(this),b.reject)}}.bind(this),b.reject);return b},saveProjectLaunchConfiguration:function(c,b,h,e,
d,a,g,i,j){var o=new k,p=b,p=p.replace(/\ /g," "),p=p.replace(/[^\w\d\s]/g,"");p.indexOf(".launch")<0&&(p+=".launch");var s={Name:b,ServiceId:h,Params:e,Url:d,ManageUrl:a,Path:g};if(i)s.UrlTitle=i;if(j)s.Type=j;this._getLaunchConfigurationsDir(c,!0).then(function(a){if(a.Children){for(var b=0;b<a.Children.length;b++)if(a.Children[b].Name===p){this.fileClient.write(a.Children[b].Location,JSON.stringify(s)).then(function(){o.resolve(s)},o.reject);return}this.fileClient.createFile(a.Location,p).then(function(a){this.fileClient.write(a.Location,
JSON.stringify(s)).then(function(){o.resolve(s)},o.reject)}.bind(this),o.reject)}else{var d=arguments.callee.bind(this);this.fileClient.fetchChildren(a.ChildrenLocation).then(function(b){a.Children=b;d(a)}.bind(this),o.reject)}}.bind(this));return o}};c.prototype.constructor=c;return{ProjectClient:c}});
define("orion/widgets/nav/project-nav","i18n!orion/edit/nls/messages,orion/commands,orion/objects,orion/webui/littlelib,orion/explorers/explorer-table,orion/widgets/nav/common-nav,orion/projectCommands,orion/PageUtil,orion/URITemplate,orion/Deferred,orion/projectClient".split(","),function(i,k,j,g,c,f,b,h,e,d){function a(a,b,d,c,e,f,h,g){this.projectClient=h;this.project=b;this.fileMetadata=g;s.apply(this,arguments)}function m(a){this.projectClient=a.projectClient;o.apply(this,arguments);var d=this;
this.dependenciesDisplatcher=b.getDependencyDispatcher();this.dependneciesListener=function(){d.changedItem.call(d)};this._dependenciesEventTypes=["create","delete"];this._dependenciesEventTypes.forEach(function(a){d.dependenciesDisplatcher.addEventListener(a,d.dependneciesListener)})}function n(){p.apply(this,arguments)}function q(a){function b(a){a&&a.Directory&&d.getProjectJson(a).then(function(b){if(b)d.showViewMode(!0),c.getActiveViewModeId()===d.id?d.explorer.display(a):(d.project=a,c.setViewMode(d.id))})}
this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.sidebar=a.sidebar;this.explorer=null;var d=this,c=this.sidebar;this.editorInputManager.addEventListener("InputChanged",
function(a){b(a.metadata)});this.sidebarNavInputManager.addEventListener("linkClick",function(a){b(a.item)});this.sidebarNavInputManager.addEventListener("selectionChanged",function(a){if(c.getActiveViewModeId()!==d.id){d.project=null;var b=a.selections&&a.selections.length>0?a.selections[0]:null;if(b){for(;b.parent&&b.parent.parent;)b=b.parent;d.getProjectJson(b).then(function(a){d.project=b;d.showViewMode(!!a)})}else d.showViewMode(!1)}})}var o=f.CommonNavExplorer,p=f.CommonNavRenderer,s=c.FileModel,
u=new e("#{,resource,params*}");a.prototype=Object.create(s.prototype);j.mixin(a.prototype,{processParent:function(a,b){var d=s.prototype.processParent.call(this,a,b);if(!a.Project)a.Project=this.project;for(var c=0;c<b.length;c++)b[c].Project=this.project;return d},getChildren:function(a,b){if(a.children)b(a.children);else if(a.type==="Project"){var c=[];this.fileMetadata.type="ProjectRoot";c.push(this.fileMetadata);d.all((a.Dependencies||[]).map(function(b){var d={Dependency:b,Project:a};c.push(d);
return this.projectClient.getDependencyFileMetadata(b,a.WorkspaceLocation).then(function(a){j.mixin(d,a)},function(){d.Directory=d.disconnected=!0})}.bind(this))).then(function(){this.processParent(a,c);c.splice(c.indexOf(this.fileMetadata),1);c.splice(0,0,this.fileMetadata);b(c)}.bind(this))}else return s.prototype.getChildren.call(this,a,b)},getId:function(a){if(a.type==="Project")a={Location:a.ContentLocation};else if(a.Dependency&&a.disconnected)a=a.Dependency;return s.prototype.getId.call(this,
a)},hasChildren:function(){return!0}});m.prototype=Object.create(o.prototype);j.mixin(m.prototype,{onFileModelChange:function(a){var b=a.newValue;a.oldValue.ChildrenLocation===this.treeRoot.ContentLocation?this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:b?b.ChildrenLocation||b.ContentLocation:null,newInput:b?b.ChildrenLocation||b.ContentLocation:null}):o.prototype.onFileModelChange.call(this,a)},display:function(a,b){if(a){this.fileMetadata=a;var d;a&&a.Parents&&a.Parents.length===
0?d=a:a&&a.Parents&&(d=a.Parents[a.Parents.length-1]);return!b&&d&&d.Location===this.projectLocation?void 0:this.projectClient.readProject(a).then(function(c){this.projectLocation=d?d.Location:null;c.type="Project";c.Directory=!0;c.fileMetadata=a;return o.prototype.display.call(this,c,b).then(function(){return this.expandItem(a)}.bind(this))}.bind(this))}},loadResourceList:function(a){a&&typeof a==="object"&&(a=a.ChildrenLocation||a.ContentLocation);this.treeRoot&&a===this.treeRoot.ContentLocation?
this.display(this.fileMetadata,!0):this.scopeUp()},createModel:function(){return new a(this.registry,this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders,this.projectClient,this.fileMetadata)},reroot:function(a){this.scopeUp(a.Location);return(new d).reject()},createDefaultDeployCommand:function(){var a=this,b=new k.Command({name:i.Deploy,tooltip:a.defaultDeployCommand?a.defaultDeployCommand.tooltip?a.defaultDeployCommand.tooltip:a.defaultDeployCommand.name:i.Deploy,id:"orion.project.deploy.default",
visibleWhen:function(){return a.defaultDeployCommand&&a.defaultDeployCommand.visibleWhen.apply(a.defaultDeployCommand,arguments)},callback:function(b){return a.defaultDeployCommand.callback(b)}}),d=this.commandRegistry;d.addCommand(b);d.registerCommandContribution(this.additionalActionsScope,b.id,0)},registerCommands:function(){return o.prototype.registerCommands.call(this).then(function(){var a=this.commandRegistry,d=this.fileActionsScope,c=this.additionalActionsScope;a.registerCommandContribution("dependencyCommands",
"orion.project.dependency.connect",1);a.registerCommandContribution("dependencyCommands","orion.project.dependency.disconnect",2);a.registerCommandContribution(d,"orion.project.create.readme",5,"orion.menuBarFileGroup/orion.newContentGroup");var l=0;a.addCommandGroup(d,"orion.newDependency",6,i.Dependency,"orion.menuBarFileGroup/orion.newContentGroup");b.getAddDependencyCommands(a).forEach(function(b){a.registerCommandContribution(d,b.id,l++,"orion.menuBarFileGroup/orion.newContentGroup/orion.newDependency")});
a.addCommandGroup(c,"orion.deployNavGroup",1E3,i["Deploy As"],null,null,null,i["Deploy As"],"dropdownSelection");var e=b.getDeployProjectCommands(a);if(e&&e.length>0)this.defaultDeployCommand=e[0],l=0,e.forEach(function(b){a.registerCommandContribution(c,b.id,l++,"orion.deployNavGroup")});this.createDefaultDeployCommand()}.bind(this))},updateCommands:function(a){if(this.treeRoot&&this.treeRoot.Project&&typeof this.treeRoot.Project.launchConfigurations==="undefined"){this.treeRoot.Project.launchConfigurations=
[];var d=function(a,d){var c;if(this.launchCommands)for(c=0;c<this.launchCommands.length;c++)this.commandRegistry.unregisterCommandContribution(this.additionalActionsScope,this.launchCommands[c]);this.treeRoot.Project.launchConfigurations=a;this.launchCommands=[];b.updateProjectNavCommands(this.treeRoot,a,this.commandRegistry,this.projectClient,this.fileClient);var e;for(c=0;c<a.length;c++)e="orion.launchConfiguration.deploy."+a[c].ServiceId+a[c].Name,this.launchCommands.push(e),this.commandRegistry.registerCommandContribution(this.additionalActionsScope,
e,c+1,"orion.deployNavGroup/orion.deployLaunchConfigurationGroup");o.prototype.updateCommands.apply(this,d)};this.projectClient.getProjectLaunchConfigurations(this.treeRoot.Project).then(function(c){d.apply(this,[c,a]);if(!this.launchConfigurationListener){var l=this;this.launchConfigurationDispatcher=b.getLaunchConfigurationDispatcher();this.launchConfigurationListener=function(a){a.type==="changedDefault"?l.updateCommands(l.selection.getSelections()):l.selection.getSelections(function(b){if(a.oldValue)for(var c=
0;c<l.treeRoot.Project.launchConfigurations.length;c++){var e=l.treeRoot.Project.launchConfigurations[c];if(e.Name===a.oldValue.Name&&e.ServiceId===a.oldValue.ServiceId){if(a.newValue){l.treeRoot.Project.launchConfigurations[c]=a.newValue;d.apply(l,[l.treeRoot.Project.launchConfigurations,b]);return}l.treeRoot.Project.launchConfigurations[c].splice(c,1);break}}a.newValue&&l.treeRoot.Project.launchConfigurations.push(a.newValue);d.apply(l,[l.treeRoot.Project.launchConfigurations])})};this._launchConfigurationEventTypes=
["create","delete"];this._launchConfigurationEventTypes.forEach(function(a){l.launchConfigurationDispatcher.addEventListener(a,l.launchConfigurationListener)})}}.bind(this),function(b){console.error(b);o.prototype.updateCommands.apply(this,a)}.bind(this))}else o.prototype.updateCommands.apply(this,a)},scopeDown:!1,scopeUp:function(){var a=h.matchResourceParameters(),b=a.resource;delete a.navigate;delete a.resource;window.location.href=u.expand({resource:b,params:a});this.sidebar.setViewMode("nav")},
changedItem:function(a,b){return!a||!this.model?this.display(this.fileMetadata,!0):a.Projects?(new d).resolve():o.prototype.changedItem.call(this,a,b)},destroy:function(){if(this.launchCommands)for(var a=0;a<this.launchCommands.length;a++)this.commandRegistry.unregisterCommandContribution(this.additionalActionsScope,this.launchCommands[a],"orion.deployNavGroup/orion.deployLaunchConfigurationGroup");var b=this;this._dependenciesEventTypes.forEach(function(a){b.dependenciesDisplatcher.removeEventListener(a,
b.dependneciesListener)});b.launchConfigurationListener&&this._launchConfigurationEventTypes.forEach(function(a){b.launchConfigurationDispatcher.removeEventListener(a,b.launchConfigurationListener)});o.prototype.destroy.call(this)}});n.prototype=Object.create(p.prototype);j.mixin(n.prototype,{getCellElement:function(a,b,d){d=p.prototype.getCellElement.call(this,a,b,d);if((b.Dependency||b.type==="ProjectRoot")&&a===0){d.className=b.type==="ProjectRoot"?"projectNavColumn projectPrimaryNavColumn":"projectNavColumn";
g.$(".mainNavColumn",d).classList.add("projectInformationNode");var a=b.Dependency?b.Dependency.Name:b.Project?b.Project.Name:b.Name,c=g.$("a",d);b.disconnected&&(a+=" "+i.disconnected,c.removeAttribute("href"));g.empty(c);c.appendChild(document.createTextNode(a));if(b.Dependency)a=document.createElement("span"),a.className="mainNavColumn",a.style.cssFloat="right",this.explorer.commandRegistry.renderCommands("dependencyCommands",a,b,this,"tool"),d.appendChild(a)}return d}});j.mixin(q.prototype,{label:i.Project,
id:"project",create:function(){var a=this;this.explorer=new m({preferences:this.preferences,commandRegistry:this.commandRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,sidebar:this.sidebar,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,projectClient:this.projectClient,rendererFactory:function(b){return new n({checkbox:!1,treeTableClass:"miniNavTreeTable",cachePrefix:"ProjectNav"},b,a.commandRegistry,a.contentTypeRegistry)},serviceRegistry:this.serviceRegistry,
toolbarNode:this.toolbarNode});this.explorer.display(this.project);window.location.href=u.expand({resource:this.project.Location});this.sidebar.hideToolbar()},destroy:function(){this.explorer&&this.explorer.destroy();this.explorer=null;this.sidebar.showToolbar()},getProjectJson:function(a){function b(a){for(var d=0;d<a.length;d++)if(!a[d].Directory&&a[d].Name==="project.json")return a[d];return null}var c=new d;a.Children||a.children?c.resolve(b(a.Children||a.children)):a.ChildrenLocation&&this.fileClient.fetchChildren(a.ChildrenLocation).then(function(d){a.Children=
d;c.resolve(b(d))});return c},showViewMode:function(a){var b=this.sidebar;!!b.getViewMode(this.id)!==a&&(a?b.addViewMode(this.id,this):b.removeViewMode(this.id),b.renderViewModeMenu())}});return q});
define("orion/sidebar","orion/Deferred,orion/objects,orion/commands,orion/outliner,orion/webui/littlelib,orion/PageUtil,orion/widgets/nav/mini-nav,orion/widgets/nav/project-nav,orion/globalCommands,i18n!orion/edit/nls/messages".split(","),function(i,k,j,g,c,f,b,h,e,d){function a(a){this.params=a;this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.outlineService=
a.outlineService;this.parentNode=c.node(a.parent);this.toolbarNode=c.node(a.toolbar);this.selection=a.selection;this.serviceRegistry=a.serviceRegistry;this.sidebarNavInputManager=a.sidebarNavInputManager;this.menuBar=a.menuBar;this.viewModes={};this.activeViewMode=null;this.switcherScope=a.switcherScope;this.switcherNode=null}k.mixin(a.prototype,{defaultViewMode:"nav",show:function(){if(!this.created){this.created=!0;var a=this.commandRegistry,f=this.contentTypeRegistry,i=this.fileClient,o=this.editorInputManager,
p=this.outlineService,s=this.parentNode,k=this.progressService,v=this.selection,t=this.serviceRegistry,w=this.toolbarNode,l=this.switcherNode=c.node(this.switcherScope),r=new j.Command({name:d.SidePanel,imageClass:"core-sprite-outline",selectionClass:"dropdownSelection",tooltip:d.SidePanelTooltip,id:"orion.sidebar.viewmode",visibleWhen:function(){var a=e.getMainSplitter();return a?!a.splitter.isClosed():!0},choiceCallback:this.viewModeMenuCallback.bind(this)});a.addCommand(r);a.registerCommandContribution(l.id,
"orion.sidebar.viewmode",2,"orion.menuBarViewGroup");this.addViewMode("nav",new b({commandRegistry:a,contentTypeRegistry:f,preferences:this.preferences,fileClient:i,editorInputManager:o,parentNode:s,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:t,toolbarNode:w,sidebar:this}));if(this.serviceRegistry.getServiceReferences("orion.projects").length>0)this.projectViewMode=new h({commandRegistry:a,contentTypeRegistry:f,preferences:this.preferences,fileClient:i,editorInputManager:o,
parentNode:s,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:t,toolbarNode:w,sidebar:this});this.outliner=new g.Outliner({parent:s,toolbar:w,serviceRegistry:t,contentTypeRegistry:f,preferences:this.preferences,outlineService:p,commandService:a,selectionService:v,inputManager:o,progressService:k,sidebar:this});this.setViewMode(this.defaultViewMode)}},showToolbar:function(){this.toolbarNode.style.display="block";this.parentNode.classList.remove("toolbarTarget-toolbarHidden")},hideToolbar:function(){this.toolbarNode.style.display=
"none";this.parentNode.classList.add("toolbarTarget-toolbarHidden")},viewModeMenuCallback:function(){var a=this,b=this.getActiveViewModeId();return Object.keys(this.viewModes).map(function(d){var c=a.getViewMode(d);return{checked:d===b,name:c.label||d,callback:a.setViewMode.bind(a,d)}})},getActiveViewModeId:function(){return this.activeViewModeId},addViewMode:function(a,b){if(!a)throw Error("Invalid id: "+a);if(!b||typeof b!=="object")throw Error("Invalid mode: "+b);Object.prototype.hasOwnProperty.call(this.viewModes,
a)||(this.viewModes[a]=b)},removeViewMode:function(a){var b=this.getViewMode(a);b&&typeof b.destroy==="function"&&b.destroy();delete this.viewModes[a]},getViewMode:function(a){return Object.prototype.hasOwnProperty.call(this.viewModes,a)?this.viewModes[a]:null},setViewMode:function(a){var b=this.activeViewMode;b&&typeof b.destroy==="function"&&b.destroy();this.toolbarNode&&this.commandRegistry.destroy(this.toolbarNode);c.empty(this.parentNode);this.activeViewModeId=(b=this.activeViewMode=this.getViewMode(a))?
a:null;b&&typeof b.create==="function"&&b.create()},renderViewModeMenu:function(){var a=this.switcherNode;this.commandRegistry.destroy(a);this.commandRegistry.renderCommands(a.id,a,null,this,"button")}});return a});
define("orion/inputManager","i18n!orion/edit/nls/messages,orion/i18nUtil,orion/Deferred,orion/EventTarget,orion/objects,orion/PageUtil".split(","),function(i,k,j,g,c,f){function b(b){this._document=b.document||document;this._timeout=b.timeout;for(var b="keypress,keydown,keyup,mousemove,mousedown,mousemove".split(","),a=function(){this._resetTimer()}.bind(this),c=0;c<b.length;c++)this._document.addEventListener(b[c],a,!0);g.attach(this)}function h(b,a){if(b){if(!a.Severity){var c=a,e={Severity:"Error",
Message:i.noResponse};if(c.status!==0)if(c.responseText){c=c.responseText;try{var f=JSON.parse(c);e.Severity=f.Severity||e.Severity;e.Message=f.Message||e.Message}catch(h){e.Message=c}}else try{e.Message=JSON.stringify(c)}catch(g){}a=e}b.setProgressResult(a)}else window.console.log(a)}function e(b){g.attach(this);this.serviceRegistry=b.serviceRegistry;this.statusService=b.statusService;this.fileClient=b.fileClient;this.progressService=b.progressService;this.contentTypeRegistry=b.contentTypeRegistry;
this.selection=b.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}b.prototype={_resetTimer:function(){var b=this._document.defaultView||this._document.parentWindow;if(this._timer)b.clearTimeout(this._timer),this._timer=null;if(this._timeout!==-1)this._timer=b.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout)},onIdle:function(b){return this.dispatchEvent(b)},setTimeout:function(b){this._timeout=b;this._resetTimer()}};
c.mixin(e.prototype,{_maybeLoadWorkspace:function(b){var a=this.fileClient;return b===a.fileServiceRootURL(b)?a.loadWorkspace(b).then(function(a){return a.Location}):(new j).resolve(b)},_read:function(b){if(this.cachedMetadata&&this.cachedMetadata.Location===b)return(new j).resolve(this.cachedMetadata);var a=this.fileClient,c=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(b).then(function(b){return a.read.apply(a,[b].concat(c))})},load:function(){var b=this.getInput();if(b){var a=
this.fileClient,c=this._parsedLocation.resource,e=this.progressService,f=function(a,b,d){return!e?a:e.progress(a,k.formatMessage(b,d))},g=this.getEditor();if(this._fileMetadata)!this._saving&&!this._fileMetadata.Directory&&!this._readonly&&f(a.read(c,!0),i.ReadingMetadata,b).then(function(l){if(this._fileMetadata&&this._fileMetadata.Location===l.Location&&this._fileMetadata.ETag!==l.ETag)this._fileMetadata=l,(!g.isDirty()||window.confirm(i.loadOutOfSync))&&f(a.read(c),i.Reading,b).then(function(a){g.setInput(b,
null,a);this._unsavedChanges=[]}.bind(this))}.bind(this));else{var p=c;if(p.indexOf("/gitapi/commit/")===0){var s=p.indexOf("/file"),u=p.indexOf("?",s);if(u===-1)u=p.length;p=p.substring(s,u);this._readonly=!0}var v=window.setTimeout(function(){v=null;this.reportStatus(k.formatMessage(i.Fetching,b))}.bind(this),800),t=function(){this.reportStatus("");v&&window.clearTimeout(v)}.bind(this),w=function(a){t();var b=null;if(this.serviceRegistry)b=this.serviceRegistry.getService("orion.page.message");else if(this.statusService)b=
this.statusService;h(b,a);this._setNoInput()}.bind(this);this._acceptPatch=null;f(this._read(p,!0),i.ReadingMetadata,p).then(function(l){l?l.Directory?j.when(l.Children||f(a.fetchChildren(l.ChildrenLocation),i.Reading,b),function(a){t();l.Children=a;this._setInputContents(this._parsedLocation,b,a,l)}.bind(this),w):this._isText(l)?f(a.read(c,!1,!0),i.Reading,b).then(function(a){t();if(typeof a!=="string")this._acceptPatch=a.acceptPatch,a=a.result;this._setInputContents(this._parsedLocation,b,a,l)}.bind(this),
w):f(a._getService(c).readBlob(c),i.Reading,b).then(function(a){t();this._setInputContents(this._parsedLocation,b,a,l)}.bind(this),w):w({responseText:k.formatMessage(i.ReadingMetadataError,p)})}.bind(this),w)}}},processParameters:function(b){var a=this.getEditor();a&&a.processParameters&&a.processParameters(b)},getAutoLoadEnabled:function(){return this._autoLoadEnabled},getAutoSaveEnabled:function(){return this._autoSaveEnabled},getEditor:function(){return this.editor},getInput:function(){return this._input},
getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var b=this._fileMetadata;return this._readonly||!b||b.Attributes&&b.Attributes.ReadOnly},getContentType:function(){return this._contentType},onFocus:function(){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()},onChanging:function(b){if(this._getSaveDiffsEnabled()){var a=this._unsavedChanges.length,c=b.removedCharCount,e=b.start,f=b.start+c,h=0;
b.addedCharCount===0?h=-1:c===0&&(h=1);if(a>0&&h===this.previousChangeType){a=this._unsavedChanges[a-1];if(c===0&&e===a.end+a.text.length){a.text+=b.text;return}if(b.addedCharCount===0&&f===a.start){a.start=e;return}}this.previousChangeType=h;this._unsavedChanges.push({start:e,end:f,text:b.text})}},reportStatus:function(b){this.statusReporter?this.statusReporter(b):this.editor&&this.editor.reportStatus(b)},save:function(){function b(a){if(f===r.getInput())r.getFileMetadata().ETag=a.ETag,c.setInput(f,
null,g,!0);r.reportStatus("");e&&l&&l.setProgressResult({Message:i.Saved,Severity:"Normal"});r.afterSave&&r.afterSave();r._saving=!1}function a(a){r.reportStatus("");h(l,a);r._saving=!1;r._errorSaving=!0}if(!this._saving){var c=this.getEditor();if(c&&c.isDirty()&&!this.getReadOnly()){var e=this._errorSaving;this._saving=!0;var f=this.getInput();this.reportStatus(i["Saving..."]);this.dispatchEvent({type:"Saving",inputManager:this});c.markClean();var g=c.getText(),j=g;if(this._getSaveDiffsEnabled()&&
!this._errorSaving){for(var s=this._unsavedChanges,u=0,v=0;v<s.length;v++)u+=s[v].text.length;g.length>u&&(j={diff:s})}this._unsavedChanges=[];this._errorSaving=!1;var s={ETag:this.getFileMetadata().ETag},t=this._parsedLocation.resource,j=this.fileClient.write(t,j,s),w=this.progressService,l=null;this.serviceRegistry&&(l=this.serviceRegistry.getService("orion.page.message"));w&&(j=w.progress(j,k.formatMessage(i.savingFile,f)));var r=this;j.then(b,function(c){c.status===412?window.confirm(i.saveOutOfSync)?
(c=r.fileClient.write(t,g),w&&(c=w.progress(c,k.formatMessage(i.savingFile,f))),c.then(b,a)):r._saving=!1:a(c)})}}},setAutoLoadEnabled:function(b){this._autoLoadEnabled=b},setAutoSaveTimeout:function(d){this._autoSaveEnabled=d!==-1;this._idle?this._idle.setTimeout(d):(this._idle=new b({document:document,timeout:d}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(b){this._contentType=b},setInput:function(b){if(!this._ignoreInput&&
(b||(b=f.hash()),typeof b==="string")){var a=this.getEditor();b&&b[0]!=="#"&&(b="#"+b);var c=f.matchResourceParameters(b),e=this._parsedLocation||{};if(a&&a.isDirty()){var h=this._location;if(e.resource!==c.resource)if(this._autoSaveEnabled)this.save();else if(!window.confirm(i.confirmUnsavedChanges)){window.location.hash=h;return}}a=a&&e.editor!==c.editor;this._location=b;this._parsedLocation=c;this._ignoreInput=!0;this.selection&&this.selection.setSelections(b);this._ignoreInput=!1;(b=c.resource)?
b===this._input?a?(this.reportStatus(""),this._setInputContents(c,b,null,this._fileMetadata,this._isText(this._fileMetadata))):this.processParameters(c):(this._input=b,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(b){var a=b.lastIndexOf("/");a!==-1&&(b=b.substring(a+1));this._title=b},setSaveDiffsEnabled:function(b){this._saveDiffsEnabled=b},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&this._acceptPatch!==null&&this._acceptPatch.indexOf("application/json-patch")!==
-1},_isText:function(b){b=this.contentTypeRegistry.getFileContentType(b);if(!b)return!0;var a=this.contentTypeRegistry.getContentType("text/plain");return this.contentTypeRegistry.isExtensionOf(b,a)},_setNoInput:function(b){b?this.fileClient.loadWorkspace("").then(function(a){this._input=a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=this._fileMetadata=null,this.setContentType(null),this.dispatchEvent({type:"InputChanged",input:null}))},
_setInputContents:function(b,a,c,e,f){var h,g=!1;e?(this._fileMetadata=e,this.setTitle(e.Location||String(e)),this.setContentType(this.contentTypeRegistry.getFileContentType(e)),h=e.Name,g=e.Directory):(this._fileMetadata=null,this.setTitle(a),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),h=this.getTitle());var i=this.getEditor();if(this._focusListener)i&&i.getTextView&&i.getTextView()&&i.getTextView().removeEventListener("Focus",this._focusListener),this._focusListener=
null;if(this._changingListener)i&&i.getModel&&i.getModel()&&i.getModel().removeEventListener("Changing",this._changingListener),this._changingListener=null;e={type:"InputChanged",input:b,name:h,title:a,contentType:this.getContentType(),metadata:e,location:window.location,contents:c};this.dispatchEvent(e);this.editor=i=e.editor;if(!g){if(i&&i.getModel&&i.getModel())i.getModel().addEventListener("Changing",this._changingListener=this.onChanging.bind(this));f||i.setInput(a,null,c);if(i&&i.getTextView&&
i.getTextView())i.getTextView().addEventListener("Focus",this._focusListener=this.onFocus.bind(this));this._unsavedChanges=[];this.processParameters(b)}}});return{handleError:h,InputManager:e}});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(i,k,j){function g(c,f){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(c);this.setLineDelimiter(f)}g.prototype={destroy:function(){},find:function(c){if(this._text.length>1)this._text=[this._text.join("")];var f=c.string,b=c.regex,h=f,e="",d=c.caseInsensitive;if(h)if(b){if(f=k.parse(h))h=f.pattern,e=f.flags}else h=f.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),d&&(h=h.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var a=null,g;if(h){var f=c.reverse,i=c.wrap,b=c.wholeWord,j=c.start||0,c=c.end,o=c!==null&&c!==void 0;e.indexOf("g")===-1&&(e+="g");e.indexOf("m")===-1&&(e+="m");d&&e.indexOf("i")===-1&&(e+="i");b&&(h="\\b"+h+"\\b");var p=this._text[0],s,u,v=0;o&&(d=j<c?j:c,p=p.substring(d,j<c?c:j),v=d);var t=RegExp(h,e);if(f)g=function(){var a=null;for(t.lastIndex=0;;){u=t.lastIndex;s=t.exec(p);if(u===t.lastIndex)return null;if(s){if(!(s.index+v<j)){if(!i||a)break;j=p.length+v}a={start:s.index+
v,end:t.lastIndex+v}}else break}if(a)j=a.start;return a};else{if(!o)t.lastIndex=j;g=function(){for(;;){u=t.lastIndex;s=t.exec(p);if(u===t.lastIndex)break;if(s)return{start:s.index+v,end:t.lastIndex+v};if(!(u!==0&&i))break}return null}}a=g()}return{next:function(){var b=a;b&&(a=g());return b},hasNext:function(){return a!==null}}},getCharCount:function(){for(var c=0,f=0;f<this._text.length;f++)c+=this._text[f].length;return c},getLine:function(c,f){var b=this.getLineCount();if(!(0<=c&&c<b))return null;
var h=this._lineOffsets[c];if(c+1<b){b=this.getText(h,this._lineOffsets[c+1]);if(f)return b;for(var h=b.length,e;(e=b.charCodeAt(h-1))===10||e===13;)h--;return b.substring(0,h)}else return this.getText(h)},getLineAtOffset:function(c){var f=this.getCharCount();if(!(0<=c&&c<=f))return-1;var b=this.getLineCount();if(c===f)return b-1;var h,e,d=this._lastLineIndex;if(0<=d&&d<b&&(h=this._lineOffsets[d],e=d+1<b?this._lineOffsets[d+1]:f,h<=c&&c<e))return d;for(var a=b,g=-1;a-g>1;)if(d=Math.floor((a+g)/2),
h=this._lineOffsets[d],e=d+1<b?this._lineOffsets[d+1]:f,c<=h)a=d;else if(c<e){a=d;break}else g=d;return this._lastLineIndex=a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(c,f){var b=this.getLineCount();if(!(0<=c&&c<b))return-1;if(c+1<b){b=this._lineOffsets[c+1];if(f)return b;for(var h=this.getText(Math.max(this._lineOffsets[c],b-2),b),e=h.length,d;(d=h.charCodeAt(e-1))===10||d===13;)e--;return b-(h.length-e)}else return this.getCharCount()},
getLineStart:function(c){return!(0<=c&&c<this.getLineCount())?-1:this._lineOffsets[c]},getText:function(c,f){c===void 0&&(c=0);f===void 0&&(f=this.getCharCount());if(c===f)return"";for(var b=0,h=0,e;h<this._text.length;){e=this._text[h].length;if(c<=b+e)break;b+=e;h++}for(var d=b,a=h;h<this._text.length;){e=this._text[h].length;if(f<=b+e)break;b+=e;h++}if(a===h)return this._text[a].substring(c-d,f-b);d=this._text[a].substring(c-d);b=this._text[h].substring(0,f-b);return d+this._text.slice(a+1,h).join("")+
b},onChanging:function(c){return this.dispatchEvent(c)},onChanged:function(c){return this.dispatchEvent(c)},setLineDelimiter:function(c,f){c==="auto"&&(c=void 0,this.getLineCount()>1&&(c=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=c?c:j.platformDelimiter;if(f){var b=this.getLineCount();if(b>1){for(var h=Array(b),e=0;e<b;e++)h[e]=this.getLine(e);this.setText(h.join(this._lineDelimiter))}}},setText:function(c,f,b){c===void 0&&(c="");f===void 0&&(f=0);b===void 0&&(b=
this.getCharCount());if(!(f===b&&c==="")){for(var h=this.getLineAtOffset(f),e=this.getLineAtOffset(b),d=f,a=b-f,g=e-h,i=c.length,j=0,o=this.getLineCount(),k=0,s=0,u=0,v=[];;){k!==-1&&k<=u&&(k=c.indexOf("\r",u));s!==-1&&s<=u&&(s=c.indexOf("\n",u));if(s===-1&&k===-1)break;u=k!==-1&&s!==-1?k+1===s?s+1:(k<s?k:s)+1:k!==-1?k+1:s+1;v.push(f+u);j++}this.onChanging({type:"Changing",text:c,start:d,removedCharCount:a,addedCharCount:i,removedLineCount:g,addedLineCount:j});v.length===0&&(u=this.getLineStart(h),
e=e+1<o?this.getLineStart(e+1):this.getCharCount(),f!==u&&(c=this.getText(u,f)+c,f=u),b!==e&&(c+=this.getText(b,e),b=e));u=i-a;for(e=h+g+1;e<o;e++)this._lineOffsets[e]+=u;if(v.length<5E4)h=[h+1,g].concat(v),Array.prototype.splice.apply(this._lineOffsets,h);else{u=h+1;this._lineOffsets.splice(u,g);for(o=0;o<v.length;o+=5E4)h=[u,0].concat(v.slice(o,Math.min(v.length,o+5E4))),Array.prototype.splice.apply(this._lineOffsets,h),u+=5E4}for(u=o=0;u<this._text.length;){e=this._text[u].length;if(f<=o+e)break;
o+=e;u++}h=o;for(v=u;u<this._text.length;){e=this._text[u].length;if(b<=o+e)break;o+=e;u++}e=this._text[u];f=this._text[v].substring(0,f-h);b=e.substring(b-o);v=[v,u-v+1];f&&v.push(f);c&&v.push(c);b&&v.push(b);Array.prototype.splice.apply(this._text,v);if(this._text.length===0)this._text=[""];this.onChanged({type:"Changed",start:d,removedCharCount:a,addedCharCount:i,removedLineCount:g,addedLineCount:j})}}};i.EventTarget.addMixin(g.prototype);return{TextModel:g}});
define("orion/editor/undoStack",[],function(){function i(g,c,f,b,h){this.model=g;this.offset=c;this.text=f;this.previousText=b;this.type=h}function k(g){this.owner=g;this.changes=[]}function j(g,c){this.size=c!==void 0?c:100;this.reset();var f=this;this._listener={onChanging:function(b){f._onChanging(b)},onDestroy:function(b){f._onDestroy(b)}};if(g.getModel){var b=g.getModel();b.getBaseModel&&(b=b.getBaseModel());this.model=b;this.setView(g)}else this.shared=!0,this.model=g;this.model.addEventListener("Changing",
this._listener.onChanging)}i.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(g,c){this._doUndoRedo(this.offset,this.previousText,this.text,g,c);return!0},redo:function(g,c){this._doUndoRedo(this.offset,this.text,this.previousText,g,c);return!0},merge:function(g,c,f,b,h){if(b===this.type)if(b===1&&g===
this.offset+this.text.length)return this.text+=c,!0;else if(b===-1&&h===this.offset)return this.offset=g,this.previousText=f+this.previousText,!0;else if(b===-1&&g===this.offset)return this.previousText+=f,!0;return!1},_doUndoRedo:function(g,c,f,b,h){this.model.setText(c,g,g+f.length);h&&b&&(f=b.getModel(),f!==this.model&&(g=f.mapOffset(g,!0)),b.setSelection(g,g+c.length))}};k.prototype={getRedoChanges:function(){for(var g=[],c=0;c<this.changes.length;c++)g=g.concat(this.changes[c].getRedoChanges());
return g},getUndoChanges:function(){for(var g=[],c=this.changes.length-1;c>=0;c--)g=g.concat(this.changes[c].getUndoChanges());return g},add:function(g){this.changes.push(g)},end:function(g){if(g)this.endSelection=g.getSelection(),this.endCaret=g.getCaretOffset();(g=this.owner)&&g.end&&g.end()},undo:function(g,c){this.changes.length>1&&g&&g.setRedraw(!1);for(var f=this.changes.length-1;f>=0;f--)this.changes[f].undo(g,!1);this.changes.length>1&&g&&g.setRedraw(!0);if(c&&g){var f=this.startSelection.start,
b=this.startSelection.end;g.setSelection(this.startCaret?f:b,this.startCaret?b:f)}(f=this.owner)&&f.undo&&f.undo();return this.changes.length>0},redo:function(g,c){this.changes.length>1&&g&&g.setRedraw(!1);for(var f=0;f<this.changes.length;f++)this.changes[f].redo(g,!1);g&&g.setRedraw(!0);if(c&&g){var f=this.endSelection.start,b=this.endSelection.end;g.setSelection(this.endCaret?f:b,this.endCaret?b:f)}(f=this.owner)&&f.redo&&f.redo();return this.changes.length>0},merge:function(g,c,f,b,h){var e=this.changes.length;
return e>0?this.changes[e-1].merge(g,c,f,b,h):!1},start:function(g){if(g)this.startSelection=g.getSelection(),this.startCaret=g.getCaretOffset();(g=this.owner)&&g.start&&g.start()}};j.prototype={destroy:function(){this._onDestroy()},add:function(g){this.compoundChange?this.compoundChange.add(g):(this.stack.splice(this.index,this.stack.length-this.index,g),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--))},markClean:function(){this._commitUndo();if(this.cleanChange=this.stack[this.index-
1])this.cleanChange.type=2},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return this.index>0},canRedo:function(){return this.stack.length-this.index>0},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var g=[],c=this.index;c<this.stack.length;c++)g=g.concat(this.stack[c].getRedoChanges());
return g},getUndoChanges:function(){this._commitUndo();for(var g=[],c=this.index;c>=0;c--)g=g.concat(this.stack[c].getUndoChanges());return g},undo:function(){this._commitUndo();var g;g=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;g=this.stack[--this.index]}while(!(g=g.undo(this.view,!0)));this._ignoreUndo=!1;return g},redo:function(){this._commitUndo();var g;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;g=this.stack[this.index++]}while(!g.redo(this.view,!0));this._ignoreUndo=
!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(g){if(this.view!==g)this.view&&g.removeEventListener("Destroy",this._listener.onDestroy),(this.view=g)&&g.addEventListener("Destroy",this._listener.onDestroy)},startCompoundChange:function(g){this._commitUndo();g=new k(g);this.add(g);this.compoundChange=g;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(g){(!g||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);if(this.view)this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null},_onChanging:function(g){if(!this._ignoreUndo){var c=g.text,f=g.start,b=g.addedCharCount,h=g.removedCharCount,g=f+h,e=0;b===0&&h===1?e=-1:b===1&&h===0&&(e=1);b=this.stack.length;h=this.model.getText(f,g);(!(b>0&&this.index===b)||!this.stack[b-1].merge(f,c,h,e,g))&&this.add(new i(this.model,f,c,
h,e))}}};return{UndoStack:j}});
(function(){function i(a){this.tokens=[];this.tokens.links={};this.options=a||h.defaults;this.rules=e.normal;if(this.options.gfm)this.rules=this.options.tables?e.tables:e.gfm}function k(a,b){this.options=b||h.defaults;this.links=a;this.rules=d.normal;if(!this.links)throw Error("Tokens array requires a `links` property.");if(this.options.gfm)this.rules=this.options.breaks?d.breaks:d.gfm;else if(this.options.pedantic)this.rules=d.pedantic}function j(a){this.tokens=[];this.token=null;this.options=a||
h.defaults}function g(a,b){return a.replace(!b?/&(?!#?\w+;)/g:/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function c(a,b){a=a.source;b=b||"";return function q(d,c){if(!d)return RegExp(a,b);c=c.source||c;c=c.replace(/(^|[^\[])\^/g,"$1");a=a.replace(d,c);return q}}function f(){}function b(a){for(var b=1,d,c;b<arguments.length;b++)for(c in d=arguments[b],d)Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c]);return a}function h(a,d,c){if(c||
typeof d==="function"){c||(c=d,d=null);d&&(d=b({},h.defaults,d));var e=d.highlight,f,k,s=0;try{f=i.lex(a,d)}catch(u){return c(u)}k=f.length;var v=function(a){var b,h;a!==!0&&delete d.highlight;try{b=j.parse(f,d)}catch(g){h=g}d.highlight=e;return h?c(h):c(null,b)};if(!e||e.length<3)return v(!0);if(!k)return v();for(;s<f.length;s++)(function(a){return a.type!=="code"?--k||v():e(a.text,a.lang,function(b,d){if(d==null||d===a.text)return--k||v();a.text=d;a.escaped=!0;--k||v()})})(f[s])}else try{return d&&
(d=b({},h.defaults,d)),j.parse(i.lex(a,d),d)}catch(t){t.message+="\nPlease report this to https://github.com/chjj/marked.";if((d||h.defaults).silent)return"<p>An error occured:</p><pre>"+g(t.message+"",!0)+"</pre>";throw t;}}var e={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:f,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:f,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};e.item=c(e.item,"gm")(/bull/g,e.bullet)();e.list=c(e.list)(/bull/g,e.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();e._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b";
e.html=c(e.html)("comment",/<\!--[\s\S]*?--\>/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,e._tag)();e.paragraph=c(e.paragraph)("hr",e.hr)("heading",e.heading)("lheading",e.lheading)("blockquote",e.blockquote)("tag","<"+e._tag)("def",e.def)();e.normal=b({},e);e.gfm=b({},e.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});e.gfm.paragraph=c(e.paragraph)("(?!","(?!"+e.gfm.fences.source.replace("\\1","\\2")+"|")();e.tables=
b({},e.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});i.rules=e;i.lex=function(a,b){return(new i(b)).lex(a)};i.prototype.lex=function(a){a=a.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(a,!0)};i.prototype.token=function(a,b){for(var a=a.replace(/^ +$/gm,""),d,c,f,h,g,i,j;a;){if(f=this.rules.newline.exec(a))a=a.substring(f[0].length),f[0].length>
1&&this.tokens.push({type:"space"});if(f=this.rules.code.exec(a))a=a.substring(f[0].length),f=f[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:!this.options.pedantic?f.replace(/\n+$/,""):f});else if(f=this.rules.fences.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"code",lang:f[2],text:f[3]});else if(f=this.rules.heading.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"heading",depth:f[1].length,text:f[2]});else if(b&&(f=this.rules.nptable.exec(a))){a=a.substring(f[0].length);
g={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/\n$/,"").split("\n")};for(i=0;i<g.align.length;i++)g.align[i]=/^ *-+: *$/.test(g.align[i])?"right":/^ *:-+: *$/.test(g.align[i])?"center":/^ *:-+ *$/.test(g.align[i])?"left":null;for(i=0;i<g.cells.length;i++)g.cells[i]=g.cells[i].split(/ *\| */);this.tokens.push(g)}else if(f=this.rules.lheading.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"heading",
depth:f[2]==="="?1:2,text:f[1]});else if(f=this.rules.hr.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"hr"});else if(f=this.rules.blockquote.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"blockquote_start"}),f=f[0].replace(/^ *> ?/gm,""),this.token(f,b),this.tokens.push({type:"blockquote_end"});else if(f=this.rules.list.exec(a)){a=a.substring(f[0].length);h=f[2];this.tokens.push({type:"list_start",ordered:h.length>1});f=f[0].match(this.rules.item);d=!1;j=f.length;for(i=0;i<
j;i++)g=f[i],c=g.length,g=g.replace(/^ *([*+-]|\d+\.) +/,""),~g.indexOf("\n ")&&(c-=g.length,g=!this.options.pedantic?g.replace(RegExp("^ {1,"+c+"}","gm"),""):g.replace(/^ {1,4}/gm,"")),this.options.smartLists&&i!==j-1&&(c=e.bullet.exec(f[i+1])[0],h!==c&&!(h.length>1&&c.length>1)&&(a=f.slice(i+1).join("\n")+a,i=j-1)),c=d||/\n\n(?!\s*$)/.test(g),i!==j-1&&(d=g[g.length-1]==="\n",c||(c=d)),this.tokens.push({type:c?"loose_item_start":"list_item_start"}),this.token(g,!1),this.tokens.push({type:"list_item_end"});
this.tokens.push({type:"list_end"})}else if(f=this.rules.html.exec(a))a=a.substring(f[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:f[1]==="pre"||f[1]==="script",text:f[0]});else if(b&&(f=this.rules.def.exec(a)))a=a.substring(f[0].length),this.tokens.links[f[1].toLowerCase()]={href:f[2],title:f[3]};else if(b&&(f=this.rules.table.exec(a))){a=a.substring(f[0].length);g={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,
"").split(/ *\| */),cells:f[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i<g.align.length;i++)g.align[i]=/^ *-+: *$/.test(g.align[i])?"right":/^ *:-+: *$/.test(g.align[i])?"center":/^ *:-+ *$/.test(g.align[i])?"left":null;for(i=0;i<g.cells.length;i++)g.cells[i]=g.cells[i].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(g)}else if(b&&(f=this.rules.paragraph.exec(a)))a=a.substring(f[0].length),this.tokens.push({type:"paragraph",text:f[1][f[1].length-1]==="\n"?f[1].slice(0,-1):
f[1]});else if(f=this.rules.text.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"text",text:f[0]});else if(a)throw Error("Infinite loop on byte: "+a.charCodeAt(0));}return this.tokens};var d={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:f,tag:/^<\!--[\s\S]*?--\>|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:f,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};d.link=c(d.link)("inside",d._inside)("href",d._href)();d.reflink=c(d.reflink)("inside",d._inside)();d.normal=b({},d);d.pedantic=b({},d.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});
d.gfm=b({},d.normal,{escape:c(d.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:c(d.text)("]|","~]|")("|","|https?://|")()});d.breaks=b({},d.gfm,{br:c(d.br)("{2,}","*")(),text:c(d.gfm.text)("{2,}","*")()});k.rules=d;k.output=function(a,b,d){return(new k(b,d)).output(a)};k.prototype.output=function(a){var m;var l;for(var b="",d,c;a;)if(c=this.rules.escape.exec(a))a=a.substring(c[0].length),b+=c[1];else if(c=this.rules.autolink.exec(a))a=a.substring(c[0].length),
c[2]==="@"?(d=c[1][6]===":"?this.mangle(c[1].substring(7)):this.mangle(c[1]),c=this.mangle("mailto:")+d):(l=d=g(c[1]),c=l),b+='<a href="'+c+'">'+d+"</a>";else if(c=this.rules.url.exec(a))a=a.substring(c[0].length),m=d=g(c[1]),c=m,b+='<a href="'+c+'">'+d+"</a>";else if(c=this.rules.tag.exec(a))a=a.substring(c[0].length),b+=this.options.sanitize?g(c[0]):c[0];else if(c=this.rules.link.exec(a))a=a.substring(c[0].length),b+=this.outputLink(c,{href:c[2],title:c[3]});else if((c=this.rules.reflink.exec(a))||
(c=this.rules.nolink.exec(a)))a=a.substring(c[0].length),d=(c[2]||c[1]).replace(/\s+/g," "),d=this.links[d.toLowerCase()],!d||!d.href?(b+=c[0][0],a=c[0].substring(1)+a):b+=this.outputLink(c,d);else if(c=this.rules.strong.exec(a))a=a.substring(c[0].length),b+="<strong>"+this.output(c[2]||c[1])+"</strong>";else if(c=this.rules.em.exec(a))a=a.substring(c[0].length),b+="<em>"+this.output(c[2]||c[1])+"</em>";else if(c=this.rules.code.exec(a))a=a.substring(c[0].length),b+="<code>"+g(c[2],!0)+"</code>";
else if(c=this.rules.br.exec(a))a=a.substring(c[0].length),b+="<br>";else if(c=this.rules.del.exec(a))a=a.substring(c[0].length),b+="<del>"+this.output(c[1])+"</del>";else if(c=this.rules.text.exec(a))a=a.substring(c[0].length),b+=g(this.smartypants(c[0]));else if(a)throw Error("Infinite loop on byte: "+a.charCodeAt(0));return b};k.prototype.outputLink=function(a,b){return a[0][0]!=="!"?'<a href="'+g(b.href)+'"'+(b.title?' title="'+g(b.title)+'"':"")+">"+this.output(a[1])+"</a>":'<img src="'+g(b.href)+
'" alt="'+g(a[1])+'"'+(b.title?' title="'+g(b.title)+'"':"")+">"};k.prototype.smartypants=function(a){return!this.options.smartypants?a:a.replace(/--/g,"\u2014").replace(/'([^']*)'/g,"\u2018$1\u2019").replace(/"([^"]*)"/g,"\u201c$1\u201d").replace(/\.{3}/g,"\u2026")};k.prototype.mangle=function(a){for(var b="",d=a.length,c=0,e;c<d;c++)e=a.charCodeAt(c),Math.random()>0.5&&(e="x"+e.toString(16)),b+="&#"+e+";";return b};j.parse=function(a,b){return(new j(b)).parse(a)};j.prototype.parse=function(a){this.inline=
new k(a.links,this.options);this.tokens=a.reverse();for(a="";this.next();)a+=this.tok();return a};j.prototype.next=function(){return this.token=this.tokens.pop()};j.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};j.prototype.parseText=function(){for(var a=this.token.text;this.peek().type==="text";)a+="\n"+this.next().text;return this.inline.output(a)};j.prototype.tok=function(){switch(this.token.type){case "space":return"";case "hr":return"<hr>\n";case "heading":return"<h"+
this.token.depth+">"+this.inline.output(this.token.text)+"</h"+this.token.depth+">\n";case "code":if(this.options.highlight){var a=this.options.highlight(this.token.text,this.token.lang);if(a!=null&&a!==this.token.text)this.token.escaped=!0,this.token.text=a}if(!this.token.escaped)this.token.text=g(this.token.text,!0);return"<pre><code"+(this.token.lang?' class="'+this.options.langPrefix+this.token.lang+'"':"")+">"+this.token.text+"</code></pre>\n";case "table":var a="",b,d,c,e;a+="<thead>\n<tr>\n";
for(d=0;d<this.token.header.length;d++)b=this.inline.output(this.token.header[d]),a+=this.token.align[d]?'<th align="'+this.token.align[d]+'">'+b+"</th>\n":"<th>"+b+"</th>\n";a+="</tr>\n</thead>\n";a+="<tbody>\n";for(d=0;d<this.token.cells.length;d++){b=this.token.cells[d];a+="<tr>\n";for(e=0;e<b.length;e++)c=this.inline.output(b[e]),a+=this.token.align[e]?'<td align="'+this.token.align[e]+'">'+c+"</td>\n":"<td>"+c+"</td>\n";a+="</tr>\n"}a+="</tbody>\n";return"<table>\n"+a+"</table>\n";case "blockquote_start":for(a=
"";this.next().type!=="blockquote_end";)a+=this.tok();return"<blockquote>\n"+a+"</blockquote>\n";case "list_start":d=this.token.ordered?"ol":"ul";for(a="";this.next().type!=="list_end";)a+=this.tok();return"<"+d+">\n"+a+"</"+d+">\n";case "list_item_start":for(a="";this.next().type!=="list_item_end";)a+=this.token.type==="text"?this.parseText():this.tok();return"<li>"+a+"</li>\n";case "loose_item_start":for(a="";this.next().type!=="list_item_end";)a+=this.tok();return"<li>"+a+"</li>\n";case "html":return!this.token.pre&&
!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case "paragraph":return"<p>"+this.inline.output(this.token.text)+"</p>\n";case "text":return"<p>"+this.parseText()+"</p>\n"}};f.exec=f;h.options=h.setOptions=function(a){b(h.defaults,a);return h};h.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1};h.Parser=j;h.parser=j.parse;h.Lexer=i;h.lexer=i.lex;h.InlineLexer=k;h.inlineLexer=k.output;h.parse=
h;typeof exports==="object"?module.exports=h:typeof define==="function"&&define.amd?define("marked/marked",[],function(){return h}):this.marked=h}).call(function(){return this||(typeof window!=="undefined"?window:global)}());
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(i,k){function j(c){if(c)this._view=c,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0}function g(c){j.call(this,c)}j.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(c){for(var f=[],b=this._keyBindings,h=0;h<b.length;h++)b[h].actionID===c&&f.push(b[h].keyBinding);return f},getView:function(){return this._view},isActive:function(){return this._view.getKeyModes().indexOf(this)!==-1},
match:function(c){if(c.type==="keydown")switch(c.keyCode){case 16:case 17:case 18:case 91:return}for(var f=this._keyBindingIndex,b=this._matchingKeyBindings||this._keyBindings,h=[],e=0;e<b.length;e++){var d=b[e],a=d.keyBinding.match(c,f);if(a===!0)return this._keyBindingIndex=0,this._matchingKeyBindings=null,d.actionID;else typeof a==="number"&&h.push(d)}if(h.length===0)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=h,"noop"},setKeyBinding:function(c,
f){for(var b=this._keyBindings,h=0;h<b.length;h++){var e=b[h];if(e.keyBinding.equals(c)){f?e.actionID=f:e.predefined?e.actionID="noop":b.splice(h,1);return}}f&&b.push({keyBinding:c,actionID:f})},setView:function(c){this._view=c}};g.prototype=new j;g.prototype.createKeyBindings=function(){var c=i.KeyBinding,f=[];f.push({actionID:"lineUp",keyBinding:new c(38),predefined:!0});f.push({actionID:"lineDown",keyBinding:new c(40),predefined:!0});f.push({actionID:"charPrevious",keyBinding:new c(37),predefined:!0});
f.push({actionID:"charNext",keyBinding:new c(39),predefined:!0});k.isMac?(f.push({actionID:"scrollPageUp",keyBinding:new c(33),predefined:!0}),f.push({actionID:"scrollPageDown",keyBinding:new c(34),predefined:!0}),f.push({actionID:"pageUp",keyBinding:new c(33,null,null,!0),predefined:!0}),f.push({actionID:"pageDown",keyBinding:new c(34,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new c(37,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(39,!0),predefined:!0}),
f.push({actionID:"wordPrevious",keyBinding:new c(37,null,null,!0),predefined:!0}),f.push({actionID:"wordNext",keyBinding:new c(39,null,null,!0),predefined:!0}),f.push({actionID:"scrollTextStart",keyBinding:new c(36),predefined:!0}),f.push({actionID:"scrollTextEnd",keyBinding:new c(35),predefined:!0}),f.push({actionID:"textStart",keyBinding:new c(38,!0),predefined:!0}),f.push({actionID:"textEnd",keyBinding:new c(40,!0),predefined:!0}),f.push({actionID:"scrollPageUp",keyBinding:new c(38,null,null,null,
!0),predefined:!0}),f.push({actionID:"scrollPageDown",keyBinding:new c(40,null,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new c(37,null,null,null,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(39,null,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new c(38,null,null,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(40,null,null,!0),predefined:!0})):(f.push({actionID:"pageUp",keyBinding:new c(33),predefined:!0}),f.push({actionID:"pageDown",
keyBinding:new c(34),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new c(36),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(35),predefined:!0}),f.push({actionID:"wordPrevious",keyBinding:new c(37,!0),predefined:!0}),f.push({actionID:"wordNext",keyBinding:new c(39,!0),predefined:!0}),f.push({actionID:"textStart",keyBinding:new c(36,!0),predefined:!0}),f.push({actionID:"textEnd",keyBinding:new c(35,!0),predefined:!0}));k.isFirefox&&k.isLinux&&(f.push({actionID:"lineUp",keyBinding:new c(38,
!0),predefined:!0}),f.push({actionID:"lineDown",keyBinding:new c(40,!0),predefined:!0}));k.isWindows&&(f.push({actionID:"scrollLineUp",keyBinding:new c(38,!0),predefined:!0}),f.push({actionID:"scrollLineDown",keyBinding:new c(40,!0),predefined:!0}));f.push({actionID:"selectLineUp",keyBinding:new c(38,null,!0),predefined:!0});f.push({actionID:"selectLineDown",keyBinding:new c(40,null,!0),predefined:!0});f.push({actionID:"selectCharPrevious",keyBinding:new c(37,null,!0),predefined:!0});f.push({actionID:"selectCharNext",
keyBinding:new c(39,null,!0),predefined:!0});f.push({actionID:"selectPageUp",keyBinding:new c(33,null,!0),predefined:!0});f.push({actionID:"selectPageDown",keyBinding:new c(34,null,!0),predefined:!0});k.isMac?(f.push({actionID:"selectLineStart",keyBinding:new c(37,!0,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(39,!0,!0),predefined:!0}),f.push({actionID:"selectWordPrevious",keyBinding:new c(37,null,!0,!0),predefined:!0}),f.push({actionID:"selectWordNext",keyBinding:new c(39,
null,!0,!0),predefined:!0}),f.push({actionID:"selectTextStart",keyBinding:new c(36,null,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new c(35,null,!0),predefined:!0}),f.push({actionID:"selectTextStart",keyBinding:new c(38,!0,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new c(40,!0,!0),predefined:!0}),f.push({actionID:"selectLineStart",keyBinding:new c(37,null,!0,null,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(39,null,!0,null,!0),predefined:!0}),
f.push({actionID:"selectLineStart",keyBinding:new c(38,null,!0,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(40,null,!0,!0),predefined:!0})):(k.isLinux&&(f.push({actionID:"selectWholeLineUp",keyBinding:new c(38,!0,!0),predefined:!0}),f.push({actionID:"selectWholeLineDown",keyBinding:new c(40,!0,!0),predefined:!0})),f.push({actionID:"selectLineStart",keyBinding:new c(36,null,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(35,null,!0),predefined:!0}),f.push({actionID:"selectWordPrevious",
keyBinding:new c(37,!0,!0),predefined:!0}),f.push({actionID:"selectWordNext",keyBinding:new c(39,!0,!0),predefined:!0}),f.push({actionID:"selectTextStart",keyBinding:new c(36,!0,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new c(35,!0,!0),predefined:!0}));f.push({actionID:"undo",keyBinding:new i.KeyBinding("z",!0),predefined:!0});k.isMac?f.push({actionID:"redo",keyBinding:new i.KeyBinding("z",!0,!0),predefined:!0}):f.push({actionID:"redo",keyBinding:new i.KeyBinding("y",!0),predefined:!0});
f.push({actionID:"deletePrevious",keyBinding:new c(8),predefined:!0});f.push({actionID:"deletePrevious",keyBinding:new c(8,null,!0),predefined:!0});f.push({actionID:"deleteNext",keyBinding:new c(46),predefined:!0});f.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0),predefined:!0});f.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0,!0),predefined:!0});f.push({actionID:"deleteWordNext",keyBinding:new c(46,!0),predefined:!0});f.push({actionID:"tab",keyBinding:new c(9),predefined:!0});
f.push({actionID:"shiftTab",keyBinding:new c(9,null,!0),predefined:!0});f.push({actionID:"enter",keyBinding:new c(13),predefined:!0});f.push({actionID:"enter",keyBinding:new c(13,null,!0),predefined:!0});f.push({actionID:"selectAll",keyBinding:new c("a",!0),predefined:!0});f.push({actionID:"toggleTabMode",keyBinding:new c("m",!0),predefined:!0});k.isMac&&(f.push({actionID:"deleteNext",keyBinding:new c(46,null,!0),predefined:!0}),f.push({actionID:"deleteWordPrevious",keyBinding:new c(8,null,null,!0),
predefined:!0}),f.push({actionID:"deleteWordNext",keyBinding:new c(46,null,null,!0),predefined:!0}));f.push({actionID:"toggleWrapMode",keyBinding:new i.KeyBinding("w",!0,!1,!0)});f.push({actionID:"toggleOverwriteMode",keyBinding:new i.KeyBinding(45)});if(!k.isFirefox){var b=k.isMac&&k.isChrome;f.push({actionID:"noop",keyBinding:new c("u",!b,!1,!1,b),predefined:!0});f.push({actionID:"noop",keyBinding:new c("i",!b,!1,!1,b),predefined:!0});f.push({actionID:"noop",keyBinding:new c("b",!b,!1,!1,b),predefined:!0})}k.isFirefox&&
(f.push({actionID:"copy",keyBinding:new c(45,!0),predefined:!0}),f.push({actionID:"paste",keyBinding:new c(45,null,!0),predefined:!0}),f.push({actionID:"cut",keyBinding:new c(46,null,!0),predefined:!0}));k.isMac&&(f.push({actionID:"lineStart",keyBinding:new c("a",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c("e",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineUp",keyBinding:new c("p",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineDown",keyBinding:new c("n",!1,!1,
!1,!0),predefined:!0}),f.push({actionID:"charPrevious",keyBinding:new c("b",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"charNext",keyBinding:new c("f",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deletePrevious",keyBinding:new c("h",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteNext",keyBinding:new c("d",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteLineEnd",keyBinding:new c("k",!1,!1,!1,!0),predefined:!0}),k.isFirefox?(f.push({actionID:"scrollPageDown",keyBinding:new c("v",!1,
!1,!1,!0),predefined:!0}),f.push({actionID:"deleteLineStart",keyBinding:new c("u",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteWordPrevious",keyBinding:new c("w",!1,!1,!1,!0),predefined:!0})):(f.push({actionID:"pageDown",keyBinding:new c("v",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"centerLine",keyBinding:new c("l",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"enterNoCursor",keyBinding:new c("o",!1,!1,!1,!0),predefined:!0})));return f};return{KeyMode:j,DefaultKeyMode:g}});
define("orion/editor/util",[],function(){return{contains:function(i,k){if(!k)return!1;if(!i.compareDocumentPosition){for(var j=k;j;){if(i===j)return!0;j=j.parentNode}return!1}return i===k||(i.compareDocumentPosition(k)&16)!==0},addEventListener:function(i,k,j,g){typeof i.addEventListener==="function"?i.addEventListener(k,j,g===!0):i.attachEvent("on"+k,j)},removeEventListener:function(i,k,j,g){typeof i.removeEventListener==="function"?i.removeEventListener(k,j,g===!0):i.detachEvent("on"+k,j)}}});
define("orion/editor/textView","i18n!orion/editor/nls/messages,orion/editor/textModel,orion/editor/keyModes,orion/editor/eventTarget,orion/editor/textTheme,orion/editor/util,orion/util".split(","),function(i,k,j,g,c,f,b){function h(a,d,c){if(c){d.className="";for(var c=d.attributes,e=c.length;e-- >0;)(!b.isIE||b.isIE>=9||b.isIE<9&&c[e].specified)&&d.removeAttribute(c[e].name)}if(a){if(a.styleClass)d.className=a.styleClass;if(c=a.style)for(var f in c)c.hasOwnProperty(f)&&(d.style[f]=c[f]);if(a=a.attributes)for(var h in a)a.hasOwnProperty(h)&&
d.setAttribute(h,a[h])}}function e(a){return a instanceof Array?a.slice(0):a}function d(a,b){if(!a)return b;if(!b)return a;for(var d in b)b.hasOwnProperty(d)&&(a.hasOwnProperty(d)||(a[d]=b[d]));return a}function a(b,d){if(b===d)return!0;if(b&&!d||!b&&d)return!1;if(b&&b.constructor===String||d&&d.constructor===String)return!1;if(b instanceof Array||d instanceof Array){if(!(b instanceof Array&&d instanceof Array))return!1;if(b.length!==d.length)return!1;for(var c=0;c<b.length;c++)if(!a(b[c],d[c]))return!1;
return!0}if(!(b instanceof Object)||!(d instanceof Object))return!1;for(c in b)if(b.hasOwnProperty(c)){if(!d.hasOwnProperty(c))return!1;if(!a(b[c],d[c]))return!1}for(c in d)if(!b.hasOwnProperty(c))return!1;return!0}function m(a,b,d){for(var c=0,e=0,f=0,h=a.length;f<h;){c!==-1&&c<=f&&(c=a.indexOf("\r",f));e!==-1&&e<=f&&(e=a.indexOf("\n",f));var g=f,i;if(e===-1&&c===-1){b(a.substring(f));break}c!==-1&&e!==-1?c+1===e?(i=c,f=e+1):(i=c<e?c:e,f=(c<e?c:e)+1):c!==-1?(i=c,f=c+1):(i=e,f=e+1);b(a.substring(g,
i));d()}}function n(a){var b,d,c,e,f=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;if(f.getComputedStyle)a=f.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),d=a.getPropertyValue("padding-top"),c=a.getPropertyValue("padding-right"),e=a.getPropertyValue("padding-bottom");else if(a.currentStyle)b=a.currentStyle.paddingLeft,d=a.currentStyle.paddingTop,c=a.currentStyle.paddingRight,e=a.currentStyle.paddingBottom;return{left:parseInt(b,10)||0,top:parseInt(d,10)||0,right:parseInt(c,
10)||0,bottom:parseInt(e,10)||0}}function q(a){var b,d,c,e,f=a._trim;if(!f){var f=n(a),h=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;if(h.getComputedStyle)e=h.getComputedStyle(a,null),b=e.getPropertyValue("border-left-width"),d=e.getPropertyValue("border-top-width"),c=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width");else if(a.currentStyle)b=a.currentStyle.borderLeftWidth,d=a.currentStyle.borderTopWidth,c=a.currentStyle.borderRightWidth,e=a.currentStyle.borderBottomWidth;
b=parseInt(b,10)||0;d=parseInt(d,10)||0;c=parseInt(c,10)||0;e=parseInt(e,10)||0;f.left+=b;f.top+=d;f.right+=c;f.bottom+=e;a._trim=f}return f}function o(a,b,d){this.start=a;this.end=b;this.caret=d}function p(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function s(a,b,d){this.view=a;this.lineIndex=b;this._lineDiv=d}function u(a){this._init(a||{})}var v=f.addEventListener,t=f.removeEventListener,w=function(){function a(b){this.options=b}a.prototype.play=function(){var a=
typeof this.options.duration==="number"?this.options.duration:350,b=this.options.easing||this.defaultEasing,d=this.options.onAnimate||function(){},c=this.options.curve[0],l=this.options.curve[1],e=l-c,f=-1,h,g=this;this.interval=this.options.window.setInterval(function(){f=f===-1?(new Date).getTime():f;var i=((new Date).getTime()-f)/a;i<1?(i=b(i),h=c+i*e,d(h)):(d(l),g.stop())},typeof this.options.rate==="number"?this.options.rate:20)};a.prototype.stop=function(){this.options.window.clearInterval(this.interval);
(this.options.onEnd||function(){})()};a.prototype.defaultEasing=function(a){return Math.sin(a*(Math.PI/2))};return a}();o.prototype={clone:function(){return new o(this.start,this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(a){this.caret?this.start=a:this.end=a;if(this.start>this.end)a=this.start,this.start=this.end,this.end=a,this.caret=!this.caret},setCaret:function(a){this.end=this.start=a;this.caret=!1},getCaret:function(){return this.caret?
this.start:this.end},toString:function(){return"start="+this.start+" end="+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===this.end},equals:function(a){return this.caret===a.caret&&this.start===a.start&&this.end===a.end}};p.prototype={toString:function(){return"{l="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};s.prototype={create:function(a,b){if(!this._lineDiv){var d=this._lineDiv=this._createLine(a,b,this.lineIndex);d._line=
this;return d}},_createLine:function(d,c,e){var f=this.view,g=f._model,i=g.getLine(e),m=g.getLineStart(e),j={type:"LineStyle",textView:f,lineIndex:e,lineText:i,lineStart:m};if(i.length<2E3)f.onLineStyle(j);g=c||b.createElement(d.ownerDocument,"div");if(!c||!a(c.viewStyle,j.style)){h(j.style,g,c);if(c)c._trim=null;g.viewStyle=j.style;g.setAttribute("role","presentation")}g.lineIndex=e;e=[];this._createRanges(j.ranges,i,0,i.length,m,{tabOffset:0,ranges:e});i=" ";!f._fullSelection&&b.isIE<9&&(i="\ufeff");
j={text:i,style:f._metrics.largestFontStyle,ignoreChars:1};e.length===0||!e[e.length-1].style||e[e.length-1].style.tagName!=="div"?e.push(j):e.splice(e.length-1,0,j);var n,o,k,q,t,i=f=0,s,p;if(c){if(o=c.modelChangedEvent)o.removedLineCount===0&&o.addedLineCount===0?(p=o.start-m,s=o.addedCharCount-o.removedCharCount):p=-1,c.modelChangedEvent=void 0;o=c.firstChild}for(m=0;m<e.length;m++){j=e[m];q=j.text;f+=q.length;n=j.style;if(o)if(t=o.firstChild.data,k=o.viewStyle,t===q&&a(n,k)){i+=t.length;o._rectsCache=
void 0;n=o=o.nextSibling;continue}else for(;o;){if(p!==-1){k=f;k>=p&&(k-=s);t=(t=o.firstChild.data)?t.length:0;if(i+t>k)break;i+=t}k=o.nextSibling;g.removeChild(o);o=k}n=this._createSpan(g,q,n,j.ignoreChars);o?g.insertBefore(n,o):g.appendChild(n);if(c)c.lineWidth=void 0}if(c)for(d=n?n.nextSibling:null;d;)k=d.nextSibling,c.removeChild(d),d=k;else d.appendChild(g);return g},_createRanges:function(b,d,c,e,f,h){if(!(c>e)){if(b)for(var g=0;g<b.length;g++){var i=b[g];if(!(i.end<f+c)){var m=Math.max(f+c,
i.start)-f;if(m>e)break;var j=Math.min(f+e,i.end)-f;if(m<=j){m=Math.max(c,m);j=Math.min(e,j);c<m&&this._createRange(d,c,m,null,h);if(!i.style||!i.style.unmergeable)for(;g+1<b.length&&b[g+1].start-f===j&&a(i.style,b[g+1].style);)i=b[g+1],j=Math.min(f+e,i.end)-f,g++;this._createRange(d,m,j,i.style,h);c=j}}}c<e&&this._createRange(d,c,e,null,h)}},_createRange:function(a,b,d,c,e){if(!(b>d)){var f=this.view._customTabSize;if(f&&f!==8)for(var h=a.indexOf("\t",b);h!==-1&&h<d;){b<h&&(b={text:a.substring(b,
h),style:c},e.ranges.push(b),e.tabOffset+=b.text.length);b=f-e.tabOffset%f;if(b>0){for(var g="\u00a0",i=1;i<b;i++)g+=" ";b={text:g,style:c,ignoreChars:b-1};e.ranges.push(b);e.tabOffset+=b.text.length}b=h+1;if(b===d)return;h=a.indexOf("\t",b)}b<=d&&(b={text:a.substring(b,d),style:c},e.ranges.push(b),e.tabOffset+=b.text.length)}},_createSpan:function(a,d,c,e){var f=this.view,g="span";c&&c.tagName&&(g=c.tagName.toLowerCase());var i=g==="a";if(i)a.hasLink=!0;i&&!f._linksVisible&&(g="span");i=a.ownerDocument;
a=b.createElement(a.ownerDocument,g);c&&c.html?(a.innerHTML=c.html,a.ignore=!0):c&&c.node?(a.appendChild(c.node),a.ignore=!0):a.appendChild(i.createTextNode(c&&c.text?c.text:d));h(c,a);if(g==="a"){var m=f._getWindow();v(a,"click",function(a){return f._handleLinkClick(a?a:m.event)},!1)}a.viewStyle=c;if(e)a.ignoreChars=e;return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,d){var c=this._ensureCreated(),
e=this.view;if(a===void 0)return this._getLineBoundingClientRect(c,!0);var f=e._model,h=c.ownerDocument,g=this.lineIndex,i=null;if(a<f.getLineEnd(g)){g=f.getLineStart(g);for(f=c.firstChild;f;){if(!f.ignore){var m=f.firstChild,j=m.length;f.ignoreChars&&(j-=f.ignoreChars);if(g+j>a){i=a-g;if(m.length===1)i=new p(f.getBoundingClientRect());else if(e._isRangeRects)h=h.createRange(),h.setStart(m,i),h.setEnd(m,i+1),i=new p(h.getBoundingClientRect());else if(b.isIE){if(h=h.body.createTextRange(),h.moveToElementText(f),
h.collapse(),(g=i===0&&b.isIE===8)&&(i=1),h.moveEnd("character",i+1),h.moveStart("character",i),i=new p(h.getBoundingClientRect()),g)i.left=f.getClientRects()[0].left}else{var n=m.data;f.removeChild(m);f.appendChild(h.createTextNode(n.substring(0,i)));var o=b.createElement(h,"span");o.appendChild(h.createTextNode(n.substring(i,i+1)));f.appendChild(o);f.appendChild(h.createTextNode(n.substring(i+1)));i=new p(o.getBoundingClientRect());f.innerHTML="";f.appendChild(m);this._createdDiv||(h=e._getSelection(),
(g<=h.start&&h.start<g+j||g<=h.end&&h.end<g+j)&&e._updateDOMSelection())}b.isIE&&(h=c.ownerDocument.defaultView||c.ownerDocument.parentWindow,c=h.screen.logicalXDPI/h.screen.deviceXDPI,h=h.screen.logicalYDPI/h.screen.deviceYDPI,i.left*=c,i.right*=c,i.top*=h,i.bottom*=h);break}g+=j}f=f.nextSibling}}c=this.getBoundingClientRect();if(!i)e._wrapMode?(e=this.getClientRects(),i=e[e.length-1],i.left=i.right,i.left+=c.left,i.top+=c.top,i.right+=c.left,i.bottom+=c.top):(i=new p(c),i.left=i.right);if(d||d===
void 0)i.left-=c.left,i.top-=c.top,i.right-=c.left,i.bottom-=c.top;return i},_getClientRects:function(a,b){var c,d,e,f;if(!a._rectsCache){c=a.getClientRects();d=Array(c.length);for(f=0;f<c.length;f++)e=d[f]=new p(c[f]),e.left-=b.left,e.top-=b.top,e.right-=b.left,e.bottom-=b.top;a._rectsCache=d}c=a._rectsCache;d=[c.length];for(f=0;f<c.length;f++)d[f]=new p(c[f]);return d},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var b=this._ensureCreated(),c=[],d=
b.firstChild,e,f=b.getBoundingClientRect();d;){if(!d.ignore)for(var h=this._getClientRects(d,f),b=0;b<h.length;b++){var g=h[b],i;if(g.top!==g.bottom){var m=g.top+(g.bottom-g.top)/2;for(i=0;i<c.length;i++)if(e=c[i],e.top<=m&&m<e.bottom)break;if(i===c.length)c.push(g);else{if(g.left<e.left)e.left=g.left;if(g.top<e.top)e.top=g.top;if(g.right>e.right)e.right=g.right;if(g.bottom>e.bottom)e.bottom=g.bottom}}}d=d.nextSibling}return a!==void 0?c[a]:c},_getLineBoundingClientRect:function(a,b){var c=new p(a.getBoundingClientRect());
if(!this.view._wrapMode){c.right=c.left;for(var d=a.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(d)d=d.getBoundingClientRect(),c.right=d.right+q(a).right}b&&(d=q(a),c.left+=d.left,c.right-=d.right);return c},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;for(var b=this.getClientRects(),a=this.getBoundingClientRect(a),a=a.top+(a.bottom-a.top)/2,c=0;c<b.length;c++)if(b[c].top<=a&&
a<b[c].bottom)return c;return b.length-1},getLineStart:function(a){if(!this.view._wrapMode||a===0)return this.view._model.getLineStart(a);var b=this.getClientRects();return this.getOffset(b[a].left+1,b[a].top+1)},getOffset:function(a,c){var d=this.view,e=d._model,f=this.lineIndex,h=e.getLineStart(f),g=e.getLineEnd(f);if(h===g)return h;var i=this._ensureCreated(),m=this.getBoundingClientRect(),j,n;if(d._wrapMode){j=this.getClientRects();if(c<j[0].top)c=j[0].top;for(var o=0;o<j.length;o++)if(n=j[o],
n.top<=c&&c<n.bottom)break;if(a<n.left)a=n.left;a>n.right&&(a=n.right-1)}else a<0&&(a=0),a>m.right-m.left&&(a=m.right-m.left);var k=i.ownerDocument,o=k.defaultView||k.parentWindow,q=b.isIE?o.screen.logicalXDPI/o.screen.deviceXDPI:1,t=b.isIE?o.screen.logicalYDPI/o.screen.deviceYDPI:1,o=h,s=i.firstChild;a:for(;s;){if(!s.ignore){var p=s.firstChild,i=p.length;s.ignoreChars&&(i-=s.ignoreChars);var w,u,v;j=this._getClientRects(s,m);for(var F=0;F<j.length;F++)if(n=j[F],n.left<=a&&a<n.right&&(!d._wrapMode||
n.top<=c&&c<n.bottom)){var F=n.left+m.left,C;if(b.isIE||d._isRangeRects){for(var k=d._isRangeRects?k.createRange():k.body.createTextRange(),A=i,L=-1;A-L>1;){var Y=Math.floor((A+L)/2);j=L+1;n=Y===i-1&&s.ignoreChars?p.length:Y+1;C=j===0&&b.isIE===8;d._isRangeRects?(k.setStart(p,j),k.setEnd(p,n)):(C&&(j=1),k.moveToElementText(s),k.move("character",j),k.moveEnd("character",n-j));j=k.getClientRects();for(var X=!1,S=0;S<j.length;S++)if(n=j[S],w=(C?F:n.left)*q-m.left,v=n.right*q-m.left,u=n.top*t-m.top,n=
n.bottom*t-m.top,w<=a&&a<v&&(!d._wrapMode||u<=c&&c<n)){X=!0;break}X?A=Y:L=Y}o+=A;j=A;n=A===i-1&&s.ignoreChars?p.length:Math.min(A+1,p.length);d._isRangeRects?(k.setStart(p,j),k.setEnd(p,n)):(k.moveToElementText(s),k.move("character",j),k.moveEnd("character",n-j));j=k.getClientRects();d=!1;j.length>0&&(n=j[0],w=(C?F:n.left)*q-m.left,v=n.right*q-m.left,d=a>w+(v-w)/2);m=o-h;e=e.getLine(f);f=e.charCodeAt(m);55296<=f&&f<=56319&&d?m<e.length&&(f=e.charCodeAt(m+1),56320<=f&&f<=57343&&(o+=1)):56320<=f&&f<=
57343&&!d&&m>0&&(f=e.charCodeAt(m-1),55296<=f&&f<=56319&&(o-=1));d&&o++}else{e=[];for(f=0;f<i;f++)e.push("<span>"),f===i-1?e.push(p.data.substring(f)):e.push(p.data.substring(f,f+1)),e.push("</span>");s.innerHTML=e.join("");for(e=s.firstChild;e;){n=e.getBoundingClientRect();w=n.left-m.left;v=n.right-m.left;if(w<=a&&a<v){a>w+(v-w)/2&&o++;break}o++;e=e.nextSibling}if(!this._createdDiv)s.innerHTML="",s.appendChild(p),m=d._getSelection(),(o<=m.start&&m.start<o+i||o<=m.end&&m.end<o+i)&&d._updateDOMSelection()}break a}o+=
i}s=s.nextSibling}return Math.min(g,Math.max(h,o))},getNextOffset:function(a,c){if(c.unit==="line"){var d=this.view._model,e=d.getLineAtOffset(a);if(c.count>0)return c.count--,d.getLineEnd(e);c.count++;return d.getLineStart(e)}return c.unit==="wordend"||c.unit==="wordWS"||c.unit==="wordendWS"?this._getNextOffset_W3C(a,c):b.isIE?this._getNextOffset_IE(a,c):this._getNextOffset_W3C(a,c)},_getNextOffset_W3C:function(a,b){function c(a){return 33<=a&&a<=47||58<=a&&a<=64||91<=a&&a<=94||a===96||123<=a&&a<=
126}function d(a){return a===32||a===9}var e=this.view._model,f=e.getLineAtOffset(a),h=e.getLine(f),g=e.getLineStart(f),e=e.getLineEnd(f),f=h.length,i=a-g,m,j=b.count<0?-1:1;if(b.unit==="word"||b.unit==="wordend"||b.unit==="wordWS"||b.unit==="wordendWS")for(var n,o,k;b.count!==0;){if(b.count>0){if(i===f)return e;m=h.charCodeAt(i);n=c(m);o=!n&&!d(m);for(i++;i<f;){m=h.charCodeAt(i);if(b.unit!=="wordWS"&&b.unit!=="wordendWS"){k=c(m);if(b.unit==="wordend"){if(!k&&n)break}else if(k&&!n)break;m=!k&&!d(m)}else m=
!d(m);if(b.unit==="wordend"||b.unit==="wordendWS"){if(!m&&o)break}else if(m&&!o)break;o=m;n=k;i++}}else{if(i===0)return g;i--;m=h.charCodeAt(i);n=c(m);for(o=!n&&!d(m);0<i;){m=h.charCodeAt(i-1);if(b.unit!=="wordWS"&&b.unit!=="wordendWS"){k=c(m);if(b.unit==="wordend"){if(k&&!n)break}else if(!k&&n)break;m=!k&&!d(m)}else m=!d(m);if(b.unit==="wordend"||b.unit==="wordendWS"){if(m&&!o)break}else if(!m&&o)break;o=m;n=k;i--}}b.count-=j}else for(;b.count!==0&&0<=i+j&&i+j<=f;)i+=j,m=h.charCodeAt(i),56320<=m&&
m<=57343&&i>0&&(m=h.charCodeAt(i-1),55296<=m&&m<=56319&&(i+=j)),b.count-=j;return g+i},_getNextOffset_IE:function(a,b){var c=this._ensureCreated(),d=this.view._model,e=this.lineIndex,f=0,h;h=d.getLineStart(e);var g=c.ownerDocument,i=b.count<0?-1:1;if(a===d.getLineEnd(e)){for(c=c.lastChild;c&&c.ignoreChars===c.firstChild.length;)c=c.previousSibling;if(!c)return h;f=g.body.createTextRange();f.moveToElementText(c);h=f.text.length;f.moveEnd(b.unit,i);f=a+f.text.length-h}else if(a===h&&b.count<0)f=h;else for(c=
c.firstChild;c;){d=c.firstChild.length;c.ignoreChars&&(d-=c.ignoreChars);if(h+d>a){f=g.body.createTextRange();if(a===h&&b.count<0){for(h=c.previousSibling;h;){if(h.firstChild&&h.firstChild.length)break;h=h.previousSibling}f.moveToElementText(h?h:c.previousSibling)}else f.moveToElementText(c),f.collapse(),f.moveEnd("character",a-h);h=f.text.length;f.moveEnd(b.unit,i);f=a+f.text.length-h;break}h=d+h;c=c.nextSibling}b.count-=i;return f},destroy:function(){var a=this._createdDiv;if(a)a.parentNode.removeChild(a),
this._createdDiv=null}};u.prototype={addKeyMode:function(a,b){var c=this._keyModes;b!==void 0?c.splice(b,0,a):c.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var c=this._rulers;if(b!==void 0){var d,e;for(d=0,e=0;d<c.length&&e<b;d++)a.getLocation()===c[d].getLocation()&&e++;c.splice(e,0,a);b=e}else c.push(a);this._createRuler(a,b);this._update()},computeSize:function(){var a=0,c=0,d=this._model,e=this._clientDiv;if(!e)return{width:a,height:c};var f=e.style.width;if(b.isWebkit)e.style.width=
"0x7fffffffpx";for(var d=d.getLineCount(),h=0;h<d;h++){var g=this._getLine(h),i=g.getBoundingClientRect(),a=Math.max(a,i.right-i.left);c+=i.bottom-i.top;g.destroy()}if(b.isWebkit)e.style.width=f;e=this._getViewPadding();a+=e.right+e.left+this._metrics.scrollWidth;c+=e.bottom+e.top+this._metrics.scrollWidth;return{width:a,height:c}},convert:function(a,b,c){if(this._clientDiv){var d=this._getScroll(),e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();b==="document"&&(a.x!==void 0&&(a.x+=
-d.x+f.left+e.left),a.y!==void 0&&(a.y+=-d.y+f.top+e.top));c==="document"&&(a.x!==void 0&&(a.x+=d.x-f.left-e.left),a.y!==void 0&&(a.y+=d.y-f.top-e.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&&
(this._updateDOMSelection(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var b=[],c=this._actions,d;for(d in c)c.hasOwnProperty(d)&&(a||!c[d].defaultHandler)&&b.push(d);return b},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()},
getCaretOffset:function(){return this._getSelection().getCaret()},getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(a){for(var b=[],c=this._keyModes,d=0;d<c.length;d++)b=b.concat(c[d].getKeyBindings(a));return b},getKeyModes:function(){return this._keyModes.slice(0)},
getLineHeight:function(a){return!this._clientDiv?0:this._getLineHeight(a)},getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var b=this._model,a=Math.min(Math.max(0,a),b.getCharCount()),b=b.getLineAtOffset(a),c=this._getLine(b),a=c.getBoundingClientRect(a);c.destroy();c=a.left;b=this._getLinePixel(b)+a.top;return{x:c,y:b}},getNextOffset:function(a,
b){var c=new o(a,a,!1);this._doMove(b,c);return c.getCaret()},getOptions:function(){var a;if(arguments.length===0)a=this._defaultOptions();else if(arguments.length===1){if(a=arguments[0],typeof a==="string")return e(this["_"+a])}else{a={};for(var b in arguments)arguments.hasOwnProperty(b)&&(a[arguments[b]]=void 0)}for(var c in a)a.hasOwnProperty(c)&&(a[c]=e(this["_"+c]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var c=this._getLineIndex(b),
d=this._getLine(c),c=d.getOffset(a,b-this._getLinePixel(c));d.destroy();return c},getLineAtOffset:function(a){this.getModel().getLineAtOffset(a)},getLineStart:function(a){this.getModel().getLineStart(a)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var a=this._getSelection();return{start:a.start,end:a.end}},getText:function(a,b){return this._model.getText(a,b)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?
0:this._getScroll().y},invokeAction:function(a,b,c){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(c))return!0;if(a.defaultHandler)return typeof a.defaultHandler(c)==="boolean"}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},
onDragOver:function(a){return this.dispatchEvent(a)},onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onKeyDown:function(a){return this.dispatchEvent(a)},onKeyPress:function(a){return this.dispatchEvent(a)},onKeyUp:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},onModelChanging:function(a){return this.dispatchEvent(a)},
onModify:function(a){return this.dispatchEvent(a)},onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},onFocus:function(a){return this.dispatchEvent(a)},
onBlur:function(a){return this.dispatchEvent(a)},redraw:function(){if(!(this._redrawCount>0)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,b){if(!(this._redrawCount>0))for(var c=this.getRulers(),d=0;d<c.length;d++)this.redrawLines(a,b,c[d])},redrawLines:function(a,b,c){if(!(this._redrawCount>0)&&(a===void 0&&(a=0),b===void 0&&(b=this._model.getLineCount()),a!==b)){var d=this._clientDiv;if(d){if(c)for(d=this._getRulerParent(c).firstChild;d;){if(d._ruler===
c)break;d=d.nextSibling}c?d.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,b);if(!c||c.getOverview()==="page")for(d=d.firstChild;d;){var e=d.lineIndex;if(a<=e&&e<b)d.lineChanged=!0;d=d.nextSibling}if(!c&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<b)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._queueUpdate()}}},redrawRange:function(a,b){if(!(this._redrawCount>0)){var c=this._model;a===void 0&&(a=0);b===void 0&&(b=c.getCharCount());
var d=c.getLineAtOffset(a),c=c.getLineAtOffset(Math.max(a,b-1))+1;this.redrawLines(d,c)}},removeKeyMode:function(a){for(var b=this._keyModes,c=0;c<b.length;c++)if(b[c]===a){b.splice(c,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,c=0;c<b.length;c++)if(b[c]===a){b.splice(c,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,c){if(a){var d=this._actions,e=d[a];
e||(e=d[a]={});e.handler=b;if(c!==void 0)e.actionDescription=c}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,c){var d=this._model.getCharCount(),a=Math.max(0,Math.min(a,d));this._setSelection(new o(a,a,!1),b===void 0||b,!0,c)},setHorizontalPixel:function(a){this._clientDiv&&(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?--this._redrawCount===0&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==
this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var b=this._model.getLineCount(),c=this._model.getCharCount(),d=a.getLineCount(),e=a.getCharCount(),f={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:c,addedCharCount:e,removedLineCount:b,addedLineCount:d};this.onModelChanging(f);this._model=a;f={type:"ModelChanged",start:0,removedCharCount:c,addedCharCount:e,removedLineCount:b,
addedLineCount:d};this.onModelChanged(f);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(b){var c=this._defaultOptions(),d;for(d in b)if(b.hasOwnProperty(d)){var f=b[d];if(!a(this["_"+d],f)){var h=c[d]?c[d].update:null;h?h.call(this,f):this["_"+d]=e(f)}}},setSelection:function(a,b,c,d){var e=a>b;if(e)var f=a,a=b,b=f;f=this._model.getCharCount();a=
Math.max(0,Math.min(a,f));b=Math.max(0,Math.min(b,f));this._setSelection(new o(a,b,e),c===void 0||c,!0,d)},setText:function(a,c,d){var e=c===void 0&&d===void 0;c===void 0&&(c=0);d===void 0&&(d=this._model.getCharCount());if(e)this._variableLineHeight=!1;this._modifyContent({text:a,start:c,end:d,_code:!0},!e);if(e)this._columnX=-1,this._setSelection(new o(0,0,!1),!0),b.isFirefox&&this._fixCaret()},setTopIndex:function(a){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,a))-this._getScroll().y)},
setTopPixel:function(a){this._clientDiv&&this._scrollView(0,Math.max(0,a)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(a,b){this._clientDiv&&(a&&this._updateStyle(),b===void 0||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){if(!this._ignoreEvent(a)){if(b.isFirefox&&a.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var c=this._overlayDiv||this._clientDiv;if(b.isIE<9)c=
this._viewDiv;for(var d=a.target?a.target:a.srcElement;d;){if(c===d)return;d=d.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){if(!this._ignoreEvent(a)&&b.isFirefox&&a.which===1)this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1},_handleBlur:function(){if(!this._ignoreBlur){this._hasFocus=
!1;if(b.isIE<9&&!this._getSelection().isEmpty()){var a=this._rootDiv,c=b.createElement(a.ownerDocument,"div");a.appendChild(c);a.removeChild(c)}if(this._cursorDiv)this._cursorDiv.style.display="none";if(this._selDiv1)if(this._selDiv1.style.background="lightgray",this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",a=this._getWindow(),c=this._selDiv1.ownerDocument,a.getSelection){c=a.getSelection();for(a=c.anchorNode;a;){if(a===this._clientDiv){c.rangeCount>0&&c.removeAllRanges();
break}a=a.parentNode}}else if(c.selection){this._ignoreSelect=!1;for(a=c.selection.createRange().parentElement();a;){if(a===this._clientDiv){c.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(a){if(!this._ignoreEvent(a)){b.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var c=!1;this.isListening("ContextMenu")?(c=this._createMouseEvent("ContextMenu",a),c.screenX=a.screenX,c.screenY=a.screenY,this.onContextMenu(c),
c=c.defaultPrevented):b.isMac&&b.isFirefox&&a.button===0&&(c=!0);if(c)return a.preventDefault&&a.preventDefault(),!1}},_handleCopy:function(a){if(!this._ignoreEvent(a)&&!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){if(!this._ignoreEvent(a)&&(this._lastMouseTime=
a.timeStamp?a.timeStamp:(new Date).getTime(),this._clickCount!==2))this._clickCount=2,this._handleMouse(a)},_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(b.isFirefox){var c=this;this._getWindow().setTimeout(function(){c._clientDiv.contentEditable=!0;c._clientDiv.draggable=!1;c._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&this._dragOffset!==-1)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&a.preventDefault(),
!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",a))},_handleDragEnd:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",a));b.isFirefox&&(this._fixCaret(),a.dataTransfer.dropEffect==="none"&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var c=!0;this._dropTarget=
!0;this.isListening("DragEnter")&&(c=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(b.isWebkit||c)return a.preventDefault&&a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var c=!0;this.isListening("DragOver")&&(c=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(b.isWebkit||c){if(c)a.dataTransfer.dropEffect="none";a.preventDefault&&a.preventDefault();return!1}}},_handleDragLeave:function(a){if(!this._ignoreEvent(a)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",
a))},_handleDrop:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1}},_handleFocus:function(){this._hasFocus=!0;b.isIOS&&this._lastTouchOffset!==void 0?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();if(this._cursorDiv)this._cursorDiv.style.display="block";if(this._selDiv1){var a=this._highlightRGB;this._selDiv1.style.background=
a;this._selDiv2.style.background=a;this._selDiv3.style.background=a}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var c=this._createKeyEvent("KeyDown",a);this.onKeyDown(c);if(c.defaultPrevented){if(b.isFirefox)this._keyDownPrevented=!0;a.preventDefault();return}}c=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:c=!0;break;default:this._setLinksVisible(!1)}if(a.keyCode===229){if(this._readonly)return a.preventDefault&&
a.preventDefault(),!1;c=!0;if(b.isSafari&&b.isMac&&a.ctrlKey)c=!1,a.keyCode=129;c&&this._startIME()}else c||this._commitIME();if((b.isMac||b.isLinux)&&b.isFirefox<4||b.isOpera<12.16)return this._keyDownEvent=a,!0;if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1}},_handleKeyPress:function(a){if(!this._ignoreEvent(a))if(this._keyDownPrevented)a.preventDefault&&(a.preventDefault(),a.stopPropagation()),this._keyDownPrevented=
void 0;else{if(b.isMac&&b.isWebkit&&(63232<=a.keyCode&&a.keyCode<=63487||a.keyCode===13||a.keyCode===8))return a.preventDefault&&a.preventDefault(),!1;if(((b.isMac||b.isLinux)&&b.isFirefox<4||b.isOpera<12.16)&&this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var c=b.isMac?a.metaKey:a.ctrlKey;if(a.charCode!==void 0&&c)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(c=this._createKeyEvent("KeyPress",a),this.onKeyPress(c),c.defaultPrevented)){a.preventDefault();
return}if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1;c=!1;if(b.isMac){if(a.ctrlKey||a.metaKey)c=!0}else if(b.isFirefox){if(a.ctrlKey||a.altKey)c=!0}else a.ctrlKey^a.altKey&&(c=!0);if(!c&&(c=b.isOpera?a.which:a.charCode!==void 0?a.charCode:a.keyCode,c>31))return this._doContent(String.fromCharCode(c)),a.preventDefault&&a.preventDefault(),!1}},_handleDocKeyUp:function(a){(b.isMac?a.metaKey:a.ctrlKey)||this._setLinksVisible(!1)},
_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var b=this._createKeyEvent("KeyUp",a);this.onKeyUp(b);if(b.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);a.keyCode===13&&this._commitIME()}},_handleLinkClick:function(a){if(!(b.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var c=this._getWindow(),d=!0,e=c;if(b.isIE||b.isFirefox&&!this._overlayDiv)e=this._clientDiv;if(this._overlayDiv){if(this._hasFocus)this._ignoreFocus=
!0;var f=this;c.setTimeout(function(){f.focus();f._ignoreFocus=!1},0)}this._clickCount===1?(d=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,(!b.isOpera||b.isOpera>=12.16)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return d},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if((a.target||
a.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();var c=a.which;c||(a.button===4&&(c=2),a.button===2&&(c=3),a.button===1&&(c=1));var d=c!==2&&a.timeStamp?a.timeStamp:(new Date).getTime(),e=d-this._lastMouseTime,f=Math.abs(this._lastMouseX-a.clientX),h=Math.abs(this._lastMouseY-a.clientY),g=this._lastMouseButton===c;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=d;this._lastMouseButton=c;if(c===1)this._isMouseDown=!0,g&&e<=this._clickTime&&
f<=this._clickDist&&h<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&(d=this._createMouseEvent("MouseDown",a),this.onMouseDown(d),d.defaultPrevented)){a.preventDefault();return}if(c===1&&this._handleMouse(a)&&(b.isIE>=9||b.isOpera||b.isChrome||b.isSafari||b.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();b.isFirefox&&this._lastMouseButton===3&&this._updateDOMSelection()}},_handleMouseOver:function(a){if(!this._ignoreEvent(a)&&
!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",a))},_handleMouseOut:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){if(!this._animation){var c=this._isClientDiv(a);if(this.isListening("MouseMove")&&c)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var d=this._linksVisible||this._lastMouseMoveX!==
a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;this._setLinksVisible(d&&!this._isMouseDown&&(b.isMac?a.metaKey:a.ctrlKey));if(!this._isW3CEvents){if(a.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&a.button===1&&(this._clickCount&1)!==0&&c)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&this._dragOffset===-1){var c=a.clientX,a=a.clientY,e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),
h=this._getClientWidth(),g=this._getClientHeight(),d=f.left+e.left,i=f.top+e.top,h=f.left+e.left+h,e=f.top+e.top+g;a<i?this._doAutoScroll("up",c,a-i):a>e?this._doAutoScroll("down",c,a-e):c<d&&!this._wrapMode?this._doAutoScroll("left",c-d,a):c>h&&!this._wrapMode?this._doAutoScroll("right",c-h,a):(this._endAutoScroll(),this._setSelectionTo(c,a,!0))}}}},_isClientDiv:function(a){for(var b=this._overlayDiv||this._clientDiv,a=a.target?a.target:a.srcElement;a;){if(b===a)return!0;a=a.parentNode}return!1},
_createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(a,b){var c=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:c.x,y:c.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var c=a.which?a.button===0:a.button===1;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||c&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",
a));if(!this._linksVisible&&c&&this._isMouseDown){if(this._dragOffset!==-1)c=this._getSelection(),c.extend(this._dragOffset),c.collapse(),this._setSelection(c,!0,!0),this._dragOffset=-1;this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null);b.isFirefox&&a.preventDefault()}},_handleMouseWheel:function(a){var c=this._getLineHeight(),d=0,e=0;b.isIE||b.isOpera?e=-a.wheelDelta/40*c:b.isFirefox?a.type==="wheel"?a.deltaMode?(d=Math.max(-256,Math.min(256,a.deltaX))*c,e=Math.max(-256,
Math.min(256,a.deltaY))*c):(d=a.deltaX,e=a.deltaY):(c=b.isMac?a.detail*3:Math.max(-256,Math.min(256,a.detail))*c,a.axis===a.HORIZONTAL_AXIS?d=c:e=c):b.isMac?(e=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,d=a.wheelDeltaX%120!==0?1:e<40?40/(40-e):40,e=a.wheelDeltaY%120!==0?1:e<40?40/(40-e):40,d=Math.ceil(-a.wheelDeltaX/d),-1<d&&d<0&&(d=-1),0<d&&d<1&&(d=1),e=Math.ceil(-a.wheelDeltaY/e),-1<e&&e<0&&(e=-1),0<e&&e<1&&(e=1)):(d=-a.wheelDeltaX,e=-a.wheelDeltaY/120*8*c);if(b.isSafari||
b.isChrome&&b.isMac){for(c=a.target;c&&c.lineIndex===void 0;)c=c.parentNode;this._mouseWheelLine=c}c=this._getScroll();this._scrollView(d,e);d=this._getScroll();if(c.x!==d.x||c.y!==d.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(b.isIE){var c=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){c._updateDOMSelection();c._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(){var c=
this._rootDiv.clientWidth,d=this._rootDiv.clientHeight;if(this._rootWidth!==c||this._rootHeight!==d){this._rootWidth!==c&&this._wrapMode&&this._resetLineHeight();this._rootWidth=c;this._rootHeight=d;c=b.isIE<9;d=this._calculateMetrics();if(!a(d,this._metrics)){if(this._variableLineHeight)this._variableLineHeight=!1,this._resetLineHeight();this._metrics=d;c=!0}c?this._queueUpdate():this._update()}},_handleRulerEvent:function(a){for(var b=a.target?a.target:a.srcElement,c=b.lineIndex;b&&!b._ruler;){if(c===
void 0&&b.lineIndex!==void 0)c=b.lineIndex;b=b.parentNode}var d=b?b._ruler:null;if(c===void 0&&d&&d.getOverview()==="document"){var c=this._getClientHeight(),e=this._model.getLineCount(),f=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect(),c=Math.floor((a.clientY-h.top-this._metrics.scrollWidth)*e/(c+f.top+f.bottom-2*this._metrics.scrollWidth));0<=c&&c<e||(c=void 0)}if(d)switch(a.type){case "click":if(d.onClick)d.onClick(c,a);break;case "dblclick":if(d.onDblClick)d.onDblClick(c,a);break;
case "mousemove":if(d.onMouseMove)d.onMouseMove(c,a);break;case "mouseover":if(d.onMouseOver)d.onMouseOver(c,a);break;case "mouseout":if(d.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===b)return;e=e.parentNode}d.onMouseOut(c,a)}}},_handleScroll:function(){var a=this._getScroll(!1),b=this._hScroll,c=this._vScroll;if(b!==a.x||c!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(c===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:c},newValue:a})},_handleSelectStart:function(a){if(this._ignoreSelect)return a&&
a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var c;c=a.tagName==="DIV"?a:a.parentNode.parentNode;var d=0,e=c.lineIndex;if(a.tagName!=="DIV")for(c=c.firstChild;c;){var f=c.firstChild;if(f===a){c.ignoreChars&&(d-=c.ignoreChars);d+=b;break}c.ignoreChars&&(d-=c.ignoreChars);d+=f.data.length;c=c.nextSibling}return Math.max(0,d)+this._model.getLineStart(e)}},_updateSelectionFromDOM:function(){var a=this._getWindow().getSelection(),b=this._getModelOffset(a.anchorNode,a.anchorOffset),
a=this._getModelOffset(a.focusNode,a.focusOffset);b===void 0||a===void 0||this._setSelection(new o(b,a),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset===-1)if(b.isAndroid){var a=this._getWindow();this._selTimer&&a.clearTimeout(this._selTimer);var c=this;this._selTimer=a.setTimeout(function(){if(c._clientDiv)c._selTimer=null,c._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var b=this._getWindow().getSelection();
if(b.anchorNode!==this._anchorNode||b.focusNode!==this._focusNode||b.anchorOffset!==this._anchorOffset||b.focusOffset!==this._focusOffset){for(var c=b.anchorNode;c;){if(c.lineIndex!==void 0)break;c=c.parentNode}if(c){var d=this._model,e=c.lineIndex,f=d.getLine(e),h=f,g=0,d=d.getLineStart(e);if(b.rangeCount>0)b.getRangeAt(0).deleteContents(),e=c.ownerDocument.createTextNode(a.data),b.getRangeAt(0).insertNode(e),g=this._getDOMText(c,e),h=g.text,g=g.offset,e.parentNode.removeChild(e);c.lineRemoved=!0;
for(c=0;f.charCodeAt(c)===h.charCodeAt(c)&&c<g;)c++;b=f.length-1;for(e=h.length-f.length;f.charCodeAt(b)===h.charCodeAt(b+e)&&b+e>=g+a.data.length;)b--;b++;f=h.substring(c,b+e);c+=d;b+=d;this._modifyContent({text:f,start:c,end:b,_ignoreDOMSelection:!0},!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var c=this._getWindow();if(this._touchScrollTimer)this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",c.clearInterval(this._touchScrollTimer),
this._touchScrollTimer=null;var d=a.touches;if(d.length===1){var d=d[0],e=d.clientX,f=d.clientY;this._touchStartX=e;this._touchStartY=f;if(b.isAndroid&&(f<d.pageY-c.pageYOffset||e<d.pageX-c.pageXOffset))e=d.pageX-c.pageXOffset,f=d.pageY-c.pageYOffset;c=this.convert({x:e,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(c.x,c.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=a.touches;if(b.length===1){b=b[0];this._touchCurrentX=b.clientX;
this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&a.timeStamp-this._touchStartTime<200){this._vScrollDiv.style.display="block";if(!this._wrapMode)this._hScrollDiv.style.display="block";var c=this,d=this._getWindow();this._touchScrollTimer=d.setInterval(function(){var a=0,b=0;if(c._touching)a=c._touchStartX-c._touchCurrentX,b=c._touchStartY-c._touchCurrentY,c._touchSpeedX=a/10,c._touchSpeedY=b/10,c._touchStartX=c._touchCurrentX,c._touchStartY=c._touchCurrentY;else if(Math.abs(c._touchSpeedX)<
0.1&&Math.abs(c._touchSpeedY)<0.1){c._vScrollDiv.style.display="none";c._hScrollDiv.style.display="none";d.clearInterval(c._touchScrollTimer);c._touchScrollTimer=null;return}else a=c._touchSpeedX*10,b=c._touchSpeedY*10,c._touchSpeedX*=0.95,c._touchSpeedY*=0.95;c._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){if(a.touches.length===0)this._touching=!1},_doAction:function(a){var b,c,d=this._keyModes;for(c=d.length-1;c>=0;c--)if(b=d[c],typeof b.match===
"function"&&(b=b.match(a),b!==void 0))return this.invokeAction(b);return!1},_doMove:function(a,b){var c=this._model,d=b.getCaret(),e=c.getLineAtOffset(d);if(!a.count)a.count=1;for(;a.count!==0;){var f=c.getLineStart(e);if(a.count<0&&d===f)if(e>0)a.unit==="character"&&a.count++,e--,b.extend(c.getLineEnd(e));else break;else if(a.count>0&&d===c.getLineEnd(e))if(e+1<c.getLineCount())a.unit==="character"&&a.count--,e++,b.extend(c.getLineStart(e));else break;else{var h=!1;a.expandTab&&a.unit==="character"&&
(d-f)%this._tabSize===0&&(h=!/[^ ]/.test(c.getText(f,d)));h?(b.extend(d-this._tabSize),a.count+=a.count<0?1:-1):(f=this._getLine(e),b.extend(f.getNextOffset(d,a)),f.destroy())}d=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();if(b.isEmpty()){if(!a.count)a.count=1;a.count*=-1;a.expandTab=this._expandTab;this._doMove(a,b)}this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var c=this.getText(b.start,
b.end);this._setSelection(b,!0);switch(a.type){case "lower":c=c.toLowerCase();break;case "capitalize":c=c.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<c.length;b++){var d=c[b],e=d.toLowerCase(),d=e!==d?e:d.toUpperCase();a+=d}c=a;break;default:c=c.toUpperCase()}this._doContent(c);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var c=this._model,d=c.getLineAtOffset(b.end);b.end<c.getLineEnd(d)&&(c=this._getLine(d),
b.extend(c.getNextOffset(b.getCaret(),{unit:"character",count:1})),c.destroy())}this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?this._setClipboardText(this._getBaseText(b.start,b.end),a):!0},_doCursorNext:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.start=b.end:this._doMove(a,b);a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){var b=this._getSelection();
if(!b.isEmpty()&&!a.select)b.end=b.start;else{if(!a.count)a.count=1;a.count*=-1;this._doMove(a,b)}a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,b.end),this._doContent(""),this._setClipboardText(b,a)):!0},_doDelete:function(a){var b=this._getSelection();b.isEmpty()&&this._doMove(a,b);this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doEnd:function(a){var b=this._getSelection(),
c=this._model,d;if(a.ctrl)b.extend(c.getCharCount()),d=function(){};else{var e=b.getCaret(),f=c.getLineAtOffset(e);if(this._wrapMode){var h=this._getLine(f),e=h.getLineIndex(e),e=e===h.getLineCount()-1?c.getLineEnd(f):h.getLineStart(e+1)-1;h.destroy()}else a.count&&a.count>0&&(f=Math.min(f+a.count-1,c.getLineCount()-1)),e=c.getLineEnd(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,d);return!0},_doEnter:function(a){var b=this._model,c=this._getSelection();this._doContent(b.getLineDelimiter());
if(a&&a.noCursor)c.end=c.start,this._setSelection(c,!0);return!0},_doHome:function(a){var b=this._getSelection(),c=this._model,d;if(a.ctrl)b.extend(0),d=function(){};else{var e=b.getCaret(),f=c.getLineAtOffset(e);this._wrapMode?(c=this._getLine(f),e=c.getLineIndex(e),e=c.getLineStart(e),c.destroy()):e=c.getLineStart(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,d);return!0},_doLineDown:function(a){var c=this._model,d=this._getSelection(),e=d.getCaret(),f=c.getLineAtOffset(e),h=
this._getLine(f),g=this._columnX,i=1,m=!1;if(g===-1||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?c.getLineEnd(f+1):e,g=h.getBoundingClientRect(g).left;(e=h.getLineIndex(e))<h.getLineCount()-1?i=h.getClientRects(e+1).top+1:(e=c.getLineCount()-1,m=f===e,a.count&&a.count>0?f=Math.min(f+a.count,e):f++);e=!1;if(m){if(a.select||b.isMac||b.isLinux)d.extend(c.getCharCount()),e=!0}else h.lineIndex!==f&&(h.destroy(),h=this._getLine(f)),d.extend(h.getOffset(g,i)),e=!0;e&&(a.select||d.collapse(),this._setSelection(d,
!0,!0));this._columnX=g;h.destroy();return!0},_doLineUp:function(a){var c=this._model,d=this._getSelection(),e=d.getCaret(),f=c.getLineAtOffset(e),h=this._getLine(f),g=this._columnX,i=!1,m;if(g===-1||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?c.getLineStart(f-1):e,g=h.getBoundingClientRect(g).left;(e=h.getLineIndex(e))>0?m=h.getClientRects(e-1).top+1:(i=f===0,i||(a.count&&a.count>0?f=Math.max(f-a.count,0):f--,m=this._getLineHeight(f)-1));e=!1;if(i){if(a.select||b.isMac||b.isLinux)d.extend(0),e=!0}else h.lineIndex!==
f&&(h.destroy(),h=this._getLine(f)),d.extend(h.getOffset(g,m)),e=!0;e&&(a.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=g;h.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var c=this,d=this._model,e=this._getSelection(),f=e.getCaret(),h=d.getLineAtOffset(f),g=d.getLineCount(),i=this._getScroll(),d=this._getClientHeight(),m,j;if(this._lineHeight){m=this._columnX;i=this._getBoundsAtOffset(f);if(m===-1||a.select&&b.isIE)m=i.left;f=this._getLineIndex(i.top+d);
j=this._getLine(f);h=this._getLinePixel(f);f=j.getOffset(m,i.top+d-h);d=j.getBoundingClientRect(f);j.destroy();e.extend(f);a.select||e.collapse();this._setSelection(e,!0,!0,function(){c._columnX=m},d.top+h-i.top);return!0}if(h<g-1){var n=this._getLineHeight(),o=Math.min(g-h-1,Math.floor(d/n)),o=Math.max(1,o);m=this._columnX;if(m===-1||a.select&&b.isIE)j=this._getLine(h),m=j.getBoundingClientRect(f).left,j.destroy();j=this._getLine(h+o);e.extend(j.getOffset(m,0));j.destroy();a.select||e.collapse();
a=g*n;f=i.y+o*n;f+d>a&&(f=a-d);this._setSelection(e,!0,!0,function(){c._columnX=m},f-i.y)}return!0},_doPageUp:function(a){var c=this,d=this._model,e=this._getSelection(),f=e.getCaret(),h=d.getLineAtOffset(f),g=this._getScroll(),i=this._getClientHeight(),m;if(this._lineHeight){m=this._columnX;g=this._getBoundsAtOffset(f);if(m===-1||a.select&&b.isIE)m=g.left;f=this._getLineIndex(g.bottom-i);d=this._getLine(f);h=this._getLinePixel(f);f=d.getOffset(m,g.bottom-i-h);i=d.getBoundingClientRect(f);d.destroy();
e.extend(f);a.select||e.collapse();this._setSelection(e,!0,!0,function(){c._columnX=m},i.top+h-g.top);return!0}if(h>0){var j=this._getLineHeight(),i=Math.max(1,Math.min(h,Math.floor(i/j)));m=this._columnX;if(m===-1||a.select&&b.isIE)d=this._getLine(h),m=d.getBoundingClientRect(f).left,d.destroy();d=this._getLine(h-i);e.extend(d.getOffset(m,this._getLineHeight(h-i)-1));d.destroy();a.select||e.collapse();a=Math.max(0,g.y-i*j);this._setSelection(e,!0,!0,function(){c._columnX=m},a-g.y)}return!0},_doPaste:function(a){var c=
this;return this._getClipboardText(a,function(a){a&&(b.isLinux&&c._lastMouseButton===2&&(new Date).getTime()-c._lastMouseTime<=c._clickTime&&c._setSelectionTo(c._lastMouseX,c._lastMouseY),c._doContent(a))})!==null},_doScroll:function(a){var b=a.type,c=this._model,d=c.getLineCount(),a=this._getClientHeight(),e=this._getLineHeight();d*=e;var f=this._getScroll().y,h;switch(b){case "textStart":h=0;break;case "textEnd":h=d-a;break;case "pageDown":h=f+a;break;case "pageUp":h=f-a;break;case "lineDown":h=
f+e;break;case "lineUp":h=f-e;break;case "centerLine":b=this._getSelection(),h=c.getLineAtOffset(b.start),c=(c.getLineAtOffset(b.end)-h+1)*e,h=h*e-a/2+c/2}h!==void 0&&(h=Math.min(Math.max(0,h),d-a),this._scrollViewAnimated(0,h-f,function(){}));return!0},_doSelectAll:function(){var a=this._model,b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var a="\t";if(this._expandTab)var b=this._model,a=this._getSelection().getCaret(),
c=b.getLineAtOffset(a),b=b.getLineStart(c),a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ");this._doContent(a);return!0}},_doShiftTab:function(){return!this._tabMode||this._readonly?void 0:!0},_doOverwriteMode:function(){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0},_doTabMode:function(){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=
this._model,c=this._getSelection(),d=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),e=c.getCaret(),f=a.getLineCount(),h=a.getLineAtOffset(e),g;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")e=this._autoScrollY/this._getLineHeight(),e=e<0?Math.floor(e):Math.ceil(e),g=Math.max(0,Math.min(f-1,h+e));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")g=this._getLineIndex(d.y),h=this._getLine(h),d.x+=h.getBoundingClientRect(e,!1).left,h.destroy();
g===0&&(b.isMac||b.isLinux)?c.extend(0):g===f-1&&(b.isMac||b.isLinux)?c.extend(a.getCharCount()):(h=this._getLine(g),c.extend(h.getOffset(d.x,d.y-this._getLinePixel(g))),h.destroy());this._setSelection(c,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var b=this._model.getLineCount(),c=0;if(a){for(var a=
0,d=(new Date).getTime(),e=0;c<b;)if(this._lineHeight[c]||(a++,e||(e=c),this._lineHeight[c]=this._calculateLineHeight(c)),c++,(new Date).getTime()-d>100)break;this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(c!==b){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(a){var a=this._getLine(a),
b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,c=a.ownerDocument,d=b.createElement(c,"div");d.style.lineHeight="normal";var e={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(e);h(e.style,d);d.style.position="fixed";d.style.left="-1000px";var f=b.createElement(c,"span");f.appendChild(c.createTextNode(" "));d.appendChild(f);var g=b.createElement(c,"span");g.style.fontStyle=
"italic";g.appendChild(c.createTextNode(" "));d.appendChild(g);var i=b.createElement(c,"span");i.style.fontWeight="bold";i.appendChild(c.createTextNode(" "));d.appendChild(i);e=b.createElement(c,"span");e.style.fontWeight="bold";e.style.fontStyle="italic";e.appendChild(c.createTextNode(" "));d.appendChild(e);a.appendChild(d);var m=d.getBoundingClientRect(),f=f.getBoundingClientRect(),g=g.getBoundingClientRect(),i=i.getBoundingClientRect(),e=e.getBoundingClientRect(),f=f.bottom-f.top,g=g.bottom-g.top,
i=i.bottom-i.top,j=e.bottom-e.top,o=0,e=m.bottom-m.top<=0,m=Math.max(1,m.bottom-m.top);g>f&&(o=1);i>g&&(o=2);j>i&&(o=3);var k;if(o!==0){k={style:{}};if((o&1)!==0)k.style.fontStyle="italic";if((o&2)!==0)k.style.fontWeight="bold"}f=q(d);a.removeChild(d);j=n(this._viewDiv);d=b.createElement(c,"div");d.style.position="fixed";d.style.left="-1000px";d.style.paddingLeft=j.left+"px";d.style.paddingTop=j.top+"px";d.style.paddingRight=j.right+"px";d.style.paddingBottom=j.bottom+"px";d.style.width="100px";d.style.height=
"100px";j=b.createElement(c,"div");j.style.width="100%";j.style.height="100%";d.appendChild(j);a.appendChild(d);o=d.getBoundingClientRect();g=j.getBoundingClientRect();i=0;if(!this._singleMode)d.style.overflow="hidden",j.style.height="200px",i=d.clientWidth,d.style.overflow="scroll",i-=d.clientWidth;a.removeChild(d);j={left:g.left-o.left,top:g.top-o.top,right:o.right-g.right,bottom:o.bottom-g.bottom};g=o=0;if(!e&&(this._wrapOffset||this._marginOffset))d=b.createElement(c,"div"),d.style.position="fixed",
d.style.left="-1000px",d.innerHTML=Array(this._wrapOffset+1).join(" "),a.appendChild(d),o=d.getBoundingClientRect(),o=Math.ceil(o.right-o.left),d.innerHTML=Array(this._marginOffset+1).join(" "),g=d.getBoundingClientRect(),g=Math.ceil(g.right-g.left),a.removeChild(d);return{lineHeight:m,largestFontStyle:k,lineTrim:f,viewPadding:j,scrollWidth:i,wrapWidth:o,marginWidth:g,invalid:e}},_cancelAnimation:function(){if(this._animation)this._animation.stop(),this._animation=null},_clearSelection:function(a){var b=
this._getSelection();if(b.isEmpty())return!1;a==="next"?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(){if(this._imeOffset!==-1){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,b=a.getLineAtOffset(this._imeOffset),c=a.getLineStart(b),d=this._getDOMText(this._getLineNode(b)).text,a=a.getLine(b),c=this._imeOffset-c,a=c+d.length-a.length;c!==a&&this._doContent(d.substring(c,a));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new j.DefaultKeyMode(this));
var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(d(b,{select:!1}))},actionDescription:{name:i.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(d(b,{select:!1}))},actionDescription:{name:i.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(d(b,{select:!1,ctrl:!1}))},actionDescription:{name:i.lineStart}},lineEnd:{defaultHandler:function(b){return a._doEnd(d(b,{select:!1,ctrl:!1}))},actionDescription:{name:i.lineEnd}},
charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(d(b,{select:!1,unit:"character"}))},actionDescription:{name:i.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(d(b,{select:!1,unit:"character"}))},actionDescription:{name:i.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(d(b,{select:!1}))},actionDescription:{name:i.pageUp}},pageDown:{defaultHandler:function(b){return a._doPageDown(d(b,{select:!1}))},actionDescription:{name:i.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(d(b,
{type:"pageUp"}))},actionDescription:{name:i.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(d(b,{type:"pageDown"}))},actionDescription:{name:i.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(d(b,{type:"lineUp"}))},actionDescription:{name:i.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(d(b,{type:"lineDown"}))},actionDescription:{name:i.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(d(b,
{select:!1,unit:"word"}))},actionDescription:{name:i.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(d(b,{select:!1,unit:"word"}))},actionDescription:{name:i.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(d(b,{select:!1,ctrl:!0}))},actionDescription:{name:i.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(d(b,{select:!1,ctrl:!0}))},actionDescription:{name:i.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(d(b,{type:"textStart"}))},
actionDescription:{name:i.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(d(b,{type:"textEnd"}))},actionDescription:{name:i.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(d(b,{type:"centerLine"}))},actionDescription:{name:i.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(d(b,{select:!0}))},actionDescription:{name:i.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(d(b,{select:!0}))},actionDescription:{name:i.selectLineDown}},
selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(d(b,{select:!0,wholeLine:!0}))},actionDescription:{name:i.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(d(b,{select:!0,wholeLine:!0}))},actionDescription:{name:i.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(d(b,{select:!0,ctrl:!1}))},actionDescription:{name:i.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(d(b,{select:!0,ctrl:!1}))},
actionDescription:{name:i.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(d(b,{select:!0,unit:"character"}))},actionDescription:{name:i.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(d(b,{select:!0,unit:"character"}))},actionDescription:{name:i.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(d(b,{select:!0}))},actionDescription:{name:i.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(d(b,
{select:!0}))},actionDescription:{name:i.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(d(b,{select:!0,unit:"word"}))},actionDescription:{name:i.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(d(b,{select:!0,unit:"word"}))},actionDescription:{name:i.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(d(b,{select:!0,ctrl:!0}))},actionDescription:{name:i.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(d(b,
{select:!0,ctrl:!0}))},actionDescription:{name:i.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(d(b,{unit:"character"}))},actionDescription:{name:i.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(d(b,{unit:"character"}))},actionDescription:{name:i.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(d(b,{unit:"word"}))},actionDescription:{name:i.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(d(b,
{unit:"word"}))},actionDescription:{name:i.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(d(b,{unit:"line"}))},actionDescription:{name:i.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(d(b,{unit:"line"}))},actionDescription:{name:i.deleteLineEnd}},tab:{defaultHandler:function(){return a._doTab()},actionDescription:{name:i.tab}},shiftTab:{defaultHandler:function(){return a._doShiftTab()},actionDescription:{name:i.shiftTab}},enter:{defaultHandler:function(){return a._doEnter()},
actionDescription:{name:i.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(d(b,{noCursor:!0}))},actionDescription:{name:i.enterNoCursor}},selectAll:{defaultHandler:function(){return a._doSelectAll()},actionDescription:{name:i.selectAll}},copy:{defaultHandler:function(){return a._doCopy()},actionDescription:{name:i.copy}},cut:{defaultHandler:function(){return a._doCut()},actionDescription:{name:i.cut}},paste:{defaultHandler:function(){return a._doPaste()},actionDescription:{name:i.paste}},
uppercase:{defaultHandler:function(b){return a._doCase(d(b,{type:"upper"}))},actionDescription:{name:i.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(d(b,{type:"lower"}))},actionDescription:{name:i.lowercase}},capitalize:{defaultHandler:function(b){return a._doCase(d(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:i.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(d(b,{type:"reverse"}))},actionDescription:{name:i.reversecase}},toggleOverwriteMode:{defaultHandler:function(){return a._doOverwriteMode()},
actionDescription:{name:i.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(){return a._doTabMode()},actionDescription:{name:i.toggleTabMode}},toggleWrapMode:{defaultHandler:function(){return a._doWrapMode()},actionDescription:{name:i.toggleWrapMode}}}},_createRulerParent:function(a){var c=b.createElement(document,"div");c.className=a;c.tabIndex=-1;c.style.overflow="hidden";c.style.MozUserSelect="none";c.style.WebkitUserSelect="none";c.style.position="absolute";c.style.top="0px";c.style.bottom=
"0px";c.style.cursor="default";c.style.display="none";c.setAttribute("aria-hidden","true");this._rootDiv.appendChild(c);return c},_createRuler:function(a,c){if(this._clientDiv){var d=this._getRulerParent(a);if(d){if(d!==this._marginDiv||this._marginOffset)d.style.display="block";var e=b.createElement(d.ownerDocument,"div");e._ruler=a;e.rulerChanged=!0;e.style.position="relative";e.style.cssFloat="left";e.style.styleFloat="left";e.style.outline="none";if(c===void 0||c<0||c>=d.children.length)d.appendChild(e);
else{for(var f=d.firstChild;f&&c-- >0;)f=f.nextSibling;d.insertBefore(e,f)}}}},_createView:function(){if(!this._clientDiv){for(var a=this._parent;a.hasChildNodes();)a.removeChild(a.lastChild);var c=a.ownerDocument,d=b.createElement(c,"div");this._rootDiv=d;d.tabIndex=-1;d.style.position="relative";d.style.overflow="hidden";d.style.width="100%";d.style.height="100%";d.style.overflow="hidden";d.style.WebkitTextSizeAdjust="100%";d.setAttribute("role","application");a.appendChild(d);this._leftDiv=this._createRulerParent("textviewLeftRuler");
a=b.createElement(c,"div");a.className="textviewScroll";this._viewDiv=a;a.tabIndex=-1;a.style.position="absolute";a.style.top="0px";a.style.bottom="0px";a.style.borderWidth="0px";a.style.margin="0px";a.style.outline="none";a.style.background="transparent";if(b.isMac&&b.isWebkit)a.style.pointerEvents="none",a.style.zIndex="2";d.appendChild(a);var e=this._createRulerParent("textviewRightRuler");this._rightDiv=e;e.style.right="0px";this._scrollDiv=e=b.createElement(c,"div");e.style.margin="0px";e.style.borderWidth=
"0px";e.style.padding="0px";a.appendChild(e);(this._marginDiv=this._createRulerParent("textviewMarginRuler")).style.zIndex="4";if(!b.isIE&&!b.isIOS)this._clipDiv=a=b.createElement(c,"div"),a.style.position="absolute",a.style.overflow="hidden",a.style.margin="0px",a.style.borderWidth="0px",a.style.padding="0px",a.style.background="transparent",d.appendChild(a),this._clipScrollDiv=e=b.createElement(c,"div"),e.style.position="absolute",e.style.height="1px",e.style.top="-1000px",e.style.background="transparent",
a.appendChild(e);this._setFullSelection(this._fullSelection,!0);a=b.createElement(c,"div");a.className="textviewContent";this._clientDiv=a;a.tabIndex=0;a.style.position="absolute";a.style.borderWidth="0px";a.style.margin="0px";a.style.padding="0px";a.style.outline="none";a.style.zIndex="1";a.style.WebkitUserSelect="text";a.setAttribute("spellcheck","false");if(b.isIOS||b.isAndroid)a.style.WebkitTapHighlightColor="transparent";(this._clipDiv||d).appendChild(a);if(b.isIOS||b.isAndroid)this._vScrollDiv=
e=b.createElement(c,"div"),e.style.position="absolute",e.style.borderWidth="1px",e.style.borderColor="white",e.style.borderStyle="solid",e.style.borderRadius="4px",e.style.backgroundColor="black",e.style.opacity="0.5",e.style.margin="0px",e.style.padding="0px",e.style.outline="none",e.style.zIndex="3",e.style.width="8px",e.style.display="none",d.appendChild(e),this._hScrollDiv=e=b.createElement(c,"div"),e.style.position="absolute",e.style.borderWidth="1px",e.style.borderColor="white",e.style.borderStyle=
"solid",e.style.borderRadius="4px",e.style.backgroundColor="black",e.style.opacity="0.5",e.style.margin="0px",e.style.padding="0px",e.style.outline="none",e.style.zIndex="3",e.style.height="8px",e.style.display="none",d.appendChild(e);if(b.isFirefox&&!a.setCapture)this._overlayDiv=c=b.createElement(c,"div"),c.style.position=a.style.position,c.style.borderWidth=a.style.borderWidth,c.style.margin=a.style.margin,c.style.padding=a.style.padding,c.style.cursor="text",c.style.zIndex="2",(this._clipDiv||
d).appendChild(c);a.contentEditable="true";a.setAttribute("role","textbox");a.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,!0);this._hookEvents();d=this._rulers;for(c=0;c<d.length;c++)this._createRuler(d[c]);this._update()}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},
scrollAnimation:{value:0,update:null},readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,update:this._setFullSelection},tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},singleMode:{value:!1,update:this._setSingleMode},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},marginOffset:{value:0,update:this._setMarginOffset},wrapOffset:{value:0,update:this._setWrapOffset},
wrapMode:{value:!1,update:this._setWrapMode},wrappable:{value:!1,update:null},theme:{value:c.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var c=b.firstChild;c;){if(c._ruler===a){c._ruler=void 0;b.removeChild(c);if(b.children.length===0&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}c=c.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);
this._unhookEvents();var a=this._getWindow();if(this._autoScrollTimerID)a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null;if(this._updateTimer)a.clearTimeout(this._updateTimer),this._updateTimer=null;a=this._rootDiv;a.parentNode.removeChild(a);this._hScrollDiv=this._vScrollDiv=this._cursorDiv=this._marginDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=
this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,b,c){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=c;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var b=this._hasFocus;this._ignoreFocus=!0;b&&a.blur();a.contentEditable=!1;a.contentEditable=!0;b&&a.focus();this._ignoreFocus=
!1}},_getBaseText:function(a,b){var c=this._model;c.getBaseModel&&(a=c.mapOffset(a),b=c.mapOffset(b),c=c.getBaseModel());return c.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=b.getBoundingClientRect(),c=this._clientDiv.getBoundingClientRect();a.bottom>c.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a)),a=b.getBoundingClientRect(a),
c=this._getLinePixel(b.lineIndex);a.top+=c;a.bottom+=c;b.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,c){var d=this._model.getLineDelimiter(),e,f,h=this._getWindow(),g=h.clipboardData;if(!g&&a)g=a.clipboardData;if(g)return e=[],f=g.getData(b.isIE?"Text":"text/plain"),
m(f,function(a){e.push(a)},function(){e.push(d)}),f=e.join(""),c&&c(f),f;if(b.isFirefox){this._ignoreFocus=!0;var i=this._clipboardDiv,g=this._rootDiv.ownerDocument;if(!i)this._clipboardDiv=i=b.createElement(g,"div"),i.style.position="fixed",i.style.whiteSpace="pre",i.style.left="-1000px",this._rootDiv.appendChild(i);i.innerHTML="<pre contenteditable=''></pre>";i.firstChild.focus();var j=this,n=function(){var a=j._getTextFromElement(i);i.innerHTML="";e=[];m(a,function(a){e.push(a)},function(){e.push(d)});
return e.join("")},o=!1;this._ignorePaste=!0;if(!b.isLinux||this._lastMouseButton!==2)try{o=g.execCommand("paste",!1,null)}catch(k){o=i.childNodes.length>1||i.firstChild&&i.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!o)return a?(h.setTimeout(function(){j.focus();(f=n())&&c&&c(f);j._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(f=n())&&c&&c(f);return f}return""},_getDOMText:function(a,b){for(var c=a.firstChild,d="",e=0;c;){var f;if(!c.ignore)if(c.ignoreChars){f=
c.lastChild;for(var h=0,g=[],i=-1;f;){var m=f.data;if(m)for(var j=m.length-1;j>=0;j--){var n=m.substring(j,j+1);h<c.ignoreChars&&(n===" "||n==="\u200b"||n==="\ufeff")?h++:g.push(n==="\u00a0"?"\t":n)}if(b===f)i=g.length;f=f.previousSibling}g=g.reverse().join("");i!==-1&&(e=d.length+g.length-i);d+=g}else for(f=c.firstChild;f;){if(b===f)e=d.length;d+=f.data;f=f.nextSibling}c=c.nextSibling}return{text:d,offset:e}},_getTextFromElement:function(a){var b=a.ownerDocument,c=b.defaultView;if(!c.getSelection)return a.innerText||
a.textContent;b=b.createRange();b.selectNode(a);var a=c.getSelection(),c=[],d;for(d=0;d<a.rangeCount;d++)c.push(a.getRangeAt(d));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);b=a.toString();a.removeAllRanges();for(d=0;d<c.length;d++)a.addRange(c[d]);this._ignoreSelect=!1;return b},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var b=this._getLineNode(a);return b&&!b.lineChanged&&!b.lineRemoved?b._line:new s(this,a)},_getLineHeight:function(a,b){if(a!==
void 0&&this._lineHeight){var c=this._lineHeight[a];if(c)return c;if(b||b===void 0)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var b=this._clientDiv.firstChild;b;){if(a===b.lineIndex)return b;b=b.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&a.lineIndex===-1;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:this._clientDiv.lastChild;a&&a.lineIndex===
-1;)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var b=this._getTopIndex(),c=-this._topIndexY+this._getScroll().y;if(a>b)for(;b<a;b++)c+=this._getLineHeight(b);else for(b-=1;b>=a;b--)c-=this._getLineHeight(b);return c}return this._getLineHeight()*a},_getLineIndex:function(a){var b,c=0,d=this._model.getLineCount();if(this._lineHeight){var c=this._getTopIndex(),e=-this._topIndexY+this._getScroll().y;if(a!==e)if(a<e)for(;a<
e&&c>0;)a+=this._getLineHeight(--c);else for(b=this._getLineHeight(c);a-b>=e&&c<d-1;)a-=b,b=this._getLineHeight(++c)}else b=this._getLineHeight(),c=Math.floor(a/b);return Math.max(0,Math.min(d-1,c))},_getRulerParent:function(a){switch(a.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(a){(a===void 0||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},
_getTopIndex:function(a){var b=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=b.getBoundingClientRect(),c=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect();a.top<d.top+c.top&&(b=this._getLineNext(b)||b)}return b.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(b){a._onModelChanging(b)},onChanged:function(b){a._onModelChanged(b)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",
this._modelListener.onChanged);this._themeListener={onChanged:function(){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var c=this._handlers=[],d=this._clientDiv,e=this._viewDiv,f=this._rootDiv,h=this._overlayDiv||d,g=d.ownerDocument,i=this._getWindow(),m=b.isIE?g:i;c.push({target:i,type:"resize",handler:function(b){return a._handleResize(b?b:i.event)}});c.push({target:d,type:"blur",handler:function(b){return a._handleBlur(b?b:i.event)}});
c.push({target:d,type:"focus",handler:function(b){return a._handleFocus(b?b:i.event)}});c.push({target:e,type:"focus",handler:function(){d.focus()}});c.push({target:e,type:"scroll",handler:function(b){return a._handleScroll(b?b:i.event)}});c.push({target:d,type:"textInput",handler:function(b){return a._handleTextInput(b?b:i.event)}});c.push({target:d,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:i.event)}});c.push({target:d,type:"keypress",handler:function(b){return a._handleKeyPress(b?
b:i.event)}});c.push({target:d,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:i.event)}});b.isIE&&c.push({target:g,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?b:i.event)}});c.push({target:d,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:i.event)}});c.push({target:d,type:"copy",handler:function(b){return a._handleCopy(b?b:i.event)}});c.push({target:d,type:"cut",handler:function(b){return a._handleCut(b?b:i.event)}});c.push({target:d,type:"paste",
handler:function(b){return a._handlePaste(b?b:i.event)}});if(b.isIOS||b.isAndroid)c.push({target:g,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:i.event)}}),c.push({target:d,type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:i.event)}}),c.push({target:d,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:i.event)}}),c.push({target:d,type:"touchend",handler:function(b){return a._handleTouchEnd(b?b:i.event)}});else{c.push({target:d,type:"selectstart",
handler:function(b){return a._handleSelectStart(b?b:i.event)}});c.push({target:d,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:i.event)}});c.push({target:d,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:i.event)}});c.push({target:d,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:i.event)}});c.push({target:m,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:i.event)}});c.push({target:m,type:"mousemove",handler:function(b){return a._handleMouseMove(b?
b:i.event)}});c.push({target:f,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:i.event)}});c.push({target:f,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?b:i.event)}});c.push({target:h,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:i.event)}});c.push({target:h,type:"drag",handler:function(b){return a._handleDrag(b?b:i.event)}});c.push({target:h,type:"dragend",handler:function(b){return a._handleDragEnd(b?b:i.event)}});c.push({target:h,
type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:i.event)}});c.push({target:h,type:"dragover",handler:function(b){return a._handleDragOver(b?b:i.event)}});c.push({target:h,type:"dragleave",handler:function(b){return a._handleDragLeave(b?b:i.event)}});c.push({target:h,type:"drop",handler:function(b){return a._handleDrop(b?b:i.event)}});c.push({target:this._clientDiv,type:b.isFirefox>26?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?
b:i.event)}});this._clipDiv&&c.push({target:this._clipDiv,type:b.isFirefox>26?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:i.event)}});if(b.isFirefox&&(!b.isWindows||b.isFirefox>=15))(e=i.MutationObserver||i.MozMutationObserver)?(this._mutationObserver=new e(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(d,{subtree:!0,characterData:!0})):c.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?
b:i.event)}});this._overlayDiv&&(c.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:i.event)}}),c.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:i.event)}}),c.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:i.event)}}),c.push({target:this._overlayDiv,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:i.event)}}));this._isW3CEvents||c.push({target:this._clientDiv,
type:"dblclick",handler:function(b){return a._handleDblclick(b?b:i.event)}})}this._hookRulerEvents(this._leftDiv,c);this._hookRulerEvents(this._rightDiv,c);this._hookRulerEvents(this._marginDiv,c);for(e=0;e<c.length;e++)f=c[e],v(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(a,c){if(a){var d=this,e=this._getWindow();b.isIE&&c.push({target:a,type:"selectstart",handler:function(){return!1}});c.push({target:a,type:b.isFirefox>26?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return d._handleMouseWheel(a?
a:e.event)}});c.push({target:a,type:"click",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"dblclick",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"mousemove",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"mouseover",handler:function(a){d._handleRulerEvent(a?a:e.event)}});c.push({target:a,type:"mouseout",handler:function(a){d._handleRulerEvent(a?a:e.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||
this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var c=a.parent;typeof c==="string"&&(c=(a.document||document).getElementById(c));if(!c)throw"no parent";a.parent=c;a.model=a.model||new k.TextModel;var d=this._defaultOptions(),e;for(e in d)d.hasOwnProperty(e)&&(this["_"+e]=a[e]!==void 0?a[e]:d[e].value);this._keyModes=[];this._rulers=[];this._selection=new o(0,0,!1);this._linksVisible=
!1;this._maxLineWidth=this._redrawCount=0;this._maxLineIndex=-1;this._ignoreSelect=!0;this._hasFocus=this._ignoreFocus=!1;this._dragOffset=this._columnX=-1;this._isRangeRects=(!b.isIE||b.isIE>=9)&&typeof c.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=c.addEventListener;this._autoScrollTimerID=this._autoScrollY=this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=
this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions();this._createView()},_modifyContent:function(a,b){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(a.text===null||a.text===void 0)){var c=this._model;try{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!0;c.setText(a.text,a.start,a.end)}finally{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!1}b&&(c=
this._getSelection(),c.setCaret(a.start+a.text.length),this._setSelection(c,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var b=a.start,c=a.addedCharCount,d=a.removedCharCount,e=a.addedLineCount,f=a.removedLineCount,h=this._getSelection();h.end>b&&(h.end>b&&h.start<b+d?h.setCaret(b+c):(h.start+=c-d,h.end+=c-d),this._setSelection(h,!1,!1));b=this._model.getLineAtOffset(b);for(c=this._getLineNext();c;){d=c.lineIndex;if(b<=
d&&d<=b+f)b===d&&!c.modelChangedEvent&&!c.lineRemoved?(c.modelChangedEvent=a,c.lineChanged=!0):(c.lineRemoved=!0,c.lineChanged=!1,c.modelChangedEvent=null);if(d>b+f)c.lineIndex=d+e-f,c._line.lineIndex=c.lineIndex;c=this._getLineNext(c)}this._lineHeight&&(a=[b,f].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));if(!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<=b+f)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._update()},_onModelChanging:function(a){a.type=
"ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(a!==void 0&&b!==void 0)for(var c=a;c<b;c++)this._lineHeight[c]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},
_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new o(0,0,!1),!1,!1);if(this._viewDiv)this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0;var a=this._clientDiv;if(a){for(var c=a.firstChild;c;)c.lineRemoved=!0,c=c.nextSibling;if(b.isFirefox)this._ignoreFocus=
!1,(c=this._hasFocus)&&a.blur(),a.contentEditable=!1,a.contentEditable=!0,c&&a.focus(),this._ignoreFocus=!1}},_scrollViewAnimated:function(a,b,c){var d=this._getWindow();if(c&&this._scrollAnimation){var e=this;this._animation=new w({window:d,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);e._scrollView(0,a);b-=a},onEnd:function(){e._animation=null;e._scrollView(a,b);c&&d.setTimeout(c,0)}});this._animation.play()}else this._scrollView(a,b),c&&d.setTimeout(c,0)},_scrollView:function(a,
b){this._ensureCaretVisible=!1;var c=this._viewDiv;a&&(c.scrollLeft+=a);b&&(c.scrollTop+=b)},_setClipboardText:function(a,c){var d,e=this._getWindow(),f=e.clipboardData;if(!f&&c)f=c.clipboardData;if(f&&(d=[],m(a,function(a){d.push(a)},function(){d.push(b.platformDelimiter)}),f.setData(b.isIE?"Text":"text/plain",d.join(""))))return!0;var h=this._parent.ownerDocument,g=b.createElement(h,"pre");g.style.position="fixed";g.style.left="-1000px";m(a,function(a){g.appendChild(h.createTextNode(a))},function(){g.appendChild(b.createElement(h,
"br"))});g.appendChild(h.createTextNode(" "));this._clientDiv.appendChild(g);f=h.createRange();f.setStart(g.firstChild,0);f.setEndBefore(g.lastChild);var i=e.getSelection();i.rangeCount>0&&i.removeAllRanges();i.addRange(f);var j=this,f=function(){g&&g.parentNode===j._clientDiv&&j._clientDiv.removeChild(g);j._updateDOMSelection()},i=!1;this._ignoreCopy=!0;try{i=h.execCommand("copy",!1,null)}catch(n){}this._ignoreCopy=!1;if(!i&&c)return e.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(a,
c,d,e,f){for(var h,g,i,m,j=0,n=a.firstChild,o,k,q=this._model.getLine(a.lineIndex).length;n;){if(!n.ignore){o=n.firstChild;k=o.length;n.ignoreChars&&(k-=n.ignoreChars);if(j+k>c||j+k>=q){h=o;g=c-j;n.ignoreChars&&k>0&&g===k&&(g+=n.ignoreChars);break}j+=k}n=n.nextSibling}for(var j=0,n=d.firstChild,s=this._model.getLine(d.lineIndex).length;n;){if(!n.ignore){o=n.firstChild;k=o.length;n.ignoreChars&&(k-=n.ignoreChars);if(k+j>e||j+k>=s){i=o;m=e-j;n.ignoreChars&&k>0&&m===k&&(m+=n.ignoreChars);break}j+=k}n=
n.nextSibling}this._setDOMFullSelection(a,c,q,d,e,s);a=this._getWindow();c=this._parent.ownerDocument;if(a.getSelection){d=a.getSelection();a=c.createRange();a.setStart(h,g);a.setEnd(i,m);if(this._hasFocus&&(d.anchorNode!==h||d.anchorOffset!==g||d.focusNode!==i||d.focusOffset!==m||d.anchorNode!==i||d.anchorOffset!==m||d.focusNode!==h||d.focusOffset!==g))this._anchorNode=h,this._anchorOffset=g,this._focusNode=i,this._focusOffset=m,this._ignoreSelect=!1,d.rangeCount>0&&d.removeAllRanges(),d.addRange(a),
this._ignoreSelect=!0;if(this._cursorDiv&&(a=c.createRange(),f?(a.setStart(h,g),a.setEnd(h,g)):(a.setStart(i,m),a.setEnd(i,m)),i=a.getClientRects()[0],m=this._cursorDiv.parentNode,h=m.getBoundingClientRect(),i&&h))this._cursorDiv.style.top=i.top-h.top+m.scrollTop+"px",this._cursorDiv.style.left=i.left-h.left+m.scrollLeft+"px"}else if(c.selection&&this._hasFocus)f=c.body,a=b.createElement(c,"div"),f.appendChild(a),f.removeChild(a),a=f.createTextRange(),a.moveToElementText(h.parentNode),a.moveStart("character",
g),h=f.createTextRange(),h.moveToElementText(i.parentNode),h.moveStart("character",m),a.setEndPoint("EndToStart",h),this._ignoreSelect=!1,a.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(a,b,c,d,e){if(this._selDiv1&&(c=this._selDiv1,c.style.width="0px",c.style.height="0px",c=this._selDiv2,c.style.width="0px",c.style.height="0px",c=this._selDiv3,c.style.width="0px",c.style.height="0px",!(a===d&&b===e))){var f=this._model,h=this._getViewPadding(),g=this._clientDiv.getBoundingClientRect(),
i=this._viewDiv.getBoundingClientRect(),c=i.left+h.left,m=g.right,h=i.top+h.top,j=g.bottom,i=g=0;this._clipDiv?(i=this._clipDiv.getBoundingClientRect(),g=i.left-this._clipDiv.scrollLeft):(i=this._rootDiv.getBoundingClientRect(),g=i.left);i=i.top;this._ignoreDOMSelection=!0;var n=(new s(this,a.lineIndex,a)).getBoundingClientRect(f.getLineStart(a.lineIndex)+b,!1),o=n.left,b=(new s(this,d.lineIndex,d)).getBoundingClientRect(f.getLineStart(d.lineIndex)+e,!1),f=b.left;this._ignoreDOMSelection=!1;var k=
this._selDiv1,o=Math.min(m,Math.max(c,o)),q=Math.min(j,Math.max(h,n.top)),t=m,e=Math.min(j,Math.max(h,n.bottom));k.style.left=o-g+"px";k.style.top=q-i+"px";k.style.width=Math.max(0,t-o)+"px";k.style.height=Math.max(0,e-q)+"px";if(a.lineIndex===d.lineIndex)t=Math.min(f,m),k.style.width=Math.max(0,t-o)+"px";else if(n=Math.min(j,Math.max(h,b.top)),f=Math.min(m,Math.max(c,f)),h=Math.min(j,Math.max(h,b.bottom)),j=this._selDiv3,j.style.left=c-g+"px",j.style.top=n-i+"px",j.style.width=Math.max(0,f-c)+"px",
j.style.height=Math.max(0,h-n)+"px",Math.abs(a.lineIndex-d.lineIndex)>1)a=this._selDiv2,a.style.left=c-g+"px",a.style.top=e-i+"px",a.style.width=Math.max(0,m-c)+"px",a.style.height=Math.max(0,n-e)+"px"}},_setGrab:function(a){if(a!==this._grabControl)a?(a.setCapture&&a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null)},_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;if(b.isIE&&a)this._hadFocus=
this._hasFocus;var c=this._clientDiv;c.contentEditable=!a;this._hadFocus&&!a&&c.focus();if(this._overlayDiv)this._overlayDiv.style.zIndex=a?"-1":"1";for(a=this._getLineNext();a;){if(a.hasLink)for(c=a.firstChild;c;)if(c.ignore)c=c.nextSibling;else{var d=c.nextSibling,e=c.viewStyle;e&&e.tagName&&e.tagName.toLowerCase()==="a"&&a.replaceChild(a._line._createSpan(a,c.firstChild.data,e),c);c=d}a=this._getLineNext(a)}this._updateDOMSelection()}},_setSelection:function(a,b,c,d,e){if(a){this._columnX=-1;c===
void 0&&(c=!0);var f=this._selection;this._selection=a;b!==!1&&this._showCaret(!1,d,b,e);c&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,b,c,d){var e=this._model,f=this._getSelection(),b=this.convert({x:a,y:b},"page","document"),a=this._getLineIndex(b.y);if(this._clickCount===1){e=this._getLine(a);a=e.getOffset(b.x,b.y-this._getLinePixel(a));e.destroy();if(d&&!c&&f.start<=
a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);c||f.collapse()}else(this._clickCount&1)===0?(e=this._getLine(a),a=e.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(c=this._doubleClickSelection.start,d=e.getNextOffset(a,{unit:"wordend",count:1})):(c=e.getNextOffset(a,{unit:"word",count:-1}),d=this._doubleClickSelection.end):(c=e.getNextOffset(a,{unit:"word",count:-1}),d=e.getNextOffset(c,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?
(d=e.getLineAtOffset(this._doubleClickSelection.start),a>=d?(c=e.getLineStart(d),d=e.getLineEnd(a)):(c=e.getLineStart(a),d=e.getLineEnd(d))):(c=e.getLineStart(a),d=e.getLineEnd(a)),f.setCaret(c),f.extend(d);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(a,c){this._fullSelection=a;if(b.isWebkit)this._fullSelection=!0;var d=this._clipDiv||this._rootDiv;if(d)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!b.isIOS){var e=d.ownerDocument;this._highlightRGB=b.isWebkit?
"transparent":"Highlight";var f=b.createElement(e,"div");this._selDiv1=f;f.style.position="absolute";f.style.borderWidth="0px";f.style.margin="0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width="0px";f.style.height="0px";f.style.zIndex="0";d.appendChild(f);var h=b.createElement(e,"div");this._selDiv2=h;h.style.position="absolute";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.background=this._highlightRGB;
h.style.width="0px";h.style.height="0px";h.style.zIndex="0";d.appendChild(h);this._selDiv3=e=b.createElement(e,"div");e.style.position="absolute";e.style.borderWidth="0px";e.style.margin="0px";e.style.padding="0px";e.style.outline="none";e.style.background=this._highlightRGB;e.style.width="0px";e.style.height="0px";e.style.zIndex="0";d.appendChild(e);if(b.isFirefox&&b.isMac){d=this._getWindow().getComputedStyle(e,null).getPropertyValue("background-color");switch(d){case "rgb(119, 141, 168)":d="rgb(199, 208, 218)";
break;case "rgb(127, 127, 127)":d="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":d="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":d="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":d="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":d="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":d="rgb(232, 184, 255)";break;default:d="rgb(180, 213, 255)"}this._highlightRGB=d;f.style.background=d;h.style.background=d;e.style.background=d}c||this._updateDOMSelection()}}else{if(this._selDiv1)d.removeChild(this._selDiv1),
this._selDiv1=null;if(this._selDiv2)d.removeChild(this._selDiv2),this._selDiv2=null;if(this._selDiv3)d.removeChild(this._selDiv3),this._selDiv3=null}},_setBlockCursor:function(a){this._blockCursorVisible=a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=b.createElement(document,"div");a.className="textviewBlockCursor";
this._cursorDiv=a;a.tabIndex=-1;a.style.zIndex="2";a.style.color="transparent";a.style.position="absolute";a.style.pointerEvents="none";a.innerHTML="&nbsp;";this._viewDiv.appendChild(a);this._updateDOMSelection()}}else if(this._cursorDiv)this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";if(!b)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setWrapOffset:function(a,
b){this._wrapOffset=a;if(!b)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,c){this._tabSize=a;this._customTabSize=void 0;var d=this._clientDiv;if(b.isOpera){if(d)d.style.OTabSize=this._tabSize+""}else if(b.isWebkit>=537.1){if(d)d.style.tabSize=this._tabSize+""}else if(b.isFirefox>=
4){if(d)d.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==8)this._customTabSize=this._tabSize;c||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a,b){this._themeClass=a;var c="textview",d=this._theme.getThemeClass();d&&(c+=" "+
d);this._themeClass&&d!==this._themeClass&&(c+=" "+this._themeClass);this._rootDiv.className=c;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var c=this._clientDiv;this._wrapMode?(c.style.whiteSpace="pre-wrap",c.style.wordWrap="break-word"):(c.style.whiteSpace="pre",c.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,c,d){if(this._clientDiv){var e=this._model,f=this._getSelection(),
h=this._getScroll(),g=f.getCaret(),i=f.start,m=f.end,j=e.getLineAtOffset(m),n=Math.max(Math.max(i,e.getLineStart(j)),m-1),e=this._getClientWidth(),j=this._getClientHeight(),o=e/4,k=this._getBoundsAtOffset(g===i?i:n),q=k.left,s=k.right,t=k.top,p=k.bottom;a&&!f.isEmpty()&&(k=this._getBoundsAtOffset(g===m?i:n),k.top===t?g===i?s=q+Math.min(k.right-q,e):q=s-Math.min(s-k.left,e):g===i?p=t+Math.min(k.bottom-t,j):t=p-Math.min(p-k.top,j));a=0;q<h.x&&(a=Math.min(q-h.x,-o));s>h.x+e&&(a=Math.max(s-h.x-e,o));
f=0;t<h.y?f=t-h.y:p>h.y+j&&(f=p-h.y-j);d&&(d>0?f>0&&(f=Math.max(f,d)):f<0&&(f=Math.min(f,d)));if(a!==0||f!==0)return f!==0&&typeof c==="number"&&(c<0&&(c=0),c>1&&(c=1),f+=Math.floor(f>0?c*j:-c*j)),this._scrollViewAnimated(a,f,b),j!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;else b&&b();return!1}},_startIME:function(){if(this._imeOffset===-1){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);
this._imeOffset=a.start}},_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var b=this._handlers[a];t(b.target,b.type,b.handler)}this._handlers=null;if(this._mutationObserver)this._mutationObserver.disconnect(),this._mutationObserver=
null},_updateDOMSelection:function(){if(!(this._redrawCount>0)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,c=b.getLineAtOffset(a.start),d=b.getLineAtOffset(a.end),e=this._getLineNext();if(e){var f=this._getLinePrevious(),h;c<e.lineIndex?(h=e,c=0):c>f.lineIndex?(h=f,c=0):(h=this._getLineNode(c),c=a.start-b.getLineStart(c));d<e.lineIndex?b=0:d>f.lineIndex?(e=f,b=0):(e=this._getLineNode(d),b=a.end-b.getLineStart(d));this._setDOMSelection(h,c,e,b,a.caret)}}},
_update:function(a){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,a=!1;var c=this._clientDiv,d=this._viewDiv;if(c){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var e=this._model,f=this._getScroll(!1),h=this._getViewPadding(),g=e.getLineCount(),i=this._getLineHeight(),m=!1,j=!1,n=!1,o=this._metrics.scrollWidth;if(this._wrapMode)c.style.width=(this._metrics.wrapWidth||this._getClientWidth())+
"px";var k,q,t,p,w=0,u=0,v;if(this._lineHeight){for(;u<g;){v=this._getLineHeight(u);if(w+v>f.y)break;w+=v;u++}k=u;q=Math.max(0,k-1);t=e=f.y-w;k>0&&(e+=this._getLineHeight(k-1))}else p=Math.max(0,f.y)/i,k=Math.floor(p),q=Math.max(0,k-1),e=Math.round((p-q)*i),t=Math.round((p-k)*i);this._topIndexY=t;p=this._rootDiv;var I=p.clientWidth,F=p.clientHeight;if(a){i=0;this._leftDiv&&(k=this._leftDiv.getBoundingClientRect(),i=k.right-k.left);k=this._getClientWidth();p=this._getClientHeight();j=k;if(this._wrapMode){if(this._metrics.wrapWidth)j=
this._metrics.wrapWidth}else j=Math.max(this._maxLineWidth,j);for(;u<g;)v=this._getLineHeight(u,!1),w+=v,u++;g=w}else{p=this._getClientHeight();t=Math.min(k+Math.floor((p+t)/i),g-1);var f=Math.min(t+1,g-1),C;for(v=c.firstChild;v;){C=v.lineIndex;var A=v.nextSibling;if(!(q<=C&&C<=f)||v.lineRemoved||v.lineIndex===-1)this._mouseWheelLine===v?(v.style.display="none",v.lineIndex=-1):c.removeChild(v);v=A}v=this._getLineNext();var A=d.ownerDocument,L=A.createDocumentFragment();for(C=q;C<=f;C++)if(!v||v.lineIndex>
C)(new s(this,C)).create(L,null);else{L.firstChild&&(c.insertBefore(L,v),L=A.createDocumentFragment());if(v&&v.lineChanged)v=(new s(this,C)).create(L,v),v.lineChanged=!1;v=this._getLineNext(v)}L.firstChild&&c.insertBefore(L,v);if(b.isWebkit&&!this._wrapMode)c.style.width="0x7fffffffpx";v=this._getLineNext();C=p+e;for(L=!1;v;){q=v.lineWidth;if(q===void 0)if(A=v._line.getBoundingClientRect(),q=v.lineWidth=Math.ceil(A.right-A.left),A=A.bottom-A.top,this._lineHeight)this._lineHeight[v.lineIndex]=A;else if(i!==
0&&A!==0&&Math.ceil(i)!==Math.ceil(A))this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[v.lineIndex]=A;if(this._lineHeight&&!L&&(C-=this._lineHeight[v.lineIndex],C<0))t=v.lineIndex,L=!0;if(!this._wrapMode){if(q>=this._maxLineWidth)this._maxLineWidth=q,this._maxLineIndex=v.lineIndex;if(this._checkMaxLineIndex===v.lineIndex)this._checkMaxLineIndex=-1}if(v.lineIndex===k)this._topChild=v;if(v.lineIndex===t)this._bottomChild=v;v=this._getLineNext(v)}if(this._checkMaxLineIndex!==-1&&(C=this._checkMaxLineIndex,
this._checkMaxLineIndex=-1,0<=C&&C<g)){i=new s(this,C);A=i.getBoundingClientRect();q=A.right-A.left;if(q>=this._maxLineWidth)this._maxLineWidth=q,this._maxLineIndex=C;i.destroy()}for(;u<g;)v=this._getLineHeight(u,u<=t),w+=v,u++;g=w;this._updateRuler(this._leftDiv,k,f,F);this._updateRuler(this._rightDiv,k,f,F);this._updateRuler(this._marginDiv,k,f,F);i=0;this._leftDiv&&(k=this._leftDiv.getBoundingClientRect(),i=k.right-k.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),f=f.right-
f.left);d.style.left=i+"px";d.style.right=f+"px";f=this._scrollDiv;f.style.height=g+"px";k=this._getClientWidth();if(!this._singleMode&&!this._wrapMode){w=m=p;(u=d.style.overflowX==="scroll")?m+=o:w-=o;v=t=k;(q=d.style.overflowY==="scroll")?t+=o:v-=o;p=m;k=t;g>p&&(n=!0,k=v);this._maxLineWidth>k&&(j=!0,p=w,g>p&&(n=!0,k=v));if(u!==j)d.style.overflowX=j?"scroll":"hidden";if(q!==n)d.style.overflowY=n?"scroll":"hidden";m=u!==j||q!==n}n=k;if(this._wrapMode){if(this._metrics.wrapWidth)n=this._metrics.wrapWidth}else n=
Math.max(this._maxLineWidth,n);j=n;if((!b.isIE||b.isIE>=9)&&this._maxLineWidth>k)n+=h.right+h.left;f.style.width=n+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width=n+"px";f=this._getScroll(!1)}if(this._vScrollDiv)n=p-8,w=Math.max(15,Math.ceil(Math.min(1,n/(g+h.top+h.bottom))*n)),this._vScrollDiv.style.left=i+k-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*n/g))+"px",this._vScrollDiv.style.height=w+"px";if(!this._wrapMode&&this._hScrollDiv)n=k-8,w=Math.max(15,Math.ceil(Math.min(1,
n/(this._maxLineWidth+h.left+h.right))*n)),this._hScrollDiv.style.left=i+Math.floor(Math.max(0,Math.floor(f.x*n/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=p-9+"px",this._hScrollDiv.style.width=w+"px";u=f.x;w=this._clipDiv;n=this._overlayDiv;if(t=this._marginDiv)t.style.left=-u+i+this._metrics.marginWidth+h.left+"px",t.style.bottom=(d.style.overflowX==="scroll"?o:0)+"px";if(w){w.scrollLeft=u;w.scrollTop=0;d=i+h.left;o=h.top;a=k;i=p;u=0;t=-e;if(f.x===0)d-=h.left,a+=h.left,u=h.left;f.x+k===
j&&(a+=h.right);f.y===0&&(o-=h.top,i+=h.top,t+=h.top);f.y+p===g&&(i+=h.bottom);w.style.left=d+"px";w.style.top=o+"px";w.style.right=I-a-d+"px";w.style.bottom=F-i-o+"px";c.style.left=u+"px";c.style.top=t+"px";c.style.width=j+"px";c.style.height=p+e+"px";if(n)n.style.left=c.style.left,n.style.top=c.style.top,n.style.width=c.style.width,n.style.height=c.style.height}else{d=u;o=e;I=u+k;F=e+p;d===0&&(d-=h.left);o===0&&(o-=h.top);I===j&&(I+=h.right);f.y+p===g&&(F+=h.bottom);c.style.clip="rect("+o+"px,"+
I+"px,"+F+"px,"+d+"px)";c.style.left=-u+i+h.left+"px";c.style.width=(this._wrapMode||b.isWebkit?j:k+u)+"px";if(!a)c.style.top=-e+h.top+"px",c.style.height=p+e+"px";if(n&&(n.style.clip=c.style.clip,n.style.left=c.style.left,n.style.width=c.style.width,!a))n.style.top=c.style.top,n.style.height=c.style.height}this._updateDOMSelection();if(m)c=this._ensureCaretVisible,this._ensureCaretVisible=!1,c&&this._showCaret(),this._queueUpdate()}}},_updateOverflow:function(){var a=this._viewDiv;this._wrapMode?
(a.style.overflowX="hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,c,d,e){if(a)for(var f=this._parent.ownerDocument,g=this._getLineHeight(),i=this._getViewPadding(),a=a.firstChild;a;){var m=a._ruler,j=g,n=m.getOverview();n==="page"&&(j+=this._topIndexY);a.style.top=-j+"px";a.style.height=e+j+"px";a.rulerChanged&&h(m.getRulerStyle(),a);var o,k=a.firstChild;k?(o=k,k=k.nextSibling):(o=b.createElement(f,"div"),o.style.visibility="hidden",a.appendChild(o));var q;
if(a.rulerChanged&&o){j=-1;if(q=m.getWidestAnnotation())if(h(q.style,o),q.html)o.innerHTML=q.html;o.lineIndex=j;o.style.height=g+i.top+"px"}var t;if(n==="page"){for(m=m.getAnnotations(c,d+1);k;)j=k.lineIndex,q=k.nextSibling,(!(c<=j&&j<=d)||k.lineChanged)&&a.removeChild(k),k=q;k=a.firstChild.nextSibling;t=f.createDocumentFragment();for(j=c;j<=d;j++)if(!k||k.lineIndex>j){o=b.createElement(f,"div");if(q=m[j]){h(q.style,o);if(q.html)o.innerHTML=q.html;o.annotation=q}o.lineIndex=j;o.style.height=this._getLineHeight(j)+
"px";t.appendChild(o)}else if(t.firstChild&&(a.insertBefore(t,k),t=f.createDocumentFragment()),k)k=k.nextSibling;t.firstChild&&a.insertBefore(t,k)}else{q=this._getClientHeight();j=this._model.getLineCount();k=q+i.top+i.bottom-2*this._metrics.scrollWidth;n=g*j<k?g:k/j;if(a.rulerChanged){for(q=a.childNodes.length;q>1;)a.removeChild(a.lastChild),q--;m=m.getAnnotations(0,j);t=f.createDocumentFragment();for(var p in m)if(j=p>>>0,!(j<0)){o=b.createElement(f,"div");q=m[p];h(q.style,o);o.style.position="absolute";
o.style.top=this._metrics.scrollWidth+g+Math.floor(j*n)+"px";if(q.html)o.innerHTML=q.html;o.annotation=q;o.lineIndex=j;t.appendChild(o)}a.appendChild(t)}else if(a._oldTrackHeight!==k)for(o=a.firstChild?a.firstChild.nextSibling:null;o;)o.style.top=this._metrics.scrollWidth+g+Math.floor(o.lineIndex*n)+"px",o=o.nextSibling;a._oldTrackHeight=k}a.rulerChanged=!1;a=a.nextSibling}},_updateStyleSheet:function(){var a="";b.isWebkit&&this._metrics.scrollWidth>0&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
b.isFirefox&&b.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var c=document.getElementById("_textviewStyle");if(c)c.removeChild(c.firstChild),c.appendChild(document.createTextNode(a));else{c=b.createElement(document,"style");c.id="_textviewStyle";var d=document.getElementsByTagName("head")[0]||document.documentElement;c.appendChild(document.createTextNode(a));d.insertBefore(c,d.firstChild)}}},_updateStyle:function(a){if(!a&&
b.isIE)this._rootDiv.style.lineHeight="normal";var c=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=b.isIE?c.lineHeight-(c.lineTrim.top+c.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};g.EventTarget.addMixin(u.prototype);return{TextView:u}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(i,k){function j(g){this._model=g;this._projections=[];var c=this;this._listener={onChanged:function(f){c._onChanged(f)},onChanging:function(f){c._onChanging(f)}};g.addEventListener("postChanged",this._listener.onChanged);g.addEventListener("preChanging",this._listener.onChanging)}j.prototype={destroy:function(){if(this._model)this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null},addProjection:function(g){if(g){var c=this._model,f=this._projections;g._lineIndex=c.getLineAtOffset(g.start);g._lineCount=c.getLineAtOffset(g.end)-g._lineIndex;var b=g.text;b||(b="");g._model=typeof b==="string"?new i.TextModel(b,c.getLineDelimiter()):b;var c=this.mapOffset(g.start,!0),b=g.end-g.start,h=g._lineCount,e=g._model.getCharCount(),d=g._model.getLineCount()-1;this.onChanging({type:"Changing",text:g._model.getText(),
start:c,removedCharCount:b,addedCharCount:e,removedLineCount:h,addedLineCount:d});var a=this._binarySearch(f,g.start);f.splice(a,0,g);this.onChanged({type:"Changed",start:c,removedCharCount:b,addedCharCount:e,removedLineCount:h,addedLineCount:d})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(g,c){var f=this._projections,b=0,h,e;if(c){for(h=0;h<f.length;h++){e=f[h];if(e.start>g)break;if(e.end>g)return-1;b+=e._model.getCharCount()-
(e.end-e.start)}return g+b}for(h=0;h<f.length;h++){e=f[h];if(e.start>g-b)break;var d=e._model.getCharCount();if(e.start+d>g-b)return-1;b+=d-(e.end-e.start)}return g-b},removeProjection:function(g){var c,f=0;for(c=0;c<this._projections.length;c++){var b=this._projections[c];if(b===g){g=b;break}f+=b._model.getCharCount()-(b.end-b.start)}if(c<this._projections.length){var b=this._model,f=g.start+f,h=g.end-g.start,e=g._lineCount,d=g._model.getCharCount(),a=g._model.getLineCount()-1;this.onChanging({type:"Changing",
text:b.getText(g.start,g.end),start:f,removedCharCount:d,addedCharCount:h,removedLineCount:a,addedLineCount:e});this._projections.splice(c,1);this.onChanged({type:"Changed",start:f,removedCharCount:d,addedCharCount:h,removedLineCount:a,addedLineCount:e})}},_binarySearch:function(g,c){for(var f=g.length,b=-1,h;f-b>1;)h=Math.floor((f+b)/2),c<=g[h].start?f=h:b=h;return f},getCharCount:function(){for(var g=this._model.getCharCount(),c=this._projections,f=0;f<c.length;f++){var b=c[f];g+=b._model.getCharCount()-
(b.end-b.start)}return g},getLine:function(g,c){if(g<0)return null;var f=this._model,b=this._projections,h=0,e=[],d=0,a,i,j;for(a=0;a<b.length;a++){j=b[a];if(j._lineIndex>=g-h)break;i=j._model.getLineCount()-1;if(j._lineIndex+i>=g-h)if(d=g-(j._lineIndex+h),d<i)return j._model.getLine(d,c);else e.push(j._model.getLine(i));d=j.end;h+=i-j._lineCount}for(d=Math.max(d,f.getLineStart(g-h));a<b.length;a++){j=b[a];if(j._lineIndex>g-h)break;e.push(f.getText(d,j.start));i=j._model.getLineCount()-1;if(j._lineIndex+
i>g-h)return e.push(j._model.getLine(0,c)),e.join("");e.push(j._model.getText());d=j.end;h+=i-j._lineCount}b=f.getLineEnd(g-h,c);d<b&&e.push(f.getText(d,b));return e.join("")},getLineAtOffset:function(g){for(var c=this._model,f=this._projections,b=0,h=0,e=0;e<f.length;e++){var d=f[e];if(d.start>g-b)break;var a=d._model.getCharCount();if(d.start+a>g-b){f=g-(d.start+b);h+=d._model.getLineAtOffset(f);b+=f;break}h+=d._model.getLineCount()-1-d._lineCount;b+=a-(d.end-d.start)}return c.getLineAtOffset(g-
b)+h},getLineCount:function(){for(var g=this._projections,c=this._model.getLineCount(),f=0;f<g.length;f++){var b=g[f];c+=b._model.getLineCount()-1-b._lineCount}return c},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(g,c){if(g<0)return-1;for(var f=this._model,b=this._projections,h=0,e=0,d=0;d<b.length;d++){var a=b[d];if(a._lineIndex>g-h)break;var i=a._model.getLineCount()-1;if(a._lineIndex+i>g-h)return a._model.getLineEnd(g-(a._lineIndex+h),c)+a.start+e;e+=
a._model.getCharCount()-(a.end-a.start);h+=i-a._lineCount}return f.getLineEnd(g-h,c)+e},getLineStart:function(g){if(g<0)return-1;for(var c=this._model,f=this._projections,b=0,h=0,e=0;e<f.length;e++){var d=f[e];if(d._lineIndex>=g-b)break;var a=d._model.getLineCount()-1;if(d._lineIndex+a>=g-b)return d._model.getLineStart(g-(d._lineIndex+b))+d.start+h;h+=d._model.getCharCount()-(d.end-d.start);b+=a-d._lineCount}return c.getLineStart(g-b)+h},getText:function(g,c){g===void 0&&(g=0);var f=this._model,b=
this._projections,h=0,e=[],d,a,i;for(d=0;d<b.length;d++){a=b[d];if(a.start>g-h)break;i=a._model.getCharCount();if(a.start+i>g-h)if(c!==void 0&&a.start+i>c-h)return a._model.getText(g-(a.start+h),c-(a.start+h));else e.push(a._model.getText(g-(a.start+h))),g=a.end+h+i-(a.end-a.start);h+=i-(a.end-a.start)}var j=g-h;if(c!==void 0){for(;d<b.length;d++){a=b[d];if(a.start>c-h)break;e.push(f.getText(j,a.start));i=a._model.getCharCount();if(a.start+i>c-h)return e.push(a._model.getText(0,c-(a.start+h))),e.join("");
e.push(a._model.getText());j=a.end;h+=i-(a.end-a.start)}e.push(f.getText(j,c-h))}else{for(;d<b.length;d++)a=b[d],e.push(f.getText(j,a.start)),e.push(a._model.getText()),j=a.end;e.push(f.getText(j))}return e.join("")},_onChanged:function(){var g=this._change,c=g.baseStart,f=g.baseEnd,b,h,e=this._projections;for(b=0;b<e.length;b++)if(h=e[b],h.end>c)break;var d=b;for(b=0;b<e.length;b++)if(h=e[b],h.start>=f)break;var a=b,i=this._model,c=g.baseText.length-(f-c);for(b=a;b<e.length;b++)h=e[b],h.start+=c,
h.end+=c,h._lineIndex=i.getLineAtOffset(h.start);h=e.splice(d,a-d);for(b=0;b<h.length;b++)h[b].annotation&&h[b].annotation._expand();this.onChanged({type:"Changed",start:g.start,removedCharCount:g.removedCharCount,addedCharCount:g.addedCharCount,removedLineCount:g.removedLineCount,addedLineCount:g.addedLineCount});this._change=void 0},_onChanging:function(g){var c=!!this._change,f=this._change||{},b=g.start,h=b+g.removedCharCount;f.baseStart=b;f.baseEnd=h;f.baseText=g.text;f.addedLineCount=g.addedLineCount;
if(!c){this._change=f;f.text=g.text;var e=this._projections,d,a,i,g=function(b){for(a=0,d=0;a<e.length;a++){i=e[a];if(i.start>b)break;if(i.end>b)return-1;d+=i._model.getCharCount()-(i.end-i.start)}return b+d};f.start=g(b);if(f.start===-1)f.text=this._model.getText(i.start,b)+f.text,f.addedLineCount+=this._model.getLineAtOffset(b)-this._model.getLineAtOffset(i.start),f.start=i.start+d;f.end=g(h);if(f.end===-1)f.text+=this._model.getText(h,i.end),f.addedLineCount+=this._model.getLineAtOffset(i.end)-
this._model.getLineAtOffset(h),f.end=i.start+d}f.addedCharCount=f.text.length;f.removedCharCount=f.end-f.start;f.removedLineCount=this.getLineAtOffset(f.end)-this.getLineAtOffset(f.start);this.onChanging({type:"Changing",text:f.text,start:f.start,removedCharCount:f.removedCharCount,addedCharCount:f.addedCharCount,removedLineCount:f.removedLineCount,addedLineCount:f.addedLineCount})},onChanging:function(g){return this.dispatchEvent(g)},onChanged:function(g){return this.dispatchEvent(g)},setLineDelimiter:function(g){this._model.setLineDelimiter(g)},
setText:function(g,c,f){function b(b){for(d=0,e=0;d<h.length;d++){a=h[d];if(a.start>b-e)break;var c=a._model.getCharCount();if(a.start+c>b-e)return-1;e+=c-(a.end-a.start)}return b-e}this._change={text:g||"",start:c||0,end:f===void 0?this.getCharCount():f};var h=this._projections,e,d,a,i,j,g=b(this._change.start);if(g===-1)i={projection:a,start:this._change.start-(a.start+e)},g=a.end;c=b(this._change.end);if(c===-1)j={projection:a,end:this._change.end-(a.start+e)},c=a.start;if(i&&j&&i.projection===
j.projection)a._model.setText(this._change.text,i.start,j.end);else{this._model.setText(this._change.text,g,c);if(i)a=i.projection,a._model.setText("",i.start);if(j)a=j.projection,a._model.setText("",0,j.end),a.start=a.end,a._lineCount=0}this._change=void 0}};k.EventTarget.addMixin(j.prototype);return{ProjectionTextModel:j}});
define("orion/editor/tooltip","i18n!orion/editor/nls/messages,orion/editor/textView,orion/editor/textModel,orion/editor/projectionTextModel,orion/editor/util,orion/util".split(","),function(i,k,j,g,c,f){function b(b){this._view=b;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(b.getOptions("parent").ownerDocument)}b.getTooltip=function(c){if(!c._tooltip)c._tooltip=new b(c);return c._tooltip};b.prototype={_create:function(b){if(!this._tooltipDiv){var e=
this._tooltipDiv=f.createElement(b,"div");e.tabIndex=0;e.className="textviewTooltip";e.setAttribute("aria-live","assertive");e.setAttribute("aria-atomic","true");var d=this._tooltipContents=f.createElement(b,"div");e.appendChild(d);b.body.appendChild(e);var a=this;c.addEventListener(e,"mouseover",function(){if(a._hideDelay){var b=a._getWindow();if(a._delayedHideTimeout)b.clearTimeout(a._delayedHideTimeout),a._delayedHideTimeout=null;if(a._hideTimeout)b.clearTimeout(a._hideTimeout),a._hideTimeout=
null;a._nextTarget=null}},!1);c.addEventListener(e,"mouseout",function(b){b=b.relatedTarget||b.toElement;b===e||a._hasFocus()||(!b||!c.contains(e,b))&&a._hide()},!1);c.addEventListener(e,"keydown",function(b){b.keyCode===27&&a._hide()},!1);c.addEventListener(b,"mousedown",this._mouseDownHandler=function(b){a.isVisible()&&(c.contains(e,b.target||b.srcElement)||a._hide())},!0);this._view.addEventListener("Destroy",function(){a.destroy()});this._hide()}},_getWindow:function(){var b=this._tooltipDiv.ownerDocument;
return b.defaultView||b.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var b=this._tooltipDiv.parentNode;b&&b.removeChild(this._tooltipDiv);c.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var b=this._tooltipDiv;return!b?!1:c.contains(b,b.ownerDocument.activeElement)},hide:function(b){if(b===void 0)b=this._hideDelay;var c=this._getWindow();if(this._delayedHideTimeout)c.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null;var d=this;b?d._delayedHideTimeout=c.setTimeout(function(){d._delayedHideTimeout=null;d._hide();d.setTarget(d._nextTarget,0)},b):(d._hide(),d.setTarget(d._nextTarget,0))},_hide:function(){var b=this._tooltipDiv;if(b){this._hasFocus()&&this._view.focus();if(this._contentsView)this._contentsView.destroy(),this._contentsView=null;if(this._tooltipContents)this._tooltipContents.innerHTML="";b.style.visibility="hidden";b=this._getWindow();if(this._showTimeout)b.clearTimeout(this._showTimeout),
this._showTimeout=null;if(this._delayedHideTimeout)b.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null;if(this._hideTimeout)b.clearTimeout(this._hideTimeout),this._hideTimeout=null;if(this._fadeTimeout)b.clearInterval(this._fadeTimeout),this._fadeTimeout=null}},isVisible:function(){return this._tooltipDiv&&this._tooltipDiv.style.visibility==="visible"},setTarget:function(b,c,d){if(this.isVisible()){if(!this._hasFocus())this._nextTarget=b,this.hide(d)}else if(this._target=b){var a=
this,b=a._getWindow();if(a._showTimeout)b.clearTimeout(a._showTimeout),a._showTimeout=null;c===0?a.show(!0):a._showTimeout=b.setTimeout(function(){a._showTimeout=null;a.show(!0)},c?c:a._showDelay)}},show:function(b){if(this._target){var c=this._target.getTooltipInfo();if(c){var d=this._tooltipDiv,a=this._tooltipContents;d.style.left=d.style.right=d.style.width=d.style.height=a.style.width=a.style.height="auto";var f=c.contents;f instanceof Array&&(f=this._getAnnotationContents(f));if(typeof f==="string")a.innerHTML=
f;else if(this._isNode(f))a.appendChild(f);else if(f instanceof g.ProjectionTextModel){var i=this._view,j=i.getOptions();j.wrapMode=!1;j.parent=a;var o=j.themeClass;o?((o=o.replace("tooltipTheme",""))&&(o=" "+o),o="tooltipTheme"+o):o="tooltipTheme";j.themeClass=o;j=this._contentsView=new k.TextView(j);j.addEventListener("LineStyle",function(a){i.onLineStyle(a)});j.setModel(f);f=j.computeSize();a.style.width=f.width+"px";a.style.height=f.height+"px";j.resize()}else return;a=d.ownerDocument.documentElement;
c.anchor==="right"?(f=a.clientWidth-c.x,d.style.right=f+"px"):(f=parseInt(this._getNodeStyle(d,"padding-left","0"),10),f+=parseInt(this._getNodeStyle(d,"border-left-width","0"),10),f=c.x-f,d.style.left=f+"px");d.style.maxWidth=a.clientWidth-f-10+"px";f=parseInt(this._getNodeStyle(d,"padding-top","0"),10);f+=parseInt(this._getNodeStyle(d,"border-top-width","0"),10);f=c.y-f;d.style.top=f+"px";d.style.maxHeight=a.clientHeight-f-10+"px";d.style.opacity="1";d.style.visibility="visible";if(b){var p=this,
s=this._getWindow();p._hideTimeout=s.setTimeout(function(){p._hideTimeout=null;var a=parseFloat(p._getNodeStyle(d,"opacity","1"));p._fadeTimeout=s.setInterval(function(){d.style.visibility==="visible"&&a>0?(a-=0.1,d.style.opacity=a):p._hide()},p._fadeDelay/10)},p._autoHideDelay)}}}},_getAnnotationContents:function(b){function e(a,b){var c=u.getLineStart(u.getLineAtOffset(a)),d=u.getLineEnd(u.getLineAtOffset(b),!0);return u.getText(c,d)}function d(a){var b=a.title,d=f.createElement(o,"div");d.className=
"tooltipRow";if(a.html)d.innerHTML=a.html,d.lastChild&&c.addEventListener(d.lastChild,"click",function(){var b=a.start,c=a.end;s.getBaseModel&&(b=s.mapOffset(b,!0),c=s.mapOffset(c,!0));p.setSelection(b,c,1/3,function(){k._hide()})},!1),d.appendChild(o.createTextNode("\u00a0"));b||(b=e(a.start,a.end));typeof b==="function"&&(b=a.title());if(typeof b==="string"){var h=f.createElement(o,"span");h.appendChild(o.createTextNode(b));b=h}d.appendChild(b);return d}for(var a,m=[],j=0;j<b.length;j++)a=b[j],
a.title!==""&&!a.groupAnnotation&&m.push(a);b=m;if(b.length===0)return null;var k=this,o=this._tooltipDiv.ownerDocument,p=this._view,s=p.getModel(),u=s.getBaseModel?s.getBaseModel():s;if(b.length===1)if(a=b[0],a.title!==void 0){a=d(a);if(a.firstChild)(b=a.firstChild.className)&&(b+=" "),b+="single",a.firstChild.className=b;return a}else return b=new g.ProjectionTextModel(u),m=u.getLineStart(u.getLineAtOffset(a.start)),j=u.getCharCount(),a.end!==j&&b.addProjection({start:a.end,end:j}),m>0&&b.addProjection({start:0,
end:m}),b;else{m=f.createElement(o,"div");a=f.createElement(o,"em");a.appendChild(o.createTextNode(i.multipleAnnotations));m.appendChild(a);for(j=0;j<b.length;j++)a=b[j],(a=d(a))&&m.appendChild(a);return m}},_getNodeStyle:function(b,c,d){var a;if(b&&(a=b.style[c],!a))if(b.currentStyle){for(a=0;(a=c.indexOf("-",a))!==-1;)c=c.substring(0,a)+c.substring(a+1,a+2).toUpperCase()+c.substring(a+2);a=b.currentStyle[c]}else a=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(c):null;
return a||d},_isNode:function(b){return typeof Node==="object"?b instanceof Node:b&&typeof b==="object"&&typeof b.nodeType==="number"&&typeof b.nodeName==="string"}};return{Tooltip:b}});
define("orion/editor/editor","i18n!orion/editor/nls/messages,orion/editor/eventTarget,orion/editor/tooltip,orion/editor/annotations,orion/objects,orion/util".split(","),function(i,k,j,g,c,f){function b(b){b=b||{};this._domNode=b.domNode;this._model=b.model;this._undoStack=b.undoStack;this._statusReporter=b.statusReporter;this._title=null;var a=this;this._listener={onChanged:function(b){a.onChanged(b)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function h(c){c=c||{};b.call(this,c);this._textViewFactory=c.textViewFactory;this._undoStackFactory=c.undoStackFactory;this._textDNDFactory=c.textDNDFactory;this._annotationFactory=c.annotationFactory;this._foldingRulerFactory=c.foldingRulerFactory;this._lineNumberRulerFactory=c.lineNumberRulerFactory;this._contentAssistFactory=c.contentAssistFactory;this._keyBindingFactory=c.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var e=g.AnnotationType;b.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null;this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(b,a){return this.getModel().getText(b,a)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},
install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(b){return this.dispatchEvent(b)},onInputChanged:function(b){return this.dispatchEvent(b)},onChanged:function(){this.checkDirty()},reportStatus:function(b,a,c){this._statusReporter&&this._statusReporter(b,a,c)},resize:function(){},setDirty:function(b){if(this._dirty!==b)this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"})},
_setModelText:function(b){this._model&&this._model.setText(b)},setInput:function(b,a,c,e){this._title=b;e||(a?this.reportStatus(a,"error"):c!==null&&c!==void 0&&typeof c==="string"&&this._setModelText(c),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:b,message:a,contents:c,contentsSaved:e})},setText:function(b,a,c){this.getModel().setText(b,a,c)},uninstall:function(){this.installed=!1}};k.EventTarget.addMixin(b.prototype);h.prototype=new b;
c.mixin(h.prototype,{destroy:function(){b.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},
getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){if(!this._textView)return null;var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},
getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(b,a){if(this._annotationRulerVisible!==b||a)if(this._annotationRulerVisible=b,this._annotationRuler){var c=this._textView;b?c.addRuler(this._annotationRuler,0):c.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b,a){if(this._foldingRulerVisible!==b||a)if(this._foldingRulerVisible=
b,this._foldingRuler){var c=this._textView;c.getModel().getBaseModel&&(b?c.addRuler(this._foldingRuler):c.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(b,a){if(this._lineNumberRulerVisible!==b||a)if(this._lineNumberRulerVisible=b,this._lineNumberRuler){var c=this._textView;b?c.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):c.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b,a){if(this._overviewRulerVisible!==b||a)if(this._overviewRulerVisible=
b,this._overviewRuler){var c=this._textView;b?c.addRuler(this._overviewRuler):c.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(b=c.mapOffset(b,a));return b},getLineAtOffset:function(b){return this.getModel().getLineAtOffset(this.mapOffset(b))},getLineStart:function(b){return this.getModel().getLineStart(b)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var b=this._textView,a=b.getSelection(),
b=b.getModel();if(b.getBaseModel)a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end);return a},_expandOffset:function(b){var a=this._textView.getModel(),c=this._annotationModel;if(c&&a.getBaseModel)for(b=c.getAnnotations(b,b+1);b.hasNext();)a=b.next(),a.type===e.ANNOTATION_FOLDING&&a.expand&&a.expand()},setCaretOffset:function(b,a,c){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(b),b=f.mapOffset(b,!0));e.setCaretOffset(b,a,c)},setText:function(b,a,c){var e=this._textView,
f=e.getModel();f.getBaseModel&&(a!==void 0&&(this._expandOffset(a),a=f.mapOffset(a,!0)),c!==void 0&&(this._expandOffset(c),c=f.mapOffset(c,!0)));e.setText(b,a,c)},setSelection:function(b,a,c,e){var f=this._textView,h=f.getModel();h.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=h.mapOffset(b,!0),a=h.mapOffset(a,!0));f.setSelection(b,a,c,e)},moveSelection:function(b,a,c,e){var f=this._textView;this.setSelection(b,a||b,1/3,function(){(e===void 0||e)&&f.focus();c&&c()})},_getTooltipInfo:function(b,
a){var c=this._textView,e=this.getAnnotationModel();if(!e)return null;var f=this._annotationStyler;if(!f)return null;var h=c.getOffsetAtLocation(b,a);if(h===-1)return null;h=this.mapOffset(h);f=f.getAnnotationsByType(e,h,h+1);e=[];for(h=0;h<f.length;h++)f[h].rangeStyle&&e.push(f[h]);if(e.length===0)return null;c=c.convert({x:b,y:a},"document","page");return{contents:e,anchor:"left",x:c.x+10,y:c.y+20}},_highlightCurrentLine:function(b,a){var c=this._annotationModel;if(c){var f=this._textView;if(!f.getOptions("singleMode")){var h=
f.getModel(),g=a?h.getLineAtOffset(a.start):-1,i=h.getLineAtOffset(b.start),f=b.start===b.end,j=!a||a.start===a.end,k=h.getLineStart(i),v=h.getLineEnd(i);h.getBaseModel&&(k=h.mapOffset(k),v=h.mapOffset(v));h=this._currentLineAnnotation;if(!(g===i&&j&&f&&h&&h.start===k&&h.end===v)){var g=h?[h]:null,t;f&&(h=e.createAnnotation(e.ANNOTATION_CURRENT_LINE,k,v),t=[h]);this._currentLineAnnotation=h;c.replaceAnnotations(g,t)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();if(this._undoStackFactory)this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty();if(this._textDNDFactory)this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack);if(this._contentAssistFactory)this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist();var c=this,a=this._textView,f=this;this._listener={onModelChanged:function(){f.checkDirty()},onMouseOver:function(a){f._listener.onMouseMove(a)},onMouseMove:function(b){var c=
j.Tooltip.getTooltip(a);if(c&&!(f._listener.lastMouseX===b.event.clientX&&f._listener.lastMouseY===b.event.clientY))f._listener.lastMouseX=b.event.clientX,f._listener.lastMouseY=b.event.clientY,c.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return f._getTooltipInfo(this.x,this.y)}})},onMouseOut:function(b){var c=j.Tooltip.getTooltip(a);if(c&&!(f._listener.lastMouseX===b.event.clientX&&f._listener.lastMouseY===b.event.clientY))f._listener.lastMouseX=b.event.clientX,f._listener.lastMouseY=b.event.clientY,
c.setTarget(null)},onScroll:function(){var b=j.Tooltip.getTooltip(a);b&&b.setTarget(null,0,0)},onSelection:function(a){f._updateCursorStatus();f._highlightCurrentLine(a.newValue,a.oldValue)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("MouseOver",this._listener.onMouseOver);a.addEventListener("MouseOut",this._listener.onMouseOut);a.addEventListener("MouseMove",this._listener.onMouseMove);a.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var h;if(h=typeof this._keyBindingFactory==="function"?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(c,this._undoStack,this._contentAssist))this._textActions=h.textActions,this._linkedMode=h.linkedMode,this._sourceCodeActions=h.sourceCodeActions}h=function(a){if(a!==void 0&&a!==-1){for(var b=this.getView().getModel(),f=this.getAnnotationModel(),h=c.mapOffset(b.getLineStart(a)),
a=c.mapOffset(b.getLineEnd(a)),b=f.getAnnotations(h,a),g=null;b.hasNext();){var i=b.next();if(i.type===e.ANNOTATION_BOOKMARK){g=i;break}}g?f.removeAnnotation(g):(g=e.createAnnotation(e.ANNOTATION_BOOKMARK,h,a),g.title=void 0,f.addAnnotation(g))}};if(this._annotationFactory){var g=a.getModel();g.getBaseModel&&(g=g.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(g))if(g=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))g.addAnnotationType(e.ANNOTATION_CURRENT_SEARCH),
g.addAnnotationType(e.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(e.ANNOTATION_ERROR),g.addAnnotationType(e.ANNOTATION_WARNING),g.addAnnotationType(e.ANNOTATION_MATCHING_BRACKET),g.addAnnotationType(e.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(e.ANNOTATION_CURRENT_LINE),g.addAnnotationType(e.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(e.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType(e.ANNOTATION_SELECTED_LINKED_GROUP),g.addAnnotationType(e.ANNOTATION_CURRENT_LINKED_GROUP),g.addAnnotationType(e.ANNOTATION_LINKED_GROUP),
g.addAnnotationType("orion.annotation.highlightError");var g=this._annotationFactory.createAnnotationRulers(this._annotationModel),i=this._annotationRuler=g.annotationRuler;if(i)i.onDblClick=h,i.setMultiAnnotationOverlay({html:"<div class='annotationHTML overlay'></div>"}),i.addAnnotationType(e.ANNOTATION_ERROR),i.addAnnotationType(e.ANNOTATION_WARNING),i.addAnnotationType(e.ANNOTATION_TASK),i.addAnnotationType(e.ANNOTATION_BOOKMARK);this.setAnnotationRulerVisible(this._annotationRulerVisible||this._annotationRulerVisible===
void 0,!0);if(i=this._overviewRuler=g.overviewRuler)i.addAnnotationType(e.ANNOTATION_CURRENT_SEARCH),i.addAnnotationType(e.ANNOTATION_MATCHING_SEARCH),i.addAnnotationType(e.ANNOTATION_READ_OCCURRENCE),i.addAnnotationType(e.ANNOTATION_WRITE_OCCURRENCE),i.addAnnotationType(e.ANNOTATION_CURRENT_BLAME),i.addAnnotationType(e.ANNOTATION_ERROR),i.addAnnotationType(e.ANNOTATION_WARNING),i.addAnnotationType(e.ANNOTATION_TASK),i.addAnnotationType(e.ANNOTATION_BOOKMARK),i.addAnnotationType(e.ANNOTATION_MATCHING_BRACKET),
i.addAnnotationType(e.ANNOTATION_CURRENT_BRACKET),i.addAnnotationType(e.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||this._overviewRulerVisible===void 0,!0)}if(this._lineNumberRulerFactory)this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(e.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(e.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=h,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
this._lineNumberRulerVisible===void 0,!0);if(this._foldingRulerFactory)this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(e.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||this._foldingRulerVisible===void 0,!0);this.dispatchEvent({type:"TextViewInstalled",textView:a});b.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var c=this._textView;if(c)c.destroy(),
this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0,this.dispatchEvent({type:"TextViewUninstalled",textView:c}),b.prototype.uninstall.call(this)},_updateCursorStatus:function(){var b=
this.getModel(),a=this.getCaretOffset(),c=b.getLineAtOffset(a),b=b.getLineStart(c);a-=b;for(var b=this.getKeyModes(),e=0;e<b.length;e++){var h=b[e];if(h.isActive()&&h.isStatusActive&&h.isStatusActive())return}this.reportStatus(f.formatMessage(i.lineColumn,c+1,a+1))},showAnnotations:function(b,a,c,f){var h=this._annotationModel;if(h){for(var g=[],i=[],j=h.getTextModel(),k=h.getAnnotations(),v;k.hasNext();)v=k.next(),a.indexOf(v.type)!==-1&&v.creatorID===this&&g.push(v);if(b)for(a=0;a<b.length;a++)if(v=
b[a]){if(c)v=c(v);else{var t;typeof v.line==="number"?(t=j.getLineStart(v.line-1),k=t+v.start-1,t=t+v.end-1):(k=v.start,t=v.end);var w=f(v);if(!w)continue;v=e.createAnnotation(w,k,t,v.description)}v.creatorID=this;i.push(v)}h.replaceAnnotations(g,i)}},showProblems:function(b){this.showAnnotations(b,[e.ANNOTATION_ERROR,e.ANNOTATION_WARNING,e.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return e.ANNOTATION_ERROR;case "warning":return e.ANNOTATION_WARNING;case "task":return e.ANNOTATION_TASK}return null})},
showOccurrences:function(b){this.showAnnotations(b,[e.ANNOTATION_READ_OCCURRENCE,e.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?e.ANNOTATION_READ_OCCURRENCE:e.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(b){var a=this._blameRGB,h=this.getTextView().getOptions("parent").ownerDocument;if(!a){var j=f.createElement(h,"div");j.className="annotation blame";h.body.appendChild(j);var k=(h.defaultView||h.parentWindow).getComputedStyle(j).getPropertyValue("background-color");j.parentNode.removeChild(j);
var j=k.indexOf("("),o=k.indexOf(")"),k=k.substring(j+1,o);this._blameRGB=a=k.split(",").slice(0,3)}var p=function(){var a=g.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=c.mixin({},a.style);a.style.style=c.mixin({},a.style.style);a.style.style.backgroundColor="";this.groupAnnotation=a;a.blame=this.blame;a.html=this.html;a.creatorID=this.creatorID;return a},s=function(){var a=f.createElement(h,"div");a.className="tooltipTitle";var b=this.blame.Message.indexOf("\n");
if(b===-1)b=this.blame.Message.length;var c=f.createElement(h,"a");c.href=this.blame.CommitLink;c.appendChild(h.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(c);a.appendChild(f.createElement(h,"br"));a.appendChild(h.createTextNode(f.formatMessage(i.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},u=this.getModel();this.showAnnotations(b,[e.ANNOTATION_BLAME,e.ANNOTATION_CURRENT_BLAME],function(b){var d=u.getLineStart(b.Start-1),f=u.getLineEnd(b.End-1,!0),d=g.AnnotationType.createAnnotation(e.ANNOTATION_BLAME,
d,f,s),f=a.slice(0);f.push(b.Shade);d.style=c.mixin({},d.style);d.style.style=c.mixin({},d.style.style);d.style.style.backgroundColor="rgba("+f.join()+")";d.groupId=b.Name;d.groupType=e.ANNOTATION_CURRENT_BLAME;d.createGroupAnnotation=p;d.html='<img class="annotationHTML blame" src="'+b.AuthorImage+'"/>';d.blame=b;return d})},showSelection:function(b,a,c,e,f){typeof b==="number"?(typeof a!=="number"&&(a=b),this.moveSelection(b,a)):typeof c==="number"&&(b=this.getModel().getLineStart(c-1),typeof e===
"number"&&(b+=e),typeof f!=="number"&&(f=0),this.moveSelection(b,b+f))},_setModelText:function(b){this._textView&&(this._textView.setText(b),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(c,a,e,f,h){b.prototype.setInput.call(this,c,a,e,f);this._textView&&!f&&!h&&this._textView.focus()},onGotoLine:function(b,a,c,e){if(this._textView){var f=this.getModel(),b=Math.max(0,Math.min(b,f.getLineCount()-1)),h=f.getLineStart(b),
g=0;c===void 0&&(c=0);typeof a==="string"?(b=f.getLine(b).indexOf(a),b!==-1&&(g=b,c=g+a.length)):(g=a,a=f.getLineEnd(b)-h,g=Math.min(g,a),c=Math.min(c,a));this.moveSelection(h+g,h+c,e)}}});return{BaseEditor:b,Editor:h}});
define("orion/markdownView","marked/marked,orion/editor/editor,orion/objects,orion/webui/littlelib,orion/URITemplate,orion/section,orion/URL-shim".split(","),function(i,k,j,g,c,f){function b(a,b,c,d){return function(e,f){if(f.href.indexOf(":")===-1)try{var h;if(b.protocol==="filesystem:")h={href:"filesystem:"+(new URL(f.href,b.pathname)).href};else if(h=new URL(f.href,b),d)h.protocol="",h.host="";if(e[0][0]!=="!")f.href=m.expand({resource:h.href});else{if(c.readBlob){var g="_md_img_"+q++;c.readBlob(h.href).then(function(a){var b=
h.href.match(n),a=URL.createObjectURL(new Blob([a],{type:b?"image/"+b[1]:"image/png"}));document.getElementById(g).src=a;URL.revokeObjectURL(a)});return"<img id='"+g+"' src=''>"}f.href=h.href}}catch(i){console.log(i)}return a.call(this,e,f)}}function h(a,c,d){var e=i.InlineLexer.prototype.outputLink,f=new URL(c,window.location.href);i.InlineLexer.prototype.outputLink=b(e,f,d,c.indexOf(":")===-1);a=i(a,{sanitize:!0});i.InlineLexer.prototype.outputLink=e;return a}function e(a){this.fileClient=a.fileClient;
this.progress=a.progress;this.canHide=a.canHide;this._node=null}function d(a){this.id="orion.viewer.markdown";this.fileClient=a.fileClient;this.metadata=a.metadata;o.apply(this,arguments)}function a(a){this._parent=a.parent;this.fileClient=a.fileService;this.metadata=a.metadata;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progressService;this.model=a.model;this.undoStack=a.undoStack}var m=new c("#{,resource,params*}"),
n=/\.([0-9a-z]+)(?:[\?#]|$)/i,q=0;e.prototype={display:function(a,b,c,d){a.classList.add("orionMarkdown");a.innerHTML=h(b,c,d)},displayContents:function(a,b){var c=b.Location||b;g.empty(a);var d=document.createElement("div");(this.progress?this.progress.progress(this.fileClient.read(c),"Reading file "+(b.Name||c)):this.fileClient.read(c)).then(function(a){this.display.bind(this)(d,a,c,this.fileClient)}.bind(this));a.appendChild(d)},displayInFrame:function(a,b,c,d,e){a=new f.Section(a,{id:"markdownSection",
title:b.Name||e||"readme",headerClass:c,canHide:this.canHide});d&&(c=a.getTitleElement())&&c.classList.add(d);this.displayContents.call(this,a.getContentElement(),b)}};var o=k.BaseEditor;d.prototype=Object.create(o.prototype);j.mixin(d.prototype,{createMarked:function(a){return h(a,this.metadata.Location,this.fileClient)},install:function(){var a=this._rootDiv=document.createElement("div");a.style.width="100%";a.style.height="100%";var b=this._contentDiv=document.createElement("div");b.classList.add("orionMarkdown");
a.appendChild(b);g.node(this._domNode).appendChild(a);this._contentDiv.innerHTML=this.createMarked(this.getModel().getText());o.prototype.install.call(this)},setInput:function(a,b,c,d){o.prototype.setInput.call(this,a,b,c,d);if(!b&&!d)this._contentDiv.innerHTML=this.createMarked(c)},uninstall:function(){g.empty(this._domNode);o.prototype.uninstall.call(this)}});a.prototype={create:function(){this.editor=new d({domNode:this._parent,fileClient:this.fileClient,metadata:this.metadata,model:this.model,
undoStack:this.undoStack});this.editor.install()},destroy:function(){this.editor&&this.editor.destroy();this.editor=null}};return{MarkdownEditorView:a,MarkdownView:e}});
define("orion/projects/projectEditor","orion/URITemplate,orion/webui/littlelib,orion/Deferred,orion/objects,orion/projectCommands,orion/commandRegistry,orion/PageLinks,orion/explorers/explorer,orion/section".split(","),function(i,k,j,g,c,f,b,h,e){function d(a){this.root=a}function a(a,b,c){this._init(a);this.projectEditor=b;this.explorer=c}function m(a){this.root=a}function n(a,b,c){this._init(a);this.projectEditor=b;this.explorer=c}function q(a,b){this.root=a;this.projectClient=b}function o(a,b,
c){this._init(a);this.projectEditor=b;this.explorer=c;this.commandService=a.commandRegistry;this.actionScopeId=a.actionScopeId}function p(a,b,c){this.root=a;this.launchConfigurations=b;this.projectClient=c}function s(a,b,c){this._init(a);this.projectEditor=b;this.explorer=c;this.commandService=a.commandRegistry;this.actionScopeId=a.actionScopeId;this.projectClient=a.projectClient}function u(a,b,c,d,e){h.Explorer.apply(this,arguments);this.actionScopeId=e;this.selectionActions="LaunchConfigurationExplorerSelectionActions";
this.actionsSections=[this.selectionActions]}function v(a){this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.progress=a.progress;this.preferences=a.preferences;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.commandRegistry=a.commandRegistry;this._node=null;this.dependencyActions="dependencyActions";this.launchConfigurationActions="launchConfigurationsActions";this.createCommands()}var t=new i("./edit.html#{,resource,params*}");d.prototype=new h.ExplorerModel;
d.prototype.constructor=d;d.prototype.getRoot=function(a){return a(this.root)};d.prototype.getChildren=function(a,b){a===this.root?b([{id:"Name",displayName:"Name",value:a.Name,no:1},{id:"Description",displayName:"Description",value:a.Description,no:2},{id:"Url",displayName:"Site",value:a.Url,href:a.Url,no:3}]):b([])};d.prototype.getId=function(a){return"ProjectInfo"+a.id};a.prototype=new h.SelectionRenderer;a.prototype.constructor=a;a.prototype.getCellHeaderElement=function(){};a.prototype.getCellElement=
function(a,b){if(a===0){var c=document.createElement("td"),d=document.createElement("span");d.className="discreetInputLabel";d.appendChild(document.createTextNode(b.displayName));c.classList.add("discreetInputLabel");c.appendChild(d);c.width="20%";return c}if(a===1){if(b.href){c=document.createElement("td");c.style.verticalAlign="top";var e=document.createElement("input");e.style.visibility="hidden";var f=document.createElement("div");f.style.marginTop="-15px";f.title="Click to edit";f.className=
"discreetInput";f.tabIndex=b.no;var h=document.createElement("a");h.href=b.value||"";h.appendChild(document.createTextNode(b.value||""));h.tabIndex=b.no+1;f.appendChild(h);f.title="Click to edit";f.onclick=function(){f.style.visibility="hidden";h.style.visibility="hidden";e.style.visibility="";e.focus()}.bind(this.projectEditor);f.onfocus=f.onclick;f.onkeyup=function(a){if(a.keyCode===k.KEY.ENTER)f.onclick(a)}.bind(this.projectEditor);h.urlSelector=f;this.projectEditor._renderEditableFields(e,b.id,
b.no,h);c.appendChild(e);c.appendChild(f);return c}c=document.createElement("td");c.style.verticalAlign="top";d=b.id==="Description"?document.createElement("textArea"):document.createElement("input");this.projectEditor._renderEditableFields(d,b.id,b.no,null);c.appendChild(d);return c}};m.prototype=new h.ExplorerModel;m.prototype.constructor=m;m.prototype.getRoot=function(a){return a(this.root)};m.prototype.getChildren=function(a,b){if(a===this.root){for(var c=0;c<a.Children.length;c++)a.Children[c].parent=
a;b(a.Children)}else b([])};m.prototype.getId=function(a){return"AdditionalInfo"+h.ExplorerModel.prototype.getId.call(this,{Location:a.parent.Name+a.Name})};n.prototype=new h.SelectionRenderer;n.prototype.constructor=n;n.prototype.getCellHeaderElement=function(a){if(a===0)return a=document.createElement("td"),a.colSpan=2,a.appendChild(document.createTextNode(this.explorer.model.root.Name)),a};n.prototype.getCellElement=function(a,c){if(a===0){var d=document.createElement("td"),e=document.createElement("span");
e.className="discreetInputLabel";e.appendChild(document.createTextNode(c.Name));d.classList.add("discreetInputLabel");d.appendChild(e);d.width="20%";return d}if(a===1){d=document.createElement("td");if(c.Href){var e=document.createElement("a"),f=new i(c.Href);e.href=f.expand({OrionHome:b.getOrionHome()});e.appendChild(document.createTextNode(c.Value||" "));d.appendChild(e)}else d.appendChild(document.createTextNode(c.Value||" "));return d}};q.prototype=new h.ExplorerModel;q.prototype.constructor=
q;q.prototype.getRoot=function(a){return a(this.root)};q.prototype.getChildren=function(a,b){if(a===this.root){var c=[];j.all((a.Dependencies||[]).map(function(b){var d={Dependency:b,Project:a};c.push(d);return this.projectClient.getDependencyFileMetadata(b,a.WorkspaceLocation).then(function(a){g.mixin(d,a)},function(){d.Directory=d.disconnected=!0})}.bind(this))).then(function(){b(c)}.bind(this))}else b([])};q.prototype.getId=function(a){return h.ExplorerModel.prototype.getId.call(this,a.Dependency)};
o.prototype=new h.SelectionRenderer;o.prototype.constructor=o;o.prototype.getCellHeaderElement=function(){};o.prototype.getCellElement=function(a,b,c){if(a===0)return a=document.createElement("td"),b.Location?(a.className="navColumnNoIcon",c=document.createElement("a"),c.href=t.expand({resource:b.Location}),c.appendChild(document.createTextNode(b.Dependency.Name)),a.appendChild(c)):(c=b.Dependency.Name,b.disconnected&&(c+=" (disconnected)"),a.appendChild(document.createTextNode(c))),a;if(a===1)return b=
this.getActionsColumn(b,c,null,null,!0),b.style.textAlign="right",b};p.prototype=new h.ExplorerModel;p.prototype.constructor=p;p.prototype.getRoot=function(a){return a(this.root)};p.prototype.getChildren=function(a,b){if(a===this.root)if(this.launchConfigurations){for(var c=0;c<this.launchConfigurations.length;c++)this.launchConfigurations[c].project=a;this.root.children=this.launchConfigurations;b(this.launchConfigurations)}else this.projectClient.getProjectLaunchConfigurations(a).then(function(c){for(var d=
0;d<c.length;d++)c[d].project=a;a.children=c;b(c)});else b([])};p.prototype.getId=function(a){return"LaunchConfiguration"+h.ExplorerModel.prototype.getId.call(this,{Location:a.Name})};s.prototype=new h.SelectionRenderer;s.prototype.constructor=s;s.prototype.getCellHeaderElement=function(){};s.prototype.getCellElement=function(a,c,d){if(a===0){var e=document.createElement("td");if(c.Name)e.className="secondaryColumnLeft",e.appendChild(document.createTextNode(c.Name));return e}if(a===1){e=document.createElement("td");
if(c.Url){var f=document.createElement("a");f.target="_new";f.href=c.Url.indexOf("://")<0?"http://"+c.Url:c.Url;f.title=c.Url;f.appendChild(document.createTextNode(c.UrlTitle||c.Params.Name||"View App"));e.appendChild(f)}return e}if(a===2)return e=document.createElement("td"),c.ServiceId&&this.projectClient.getProjectDelpoyService(c.ServiceId,c.Type).then(function(a){if(a)if(a.getLogLocationTemplate)a.getLogLocationTemplate(c).then(function(a){if(a){var d=document.createElement("a");d.target="_new";
var a=new i(a),f=g.clone(c.Params);g.mixin(f,{OrionHome:b.getOrionHome()});d.href=a.expand(f);d.appendChild(document.createTextNode("Logs"));e.appendChild(d)}});else if(a.logLocationTemplate){var d=document.createElement("a");d.target="_new";var a=new i(a.logLocationTemplate),f=g.clone(c.Params);g.mixin(f,{OrionHome:b.getOrionHome()});d.href=a.expand(f);d.appendChild(document.createTextNode("Logs"));e.appendChild(d)}}),e;if(a===3){e=document.createElement("td");e.classList.add("secondaryColumnRight");
if(c.status&&c.status.CheckState===!0)delete c.status;else if(c.status)return c.status.error&&c.status.error.Retry?(c.parametersRequested=c.status.error.Retry.parameters,c.optionalParameters=c.status.error.Retry.optionalParameters,this.getActionsColumn(c,d,null,"secondaryColumnRight",!0)):(c.status.error?(f=document.createElement("span"),f.appendChild(document.createTextNode("Error")),f.title=c.status.error.Message):c.status.State==="STARTED"?(f=document.createElement("span"),f.className="imageSprite core-sprite-applicationrunning",
f.title=c.status.Message||"Started"):c.status.State==="STOPPED"?(f=document.createElement("span"),f.className="imageSprite core-sprite-applicationstopped",f.title=c.status.Message||"Stopped"):c.status.State==="NOT_DEPLOYED"?(f=document.createElement("span"),f.className="imageSprite core-sprite-applicationnotdeployed",f.title=c.status.Message||"Not deployed"):c.status.State==="PROGRESS"?(f=document.createElement("span"),f.className="imageSprite core-sprite-progress",f.title="Checking application state"):
(f=document.createElement("span"),f.appendChild(document.createTextNode("State unknown")),f.title=c.status.Message),e.appendChild(f),e);c.ServiceId&&this.projectClient.getProjectDelpoyService(c.ServiceId,c.Type).then(function(b){b&&b.getState?(c.status={State:"PROGRESS"},e.innerHTML=this.getCellElement(a,c,d).innerHTML,b.getState(c.Params).then(function(b){c.status=b;for(var f=this.getCellElement(a,c,d),b=0;b<e.classList.length;b++)f.classList.toggle(e.classList[b],!0);var h=e.previousSibling;d.replaceChild(f,
e);f=this.getCellElement(a-1,c,d);for(b=0;b<h.classList.length;b++)f.classList.toggle(h.classList[b],!0);d.replaceChild(f,h)}.bind(this),function(b){c.status={error:b};for(var f=this.getCellElement(a,c,d),b=0;b<e.classList.length;b++)f.classList.toggle(e.classList[b],!0);var h=e.previousSibling;d.replaceChild(f,e);f=this.getCellElement(a-1,c,d);for(b=0;b<h.classList.length;b++)f.classList.toggle(h.classList[b],!0);d.replaceChild(f,h)}.bind(this))):e.appendChild(document.createTextNode("State unknown"))}.bind(this));
return e}};u.prototype=Object.create(h.Explorer.prototype);g.mixin(u.prototype,{registerCommands:function(){this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.manage",1);this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.deploy",2);this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.startApp",3);this.commandService.registerCommandContribution(this.selectionActions,
"orion.launchConfiguration.stopApp",4)},updateCommands:function(a){this.selectionActionsNode=k.node(this.selectionActions);k.empty(this.selectionActionsNode);this.commandService.renderCommands(this.selectionActions,this.selectionActionsNode,a,this,"tool");k.$$array(".commandLink",this.selectionActionsNode).forEach(function(a){a.target="_new"})},load:function(a,b,c,d){this.createTree(a,new p(b,c,d),{indent:"8px"});this.loaded()},constructor:u});v.prototype={createCommands:function(){this.launchConfigurationDispatcher=
c.getLaunchConfigurationDispatcher();this.dependenciesDisplatcher=c.getDependencyDispatcher();var a=this;this.launchConfigurationListener=function(b){a.launchConfigurationChanged.call(a,b)};this._launchConfigurationEventTypes=["create","delete","changeState"];this._launchConfigurationEventTypes.forEach(function(b){a.launchConfigurationDispatcher.addEventListener(b,a.launchConfigurationListener)});this.dependneciesListener=function(b){a.dependenciesChanged.call(a,b)};this._dependenciesEventTypes=["create",
"delete"];this._dependenciesEventTypes.forEach(function(b){a.dependenciesDisplatcher.addEventListener(b,a.dependneciesListener)});this.commandRegistry.registerCommandContribution(this.dependencyActions,"orion.project.dependency.connect",1);this.commandRegistry.registerCommandContribution(this.dependencyActions,"orion.project.dependency.disconnect",2);this.commandRegistry.registerCommandContribution(this.launchConfigurationActions,"orion.launchConfiguration.checkStatus",1)},changedItem:function(){this.fileClient.read(this.parentFolder.Location,
!0).then(function(a){k.empty(this.node);this.displayContents(this.node,a)}.bind(this))},display:function(a,b){function c(a,b){b=b||{};a.forEach(function(a){var c;switch(a){case "projectInfo":c=document.createElement("span");this.node.appendChild(c);this.renderProjectInfo(c,b[a]);break;case "additionalInfo":c=document.createElement("span");this.node.appendChild(c);this.renderAdditionalProjectProperties(c);break;case "deployment":c=document.createElement("span");this.node.appendChild(c);this.renderLaunchConfigurations(c,
null,b[a]);break;case "dependencies":c=document.createElement("span"),c.id="projectDependenciesNode",this.node.appendChild(c),this.renderDependencies(c,b[a])}}.bind(this))}this.node=a;this.node.className="orionProject";this.projectData=b;var d=["projectInfo","additionalInfo","deployment","dependencies"];this.preferences.getPreferences("/sectionsOrder").then(function(a){d=a.get("projectView")||d;a=a.get("projectViewNames")||[];c.apply(this,[d,a])}.bind(this),function(a){c.apply(this,[d,{}]);window.console.error(a)}.bind(this))},
displayContents:function(a,b){this.parentFolder=b;this.projectClient.readProject(b).then(function(b){this.display.bind(this)(a,b)}.bind(this))},dependenciesChanged:function(a){var b=k.node("projectDependenciesNode");if(b){if(a.project.ContentLocation===this.projectData.ContentLocation)if(a.type==="delete"){if(this.projectData.Dependencies&&a.oldValue)for(var c=0;c<this.projectData.Dependencies.length;c++)this.projectData.Dependencies[c].Location===a.oldValue.Location&&this.projectData.Dependencies.splice(c,
1)}else a.type==="create"&&this.projectData.Dependencies&&a.newValue&&this.projectData.Dependencies.push(a.newValue);k.empty(b);this.renderDependencies(b,this.dependenciesSectionName)}},_renderEditableFields:function(a,b,c,d){var e=function(c){var e={};e[b]=c.target.value;this.progress.progress(this.projectClient.changeProjectProperties(this.projectData,e),"Saving project "+this.projectData.Name).then(function(b){if(b&&(this.projectData=b,a.value=c.target.value,d)){k.empty(d);d.appendChild(document.createTextNode(c.target.value)||
"");d.href=c.target.value;d.style.visibility="";if(d.urlSelector)d.urlSelector.style.visibility="";a.style.visibility="hidden"}}.bind(this))}.bind(this);a.value=this.projectData[b]||"";a.title="Click to edit";a.className="discreetInput";a.tabIndex=String(c);a.onkeyup=function(c){if(c.keyCode===k.KEY.ENTER)a.tagName.toUpperCase()!=="TEXTAREA"&&a.blur();else if(c.keyCode===k.KEY.ESCAPE)a.value=this.projectData[b]||"",a.blur()}.bind(this);a.onblur=function(a){e(a)}},renderProjectInfo:function(b,c){var f=
new e.Section(b,{id:"projectInfoSection",headerClass:["sectionTreeTableHeader"],title:c||"Project Information",canHide:!0}),g=document.createElement("div");g.id="projectInformationNode";var i=new a({checkbox:!1,treeTableClass:"sectionTreeTable",cachePrefix:"ProjectInfoExplorer"},this),i=new h.Explorer(this.serviceRegistry,null,i,this.commandRegistry);f.embedExplorer(i,g);i.createTree(g,new d(this.projectData),{noSelection:!0})},renderAdditionalProjectProperties:function(a){this.projectClient.getMatchingProjectHandlers(this.parentFolder).then(function(b){for(var c=
0;c<b.length;c++){var d=b[c];d&&d.getAdditionalProjectProperties&&this.progress.progress(d.getAdditionalProjectProperties(this.parentFolder,this.projectData),"Getting additional project information").then(function(b){if(b&&b.length&&b.length!==0)for(var c=0;c<b.length;c++){var d=b[c];if(d.Name){var f=new e.Section(a,{id:d.Name+"Section",headerClass:["sectionTreeTableHeader"],title:d.Name,canHide:!0}),g=document.createElement("div"),i=new n({treeTableClass:"sectionTreeTable",checkbox:!1},this),i=new h.Explorer(this.serviceRegistry,
null,i,this.commandRegistry);f.embedExplorer(i,g);i.createTree(g,new m(d),{noSelection:!0})}}}.bind(this))}}.bind(this))},renderDependencies:function(a,b){if(this.projectData.Dependencies&&this.projectData.Dependencies.length!==0){this.dependenciesSectionName=b||"Associated Content";var c=new e.Section(a,{id:"projectDependenciesSection",headerClass:["sectionTreeTableHeader"],title:this.dependenciesSectionName,canHide:!0}),d=document.createElement("div");d.id="dependenciesNode";var f=new o({checkbox:!1,
treeTableClass:"sectionTreeTable",commandRegistry:this.commandRegistry,actionScopeId:this.dependencyActions},this),f=new h.Explorer(this.serviceRegistry,null,f,this.commandRegistry);f.actionScopeId=this.dependencyActions;c.embedExplorer(f,d);f.createTree(d,new q(this.projectData,this.projectClient),{indent:"8px",noSelection:!0})}},renderLaunchConfigurations:function(a,b,c){this.configurationsParent=a;if(b){k.empty(this.configurationsParent);this.launchCofunctionSectionsTitle=c||"Deployment Information";
var d=new e.Section(a,{id:"projectLaunchConfigurationSection",headerClass:["sectionTreeTableHeader"],title:this.launchCofunctionSectionsTitle,canHide:!0}),f=document.createElement("div");f.id="launchConfigurationsNode";var h=new s({checkbox:!1,treeTableClass:"sectionTreeTable",commandRegistry:this.commandRegistry,actionScopeId:this.launchConfigurationActions,projectClient:this.projectClient},this),h=new u(this.serviceRegistry,null,h,this.commandRegistry,this.launchConfigurationActions);d.embedExplorer(h,
f);h.load(f,this.projectData,b,this.projectClient)}else this.projectClient.getProjectLaunchConfigurations(this.projectData).then(function(b){(this.configurations=b)&&b.length!==0&&this.renderLaunchConfigurations(a,b,c)}.bind(this))},launchConfigurationChanged:function(a){if(this.configurations&&(a.type==="create"||a.type==="changeState")&&a.newValue){for(var b=0;b<this.configurations.length;b++){var c=this.configurations[b];if(c.Name===a.newValue.Name&&c.ServiceId===a.newValue.ServiceId){this.configurations[b]=
a.newValue;this.renderLaunchConfigurations(this.configurationsParent,this.configurations,this.launchCofunctionSectionsTitle);return}}a.type==="create"&&(this.configurations.push(a.newValue),this.renderLaunchConfigurations(this.configurationsParent,this.configurations,this.launchCofunctionSectionsTitle))}},destroy:function(){var a=this;this._launchConfigurationEventTypes.forEach(function(b){a.launchConfigurationDispatcher.removeEventListener(b,a.launchConfigurationListener)});this._dependenciesEventTypes.forEach(function(b){a.dependenciesDisplatcher.removeEventListener(b,
a.dependneciesListener)})}};return{ProjectEditor:v}});
define("orion/projects/projectExplorer","i18n!orion/edit/nls/messages,orion/Deferred,orion/URITemplate,orion/webui/littlelib,orion/explorers/explorer,orion/section".split(","),function(i,k,j,g,c,f){function b(a){this._init(a)}function h(a,c,e,f){this.registry=c;this.selection=e;this.commandRegistry=f;this.parentId=a;this.renderer=new b({});this.renderer.explorer=this;this.myTree=null;this.newActionsScope=d;this.actionsSections=[this.newActionsScope];this._init()}var e=new j("../edit/edit.html#{,resource,params*}"),
d="newProjectActions";b.prototype=new c.SelectionRenderer;b.prototype.getCellHeaderElement=function(){return null};b.prototype.emptyCallback=function(a){var b=document.createElement("tr"),c=document.createElement("td");c.colSpan=this.oneColumn?1:3;var d=document.createElement("div");d.classList.add("noFile");d.textContent=i.NoProjects;var e=document.createElement("span");e.appendChild(document.createTextNode(i.File));g.processDOMNodes(d,[e]);c.appendChild(d);b.appendChild(c);a.appendChild(b)};b.prototype.getCellElement=
function(a,b){var c=document.createElement("td");switch(a){case 0:c.className="navColumnNoIcon";var d=document.createElement("a");d.appendChild(document.createTextNode(b.Name));d.href=e.expand({resource:b.ContentLocation});c.appendChild(d);return c;case 1:return c.appendChild(document.createTextNode(!b.Description?" ":b.Description.length>200?b.Description.substring(0,180)+"...":b.Description)),c;case 2:return b.Url?(d=document.createElement("a"),d.appendChild(document.createTextNode(b.Url)),d.href=
b.Url,c.appendChild(d)):c.appendChild(document.createTextNode(" ")),c}return null};h.prototype=Object.create(c.Explorer.prototype);h.prototype._init=function(){var a=new f.Section(g.node(this.parentId),{id:"projectsSection",title:"Projects",canHide:!0}),b=document.createElement("div");b.id="projectsExplorer";a.embedExplorer(this,b)};h.prototype.loadProjects=function(a){this.model=new c.SimpleFlatModel(a,"orion.project.",function(a){if(a.ContentLocation)return a.ContentLocation.replace(/[\\\/]/g,"")});
this.myTree=this.createTree(this.parent,this.model,{indent:"8px",selectionPolicy:this.renderer.selectionPolicy});this.updateCommands()};return{ProjectExplorer:h,newActionsScope:d}});
define("orion/projects/projectView",["orion/projects/projectExplorer","orion/selection","orion/URITemplate","orion/webui/littlelib","orion/fileCommands"],function(i,k,j,g,c){function f(b){this.progress=b.progress;this.fileClient=b.fileClient;this.serviceRegistry=b.serviceRegistry;this.commandRegistry=b.commandRegistry;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.modelEventDispatcher=c.getModelEventDispatcher();var e=this;this.modelListener=function(b){e.changedItemEvent.call(e,
b)};this._eventTypes=["copy","create","delete","import","move"];this._eventTypes.forEach(function(b){e.modelEventDispatcher.addEventListener(b,e.modelListener)})}var b=new j("#{,resource,params*}");f.prototype={display:function(b,c){c.classList.add("orionProject");this.projectExplorer=new i.ProjectExplorer(c,this.serviceRegistry,new k.Selection(this.serviceRegistry),this.commandRegistry);this.changedItem(b)},setCommandsVisible:function(b){this.projectExplorer&&this.projectExplorer.setCommandsVisible.call(this.projectExplorer,
b)},changedItemEvent:function(b){b.parent&&this.workspace&&b.parent.Location===this.workspace.Location&&this.projects&&this._handleChangedEvent(b.oldValue,b.newValue)},_handleChangedEvent:function(b,c){var d=this;if(b&&b.ContentLocation&&!b.Children&&!b.ChildrenLocation)this.fileClient.loadWorkspace(b.ContentLocation).then(function(a){d._handleChangedEvent(a,c)});else if(c&&c.ContentLocation&&!c.Children&&!c.ChildrenLocation)this.fileClient.loadWorkspace(c.ContentLocation).then(function(a){d._handleChangedEvent(b,
a)});else if(c)this.projectClient.readProject(c,this.workspace).then(function(a){if(b)for(var c=0;c<d.projects.length;c++){if(b.Location===d.projects[c].ContentLocation){a?d.projects[c]=a:d.projects.splice(c,1);d.projectExplorer.loadProjects(d.projects);break}}else a&&(d.projects.push(a),d.projectExplorer.loadProjects(d.projects))});else if(b)for(var a=0;a<d.projects.length;a++)if(b.Location===d.projects[a].ContentLocation){d.projects.splice(a,1);d.projectExplorer.loadProjects(d.projects);break}},
changedItem:function(c,e,d){var a=this;d==="created"&&c.ContentLocation?window.location=b.expand({resource:c.ContentLocation}):c?a.progress.progress(a.projectClient.readAllProjects(c),"Listing projects").then(function(b){a.workspace=c;a.projects=b;a.projectExplorer.loadProjects(b)}):a.progress.progress(a.fileClient.loadWorkspace(),"Getting workspace information").then(function(b){a.progress.progress(a.projectClient.readAllProjects(c),"Listing projects").then(function(c){a.workspace=b;a.projects=c;
a.projectExplorer.loadProjects(c)})})},destroy:function(){var b=this;this._eventTypes.forEach(function(c){b.modelEventDispatcher.removeEventListener(c,b.modelListener)})}};return{ProjectView:f}});
define("orion/folderView","i18n!orion/edit/nls/messages,orion/globalCommands,orion/explorers/explorer-table,orion/explorers/navigatorRenderer,orion/selection,orion/fileCommands,orion/markdownView,orion/projects/projectEditor,orion/PageUtil,orion/URITemplate,orion/webui/littlelib,orion/objects,orion/Deferred,orion/projects/projectView,orion/section".split(","),function(i,k,j,g,c,f,b,h,e,d,a,m,n,q,o){function p(){t.apply(this,arguments)}function s(b){b.setFocus=!1;b.cachePrefix=null;b.dragAndDrop=f.uploadFile;
b.modelEventDispatcher=f.getModelEventDispatcher();b.rendererFactory=function(a){return new p({checkbox:!1,treeTableClass:"sectionTreeTable",cachePrefix:"FolderNavigator"},a,b.commandRegistry,b.contentTypeRegistry)};v.apply(this,arguments);this.menuBar=b.menuBar;this.serviceRegistry=b.serviceRegistry;this.fileClient=b.fileClient;this.commandRegistry=b.commandRegistry;this.contentTypeRegistry=b.contentTypeRegistry;this.editorInputManager=b.editorInputManager;this.readonly=b.readonly;this.breadCrumbMaker=
b.breadCrumbMaker;this.clickHandler=b.clickHandler;this.treeRoot={};this.parent=a.node(b.parentId)}function u(a){this._parent=a.parent;this._metadata=a.metadata;this.menuBar=a.menuBar;this.fileClient=a.fileService;this.progress=a.progressService;this.serviceRegistry=a.serviceRegistry;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.editorInputManager=a.inputManager;this.preferences=a.preferences;this.readonly=a.readonly===void 0?!1:a.readonly;this.showProjectView=
a.showProjectView===void 0?!0:a.showProjectView;this.showFolderNav=!0;this.editorView=a.editorView;this._maxEditorHeight=a.maxEditorHeight;this.imageView=a.imageView;this.breadCrumbMaker=a.breadCrumbMaker;this.clickHandler=a.clickHandler;this._init()}var v=j.FileExplorer,t=g.NavigatorRenderer,w=new d("#{,resource,params*}");p.prototype=Object.create(t.prototype);m.mixin(p.prototype,{showFolderImage:!0,createFolderNode:function(a){var b=g.NavigatorRenderer.prototype.createFolderNode.call(this,a);if(this.showFolderLinks&&
b.tagName==="A")b.href=w.expand({resource:a.Location});b.classList.add("folderNavFolder");b.classList.add("navlink");b.classList.add("targetSelector");b.classList.remove("navlinkonpage");if(this.explorer.readonly&&this.explorer.clickHandler)b.href="javascript:void(0)",b.addEventListener("click",function(){this.explorer.clickHandler(a.Location)}.bind(this),!1);b.addEventListener("click",function(){this.explorer.editorInputManager.cachedMetadata=a}.bind(this),!1);return b},updateFileNode:function(a,
b,c){g.NavigatorRenderer.prototype.updateFileNode.call(this,a,b,c);b.addEventListener("click",function(){this.explorer.editorInputManager.cachedMetadata=a}.bind(this),!1);if(this.explorer.readonly&&b.tagName==="A")this.explorer.clickHandler?(b.href="javascript:void(0)",b.addEventListener("click",function(){this.explorer.clickHandler(a.Location)}.bind(this),!1)):b.href=w.expand({resource:a.Location})},getCellHeaderElement:function(a){if(this.explorer.breadCrumbMaker)return null;if(a===0){a=document.createElement("th");
a.colSpan=1;var b=this.explorer.treeRoot;a.appendChild(document.createTextNode(b.Parents?b.Name:this.explorer.fileClient.fileServiceName(b.Location)));return a}return null},emptyCallback:function(a){this.explorer.readonly||g.NavigatorRenderer.prototype.emptyCallback.call(this,a)},getExpandImage:function(){return null}});s.prototype=Object.create(v.prototype);m.mixin(s.prototype,{loadRoot:function(a){a?this.load(a,"Loading "+a.Name).then(this.loaded.bind(this)):this.loadResourceList(e.matchResourceParameters().resource+
"?depth=1",!1).then(this.loaded.bind(this))},isCommandsVisible:function(){if(!this.selection)return!1;var a=k.getMainSplitter();return a?a.splitter.isClosed():!this.readonly},scope:function(a){window.location.href=w.expand({resource:a})},scopeUp:function(){var a=this.treeRoot,b=a.Parents&&a.Parents[0];this.scope(b?b.ChildrenLocation:this.fileClient.fileServiceRootURL(a.Location))},scopeDown:function(a){this.scope(a.ChildrenLocation)},registerCommands:function(){return(new n).resolve()},updateCommands:function(){this.menuBar&&
(this.menuBar.setActiveExplorer(this),this.menuBar.updateCommands())}});u.prototype={_init:function(){if(this.serviceRegistry&&this.serviceRegistry.getServiceReferences("orion.projects").length===0)this.showProjectView=!1;this.markdownView=new b.MarkdownView({fileClient:this.fileClient,canHide:!this.readonly,progress:this.progress});if(this.showProjectView)this.projectEditor=new h.ProjectEditor({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry,
preferences:this.preferences}),this.projectView=new q.ProjectView({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry});if(k.getMainSplitter())k.getMainSplitter().splitter.addEventListener("toggle",this._splitterToggleListener=function(a){[this.markdownView,this.projectEditor,this.projectView,this.folderNavExplorer].forEach(function(b){b&&b.setCommandsVisible&&b.setCommandsVisible(a.closed)})}.bind(this))},_isCommandsVisible:function(){var a=
k.getMainSplitter();return a?a.splitter.isClosed():!this.readonly},displayWorkspaceView:function(){if(!this._node)this._node=document.createElement("div");this._parent.appendChild(this._node);if(this.showProjectView){var a=document.createElement("div");this._node.appendChild(a);this.projectView.display(this._metadata,a);this.projectView.setCommandsVisible(this._isCommandsVisible())}},displayFolderView:function(b){function c(b,f){b.forEach(function(b){if(b==="project")d&&this.showProjectView&&(g=document.createElement("div"),
this.projectEditor.displayContents(g,this._metadata),this._node.appendChild(g));else if(b==="folderNav"){if(this.showFolderNav){var c=document.createElement("div");c.id="folderNavNode";b=new o.Section(this._node,{id:"folderNavSection",headerClass:["sectionTreeTableHeader"],title:f[b]||"Files",canHide:!this.readonly});if(this.editorView){b.setContent(this.editorView.getParent());this.editorView.create();var h=this.editorView.editor.getTextView();h.getModel().addEventListener("Changed",this._editorViewModelChangedListener=
function(){var a=h.getLineHeight()*h.getModel().getLineCount()+20;if(this._maxEditorHeight&&this._maxEditorHeight>0&&a>this._maxEditorHeight)a=this._maxEditorHeight;this.editorView.getParent().style.height=a+"px"}.bind(this));this.editor=this.editorView.editor}else this.imageView?b.setContent(this.imageView.image):(this.folderNavExplorer=new s({parentId:c,view:this,readonly:this.readonly,menuBar:this.menuBar,breadCrumbMaker:this.breadCrumbMaker,clickHandler:this.clickHandler,serviceRegistry:this.serviceRegistry,
fileClient:this.fileClient,editorInputManager:this.editorInputManager,commandRegistry:this.commandRegistry,contentTypeRegistry:this.contentTypeRegistry}),b.embedExplorer(this.folderNavExplorer),this.folderNavExplorer.setCommandsVisible(this._isCommandsVisible()),this.folderNavExplorer.loadRoot(this._metadata));if(this.breadCrumbMaker&&(c=b.getTitleElement())){a.empty(c);var i=document.createElement("div");c.appendChild(i);this.breadCrumbMaker(i,b.getHeaderElement().offsetWidth-24)}}}else b==="readme"&&
e&&(g=document.createElement("div"),this.markdownView.displayInFrame(g,e,["sectionTreeTableHeader"],null,f[b]),this._node.appendChild(g))}.bind(this))}var b=b.Children,d,e;if(b)for(var f=0;f<b.length;f++){var h=b[f];!h.Directory&&h.Name==="project.json"&&(d=h);!h.Directory&&h.Name&&h.Name.toLowerCase()==="readme.md"&&(e=h)}var g;if(!this._node)this._node=document.createElement("div");this._parent.appendChild(this._node);var i=["project","folderNav","readme"],j={};this.editorView?c.apply(this,[i,j]):
this.preferences?this.preferences.getPreferences("/sectionsOrder").then(function(a){j=a.get("folderViewNames")||j;i=a.get("folderView")||i;c.apply(this,[i,j])}.bind(this),function(a){c.apply(this,[i,j]);window.console.error(a)}.bind(this)):c.apply(this,[i,j])},create:function(){this._metadata.Projects&&this.displayWorkspaceView();this.editorView||this.imageView?this.displayFolderView(this._metadata):this._metadata.Children?this.displayFolderView(this._metadata):this._metadata.ChildrenLocation&&this.progress.progress(this.fileClient.fetchChildren(this._metadata.ChildrenLocation),
"Fetching children of "+this._metadata.Name).then(function(a){this._metadata.Children=a;this.displayFolderView(this._metadata)}.bind(this))},destroy:function(){if(this.editorView)this.editorView.editor.getTextView().getModel().removeEventListener("Changed",this._editorViewModelChangedListener),this.editorView.destroy(),this.editor=null;var a=k.getMainSplitter();a&&a.splitter.removeEventListener("toggle",this._splitterToggleListener);this.folderNavExplorer&&this.folderNavExplorer.destroy();this.folderNavExplorer=
null;this._node&&this._node.parentNode&&this._node.parentNode.removeChild(this._node);this.projectView&&this.projectView.destroy();this.projectEditor&&this.projectEditor.destroy();this._node=null}};return{FolderView:u}});
define("orion/editor/find","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/annotations,orion/regex,orion/objects,orion/util".split(","),function(i,k,j,g,c,f,b){function h(a){var b=a.getTextView();j.KeyMode.call(this,b);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";b.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));b.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var d=this;this._listener={onVerify:function(a){var b=d.editor,e=b.getModel(),f=b.mapOffset(a.start),b=b.mapOffset(a.end),e=e.getText(f,b);if((e=d._prefix.match(RegExp("^"+c.escape(e),"i")))&&e.length>0)d._prefix+=a.text,d._success=!0,d._status(),d.find(d._forward,!0),a.text=null},onSelection:function(){d._ignoreSelection||d.setActive(!1)}}}function e(a,b,c){if(a){this._editor=a;this._undoStack=b;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental=
!0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var d=this;this._listeners={onEditorFocus:function(a){d._removeCurrentAnnotation(a)}};this.setOptions(c)}}var d={};h.prototype=new j.KeyMode;f.mixin(h.prototype,{createKeyBindings:function(){var a=k.KeyBinding,b=[];b.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});b.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});b.push({actionID:"incrementalFindCancel",
keyBinding:new a(27)});b.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});b.push({actionID:"incrementalFind",keyBinding:new a(40)});b.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});b.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return b},find:function(a,b){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var c=this._prefix;if(c.length===0)return!1;var d=this.editor,e=d.getModel(),e=a?this._success?b?this._start:d.getCaretOffset()+
1:0:this._success?b?this._start:d.getCaretOffset():e.getCharCount()-1;if(c=d.getModel().find({string:c,start:e,reverse:!a,caseInsensitive:c.toLowerCase()===c}).next()){if(!b)this._start=e;this._ignoreSelection=this._success=!0;d.moveSelection(a?c.start:c.end,a?c.end:c.start);this._ignoreSelection=!1}else this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){if(this._active!==a)this._active=a,this._prefix=
"",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status()},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0,
a.length-1);return a.length===0?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?i.incrementalFindStr:i.incrementalFindStrNotFound:this._success?i.incrementalFindReverseStr:i.incrementalFindReverseStrNotFound;a=b.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
d.IncrementalFind=h;e.prototype={find:function(a,b,c){this.setOptions({reverse:!a});var d=this.getFindString(),e;if(b)d=b.findString||d,e=b.count;a=this.getOptions();this.setOptions(b);b=c?this._startOffset:this.getStartOffset();if((e=this._doFind(d,b,e))&&!c)this._startOffset=e.start;this.setOptions(a);this._hideAfterFind&&this.hide();return e},getStartOffset:function(){return this._start!==void 0?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var a=
this._editor.getSelection(),a=this._editor.getText(a.start,a.end);this._regex&&(a=c.escape(a));return a||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},
hide:function(){this._visible=!1;if(this._savedOptions&&(this.setOptions(this._savedOptions.pop()),this._savedOptions.length===0))this._savedOptions=null;this._removeAllAnnotations();var a=this._editor.getTextView();a&&(a.removeEventListener("Focus",this._listeners.onEditorFocus),a.focus())},_processReplaceString:function(a){var b=a;if(this._regex){for(var b="",c=!1,d=this._editor.getModel().getLineDelimiter(),e=0;e<a.length;e++){var f=a.substring(e,e+1);if(c){switch(f){case "R":b+=d;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+f}c=!1}else f==="\\"?c=!0:b+=f}c&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,c=this._processReplaceString(this.getReplaceString()),d=b.getSelection().start;if(b=b.getModel().find({string:a,start:d,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,c),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var c=this._editor,d=c.getTextView();c.reportStatus(i.replaceAll);var e=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var h=0,g=0;;){var j=f._doFind(a,h,null,!0);if(!j)break;g++;g===1&&(d.setRedraw(!1),f.startUndo());f._doReplace(j.start,j.end,a,e);h=f.getStartOffset()}g>
0&&(f.endUndo(),d.setRedraw(!0));h>0?c.reportStatus(b.formatMessage(i.replacedMatches,g)):c.reportStatus(i.nothingReplaced,"error");f._replacingAll=!1},100)}},setOptions:function(a){if(a){if((a.showAll===!0||a.showAll===!1)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(g.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(a.caseInsensitive===!0||a.caseInsensitive===!1)this._caseInsensitive=
a.caseInsensitive;if(a.wrap===!0||a.wrap===!1)this._wrap=a.wrap;if(a.wholeWord===!0||a.wholeWord===!1)this._wholeWord=a.wholeWord;if(a.incremental===!0||a.incremental===!1)this._incremental=a.incremental;if(a.regex===!0||a.regex===!1)this._regex=a.regex;if(a.findAfterReplace===!0||a.findAfterReplace===!1)this._findAfterReplace=a.findAfterReplace;if(a.hideAfterFind===!0||a.hideAfterFind===!1)this._hideAfterFind=a.hideAfterFind;if(a.reverse===!0||a.reverse===!1)this._reverse=a.reverse;if(a.hasOwnProperty("findCallback"))this._findCallback=
a.findCallback;if(a.hasOwnProperty("start"))this._start=a.start;if(a.hasOwnProperty("end"))this._end=a.end}},show:function(a){this._visible=!0;if(a){if(!this._savedOptions)this._savedOptions=[];this._savedOptions.push(this.getOptions());this.setOptions(a)}this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var b=this;window.setTimeout(function(){b._incremental&&b.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(a,b,c){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:c?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,c,d){var c=c||1,e=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var f,h;if(this._regex)try{h=this._find(a,b,d)}catch(j){e.reportStatus(j.message,
"error");return}else h=this._find(a,b,d);for(a=0;a<c&&h.hasNext();a++)f=h.next();if(!this._replacingAll){f?this._editor.reportStatus(""):this._editor.reportStatus(i.notFound,"error");if(this.isVisible()){c=g.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(h=e.getAnnotationModel())h.removeAnnotations(c),f&&h.addAnnotation(g.AnnotationType.createAnnotation(c,f.start,f.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var k=this;this._timer=window.setTimeout(function(){k._markAllOccurrences();
k._timer=null},500)}}this._findCallback?this._findCallback(f):f&&e.moveSelection(f.start,f.end,null,!1)}return f},_doReplace:function(a,b,c,d){var e=this._editor;if(this._regex&&(d=e.getText(a,b).replace(RegExp(c,this._caseInsensitive?"i":""),d),!d))return;e.setText(d,a,b);e.setSelection(a,a+d.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=g.AnnotationType.ANNOTATION_MATCHING_SEARCH,c=a.getAnnotations(),d=[],e;c.hasNext();){var f=c.next();f.type===
b&&d.push(f)}if(this.isVisible()){c=this.getFindString();c=this._editor.getModel().find({string:c,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(e=[];c.hasNext();)f=c.next(),e.push(g.AnnotationType.createAnnotation(b,f.start,f.end))}a.replaceAnnotations(d,e)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(g.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(g.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(){var a=this._editor.getAnnotationModel();a&&a.removeAnnotations(g.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};d.Find=e;return d});
define("orion/editor/actions","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/annotations,orion/editor/tooltip,orion/editor/find,orion/util".split(","),function(i,k,j,g,c,f){function b(a,b,d){this.editor=a;this.undoStack=b;this._incrementalFind=new c.IncrementalFind(a);this._find=d?d:new c.Find(a,b);this._lastEditLocation=null;this.init()}function h(a,b,c,d){this.editor=a;this.undoStack=b;this.contentAssist=c;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var e=j.AnnotationType,d={};b.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){if(this.editor.isDirty())this._lastEditLocation=a.start+a.addedCharCount}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(a){if(this.undoStack){var b=1;if(a&&a.count)b=a.count;for(;b>0;)this.undoStack.undo(),--b;return!0}return!1}.bind(this),
{name:i.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;if(a&&a.count)b=a.count;for(;b>0;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:i.redo});a.setKeyBinding(new k.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(i.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:i.find});a.setKeyBinding(new k.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?
(this._find.find(!0,a),!0):!1}.bind(this),{name:i.findNext});a.setKeyBinding(new k.KeyBinding("k",!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:i.findPrevious});a.setKeyBinding(new k.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:i.incrementalFind});a.setKeyBinding(new k.KeyBinding("j",!0,!0),"incrementalFindReverse");
a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:i.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:i.unindentLines});a.setKeyBinding(new k.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:i.moveLinesUp});a.setKeyBinding(new k.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:i.moveLinesDown});a.setKeyBinding(new k.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:i.copyLinesUp});a.setKeyBinding(new k.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:i.copyLinesDown});a.setKeyBinding(new k.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:i.deleteLines});a.setKeyBinding(new k.KeyBinding("l",!f.isMac,!1,!1,f.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:i.gotoLine});a.setKeyBinding(new k.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:i.nextAnnotation});a.setKeyBinding(new k.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:i.prevAnnotation});a.setKeyBinding(new k.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:i.expand});a.setKeyBinding(new k.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:i.collapse});a.setKeyBinding(new k.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:i.expandAll});a.setKeyBinding(new k.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:i.collapseAll});a.setKeyBinding(new k.KeyBinding("q",!f.isMac,!1,!1,f.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:i.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=b.getLineStart(d),d=b.getLineEnd(c,!0),f=b.getLineCount(),h="",e=b.getText(e,d);c===f-1&&(e=(h=b.getLineDelimiter())+e);a.setText(e,d,d);a.setSelection(d+h.length,d+e.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-
1:c.end),d=b.getLineStart(d),e=b.getLineEnd(c,!0),f=b.getLineCount(),h="",e=b.getText(d,e);c===f-1&&(e+=h=b.getLineDelimiter());a.setText(e,d,d);a.setSelection(d,d+e.length-h.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=1;if(a&&a.count)c=a.count;var d=b.getSelection(),e=b.getModel(),f=e.getLineAtOffset(d.start),a=e.getLineStart(f),c=d.start!==d.end||c===1?e.getLineAtOffset(d.end>d.start?d.end-1:d.end):Math.min(f+c-1,e.getLineCount()-
1),c=e.getLineEnd(c,!0);b.setText("",a,c);return!0},expandAnnotation:function(a){var b=this.editor,c=b.getAnnotationModel();if(!c)return!0;var d=b.getModel(),e=b.getCaretOffset(),f=d.getLineAtOffset(e),e=d.getLineStart(f),f=d.getLineEnd(f,!0);d.getBaseModel&&(e=d.mapOffset(e),f=d.mapOffset(f),d.getBaseModel());for(var h,c=c.getAnnotations(e,f);!h&&c.hasNext();)d=c.next(),d.type===j.AnnotationType.ANNOTATION_FOLDING&&(h=d);h&&a!==h.expanded&&(a?h.expand():(b.setCaretOffset(h.start),h.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,c=b.getTextView(),d=b.getAnnotationModel();if(!d)return!0;b.getModel();d=d.getAnnotations();for(c.setRedraw(!1);d.hasNext();)b=d.next(),b.type===j.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());c.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),
f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end);if(e!==f){var h=[];h.push("");for(var g=e;g<=f;g++)h.push(c.getLine(g,!0));g=c.getLineStart(e);c=c.getLineEnd(f,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(h.join(b),g,c);a.setSelection(g===d.start?d.start:d.start+b.length,d.end+(f-e+1)*b.length);return!0}return!1}},gotoLastEdit:function(){typeof this._lastEditLocation==="number"&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=
this.editor,b=a.getModel().getLineAtOffset(a.getCaretOffset());if(b=prompt(i.gotoLinePrompty,b+1))b=parseInt(b,10),a.onGotoLine(b-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),e=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount();if(e===f-1)return!0;var d=b.getLineStart(d),c=b.getLineEnd(e,!0),h=b.getLineEnd(e+1,!0)-(c-d),g=0;e!==f-2?b=b.getText(d,c):(e=b.getLineEnd(e),
b=b.getText(e,c)+b.getText(d,e),g+=c-e);this.startUndo();a.setText("",d,c);a.setText(b,h,h);a.setSelection(h+g,h+g+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start);if(d===0)return!0;var e=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineCount(),c=b.getLineStart(d-1),h=b.getLineStart(d),g=b.getLineEnd(e,!0),i=b.getText(h,g),j=0;e===f-1&&(e=b.getLineEnd(d-
1),d=b.getLineEnd(d-1,!0),i+=b.getText(e,d),h=e,j=d-e);this.startUndo();a.setText("",h,g);a.setText(i,c,c);a.setSelection(c,c+i.length-j);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===e.ANNOTATION_MATCHING_BRACKET||a.type===e.ANNOTATION_CURRENT_BRACKET||!f.isAnnotationTypeVisible(a.type)}var c=this.editor,d=c.getAnnotationModel();if(!d)return!0;var f=c.getOverviewRuler()||c.getAnnotationStyler();if(!f)return!0;for(var h=c.getModel(),i=c.getCaretOffset(),
j=d.getAnnotations(a?i:0,a?h.getCharCount():i),k=null;j.hasNext();){var t=j.next();if(a){if(t.start<=i)continue}else if(t.start>=i)continue;if(!b(t)&&(k=t,a))break}if(k){for(var w=[k],j=d.getAnnotations(k.start,k.start);j.hasNext();)t=j.next(),t!==k&&!b(t)&&w.push(t);var l=c.getTextView(),r=h.getLineAtOffset(k.start),y=g.Tooltip.getTooltip(l);if(!y)return c.moveSelection(k.start),!0;c.moveSelection(k.start,k.start,function(){y.setTarget({getTooltipInfo:function(){var a=l.convert({x:l.getLocationAtOffset(k.start).x,
y:l.getLocationAtOffset(h.getLineStart(r)).y},"document","page");return{contents:w,x:a.x,y:a.y+Math.floor(l.getLineHeight(r)*1.33)}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=b.getOptions("tabSize"),g=Array(h+1).join(" "),i=[],j=b=0,k=e;k<=f;k++){var l=c.getLine(k,!0);if(c.getLineStart(k)!==
c.getLineEnd(k))if(l.indexOf("\t")===0)l=l.substring(1),b++;else if(l.indexOf(g)===0)l=l.substring(h),b+=h;else return!0;k===e&&(j=b);i.push(l)}e=c.getLineStart(e);h=c.getLineEnd(f,!0);c=c.getLineStart(f);a.setText(i.join(""),e,h);f=e===d.start?d.start:d.start-j;d=Math.max(f,d.end-b+(d.end===c+1&&d.start!==d.end?1:0));a.setSelection(f,d);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};d.TextActions=
b;h.prototype={init:function(){var a=this.editor.getTextView();a.setAction("lineStart",function(){return this.lineStart()}.bind(this));a.setAction("enter",function(){return this.autoIndent()}.bind(this));a.setKeyBinding(new k.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:i.trimTrailingWhitespaces});a.setKeyBinding(new k.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:i.toggleLineComment});a.setKeyBinding(new k.KeyBinding(191,!0,!f.isMac,!1,f.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:i.addBlockComment});a.setKeyBinding(new k.KeyBinding(220,!0,!f.isMac,!1,f.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:i.removeBlockComment});a.setKeyBinding(new k.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new k.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new k.KeyBinding("<",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("<",">")}.bind(this));
a.setKeyBinding(new k.KeyBinding(">",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket(">")}.bind(this));a.setKeyBinding(new k.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new k.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",function(){return this.skipClosingBracket(")")}.bind(this));
a.setKeyBinding(new k.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new k.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new k.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",function(){return this.autoPairQuotations("'")}.bind(this));
a.setKeyBinding(new k.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation");a.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this));a.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;var c=a.getSelection();if(c.start===c.end){for(var d=a.getModel(),e=d.getLineAtOffset(c.start),f=d.getLine(e,!1),h=d.getLineStart(e),g=0,i=c.start-
h,j;g<i&&((j=f.charCodeAt(g))===32||j===9);)g++;var h=f.substring(0,g),b=b.getOptions("tabSize","expandTab"),k=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=d.getLineDelimiter(),l=/^[\s]*\/\*[\*]*[\s]*$/,r=/^[\s]*\*/,y=/\*\/[\s]*$/,x=f.substring(0,i),z=f.substring(i),E;if(this.smartIndentation&&f.charCodeAt(E=x.trimRight().length-1)===123)return d=i-E-1,z=z.length-z.trimLeft().length,f=f.charCodeAt(i+z)===125?b+h+k+b+h:b+h+k,a.setText(f,c.start-d,c.end+z),a.setCaretOffset(c.start+b.length+h.length+
k.length-d),!0;else if(this.autoCompleteComments&&!y.test(x)&&(l.test(x)||r.test(x))){if(g=l.exec(x)){f=b+h+" * ";f+=y.test(z)?z.substring(0,z.length-2).trim():z.trim();if(d.getLineCount()===e+1||!r.test(d.getLine(e+1)))f+=b+h+" */";a.setText(f,c.start,c.end+z.length);a.setCaretOffset(c.start+b.length+h.length+3);return!0}if(g=r.exec(x))for(e-=1;e>=0;e--)if(g=d.getLine(e,!1),l.test(g))return y.test(z)||f.charCodeAt(i)===47?(f=b+h+"*"+z,h=c.start+b.length+h.length+1):(f=b+h+"* "+z,h=c.start+b.length+
h.length+2),a.setText(f,c.start,c.end+z.length),a.setCaretOffset(h),!0;else if(!r.test(g))break}else if(y.test(x)&&h.charCodeAt(h.length-1)===32)return f=b+h.substring(0,h.length-1),a.setText(f,c.start,c.end),a.setCaretOffset(c.start+f.length),!0;else if(g>0){for(g=i;g<f.length&&((j=f.charCodeAt(g++))===32||j===9);)c.end++;a.setText(d.getLineDelimiter()+h,c.start,c.end);return!0}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),
c=a.getSelection(),d=this._findEnclosingComment(b,c.start,c.end);if(d.commentStart!==void 0&&d.commentEnd!==void 0)return!0;b=b.getText(c.start,c.end);if(b.length===0)return!0;var d=b.length,b=b.replace(/\/\*|\*\//g,""),e=b.length;a.setText("/*"+b+"*/",c.start,c.end);a.setSelection(c.start+2,c.end+2+(e-d));return!0},autoPairBrackets:function(a,b){if(a==="["&&!this.autoPairSquareBrackets)return!1;else if(a==="{"&&!this.autoPairBraces)return!1;else if(a==="("&&!this.autoPairParentheses)return!1;else if(a===
"<"&&!this.autoPairAngleBrackets)return!1;var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),e=c.getModel(),f=c.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),h=/^$|[)}\]>]/;if(d.start===d.end&&h.test(f))return c.setText(a+b,d.start,d.start),c.setCaretOffset(d.start+1),!0;else if(d.start!==d.end)return e=e.getText(d.start,d.end),c.setText(a+e+b,d.start,d.end),c.setSelection(d.start+1,d.end+1),!0;return!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;
var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel(),e=b.getCaretOffset(),f=e===0?"":d.getText(c.start-1,c.start).trim(),h=e===d.getCharCount()?"":d.getText(c.start,c.start+1).trim(),e=/^"$|^'$/,g=/\w/,i=/^$|[)}\]>]/;if(c.start!==c.end){d=d.getText(c.start,c.end);if(e.test(d))return!1;b.setText(a+d+a,c.start,c.end);b.setSelection(c.start+1,c.end+1)}else if(h===a)b.setCaretOffset(c.start+1);else if(f===a||e.test(h)||g.test(f)||!i.test(h))return!1;
else b.setText(a+a,c.start,c.start),b.setCaretOffset(c.start+1);return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&a.positions.length>0&&this.linkedMode){for(var b=[],c=0;c<a.positions.length;++c)b[c]={positions:[{offset:a.positions[c].offset,length:a.positions[c].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&a.groups.length>0&&this.linkedMode?this.linkedMode.enterLinkedMode({groups:a.groups,escapePosition:a.escapePosition}):
a.escapePosition&&this.editor.getTextView().setCaretOffset(a.escapePosition);return!0},deletePrevious:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getSelection();if(b.start!==b.end)return!1;var c=a.getModel(),d=a.getCaretOffset(),e=d===0?"":c.getText(b.start-1,b.start),c=d===c.getCharCount()?"":c.getText(b.start,b.start+1);(e==="("&&c===")"||e==="["&&c==="]"||e==="{"&&c==="}"||e==="<"&&c===">"||e==='"'&&c==='"'||e==="'"&&c==="'")&&a.setText("",b.start,b.start+
1);return!1},_findEnclosingComment:function(a,b,c){var d=a.getLineAtOffset(b),e=a.getLineAtOffset(c),f,h,g,i,j,k;for(f=d;f>=0;f--)if(h=a.getLine(f),g=f===d?b-a.getLineStart(d):h.length,i=h.lastIndexOf("/*",g),h=h.lastIndexOf("*/",g),h>i)break;else if(i!==-1){j=a.getLineStart(f)+i;break}for(f=e;f<a.getLineCount();f++)if(h=a.getLine(f),g=f===e?c-a.getLineStart(e):0,i=h.indexOf("/*",g),h=h.indexOf("*/",g),i!==-1&&i<h)break;else if(h!==-1){k=a.getLineStart(f)+h;break}return{commentStart:j,commentEnd:k}},
lineStart:function(){for(var a=this.editor,b=a.getModel(),c=a.getCaretOffset(),d=b.getLineAtOffset(c),e=b.getLineStart(d),b=b.getLine(d),d=0;d<b.length;d++){var f=b.charCodeAt(d);if(!(f===32||f===9))break}d+=e;return c!==d?(a.setSelection(d,d),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getText(c.start,c.end),e,f,h;for(h=0;h<d.length;h++)if(d.substring(h,h+2)==="/*"){e=c.start+h;break}for(;h<d.length;h++)if(d.substring(h,
h+2)==="*/"){f=c.start+h;break}if(e!==void 0&&f!==void 0)a.setText(b.getText(e+2,f),e,f+2),a.setSelection(e,f);else{d=this._findEnclosingComment(b,c.start,c.end);if(d.commentStart===void 0||d.commentEnd===void 0)return!0;b=b.getText(d.commentStart+2,d.commentEnd);a.setText(b,d.commentStart,d.commentEnd+2);a.setSelection(c.start-2,c.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),
e=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=!0,h=[],g,i,j=d;j<=e;j++)if(g=b.getLine(j,!0),h.push(g),!f||(i=g.indexOf("//"))===-1)f=!1;else if(i!==0){var k;for(k=0;k<i;k++)if(f=g.charCodeAt(k),!(f===32||f===9))break;f=k===i}j=b.getLineStart(d);k=b.getLineEnd(e,!0);if(f){for(f=0;f<h.length;f++)g=h[f],i=g.indexOf("//"),h[f]=g.substring(0,i)+g.substring(i+2);h=h.join("");g=b.getLineStart(e);b=j===c.start?c.start:c.start-2;c=c.end-2*(e-d+1)+(c.end===g+1?2:0)}else h.splice(0,0,""),h=h.join("//"),
b=j===c.start?c.start:c.start+2,c=c.end+2*(e-d+1);a.setText(h,j,k);a.setSelection(b,c);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),c=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var d=/(\s+$)/,e=b.getLineCount(),f=0;f<e;f++){var h=b.getLine(f),g=d.exec(h);if(g){var i=b.getLineStart(f),h=g[0].length,g=i+g.index;b.setText("",g,g+h);if(c.start>g)c.start=Math.max(g,c.start-h);if(c.start!==c.end&&c.end>g)c.end=Math.max(g,c.end-
h)}}a.getUndoStack().endCompoundChange();a.getTextView().setRedraw(!0);a.setSelection(c.start,c.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel();return(b.getCaretOffset()===d.getCharCount()?"":d.getText(c.start,c.start+1))===a?(b.setCaretOffset(c.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},
setAutoPairParentheses:function(a){this.autoPairParentheses=a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setSmartIndentation:function(a){this.smartIndentation=a}};d.SourceCodeActions=h;if(!String.prototype.trimLeft)String.prototype.trimLeft=
function(){return this.replace(/^\s+/g,"")};if(!String.prototype.trimRight)String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")};return d});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(i,k,j,g){function c(b,a,c,e){this._location=a||"left";this._overview=c||"page";this._rulerStyle=e;this._view=null;var f=this;this._listener={onTextModelChanged:function(a){f._onTextModelChanged(a)},onAnnotationModelChanged:function(a){f._onAnnotationModelChanged(a)}};this.setAnnotationModel(b)}function f(b,a,e,f,h){c.call(this,b,a,"page",e);this._oddStyle=f||{style:{backgroundColor:"white"}};
this._evenStyle=h||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function b(b,a,e){c.call(this,b,a,"page",e)}function h(b,a,e){c.call(this,b,a,"document",e)}function e(c,a,e){b.call(this,c,a,e)}c.prototype={getAnnotations:function(b,a){var c=this._annotationModel;if(!c)return[];var e=this._view.getModel(),f=e.getLineStart(b),h=e.getLineEnd(a-1),g=e;e.getBaseModel&&(g=e.getBaseModel(),f=e.mapOffset(f),h=e.mapOffset(h));for(var i=[],c=this.getAnnotationsByType(c,f,h),f=0;f<
c.length;f++)for(var h=c[f],j=g.getLineAtOffset(h.start),k=g.getLineAtOffset(Math.max(h.start,h.end-1)),t=j;t<=k;t++){var w=t;if(e!==g){w=g.getLineStart(t);w=e.mapOffset(w,!0);if(w===-1)continue;w=e.getLineAtOffset(w)}if(b<=w&&w<a){var l=this._mergeAnnotation(i[w],h,t-j,k-j+1);l&&(i[w]=l)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var r in i)i[r]._multiple&&(i[r].html+=this._multiAnnotationOverlay.html);return i},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location},
getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(b){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=b)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(b){this._multiAnnotation=b},setMultiAnnotationOverlay:function(b){this._multiAnnotationOverlay=
b},setView:function(b){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=b;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(b){if(b!==void 0){var a=this._view,c=a.getModel(),e=c,f=c.getLineStart(b),h=f,g=f,i=this._annotationModel;if(i){a=a.getSelection();g=c.getLineEnd(b,!0);if(f<=a.start&&a.start<g)f=a.start;c.getBaseModel&&(f=c.mapOffset(f),
g=c.mapOffset(g),e=c.getBaseModel());for(var k,g=i.getAnnotations(f,g),i=null;!k&&g.hasNext();)a=g.next(),this.isAnnotationTypeVisible(a.type)&&(i=a,a.start<=f||(k=a));if(i&&i.groupId!==void 0)this._currentClickGroup=this._currentClickGroup===i.groupId?null:i.groupId,this._setCurrentGroup(b);k&&e.getLineAtOffset(k.start)===e.getLineAtOffset(f)?(f=k.start,g=k.end):g=f=h;c.getBaseModel&&(f=c.mapOffset(f,!0),g=c.mapOffset(g,!0))}(b=j.Tooltip.getTooltip(this._view))&&b.setTarget(null);this._view.setSelection(g,
f,1/3,function(){})}},onDblClick:function(){},onMouseMove:function(b,a){var c=j.Tooltip.getTooltip(this._view);if(c&&!(c.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=b;var e=this;c.setTarget({y:a.clientY,getTooltipInfo:function(){return e._getTooltipInfo(e._tooltipLineIndex,this.y)}})}},onMouseOver:function(b,a){this.onMouseMove(b,a);this._currentClickGroup||this._setCurrentGroup(b)},onMouseOut:function(){this._currentClickGroup||this._setCurrentGroup(-1);var b=j.Tooltip.getTooltip(this._view);
b&&b.setTarget(null)},_getTooltipInfo:function(b,a){if(b!==void 0){var c=this._view,e=c.getModel(),f=this._annotationModel,h=[];if(f){var h=e.getLineStart(b),g=e.getLineEnd(b);e.getBaseModel&&(h=e.mapOffset(h),g=e.mapOffset(g));h=this.getAnnotationsByType(f,h,g)}f=this._getTooltipContents(b,h);if(!f)return null;f={contents:f,anchor:this.getLocation()};h=c.getClientArea();h.y=this.getOverview()==="document"?c.convert({y:a},"view","document").y:c.getLocationAtOffset(e.getLineStart(b)).y;c.convert(h,
"document","page");f.x=h.x;f.y=h.y;f.anchor==="right"&&(f.x+=h.width);return f}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(f.isAnnotationTypeVisible(a[b].type)){var d=a[b].start,h=a[b].end;e.getBaseModel&&(d=e.mapOffset(d,!0),h=e.mapOffset(h,!0));d!==-1&&h!==-1&&c.redrawLines(e.getLineAtOffset(d),e.getLineAtOffset(Math.max(d,h-1))+1,f)}}var c=this._view;if(c){var e=c.getModel(),f=this,h=e.getLineCount();b.textModelChangedEvent?
(b=b.textModelChangedEvent.start,e.getBaseModel&&(b=e.mapOffset(b,!0)),b=e.getLineAtOffset(b),c.redrawLines(b,h,f)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,c){b||(b={});if(c===0)if(b.html&&a.html){if(a.html!==b.html&&!b._multiple&&this._multiAnnotation)b.html=this._multiAnnotation.html;b._multiple=!0}else b.html=a.html;b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?
b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var c;if(a.style){if(!b.style)b.style={};for(c in a.style)b.style[c]===void 0&&(b.style[c]=a.style[c])}if(a.attributes){if(!b.attributes)b.attributes={};for(c in a.attributes)b.attributes[c]===void 0&&(b.attributes[c]=a.attributes[c])}}return b},_setCurrentGroup:function(b){var a=this._annotationModel,c=null,e=a.getTextModel(),f,h=this._currentGroupAnnotation;if(b!==-1){var g=e.getLineStart(b),i=e.getLineEnd(b);e.getBaseModel&&(g=e.mapOffset(g),
i=e.mapOffset(i));for(f=a.getAnnotations(g,i);f.hasNext();)if(e=f.next(),this.isAnnotationTypeVisible(e.type)&&e.start<=g&&e.end>=i&&e.groupId!==void 0){c=e;break}if(h&&c&&h.groupId===c.groupId)return}this._currentGroupAnnotation=null;h&&a.removeAnnotations(h.groupType);if(c&&b!==-1){this._currentGroupAnnotation=c;f=a.getAnnotations();for(b=[];f.hasNext();)e=f.next(),delete e.groupAnnotation,e.groupId===c.groupId&&(e=e.createGroupAnnotation(),b.push(e));a.replaceAnnotations(null,b)}}};k.AnnotationTypeList.addMixin(c.prototype);
f.prototype=new c;f.prototype.getAnnotations=function(b,a){for(var e=c.prototype.getAnnotations.call(this,b,a),f=this._view.getModel(),h=b;h<a;h++){var g=h&1?this._oddStyle:this._evenStyle,i=h;f.getBaseModel&&(i=f.getLineStart(i),i=f.getBaseModel().getLineAtOffset(f.mapOffset(i)));e[h]||(e[h]={});e[h].html=this._firstLine+i+"";if(!e[h].style)e[h].style=g}return e};f.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();return this.getAnnotations(b-1,b)[b-1]};f.prototype.setFirstLine=
function(b){this._firstLine=b!==void 0?b:1};f.prototype._onTextModelChanged=function(b){var b=b.start,a=this._view.getModel(),c=(this._firstLine+(a.getBaseModel?a.getBaseModel().getLineCount():a.getLineCount())-1+"").length;if(this._numOfDigits!==c)this._numOfDigits=c,this._view.redrawLines(a.getLineAtOffset(b),a.getLineCount(),this)};b.prototype=new c;h.prototype=new c;h.prototype.getRulerStyle=function(){var b={style:{lineHeight:"1px",fontSize:"1px"}};return b=this._mergeStyle(b,this._rulerStyle)};
h.prototype._getTooltipContents=function(b,a){if(a.length===0){var e=this._view.getModel(),f=b;e.getBaseModel&&(f=e.getLineStart(f),f=e.getBaseModel().getLineAtOffset(e.mapOffset(f)));return g.formatMessage(i.line,f+1)}return c.prototype._getTooltipContents.call(this,b,a)};h.prototype._mergeAnnotation=function(b,a,c,e){if(c===0){if(!b)b={html:"&nbsp;",style:{style:{height:3*e+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle);return b}};e.prototype=new b;e.prototype.onClick=function(b){if(b!==
void 0){var a=this._annotationModel;if(a){var c=this._view.getModel(),e=c.getLineStart(b),b=c.getLineEnd(b,!0);c.getBaseModel&&(e=c.mapOffset(e),b=c.mapOffset(b),c=c.getBaseModel());for(var f,a=a.getAnnotations(e,b);!f&&a.hasNext();)b=a.next(),this.isAnnotationTypeVisible(b.type)&&(f=b);f&&c.getLineAtOffset(f.start)===c.getLineAtOffset(e)&&((c=j.Tooltip.getTooltip(this._view))&&c.setTarget(null),f.expanded?f.collapse():f.expand())}}};e.prototype._getTooltipContents=function(c,a){return a.length===
1&&a[0].expanded?null:b.prototype._getTooltipContents.call(this,c,a)};e.prototype._onAnnotationModelChanged=function(c){function a(a){for(g=0;g<a.length;g++)if(h.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;f.getBaseModel&&(b=f.mapOffset(b,!0));b!==-1&&(j=Math.min(j,f.getLineAtOffset(b)))}}if(c.textModelChangedEvent)b.prototype._onAnnotationModelChanged.call(this,c);else{var e=this._view;if(e){var f=e.getModel(),h=this,g,i=f.getLineCount(),j=i;a(c.added);a(c.removed);a(c.changed);c=e.getRulers();
for(g=0;g<c.length;g++)e.redrawLines(j,i,c[g])}}};return{Ruler:c,AnnotationRuler:b,LineNumberRuler:f,OverviewRuler:h,FoldingRuler:e}});
define("orion/editor/textDND",["orion/util"],function(i){function k(i,g){this._view=i;this._undoStack=g;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var c=this;this._listener={onDragStart:function(f){c._onDragStart(f)},onDragEnd:function(f){c._onDragEnd(f)},onDragEnter:function(f){c._onDragEnter(f)},onDragOver:function(f){c._onDragOver(f)},onDrop:function(f){c._onDrop(f)},onDestroy:function(f){c._onDestroy(f)}};i.addEventListener("DragStart",this._listener.onDragStart);i.addEventListener("DragEnd",
this._listener.onDragEnd);i.addEventListener("DragEnter",this._listener.onDragEnter);i.addEventListener("DragOver",this._listener.onDragOver);i.addEventListener("Drop",this._listener.onDrop);i.addEventListener("Destroy",this._listener.onDestroy)}k.prototype={destroy:function(){var i=this._view;if(i)i.removeEventListener("DragStart",this._listener.onDragStart),i.removeEventListener("DragEnd",this._listener.onDragEnd),i.removeEventListener("DragEnter",this._listener.onDragEnter),i.removeEventListener("DragOver",
this._listener.onDragOver),i.removeEventListener("Drop",this._listener.onDrop),i.removeEventListener("Destroy",this._listener.onDestroy),this._view=null},_onDestroy:function(){this.destroy()},_onDragStart:function(i){var g=this._view,c=g.getSelection(),g=g.getModel();if(g.getBaseModel)c.start=g.mapOffset(c.start),c.end=g.mapOffset(c.end),g=g.getBaseModel();if(g=g.getText(c.start,c.end))this._dragSelection=c,i.event.dataTransfer.effectAllowed="copyMove",i.event.dataTransfer.setData("Text",g)},_onDragEnd:function(j){if(this._dragSelection){var g=
this._view,c=j.event.dataTransfer.dropEffect;if(!i.isFirefox&&(c!=="none"||this._dropText))c=j.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(j=c==="move")&&g.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var c=this._dropText,f=this._dropOffset;if(j)if(f>=this._dragSelection.end)f-=this._dragSelection.end-this._dragSelection.start;else if(f>=this._dragSelection.start)f=this._dragSelection.start;g.setText(c,
f,f);g.setSelection(f,f+c.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(i){this._onDragOver(i)},_onDragOver:function(j){var g=j.event.dataTransfer.types,c=!this._view.getOptions("readonly");c&&g&&(c=g.contains?g.contains("text/plain")||g.contains("Text"):g.indexOf("text/plain")!==-1||g.indexOf("Text")!==-1);if(c){if(!i.isFirefox)this._dropEffect=j.event.dataTransfer.dropEffect=(i.isMac?j.event.altKey:
j.event.ctrlKey)?"copy":"move"}else j.event.dataTransfer.dropEffect="none"},_onDrop:function(j){var g=this._view,c=j.event.dataTransfer.getData("Text");if(c){if(!i.isFirefox)j.event.dataTransfer.dropEffect=this._dropEffect;j=g.getOffsetAtLocation(j.x,j.y);this._dragSelection?(this._dropOffset=j,this._dropText=c):(g.setText(c,j,j),g.setSelection(j,j+c.length))}}};return{TextDND:k}});
define("orion/editor/templates",[],function(){function i(i,g,c,f){this.prefix=i;this.description=g;this.template=c;this.name=f;this._parse()}function k(i,g){this._keywords=i||[];this._templates=[];this.addTemplates(g||[])}i.prototype={getProposal:function(i,g,c){var i=g-i.length,g={},f,b=c.delimiter!==void 0?c.delimiter:"\n";c.indentation&&(b+=c.indentation);for(var h=c.tab!==void 0?c.tab:"\t",e=0,d=this.variables,a=this.segments,c=[],k=0;k<a.length;k++){var n=a[k],q=d[n];if(q!==void 0)switch(n){case "${tab}":n=
h;break;case "${delimiter}":n=b;break;case "${cursor}":n="";f=e;break;default:var o=g[n];o||(o=g[n]={data:q.data,positions:[]});n=q.substitution;o.data&&o.data.values&&(n=o.data.values[0]);o.positions.push({offset:i+e,length:n.length})}c.push(n);e+=n.length}var b=[],p;for(p in g)g.hasOwnProperty(p)&&b.push(g[p]);c=c.join("");if(f===void 0)f=c.length;return{proposal:c,name:this.name,description:this.description,groups:b,escapePosition:i+f,style:"noemphasis"}},match:function(i){return this.prefix.indexOf(i)===
0},_parse:function(){var i=this.template,g=[],c={},f,b=0,i=i.replace(/\n/g,"${delimiter}"),i=i.replace(/\t/g,"${tab}");i.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(h,e,d){var a=h.substring(2,h.length-1),e=h,k=a,n=null,q=k.indexOf(":");q!==-1&&(k=k.substring(0,q),e="${"+k+"}",n=JSON.parse(a.substring(q+1).replace("\\}","}").trim()));(a=c[e])||(a=c[e]={});a.substitution=k;if(n)a.data=n;(f=i.substring(b,d))&&g.push(f);g.push(e);b=d+h.length;return k});(f=i.substring(b,i.length))&&g.push(f);this.segments=
g;this.variables=c}};k.prototype={addTemplates:function(j){for(var g=this.getTemplates(),c=0;c<j.length;c++)g.push(new i(j[c].prefix,j[c].description,j[c].template,j[c].name))},computeProposals:function(i,g,c){var f=this.getPrefix(i,g,c),b=[];this.isValid(f,i,g,c)&&(b=b.concat(this.getTemplateProposals(f,g,c)),b=b.concat(this.getKeywordProposals(f)));return b},getKeywords:function(){return this._keywords},getKeywordProposals:function(i){var g=[],c=this.getKeywords();if(c){for(var f=0;f<c.length;f++)c[f].indexOf(i)===
0&&g.push({proposal:c[f].substring(i.length),description:c[f],style:"noemphasis_keyword"});0<g.length&&g.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return g},getPrefix:function(i,g,c){return c.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(i,g,c){for(var f=[],b=this.getTemplates(),h=0;h<b.length;h++){var e=b[h];e.match(i)&&(e=e.getProposal(i,g,c),this.removePrefix(i,e),f.push(e))}0<f.length&&(f.sort(function(b,
a){return b.name<a.name?-1:b.name>a.name?1:0}),f.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return f},removePrefix:function(i,g){if(!(g.overwrite=g.proposal.substring(0,i.length)!==i))g.proposal=g.proposal.substring(i.length)},isValid:function(){return!0}};return{Template:i,TemplateContentAssist:k}});
define("orion/editor/linkedMode","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/annotations,orion/editor/templates,orion/objects,orion/util".split(","),function(i,k,j,g,c,f){function b(b,c,a){var f=b.getTextView();j.KeyMode.call(this,f);this.editor=b;this.undoStack=c;this.contentAssist=a;this.linkedModeModel=null;f.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));f.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));f.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));f.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(a.selectedGroupIndex>0?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),
this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.editor.mapOffset(a.start),c=this.linkedModeModel,d,e;c;)if(d=this._getPositionChanged(c,b,b+a.removedCharCount),e=d.position,e===void 0||e.model!==c)this.exitLinkedMode(!1),c=this.linkedModeModel;else break;if(c){c=0;a=a.addedCharCount-a.removedCharCount;d=d.positions;for(var f,h=0;h<d.length;++h){f=d[h];e=f.position;var g=e.offset<=b&&b<=e.offset+e.length;g&&!f.ansestor?(e.offset+=c,
e.length+=a,c+=a):(e.offset+=c,f.ansestor&&g&&(e.length+=a));if(f.escape)f.model.escapePosition=e.offset}this._updateAnnotations(d)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,c=b.mapOffset(a.start),d=this.editor.mapOffset(a.end),e=this.linkedModeModel,f,h;e;)if(f=this._getPositionChanged(e,c,d),h=f.position,h===void 0||h.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var g=this._compoundChange;g?g.owner.model===e&&g.owner.group===h.group||
(this.endUndo(),this.startUndo()):this.startUndo();e.selectedGroupIndex=h.group;var g=0,i=a.text.length-(d-c);f=f.positions;var j;c-=h.position.offset;for(var k=d-h.position.offset,m=0;m<f.length;++m)if(j=f[m],d=j.position,j.oldOffset=d.offset,j.model===e&&j.group===h.group?(d.offset+=g,d.length+=i,g+=i):(d.offset+=g,j.ansestor&&(d.length+=h.count*i)),j.escape)j.model.escapePosition=d.offset;this.ignoreVerify=!0;for(m=f.length-1;m>=0;m--)j=f[m],j.model===e&&j.group===h.group&&b.setText(a.text,j.oldOffset+
c,j.oldOffset+k);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var h={};b.prototype=new j.KeyMode;f.mixin(b.prototype,{createKeyBindings:function(){var b=k.KeyBinding,c=[];c.push({actionID:"linkedModeEnter",keyBinding:new b(13)});c.push({actionID:"linkedModeCancel",keyBinding:new b(27)});c.push({actionID:"linkedModeNextGroup",keyBinding:new b(9)});c.push({actionID:"linkedModePreviousGroup",keyBinding:new b(9,!1,!0)});return c},enterLinkedMode:function(b){if(!this.linkedModeModel){var c=
this.editor.getTextView();c.addKeyMode(this);c.addEventListener("Verify",this.linkedModeListener.onVerify);c.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(i.linkedModeEntered,null,!0)}this._sortedPositions=null;if(this.linkedModeModel)b.previousModel=this.linkedModeModel,b.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=b;this.linkedModeModel=
b;this.selectLinkedGroup(0)},exitLinkedMode:function(b){if(this.isActive()){if(this._compoundChange)this.endUndo(),this._compoundChange=null;this._sortedPositions=null;var c=this.linkedModeModel;this.linkedModeModel=c.previousModel;c.parentGroup=c.previousModel=void 0;if(this.linkedModeModel)this.linkedModeModel.nextModel=void 0;if(!this.linkedModeModel){var a=this.editor,f=a.getTextView();f.removeKeyMode(this);f.removeEventListener("Verify",this.linkedModeListener.onVerify);f.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);f=this.contentAssist;f.removeEventListener("Activating",this.linkedModeListener.onActivating);f.offset=void 0;this.editor.reportStatus(i.linkedModeExited,null,!0);b&&a.setCaretOffset(c.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var b=this,c=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:c,group:c.selectedGroupIndex,end:function(){b._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(b){var d=this.linkedModeModel;if(d){d.selectedGroupIndex=b;var b=d.groups[b],a=b.positions[0],f=this.editor;f.setSelection(a.offset,a.offset+a.length);if(d=this.contentAssist)if(d.offset=void 0,b.data&&b.data.type==="link"&&b.data.values)(this._groupContentAssistProvider=new c.TemplateContentAssist(b.data.values)).getPrefix=function(){var b=
f.getSelection();return b.start===b.end&&(b=f.getCaretOffset(),a.offset<=b&&b<=a.offset+a.length)?f.getText(a.offset,b):""},d.offset=a.offset,d.deactivate(),d.activate();else if(this._groupContentAssistProvider)this._groupContentAssistProvider=null,d.deactivate()}this._updateAnnotations()},_getModelPositions:function(b,c,a){for(var f=c.groups,h=0;h<f.length;h++)for(var g=f[h].positions,i=0;i<g.length;i++){var j=g[i];a&&(j={offset:j.offset+a,length:j.length});j={index:i,group:h,count:g.length,model:c,
position:j};b.push(j);if(c.nextModel&&c.nextModel.parentGroup===h)j.ansestor=!0,this._getModelPositions(b,c.nextModel,(a||0)+g[i].offset-g[0].offset)}},_getSortedPositions:function(b){var c=this._sortedPositions;if(!c){for(c=[];b.previousModel;)b=b.previousModel;for(this._getModelPositions(c,b);b;)b.escapePosition!==void 0&&c.push({escape:!0,model:b,position:{offset:b.escapePosition,length:0}}),b=b.nextModel;c.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=c}return c},
_getPositionChanged:function(b,c,a){for(var f,b=this._getSortedPositions(b),h=b.length-1;h>=0;h--){var g=b[h].position;if(g.offset<=c&&a<=g.offset+g.length){f=b[h];break}}return{position:f,positions:b}},_updateAnnotations:function(b){var c=this.editor.getAnnotationModel();if(c){var a=[],f=[];c.getTextModel();for(var h=c.getAnnotations(),i;h.hasNext();)switch(i=h.next(),i.type){case g.AnnotationType.ANNOTATION_LINKED_GROUP:case g.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case g.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:a.push(i)}if(h=
this.linkedModeModel)for(var b=b||this._getSortedPositions(h),j=0;j<b.length;j++)if(i=b[j],i.model===h){var k=g.AnnotationType.ANNOTATION_LINKED_GROUP;i.group===h.selectedGroupIndex&&(k=i.index===0?g.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:g.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);i=i.position;i=g.AnnotationType.createAnnotation(k,i.offset,i.offset+i.length,"");f.push(i)}c.replaceAnnotations(a,f)}}});h.LinkedMode=b;return h});
define("orion/editor/factories","orion/editor/actions,orion/editor/undoStack,orion/editor/rulers,orion/editor/annotations,orion/editor/textDND,orion/editor/linkedMode".split(","),function(i,k,j,g,c,f){function b(){}function h(){}function e(){}function d(){}function a(){}function m(){}var n={};b.prototype={createKeyBindings:function(a,b,c,d){var d=new i.TextActions(a,b,d),e=new f.LinkedMode(a,b,c),a=new i.SourceCodeActions(a,b,c,e);return{textActions:d,linkedMode:e,sourceCodeActions:a}}};n.KeyBindingsFactory=
b;h.prototype={createUndoStack:function(a){a=a.getTextView();return new k.UndoStack(a,200)}};n.UndoFactory=h;e.prototype={createLineNumberRuler:function(a){return new j.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};n.LineNumberRulerFactory=e;d.prototype={createFoldingRuler:function(a){return new j.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};n.FoldingRulerFactory=d;a.prototype={createAnnotationModel:function(a){return new g.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new g.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new j.AnnotationRuler(a,"left",{styleClass:"ruler annotations"}),a=new j.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};n.AnnotationFactory=a;m.prototype={createTextDND:function(a,b){return new c.TextDND(a.getTextView(),b)}};n.TextDNDFactory=m;return n});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(i,k,j,g){return g.mixin({},i,k,j)});
define("orion/editor/contentAssist","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/eventTarget,orion/Deferred,orion/objects,orion/editor/util,orion/util,orion/webui/littlelib".split(","),function(i,k,j,g,c,f,b,h,e){var d,a,m;function n(b){this.textView=b;this.state=d;this.resetProviderInfoArray();var c=this;this.contentAssistListener={onModelChanging:function(a){this._latestModelChangingEvent=a}.bind(this),onSelection:function(b){this.isDeactivatingChange(this._latestModelChangingEvent,
b)?this.setState(d):this.isActive()&&(this.state===a&&this.setState(m),this.filterProposals(b));this._latestModelChangingEvent=null}.bind(this),onScroll:function(){this.setState(d)}.bind(this)};b.setKeyBinding(h.isMac?new k.KeyBinding(" ",!1,!1,!1,!0):new k.KeyBinding(" ",!0),"contentAssist");b.setKeyBinding(h.isMac?new k.KeyBinding(" ",!1,!1,!0,!0):new k.KeyBinding(" ",!0,!1,!0),"contentAssist");b.setAction("contentAssist",function(){b.getOptions("readonly")||c.activate();return!0},{name:i.contentAssist})}
function q(a,b){var c=a.textView;j.KeyMode.call(this,c);this.contentAssist=a;this.widget=b;this.proposals=[];var d=this;this.contentAssist.addEventListener("ProposalsComputed",function(a){d.proposals=a.data.proposals;if(d.proposals.length===0)d.selectedIndex=-1,d.cancel();else{for(d.selectedIndex=0;d.proposals[d.selectedIndex]&&d.proposals[d.selectedIndex].unselectable;)d.selectedIndex++;if(d.proposals[d.selectedIndex]){if(d.widget){var b=!0;if(a.autoApply){for(a=d.selectedIndex+1;d.proposals[a]&&
d.proposals[a].unselectable;)a++;d.proposals[a]||(b=!1,d.contentAssist.apply(d.proposals[d.selectedIndex]))}b&&(d.widget.show(),d.widget.selectNode(d.selectedIndex))}}else d.selectedIndex=-1,d.cancel()}});c.setAction("contentAssistApply",function(){return this.enter()}.bind(this));c.setAction("contentAssistCancel",function(){return this.cancel()}.bind(this));c.setAction("contentAssistNextProposal",function(){return this.lineDown()}.bind(this));c.setAction("contentAssistPreviousProposal",function(){return this.lineUp()}.bind(this));
c.setAction("contentAssistNextPage",function(){return this.pageDown()}.bind(this));c.setAction("contentAssistPreviousPage",function(){return this.pageUp()}.bind(this));c.setAction("contentAssistHome",function(){this.widget&&this.widget.scrollIndex(0,!0);return this.lineDown(0)}.bind(this));c.setAction("contentAssistEnd",function(){return this.lineUp(this.proposals.length-1)}.bind(this));c.setAction("contentAssistTab",function(){return this.tab()}.bind(this));this.widget&&(this.widget.setContentAssistMode(this),
this.widget.createAccessible())}function o(a,c){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=this.textViewListenerAdded=!1;var d=this.textView.getOptions("parent").ownerDocument;this.parentNode=typeof c==="string"?d.getElementById(c):c;if(!this.parentNode){this.parentNode=h.createElement(d,"div");this.parentNode.className="contentassist";var e=d.getElementsByTagName("body")[0];if(e)e.appendChild(this.parentNode);else throw Error("parentNode is required");}this.parentNode.addEventListener("scroll",
this.onScroll.bind(this));var f=this;this.textViewListener={onMouseDown:function(a){(a.event.target||a.event.srcElement).parentElement!==f.parentNode&&f.contentAssist.deactivate()}};this.contentAssist.addEventListener("Deactivating",function(){f.hide()});this.scrollListener=function(){f.isShowing&&f.position()};b.addEventListener(d,"scroll",this.scrollListener)}d=1;a=2;m=3;var p={selected:"selected",hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",noemphasis_keyword:"proposal-noemphasis-keyword",
noemphasis_title:"proposal-noemphasis-title",noemphasis_title_keywords:"proposal-noemphasis-title-keywords",dfault:"proposal-default"};n.prototype={apply:function(a){if(!a)return!1;var b=this.textView,c=b.getSelection(),e=this._initialCaretOffset,f=e,h=c=Math.max(c.start,c.end),g=b.getModel();g.getBaseModel&&(f=g.mapOffset(f),h=g.mapOffset(h),g=g.getBaseModel());a.overwrite&&(e=this.getPrefixStart(g,f));f={proposal:a,start:f,end:h};this.setState(d);b.setText(typeof a==="string"?a:a.proposal,e,c);
this.dispatchEvent({type:"ProposalApplied",data:f});return!0},activate:function(b,c){if(this.state===d)this._autoTriggered=c?!0:!1,this.setState(a,b)},deactivate:function(){this.setState(d)},getTextView:function(){return this.textView},isActive:function(){return this.state===a||this.state===m},isDeactivatingChange:function(a,b){var c=!1;b.newValue.start<this._initialCaretOffset?c=!0:a&&(c=a.removedLineCount>0||a.addedLineCount>0);return c},setState:function(b,c){var e;if(b===a)this._filterText="",
e="Activating",this._mode&&this._mode.setActive(!0);else if(b===d)e="Deactivating",this._mode&&this._mode.setActive(!1),this._initialCaretOffset=-1,this._filterText="";e&&this.dispatchEvent({type:e,providerInfoArray:c});this.state=b;this.onStateChange(b)},setMode:function(a){this._mode=a},onStateChange:function(b){if(b===d){if(this.listenerAdded)this._latestModelChangingEvent=null,this.textView.removeEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.removeEventListener("Scroll",
this.contentAssistListener.onScroll),this.textView.removeEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!1}else if(b===a){if(!this.listenerAdded)this.textView.addEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.addEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.addEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!0;this.computeProposals()}},computeProposals:function(){var a=
this,b=this.textView.getCaretOffset(),c=this.textView.getSelection(),c=Math.min(c.start,c.end);this._initialCaretOffset=Math.min(b,c);this._computeProposals(this._initialCaretOffset).then(function(b){a._computedProposals=b;a.isActive()&&(b=a._flatten(b),a.dispatchEvent({type:"ProposalsComputed",data:{proposals:b},autoApply:!a._autoTriggered}))})},getPrefixStart:function(a,b){for(var c=b;c>0&&/[A-Za-z0-9_]/.test(a.getText(c-1,c));)c--;return c},handleError:function(a){typeof console!=="undefined"&&
(console.log("Error retrieving content assist proposals"),console.log(a&&a.stack))},_computeProposals:function(a){var b=this._providerInfoArray,d=this.textView,e=d.getSelection(),h=d.getModel(),g=a;if(h.getBaseModel)g=h.mapOffset(g),e.start=h.mapOffset(e.start),e.end=h.mapOffset(e.end),h=h.getBaseModel();for(var a=h.getLine(h.getLineAtOffset(g)),i=0;i<a.length&&/\s/.test(a.charAt(i));)i++;var i=a.substring(0,i),d=d.getOptions("tabSize","expandTab"),d=d.expandTab?Array(d.tabSize+1).join(" "):"\t",
j={line:a,offset:g,prefix:h.getText(this.getPrefixStart(h,g),g),selection:e,delimiter:h.getLineDelimiter(),tab:d,indentation:i},k=this,b=b.map(function(a){var a=a.provider,b;try{var d,e;if(d=a.computeContentAssist){var i=k.editorContextProvider,m=i.getEditorContext();j=f.mixin(j,i.getOptions());e=d.apply(a,[m,j])}else if(d=a.getProposals||a.computeProposals)e=d.apply(a,[h.getText(),g,j]);b=k.progress?k.progress.progress(e,"Generating content assist proposal"):e}catch(o){k.handleError(o)}return c.when(b)});
return c.all(b,this.handleError)},filterProposals:function(){var a="",b=0;if(this._latestModelChangingEvent){a=this._latestModelChangingEvent.text;if(b=this._latestModelChangingEvent.removedCharCount)this._filterText=this._filterText.substring(0,this._filterText.length-b);if(a)this._filterText=this._filterText.concat(a);a=this.textView.getModel();a.getBaseModel&&(a=a.getBaseModel());var c=this.textView.getText(this.getPrefixStart(a,this._initialCaretOffset),this._initialCaretOffset),d=[];this._computedProposals.forEach(function(a){a=
a.filter(function(a){if(p[a.style]===p.hr||p[a.style]===p.noemphasis_title)return!0;var b="";if(a.overwrite){if(a.name)b=a.name;else if(a.proposal)b=a.proposal;else return!1;return 0===b.indexOf(c+this._filterText)}else return a.name||a.proposal?(b=!1,a.name&&(b=0===a.name.indexOf(c+this._filterText)),!b&&a.proposal&&(b=0===a.proposal.indexOf(this._filterText)),b):typeof a==="string"?0===a.indexOf(this._filterText):!1},this);a.length>0&&d.push(a)},this);d=this._removeExtraUnselectableElements(d);
this.dispatchEvent({type:"ProposalsComputed",data:{proposals:this._flatten(d)},autoApply:!1})}},_removeExtraUnselectableElements:function(a){return a.map(function(a){return a.filter(function(b,c){var d=!0;if(p[b.style]===p.hr)0===c||a.length-1===c?d=!1:p.hr===p[a[c-1].style]&&(d=!1);else if(p[b.style]===p.noemphasis_title){var e=a[c+1];e?p[e.style]===p.noemphasis_title&&(d=!1):d=!1}return d})})},setEditorContextProvider:function(a){this.editorContextProvider=a},_generateProviderId:function(){this._uniqueProviderIdCounter?
this._uniqueProviderIdCounter++:this._uniqueProviderIdCounter=0;return"ContentAssistGeneratedID_"+this._uniqueProviderIdCounter},setAutoTriggerEnabled:function(a){this._autoTriggerEnabled=a;this._updateAutoTriggerListenerState()},setProviders:function(a){this.setProviderInfoArray(a.map(function(a){return{provider:a,id:this._generateProviderId()}},this))},setProviderInfoArray:function(a){this.resetProviderInfoArray();this._providerInfoArray=a;this._charTriggersInstalled=a.some(function(a){return a.charTriggers});
this._updateAutoTriggerListenerState()},resetProviderInfoArray:function(){this._providerInfoArray=[];this._charTriggersInstalled=!1;this._updateAutoTriggerListenerState()},setProgress:function(a){this.progress=a},setStyleAccessor:function(a){this._styleAccessor=a},_flatten:function(a){return a.reduce(function(a,b){var c=a;if(Array.isArray(b)&&b.length>0){var c=b,d=a;b[0].style&&0===p[b[0].style].indexOf(p.noemphasis)&&(c=a,d=b);c.length>0&&c[c.length-1].style&&p.hr!==p[c[c.length-1].style]&&(c=c.concat({proposal:"",
name:"",description:"---------------------------------",style:"hr",unselectable:!0}));c=c.concat(d)}return c},[])},_triggerListener:function(){if(this._styleAccessor){var a=this.textView.getCaretOffset(),b=null,c=[];if(this._charTriggersInstalled){var d=this.textView.getText(a-1,a);this._providerInfoArray.forEach(function(e){var f=e.charTriggers;if(f&&f.test(d)){var f=!1,h=e.excludedStyles;h&&(b||(b=this._styleAccessor.getStyles(a-1)),f=b.some(function(a){return h.test(a.style)}));f||c.push(e)}},
this);c.length>0&&this.activate(c,!0)}}},_updateAutoTriggerListenerState:function(){if(!this._boundTriggerListener)this._boundTriggerListener=this._triggerListener.bind(this);if(this._triggerListenerInstalled){if(!this._autoTriggerEnabled||!this._charTriggersInstalled)this.textView.removeEventListener("Modify",this._boundTriggerListener),this._triggerListenerInstalled=!1}else if(this._autoTriggerEnabled&&this._charTriggersInstalled)this.textView.addEventListener("Modify",this._boundTriggerListener),
this._triggerListenerInstalled=!0}};g.EventTarget.addMixin(n.prototype);q.prototype=new j.KeyMode;f.mixin(q.prototype,{createKeyBindings:function(){var a=k.KeyBinding,b=[];b.push({actionID:"contentAssistApply",keyBinding:new a(13)});b.push({actionID:"contentAssistCancel",keyBinding:new a(27)});b.push({actionID:"contentAssistNextProposal",keyBinding:new a(40)});b.push({actionID:"contentAssistPreviousProposal",keyBinding:new a(38)});b.push({actionID:"contentAssistNextPage",keyBinding:new a(34)});b.push({actionID:"contentAssistPreviousPage",
keyBinding:new a(33)});b.push({actionID:"contentAssistHome",keyBinding:new a(e.KEY.HOME)});b.push({actionID:"contentAssistEnd",keyBinding:new a(e.KEY.END)});b.push({actionID:"contentAssistTab",keyBinding:new a(9)});return b},cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},getProposals:function(){return this.proposals},isActive:function(){return this.getContentAssist().isActive()},setActive:function(a){a?this.contentAssist.textView.addKeyMode(this):
this.contentAssist.textView.removeKeyMode(this)},lineUp:function(a,b){return this.selectNew(a,b,!1)},lineDown:function(a,b){return this.selectNew(a,b,!0)},selectNew:function(a,b,c){if(c){if(void 0===a&&(a=this.selectedIndex+1),a>=this.proposals.length)if(b)return!0;else a=0}else if(void 0===a&&(a=this.selectedIndex-1),0>a)if(b)return!0;else a=this.proposals.length-1;for(var d=a;this.proposals[a]&&this.proposals[a].unselectable;){if(c){if(a++,a>=this.proposals.length)if(b)return!0;else a=0}else if(a--,
0>a)if(b)return!0;else a=this.proposals.length-1;if(a===d){a=-1;break}}this.selectedIndex=a;this.widget&&this.widget.selectNode(a);return!0},pageUp:function(){if(this.widget){var a=this.widget.getTopIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!1),a=this.widget.getTopIndex());return 0===a?this.lineDown(a,!0):this.lineUp(a,!0)}else return this.lineUp()},pageDown:function(){if(this.widget){var a=this.widget.getBottomIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!0),a=this.widget.getBottomIndex());
return this.lineDown(a,!0)}else return this.lineDown()},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},tab:function(){return this.widget?(this.widget.parentNode.focus(),!0):!1}});o.prototype={onClick:function(a){if(!a)a=window.event;this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},onScroll:function(){this.previousCloneNode&&!this.preserveCloneThroughScroll&&(this._removeCloneNode(),this.previousSelectedNode.classList.add(p.selected));
this.preserveCloneThroughScroll=!1},createDiv:function(a,b,c){var d=b.ownerDocument,e=h.createElement(d,"div");e.id="contentoption"+c;e.setAttribute("role","option");e.className=p[a.style]?p[a.style]:p.dfault;a.style==="hr"?a=h.createElement(d,"hr"):(a=this._createDisplayNode(e,a,c),e.contentAssistProposalIndex=c);e.appendChild(a);b.appendChild(e)},createAccessible:function(){var a=this._contentAssistMode,b=this;this.parentNode.addEventListener("keydown",function(c){if(!c)c=window.event;c.preventDefault&&
c.preventDefault();if(c.keyCode===e.KEY.ESCAPE)return a.cancel();else if(c.keyCode===e.KEY.UP)return a.lineUp();else if(c.keyCode===e.KEY.DOWN)return a.lineDown();else if(c.keyCode===e.KEY.ENTER)return a.enter();else if(c.keyCode===e.KEY.PAGEDOWN)return a.pageDown();else if(c.keyCode===e.KEY.PAGEUP)return a.pageUp();else if(c.keyCode===e.KEY.HOME)return b.scrollIndex(0,!0),a.lineDown(0);else if(c.keyCode===e.KEY.END)return a.lineUp(a.getProposals().length-1);return!1})},_createDisplayNode:function(a,
b,c){var d=null,e=null;if(typeof b==="string")e=b;else if(b.description&&typeof b.description==="string")if(b.name&&typeof b.name==="string"){var f=this._createNameNode(b.name);f.contentAssistProposalIndex=c;d=document.createElement("span");d.appendChild(f);f=document.createTextNode(b.description);d.appendChild(f);a.setAttribute("title",b.name+b.description)}else e=b.description;else e=b.proposal;e&&(d=this._createNameNode(e),a.setAttribute("title",e));d.contentAssistProposalIndex=c;return d},_createNameNode:function(a){var b=
document.createElement("span");b.classList.add("proposal-name");b.appendChild(document.createTextNode(a));return b},getProposal:function(a){var b=null,a=a.contentAssistProposalIndex;void 0!==a&&(b=this._contentAssistMode.getProposals()[a]||null);return b},getTopIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++)if(a[b].offsetTop>=this.parentNode.scrollTop)return b;return 0},getBottomIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++){var c=a[b];if(c.offsetTop+
c.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight)return Math.max(0,b-1)}return a.length-1},scrollIndex:function(a,b){this.parentNode.childNodes[a].scrollIntoView(b);this.preserveCloneThroughScroll=!0},selectNode:function(a){var b=null;if(this.previousSelectedNode)this.previousSelectedNode.classList.remove(p.selected),this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode();if(-1!==a){b=this.parentNode.childNodes[a];b.classList.add(p.selected);this.parentNode.setAttribute("aria-activedescendant",
b.id);b.focus();if(b.offsetTop<this.parentNode.scrollTop)b.scrollIntoView(!0),this.preserveCloneThroughScroll=!0;else if(b.offsetTop+b.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight)b.scrollIntoView(!1),this.preserveCloneThroughScroll=!0;var c=e.bounds(b.firstChild||b),d=e.bounds(this.parentNode),a=window.getComputedStyle(this.parentNode),f=window.getComputedStyle(b),f=parseInt(a.paddingLeft)+parseInt(a.paddingRight)+parseInt(f.paddingLeft)+parseInt(f.paddingRight);if(c.width>=
d.width-f){f=parseInt(a.top);d=b.cloneNode(!0);d.classList.add("cloneProposal");d.style.top=f+b.offsetTop-this.parentNode.scrollTop+"px";d.style.left=a.left;d.setAttribute("id",d.id+"_clone");c=c.left+c.width-parseInt(document.documentElement.clientWidth);if(c>0)a=parseInt(a.left)-c,0>a&&(a=0),d.style.left=a+"px";a=document.createElement("div");a.id="clone_contentassist";a.classList.add("contentassist");a.classList.add("cloneWrapper");a.appendChild(d);a.onclick=this.parentNode.onclick;this.parentNode.parentNode.insertBefore(a,
this.parentNode);var h=function(a){a.contentAssistProposalIndex=b.contentAssistProposalIndex;if(a.hasChildNodes())for(var c=0;c<a.childNodes.length;c++)h(a.childNodes[c])};h(a);b.classList.remove(p.selected);this.previousCloneNode=a}}this.previousSelectedNode=b},setContentAssistMode:function(a){this._contentAssistMode=a},show:function(){var a=this._contentAssistMode.getProposals();if(a.length===0)this.hide();else{this.parentNode.innerHTML="";for(var b=0;b<a.length;b++)this.createDiv(a[b],this.parentNode,
b);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0;if(!this.textViewListenerAdded)this.textView.addEventListener("MouseDown",this.textViewListener.onMouseDown),this.textViewListenerAdded=!0}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1;if(this.textViewListenerAdded)this.textView.removeEventListener("MouseDown",this.textViewListener.onMouseDown),
this.textViewListenerAdded=!1;if(this.previousSelectedNode)this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode()},position:function(){var a=this.contentAssist,b=this.textView;if(a.offset!==void 0){var a=a.offset,c=b.getModel();c.getBaseModel&&(a=c.mapOffset(a,!0))}else a=this.textView.getCaretOffset();a=b.getLocationAtOffset(a);a.y+=b.getLineHeight();this.textView.convert(a,"document","page");this.parentNode.style.position="fixed";this.parentNode.style.left=a.x+"px";this.parentNode.style.top=
a.y+"px";this.parentNode.style.display="block";this.parentNode.scrollTop=0;b=this.parentNode.ownerDocument;c=b.documentElement.clientWidth;if(a.y+this.parentNode.offsetHeight>b.documentElement.clientHeight)this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px";if(a.x+this.parentNode.offsetWidth>c)this.parentNode.style.left=c-this.parentNode.offsetWidth+"px"},_removeCloneNode:function(){this.parentNode.parentNode.contains(this.previousCloneNode)&&this.parentNode.parentNode.removeChild(this.previousCloneNode);
this.previousCloneNode=null}};return{ContentAssist:n,ContentAssistMode:q,ContentAssistWidget:o}});
define("orion/editor/emacs",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(i,k,j,g){function c(c){k.KeyMode.call(this,c)}c.prototype=new k.KeyMode;c.prototype.createKeyBindings=function(){var c=[];c.push({actionID:"emacs-beginning-of-line",keyBinding:this._createStroke("a",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-end-of-line",keyBinding:this._createStroke("e",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-forward-char",keyBinding:this._createStroke("f",
!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-backward-char",keyBinding:this._createStroke("b",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-forward-word",keyBinding:this._createStroke("f",!1,!1,!0)});c.push({actionID:"emacs-backward-word",keyBinding:this._createStroke("b",!1,!1,!0)});c.push({actionID:"emacs-next-line",keyBinding:this._createStroke("n",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-previous-line",keyBinding:this._createStroke("p",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-beginning-of-buffer",
keyBinding:this._createStroke(188,!1,!0,!0)});c.push({actionID:"emacs-end-of-buffer",keyBinding:this._createStroke(190,!1,!0,!0)});c.push({actionID:"emacs-delete-backward-char",keyBinding:this._createStroke(46,!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-delete-char",keyBinding:this._createStroke("d",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-kill-line",keyBinding:this._createStroke("k",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-kill-word",keyBinding:this._createStroke("d",!1,!1,
!0)});c.push({actionID:"emacs-backward-kill-word",keyBinding:this._createStroke(46,!1,!1,!0)});c.push({actionID:"undo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("u")])});c.push({actionID:"redo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("r")])});c.push({actionID:"emacs-scroll-up",keyBinding:this._createStroke("v",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-scroll-down",keyBinding:this._createStroke("v",!1,!1,!0)});c.push({actionID:"emacs-set-mark-command",
keyBinding:this._createStroke(" ",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-reset-mark-command",keyBinding:this._createStroke("g",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-exchange-point-and-mark",keyBinding:this._createSequence([this._createStroke("x",!g.isMac,!1,!1,g.isMac),this._createStroke("x",!g.isMac,!1,!1,g.isMac)])});for(var b=0;b<=9;b++)c.push({actionID:"emacs-digit-argument-"+b,keyBinding:this._createStroke(48+b,!g.isMac,!1,!1,g.isMac)}),c.push({actionID:"emacs-digit-argument-"+
b,keyBinding:this._createStroke(48+b,!1,!1,!0)}),c.push({actionID:"emacs-digit-argument-"+b,keyBinding:this._createStroke(48+b,!g.isMac,!1,!0,g.isMac)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!1,!1,!0)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!g.isMac,!1,!0,g.isMac)});c.push({actionID:"emacs-uppercase",keyBinding:this._createStroke("u",
!1,!1,!0)});c.push({actionID:"emacs-lowercase",keyBinding:this._createStroke("l",!1,!1,!0)});c.push({actionID:"emacs-capitalize",keyBinding:this._createStroke("c",!1,!1,!0)});c.push({actionID:"contentAssist",keyBinding:this._createStroke(191,!1,!1,!0)});c.push({actionID:"find",keyBinding:this._createStroke("r",!1,!1,!0)});c.push({actionID:"incrementalFind",keyBinding:this._createStroke("s",!0)});c.push({actionID:"incrementalFindReverse",keyBinding:this._createStroke("r",!0)});c.push({actionID:"save",
keyBinding:this._createSequence([this._createStroke("x",!g.isMac,!1,!1,g.isMac),this._createStroke("s",!g.isMac,!1,!1,g.isMac)])});this._createActions(this.getView());return c};c.prototype._createStroke=function(c,b,h,e,d){c=new j.KeyStroke(c,b,h,e,d);c.scopeName=i.emacs;return c};c.prototype._createSequence=function(c){c=new j.KeySequence(c);c.scopeName=i.emacs;return c};c.prototype._getData=function(){var c={count:(this._argument||1)*(this._sign||1)};this._argument=0;this._sign=1;return c};c.prototype._moveCursor=
function(c){var b=this._getData();if(this._marker)b.select=!0;return this.getView().invokeAction(c,!1,b)};c.prototype._digitArgument=function(c){this._argument=(this._argument||0)*10+c;return!0};c.prototype._negativeArgument=function(){this._sign=(this._sign||1)*-1;return!0};c.prototype._createActions=function(c){var b=this;c.setAction("emacs-beginning-of-line",function(){return b._moveCursor("lineStart")},{name:i.lineStart});c.setAction("emacs-end-of-line",function(){return b._moveCursor("lineEnd")},
{name:i.lineEnd});c.setAction("emacs-forward-char",function(){return b._moveCursor("charNext")},{name:i.charNext});c.setAction("emacs-backward-char",function(){return b._moveCursor("charPrevious")},{name:i.charPrevious});c.setAction("emacs-forward-word",function(){return b._moveCursor("wordNext")},{name:i.wordNext});c.setAction("emacs-backward-word",function(){return b._moveCursor("wordPrevious")},{name:i.wordPrevious});c.setAction("emacs-next-line",function(){return b._moveCursor("lineDown")},{name:i.lineDown});
c.setAction("emacs-previous-line",function(){return b._moveCursor("lineUp")},{name:i.lineUp});c.setAction("emacs-beginning-of-buffer",function(){return b._moveCursor("textStart")},{name:i.textStart});c.setAction("emacs-end-of-buffer",function(){return b._moveCursor("textEnd")},{name:i.textEnd});c.setAction("emacs-delete-backward-char",function(){return c.invokeAction("deletePrevious")},{name:i.deletePrevious});c.setAction("emacs-delete-char",function(){return c.invokeAction("deletePrevious")},{name:i.deletePrevious});
c.setAction("emacs-kill-line",function(){return c.invokeAction("deleteLineEnd")},{name:i.deleteLineEnd});c.setAction("emacs-kill-word",function(){return c.invokeAction("deleteWordNext")},{name:i.deleteWordNext});c.setAction("emacs-backward-kill-word",function(){return c.invokeAction("deleteWordPrevious")},{name:i.deleteWordPrevious});c.setAction("emacs-scroll-up",function(){return b._moveCursor("pageDown")},{name:i.pageDown});c.setAction("emacs-scroll-down",function(){return b._moveCursor("pageUp")},
{name:i.pageUp});c.setAction("emacs-set-mark-command",function(){var h=c.getCaretOffset();c.setCaretOffset(h);b._marker=h;return!0},{name:i.setMarkCommand});c.setAction("emacs-exchange-point-and-mark",function(){if(b._marker!==void 0){var h=c.getCaretOffset(),e=c.getSelection();if(e.end===h){var d=e.start;e.start=e.end;e.end=d}b._marker=h;c.setSelection(e.start,e.end)}return!0},{name:i.exchangeMarkPoint});c.setAction("emacs-reset-mark-command",function(){var h=c.getCaretOffset();c.setCaretOffset(h);
b._marker=void 0;return!0},{name:i.clearMark});c.setAction("emacs-digit-argument-0",function(){return b._digitArgument(0)},{name:g.formatMessage(i.digitArgument,"0")});c.setAction("emacs-digit-argument-1",function(){return b._digitArgument(1)},{name:g.formatMessage(i.digitArgument,"1")});c.setAction("emacs-digit-argument-2",function(){return b._digitArgument(2)},{name:g.formatMessage(i.digitArgument,"2")});c.setAction("emacs-digit-argument-3",function(){return b._digitArgument(3)},{name:g.formatMessage(i.digitArgument,
"3")});c.setAction("emacs-digit-argument-4",function(){return b._digitArgument(4)},{name:g.formatMessage(i.digitArgument,"4")});c.setAction("emacs-digit-argument-5",function(){return b._digitArgument(5)},{name:g.formatMessage(i.digitArgument,"5")});c.setAction("emacs-digit-argument-6",function(){return b._digitArgument(6)},{name:g.formatMessage(i.digitArgument,"6")});c.setAction("emacs-digit-argument-7",function(){return b._digitArgument(7)},{name:g.formatMessage(i.digitArgument,"7")});c.setAction("emacs-digit-argument-8",
function(){return b._digitArgument(8)},{name:g.formatMessage(i.digitArgument,"8")});c.setAction("emacs-digit-argument-9",function(){return b._digitArgument(9)},{name:g.formatMessage(i.digitArgument,"9")});c.setAction("emacs-negative-argument",function(){return b._negativeArgument()},{name:i.negativeArgument});c.setAction("emacs-uppercase",function(){var h=b._getData();h.unit="word";return c.invokeAction("uppercase",!1,h)},{name:i.uppercase});c.setAction("emacs-lowercase",function(){var h=b._getData();
h.unit="word";return c.invokeAction("lowercase",!1,h)},{name:i.lowercase});c.setAction("emacs-capitalize",function(){var h=b._getData();h.unit="word";return c.invokeAction("capitalize",!1,h)},{name:i.capitalize})};return{EmacsMode:c}});
define("orion/editor/vi",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(i,k,j,g){function c(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function f(a,b,c,d,e,f,h){a=new j.KeyStroke(a,b,c,d,e,f);a.scopeName=h||i.vi;return a}function b(a,b){var c=new j.KeySequence(a);c.scopeName=b||i.vi;return c}function h(a,b,c){this.key=b;this.msg=c;this.number="";k.KeyMode.call(this,a);a&&this._createActions(a)}function e(a){var b=a.getView();this.viMode=
a;k.KeyMode.call(this,b);this._createActions(b)}function d(a,b,c,d){this.viMode=a;this.nextMode=b;h.call(this,a.getView(),c,d)}function a(a){var b=a.getView();k.KeyMode.call(this,b);this.viMode=a;this._createActions(b)}function m(b,c){h.call(this,b,"",i.vimove);this.insertMode=new a(this);this.changeMode=new d(this,this.insertMode,"c",i.vichange);this.deleteMode=new d(this,this,"d",i.videlete);this.yankMode=new d(this,this,"y",i.viyank);this.statusReporter=c}var n,q;h.prototype=new k.KeyMode;c(h.prototype,
{_msg:function(a){return{name:g.formatMessage(i[a],this.msg)}},createKeyBindings:function(){for(var a=[],b=this.key,b=b?"-"+b+"-":"-",c=0;c<=9;c++)a.push({actionID:"vi"+b+c,keyBinding:f(c+"",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi"+b+"Left",keyBinding:f("h",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Left",keyBinding:f("h",!0,!1,!1,!1)});a.push({actionID:"vi"+b+"Left",keyBinding:f(8)});a.push({actionID:"vi"+b+"Left",keyBinding:f(37)});a.push({actionID:"vi"+b+"Down",keyBinding:f("j",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Down",keyBinding:f(40)});a.push({actionID:"vi"+b+"Up",keyBinding:f("k",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Up",keyBinding:f(38)});a.push({actionID:"vi"+b+"Right",keyBinding:f("l",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Right",keyBinding:f(39)});a.push({actionID:"vi"+b+"Right",keyBinding:f(32)});a.push({actionID:"vi"+b+"w",keyBinding:f("w",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"b",keyBinding:f("b",!1,!1,!1,!1,
"keypress")});a.push({actionID:"vi"+b+"W",keyBinding:f("W",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"B",keyBinding:f("B",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"e",keyBinding:f("e",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"E",keyBinding:f("E",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"$",keyBinding:f("$",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:f("^",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:f("_",!1,!1,!1,!1,"keypress")});
a.push({actionID:"vi"+b+"+",keyBinding:f("+",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"+",keyBinding:f(13)});a.push({actionID:"vi"+b+"-",keyBinding:f("-",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"|",keyBinding:f("|",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"H",keyBinding:f("H",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"M",keyBinding:f("M",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"L",keyBinding:f("L",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"/",
keyBinding:f("/",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"?",keyBinding:f("?",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"n",keyBinding:f("n",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"N",keyBinding:f("N",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"f",keyBinding:f("f",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"F",keyBinding:f("F",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"t",keyBinding:f("t",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"T",keyBinding:f("T",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+",",keyBinding:f(",",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+";",keyBinding:f(";",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"G",keyBinding:f("G",!1,!1,!1,!1,"keypress")});return a},_createActions:function(a){function b(c){for(var c=a.getModel().getLine(c),d=0,e=c.charCodeAt(d);e===32||e===9;)d++,e=c.charCodeAt(d);return d}function c(a,b){a&&e.getView().setCaretOffset(a.start);b.editDone&&b.editDone()}var d=this.key,d=d?"-"+d+"-":
"-",e=this;a.setAction("vi"+d+"0",function(){return e._storeNumber(0)});a.setAction("vi"+d+"1",function(){return e._storeNumber(1)});a.setAction("vi"+d+"2",function(){return e._storeNumber(2)});a.setAction("vi"+d+"3",function(){return e._storeNumber(3)});a.setAction("vi"+d+"4",function(){return e._storeNumber(4)});a.setAction("vi"+d+"5",function(){return e._storeNumber(5)});a.setAction("vi"+d+"6",function(){return e._storeNumber(6)});a.setAction("vi"+d+"7",function(){return e._storeNumber(7)});a.setAction("vi"+
d+"8",function(){return e._storeNumber(8)});a.setAction("vi"+d+"9",function(){return e._storeNumber(9)});a.setAction("vi"+d+"Left",function(){return e._invoke("charPrevious",{unit:"character"})},this._msg("viLeft"));a.setAction("vi"+d+"Right",function(){return e._invoke("charNext",{unit:"character"})},this._msg("viRight"));a.setAction("vi"+d+"Up",function(){return e._invoke("lineUp",{editLine:!0})},this._msg("viUp"));a.setAction("vi"+d+"Down",function(){return e._invoke("lineDown",{editLine:!0})},
this._msg("viDown"));a.setAction("vi"+d+"w",function(){return e._invoke("wordNext",{unit:"word"})},this._msg("viw"));a.setAction("vi"+d+"b",function(){return e._invoke("wordPrevious",{unit:"word"})},this._msg("vib"));a.setAction("vi"+d+"W",function(){return e._invoke("wordNext",{unit:"wordWS"})},this._msg("viW"));a.setAction("vi"+d+"B",function(){return e._invoke("wordPrevious",{unit:"wordWS"})},this._msg("viB"));a.setAction("vi"+d+"e",function(){e._invoke("charNext",{unit:"character"});e._invoke("wordNext",
{unit:"wordend"});e._invoke("charPrevious",{unit:"character"});return!0},this._msg("vie"));a.setAction("vi"+d+"E",function(){return e._invoke("wordNext",{unit:"wordendWS"})},this._msg("viE"));a.setAction("vi"+d+"$",function(){return e._invoke("lineEnd")},this._msg("vi$"));a.setAction("vi"+d+"^_",function(){return e._invoke(function(){var c=a.getModel(),d=a.getCaretOffset(),d=c.getLineAtOffset(d);a.setCaretOffset(c.getLineStart(d)+b(d))})},this._msg("vi^_"));a.setAction("vi"+d+"+",function(){return e._invoke(function(c){var d=
a.getModel(),e=a.getCaretOffset(),f=d.getLineCount()-1,c=Math.min(d.getLineAtOffset(e)+c.count,f);a.setCaretOffset(d.getLineStart(c)+b(c))},{editLine:!0})},this._msg("vi+"));a.setAction("vi"+d+"-",function(){return e._invoke(function(c){var d=a.getModel(),e=a.getCaretOffset(),c=Math.max(d.getLineAtOffset(e)-c.count,0);a.setCaretOffset(d.getLineStart(c)+b(c))},{editLine:!0})},this._msg("vi-"));a.setAction("vi"+d+"|",function(){return e._invoke(function(b){var c=a.getModel(),d=a.getCaretOffset(),d=
c.getLineAtOffset(d);a.setCaretOffset(Math.min(c.getLineStart(d)+b.count-1,c.getLineEnd(d)))})},this._msg("vi|"));a.setAction("vi"+d+"H",function(){return e._invoke(function(b){b=a.getModel().getLineStart(a.getTopIndex(!0)+(b.count-1));a.setCaretOffset(b)},{editLine:!0})},this._msg("viH"));a.setAction("vi"+d+"M",function(){return e._invoke(function(){var b=Math.ceil((a.getBottomIndex(!0)-a.getTopIndex(!0))/2)+a.getTopIndex(!0);a.setCaretOffset(a.getModel().getLineStart(b))},{editLine:!0})},this._msg("viM"));
a.setAction("vi"+d+"L",function(){return e._invoke(function(b){a.setCaretOffset(a.getModel().getLineStart(a.getBottomIndex(!0)-(b.count-1)))},{editLine:!0})},this._msg("viL"));a.setAction("vi"+d+"/",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!1,findCallback:function(b){e._searchFwd=!0;c(b,a)}};return e._invoke("find",a)},this._msg("vi/"));a.setAction("vi"+d+"?",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!0,findCallback:function(b){e._searchFwd=!1;c(b,a)}};return e._invoke("find",
a)},this._msg("vi?"));a.setAction("vi"+d+"n",function(){var b,d=a.getCaretOffset();e._searchFwd?(b="findNext",d++):b="findPrevious";var f={start:d,findCallback:function(a){c(a,f)}};return e._invoke(b,f)},this._msg("vin"));a.setAction("vi"+d+"N",function(){var b,d=a.getCaretOffset();e._searchFwd?b="findPrevious":(b="findNext",d++);var f={start:d,findCallback:function(a){c(a,f)}};return e._invoke(b,f)},this._msg("viN"));a.setAction("vi"+d+"f",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(c,
b.getLineEnd(b.getLineAtOffset(c)),!1,0)},this._msg("vif"));a.setAction("vi"+d+"F",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(c)),c,!0,0)},this._msg("viF"));a.setAction("vi"+d+"t",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(c,b.getLineEnd(b.getLineAtOffset(c)),!1,-1)},this._msg("vit"));a.setAction("vi"+d+"T",function(){var b=a.getModel(),c=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(c)),
c,!0,1)},this._msg("viT"));a.setAction("vi"+d+",",function(){return e._findNextChar(e._charTempOptions.reverse)},this._msg("vi,"));a.setAction("vi"+d+";",function(){return e._findNextChar(!e._charTempOptions.reverse)},this._msg("vi;"));a.setAction("vi"+d+"G",function(){if(e.number===""){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());e.number=b.getLineCount()}return e._invoke(function(b){b=b||{};b.line=b.count;b.editLine=!0;b.callback=function(){b.editDone&&b.editDone()};a.invokeAction("gotoLine",
!1,b)})},this._msg("viG"))},_invoke:function(a,b){var c=this.getView(),b=b||{};b.count=this._getCount();typeof a==="function"?a(b):c.invokeAction(a,!1,b);return!0},_getCount:function(){var a=1;this.number!==""&&(a=this.number>>0);this.number="";return a},_findChar:function(a,b,c,d){this._charTempOptions={};this._charTempOptions.start=a;this._charTempOptions.end=b;this._charTempOptions.hideAfterFind=!0;this._charTempOptions.incremental=!1;this._charTempOptions.reverse=c;this._charTempOptions.offset=
d;var e=this._charTempOptions,f=this;this._charTempOptions.findCallback=function(a){a&&f.getView().setCaretOffset(a.start+d);e.editDone&&e.editDone()};return this._invoke("find",this._charTempOptions)},_findNextChar:function(a){if(this._charTempOptions){var b=this.getView(),c={};c.hideAfterFind=this._charTempOptions.hideAfterFind;c.incremental=this._charTempOptions.incremental;c.reverse=this._charTempOptions.reverse;c.wrap=!1;var d=this;c.findCallback=function(a){a&&d.getView().setCaretOffset(a.start+
d._charTempOptions.offset);c.editDone&&c.editDone()};var e=b.getModel();return a?(c.start=b.getCaretOffset()+1-this._charTempOptions.offset,c.end=e.getLineEnd(e.getLineAtOffset(c.start)),c.reverse=!1,this._invoke("findNext",c)):(c.start=b.getCaretOffset()-this._charTempOptions.offset,c.end=e.getLineStart(e.getLineAtOffset(c.start)),c.reverse=!0,this._invoke("findPrevious",c))}return!0},_storeNumber:function(a){var b=this;if(a===0&&!this.number)return this._invoke(function(){b.getView().invokeAction("lineStart",
!0)});this.number+=a;return!0}});e.prototype=new k.KeyMode;c(e.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-:-ESC",keyBinding:f(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-:-ESC",function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=k.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){this.number=a}});d.prototype=new h;c(d.prototype,
{createKeyBindings:function(){var a=h.prototype.createKeyBindings.call(this);a.push({actionID:"vi-"+this.key+"ESC",keyBinding:f(27),predefined:!0});a.push({actionID:"vi-"+this.key+"-"+this.key,keyBinding:f(this.key,!1,!1,!1,!1,"keypress")});return a},_invoke:function(a,b){var b=b||{},c=this.getView(),d=c.getCaretOffset(),e=d,f=c.getModel(),g=this;b.editDone=function(){var a=c.getCaretOffset();if(e>a){var h=e;e=a;a=h}b.editLine&&(e=f.getLineStart(f.getLineAtOffset(e)),a=f.getLineEnd(f.getLineAtOffset(a),
g.key==="c"?!1:!0));g.key==="y"?(n=c.getText(e,a),q=b.editLine,c.setCaretOffset(d)):c.setText("",e,a);c.removeKeyMode(g);c.addKeyMode(g.nextMode)};h.prototype._invoke.call(this,a,b);b.editDone();return!0},_getCount:function(){var a=1;this.firstNumber!==""&&(a=this.firstNumber>>0);var b=1;this.number!==""&&(b=this.number>>0);a*=b;this.number=this.firstNumber="";return a},_createActions:function(a){h.prototype._createActions.call(this,a);var b=this;a.setAction("vi-"+b.key+"ESC",function(){a.removeKeyMode(b);
a.addKeyMode(b.viMode);return!0});a.setAction("vi-"+b.key+"-"+b.key,function(){return b._invoke("lineEnd",{editLine:!0})},this._msg("viycd"))},storeNumber:function(a){this.firstNumber=a},_modeAdded:function(){this.secondNumber=""},_modeRemoved:function(){this.number=this.firstNumber=this.command=""}});a.prototype=new k.KeyMode;c(a.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-insert-ESC",keyBinding:f(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-insert-ESC",
function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=k.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(){}});m.prototype=new h;c(m.prototype,{createKeyBindings:function(){var a=h.prototype.createKeyBindings.call(this);a.push({actionID:"vi-ctrl-f",keyBinding:f("f",!0)});a.push({actionID:"vi-ctrl-b",keyBinding:f("b",!0)});a.push({actionID:"vi-ctrl-e",keyBinding:f("e",!0)});a.push({actionID:"vi-ctrl-y",
keyBinding:f("y",!0)});a.push({actionID:"statusLineMode",keyBinding:f(":",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi-a",keyBinding:f("a",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-A",keyBinding:f("A",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-i",keyBinding:f("i",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-I",keyBinding:f("I",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-o",keyBinding:f("o",!1,!1,!1,!1,"keypress"),predefined:!0});
a.push({actionID:"vi-O",keyBinding:f("O",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-R",keyBinding:f("R",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-s",keyBinding:f("s",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-S",keyBinding:f("S",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-p",keyBinding:f("p",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-P",keyBinding:f("P",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-u",
keyBinding:f("u",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-c",keyBinding:f("c",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-d",keyBinding:f("d",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-y",keyBinding:f("y",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-~",keyBinding:f("~",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-x",keyBinding:f("x",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-X",keyBinding:f("X",
!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-C",keyBinding:f("C",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-D",keyBinding:f("D",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-*",keyBinding:f("*",!1,!1,!1,!1,"keypress"),predefined:!0});return a},getKeyBindings:function(a){var c=k.KeyMode.prototype.getKeyBindings.call(this,a),c=c||[],d=this.changeMode.getKeyBindings(a),e;if(!this.changeMode.isActive())for(e=0;e<d.length;e++)d[e]=b([f("c",!1,!1,!1,!1,"keypress"),
d[e]]);c=c.concat(d);d=this.deleteMode.getKeyBindings(a);if(!this.deleteMode.isActive())for(e=0;e<d.length;e++)d[e]=b([f("d",!1,!1,!1,!1,"keypress"),d[e]]);c=c.concat(d);d=this.yankMode.getKeyBindings(a);if(!this.yankMode.isActive())for(e=0;e<d.length;e++)d[e]=b([f("y",!1,!1,!1,!1,"keypress"),d[e]]);return c=c.concat(d)},match:function(a){var b=k.KeyMode.prototype.match.call(this,a);!b&&a.type==="keypress"&&(b="noop");return b},_createActions:function(a){h.prototype._createActions.call(this,a);var b=
this;a.setAction("vi-ctrl-f",function(){return b._invoke("pageDown")},{name:i.pageDown});a.setAction("vi-ctrl-b",function(){return b._invoke("pageUp")},{name:i.pageUp});a.setAction("vi-ctrl-e",function(){return b._invoke("scrollLineDown")},{name:i.scrollLineDown});a.setAction("vi-ctrl-y",function(){return b._invoke("scrollLineUp")},{name:i.scrollLineUp});a.setAction("vi-a",function(){return b._toInsertMode("charNext")},{name:i.via});a.setAction("vi-A",function(){return b._toInsertMode("lineEnd")},
{name:i.viA});a.setAction("vi-i",function(){return b._toInsertMode("noop")},{name:i.vii});a.setAction("vi-I",function(){return b._toInsertMode("lineStart")},{name:i.viI});a.setAction("vi-O",function(){b._invoke("lineUp");b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:i.viO});a.setAction("vi-o",function(){b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:i.vio});a.setAction("vi-R",function(){return b._toInsertMode("toggleOverwriteMode")},{name:i.viR});a.setAction("vi-s",
function(){return b._toInsertMode("deleteNext",{unit:"char"})},{name:i.vis});a.setAction("vi-S",function(){return b._toInsertMode("deleteLines",{unit:"line"})},{name:i.viS});a.setAction("vi-p",function(){return b._invoke(function(){var a=b.getView(),c=a.getSelection();if(c.start===c.end){var d=a.getModel(),e=a.getCaretOffset();q?c.start=c.end=d.getLineEnd(d.getLineAtOffset(e),!0):(c.start++,c.end++)}a.setText(n,c.start,c.end)})},{name:i.vip});a.setAction("vi-P",function(){return b._invoke(function(){var a=
b.getView(),c=a.getSelection();if(c.start===c.end){var d=a.getModel(),e=a.getCaretOffset();if(q)c.start=c.end=d.getLineStart(d.getLineAtOffset(e))}a.setText(n,c.start,c.end)})},{name:i.viP});a.setAction("vi-u",function(){return b._invoke("undo")},{name:i.Undo});a.setAction("vi-c",function(){a.removeKeyMode(b);a.addKeyMode(b.changeMode);b.changeMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-d",function(){a.removeKeyMode(b);a.addKeyMode(b.deleteMode);b.deleteMode.storeNumber(b.number);
b.number="";return!0});a.setAction("vi-y",function(){a.removeKeyMode(b);a.addKeyMode(b.yankMode);b.yankMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-~",function(){return b._invoke("reversecase")},{name:i.reversecase});a.setAction("vi-x",function(){return b._invoke("deleteNext")},{name:i.deleteNext});a.setAction("vi-X",function(){return b._invoke("deletePrevious")},{name:i.deletePrevious});a.setAction("vi-C",function(){return b._toInsertMode("deleteLineEnd")},{name:i.viC});a.setAction("vi-D",
function(){return b._invoke("deleteLineEnd")},{name:i.deleteLineEnd});a.setAction("vi-*",function(){var a=b.getView(),c=a.getCaretOffset(),c=a.getNextOffset(c+1,{count:-1,unit:"word"}),d=a.getNextOffset(c,{count:1,unit:"wordend"}),a=a.getText(c,d);b._searchFwd=!0;return b._invoke("find",{hideAfterFind:!0,incremental:!1,reverse:!1,findString:a})},{name:i.viStar})},_reportStatus:function(a){this.statusReporter&&this.statusReporter(a)},_toInsertMode:function(a,b){var b=b||{},c=1;this.number!==""&&(c=
this.number>>0);b.count=c;c=this.getView();this.insertMode.storeNumber(this.number);c.invokeAction(a,!1,b);c.removeKeyMode(this);c.addKeyMode(this.insertMode);this.number="";return!0},_modeAdded:function(){this.getView().setOptions({blockCursorVisible:!0})},_modeRemoved:function(){var a=this.getView();a.setOptions({blockCursorVisible:!1});a.removeKeyMode(this.insertMode);a.removeKeyMode(this.changeMode);a.removeKeyMode(this.deleteMode)}});return{VIMode:m}});
define("orion/editorPreferences",[],function(){function i(g,c){this._preferences=g;if(this._callback=c)var f=g.listenForChangedSettings(k,function(b){b.key===f&&c()}.bind(this))}var k="/editor/settings",j={autoSave:!1,autoSaveVisible:!0,autoSaveLocalVisible:!0,autoSaveTimeout:1E3,autoSaveTimeoutVisible:!0,themeVisible:!0,themeLocalVisible:!0,fontSizeVisible:!0,fontSizeLocalVisible:!0,autoLoad:!0,autoLoadVisible:!0,saveDiffs:!0,saveDiffsVisible:!0,contentAssistAutoTrigger:!0,contentAssistAutoTriggerVisible:!0,
showOccurrences:!1,showOccurrencesVisible:!0,autoPairParentheses:!0,autoPairParenthesesVisible:!0,autoPairBraces:!0,autoPairBracesVisible:!0,autoPairSquareBrackets:!0,autoPairSquareBracketsVisible:!0,autoPairAngleBrackets:!1,autoPairAngleBracketsVisible:!0,autoPairQuotations:!0,autoPairQuotationsVisible:!0,autoCompleteComments:!0,autoCompleteCommentsVisible:!0,smartIndentation:!0,smartIndentationVisible:!0,trimTrailingWhiteSpace:!1,trimTrailingWhiteSpaceVisible:!0,tabSize:4,tabSizeVisible:!0,expandTab:!1,
expandTabVisible:!0,scrollAnimation:!0,scrollAnimationVisible:!0,scrollAnimationTimeout:300,scrollAnimationTimeoutVisible:!0,annotationRuler:!0,annotationRulerVisible:!0,lineNumberRuler:!0,lineNumberRulerVisible:!0,foldingRuler:!0,foldingRulerVisible:!0,overviewRuler:!0,overviewRulerVisible:!0,showTabs:!1,showTabsVisible:!0,showSpaces:!1,showSpacesVisible:!0,wordWrap:!1,wordWrapVisible:!0,showMargin:!1,showMarginVisible:!0,marginOffset:80,marginOffsetVisible:!0,keyBindings:"Default",keyBindingsVisible:!0,
keyBindingsLocalVisible:!0};i.prototype={_initialize:function(g){var g=g.get("editorSettings")||{},c;for(c in j)g.hasOwnProperty(c)||(g[c]=j[c]);return g},getPrefs:function(g){this._preferences.getPreferences(k).then(function(c){c=this._initialize(c);typeof c==="string"&&(c=JSON.parse(c));g(c)}.bind(this))},setPrefs:function(g,c){this._preferences.getPreferences(k).then(function(f){f.put("editorSettings",g);g=this._initialize(f);c&&c(g);this._callback&&this._callback(g)}.bind(this))}};return{EditorPreferences:i}});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme"],function(i,k){function j(){}function g(){this.styles=[];var c=new j;c.name="Eclipse";c.annotationRuler="white";c.background="white";c.comment="green";c.keyword="#7f0055";c.text="darkSlateGray";c.string="blue";c.overviewRuler="white";c.lineNumberOdd="#444";c.lineNumberEven="#444";c.lineNumber="#444";c.currentLine="#EAF2FE";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=
b;this.styles.push(c);c=new j;c.name="Prospecto";c.annotationRuler="white";c.background="white";c.comment="#3C802C";c.keyword="#CC4C07";c.text="#333";c.string="#446FBD";c.overviewRuler="white";c.lineNumberOdd="silver";c.lineNumberEven="silver";c.lineNumber="silver";c.currentLine="#EAF2FE";c.tag="#CC4C07";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new j;c.name="Blue";c.annotationRuler="lavender";c.background="aliceBlue";c.comment="indigo";c.keyword="cornFlowerBlue";c.text=
"navy";c.string="cornFlowerBlue";c.overviewRuler="lavender";c.lineNumberOdd="darkSlateGray";c.lineNumberEven="darkSlateGray";c.lineNumber="darkSlateGray";c.currentLine="white";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new j;c.name="Ambience";c.annotationRuler="#3D3D3D";c.background="#202020";c.comment="mediumslateblue";c.keyword="cornFlowerBlue";c.text="darkseagreen";c.string="lightcoral";c.overviewRuler="white";c.lineNumberOdd="black";c.lineNumberEven=
"black";c.lineNumber="black";c.currentLine="lightcyan";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new j;c.name="Tierra";c.annotationRuler="moccasin";c.background="lemonchiffon";c.comment="darkseagreen";c.keyword="darkred";c.text="#555555";c.string="orangered";c.overviewRuler="moccasin";c.lineNumberOdd="chocolate";c.lineNumberEven="chocolate";c.lineNumber="chocolate";c.currentLine="#baa289";c.tag="darkred";c.attribute="cadetBlue";c.fontFamily=f;
c.fontSize=b;this.styles.push(c);c=new j;c.name="Nimbus";c.annotationRuler="#444";c.background="dimgray";c.comment="darkseagreen";c.keyword="darkorange";c.text="white";c.string="cornflowerblue";c.overviewRuler="#444";c.lineNumberOdd="#aaa";c.lineNumberEven="#aaa";c.lineNumber="#aaa";c.currentLine="#aabfbb";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new j;c.name="Adelante";c.annotationRuler="#E2D2B2";c.background="#F1E7C8";c.comment="#5D774E";c.keyword=
"#AF473B";c.text="dimgray";c.string="#DE5D3B";c.overviewRuler="#E2D2B2";c.lineNumberOdd="#AF473B";c.lineNumberEven="#AF473B";c.lineNumber="#AF473B";c.currentLine="#9e937b";c.tag="#AF473B";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new j;c.name="Raspberry Pi";c.annotationRuler="seashell";c.background="seashell";c.comment="#66B32F";c.keyword="#E73E36";c.text="dimgray";c.string="darkorange";c.overviewRuler="seashell";c.lineNumberOdd="#E73E36";c.lineNumberEven="#E73E36";
c.lineNumber="#E73E36";c.currentLine="#F5B1AE";c.tag="#E73E36";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c)}function c(){return this.styles}var f='"Consolas", "Monaco", "Vera Mono", "monospace"',b="10pt";g.prototype.styles=[];g.prototype.getStyles=c;g.prototype.fontSettable=!0;g.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected",version:"5.0"}};g.prototype.parseToXML=function(b){try{var c=
null;if(window.DOMParser){var c=(new DOMParser).parseFromString(b,"text/xml"),d=c.getElementsByTagName("parsererror");return!d||!d.length||!d[0].childNodes.length?c:null}else return c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(b),c}catch(a){}};g.prototype.selectFontSize=function(b){console.log("fontsize: "+b)};g.prototype.importTheme=function(b){console.log("import theme");console.log(b);var c=this.parseToXML(b.parameters.valueFor("name")),d=new j;d.name=c.getElementsByTagName("colorTheme")[0].attributes[1].value;
d.annotationRuler=c.getElementsByTagName("background")[0].attributes[0].value;d.background=c.getElementsByTagName("background")[0].attributes[0].value;d.comment=c.getElementsByTagName("singleLineComment")[0].attributes[0].value;d.keyword=c.getElementsByTagName("keyword")[0].attributes[0].value;d.text=c.getElementsByTagName("foreground")[0].attributes[0].value;d.string=c.getElementsByTagName("string")[0].attributes[0].value;d.overviewRuler=c.getElementsByTagName("background")[0].attributes[0].value;
d.lineNumberOdd=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumberEven=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.lineNumber=c.getElementsByTagName("lineNumber")[0].attributes[0].value;d.currentLine=c.getElementsByTagName("selectionBackground")[0].attributes[0].value;b.items.addTheme(d)};g.prototype.processSettings=function(b){var c=k.TextTheme.getTheme();c.setThemeClass("editorTheme",c.buildStyleSheet("editorTheme",b))};g.prototype.getViewData=function(){var b=
{top:10,left:10,width:400,height:350},c=b.left,d=b.top;b.shapes=[{type:"TEXT",name:i["Line Numbers"],label:"1",x:c+20,y:d+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:i.Background,x:c+46,y:d,width:290,height:b.height,family:"background",fill:"white"},{type:"TEXT",name:i.Strings,label:"'text/javascript'",x:c+134,y:d+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"=",x:c+124,y:d+20,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"RECTANGLE",name:i["Current Line"],x:c+46,y:d+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:i["HTML Attribute"],label:"type",x:c+98,y:d+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:i["Overview Ruler"],x:c+336,y:d,width:14,height:b.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:i.Comments,label:"/* comment */",x:c+75,y:d+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},{type:"TEXT",
name:i["HTML Tag"],label:"<script",x:c+55,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:">",x:c+213,y:d+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Strings,label:"'Result'",x:c+164,y:d+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"multiply(a,b){",x:c+120,y:d+60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"function",
x:c+75,y:d+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"var",x:c+95,y:d+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"output = ",x:c+115,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:";",x:c+205,y:d+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"var",x:c+95,y:d+100,fill:"darkorange",family:"keyword",
font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"result = a*b;",x:c+115,y:d+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Keywords,label:"return",x:c+95,y:d+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"output + result;",x:c+135,y:d+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"}",x:c+75,y:d+140,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:i["HTML Tag"],label:"<\/script>",x:c+55,y:d+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:"<style",x:c+55,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Attribute"],label:"type",x:c+95,y:d+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",name:i.Foreground,label:"=",x:c+121,y:d+200,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i.Strings,
label:"'text/css'",x:c+131,y:d+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:">",x:c+180,y:d+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Class Name"],label:".some-class",x:c+75,y:d+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Class Name"],label:"{",x:c+145,y:d+220,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Attribute"],label:"color:",
x:c+95,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Value"],label:"#123456",x:c+130,y:d+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Text"],label:";",x:c+180,y:d+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["CSS Class Name"],label:"}",x:c+75,y:d+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:i["HTML Tag"],label:"</style>",x:c+55,y:d+280,fill:"darkorange",
family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:i["Annotation Ruler"],x:c,y:d,width:46,height:b.height,family:"annotationRuler",fill:"white"}];for(var a=0;a<16;a++)b.shapes.push({type:"TEXT",name:i["Line Numbers"],label:a+1,x:c+20,y:d+20*a+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return b};return{ThemeData:g,getStyles:c}});
define("orion/widgets/input/TextField",["orion/objects","orion/webui/littlelib"],function(i,k){function j(g,c){i.mixin(this,g);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.textfield=k.$(".setting-control",this.node)}i.mixin(j.prototype,{templateString:'<input type="text" class="setting-control" name="myname"/>',category:null,item:null,element:null,ui:null,show:function(){this.textfield.addEventListener("change",this.change.bind(this));this.postCreate()},
destroy:function(){if(this.node)k.empty(this.node),this.textfield=this.node=null},setStorageItem:function(){},width:function(g){this.textfield.style.width=g},getValue:function(){return this.inputType==="integer"?parseInt(this.textfield.value,10):this.textfield.value},setValue:function(g){this.textfield.value=g},getSelection:function(){return this.getValue()},setSelection:function(g){this.setValue(g)},postCreate:function(){if(this.inputType&&this.inputType==="password")this.textfield.type="password";
this.editmode&&this.editmode==="readonly"&&this.textfield.setAttribute("readonly","true")},change:function(){var g;if(this.selection&&this.selection.value)g=this.selection.value;this.setStorageItem(this.category,this.item,this.element,g,this.ui)}});return j});
define("orion/widgets/input/LabeledTextfield",["orion/objects","orion/webui/littlelib","orion/widgets/input/TextField"],function(i,k,j){function g(c,f){j.apply(this,arguments);this.mylabel=k.$(".setting-label",this.node)}i.mixin(g.prototype,j.prototype,{templateString:'<div class="setting-property"><label><span class="setting-label"></span><input class="setting-control" type="text" /></label></div>',destroy:function(){j.prototype.destroy.call(this);if(this.mylabel)this.mylabel=null},postCreate:function(){j.prototype.postCreate.call(this);
this.mylabel.textContent=this.fieldlabel+":"}});return g});
define("orion/widgets/input/Checkbox",["orion/objects","orion/webui/littlelib"],function(i,k){function j(g,c){i.mixin(this,g);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.checkbox=k.$(".setting-control",this.node)}i.mixin(j.prototype,{templateString:'<label><input class="setting-control settingsCheckbox" type="checkbox"/></label>',show:function(){this.checkbox.addEventListener("change",this.change.bind(this));this.postCreate()},destroy:function(){if(this.node)k.empty(this.node),
this.checkbox=this.node=null},setStorageItem:function(){},isChecked:function(){return this.checkbox.checked},setChecked:function(g){this.checkbox.checked=g},getSelection:function(){return this.isChecked()},setSelection:function(g){this.setChecked(g)},change:function(){this.setStorageItem(this.checkbox.value)},postCreate:function(){this.checkbox.style.width="20px";this.editmode&&this.editmode==="readonly"&&this.checkbox.setAttribute("disabled","disabled")}});return j});
define("orion/widgets/input/LabeledCheckbox",["orion/objects","orion/webui/littlelib","orion/widgets/input/Checkbox"],function(i,k,j){function g(c,f){j.apply(this,arguments);this.mylabel=k.$(".setting-label",this.node)}i.mixin(g.prototype,j.prototype,{templateString:'<label><span class="setting-label"></span><input class="setting-control settingsCheckbox" type="checkbox"/></label>',postCreate:function(){j.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){j.prototype.destroy.call(this);
if(this.mylabel)this.mylabel=null}});return g});
define("orion/widgets/input/Select",["orion/objects","orion/webui/littlelib"],function(i,k){function j(g,c){i.mixin(this,g);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.select=k.$(".setting-control",this.node)}i.mixin(j.prototype,{templateString:'<select class="setting-control" id="selection"></select>',addOptions:function(g){var c=document.createElement("option");c.value=g.value;c.appendChild(document.createTextNode(typeof g.label==="string"?g.label:g.value));
if(g.selected)c.selected="selected";this.select.appendChild(c)},show:function(){this.postCreate()},postCreate:function(){this.options.forEach(this.addOptions.bind(this));this.select.addEventListener("change",this.change.bind(this))},destroy:function(){if(this.node)k.empty(this.node),this.node=this.select=null},setStorageItem:function(){},getSelected:function(){return this.select.value},getSelectedIndex:function(){return this.select.selectedIndex},setSelectedIndex:function(g){this.select.selectedIndex=
g},getSelection:function(){return this.getSelected()},setSelection:function(g){for(var c=0;c<this.options.length;c++)if(this.options[c].value===g){this.setSelectedIndex(c);return}this.setSelectedIndex(0)},change:function(){var g=this.select.value;this.category?this.setStorageItem(this.category,this.item,this.element,g,this.ui):this.setStorageItem(g)}});return j});
define("orion/widgets/input/LabeledSelect",["orion/objects","orion/webui/littlelib","orion/widgets/input/Select"],function(i,k,j){function g(c,f){j.apply(this,arguments);this.mylabel=k.$(".setting-label",this.node)}i.mixin(g.prototype,j.prototype,{templateString:'<div class="setting-property"><label><span class="setting-label"></span><select class="setting-control"></select></label></div>',postCreate:function(){j.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){j.prototype.destroy.call(this);
if(this.mylabel)this.mylabel=null}});return g});
define("orion/widgets/settings/Subsection",[],function(){function i(i){var j=i.sectionName;this.parentNode=i.parentNode;this.children=i.children;i=document.createElement("section");i.classList.add("setting-row");i.setAttribute("role","region");i.setAttribute("aria-labelledby","Navigation-header");var g=document.createElement("h3");g.classList.add("setting-header");g.textContent=j;j=document.createElement("div");j.classList.add("setting-content");i.appendChild(g);i.appendChild(j);this.node=i;this.subsectionContent=
j}i.prototype.show=function(){this.parentNode&&this.parentNode.appendChild(this.node);if(this.children){var i=this;this.children.forEach(function(j){i.subsectionContent.appendChild(j.node);j.show()})}};return i});
define("orion/widgets/settings/EditorSettings","i18n!orion/settings/nls/messages,orion/widgets/input/LabeledTextfield,orion/widgets/input/LabeledCheckbox,orion/widgets/input/LabeledSelect,orion/section,orion/widgets/settings/Subsection,orion/commands,orion/objects,orion/webui/littlelib".split(","),function(i,k,j,g,c,f,b,h,e){function d(a,b,c,d,f){if(!d.local){var h=document.createElement("span");h.classList.add(o);h.classList.add(f[b+"LocalVisible"]?p:s);h.title=i.localSettingsTooltip;h.addEventListener("click",
function(){h.classList.contains(s)?(h.classList.add(p),h.classList.remove(s)):(h.classList.add(s),h.classList.remove(p))});b=e.$("label",a.node);b.parentNode.insertBefore(h,b)}return a}function a(a,b,c){return d(new j(b),a,this,b,c)}function m(a,b,c){b.inputType="integer";return d(new k(b),a,this,b,c)}function n(a,b){return!(this.min<=b[a]&&b[a]<=this.max)?i[a+"Invalid"]:""}function q(a,b){h.mixin(this,a);this.node=b}var o="setting-local-indicator",p="on",s="off",u={editorSettings:{keys:{keyBindings:{values:[{value:"",
label:i.Default},{value:"Emacs",label:"Emacs"},{value:"vi",label:"vi"}],create:function(a,b,c){var e=this.values;b.options=[];for(var f=0;f<e.length;f++){var h=e[f],i={value:h.value,label:h.label};if(h.value===c[a])i.selected=!0;b.options.push(i)}return d(new g(b),a,this,b,c)}}},fileManagement:{autoSave:{create:a},autoSaveTimeout:{min:50,max:1E4,create:m,validate:n},autoLoad:{create:a},saveDiffs:{create:a},trimTrailingWhiteSpace:{create:a}},typing:{autoPairQuotations:{create:a},autoPairParentheses:{create:a},
autoPairBraces:{create:a},autoPairSquareBrackets:{create:a},autoPairAngleBrackets:{create:a},autoCompleteComments:{create:a},smartIndentation:{create:a}},tabs:{tabSize:{min:1,max:16,create:m,validate:n},expandTab:{create:a}},whitespaces:{showTabs:{create:a},showSpaces:{create:a}},wrapping:{wordWrap:{create:a},showMargin:{create:a},marginOffset:{min:10,max:200,create:m,validate:n}},smoothScrolling:{scrollAnimation:{create:a},scrollAnimationTimeout:{min:50,max:1E3,create:m,validate:n}},rulers:{annotationRuler:{create:a},
lineNumberRuler:{create:a},foldingRuler:{create:a},overviewRuler:{create:a}},languageTools:{showOccurrences:{create:a},contentAssistAutoTrigger:{create:a}}}};h.mixin(q.prototype,{templateString:'<div class="sections"></div>',commandTemplate:'<div id="commandButtons"><div id="editorCommands" class="layoutRight sectionActions"></div></div>',createElements:function(){this.node.innerHTML=this.templateString;this.sections=e.$(".sections",this.node);this.createSections();this.local?this.sections.classList.add("local"):
(document.getElementById("pageActions").innerHTML=this.commandTemplate,this.createToolbar())},createSections:function(){var a=this.oldPrefs,b=[],d,h,j=this.themePreferences;if(!this.local&&this.editorThemeWidget)this.editorThemeSection=new c.Section(this.sections,{id:"editorThemeSettings",title:i.EditorThemes,canHide:!0,slideout:!0}),this.editorThemeWidget.renderData(this.editorThemeSection.getContentElement(),"INITIALIZE");else{var k=this.oldThemeStyles;if(a.themeVisible&&(!this.local||a.themeLocalVisible)){var m=
k.styles;d=[];for(var n=0;n<m.length;n++){h={value:m[n].name,label:m[n].name};if(m[n].name===k.style.name)h.selected=!0;d.push(h)}b.push(d=this.themeSelect=new g({fieldlabel:i.Theme,options:d}));d.setStorageItem=function(a){j.setTheme(a)}}if(a.fontSizeVisible&&(!this.local||a.fontSizeLocalVisible)){k=k.style.fontSize;d=[];for(m=8;m<19;m++){h={value:m+"pt",label:m+"pt"};if(h.label===k)h.selected=!0;d.push(h)}b.push(d=this.sizeSelect=new g({fieldlabel:i["Font Size"],options:d}));d.setStorageItem=function(a){j.setFontSize(a)}}!this.local&&
b.length>0&&(b=new f({sectionName:i.Theme,parentNode:this.editorThemeSection.getContentElement(),children:b}),b.show(),b=[])}var q,B;for(B in u)if(u.hasOwnProperty(B)){if(!this.local)q=new c.Section(this.sections,{id:B,title:i[B],canHide:!0,slideout:!0}),d=document.createElement("div"),d.classList.add("setting-info"),d.textContent=i.editorSettingsInfo,h=document.createElement("span"),h.classList.add(o),h.classList.add(p),k=document.createElement("span"),k.classList.add(o),k.classList.add(s),m=document.createElement("span"),
m.classList.add("core-sprite-wrench"),m.classList.add("icon-inline"),m.classList.add("imageSprite"),e.processDOMNodes(d,[h,k,m]),q.getContentElement().appendChild(d);for(var G in u[B])if(u[B].hasOwnProperty(G)){for(var D in u[B][G])if(a[D+"Visible"]&&(!this.local||a[D+"LocalVisible"]))h=u[B][G][D],d={},d.local=this.local,d.fieldlabel=i[D],b.push(h.widget=h.create(D,d,a));!this.local&&b.length>0&&(b=new f({sectionName:i[G],parentNode:q.getContentElement(),children:b}),b.show(),b=[])}}this.local&&b.forEach(function(a){this.sections.appendChild(a.node);
if(!a.hasOwnProperty("setStorageItem"))a.setStorageItem=this.update.bind(this);a.show()}.bind(this))},createToolbar:function(){var a=e.node("editorSettingsToolActionsArea");this.commandService.addCommand(new b.Command({name:i.Restore,tooltip:i["Restore default Editor Settings"],id:"orion.restoreeditorsettings",callback:function(a){this.restore(a.items)}.bind(this)}));this.commandService.registerCommandContribution("restoreEditorSettingCommand","orion.restoreeditorsettings",2);this.commandService.renderCommands("restoreEditorSettingCommand",
a,this,this,"button");this.commandService.addCommand(new b.Command({name:i.Update,tooltip:i["Update Editor Settings"],id:"orion.updateeditorsettings",callback:function(a){this.update(a.items)}.bind(this)}));this.commandService.registerCommandContribution("editorSettingCommand","orion.updateeditorsettings",1);this.commandService.renderCommands("editorSettingCommand",a,this,this,"button")},valueChanged:function(){var a={},b;for(b in this.oldPrefs)this.oldPrefs.hasOwnProperty(b)&&(a[b]=this.oldPrefs[b]);
this.getValues(a);for(var c in a)if(a.hasOwnProperty(c)&&a[c]!==this.oldPrefs[c])return a},validate:function(a){var b="";this._forEach(function(c,d){return d.validate&&(b=d.validate(c,a))?!1:!0});return b},_progress:function(a,b){this.registry&&this.registry.getService("orion.page.message").setProgressResult({Message:a,Severity:b})},update:function(){var a=this.valueChanged();if(a){var b=this.validate(a);if(b){this._progress(b,"Error");return}this.preferences.setPrefs(a,function(){this.setValues(this.oldPrefs=
a);this._progress(i["Editor preferences updated"],"Normal")}.bind(this))}else this.setValues(this.oldPrefs);this.editor&&this.editor.focus()},restore:function(){this.preferences.setPrefs({},function(a){this._show(a);this._progress(i["Editor defaults restored"],"Normal")}.bind(this))},show:function(a,b){if(a)this.node=a;this.themePreferences.getTheme(function(a){this.preferences.getPrefs(function(c){this._show(c,a);b&&b()}.bind(this))}.bind(this))},_show:function(a,b){if(b)this.oldThemeStyles=b;this.oldPrefs=
a;this.createElements();this.setValues(a)},_forEach:function(a){for(var b in u)if(u.hasOwnProperty(b))for(var c in u[b])if(u[b].hasOwnProperty(c))for(var d in u[b][c])if(u[b][c].hasOwnProperty(d)){var e=u[b][c][d];if(e.widget&&!a(d,e))return}},getValues:function(a){this._forEach(function(b,c){a[b]=c.widget.getSelection();if(!this.local){var d=e.$("."+o,c.widget.node);a[b+"LocalVisible"]=d&&d.classList.contains(p)}return!0}.bind(this))},setValues:function(a){this._forEach(function(b,c){c.widget.setSelection(a[b]);
if(!this.local){var d=e.$("."+o,c.widget.node);d&&(a[b+"LocalVisible"]?(d.classList.add(p),d.classList.remove(s)):(d.classList.add(s),d.classList.remove(p)))}return!0}.bind(this))},destroy:function(){if(this.node)this.node=null;if(this.editorThemeWidget)this.editorThemeWidget.destroy(),this.editorThemeWidget=null}});return q});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace All":"Replace All",
"Search ${0}":"Search ${0}","Type a keyword or wild card to search in ":"Type a keyword or wild card to search in ","Search failed.":"Search failed.","No matches found for ${0}":"No matches found for ${0}","Searching...":"Searching...","Resource has been changed by others.":"Resource has been changed by others.","Failed to write file.":"Failed to write file.",Results:"Results","Files ${0} of ${1} matching ${2}":"Files ${0} of ${1} matching ${2}","Replace ${0} with ${1} for files ${2} of ${3}":"Replace ${0} with ${1} for files ${2} of ${3}",
Location:"Location","Click to compare":"Click to compare",'Search again in this folder with "${0}"':'Search again in this folder with "${0}"',"Files replaced":"Files replaced",Status:"Status","${0} out of ${1}  matches replaced.":"${0} out of ${1}  matches replaced.","Replace all matches with...":"Replace all matches with...","Apply Changes":"Apply Changes","Replace all selected matches":"Replace all selected matches","Hide Compare":"Hide Compare","Hide compare view of changes":"Hide compare view of changes",
"Show Compare":"Show Compare","Show compare view of changes":"Show compare view of changes","Show All":"Show All","Show all the results in one page":"Show all the results in one page","< Previous Page":"< Previous Page","Show previous page of search result":"Show previous page of search result","Next Page >":"Next Page >","Show next page of search result":"Show next page of search result","Next result":"Next result","Previous result":"Previous result","Expand all results":"Expand all results","Collapse all results":"Collapse all results",
"Writing files...":"Writing files...","Preparing preview...":"Preparing preview...","Replaced File (${0})":"Replaced File (${0})","Original File (${0})":"Original File (${0})","Sort by Name":"Sort by Name","Compare changes":"Compare changes","Search Results":"Search Results","Replace All Matches":"Replace All Matches","No matches":"No matches",Rename:"Rename","My Saved Searches":"My Saved Searches","Save frequently used searches by choosing ${0} shown above.":"Save frequently used searches by choosing ${0} shown above.",
"Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.","Files that contain:":"Files that contain:",Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","Sort by":"Sort by","File name":"File name","Path name":"Path name",
Save:"Save","Type a name for the search":"Type a name for the search","Save the current search":"Save the current search","Type filter text":"Type filter text","Scope Search":"Scope Search","Open in Search page for this directory":"Open the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.","Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace <td([\\s\\S]*?)</td> with <span$1</span>.":"Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace <td([\\s\\S]*?)</td> with <span$1</span>.",
"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace <td([\\s\\S]*?)</td> with <span$1</span>.":"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace <td([\\s\\S]*?)</td> with <span$1</span>."});
define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(i){function k(j,g,c){i.attach(this);this._binderFunc=g;this.setInputField(j);(j=c?c.group:null)||(j=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=j+"__completion__";this._proposeFromStart=c?c.proposeFromStart:!1;this._extendedProvider=c?c.extendedProvider:null;this._serviceRegistry=c?c.serviceRegistry:null;this._onDelete=c?c.onDelete:null;this._deleteToolTips=
c?c.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];c=function(c){this._binderFunc&&this._binderFunc(function(b){this._bind(b);c.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",c);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:c});c=function(){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",c);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:c});c=function(){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",c);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:c})}k.prototype._removeListeners=function(i){i&&i.forEach(function(g){g.evtTarget.removeEventListener(g.type,g.handler,!1)})};k.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};k.prototype.hasValueOf=function(i){return this._dataList.some(function(g){return g.value===i})};k.prototype.setInputField=function(i){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=i;if(typeof this._inputField==="string")this._inputField=document.getElementById(this._inputField);i=function(){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):this._dismiss()}.bind(this);this._inputField.addEventListener("blur",i);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:i});i=function(g){this.onKeyDown(g)}.bind(this);this._inputField.addEventListener("keydown",i);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:i});i=function(){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",i);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:i});i=function(){if(this._dismissed&&this._binderFunc)this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(g){this._bind(g)}.bind(this))}.bind(this);this._inputField.addEventListener("focus",i);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:i})};k.prototype.onKeyDown=function(i){if(this._dismissed)return!0;var g=i.charCode||i.keyCode;if(g===13){if(this._proposalList&&this._proposalList.length>0&&this._proposalIndex>=
0&&this._proposalIndex<this._proposalList.length)return i.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,i.ctrlKey),i.stopPropagation(),!1}else if((g===40||g===38)&&this._proposalList&&this._proposalList.length>0)return i.preventDefault(),this._walk(g===40),i.stopPropagation(),!1;else if(g===27)return i.preventDefault(),this._dismiss(),!1;else if(g===46&&this._proposalIndex>-1&&this._onDelete)return i.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),i.stopPropagation(),!1;return!0};k.prototype._resetIndexAfterDeletion=function(){if(this._proposalList.length<=1)this._proposalIndex=-1;else if(this._proposalIndex===this._proposalList.length-1)this._proposalIndex=this._proposalList.length-2};k.prototype._bind=function(i){this._dataList=i};k.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};k.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
k.prototype._initUI=function(){this._completionUIContainer=document.getElementById(this._getUIContainerID());if(!this._completionUIContainer)this._completionUIContainer=document.createElement("div"),this._completionUIContainer.id=this._getUIContainerID(),this._completionUIContainer.style.display="none",this._completionUIContainer.className="inputCompletionContainer",this._completionUIContainer.setAttribute("role","list"),this._completionUIContainer.setAttribute("aria-atomic","true"),this._completionUIContainer.setAttribute("aria-live",
"assertive"),document.body.appendChild(this._completionUIContainer);this._completionUIContainer.textContent="";this._completionUL=document.getElementById(this._getUIProposalListId());if(!this._completionUL)this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL";this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};k.prototype._createProposalLink=function(i,g,c,f){var b=
document.createElement("a");b.href=require.toUrl(g);b.appendChild(this._createBoldText(i,c,f));return b};k.prototype._createBoldText=function(i,g,c,f){if(g<0)return document.createTextNode(i);var f=f?f:document.createElement("span"),b;0!==g&&(b=document.createTextNode(i.substring(0,g)),f.appendChild(b));var h=document.createElement("b");f.appendChild(h);b=document.createTextNode(i.substring(g,g+c));h.appendChild(b);g+c<i.length&&(b=document.createTextNode(i.substring(g+c)),f.appendChild(b));return f};
k.prototype._proposeOnCategory=function(i,g){if(g.length!==0){var c;if(i){c=document.createElement("li");c.className="inputCompletionLICategory";var f=document.createTextNode(i);c.appendChild(f);this._completionUL.appendChild(c)}g.forEach(function(b){c=document.createElement("li");c.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);c.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);c.className="inputCompletionLINormal";c.completionItem=b.item;
var f;if(typeof b.item.value==="string"){var e=document.createElement("table");e.style.width="100%";e.style.tableLayout="fixed";e.style.borderSpacing="0";var d=document.createElement("tr");d.style.width=this._inputField.offsetWidth+"px";e.appendChild(d);var a=document.createElement("td");a.classList.add("inputCompletionLILeftTD");var g=this._createBoldText(b.item.value,b.boldIndex,b.boldLength);a.appendChild(g);a.style.overflow="hidden";d.appendChild(a);if(this._onDelete)f=document.createElement("button"),
f.classList.add("inputCompletionDismissButton"),f.classList.add("layoutRight"),f.classList.add("core-sprite-close"),f.classList.add("imageSprite"),f.style.display="none",f.style.margin="0 0 0",f.title=this._deleteToolTips,f.onclick=function(a){a.stopPropagation();this._onDelete(b.item.value,this);this._resetIndexAfterDeletion()}.bind(this),a=document.createElement("td"),a.classList.add("inputCompletionLIRightTD"),a.appendChild(f),d.appendChild(a);c.appendChild(e)}else b.item.value.name&&b.item.value.type===
"link"&&c.appendChild(this._createProposalLink(b.item.value.name,b.item.value.value,b.boldIndex,b.boldLength));this._completionUL.appendChild(c);this._proposalList.push({item:b.item,domNode:c,deleteBtn:f})}.bind(this))}};k.prototype._domNode2Index=function(i){if(this._proposalList)for(var g=0;g<this._proposalList.length;g++)if(this._proposalList[g].domNode===i)return g;return-1};k.prototype._highlight=function(i,g){var c=i,f,b=!1;if(!isNaN(c))b=!0,this._proposalList&&i>=0&&i<this._proposalList.length?
(c=this._proposalList[i].domNode,f=this._proposalList[i].deleteBtn):c=null;if(c){c.className=g?"inputCompletionLISelected":"inputCompletionLINormal";if(f)f.style.display=g?"":"none";g&&b&&(c.offsetTop<this._completionUIContainer.scrollTop?c.scrollIntoView(!0):c.offsetTop+c.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&c.scrollIntoView(!1))}};k.prototype._selectProposal=function(i,g){var c=i;isNaN(c)&&(c=this._domNode2Index(i));if(c!==this._proposalIndex||
g)this._highlight(this._proposalIndex,!1),this._proposalIndex=c,this._highlight(this._proposalIndex,!0)};k.prototype._dismiss=function(i,g){if(!this._mouseDown){this._dismissed=!0;this._proposalList=null;this._proposalIndex=-1;if(typeof i==="string")this._inputField.value=i,this._dismissing=!0,this._inputField.focus();else if(i&&i.name&&i.type==="link")g?window.open(i.value):window.location.href=i.value;window.setTimeout(function(){this._completionUIContainer.style.display="none"}.bind(this),200)}};
k.prototype._show=function(){if(this._proposalList&&this._proposalList.length>0){for(var i=0,g=0,c=this._inputField;c;)i+=c.offsetLeft,g+=c.offsetTop,c=c.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=g+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=i+"px";this._completionUIContainer.style.width=this._inputField.offsetWidth+"px";this._dismissed=this._mouseDown=!1}else this._dismissed=!0,this._proposalList=null,this._proposalIndex=
-1,this._completionUIContainer.style.display="none"};k.prototype._walk=function(i){i=this._proposalIndex+(i?1:-1);i<-1?i=this._proposalList.length-1:i>=this._proposalList.length&&(i=-1);this._selectProposal(i)};k.prototype._proposeOnList=function(i,g,c){var f="",b=[],h=g?g.length:0;i.forEach(function(e){if(e.type==="category")this._proposeOnCategory(f,b),f=e.label,b=[];else{var d=!0,a=-1;if(g&&c){var i;typeof e.value==="string"?i=e.value.toLowerCase():e.value.name&&(i=e.value.name.toLowerCase());
a=i.indexOf(g);a<0?d=!1:this._proposeFromStart&&(d=a===0)}d&&b.push({item:e,boldIndex:a,boldLength:h})}}.bind(this));this._proposeOnCategory(f,b)};k.prototype._proposeOn=function(i){this._completionUL.textContent="";var g=i?i.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,g,!0);this._extendedProvider&&g?this._extendedProvider(i,function(c){c&&c.forEach(function(c){this._proposeOnList(c.proposals,c.filterForMe?g:i,c.filterForMe)}.bind(this));this._show()}.bind(this),[]):
this._show()};k.prototype.constructor=k;return{InputCompletion:k}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages,orion/editor/find,orion/commands,orion/objects,orion/searchUtils,orion/inputCompletion/inputCompletion,orion/webui/littlelib".split(","),function(i,k,j,g,c,f,b){function h(b,c,a,f,h){k.Find.call(this,b,f,h);this._serviceRegistry=c;this._commandService=a}h.prototype=new k.Find;g.mixin(h.prototype,{getFindString:function(){var b=document.getElementById("localSearchFindWith");return!b?k.Find.prototype.getFindString.call(this):
b.value},getReplaceString:function(){var b=document.getElementById("localSearchReplaceWith");return!b?k.Find.prototype.getReplaceString(this):b.value},hide:function(){var b=this.isVisible();k.Find.prototype.hide.call(this);b&&this._commandService.closeParameterCollector()},show:function(b){k.Find.prototype.show.call(this,b);var c=b.findString;this._addRecentfind(c);var b=b.replaceString,a=document.getElementById("localSearchFindWith");a||(this._createActionTable(),a=document.getElementById("localSearchFindWith"));
if(c)a.value=c;if(b)document.getElementById("localSearchReplaceWith").value=b;window.setTimeout(function(){a.select();a.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw==",this._replaceInfo.title=i["Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace <td([\\s\\S]*?)</td> with <span$1</span>."]):
(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAEAAACH5BAEAABIALAAAAAAHAAgAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAgsAPcpQzMJjbJ9xNAQQ6hwUqaHDws+3PeQoMN9DiUuzFRQ2ZiDyyYdHFhwYUAAOw==",
this._replaceInfo.title=i["Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace <td([\\s\\S]*?)</td> with <span$1</span>."]);this._replaceInfo.style.display=""},_createActionTable:function(){var b=this;this._commandService.openParameterCollector("pageNavigationActions",function(c){var a=document.createElement("input");a.type="text";a.name=i["Find:"];a.className="parameterInput";a.id="localSearchFindWith";a.placeholder=
i["Find With"];a.oninput=function(a){return b._handleInput(a)};a.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(a);b._initCompletion(a);b._createButton(i.Next,c,function(){b._addRecentfind(b.getFindString());b.find(!0)});b._createButton(i.Previous,c,function(){b._addRecentfind(b.getFindString());b.find(!1)});var f=b._editor.getTextView().getOptions("readonly");if(!f){var h=document.createElement("input");h.type="text";h.name=i["ReplaceWith:"];h.className="parameterInput";h.id="localSearchReplaceWith";
h.placeholder=i["Replace With"];h.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(h);b._replaceInfo=b._createInfoImage(null,c,null);b._showReplaceInfo();b._createButton(i.Replace,c,function(){b.replace()});b._createButton(i["Replace All"],c,function(){b.replaceAll()})}h=document.createElement("div");c.appendChild(h);h.classList.add("findOptionsDiv");var g=j.createDropdownMenu(h,i.Options,null,"dismissButton",null,!0);g.menuButton.classList.add("parameterInlineButton");j.createCheckedMenuItem(g.menu,
i["Show all"],b._showAll,function(a){b.setOptions({showAll:a.target.checked});g.dropdown.close(!0)});j.createCheckedMenuItem(g.menu,i["Case sensitive"],!b._caseInsensitive,function(a){b.setOptions({caseInsensitive:!a.target.checked});g.dropdown.close(!0);b.find(!0)});j.createCheckedMenuItem(g.menu,i["Wrap search"],b._wrap,function(a){b.setOptions({wrap:a.target.checked});g.dropdown.close(!0)});j.createCheckedMenuItem(g.menu,i["Incremental search"],b._incremental,function(a){b.setOptions({incremental:a.target.checked});
g.dropdown.close(!0)});j.createCheckedMenuItem(g.menu,i["Whole Word"],b._wholeWord,function(a){b.setOptions({wholeWord:a.target.checked});g.dropdown.close(!0);b.find(!0)});b._regExBox=j.createCheckedMenuItem(g.menu,i["Regular expression"],b._regex,function(a){b.setOptions({regex:a.target.checked});g.dropdown.close(!0);b.find(!0);b._showReplaceInfo()});f||j.createCheckedMenuItem(g.menu,i["Find after replace"],b._findAfterReplace,function(a){b.setOptions({findAfterReplace:a.target.checked});g.dropdown.close(!0)});
return a},function(){b.hide()})},_storeRecentFind:function(b,c,a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(f){f.put("recentFind",b);c&&window.setTimeout(function(){c.dispatchEvent({type:"inputDataListChanged",deleting:a})}.bind(this),20)})},_addRecentfind:function(b){typeof b==="string"&&b&&(!this._completion||!this._completion.hasValueOf(b))&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var a,
c=c.get("recentFind");typeof c==="string"&&(c=JSON.parse(c));if(c){for(a in c)if(c[a].name===b)return;c.length>=30&&c.splice(29,c.length-30+1)}else c=[];c.splice(0,0,{name:b});this._storeRecentFind(c,this._completion)}.bind(this))},_removeRecentSearch:function(b,c){typeof b==="string"&&b&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var f,a=a.get("recentFind");typeof a==="string"&&(a=JSON.parse(a));if(a)for(f in a)if(a[f].name===b){a.splice(f,
1);this._storeRecentFind(a,c,!0);break}}.bind(this))},_initCompletion:function(b){if(this._completion)this._completion.setInputField(b);else{var c=function(a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get("recentFind");typeof b==="string"&&(b=JSON.parse(b));if(b){var c=[];b.forEach(function(a){c.push({type:"proposal",label:a.name,value:a.name})});a(c)}})}.bind(this);this._completion=new f.InputCompletion(b,c,{serviceRegistry:this._serviceRegistry,
group:"localSearch",onDelete:function(a,b){this._removeRecentSearch(a,b)}.bind(this),deleteToolTips:i["Click or use delete key to delete the search term"]})}},_createButton:function(c,d,a){var f=document.createElement("button");f.addEventListener("click",a.bind(this),!1);var h=this;f.addEventListener("keydown",function(a){a.keyCode===b.KEY.ESCAPE&&h.hide()});f.appendChild(document.createTextNode(c));f.className="dismissButton parameterInlineButton";d.appendChild(f)},_createInfoImage:function(b,c){var a=
document.createElement("img");a.classList.add("replaceInfo");a.addEventListener("click",function(){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);this._showReplaceInfo()}.bind(this));c.appendChild(a);return a},_handleInput:function(){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(b){var c=(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&!b.shiftKey;if(c&&b.keyCode===70)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,
!1;if((this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&b.keyCode===75||b.keyCode===13)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this._addRecentfind(this.getFindString()),b.keyCode===13?this.find(this._reverse?b.shiftKey:!b.shiftKey):this.find(!b.shiftKey),!1;if(c&&b.keyCode===82)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this.replace(),!1;return b.keyCode===27?(this.hide(),!1):!0}});return{TextSearcher:h}});
define("orion/edit/dispatcher",["orion/edit/dispatcher"],function(){function i(i,j,g){this.serviceRegistry=i;this.editor=j;this.inputManager=g;this.contentTypeService=i.getService("orion.core.contentTypeRegistry");if(!this.contentTypeService)throw Error("Missing required service");this.serviceReferences={};var c=this;this.listener={onServiceAdded:function(f){c._onServiceAdded(f.serviceReference)},onServiceRemoved:function(f){c._onServiceRemoved(f.serviceReference)}};this.serviceRegistry.addEventListener("registered",
this.listener.onServiceAdded);this.serviceRegistry.addEventListener("unregistering",this.listener.onServiceRemoved);this._init()}i.prototype={_init:function(){var i=this;this.editor.getTextView()?this._wire(this.serviceRegistry):this.editor.addEventListener("TextViewInstalled",function(){i._wire(i.serviceRegistry)})},_wire:function(i){for(var i=i.getServiceReferences("orion.edit.model"),j=0;j<i.length;j++)this._wireServiceReference(i[j])},_wireServiceReference:function(i){var j=i.getProperty("contentType");
if(typeof j!==void 0&&j!==null){var g=this;this.contentTypeService.isSomeExtensionOf(this.inputManager.getContentType(),j).then(function(c){c&&g._wireService(i,g.serviceRegistry.getService(i))})}},_wireService:function(i,j){for(var g=Object.keys(j),c=this.editor.getTextView(),f=0;f<g.length;f++){var b=g[f],h=j[b];b.substr(0,2)!=="on"||typeof h!=="function"||(b=b.substr(2),this._wireServiceMethod(i,j,h,c,b))}this._initService(j,c)},_wireServiceMethod:function(i,j,g,c,f){j=function(b){g(b).then()};
i=i.getProperty("service.id");this.serviceReferences[i]=this.serviceReferences[i]||[];this.serviceReferences[i].push([c,f,j]);c.addEventListener(f,j)},_onServiceRemoved:function(i){var i=i.getProperty("service.id"),j=this.serviceReferences[i];if(j){for(var g=0;g<j.length;g++){var c=j[g];c[0].removeEventListener(c[1],c[2])}delete this.serviceReferences[i]}},_onServiceAdded:function(i){i.getProperty("objectClass").indexOf("orion.edit.model")!==-1&&this._wireServiceReference(i)},_initService:function(i,
j){var g=i.onModelChanging;if(typeof g==="function"){var c=j.getModel(),f=c.getText(),c={type:"Changing",text:f,start:0,removedCharCount:0,addedCharCount:f.length,removedLineCount:0,addedLineCount:c.getLineCount()};g.call(i,c)}}};return{Dispatcher:i}});
define("orion/edit/typedefs",["orion/objects","orion/serviceTracker"],function(i,k){function j(g){this.props=Object.create(null);this.defs=Object.create(null);this.registration=null;var c=new k(g,"orion.core.typedef"),f=this;c.onServiceAdded=function(b){var c=b.getProperty("id"),e=b.getProperty("defs");if(!c||!e)throw Error("TypeDef registration missing required 'id' or 'defs' [service id: "+b.getProperty("service.id")+"]");var d={};b.getPropertyKeys().forEach(function(a){a!=="defs"&&a!=="service.id"&&
a!=="service.names"&&a!=="objectClass"&&(d[a]=b.getProperty(a))});f.props[c]=d;f.defs[c]=e;f._updateRegistration()};c.removedService=function(b){b=b.getProperty("id");delete f.props[b];delete f.defs[b];f._updateRegistration()};c.open();this.registration=g.registerService("orion.edit.context",{getTypeDef:this.getTypeDef.bind(this)},null);this._updateRegistration()}i.mixin(j.prototype,{_updateRegistration:function(){this.registration&&this.registration.setProperties({typeDefs:this.getAllProperties()})},
getTypeDef:function(g){return this.defs[g]||null},getProperties:function(g){return this.props[g]||null},getAllProperties:function(){return this.props}});return j});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",patterns:[{include:"#brace_open"},{include:"#brace_close"},{include:"#bracket_open"},{include:"#bracket_close"},{include:"#parenthesis_open"},{include:"#parenthesis_close"},{include:"#number_decimal"},{include:"#number_hex"},{include:"#string_doubleQuote"},{include:"#string_singleQuote"}],repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},
bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},doc_block:{begin:"/\\*\\*",end:"\\*/",name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\<\\S*\\>",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",
name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",
name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",patterns:[{include:"orion.lib"},{include:"#comment_singleLine"},{include:"#comment_block"}],repository:{comment_singleLine:{match:"//.*",name:"comment.line.double-slash",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:"/\\*",end:"\\*/",name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",
captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(i){var k="break,case,class,catch,continue,const,debugger,default,delete,do,else,enum,export,extends,false,finally,for,function,if,implements,import,in,instanceof,interface,let,new,null,package,private,protected,public,return,static,super,switch,this,throw,true,try,typeof,undefined,var,void,while,with,yield".split(","),i=i.grammars;i.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{include:"orion.lib#doc_block"},
{include:"orion.c-like"},{match:"\\b(?:"+k.join("|")+")\\b",name:"keyword.control.js"},{match:"/(?![\\s])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"}]});return{id:i[i.length-1].id,grammars:i,keywords:k}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(i){var k="abstract,boolean,break,byte,case,catch,char,class,continue,default,do,double,else,extends,false,final,finally,float,for,if,implements,import,instanceof,int,interface,long,native,new,null,package,private,protected,public,return,short,static,super,switch,synchronized,this,throw,throws,transient,true,try,void,volatile,while".split(","),i=i.grammars;i.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#doc_block"},{include:"orion.c-like"},{match:"\\b(?:"+k.join("|")+")\\b",name:"keyword.control.java"}],repository:{string_singleQuote:{}}});return{id:i[i.length-1].id,grammars:i,keywords:k}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(i){var k="alignment-adjust,alignment-baseline,animation-delay,animation-direction,animation-duration,animation-iteration-count,animation-name,animation-play-state,animation-timing-function,animation,appearance,azimuth,backface-visibility,background-attachment,background-clip,background-color,background-image,background-origin,background-position,background-repeat,background-size,background,baseline-shift,binding,bleed,bookmark-label,bookmark-level,bookmark-state,bookmark-target,border-bottom-color,border-bottom-left-radius,border-bottom-right-radius,border-bottom-style,border-bottom-width,border-bottom,border-collapse,border-color,border-image-outset,border-image-repeat,border-image-slice,border-image-source,border-image-width,border-image,border-left-color,border-left-style,border-left-width,border-left,border-radius,border-right-color,border-right-style,border-right-width,border-right,border-spacing,border-style,border-top-color,border-top-left-radius,border-top-right-radius,border-top-style,border-top-width,border-top,border-width,border,bottom,box-align,box-decoration-break,box-direction,box-flex-group,box-flex,box-lines,box-ordinal-group,box-orient,box-pack,box-shadow,box-sizing,break-after,break-before,break-inside,caption-side,clear,clip,color-profile,color,column-count,column-fill,column-gap,column-rule-color,column-rule-style,column-rule-width,column-rule,column-span,column-width,columns,content,counter-increment,counter-reset,crop,cue-after,cue-before,cue,cursor,direction,display,dominant-baseline,drop-initial-after-adjust,drop-initial-after-align,drop-initial-before-adjust,drop-initial-before-align,drop-initial-size,drop-initial-value,elevation,empty-cells,fit-position,fit,flex-align,flex-flow,flex-inline-pack,flex-order,flex-pack,float-offset,float,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,font,grid-columns,grid-rows,hanging-punctuation,height,hyphenate-after,hyphenate-before,hyphenate-character,hyphenate-lines,hyphenate-resource,hyphens,icon,image-orientation,image-rendering,image-resolution,inline-box-align,left,letter-spacing,line-height,line-stacking-ruby,line-stacking-shift,line-stacking-strategy,line-stacking,list-style-image,list-style-position,list-style-type,list-style,margin-bottom,margin-left,margin-right,margin-top,margin,mark-after,mark-before,mark,marker-offset,marks,marquee-direction,marquee-loop,marquee-play-count,marquee-speed,marquee-style,max-height,max-width,min-height,min-width,move-to,nav-down,nav-index,nav-left,nav-right,nav-up,opacity,orphans,outline-color,outline-offset,outline-style,outline-width,outline,overflow-style,overflow-x,overflow-y,overflow,padding-bottom,padding-left,padding-right,padding-top,padding,page-break-after,page-break-before,page-break-inside,page-policy,page,pause-after,pause-before,pause,perspective-origin,perspective,phonemes,pitch-range,pitch,play-during,position,presentation-level,punctuation-trim,quotes,rendering-intent,resize,rest-after,rest-before,rest,richness,right,rotation-point,rotation,ruby-align,ruby-overhang,ruby-position,ruby-span,size,speak-header,speak-numeral,speak-punctuation,speak,speech-rate,stress,string-set,table-layout,target-name,target-new,target-position,target,text-align-last,text-align,text-decoration,text-emphasis,text-height,text-indent,text-justify,text-outline,text-shadow,text-transform,text-wrap,top,transform-origin,transform-style,transform,transition-delay,transition-duration,transition-property,transition-timing-function,transition,unicode-bidi,vertical-align,visibility,voice-balance,voice-duration,voice-family,voice-pitch-range,voice-pitch,voice-rate,voice-stress,voice-volume,volume,white-space-collapse,white-space,widows,width,word-break,word-spacing,word-wrap,z-index".split(","),i=
i.grammars;i.push({id:"orion.css",contentTypes:["text/css"],patterns:[{include:"orion.lib"},{include:"orion.c-like#comment_block"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+k.join("|")+")\\b",name:"keyword.control.css"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{begin:"(['\"])(?:\\\\.|[^\\\\\\1])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\\\1])*(\\1|[^\\\\]$))",name:"string.quoted.multiline.css"}],
repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});return{id:i[i.length-1].id,grammars:i,keywords:k}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(i,k,j,g){function c(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function f(){c.call(this,null,!0)}function b(a){c.call(this,null,a)}function h(){c.call(this,null,!1)}function e(e,g,i){this.commentStart="/*";this.commentEnd="*/";var j=[];switch(g){case "java":j=a;break;
case "js":j=d;break;case "css":j=m}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new c(j,this.whitespacesVisible);this._firstScanner=new h;this._commentScanner=new b(this.whitespacesVisible);this._whitespaceScanner=new f;if(g==="css")this._scanner.isCSS=!0,this._firstScanner.isCSS=!0;this.view=e;this.annotationModel=i;this._bracketAnnotations=void 0;var l=this;this._listener=
{onChanged:function(a){l._onModelChanged(a)},onDestroy:function(a){l._onDestroy(a)},onLineStyle:function(a){l._onLineStyle(a)},onMouseDown:function(a){l._onMouseDown(a)},onSelection:function(a){l._onSelection(a)}};g=e.getModel();g.getBaseModel&&(g=g.getBaseModel());g.addEventListener("Changed",this._listener.onChanged);e.addEventListener("MouseDown",this._listener.onMouseDown);e.addEventListener("Selection",this._listener.onSelection);e.addEventListener("Destroy",this._listener.onDestroy);e.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();e.redrawLines()}var d=k.keywords,a=j.keywords,m=g.keywords,n={styleClass:"comment"},q={styleClass:"comment"},o={styleClass:"comment block documentation"},p={styleClass:"keyword other documentation markup"},s={styleClass:"keyword other documentation task"},u={styleClass:"keyword other documentation tag"},v={styleClass:"string"},t={styleClass:"constant numeric"},w={styleClass:"keyword"},l={styleClass:"punctuation separator space",
unmergeable:!0},r={styleClass:"punctuation separator tab",unmergeable:!0},y={styleClass:"meta annotation currentLine"};c.prototype={getOffset:function(){return this.offset},getStartOffset:function(){return this.startOffset},getData:function(){return this.text.substring(this.startOffset,this.offset)},getDataLength:function(){return this.offset-this.startOffset},_default:function(a){switch(a){case 32:case 9:if(this.whitespacesVisible)return a===32?11:10;do a=this._read();while(a===32||a===9);this._unread(a);
return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var b=this.isCSS,c=this.offset-1;if(!b&&48<=a&&a<=57){var d=b=!1,e=!1,f=a;do if(a=this._read(),a===46&&!b)b=!0;else if(a===101&&!d)b=d=!0,a=this._read(),a!==45&&this._unread(a);else if(a===120&&f===48&&this.offset-c===2)b=d=e=!0;else if(!(48<=a&&a<=57||e&&(65<=a&&a<=70||97<=a&&a<=102)))break;while(1);this._unread(a);return 3}if(97<=a&&a<=122||65<=a&&a<=90||a===95||45===a&&b){do a=this._read();while(97<=a&&
a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57||45===a&&b);this._unread(a);a=this.keywords;if(a.length>0){c=this.text.substring(c,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===c)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){a!==-1&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),b;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&a===47)for(;;)if(a=
this._read(),a===-1||a===10||a===13)return this._unread(a),6;if(a===42){a=this._read();b=7;for(a===42&&(b=8);;){for(;a===42;)if(a=this._read(),a===47)return b;if(a===-1)return this._unread(a),b;a=this._read()}}this._unread(a);return 1;case 39:for(b=4;;)switch(a=this._read(),a){case 39:return b;case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),a!==10&&this._unread(a)}}break;case 34:for(b=4;;)switch(a=this._read(),a){case 34:return b;
case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),a!==10&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};f.prototype=new c(null);f.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(a===32||a===9||a===-1));this._unread(a);
return 1}}};b.prototype=new c(null);b.prototype.setType=function(a){this._type=a};b.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return a===32?11:10;do a=this._read();while(a===32||a===9);this._unread(a);return 9;case 60:if(this._type===8){do a=this._read();while(!(a===62||a===-1));if(a===62)return 12}return 1;case 64:if(this._type===8){do a=this._read();while(97<=a&&a<=122||65<=a&&a<=
90||a===95||48<=a&&a<=57);this._unread(a);return 13}return 1;case 84:if((a=this._read())===79)if((a=this._read())===68)if((a=this._read())===79)if(a=this._read(),!(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(a===32||a===9||a===-1||a===60||a===64||a===84));this._unread(a);return 1}}};h.prototype=new c(null);h.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};e.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,
b){if(this.whitespacesVisible!==a)this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw()},setTabsVisible:function(a){if(this.tabsVisible!==a)this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw()},setSpacesVisible:function(a){if(this.spacesVisible!==a)this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw()},setDetectHyperlinks:function(a){this.detectHyperlinks=
a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;d===void 0&&(d=-1);if(e===void 0)e=a.length;for(;e-d>1;)if(f=Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=f;break}else d=f;return e},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();
if(a.getBaseModel){var b=this.annotationModel;if(b){b.removeAnnotations(i.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var h=e[f];(h=this._createFoldingAnnotation(a,d,h.start,h.end))&&c.push(h)}b.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c),b=b.getLineAtOffset(d);return e===b?null:new (i.AnnotationType.getType(i.AnnotationType.ANNOTATION_FOLDING))(c,d,a)},_computeTasks:function(a,b,c){if(this.detectTasks){var d=
this.annotationModel;if(d){var e=this.view.getModel(),f=e;e.getBaseModel&&(f=e.getBaseModel());for(var h=d.getAnnotations(b,c),e=[],g=i.AnnotationType.ANNOTATION_TASK;h.hasNext();){var j=h.next();j.type===g&&e.push(j)}h=[];j=this._commentScanner;j.setText(f.getText(b,c));for(var l;l=j.nextToken();){var k=j.getStartOffset()+b;l===14&&(l=f.getLineEnd(f.getLineAtOffset(k)),a!==6&&(l=Math.min(l,c-this.commentEnd.length)),h.push(i.AnnotationType.createAnnotation(g,k,l,f.getText(k,l))))}d.replaceAnnotations(e,
h)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)===a)return y}return null},_getStyles:function(a,b,c){a.getBaseModel&&(c=a.mapOffset(c));for(var d=c+b.length,e=[],f=c,h=this.comments,g=this._binarySearch(h,c,!0);g<h.length;g++){if(h[g].start>=d)break;var i=h[g].start,j=h[g].end;f<i&&this._parse(b.substring(f-c,i-c),f,e);var l=h[g].type,k;switch(l){case 8:k=o;break;case 7:k=q;break;case 5:k=
v}f=Math.max(f,i);i=Math.min(d,j);(l===8||l===7)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,i-c),f,e,k,l):l===5&&this.whitespacesVisible?this._parseString(b.substring(f-c,i-c),f,e,v):e.push({start:f,end:i,style:k});f=j}f<d&&this._parse(b.substring(f-c,d-c),f,e);if(a.getBaseModel)for(b=0;b<e.length;b++)c=e[b].end-e[b].start,e[b].start=a.mapOffset(e[b].start,!0),e[b].end=e[b].start+c;return e},_parse:function(a,b,c){var d=this._scanner;for(d.setText(a);a=d.nextToken();){var e=
d.getStartOffset()+b,f=null;switch(a){case 2:f=w;break;case 3:f=t;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(d.getData(),e,c,v);continue}else f=v;break;case 8:this._parseComment(d.getData(),e,c,o,a);continue;case 6:this._parseComment(d.getData(),e,c,n,a);continue;case 7:this._parseComment(d.getData(),e,c,q,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=r);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=l)}c.push({start:e,end:d.getOffset()+b,
style:f})}},_parseComment:function(a,b,c,d,e){var f=this._commentScanner;f.setText(a);for(f.setType(e);a=f.nextToken();){var e=f.getStartOffset()+b,h=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(h=r);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=l);break;case 12:h=p;break;case 13:h=u;break;case 14:h=s;break;default:this.detectHyperlinks&&(h=this._detectHyperlinks(f.getData(),e,c,h))}h&&c.push({start:e,end:f.getOffset()+b,style:h})}},_parseString:function(a,b,c,d){var e=
this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,h=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(h=r);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=l)}h&&c.push({start:f,end:e.getOffset()+b,style:h})}},_detectHyperlinks:function(a,b,c,d){var e=null,f;if((f=a.indexOf("://"))>0){for(var e=a,h=f;h>0;){f=e.charCodeAt(h-1);if(!(97<=f&&f<=122||65<=f&&f<=90||45===f||48<=f&&f<=57))break;h--}if(h>0&&(f="\"\"''(){}[]<>".indexOf(e.substring(h-
1,h)),f!==-1&&(f&1)===0&&(f=e.lastIndexOf("\"\"''(){}[]<>".substring(f+1,f+2)))!==-1)){var g=f;f=this._clone(d);f.tagName="a";f.attributes={href:e.substring(h,g)};c.push({start:b,end:b+h,style:d});c.push({start:b+h,end:b+g,style:f});c.push({start:b+g,end:b+a.length,style:d});return null}}else a.toLowerCase().indexOf("bug#")===0&&(e="https://bugs.eclipse.org/bugs/show_bug.cgi?id="+parseInt(a.substring(4),10));return e?(f=this._clone(d),f.tagName="a",f.attributes={href:e},f):d},_clone:function(a){if(!a)return a;
var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},_findComments:function(a,b){var b=b||0,c=this._firstScanner,d;c.setText(a);for(var e=[];d=c.nextToken();)(d===7||d===8||d===5)&&e.push({start:c.getStartOffset()+b,end:c.getOffset()+b,type:d}),(d===6||d===7||d===8)&&this._computeTasks(d,c.getStartOffset()+b,c.getOffset()+b);return e},_findMatchingBracket:function(a,b){var c="{}()[]<>",d=a.getText(b,b+1),e=c.indexOf(d,0);if(e===-1)return-1;var f;f=e&1?c.substring(e-1,e):c.substring(e+
1,e+2);for(var h=a.getLineAtOffset(b),c=a.getLine(h),g=a.getLineStart(h),i=a.getLineEnd(h),c=this._findBrackets(d,f,c,g,g,i),i=0;i<c.length;i++)if(g=c[i]>=0?1:-1,c[i]*g-1===b){var j=1;if(e&1){for(i--;i>=0;i--)if(g=c[i]>=0?1:-1,j+=g,j===0)return c[i]*g-1;for(h-=1;h>=0;){c=a.getLine(h);g=a.getLineStart(h);i=a.getLineEnd(h);c=this._findBrackets(d,f,c,g,g,i);for(e=c.length-1;e>=0;e--)if(g=c[e]>=0?1:-1,j+=g,j===0)return c[e]*g-1;h--}}else{for(i++;i<c.length;i++)if(g=c[i]>=0?1:-1,j+=g,j===0)return c[i]*
g-1;h+=1;for(e=a.getLineCount();h<e;){c=a.getLine(h);g=a.getLineStart(h);i=a.getLineEnd(h);c=this._findBrackets(d,f,c,g,g,i);for(i=0;i<c.length;i++)if(g=c[i]>=0?1:-1,j+=g,j===0)return c[i]*g-1;h++}}break}return-1},_findBrackets:function(a,b,c,d,e,f){for(var h=[],a=a.charCodeAt(0),b=b.charCodeAt(0),g=e,i=this._scanner,j,l=this.comments,k=this._binarySearch(l,e,!0);k<l.length;k++){if(l[k].start>=f)break;j=l[k].start;var m=l[k].end;if(g<j)for(i.setText(c.substring(g-e,j-e));j=i.nextToken();)j===a?h.push(i.getStartOffset()+
g-e+d+1):j===b&&h.push(-(i.getStartOffset()+g-e+d+1));g=m}if(g<f)for(i.setText(c.substring(g-e,f-e));j=i.nextToken();)j===a?h.push(i.getStartOffset()+g-e+d+1):j===b&&h.push(-(i.getStartOffset()+g-e+d+1));return h},_onDestroy:function(){this.destroy()},_onLineStyle:function(a){if(a.textView===this.view)a.style=this._getLineStyle(a.lineIndex);a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var b=a.oldValue,c=a.newValue,d=this.view,a=d.getModel(),e;if(this.highlightCaretLine){var f=
a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var h=c.start===c.end,b=b.start===b.end;f===e&&b&&h||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&h&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,g,j;if(c.start===c.end&&(j=d.getCaretOffset())>0)j-=1,a.getBaseModel&&(j=a.mapOffset(j),a=a.getBaseModel()),a=this._findMatchingBracket(a,j),a!==-1&&(g=[i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_CURRENT_BRACKET,
j,j+1)]);this._bracketAnnotations=g;this.annotationModel.replaceAnnotations(b,g)}},_onMouseDown:function(a){if(a.clickCount===2){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(d>0){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());e=this._findMatchingBracket(f,e);e!==-1&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d>a&&(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=a.start,c=a.removedCharCount,d=a.addedCharCount-c,e=this.view,
a=e.getModel(),f=a.getBaseModel?a.getBaseModel():a,c=b+c,h=f.getCharCount(),g=this.comments.length,j=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(this.comments,j,!0),k=this._binarySearch(this.comments,c,!1,l-1,g);l<g&&this.comments[l].start<=j&&j<this.comments[l].end?(j=this.comments[l].start,j>b&&(j+=d)):j=l===g&&g>0&&h-d===this.comments[g-1].end?this.comments[g-1].start:j;var m;k<g?(m=this.comments[k].end,m>b&&(m+=d),k+=1):(k=g,m=h);for(var n,h=this._findComments(f.getText(j,m),j),
g=l;g<this.comments.length;g++)n=this.comments[g],n.start>b&&(n.start+=d),n.start>b&&(n.end+=d);var o=k-l!==h.length;if(!o)for(g=0;g<h.length;g++){n=this.comments[l+g];var t=h[g];if(n.start!==t.start||n.end!==t.end||n.type!==t.type){o=!0;break}}g=[l,k-l].concat(h);Array.prototype.splice.apply(this.comments,g);o&&(g=j,n=m,a!==f&&(g=a.mapOffset(g,!0),n=a.mapOffset(n,!0)),e.redrawRange(g,n));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=this.annotationModel;l=e.getAnnotations(j,m);j=[];for(m=
[];l.hasNext();)if(n=l.next(),n.type===i.AnnotationType.ANNOTATION_FOLDING){m.push(n);for(g=0;g<h.length;g++)if(n.start===h[g].start&&n.end===h[g].end)break;g===h.length?(j.push(n),n.expand()):(g=n.start,k=n.end,g>b&&(g-=d),k>b&&(k-=d),g<=b&&b<k&&g<=c&&c<k&&(g=f.getLineAtOffset(n.start),k=f.getLineAtOffset(n.end),g!==k?n.expanded||n.expand():e.removeAnnotation(n)))}b=[];for(g=0;g<h.length;g++){n=h[g];for(d=0;d<m.length;d++)if(m[d].start===n.start&&m[d].end===n.end)break;d===m.length&&(n=this._createFoldingAnnotation(a,
f,n.start,n.end))&&b.push(n)}e.replaceAnnotations(j,b)}}};return{TextStyler:e}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(i){function k(a,b){this._unnamedCounter=0;this._patterns=[];this._rootId=b;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function j(a,b,c,d,e){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.pattern=b;this._styler=c;this._parent=e;this._linePatterns=[];this._blockPatterns=[];this._enclosurePatterns=
{};if(d)this._initPatterns(),this._subBlocks=u(d,d.getText(this.start,this.end),this,this.start)}function g(a){this._styler=a}function c(a,b,c,d){this.highlightCaretLine=this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectTasks=this.foldingEnabled=!0;this.view=a;this.annotationModel=b;this.patternManager=new k(c,d);this._accessor=new g(this);this._bracketAnnotations=void 0;var e=this;this._listener={onChanged:function(a){e._onModelChanged(a)},onDestroy:function(a){e._onDestroy(a)},
onLineStyle:function(a){e._onLineStyle(a)},onMouseDown:function(a){e._onMouseDown(a)},onSelection:function(a){e._onSelection(a)}};c=a.getModel();c.getBaseModel&&(c=c.getBaseModel());c.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);d=c.getCharCount();this._rootBlock=
new j({start:0,contentStart:0,end:d,contentEnd:d},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(d=[],v(this._rootBlock,c,d),b.replaceAnnotations([],d));a.redrawLines()}var f={styleClass:"meta annotation currentLine"},b=/$/,h=/\\(\d)/g,e=/(.*)(?:[\r\n]|$)/g,d={regex:/ /g,style:{styleClass:"punctuation separator space",unmergeable:!0}},a={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},m=function(a,b,c,d){var f=c,h=a.lastIndex;e.lastIndex=
c;var c=e.exec(b),g,i;a.lastIndex=0;if(c){for(i=c.index;0<=--i;)if(g=b.charAt(i),g==="\n"||g==="\r")break;g=b.substring(i+1,c.index+c[1].length);a.lastIndex=i=c.index-i-1}for(;c&&c.index<b.length;){var j;if(d){var k=a.lastIndex;if(a.test(g))a.lastIndex=k,j=a.exec(g)}else j=a.exec(g);if(j)return j.index+=f,j.index-=i,a.lastIndex=h,j;i=0;f+=c[0].length;if(c=e.exec(b))g=c[1],a.lastIndex=0}a.lastIndex=h;return null},n=function(a,b){var c=a.toString();h.lastIndex=0;if(!h.test(c))return a;h.lastIndex=0;
for(var d=h.exec(c);d;)c=c.replace(d[0],b[d[1]]||""),h.lastIndex=0,d=h.exec(c);return RegExp(c.substring(1,c.length-2),"g")},q=function(a,b,c,d){if(b=m(a.pattern.regex?a.pattern.regex:a.pattern.regexBegin,b,d,!0)){a.result=b;for(d=0;d<c.length;d++)if(b.index<c[d].result.index||b.index===c[d].result.index&&a.pattern.pattern.index<c[d].pattern.pattern.index){c.splice(d,0,a);return}c.push(a)}},o=function(a,b,c,d){if(b[0])d.push({start:c,end:c+a[0].length,style:b[0].name});else for(var e=0,f=1;f<a.length;f++)if(a[f]){var h=
b[f];if(h){var g=c+e;d.push({start:g,end:g+a[f].length,style:h.name})}e+=a[f].length}},p=function(a,b,c){var d=a.start;b.forEach(function(b){d<=b.start&&c.push({start:d,end:b.start,style:a.style});c.push(b);d=b.end});d<a.end&&c.push({start:d,end:a.end,style:a.style})},s=function(a,c,d,e,f){if(d=d.getLinePatterns()){var h=[];d.forEach(function(b){var c=b.regex||b.regexBegin;c.oldLastIndex=c.lastIndex;(c=m(c,a,0))&&h.push({result:c,pattern:b})});h.sort(function(a,b){return a.result.index<b.result.index?
-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var g=0;h.length>0;){var i=h[0];h.splice(0,1);if(!(i.result.index<g)){var j=i.result.index,k,s=[];if(i.pattern.regex){g=i.result;k=j+g[0].length;k={start:c+j,end:c+k,style:i.pattern.pattern.name};if(!f){i.pattern.pattern.captures&&o(g,i.pattern.pattern.captures,c+j,s);s.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(j=0;j<s.length-1;j++)if(s[j+1].start<s[j].end){var u={start:s[j+1].end,
end:s[j].end,style:s[j].style};s[j].end=s[j+1].start;s.splice(j+2,0,u)}}p(k,s,e)}else{g=i.pattern.regexEnd;g=n(g,i.result);g=m(g,a,i.result.index+i.result[0].length);if(!g)b.lastIndex=0,g=b.exec(a);k=g.index+g[0].length;e.push({start:c+j,end:c+k,style:i.pattern.pattern.name})}g=g.index+g[0].length}q(i,a,h,g)}d.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},u=function(a,c,d,e){var f=[];d.getBlockPatterns().forEach(function(a){var b=m(a.regexBegin||a.regex,c,0);b&&f.push({result:b,
pattern:a})}.bind(this));if(!f.length)return f;f.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var h=0,g=[];f.length>0;){var i=f[0];f.splice(0,1);if(!(i.result.index<h)){var k=a.getLineAtOffset(e+i.result.index),o=a.getLine(k),p=[];s(o,a.getLineStart(k),d,p);k=e+i.result.index;for(o=0;o<p.length;o++)if(p[o].start===k){var h=i.result.index,u=null,v=i.pattern.regexEnd;if(v){h+=i.result[0].length;
for(var v=n(v,i.result),J=h;!u;){J=m(v,c,J);if(!J)b.lastIndex=0,J=b.exec(c);var U=[],K=new j({start:k,end:e+J.index+J[0].length,contentStart:e+h,contentEnd:e+J.index},i.pattern,d.getStyler(),a,d);s(c.substring(h,J.index+J[0].length),h,K,U);if(!U.length||U[U.length-1].end<=J.index)u=K;J=J.index+J[0].length}}else u=new j({start:k,end:k+i.result[0].length,contentStart:k,contentEnd:k+i.result[0].length},i.pattern,d.getStyler(),a,d);g.push(u);h=u.end-e;break}o===p.length&&(h=i.result.index+1)}q(i,c,f,
h)}return g},v=function(a,b,c){if(a.getAnnotationModel()){var d=i.AnnotationType.ANNOTATION_TASK;if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&a.pattern.pattern.name.indexOf("comment")===0){var e=[];s(b.getText(a.contentStart,a.end),a.contentStart,a,e,!0);for(var f=0;f<e.length;f++)e[f].style==="meta.annotation.task.todo"&&c.push(i.AnnotationType.createAnnotation(d,e[f].start,e[f].end,b.getText(e[f].start,e[f].end)))}a.getBlocks().forEach(function(a){v(a,b,c)}.bind(this))}};k.prototype=
{getPatterns:function(a){var b=[0],c={},d=RegExp("^"+(a?typeof a==="string"?a:a.qualifiedId:this._rootId)+"#[^#]+$"),e=[];this._patterns.forEach(function(a){if(d.test(a.qualifiedId))a.include?e.push(a):(a.index=b[0]++,c[a.id]=a)}.bind(this));e.forEach(function(a){this._processInclude(a,b,c)}.bind(this));var f=[];Object.keys(c).forEach(function(a){f.push(c[a])});return f},_addPatterns:function(a,b){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,b)}.bind(this))},_addRepositoryPatterns:function(a,
b){Object.keys(a).forEach(function(c){this._addPattern(a[c],c,b)}.bind(this))},_addPattern:function(a,b,c){a.parentId=c;a.id=b;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_processInclude:function(a,b,c){var d,e=a.include.indexOf("#");d=e===0?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):e===-1?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");var f=[];this._patterns.forEach(function(a){if(d.test(a.qualifiedId))if(a.include)f.push(a);
else if(!c[a.id])a.index=b[0]++,c[a.id]=a}.bind(this));f.forEach(function(a){this._processInclude(a,b,c)}.bind(this))},_NO_ID:"NoID"};j.prototype={adjustEnd:function(a){this.end+=a;this.contentEnd+=a;this._subBlocks.forEach(function(b){b.adjustEnd(a)})},adjustStart:function(a){this.start+=a;this.contentStart+=a;this._subBlocks.forEach(function(b){b.adjustStart(a)})},computeStyle:function(a,b){if(!this.pattern||!(this.start<=b&&b<this.end))return null;var c={start:this.start,end:this.end,style:this.pattern.pattern.name};
if(this.contentStart<=b&&b<this.contentEnd)return this.pattern.pattern.contentName?{start:this.contentStart,end:this.contentEnd,style:this.pattern.pattern.contentName}:c;var d,e,f,h;if(b<this.contentStart){e=this.pattern.pattern.beginCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexBegin;f=a.getText(this.start,this.contentStart);h=this.start}else{e=this.pattern.pattern.endCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexEnd;f=a.getText(this.contentEnd,
this.end);h=this.contentEnd}d.lastIndex=0;if(f=d.exec(f)){d=[];o(f,e,h,d);for(e=0;e<d.length;e++)if(d[e].start<=b&&b<d[e].end)return d[e]}return c},getAnnotationModel:function(){return this._styler._getAnnotationModel()},getBlockPatterns:function(){return this._blockPatterns},getBlocks:function(){return this._subBlocks},getEnclosurePatterns:function(){return this._enclosurePatterns},getLinePatterns:function(){return this._linePatterns},getParent:function(){return this._parent},getPatternManager:function(){return this._styler._getPatternManager()},
getStyler:function(){return this._styler},isRenderingWhitespace:function(){return this._styler._isRenderingWhitespace()},_initPatterns:function(){var a=function(a){var b=/^\(\?i\)\s*/.exec(a);b&&(a=a.substring(b[0].length));return a};this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(b){var c;if(b.match&&!b.begin&&!b.end){c="g";var d=a(b.match);d!==b.match&&(c+="i");c={regex:RegExp(d,c),pattern:b};this._linePatterns.push(c);if(b.patterns)this._blockPatterns.push(c);
else if(b.name&&b.name.indexOf("punctuation.section")===0&&(b.name.indexOf(".begin")!==-1||b.name.indexOf(".end")!==-1))this._enclosurePatterns[b.name]=c}else if(!b.match&&b.begin&&b.end){c="g";d=a(b.begin);d!==b.begin&&(c+="i");var e="g",f=a(b.end);f!==b.end&&(e+="i");c={regexBegin:RegExp(d,c),regexEnd:RegExp(f,e),pattern:b};this._linePatterns.push(c);this._blockPatterns.push(c)}}.bind(this))}};g.prototype={getStyles:function(a){return this._styler.getStyles(a)}};c.prototype={destroy:function(){var a=
this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var b=[],c=this.view.getModel();c.getBaseModel&&
(c=c.getBaseModel());var d=this._findBlock(this._rootBlock,a),e=c.getLineAtOffset(a),f=c.getLine(e),h=[];s(f,c.getLineStart(e),d,h);for(e=0;e<h.length;e++){if(a<h[e].start)break;if(h[e].start<=a&&a<h[e].end){b.push(h[e]);break}}for(;d;)(h=d.computeStyle(c,a))&&b.splice(0,0,h),d=d.getParent();return b},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,b){if(this.whitespacesVisible!==a)this.whitespacesVisible=a,b&&this.view.redraw()},setTabsVisible:function(a){if(this.tabsVisible!==
a)this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw()},setSpacesVisible:function(a){if(this.spacesVisible!==a)this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw()},setDetectHyperlinks:function(){},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;d===void 0&&(d=-1);if(e===void 0)e=a.length;for(;e-d>1;)if(f=
Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=f;break}else d=f;return e},_computeFolding:function(a){if(this.foldingEnabled){var b=this.view.getModel();if(b.getBaseModel){var c=this.annotationModel;if(c){c.removeAnnotations(i.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=b.getBaseModel(),f=0;f<a.length;f++){var h=a[f];(h=this._createFoldingAnnotation(b,e,h.start,h.end))&&d.push(h)}c.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c),
b=b.getLineAtOffset(d);return e===b?null:new (i.AnnotationType.getType(i.AnnotationType.ANNOTATION_FOLDING))(c,d,a)},_findBlock:function(a,b){var c=a.getBlocks();if(!c.length)return a;var d=this._binarySearch(c,b,!0);return d<c.length&&c[d].start<=b&&b<c[d].end?this._findBlock(c[d],b):a},_findBrackets:function(a,b,c,d,e,f){for(var h=[],g=[],i=e,j=c.getBlocks(),k=this._binarySearch(j,e,!0);k<j.length;k++){if(j[k].start>=f)break;var m=j[k].start,n=j[k].end;i<m&&(s(d.substring(i-e,m-e),i,c,g),g.forEach(function(c){c.style.indexOf(a.pattern.name)===
0?h.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&h.push(-(c.start+1))}),g=[]);i=n}i<f&&(s(d.substring(i-e,f-e),i,c,g),g.forEach(function(c){c.style.indexOf(a.pattern.name)===0?h.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&h.push(-(c.start+1))}));return h},_findMatchingBracket:function(a,b,c){for(var d=a.getLineAtOffset(c),e=a.getLineEnd(d),f=a.getText(c,e),h,g=b.getEnclosurePatterns(),i=Object.keys(g),j=0;j<i.length;j++){var k=g[i[j]],n=m(k.regex,f,0);if(n&&n.index===0){h=k;break}}if(!h)return-1;
f=!1;h.pattern.name.indexOf(".begin")!==-1?(f=!0,j=h.pattern.name.replace(".begin",".end")):j=h.pattern.name.replace(".end",".begin");g=g[j];if(!g)return-1;i=a.getLine(d);k=a.getLineStart(d);e=this._findBrackets(h,g,b,i,k,e);for(j=0;j<e.length;j++)if(i=e[j]>=0?1:-1,e[j]*i-1===c){c=1;if(f){for(j++;j<e.length;j++)if(i=e[j]>=0?1:-1,c+=i,c===0)return e[j]*i-1;d+=1;for(j=a.getLineCount();d<j;){i=a.getLine(d);k=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(h,g,b,i,k,e);for(f=0;f<e.length;f++)if(i=
e[f]>=0?1:-1,c+=i,c===0)return e[f]*i-1;d++}}else{for(j--;j>=0;j--)if(i=e[j]>=0?1:-1,c+=i,c===0)return e[j]*i-1;for(d-=1;d>=0;){i=a.getLine(d);k=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(h,g,b,i,k,e);for(j=e.length-1;j>=0;j--)if(i=e[j]>=0?1:-1,c+=i,c===0)return e[j]*i-1;d--}}break}return-1},_getAnnotationModel:function(){return this.annotationModel},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)===
a)return f}return null},_getPatternManager:function(){return this.patternManager},_getStyles:function(a,b,c,d){b.getBaseModel&&(d=b.mapOffset(d));for(var e=d+c.length,f=[],h=d,g=a.getBlocks(),i=this._binarySearch(g,d,!0);i<g.length;i++){if(g[i].start>=e)break;var j=g[i].start,k=g[i].end;h<j&&s(c.substring(h-d,j-d),h,a,f);var n=Math.max(h,j);if(n===j&&g[i].pattern.regexBegin){var q=m(g[i].pattern.regexBegin,c.substring(n-d),0);if(q){var p=g[i].pattern.pattern.beginCaptures||g[i].pattern.pattern.captures;
p?o(q,p,n,f):f.push({start:n,end:n+q[0].length,style:g[i].pattern.pattern.name});n+=q[0].length}}var j=Math.min(e,k),u=[];if(j===k&&g[i].pattern.regexEnd&&(h=c.substring(j-h-(g[i].end-g[i].contentEnd)),q=m(g[i].pattern.regexEnd,h,0)))(p=g[i].pattern.pattern.endCaptures||g[i].pattern.pattern.captures)?o(q,p,j-q[0].length,u):g[i].pattern.pattern.name&&u.push({start:j-q[0].length,end:j,style:g[i].pattern.pattern.name}),j-=q[0].length;var h=this._getStyles(g[i],b,c.substring(n-d,j-d),n),v=g[i].pattern.pattern.contentName||
g[i].pattern.pattern.name;if(v){var R=n;h.forEach(function(a){a.start-R&&f.push({start:R,end:a.start,style:v});f.push(a);R=a.end});j-R&&f.push({start:R,end:j,style:v})}else f=f.concat(h);f=f.concat(u);h=k}h<e&&s(c.substring(h-d,e-d),h,a,f);if(b.getBaseModel)for(a=0;a<f.length;a++)c=f[a].end-f[a].start,f[a].start=b.mapOffset(f[a].start,!0),f[a].end=f[a].start+c;return f},_isRenderingWhitespace:function(){return this.whitespacesVisible&&(this.tabsVisible||this.spacesVisible)},_onDestroy:function(){this.destroy()},
_onLineStyle:function(b){if(b.textView===this.view)b.style=this._getLineStyle(b.lineIndex);b.ranges=this._getStyles(this._rootBlock,b.textView.getModel(),b.lineText,b.lineStart);b.ranges.forEach(function(a){if(a.style)a.style={styleClass:a.style.replace(/\./g," ")}});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(d,b.ranges,b.lineText,b.lineStart),this.tabsVisible&&this._spliceStyles(a,b.ranges,b.lineText,b.lineStart))},_onSelection:function(a){var b=a.oldValue,c=a.newValue,
d=this.view,a=d.getModel(),e;if(this.highlightCaretLine){var f=a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var h=c.start===c.end,b=b.start===b.end;f===e&&b&&h||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&h&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,g,j;if(c.start===c.end&&(j=d.getCaretOffset())>0)j-=1,a.getBaseModel&&(j=a.mapOffset(j),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,j),a=this._findMatchingBracket(a,c,j),a!==-1&&(g=[i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_MATCHING_BRACKET,
a,a+1),i.AnnotationType.createAnnotation(i.AnnotationType.ANNOTATION_CURRENT_BRACKET,j,j+1)]);this._bracketAnnotations=g;this.annotationModel.replaceAnnotations(b,g)}},_onMouseDown:function(a){if(a.clickCount===2){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(d>0){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());var h=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,h,e);e!==-1&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d>
a&&(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=a.start,c=a.removedCharCount,a=a.addedCharCount-c,d=this.view,e=d.getModel(),f=e.getBaseModel?e.getBaseModel():e,c=b+c,h=f.getCharCount(),g=this._rootBlock.getBlocks(),j=g.length,k=f.getLineStart(f.getLineAtOffset(b)),m=this._binarySearch(g,k,!0),n=this._binarySearch(g,c,!1,m-1,j),o;m<j&&g[m].start<=k&&k<g[m].end?(o=g[m].start,o>b&&(o+=a)):o=m===j&&j>0&&h-a===g[j-1].end?g[j-1].start:k;var q;do n<j?(q=g[n].end,q>b&&(q+=a),n+=1):
(n=j,q=h),k=f.getText(o,q),k=u(f,k,this._rootBlock,o);while(k.length&&g.length&&n<j&&k[k.length-1].pattern.pattern.id!==g[n-1].pattern.pattern.id);for(h=m;h<g.length;h++)j=g[h],j.start>b&&j.adjustStart(a),j.start>b&&j.adjustEnd(a);var p=n-m!==k.length;if(!p)for(h=0;h<k.length;h++){var j=g[m+h],s=k[h];if(j.start!==s.start||j.end!==s.end||j.type!==s.type){p=!0;break}}h=[m,n-m].concat(k);Array.prototype.splice.apply(g,h);p&&(h=o,j=q,e!==f&&(h=e.mapOffset(h,!0),j=e.mapOffset(j,!0)),d.redrawRange(h,j));
if(this.annotationModel){d=[];g=[];m=[];o=this.annotationModel.getAnnotations(o,q);for(q=this.foldingEnabled&&f!==e;o.hasNext();)if(j=o.next(),q&&j.type===i.AnnotationType.ANNOTATION_FOLDING){m.push(j);for(h=0;h<k.length;h++)if(j.start===k[h].start&&j.end===k[h].end)break;h===k.length?(d.push(j),j.expand()):(h=j.start,n=j.end,h>b&&(h-=a),n>b&&(n-=a),h<=b&&b<n&&h<=c&&c<n&&(h=f.getLineAtOffset(j.start),n=f.getLineAtOffset(j.end),h!==n?j.expanded||j.expand():this.annotationModel.removeAnnotation(j)));
for(h=0;h<k.length;h++){j=k[h];for(n=0;n<m.length;n++)if(m[n].start===j.start&&m[n].end===j.end)break;n===m.length&&(j=this._createFoldingAnnotation(e,f,j.start,j.end))&&g.push(j)}}else j.type===i.AnnotationType.ANNOTATION_TASK&&d.push(j);if(this.detectTasks)for(h=0;h<k.length;h++)v(k[h],f,g);this.annotationModel.replaceAnnotations(d,g)}},_spliceStyles:function(a,b,c,d){for(var e=a.regex,f=e.lastIndex=0,h=e.exec(c);h;){for(h=d+h.index;f<b.length;){if(h<b[f].end)break;f++}var g={start:h,end:h+1,style:a.style};
if(f<b.length&&b[f].start<=h){var i={start:h+1,end:b[f].end,style:b[f].style};b[f].end=h;b.splice(f+1,0,i);b.splice(f+1,0,g);f+=2}else b.splice(f,0,g),f++;h=e.exec(c)}}};return{TextStyler:c}});
define("orion/editor/textMateStyler",["orion/regex"],function(i){function k(c){var f;if(c instanceof Array){f=Array(c.length);for(var b=0;b<c.length;b++)f[b]=k(c[b])}else for(b in f={},c)if(Object.prototype.hasOwnProperty.call(c,b)){var h=c[b];f[b]=typeof h==="object"&&h!==null?k(h):h}return f}function j(c,f,b){this.initialize(c);this.grammar=k(f);this.externalGrammars=b?k(b):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var g={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(c){return c[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(c){function f(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var b="",h,c=g.processGlobalFlag("x",c,function(b){for(var a="",c=!1,e=b.length,f=0;f<e;){var h=b.charAt(f);if(!c&&h==="#")for(;f<e&&h!=="\r"&&h!=="\n";)h=b.charAt(++f);
else if(!c&&/\s/.test(h))for(;f<e&&/\s/.test(h);)h=b.charAt(++f);else h==="\\"?(a+=h,/\s/.test(b.charAt(f+1))||(a+=b.charAt(f+1),f+=1)):(h==="["?c=!0:h==="]"&&(c=!1),a+=h),f+=1}return a}),c=g.processGlobalFlag("i",c,function(c){b+="i";return c});for(h=0;h<this.unsupported.length;h++){var e;(e=this.unsupported[h].regex.exec(c))&&f(this.unsupported[h].func(e),e)}return RegExp(c,b)},processGlobalFlag:function(c,f,b){function h(b,a){for(var c=0,e=b.length,f=-1,h=a;h<e&&f===-1;h++)switch(b.charAt(h)){case "\\":h++;
break;case "(":c++;break;case ")":c--,c===0&&(f=h)}return f}var e="(?"+c+")",c="(?"+c+":";if(f.substring(0,e.length)===e)return b(f.substring(e.length));else if(f.substring(0,c.length)===c){e=h(f,0);if(e<f.length-1)throw Error("Only a "+c+") group that encloses the entire regex is supported in: "+f);return b(f.substring(c.length,e))}return f},hasBackReference:function(c){return/\\\d+/.test(c.source)},getSubstitutedRegex:function(c,f,b){for(var b=typeof b==="undefined"?!0:!1,c=c.source.split(/(\\\d+)/g),
h=[],e=0;e<c.length;e++){var d=c[e],a=/\\(\d+)/.exec(d);a?(d=f[a[1]]||"",h.push(b?i.escape(d):d)):h.push(d)}return RegExp(h.join(""))},groupify:function(c,f){for(var b=c.source,h=b.length,e=[],d=0,a=[],g=1,i=1,j=[],k={},p={},s=0;s<h;s++){var u=e[e.length-1],v=b.charAt(s);switch(v){case "(":if(u===4)e.pop(),j.push(")"),a[a.length-1].end=s;var t=s+2<h?b.charAt(s+1)+""+b.charAt(s+2):null;if(t==="?:"||t==="?="||t==="?!"){var w;t==="?:"?w=1:(w=3,d++);e.push(w);a.push({start:s,end:-1,type:w});j.push(v);
j.push(t);s+=t.length}else e.push(2),a.push({start:s,end:-1,type:2,oldNum:g,num:i}),j.push(v),d===0&&(p[i]=null),k[g]=i,g++,i++;break;case ")":u=e.pop();u===3&&d--;a[a.length-1].end=s;j.push(v);break;case "*":case "+":case "?":case "}":var l=v,r=b.charAt(s-1),t=s-1;if(v==="}"){for(w=s-1;b.charAt(w)!=="{"&&w>=0;w--);r=b.charAt(w-1);t=w-1;l=b.substring(w,s+1)}w=a[a.length-1];if(r===")"&&(w.type===2||w.type===4)){j.splice(w.start,0,"(");j.push(l);j.push(")");v={start:w.start,end:j.length-1,type:4,num:w.num};
for(r=0;r<a.length;r++)if(u=a[r],(u.type===2||u.type===4)&&u.start>=w.start&&u.end<=t)if(u.start+=1,u.end+=1,u.num+=1,u.type===2)k[u.oldNum]=u.num;a.push(v);i++;break}default:v!=="|"&&u!==2&&u!==4&&d===0&&(e.push(4),a.push({start:s,end:-1,type:4,num:i}),j.push("("),p[i]=null,i++),j.push(v),v==="\\"&&(v=b.charAt(s+1),j.push(v),s+=1)}}for(;e.length;)e.pop(),j.push(")");var b=RegExp(j.join("")),h={},f=f||k,y;for(y in f)f.hasOwnProperty(y)&&(h[y]="\\"+f[y]);b=this.getSubstitutedRegex(b,h,!1);return[b,
k,p]},complexCaptures:function(c){if(!c)return!1;for(var f in c)if(c.hasOwnProperty(f)&&f!=="0")return!0;return!1}};j.prototype={initialize:function(c){this.textView=c;this.textView.stylerOptions=this;var f=this;this._listener={onModelChanged:function(b){f.onModelChanged(b)},onDestroy:function(b){f.onDestroy(b)},onLineStyle:function(b){f.onLineStyle(b)},onStorage:function(b){f.onStorage(b)}};c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Destroy",this._listener.onDestroy);
c.addEventListener("LineStyle",this._listener.onLineStyle);c.redrawLines()},onDestroy:function(){this.destroy()},destroy:function(){if(this.textView)this.textView.removeEventListener("ModelChanged",this._listener.onModelChanged),this.textView.removeEventListener("Destroy",this._listener.onDestroy),this.textView.removeEventListener("LineStyle",this._listener.onLineStyle),this.textView=null;this._listener=this._tree=this._styles=this.grammar=null},preprocess:function(c){for(c=[c];c.length!==0;){var f=
c.pop();if(!f._resolvedRule||!f._typedRule)if(f._resolvedRule=this._resolve(f),f._typedRule=this._createTypedRule(f),this.addStyles(f.name),this.addStyles(f.contentName),this.addStylesForCaptures(f.captures),this.addStylesForCaptures(f.beginCaptures),this.addStylesForCaptures(f.endCaptures),f._resolvedRule!==f&&c.push(f._resolvedRule),f.patterns)for(var b=0;b<f.patterns.length;b++)c.push(f.patterns[b])}},addStyles:function(c){if(c&&!this._styles[c]){this._styles[c]=[];for(var f=c.split("."),b=0;b<
f.length;b++)this._styles[c].push(f.slice(0,b+1).join("-"))}},addStylesForCaptures:function(c){for(var f in c)c.hasOwnProperty(f)&&this.addStyles(c[f].name)},ContainerRule:function(){function c(c){this.rule=c;this.subrules=c.patterns}c.prototype.valueOf=function(){return"aa"};return c}(),BeginEndRule:function(){function c(c){this.rule=c;this.beginRegex=g.toRegExp(c.begin);this.endRegex=g.toRegExp(c.end);this.subrules=c.patterns||[];this.endRegexHasBackRef=g.hasBackReference(this.endRegex);var b=g.complexCaptures(c.captures),
c=g.complexCaptures(c.beginCaptures)||g.complexCaptures(c.endCaptures);if(this.isComplex=b||c)b=g.groupify(this.beginRegex),this.beginRegex=b[0],this.beginOld2New=b[1],this.beginConsuming=b[2],b=g.groupify(this.endRegex,this.beginOld2New),this.endRegex=b[0],this.endOld2New=b[1],this.endConsuming=b[2]}c.prototype.valueOf=function(){return this.beginRegex};return c}(),MatchRule:function(){function c(c){this.rule=c;this.matchRegex=g.toRegExp(c.match);if(this.isComplex=g.complexCaptures(c.captures))c=
g.groupify(this.matchRegex),this.matchRegex=c[0],this.matchOld2New=c[1],this.matchConsuming=c[2]}c.prototype.valueOf=function(){return this.matchRegex};return c}(),_createTypedRule:function(c){return c.match?new this.MatchRule(c):c.begin?new this.BeginEndRule(c):new this.ContainerRule(c)},_resolve:function(c){var f=c;if(c.include){if(c.begin||c.end||c.match)throw Error('Unexpected regex pattern in "include" rule '+c.include);c=c.include;if(c.charAt(0)==="#"){if(f=this.grammar.repository&&this.grammar.repository[c.substring(1)],
!f)throw Error("Couldn't find included rule "+c+" in grammar repository");}else if(c==="$self")f=this.grammar;else if(c==="$base")throw Error('Include "$base" is not supported');else if(f=this._allGrammars[c],!f)for(var b=0;b<this.externalGrammars.length;b++){var h=this.externalGrammars[b];if(h.scopeName===c){this.preprocess(h);f=this._allGrammars[c]=h;break}}}return f},ContainerNode:function(){function c(c,b){this.parent=c;this.rule=b;this.children=[];this.end=this.start=null}c.prototype.addChild=
function(c){this.children.push(c)};c.prototype.valueOf=function(){var c=this.rule;return"ContainerNode { "+(c.include||"")+" "+(c.name||"")+(c.comment||"")+"}"};return c}(),BeginEndNode:function(){function c(c,b,h){this.parent=c;this.rule=b;this.children=[];this.setStart(h);this.endMatch=this.end=null;this.endRegexSubstituted=b.endRegexHasBackRef?g.getSubstitutedRegex(b.endRegex,h):null}c.prototype.addChild=function(c){this.children.push(c)};c.prototype.getIndexInParent=function(){return this.parent?
this.parent.children.indexOf(this):-1};c.prototype.setStart=function(c){this.start=c.index;this.beginMatch=c};c.prototype.setEnd=function(c){c&&typeof c==="object"?(this.endMatch=c,this.end=c.index+c[0].length):(this.endMatch=null,this.end=c)};c.prototype.shiftStart=function(c){this.start+=c;this.beginMatch.index+=c};c.prototype.shiftEnd=function(c){this.end+=c;this.endMatch&&(this.endMatch.index+=c)};c.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+
"}"};return c}(),push:function(c,f){if(f)for(var b=f.length;b>0;)c.push(f[--b])},exec:function(c,f,b){(f=c.exec(f))&&(f.index+=b);c.lastIndex=0;return f},afterMatch:function(c){return c.index+c[0].length},getEndMatch:function(c,f,b){if(c instanceof this.BeginEndNode){var h=c.rule,c=c.endRegexSubstituted||h.endRegex;return!c?null:this.exec(c,f,b)}return null},initialParse:function(){this.textView.getModel().getCharCount();this._tree=new this.ContainerNode(null,this.grammar._typedRule);this.parse(this._tree,
!1,0)},onModelChanged:function(c){var f=c.addedCharCount,b=c.removedCharCount,c=c.start;if(this._tree){var h=this.textView.getModel(),e=h.getCharCount(),h=h.getLineEnd(h.getLineAtOffset(c)-1),d=this.getFirstDamaged(h,h),h=h===-1?0:h,f=d?this.parse(d,!0,h,c,f,b):e;this.textView.redrawRange(h,f)}else this.initialParse()},getFirstDamaged:function(c,f){if(c<0)return this._tree;for(var b=[this._tree],h=null;b.length;){var e=b.pop();if(!e.parent||this.isDamaged(e,c,f)){e instanceof this.BeginEndNode&&(h=
e);for(var d=0;d<e.children.length;d++)b.push(e.children[d])}}return h||this._tree},isDamaged:function(c,f,b){return c.start<=b&&c.end>f},parse:function(c,f,b,h,e,d){var a=this.textView.getModel(),g=a.getLineStart(a.getLineCount()-1),i=a.getCharCount(),j=this.getInitialExpected(c,b),k=-1;if(f)c.repaired=!0,c.endNeedsUpdate=!0,k=(k=c.children[c.children.length-1])?a.getLineEnd(a.getLineAtOffset(k.end+(e-d))):-1,h=a.getLineEnd(a.getLineAtOffset(h+d)),k=Math.max(k,h);for(var k=k===-1?i:k,h=j,p=c,s=!1,
u=b,v=-1;p&&(!f||u<k);){var t=this.getNextMatch(a,p,u);t||(u=u>=g?i:a.getLineStart(a.getLineAtOffset(u)+1));var w=t&&t.match,l=t&&t.rule,r=t&&t.isEnd;if(t&&t.isSub){if(u=this.afterMatch(w),l instanceof this.BeginEndRule)s=!0,f&&l===h.rule&&p===h.parent?(p=h,p.setStart(w),p.repaired=!0,p.endNeedsUpdate=!0,h=this.getNextExpected(h,"begin")):(f&&(this.prune(p,h),f=!1),w=new this.BeginEndNode(p,l,w),p.addChild(w),p=w)}else if(r||u===i){if(p instanceof this.BeginEndNode)w?(s=!0,v=Math.max(v,p.end),p.setEnd(w),
u=this.afterMatch(w),f&&p===h&&p.parent===h.parent?(p.repaired=!0,delete p.endNeedsUpdate,h=this.getNextExpected(h,"end")):f&&(this.prune(p,h),f=!1)):(p.setEnd(i),delete p.endNeedsUpdate);p=p.parent}f&&u>=k&&!s&&(this.prune(c,j),f=!1)}this.removeUnrepairedChildren(c,f,b);this.cleanup(f,c,b,k,i,e,d);return f?Math.max(v,u):u},removeUnrepairedChildren:function(c,f,b){if(f){for(var f=c.children,h=-1,e=0;e<f.length;e++){var d=f[e];if(!d.repaired&&this.isDamaged(d,b,Number.MAX_VALUE)){h=e;break}}if(h!==
-1)c.children.length=h}},cleanup:function(c,f,b,h,e,d,a){if(c){c=d-a;e=this.getIntersecting(h-c+1,e);f=this.getIntersecting(b,h);for(b=0;b<e.length;b++)h=e[b],!h.repaired&&h instanceof this.BeginEndNode&&(h.shiftEnd(c),h.shiftStart(c));for(b=0;b<f.length;b++)h=f[b],h.repaired&&h.endNeedsUpdate&&h.shiftEnd(c),delete h.endNeedsUpdate,delete h.repaired}else{f=this.getIntersecting(b,h);for(b=0;b<f.length;b++)delete f[b].repaired}},getNextMatch:function(c,f,b,h){var e=c.getLineAtOffset(b),e=c.getLineEnd(e),
d=c.getText(b,e),a=[],g=[],c=[],e=[];for(this.push(a,f.rule.subrules);a.length;){var i=a.length?a.pop():null,i=i&&i._resolvedRule._typedRule;if(i instanceof this.ContainerRule&&g.indexOf(i)===-1)g.push(i),this.push(a,i.subrules);else if(!i||!h||i.matchRegex){var j=i&&this.exec(i.matchRegex||i.beginRegex,d,b);j&&(c.push(j),e.push(i))}}a=Number.MAX_VALUE;g=-1;for(i=0;i<c.length;i++)if(j=c[i],j.index<a)a=j.index,g=i;if(!h&&(b=this.getEndMatch(f,d,b)))if(h=f.rule.applyEndPatternLast,g===-1||b.index<a||
!h&&b.index===a)return{isEnd:!0,rule:f.rule,match:b};return g===-1?null:{isSub:!0,rule:e[g],match:c[g]}},getInitialExpected:function(c,f){var b,h;if(c===this._tree)for(b=0;b<c.children.length;b++){if(h=c.children[b],h.start>=f)return h}else if(c instanceof this.BeginEndNode&&c.endMatch){var e=c.endMatch.index;for(b=0;b<c.children.length;b++)if(h=c.children[b],h.start>=f)break;if(h&&h.start<e)return h}return c},getNextExpected:function(c,f){if(f==="begin"){var b=c.children[0];return b?b:c}else if(f===
"end"&&(b=c.parent)){var h=b.children[b.children.indexOf(c)+1];return h?h:b}return null},prune:function(c,f){if(f.parent===c)c.children.length=f.getIndexInParent();else if(c instanceof this.BeginEndNode)c.endMatch=null,c.end=null;if(c.parent)c.parent.children.length=c.getIndexInParent()+1},onLineStyle:function(c){this._tree||this.initialParse();var f=c.lineStart,b=this.textView.getModel(),h=b.getLineEnd(c.lineIndex),e=b.getLineEnd(b.getLineAtOffset(f)-1),e=this.getFirstDamaged(e,e),f=this.getLineScope(b,
e,f,h);c.ranges=this.toStyleRanges(f);c.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(c,f,b,h){for(var e=b,d=this.getInitialExpected(f,b),a=[],g=[];f&&e<h;){var i=this.getNextMatch(c,f,e);if(!i)break;var j=i&&i.match,k=i&&i.rule,p=i&&i.isSub,i=i&&i.isEnd;j.index!==e&&g.push({start:e,end:j.index,node:f});if(p)e=this.afterMatch(j),k instanceof this.BeginEndRule?(this.addBeginScope(a,j,k),f=d,d=this.getNextExpected(d,"begin")):this.addMatchScope(a,j,k);else if(i)e=this.afterMatch(j),
this.addEndScope(a,j,k),d=this.getNextExpected(d,"end"),f=f.parent}e<h&&g.push({start:e,end:h,node:f});c=this.getInheritedLineScope(g,b,h);return a.concat(c)},getInheritedLineScope:function(c){for(var f=[],b=0;b<c.length;b++)for(var h=c[b],e=h.node;e;){var d=e.rule.rule,a=d.name;if(d=d.contentName||a){this.addScopeRange(f,h.start,h.end,d);break}e=e.parent}return f},addBeginScope:function(c,f,b){var h=b.rule;this.addCapturesScope(c,f,h.beginCaptures||h.captures,b.isComplex,b.beginOld2New,b.beginConsuming)},
addEndScope:function(c,f,b){var h=b.rule;this.addCapturesScope(c,f,h.endCaptures||h.captures,b.isComplex,b.endOld2New,b.endConsuming)},addMatchScope:function(c,f,b){var h=b.rule,e=h.name;(h=h.captures)?this.addCapturesScope(c,f,h,b.isComplex,b.matchOld2New,b.matchConsuming):this.addScope(c,f,e)},addScope:function(c,f,b){b&&c.push({start:f.index,end:this.afterMatch(f),scope:b})},addScopeRange:function(c,f,b,h){h&&c.push({start:f,end:b,scope:h})},addCapturesScope:function(c,f,b,h,e,d){if(b)if(h){for(var h=
{1:0},a=0,g=1;f[g]!==void 0;g++)d[g]!==void 0&&(a+=f[g].length),f[g+1]!==void 0&&(h[g+1]=a);d=f.index;for(a=1;b[a];a++){var g=b[a].name,i=e[a],j=d+h[i];typeof f[i]!=="undefined"&&this.addScopeRange(c,j,j+f[i].length,g)}}else this.addScope(c,f,b[0]&&b[0].name)},getIntersecting:function(c,f){for(var b=[],h=this._tree?[this._tree]:[];h.length;){var e=h.pop(),d=!1;e instanceof this.ContainerNode?d=!0:this.isDamaged(e,c,f)&&(d=!0,b.push(e));if(d)for(var d=e.children.length,a=0;a<d;a++)h.push(e.children[a])}return b.reverse()},
toStyleRanges:function(c){for(var f=[],b=0;b<c.length;b++){var h=c[b],e=this._styles[h.scope];if(!e)throw Error("styles not found for "+h.scope);e=e.join(" ");f.push({start:h.start,end:h.end,style:{styleClass:e}})}return f}};return{RegexUtil:g,TextMateStyler:j}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(i,k){function j(b){return b.getProperty("objectClass").indexOf(c)!==-1&&b.getProperty("type")==="highlighter"}function g(b,c,e){this.initialize(b,c,e);this.lineStyles=[]}var c="orion.edit.highlighter",f=c+" service must be an event emitter";k.AnnotationType.registerType("orion.annotation.highlightError",{title:i.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});
g.prototype={initialize:function(b,f,e){this.textView=b;this.serviceRegistry=f;this.annotationModel=e;this.services=[];var d=this;this.listener={onModelChanging:function(a){d.onModelChanging(a)},onModelChanged:function(a){d.onModelChanged(a)},onDestroy:function(a){d.onDestroy(a)},onLineStyle:function(a){d.onLineStyle(a)},onStyleReady:function(a){d.onStyleReady(a)},onServiceAdded:function(a){d.onServiceAdded(a.serviceReference,d.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){d.onServiceRemoved(a.serviceReference,
d.serviceRegistry.getService(a.serviceReference))}};b.addEventListener("ModelChanging",this.listener.onModelChanging);b.addEventListener("ModelChanged",this.listener.onModelChanged);b.addEventListener("Destroy",this.listener.onDestroy);b.addEventListener("LineStyle",this.listener.onLineStyle);f.addEventListener("registered",this.listener.onServiceAdded);f.addEventListener("unregistering",this.listener.onServiceRemoved);b=f.getServiceReferences(c);for(e=0;e<b.length;e++){var a=b[e];j(a)&&this.addServiceListener(f.getService(a))}},
onDestroy:function(){this.destroy()},destroy:function(){if(this.textView)this.textView.removeEventListener("ModelChanging",this.listener.onModelChanging),this.textView.removeEventListener("ModelChanged",this.listener.onModelChanged),this.textView.removeEventListener("Destroy",this.listener.onDestroy),this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView=null;if(this.services){for(var b=0;b<this.services.length;b++)this.removeServiceListener(this.services[b]);this.services=
null}if(this.serviceRegistry)this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null;this.lineStyles=this.listener=null},onModelChanging:function(b){this.startLine=this.textView.getModel().getLineAtOffset(b.start)},onModelChanged:function(b){var c=this.startLine;(b.addedLineCount||b.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[c,b.removedLineCount].concat(this._getEmptyStyle(b.addedLineCount)))},
onStyleReady:function(b){var c=b.lineStyles||b.style,b=Number.MAX_VALUE,e=-1,d=this.textView.getModel(),a;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(this.lineStyles[a]=c[a],b=Math.min(b,a),e=Math.max(e,a));b=Math.max(b,0);e=Math.min(e,d.getLineCount());if(c=this.annotationModel){for(var f=c.getAnnotations(d.getLineStart(b),d.getLineEnd(e)),g=[];f.hasNext();){var i=f.next();i.type==="orion.annotation.highlightError"&&g.push(i)}f=[];for(i=b;i<=e;i++){a=i;var j=this.lineStyles[a],j=j&&j.errors;
a=d.getLineStart(a);if(j)for(var p=0;p<j.length;p++){var s=j[p];f.push(k.AnnotationType.createAnnotation("orion.annotation.highlightError",s.start+a,s.end+a))}}c.replaceAnnotations(g,f)}this.textView.redrawLines(b,e+1)},onLineStyle:function(b){function c(b,a){for(var e=b.length,f=[],h=0;h<e;h++){var g=b[h];f.push({start:g.start+a,end:g.end+a,style:g.style})}return f}var e=this.lineStyles[b.lineIndex];if(e)if(e.ranges)b.ranges=c(e.ranges,b.lineStart);else if(e.style)b.style=e.style},_getEmptyStyle:function(b){for(var c=
[],e=0;e<b;e++)c.push(null);return c},setContentType:function(b){this.contentType=b;if(this.services)for(b=0;b<this.services.length;b++){var c=this.services[b];if(c.setContentType){var e=this.serviceRegistry.getService("orion.page.progress");e?e.progress(c.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):c.setContentType(this.contentType)}}},onServiceAdded:function(b,c){j(b)&&this.addServiceListener(c)},onServiceRemoved:function(b,
c){this.services.indexOf(c)!==-1&&this.removeServiceListener(c)},addServiceListener:function(b){if(typeof b.addEventListener==="function"){if(b.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(b),b.setContentType&&this.contentType){var c=this.serviceRegistry.getService("orion.page.progress");c?c.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}else typeof console!==
"undefined"&&console.log(Error(f))},removeServiceListener:function(b){typeof b.removeEventListener==="function"?(b.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),b=this.services.indexOf(b),b!==-1&&this.services.splice(b,1)):typeof console!=="undefined"&&console.log(Error(f))}};return g});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(i,k,j,g,c){function f(b,d,a,f,n,q,o){function p(b,e){var f=b.getProperty("contentType")||b.getProperty("contentTypes"),h=b.getProperty("fileTypes");if(f)return c.when(d.isSomeExtensionOf(a,f)).then(function(a){return a?b:null});else if(e&&h&&h.indexOf(e)!==-1)return f=new c,f.resolve(b),f;return null}function s(a){var b=null;switch(a&&
a.id){case "application/javascript":case "application/json":b=new i.TextStyler(f,"js",n);break;case "text/x-java-source":b=new i.TextStyler(f,"java",n);break;case "text/css":b=new i.TextStyler(f,"css",n)}return b}if(!h){var u=s(a);if(u)return q=new c,q.resolve(u),q}if(h&&!this.orionGrammars)this.orionGrammars={};for(var u=q&&q.split(".").pop().toLowerCase(),q=b.getServiceReferences("orion.edit.highlighter"),v=[],t=[],w=0;w<q.length;w++){var l=q[w],r=l.getProperty("type");r==="grammar"||!h&&typeof r===
"undefined"?v.push(l.getProperty("grammar")):r!=="highlighter"&&(r=l.getProperty("id"))&&!this.orionGrammars[r]&&(this.orionGrammars[r]={id:r,contentTypes:l.getProperty("contentTypes"),patterns:l.getProperty("patterns"),repository:l.getProperty("repository")});(l=p(l,u))&&t.push(l)}return c.all(t,function(a){return{_error:a}}).then(function(c){for(var d,i=c.length-1;i>=0;i--){var l=c[i];if(l&&!l._error&&(o||l.getProperty("type")!=="highlighter")){d=l;break}}var p;if(d)if(c=d.getProperty("type"),c===
"highlighter")p=new g(f,b,n),p.setContentType(a);else if(c==="grammar"||!h&&typeof c==="undefined")d=d.getProperty("grammar"),p=new j.TextMateStyler(f,d,v);else if(h){p=[];for(var q in this.orionGrammars)p.push(this.orionGrammars[q]);p=new k.TextStyler(f,n,p,d.getProperty("id"))}return p})}function b(b,c){this.serviceRegistry=b;this.contentTypeService=c;this.styler=null}var h=1;b.prototype={setup:function(b,c,a,h,g){g=typeof g==="undefined"?!0:g;if(this.styler)this.styler.destroy&&this.styler.destroy(),
this.styler=null;var i=this;return f(this.serviceRegistry,this.contentTypeService?this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),b,c,a,h,g).then(function(a){return i.styler=a})},getStyler:function(){return this.styler}};return{createStyler:f,SyntaxHighlighter:b}});
define("orion/markOccurrences",["orion/edit/editorContext","orion/Deferred"],function(i,k){function j(g,c,f){this.registry=g;this.inputManager=c;this.editor=f}j.prototype={setOccurrencesVisible:function(g){if(this.occurrencesVisible!==g)(this.occurrencesVisible=g)||this.editor.showOccurrences([])},findOccurrences:function(){function g(b,c,a){function f(a,b,c){a=b.getProperty("contentType");return h.isSomeExtensionOf(c,a).then(function(a){return a?b:null})}for(var h=b.getService("orion.core.contentTypeRegistry"),
g=b.getServiceReferences("orion.edit.occurrences"),i=[],j=0;j<g.length;j++){var s=g[j],u=s.getProperty("pattern");s.getProperty("contentType")?i.push(f(b,s,c)):u&&RegExp(u).test(a)&&(u=new k,u.resolve(s),i.push(u))}return k.all(i,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}var c,f=this,b=f.registry.getService("orion.edit.occurrences"),h=function(){c&&window.clearTimeout(c);f.occurrencesVisible&&(c=window.setTimeout(function(){c=
null;var e={selection:f.editor.getSelection()};b.computeOccurrences(i.getEditorContext(f.registry),e).then(function(b){f.editor.showOccurrences(b)})},500))};f.inputManager.addEventListener("InputChanged",function(b){var d=f.editor.getTextView();d&&(d.removeEventListener("Selection",h),g(f.registry,b.contentType,b.title).then(function(a){!a||a.length===0?c&&window.clearTimeout(c):d.addEventListener("Selection",h)}))})}};return{MarkOccurrences:j}});
define("orion/syntaxchecker",["orion/Deferred","orion/edit/editorContext"],function(i,k){return{SyntaxChecker:function(){function j(c,f){this.registry=c;this.editor=f}function g(c,f,b){c=Math.max(c,f);return c=Math.min(c,b)}j.prototype={checkSyntax:function(c,f,b,h){function e(a,b){function c(a,b,e){a=b.getProperty("contentType");return d.isSomeExtensionOf(e,a).then(function(a){return a?b:null})}for(var d=a.getService("orion.core.contentTypeRegistry"),e=a.getServiceReferences("orion.edit.validator"),
h=[],g=0;g<e.length;g++){var j=e[g],k=j.getProperty("pattern");j.getProperty("contentType")?h.push(c(a,j,b)):k&&RegExp(k).test(f)&&(k=new i,k.resolve(j),h.push(k))}return i.all(h,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}if(c&&!b){var d=this,a=this.registry;e(a,c).then(function(b){var e=function(a){return a&&(a.problems||a.errors)||[]},g=a.getService("orion.page.progress"),b=b.map(function(b){var b=a.getService(b),
d;b.computeProblems?(d={contentType:c.id,title:f},d=b.computeProblems(k.getEditorContext(a),d)):b.checkSyntax&&(d=b.checkSyntax(f,h));return g.progress(d,"Validating "+f).then(e)});i.all(b,function(a){return{_error:a}}).then(function(b){for(var c=[],e=0;e<b.length;e++){var f=b[e];f._error||(d._fixup(f),c=c.concat(f))}a.getService("orion.core.marker")._setProblems(c)})})}},_fixup:function(c){for(var f=this.editor.getModel(),b=0;b<c.length;b++){var h=c[b];h.description=h.description||h.reason;h.severity=
h.severity||"error";h.start=typeof h.start==="number"?h.start:h.character;if(typeof h.line==="number"){var e=f.getLine(h.line-1,!1).length;h.start=g(h.start,1,e-1);h.end=typeof h.end==="number"?h.end:-1;h.end=g(h.end,h.start+1,e)}else if(e=f.getCharCount(),h.start=g(h.start,0,e),h.end=typeof h.end==="number"?h.end:-1,h.end=g(h.end,h.start,e),h.end===e&&f.getLineCount()>1&&e===f.getLineStart(f.getLineCount()-1)){var d=f.getLineCount()-2,e=f.getLineStart(d),d=f.getLineEnd(d);e===d?h.start=h.end=d:(h.start=
d-1,h.end=d)}}}};return j}()}});
define("orion/editorView","i18n!orion/edit/nls/messages,orion/editor/editor,orion/editor/textView,orion/editor/textModel,orion/editor/projectionTextModel,orion/editor/editorFeatures,orion/editor/contentAssist,orion/editor/emacs,orion/editor/vi,orion/editorPreferences,orion/widgets/themes/ThemePreferences,orion/widgets/themes/editor/ThemeData,orion/widgets/settings/EditorSettings,orion/searchAndReplace/textSearcher,orion/editorCommands,orion/globalCommands,orion/edit/dispatcher,orion/edit/editorContext,orion/edit/typedefs,orion/highlight,orion/markOccurrences,orion/syntaxchecker,orion/keyBinding,orion/uiUtils,orion/util,orion/objects".split(","),function(i,
k,j,g,c,f,b,h,e,d,a,m,n,q,o,p,s,u,v,t,w,l,r,y,x,z){function E(a){this._parent=a.parent;this.renderToolbars=a.renderToolbars;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progress;this.statusService=a.statusService;this.fileClient=a.fileService;this.inputManager=a.inputManager;this.preferences=a.preferences;this.readonly=a.readonly;this.searcher=a.searcher;this.statusReporter=a.statusReporter;this.model=
a.model;this.undoStack=a.undoStack;this.syntaxHighlighter=new t.SyntaxHighlighter(this.serviceRegistry);this.typeDefRegistry=new v(this.serviceRegistry);(a=p.getKeyAssist())&&a.addProvider(this);var b=p.getMainSplitter();b&&b.splitter.addEventListener("resize",function(a){this.editor&&a.node===b.main&&this.editor.resize()}.bind(this));p.getGlobalEventTarget().addEventListener("toggleTrim",function(){this.editor&&this.editor.resize()}.bind(this));this.settings={};this._init()}E.prototype={updateKeyMode:function(a,
b){this.emacs&&b.removeKeyMode(this.emacs);this.vi&&b.removeKeyMode(this.vi);if(a.keyBindings==="Emacs"){if(!this.emacs)this.emacs=new h.EmacsMode(b);b.addKeyMode(this.emacs)}else if(a.keyBindings==="vi"){if(!this.vi)this.vi=new e.VIMode(b,this.statusReporter);b.addKeyMode(this.vi)}},getParent:function(){return this._parent},updateSourceCodeActions:function(a,b){b&&(b.setAutoPairParentheses(a.autoPairParentheses),b.setAutoPairBraces(a.autoPairBraces),b.setAutoPairSquareBrackets(a.autoPairSquareBrackets),
b.setAutoPairAngleBrackets(a.autoPairAngleBrackets),b.setAutoPairQuotations(a.autoPairQuotations),b.setAutoCompleteComments(a.autoCompleteComments),b.setSmartIndentation(a.smartIndentation))},updateViewOptions:function(a){var b=0;if(a.showMargin&&(b=a.marginOffset,typeof b!=="number"))b=a.marginOffset=parseInt(b,10);var c=0;a.wordWrap&&(c=b);return{readonly:this.readonly||this.inputManager.getReadOnly(),tabSize:a.tabSize||4,expandTab:a.expandTab,wrapMode:a.wordWrap,wrapOffset:c,marginOffset:b,scrollAnimation:a.scrollAnimation?
a.scrollAnimationTimeout:0}},updateSettings:function(a){this.settings=a;var b=this.editor,c=this.inputManager;c.setAutoLoadEnabled(a.autoLoad);c.setAutoSaveTimeout(a.autoSave?a.autoSaveTimeout:-1);c.setSaveDiffsEnabled(a.saveDiffs);this.updateStyler(a);var d=b.getTextView();d&&(this.updateKeyMode(a,d),d.setOptions(this.updateViewOptions(a)));this.updateSourceCodeActions(a,b.getSourceCodeActions());b.setAnnotationRulerVisible(a.annotationRuler);b.setLineNumberRulerVisible(a.lineNumberRuler);b.setFoldingRulerVisible(a.foldingRuler);
b.setOverviewRulerVisible(a.overviewRuler);this.renderToolbars&&this.renderToolbars(c.getFileMetadata());this.markOccurrences.setOccurrencesVisible(a.showOccurrences);b.getContentAssist()&&b.getContentAssist().setAutoTriggerEnabled(a.contentAssistAutoTrigger)},updateStyler:function(a){var b=this.syntaxHighlighter.getStyler();b&&(b.setTabsVisible&&b.setTabsVisible(a.showTabs),b.setSpacesVisible&&b.setSpacesVisible(a.showSpaces))},showKeyBindings:function(a){var b=this.editor;if(b&&b.getTextView&&b.getTextView()){var c=
b.getTextView(),d=c.getActions(!0).filter(function(a){return(a=c.getActionDescription(a))&&a.name});d.sort(function(a,b){return c.getActionDescription(a).name.localeCompare(c.getActionDescription(b).name)});a.createHeader(i.Editor);for(var e=function(a){return function(){c.focus();return c.invokeAction(a)}},b={},f,h=0;h<d.length;h++)for(var g=d[h],j=c.getActionDescription(g),k=c.getKeyBindings(g),l=0;l<k.length;l++){f=k[l];var m=y.getUserKeyString(f);f.scopeName?(b[f.scopeName]||(b[f.scopeName]=[]),
b[f.scopeName].push({bindingString:m,name:j.name,execute:e(g)})):a.createItem(m,j.name,e(g))}for(var n in b)if(b[n].length){a.createHeader(n);for(d=0;d<b[n].length;d++)f=b[n][d],a.createItem(f.bindingString,f.name,f.execute)}}},_init:function(){var e=null;if(this.preferences)e=this.editorPreferences=new d.EditorPreferences(this.preferences,function(a){a?this.updateSettings(a):e.getPrefs(this.updateSettings.bind(this))}.bind(this));var h=null;this.preferences&&(h=new a.ThemePreferences(this.preferences,
new m.ThemeData),h.apply());var p,t=this,v=this._parent,y=this.readonly,E=this.commandRegistry,K=this.serviceRegistry,R=this.fileClient,N=this.inputManager,P=this.searcher,W=this.progress,T=this.contentTypeRegistry,I=function(a,b,c){var d=N.getContentType(),e=a.getTitle(),a=K.getServiceReferences("orion.edit.contentAssist").concat(K.getServiceReferences("orion.edit.contentassist"));(c=c&&c.providerInfoArray)||(c=a.map(function(a){var b=a.getProperty("contentType"),c=a.getProperty("pattern");if(b&&
T.isSomeExtensionOf(d,b)||c&&RegExp(c).test(e)){var b=K.getService(a),c=a.getProperty("service.id").toString(),f=a.getProperty("charTriggers"),a=a.getProperty("excludedStyles");f&&(f=RegExp(f));a&&(a=RegExp(a));return{provider:b,id:c,charTriggers:f,excludedStyles:a}}return null}).filter(function(a){return!!a}));var f={};Object.keys(u).forEach(function(a){typeof u[a]==="function"&&(f[a]=u[a].bind(null,K))});b.setEditorContextProvider(f);b.setProviderInfoArray(c);b.setAutoTriggerEnabled(t.settings.contentAssistAutoTrigger);
b.setProgress(W);b.setStyleAccessor(t.getStyleAccessor())},F=y?null:{createContentAssistMode:function(a){var c=new b.ContentAssist(a.getTextView());c.addEventListener("Activating",I.bind(null,a,c));var d=new b.ContentAssistWidget(c,"contentassist"),d=new b.ContentAssistMode(c,d);c.setMode(d);I(a,c);c.computeProposals();return d}},C=this.editor=new k.Editor({textViewFactory:function(){var a=t.updateViewOptions(t.settings);z.mixin(a,{parent:v,model:new c.ProjectionTextModel(t.model||new g.TextModel),
wrappable:!0});return new j.TextView(a)},undoStackFactory:t.undoStack?{createUndoStack:function(a){t.undoStack.setView(a.getTextView());return t.undoStack}}:new f.UndoFactory,textDNDFactory:new f.TextDNDFactory,annotationFactory:new f.AnnotationFactory,foldingRulerFactory:new f.FoldingRulerFactory,lineNumberRulerFactory:new f.LineNumberRulerFactory,contentAssistFactory:F,keyBindingFactory:function(a,b,c,d){b=new q.TextSearcher(a,K,E,c);c=(new f.KeyBindingsFactory).createKeyBindings(a,c,d,b);t.updateSourceCodeActions(t.settings,
c.sourceCodeActions);(new o.EditorCommandFactory({serviceRegistry:K,commandRegistry:E,fileClient:R,inputManager:N,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",readonly:y,navToolbarId:"pageNavigationActions",textSearcher:b,searcher:P,editorSettings:function(){return t.settings},localSettings:p})).generateEditorCommands(a);var h=a.getTextView();if(a=E.findCommand("orion.keyAssist"))h.setKeyBinding(new r.KeyStroke(191,!1,!0,!x.isMac,x.isMac),a.id),h.setAction(a.id,
a.callback,a);h.setAction("toggleWrapMode",function(){h.invokeAction("toggleWrapMode",!0);var a=h.getOptions("wrapMode");t.settings.wordWrap=a;e&&e.setPrefs(t.settings);return!0});t.vi=t.emacs=null;t.updateKeyMode(t.settings,h);return c},statusReporter:this.statusReporter,domNode:v});C.id="orion.editor";C.processParameters=function(a){for(var b=["start","end","line","offset","length"],c=0;c<b.length;c++){var d=b[c];a[d]&&(a[d]=parseInt(a[d],10))}this.showSelection(a.start,a.end,a.line,a.offset,a.length)};
this.dispatcher=new s.Dispatcher(this.serviceRegistry,C,N);h&&e&&(p=new n({local:!0,editor:C,themePreferences:h,preferences:e}));N.addEventListener("InputChanged",function(a){var b=C.getTextView();b&&(b.setOptions(this.updateViewOptions(this.settings)),this.syntaxHighlighter.setup(a.contentType,C.getTextView(),C.getAnnotationModel(),a.title,!0).then(function(){this.updateStyler(this.settings);C.getContentAssist()&&I(C,C.getContentAssist())}.bind(this)))}.bind(this));N.addEventListener("Saving",function(){t.settings.trimTrailingWhiteSpace&&
C.getTextView().invokeAction("trimTrailingWhitespaces")});(h=K.getService("orion.core.marker"))&&h.addEventListener("problemsChanged",function(a){C.showProblems(a.problems)});(h=K.getService("orion.core.blame"))&&h.addEventListener("blameChanged",function(a){C.showBlame(a.blameInfo)});h=this.markOccurrences=new w.MarkOccurrences(K,N,C);h.setOccurrencesVisible(this.settings.occurrencesVisible);h.findOccurrences();var A=new l.SyntaxChecker(K,C);C.addEventListener("InputChanged",function(a){A.checkSyntax(N.getContentType(),
a.title,a.message,a.contents);N.getReadOnly()&&C.reportStatus(i.readonly,"error")});var L={};"getCaretOffset,setCaretOffset,getSelection,setSelection,getText,setText,getLineAtOffset,getLineStart".split(",").forEach(function(a){L[a]=C[a].bind(C)});K.registerService("orion.edit.context",L,null);this.editorPreferences&&this.editorPreferences.getPrefs(this.updateSettings.bind(this))},create:function(){this.editor.install()},destroy:function(){this.editor.uninstall()},getStyleAccessor:function(){var a=
null,b=this.syntaxHighlighter.getStyler();b&&b.getStyleAccessor&&(a=b.getStyleAccessor());return a}};return{EditorView:E}});
define("orion/editorPluginView","orion/editor/editor,orion/commands,orion/editorCommands,orion/objects,orion/webui/littlelib,orion/PageLinks,orion/URITemplate".split(","),function(i,k,j,g,c){function f(b){h.apply(this,arguments);this.editorService=b.editorService;this.id=this.editorService.getProperty("id");this.metadata=b.metadata;this.serviceRegistry=b.serviceRegistry;this.pluginRegistry=b.pluginRegistry;this.statusService=b.statusService;this.inputManager=b.inputManager}function b(b){this._parent=
b.parent;this.serviceRegistry=b.serviceRegistry;this.pluginRegistry=b.pluginRegistry;this.contentTypeRegistry=b.contentTypeRegistry;this.commandRegistry=b.commandRegistry;this.statusService=b.statusService;this.progressService=b.progressService;this.editorService=b.editorService;this.metadata=b.metadata;this.inputManager=b.inputManager;this.readonly=b.readonly;this.model=b.model;this.undoStack=b.undoStack}var h=i.BaseEditor;f.prototype=Object.create(h.prototype);g.mixin(f.prototype,{_getPlugin:function(){return this.pluginRegistry.getPlugin(this.editorService._properties.__plugin__)},
_load:function(){for(var b=this.serviceRegistry,c=b.getServiceReferences("orion.edit.editor"),a=0;a<c.length;a++)if(c[a].getProperty("id")===this.id)this.editorService=c[a];c=b.getService(this.editorService);c.setBlob&&c.setBlob(new Blob([this._contents],{type:this.inputManager.getContentType().id}));if(c.setTextModel)b=b.getService(b.getServiceReferences("orion.edit.model.context")[0]),b.processKey=function(a){k.processKey(a)},c.setTextModel(b);if(c.registerKeys){var f=k.getKeyBindings(),h=[];Object.keys(f).forEach(function(a){a=
f[a].keyBinding;h.push({keyCode:a.keyCode,mod1:a.mod1,mod2:a.mod2,mod3:a.mod3,mod4:a.mod4})});c.registerKeys(h)}},install:function(){var b=c.node(this._domNode),d=this._rootDiv=document.createElement("div");d.style.width="100%";d.style.height="100%";d.style.overflow="hidden";var a=this;this._getPlugin().setParent(d).then(function(){a._load()},function(b){var c=a.statusService;if(c){var d=b.responseText;if(d)try{b=JSON.parse(d)}catch(e){b={Severity:"Error",Message:d}}c.setProgressResult(b)}else window.console.log(b)});
b.appendChild(d);h.prototype.install.call(this)},onChanged:function(b){h.prototype.onChanged.call(this,b);var c=this.serviceRegistry.getService(this.editorService);if(c&&c.onChanged)c.onChanged(b)},setInput:function(b,c,a,f){if(typeof a!=="string")this._contents=a;h.prototype.setInput.call(this,b,c,a,f)},uninstall:function(){this._getPlugin().setParent(null);c.empty(this._domNode);h.prototype.uninstall.call(this)}});b.prototype={create:function(){this.editor=new f({domNode:this._parent,model:this.model,
undoStack:this.undoStack,serviceRegistry:this.serviceRegistry,pluginRegistry:this.pluginRegistry,editorService:this.editorService,statusService:this.statusService,inputManager:this.inputManager,metadata:this.metadata});this.editor.install();(new j.EditorCommandFactory({serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry,inputManager:this.inputManager,readonly:this.readonly,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",navToolbarId:"pageNavigationActions"})).generateBaseEditorCommands(this.editor)},
destroy:function(){this.editor&&this.editor.destroy();this.editor=null}};return{PluginEditorView:b,PluginEditor:f}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(i){return{detectValidURL:function(k){for(var j=/\[([^\]]*)\]\(([^\)]+)\)/g,g=j.exec(k),c=[],f=0;g;){if(g.length===3&&g[2].length>0){var b=new URL(g[2]);b.protocol!==":"&&i.validateURLScheme(b.href)&&(g.index>f&&c.push({segmentStr:k.substring(f,g.index)}),c.push({segmentStr:g[1].length>0?g[1]:g[2],urlStr:g[2]}),f=g.index+g[0].length)}g=j.exec(k)}if(f===0)return null;f<k.length-1&&c.push({segmentStr:k.substring(f)});return c},processURLSegments:function(i,
j){j.forEach(function(g){if(g.urlStr){var c=document.createElement("a");c.href=g.urlStr;c.appendChild(document.createTextNode(g.segmentStr))}else c=document.createElement("span"),c.textContent=g.segmentStr;i.appendChild(c)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(i,k,j,g){function c(b,c,e,d,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.message",this);this._operationsClient=c;this.notificationContainerDomId=a;this.domId=e;this.progressDomId=d||e;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var f;c.prototype={_init:function(){var b=k.node("closeNotifications");if(b&&
!this._hookedClose){b.style.cursor="pointer";this._hookedClose=!0;var c=k.node(this.notificationContainerDomId);k.addAutoDismiss([c],function(){this._clickToDisMiss&&this.close()}.bind(this));b.addEventListener("click",function(){this.close()}.bind(this));c.addEventListener("click",function(b){b&&b.target&&b.target.nodeName.toLowerCase()==="a"&&(b=k.$$("a",c))&&b.length&&b.length===1&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var b=k.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&b?(b.innerHTML="",b.classList.remove("cancelButton"),b.classList.add("dismissButton"),b.classList.add("core-sprite-close"),b.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){if(!this._notifierElements)this._notifierElements=j.getToolbarElements(this.notificationContainerDomId);return this._notifierElements},setMessage:function(b,c,e){this._init();this.currentMessage=b;var d=k.node(this.domId);
if(typeof e==="boolean"){var a=d.getAttribute("aria-live");d.setAttribute("aria-live",e?"polite":"off");window.setTimeout(function(){b===this.currentMessage&&(k.empty(d),d.appendChild(document.createTextNode(b)),window.setTimeout(function(){d.setAttribute("aria-live",a)},100))}.bind(this),100)}else k.empty(d),d.appendChild(document.createTextNode(b));typeof c==="number"&&window.setTimeout(function(){b===this.currentMessage&&(k.empty(d),d.appendChild(document.createTextNode("")))}.bind(this),c)},setErrorMessage:function(b){this._clickToDisMiss=
!0;this.currentMessage=b;this._init();var c=b.responseText||b.message||b;if(typeof c==="string")try{c=JSON.parse(c)}catch(e){}var b=c.Message||c,d="red";if(c.Severity)switch(c.Severity){case "Warning":d="#FFCC00";break;case "Error":d="red";break;case "Info":case "Ok":d="green"}c=document.createElement("span");c.style.color=d;c.appendChild(document.createTextNode(b));b=k.node(this.domId);k.empty(b);b.appendChild(c)},setProgressMessage:function(b){this._clickToDisMiss=!1;this._init();this.currentMessage=
b;var c=document.createElement("span");c.classList.add("progressIcon");var e=k.node(this.progressDomId);k.empty(e);e.appendChild(c);e.appendChild(document.createTextNode(b));c=k.node(this.notificationContainerDomId);c.classList.remove("notificationHide");if(b&&b.length>0)c.classList.add("progressNormal"),c.classList.add("notificationShow");else if(this._progressMonitors&&this._progressMonitors.length>0)return this._renderOngoingMonitors();else c.classList.remove("notificationShow"),c.classList.add("notificationHide")},
setCancelFunction:function(b){this._cancelFunc=b},setProgressResult:function(b,c){this._clickToDisMiss=!1;this._cancelMsg=c;this.currentMessage=b;var e=b.responseText||b;if(typeof e==="string")try{e=JSON.parse(e)}catch(d){}this._init();var a=e.Message||e.toString(),f=i.UnknownError,j="core-sprite-information",q="progressNormal",o=document.createElement("span");o.classList.add("imageSprite");o.classList.add("progressIcon");var p=[];if(e.Severity)switch(e.Severity){case "Warning":f=i.UnknownWarning;
j="core-sprite-warning";q="progressWarning";p.push("progressInfo");p.push("progressError");p.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":j="core-sprite-error";q="progressError";p.push("progressWarning");p.push("progressInfo");p.push("progressNormal");this._clickToDisMiss=!0;break;default:q="progressNormal",p.push("progressWarning"),p.push("progressError"),p.push("progressNormal")}p.push("notificationHide");o.classList.add(j);var s=k.node(this.progressDomId),j=k.node(this.notificationContainerDomId);
k.empty(s);s.appendChild(o);a===Object.prototype.toString()&&(a=f);if(e.HTML)e=document.createElement("span"),e.innerHTML=a,s.appendChild(e);else{if(f=g.detectValidURL(a))a=document.createDocumentFragment(),g.processURLSegments(a,f),Array.prototype.forEach.call(k.$$("a",a),function(a){a.target="_blank"});else{if(e.Severity!=="Warning"&&e.Severity!=="Error"&&!c)this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),
5E3);a=document.createTextNode(a)}s.appendChild(a)}if(q&&this.progressDomId!==this.domId){j.classList.add(q);for(q=0;q<p.length;q++)j.classList.remove(p[q])}j.classList.add("notificationShow");if(p=k.node("closeNotifications"))this._cancelMsg?(p.classList.add("cancelButton"),p.classList.remove("dismissButton"),p.classList.remove("core-sprite-close"),p.classList.remove("imageSprite"),p.innerHTML=this._cancelMsg):(p.innerHTML="",p.classList.remove("cancelButton"),p.classList.add("dismissButton"),p.classList.add("core-sprite-close"),
p.classList.add("imageSprite"))},showWhile:function(b,c){var e=this;if(c){e.setProgressMessage(c);var d=function(){c===e.currentMessage&&e.setProgressMessage("")};b.then(d,d)}return b},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(b,c){return new f(this,++this._lastProgressId,b,c)},_renderOngoingMonitors:function(){if(this._progressMonitors.length>0){var b="",c=!0,e;for(e in this._progressMonitors)this._progressMonitors[e].status&&(c||(b+=", "),b+=this._progressMonitors[e].status,
c=!1);this.setProgressMessage(b)}else this.setProgressMessage("")},_beginProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._renderOngoingMonitors()},_doneProgressMonitor:function(b){delete this._progressMonitors[b.progressId];this._progressMonitors.length--;b.status?this.setProgressResult(b.status):this._renderOngoingMonitors()}};c.prototype.constructor=
c;f=function(b,c,e,d){this.statusService=b;this.progressId=c;if(e){this.deferred=e;this.begin(d);var a=this;e.then(function(){a.done.bind(a)()},function(){a.done.bind(a)()})}};f.prototype.begin=function(b){this.status=b;this.statusService._beginProgressMonitor(this)};f.prototype.done=function(b){this.status=b;this.statusService._doneProgressMonitor(this)};f.prototype.worked=function(b){this.status=b;this.statusService._workedProgressMonitor(this)};f.prototype.constructor=f;return{StatusReportingService:c,
ProgressMonitor:f}});
define("orion/operations/nls/root/messages",{More:"More","No Matching OperationService for location:":"No Matching OperationService for location:","No operations services registered.":"No operations services registered.","could not find toolbar ":"could not find toolbar ","Remove Completed":"Remove Completed","Remove all completed operations":"Remove all completed operations",Remove:"Remove","Remove operations from the operations list.":"Remove operations from the operations list.",Cancel:"Cancel",
"Cancel operations from the operations list.":"Cancel operations from the operations list.","Operation resulted in a warning.":"Operation resulted in a warning.","Operation resulted in an error.":"Operation resulted in an error.","Operation is running.":"Operation is running.","Operation is canceled.":"Operation is canceled.","Operation failed.":"Operation failed.",Name:"Name",Actions:"Actions",Status:"Status",Scheduled:"Scheduled"});
define("orion/operations/nls/messages",["orion/i18n!orion/operations/nls/messages","orion/operations/nls/root/messages"],function(i,k){var j={root:k};Object.keys(i).forEach(function(g){typeof j[g]==="undefined"&&(j[g]=i[g])});return j});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(i,k,j,g){var c={};(function(){var f=!1;c.updateNavTools=function(b,c,e,d,a,g){var k=j.node(d);if(k)c.destroy(k);else throw i["could not find toolbar "]+d;c.renderCommands(d,k,g,e,"button");if(a&&(d=j.node(a)))c.destroy(d),c.renderCommands(a,d,null,e,"button");f||(f=!0,b.getService("orion.page.selection").addEventListener("selectionChanged",function(b){var d=j.node(a);
d&&(c.destroy(d),c.renderCommands(a,d,b.selections,e,"button"))}))};c.createOperationsCommands=function(b,c,e){function d(a){return!a.operation||!a.operation.type?!1:a.operation.type==="loadstart"||a.operation.type==="progress"}var a=new g.Command({name:i["Remove Completed"],tooltip:i["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(){e.removeCompletedOperations().then(function(){c.loadOperations.bind(c)()})},visibleWhen:function(){return!0}});b.addCommand(a);
a=new g.Command({name:i.Remove,tooltip:i["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(a){for(var a=Array.isArray(a.items)?a.items:[a.items],b=0;b<a.length;b++){var d=a[b];e.removeOperation.bind(e)(d.Location).then(function(){c.loadOperations.bind(c)()},function(){c.loadOperations.bind(c)()})}},visibleWhen:function(a){if(!Array.isArray(a)||a.length===0)return!d(a);for(var b in a)if(d(a[b]))return!1;return!0}});b.addCommand(a);
a=new g.Command({name:i.Cancel,tooltip:i["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){for(var a=Array.isArray(a.items)?a.items:[a.items],b=0;b<a.length;b++){var c=a[b];c.deferred&&c.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||a.length===0)return d(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var b in a)if(!d(a[b])||!a[b].operation||!a[b].operation.cancelable)return!1;return!0}});b.addCommand(a)}})();
return c});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(i,k,j,g,c){function f(b){this._options=b}f.prototype=new g.PopupDialog;f.prototype.TEMPLATE='<table style="width: 360px;"><tr><td><h2>Recent operations</h2></td><td style="text-align: right;"><a id="allOperationsLink" class="navlinkonpage">All Operations</a></td></tr></table><div id="operationsExist"><div style="padding-left: 7px" id="myOperationsListEmpty">No operations running on this page.</div><table id="myOperationsList" style="display: none;"></table></div><div style="padding-left: 7px" id="operationsDontExist">No operations running.</div>';f.prototype._init=
function(b){this._myOperations=[];this._operationsDeferreds=[];this._commandService=b.commandRegistry;c.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(b.triggerNode)};f.prototype._bindToDom=function(){this.$allOperationsLink.href=k.toUrl("operations/list.html");this._setOperationsVisibility()};f.prototype.setOperations=function(b,c){this._myOperations||this._init(this._options);this._myOperations=
[];this._operationsDeferreds=[];if(b)for(var e in b)this._myOperations.push(b[e]),this._operationsDeferreds.push(c[e]);this._renderOperations()};f.prototype.parseProgressResult=function(b){if(!b)return{};b=b.responseText||b;try{b=JSON.parse(b)}catch(c){}var e={Message:b.Message||b,Severity:b.Severity};if(b.DetailedMessage&&b.DetailedMessage!==e.Message)e.DetailedMessage=b.DetailedMessage;return e};f.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,this._myOperations,
this._operationsDeferreds)};f.prototype._renderOperationsTable=function(b,c,e){j.empty(b);for(var d=0;d<c.length;d++){var a=c[d],f=document.createElement("tr"),g=document.createElement("td");g.style.paddingLeft="5px";g.style.paddingRight="5px";g.textContent=a.Name;f.appendChild(g);var k=document.createElement("div");g.appendChild(k);g=document.createElement("span");g.style.paddingRight="5px";g.classList.add("imageSprite");switch(a.type){case "Warning":g.classList.add("core-sprite-warning");g.setAttribute("aria-label",
i["Operation resulted in a warning."]);break;case "error":g.classList.add("core-sprite-error");g.setAttribute("aria-label",i["Operation resulted in an error."]);break;case "loadstart":case "progress":g.classList.add("core-sprite-start");g.setAttribute("aria-label",i["Operation is running."]);break;case "abort":g.classList.add("core-sprite-stop");g.setAttribute("aria-label",i["Operation is canceled."]);break;case "load":case "loadend":g.classList.add("core-sprite-ok"),g.setAttribute("aria-label","Operation ok.")}k.appendChild(g);
g=document.createElement("span");g.classList.add("operationStatus");g.textContent=a.Name;k.appendChild(g);if(a.error){var o=a.error.Message||a.error;a.error.DetailedMessage&&a.error.DetailedMessage!==""&&(o+=": "+a.error.DetailedMessage);g.textContent=o;g.classList.remove("operationStatus");g.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",k,{operation:a,deferred:e[d]},this,"tool");b.appendChild(f)}this._setOperationsVisibility()};f.prototype._setOperationsVisibility=
function(){this.$myOperationsList.style.display=this._myOperations.length>0?"":"none";this.$myOperationsListEmpty.style.display=this._myOperations.length>0?"none":"";this.$operationsDontExist.style.display=this._myOperations.length>0?"none":"";this.$operationsExist.style.display=this._myOperations.length>0?"":"none"};f.prototype.constructor=f;return{OperationsDialog:f}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(i,k,j,g,c){function f(b,e){if(!this._progressPane){this._progressPane=g.node(b);this._operationsDialog=new c.OperationsDialog({triggerNode:this._progressPane,commandRegistry:e});var d=this;this._progressPane.addEventListener("keydown",function(a){(a.charOrCode===" "||a.keyCode===g.KEY.ENTER)&&d._operationsDialog.show()})}}function b(b,c,d,a){this._serviceRegistry=
b;this._serviceRegistration=b.registerService("orion.page.progress",this);this._commandRegistry=d;this._operationsClient=c;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=a}f.prototype={_switchIconTo:function(b){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);this._lastIconClass=b;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(b,c){var d=
{},a;for(a in b)b[a].progressMonitor||(d[a]=b[a]);if(this._isEmpty(d))this._switchIconTo("progressPane_empty"),this._progressPane.title=i.Operations,this._progressPane.alt=i.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var f="";for(a in d){var g=d[a];if(g.type&&(g.type==="loadstart"||g.type==="progress")){f="running";break}}switch(f){case "running":this._progressPane.title=i["Operations running"];this._progressPane.alt=i["Operations running"];
this._progressPane.setAttribute("aria-valuetext",i["Operations running"]);this._switchIconTo("progressPane_running");break;case "warning":this._progressPane.title=i["Some operations finished with warning"];this._progressPane.alt=i["Some operations finished with warning"];this._progressPane.setAttribute("aria-valuetext",i["Some operations finished with warning"]);this._switchIconTo("progressPane_warning");break;case "error":this._progressPane.title=i["Some operations finished with error"];this._progressPane.alt=
i["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",i["Some operations finished with error"]);this._switchIconTo("progressPane_error");break;default:this._progressPane.title=i.Operations,this._progressPane.alt=i.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_operations")}}this._operationsDialog.setOperations(d,c)},_isEmpty:function(b){for(var c in b)return!1;return!0}};
f.prototype.constructon=f;b.prototype={init:function(b){if(!this._progressMonitorClass)this._progressMonitorTool=new f(b,this._commandRegistry)},progress:function(b,c,d){var a=this,f=this._operationsIndex++;!d&&this._progressMonitorClass&&(d=new this._progressMonitorClass,d.begin(c));b.then(function(){if(a._operations[f]){var g=a._operations[f];if(c)g.Name=c;a._lastOperation=g;g.type="loadend";if(d)g.progressMonitor=d;a.writeOperation.bind(a)(f,g,b);g.Location||a._removeOperationFromTheList.bind(a)(f)}},
function(g){if(a._operations[f]){var i=a._operations[f];if(c)i.Name=c;if(d)i.progressMonitor=d;a._lastOperation=i;i.type=g.canceled?"abort":"error";i.error=g;a.writeOperation.bind(a)(f,i,b);i.Location||a._removeOperationFromTheList.bind(a)(f)}},function(g){if(c)g.Name=c;if(d)g.progressMonitor=d;a.writeOperation.bind(a)(f,g,b)});return b},removeOperation:function(b){for(var c in this._operations)if(this._operations[c].Location&&this._operations[c].Location===b){this._removeOperationFromTheList(c);
break}this._operationsClient.removeOperation.bind(this._operationsClient)(b)},_removeOperationFromTheList:function(b){var c=this._operations[b].progressMonitor;delete this._operations[b];delete this._operationDeferrds[b];c?c.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},removeCompletedOperations:function(){for(var b in this._operations){var c=this._operations[b];if(c.type&&c.type!=="loadstart"&&c.type!=="progress")(c=this._operations[b].progressMonitor)&&
c.done(),delete this._operations[b],delete this._operationDeferrds[b]}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(b){this._serviceRegistry.getService("orion.page.message").setProgressResult(b)},showWhile:function(b,c,d){c&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(c);var a=this;b.then(function(){a._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(b){d?a._serviceRegistry.getService("orion.page.message").setProgressMessage(""):
a.setProgressResult.bind(a)(b);return b});return this.progress(b,c)},writeOperation:function(b,c,d){this._operations[b]=c;this._operationDeferrds[b]=d;c.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(a){a.put(c.Location,{Name:c.Name,expires:c.expires})});c.progressMonitor?c.progressMonitor.progress(c.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};b.prototype.constructor=b;return{ProgressService:b}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(i,k){function j(b,c,e){return b[c].apply(b,e)}function g(b){this._location=b}function c(){var b=new k;b.reject(i["No Matching OperationService for location:"]+this._location);return b}function f(b){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=b.getService("orion.core.preference");for(var c=b.getServiceReferences("orion.core.operation"),
e=0;e<c.length;e++){var d=b.getService(c[e]);this._services[e]=d;d=c[e].getProperty("pattern")||".*";d[0]!=="^"&&(d="^"+d);this._patterns[e]=RegExp(d)}this._getService=function(a){if(!a)return this._services[0];for(var b=0;b<this._patterns.length;++b)if(this._patterns[b].test(a))return this._services[b];this._operations.remove(a);return new g(a)}}g.prototype={getOperation:c,getOperations:c,removeCompletedOperations:c,removeOperation:c,cancelOperation:c};g.prototype.constructor=g;f.prototype={getOperations:function(){var b=
new k;if(this._operations)return b.resolve(this._operations),b;var c=this;this._preferenceService.getPreferences("/operations").then(function(e){c._operations=e;b.resolve(c._operations)});return b},getOperation:function(b){return j(this._getService(b),"getOperation",arguments)},removeCompletedOperations:function(){for(var b=[],c=this,e=0;e<this._services.length;e++){var d=this._patterns[e],a=new k;b[e]=a.promise;j(this._services[e],"removeCompletedOperations").then(function(a){return function(b){Array.isArray(b)&&
c.getOperations.bind(c)().then(function(c){for(var e=c.keys(),f=0;f<e.length;f++){var g=e[f];d.test(g)&&b.indexOf(g)<0&&c.remove(g)}a.resolve()})}}(a),function(a){return function(b){a.reject(b)}}(a))}return k.all(b)},removeOperation:function(b){var c=this;return j(this._getService(b),"removeOperation",arguments).then(function(){c.getOperations.bind(c)().then(function(c){c.remove(b)})},function(b){return b},function(b){return b})}};f.prototype.constructor=f;return{OperationsClient:f}});
define("orion/dialogs",[],function(){function i(i){this._serviceRegistry=i;this._serviceRegistration=i.registerService("orion.page.dialog",this)}i.prototype={confirm:function(i,j){j(window.confirm(i))},openFiles:function(){}};i.prototype.constructor=i;return{DialogService:i}});
define("orion/searchClient","i18n!orion/search/nls/messages,require,orion/webui/littlelib,orion/i18nUtil,orion/searchUtils,orion/crawler/searchCrawler,orion/explorers/navigatorRenderer,orion/extensionCommands,orion/Deferred".split(","),function(i,k,j,g,c,f,b,h,e){function d(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function a(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new d(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}d.prototype.makeRenderFunction=function(a,d,f,o,p){var s=this.serviceRegistry,u=this.commandRegistry;this.openWithCommands=this.openWithCommands||h.createOpenWithCommands(s,a,u);var v=this;return function(h,s,l,r){e.when(v.openWithCommands,function(e){if(l)j.empty(d),e=document.createElement("div"),e.appendChild(document.createTextNode(i["Search failed."])),d.appendChild(e),typeof o==="function"&&o(d);else{var v=
function(){function a(b,c){var d=c.folderName?c.folderName:c.path,e=document.createElement("span");e.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");e.appendChild(document.createTextNode(" - "+d+" "));b.appendChild(e)}var b={};return function(c,d){var e=d.name;if(b.hasOwnProperty(e)){a(c,d);var f=b[e];typeof f==="function"&&(b[e]=null,f())}else b[e]=function(){a(c,d)}}}(),z=!1;j.empty(d);if(h&&h.length>0){var E=document.createElement("table");E.setAttribute("role","presentation");for(var B=0;B<h.length;B++){var G=
h[B],D;if(!z&&(z=!0,f))D=E.insertRow(0).insertCell(0),D.textContent=f;D=E.insertRow(-1).insertCell(0);D.colspan=2;p&&p(D);var M={Name:G.name,Directory:G.directory,Location:G.path||G.location},H=null;if(typeof G.LineNumber==="number")H={},H.line=G.LineNumber;if(r&&r.keyword&&!r.nameSearch){var J=c.generateSearchHelper(r),H=H||{};H.find=J.inFileQuery.searchStr;H.regEx=J.inFileQuery.wildCard?!0:void 0}M=b.createLink(k.toUrl("edit/edit.html"),M,u,a,e,{"aria-describedby":(G.folderName?G.folderName:G.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},H);G.LineNumber&&M.appendChild(document.createTextNode(" (Line "+G.LineNumber+")"));D.appendChild(M);v(D,G)}d.appendChild(E);typeof o==="function"&&o(d)}!z&&s&&(e=g.formatMessage(i["No matches found for ${0}"],s),j.empty(d),d.appendChild(document.createTextNode(e)),typeof o==="function"&&o(d))}})}};a.prototype={search:function(a,b,d){var e=function(a){for(var d=[],e=0;e<a.response.docs.length;e++){var f=a.response.docs[e],g=f.Location,h=c.path2FolderName(f.Path?
f.Path:f.Location,f.Name),i=h?h:g;(b?i.indexOf(b)>=0:1)&&d.push({name:f.Name,path:g,folderName:h,directory:f.Directory,lineNumber:f.LineNumber})}return d};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){d(e(b),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(b){var c=a.keyword,c=c.substring(c.indexOf("}")+1),c=c.substring(c.indexOf(":")+1);d(e(b),c,null,a)},function(a){d(null,
null,a,null)})}catch(g){typeof g==="string"&&g.indexOf("search")>-1&&this._crawler?this._crawler.searchName(a,function(b){d(e(b),null,null,a)}):typeof g==="string"&&g.indexOf("search")>-1&&!a.nameSearch?(new f.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){d(e(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(g)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,b){console.error(a);j.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var c="",d=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&a.Parents.length>0?d=b.index==="last"?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(d=a);if(d)this.setLocationbyURL(d.Location),c=d.Name,this._childrenLocation=d.ChildrenLocation;else if(a)this.setLocationbyURL(this._searchRootLocation),
c=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation;d=j.node("search");c||(c="");if(d&&d.placeholder){d.value="";var e=g.formatMessage(i["Search ${0}"],c);d.placeholder=e.length>30?e.substring(0,27)+"...":g.formatMessage(i["Search ${0}"],c)}if(d&&d.title)d.title=i["Type a keyword or wild card to search in "]+c},setLocationbyURL:function(a){this._searchLocation=a},setRootLocationbyURL:function(a){this._searchRootLocation=a},setChildrenLocationbyURL:function(a){this._childrenLocation=
a},getSearchLocation:function(){return this._searchLocation?this._searchLocation:this._fileService.fileServiceRootURL()},getSearchRootLocation:function(){return this._searchRootLocation?this._searchRootLocation:this._fileService.fileServiceRootURL()},getChildrenLocation:function(){return this._childrenLocation?this._childrenLocation:this._fileService.fileServiceRootURL()},createSearchParams:function(a,b,c,d){c=c?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:c,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:c,sort:d&&d.sort?d.sort:"Path asc",rows:d&&d.rows?d.rows:40,start:0,caseSensitive:d?d.caseSensitive:void 0,regEx:d?d.regEx:void 0,fileType:d?d.fileType:void 0,keyword:a,replace:d?d.replace:void 0}}};a.prototype.constructor=a;return{Searcher:a}});
define("orion/problems",["orion/EventTarget"],function(i){function k(j){this._serviceRegistry=j;i.attach(this);this._serviceRegistration=j.registerService("orion.core.marker",this)}k.prototype={_setProblems:function(i){this.problems=i;this.dispatchEvent({type:"problemsChanged",problems:i})}};k.prototype.constructor=k;return{ProblemService:k}});
define("orion/blameAnnotations",["orion/EventTarget"],function(i){function k(j){this._serviceRegistry=j;i.attach(this);this._serviceRegistration=j.registerService("orion.core.blame",this)}k.prototype={_setAnnotations:function(i){this.blameInfo=i;this.dispatchEvent({type:"blameChanged",blameInfo:i})}};k.prototype.constructor=k;return{BlameService:k}});
define("edit/setup","i18n!orion/edit/nls/messages,orion/sidebar,orion/inputManager,orion/globalCommands,orion/editor/textModel,orion/editor/undoStack,orion/folderView,orion/editorView,orion/editorPluginView,orion/markdownView,orion/commandRegistry,orion/contentTypes,orion/fileClient,orion/fileCommands,orion/selection,orion/status,orion/progress,orion/operationsClient,orion/outliner,orion/dialogs,orion/extensionCommands,orion/projectCommands,orion/searchClient,orion/problems,orion/blameAnnotations,orion/Deferred,orion/EventTarget,orion/URITemplate,orion/i18nUtil,orion/PageUtil,orion/objects,orion/webui/littlelib,orion/projectClient".split(","),function(i,
k,j,g,c,f,b,h,e,d,a,m,n,q,o,p,s,u,v,t,w,l,r,y,x,z,E,B,G,D,M,H,J){function U(a){this.parentNode=a.parentNode;this.commandRegistry=a.commandRegistry;this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.parentNode=a.parentNode;this.fileActionsScope="fileActions";this.editActionsScope="editActions";this.viewActionsScope="viewActions";this.toolsActionsScope="toolsActions";this.additionalActionsScope="extraActions";this.createActionSections()}z={};U.prototype=
{};M.mixin(U.prototype,{createActionSections:function(){var a=this;[this.fileActionsScope,this.editActionsScope,this.viewActionsScope,this.toolsActionsScope,this.additionalActionsScope].reverse().forEach(function(b){if(!a[b]){var c=document.createElement("ul");c.id=b;c.classList.add("commandList");c.classList.add("layoutLeft");c.classList.add("pageActions");b===a.additionalActionsScope&&c.classList.add("extraActions");a.parentNode.insertBefore(c,a.parentNode.firstChild);a[b]=c}});var b=this.commandRegistry,
c=this.fileActionsScope,d=this.editActionsScope,e=this.viewActionsScope,f=this.toolsActionsScope;b.addCommandGroup(c,"orion.menuBarFileGroup",1E3,i.File,null,i.noActions,null,null,"dropdownSelection");b.addCommandGroup(d,"orion.menuBarEditGroup",100,i.Edit,null,i.noActions,null,null,"dropdownSelection");b.addCommandGroup(e,"orion.menuBarViewGroup",100,i.View,null,i.noActions,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.menuBarToolsGroup",100,i.Tools,null,null,null,null,"dropdownSelection");
b.addCommandGroup(c,"orion.newContentGroup",0,i.New,"orion.menuBarFileGroup",null,null,null,"dropdownSelection");b.addCommandGroup(c,"orion.importGroup",100,i.Import,"orion.menuBarFileGroup",null,null,null,"dropdownSelection");b.addCommandGroup(c,"orion.exportGroup",1001,i.Export,"orion.menuBarFileGroup",null,null,null,"dropdownSelection")},createCommands:function(){var a=this.serviceRegistry,b=this.commandRegistry,c=this.fileClient;return q.createFileCommands(a,b,c).then(function(){return w.createFileCommands(a,
null,"all",!0,b).then(function(){if(a.getServiceReferences("orion.projects").length>0){var d=a.getService("orion.project.client");return d.getProjectHandlerTypes().then(function(e){return d.getProjectDeployTypes().then(function(f){return l.createProjectCommands(a,b,c,d,e,f)},function(){return l.createProjectCommands(a,b,c,d,e)})})}})})},setActiveExplorer:function(a){this.explorer=a},updateCommands:function(){var a=this.explorer,b,c,d;if(a)b=a.isCommandsVisible(),c=a.selection,d=a.treeRoot;var e=this.inputManager.getFileMetadata(),
f=this.commandRegistry,g=this.serviceRegistry;f.registerSelectionService(this.fileActionsScope,b?c:null);f.registerSelectionService(this.editActionsScope,b?c:null);f.registerSelectionService(this.viewActionsScope,b?c:null);q.setExplorer(a);l.setExplorer(a);q.updateNavTools(g,f,a,null,[this.fileActionsScope,this.editActionsScope,this.viewActionsScope],d,!0);f.destroy(this.toolsActionsScope);f.renderCommands(this.toolsActionsScope,this.toolsActionsScope,e,a,"tool");f.destroy(this.additionalActionsScope);
f.renderCommands(this.additionalActionsScope,this.additionalActionsScope,d,a,"button")}});z.setUpEditor=function(l,q,w,z){function W(a){Q!==a&&(Q&&Q.addEventListener("DirtyChanged",fa),(Q=a)&&Q.addEventListener("DirtyChanged",fa=function(){g.setDirtyIndicator(Q.isDirty())}))}function T(a){ba.updateCommands();var b=H.node("pageActions");b&&(A.destroy(b),a&&A.renderCommands(b.id,b,a,Q,"button"));if(b=H.node("pageNavigationActions"))A.destroy(b),a&&A.renderCommands(b.id,b,a,Q,"button");if(b=H.node("settingsActions"))A.destroy(b),
a&&A.renderCommands(b.id,b,a,Q,"button")}function I(a,b,c){b==="progress"?L.setProgressMessage(a):b==="error"?L.setErrorMessage(a):L.setMessage(a,null,c)}function F(a,c){var f=null;if(c&&a){var g=M.mixin({input:a,metadata:c},la);if(c.Directory)f=new b.FolderView(g);else{var h=a.editor;if(!h||h==="orion.editor")f=da;else if(h==="orion.viewer.markdown")f=new d.MarkdownEditorView(g);else for(var i=l.getServiceReferences("orion.edit.editor"),j=0;j<i.length;j++)if(i[j].getProperty("id")===h){g.editorService=
i[j];f=new e.PluginEditorView(g);break}}}ea!==f&&(A.closeParameterCollector(),ea&&ea.destroy(),(ea=f)&&ea.create());return ea}var C,A,L,Y,X,S,Z,ca;(function(){C=new o.Selection(l);var b=new u.OperationsClient(l);L=new p.StatusReportingService(l,b,"statusPane","notifications","notificationArea");new t.DialogService(l);A=new a.CommandRegistry({selection:C});S=new s.ProgressService(l,b,A);new y.ProblemService(l);Y=new v.OutlineService({serviceRegistry:l,preferences:w});X=new m.ContentTypeRegistry(l);
Z=new n.FileClient(l);new J.ProjectClient(l,Z);ca=new r.Searcher({serviceRegistry:l,commandService:A,fileService:Z});new x.BlameService(l)})();var ga=H.node("sidebar"),ha=H.node("sidebarToolbar"),ia=H.node("pageToolbar"),$=H.node("editor");g.generateBanner("orion-editor",l,A,w,ca,null,null,!1);var Q,fa,V,O,da,aa,ba,ka=new B("#{,resource,params*}"),na=function(a,b,c){b=c?c.Location:Z.fileServiceRootURL(b);a.href=ka.expand({resource:b});c&&(b=V.getFileMetadata())&&b.Location===c.Location&&a.addEventListener("click",
function(){O.reveal(c)})},ea,la,ja=new c.TextModel,oa=new f.UndoStack(ja,500),ma={};["getText","setText"].forEach(function(a){ma[a]=ja[a].bind(ja)});l.registerService("orion.edit.model.context",ma,null);V=new j.InputManager({serviceRegistry:l,fileClient:Z,progressService:S,statusReporter:I,selection:C,contentTypeRegistry:X});V.addEventListener("InputChanged",function(a){var b=a.metadata,c=F(a.input,b);W(c?c.editor:null);a.editor=Q;T(b);var c=a.name,d=b;if(a.input===null||a.input===void 0)c=aa?aa.Name:
"",d=aa;g.setPageCommandExclusions(["orion.editFromMetadata"]);g.setPageTarget({task:"Editor",name:c,target:d,makeAlternate:function(){if(b&&b.parent)return b.parent;else if(b&&b.Parents&&b.Parents.length>0)return S.progress(Z.read(b.Parents[0].Location,!0),G.formatMessage(i.ReadingMetadata,b.Parents[0].Location))},makeBreadcrumbLink:na,makeBreadcrumFinalLink:!0,serviceRegistry:l,commandService:A,searchService:ca,fileService:Z});Q&&g.setDirtyIndicator(Q.isDirty());A.processURL(window.location.href)});
ba=new U({parentNode:ia,fileClient:Z,inputManager:V,commandRegistry:A,serviceRegistry:l});ba.createCommands().then(function(){function a(){E.attach(this)}la={parent:$,model:ja,menuBar:ba,undoStack:oa,serviceRegistry:l,pluginRegistry:q,commandRegistry:A,contentTypeRegistry:X,renderToolbars:T,inputManager:V,readonly:z,preferences:w,searcher:ca,selection:C,fileService:Z,statusReporter:I,statusService:L,progressService:S};da=new h.EditorView(la);O=new a;var b=new k({commandRegistry:A,contentTypeRegistry:X,
editorInputManager:V,preferences:w,fileClient:Z,outlineService:Y,parent:ga,progressService:S,selection:C,serviceRegistry:l,sidebarNavInputManager:O,switcherScope:"viewActions",menuBar:ba,toolbar:ha});a.prototype.processHash=function(){var a=D.matchResourceParameters().navigate;typeof a==="string"&&this.setInput&&b.getActiveViewModeId()==="nav"&&this.setInput(a)};b.show();O.addEventListener("rootChanged",function(a){aa=a.root});var c=function(a){window.location=ka.expand({resource:a.newInput||a.parent||
""})};O.addEventListener("filesystemChanged",c);O.addEventListener("editorInputMoved",c);O.addEventListener("create",function(a){if(a.newValue)window.location=ka.expand({resource:a.newValue.Location})});C.addEventListener("selectionChanged",function(a){V.setInput(a.selection)});window.addEventListener("hashchange",function(){V.setInput(D.hash());O.processHash(D.hash())});V.setInput(D.hash());O.processHash(D.hash())});window.onbeforeunload=function(){if(Q&&Q.isDirty())return V.getAutoSaveEnabled()?
(V.save(),i.unsavedAutoSaveChanges):i.unsavedChanges}};return z});define('built-edit.js',["orion/browserCompatibility","orion/bootstrap","edit/setup"],function(i,k,j){k.startup().then(function(g){j.setUpEditor(g.serviceRegistry,g.pluginRegistry,g.preferences,!1)})});