/**
 * @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 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) 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) 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
 * 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, 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) 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) 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, 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) 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) 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) 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) 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) 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 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) 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) 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) 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) 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
 ******************************************************************************/

/*******************************************************************************
 * @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
 ******************************************************************************/

/* See jsdiff-license.txt for terms of usage */

/*******************************************************************************
 * @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
 ******************************************************************************/

/*

 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, 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).


 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
 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) 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: 
 Felipe Heidrich (IBM Corporation) - initial API and implementation
 Silenio Quarti (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). 

 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) 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) 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) 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) 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, 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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, 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, 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

 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) 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) 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) 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) 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) 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) 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: 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) 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) 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) 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) 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, 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
 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) 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
*/
(function(){function j(b,d,a,e,i,g){d[b]&&(a.push(b),(d[b]===!0||d[b]===1)&&e.push(i+b+"/"+g))}function k(b,d,a,e,i){d=e+d+"/"+i;require._fileExists(b.toUrl(d+".js"))&&a.push(d)}function h(b,d,a){for(var e in d)d.hasOwnProperty(e)&&(!b.hasOwnProperty(e)||a)?b[e]=d[e]:typeof d[e]==="object"&&h(b[e],d[e],a)}var d=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(b){var f=b.config?b.config():{};return{version:"2.0.1+",load:function(a,b,i,g){g=g||{};if(g.locale)f.locale=g.locale;
var c=d.exec(a),l=c[1],m=c[4],p=c[5],o=m.split("-"),q=[],v={},s,r="";if(c[5])l=c[1],a=l+p;else{p=c[4];m=f.locale;if(!m)m=f.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase();o=m.split("-")}if(g.isBuild){q.push(a);k(b,"root",q,l,p);for(s=0;s<o.length;s++)g=o[s],r+=(r?"-":"")+g,k(b,r,q,l,p);b(q,function(){i()})}else b([a],function(c){var a=[],n;j("root",c,a,q,l,p);for(s=0;s<o.length;s++)n=o[s],r+=(r?"-":"")+n,j(r,c,a,q,l,p);b(q,function(){var n,
g,d;for(n=a.length-1;n>-1&&a[n];n--){d=a[n];g=c[d];if(g===!0||g===1)g=b(l+d+"/"+p);h(v,g)}i(v)})})}}})})();
define("orion/i18n",[],function(){return{load:function(j,k,h,d){var d=d||{},b=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,f=b.exec(j);if(f){if(!k.defined||k.defined(j))try{h(k(j));return}catch(a){}if(d.isBuild||d.isTest)h({});else if(k.specified&&!k.specified("orion/bootstrap"))h({});else{var e=f[1],i=f[3]?f[2]:"",g=f[3]||f[2];k(["orion/bootstrap"],function(c){c.startup().then(function(c){var a=c.serviceRegistry,c=a.getServiceReferences("orion.i18n.message");if(i)c.some(function(c){return j===c.getProperty("name")?
(a.getService(c).getMessageBundle().then(function(c){h(c)},function(){h({})}),!0):!1})||h({});else{var p={},o;c.forEach(function(c){var a=c.getProperty("name");if((f=b.exec(a))&&e===f[1]&&g===(f[3]||f[2]))if(i=f[3]?f[2]:""){if((c=d.locale||(typeof navigator!=="undefined"?navigator.language||navigator.userLanguage:null))&&c.toLowerCase().indexOf(i.toLowerCase())===0)p[i]=!0,(!k.specified||!k.specified(a))&&define(a,["orion/i18n!"+a],function(c){return c})}else o=c});!k.specified||!k.specified(j)?o?
a.getService(o).getMessageBundle().then(function(c){Object.keys(p).forEach(function(a){typeof c[a]==="undefined"&&(c[a]=p[a])});define(j,[],c);h(c)},function(){define(j,[],p);h(p)}):(define(j,[],p),h(p)):h(p)}})})}}else h(null)}}});
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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
(function(){function j(){for(var b=navigator.userAgent,d={browser:!1,version:!1},a=[{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}],e=0;e<a.length;e++){var i=a[e],g=b.match(i.regExp);if(g){d.browser=
!0;d.version=g[1]>=i.minVersion;d.name=i.name;break}}return d}function k(){try{return"localStorage"in window&&window.localStorage!==null}catch(b){return!1}}function h(b){alert(b);throw Error("unsupported browser");}var d=j();if(d.browser)d.version||h("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+d.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()||h("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:j,supportsLocalStorage:k,throwBrowserAlert:h}})();define("orion/browserCompatibility",function(){});
(function(j,k){typeof define==="function"&&define.amd?define("orion/Deferred",k):typeof exports==="object"?module.exports=k():(j.orion=j.orion||{},j.orion.Deferred=k())})(this,function(){function j(){for(var a;a=b.shift();)a();f=!1}function k(a){b.push(a);f||(f=!0,setTimeout(j,0))}function h(a){return function(){a.apply(void 0,arguments)}}function d(){function a(){for(var a;a=m.shift();){var g=a.deferred,e=l==="fulfilled"?"resolve":"reject";if(typeof a[e]==="function")try{var i=(0,a[e])(c),d=i&&(typeof i===
"object"||typeof i==="function")&&i.then;if(typeof d==="function")if(i===g.promise)g.reject(new TypeError);else{var f=i.cancel;typeof f==="function"?g._protected(b).parentCancel=f.bind(i):delete g._protected(b).parentCancel;d.call(i,h(g.resolve),h(g.reject),h(g.progress))}else g.resolve(i)}catch(n){g.reject(n)}else g[e](c)}}function e(g){delete o.parentCancel;l="rejected";c=g;m.length&&k(a)}function i(g){function b(c){return function(n){h||(h=!0,c(n))}}var h=!1;delete o.parentCancel;try{var j=g&&
(typeof g==="object"||typeof g==="function")&&g.then;if(typeof j==="function")if(g===f)e(new TypeError);else{l="assumed";var u=g&&g.cancel;if(typeof u!=="function"){var w=new d,g=w.promise;try{j(w.resolve,w.reject,w.progress)}catch(n){w.reject(n)}u=g.cancel;j=g.then}c=g;j.call(g,b(i),b(e));o.parentCancel=u.bind(g)}else l="fulfilled",c=g,m.length&&k(a)}catch(t){b(e)(t)}}function g(){var c=o.parentCancel;if(c)delete o.parentCancel,c();else if(!l)c=Error("Cancel"),c.name="Cancel",e(c)}var c,l,m=[],f=
this,o={};Object.defineProperty(this,"_protected",{value:function(c){if(c!==b)throw Error("protected");return o}});this.resolve=function(c){l||i(c);return f};this.reject=function(c){l||e(c);return f};this.progress=function(c){l||m.forEach(function(a){if(a.progress)try{a.progress(c)}catch(g){}});return f.promise};this.cancel=function(){o.parentCancel?setTimeout(g,0):g();return f};this.then=function(c,g,e){c={resolve:c,reject:g,progress:e,deferred:new d};m.push(c);c.deferred._protected(b).parentCancel=
f.promise.cancel.bind(f);(l==="fulfilled"||l==="rejected")&&k(a);return c.deferred.promise};this.promise={then:f.then,cancel:f.cancel}}var b=[],f=!1;d.all=function(a,b){function i(a,g){m||(l[a]=g,--c===0&&f.resolve(l))}function g(c,a){if(!m){if(b)try{i(c,b(a));return}catch(g){a=g}f.reject(a)}}var c=a.length,l=[],m=!1,f=new d;f.then(void 0,function(){m=!0;a.forEach(function(c){c.cancel&&c.cancel()})});c===0?f.resolve(l):a.forEach(function(c,a){c.then(i.bind(void 0,a),g.bind(void 0,a))});return f.promise};
d.when=function(a,b,i,g){var c;if(!(a&&typeof a.then==="function"))c=new d,c.resolve(a),a=c.promise;return a.then(b,i,g)};return d});
define("orion/EventTarget",[],function(){function j(){this._namedListeners={}}j.prototype={dispatchEvent:function(j){if(!j.type)throw Error("unspecified type");var h=this._namedListeners[j.type];h&&h.forEach(function(d){try{typeof d==="function"?d(j):d.handleEvent(j)}catch(b){typeof console!=="undefined"&&console.log(b)}});return!j.defaultPrevented},addEventListener:function(j,h){if(typeof h==="function"||h.handleEvent)this._namedListeners[j]=this._namedListeners[j]||[],this._namedListeners[j].push(h)},
removeEventListener:function(j,h){var d=this._namedListeners[j];if(d)for(var b=0;b<d.length;b++)if(d[b]===h){d.length===1?delete this._namedListeners[j]:d.splice(b,1);break}}};j.prototype.constructor=j;j.attach=function(k){var h=new j;k.dispatchEvent=h.dispatchEvent.bind(h);k.addEventListener=h.addEventListener.bind(h);k.removeEventListener=h.removeEventListener.bind(h)};return j});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(j,k){function h(a,b,g){this._properties=g||{};this._properties["service.id"]=a;this._properties.objectClass=b;this._properties["service.names"]=b}function d(a,b,g){this._serviceId=a;this._serviceReference=b;this._internalRegistry=g}function b(a,b){function g(c){return function(){var g;try{if(!b())throw Error("Service was unregistered");var d=a[c].apply(a,Array.prototype.slice.call(arguments));if(d&&typeof d.then==="function")return d;
else g=new j,g.resolve(d)}catch(f){g=new j,g.reject(f)}return g.promise}}for(var c in a)typeof a[c]==="function"&&(this[c]=g(c))}function f(a,b){this.type=a;this.serviceReference=b}function a(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new k;var a=this;this._internalRegistry={isRegistered:function(b){return a._entries[b]?!0:!1},unregisterService:function(b){var g=a._entries[b];if(!g)throw Error("Service has already been unregistered: "+b);var c=g.reference;a._serviceEventTarget.dispatchEvent(new f("unregistering",
c));a._entries[b]=null;c.getProperty("objectClass").forEach(function(g){for(var b=a._namedReferences[g],i=0;i<b.length;i++)if(b[i]===c){b.length===1?delete a._namedReferences[g]:b.splice(i,1);break}})},modifyService:function(b){var g=a._entries[b];if(!g)throw Error("Service not found while trying to send modified event: "+b);a._serviceEventTarget.dispatchEvent(new f("modified",g.reference))}}}h.prototype={getPropertyKeys:function(){var a=[],b;for(b in this._properties)this._properties.hasOwnProperty(b)&&
a.push(b);return a},getProperty:function(a){return this._properties[a]}};h.prototype.constructor=h;d.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(a){var b=this._serviceReference._properties;this._serviceReference._properties=a||{};a["service.id"]=this._serviceId;
a.objectClass=b.objectClass;a["service.names"]=b["service.names"];this._internalRegistry.modifyService(this._serviceId)}};d.prototype.constructor=d;a.prototype={getService:function(a){var b;if(typeof a==="string")(a=this._namedReferences[a])&&a.some(function(a){b=this._entries[a.getProperty("service.id")].service;return!!b},this);else if(a=this._entries[a.getProperty("service.id")])b=a.service;return b||null},getServiceReferences:function(a){if(a)return this._namedReferences[a]?this._namedReferences[a]:
[];var b=[];this._entries.forEach(function(a){a&&b.push(a.reference)});return b},registerService:function(a,i,g){if(typeof i==="undefined"||i===null)throw Error("invalid service");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var c=this._entries.length,l=new h(c,a,g),m=this._namedReferences;a.forEach(function(c){m[c]=m[c]||[];m[c].push(l)});a=new b(i,this._internalRegistry.isRegistered.bind(null,c));this._entries.push({reference:l,service:a});a=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new f("registered",
l));return new d(c,l,a)},addEventListener:function(a,b){this._serviceEventTarget.addEventListener(a,b)},removeEventListener:function(a,b){this._serviceEventTarget.removeEventListener(a,b)}};a.prototype.constructor=a;return{ServiceRegistry:a}});
define("orion/xhr",["orion/Deferred"],function(j){function k(h,d,b,f){var a=typeof b.response!=="undefined"?b.response:b.responseText,e;try{e=b.status}catch(i){e=0}h={args:d,response:a,responseText:typeof a==="string"?a:null,status:e,url:h,xhr:b};if(typeof f!=="undefined")h.error=f;return h}return function(h,d,b){var b=b||{},f=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,a=new j,e=b.headers||{},i=b.log||!1,g;typeof e["X-Requested-With"]==="undefined"&&(e["X-Requested-With"]="XMLHttpRequest");
if(typeof b.data!=="undefined"&&(h==="POST"||h==="PUT"))g=b.data;var c=!1,l=!1;a.promise.then(void 0,function(a){c=!0;!l&&a instanceof Error&&a.name==="Cancel"&&f.abort()});f.onabort=function(){l=!0;if(!c){var b=Error("Cancel");b.name="Cancel";a.reject(b)}};f.onload=function(){var c=k(d,b,f);200<=f.status&&f.status<400?a.resolve(c):(a.reject(c),i&&typeof console!=="undefined"&&console.log(Error(f.statusText)))};f.onerror=function(){var c=k(d,b,f);a.reject(c);i&&typeof console!=="undefined"&&console.log(Error(f.statusText))};
f.onprogress=function(c){c.xhr=f;a.progress(c)};try{f.open(h,d,!0);if(typeof b.responseType==="string")f.responseType=b.responseType;if(typeof b.timeout==="number")if(typeof f.timeout==="number")f.timeout=b.timeout,f.addEventListener("timeout",function(){a.reject(k(d,b,f,"Timeout exceeded"))});else{var m=setTimeout(function(){a.reject(k(d,b,f,"Timeout exceeded"))},b.timeout);a.promise.then(clearTimeout.bind(null,m),clearTimeout.bind(null,m))}Object.keys(e).forEach(function(c){f.setRequestHeader(c,
e[c])});f.send(g||null)}catch(p){a.reject(k(d,b,f,p))}return a.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(j,k,h){function d(a,c){this._name=a;this._providers=c;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function b(a,c){return{get:function(b,e){if(c===0)return null;var i=localStorage.getItem(a+b);if(i===null)return null;i=JSON.parse(i);return e||c===-1||i._expires&&i._expires>(new Date).getTime()?(delete i._expires,i):null},set:function(b,e){if(c!==0){if(c!==-1)e._expires=(new Date).getTime()+
1E3*c;if(Object.keys(e).length===0)localStorage.removeItem(a+b);else{var i=JSON.stringify(e);localStorage.setItem(a+b,i);delete e._expires}}},remove:function(c){localStorage.removeItem(a+c)}}}function f(a){this._currentPromises={};this._cache=new b("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var c=a.getServiceReferences("orion.core.preference.provider");if(c.length>0)this._service=a.getService(c[0])}return!!this._service}}function a(a){this._location=
a;this._currentPromise=null;this._cache=new b("/orion/preferences/default",3600)}function e(){this._cache=new b("/orion/preferences/local",-1)}function i(b,c){this._userProvider=new f(b);this._localProvider=new e;c=c||"defaults.pref";c.indexOf("://")===-1&&(c=j.toUrl(c));this._defaultsProvider=new a(c);this._serviceRegistration=b.registerService("orion.core.preference",this)}d.prototype={_flush:function(){for(var a=[],c=0;c<this._stores.length;++c){var b=this._stores[c];this._dirty.indexOf(b)!==-1&&
a.push(this._providers[c].put(this._name,b));if(this._pendingDeletes[c]&&this._pendingDeletes[c].length>0){for(b=0;b<this._pendingDeletes[c].length;b++)a.push(this._providers[c].remove(this._name,this._pendingDeletes[c][b]));delete this._pendingDeletes[c]}}this._dirty=[];return k.all(a)},_scheduleFlush:function(a){a&&this._dirty.indexOf(a)===-1&&this._dirty.push(a);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 a=0;a<this._stores.length;++a){var c=this._stores[a],b;for(b in c)c.hasOwnProperty(b)&&typeof this._cached[b]==="undefined"&&(this._cached[b]=c[b])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(a){return this._getCached()[a]},put:function(a,c){if(this._stores.length!==0){var b=this._stores[0];if(b[a]!==c)b[a]=c,this._cached=null,this._scheduleFlush(b)}},remove:function(a){for(var c=0;c<
this._stores.length;++c){var b=this._stores[c];if(b.hasOwnProperty(a))return delete b[a],this._pendingDeletes[c]||(this._pendingDeletes[c]=[]),this._pendingDeletes[c].push(a),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var a=0;a<this._stores.length;++a)this._stores[a]={},this._scheduleFlush(this._stores[a]);this._cached=null},sync:function(a){if(this._flushPending)return this._flushPending=!1,this._flush();for(var c=this,b=[],e=0;e<this._providers.length;++e)b.push(this._providers[e].get(this._name,
a).then(function(a){return function(b){c._stores[a]=b}}(e)));return k.all(b).then(function(){c._cached=null;c._getCached()})},flush:function(){this._flush()}};f.prototype={get:function(a,c){if(this._currentPromises[a])return this._currentPromises[a];var b=new k,e=null;c?this._cache.remove(a):e=this._cache.get(a);if(e!==null)b.resolve(e);else{this._currentPromises[a]=b;var i=this;this._service.get(a).then(function(c){i._cache.set(a,c);delete i._currentPromises[a];b.resolve(c)},function(c){c.status===
404?(c={},i._cache.set(a,c),delete i._currentPromises[a],b.resolve(c)):(delete i._currentPromises[a],b.resolve(i._cache.get(a,!0)||{}))})}return b},put:function(a,c){this._cache.set(a,c);return this._service.put(a,c)},remove:function(a,c){var b=this._cache.get(a);delete b[c];this._cache.set(a,b);return this._service.remove(a,c)}};a.prototype={get:function(a,c){if(this._currentPromise)return this._currentPromise;var b=new k,e=null;c?this._cache.remove(a):e=this._cache.get(a);if(e!==null)b.resolve(e);
else{this._currentPromise=b;var i=this;h("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=JSON.parse(c.response);i._cache.set(a,c[a]||{});i._currentPromise=null;b.resolve(c[a]||{})},function(c){c.xhr.status===401||c.xhr.status===404?(i._cache.set(a,{}),i._currentPromise=null,b.resolve({})):(i._currentPromise=null,c=i._cache.get(a,!0),c!==null?b.resolve(c[a]||{}):b.resolve({}))})}return b},put:function(){var a=new k;a.resolve();return a},remove:function(a,c){var b=
this._cache.get(a);delete b[c];this.put(a,b)}};e.prototype={get:function(a){var c=new k,a=this._cache.get(a);a!==null?c.resolve(a):c.resolve({});return c},put:function(a,c){var b=new k;this._cache.set(a,c);b.resolve();return b},remove:function(a,c){var b=this._cache.get(a);delete b[c];this.put(a,b)}};i.DEFAULT_SCOPE=1;i.LOCAL_SCOPE=2;i.USER_SCOPE=4;i.prototype={listenForChangedSettings:function(a,c,b){if(!c||typeof c!=="number"||c>7||c<1)b=c,c=i.DEFAULT_SCOPE|i.LOCAL_SCOPE|i.USER_SCOPE;window.addEventListener("storage",
b,!1);if((i.USER_SCOPE&c)!==0)return"/orion/preferences/user"+a;else if((i.LOCAL_SCOPE&c)!==0)return"/orion/preferences/local"+a;return"/orion/preferences/default"+a},getPreferences:function(a,c){if(!c||typeof c!=="number"||c>7||c<1)c=i.DEFAULT_SCOPE|i.LOCAL_SCOPE|i.USER_SCOPE;var b=[];i.USER_SCOPE&c&&this._userProvider.available()&&b.push(this._userProvider);i.LOCAL_SCOPE&c&&b.push(this._localProvider);i.DEFAULT_SCOPE&c&&b.push(this._defaultsProvider);var e=new d(a,b);return e.sync().then(function(){return e})},
getSetting:function(a,c,b){for(var e,i=0;i<a.length;i++)if(a[i].label===c)for(var d=0;d<a[i].data.length;d++)if(a[i].data[d].label===b){e=a[i].data[d].value;break}return e}};return{PreferencesService:i}});
(function(){function j(c){if(typeof c!=="string")throw new TypeError;}function k(c){return c?c.split("&"):[]}function h(c){return c.length===0?"":c.join("&")}function d(c){var a=/([^=]*)(?:=?)(.*)/.exec(c),c=a[1]?decodeURIComponent(a[1]):"",a=a[2]?decodeURIComponent(a[2]):"";return[c,a]}function b(c){var a=encodeURIComponent(c[0]);c[1]&&(a+="="+encodeURIComponent(c[1]));return a}function f(c,a){var n="",b=[],t=0;return{next:function(){if(n!==c.query)n=c.query,b=k(n);if(t<b.length){var g=d(b[t++]);
switch(a){case "keys":return g[0];case "values":return g[1];case "keys+values":return[g[0],g[1]];default:throw new TypeError;}}throw z;}}}function a(c){Object.defineProperty(this,"_url",{get:function(){return c._url}})}function e(c){return c?/[1-9]\d*$/.exec(c)[0]:""}function i(c){var a=[];c.split("/").forEach(function(c){c===".."?a.pop():c!=="."&&a.push(c)});return a.join("/")}function g(c){return c.replace(/\s/g,function(c){return"%"+c.charCodeAt(0).toString(16)})}function c(c,a){if(typeof c!==
"string")throw new TypeError;var c=g(c),n=o.exec(c);if(!n)return null;var b={};b.scheme=n[1]||"";if(b.scheme&&!v.test(b.scheme))return null;var t=n[2];if(t&&(t=q.exec(t),b.userinfo=t[1],b.host=t[2],b.port=t[3],b.port&&!s.test(b.port)))return null;b.path=n[3];b.query=n[4];b.fragment=n[5];if(!b.scheme&&a&&(b.scheme=a.scheme,!b.host&&a.host))b.userinfo=a.userinfo,b.host=a.host,b.port=a.port,b.pathRelative=!0;if(b.pathRelative)if(b.path){if(b.path[0]!=="/")n=/^(.*\/)[^\/]*$/.exec(a.path)[1]||"/",b.path=
n+b.path}else b.path=a.path;if(b.scheme)b.scheme=b.scheme.toLowerCase();if(b.port)b.port=e(b.port);if(b.host&&b.path)b.path=i(b.path);return b}function l(n,b){var t;if(b){b=b.href||b;t=c(b);if(!t||!t.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:t})}t=c(n,t);if(!t)throw new SyntaxError;Object.defineProperty(this,"_input",{value:n,writable:!0});Object.defineProperty(this,"_url",{value:t,writable:!0});var g=new a(this);Object.defineProperty(this,"query",{get:function(){return this._url?
g:null},enumerable:!0})}try{var m;if(typeof window.URL==="function"&&window.URL.length!==0&&(m=new window.URL("http://www.w3.org?q")).protocol==="http:"&&m.query)return}catch(p){}var o=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,q=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,v=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,s=/^\d*$/,r=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,u=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,w=/^([^?#\s]*)$/,n=/^([^\s]*)$/,t=/^\S*$/,y=/([^:]*):?(.*)/,z=typeof StopIteration!==
"undefined"?StopIteration:Error("Stop Iteration"),D={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(a.prototype,{get:{value:function(c){j(c);var a;k(this._url.query).some(function(n){n=d(n);if(n[0]===c)return a=n[1],!0});return a},enumerable:!0},set:{value:function(c,a){j(c);j(a);var n=k(this._url.query);n.some(function(t,g){var e=d(t);if(e[0]===c)return e[1]=a,n[g]=b(e),!0})||n.push(b([c,a]));this._url.query=h(n)},enumerable:!0},has:{value:function(c){j(c);
return k(this._url.query).some(function(a){if(d(a)[0]===c)return!0})},enumerable:!0},"delete":{value:function(c){j(c);var a=k(this._url.query),n=a.filter(function(a){return d(a)[0]!==c});return n.length!==a.length?(this._url.query=h(n),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(c,a){if(typeof c!=="function")throw new TypeError;var n=f(this._url,"keys+values");try{for(;;){var b=n.next();c.call(a,b[1],b[0],this)}}catch(t){if(t!==z)throw t;
}},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(c){j(c);var a=[];k(this._url.query).forEach(function(n){n=d(n);n[0]===c&&a.push(n[1])});return a},enumerable:!0},append:{value:function(c,a){j(c);j(a);var n=k(this._url.query);n.push(b([c,a]));this._url.query=
h(n)},enumerable:!0}});Object.defineProperties(l.prototype,{href:{get:function(){var c;if(this._url){c=this._url;var a=c.scheme?c.scheme+":":"";c.host&&(a+="//",c.userinfo&&(a+=c.userinfo+"@"),a+=c.host,c.port&&(a+=":"+c.port));a+=c.path;c.query&&(a+="?"+c.query);c.fragment&&(a+="#"+c.fragment);c=a}else c=this._input;return c},set:function(a){j(a);this._input=a;this._url=c(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(c){j(c);if(this._url&&(c=c.slice(-1)===":"?c.substring(0,c.length-1):c,c===""||v.test(c)))this._url.scheme=c.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(c){j(c);if(this._url)this._url.userinfo=c}},username:{get:function(){if(!this._url)return"";var c=y.exec(this._userinfo);return decodeURIComponent(c[1]||"")},set:function(c){j(c);if(this._url){var a=
y.exec(this._userinfo),c=[encodeURIComponent(c||"")];a[2]&&c.push(a[2]);this._userinfo=c.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var c=y.exec(this._userinfo);return decodeURIComponent(c[2]||"")},set:function(c){j(c);if(this._url){var a=[y.exec(this._userinfo)[1]||""];c&&a.push(encodeURIComponent(c));this._userinfo=a.join(":")}},enumerable:!0},host:{get:function(){var c="";this._url&&this._url.host&&(c+=this._url.host,this._url.port&&(c+=":"+this._url.port));return c},
set:function(c){j(c);if(this._url&&(c=u.exec(c)))this._url.host=c[1],this._url.port=e(c[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(c){j(c);if(this._url&&r.exec(c))this._url.host=c},enumerable:!0},port:{get:function(){var c=this._url?this._url.port||"":"";c&&c===D[this.protocol]&&(c="");return c},set:function(c){j(c);if(this._url&&s.exec(c))this._url.port=e(c)},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(c){j(c);
if(this._url&&w.exec(c))this._url.host&&c&&c[0]!=="/"&&(c="/"+c),this._url.path=c?i(c):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(c){j(c);if(this._url&&(c&&c[0]==="?"&&(c=c.substring(1)),n.exec(c)))this._url.query=c},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(c){j(c);if(this._url&&(c&&c[0]==="#"&&(c=c.substring(1)),t.exec(c)))this._url.fragment=c},enumerable:!0}});
if((m=window.URL||window.webkitURL)&&m.createObjectURL)Object.defineProperty(l,"createObjectURL",{value:m.createObjectURL.bind(m),enumerable:!1}),Object.defineProperty(l,"revokeObjectURL",{value:m.revokeObjectURL.bind(m),enumerable:!1});window.URL=l})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(j,k){function h(c,a){var b=Object.keys(c),g=Object.keys(a);if(b.length!==g.length)return!1;b.sort();g.sort();for(var e=0,i=b.length;e<i;e++){var d=b[e];if(d!==g[e])return!1;var f=c[d],d=a[d];if(f!==d&&JSON.stringify(f)!==JSON.stringify(d))return!1}return!0}function d(c){if(c.indexOf("://")===-1)try{return(new URL(c,location.href)).href}catch(a){}return c}function b(c){var a=null,b={key:function(b){return(a=
a||Object.keys(c))[b]},getItem:function(a){return c[a]},setItem:function(b,g){c[b]=g;a=null},removeItem:function(b){delete c[b];a=null},clear:function(){(a=a||Object.keys(c)).forEach(function(a){delete c[a]}.bind(this));a=null}};Object.defineProperty(b,"length",{get:function(){return(a=a||Object.keys(c)).length}});return b}function f(c,a){if(a&&a instanceof XMLHttpRequest){var b,g;try{b=a.status,g=a.statusText}catch(e){b=0,g=""}return{status:b||0,statusText:g}}return a}function a(c){var a=c?JSON.parse(JSON.stringify(c,
f)):c;if(c instanceof Error)a.__isError=!0,a.message=a.message||c.message,a.name=a.name||c.name;return a}function e(c,a){this.type=c;this.plugin=a}function i(c,a){this.__objectId=c;this.__methods=a}function g(c,b,g){function d(c){A&&g.postMessage(c,A)}function f(c){if(!A)return(new j).reject(Error("plugin not connected"));c.id=String(Y++);var a=new j;R[c.id]=a;a.then(null,function(a){C==="active"&&a instanceof Error&&a.name==="Cancel"&&d({requestId:c.id,method:"cancel",params:a.message?[a.message]:
[]})});var n=Object.prototype.toString;c.params.forEach(function(b,g){if(n.call(b)==="[object Object]"&&!(b instanceof i)){var t,e;for(t in b)n.call(b[t])==="[object Function]"&&(e=e||[],e.push(t));if(e){var l=W++;S[l]=b;t=function(){delete S[l]};a.then(t,t);c.params[g]=new i(l,e)}}});g.postMessage(c,A);return a.promise}function v(c,a){c||c===0?d({id:c,result:null,error:a}):console.log(a)}function s(c,n,b,g){g.forEach(function(c,a){if(c&&typeof c.__objectId!=="undefined"){var n={};c.__methods.forEach(function(a){n[a]=
function(){return f({objectId:c.__objectId,method:a,params:Array.prototype.slice.call(arguments)})}});g[a]=n}});var t=typeof c===void 0?null:{id:c,result:null,error:null};try{var e=b.apply(n,g);if(t)e&&typeof e.then==="function"?(Q[c]=e,e.then(function(a){delete Q[c];t.result=a;d(t)},function(n){if(Q[c])delete Q[c],t.error=a(n),d(t)},function(){d({responseId:c,method:"progress",params:Array.prototype.slice.call(arguments)})})):(t.result=e,d(t))}catch(i){if(t)t.error=a(i),d(t)}}function r(c){try{if(c.method){var a=
c.method,n=c.params||[];if("serviceId"in c){var b=O[c.serviceId];b||v(c.id,"service not found");a in b?s(c.id,b,b[a],n):v(c.id,"method not found")}else if("objectId"in c){var t=S[c.objectId];t||v(c.id,"object not found");a in t?s(c.id,t,t[a],n):v(c.id,"method not found")}else if("requestId"in c){var e=Q[c.requestId];e&&a==="cancel"&&e.cancel&&e.cancel.apply(e,n)}else if("responseId"in c){var i=R[c.responseId];i&&a==="progress"&&i.progress&&i.progress.apply(i,n)}else if("plugin"===c.method){var l=
c.params[0];J({headers:l.headers,services:l.services}).then(function(){x&&x.resolve(y)})}else if("timeout"===c.method)x&&x.reject(c.error);else throw Error("Bad method: "+c.method);}else{var d=R[String(c.id)];delete R[String(c.id)];if(c.error){var m=g.handleServiceError(y,c.error);d.reject(m)}else d.resolve(c.result)}}catch(f){console.log("Plugin._messageHandler "+f)}}function u(c){var a={};if(c.methods&&(c.methods.forEach(function(n){a[n]=function(){var a={serviceId:c.serviceId,method:n,params:Array.prototype.slice.call(arguments)};
return C==="active"?f(a):y.start({"transient":!0}).then(function(){return f(a)})}}),a.addEventListener&&a.removeEventListener)){var n=new k,b=W++;S[b]={handleEvent:n.dispatchEvent.bind(n)};var g=new i(b,["handleEvent"]),t=a.addEventListener;a.addEventListener=function(c,a){n._namedListeners[c]||t(c,g);n.addEventListener(c,a)};var e=a.removeEventListener;a.removeEventListener=function(c,a){n.removeEventListener(c,a);n._namedListeners[c]||e(c,g)}}return a}function w(a){var n=JSON.parse(JSON.stringify(a.properties));
n.__plugin__=c;a=a.names||a.type||[];Array.isArray(a)||(a=[a]);n.objectClass=a;return n}function n(c){var a=u(c),n=w(c),n=g.registerService(c.names||c.type,a,n);K[c.serviceId]={registration:n,proxy:a}}function t(){g.persist(c,{created:z,headers:D,services:E,autostart:B,lastModified:F})}var y=this,b=b||{},z=b.created||(new Date).getTime(),D=b.headers||{},E=b.services||[],B=b.autostart,F=b.lastModified||0,C="installed",G,x,A,L,K={},Y=0,W=0,Q={},R={},S={},O={},J;this._persist=t;this._resolve=function(){C=
"resolved";g.dispatchEvent(new e("resolved",y))};this._getAutostart=function(){return B};this._getCreated=function(){return z};this.getLocation=function(){return c};this.getHeaders=function(){return JSON.parse(JSON.stringify(D))};this.getName=function(){var c=this.getHeaders();return c?c.name||"":null};this.getVersion=function(){var c=this.getHeaders();return c?c.version||"0.0.0":null};this.getLastModified=function(){return F};this.getServiceReferences=function(){var c=[];Object.keys(K).forEach(function(a){c.push(K[a].registration.getReference())});
return c};this.setParent=function(c){return L!==c?(L=c,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 j).resolve()};this.getState=function(){return C};this.start=function(a){if(C==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(G)return G.promise.then(this.start.bind(this,a));if(C==="active")return(new j).resolve();if(!a||!a.transient){var b=a&&a.lazy?"lazy":"started";
b!==B&&(B=b,t())}b=g.getState();if(b!=="starting"&&b!=="active")return a.transient?(new j).reject(Error("start transient error")):(new j).resolve();if(C==="installed")try{this._resolve()}catch(i){return(new j).reject(i)}C==="resolved"&&E.forEach(function(c){n(c)});if(a&&a.lazy)return C!=="starting"&&(C="starting",g.dispatchEvent(new e("lazy activation",y))),(new j).resolve();var d=new j;G=d;C="starting";g.dispatchEvent(new e("starting",y));x=new j;A=g.connect(c,r,L);x.then(function(){x=null;C="active";
g.dispatchEvent(new e("started",y));G=null;d.resolve()},function(){x=null;C="stopping";g.dispatchEvent(new e("stopping",y));Object.keys(K).forEach(function(c){K[c].registration.unregister();delete K[c]});g.disconnect(A);A=null;C="resolved";G=null;g.dispatchEvent(new e("stopped",y));d.reject(Error("plugin activation error"))});return d.promise};this.stop=function(c){if(C==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(G)return G.promise.then(this.stop.bind(this,c));if((!c||
!c.transient)&&"stopped"!==B)B="stopped",t();if(C!=="active"&&C!=="starting")return(new j).resolve();G=c=new j;C="stopping";g.dispatchEvent(new e("stopping",y));Object.keys(K).forEach(function(c){K[c].registration.unregister();delete K[c]});A&&(g.disconnect(A),A=null);C="resolved";G=null;g.dispatchEvent(new e("stopped",y));c.resolve();return c.promise};J=function(a){if(C==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(!a)return F===0&&(F=(new Date).getTime(),t()),g.loadManifest(c).then(J);
var b=D,i=E,d=B;D=a.headers||{};E=a.services||{};B=a.autostart||B;a.lastModified?F=a.lastModified:(F=(new Date).getTime(),t());if(h(D,b)&&h(E,i)&&B===d)return(new j).resolve();if(C==="active"||C==="starting"){var m=[];Object.keys(E).forEach(function(c){var a=E[c];m.push(c);var b=K[c];if(b){if(h(a.methods,Object.keys(b.proxy))){var c=w(a),g=b.registration.getReference(),t={};g.getPropertyKeys().forEach(function(c){t[c]=g.getProperty(c)});h(c,t)||b.registration.setProperties(c);return}b.registration.unregister();
delete K[c]}n(a)});Object.keys(K).forEach(function(c){m.indexOf(c)===-1&&(K[c].registration.unregister(),delete K[c])})}C==="active"&&(g.disconnect(A),x=new j,A=g.connect(c,r,L),x.then(function(){x=null},function(){x=null;C="stopping";g.dispatchEvent(new e("stopping"),y);Object.keys(K).forEach(function(c){K[c].registration.unregister();delete K[c]});g.disconnect(A);A=null;C="resolved";g.dispatchEvent(new e("stopped",y))}));return(new j).resolve()};this.update=function(c){return J(c).then(function(){g.dispatchEvent(new e("updated",
y))})};this.uninstall=function(){if(C==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(C==="active"||C==="starting"||C==="stopping")return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));g.removePlugin(this);C="uninstalled";g.dispatchEvent(new e("uninstalled",y));return(new j).resolve()}}var c=/^http[s]?/i;return{Plugin:g,PluginRegistry:function(a,i){function f(c){var a=c.source;r.some(function(n){if(a===n.target){try{var b;if(typeof n.useStructuredClone===
"undefined"){var g=typeof c.data!=="string";b=g?c.data:JSON.parse(c.data);n.useStructuredClone=g}else b=n.useStructuredClone?c.data:JSON.parse(c.data);n.handler(b)}catch(e){}return!0}})}var i=i||{},o=i.storage||localStorage;o.getItem||(o=b(o));var q="installed",h,s=[],r=[],u=new k,w={},n={registerService:a.registerService.bind(a),connect:function(c,a,n,b){function g(c){c=Error(c);c.name="timeout";a({method:"timeout",error:c})}var e={handler:a,url:c},i=setTimeout(g.bind(null,"Load timeout for: "+c),
b||15E3),l=document.createElement("iframe");l.name=c+"_"+(new Date).getTime();l.src=c;l.onload=function(){clearTimeout(i);i=setTimeout(g.bind(null,"Plugin handshake timeout for: "+c),5E3)};l.sandbox="allow-scripts allow-same-origin";l.style.width=l.style.height="100%";l.frameBorder=0;(n||h).appendChild(l);e.target=l.contentWindow;e.close=function(){clearTimeout(i);if(l){var c=l.parentNode;c&&c.removeChild(l);l=null}};r.push(e);return e},disconnect:function(c){for(var a=0;a<r.length;a++)if(c===r[a]){r.splice(a,
1);try{c.close()}catch(n){}break}},removePlugin:function(c){for(var a=0;a<s.length;a++)if(c===s[a]){s.splice(a,1);break}o.removeItem("plugin."+c.getLocation())},persist:function(c,a){o.setItem("plugin."+c,JSON.stringify(a))},postMessage:function(c,a){a.target.postMessage(a.useStructuredClone?c:JSON.stringify(c),a.url)},dispatchEvent:function(c){try{u.dispatchEvent(c)}catch(a){console&&console.log("PluginRegistry.dispatchEvent "+a)}},loadManifest:function(c){var a=new j,b=n.connect(c,function(c){b&&
c.method&&("manifest"===c.method||"plugin"===c.method?(c=c.params[0],n.disconnect(b),b=null,a.resolve(c)):"timeout"===c.method&&(n.disconnect(b),b=null,a.reject(c.error)))});return a.promise},getState:function(){return q},handleServiceError:function(a,n){if(n&&n.status===401){var b=a.getHeaders(),g=a.getName()||a.getLocation(),e=document.createElement("span");e.appendChild(document.createTextNode("Authentication required for: "+g+"."));if(b.login)e.appendChild(document.createTextNode(" ")),g=document.createElement("a"),
g.target="_blank",g.textContent="Login",g.href=b.login,c.test(g.href)?(e.appendChild(g),e.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+b.login);return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(e)}}if(n.__isError){var i=n,n=Error(i.message);Object.keys(i).forEach(function(c){n[c]=i[c]});delete n.__isError}return n}};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=n.getState;this.init=function(){if(!(q==="starting"||q==="active"||q==="stopping")){addEventListener("message",f,!1);for(var c=[],a=0,b=o.length;a<b;a++)c.push(o.key(a));c.forEach(function(c){if(c.indexOf("plugin.")===0){var a=c.substring(7),c=JSON.parse(o.getItem(c));c.created&&s.push(new g(a,c,n))}});s.sort(function(c,a){return c._getCreated()<a._getCreated()?-1:1});if(i.parent)h=i.parent;else{h=document.createElement("div");
if(!i.visible)h.style.display="none",h.style.visibility="hidden";document.body.appendChild(h)}i.plugins&&Object.keys(i.plugins).forEach(function(c){c=d(c);if(!this.getPlugin(c)){var a=i.plugins[c];typeof a!=="object"&&(a={});a.autostart=a.autostart||i.defaultAutostart||"lazy";s.push(new g(c,a,n))}}.bind(this));q="starting"}};this.start=function(){q!=="starting"&&this.init();if(q!=="starting")return(new j).reject("Cannot start framework. Framework is already "+q+".");var c=[],a=(new Date).getTime();
s.forEach(function(n){var b=n._getAutostart();n.getLastModified()===0?c.push(n.update().then(function(){if("started"===b)return n.start({"transient":!0});if("lazy"===b)return n.start({lazy:!0,"transient":!0});n._resolve()})):"started"===b?c.push(n.start({"transient":!0})):"lazy"===b?(c.push(n.start({lazy:!0,"transient":!0})),a>n.getLastModified()+864E5&&n.update()):n._resolve()});return j.all(c,function(c){console.log("PluginRegistry.stop "+c)}).then(function(){q="active"})};this.stop=function(){if(q!==
"starting"&&q!=="active")return(new j).reject("Cannot stop registry. Registry is already "+q+".");q="stopping";var c=[];s.forEach(function(a){c.push(a.stop({"transient":!0}))});return j.all(c,function(c){console.log("PluginRegistry.stop "+c)}).then(function(){if(!i.parent){var c=h.parentNode;c&&c.removeChild(h)}h=null;removeEventListener("message",f);q="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new j).reject("Cannot uninstall registry")};
this.installPlugin=function(c,a){var c=d(c),b=this.getPlugin(c);if(b)return(new j).resolve(b);if(w[c])return w[c];if(a)return b=new g(c,a,n),s.push(b),b._persist(),n.dispatchEvent(new e("installed",b)),(new j).resolve(b);var i=n.loadManifest(c).then(function(a){b=new g(c,a,n);s.push(b);b._persist();delete w[c];n.dispatchEvent(new e("installed",b));return b},function(a){delete w[c];throw a;});return w[c]=i};this.getPlugins=function(){return s.slice()};this.getPlugin=function(c){var a=null,c=d(c);s.some(function(n){if(c===
n.getLocation())return a=n,!0});return a};this.addEventListener=u.addEventListener.bind(u);this.removeEventListener=u.removeEventListener.bind(u);this.resolvePlugins=function(){var c=!0;s.forEach(function(a){c=c&&a._resolve()});return c}}}});
define("orion/serviceTracker",[],function(){function j(d,b){function f(c){var a=c.getProperty("service.id"),b=this.addingService(c);b&&(e[a]=c,i[a]=b)}function a(c){var a=c.getProperty("service.id"),b=i[a];delete e[a];delete i[a];this.removedService(c,b)}this.serviceRegistry=d;var e={},i={},g=k,c,l;this.close=function(){if(g!==h)throw"Already closed";g=k;d.removeEventListener("registered",c);d.removeEventListener("unregistering",l);l=c=null;var b=this;this.getServiceReferences().forEach(function(c){a.call(b,
c)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){var c=Object.keys(e);return!c.length?null:c.map(function(c){return e[c]})};this.open=function(){if(g!==k)throw"Already open";g=h;var e=this;c=function(c){if(c.serviceReference.getProperty("objectClass").indexOf(b)!==-1&&(f.call(e,c.serviceReference),typeof e.onServiceAdded==="function"))return e.onServiceAdded(c.serviceReference,e.serviceRegistry.getService(c.serviceReference))};l=function(c){c.serviceReference.getProperty("objectClass").indexOf(b)!==
-1&&a.call(e,c.serviceReference)};d.addEventListener("registered",c);d.addEventListener("unregistering",l);d.getServiceReferences(b).forEach(function(c){f.call(e,c);if(typeof e.onServiceAdded==="function")return e.onServiceAdded(c,d.getService(c))});if(typeof this.onOpen==="function")this.onOpen()}}var k=0,h=1;j.prototype={addingService:function(d){return this.serviceRegistry.getService(d)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return j});
define("orion/objects",[],function(){function j(j){for(var h=1;h<arguments.length;h++){var d=arguments[h],b;for(b in d)Object.prototype.hasOwnProperty.call(d,b)&&(j[b]=d[b])}return j}return{clone:function(k){if(Array.isArray(k))return Array.prototype.slice.call(k);var h=Object.create(Object.getPrototypeOf(k));j(h,k);return h},mixin:j,toArray:function(j){return Array.isArray(j)?j:[j]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(j,k,h){var d,b,f,a,e,i="pid";d=function(c,a,b){function g(c,b,e){b.forEach(function(g,n){try{var i=c[n].getProperty("__plugin__"),d=i&&a.getPlugin(i);(!i||d&&d.getState()==="active")&&b[n].updated(e)}catch(f){typeof console!=="undefined"&&console.log(f)}})}k.call(this,c,"orion.cm.managedservice");var e={},d={},f=function(a){var g=[];a.plugin.getServiceReferences().forEach(function(a){if(a.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var e=a.getProperty(i),a=c.getService(a);e&&a&&(e=(e=b._find(e))&&e.getProperties(),g.push(a.updated(e)))}});return j.all(g)};this.addingService=function(a){var b=a.getProperty(i),g=c.getService(a);if(!b||!g)return null;e[b]||(e[b]=[]);d[b]||(d[b]=[]);e[b].push(a);d[b].push(g);return g};this.onServiceAdded=function(c,a){var e=c.getProperty(i),e=b._find(e);g([c],[a],e&&e.getProperties())};this.onOpen=function(){a.addEventListener("started",f)};this.onClose=function(){a.removeEventListener("started",
f)};this.notifyUpdated=function(c){var a=c.getPid();g(e[a]||[],d[a]||[],c.getProperties())};this.notifyDeleted=function(c){c=c.getPid();g(e[c]||[],d[c]||[],null)};this.removedService=function(c,a){var b=c.getProperty(i),g=e[b],n=d[b];g.length>1?g.splice(g.indexOf(c),1):delete e[b];n.length>1?n.splice(n.indexOf(a),1):delete d[b]}};b=function(){function c(c,b,g){this.store=new f(this,g);this.configAdmin=new a(this,this.store);this.tracker=new d(c,b,this.store)}c.prototype={getConfigurationAdmin:function(){var c=
this;return this.configAdmin._init().then(function(a){c.tracker.open();return a})},notifyDeleted:function(c){this.tracker.notifyDeleted(c)},notifyUpdated:function(c){this.tracker.notifyUpdated(c)}};return c}();a=function(){function c(c,a){this.factory=c;this.store=a}c.prototype={_init:function(){var c=this;return this.store._init().then(function(){return c})},getConfiguration:function(c){return this.store.get(c)},listConfigurations:function(){return this.store.list()}};return c}();var g="/cm/configurations";
f=function(){function c(c,a){this.factory=c;this.prefsService=a;this.configs=Object.create(null);this.pref=null;var b=this;this.initPromise=this.prefsService.getPreferences(g).then(function(c){b.pref=c;c.keys().forEach(function(a){if(!b.configs[a]){var g=c.get(a);typeof g==="object"&&g!==null&&Object.keys(g).length>0&&(g[i]=a,b.configs[a]=new e(b.factory,b,g))}})})}c.prototype={_init:function(){return this.initPromise},_find:function(c){return this.configs[c]||null},get:function(c){var a=this._find(c);
a||(a=new e(this.factory,this,c),this.configs[c]=a);return a},list:function(){var c=this,a=[];this.pref.keys().forEach(function(b){(b=c._find(b))&&b.getProperties()!==null&&a.push(b)});return a},remove:function(c){this.pref.remove(c);delete this.configs[c]},save:function(c,a){this.pref.put(c,a.getProperties(!0)||{})}};return c}();e=function(){function c(c,a){a=h.clone(a);delete a[i];c.properties=a}function a(b,g,e){this.factory=b;this.store=g;if(e!==null&&typeof e==="object")this.pid=e[i],c(this,
e);else if(typeof e==="string")this.pid=e,this.properties=null;else throw Error("Invalid pid/properties "+e);}a.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(c){this._checkRemoved();var a=null;if(this.properties&&(a=h.clone(this.properties),!c))a[i]=this.pid;return a},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(a){this._checkRemoved();c(this,a);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return a}();return{ConfigurationAdminFactory:b}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(j,k,h,d,b,f){var a;return{startup:function(){if(a)return a;a=new k;var e=new h.ServiceRegistry,i=new d.PreferencesService(e);return i.getPreferences("/plugins").then(function(g){var c={plugins:{}};g.keys().forEach(function(a){var b=j.toUrl(a);c.plugins[b]=g[a]});var l=new b.PluginRegistry(e,c);return l.start().then(function(){if(e.getServiceReferences("orion.core.preference.provider").length>
0)return i.getPreferences("/plugins",i.USER_SCOPE).then(function(c){var a=[];c.keys().forEach(function(c){c=j.toUrl(c);l.getPlugin(c)||a.push(l.installPlugin(c,{autostart:"lazy"}).then(function(c){return c.update().then(function(){return c.start({lazy:!0})})}))});return k.all(a,function(c){console.log(c)})})}).then(function(){return(new f.ConfigurationAdminFactory(e,l,i)).getConfigurationAdmin().then(e.registerService.bind(e,"orion.cm.configadmin"))}).then(function(){var c=e.getService("orion.core.auth");
if(c){var a=c.getUser().then(function(a){if(a)localStorage.setItem("lastLogin",(new Date).getTime());else return c.getAuthForm(window.location.href).then(function(c){setTimeout(function(){window.location=c},0)})}),b=localStorage.getItem("lastLogin");if(!b||b<(new Date).getTime()-9E5)return a}}).then(function(){var c={serviceRegistry:e,preferences:i,pluginRegistry:l};a.resolve(c);return c})})}}});
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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
define("orion/util",[],function(){var j=navigator.userAgent,k=j.indexOf("MSIE")!==-1||j.indexOf("Trident")!==-1?document.documentMode:void 0,h=parseFloat(j.split("Firefox/")[1]||j.split("Minefield/")[1])||void 0,d=j.indexOf("Opera")!==-1?parseFloat(j.split("Version/")[1]):void 0,b=parseFloat(j.split("Chrome/")[1])||void 0,f=j.indexOf("Safari")!==-1&&!b,a=parseFloat(j.split("WebKit/")[1])||void 0,e=j.indexOf("Android")!==-1,i=j.indexOf("iPad")!==-1,j=j.indexOf("iPhone")!==-1,g=i||j,c=navigator.platform.indexOf("Mac")!==
-1,l=navigator.platform.indexOf("Win")!==-1,m=navigator.platform.indexOf("Linux")!==-1,p="ontouchstart"in document.createElement("input");return{formatMessage:function(c){var a=arguments;return c.replace(/\$\{([^\}]+)\}/g,function(c,b){return a[(b<<0)+1]})},createElement:function(c,a){return c.createElementNS?c.createElementNS("http://www.w3.org/1999/xhtml",a):c.createElement(a)},isIE:k,isFirefox:h,isOpera:d,isChrome:b,isSafari:f,isWebkit:a,isAndroid:e,isIPad:i,isIPhone:j,isIOS:g,isMac:c,isWindows:l,
isLinux:m,isTouch:p,platformDelimiter:l?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(j){function k(a,b){b||(b=document);return b.querySelectorAll(a)}function h(a){var b=a.tabIndex;b===0&&j.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[a.nodeName.toLowerCase()]&&!a.attributes.tabIndex&&(b=-1);return b}function d(a){if(h(a)>=0)return a;if(a.hasChildNodes())for(var b=0;b<a.childNodes.length;b++){var c=d(a.childNodes[b]);if(c)return c}return null}function b(a){if(h(a)>=
0)return a;if(a.hasChildNodes())for(var g=a.childNodes.length-1;g>=0;g--){var c=b(a.childNodes[g]);if(c)return c}return null}function f(b,g){if(b.nodeType===3){var c=a.exec(b.nodeValue);c&&c.length>1&&g(b,c)}if(b.hasChildNodes())for(c=0;c<b.childNodes.length;c++)f(b.childNodes[c],g)}var a=/\$\{([^\}]+)\}/,e=null;return{$:function(a,b){b||(b=document);return b.querySelector(a)},$$:k,$$array:function(a,b){return Array.prototype.slice.call(k(a,b))},node:function(a){var b=a;typeof a==="string"&&(b=document.getElementById(a));
return b},contains:function(a,b){if(!a||!b)return!1;if(a===b)return!0;var c=a.compareDocumentPosition(b);return Boolean(c&16)},bounds:function(a){a=a.getBoundingClientRect();return{left:a.left+document.documentElement.scrollLeft,top:a.top+document.documentElement.scrollTop,width:a.width,height:a.height}},empty:function(a){for(;a.hasChildNodes();)a.removeChild(a.firstChild)},firstTabbable:d,lastTabbable:b,stop:function(a){if(window.document.all)a.keyCode=0;a.preventDefault&&(a.preventDefault(),a.stopPropagation())},
processTextNodes:function(a,b){f(a,function(c,a){c.parentNode.replaceChild(document.createTextNode(b[a[1]]||a[1]),c)})},processDOMNodes:function(a,b){f(a,function(c,a){var e=b[a[1]];if(e){var i=document.createRange(),d=a.index;i.setStart(c,d);i.setEnd(c,d+a[0].length);i.deleteContents();i.insertNode(e)}})},addAutoDismiss:function(a,b){function c(c){e.forEach(function(a){var b=!1,g=a.excludeNodes.some(function(a){return document.body.contains(a)?(b=!0,a.contains(c.target)):!1});if(b&&!g)try{a.dismiss(c)}catch(e){typeof console!==
"undefined"&&console&&console.error(e&&e.message)}});e=e.filter(function(c){return c.excludeNodes.some(function(c){return document.body.contains(c)})})}e===null&&(e=[],document.addEventListener("click",c,!0),j.isIOS&&document.addEventListener("touchend",function(c){function a(){c.target.removeEventListener("click",a)}c.touches.length===0&&c.target.addEventListener("click",a)},!1));e.push({excludeNodes:a,dismiss:b})},setFramesEnabled:function(a){for(var b=document.getElementsByTagName("iframe"),c=
0;c<b.length;c++)b[c].parentNode.style.pointerEvents=a?"":"none"},removeAutoDismiss:function(a){e=e.filter(function(b){return a!==b.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("text",["module"],function(j){var k,h,d=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],b=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,f=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,a=typeof location!=="undefined"&&location.href,e=a&&location.protocol&&location.protocol.replace(/\:/,""),i=a&&location.hostname,g=a&&(location.port||void 0),c=[],l=j.config&&j.config()||{};k={version:"2.0.5",strip:function(c){if(c){var c=c.replace(b,""),a=c.match(f);a&&(c=a[1])}else c="";return c},
jsEscape:function(c){return c.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:l.createXhr||function(){var c,a,b;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else if(typeof ActiveXObject!=="undefined")for(a=0;a<3;a+=1){b=d[a];try{c=new ActiveXObject(b)}catch(e){}if(c){d=[b];break}}return c},parseName:function(c){var a,
b,e=!1,g=c.indexOf(".");a=c.indexOf("./")===0||c.indexOf("../")===0;g!==-1&&(!a||g>1)?(a=c.substring(0,g),b=c.substring(g+1,c.length)):a=c;c=b||a;g=c.indexOf("!");g!==-1&&(e=c.substring(g+1)==="strip",c=c.substring(0,g),b?b=c:a=c);return{moduleName:a,ext:b,strip:e}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(c,a,b,e){var g,i;g=k.xdRegExp.exec(c);if(!g)return!0;c=g[2];g=g[3];g=g.split(":");i=g[1];g=g[0];return(!c||c===a)&&(!g||g.toLowerCase()===b.toLowerCase())&&(!i&&!g||i===e)},finishLoad:function(a,
b,g,e){g=b?k.strip(g):g;l.isBuild&&(c[a]=g);e(g)},load:function(c,b,d,f){if(f.isBuild&&!f.inlineText)d();else{l.isBuild=f.isBuild;var h=k.parseName(c),f=h.moduleName+(h.ext?"."+h.ext:""),j=b.toUrl(f),r=l.useXhr||k.useXhr;!a||r(j,e,i,g)?k.get(j,function(a){k.finishLoad(c,h.strip,a,d)},function(c){d.error&&d.error(c)}):b([f],function(c){k.finishLoad(h.moduleName+"."+h.ext,h.strip,c,d)})}},write:function(a,b,g){if(c.hasOwnProperty(b)){var e=k.jsEscape(c[b]);g.asModule(a+"!"+b,"define(function () { return '"+
e+"';});\n")}},writeFile:function(c,a,b,g,e){var a=k.parseName(a),i=a.ext?"."+a.ext:"",d=a.moduleName+i,l=b.toUrl(a.moduleName+i)+".js";k.load(d,b,function(){var a=function(c){return g(l,c)};a.asModule=function(c,a){return g.asModule(c,l,a)};k.write(c,d,a,e)},e)}};if(l.env==="node"||!l.env&&typeof process!=="undefined"&&process.versions&&process.versions.node)h=require.nodeRequire("fs"),k.get=function(c,a){var b=h.readFileSync(c,"utf8");b.indexOf("\ufeff")===0&&(b=b.substring(1));a(b)};else if(l.env===
"xhr"||!l.env&&k.createXhr())k.get=function(c,a,b,g){var e=k.createXhr(),i;e.open("GET",c,!0);if(g)for(i in g)g.hasOwnProperty(i)&&e.setRequestHeader(i.toLowerCase(),g[i]);if(l.onXhr)l.onXhr(e,c);e.onreadystatechange=function(){var g;if(e.readyState===4)g=e.status,g>399&&g<600?(g=Error(c+" HTTP status: "+g),g.xhr=e,b(g)):a(e.responseText)};e.send(null)};else if(l.env==="rhino"||!l.env&&typeof Packages!=="undefined"&&typeof java!=="undefined")k.get=function(c,a){var b,g,e=new java.io.File(c),i=java.lang.System.getProperty("line.separator"),
e=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(e),"utf-8")),d="";try{b=new java.lang.StringBuffer;(g=e.readLine())&&g.length()&&g.charAt(0)===65279&&(g=g.substring(1));for(g!==null&&b.append(g);(g=e.readLine())!==null;)b.append(i),b.append(g);d=String(b.toString())}finally{e.close()}a(d)};return k});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(j,k,h){return{slideoutHTMLFragment:function(d){var b=document.createElement("div");b.innerHTML=h;var f=k.$("#slideContainer",b);f.id=d+f.id;f=k.$("#pageCommandParameters",b);f.id=d+f.id;f=k.$("#pageCommandDismiss",b);f.id=d+f.id;return b.innerHTML}}});
define("orion/keyBinding",["orion/util"],function(j){function k(d,b,f,a,e,i){this.type=i||"keydown";this.keyCode=typeof d==="string"&&this.type==="keydown"?d.toUpperCase().charCodeAt(0):d;this.mod1=b!==void 0&&b!==null?b:!1;this.mod2=f!==void 0&&f!==null?f:!1;this.mod3=a!==void 0&&a!==null?a:!1;this.mod4=e!==void 0&&e!==null?e:!1}function h(d){this.keys=d}k.prototype={getKeys:function(){return[this]},match:function(d,b){if(b!==void 0){if(b!==0)return!1}else if(d instanceof Array){if(d.length>1)return!1;
d=d[0]}return d.type!==this.type?!1:this.keyCode===d.keyCode||this.keyCode===String.fromCharCode(j.isOpera?d.which:d.charCode!==void 0?d.charCode:d.keyCode)?this.mod1!==(j.isMac?d.metaKey:d.ctrlKey)?!1:this.type==="keydown"&&this.mod2!==d.shiftKey?!1:this.mod3!==d.altKey?!1:j.isMac&&this.mod4!==d.ctrlKey?!1:!0:!1},equals:function(d){return!d?!1:this.keyCode!==d.keyCode?!1:this.mod1!==d.mod1?!1:this.mod2!==d.mod2?!1:this.mod3!==d.mod3?!1:this.mod4!==d.mod4?!1:this.type!==d.type?!1:!0}};h.prototype=
{getKeys:function(){return this.keys.slice(0)},match:function(d,b){var f=this.keys;if(b!==void 0)return b>f.length?!1:f[b].match(d)?b===f.length-1?!0:b+1:!1;else{d instanceof Array||(d=[d]);if(d.length>f.length)return!1;var a;for(a=0;a<d.length;a++)if(!f[a].match(d[a]))return!1;return a===f.length?!0:a}},equals:function(d){if(!d.keys)return!1;if(d.keys.length!==this.keys.length)return!1;for(var b=0;b<d.keys.length;b++)if(!d.keys[b].equals(this.keys[b]))return!1;return!0}};return{KeyBinding:k,KeyStroke:k,
KeySequence:h}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(j,k,h){function d(b){h.attach(this);this._init(b)}d.prototype={_init:function(b){this._dropdownNode=k.node(b.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=b.populate;this._selectionClass=b.selectionClass;this._parentDropdown=b.parentDropdown;this._positioningNode=b.positioningNode;if(!this._parentDropdown)for(var d=this._dropdownNode.parentNode;d&&document!==d;){if(d.classList&&
d.classList.contains("dropdownMenu")){this._parentDropdown=d.dropdown;break}d=d.parentNode}this._triggerNode=b.triggerNode?b.triggerNode:k.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!b.skipTriggerEventListeners){var a=this;this._triggerNode.addEventListener("click",function(b){a.toggle(b)&&k.stop(b)},!1);this._triggerNode.tagName.toLowerCase()==="span"&&this._triggerNode.addEventListener("keydown",function(b){if(b.keyCode===
k.KEY.ENTER||b.keyCode===k.KEY.SPACE)a.toggle(),k.stop(b)},!1)}this._dropdownNode.addEventListener("keydown",this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(b){var d=this;b.addEventListener("click",function(a){d.toggle(a)&&k.stop(a)},!1)},toggle:function(b){return this.isVisible()?this.close():this.open(b)},isVisible:function(){return this._isVisible},open:function(b){var d=!1;if(!this.isVisible()){this.dispatchEvent({type:"triggered",dropdown:this,event:b});k.setFramesEnabled(!1);this._populate&&
(this.empty(),this._populate(this._dropdownNode));var a=this.getItems();if(a.length>0){if(!this._hookedAutoDismiss)this._boundAutoDismiss?k.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),d=k.$$array(".dropdownSubMenu",this._dropdownNode),k.addAutoDismiss([this._triggerNode].concat(d),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(b);a[0].focus();d=!0;this._parentDropdown&&this._parentDropdown.submenuOpen(this)}}return d},_autoDismiss:function(b){if(this.close(!1)&&this._dropdownNode.contains(b.target))for(b=this._parentDropdown;b;)b.close(!1),b=b._parentDropdown},_positionDropdown:function(){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+
"px";else{var b=k.bounds(this._dropdownNode),d=k.bounds(document.body);if(b.left+b.width>d.left+d.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-b.width+"px";else{var a=k.bounds(this._boundingNode(this._triggerNode)),e=k.bounds(this._triggerNode);this._dropdownNode.style.left=e.left-a.left-b.width+e.width+"px"}b=b.top+b.height-(d.top+d.height);if(0<b)this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-b)+"px"}},_boundingNode:function(b){var d=
window.getComputedStyle(b,null);return d===null?b:d.getPropertyValue("position")==="absolute"||!b.parentNode||b===document.body?b:this._boundingNode(b.parentNode)},close:function(b){var d=!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),b&&this._triggerNode.focus(),this._isVisible=!1,d=!0;return d},getItems:function(){var b=
[],d=this;k.$$array("li:not(.dropdownSeparator) > .dropdownMenuItem",this._dropdownNode,!0).forEach(function(a){a.parentNode.parentNode===d._dropdownNode&&b.push(a)});b.forEach(function(a){if(!a._hasDropdownMouseover)a.addEventListener("mouseover",function(b){a.dropdown?a.dropdown.open(b):(d._closeSelectedSubmenu(),k.stop(b))}),a._hasDropdownMouseover=!0});return b},empty:function(){var b=this;k.$$array("li",this._dropdownNode).forEach(function(d){d.parentNode===b._dropdownNode&&d.parentNode.removeChild(d)});
this._hookedAutoDismiss=!1},_dropdownKeyDown:function(b){if(b.keyCode===k.KEY.UP||b.keyCode===k.KEY.DOWN||b.keyCode===k.KEY.RIGHT||b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.LEFT){var d=this.getItems(),a=document.activeElement;if(d.length&&d.length>0&&a){var e=d.indexOf(a);e<0&&(e=d.indexOf(a.parentNode));e>=0&&(b.keyCode===k.KEY.UP&&e>0?(e--,d[e].focus()):b.keyCode===k.KEY.DOWN&&e<d.length-1?(e++,d[e].focus()):b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.RIGHT?a.classList.contains("dropdownTrigger")&&
a.dropdown&&a.dropdown.open():b.keyCode===k.KEY.LEFT&&a.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&this.close(!0),k.stop(b))}}else b.keyCode===k.KEY.ESCAPE&&(this.close(!0),k.stop(b))},submenuOpen:function(b){if(b!==this._selectedSubmenu)this._closeSelectedSubmenu(),this._selectedSubmenu=b},_closeSelectedSubmenu:function(){for(var b=this._selectedSubmenu;b;)b.close(),b=b._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&k.removeAutoDismiss(this._boundAutoDismiss)}};
d.prototype.constructor=d;return{Dropdown:d}});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(j,k){function h(d){this._init(d)}h.prototype={_init:function(d){this._node=k.node(d.node);if(!this._node)throw"no dom node for tooltip found";this._position=d.position||["right","above","below","left"];this._text=d.text;this._hideDelay=d.hideDelay===void 0?200:d.hideDelay;this._tailSize=d.tailSize||10;this._trigger=d.trigger||"mouseover";this._afterShowing=d.afterShowing;this._afterHiding=d.afterHiding;var b=this;if(this._trigger===
"click")this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(a){a.target===b._node&&(b.show(),k.stop(a))},!1);else if(this._trigger==="mouseover"){this._showDelay=d.showDelay===void 0?500:d.showDelay;d=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(a){k.contains(b._node,a.target)&&(b.show(),k.stop(a))},!1);this._leaveHandler=function(a){k.contains(b._node,a.target)&&b.hide()};for(var f=0;f<d.length;f++)this._node.addEventListener(d[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 d=this;k.addAutoDismiss([this._tip,this._node],function(){d.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(d._timeout)window.clearTimeout(d._timeout),d._timeout=null;d._tip.addEventListener("mouseout",function(b){k.contains(d._tip,b.target)&&(d.hide(),k.stop(b))},
!1)},!1)}return this._tip},_positionTip:function(d,b){this._makeTipNode();d==="left"?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var f=this._node,a;for(a=k.bounds(f);f&&!a.width&&!a.height;f=f.parentNode)a=k.bounds(f);var f=k.bounds(this._tipInner),e;switch(d){case "above":e=a.top-f.height-this._tailSize-1;a=a.left-this._tailSize;break;case "below":e=a.top+a.height+this._tailSize+1;a=a.left-this._tailSize;break;case "left":e=a.top-this._tailSize/2;a=a.left-f.width-
this._tailSize-1;break;default:e=a.top-this._tailSize/2,a=a.left+a.width+this._tailSize+1}var i=k.bounds(document.documentElement);if(e+f.height>i.height)if(b)e=i.height-f.height-1;else return!1;if(a+f.width>i.width)if(b)a=i.width-f.width-1;else return!1;if(a<0)if(b)a=4;else return!1;if(e<0)if(b)e=4;else return!1;if(this._tail&&this._tail.previousPosition!==d)this._tip.removeChild(this._tail),this._tail=null;if(!this._tail){this._tail=document.createElement("span");this._tail.classList.add("tooltipTailFrom"+
d);d==="above"||d==="left"?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner);if(d==="left")this._tail.style.left=f.width+"px";this._tail.previousPosition=d}this._tip.style.top=e+"px";this._tip.style.left=a+"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 d=!1,b=0;!d&&b<this._position.length;)d=this._positionTip(this._position[b]),b++;d||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(d){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;if(this._tip&&this._tip.classList.contains("tooltipShowing")){if(d===void 0)d=
this._hideDelay;var b=this;this._timeout=window.setTimeout(function(){b._tip.classList.remove("tooltipShowing");b._tip.removeAttribute("style");b._afterHiding&&b._afterHiding()},d)}},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 d=["mouseout","click"],b=0;b<d.length;b++)this._node.removeEventListener(d[b],this._leaveHandler,!1)}}};h.prototype.constructor=h;return{Tooltip:h}});
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(j,k,h,d,b,f,a,e){function i(c){var a=c.invocation;if(a){var b=c.command;if(b.hrefCallback)return c=b.hrefCallback.call(a.handler||window,a),c.then?c.then(function(c){window.open(c)}):window.open(c),!0;else if(a.commandRegistry)return a.commandRegistry._invoke(a),
!0;else if(b.onClick||b.callback)return window.setTimeout(function(){(b.onClick||b.callback).call(a.handler||window,a)},0),!0}return!1}function g(c,a){for(var b in a)if(a[b]&&a[b].keyBinding&&a[b].command&&a[b].keyBinding.match(c)){var g=a[b],e=g.keyBinding;if((!e.domScope||k.contains(k.node(e.domScope),c.target))&&i(g)){k.stop(c);break}}}function c(){var c={};if(r){var a,b,g;b=Object.keys(u);for(a=0;a<b.length;a++)g=b[a],c[g]=u[g];var e=r();b=Object.keys(e);for(a=0;a<b.length;a++)g=b[a],c[g]=e[g]}else c=
u;return c}function l(a){g(a,c())}function m(c,a){c=c||window.event;if(function(c){if(j.isMac){if(c.metaKey&&!c.altKey)return!c.shiftKey&&!c.ctrlKey&&(c.keyCode===65||c.keyCode===67||c.keyCode===86||c.keyCode===88||c.keyCode===90)?!0:!1;if(c.ctrlKey)return!1}else{if(c.ctrlKey&&!c.altKey)return!c.shiftKey&&(c.keyCode===65||c.keyCode===67||c.keyCode===86||c.keyCode===88||c.keyCode===90)?!0:!1;if(c.altKey&&!c.ctrlKey)return!1}if(c["char"])return c["char"].length>0;else if(c.charCode||c.keyCode)switch(c=
c.charCode||c.keyCode,c){case 8:case 9:case 13:case 46:return!0;default:return c>=32&&c<112||c>123}return!1}(c)){if(c.target.contentEditable==="true")return;var b=c.target.nodeName.toLowerCase();if(b==="input")switch(c.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(b==="textarea")return}a?a(c):l(c)}function p(){this._init()}
function o(c,a,b){a.classList.add("commandImage");var g;c.imageClass?c.addImageClassToElement?a.classList.add(c.imageClass):(g=document.createElement("span"),a.appendChild(g),g.classList.add(c.spriteClass),g.classList.add(c.imageClass)):(g=new Image,g.alt=c.name,g.name=b,g.id=b,g.src=c.image,a.appendChild(g));return g}function q(c,a){var b=document.createElement("span");b.classList.add("dropdownKeyBinding");b.appendChild(document.createTextNode(a));c.appendChild(b)}function v(c,a,b,g,e){this.commandRegistry=
e;this.handler=c;this.items=a;this.userData=b;this.command=g;if(g.parameters)this.parameters=g.parameters.makeCopy();this.id=g.id}function s(c){this._init(c)}var r=null,u={};p.prototype={setProxy:function(c){this.proxy=c},setKeyBindings:function(c){this.bindings=c},_init:function(){var c=this;document.addEventListener("keydown",function(a){return m(a,function(a){var b=c.proxy,n=c.bindings;if(n&&b)for(var g=0;g<n.length;g++)n[g].match(a)&&(b.processKey({type:a.type,keyCode:a.keyCode,altKey:a.altKey,
ctrlKey:a.ctrlKey,metaKey:a.metaKey,shiftKey:a.shiftKey}),k.stop(a))})})}};window.document.addEventListener("keydown",m,!1);v.prototype={collectsParameters:function(){return this.commandRegistry&&this.commandRegistry.collectsParameters()},makeCopy:function(c){var a=new v(this.handler,this.items,this.userData,this.command,this.commandRegistry);a.domNode=this.domNode;a.domParent=this.domParent;if(c)a.parameters=c.makeCopy();else if(this.parameters)a.parameters=this.parameters.makeCopy();return a}};
v.prototype.constructor=v;s.prototype={_init:function(c){this.id=c.id;this.name=c.name;this.tooltip=c.tooltip;this.callback=c.callback;this.hrefCallback=c.hrefCallback;this.choiceCallback=c.choiceCallback;this.positioningNode=c.positioningNode;this.image=c.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=c.imageClass;this.addImageClassToElement=c.addImageClassToElement;this.selectionClass=
c.selectionClass;this.spriteClass=c.spriteClass||"commandSprite";this.visibleWhen=c.visibleWhen;this.parameters=c.parameters;this.isEditor=c.isEditor},populateChoicesMenu:function(c,a,b,g,e){var b=this.getChoices(a,b,g),i=b.some(function(c){return c.checked});b.forEach(function(b){if(b.name){var g=document.createElement("li");c.appendChild(g);var t=document.createElement("span");t.tabIndex=0;t.role="menuitem";t.classList.add("dropdownMenuItem");if(i){var d=document.createElement("span");d.classList.add("check");
d.appendChild(document.createTextNode(b.checked?"\u25cf":""));t.appendChild(d)}d=document.createTextNode(b.name);t.appendChild(d);g.appendChild(t);t.choice=b;t.addEventListener("click",function(c){c.target.choice&&c.target.choice.callback.call(c.target.choice,a)},!1);t.addEventListener("keydown",function(c){(c.keyCode===k.KEY.ENTER||c.keyCode===k.KEY.SPACE)&&c.target.choice&&c.target.choice.callback.call(c.target.choice,a)},!1)}else e._generateMenuSeparator(c)})},getChoices:function(c,a,b){return this.choiceCallback?
this.choiceCallback.call(a,c,b):null},makeChoiceCallback:function(c,a){return function(b){c.callback&&c.callback.call(c,a,b)}},hasImage:function(){return this.imageClass||this.image!=="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"}};s.prototype.constructor=s;return{Command:s,CommandInvocation:v,createDropdownMenu:function(c,a,g,e,i,l,f,m,p){c=k.node(c);if(!c)throw"no parent node was specified";
var q=document.createRange();q.selectNode(c);q=p?q.createContextualFragment(b):q.createContextualFragment(d);k.processTextNodes(q,{ButtonText:a});c.appendChild(q);var c=c.lastChild,v;p?(p=c.previousSibling,v=p.lastChild):p=c.previousSibling;e?p.classList.add(e):(p.classList.add("orionButton"),p.classList.add("commandButton"));if(i){if(!l)p.textContent="",p.setAttribute("aria-label",a);o({spriteClass:"commandSprite",imageClass:i},p,a);p.classList.add("orionButton")}p.dropdown=new h.Dropdown({dropdown:c,
populate:g,selectionClass:f,skipTriggerEventListeners:!!v,positioningNode:m});c.dropdown=p.dropdown;return{menuButton:p,menu:c,dropdown:p.dropdown,dropdownArrow:v}},createCheckedMenuItem:function(c,b,g,e){c=k.node(c);if(!c)throw"no parent node was specified";var i=document.createRange();i.selectNode(c);i=i.createContextualFragment(a);k.processTextNodes(i,{ItemText:b});c.appendChild(i);c=k.$(".checkedMenuItem",c.lastChild);c.checked=g;c.addEventListener("change",e,!1);return c},createCommandItem:function(c,
a,b,g,i,d,l){var f,d=d||!a.name&&a.hasImage();if(a.hrefCallback)f=document.createElement("a"),f.id=g,d&&a.hasImage()?o(a,f,g):(f.className="commandLink",f.appendChild(document.createTextNode(a.name))),l=a.hrefCallback.call(b.handler,b),l.then?l.then(function(c){f.href=c}):f.href=l?l:"#";else{f=document.createElement("button");f.className="orionButton";d?a.hasImage()?(o(a,f,g),a.name&&f.setAttribute("aria-label",a.name)):(f.classList.add("commandButton"),f.classList.add("commandMissingImageButton"),
f.appendChild(document.createTextNode(a.name))):(f.classList.add("commandButton"),g=document.createTextNode(a.name),f.appendChild(g));var m=l||a.callback;if(m)a.onClick=m,f.addEventListener("click",function(){m.call(b.handler,b)},!1)}c.nodeName.toLowerCase()==="ul"?(l=document.createElement("li"),c.appendChild(l),c=l):f.classList.add("commandMargins");c.appendChild(f);if(a.tooltip)f.commandTooltip=new e.Tooltip({node:f,text:a.tooltip,position:["above","below","right","left"]});i&&(u[a.id]={keyBinding:i,
command:a,invocation:b});return f},createCommandMenuItem:function(c,a,b,g,i,d){var l,f=c.dropdown;if(a.hrefCallback){l=document.createElement("a");var m=document.createElement("span");m.appendChild(document.createTextNode(a.name));m.classList.add("dropdownCommandName");l.appendChild(m);i=a.hrefCallback.call(b.handler,b);i.then?i.then(function(c){l.href=c}):l.href=i?i:"#";l.addEventListener("keydown",function(c){(c.keyCode===k.KEY.ENTER||c.keyCode===k.KEY.SPACE)&&l.click()},!1)}else{l=document.createElement("span");
l.tabIndex=0;m=document.createElement("span");m.appendChild(document.createTextNode(a.name));m.classList.add("dropdownCommandName");l.appendChild(m);var p=i||a.callback;if(p)a.onClick=p,l.addEventListener("click",function(){f.close(!0);p.call(b.handler,b)},!1),l.addEventListener("keydown",function(c){if(c.keyCode===k.KEY.ENTER||c.keyCode===k.KEY.SPACE)c.preventDefault(),l.click()},!1)}l.className="dropdownMenuItem";l.role="menuitem";if(a.tooltip)l.commandTooltip=new e.Tooltip({node:l,text:a.tooltip,
position:["above","below","right","left"]});d&&q(l,d);d=document.createElement("li");c.appendChild(d);d.appendChild(l);g&&(u[a.id]={keyBinding:g,command:a,invocation:b});return l},executeBinding:i,setKeyBindingProvider:function(c){r=c},localKeyBindings:u,CommandsProxy:p,getKeyBindings:c,processKey:l,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:g}});
define("orion/explorers/navigationUtils",[],function(){function j(h,d){if(!k&&h)h.push({domNode:d}),d.tabIndex=-1,d.style.outline="none"}var k=navigator.userAgent.indexOf("iPad")!==-1;return{addNavGrid:function(h,d,b){h&&(h=h.getGridNavHolder(d,!0))&&j(h,b)},generateNavGrid:j,removeNavGrid:function(h,d){if(h)for(var b=0;b<h.length;b++)if(h[b].domNode===d){h.splice(b,1);break}}}});
define("orion/PageUtil",[],function(){var j=/^http[s]?/i;return{hash:function(){var j=window.location.href.split("#")[1];return j?"#"+j:""},matchResourceParameters:function(j){var j=j||window.location.toString(),h={resource:""},d=j.indexOf("#");if(d!==-1&&(j=j.substring(d+1),j.length!==0)){j=j.split(",");h.resource=decodeURIComponent(j[0]);for(d=1;d<j.length;d++){var b=/([^=]*)(=?)(.*)/.exec(j[d]),f=decodeURIComponent(b[1]||""),b=decodeURIComponent(b[3]||"");f!==""&&f!=="resource"&&(h[f]=b)}}return h},
validateURLScheme:function(k,h){var d=k;if(k.indexOf("://")===-1){var b=document.createElement("a");b.href=k;d=b.href}b=!1;return(b=h?h.some(function(b){return RegExp("^"+b+":","i").test(d)}):j.test(d))?k:(console.log("Illegal URL Scheme: '"+k+"'"),"")}}});
define("orion/uiUtils",["orion/webui/littlelib"],function(j){function k(d){var b="",f=navigator.platform.indexOf("Mac")!==-1;f?(d.mod4&&(b+="\u2303"),d.mod3&&(b+="\u2325"),d.mod2&&(b+="\u21e7"),d.mod1&&(b+="\u2318")):(d.mod1&&(b+="Ctrl+"),d.mod2&&(b+="Shift+"),d.mod3&&(b+="Alt+"));if(d.alphaKey)return b+d.alphaKey;if(d.type==="keypress")return b+d.keyCode;for(var a in j.KEY)if(typeof(j.KEY[a]==="number")&&j.KEY[a]===d.keyCode){if(f)switch(j.KEY[a]){case j.KEY.BKSPC:a="\u232b";break;case j.KEY.TAB:a=
"\u21e5";break;case j.KEY.ENTER:a="\u23ce";break;case j.KEY.ESCAPE:a="\u238b";break;case j.KEY.SPACE:a="\u2423";break;case j.KEY.PAGEUP:a="\u21de";break;case j.KEY.PAGEDOWN:a="\u21df";break;case j.KEY.END:a="\u21f2";break;case j.KEY.HOME:a="\u21f1";break;case j.KEY.DEL:a="\u2326"}switch(j.KEY[a]){case j.KEY.DOWN:a="\u2193";break;case j.KEY.UP:a="\u2191";break;case j.KEY.RIGHT:a="\u2192";break;case j.KEY.LEFT:a="\u2190"}return b+a}var e;switch(d.keyCode){case 59:e=d.mod2?":":";";break;case 61:e=d.mod2?
"+":"=";break;case 188:e=d.mod2?"<":",";break;case 190:e=d.mod2?">":".";break;case 191:e=d.mod2?"?":"/";break;case 192:e=d.mod2?"~":"`";break;case 219:e=d.mod2?"{":"[";break;case 220:e=d.mod2?"|":"\\";break;case 221:e=d.mod2?"}":"]";break;case 222:e=d.mod2?'"':"'"}return e?b+e:d.keyCode>=112&&d.keyCode<=123?b+"F"+(d.keyCode-111):b+String.fromCharCode(d.keyCode)}function h(d){var b=window.navigator.platform.indexOf("Mac")!==-1;return b&&d.metaKey||!b&&d.ctrlKey}return{getUserKeyString:function(d){for(var b=
"",d=d.getKeys(),f=0;f<d.length;f++)f!==0&&(b+=" "),b+=k(d[f]);return b},getUserText:function(d){var b=d.id,f=d.refNode,a=d.hideRefNode,e=d.initialText,i=d.onComplete,g=d.onEditDestroy,c=d.selectTo,l=d.isInitialValid,d=d.insertAsChild,m=!1,p=function(c){return function(d){if(!m){var p=j.node(b),h=p.value;if(p)if(c&&d.keyCode===j.KEY.ESCAPE){if(a)f.style.display="inline";m=!0;p.parentNode.removeChild(p);g&&g()}else if(!(c&&d.keyCode!==j.KEY.ENTER)){if(h.length===0||!l&&h===e){if(a)f.style.display=
"inline"}else if(i(h),a&&f.parentNode)f.style.display="inline";m=!0;p.parentNode&&p.parentNode.removeChild(p);g&&g()}}}},h=document.createElement("input");h.id=b;h.value=e||"";d?f.appendChild(h):f.parentNode.insertBefore(h,f.nextSibling);h.classList.add("userEditBoxPrompt");if(a)f.style.display="none";h.addEventListener("keydown",p(!0),!1);h.addEventListener("blur",p(!1),!1);window.setTimeout(function(){h.focus();if(e){var a=j.node(b),g=c?e.indexOf(c):-1;if(g>0)if(a.createTextRange)a=a.createTextRange(),
a.collapse(!0),a.moveStart("character",0),a.moveEnd("character",g),a.select();else if(a.setSelectionRange)a.setSelectionRange(0,g);else{if(a.selectionStart!==void 0)a.selectionStart=0,a.selectionEnd=g}else a.select()}},0)},openInNewWindow:h,followLink:function(d,b){b&&h(b)?window.open(d):window.location=d},createButton:function(d,b){var f=document.createElement("button");f.className="orionButton commandButton commandMargins";f.addEventListener("click",function(a){b();j.stop(a)},!1);d&&f.appendChild(document.createTextNode(d));
return f},createDropdownButton:function(){},isFormElement:function(d){switch(d.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/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(j,k,h,d,b,f,a,e,i,g){function c(c){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(c);this._parameterCollector=
null}function l(c,a){this.token=c;this.parameterName=a}function m(c,a,b){this.event=c;this.handler=a;this.capture=b||!1}function p(c,a,b,g,e,i){this.name=c;this.type=a;this.label=b;this.value=g;this.lines=e||1;this.eventListeners=Array.isArray(i)?i:i?[i]:[]}function o(c,a,b){this._storeParameters(c);this._hasOptionalParameters=a&&a.hasOptionalParameters;this._options=a;this.optionsRequested=!1;this.getParameters=b;this.clientCollect=a&&a.clientCollect}c.prototype={_init:function(c){this._selectionService=
c.selection;var a=this;j.setKeyBindingProvider(function(){return a._activeBindings})},processURL:function(c){for(var a in this._urlBindings)if(this._urlBindings[a]&&this._urlBindings[a].urlBinding&&this._urlBindings[a].command){var b=this._urlBindings[a].urlBinding.match(c);if(b){var g=this._urlBindings[a],e=g.command,i=g.invocation;if(i&&i.parameters&&e.callback){i.parameters.setValue(b.parameterName,b.parameterValue);var n=this;window.setTimeout(function(){n._invoke(i)},0);break}}}},findCommand:function(c){return this._commandList[c]},
runCommand:function(c,a,b,g){a?(c=this._commandList[c])&&(c.visibleWhen?c.visibleWhen(a):1)&&c.callback&&this._invoke(new j.CommandInvocation(b,a,null,c,this),g):(a=this._urlBindings[c])&&a.command&&a.command.callback&&this._invoke(a.invocation,g)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(c){this._parameterCollector=c},openParameterCollector:function(c,a,b){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(c,
a,b))},confirm:function(c,a,b,g,e,i){var n=!1;if(this._parameterCollector&&!e){var t=this;this._parameterCollector.close();if(this._parameterCollector.open(c,function(c,e){var i=document.createElement("span");i.classList.add("parameterPrompt");i.textContent=a;c.appendChild(i);i=document.createElement("button");i.addEventListener("click",function(){n=!0;t._parameterCollector.close()},!1);e.appendChild(i);i.appendChild(document.createTextNode(b));i.className="dismissButton";var d=document.createElement("button");
d.addEventListener("click",function(){n=!1;t._parameterCollector.close()},!1);e.appendChild(d);d.appendChild(document.createTextNode(g));d.className="dismissButton";return i},function(){i(n)}))return}n=window.confirm(a);i(n)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(c,a){return this._collectAndInvoke(c.makeCopy(a),!1)},_collectAndInvoke:function(c,b){if(c)if(this._parameterCollector&&
c.parameters&&c.parameters.hasParameters()&&(b||c.parameters.shouldCollectParameters())){var g=!1;c.parameters.updateParameters(c);if(c.parameters.shouldCollectParameters()&&(g=this._parameterCollector.collectParameters(c),!g)){var e=new a.Tooltip({node:c.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),g=e.contentContainer();g.classList.add("parameterPopup");var i=window.document.activeElement,d=this._parameterCollector.getFillFunction(c,
function(){i&&i.focus();e.destroy()})(g);e.show();window.setTimeout(function(){d.focus();d.select()},0);g=!0}g||c.command.callback.call(c.handler||window,c)}else c.command.callback.call(c.handler||window,c);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(c){this._collectAndInvoke(c,!0)},showKeyBindings:function(c){function a(c){return function(){j.executeBinding(c)}}var b={},g,e,i=[],n;for(n in this._activeBindings)(e=
this._activeBindings[n])&&e.keyBinding&&e.command&&(e.command.name||e.command.tooltip)&&i.push(e);i.sort(function(c,a){return(c.command.name||c.command.tooltip).localeCompare(a.command.name||a.command.tooltip)});for(n=0;n<i.length;n++)e=i[n],e.keyBinding.scopeName?(b[e.keyBinding.scopeName]||(b[e.keyBinding.scopeName]=[]),b[e.keyBinding.scopeName].push(e)):(g=d.getUserKeyString(e.keyBinding),c.createItem(g,e.command.name||e.command.tooltip,a(e)));for(var t in b)b[t].length&&b[t].length>0&&(c.createHeader(t),
b[t].forEach(function(b){g=d.getUserKeyString(b.keyBinding);c.createItem(g,b.command.name||b.command.tooltip,a(b))}))},addCommand:function(c){this._commandList[c.id]=c;var a=this._pendingBindings[c.id];if(a){var b=this;a.forEach(function(a){b._addBinding(c,a.type,a.binding,a.bindingOnly)});delete this._pendingBindings[c.id]}},addCommandGroup:function(c,a,b,g,e,i,n,t,d,l){this._contributionsByScopeId[c]||(this._contributionsByScopeId[c]={});c=this._contributionsByScopeId[c];e&&(c=this._createEntryForPath(c,
e));if(c[a]){if(g)c[a].title=g;if(b)c[a].position=b;if(n)c[a].imageClass=n;if(t)c[a].tooltip=t;if(d)c[a].selectionClass=d;l===!0?c[a].pretendDefaultActionId=!0:c[a].defaultActionId=l;c[a].emptyGroupMessage=i}else c[a]={title:g,position:b,emptyGroupMessage:i,imageClass:n,tooltip:t,selectionClass:d,defaultActionId:l===!0?null:l,pretendDefaultActionId:l===!0,children:{}},c.sortedContributions=null},_createEntryForPath:function(c,a){a&&a.split("/").forEach(function(a){if(a.length>1){if(!c[a])c[a]={position:0,
children:{}},c.sortedContributions=null;c=c[a].children}});return c},registerSelectionService:function(c,a){this._contributionsByScopeId[c]||(this._contributionsByScopeId[c]={});this._contributionsByScopeId[c].localSelectionService=a},registerCommandContribution:function(c,a,b,g,e,i,n){this._contributionsByScopeId[c]||(this._contributionsByScopeId[c]={});c=this._contributionsByScopeId[c];g&&(c=this._createEntryForPath(c,g));c[a]={position:b};i&&((b=this._commandList[a])?this._addBinding(b,"key",i,
e):this._addPendingBinding(a,"key",i,e));n&&((b=this._commandList[a])?this._addBinding(b,"url",n,e):this._addPendingBinding(a,"url",n,e));c.sortedContributions=null},unregisterCommandContribution:function(c,a,b){if(this._contributionsByScopeId[c]){delete this._commandList[a];delete this._activeBindings[a];delete this._urlBindings[a];delete this._pendingBindings[a];var g=this._contributionsByScopeId[c];b&&b.split("/").forEach(function(c){if(c.length>1&&g[c])g=g[c].children});delete g[a];g.sortedContributions=
null}},_addBinding:function(c,a,b,g){if(!c.id)throw Error("No command id: "+c);a==="key"?this._activeBindings[c.id]={command:c,keyBinding:b,bindingOnly:g}:a==="url"&&(this._urlBindings[c.id]={command:c,urlBinding:b,bindingOnly:g})},_addPendingBinding:function(c,a,b,g){this._pendingBindings[c]=this._pendingBindings[c]||[];this._pendingBindings[c].push({type:a,binding:b,bindingOnly:g})},_checkForTrailingSeparator:function(c,a,g){var e;if(a==="tool"||a==="button")if((e=c.childNodes.length>0?c.childNodes[c.childNodes.length-
1]:null)&&e.classList.contains("commandSeparator"))return g?(c.removeChild(e),!1):!0;if(a==="menu"&&(c=b.$$array("li > *",c),c.length>0&&c[c.length-1].classList.contains("dropdownSeparator")))if(e=c[c.length-1],g)e.parentNode.parentNode.removeChild(e.parentNode);else return!0;return!1},renderCommands:function(c,a,g,e,i,d,n){if(typeof c!=="string")throw"a scope id for rendering must be specified";a=b.node(a);if(!a)throw"no parent";var t=this._contributionsByScopeId[c];if(!g&&t){var g=t.localSelectionService||
this._selectionService,l=this;g&&g.getSelections(function(b){l.renderCommands(c,a,b,e,i,d)})}else t&&(this._render(t,a,g,e,i||"button",d,n),this._checkForTrailingSeparator(a,i,!0))},destroy:function(c){c=b.node(c);if(!c)throw"no parent";for(;c.hasChildNodes();){var a=c.firstChild;a.commandTooltip&&a.commandTooltip.destroy();a.emptyGroupTooltip&&a.emptyGroupTooltip.destroy();this.destroy(a);c.removeChild(a)}},_render:function(c,b,g,e,i,l,n){var t=c.sortedContributions;if(!t){var t=[],f=!1,m;for(m in c)if(Object.prototype.hasOwnProperty.call(c,
m)){var p=c[m];if(p&&typeof p.position==="number")p.id=m,t.push(p),f=!0}if(f)t.sort(function(c,a){return c.position-a.position}),c.sortedContributions=t}var h=0,o=this;t.forEach(function(c){var t;if(!c.imageClass)c.imageClass=null;if(c.children&&Object.getOwnPropertyNames(c.children).length>0){var f=c.children;if(i==="tool"||i==="button")if(c.title){var y;if(c.defaultActionId)(f=o._commandList[c.defaultActionId])&&(f.visibleWhen?f.visibleWhen(g):1)?(y=new j.CommandInvocation(e,g,l,f,o),y.domParent=
b):c.pretendDefaultActionId=!0;f=o._createDropdownMenu(b,c.title,null,null,c.imageClass,c.tooltip,c.selectionClass,null,y,c.pretendDefaultActionId);n&&k.generateNavGrid(n,f.menuButton);if(f)if(o._render(c.children,f.menu,g,e,"menu",l,n),o._checkForTrailingSeparator(f.menu,"menu",!0),f.menu.childNodes.length===0)if(c.emptyGroupMessage){if(!f.menuButton.emptyGroupTooltip)f.menuButton.emptyGroupTooltip=new a.Tooltip({node:f.menuButton,text:c.emptyGroupMessage,trigger:"click",position:["below","right",
"above","left"]})}else n&&k.removeNavGrid(n,f.menuButton),c=function(c){c&&c.parentNode&&c.parentNode.removeChild(c)},c(f.menu),c(f.menuButton),c(f.destroyButton);else f.menuButton.style.visibility="visible"}else{var m;b.childNodes.length>0&&!o._checkForTrailingSeparator(b,i)&&(m=o.generateSeparatorImage(b));o._render(f,b,g,e,i,l,n);b.childNodes.length>0&&b.childNodes[b.childNodes.length-1]!==m&&(m=o.generateSeparatorImage(b))}else if(c.title){if(c=o._createDropdownMenu(b,c.title,!0,null,null,c.imageClass))o._render(f,
c.menu,g,e,"menu",l,n),o._checkForTrailingSeparator(c.menu,"menu",!0),c.menu.childNodes.length===0&&c.destroyButton&&b.removeChild(c.destroyButton)}else b.childNodes.length>0&&o._generateMenuSeparator(b),o._render(f,b,g,e,i,l,n),o._generateMenuSeparator(b)}else{var z=o._commandList[c.id],f=z?!0:!1;y=c=null;if(z){t=new j.CommandInvocation(e,g,l,z,o);t.domParent=b;m=f&&(z.visibleWhen?z.visibleWhen(g):!0);if(o._activeBindings[z.id]&&o._activeBindings[z.id].keyBinding)c=o._activeBindings[z.id],c.invocation=
m?t:null,c.bindingOnly&&(f=!1);if(o._urlBindings[z.id]&&o._urlBindings[z.id].urlBinding)y=o._urlBindings[z.id],y.invocation=m?t:null,y.bindingOnly&&(f=!1);f=f&&m}if(f)z.choiceCallback?(i==="tool"||i==="button"?(c=b,f=!1,b.nodeName.toLowerCase()==="ul"&&(c=document.createElement("li"),b.appendChild(c))):(c=b,f=!0),o._createDropdownMenu(c,z.name,f,function(c){z.populateChoicesMenu(c,g,e,l,o)}.bind(z),z.imageClass,z.tooltip||z.title,z.selectionClass,z.positioningNode)):(t.handler=t.handler||this,t.domParent=
b,f=function(){o._invoke(t)},i==="menu"?(y=null,c&&c.keyBinding&&(y=d.getUserKeyString(c.keyBinding)),c=j.createCommandMenuItem(b,z,t,null,f,y)):(c=i+z.id+h,c=j.createCommandItem(b,z,t,c,null,i==="tool",f)),k.generateNavGrid(n,c),t.domNode=c,h++)}})},_createDropdownMenu:function(c,e,i,d,l,m,n,t,y,z){c=b.node(c);if(!c||!b.contains(document.body,c))return null;var p,h,o=c;if(i)m=document.createRange(),m.selectNode(c),m=m.createContextualFragment(g),b.processTextNodes(m,{ButtonText:e}),c.appendChild(m),
h=c.lastChild,l=h.lastChild,e=l.previousSibling,e.dropdown=new f.Dropdown({dropdown:l,populate:d,parentDropdown:c.dropdown}),l.dropdown=e.dropdown;else{c.nodeName.toLowerCase()==="ul"&&(o=document.createElement("li"),c.appendChild(o),h=o);c=null;l&&(c="dropdownButtonWithIcon",m=m||e);var m=l?m||e:m,k=j.createDropdownMenu(o,e,d,c,l,!1,n,t,y||z);p=k.dropdownArrow;e=k.menuButton;if(p){if(y)y.domNode=k.menuButton;var C=this;e.onclick=function(c){var a=b.bounds(p);c.clientX>=a.left&&k.dropdown?k.dropdown.toggle(c):
C._invoke(y)};if(k.dropdown)e.onkeydown=function(c){b.KEY.DOWN===c.keyCode&&(k.dropdown.toggle(c),b.stop(c))}}var l=k.menu,G;(d=y&&y.command&&(y.command.tooltip||y.command.name))?G=y.command.tooltip||y.command.name:d&&(G=m);if(G)e.commandTooltip=new a.Tooltip({node:e,text:G,position:["above","below","right","left"]})}return{menuButton:e,menu:l,dropdown:e.dropdown,destroyButton:h,dropdownArrow:p}},_generateMenuSeparator:function(c){if(!this._checkForTrailingSeparator(c,"menu")){var a=document.createElement("li");
a.classList.add("dropdownSeparator");var b=document.createElement("span");b.classList.add("dropdownSeparator");a.appendChild(b);c.appendChild(a)}},generateSeparatorImage:function(c){var a;a=c.nodeName.toLowerCase()==="ul"?document.createElement("li"):document.createElement("span");c.appendChild(a);a.classList.add("core-sprite-sep");a.classList.add("imageSprite");a.classList.add("commandSeparator");return a}};c.prototype.constructor=c;l.prototype={match:function(c){c=h.matchResourceParameters(c);return typeof c[this.token]!==
"undefined"?(this.parameterValue=c[this.token],this):null}};l.prototype.constructor=l;m.prototype.constructor=m;p.prototype={optionsRequested:function(){return this.optionsRequested}};p.prototype.constructor=p;o.prototype={_storeParameters:function(c){this.parameterTable=null;if(c){var a=this.parameterTable={};c.forEach(function(c){a[c.name]=c})}},updateParameters:function(c){typeof this.getParameters==="function"&&this._storeParameters(this.getParameters(c))},hasParameters:function(){return this.parameterTable!==
null},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(c){return this.parameterTable[c]},valueFor:function(c){return(c=this.parameterTable[c])?c.value:null},setValue:function(c,a){var b=this.parameterTable[c];if(b)b.value=a},forEach:function(c){for(var a in this.parameterTable)this.parameterTable[a].type&&this.parameterTable[a].name&&c(this.parameterTable[a])},makeCopy:function(){var c=[];this.forEach(function(a){a=new p(a.name,a.type,a.label,
a.value,a.lines,a.eventListeners);c.push(a)});var a=new o(c,this._options,this.getParameters);a.clientCollect=this.clientCollect;return a},hasOptionalParameters:function(){return this._hasOptionalParameters}};o.prototype.constructor=o;return{CommandRegistry:c,URLBinding:l,ParametersDescription:o,CommandParameter:p,CommandEventListener:m}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(j,k,h){function d(b,d){this._activeContainer=null;this._getElementsFunction=b;this._toolbarLayoutFunction=d}d.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&h.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&h.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(b,d,a){typeof b==="string"&&(b=h.node(b));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===b)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(b))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=a;var e=d(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!e)return!1;this._activeElements.focusNode=e;b=h.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(b.length===0){d=this._activeElements.dismissArea||
this._activeElements.parameterArea;b=document.createElement("button");b.id="closebox";b.className="imageSprite core-sprite-close dismissButton";b.title=j.Close;d.appendChild(b);var i=this;b.addEventListener("click",function(){i.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);if(e)this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){e.focus();e.select&&e.select()},0);this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(b,d){h.$$array("input",d).forEach(function(a){a.type==="checkbox"?b.parameters.setValue(a.parameterName,a.checked):a.type!=="button"&&b.parameters.setValue(a.parameterName,a.value.trim())});h.$$array("textArea",d).forEach(function(a){b.parameters.setValue(a.parameterName,a.value.trim())});b.command.callback&&b.command.callback.call(b.handler,b)},collectParameters:function(b){return b.parameters?
(b.domNode&&b.domNode.classList.add("commandMarker"),this.open(b.domNode||b.domParent,this.getFillFunction(b))):!1},getFillFunction:function(b,d){var a=this;return function(e,i){var g=null,c=function(){d&&d();a.close()},l=function(g){g.keyCode===h.KEY.ENTER&&a._collectAndCall(b,e);if(g.keyCode===h.KEY.ESCAPE||g.keyCode===h.KEY.ENTER)c(),h.stop(g)};b.parameters.forEach(function(a){var i=null;if(a.label)i=document.createElement("label"),i.classList.add("parameterInput"),i.setAttribute("for",a.name+
"parameterCollector"),i.textContent=a.label,e.appendChild(i);var d=a.name+"parameterCollector",f,i=i||e;if(a.type==="text"&&typeof a.lines==="number"&&a.lines>1)f=document.createElement("textarea"),f.rows=a.lines,f.type="textarea",f.id=d,i.appendChild(f),l=function(a){a.keyCode===h.KEY.ESCAPE&&(c(),h.stop(a))};else if(a.type==="boolean"){if(f=document.createElement("input"),f.type="checkbox",f.id=d,i.appendChild(f),a.value)f.checked=!0}else if(f=document.createElement("input"),f.type=a.type,f.id=
d,i.appendChild(f),a.value)f.value=a.value;f.classList.add("parameterInput");f.setAttribute("speech","speech");f.setAttribute("x-webkit-speech","x-webkit-speech");f.parameterName=a.name;g||(g=f);a.eventListeners.length>0&&a.eventListeners.forEach(function(c){f.addEventListener(c.event,function(a){return c.handler(a,b)},c.capture)});f.addEventListener("keydown",l,!1)});var m=i;m||(m=document.createElement("span"),m.classList.add("layoutRight"),m.classList.add("parametersDismiss"),e.appendChild(m));
var p=function(c,a){var b=document.createElement("button");a.appendChild(b);c&&b.appendChild(document.createTextNode(c));b.classList.add("dismissButton");return b};if(b.parameters.hasOptionalParameters())b.parameters.optionsRequested=!1,p(j.More,m).addEventListener("click",function(){b.parameters.optionsRequested=!0;a._collectAndCall(b,e);c()},!1);p(j.Submit,m).addEventListener("click",function(){a._collectAndCall(b,e);c()},!1);m=p(null,m);m.id="closebox";m.classList.add("imageSprite");m.classList.add("core-sprite-close");
m.title=j.Close;m.addEventListener("click",function(){c()},!1);return g}}};d.prototype.constructor=d;return{CommandParameterCollector:d}});define("orion/regex",[],function(){return{escape:function(j){return j.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")},parse:function(j){return(j=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(j))?{pattern:j[1],flags:j[2]}:null}}});
define("orion/contentTypes",[],function(){function j(a,c){function b(c,a,g,e){var g=a.filename.indexOf(g)>=0,i;i=e.toLowerCase();i=a.extension.indexOf(i)!==-1;if(g||i){if(!(i=!c))g&&(e=e.toLowerCase(),g=c.extension.indexOf(e)!==-1),i=g;if(i)return a}return c}if(typeof a!=="string")return null;for(var e=a&&a.split(".").pop(),i=null,d=0;d<c.length;d++){var f=c[d];b(i,f,a,e)===f&&(i=f)}return i}function k(a){return a===null||typeof a==="undefined"?[]:Array.isArray(a)?a:[a]}function h(a){return k(a).map(function(c){return String.prototype.toLowerCase.call(c)})}
function d(a){return{id:a.id,name:a.name,image:a.image,imageClass:a.imageClass,"extends":a["extends"],extension:h(a.extension),filename:k(a.filename)}}function b(a){var c=Object.create(null);a.map(d).forEach(function(a){Object.prototype.hasOwnProperty.call(c,a.id)||(c[a.id]=a)});return c}function f(g){if(g&&g.registerService){this.serviceRegistry=g;for(var c=g.getServiceReferences(e).concat(g.getServiceReferences(i)),d=[],f=0;f<c.length;f++)for(var p=k(c[f].getProperty("contentTypes")),h=0;h<p.length;h++)d.push(p[h]);
this.map=b(d);g.registerService(a,this)}else if(Array.isArray(g))this.serviceRegistry=null,this.map=b(g);else throw Error("Invalid parameter");}var a="orion.core.contentTypeRegistry",e="orion.core.contenttype",i="orion.file.contenttype";f.prototype={getContentTypes:function(){var a=this.getContentTypesMap(),c=[],b;for(b in a)Object.prototype.hasOwnProperty.call(a,b)&&c.push(a[b]);return c},getContentTypesMap:function(){return this.map},getFileContentType:function(a){return j(a.Name,this.getContentTypes())},
getFilenameContentType:function(a){return j(a,this.getContentTypes())},getContentType:function(a){return this.map[a]||null},isExtensionOf:function(a,c){a=typeof a==="string"?this.getContentType(a):a;c=typeof c==="string"?this.getContentType(c):c;if(!a||!c)return!1;if(a.id===c.id)return!0;else for(var b=a,e={};b&&(b=this.getContentType(b["extends"]));){if(b.id===c.id)return!0;if(e[b.id])throw Error("Cycle: "+b.id);e[b.id]=!0}return!1},isSomeExtensionOf:function(a,c){for(var b=0;b<c.length;b++)if(this.isExtensionOf(a,
c[b]))return!0;return!1}};return{ContentTypeRegistry:f,getFilenameContentType:j}});
define("orion/URITemplate",[],function(){function j(c){this._text=c}function k(c){return c.replace("%25","%")}function h(c,a){if(a==="U")return encodeURIComponent(c).replace(/[!'()*]/g,function(c){return"%"+c.charCodeAt(0).toString(16).toUpperCase()});if(a==="U+R")return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(g,k);if(a==="U+R-,")return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+a);}function d(c,a,b){for(var g=
[],e=0;e<c.length;e++)typeof c[e]!=="undefined"&&g.push(h(c[e],a));return g.join(b)}function b(c,a,b,g){for(var e=Object.keys(c),i=[],d=0;d<e.length;d++)typeof c[e[d]]!=="undefined"&&i.push(h(e[d],a)+b+h(c[e[d]],a));return i.join(g)}function f(c){if(c.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=e[c[0]])?c=c.substring(1):this._operator=e.NUL;for(var a=[],b=c.split(","),g=0;g<b.length;g++){var d=b[g].match(i);if(d===null)throw Error("Bad VarSpec: "+c);a.push({name:d[1],
explode:!!d[2],prefix:d[3]?parseInt(d[3],10):-1})}this._varSpecList=a}function a(c){for(var a=[],b=0,g=c.indexOf("{",b);g!==-1;){a.push(new j(c.substring(b,g)));b=c.indexOf("}",g+1);if(b===-1)throw Error("Invalid template: "+c);a.push(new f(c.substring(g+1,b)));b+=1;g=c.indexOf("{",b)}a.push(new j(c.substring(b)));this._templateComponents=a}var e={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-,"}},i=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,g=/%25[0-9A-F][0-9A-F]/g;j.prototype={expand:function(){return encodeURI(this._text)}};
f.prototype={expand:function(c){for(var a=[],g=0;g<this._varSpecList.length;g++){var e=this._varSpecList[g],i=e.name,f=c[i],j=typeof f;if(j!=="undefined"&&f!==null){var k=a.length===0?this._operator.first:this._operator.sep;if(j==="string")this._operator.named&&(k+=h(i,"U+R"),k+=f.length===0?this._operator.ifemp:"="),e.prefix!==-1&&e.prefix<f.length&&(f=f.substring(0,e.prefix)),k+=h(f,this._operator.allow);else if(Array.isArray(f)){if(f.length===0)continue;e.explode?k+=d(f,this._operator.allow,this._operator.sep):
(e=d(f,this._operator.allow,","),this._operator.named&&(k+=h(i,"U+R"),k+=e.length===0?this._operator.ifemp:"="),k+=e)}else if(j==="object"){if(Object.keys(f).length===0)continue;e.explode?k+=b(f,this._operator.allow,"=",this._operator.sep):(e=b(f,this._operator.allow,",",","),this._operator.named&&(k+=h(i,"U+R"),k+=e.length===0?this._operator.ifemp:"="),k+=e)}else throw Error("bad param type: "+i+" : "+j);a.push(k)}}return a.join("")}};a.prototype={expand:function(c){for(var a=[],b=0;b<this._templateComponents.length;b++)a.push(this._templateComponents[b].expand(c));
return a.join("")}};return a});
define("orion/i18nUtil",["require","orion/Deferred"],function(j,k){function h(b){if(b=localStorage.getItem("orion/messageBundle/"+b))if(b=JSON.parse(b),b._expires&&b._expires>(new Date).getTime())return delete b._expires,b;return null}var d={};return{getMessageBundle:function(b){function f(c){c?j(["i18n!"+b],function(c){if(c){var a=b;c._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+a,JSON.stringify(c));delete c._expires}e.resolve(c)}):a(Error(b))}function a(c){e.reject(c)}
if(d[b])return d[b];var e=new k;d[b]=e;var i=h(b);if(i)return e.resolve(i),e;try{j([b],f,a)}catch(g){j(["orion/i18n!"+b],f,a)}return e},formatMessage:function(b){var d=arguments;return b.replace(/\$\{([^\}]+)\}/g,function(a,b){return d[(b<<0)+1]})}}});
define("orion/PageLinks","require,orion/Deferred,orion/PageUtil,orion/URITemplate,orion/i18nUtil,orion/objects,orion/URL-shim".split(","),function(j,k,h,d,b,f){function a(){return j.toUrl?(new URL(j.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function e(c){var a={};c.getPropertyKeys().forEach(function(b){b!=="objectClass"&&b!=="service.names"&&b!=="service.id"&&b!=="__plugin__"&&(a[b]=c.getProperty(b))});return a}function i(c){return b.getMessageBundle(c.nls).then(function(a){c.textContent=
c.nameKey?a[c.nameKey]:c.name;return c},function(){c.textContent=c.nameKey||c.name;return c})}function g(c,b){var g=c.getServiceReferences(b||"orion.page.link"),l=h.matchResourceParameters(window.location.href),f={OrionHome:a(),Location:l.resource},m=[];g.forEach(function(c){c=e(c);if(c.uriTemplate&&(c.nls||c.name)){var a=(new d(c.uriTemplate)).expand(f),a=h.validateURLScheme(a);c.href=a;c.nls?m.push(i(c)):(c.textContent=c.name,m.push((new k).resolve(c)))}});return k.all(m)}function c(c){var a=this.categories=
Object.create(null);c.forEach(function(c){a[c.id]=c})}function l(c){this.allPageLinks=c;this.allPageLinks.sort(m)}function m(c,a){var b=c.textContent&&c.textContent.toLowerCase(),g=a.textContent&&a.textContent.toLowerCase();return b<g?-1:b>g?1:0}var p;f.mixin(c.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(c){return this.categories[c]||null}});f.mixin(l.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(c){var a=c.href,c=
c.textContent,b=document.createElement("a");b.href=a;b.target="_self";b.classList.add("targetSelector");b.textContent=c;return b})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(a){var b;return!p?(b=[],a.getServiceReferences("orion.page.link.category").forEach(function(c){c=e(c);if(c.id&&(c.name||c.nameKey))c.nls?b.push(i(c)):(c.textContent=c.name,b.push((new k).resolve(c)))}),k.all(b).then(function(a){return p=new c(a)})):(new k).resolve(p)},getPageLinksInfo:function(c,
a){return g(c,a).then(function(c){return new l(c)})},getOrionHome:a}});
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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
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(j,k,h,d,b,f,a,e,i,g){function c(c){var a={};c.getPropertyKeys().forEach(function(b){a[b]=c.getProperty(b)});return a}var l={},m=i.getOrionHome();l._cloneItemWithoutChildren=function v(c){if(c===null||typeof c!=="object")return c;var a=c.constructor(),b;for(b in c)b!=="children"&&b!==
"Children"&&(a[b]=v(c[b]));return a};l._getOpenWithNavCommandExtensions=function(c){function a(c,b){for(var n=c.getServiceReferences("orion.navigate.openWith"),g=[],e=[],i=0;i<n.length;i++){var d=n[i];if(d.getProperty("editor")===b.id){var t=d.getProperty("contentType");t instanceof Array?g=g.concat(t):g.push(t||"*/*");d=d.getProperty("excludedContentTypes");d instanceof Array?e=e.concat(d):d!==null&&typeof d!=="undefined"&&e.push(d)}}0===g.length&&(g=null);0===e.length&&(e=null);return{contentTypes:g,
excludedContentTypes:e}}for(var b=function(){for(var a=c.getServiceReferences("orion.edit.editor"),b=[],n=0;n<a.length;n++){var g=a[n],e=g.getProperty("id");b.push({id:e,"default":g.getProperty("default")||!1,name:g.getProperty("name"),nameKey:g.getProperty("nameKey"),nls:g.getProperty("nls"),uriTemplate:g.getProperty("orionTemplate")||g.getProperty("uriTemplate"),validationProperties:g.getProperty("validationProperties")||[]})}return b}(),g=[],e=0;e<b.length;e++){var n=b[e],i=a(c,n);g.push({properties:{name:n.name||
n.id,nameKey:n.nameKey,id:"eclipse.openWithCommand."+n.id,contentType:i.contentTypes,excludedContentTypes:i.excludedContentTypes,uriTemplate:n.uriTemplate,nls:n.nls,forceSingleItem:!0,isEditor:n["default"]?"default":"editor",validationProperties:n.validationProperties},service:{}})}return g};l._makeValidator=function(c,a,g,e){function i(c,a,b,n){var g=b.match,e,d;if((e=a.indexOf("["))>=0){if((d=a.indexOf("]"))<0)return!1;var l=a.substring(0,e),f;if(!(f=c[l])||!Array.isArray(f))return!1;e=a.substring(e+
1,d);e=parseInt(e,10);if(isNaN(e))return!1;e<0&&(e+=f.length);a=a.substring(d+1);a=l+":"+String(e)+a}if(a.indexOf("|")>=0)return e=a.substring(0,a.indexOf("|")),a=a.substring(a.indexOf("|")+1),i(c,e,b,n)?!0:i(c,a,b,n);else if(a.indexOf(":")>=0)return e=a.substring(0,a.indexOf(":")),a=a.substring(a.indexOf(":")+1),c[e]?i(c[e],a,b,n):!1;else{a:{var l=!1,m;if(a.charAt(0)==="!")b=typeof c[a.substring(1)]==="undefined";else if(typeof c[a]!=="undefined"){if(typeof g==="undefined")m=c[a],l=!0;else if(typeof g===
"string"){if(!typeof(c[a]==="string")){b=!1;break a}if(b.variableName){if(g=RegExp(g).exec(c[a]))m=g[0],m=b.variableMatchPosition==="before"?c[a].substring(0,g.index):b.variableMatchPosition==="after"?c[a].substring(g.index+m.length):b.variableMatchPosition==="only"?m:c[a],l=!0}else{b=RegExp(g).test(c[a]);break a}}else c[a]===g&&(m=c[a],l=!0);if(l&&b.variableName&&(n[b.variableName]=m,n.itemCached=c,b.replacements))for(c=0;c<b.replacements.length;c++)m=!1,b.replacements[c].pattern?n[b.variableName]=
n[b.variableName].replace(RegExp(b.replacements[c].pattern),b.replacements[c].replacement||""):m=!0,m&&window.console.log("Invalid replacements specified in validation property.  "+b.replacements[c]);b=l}else b=!1}return b}}function n(a,n,g){if(g.info.validationProperties)for(var e=0;e<g.info.validationProperties.length;e++){var d=g.info.validationProperties[e];if(typeof d.source!=="undefined"){if(!i(a,d.source,d,g))return!1}else return window.console.log("Invalid validationProperties in "+c.id+".  No source property specified."),
!1}var e=!0,l=n?b.getFilenameContentType(a.Name,n):null,l=l||{id:"application/octet-stream"};g.info.excludedContentTypes&&n&&(e=g.info.excludedContentTypes.every(function(c){c=c.replace(/([*?])/g,".$1");return-1!==l.id.search(c)?!1:!0}));e&&g.info.contentType&&n&&(e=g.info.contentType.some(function(c){c=c.replace(/([*?])/g,".$1");return-1!==l.id.search(c)?!0:!1}));return e}return{info:c,validationFunction:function(c){typeof e==="function"&&(c=e.call(this,c));if(c){if(Array.isArray(c)){if((this.info.forceSingleItem||
this.info.uriTemplate)&&c.length!==1)return!1;if(c.length<1)return!1}else c=[c];for(var a=0;a<c.length;a++)if(!n(c[a],g,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(c){if(this.info.uriTemplate){var a={},b;for(b in c)Object.prototype.hasOwnProperty.call(c,b)&&(a[b]=c[b]);if(this.info.validationProperties)for(b=0;b<this.info.validationProperties.length;b++){var n=this.info.validationProperties[b];n.source&&n.variableName&&(this.itemCached===
c&&this[n.variableName]||i(c,n.source,n,this),c[n.variableName]?window.console.log("Variable name "+n.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):a[n.variableName]=this[n.variableName])}a.OrionHome=m;return(new f(this.info.uriTemplate)).expand(a)}return null}}};var p=g.UnnamedCommand;l._createCommandOptions=function(c,b,g,e,i,n){function d(a,t){var f=l._makeValidator(c,g,e,n);a.visibleWhen=f.validationFunction.bind(f);if(i)if(f.generatesURI.bind(f)())a.hrefCallback=
function(c){c=Array.isArray(c.items)?c.items[0]:c.items;return f.getURI.bind(f)(c)};else{var m=c;a.callback=function(c){var n;if(m.forceSingleItem)c=Array.isArray(c.items)?c.items[0]:c.items,n=l._cloneItemWithoutChildren(c);else if(Array.isArray(c.items)){n=[];for(var e=0;e<c.items.length;e++)n.push(l._cloneItemWithoutChildren(c.items[e]))}else n=l._cloneItemWithoutChildren(c.items);if(g)var i=g.getService("orion.page.progress");b.run?i?i.progress(b.run(n),"Running command: "+a.name):b.run(n):g&&
(i?i.progress(g.getService(b).run(n),"Running command: "+a.name):g.getService(b).run(n))}}t.resolve(a)}var f=new k;if(c.nls){var m=function(a){var b;a?(b=c.tooltipKey&&a[c.tooltipKey],a=c.nameKey&&a[c.nameKey]||c.name||p,b=b||c.tooltip||""):(a=c.name||c.nameKey||p,b=c.tooltip||c.tooltipKey||"");d({name:a,image:c.image,id:c.id||c.name,tooltip:b,isEditor:c.isEditor,showGlobally:c.showGlobally},f)};a.getMessageBundle(c.nls).then(m,m.bind(this,null))}else d({name:c.name,image:c.image,id:c.id||c.name,
tooltip:c.tooltip,isEditor:c.isEditor,showGlobally:c.showGlobally},f);return f};l.getOpenWithCommand=function(c,a,b){for(var g,c=b||l.getOpenWithCommands(c),b=0;b<c.length;b++)if(c[b].visibleWhen(a)){var e=c[b].isEditor==="default";if(!g||e)if(g=c[b],e)break}return g};l.getOpenWithCommands=function(c){var a=[],b;for(b in c._commandList){var g=c._commandList[b];g.isEditor&&a.push(g)}return a};var o;l.createAndPlaceFileCommandsExtension=function(c,a,b,e,i,n){return l.createFileCommands(c,null,n?"all":
void 0,!!n,a).then(function(c){i&&0<c.length&&(a.addCommandGroup(b,"eclipse.openWith",1E3,g.OpenWith,i,null,null,null,"dropdownSelection"),a.addCommandGroup(b,"eclipse.fileCommandExtensions",1E3,g.OpenRelated,i));c.forEach(function(c){var n=null;i&&(n=c.isEditor?i+"/eclipse.openWith":i+"/eclipse.fileCommandExtensions");a.registerCommandContribution(b,c.id,e,n)});return{}})};l.createFileCommands=function(c,a,b,g,e){var b=b===void 0?"global":b,g=g===void 0?!0:g,n=[];l._cachedFileCommands||l._createCachedFileCommands(c);
(b==="all"||b==="global")&&l._cachedFileCommands.forEach(function(c){var a=c.properties;(b==="all"||a.forceSingleItem&&a.showGlobally)&&n.push(c)});return k.when(function(){var b=c.getService("orion.core.contentTypeRegistry")||a;return o||k.when(b.getContentTypes(),function(c){return o=c})}(),function(){if(g){if(!l._cachedOpenWithExtensions)l._cachedOpenWithExtensions=l._getOpenWithNavCommandExtensions(c,o);n=n.concat(l._cachedOpenWithExtensions);e._addedOpenWithCommands=g}var a=n.map(function(a){var b=
a.properties,a=a.service,n=e.findCommand(b.id||b.name);return n?(new k).resolve(n):l._createCommandOptions(b,a,c,o,!0).then(function(c){c=new h.Command(c);e.addCommand(c);return c})});return k.all(a,function(c){return{_error:c}}).then(function(c){return c})})};l._createCachedFileCommands=function(a){var b=a.getServiceReferences("orion.navigate.command");l._cachedFileCommands=[];for(var g=0;g<b.length;g++)if(b[g].getProperty("id")!=="orion.navigateFromMetadata"){var e=a.getService(b[g]),i=c(b[g]);
l._cachedFileCommands.push({properties:i,service:e})}};l.getFileCommandIds=function(){var c=[];if(l._cachedFileCommands)l._cachedFileCommands.length&&(c=l._cachedFileCommands.map(function(c){return c.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return c};l.createOpenWithCommands=function(c,a,b){return b&&b._addedOpenWithCommands?(new k).resolve(l.getOpenWithCommands(b)):l.createFileCommands(c,a,"none",!0,b)};return l});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(j,k){function h(d){this._init(d)}h.prototype={_init:function(d){var b=k.node(d.container);if(!b)throw"no parent container";this._container=b;b.classList.remove("currentLocation");this._id=d.id||"eclipse.breadcrumbs";this._resource=d.resource||null;this._rootSegmentName=d.rootSegmentName;this._workspaceRootSegmentName=d.workspaceRootSegmentName;this._workspaceRootURL=d.workspaceRootURL;this._makeHref=d.makeHref;this._makeFinalHref=
d.makeFinalHref;this._maxLength=d.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var d;if(this._resource&&this._resource.Parents&&!this._resource.skip){d=document.createElement("a");var b=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(d,b):d.href=j.toUrl("edit/edit.html")+"#"+b}else d=document.createElement("span");k.empty(d);d.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return d}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(d){var b=document.createElement("a");b.classList.add("breadcrumb");b.appendChild(document.createTextNode(d));return b},addSegmentHref:function(d,b){this._makeHref?this._makeHref(d,b.Location,b):d.href=j.toUrl("edit/edit.html")+"#"+b.ChildrenLocation},buildSegments:function(d,b){if(this._resource.Parents){var f=this._resource.Parents.slice(0),a,e;f&&(f=f.slice(0),b==="reverse"&&(f=f.reverse().slice(0)),
f.forEach(function(b){if(!b.skip)d?(e=d,d=null):e=b.Name,a=this.buildSegment(e),this.path+=b.Name,this.addSegmentHref(a,b),a.include=!1,this.segments.push(a)}.bind(this)))}},addDivider:function(){var d=document.createElement("span");d.appendChild(document.createTextNode(" / "));this.path+="/";d.classList.add("breadcrumbSeparator");this.append(d)},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(d){this.crumbs.appendChild(d)},addTitle:function(d,b){var f=b||document.title;this.crumbs.childNodes.length===0&&(d=document.createElement("span"),d.appendChild(document.createTextNode(f)),
d.classList.add("breadcrumb"),d.classList.add("currentLocation"),this.append(d))},finalSegment:function(d,b){if(!this._resource.skip){var f;f=b?b:this._resource.Name;this._makeFinalHref?(d=this.buildSegment(f),this.addSegmentHref(d,this._resource)):(d=document.createElement("span"),d.appendChild(document.createTextNode(f)));d.classList.add("currentLocation");this.path+=this._resource.Name;this.append(d)}},firstSegment:function(d){if(d)if(this.append(d),this._resource&&this._resource.Parents&&!this._resource.skip)d.classList.add("breadcrumb"),
this.addDivider();else{if(!this._resource.skip)d.href="";d.classList.add("currentLocation")}},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(d){d.include===!0&&(this.append(d),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var d=this.segments.slice(0).reverse();d.forEach(function(b){this.append(b);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?b.include=!0:this.INCLUDE_FIRST_SECTION=
!1}.bind(this));this.segments=d.reverse()}},measure:function(){var d=this._container;d.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:d.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var d=this.getNavigatorWorkspaceRootSegment(),b=this._rootSegmentName;if(b)this.addTitle(d,b);else if(this.finalSegment(d,b),this._resource&&this._resource.Parents&&(this.buildSegments(b,"reverse"),this.measureSegments(),this.firstSegment(d)),this.crumbs.offsetWidth>=
this.MAX_LENGTH)this.INCLUDE_FIRST_SECTION=!1},render:function(){this.refresh();var d=this.getNavigatorWorkspaceRootSegment(),b=this._rootSegmentName;b?this.addTitle(d,b):(this.INCLUDE_FIRST_SECTION===!0&&this.firstSegment(d),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(d,b)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};h.prototype.constructor=h;return{BreadCrumbs:h}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(j,k,h){function d(b){k.attach(this);this._init(b)}d.prototype={_init:function(b){this._tracking=null;this._animationDelay=501;this._closeReversely=b.closeReversely;this.$node=h.node(b.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=h.node(b.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=h.node(b.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=b.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");if(b.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 b.closeByDefault!=="undefined")this._closeByDefault=b.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(b){this.addEventListener("resize",function(d){b(d.node)})},_initializeFromStoredSettings:function(){var b=localStorage.getItem(this._prefix+"/toggleState");this._closed=typeof b==="string"?b==="closed":this._closeByDefault;var b=h.bounds(this.$node.parentNode),d=h.bounds(this.$node),a;if(this._vertical)if(a=localStorage.getItem(this._prefix+"/yPosition")){if(this._splitTop=parseInt(a,10),this._splitTop>b.top+b.height-d.height)this._splitTop=b.top+b.height/
2}else{if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitTop=0}else if(a=localStorage.getItem(this._prefix+"/xPosition")){if(this._splitLeft=parseInt(a,10),this._splitLeft>b.left+b.width-d.width)this._splitLeft=b.left+b.width/2}else if(this._closeByDefault)this._initialSplit=this._getSplitPosition(),this._splitLeft=0},_getSplitPosition:function(){var b=h.bounds(this.$node),d=h.bounds(this.$node.parentNode);return this.vertical?b.top-d.top:b.left-d.left},_adjustToSplitPosition:function(b){var d=
h.bounds(this.$node),a=h.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=d.height;if(b||!this._splitTop)this._splitTop=d.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);b=this._splitTop;this.$node.parentNode.style.position==="relative"&&(b=this._splitTop-a.top);this.$sideNode.style.height=b+"px";this.$sideNode.style.display="block";this.$node.style.top=b+"px"}else{this._splitWidth=d.width;if(b||!this._splitLeft)this._splitLeft=d.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);b=this._splitLeft;this.$node.parentNode.style.position==="relative"&&(b=this._splitLeft-a.left);this.$sideNode.style.width=b+"px";this.$sideNode.style.display="block";this.$node.style.left=b+"px"}this._resize()},_resize:function(b,d,a){var b=b||0,e=h.bounds(this.$node.parentNode),i=h.bounds(this.$node);this._vertical?(a===void 0&&(a=i.top-e.top),a+=i.height,this.$mainNode.style.top=a+"px"):(d===void 0&&(d=i.left-e.left),d+=i.width,this.$mainNode.style.left=d+"px");var g=
this;window.setTimeout(function(){g._notifyResizeListeners(g.$mainNode);g._notifyResizeListeners(g.$sideNode)},b)},_notifyResizeListeners:function(b){this.dispatchEvent({type:"resize",node:b})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(b,d){b||this._addAnimation();var a=this._splitTop,e=this._splitLeft;if(this._closed){if(this._closed=!1,!this._splitLeft&&!this._splitTop&&typeof this._initialSplit==="number")a=e=this._initialSplit}else if(this._closed=
!0,this._closeReversely){var i=h.bounds(this.$node.parentNode),g=h.bounds(this.$node);this._vertical?a=i.height-g.height:e=i.width-g.width}else a=e=0;this._vertical?(this.$sideNode.style.height=a+"px",this.$node.style.top=a+"px"):(this.$sideNode.style.width=e+"px",this.$node.style.left=e+"px");this._resize(this._animationDelay,e,a);b||this._removeAnimation();d||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var c=this;window.setTimeout(function(){c._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var b=this;window.setTimeout(function(){b.$sideNode.classList.remove(b._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");b.$mainNode.classList.remove(b._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");b.$node.classList.remove(b._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(b){if(b.target===this._thumb)return h.stop(b),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),h.setFramesEnabled(!1),h.stop(b)},_mouseMove:function(b){if(this._tracking){var d=h.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=b.clientY;if(this._splitTop<d.top+5)this._splitTop=d.top+5;else if(this._splitTop>d.top+d.height-5)this._splitTop=d.top+d.height-5;var a=this._splitTop,a=this._splitTop-d.top;this.$node.style.top=a+"px"}else{this._splitLeft=b.clientX;if(this._splitLeft<d.left+5)this._splitLeft=d.left+5;else if(this._splitLeft>
d.left+d.width-5)this._splitLeft=d.left+d.width-5;a=this._splitLeft;a=this._splitLeft-2*d.left;this.$node.style.left=a+"px"}this._adjustToSplitPosition(!0);h.stop(b)}},_mouseUp:function(b){if(this._tracking)h.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"),h.stop(b)}};d.prototype.constructor=d;return{Splitter:d}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(j,k,h){function d(b){this.commandRegistry=b.commandRegistry;this.create();this._filterString="";this._providers=[]}d.prototype={addProvider:function(b){this._providers.push(b)},create:function(){var b=this._keyAssistDiv=document.createElement("div");b.id="keyAssist";b.style.display="none";b.classList.add("keyAssistFloat");b.setAttribute("role","menu");var d=this._keyAssistInput=document.createElement("input");
d.classList.add("keyAssistInput");d.type="text";d.placeholder=j["Filter bindings"];b.appendChild(d);var a=this._keyAssistContents=document.createElement("div");a.classList.add("keyAssistContents");if(h.isIOS||h.isAndroid)a.style.overflowY="auto";b.appendChild(a);var e=this._keyAssistTable=document.createElement("table");e.tabIndex=0;e.classList.add("keyAssistList");a.appendChild(e);document.body.appendChild(b);d.addEventListener("keydown",function(a){this._keyDown(a)}.bind(this));e.addEventListener("keydown",
function(a){this._keyDown(a)}.bind(this));d.addEventListener("input",function(){this.filterChanged()}.bind(this));a.addEventListener(h.isFirefox?"DOMMouseScroll":"mousewheel",function(a){this._scrollWheel(a)}.bind(this));document.addEventListener("keydown",function(a){a.keyCode===k.KEY.ESCAPE&&this.hide()}.bind(this));k.addAutoDismiss([b],function(){this.hide()}.bind(this))},createContents:function(){k.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var b=this._idCount=
this._keyAssistContents.scrollTop=0;b<this._providers.length;b++)this._providers[b].showKeyBindings(this);this.createHeader(j.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(b,d,a){if(this._filterString){var e=this._filterString.toLowerCase(),i;e!==this._filterString?(e=this._filterString,i=function(c){return c}):i=function(c){return c.toLowerCase()};if(i(d).indexOf(e)===-1&&i(b).indexOf(e)===-1&&i(this._lastHeader).indexOf(e)===-1)return}var g=this._keyAssistTable.insertRow(-1);
g.id="keyAssist-keyBinding-"+this._idCount++;g.setAttribute("role","menuitem");g._execute=a;g.classList.add("keyAssistItem");g.addEventListener("click",function(c){this._selectedRow=g;this.execute();c.preventDefault()}.bind(this));a=g.insertCell(-1);a.classList.add("keyAssistName");a.appendChild(document.createTextNode(d));a=g.insertCell(-1);a.classList.add("keyAssistAccel");a.appendChild(document.createTextNode(b))},createHeader:function(b){this._lastHeader=b;var d=this._keyAssistTable.insertRow(-1);
d.classList.add("keyAssistSection");var d=d.insertCell(-1),a=document.createElement("h2");a.appendChild(document.createTextNode(b));d.appendChild(a)},execute:function(){window.setTimeout(function(){this.hide();var b=this._selectedRow;this._selectedRow=null;b&&b._execute&&b._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var b=this._keyAssistInput.value;if(this._filterString!==b)this._filterString=
b,this.createContents()}.bind(this),100)},hide:function(){if(this.isVisible()){var b=document.activeElement,d=this._keyAssistDiv,b=d===b||(d.compareDocumentPosition(b)&16)!==0;d.style.display="none";b&&document.compareDocumentPosition(this._previousActiveElement)!==1&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return this._keyAssistDiv.style.display==="block"},removeProvider:function(b){b=this._providers.indexOf(b);b!==-1&&this._providers.splice(b,
1)},select:function(b){var d=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(d.length===0)this._selectedIndex=-1;else{var a=this._selectedIndex;a+=b?1:-1;a%=d.length;a<0&&(a=d.length-1);if(this._selectedIndex!==-1)b=d[this._selectedIndex],b.classList.remove("selected"),this._selectedRow=null;this._selectedIndex=a;if(this._selectedIndex!==-1){this._selectedRow=b=d[this._selectedIndex];b.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",b.id);this._keyAssistTable.focus();
var d=b.getBoundingClientRect(),e=this._keyAssistContents,i=e.getBoundingClientRect();b.offsetTop<e.scrollTop?a===0?e.scrollTop=0:b.scrollIntoView(!0):d.bottom>i.bottom&&b.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(b){if(b.keyCode===40)this.select(!0);else if(b.keyCode===38)this.select(!1);else if(b.keyCode===13)this.execute();else return;b.preventDefault()},_scrollWheel:function(b){var d=0,d=h.isIE||h.isOpera?-b.wheelDelta:h.isFirefox?b.detail*40:-b.wheelDeltaY,a=this._keyAssistContents,e=a.scrollTop;a.scrollTop+=d;if(e!==a.scrollTop)return b.preventDefault&&b.preventDefault(),!1}};return{KeyAssistPanel:d}});
define("orion/widgets/themes/ThemePreferences",[],function(){function j(j,h){this._preferences=j;this._themeData=h;var d=h.getThemeStorageInfo();this._themeVersion=d.version;var b=j.listenForChangedSettings(d.storage,2,function(d){d.key===b&&this.apply()}.bind(this))}j.prototype={_initialize:function(j,h,d){var b,f;this._themeVersion===void 0||d.get("version")===this._themeVersion?(b=d.get(j.styleset),(f=d.get("selected"))&&(f=JSON.parse(f))):f=b=null;b||(b=h.getStyles(),d.put(j.styleset,JSON.stringify(b)));
if(!f||f[j.selectedKey]===void 0)f=f||{},f[j.selectedKey]=j.defaultTheme,d.put("selected",JSON.stringify(f));d.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(j){var h=this._themeData,d=h.getThemeStorageInfo();this._preferences.getPreferences(d.storage,2).then(function(b){this._initialize(d,h,b);var f=JSON.parse(b.get("selected")),b=JSON.parse(b.get(d.styleset)),a;if(b)for(var e=0;e<b.length;e++)if(b[e].name===f[d.selectedKey]){a=b[e];break}j({style:a,styles:b})}.bind(this))},
setTheme:function(j,h){var d=this._themeData,b=d.getThemeStorageInfo();this._preferences.getPreferences(b.storage,2).then(function(f){this._initialize(b,d,f);var a=JSON.parse(f.get("selected"));j||(j=a[b.selectedKey]);a[b.selectedKey]=j;f.put("selected",JSON.stringify(a));h?f.put(b.styleset,JSON.stringify(h)):h=JSON.parse(f.get(b.styleset));for(var e=0;e<h.length;e++)if(h[e].name===a[b.selectedKey]){d.processSettings(h[e]);break}f.put("version",this._themeVersion)}.bind(this))},setFontSize:function(j){var h=
this._themeData,d=h.getThemeStorageInfo();this._preferences.getPreferences(d.storage,2).then(function(b){this._initialize(d,h,b);var f=JSON.parse(b.get("selected")),a=JSON.parse(b.get(d.styleset)),e;if(a)for(var i=0;i<a.length;i++)a[i].fontSize=j,a[i].name===f[d.selectedKey]&&(e=a[i]);b.put(d.styleset,JSON.stringify(a));h.processSettings(e)}.bind(this))}};return{ThemePreferences:j}});
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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
define("orion/editor/eventTarget",[],function(){function j(){}j.addMixin=function(k){var h=j.prototype,d;for(d in h)h.hasOwnProperty(d)&&(k[d]=h[d])};j.prototype={addEventListener:function(j,h,d){if(!this._eventTypes)this._eventTypes={};var b=this._eventTypes[j];b||(b=this._eventTypes[j]={level:0,listeners:[]});b.listeners.push({listener:h,useCapture:d})},dispatchEvent:function(j){var h=j.type;this._dispatchEvent("pre"+h,j);this._dispatchEvent(h,j);this._dispatchEvent("post"+h,j)},_dispatchEvent:function(j,
h){var d=this._eventTypes?this._eventTypes[j]:null;if(d){var b=d.listeners;try{if(d.level++,b)for(var f=0,a=b.length;f<a;f++)if(b[f]){var e=b[f].listener;typeof e==="function"?e.call(this,h):e.handleEvent&&typeof e.handleEvent==="function"&&e.handleEvent(h)}}finally{if(d.level--,d.compact&&d.level===0){for(f=b.length-1;f>=0;f--)b[f]||b.splice(f,1);b.length===0&&delete this._eventTypes[j];d.compact=!1}}}},isListening:function(j){return!this._eventTypes?!1:this._eventTypes[j]!==void 0},removeEventListener:function(j,
h,d){if(this._eventTypes){var b=this._eventTypes[j];if(b){for(var f=b.listeners,a=0,e=f.length;a<e;a++){var i=f[a];if(i&&i.listener===h&&i.useCapture===d){b.level!==0?(f[a]=null,b.compact=!0):f.splice(a,1);break}}f.length===0&&delete this._eventTypes[j]}}}};return{EventTarget:j}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(j,k,h){function d(b){b=b||{};this._document=b.document||document}var b={};d.getTheme=function(f){var f=f||"default",a=b[f];a||(a=b[f]=new d);return a};d.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(b,a){var e=this,i=e._themeClass;e._themeClass=b;this._load(b,a,function(){e.onThemeChanged({type:"ThemeChanged",oldValue:i,newValue:e.getThemeClass()})})},onThemeChanged:function(b){return this.dispatchEvent(b)},
buildStyleSheet:function(b,a){function e(a,c,e){c&&(i.push("."+b+" ."+a+" {"),i.push("\t"+(e?"background-color":"color")+": "+c+";"),i.push("}"))}var i=[];i.push("");i.push("."+b+" {");a.fontFamily&&i.push("\tfont-family: "+a.fontFamily+";");a.fontSize&&i.push("\tfont-size: "+a.fontSize+";");a.fontSize&&i.push("\tcolor: "+a.text+";");i.push("}");i.push("."+b+".textview {");a.background&&i.push("\tbackground-color: "+a.background+";");i.push("}");e("ruler.annotations",a.annotationRuler,!0);e("ruler.lines",
a.annotationRuler,!0);e("ruler.folding",a.annotationRuler,!0);e("ruler.overview",a.overviewRuler,!0);e("rulerLines",a.lineNumber,!1);e("rulerLines.even",a.lineNumberEven,!1);e("rulerLines.odd",a.lineNumberOdd,!1);e("annotationLine.currentLine",a.currentLine,!0);e("entity-name-tag",a.keyword,!1);e("entity-other-attribute-name",a.attribute,!1);e("string-quoted",a.string,!1);e("meta.annotation.currentLine",a.currentLine,!0);e("keyword",a.keyword,!1);e("string",a.string,!1);e("comment",a.comment,!1);
e("comment.block.documentation",a.comment,!1);e("keyword.other.documentation.markup",a.comment,!1);return i.join("\n")},_createStyle:function(b,a,e,i){var g=this._document,b="orion-theme-"+b,c=g.getElementById(b);if(c){if(i||c.firstChild.data===a)return;c.removeChild(c.firstChild);c.appendChild(g.createTextNode(a))}else i?(c=h.createElement(g,"link"),c.rel="stylesheet",c.type="text/css",c.href=a,c.addEventListener("load",function(){e()})):(c=h.createElement(g,"style"),c.appendChild(g.createTextNode(a))),
c.id=b,(g.getElementsByTagName("head")[0]||g.documentElement).appendChild(c);i||e()},_load:function(b,a,e){if(b)if(typeof a==="string")this._createStyle(b,a,e);else if(a=a.href,a.substring(a.length-4)!==".css"&&(a+=".css"),/^\//.test(a)||/[a-zA-Z0-9]+:\/\//i.test(a)||!j.toUrl)this._createStyle(b,a,e,!0);else{var i=this;j(["text!"+a],function(a){i._createStyle(b,a,e,!1)})}else e()}};k.EventTarget.addMixin(d.prototype);return{TextTheme:d}});
define("orion/widgets/themes/ThemeClass",[],function(){function j(j){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=j;this.classString="."+j+"{ "}j.prototype.className=null;j.prototype.classString=void 0;j.prototype.style=void 0;j.prototype.closeString=" }\n";j.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:j}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(j){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 h="",d=[],b=new j.ThemeClass("orionPage");
b.style.backgroundColor="#fdfdfd";b.style.width="100%";b.style.height="100%";d.push(b);b=new j.ThemeClass("topRowBanner");b.style.margin="0";b.style.border="0";b.style.backgroundColor=this.navbar;b.style.height="16px";b.style.padding="10px";b.style.paddingLeft="6px";b.style.paddingRight="2px";b.style.borderBottom="none";b.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";b.style.zIndex="100";d.push(b);b=new j.ThemeClass("a");b.style.textDecoration="none";b.style.color=
this.content;d.push(b);b=new j.ThemeClass("navlink");b.style.display="inline-block";b.style.padding="2px";b.style.color=this.content;b.style.verticalAlign="bottom";d.push(b);b=new j.ThemeClass("primaryNav");b.style.color=this.navtext;b.style.fontSize="8pt";b.style.fontWeight="normal";b.style.paddingTop="0";b.style.verticalAlign="baseline";d.push(b);b=new j.ThemeClass("primaryNav a");b.style.fontSize="8pt";b.style.color=this.navtext;b.style.marginRight="6px";b.style.marginLeft="6px";b.style.verticalAlign=
"baseline";b.style.textDecoration="none";d.push(b);b=new j.ThemeClass("primaryNav a:hover");b.style.color="#bfbfbf";b.style.cursor="hand";b.style.color="white";b.style.fontWeight="normal";d.push(b);for(var f in d)h+=d[f].toString();return h};k.prototype.writeLocationStyle=function(){var h="",d=[],b=new j.ThemeClass("titleArea");b.style.margin="0";b.style.paddingTop="5px";b.style.border="0";b.style.background=this.location;b.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";b.style.borderBottom="1px solid "+this.location;b.style.minHeight="20px";d.push(b);b=new j.ThemeClass("breadcrumb");b.style.fontSize="8pt";b.style.textDecoration="none";b.style.color="#f1f1f2;";b.style.paddingTop="2px";d.push(b);b=new j.ThemeClass("a.breadcrumb:hover");b.style.textDecoration="none";b.style.borderBottom="1px dotted";b.style.color="#F58B0F";b.style.cursor="pointer";d.push(b);b=new j.ThemeClass("breadcrumbSeparator");b.style.fontSize=
"8pt";b.style.textDecoration="none";b.style.color=this.separator;b.style.fontWeight="bold";d.push(b);b=new j.ThemeClass("currentLocation");b.style.fontWeight="bold";b.style.fontSize="8pt";b.style.color=this.breadcrumb;b.style.textDecoration="none";b.style.textWrap="normal";b.style.lineHeight="10pt";d.push(b);b=new j.ThemeClass("a.currentLocation:hover");b.style.fontWeight="bold";b.style.fontSize="10pt";b.style.color="#666666";b.style.textDecoration="none";b.style.borderBottom="0";d.push(b);b=new j.ThemeClass("navlinkonpage");
b.style.color=this.content;b.style.verticalAlign="middle";d.push(b);if(this.bannerProgress)b=new j.ThemeClass("topRowBanner .progressPane_running"),b.style.borderColor=this.bannerProgress,d.push(b);for(var f in d)h+=d[f].toString();return h};k.prototype.writeButtonStyle=function(){var h="",d=[],b=new j.ThemeClass("commandButton");b.style.color="#666";b.style.border="1px solid #dedede";b.style.backgroundColor="#ddd";b.style.textAlign="center";b.style.verticalAlign="middle";b.style.cursor="pointer";
b.style.display="inline-block";b.style.padding="4px 6px";b.style.borderRadius="3px";b.style.lineHeight="12px";b.style.fontSize="9pt";b.style.userSelect="none";d.push(b);b=new j.ThemeClass("commandButton:over");b.style.backgroundColor="#e6e6e6";b.style.border="1px solid #808080";d.push(b);b=new j.ThemeClass("commandMenu");b.style.color="#222";b.style.display="inline-block";b.style.verticalAlign="baseline";b.style.margin="0";b.style.fontSize="8pt";b.style.fontWeight="normal";b.style.border="1px solid #dedede";
b.style.backgroundColor="#efefef";b.style.cursor="pointer";b.style.borderRadius="1px";d.push(b);b=new j.ThemeClass("commandMenuItem");b.style.border="0";b.style.padding="0";b.style.margin="0";d.push(b);for(var f in d)h+=d[f].toString();return h};k.prototype.writeMainStyle=function(){var h="",d=[],b=new j.ThemeClass("searchbox");b.style.backgroundImage="url(../images/core_sprites.png)";b.style.backgroundRepeat="no-repeat";b.style.backgroundPosition="4px -297px";b.style.width="12px";b.style.height=
"12px";b.style.backgroundColor=this.search;b.style.border="1px solid "+this.search;b.style.fontSize="11px";b.style.width="15em";b.style.height="16px";b.style.borderRadius="10px";b.style.color="#999";b.style.padding="0";b.style.paddingLeft="20px";b.style.marginLeft="5px";b.style.marginTop="6px !important";b.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";d.push(b);b=new j.ThemeClass("searchbox:focus");b.style.color="white";b.style.outline=
"none";d.push(b);b=new j.ThemeClass("checkedRow");b.style.cssText="background-color:"+this.selection+" !important;";d.push(b);b=new j.ThemeClass("navbar-item-selected");b.style.background=this.selection;b.style.color=this.content;d.push(b);b=new j.ThemeClass("auxpane");b.style.border="0";b.style.background=this.sidepanel;d.push(b);b=new j.ThemeClass("mainpane");b.style.background=this.mainpanel;b.style.border=0;d.push(b);b=new j.ThemeClass("mainToolbar");b.style.background=this.toolpanel;d.push(b);
for(var f in d)h+=d[f].toString();return h};k.prototype.render=function(){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};k.prototype.getSheet=function(h){h.navbar.value?(this.navbar=h.navbar.value,this.button=h.button.value,this.location=h.location.value,this.selection=h.selection.value,this.sidepanel=h.sidepanel.value,this.mainpanel=h.mainpanel.value,this.navtext=h.navtext.value,this.search=
h.search.value,this.content=h.content.value,this.toolpanel=h.toolpanel.value,this.bannerProgress=h.bannerProgress.value):(this.navbar=h.navbar,this.button=h.button,this.location=h.location,this.selection=h.selection,this.sidepanel=h.sidepanel,this.mainpanel=h.mainpanel,this.navtext=h.navtext,this.search=h.search,this.content=h.content,this.toolpanel=h.toolpanel,this.bannerProgress=h.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(j,k,h){function d(){}function b(){this.styles=[];var a=new d;a.name="Orion";a.navbar="white";a.button="#EFEFEF";a.location="#efefef";a.selection="FEC";a.sidepanel="#FBFBFB";a.mainpanel="white";a.toolpanel="white";a.navtext="#bfbfbf";a.content="#3087B3";a.search="#444";a.breadcrumb="#3087B3";a.separator="#333";a.bannerProgress="whitesmoke";
this.styles.push(a);a=new d;a.name="Orion2014";a.navbar="white";a.button="#EFEFEF";a.location="#EFEFEF";a.selection="FEC";a.sidepanel="#EEEEEE";a.mainpanel="#EEEEEE";a.toolpanel="#EEEEEE";a.navtext="#BFBFBF";a.content="#333333";a.search="#444444";a.breadcrumb="#333333";a.separator="#333333";a.bannerProgress="orange";this.styles.push(a);a=new d;a.name="Green Zone";a.navbar="seagreen";a.button="lavender";a.location="darkseagreen";a.selection="moccasin";a.sidepanel="aliceblue";a.mainpanel="white";a.toolpanel=
"white";a.navtext="#FBFBFB";a.content="darkgreen";a.search="darkgreen";a.breadcrumb="#3087B3";a.separator="seagreen";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name="Pretty In Pink";a.navbar="plum";a.button="lavender";a.location="pink";a.selection="lavender";a.sidepanel="seashell";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="mediumorchid";a.search="violet";a.breadcrumb="#3087B3";a.separator="plum";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name=
"Blue Monday";a.navbar="cornflowerblue";a.button="lavender";a.location="skyblue";a.selection="lavender";a.sidepanel="aliceblue";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="royalblue";a.search="royalblue";a.breadcrumb="#3087B3";a.separator="cornflowerblue";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name="Vanilla Skies";a.navbar="sandybrown";a.button="lemmonchiffon";a.location="cornsilk";a.selection="lemonchiffon";a.sidepanel="white";a.mainpanel="white";a.toolpanel=
"white";a.navtext="lemonchiffon";a.content="chocolate";a.search="moccasin";a.breadcrumb="#3087B3";a.separator="sandybrown";a.bannerProgress="#F2F2F2";this.styles.push(a);a=new d;a.name="Beetlejuice";a.navbar="indigo";a.button="slateblue";a.location="darkslateblue";a.selection="silver";a.sidepanel="lavender";a.mainpanel="white";a.toolpanel="white";a.navtext="#FBFBFB";a.content="mediumslateblue";a.search="#444";a.breadcrumb="#3087B3";a.separator="indigo";a.bannerProgress="#F2F2F2";this.styles.push(a);
a=new d;a.name="Red";a.navbar="#CD2127";a.button="#777777";a.location="#D85F56";a.selection="lightcoral";a.sidepanel="#EFDAB2";a.mainpanel="#FDFADD";a.toolpanel="#FDFADD";a.navtext="#FBFBFB";a.content="darkred";a.search="#D85F56";a.breadcrumb="darkred";a.separator="#CD2127";a.bannerProgress="#F2F2F2";this.styles.push(a)}function f(){return this.styles}d.prototype.name="Orion";d.prototype.navbar="#404648";d.prototype.button="#EFEFEF";d.prototype.location="#333";d.prototype.breadcrumb="#3087B3";d.prototype.separator=
"#333";d.prototype.selection="FEC";d.prototype.sidepanel="#FBFBFB";d.prototype.mainpanel="white";d.prototype.toolpanel="white";d.prototype.navtext="#bfbfbf";d.prototype.content="#3087B3";d.prototype.search="#444";d.prototype.bannerProgress="white";b.prototype.styles=[];b.prototype.getStyles=f;b.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};b.prototype.getViewData=function(){var a={top:10,left:10,
width:350,height:350};a.shapes=[{type:"RECTANGLE",name:j["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:j["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:j["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:j["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",
name:j["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:j.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:j["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:j.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:j.Content,label:"/",x:78,y:60,family:"content",
fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:j.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:j["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:j.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:j["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:j["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:j["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:j["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:j["Line Color"],
x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:j["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:j["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 b=0;b<3;b++)a.shapes.push({type:"TEXT",name:j.Content,label:"org.eclipse.orion.content",x:170,y:127+20*b,fill:"#3087B3",family:"content"});for(b=0;b<3;b++)a.shapes.push({type:"TEXT",name:j.Content,label:"Item",x:25,y:115+20*b,fill:"#3087B3",family:"content"});for(b=0;b<3;b++)a.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+b*20,x2:165,y2:124+b*20,x3:160,y3:127+b*20,family:"navbar",fill:"#333"});a.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return a};b.prototype.processSettings=function(a){var b=new h.ThemeSheetWriter;(new k.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",b.getSheet(a))};return{ThemeData:b,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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(j){function k(h,d,b){this.elements=b;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);d===!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),j.addAutoDismiss([this.container],this.destroy.bind(this))):h.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(h){var d=document.createElement("span");d.className="UAContainer-icon";d.innerHTML='<span class="workingSpan"><img src="'+h.image+'" id="'+h.label+'ImageNode" alt="'+h.alt+'" height="64" width="64"></span><span class="UAIcon-label"><span class="UALabel" id="'+h.label+'LabelNode" >'+h.label+"</span></span>";d.onmouseover=function(){document.getElementById(h.label+"ImageNode").src=h.secondaryImage;document.getElementById(h.label+"LabelNode").className="UALabel-live";d.className="UAContainer-icon-live"};
d.onmouseout=function(){document.getElementById(h.label+"ImageNode").src=h.image;document.getElementById(h.label+"LabelNode").className="UALabel";d.className="UAContainer-icon"};var b=this;d.onclick=function(){b.showMedia(h)};this.elementNode.appendChild(d)};k.prototype.clearElements=function(){this.elementNode.innerHTML=""};k.prototype.showMedia=function(h){this.clearElements();this.addElement(h);var d=document.createElement("span");d.className="UAContainer-media";d.innerHTML='<div></div><div></div><span class="mediaSpan"><img src="'+
h.media+'" alt="'+h.alt+'" height="300" width="400"></span>';this.elementNode.appendChild(d);setTimeout(function(){d.style.opacity=1},100);h=document.getElementById(h.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=h.parentNode;h.className="chosenCircle"};k.prototype.createSwitch=function(h){var d;d=h?h.label+"switch":"indexSwitch";var b=document.createElement("span");b.className="workingSpan";b.innerHTML='<div class="circle" id ="'+d+'"></div>';var f=this;b.onclick=
h?function(){f.showMedia(h)}:function(){f.initialize();f.chosenSwitch.firstChild.className="circle";f.chosenSwitch=b;f.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(b);return this.radioButtons[this.radioButtons.length]=b};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(j,k,h,d){function b(){}var f=null;b.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 a=document.body;this.$frameParent=a;this.$$modalExclusions=this.$$modalExclusions||[];var b=document.createRange();b.selectNode(a);b=b.createContextualFragment(this.CONTAINERTEMPLATE);a.appendChild(b);this.$frame=a.lastChild;this.title&&h.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=h.$("#closeDialog",this.$frame);var i=this;this.$close.addEventListener("click",function(){i.hide()},!1);this.$parent=h.$(".dialogContent",this.$frame);
b=document.createRange();b.selectNode(this.$parent);a=b.createContextualFragment(this.TEMPLATE);this.messages&&h.processTextNodes(a,this.messages);this.$parent.appendChild(a);this.$buttonContainer=h.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(a){a.keyCode===h.KEY.ESCAPE?i.hide():a.keyCode===h.KEY.ENTER&&typeof i._defaultCallback==="function"&&i._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 a=this;this.buttons.forEach(function(b){var i=d.createButton(b.text,b.callback);if(b.id)i.id=b.id,a["$"+i.id]=i;if(b.isDefault)a._defaultCallback=b.callback,a._defaultButton=i;a.$buttonContainer.appendChild(i)})}},_makeModal:function(){var a=this;this.$frame.addEventListener("blur",function(c){a.$lastFocusedElement=c.target},!0);this._modalListener=function(c){var b=!h.contains(a.$frame,
c.target);if(b)for(var g=0;g<a.$$modalExclusions.length;g++)if(h.contains(a.$$modalExclusions[g],c.target)){b=!1;break}b&&(window.setTimeout(function(){(a.$lastFocusedElement||a.$parent).focus()},0),h.stop(c))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);var b=this.$frameParent.childNodes,i=!1;this._addedBackdrop=[];for(var g=0;g<b.length;g++){for(var c=0;c<this.$$modalExclusions.length;c++)if(h.contains(this.$$modalExclusions[c],
b[g])){i=!0;break}!i&&b[g]!==a.$frame&&b[g].classList&&!b[g].classList.contains("tooltipContainer")&&(c=b[g],c.classList.contains("modalBackdrop")||(c.classList.add("modalBackdrop"),this._addedBackdrop.push(c)))}(b=h.lastTabbable(this.$buttonContainer)||h.lastTabbable(this.$parent))&&b.addEventListener("keydown",function(c){if(c.keyCode===h.KEY.TAB){var b=a._getFirstFocusField();b&&b!==c.target&&b.focus();h.stop(c)}},!1)},_addChildDialog:function(a){this.$$modalExclusions.push(a.$frame||a.$parent)},
_inModalExclusion:function(a){return this.$$modalExclusions.some(function(b){return a.$frame===b||a.$parent===b})},_bindElements:function(a){for(var b=0;b<a.childNodes.length;b++){var i=a.childNodes[b];i.id&&(this["$"+i.id]=i);this._bindElements(i)}},hide:function(a){!a&&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");h.setFramesEnabled(!0);typeof this._afterHiding==="function"&&this._afterHiding();var b=this;this.keepAlive||window.setTimeout(function(){b.destroy()},0)},show:function(a){if(this.modal)if(f){if(!f._inModalExclusion(this)){this.hide(!0);return}}else f=this;typeof this._beforeShowing==="function"&&this._beforeShowing();h.setFramesEnabled(!1);var b=h.bounds(this.$frame),i=h.bounds(document.documentElement),g;a?(g=h.bounds(a),a=g.top+g.height+4,g=g.left+
4,a+b.height>i.height&&(a=Math.max(0,i.height-b.height-4)),g+b.width>i.width&&(g=Math.max(0,i.width-b.width-4))):(g=Math.max(0,(i.width-b.width)/2),a=Math.max(0,(i.height-b.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=a+"px";this.$frame.style.left=g+"px";this.$frame.classList.add("dialogShowing");typeof this._afterShowing==="function"&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return h.firstTabbable(this.$parent)||
this._defaultButton||h.firstTabbable(this.$buttonContainer)||this.$close},destroy:function(){if(this.$frame)f===this&&(f=null),h.setFramesEnabled(!0),this._addedBackdrop&&this._addedBackdrop.length>0&&this._addedBackdrop.forEach(function(a){a.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}};b.prototype.constructor=
b;return{Dialog:b}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages,require,orion/webui/littlelib,orion/PageLinks,orion/widgets/userAssistance/UATaskPanel,orion/webui/dialog".split(","),function(j,k,h,d,b){function f(a){this._displaySignOut=!0;this._init(a)}f.prototype={_init:function(a){this._dropdownNode=h.node(a.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=a.dropdown;this._serviceRegistry=a.serviceRegistry;this.authenticatedServices={};this.unauthenticatedServices=
{};this._noSeparator=a.noSeparator;this._dropDownItemClass=a.dropDownItemClass;this._keyAssistClass=a.keyAssistClass;if(a.signOut!==void 0)this._displaySignOut=a.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(a){var b=0,i;for(i in a)a.hasOwnProperty(i)&&b++;return b},_makeMenuItem:function(a,
b){var i=document.createElement("span");i.role="menuitem";i.tabIndex=0;var g=document.createTextNode(a);i.appendChild(g);typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&i.classList.add(this._dropDownItemClass):i.classList.add("dropdownMenuItem");i.addEventListener("click",b,!1);i.addEventListener("keydown",function(c){(c.keyCode===h.KEY.ENTER||c.keyCode===h.KEY.SPACE)&&b()},!1);return i},_renderAuthenticatedService:function(a){var b=this,i=this.authenticatedServices[a].authService;
if(i&&i.logout&&this._displaySignOut){var g=document.createElement("li"),c=this._makeMenuItem(j["Sign Out"],function(){i.logout().then(function(){b.addUserItem(a,i,b.authenticatedServices[a].label);localStorage.removeItem(a);localStorage.removeItem("lastLogin");for(var c=localStorage.length-1;c>=0;c--){var g=localStorage.key(c);g&&g.indexOf("/orion/preferences/user")===0&&localStorage.removeItem(g)}i.getAuthForm(window.location.href).then(function(c){window.location=c})})});g.appendChild(c);this._dropdownNode.appendChild(g)}},
renderServices:function(){function a(c){i[c]||(i[c]=b.createDocumentFragment());return i[c]}var b=document,i=[],g=this._serviceRegistry;d.getPageLinksInfo(g,"orion.page.link.user").then(function(c){this._dropdown?this._dropdown.empty():this._dropdownNode&&h.empty(this._dropdownNode);c.getAllLinks().forEach(function(c){var g,i;if(c.category&&(i=/user\.(\d+)/.exec(c.category)))g=parseInt(i[1],10);if(typeof g!=="number"||isNaN(g))g=1;g=a(g);i=b.createElement("li");var d=b.createElement("a");d.role="menuitem";
typeof this._dropDownItemClass==="string"?this._dropDownItemClass!==""&&d.classList.add(this._dropDownItemClass):d.classList.add("dropdownMenuItem");d.href=c.href;d.textContent=c.textContent;i.appendChild(d);g.appendChild(i);d.addEventListener("keydown",function(c){(c.keyCode===h.KEY.ENTER||c.keyCode===h.KEY.SPACE)&&d.click()},!1)}.bind(this));if(this.keyAssistFunction){var c=document.createElement("li"),d=this._makeMenuItem(j["Keyboard Shortcuts"],this.keyAssistFunction);typeof this._keyAssistClass===
"string"?this._keyAssistClass!==""&&d.classList.add(this._keyAssistClass):d.classList.add("key-assist-menuitem");c.appendChild(d);a(0).appendChild(c)}if(c=g.getServiceReferences("orion.page.getstarted")[0])d=c.getProperty("data"),c=document.createElement("li"),d=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,d)),c.appendChild(d),a(0).appendChild(c);var f=this;i.sort(function(c,a){return c-a}).forEach(function(c,a){if(a<i.length-1&&!this._noSeparator){var b=document.createElement("li");
b.classList.add("dropdownSeparator");var g=document.createElement("span");g.classList.add("dropdownSeparator");b.appendChild(g);c.appendChild(b)}f._dropdownNode.appendChild(c)}.bind(this));if(this.isSingleService())for(var p in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(p)&&this._renderAuthenticatedService(p,0)}.bind(this))},getStartedDialog:function(a){new b(null,!0,a)},setKeyAssist:function(a){this.keyAssistFunction=a;this.renderServices()},addUserItem:function(a,b,i,g){g?
(this.unauthenticatedServices[a]&&delete this.unauthenticatedServices[a],this.authenticatedServices[a]={authService:b,label:i,data:g}):(this.authenticatedServices[a]&&delete this.authenticatedServices[a],this.unauthenticatedServices[a]=this.unauthenticatedServices[a]?{authService:b,label:i,pending:this.unauthenticatedServices[a].pending}:{authService:b,label:i});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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
define("orion/searchUtils","i18n!orion/nls/messages,require,orion/regex,orion/commandRegistry,orion/PageUtil,orion/URITemplate".split(","),function(j,k,h,d,b,f){function a(a,b,c){var e="";c&&(e="^");if(e=h.parse("/"+e+a.searchStr+"/"))c=e.pattern,e=e.flags,e.indexOf("i")===-1&&!b.caseSensitive&&(e+="i"),a.regExp={pattern:c,flags:e},a.wildCard=!0}var e={ALL_FILE_TYPE:"*.*"};e.doSearch=function(a,b,c,d){if(a){var f=!0;c==="*"&&(c="");c===""&&(f=d&&d.type!==e.ALL_FILE_TYPE);if(f)c!==""&&e.addRecentSearch(b,
c,d?d.regEx:!1),a=a.createSearchParams(c,!1,!1,d),a=e.generateSearchHref(a),window.location=a}else window.alert(j["Can't search: no search service is available"])};e.generateSearchHelper=function(b,g){var c=b.keyword,d=c,f={};b.fileType&&b.fileType!==e.ALL_FILE_TYPE&&c===""&&(d="*."+b.fileType);if(b.regEx)f.searchStr=c,a(f,b,g);else{var p=c.indexOf("*")>-1,h=c.indexOf("?")>-1;p&&(c=c.split("*").join(".*"));h&&(c=c.split("?").join("."));!p&&!h&&!b.nameSearch?(f.searchStr=b.caseSensitive?c.split("\\").join(""):
c.split("\\").join("").toLowerCase(),f.wildCard=!1):(f.searchStr=b.caseSensitive?c:c.toLowerCase(),a(f,b,g),f.wildCard=!0)}f.searchStrLength=f.searchStr.length;return{params:b,inFileQuery:f,displayedSearchTerm:d}};e.convertSearchParams=function(a){if(a.rows!==void 0)a.rows=parseInt(a.rows,10);if(a.start!==void 0)a.start=parseInt(a.start,10);if(typeof a.regEx==="string")a.regEx=a.regEx.toLowerCase()==="true";if(typeof a.caseSensitive==="string")a.caseSensitive=a.caseSensitive.toLowerCase()==="true";
if(typeof a.nameSearch==="string")a.nameSearch=a.nameSearch.toLowerCase()==="true"};e.copySearchParams=function(a,b){var c={},e;for(e in a)if(a[e]!==void 0&&a[e]!==null&&(b||e!=="replace"))c[e]=a[e];return c};e.generateSearchHref=function(a){var b=k.toUrl("search/search.html"),a=e.copySearchParams(a,!0),c=a.resource;a.resource=void 0;return typeof a.keyword!=="undefined"?(new f(b+"#{,resource,params*}")).expand({resource:c,params:a}):(new f(b+"#{,resource}")).expand({resource:c})};e.generateFindURLBinding=
function(a,b,c,e,d){a={find:b.searchStr,regEx:b.wildCard?!0:void 0,caseSensitive:a.caseSensitive?!0:void 0,replaceWith:typeof e==="string"?e:void 0,atLine:typeof c==="number"?c:void 0};return d?a:","+(new f("{,params*}")).expand({params:a})};e.convertFindURLBinding=function(a){if(typeof a.regEx==="string")a.regEx=a.regEx.toLowerCase()==="true";if(typeof a.caseSensitive==="string")a.caseSensitive=a.caseSensitive.toLowerCase()==="true";if(typeof a.atLine==="string")a.atLine=parseInt(a.atLine,10)};e.replaceRegEx=
function(a,b,c){return a.replace(RegExp(b.pattern,b.flags),c)};e.replaceStringLiteral=function(a,b,c){b=h.parse("/"+b+"/gim");return e.replaceRegEx(a,b,c)};e.searchOnelineLiteral=function(a,b,c){var e;e=0;for(var d=!1,f=[];;)if(e=b.indexOf(a.searchStr,e),e<0)break;else{f.push({startIndex:e,length:a.searchStrLength});d=!0;if(c)break;e+=a.searchStrLength}return d?f:null};e.findRegExp=function(a,b,c,e){if(!b)return null;c=c||"";c+=(c.indexOf("g")===-1?"g":"")+(c.indexOf("m")===-1?"m":"");var d=null;
return(d=RegExp(b,c).exec(a.substring(e)))&&{startIndex:d.index+e,length:d[0].length}};e.searchOnelineRegEx=function(a,b,c){for(var d=0,f=!1,p=[];;)if(d=e.findRegExp(b,a.regExp.pattern,a.regExp.flags,d)){p.push(d);f=!0;if(c)break;d=d.startIndex+d.length}else break;return f?p:null};e.generateNewContents=function(a,b,c,d,f,p){if(d&&b){if(!a)c.contents=[];for(var h=0;h<b.length;h++){for(var j=b[h],k=!1,s=!1,r=[],u,w=0,n=0;n<d.children.length;n++)if(d.children[n].lineNumber-1===h){w=n;for(k=0;k<d.children[n].matches.length;k++)d.children[n+
k].checked!==!1&&r.push(k);s=r.length>0;u=d.children[n].matches;k=!0;break}if(k){if(s){r=e.replaceCheckedMatches(j,f,u,r,p);j=r.replacedStr;for(k=0;k<d.children[w].matches.length;k++)d.children[w+k].newMatches=r.newMatches}else for(k=0;k<d.children[w].matches.length;k++)d.children[w+k].newMatches=d.children[w+k].matches;a?c.contents[h]=j:c.contents.push(j)}else a||c.contents.push(j)}}};e.generateMatchContext=function(a,b,c){var e=[],d=a*2+1,f;b.length<=d?(f=0,a=b.length-1):(f=c-a,f<0?(f=0,a=f+d-1):
(a=c+a,a>b.length-1&&(a=b.length-1,f=a-d+1)));for(d=f;d<=a;d++)e.push({context:b[d],current:d===c});return e};e.splitFile=function(a){for(var b=0,c=0,e=0,d=0,f=[];;){b!==-1&&b<=e&&(b=a.indexOf("\r",e));c!==-1&&c<=e&&(c=a.indexOf("\n",e));if(c===-1&&b===-1){f.push(a.substring(d));break}var h=1;b!==-1&&c!==-1?b+1===c?(h=2,e=c+1):e=(b<c?b:c)+1:e=b!==-1?b+1:c+1;f.push(a.substring(d,e-h));d=e}return f};e.searchWithinFile=function(a,b,c,d,f,p){c=e.splitFile(c);if(f)b.contents=c;if(b){b.children=[];for(var h=
d=0;h<c.length;h++){var j=c[h];if(j&&j.length>0){var k=p?j:j.toLowerCase();if(k=a.wildCard?e.searchOnelineRegEx(a,k):e.searchOnelineLiteral(a,k)){var s,r=h+1;if(f)for(var u=0;u<k.length;u++)s=u+1,s={parent:b,checked:b.checked,type:"detail",matches:k,lineNumber:r,matchNumber:s,name:j,location:b.location+"-"+r+"-"+s},b.children.push(s);else s={parent:b,context:e.generateMatchContext(2,c,h),checked:b.checked,type:"detail",matches:k,lineNumber:r,name:j,location:b.location+"-"+r},b.children.push(s);d+=
k.length}}}b.totalMatches=d}};e.replaceCheckedMatches=function(a,b,c,e,d){for(var f=0,h="",j=[],k=0;k<c.length;k++){f!==c[k].startIndex&&(h+=a.substring(f,c[k].startIndex));if(c[k].length)d=c[k].length;for(var f=!1,s=0;s<e.length;s++)if(e[s]===k){f=!0;break}f?(j.push({startIndex:h.length,length:b.length}),h+=b):(j.push({startIndex:h.length,length:d}),h+=a.substring(c[k].startIndex,c[k].startIndex+d));f=c[k].startIndex+d}f<a.length&&(h+=a.substring(f));return{replacedStr:h,newMatches:j}};e.fullPathNameByMeta=
function(a){var b=a.length,c="";if(b>0)for(b-=1;b>-1;b--)c=c+(c===""?"":"/")+a[b].Name;return c};e.path2FolderName=function(a,b,c){return a.substring(0,a.length-b.length-(c?0:1))};e._storeRecentSearch=function(a,b,c,e){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("recentSearch",b);c&&window.setTimeout(function(){c.dispatchEvent({type:"inputDataListChanged",deleting:e})}.bind(this),20)})};e.addRecentSearch=function(a,b,c){typeof b==="string"&&b&&
a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var f,d=d.get("recentSearch");typeof d==="string"&&(d=JSON.parse(d));if(d){for(f in d)if(d[f].name===b)return;d.length>=20&&d.splice(19,d.length-20+1)}else d=[];d.splice(0,0,{name:b,regEx:c});e._storeRecentSearch(a,d)})};e.removeRecentSearch=function(a,b,c){typeof b==="string"&&b&&a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var f,d=d.get("recentSearch");typeof d===
"string"&&(d=JSON.parse(d));if(d)for(f in d)if(d[f].name===b){d.splice(f,1);e._storeRecentSearch(a,d,c,!0);break}})};e.getSearches=function(a,b,c){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a=a.get(b);typeof a==="string"&&(a=JSON.parse(a));a&&c&&c(a)})};e.getMixedSearches=function(a,b,c,d){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var i=a.get("recentSearch");typeof i==="string"&&(i=JSON.parse(i));b&&(a=
a.get("search"),typeof a==="string"&&(a=JSON.parse(a)),a&&a.forEach(function(a){if(c){var b=e.parseQueryStr(a.query);i.some(function(c){return b.searchStrTitle===c.name})||i.push({name:b.searchStrTitle,label:a.name})}else i.push({name:null,label:a.name,value:a.query})}));i&&d&&d(i)})};e.getOpenSearchPref=function(a,b){a.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(c){c=c.get("nav.config");b(c&&c["links.newtab"]!=="undefined"?c["links.newtab"]?!0:!1:!1)})};
e.setOpenSearchPref=function(a,b){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("openSearchPref",{openInNewTab:b})})};return e});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages,require,orion/i18nUtil,orion/searchUtils,orion/contentTypes,orion/Deferred".split(","),function(j,k,h,d,b,f){function a(a,b,g,c){this.registry=a;this.fileClient=b;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=c&&c.searchOnName;this._buildSkeletonOnly=c&&c.buildSkeletonOnly;this._fetchChildrenCallBack=c&&c.fetchChildrenCallBack;this._searchParams=g;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:d.generateSearchHelper(g);this._location=c&&c.location;this._childrenLocation=c&&c.childrenLocation?c.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))}a.prototype.search=function(a){var b=this.registry.getService("orion.core.contentTypeRegistry");
this._onSearchComplete=a;this._cancelled=!1;this._deferredArray=[];b.getContentTypes().then(function(a){this.contentTypesCache=a;var c=this;this._visitRecursively(this._childrenLocation).then(function(){c._cancelled||c._reportResult()}.bind(c),function(a){c._reportResult();c._statusService&&a.name==="Cancel"&&(console.log("Crawling search cancelled. Deferred array length : "+c._deferredArray.length),c._statusService.setProgressResult({Message:j["Search cancelled by user"],Severity:"Warning"}))}.bind(c))}.bind(this))};
a.prototype.searchName=function(a,b){if(a)this._searchParams=a,this.searchHelper=d.generateSearchHelper(a,!0);if(b)this.onSearchNameComplete=b;var g=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(this.fileSkeleton.length>0){for(var c=0;c<this.fileSkeleton.length;c++){var f=this.fileSkeleton[c].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?d.searchOnelineRegEx(this.searchHelper.inFileQuery,f,!0):d.searchOnelineLiteral(this.searchHelper.inFileQuery,f,!0))if(g.push(this.fileSkeleton[c]),
g.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:g.length,docs:g}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};a.prototype.buildSkeleton=function(a,b){this._buildingSkeleton=!0;var g=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var c=this;a();g.getContentTypes().then(function(a){c.contentTypesCache=a;c._visitRecursively(c._childrenLocation).then(function(){c._buildingSkeleton=!1;
b();c.searchHelper&&!c._buildSkeletonOnly&&c.searchName()})})};a.prototype._sort=function(a){a.sort(function(a,b){var c,e;if(this._searchParams.sort==="Path asc"){c=a.Location&&a.Location.toLowerCase();c=d.path2FolderName(c,a.Name&&a.Name.toLowerCase(),!0);e=b.Location&&b.Location.toLowerCase();e=d.path2FolderName(e,b.Name&&b.Name.toLowerCase(),!0);if(c<e)return-1;if(c>e)return 1}return this._sortOnNameSingle(a,b)}.bind(this))};a.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,
docs:this.fileLocations}})};a.prototype._sortOnNameSingle=function(a,b){var g=a.Name&&a.Name.toLowerCase(),c=b.Name&&b.Name.toLowerCase();return g<c?-1:g>c?1:0};a.prototype._onFileType=function(a){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===d.ALL_FILE_TYPE?!0:a.extension.indexOf(this.searchHelper.params.fileType)>=0:!0};a.prototype._visitRecursively=function(a){var d=[],g=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(a);return(g._progressService?this._progressService.progress(g.fileClient.fetchChildren(a),
"Crawling search for children of "+a):g.fileClient.fetchChildren(a)).then(function(c){for(var a=0;a<c.length;a++)if(c[a].Directory!==void 0&&c[a].Directory===!1)if(g._searchOnName)d.push(g._buildSingleSkeleton(c[a]));else if(g._buildSkeletonOnly)d.push(g._buildSingleSkeleton(c[a]));else{if(!g._cancelled){var e=b.getFilenameContentType(c[a].Name,g.contentTypesCache);if(e&&(e["extends"]==="text/plain"||e.id==="text/plain")&&g._onFileType(e))e=g._sniffSearch(c[a]),d.push(e),g._deferredArray.push(e)}}else if(c[a].Location)if(g._cancelled)break;
else e=g._visitRecursively(c[a].ChildrenLocation),d.push(e),g._deferredArray.push(e);return f.all(d)})};a.prototype._hitOnceWithinFile=function(a){a=this._searchParams.caseSensitive?a:a.toLowerCase();return this.searchHelper.inFileQuery.wildCard?d.searchOnelineRegEx(this.searchHelper.inFileQuery,a,!0):d.searchOnelineLiteral(this.searchHelper.inFileQuery,a,!0)};a.prototype._reportSingleHit=function(a){if(!this._cancelled)a.LastModified=a.LocalTimeStamp,this.fileLocations.push(a),this._hitCounter++,
this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0)};a.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(a){a.cancel()})};a.prototype._sniffSearch=function(a){this._totalCounter++;var b=this;if(!this._cancelled)if(this.searchHelper.params.keyword==="")this._reportSingleHit(a),this._statusService&&this._statusService.setProgressResult({Message:h.formatMessage(j["${0} files found out of ${1}"],
this._hitCounter,this._totalCounter)});else return(b._progressService?b._progressService.progress(b.fileClient.read(a.Location),"Reading file "+a.Location):b.fileClient.read(a.Location)).then(function(g){b._hitOnceWithinFile(g)&&b._reportSingleHit(a);b._statusService&&b._statusService.setProgressResult({Message:h.formatMessage(j["${0} files found out of ${1}"],b._hitCounter,b._totalCounter)},j.Cancel)},function(a){a&&a.message&&a.message.toLowerCase()!=="cancel"&&console.error("Error loading file content: "+
a.message)})};a.prototype._buildSingleSkeleton=function(a){this._totalCounter++;this.fileSkeleton.push(a);this.searchHelper&&!this._buildSkeletonOnly&&this._totalCounter%100===0&&this.searchName();a=new f;a.resolve(this._totalCounter);return a};a.prototype.constructor=a;return{SearchCrawler:a}});
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(j,k,h,d,b,f,a){function e(a){this._init(a)}e.prototype=new a.Dialog;e.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="'+
d.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>';e.prototype._init=function(a){this.title=a.title||j["Find File Named"];this.modal=!0;this.messages=j;this._searcher=a.searcher;this._progress=a.progress;this._onHide=a.onHide;this._contentTypeService=new h.ContentTypeRegistry(this._searcher.registry);
if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=a.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=a.initialText;this._message=a.message;this._nameSearch=!0;if(a.nameSearch!==void 0)this._nameSearch=a.nameSearch;this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(j["Missing required argument: fileService"]);this._searchRenderer=a.searchRenderer;if(!this._searchRenderer||
typeof this._searchRenderer.makeRenderFunction!=="function")throw Error(j["Missing required argument: searchRenderer"]);this._initialize()};e.prototype._bindToDom=function(a){var e=this;e.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",j["FileName FolderName"]):this.$fileName.setAttribute("placeholder",j.Search);this.$fileName.addEventListener("input",function(){e._time=+new Date;e._timeoutId&&clearTimeout(e._timeoutId);e._timeoutId=setTimeout(e.checkSearch.bind(e),
0)},!1);this.$fileName.addEventListener("keydown",function(c){if(c.keyCode===b.KEY.ENTER){var a=b.$("a",e.$results);if(a)b.stop(c),(f.isMac?c.metaKey:c.ctrlKey)?window.open(a.href):(window.location.href=a.href,e.hide())}},!1);a.addEventListener("keydown",function(c){var a,d,i;if(c.keyCode===b.KEY.DOWN||c.keyCode===b.KEY.UP)a=b.$$array("a",e.$results),d=document.activeElement,i=a.indexOf(d),c.keyCode===b.KEY.DOWN?i>=0?(d.classList.remove("treeIterationCursor"),a=i<a.length-1?a[i+1]:a[0],a.focus(),
a.classList.add("treeIterationCursor")):a.length>0&&(a=-1<a.length-1?a[0]:a[0],a.focus(),a.classList.add("treeIterationCursor")):i>=0?(d.classList.remove("treeIterationCursor"),d=e.$fileName,a=i>0?a[i-1]:d,a.focus(),i>0&&a.classList.add("treeIterationCursor")):a.length>0&&(a[a.length-1].focus(),a[a.length-1].classList.add("treeIterationCursor")),b.stop(c)});a.addEventListener("mouseup",function(c){c.target.focus()},!1);setTimeout(function(){if(e._forceUseCrawler||!e._fileService.getService(e._searcher.getSearchLocation()).search){var c=
e._searchOnRoot?e._searcher.getSearchRootLocation():e._searcher.getChildrenLocation(),c=new k.SearchCrawler(e._searcher.registry,e._fileService,"",{searchOnName:!0,location:c});e._searcher.setCrawler(c);c.buildSkeleton(function(){e.$crawlingProgress.style.display="inline";e.$progress.appendChild(document.createTextNode(j["Building file skeleton..."]))},function(){e.$crawlingProgress.style.display="none";e.$progress.removeChild(e.$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()};e.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var a=(new Date).getTime();a-this._time>this._searchDelay?(this._time=a,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};e.prototype._detectFolderKeyword=function(a){var b,c=a,e=null;if(this._nameSearch&&(b=/(\S+)\s*(.*)/,(a=b.exec(a))&&a.length===3))a[1]&&
(c=a[1]),a[2]&&(e=a[2]);return{keyword:c,folderKeyword:e}};e.prototype.doSearch=function(){var a=this.$fileName.value;if(a){var e=this._detectFolderKeyword(a),c=this._searcher.createSearchParams(e.keyword,this._nameSearch,this._searchOnRoot),d=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=d;var m=document.createElement("div");m.appendChild(document.createTextNode(this._nameSearch?j["Searching..."]:f.formatMessage(j["Searching for occurrences of"],
a)));b.empty(this.$results);this.$results.appendChild(m);this._searcher.search(c,e.folderKeyword,function(){d===this.currentSearch&&d.apply(null,arguments)}.bind(this))}};e.prototype.decorateResult=function(a){function e(a){a.button===0&&!a.ctrlKey&&!a.metaKey&&c.hide()}for(var c=this,a=b.$$array("a",a),d=0;d<a.length;d++)a[d].addEventListener("click",e,!1)};e.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};e.prototype._afterHiding=function(){this._onHide&&this._onHide()};e.prototype.constructor=
e;return{OpenResourceDialog:e}});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(j,k){function h(d,b,f){if(d=k.node(d))this._parent=d;else throw Error("Parent node of dropdown menu not found");this.options=f=f||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=f.selectionClass;d=document.createElement("div");d.classList.add("dropDownContainer");d.id=this.navDropDownId;d.style.display="none";this._parent.appendChild(d);this._dropdownMenu=d;if(b=k.node(b))this._triggerNode=
b;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(a){a.keyCode===k.KEY.ESCAPE&&this.clearPanel()}.bind(this))}j.mixin(h.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(d){this._dropdownMenu.innerHTML=d},getContentNode:function(){return this._dropdownMenu},updateContent:function(d,b){b()},_positionDropdown:function(){this._dropdownMenu.style.right="";var d=k.bounds(this._dropdownMenu),b=k.bounds(document.body);if(d.left+d.width>b.left+b.width)d=k.bounds(this._boundingNode(this._triggerNode)),b=k.bounds(this._triggerNode),this._dropdownMenu.style.right=d.width-(b.left-d.left+b.width)+"px"},_boundingNode:function(d){var b=window.getComputedStyle(d,
null);return b===null?d:b.getPropertyValue("position")==="absolute"||!d.parentNode||d===document.body?d:this._boundingNode(d.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 h});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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(j,k,h){function d(a,b,d){if(!a[b])throw b+j[" is not supported in this file system"];return a[b].apply(a,d)}function b(a,e,i,g){if(!a.readBlob)throw j["source file service does not support binary read"];if(!i.writeBlob)throw j["target file service does not support binary write"];if(e[e.length-1]!=="/")return d(a,"readBlob",[e]).then(function(c){return d(i,"writeBlob",[g,c])});var c=g.substring(0,
g.length-1),f=decodeURIComponent(c.substring(c.lastIndexOf("/")+1)),c=c.substring(0,c.lastIndexOf("/")+1);return d(i,"createFolder",[c,f]).then(function(){},function(){}).then(function(){return d(a,"fetchChildren",[e]).then(function(c){for(var e=[],d=0;d<c.length;++d){var f=c[d].Location,l=f;c[d].Directory&&(l=f.substring(0,f.length-1));l=decodeURIComponent(l.substring(l.lastIndexOf("/")+1));l=g+encodeURIComponent(l);c[d].Directory&&(l+="/");e[d]=b(a,f,i,l)}return k.all(e)})})}function f(a,b){function d(c){var a=
new k;a.reject(j["No Matching FileService for location:"]+c);return a}var g=a.getServiceReferences("orion.core.file"),c=g;if(b)for(var c=[],f=0;f<g.length;++f)b(g[f])&&c.push(g[f]);for(var m=[],p=[],o=[],q=[],v={fetchChildren:function(){var c=new k;c.resolve(q);return c},createWorkspace:function(){var c=new k;c.reject(j["no file service"]);return c},loadWorkspaces:function(){var c=new k;c.reject(j["no file service"]);return c},loadWorkspace:function(){var c=new k;window.setTimeout(function(){c.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:j["File Servers"],Location:"/",Children:q,ChildrenLocation:"/"})},100);return c},search:d,createProject:d,createFolder:d,createFile:d,deleteFile:d,moveFile:d,copyFile:d,read:d,write:d},g=0;g<c.length;++g)q[g]={Directory:!0,Length:0,LocalTimeStamp:0,Location:c[g].getProperty("top"),ChildrenLocation:c[g].getProperty("top"),Name:c[g].getProperty("Name")},f=c[g].getProperty("pattern")||c[g].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),f[0]!=="^"&&(f=
"^"+f),m[g]=RegExp(f),p[g]=a.getService(c[g]),o[g]=c[g].getProperty("Name"),c[g].getProperty("NameKey")&&c[g].getProperty("nls")&&h.getMessageBundle(c[g].getProperty("nls")).then(function(a,b){q[a].Name=b[c[a].getProperty("NameKey")];o[a]=b[c[a].getProperty("NameKey")]}.bind(this,g));this._getServiceIndex=function(c){if(c==="/")return-1;else if(!c||c.length&&c.length===0)return p[0]?0:-1;for(var a=0;a<m.length;++a)if(m[a].test(c))return a;throw j["No Matching FileService for location:"]+c;};this._getService=
function(c){c=this._getServiceIndex(c);return c===-1?v:p[c]};this._getServiceName=function(c){c=this._getServiceIndex(c);return c===-1?v.Name:o[c]};this._getServiceRootURL=function(c){c=this._getServiceIndex(c);return c===-1?v.Location:q[c].Location}}f.prototype={getService:function(a){return this._getService(a)},fileServiceName:function(a){return this._getServiceName(a)},fileServiceRootURL:function(a){return this._getServiceRootURL(a)},fetchChildren:function(a){return d(this._getService(a),"fetchChildren",
arguments)},createWorkspace:function(a){return d(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return d(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(a){return d(this._getService(a),"loadWorkspace",arguments)},createProject:function(a,b,i,g){return d(this._getService(a),"createProject",arguments)},createFolder:function(a,b){return d(this._getService(a),"createFolder",arguments)},createFile:function(a,b){return d(this._getService(a),"createFile",
arguments)},deleteFile:function(a){return d(this._getService(a),"deleteFile",arguments)},moveFile:function(a,e,i){var g=this._getService(a),c=this._getService(e);if(g===c)return d(g,"moveFile",arguments);var f=a[a.length-1]==="/",m=e;m[m.length-1]!=="/"&&(m+="/");if(i)m+=encodeURIComponent(i);else{var h=a;f&&(h=h.substring(0,h.length-1));m+=h.substring(h.lastIndexOf("/")+1)}f&&m[m.length-1]!=="/"&&(m+="/");return b(g,a,c,m).then(function(){return d(g,"deleteFile",[a])})},copyFile:function(a,e,i){var g=
this._getService(a),c=this._getService(e);if(g===c)return d(g,"copyFile",arguments);var f=a[a.length-1]==="/",m=e;m[m.length-1]!=="/"&&(m+="/");if(i)m+=encodeURIComponent(i);else{var h=a;f&&(h=h.substring(0,h.length-1));m+=h.substring(h.lastIndexOf("/")+1)}f&&m[m.length-1]!=="/"&&(m+="/");return b(g,a,c,m)},read:function(a,b){return d(this._getService(a),"read",arguments)},readBlob:function(a){return d(this._getService(a),"readBlob",arguments)},write:function(a,b,i){return d(this._getService(a),"write",
arguments)},remoteImport:function(a,b){return d(this._getService(a),"remoteImport",arguments)},remoteExport:function(a,b){return d(this._getService(a),"remoteExport",arguments)},search:function(a){return d(this._getService(a.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(j,k,h,d,b,f,a,e){function i(c,a){this.parentNode=h.node(c);this.contentNode=h.node(a);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);h.addAutoDismiss([this.anchor],this._expandMenu.bind(this,null))}function g(c){return!c.isRelatedLink}function c(c,a){var b=c.order,e=a.order;if(b<e)return-1;else if(e<b)return 1;return 0}function l(c,a){var b=c.source.order,e=a.source.order,b=typeof b==="number"?b:100,e=typeof e==="number"?
e:100;return b===e?c.textContent.localeCompare(a.textContent):b<e?-1:1}var m=e.isTouch;k.mixin(i.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(c,a,b){var e=this.anchor,c=this.createListItem(c,a);b&&c.classList.add("sideMenuItemActive");e.appendChild(c);this.menuitems[a]=c},setSideMenu:function(){var c=this.getDisplayState(),a=this.parentNode;if(a){if(c===this.CLOSED_STATE){this.setPageContentLeft("0");
if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._timeout=window.setTimeout(function(){a.style.display="none"},this.TRANSITION_DURATION_MS);a.classList.add("animating")}if(c===this.OPEN_STATE){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;a.classList.remove("animating");a.style.display="block";a.style.width=this.SIDE_MENU_OPEN_WIDTH;this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)}}},setPageContentLeft:function(c){var a=this.contentNode;if(a)a.style.left=
c},toggleSideMenu:function(){var c=this.getDisplayState(),a=this.contentNode;a&&a.classList.add("content-fixedHeight-animation");c=c===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;c===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,c);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];h.empty(this.anchor)},getMenuItems:function(){var c=this.menuitems;return Object.keys(c).map(function(a){return c[a]})},getMenuItem:function(c){return this.menuitems[c]},
getDisplayState:function(){var c=localStorage.getItem(this.LOCAL_STORAGE_NAME);if(!c)c=this.DEFAULT_STATE;return c},createListItem:function(c,a){var b=document.createElement("li");b.className=c;b.classList.add("sideMenuItem");b.categoryId=a;return b},setCategories:function(c){this.categories=c;this.links=Object.create(null)},setPageLinks:function(c){this.pageLinks=c;var a=this,b=c.createLinkElements();c.getAllLinks().forEach(function(c,e){var d=b[e];d.source=c;a._getLinksBin(c.category).push(d)});
this._renderLinks()},setRelatedLinks:function(c,a){this.relatedLinks=c;var b=this;Object.keys(this.links).forEach(function(c){var a=b._getLinksBin(c);b.links[c]=a.filter(g)});var e=document.createDocumentFragment();c.forEach(function(c){var a=c.relatedLink,d=b._getLinksBin(a.category),c=j.createCommandMenuItem(e,c.command,c.invocation);c.classList.remove("dropdownMenuItem");c.isRelatedLink=!0;c.source=a;d.push(c)});this._renderLinks(a)},_getLinksBin:function(c){if(c){var a=this.links;a[c]=a[c]||[];
return a[c]}else return[]},_sort:function(){var c=this.links;Object.keys(c).forEach(function(a){c[a].sort(l)})},_renderCategories:function(){var a=this.categories,e=this,g=new URL(window.location.href),i=b.matchResourceParameters();i.OrionHome=d.getOrionHome();var l=!1;this.clearMenuItems();a.getCategoryIDs().map(function(c){return a.getCategory(c)}).sort(c).forEach(function(c){var a=e._getLinksBin(c.id);a.length&&(l?e.addMenuItem(c.imageClass,c.id,!1):(a=a.some(function(c){if(!c.source.uriTemplate)return!1;
c=new f(c.source.uriTemplate);c=new URL(c.expand(i),window.location);return c.protocol===g.protocol&&c.host===g.host&&c.hostname===g.hostname&&c.port===g.port&&c.pathname===g.pathname&&c.search===g.search?l=!0:!1}),e.addMenuItem(c.imageClass,c.id,a)))})},_renderLinks:function(c){c=c||[];this._sort();this._renderCategories();var a=this,b=window.location.href;Object.keys(this.menuitems).forEach(function(e){var d=a.getMenuItem(e);if(d){for(var g=a._getLinksBin(e).slice(),g=g.filter(function(a){var e=
a.source;return c.indexOf(e.id)>=0||!e.default&&!e.force&&a.href===b?!1:!0}),g=g.filter(function(c){c=c.source;return!(g.length>1&&c.default&&!c.force)}),i=g.length-1;i>0;i--)g[i].href===g[i-1].href&&g.splice(i,1);if(g.length){d.appendChild(a._createCategoryElement(e,d,g[0]));var f=document.createElement("ul");f.className="sideMenuSubMenu";g.forEach(function(c){var a=document.createElement("li");a.className="sideMenuSubMenuItem";var b=document.createElement("a");b.href=c;b.className="sideMenuSubMenuItemLink";
var e=document.createElement("span");e.innerHTML=c.innerHTML;e.className="sideMenuSubMenuItemSpan";b.appendChild(e);a.appendChild(b);f.appendChild(a)});d.appendChild(f)}}})},_createCategoryElement:function(c,a,b){var c=this.categories.getCategory(c),e;m?(e=document.createElement("button"),e.type="button"):(e=document.createElement("a"),e.href=b.href);e.className+=c.imageClass;e.classList.add("submenu-trigger");e.tabIndex="0";a.classList.remove(c.imageClass);return e},_handleEvent:function(c){var a=
c.target,c=c.type==="focus";if(a.tagName!=="A"||c)a.classList.contains("submenu-trigger")&&(m||c)&&this._expandMenu(h.$(".sideMenuSubMenu",a.parentNode))},_expandMenu:function(c){this.getMenuItems().forEach(function(a){a=h.$(".sideMenuSubMenu",a);c!==a&&a.classList.remove("expanded")});c&&c.classList.toggle("expanded")}});return i});
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(j,
k,h,d,b,f,a,e,i,g,c,l,m,p,o,q,v,s,r,u,w,n,t,y,z,D,E,B,F,C,G,x,A,L,K){var Y,W,Q,R,S,O,J,I;function H(c,a){if(c.getLabel)return c.getLabel();else{var b=new t;b.resolve(a.properties.name);return b}}function M(c){m.node("progressPane").setAttribute("aria-label",j["Operations - Press spacebar to show current operations"]);(c=c.getService("orion.page.progress"))&&c.init.bind(c)("progressPane")}function T(c,a){var b=c.getServiceReferences("orion.core.auth");ea=[];var n=Y.apply(this,arguments);if(n)for(var e=
0;e<b.length;e++){var g=b[e],d=c.getService(g);H(d,g).then(function(c){d.getKey().then(function(a){ea.push(a);d.getUser().then(function(b){n.addUserItem(a,d,c,b)},function(b,e){n.addUserItem(a,d,c,e)});window.addEventListener("storage",function(){da[a]!==localStorage.getItem(a)&&(da[a]=localStorage.getItem(a),d.getUser().then(function(b){n.addUserItem(a,d,c,b)},function(){n.addUserItem(a,d,c)}))},!1)})})}}function V(c){return c}function U(c,b,n,e,d){function g(c){for(var a={},b=c.getPropertyKeys(),
n,e=0;e<b.length;e++)n=b[e],a[n]=c.getProperty(n);return a}function f(c,a){var b=null;c.some(function(c){return a===c.getProperty("id")?!!(b=c):!1});return b}function l(c){var n=c.command;if(!n.visibleWhen||n.visibleWhen(b))return c.invocation=new a.CommandInvocation(b,b,null,n,e),(new t).resolve(c);else if(typeof d==="function")return h||(h=d()),t.when(h,function(d){if(d&&b===fa&&(!n.visibleWhen||n.visibleWhen(d)))return c.invocation=new a.CommandInvocation(d,d,null,n,e),c});return(new t).resolve()}
function y(c,b,n){return n?(new t).resolve({relatedLink:c,command:n}):b.then(function(b){return{relatedLink:c,command:new a.Command(b)}})}var m=arguments,z,h,D=c&&c.getServiceReferences("orion.page.link.related");if(D&&D.length!==0){var p=this;t.when(function(){if(z)return z;var a=c.getService("orion.core.contentTypeRegistry");a||(a=new v.ContentTypeRegistry(c),a=c.getService("orion.core.contentTypeRegistry"));return a.getContentTypes().then(function(c){return z=c})}(),function(){if(W.apply(p,m)){var a=
c.getServiceReferences("orion.navigate.command"),b=[];D.forEach(function(n){var d=g(n);if(d.id){var t;if((d.nls&&d.nameKey||d.name)&&d.uriTemplate)t=i._createCommandOptions(d,n,c,z,!0),b.push(y(d,t,null));else if(t=f(a,d.id)){var l=g(t),n={};K.mixin(n,l,d);(d=e.findCommand(d.id))?b.push(y(n,null,d)):(t=i._createCommandOptions(l,t,c,z,!0),b.push(y(n,t,null)))}}});t.all(b,V).then(function(c){c.sort(function(c,a){return c.command.name.localeCompare(a.command.name)});return t.all(c.map(l),V).then(function(a){var b=
[],a=a.filter(function(a,n){if(a)return!0;b.push(c[n]);return!1});Q.call(p,e,a,b,n);R.apply(p,m)})})}})}}function ha(c){var a=m.node("globalActions");a&&(c.destroy(a),c.renderCommands(a.id,a,{},{},"tool"))}function aa(c){var a=window.getComputedStyle(c,null);return a===null?c:a.getPropertyValue("position")==="absolute"||!c.parentNode||c===document.body?c:aa(c.parentNode)}function ba(c){var a={},b=null;typeof c==="string"&&(c=m.node(c));c||(c=m.node("pageActions"));for(var n=c;n&&n.classList;){if(n.classList.contains("toolComposite")){b=
n;break}n=n.parentNode}if(c.classList.contains("commandMarker"))a.commandNode=c;if(b&&(a.slideContainer=m.$(".slideParameters",b),a.parameterArea=m.$(".parameters",b),a.dismissArea=m.$(".parametersDismiss",b),a.notifications=m.$("#notificationArea",b),b.parentNode&&(a.toolbarTarget=m.$(".toolbarTarget",b.parentNode),a.toolbarTarget)))c=m.bounds(a.toolbarTarget),n=m.bounds(aa(a.toolbarTarget.parentNode)),a.toolbarTargetY=c.top-n.top,a.toolbar=b;return a}function ca(c){if(c=c.slideContainer)if(c.style.left=
"",c.style.top="",c.classList.contains("slideContainerActive")){var a=m.bounds(c),b=m.bounds(c.parentNode);c.style.left=(b.width-a.width)/2+"px";c.style.top="0"}}var f=function(c){var a=document.createElement("a");a.href=c;return a.href}(k.toUrl("auth/NotifyAuthentication.html")),da={},P=null;Y=x.createMenuGenerator||function(c,a){if(m.node("userMenu")){var b=m.node("userDropdown"),n=new o.Dropdown({dropdown:b}),b=new y.UserMenu({dropdownNode:b,dropdown:n,serviceRegistry:c}),n=m.node("userTrigger");
new q.Tooltip({node:n,text:j.Options,position:["below","left"]});var n=document.getElementById("userTrigger"),e=n.className;e+=" imageSprite core-sprite-silhouette";n.className=e;b.setKeyAssist(a);return b}};W=x.beforeGenerateRelatedLinks||function(){return!0};Q=x.addRelatedLinkCommands||function(c,a,b,n){this.sideMenu&&this.sideMenu.setRelatedLinks(a,n)};R=x.afterGenerateRelatedLinks||function(){};S=x.afterSetPageTarget||function(){};O=x.generateNavigationMenu||function(){var c=m.node("sideMenu");
if(c){var a=m.node("centralNavigation");new q.Tooltip({node:a,text:j.CentralNavTooltip,position:["right"]});P=this.sideMenu=new L(c,m.node("pageContent"));a.addEventListener("click",P.toggleSideMenu.bind(P));(c=m.node("sideMenuToggle"))&&c.addEventListener("click",P.toggleSideMenu.bind(P))}};J=x.afterGenerateNavigationMenu||function(){};I=x.afterGenerateBanner||function(){};var ea=[],fa,$=[],N,Z=null,X=null,ga=new b;return{generateBanner:function(c,b,g,i,f,l,y,o){function A(c){c.registerService("orion.cm.managedservice",
{updated:function(c){for(var c=c&&c["links.newtab"]!=="undefined"?c["links.newtab"]?"_blank":"_self":"_self",a=m.$$array(".targetSelector"),b=0;b<a.length;b++)a[b].target=c}},{pid:"nav.config"})}(new w.ThemePreferences(i,new n.ThemeData)).apply();var q=m.node(c);if(!q)throw j["could not find banner parent, id was "]+c;var u=document.createRange();u.selectNode(q);u=u.createContextualFragment(E);m.processTextNodes(u,j);q.firstChild?q.insertBefore(u,q.firstChild):q.appendChild(u);q=m.node("home");q.href=
k.toUrl("edit/edit.html");q.setAttribute("aria-label",j["Orion Home"]);m.node("progressPane").src=a.NO_IMAGE;if(q=m.node("pageToolbar"))q.classList.add("toolbarLayout"),q.innerHTML=F+h.slideoutHTMLFragment("mainToolbar");(q=m.node("closeNotifications"))&&q.setAttribute("aria-label",j["Close notification"]);if(G.isFirefox<=17&&(q=m.node("staticBanner")))q.style.width="100%",q.style.MozBoxSizing="border-box";if(q=m.node("footer"))q.innerHTML=B,m.processTextNodes(q,j);g.setParameterCollector(new e.CommandParameterCollector(ba,
ca));document.addEventListener("keydown",function(c){c.keyCode===m.KEY.ESCAPE&&(c=b.getService("orion.page.message"))&&c.setProgressMessage("")},!1);O.apply(this,arguments);J.apply(this,arguments);q=z.getCategoriesInfo(b);u=z.getPageLinksInfo(b,"orion.page.link");t.all([q,u]).then(function(c){if(P){var a=c[1];P.setCategories(c[0]);P.setPageLinks(a);P.setSideMenu()}});if(q=m.$(".split")){var u=m.$(".sidePanelLayout"),L=m.$(".mainPanelLayout");if(u&&L)Z={side:u,main:L},Z.splitter=new p.Splitter({node:q,
sidePanel:u,mainPanel:L,toggle:!0,closeByDefault:o}),q=new a.Command({name:j["Toggle side panel"],tooltip:j["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){Z.splitter.toggleSidePanel()}}),g.addCommand(q),g.registerCommandContribution("pageActions","orion.toggleSidePane",1,null,!0,new d.KeyBinding("l",G.isMac?!1:!0,!0,!1,G.isMac?!0:!1))}var v=!1,C=function(c,a){if(!v){var b=a.getService("orion.page.progress"),n=new D.OpenResourceDialog({searcher:c,progress:b,searchRenderer:c.defaultRenderer,
onHide:function(){v=!1}});window.setTimeout(function(){v=!0;n.show()},0)}},q=new a.Command({name:j["Find File Named..."],tooltip:j["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(){C(f,b)}});g.addCommand(q);g.registerCommandContribution("globalActions","orion.openResource",100,null,!0,new d.KeyBinding("f",!0,!0));q=new a.Command({name:j["Toggle banner and footer"],tooltip:j["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var c=
m.node("banner"),a=m.node("footer"),b=m.node("sideMenu"),n=m.$(".content-fixedHeight"),e=c.style.visibility==="hidden";e?(c.style.visibility="visible",a.style.visibility="visible",n.classList.remove("content-fixedHeight-maximized"),b&&b.classList.remove("sideMenu-maximized")):(c.style.visibility="hidden",a.style.visibility="hidden",n.classList.add("content-fixedHeight-maximized"),b&&b.classList.add("sideMenu-maximized"));ga.dispatchEvent({type:"toggleTrim",maximized:!e});return!0}});g.addCommand(q);
g.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new d.KeyBinding("m",!0,!0));q=new a.Command({name:j["System Configuration Details"],tooltip:j["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return k.toUrl("help/about.html")}});g.addCommand(q);g.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new d.KeyBinding(112,!0,!0));q=new a.Command({name:j["Background Operations"],tooltip:j["Background Operations Tooltip"],
id:"orion.backgroundOperations",hrefCallback:function(){return k.toUrl("operations/list.html")}});g.addCommand(q);g.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new d.KeyBinding("o",!0,!0));X=new r.KeyAssistPanel({commandRegistry:g});q=new a.Command({name:j["Show Keys"],tooltip:j["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){X.isVisible()?X.hide():X.show();return!0}});g.addCommand(q);g.registerCommandContribution("globalActions",
"orion.keyAssist",100,null,!0,new d.KeyBinding(191,!1,!0));ha(g);T(b,q.callback);M(b);window.addEventListener("hashchange",function(){g.processURL(window.location.href)},!1);window.setTimeout(function(){A(b)},0);I.apply(this,arguments)},getToolbarElements:ba,getMainSplitter:function(){return Z},getKeyAssist:function(){return X},getGlobalEventTarget:function(){return ga},layoutToolbarElements:ca,setPageTarget:function(c){var a,b,n=c.breadcrumbRootName,e=c.serviceRegistry;c.target?(c.searchService&&
c.searchService.setLocationByMetaData(c.target),c.fileService&&!c.breadcrumbTarget&&(b=n?n+" ":"",b+=c.fileService.fileServiceName(c.target.Location),n=null),a=c.name||c.target.Name,fa=c.target,U.call(this,e,c.target,$,c.commandService,c.makeAlternate)):(c.breadcrumbTarget||(n=n||c.task||c.name),a=c.name,U.call(this,e,{NoTarget:""},$,c.commandService,c.makeAlternate));(N=c.title)||(N=a?a+" - "+c.task:c.task);window.document.title=N;S.apply(this,arguments);if(a=c.breadCrumbContainer?m.node(c.breadCrumbContainer):
m.node("location")){m.empty(a);var d=e&&new A.FileClient(e),e=c.breadcrumbTarget||c.target,d=d&&e&&e.Location?d.fileServiceRootURL(e.Location):null;new l.BreadCrumbs({container:a,resource:e,rootSegmentName:n,workspaceRootSegmentName:b,workspaceRootURL:d,makeFinalHref:c.makeBreadcrumFinalLink,makeHref:c.makeBreadcrumbLink})}},setDirtyIndicator:function(c){if(N)N.charAt(0)==="*"&&!c&&(N=N.substring(1)),c&&N.charAt(0)!=="*"&&(N="*"+N),window.document.title=N;var a=m.node("dirty");if(a)a.textContent=
c?"*":""},setPageCommandExclusions:function(c){$=c},notifyAuthenticationSite:f}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(j){return{detectValidURL:function(k){for(var h=/\[([^\]]*)\]\(([^\)]+)\)/g,d=h.exec(k),b=[],f=0;d;){if(d.length===3&&d[2].length>0){var a=new URL(d[2]);a.protocol!==":"&&j.validateURLScheme(a.href)&&(d.index>f&&b.push({segmentStr:k.substring(f,d.index)}),b.push({segmentStr:d[1].length>0?d[1]:d[2],urlStr:d[2]}),f=d.index+d[0].length)}d=h.exec(k)}if(f===0)return null;f<k.length-1&&b.push({segmentStr:k.substring(f)});return b},processURLSegments:function(j,
h){h.forEach(function(d){if(d.urlStr){var b=document.createElement("a");b.href=d.urlStr;b.appendChild(document.createTextNode(d.segmentStr))}else b=document.createElement("span"),b.textContent=d.segmentStr;j.appendChild(b)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(j,k,h,d){function b(a,b,d,g,c){this._serviceRegistry=a;this._serviceRegistration=a.registerService("orion.page.message",this);this._operationsClient=b;this.notificationContainerDomId=c;this.domId=d;this.progressDomId=g||d;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var f;b.prototype={_init:function(){var a=k.node("closeNotifications");if(a&&
!this._hookedClose){a.style.cursor="pointer";this._hookedClose=!0;var b=k.node(this.notificationContainerDomId);k.addAutoDismiss([b],function(){this._clickToDisMiss&&this.close()}.bind(this));a.addEventListener("click",function(){this.close()}.bind(this));b.addEventListener("click",function(a){a&&a.target&&a.target.nodeName.toLowerCase()==="a"&&(a=k.$$("a",b))&&a.length&&a.length===1&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var a=k.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&a?(a.innerHTML="",a.classList.remove("cancelButton"),a.classList.add("dismissButton"),a.classList.add("core-sprite-close"),a.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){if(!this._notifierElements)this._notifierElements=h.getToolbarElements(this.notificationContainerDomId);return this._notifierElements},setMessage:function(a,b,d){this._init();this.currentMessage=a;var g=k.node(this.domId);
if(typeof d==="boolean"){var c=g.getAttribute("aria-live");g.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){a===this.currentMessage&&(k.empty(g),g.appendChild(document.createTextNode(a)),window.setTimeout(function(){g.setAttribute("aria-live",c)},100))}.bind(this),100)}else k.empty(g),g.appendChild(document.createTextNode(a));typeof b==="number"&&window.setTimeout(function(){a===this.currentMessage&&(k.empty(g),g.appendChild(document.createTextNode("")))}.bind(this),b)},setErrorMessage:function(a){this._clickToDisMiss=
!0;this.currentMessage=a;this._init();var b=a.responseText||a.message||a;if(typeof b==="string")try{b=JSON.parse(b)}catch(d){}var a=b.Message||b,g="red";if(b.Severity)switch(b.Severity){case "Warning":g="#FFCC00";break;case "Error":g="red";break;case "Info":case "Ok":g="green"}b=document.createElement("span");b.style.color=g;b.appendChild(document.createTextNode(a));a=k.node(this.domId);k.empty(a);a.appendChild(b)},setProgressMessage:function(a){this._clickToDisMiss=!1;this._init();this.currentMessage=
a;var b=document.createElement("span");b.classList.add("progressIcon");var d=k.node(this.progressDomId);k.empty(d);d.appendChild(b);d.appendChild(document.createTextNode(a));b=k.node(this.notificationContainerDomId);b.classList.remove("notificationHide");if(a&&a.length>0)b.classList.add("progressNormal"),b.classList.add("notificationShow");else if(this._progressMonitors&&this._progressMonitors.length>0)return this._renderOngoingMonitors();else b.classList.remove("notificationShow"),b.classList.add("notificationHide")},
setCancelFunction:function(a){this._cancelFunc=a},setProgressResult:function(a,b){this._clickToDisMiss=!1;this._cancelMsg=b;this.currentMessage=a;var i=a.responseText||a;if(typeof i==="string")try{i=JSON.parse(i)}catch(g){}this._init();var c=i.Message||i.toString(),f=j.UnknownError,m="core-sprite-information",h="progressNormal",o=document.createElement("span");o.classList.add("imageSprite");o.classList.add("progressIcon");var q=[];if(i.Severity)switch(i.Severity){case "Warning":f=j.UnknownWarning;
m="core-sprite-warning";h="progressWarning";q.push("progressInfo");q.push("progressError");q.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":m="core-sprite-error";h="progressError";q.push("progressWarning");q.push("progressInfo");q.push("progressNormal");this._clickToDisMiss=!0;break;default:h="progressNormal",q.push("progressWarning"),q.push("progressError"),q.push("progressNormal")}q.push("notificationHide");o.classList.add(m);var v=k.node(this.progressDomId),m=k.node(this.notificationContainerDomId);
k.empty(v);v.appendChild(o);c===Object.prototype.toString()&&(c=f);if(i.HTML)i=document.createElement("span"),i.innerHTML=c,v.appendChild(i);else{if(f=d.detectValidURL(c))c=document.createDocumentFragment(),d.processURLSegments(c,f),Array.prototype.forEach.call(k.$$("a",c),function(c){c.target="_blank"});else{if(i.Severity!=="Warning"&&i.Severity!=="Error"&&!b)this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),
5E3);c=document.createTextNode(c)}v.appendChild(c)}if(h&&this.progressDomId!==this.domId){m.classList.add(h);for(h=0;h<q.length;h++)m.classList.remove(q[h])}m.classList.add("notificationShow");if(q=k.node("closeNotifications"))this._cancelMsg?(q.classList.add("cancelButton"),q.classList.remove("dismissButton"),q.classList.remove("core-sprite-close"),q.classList.remove("imageSprite"),q.innerHTML=this._cancelMsg):(q.innerHTML="",q.classList.remove("cancelButton"),q.classList.add("dismissButton"),q.classList.add("core-sprite-close"),
q.classList.add("imageSprite"))},showWhile:function(a,b){var d=this;if(b){d.setProgressMessage(b);var g=function(){b===d.currentMessage&&d.setProgressMessage("")};a.then(g,g)}return a},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(a,b){return new f(this,++this._lastProgressId,a,b)},_renderOngoingMonitors:function(){if(this._progressMonitors.length>0){var a="",b=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(b||(a+=", "),a+=this._progressMonitors[d].status,
b=!1);this.setProgressMessage(a)}else this.setProgressMessage("")},_beginProgressMonitor:function(a){this._progressMonitors[a.progressId]=a;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(a){this._progressMonitors[a.progressId]=a;this._renderOngoingMonitors()},_doneProgressMonitor:function(a){delete this._progressMonitors[a.progressId];this._progressMonitors.length--;a.status?this.setProgressResult(a.status):this._renderOngoingMonitors()}};b.prototype.constructor=
b;f=function(a,b,d,g){this.statusService=a;this.progressId=b;if(d){this.deferred=d;this.begin(g);var c=this;d.then(function(){c.done.bind(c)()},function(){c.done.bind(c)()})}};f.prototype.begin=function(a){this.status=a;this.statusService._beginProgressMonitor(this)};f.prototype.done=function(a){this.status=a;this.statusService._doneProgressMonitor(this)};f.prototype.worked=function(a){this.status=a;this.statusService._workedProgressMonitor(this)};f.prototype.constructor=f;return{StatusReportingService:b,
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(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(j,k,h,d){function b(){}b.prototype={_initialize:function(b,a,e,i,g){this._tooltip=new d.Tooltip({node:b,hideDelay:g||0,afterShowing:this._afterShowingFunction(a).bind(this),afterHiding:e,trigger:i?i:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";b=document.createRange();b.selectNode(this.$parent);b=b.createContextualFragment(this.TEMPLATE);
this.messages&&h.processTextNodes(b,j);this.$parent.appendChild(b);var c=this._tooltip;this.$parent.addEventListener("keydown",function(a){a.keyCode===h.KEY.ESCAPE&&c.hide()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent)},_bindElements:function(b){for(var a=0;a<b.childNodes.length;a++){var e=b.childNodes[a];e.id&&(this["$"+e.id]=e);this._bindElements(e)}},_afterShowingFunction:function(b){return function(){b&&b.bind(this)();if(!this.customFocus){var a=
h.firstTabbable(this.$parent);a&&a.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};b.prototype.constructor=b;return{PopupDialog:b}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(j,k,h,d){var b={};(function(){var f=!1;b.updateNavTools=function(a,b,d,g,c,l){var m=h.node(g);if(m)b.destroy(m);else throw j["could not find toolbar "]+g;b.renderCommands(g,m,l,d,"button");if(c&&(g=h.node(c)))b.destroy(g),b.renderCommands(c,g,null,d,"button");f||(f=!0,a.getService("orion.page.selection").addEventListener("selectionChanged",function(a){var g=h.node(c);
g&&(b.destroy(g),b.renderCommands(c,g,a.selections,d,"button"))}))};b.createOperationsCommands=function(a,b,i){function g(c){return!c.operation||!c.operation.type?!1:c.operation.type==="loadstart"||c.operation.type==="progress"}var c=new d.Command({name:j["Remove Completed"],tooltip:j["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(){i.removeCompletedOperations().then(function(){b.loadOperations.bind(b)()})},visibleWhen:function(){return!0}});a.addCommand(c);
c=new d.Command({name:j.Remove,tooltip:j["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(c){for(var c=Array.isArray(c.items)?c.items:[c.items],a=0;a<c.length;a++){var d=c[a];i.removeOperation.bind(i)(d.Location).then(function(){b.loadOperations.bind(b)()},function(){b.loadOperations.bind(b)()})}},visibleWhen:function(c){if(!Array.isArray(c)||c.length===0)return!g(c);for(var a in c)if(g(c[a]))return!1;return!0}});a.addCommand(c);
c=new d.Command({name:j.Cancel,tooltip:j["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(c){for(var c=Array.isArray(c.items)?c.items:[c.items],a=0;a<c.length;a++){var b=c[a];b.deferred&&b.deferred.cancel()}},visibleWhen:function(c){if(!Array.isArray(c)||c.length===0)return g(c)&&(c.operation&&c.operation.cancelable?!0:!1);for(var a in c)if(!g(c[a])||!c[a].operation||!c[a].operation.cancelable)return!1;return!0}});a.addCommand(c)}})();
return b});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(j,k,h,d,b){function f(a){this._options=a}f.prototype=new d.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(a){this._myOperations=[];this._operationsDeferreds=[];this._commandService=a.commandRegistry;b.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(a.triggerNode)};f.prototype._bindToDom=function(){this.$allOperationsLink.href=k.toUrl("operations/list.html");this._setOperationsVisibility()};f.prototype.setOperations=function(a,b){this._myOperations||this._init(this._options);this._myOperations=
[];this._operationsDeferreds=[];if(a)for(var d in a)this._myOperations.push(a[d]),this._operationsDeferreds.push(b[d]);this._renderOperations()};f.prototype.parseProgressResult=function(a){if(!a)return{};a=a.responseText||a;try{a=JSON.parse(a)}catch(b){}var d={Message:a.Message||a,Severity:a.Severity};if(a.DetailedMessage&&a.DetailedMessage!==d.Message)d.DetailedMessage=a.DetailedMessage;return d};f.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,this._myOperations,
this._operationsDeferreds)};f.prototype._renderOperationsTable=function(a,b,d){h.empty(a);for(var g=0;g<b.length;g++){var c=b[g],f=document.createElement("tr"),m=document.createElement("td");m.style.paddingLeft="5px";m.style.paddingRight="5px";m.textContent=c.Name;f.appendChild(m);var p=document.createElement("div");m.appendChild(p);m=document.createElement("span");m.style.paddingRight="5px";m.classList.add("imageSprite");switch(c.type){case "Warning":m.classList.add("core-sprite-warning");m.setAttribute("aria-label",
j["Operation resulted in a warning."]);break;case "error":m.classList.add("core-sprite-error");m.setAttribute("aria-label",j["Operation resulted in an error."]);break;case "loadstart":case "progress":m.classList.add("core-sprite-start");m.setAttribute("aria-label",j["Operation is running."]);break;case "abort":m.classList.add("core-sprite-stop");m.setAttribute("aria-label",j["Operation is canceled."]);break;case "load":case "loadend":m.classList.add("core-sprite-ok"),m.setAttribute("aria-label","Operation ok.")}p.appendChild(m);
m=document.createElement("span");m.classList.add("operationStatus");m.textContent=c.Name;p.appendChild(m);if(c.error){var o=c.error.Message||c.error;c.error.DetailedMessage&&c.error.DetailedMessage!==""&&(o+=": "+c.error.DetailedMessage);m.textContent=o;m.classList.remove("operationStatus");m.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",p,{operation:c,deferred:d[g]},this,"tool");a.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(j,k,h,d,b){function f(a,i){if(!this._progressPane){this._progressPane=d.node(a);this._operationsDialog=new b.OperationsDialog({triggerNode:this._progressPane,commandRegistry:i});var g=this;this._progressPane.addEventListener("keydown",function(c){(c.charOrCode===" "||c.keyCode===d.KEY.ENTER)&&g._operationsDialog.show()})}}function a(a,b,d,c){this._serviceRegistry=
a;this._serviceRegistration=a.registerService("orion.page.progress",this);this._commandRegistry=d;this._operationsClient=b;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=c}f.prototype={_switchIconTo:function(a){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);this._lastIconClass=a;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(a,b){var d=
{},c;for(c in a)a[c].progressMonitor||(d[c]=a[c]);if(this._isEmpty(d))this._switchIconTo("progressPane_empty"),this._progressPane.title=j.Operations,this._progressPane.alt=j.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var f="";for(c in d){var m=d[c];if(m.type&&(m.type==="loadstart"||m.type==="progress")){f="running";break}}switch(f){case "running":this._progressPane.title=j["Operations running"];this._progressPane.alt=j["Operations running"];
this._progressPane.setAttribute("aria-valuetext",j["Operations running"]);this._switchIconTo("progressPane_running");break;case "warning":this._progressPane.title=j["Some operations finished with warning"];this._progressPane.alt=j["Some operations finished with warning"];this._progressPane.setAttribute("aria-valuetext",j["Some operations finished with warning"]);this._switchIconTo("progressPane_warning");break;case "error":this._progressPane.title=j["Some operations finished with error"];this._progressPane.alt=
j["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",j["Some operations finished with error"]);this._switchIconTo("progressPane_error");break;default:this._progressPane.title=j.Operations,this._progressPane.alt=j.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_operations")}}this._operationsDialog.setOperations(d,b)},_isEmpty:function(a){for(var b in a)return!1;return!0}};
f.prototype.constructon=f;a.prototype={init:function(a){if(!this._progressMonitorClass)this._progressMonitorTool=new f(a,this._commandRegistry)},progress:function(a,b,d){var c=this,f=this._operationsIndex++;!d&&this._progressMonitorClass&&(d=new this._progressMonitorClass,d.begin(b));a.then(function(){if(c._operations[f]){var m=c._operations[f];if(b)m.Name=b;c._lastOperation=m;m.type="loadend";if(d)m.progressMonitor=d;c.writeOperation.bind(c)(f,m,a);m.Location||c._removeOperationFromTheList.bind(c)(f)}},
function(m){if(c._operations[f]){var h=c._operations[f];if(b)h.Name=b;if(d)h.progressMonitor=d;c._lastOperation=h;h.type=m.canceled?"abort":"error";h.error=m;c.writeOperation.bind(c)(f,h,a);h.Location||c._removeOperationFromTheList.bind(c)(f)}},function(m){if(b)m.Name=b;if(d)m.progressMonitor=d;c.writeOperation.bind(c)(f,m,a)});return a},removeOperation:function(a){for(var b in this._operations)if(this._operations[b].Location&&this._operations[b].Location===a){this._removeOperationFromTheList(b);
break}this._operationsClient.removeOperation.bind(this._operationsClient)(a)},_removeOperationFromTheList:function(a){var b=this._operations[a].progressMonitor;delete this._operations[a];delete this._operationDeferrds[a];b?b.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},removeCompletedOperations:function(){for(var a in this._operations){var b=this._operations[a];if(b.type&&b.type!=="loadstart"&&b.type!=="progress")(b=this._operations[a].progressMonitor)&&
b.done(),delete this._operations[a],delete this._operationDeferrds[a]}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(a){this._serviceRegistry.getService("orion.page.message").setProgressResult(a)},showWhile:function(a,b,d){b&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(b);var c=this;a.then(function(){c._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){d?c._serviceRegistry.getService("orion.page.message").setProgressMessage(""):
c.setProgressResult.bind(c)(a);return a});return this.progress(a,b)},writeOperation:function(a,b,d){this._operations[a]=b;this._operationDeferrds[a]=d;b.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(c){c.put(b.Location,{Name:b.Name,expires:b.expires})});b.progressMonitor?b.progressMonitor.progress(b.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};a.prototype.constructor=a;return{ProgressService:a}});
define("orion/dialogs",[],function(){function j(j){this._serviceRegistry=j;this._serviceRegistration=j.registerService("orion.page.dialog",this)}j.prototype={confirm:function(j,h){h(window.confirm(j))},openFiles:function(){}};j.prototype.constructor=j;return{DialogService:j}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(j){function k(h,d){d||(d="orion.page.selection");this._serviceRegistry=h;j.attach(this);this._serviceRegistration=h.registerService(d,this);this._selections=null}k.prototype={getSelection:function(h){var d=this._getSingleSelection();typeof h==="function"&&h(d);return d},getSelections:function(h){var d=Array.isArray(this._selections)?this._selections.slice():[];typeof h==="function"&&h(d);return d},_getSingleSelection:function(){return this._selections&&
this._selections.length>0?this._selections[0]:null},setSelections:function(h){var d=this._selections;this._selections=Array.isArray(h)?h.length>0?h.slice():null:h?[h]:null;d!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};k.prototype.constructor=k;return{Selection:k}});
define("orion/section","orion/webui/littlelib,orion/selection,orion/commandRegistry,orion/commonHTMLFragments,orion/objects,orion/selection".split(","),function(j,k,h,d,b,f){function a(a,b){var c=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!b.id)throw Error("Missing required argument: id");this.id=b.id;if(!b.title)throw Error("Missing required argument: title");var e=b.useAuxStyle?["sectionWrapper",
"sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");a.appendChild(this.domNode);for(var f=0;f<e.length;f++)this.domNode.classList.add(e[f]);this.domNode.id=b.id;if(b.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(a){(a.target===c.titleNode||a.target===c.twistie)&&c._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(a){a.keyCode===j.KEY.ENTER&&(a.target===c.domNode||a.target===c.titleNode||a.target===c.twistie)&&c._changeExpandedState()},!1);if(b.iconClass){var h=document.createElement("span");h.classList.add("sectionIcon");this.domNode.appendChild(h);e=Array.isArray(b.iconClass)?b.iconClass:[b.iconClass];e.forEach(function(c){h.classList.add(c)})}b.headerClass&&
(e=Array.isArray(b.headerClass)?b.headerClass:[b.headerClass],e.forEach(function(c){this.domNode.classList.add(c)}.bind(this)));this.titleNode=document.createElement("div");this.titleNode.id=b.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=b.title;if(typeof b.getItemCount==="function")e=document.createElement("div"),e.classList.add("layoutLeft"),
e.classList.add("sectionItemCount"),this.domNode.appendChild(e),e.textContent=b.getItemCount(this);this._progressNode=document.createElement("div");this._progressNode.id=b.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);e=document.createElement("div");e.id=b.id+
"FilterSearchBox";this.domNode.appendChild(e);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=b.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=b.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=b.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);b.slideout&&(e=d.slideoutHTMLFragment(b.id),f=document.createRange(),f.selectNode(this.domNode),e=f.createContextualFragment(e),this.domNode.appendChild(e));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);a.appendChild(this._contentParent);b.content&&this.setContent(b.content);this.hidden=b.hidden;if(typeof b.onExpandCollapse==="function")this._onExpandCollapse=b.onExpandCollapse;this._preferenceService=b.preferenceService;this._contentParent.style.display="none";this.domNode.classList.add("sectionWrapperClosed");
if(this._preferenceService){var o=this;this._preferenceService.getPreferences("/window/views").then(function(c){c=c.get(o.id);if(c!==void 0)o.hidden=!c;if(!o.hidden)o._contentParent.style.display="block",o.domNode.classList.remove("sectionWrapperClosed");o._updateExpandedState(!o.hidden,!1)})}else{if(!this.hidden)this._contentParent.style.display="block",this.domNode.classList.remove("sectionWrapperClosed");this._updateExpandedState(!this.hidden,!1)}this._commandService=b.commandService;this._lastMonitor=
0;this._loading={}}function e(a){this._section=a;this._id=++a._lastMonitor}a.prototype={setTitle:function(a){this.titleNode.textContent=a},getHeaderElement:function(){return this.domNode},getTitleElement:function(){return this.titleNode},getActionElement:function(){return this._toolActionsNode},setContent:function(a){typeof a==="string"?this._contentParent.innerHTML=a:(this._contentParent.innerHTML="",this._contentParent.appendChild(a))},getContentElement:function(){return this._contentParent},embedExplorer:function(a,
d,c){this._contentParent.innerHTML="";if(!a.parent)a.parent=d;this._contentParent.appendChild(a.parent);a.section=this;b.mixin(a,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(c){if(!j.node(c)){var a=document.createElement("ul");a.id=c;a.classList.add("commandList");a.classList.add("layoutRight");this.section.actionsNode.appendChild(a)}}.bind(this))},getCommandsVisible:function(){return this.section.actionsNode.style.visibility!=="hidden"},setCommandsVisible:function(c){this.section.actionsNode.style.visibility=
c?"":"hidden";var a=c?null:"cursorOnly";this.renderer.selectionPolicy=a;var b=this.getNavHandler();b&&b.setSelectionPolicy(a);c?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(c){j.node(c)&&this.commandRegistry.destroy(c)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var c=this;this.actionsSections&&(this.actionsSections.forEach(function(a){delete c[a]}),delete this.actionsSections)},updateCommands:function(c){this.section.actionsNode&&
this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,c))},loaded:function(){var a=this;if(!this.selection&&!c)this.serviceRegistry||this.registry?(this.selection=new f.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(c){a.updateCommands(c.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry");var b=
this.registerCommands();!b||!b.then?a.updateCommands():b.then(function(){a.updateCommands()})}});if(a.renderer)a.renderer.section=this,b.mixin(a.renderer,{getCellHeaderElement:function(c){(c=Object.getPrototypeOf(this).getCellHeaderElement.call(this,c))&&this.section.setTitle(c.innerHTML);return null}})},createProgressMonitor:function(){return new e(this)},_setMonitorMessage:function(a,b){this._progressNode.style.visibility="visible";this._loading[a]=b;var c="",d;for(d in this._loading)c!==""&&(c+=
"\n"),c+=this._loading[d];this._progressNode.title=c},_monitorDone:function(a){delete this._loading[a];var a="",b;for(b in this._loading)a!==""&&(a+="\n"),a+=this._loading[b];this._progressNode.title=a;if(a==="")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(a,b){var c=this.twistie,d=this.id;c&&(c.classList.add(a?this._expandImageClass:this._collapseImageClass),c.classList.remove(a?this._collapseImageClass:this._expandImageClass));this._preferenceService&&b&&this._preferenceService.getPreferences("/window/views").then(function(c){c.put(d,a)});this._onExpandCollapse&&this._onExpandCollapse(a,this)}};a.prototype.constructor=a;e.prototype={begin:function(a){this.status=
a;this._section._setMonitorMessage(this.id,a)},worked:function(a){this.status=a;this._section._setMonitorMessage(this.id,a)},done:function(a){this.status=a;this._section._monitorDone(this.id)}};e.prototype.constructor=e;return{Section:a}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(j,k){function h(d){this._init(d)}h.prototype={_init:function(d){var b=d.parent,f=this,b=k.node(b);if(!b)throw j["no parent"];if(!d.model)throw j["no tree model"];if(!d.renderer)throw j["no renderer"];this._parent=b;this._treeModel=d.model;this._onComplete=d.onComplete;this._renderer=d.renderer;this._showRoot=d.showRoot===void 0?!1:d.showRoot;this._indent=d.indent===void 0?16:d.indent;this._onCollapse=d.onCollapse;
this._labelColumnIndex=d.labelColumnIndex===void 0?0:d.labelColumnIndex;this._id=d.id===void 0?"treetable":d.id;this._tableStyle=d.tableStyle;this._tableElement=d.tableElement||"table";this._tableBodyElement=d.tableBodyElement||"tbody";this._tableRowElement=d.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(a){f._showRoot?(a._depth=0,f._generate([a],0)):f._treeModel.getChildren(a,function(a){f.destroyed||f._generate(a,0)})})},destroy:function(){this.destroyed=!0},_generate:function(d,
b){k.empty(this._parent);var f=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(f);var a=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(a);a.id=this._id;this._tableStyle&&a.classList.add(this._tableStyle);this._renderer.initTable(a,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";d.length===0?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(d,b);a.appendChild(this._bodyElement);f.appendChild(a);this._parent.appendChild(f);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(d,b,f){for(var a=0;a<d.length;a++){var e=document.createElement(this._tableRowElement);e.id=this._treeModel.getId(d[a]);e._depth=b;e._item=d[a];this._renderer.render(d[a],e);e.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*b+"px";this._renderer.rowCallback&&this._renderer.rowCallback(e,d[a]);f?(this._bodyElement.insertBefore(e,f.nextSibling),f&&(f=e)):this._bodyElement.appendChild(e)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(d,b,f){var a=this._treeModel.getId(d),e;if(a===this._id)this._removeChildRows(a),this._generateChildren(b,0),this._rowsChanged();else{var i=k.node(a);i?(i._item=d,
i&&(f||i._expanded)?(this._removeChildRows(a),b?(i._expanded=!0,this._renderer.updateExpandVisuals(i,!0),this._generateChildren(b,i._depth+1,i),this._rowsChanged()):(e=this,this._renderer.updateExpandVisuals(i,"progress"),b=this._treeModel.getChildren(i._item,function(a){if(!e.destroyed&&(e._renderer.updateExpandVisuals(i,!0),!i._expanded))i._expanded=!0,e._generateChildren(a,i._depth+1,i),e._rowsChanged()}))):this._renderer.updateExpandVisuals(i,!1)):console.log(j["could not find table row "]+a)}},
getItem:function(d){var b=k.node(d);return b&&b._item?b._item:d},toggle:function(d){var b=k.node(d);b&&(b._expanded?this.collapse(d):this.expand(d))},isExpanded:function(d){d=typeof d==="string"?d:this._treeModel.getId(d);return(d=k.node(d))?d._expanded:!1},expand:function(d,b,f){var d=typeof d==="string"?d:this._treeModel.getId(d),a=k.node(d);if(a)if(a._expanded)b&&b.apply(e,f);else{var e=this;this._renderer.updateExpandVisuals(a,"progress");this._treeModel.getChildren(a._item,function(d){if(!e.destroyed){e._renderer.updateExpandVisuals(a,
!0);if(!a._expanded)a._expanded=!0,e._generateChildren(d,a._depth+1,a),e._rowsChanged();b&&b.apply(e,f)}})}},_removeChildRows:function(d){for(var b=d===this._id,f=!1,a=-1,e=[],i=k.$$array(".treeTableRow",this._parent),g=0;g<i.length;g++){var c=i[g];if(f)break;if(b)c._depth>a?e.push(c):f=!0;else if(c.id===d)b=!0,a=c._depth}for(d=0;d<e.length;d++)b=e[d],b.parentNode.removeChild(b)},collapse:function(d){var d=typeof d==="string"?d:this._treeModel.getId(d),b=k.node(d);if(b){if(!b._expanded)return;b._expanded=
!1;this._renderer.updateExpandVisuals(b,!1);this._removeChildRows(d);this._rowsChanged()}this._onCollapse&&this._onCollapse(b._item)},getIndent:function(){return this._indent}};h.prototype.constructor=h;return{TableTree:h}});
define("orion/treeModelIterator",[],function(){var j={};j.TreeModelIterator=function(){function j(h,d){this.firstLevelChildren=h;this.reset();this._init(d)}j.prototype={_init:function(h){if(h)this.isExpanded=h.isExpanded,this.isExpandable=h.isExpandable,this.forceExpandFunc=h.forceExpandFunc,this.getChildrenFunc=h.getChildrenFunc},topLevel:function(h){return h.parent?h.parent===this.root:!0},_getChildren:function(h){return typeof this.getChildrenFunc==="function"?this.getChildrenFunc(h):h?h.children:
null},_expanded:function(h){if(!h)return!0;var d=this._getChildren(h),d=d&&d.length>0;this.isExpanded&&d&&(d=this.isExpanded(h));return d},_expandable:function(h){return!h?!0:this.isExpandable?this.isExpandable(h):!1},_diveIn:function(h){return this._expanded(h)?(this.setCursor(this._getChildren(h)[0]),this.cursor()):null},_drillToLast:function(h){return this._expanded(h)?(h=this._getChildren(h),this._drillToLast(h[h.length-1])):h},_forward:function(h){if(!this._cursor)return null;var d=this._diveIn(this._cursor);
if(!d){if(h&&this._expandable(this._cursor)&&this.forceExpandFunc){var b=this;return this.forceExpandFunc(this._cursor,"first",function(d){d&&b.setCursor(d)})}(d=this._findSibling(this._cursor,!0))&&this.setCursor(d)}return d},_backward:function(h){if(!this._cursor)return null;var d=this._findSibling(this._cursor,!1);d&&d!==this._cursor.parent&&(d=this._drillToLast(d));if(h&&d&&this._expandable(d)&&this.forceExpandFunc&&d!==this._cursor.parent){var b=this;return this.forceExpandFunc(d,"last",function(d){d&&
b.setCursor(d)})}d&&this.setCursor(d);return d},_findSibling:function(h,d){for(var b=this.topLevel(h),f=this._getChildren(h.parent),f=b?this.firstLevelChildren:f,a=0;a<f.length;a++)if(f[a]===h)return a===0&&!d?b?null:h.parent:a===f.length-1&&d?b?null:this._findSibling(h.parent,d):d?f[a+1]:f[a-1];return null},_inParentChain:function(h,d){for(var b=h.parent;b;){if(b===d)return!0;b=b.parent}return!1},_getTopLevelParent:function(h){if(this.topLevel(h))return h;for(h=h.parent;h;){if(this.topLevel(h))return h;
h=h.parent}return null},_onCollapse:function(h){return this._expanded(h.parent)?h:this._onCollapse(h.parent)},_scan:function(h,d,b){this.setCursor(d);var f=[];for(f.push(d);;){if(this.iterate(h))f.push(this.cursor());else break;if(b===this.cursor())return f}return null},setCursor:function(h){this._prevCursor=this._cursor;this._cursor=h},setTree:function(h){this.firstLevelChildren=h;if(this.firstLevelChildren.length>0)this.root=this.firstLevelChildren[0].parent},scan:function(h,d){var b=this.cursor(),
f=this._scan(!0,h,d);f||(f=this._scan(!1,h,d));this.setCursor(b);return f},iterate:function(h,d){return h?this._forward(d):this._backward(d)},iterateOnTop:function(h,d){var b=this._findSibling(this._getTopLevelParent(this.cursor()),h);b?this.setCursor(b):d&&this.firstLevelChildren.length>0&&this.setCursor(h?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(h){if(!this._cursor)return null;return this._inParentChain(this._cursor,h)?(this.setCursor(h),
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 j}();return j});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(j,k,h){var d={},b=navigator.userAgent.indexOf("iPad")!==-1,f=window.navigator.platform.indexOf("Mac")!==-1;d.ExplorerNavHandler=function(){function a(a,b,d){this.explorer=a;this.model=this.explorer.model;this._navDict=b;this._listeners=[];this._selections=[];this._currentColumn=0;a=this._getEventListeningDiv();a.tabIndex=0;a.classList.add("selectionModelContainer");var c=this;this._modelIterator=
new k.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:d.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(a){return c.explorer.renderer.isExpandable(a)}:function(a){return c.isExpandable(a)},forceExpandFunc:this.explorer.forceExpandFunc?function(a,b,d){return c.explorer.forceExpandFunc(a,b,d)}:void 0});this._init(d);(!d||d.setFocus!==!1)&&a.focus();d=function(a){if(h.isFormElement(a.target))return!0;if(c.explorer.preventDefaultFunc&&c.explorer.preventDefaultFunc(a,
c._modelIterator.cursor()))return!0;if(a.keyCode===j.KEY.DOWN)return c.onDownArrow(a);else if(a.keyCode===j.KEY.UP)return c.onUpArrow(a);else if(a.keyCode===j.KEY.RIGHT)return c.onRightArrow(a);else if(a.keyCode===j.KEY.LEFT)return c.onLeftArrow(a);else if(a.keyCode===j.KEY.SPACE)return c.onSpace(a);else if(a.keyCode===j.KEY.ENTER)return c.onEnter(a)};a.addEventListener("keydown",d,!1);this._listeners.push({type:"keydown",listener:d});d=function(){if(c.explorer.onFocus)c.explorer.onFocus(!1);else c.toggleCursor(null,
!1)};a.addEventListener("blur",d,!1);this._listeners.push({type:"blur",listener:d});d=function(){if(c.explorer.onFocus)c.explorer.onFocus(!0);else c.toggleCursor(null,!0)};a.addEventListener("focus",d,!1);this._listeners.push({type:"focus",listener:d});this._parentDiv=a}a.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(a){this._linearGridMove=!1;if(a)this._selectionPolicy=a.selectionPolicy,this.gridClickSelectionPolicy=
a.gridClickSelectionPolicy||"none",this.preventDefaultFunc=a.preventDefaultFunc,this.postDefaultFunc=a.postDefaultFunc},_ctrlKeyOn:function(a){return f?a.metaKey:a.ctrlKey},removeListeners:function(){if(this._listeners)for(var a=0;a<this._listeners.length;a++)this._parentDiv.removeEventListener(this._listeners[a].type,this._listeners[a].listener,!1)},focus:function(){var a=this._getEventListeningDiv();a&&a.focus()},_getEventListeningDiv:function(a){return this.explorer.keyEventListeningDiv&&typeof this.explorer.keyEventListeningDiv===
"function"?this.explorer.keyEventListeningDiv(a):j.node(this.explorer._parentId)},isExpandable:function(a){return!a?!1:j.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(a)))?!0:!1},isExpanded:function(a){return!a?!1:this.explorer.myTree.isExpanded(this.model.getId(a))},refreshSelection:function(a,b){var d=this;this.explorer.selection&&this.explorer.selection.getSelections(function(c){d._clearSelection(b);for(var f=0;f<c.length;f++)d._selections.push(c[f]);d._selections.length>0?
d.cursorOn(d._selections[0],!0,!1,a):d.cursorOn(null,!1,!1,a);if(!(d._shiftSelectionAnchor&&d._inSelection(d._shiftSelectionAnchor)>=0))d._shiftSelectionAnchor=null})},refreshModel:function(a,b,d,c){this._currentColumn=0;this.topIterationNodes=[];this.model=b;this._navDict=a;if(this.model.getTopIterationNodes)this.topIterationNodes=this.model.getTopIterationNodes();else if(d)this.topIterationNodes=d;this._modelIterator.setTree(this.topIterationNodes);!c&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),
!1),this._modelIterator.reset());this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(a){for(var a=this.model.getId(a),b=0;b<this._selections.length;b++)if(a===this.model.getId(this._selections[b]))return b;return-1},_clearSelection:function(a){if(a)for(a=0;a<this._selections.length;a++)this._checkRow(this._selections[a],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(a){if(this._selectionPolicy!==
a)this._selectionPolicy=a,this._selectionPolicy==="cursorOnly"&&this._clearSelection(!0)},setSelection:function(a,b,d){if(this._selectionPolicy==="cursorOnly")b&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(a,!0);else if(this._isRowSelectable(a)){!b||this._selectionPolicy==="singleSelection"?(this._clearSelection(!0),this._checkRow(a,!1),this._selections.push(a),this._lastSelection=a):(b=this._inSelection(a),b>=0?(this._checkRow(a,!0),this._selections.splice(b,1)):(this._checkRow(a,
!1),this._selections.push(a),this._lastSelection=a));if(d)this._shiftSelectionAnchor=this._lastSelection;this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))}},moveColumn:function(a,b){a||(a=this.currentModel());var d=this._getGridChildren(a);if(d&&d.length>1||b===0&&d){b!==0&&this.toggleCursor(a,!1);var c=this._currentColumn,f=!0;c+=b;c<0?(this._linearGridMove&&b!==0&&(this._modelIterator.iterate(!1)?a=this.currentModel():f=!1),
c=f?d.length-1:this._currentColumn):c>=d.length&&(this._linearGridMove&&b!==0&&(this._modelIterator.iterate(!0)?a=this.currentModel():f=!1),c=f?0:this._currentColumn);this._currentColumn=c;b!==0&&this.toggleCursor(a,!0);return!0}return!1},_getGridChildren:function(a){return this._navDict?this._navDict.getGridNavHolder(a):null},getCurrentGrid:function(a){a||(a=this.currentModel());return(a=this._getGridChildren(a))&&a.length>0?a[this._currentColumn]:null},getAriaContainerElement:function(a){for(var b=
this._parentDiv,d;a&&a!==b&&(d=a.getAttribute("role"))!=="grid"&&d!=="tree"&&d!=="treegrid";)a=a.parentNode;return a===b?null:a},toggleCursor:function(a,b){var d=this.getRowDiv(a),c=this.getCurrentGrid(a);c?(d&&(b?d.classList.add("treeIterationCursorRow"):d.classList.remove("treeIterationCursorRow")),c.domNode&&(d=this.getAriaContainerElement(c.domNode),b?(c.domNode.classList.add("treeIterationCursor"),d&&d.setAttribute("aria-activedescendant",c.domNode.id)):c.domNode.classList.remove("treeIterationCursor"))):
d&&(b?d.classList.add("treeIterationCursorRow_Dotted"):d.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(a,b,d,c){var f,m;if(a||b){if(m===this._modelIterator.cursor())return;f=this._modelIterator.cursor();m=a;this._modelIterator.setCursor(m)}else f=this._modelIterator.prevCursor(),m=this._modelIterator.cursor();if(f!==m||b)if(this.toggleCursor(f,!1),!b||m){this.moveColumn(null,0);this.toggleCursor(m,!0);if((a=this.getRowDiv())&&
!c){c=a.parentNode;for(b=document.documentElement;c&&c!==b;){var h=window.getComputedStyle(c,null);if(!h)break;h=h.getPropertyValue("overflow-y");if(h==="auto"||h==="scroll")break;c=c.parentNode}c&&(b=!0,a.offsetTop<=c.scrollTop?(b=!1,d===void 0&&(d=!1)):a.offsetTop+a.offsetHeight>=c.scrollTop+c.clientHeight&&(b=!1,d===void 0&&(d=!0)),b||a.scrollIntoView(!d))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(f,m)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var a=
[],b=0;b<this._selections.length;b++)a.push(this.model.getId(this._selections[b]));return a},getRowDiv:function(a){a=a?a:this._modelIterator.cursor();if(!a)return null;var a=this.model.getId(a),b=this._navDict.getValue(a);return b&&b.rowDomNode?b.rowDomNode:j.node(a)},iterate:function(a,b,d,c){var f=null;if(this.topIterationNodes&&this.topIterationNodes.length!==0)if(c){c=this.currentModel();for((f=this._modelIterator.iterate(a,b))&&this._setCursorOnItem(a,d);f&&f.isNotSelectable;)(f=this._modelIterator.iterate(a,
b))&&this._setCursorOnItem(a,d);f||(this.cursorOn(c,!0,!1,!0),this._setCursorOnItem(a,d))}else(f=this._modelIterator.iterate(a,b))&&this._setCursorOnItem(a,d)},_setCursorOnItem:function(a,b){this.cursorOn(null,!1,a);if(b){var d=this._inSelection(this._modelIterator.prevCursor()),c=this._inSelection(this._modelIterator.cursor());d>=0&&c>=0?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(a,b){if(this.explorer.renderer._useCheckboxSelection&&
this._selectionPolicy!=="singleSelection"){var d=this.getRowDiv(a);if(d){var c=j.node(this.explorer.renderer.getCheckBoxId(d.id)),f=b?!c.checked:!0;if(f!==c.checked)this.explorer.renderer.onCheck(d,c,f,!0)}}else this._select(a,b)},_select:function(a){a||(a=this._modelIterator.cursor());var b=this.getRowDiv(a);b&&(this._inSelection(a)<0?b.classList.add("checkedRow"):b.classList.remove("checkedRow"))},_onModelGrid:function(a,b){var d=this._getGridChildren(a);if(d)for(var c=0;c<d.length;c++)if(b.target===
d[c].domNode)return!0;return!1},onClick:function(a,d){if(this.isDisabled(this.getRowDiv(a)))j.stop(d);else{var g=j.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(a)));if(d.target!==g&&!(this.gridClickSelectionPolicy==="none"&&this._onModelGrid(a,d)))if(this.cursorOn(a,!0,!1,!0),b)this.setSelection(a,!0);else if(this._ctrlKeyOn(d))this.setSelection(a,!0,!0);else if(d.shiftKey&&this._shiftSelectionAnchor){if(g=this._modelIterator.scan(this._shiftSelectionAnchor,a)){this._clearSelection(!0);
for(var c=0;c<g.length;c++)this.setSelection(g[c],!0)}}else this.setSelection(a,!1,!0)}},onCollapse:function(a){this._modelIterator.collapse(a)&&this.cursorOn()},onUpArrow:function(a){this.iterate(!1,!1,a.shiftKey,!0);!this._ctrlKeyOn(a)&&!a.shiftKey&&this.setSelection(this.currentModel(),!1,!0);a.preventDefault();return!1},onDownArrow:function(a){this.iterate(!0,!1,a.shiftKey,!0);!this._ctrlKeyOn(a)&&!a.shiftKey&&this.setSelection(this.currentModel(),!1,!0);a.preventDefault();return!1},_shouldMoveColumn:function(a){var b=
this.currentModel(),d=this._getGridChildren(b);return d&&d.length>1?this.isExpandable(b)?this._ctrlKeyOn(a):!0:!1},onLeftArrow:function(a){if(this._shouldMoveColumn(a))return this.moveColumn(null,-1),a.preventDefault(),!0;var b=this._modelIterator.cursor();if(!b)return!1;if(this.isExpandable(b)&&this.isExpanded(b))return this.explorer.myTree.collapse(b),a.preventDefault(),!0;this._modelIterator.topLevel(b)?this.explorer.scopeUp&&typeof this.explorer.scopeUp==="function"&&this.explorer.scopeUp():(this.cursorOn(b.parent),
this.setSelection(b.parent,!1,!0))},onRightArrow:function(a){if(this._shouldMoveColumn(a))return this.moveColumn(null,1),a.preventDefault(),!0;var b=this._modelIterator.cursor();if(!b)return!1;if(this.isExpandable(b)&&!this.isExpanded(b))return this.explorer.myTree.expand(b),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(b)),a.preventDefault(),!1},_isRowSelectable:function(a){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(a):!0},onSpace:function(a){this.setSelection(this.currentModel(),
!0,!0);a.preventDefault()},onEnter:function(a){var b=this.getCurrentGrid(this._modelIterator.cursor());if(b)if(b.widget)if(typeof b.onClick==="function")b.onClick();else typeof b.widget.focus==="function"&&b.widget.focus();else{var d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(a),!1,!1,!1,0,null);b.domNode.dispatchEvent(d)}else if(b=this._modelIterator.cursor()){if(this.explorer.renderer.getRowActionElement&&(d=this.explorer.renderer.getRowActionElement(this.model.getId(b)),
d.href))this._ctrlKeyOn(a)?window.open(d.href):window.location.href=d.href;if(this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(a,b),a.preventDefault(),!1}},setIsNotSelectable:function(a,b){a.isNotSelectable=b},disableItem:function(a){var b=this.getRowDiv(a);this.isExpandable(a)&&this.isExpanded(a)&&(this._modelIterator.collapse(a),this.explorer.myTree.toggle(b.id));b.classList.remove("checkedRow");b.classList.add("disabledNavRow");this.setIsNotSelectable(a,!0)},
isDisabled:function(a){return a.classList.contains("disabledNavRow")},enableItem:function(a){var b=this.getRowDiv(a);b&&(b.classList.remove("disabledNavRow"),this.setIsNotSelectable(a,!1))}};return a}();d.ExplorerNavDict=function(){function a(a){this._dict={};this._model=a}a.prototype={addRow:function(a,b){this._dict[this._model.getId(a)]={model:a,rowDomNode:b}},getValue:function(a){return this._dict[a]},getGridNavHolder:function(a,b){if(!a)return null;var d=this._model.getId(a);if(this._dict[d]){if(!this._dict[d].gridChildren&&
b)this._dict[d].gridChildren=[];return this._dict[d].gridChildren}return null},initGridNavHolder:function(a){if(!a)return null;a=this._model.getId(a);if(this._dict[a])this._dict[a].gridChildren=null}};return a}();return d});
define("orion/explorers/explorer","i18n!orion/nls/messages,require,orion/webui/littlelib,orion/webui/treetable,orion/explorers/explorerNavHandler,orion/commands".split(","),function(j,k,h,d,b,f){var a={};a.Explorer=function(){function a(b,d,c,e){this.registry=b;this.renderer=c;this.selection=d;this.commandService=e;if(this.renderer)this.renderer.explorer=this;this.myTree=null}a.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(a,b){this.myTree&&this.myTree.refresh.bind(this.myTree)(a,b,!0)},updateCommands:function(a){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(a)},makeNewItemPlaceHolder:function(a,b,c,d){a=this.getRow(a);if(c)return a=a.childNodes[c],a.appendChild(document.createElement("br")),d=document.createElement("span"),d.id=b+"placeHolderRow",a.appendChild(d),{tempNode:d,refNode:d};if(a){var e=document.createElement("tr");
e.id=b+"placeHolderRow";c=document.createElement("td");c.id=b+"placeHolderCol";e.appendChild(c);d?(a.parentNode.insertBefore(e,a.nextSibling),a=parseInt(a.firstChild.style.paddingLeft),c.style.paddingLeft=this.myTree.getIndent()+a+"px"):a.appendChild(e);d=h.node(b+"placeHolderRow");a=h.node(b+"placeHolderCol");if(d&&a)return{tempNode:d,refNode:a}}return null},getRow:function(a){if(a=this.model.getId(a))return h.node(a)},collapseAll:function(){for(var a=this._navHandler.getTopLevelNodes(),b=0;b<a.length;b++)this.myTree.collapse(a[b])},
expandAll:function(a){if(a)this._expandRecursively(a);else if(this._navHandler)for(var a=this._navHandler.getTopLevelNodes(),b=0;b<a.length;b++)this._expandRecursively(a[b])},_expandRecursively:function(a){if(this._navHandler&&this._navHandler.isExpandable(a)){var b=this;this.myTree.expand(a,function(){b.model.getChildren(a,function(a){if(!(a===void 0||a===null))for(var d=a.length,e=0;e<d;e++)b._expandRecursively(a[e])})})}},createTree:function(a,g,c){a=typeof a==="string"?a:a.id||a;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var e=a+"innerTree",f=h.node(e);f&&h.empty(f);if(g)g.rootId=e;this.model=g;this._parentId=a;this._treeOptions=c;if(!c||c&&!c.noSelection)this.selectionPolicy=c?c.selectionPolicy:"",this._navDict=new b.ExplorerNavDict(this.model);this.myTree=new d.TableTree({id:e,model:g,parent:a,onComplete:c?c.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:c?!!c.showRoot:
!1,indent:c?c.indent:void 0,onCollapse:c?c.onCollapse:void 0,navHandlerFactory:c?c.navHandlerFactory:void 0,tableElement:c?c.tableElement:void 0,tableBodyElement:c?c.tableBodyElement:void 0,tableRowElement:c?c.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 a=this.getNavHandler(),b=[];
if(a&&this.getNavDict())for(var c=a.getSelection(),d=0;d<c.length;d++){var e=a.getRowDiv(c[d]);e&&e.parentNode&&(e=this.getNavDict().getValue(this.model.getId(c[d])),e.model&&b.push(e.model))}this.selection.setSelections(b)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var a=this._treeOptions;if(!a||a&&!a.noSelection){if(!this.getNavHandler())this._navHandler=a&&a.navHandlerFactory&&typeof a.navHandlerFactory.createNavHandler===
"function"?a.navHandlerFactory.createNavHandler(this,this._navDict,a):new b.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:a?a.getChildrenFunc:null,setFocus:a&&a.setFocus,selectionPolicy:a?a.selectionPolicy:null});var d=this;this.model.getRoot(function(c){c instanceof Array?d.getNavHandler().refreshModel(d.getNavDict(),d.model,c):c.children&&c.children instanceof Array&&d.getNavHandler().refreshModel(d.getNavDict(),d.model,c.children);a&&a.setFocus&&d.getNavHandler().cursorOn(null,!1,!1,!0)})}},
_lastHash:null,checkbox:!1};return a}();a.createExplorerCommands=function(a,b){function d(a){return typeof a.getItemCount==="function"?a.getItemCount()>0?b?b(a):!0:!1:!1}var c=new f.Command({tooltip:j["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()}}),l=new f.Command({tooltip:j["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()}});a.addCommand(c);a.addCommand(l)};a.ExplorerModel=function(){function a(b,d,c){this.rootPath=b;this.fetchItems=d;this.idPrefix=c||""}a.prototype={destroy:function(){this.destroyed=!0},getRoot:function(a){var b=this;this.fetchItems(this.rootPath).then(function(c){b.root=c;a(c)})},getChildren:function(a,b){a.Children?b(a.Children):a.ChildrenLocation?this.fetchItems(a.ChildrenLocation).then(function(c){a.Children=
c;b(c)}):b([])},getId:function(a){if(a.Location===this.root.Location)return this.rootId;for(var a=a.Location.replace(/[\\\/]/g,""),b=this.idPrefix,c=0;c<a.length;c++)b+=a[c].match(/[^\.\:\-\_0-9A-Za-z]/g)?a.charCodeAt(c):a[c];return b}};return a}();a.ExplorerFlatModel=function(){function b(a,d,c){this.rootPath=a;this.fetchItems=d;this.root=c}b.prototype=new a.ExplorerModel;b.prototype.getRoot=function(a){if(this.root)a(this.root);else{var b=this;this.fetchItems(this.rootPath).then(function(c){b.root=
c;a(c)})}};b.prototype.getChildren=function(a,b){a===this.root?b(this.root):b([])};return b}();a.ExplorerRenderer=function(){function a(b,d){this.explorer=d;this._init(b);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}a.prototype={_init:function(a){if(a){this._useCheckboxSelection=a.checkbox===void 0?!1:a.checkbox;this.selectionPolicy=a.singleSelection?
"singleSelection":"";this._cachePrefix=a.cachePrefix;this.getCheckedFunc=a.getCheckedFunc;this.onCheckedFunc=a.onCheckedFunc;this._highlightSelection=!0;this._treeTableClass=a.treeTableClass||"treetable";if(a.highlightSelection===!1)this._highlightSelection=!1;if(!this.actionScopeId)this.actionScopeId=a.actionScopeId;if(!this.commandService)this.commandService=a.commandService}},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(a,b){this.tableTree=b;this.tableNode=
a;h.empty(a);this._treeTableClass&&a.classList.add(this._treeTableClass);this.renderTableHeader(a)},getActionsColumn:function(a,b,c,d,e){var c=c||"tool",f=document.createElement("td");f.id=b.id+"actionswrapper";d&&f.classList.add(d);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,f,a,this.explorer,c,null,e&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!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(a,b){if(this._useCheckboxSelection){var c=document.createElement("td"),d=document.createElement("span");d.id=this.getCheckBoxId(b.id);d.classList.add("core-sprite-check");d.classList.add("selectionCheckmarkSprite");d.rowId=b.id;if(this.getCheckedFunc)d.checked=this.getCheckedFunc(a),d.checked?(this._highlightSelection&&b.classList.add("checkedRow"),d.classList.add("core-sprite-check_on")):
(this._highlightSelection&&b.classList.remove("checkedRow"),d.classList.remove("core-sprite-check_on"));c.appendChild(d);var e=this;d.addEventListener("click",function(a){e.onCheck(b,a.target,a.target.checked?!1:!0,!0)},!1);return c}},getCheckBoxId:function(a){return a+"selectedState"},onCheck:function(a,b,c,d,e){(b.checked=c)?b.classList.add("core-sprite-check_on"):b.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(b.rowId,c,d);this.explorer.getNavHandler()&&e&&this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(a.id).model,
!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var a=this.explorer.getNavHandler().getSelectionIds(),b=this._getUIStatePreferencePath();b&&window.sessionStorage&&(window.sessionStorage[b+"selection"]=JSON.stringify(a))}},_restoreSelections:function(a){var b=this.explorer.getNavDict(),c=this.explorer.getNavHandler();if(c&&b&&c.getSelectionPolicy()!=="cursorOnly"&&(a=window.sessionStorage[a+"selection"],typeof a==="string"&&(a=a.length>0?JSON.parse(a):null),a)){for(var d=[],c=0;c<
a.length;c++){var e=b.getValue(a[c]);if(e&&e.rowDomNode&&e.model&&(d.push(e.model),this._highlightSelection&&e.rowDomNode.classList.add("checkedRow"),e=h.node(this.getCheckBoxId(e.rowDomNode.id))))e.checked=!0,e.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(d),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(a){window.sessionStorage[a+"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(a){var b=
!1,c=window.sessionStorage[a+"expanded"];typeof c==="string"&&(c=c.length>0?JSON.parse(c):null);var d;if(c)for(d=0;d<c.length;d++)if(h.node(c[d])){this._expanded.push(c[d]);var e=this;this.tableTree.expand(c[d],function(){e._restoreSelections(a)});b=!0}return!b},_getUIStatePreferencePath:function(){if(this.explorer){var a=this.explorer.getRootPath();if(this._cachePrefix&&a)return"/"+this._cachePrefix+"/"+a.replace(/[^\.\:\-\_0-9A-Za-z]/g,"")+"/uiState"}return null},expandCollapseImageId:function(a){return a+
"__expand"},updateExpandVisuals:function(a,b){var c=h.node(this.expandCollapseImageId(a.id));c&&(c.classList.remove(this._expandImageClass),c.classList.remove(this._collapseImageClass),c.classList.remove(this._progressImageClass),c.classList.add(b==="progress"?this._progressImageClass:b?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(a,b,c,d){var e=document.createElement("span");e.id=this.expandCollapseImageId(a.id);b.appendChild(e);e.classList.add(this._twistieSpriteClass);
e.classList.add(this._collapseImageClass);if(c){var f=document.createElement("span");b.appendChild(f);f.classList.add(d||"imageSprite");f.classList.add(c)}var h=this;e.onclick=function(){if(!h.explorer.getNavHandler().isDisabled(a)){h.tableTree.toggle(a.id);if(h.tableTree.isExpanded(a.id))h._expanded.push(a.id),h.explorer.postUserExpand&&h.explorer.postUserExpand(a.id);else for(var c in h._expanded)if(h._expanded[c]===a.id){h._expanded.splice(c,1);break}(c=h._getUIStatePreferencePath())&&window.sessionStorage&&
h._storeExpansions(c)}};return e},render:function(a,b){b.classList.add("navRow");this.renderRow(a,b)},rowsChanged:function(){this.explorer.selectionPolicy!=="cursorOnly"&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());(h.$(".sectionTreeTable",this.tableNode.parentNode)||h.$(".treetable",this.tableNode.parentNode))&&h.$$array(".treeTableRow",this.tableNode).forEach(function(a,b){var c=!(b%2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",d=c==="darkSectionTreeTableRow"?"lightSectionTreeTableRow":
"darkSectionTreeTableRow";a.classList.add(c);a.classList.remove(d)})},updateCommands:function(){if(this.commandService)for(var a=h.$$array(".treeTableRow"),b=0;b<a.length;b++){var c=a[b],d=h.node(c.id+"actionswrapper");this.commandService.destroy(d);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,d,c._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=[];var a=this._getUIStatePreferencePath();a&&window.sessionStorage&&this._restoreExpansions(a)&&this._restoreSelections(a)}};
return a}();a.SelectionRenderer=function(){function b(a,d){this._init(a);this.explorer=d}b.prototype=new a.ExplorerRenderer;b.prototype.renderTableHeader=function(a){var b=document.createElement("thead"),c=document.createElement("tr");b.classList.add("navTableHeading");this._useCheckboxSelection&&c.appendChild(this.initCheckboxColumn(a));for(var d=0,e=this.getCellHeaderElement(d);e;)e.innerHTML.length>0&&e.classList.add("navColumn"),c.appendChild(e),e=this.getCellHeaderElement(++d);b.appendChild(c);
d>0&&a.appendChild(b)};b.prototype.renderRow=function(a,b){b.verticalAlign="baseline";b.classList.add("treeTableRow");var c=this.explorer.getNavDict();if(c){c.addRow(a,b);var d=this;b.addEventListener("click",function(c){if(d.explorer.getNavHandler())d.explorer.getNavHandler().onClick(a,c)},!1)}if(c=this.getCheckboxColumn(a,b))c.classList.add("checkColumn"),b.appendChild(c);for(var c=0,e=this.getCellElement(c,a,b);e;)b.appendChild(e),c===0?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle(a)):
e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++c,a,b)};b.prototype.getCellHeaderElement=function(){};b.prototype.getCellElement=function(){};return b}();a.SimpleFlatModel=function(){function b(a,d,c){this.items=a;this.getKey=c;this.idPrefix=d;this.root={children:a}}b.prototype=new a.ExplorerModel;b.prototype.getRoot=function(a){a(this.root)};b.prototype.getId=function(a){for(var a=
this.getKey(a).replace(/[\\\/]/g,""),b="",c=0;c<a.length;c++)b+=a[c].match(/[^\.\:\-\_0-9A-Za-z]/g)?a.charCodeAt(c):a[c];return this.idPrefix+b};b.prototype.getChildren=function(a,b){a===this.root?b(this.items):b([])};return b}();return a});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(j){function k(h,d,b){j.attach(this);this._binderFunc=d;this.setInputField(h);(h=b?b.group:null)||(h=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=h+"__completion__";this._proposeFromStart=b?b.proposeFromStart:!1;this._extendedProvider=b?b.extendedProvider:null;this._serviceRegistry=b?b.serviceRegistry:null;this._onDelete=b?b.onDelete:null;this._deleteToolTips=
b?b.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];b=function(b){this._binderFunc&&this._binderFunc(function(a){this._bind(a);b.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",b);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:b});b=function(){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",b);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:b});b=function(){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",b);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:b})}k.prototype._removeListeners=function(h){h&&h.forEach(function(d){d.evtTarget.removeEventListener(d.type,d.handler,!1)})};k.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};k.prototype.hasValueOf=function(h){return this._dataList.some(function(d){return d.value===h})};k.prototype.setInputField=function(h){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=h;if(typeof this._inputField==="string")this._inputField=document.getElementById(this._inputField);h=function(){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):this._dismiss()}.bind(this);this._inputField.addEventListener("blur",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:h});h=function(d){this.onKeyDown(d)}.bind(this);this._inputField.addEventListener("keydown",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:h});h=function(){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",h);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:h});h=function(){if(this._dismissed&&this._binderFunc)this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(d){this._bind(d)}.bind(this))}.bind(this);this._inputField.addEventListener("focus",h);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:h})};k.prototype.onKeyDown=function(h){if(this._dismissed)return!0;var d=h.charCode||h.keyCode;if(d===13){if(this._proposalList&&this._proposalList.length>0&&this._proposalIndex>=
0&&this._proposalIndex<this._proposalList.length)return h.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,h.ctrlKey),h.stopPropagation(),!1}else if((d===40||d===38)&&this._proposalList&&this._proposalList.length>0)return h.preventDefault(),this._walk(d===40),h.stopPropagation(),!1;else if(d===27)return h.preventDefault(),this._dismiss(),!1;else if(d===46&&this._proposalIndex>-1&&this._onDelete)return h.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),h.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(h){this._dataList=h};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(h,d,b,f){var a=
document.createElement("a");a.href=require.toUrl(d);a.appendChild(this._createBoldText(h,b,f));return a};k.prototype._createBoldText=function(h,d,b,f){if(d<0)return document.createTextNode(h);var f=f?f:document.createElement("span"),a;0!==d&&(a=document.createTextNode(h.substring(0,d)),f.appendChild(a));var e=document.createElement("b");f.appendChild(e);a=document.createTextNode(h.substring(d,d+b));e.appendChild(a);d+b<h.length&&(a=document.createTextNode(h.substring(d+b)),f.appendChild(a));return f};
k.prototype._proposeOnCategory=function(h,d){if(d.length!==0){var b;if(h){b=document.createElement("li");b.className="inputCompletionLICategory";var f=document.createTextNode(h);b.appendChild(f);this._completionUL.appendChild(b)}d.forEach(function(a){b=document.createElement("li");b.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);b.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);b.className="inputCompletionLINormal";b.completionItem=a.item;
var d;if(typeof a.item.value==="string"){var f=document.createElement("table");f.style.width="100%";f.style.tableLayout="fixed";f.style.borderSpacing="0";var g=document.createElement("tr");g.style.width=this._inputField.offsetWidth+"px";f.appendChild(g);var c=document.createElement("td");c.classList.add("inputCompletionLILeftTD");var l=this._createBoldText(a.item.value,a.boldIndex,a.boldLength);c.appendChild(l);c.style.overflow="hidden";g.appendChild(c);if(this._onDelete)d=document.createElement("button"),
d.classList.add("inputCompletionDismissButton"),d.classList.add("layoutRight"),d.classList.add("core-sprite-close"),d.classList.add("imageSprite"),d.style.display="none",d.style.margin="0 0 0",d.title=this._deleteToolTips,d.onclick=function(c){c.stopPropagation();this._onDelete(a.item.value,this);this._resetIndexAfterDeletion()}.bind(this),c=document.createElement("td"),c.classList.add("inputCompletionLIRightTD"),c.appendChild(d),g.appendChild(c);b.appendChild(f)}else a.item.value.name&&a.item.value.type===
"link"&&b.appendChild(this._createProposalLink(a.item.value.name,a.item.value.value,a.boldIndex,a.boldLength));this._completionUL.appendChild(b);this._proposalList.push({item:a.item,domNode:b,deleteBtn:d})}.bind(this))}};k.prototype._domNode2Index=function(h){if(this._proposalList)for(var d=0;d<this._proposalList.length;d++)if(this._proposalList[d].domNode===h)return d;return-1};k.prototype._highlight=function(h,d){var b=h,f,a=!1;if(!isNaN(b))a=!0,this._proposalList&&h>=0&&h<this._proposalList.length?
(b=this._proposalList[h].domNode,f=this._proposalList[h].deleteBtn):b=null;if(b){b.className=d?"inputCompletionLISelected":"inputCompletionLINormal";if(f)f.style.display=d?"":"none";d&&a&&(b.offsetTop<this._completionUIContainer.scrollTop?b.scrollIntoView(!0):b.offsetTop+b.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&b.scrollIntoView(!1))}};k.prototype._selectProposal=function(h,d){var b=h;isNaN(b)&&(b=this._domNode2Index(h));if(b!==this._proposalIndex||
d)this._highlight(this._proposalIndex,!1),this._proposalIndex=b,this._highlight(this._proposalIndex,!0)};k.prototype._dismiss=function(h,d){if(!this._mouseDown){this._dismissed=!0;this._proposalList=null;this._proposalIndex=-1;if(typeof h==="string")this._inputField.value=h,this._dismissing=!0,this._inputField.focus();else if(h&&h.name&&h.type==="link")d?window.open(h.value):window.location.href=h.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 h=0,d=0,b=this._inputField;b;)h+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=d+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=h+"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(h){h=this._proposalIndex+(h?1:-1);h<-1?h=this._proposalList.length-1:h>=this._proposalList.length&&(h=-1);this._selectProposal(h)};k.prototype._proposeOnList=function(h,d,b){var f="",a=[],e=d?d.length:0;h.forEach(function(i){if(i.type==="category")this._proposeOnCategory(f,a),f=i.label,a=[];else{var g=!0,c=-1;if(d&&b){var l;typeof i.value==="string"?l=i.value.toLowerCase():i.value.name&&(l=i.value.name.toLowerCase());
c=l.indexOf(d);c<0?g=!1:this._proposeFromStart&&(g=c===0)}g&&a.push({item:i,boldIndex:c,boldLength:e})}}.bind(this));this._proposeOnCategory(f,a)};k.prototype._proposeOn=function(h){this._completionUL.textContent="";var d=h?h.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,d,!0);this._extendedProvider&&d?this._extendedProvider(h,function(b){b&&b.forEach(function(b){this._proposeOnList(b.proposals,b.filterForMe?d:h,b.filterForMe)}.bind(this));this._show()}.bind(this),[]):
this._show()};k.prototype.constructor=k;return{InputCompletion:k}});
define("orion/widgets/filesystem/filesystemSwitcher","i18n!orion/edit/nls/messages,orion/objects,orion/webui/littlelib,orion/i18nUtil,orion/commands,orion/URL-shim".split(","),function(j,k,h,d,b){function f(a){this.commandRegistry=a.commandRegistry;this.rootChangeListener=a.rootChangeListener;this.filesystemChangeDispatcher=a.filesystemChangeDispatcher;this.fileClient=a.fileClient;this.node=a.node;this.serviceRegistry=a.serviceRegistry;var b=this;this.listener=function(a){b.refresh(a.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);h.empty(this.node);this.rootChangeListener=this.filesystemChangeDispatcher=this.listener=this.node=null},registerCommands:function(){if(!this.commandsRegistered){this.commandsRegistered=!0;var a=this.commandRegistry,d=this.serviceRegistry,
f=new b.Command({name:j.ChooseFS,imageClass:"core-sprite-openarrow",selectionClass:"dropdownSelection",tooltip:j.ChooseFSTooltip,id:"orion.nav.switchfs",visibleWhen:function(){return d.getServiceReferences("orion.core.file").length>1},choiceCallback:this._switchFsMenuCallback.bind(this)});a.addCommand(f);a.registerCommandContribution("orion.mininav","orion.nav.switchfs",1)}},_switchFsMenuCallback:function(){var a=this;return this.serviceRegistry.getServiceReferences("orion.core.file").map(function(b){var b=
b.getProperty("top"),d=a._fileServiceLabel(b,!0);return{checked:a.fileSystem===d,name:d,callback:a.setActiveFilesystem.bind(a,b)}})},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 a=h.$(".dropdownTrigger",this.menu);if(a){var b=document.createEvent("MouseEvents");b.initEvent("click",!0,!0);a.dispatchEvent(b)}},_fileServiceHostname:function(a){a=this.fileClient.fileServiceRootURL(a);a.indexOf("filesystem:")===0&&(a=a.substr(11));var b=a;try{b=(new URL(a,window.location.href)).hostname}catch(d){}return b},_fileServiceLabel:function(a,
b){var f=this.fileClient.fileServiceName(a),g=this._fileServiceHostname(a);if(b)return d.formatMessage(j.FSTitle,f,g);var c=document.createDocumentFragment();c.textContent=j.FSTitle;h.processDOMNodes(c,[document.createTextNode(f),document.createTextNode(g)]);return c},refresh:function(a){var b=a;if(a.ChildrenLocation)b=a.ChildrenLocation;h.empty(this.fsName);this.fileSystem=this._fileServiceLabel(b,!0);this.fsName.appendChild(this._fileServiceLabel(b));this.commandRegistry.destroy(this.menu);this.commandRegistry.renderCommands("orion.mininav",
this.menu,{},"menu")},setActiveFilesystem:function(a){var b=a;if(a.ChildrenLocation)b=a.ChildrenLocation;a=this.fileClient.fileServiceRootURL(b);this.filesystemChangeDispatcher&&this.filesystemChangeDispatcher.dispatchEvent({type:"filesystemChanged",newInput:a})}});return{FilesystemSwitcher:f}});define("text!orion/globalSearch/searchBuilder.html",[],function(){return'\t<div class="searchOptionBlock">\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<input type="text" class="search-control" style="min-width:20em;" id="advSearchInput"></input>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<span id="advSearchCmd" ></span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<input type="text" class="search-control" style="min-width:20em;" id="advReplaceInput"></input>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<span id="advReplacePreviewCmd" ></span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n\t<div class="searchOptionBlock">\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<label id="advSearchTypeLabel"  class="search-label"></label>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<select id="advSearchTypes" class="search-control" style="min-width:10em;"></select>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<label id="advSortByLabel"  class="search-label"></label>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<select id="advSortBy" class="search-control" style="min-width:10em;"></select>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<label id="advSearchCaseSensitiveLabel" class="search-label" ></label>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type="checkbox" id="advSearchCaseSensitive" class="search-control"></input>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<label id="advSearchRegExLabel"  class="search-label"></label>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type="checkbox" id="advSearchRegEx" class="search-control"></input>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n\t<div class="searchOptionBlock">\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<input type="text" class="search-control" style="min-width:20em;" id="advSaveSearchInput"></input>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<span id="advSaveSearchCmd" ></span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n\t<div class="searchOptionBlock" id="moreOptions">\n\t</div>'});
define("orion/globalSearch/advSearchOptContainer","i18n!orion/search/nls/messages,require,orion/fileClient,orion/searchUtils,orion/contentTypes,orion/i18nUtil,orion/webui/littlelib,orion/inputCompletion/inputCompletion,orion/Deferred,orion/commands,orion/section,orion/objects,orion/EventTarget,orion/widgets/filesystem/filesystemSwitcher,text!orion/globalSearch/searchBuilder.html".split(","),function(j,k,h,d,b,f,a,e,i,g,c,l,m,p,o){function q(a,c,b,e){m.attach(this);this._parentDiv=a;this._searcher=
c;this._serviceRegistry=b;this._commandService=e;this.fileClient=new h.FileClient(this._serviceRegistry);this.fsToolbar=null;this.fileSysChangeListener=function(a){a=d.generateSearchHref({resource:a.newInput});window.location=a};this.addEventListener("filesystemChanged",this.fileSysChangeListener);if(!this.fsToolbar)a=this.fsToolbar=document.createElement("div"),a.classList.add("fsToolbarLayout"),a.classList.add("fsToolbar"),this._parentDiv.parentNode.insertBefore(a,this._parentDiv);this.fsSwitcher=
new p.FilesystemSwitcher({commandRegistry:this._commandService,rootChangeListener:this,filesystemChangeDispatcher:this,fileClient:this.fileClient,node:this.fsToolbar,serviceRegistry:this._serviceRegistry})}function v(c,b,d,e){this._parent=a.node(c);this._optRenderer=new q(this._parent,b,d,e);this._optRenderer.render()}l.mixin(q.prototype,{destroy:function(){this.removeEventListener("filesystemChanged",this.fileSysChangeListener);this.fileSysChangeListener=null},getOptions:function(a){var c;a&&(c=
this._searchParams?this._searchParams.resource:this._searcher.getSearchRootLocation());return{keyword:this._searchBox.value,sort:this._sortBy.options[this._sortBy.selectedIndex].value,rows:40,start:0,replace:this._replaceBox.value?this._replaceBox.value:void 0,caseSensitive:this._caseSensitiveCB.checked,regEx:this._regExCB.checked,fileType:this._fileTypes.options[this._fileTypes.selectedIndex].value,resource:c}},loadSearchParams:function(a){this._searchParams=a;this._locationName=null;this.dispatchEvent({type:"rootChanged",
root:this.fileClient.fileServiceRootURL(this._searchParams.resource)});if(this._searchParams.resource.length>0)this._serviceRegistry.getService("orion.page.progress").progress(this.fileClient.read(this._searchParams.resource,!0),"Getting file metadata "+this._searchParams.resource).then(function(a){var c=a.Parents?d.fullPathNameByMeta(a.Parents):"";this._locationName=c.length===0?a.Name:c+"/"+a.Name;if(this._searchNameBox)this._searchNameBox.value=this._getDefaultSaveName()}.bind(this),function(){this._locationName=
"root";if(this._searchNameBox)this._searchNameBox.value=this._getDefaultSaveName()}.bind(this));else if(this._locationName="root",this._searchNameBox)this._searchNameBox.value=this._getDefaultSaveName();this._loadSearchParams()},_loadSearchParams:function(){if(this._init&&this._searchParams){this._searchBox.value=this._searchParams.keyword?this._searchParams.keyword:"";this._replaceBox.value=this._searchParams.replace?this._searchParams.replace:"";this._caseSensitiveCB.checked=this._searchParams.caseSensitive;
this._regExCB.checked=this._searchParams.regEx;var a;for(a=0;a<this._fileTypes.options.length;a++)if(this._fileTypes.options[a].value===this._searchParams.fileType){this._fileTypes.selectedIndex=a;break}for(a=0;a<this._sortBy.options.length;a++)if(this._sortBy.options[a].value===this._searchParams.sort){this._sortBy.selectedIndex=a;break}}},render:function(){var a=this._serviceRegistry.getService("orion.core.contentTypeRegistry");a?a.getContentTypes().then(function(a){this.contentTypesCache=a;this._render()}.bind(this)):
(a=new b.ContentTypeRegistry(this._serviceRegistry),this.contentTypesCache=a.getContentTypes(),this._render())},_render:function(){this._parentDiv.innerHTML=o;this._initHTMLLabels();this._initControls();this._searchBox.focus()},_submitSearch:function(){var a=this.getOptions();a.replace=null;d.doSearch(this._searcher,this._serviceRegistry,a.keyword,a)},_replacePreview:function(){var a=this.getOptions();if(!a.replace)a.replace="";a.keyword&&d.doSearch(this._searcher,this._serviceRegistry,a.keyword,
a)},_saveSearch:function(){if(this._searchBox.value&&this._searchNameBox.value){var a=this.getOptions(!0),a=d.generateSearchHref(a).split("#")[1];this._serviceRegistry.getService("orion.core.savedSearches").addSearch(this._searchNameBox.value,a)}},_getDefaultSaveName:function(){if(this._searchBox&&this._searchBox.value){var a="'"+this._searchBox.value+"' in ",c="root";if(this._locationName)c=this._locationName;return a+c}return""},_initCompletion:function(){var a=function(a){d.getMixedSearches(this._serviceRegistry,
!0,!1,function(c){var b,d=[],e=!1,g=!1;for(b in c)c[b].label&&c[b].value?(e||(d.push({type:"category",label:j["Saved searches"]}),e=!0),d.push({type:"proposal",value:{name:c[b].label,value:k.toUrl("search/search.html")+"#"+c[b].value,type:"link"}})):(g||(d.push({type:"category",label:j["Recent searches"]}),g=!0),d.push({type:"proposal",label:c[b].name,value:c[b].name}));a(d)})}.bind(this),c=function(a,c){var b=this._serviceRegistry.getServiceReferences("orion.search.proposal");if(!b||b.length===0)c(null);
else{var d=[];b.forEach(function(c){var b=c.getProperty("filterForMe");d.push(this._serviceRegistry.getService(c).run(a).then(function(a){for(var c={filterForMe:b,proposals:[]},d=0;d<a.length;d++){c.proposals.push({type:"category",label:a[d].category});for(var n=0;n<a[d].datalist.length;n++)c.proposals.push({type:"proposal",label:a[d].datalist[n],value:a[d].datalist[n]})}return c}))}.bind(this));i.all(d).then(function(a){c(a)})}}.bind(this);this._completion=new e.InputCompletion(this._searchBox,a,
{serviceRegistry:this._serviceRegistry,group:"globalSearch",extendedProvider:c,onDelete:function(a,c){d.removeRecentSearch(this._serviceRegistry,a,c)}.bind(this),deleteToolTips:j["Click or use delete key to delete the search term"]})},_initControls:function(){this._searchBox=document.getElementById("advSearchInput");this._replaceBox=document.getElementById("advReplaceInput");this._searchNameBox=document.getElementById("advSaveSearchInput");this._fileTypes=document.getElementById("advSearchTypes");
this._sortBy=document.getElementById("advSortBy");this._caseSensitiveCB=document.getElementById("advSearchCaseSensitive");this._regExCB=document.getElementById("advSearchRegEx");for(var a=[{label:j["All types"],value:d.ALL_FILE_TYPE}],c=0;c<this.contentTypesCache.length;c++)if(this.contentTypesCache[c]["extends"]==="text/plain"||this.contentTypesCache[c].id==="text/plain")for(var b=0;b<this.contentTypesCache[c].extension.length;b++)a.push({label:this.contentTypesCache[c].extension[b],value:this.contentTypesCache[c].extension[b]});
a.forEach(function(a){var c=document.createElement("option"),b=document.createTextNode(a.label);c.appendChild(b);this._fileTypes.appendChild(c);c.value=a.value}.bind(this));[{label:j["Path name"],value:"Path asc"},{label:j["File name"],value:"NameLower asc"}].forEach(function(a){var c=document.createElement("option"),b=document.createTextNode(a.label);c.appendChild(b);this._sortBy.appendChild(c);c.value=a.value}.bind(this));this._init=!0;this._loadSearchParams();this._initCompletion();this._searchBox.addEventListener("keydown",
function(a){a.defaultPrevented||(a.charCode||a.keyCode)===13&&this._submitSearch()}.bind(this));this._searchBox.addEventListener("change",function(){this._searchNameBox.value=this._getDefaultSaveName()}.bind(this));this._replaceBox.addEventListener("keydown",function(a){(a.charCode||a.keyCode)===13&&this._replacePreview()}.bind(this));this._fileTypes.addEventListener("change",function(){var a=this._fileTypes.options[this._fileTypes.selectedIndex].value;this._searchBox.placeholder=a===d.ALL_FILE_TYPE?
j["Type a search term"]:f.formatMessage(j["All ${0} files"],a)}.bind(this));a=new g.Command({name:j.Search,id:"orion.globalSearch.search",callback:function(){this._submitSearch()}.bind(this),visibleWhen:function(){return!0}});c=new g.Command({name:j.Replace,id:"orion.globalSearch.previewCurrentPage",callback:function(){this._replacePreview()}.bind(this),visibleWhen:function(){return!0}});b=new g.Command({name:j.Save,tooltip:j["Save the current search"],id:"orion.globalSearch.saveSearch",callback:function(){this._saveSearch()},
visibleWhen:function(){return!0}});this._commandService.addCommand(a);this._commandService.addCommand(c);this._commandService.addCommand(b);this._commandService.registerCommandContribution("advSearchCmd","orion.globalSearch.search",1);a=[];this._commandService.renderCommands("advSearchCmd","advSearchCmd",this,this,"button",null,a);a[0].domNode.classList.add("search-button");this._commandService.registerCommandContribution("advReplacePreviewCmd","orion.globalSearch.previewCurrentPage",1);a=[];this._commandService.renderCommands("advReplacePreviewCmd",
"advReplacePreviewCmd",this,this,"button",null,a);a[0].domNode.classList.add("search-button");this._commandService.registerCommandContribution("advSaveSearchCmd","orion.globalSearch.saveSearch",1);a=[];this._commandService.renderCommands("advSaveSearchCmd","advSaveSearchCmd",this,this,"button",null,a);a[0].domNode.classList.add("search-button")},_initHTMLLabels:function(){document.getElementById("advSearchInput").placeholder=j["Type a search term"];document.getElementById("advReplaceInput").placeholder=
j["Type a replace term"];document.getElementById("advSaveSearchInput").placeholder=j["Type a name for the search"];document.getElementById("advSearchTypeLabel").appendChild(document.createTextNode(j["File type"]));document.getElementById("advSearchCaseSensitiveLabel").appendChild(document.createTextNode(j["Case sensitive"]));document.getElementById("advSearchRegExLabel").appendChild(document.createTextNode(j["Regular expression"]));document.getElementById("advSortByLabel").appendChild(document.createTextNode(j["Sort by"]))}});
v.prototype.getRenderer=function(){return this._optRenderer};v.prototype.constructor=v;return{AdvSearchOptContainer:v,AdvSearchOptRenderer:q}});
define("orion/searchOutliner","i18n!orion/search/nls/messages,require,orion/webui/littlelib,orion/i18nUtil,orion/section,orion/commands,orion/commandRegistry,orion/keyBinding,orion/selection,orion/explorers/explorer,orion/EventTarget,orion/globalSearch/advSearchOptContainer,orion/webui/splitter".split(","),function(j,k,h,d,b,f,a,e,i,g,c,l,m){function p(a){this._searches=[];c.attach(this);this._init(a);this._initializeSearches()}function o(a,c){this.explorer=c;this._init(a)}function q(a,c){this.selection=
c;this.registry=a;this.renderer=new o({checkbox:!1},this)}function v(c){var b=h.node(c.parent);if(!b)throw"no parent";if(!c.serviceRegistry)throw"no service registry";this._parent=b;this._registry=c.serviceRegistry;this.commandService=c.commandService;var b=new f.Command({name:j.Rename,imageClass:"core-sprite-rename",id:"eclipse.renameSearch",parameters:new a.ParametersDescription([new a.CommandParameter("name","text","Name:","")]),visibleWhen:function(a){a=Array.isArray(a)?a:[a];return a.length===
1&&a[0].query},callback:function(a){var c=Array.isArray(a.items)?a.items[0]:a.items;a.parameters&&a.parameters.valueFor("name")&&this._registry.getService("orion.core.savedSearches").renameSearch(c.query,a.parameters.valueFor("name"))}.bind(this)}),e=new f.Command({name:"Delete",imageClass:"core-sprite-delete",id:"eclipse.deleteSearch",visibleWhen:function(a){a=Array.isArray(a)?a:[a];if(a.length===0)return!1;for(var c=0;c<a.length;c++)if(!a[c].query)return!1;return!0},callback:function(a){var a=Array.isArray(a.items)?
a.items:[a.items],b=a.length===1?d.formatMessage("Are you sure you want to delete '${0}' from the searches?",a[0].name):d.formatMessage("Are you sure you want to delete these ${0} searches?",a.length);if(window.confirm(b))for(b=0;b<a.length;b++)c.serviceRegistry.getService("orion.core.savedSearches").removeSearch(a[b].query)}});this.commandService.addCommand(b);this.commandService.addCommand(e);if(b=this._registry.getService("orion.core.savedSearches")){var n=this._registry;b.getSearches().then(function(a){this.render(a.searches,
n)}.bind(this));b.addEventListener("searchesChanged",function(a){this.render(a.searches,a.registry)}.bind(this))}}function s(a){var c=h.node(a.parent);if(!c)throw"no parent";if(!a.serviceRegistry)throw"no service registry";this._parent=c;this._registry=a.serviceRegistry;this.commandService=a.commandService;this.advSearchOptContainer=new l.AdvSearchOptContainer(this._parent,a.searcher,this._registry,this.commandService);var a=h.node("outlineContainer"),b=h.$("#outlineTop",a),d=h.$("#outlineBottom",
a),e=h.$(".outlinerSplitLayout",a);e.id="searchOutlineSplitter";window.setTimeout(function(){this._splitter=new m.Splitter({node:e,sidePanel:b,mainPanel:d,toggle:!0,vertical:!0,closeReversely:!0})},100)}p.prototype={_init:function(a){this._registry=a.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.savedSearches",this)},_notifyListeners:function(){this.dispatchEvent({type:"searchesChanged",searches:this._searches,registry:this._registry})},_initializeSearches:function(){var a=
this;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var b,c=c.get("search");typeof c==="string"&&(c=JSON.parse(c));if(c)for(b in c)a._searches.push(c[b]);a._notifyListeners()})},_storeSearches:function(){var a=this._searches;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("search",a)})},addSearch:function(a,c){var b=!1,n;for(n in this._searches)if(this._searches[n].query===c)this._searches[n].name=
a,b=!0;b?this._registry.getService("orion.page.message").setProgressResult({Message:d.formatMessage(j["${0} is already saved"],a),Severity:"Warning"}):this._searches.push({name:a,query:c});this._searches.sort(this._sorter);this._storeSearches();this._notifyListeners()},removeSearch:function(a){for(var c in this._searches)if(this._searches[c].query===a){this._searches.splice(c,1);break}this._searches.sort(this._sorter);this._storeSearches();this._notifyListeners()},renameSearch:function(a,c){var b=
!1,d;for(d in this._searches)if(this._searches[d].query===a){var e=this._searches[d];if(e.name!==c)e.name=c,b=!0}b&&(this._searches.sort(this._sorter),this._storeSearches(),this._notifyListeners())},getSearches:function(){return{searches:this._searches}},_sorter:function(a,c){var b=a.name.toLowerCase(),d=c.name.toLowerCase();return b>d?1:b<d?-1:0}};o.prototype=g.SelectionRenderer.prototype;o.prototype.constructor=o;o.prototype.getLabelColumnIndex=function(){return 0};o.prototype.getCellElement=function(a,
c,b){if(c.query){var a=k.toUrl("search/search.html")+"#"+c.query,d=document.createElement("td");b.appendChild(d);d.classList.add("mainNavColumn");d.classList.add("singleNavColumn");b=document.createElement("a");b.href=a;b.className="navlinkonpage";d.appendChild(b);b.appendChild(window.document.createTextNode(c.name))}};q.prototype=g.Explorer.prototype;q.prototype.constructor=q;v.prototype={render:function(a,c){var d=this.commandService;if(!this.searchesSection){this.searchesSection=new b.Section(this._parent,
{id:"searchSection",title:j["My Saved Searches"],content:'<div id="searchContent"></div>',useAuxStyle:!0,preferenceService:c.getService("orion.core.preference"),slideout:!0});this.searchSelection=new i.Selection(c,"orion.searches.selection");var n=this.searchesSection.selectionNode.id,t;t=new e.KeyBinding(113);t.domScope="searchContent";t.scopeName=j["My Saved Searches"];this.commandService.registerCommandContribution(n,"eclipse.renameSearch",1,null,!1,t);t=new e.KeyBinding(46);t.domScope="searchContent";
t.scopeName=j["My Saved Searches"];this.commandService.registerCommandContribution(n,"eclipse.deleteSearch",2,null,!1,t);d.registerSelectionService(n,this.searchSelection);c.getService("orion.searches.selection").addEventListener("selectionChanged",function(a){var c=h.node(n);c&&(d.destroy(c),d.renderCommands(n,c,a.selections,this,"button"))})}if(a.length>0)this.searchTable=(new q(c,this.searchSelection)).createTree("searchContent",new g.SimpleFlatModel(a,"srch",function(a){return a.query}));else if(t=
h.node("searchContent")){var f=document.createElement("p");f.textContent=j["Save frequently used searches by clicking on the ${0} button above."];var z=document.createElement("b");z.textContent=j.Save;h.processDOMNodes(f,[z]);h.empty(t);t.appendChild(f)}}};v.prototype.constructor=v;s.prototype={loadSearchParams:function(a){this.advSearchOptContainer.getRenderer().loadSearchParams(a)}};s.prototype.constructor=v;return{SavedSearches:p,SearchOutliner:v,SearchBuilder:s}});
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(j,k,h,d,b,f,a,e){function i(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 g(c,d,e,g,h,j,r,u,w){var d=f.clone(d),n;if(d.Directory)n=document.createElement("a"),
n.className="navlinkonpage",n.href=!c?l:(new a(c+"#{,resource,params*}")).expand({resource:d.ChildrenLocation}),d.Name&&n.appendChild(document.createTextNode(d.Name));else{h||(h=b.getOpenWithCommands(e));n=document.createElement("a");n.className="navlink targetSelector";j&&typeof j==="object"&&Object.keys(j).forEach(function(a){n[a]=j[a]});var t=null,y=null;if(t=u?u.holderDom:n)y=document.createElement("span"),y.className="core-sprite-file modelDecorationSprite thumbnail",t.appendChild(y);d.Name&&
n.appendChild(document.createTextNode(d.Name));var z=d.Location;if(r&&typeof r==="object")d.params={},f.mixin(d.params,r);(c=b.getOpenWithCommand(e,d,h))&&(z=c.hrefCallback({items:d}));k.when(g.getFileContentType(d),function(a){if(t){var c=t,b=y;if(a){var e,g=a.imageClass,f=a.image;if(g)e=document.createElement("span"),e.className+=g,e.classList.add("thumbnail");else if(f)e=document.createElement("img"),e.src=f,e.classList.add("thumbnail");e&&c.replaceChild(e,b)}}n.href=z;w&&typeof w.updateFileNode===
"function"&&w.updateFileNode(d,n,i(a))})}return n}function c(a,c,b,d){this.explorer=c;this.commandService=b;this.contentTypeService=d;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var l=new a("#{,resource,params*}");c.prototype=new h.SelectionRenderer;c.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};c.prototype.tableCallback=function(a){a.setAttribute("aria-label",j.Navigator);a.setAttribute("role","presentation")};c.prototype.rowCallback=
function(a){a.setAttribute("role","treeitem")};c.prototype.emptyCallback=function(a){var c=document.createElement("tr"),b=document.createElement("td");b.colSpan=this.oneColumn?1:3;var d=document.createElement("div");d.classList.add("noFile");d.textContent=j.NoFile;var g=document.createElement("span");g.appendChild(document.createTextNode(j.File));e.processDOMNodes(d,[g]);b.appendChild(d);c.appendChild(b);a.appendChild(c)};c.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"}};c.prototype.setTarget=function(a){this.target=a};c.prototype.getFolderImage=function(){if(!this.showFolderImage)return null;var a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};c.prototype.createFolderNode=function(a){var c;this.showFolderLinks?(c=g(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&c.insertBefore(a,c.firstChild)):
(c=document.createElement("span"),c.textContent=a.Name);return c};c.prototype.updateFileNode=function(){};c.prototype.showFolderLinks=!0;c.prototype.getCellElement=function(a,c,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 i;if(c.Directory)this.getExpandImage(e,f),i=this.createFolderNode(c),f.appendChild(i),this.explorer._makeDropTarget(c,
i),this.explorer._makeDropTarget(c,e);else{if(!this.openWithCommands)this.openWithCommands=b.getOpenWithCommands(this.commandService);i=g("",c,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this);f.appendChild(i)}if(i)i.id=e.id+"NameLink",i.nodeType===1&&(d.addNavGrid(this.explorer.getNavDict(),c,i),i.setAttribute("role","link"),i.setAttribute("tabindex","-1"));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,f,c,this.explorer,
"tool",null,!0);return a;case 1:if(this.oneColumn)return null;e=document.createElement("td");if(c.LocalTimeStamp)e.textContent=(new Date(c.LocalTimeStamp)).toLocaleString();return e;case 2:if(this.oneColumn)return null;e=document.createElement("td");if(!c.Directory&&typeof c.Length==="number")c=parseInt(c.Length,10)/1024,e.textContent=Math.ceil(c).toLocaleString()+" KB";e.style.textAlign="right";return e}};c.prototype.constructor=c;return{NavigatorRenderer:c,isImage:i,createLink:g}});
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(j,k,h,d,b,f,a,e,i){function g(a,c){this.serviceRegistry=a;this.commandRegistry=c;this.openWithCommands=null}function c(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new g(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}g.prototype.makeRenderFunction=function(c,g,f,o,q){var v=this.serviceRegistry,s=this.commandRegistry;this.openWithCommands=this.openWithCommands||e.createOpenWithCommands(v,c,s);var r=this;return function(e,v,n,t){i.when(r.openWithCommands,function(y){if(n)h.empty(g),y=document.createElement("div"),y.appendChild(document.createTextNode(j["Search failed."])),g.appendChild(y),typeof o==="function"&&o(g);else{var i=
function(){function a(c,b){var d=b.folderName?b.folderName:b.path,n=document.createElement("span");n.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");n.appendChild(document.createTextNode(" - "+d+" "));c.appendChild(n)}var c={};return function(b,d){var n=d.name;if(c.hasOwnProperty(n)){a(b,d);var e=c[n];typeof e==="function"&&(c[n]=null,e())}else c[n]=function(){a(b,d)}}}(),D=!1;h.empty(g);if(e&&e.length>0){var E=document.createElement("table");E.setAttribute("role","presentation");for(var B=0;B<e.length;B++){var F=
e[B],C;if(!D&&(D=!0,f))C=E.insertRow(0).insertCell(0),C.textContent=f;C=E.insertRow(-1).insertCell(0);C.colspan=2;q&&q(C);var G={Name:F.name,Directory:F.directory,Location:F.path||F.location},x=null;if(typeof F.LineNumber==="number")x={},x.line=F.LineNumber;if(t&&t.keyword&&!t.nameSearch){var A=b.generateSearchHelper(t),x=x||{};x.find=A.inFileQuery.searchStr;x.regEx=A.inFileQuery.wildCard?!0:void 0}G=a.createLink(k.toUrl("edit/edit.html"),G,s,c,y,{"aria-describedby":(F.folderName?F.folderName:F.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},x);F.LineNumber&&G.appendChild(document.createTextNode(" (Line "+F.LineNumber+")"));C.appendChild(G);i(C,F)}g.appendChild(E);typeof o==="function"&&o(g)}!D&&v&&(y=d.formatMessage(j["No matches found for ${0}"],v),h.empty(g),g.appendChild(document.createTextNode(y)),typeof o==="function"&&o(g))}})}};c.prototype={search:function(a,c,d){var e=function(a){for(var d=[],e=0;e<a.response.docs.length;e++){var g=a.response.docs[e],f=g.Location,n=b.path2FolderName(g.Path?
g.Path:g.Location,g.Name),t=n?n:f;(c?t.indexOf(c)>=0:1)&&d.push({name:g.Name,path:f,folderName:n,directory:g.Directory,lineNumber:g.LineNumber})}return d};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(c){d(e(c),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(c){var b=a.keyword,b=b.substring(b.indexOf("}")+1),b=b.substring(b.indexOf(":")+1);d(e(c),b,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(c){d(e(c),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(c){d(e(c),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,c){console.error(a);h.empty(c);c.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,c){var b="",e=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);c&&a&&a.Parents&&a.Parents.length>0?e=c.index==="last"?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(e=a);if(e)this.setLocationbyURL(e.Location),b=e.Name,this._childrenLocation=e.ChildrenLocation;else if(a)this.setLocationbyURL(this._searchRootLocation),
b=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation;e=h.node("search");b||(b="");if(e&&e.placeholder){e.value="";var g=d.formatMessage(j["Search ${0}"],b);e.placeholder=g.length>30?g.substring(0,27)+"...":d.formatMessage(j["Search ${0}"],b)}if(e&&e.title)e.title=j["Type a keyword or wild card to search in "]+b},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,c,b,d){b=b?this.getSearchRootLocation():this.getSearchLocation();return c?{resource:b,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:b,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}}};c.prototype.constructor=c;return{Searcher:c}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(j,k){function h(a,b,d){return a[b].apply(a,d)}function d(a){this._location=a}function b(){var a=new k;a.reject(j["No Matching OperationService for location:"]+this._location);return a}function f(a){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=a.getService("orion.core.preference");for(var b=a.getServiceReferences("orion.core.operation"),
f=0;f<b.length;f++){var g=a.getService(b[f]);this._services[f]=g;g=b[f].getProperty("pattern")||".*";g[0]!=="^"&&(g="^"+g);this._patterns[f]=RegExp(g)}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 d(a)}}d.prototype={getOperation:b,getOperations:b,removeCompletedOperations:b,removeOperation:b,cancelOperation:b};d.prototype.constructor=d;f.prototype={getOperations:function(){var a=
new k;if(this._operations)return a.resolve(this._operations),a;var b=this;this._preferenceService.getPreferences("/operations").then(function(d){b._operations=d;a.resolve(b._operations)});return a},getOperation:function(a){return h(this._getService(a),"getOperation",arguments)},removeCompletedOperations:function(){for(var a=[],b=this,d=0;d<this._services.length;d++){var g=this._patterns[d],c=new k;a[d]=c.promise;h(this._services[d],"removeCompletedOperations").then(function(a){return function(c){Array.isArray(c)&&
b.getOperations.bind(b)().then(function(b){for(var d=b.keys(),e=0;e<d.length;e++){var f=d[e];g.test(f)&&c.indexOf(f)<0&&b.remove(f)}a.resolve()})}}(c),function(a){return function(c){a.reject(c)}}(c))}return k.all(a)},removeOperation:function(a){var b=this;return h(this._getService(a),"removeOperation",arguments).then(function(){b.getOperations.bind(b)().then(function(b){b.remove(a)})},function(a){return a},function(a){return a})}};f.prototype.constructor=f;return{OperationsClient:f}});
define("text!orion/globalSearch/search-features.html",[],function(){return'<div id="replaceTopWidget_id" style="height:100%;width:100%;position:relative;">\n\t<div id="replaceTop" class="topPanelLayout">\n\t</div>\n\t<div class="replaceSplitLayout"></div>\n\t<div id="replaceBottom" class="bottomPanelLayout">\n\t</div>\n</div>'});
define("orion/globalSearch/search-features",["orion/webui/littlelib","orion/webui/splitter","orion/globalCommands","text!orion/globalSearch/search-features.html"],function(j,k,h,d){var b=b||{};b.SearchUIFactory=function(){function b(a){this._parentDivID=a.parentDivID}b.prototype={buildUI:function(){var a=j.node(this._parentDivID);a.innerHTML=d;var b=j.$("#replaceTop",a),f=j.$("#replaceBottom",a),a=j.$(".replaceSplitLayout",a);a.id="replaceSplitter";var g=new k.Splitter({node:a,sidePanel:b,mainPanel:f,
vertical:!0});window.setTimeout(function(){g._adjustToSplitPosition(!0)},100);g.addResizeListener(function(a){a===f&&this._compareWidget&&this._compareWidget.resizeEditors&&this._compareWidget.resizeEditors()}.bind(this));var c=h.getMainSplitter();c&&c.splitter&&c.splitter.addResizeListener(function(a){a===c.main&&this._compareWidget&&this._compareWidget.getSplitter()&&this._compareWidget.getSplitter()._adjustToSplitPosition(!0)}.bind(this))},destroy:function(){},setCompareWidget:function(a){this._compareWidget=
a},getMatchDivID:function(){return"replaceTop"},getCompareDivID:function(){return"replaceBottom"}};return b}();return b});define("text!orion/compare/sideBySideTemplate.html",[],function(){return'<div id="topWidget_id" style="height:100%;width:100%;position:relative">\n\t<div class="leftPanelLayout ">\n\t\t<div class="titleActionContainer">\n\t\t\t<div class="compareActionContainer" id="left_action_id"></div>\n\t\t\t<div class="titleContainer" id="left_title_id"></div>\n\t\t</div>\n\t\t<div class="compareEditorParent" id="left_editor_id"></div>\n\t\t<div class="statusContainer" id="left_status_id"></div>\n\t</div>\n\t<div class="split compareSplitLayout"></div>\n\t<div class="rightPanelLayout">\n\t\t<div class="titleActionContainer">\n\t\t\t<div class="compareActionContainer" id="right_action_id"></div>\n\t\t\t<div class="titleContainer" id="right_title_id"></div>\n\t\t</div>\n\t\t<div class="compareEditorParent"  id="right_editor_wrapper_id">\n\t\t\t<div class="canvasContainer">\n\t\t\t\t<canvas id="diff_canvas_id" class="compareCanvas" width="46" height="3000"></canvas>\n\t\t\t</div>\n\t\t\t<div class="compareEditorParentWithCanvas" id="right_editor_id"></div>\n\t\t</div>\n\t\t<div class="statusContainer" id="right_status_id"></div>\n\t</div>\n</div>'});
define("orion/compare/compareUIFactory",["orion/webui/littlelib","orion/webui/splitter","text!orion/compare/sideBySideTemplate.html"],function(j,k,h){var d=d||{};d.TwoWayCompareUIFactory=function(){function b(b){this._parentDivID=b.parentDivID;this._commandSpanId=b.commandSpanId;this._showTitle=b.showTitle;this._leftTitle=b.leftTitle;this._rightTitle=b.rightTitle;this._showLineStatus=b.showLineStatus}b.prototype={_init:function(){var b=this._parentDivID+"_";this._topWidgetDiv=j.node("topWidget_id");
this._topWidgetDiv.id=b+"topWidget_id";this._leftEditorParentDiv=j.node("left_editor_id");this._leftEditorParentDiv.id=b+"left_editor_id";this._rightEditorParentDiv=j.node("right_editor_id");this._rightEditorParentDiv.id=b+"right_editor_id";this._rightEditorWrapperDiv=j.node("right_editor_wrapper_id");this._rightEditorWrapperDiv.id=b+"right_editor_wrapper_id";this._leftActionDiv=j.node("left_action_id");this._leftActionDiv.id=b+"left_action_id";this._rightActionDiv=j.node("right_action_id");this._rightActionDiv.id=
b+"right_action_id";this._leftTitleDiv=j.node("left_title_id");this._leftTitleDiv.id=b+"left_title_id";this._rightTitleDiv=j.node("right_title_id");this._rightTitleDiv.id=b+"right_title_id";this._leftStatusDiv=j.node("left_status_id");this._leftStatusDiv.id=b+"left_status_id";this._rightStatusDiv=j.node("right_status_id");this._rightStatusDiv.id=b+"right_status_id";this._diffCanvasDiv=j.node("diff_canvas_id");this._diffCanvasDiv.id=b+"diff_canvas_id";this._splitterId=b+"orion_splitter";this._showTitle||
this.disableTitle();this._showLineStatus||this.disableLineStatus()},_createSplitter:function(){var b=j.$(".split",this._topWidgetDiv);b.id=this._splitterId;var a=j.$(".leftPanelLayout",this._topWidgetDiv),d=j.$(".rightPanelLayout",this._topWidgetDiv);if(b&&a&&d)this._splitter=new k.Splitter({node:b,sidePanel:a,mainPanel:d})},buildUI:function(){j.node(this._parentDivID).innerHTML=h;this._init();this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(b){return j.$(".leftPanelLayout",
this._topWidgetDiv)===b},getEditorParentDiv:function(b){return b?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(b){return b?this._leftTitleDiv:this._rightTitleDiv},getActionDivId:function(b){return b?this._leftActionDiv.id:this._rightActionDiv.id},getStatusDiv:function(b){return b?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},getDiffCanvasDiv:function(){return this._diffCanvasDiv},disableTitle:function(){this._leftEditorParentDiv.style.top=
"0px";this._rightEditorWrapperDiv.style.top="0px";this._leftTitleDiv.style.height="0px";this._rightTitleDiv.style.height="0px"},disableLineStatus:function(){this._leftEditorParentDiv.style.marginBottom="0px";this._rightEditorWrapperDiv.style.marginBottom="0px";this._leftStatusDiv.style.height="0px";this._rightStatusDiv.style.height="0px"}};return b}();return d});
define("orion/compare/nls/root/messages",{"Copy current change from right to left":"Copy current change from right to left","Copy current change from left to right":"Copy current change from left to right","Switch to unified diff":"Switch to unified diff",Unified:"Unified","Switch to side by side diff":"Switch to side by side diff","Side by side":"Side by side","Generate link of the current diff":"Generate link of the current diff","Generate Link":"Generate Link","Next diff block":"Next diff block",
"Previous diff block":"Previous diff block","Next diff change":"Next diff change","Previous diff change":"Previous diff change","Copy the link URL:":"Copy the link URL:",Compare:"Compare","Open the compare page":"Open the compare page","fetching...":"fetching...","There are unsaved changes.":"There are unsaved changes.","ERROR: ":"ERROR: ","Compare...":"Compare...","files changed":" files changed",Location:"Location",Options:"Options","Sort by folders":"Sort by folders","Line 0 : Col 0":"Line 0 : Col 0",
"No Matching DiffService for location:":"No Matching DiffService for location:","${0} files compared. The two folders are identical.":"${0} files compared. The two folders are identical."});define("orion/compare/nls/messages",["orion/i18n!orion/compare/nls/messages","orion/compare/nls/root/messages"],function(j,k){var h={root:k};Object.keys(j).forEach(function(d){typeof h[d]==="undefined"&&(h[d]=j[d])});return h});
define("orion/compare/diffParser",[],function(){var j=j||{};j.DiffParser=function(){function j(d,b){this._lineDelimiter=d?d:h?"\r\n":"\n";this._diffLineDelimiter=b?b:this._lineDelimiter;this._DEBUG=!1}var h=window.navigator.platform.indexOf("Win")!==-1;j.prototype={_init:function(){this._oFileContents=[];this._diffContents=[];this._oBlocks=[];this._nBlocks=[];this._hunkRanges=[];this._lastToken=" ";this._deltaMap=[];this._nFileContents=[];this._nNewLineAtEnd=this._oNewLineAtEnd=!0;this._diffContentIndex=
1},setLineDelim:function(d){this._diffLineDelimiter=this._lineDelimiter=d},getDiffArray:function(){return{array:this._diffContents,index:this._diffContentIndex}},parse:function(d,b,f,a){this._init();if(b==="")return{outPutFile:d,mapper:[]};this._oFileContents=d===""?[]:d.split(this._lineDelimiter);this._diffContents=b.split(this._diffLineDelimiter);b=this._diffContents.length;this._hunkRanges=[];for(var e=0;e<b;e++){var i=this._parseHunkRange(e);i&&this._hunkRanges.push(i)}if(0===this._hunkRanges.length)return{outPutFile:d,
mapper:[]};this._DEBUG&&(console.log("***Diff contents: \n"),this._diffContents.forEach(function(a){console.log(a)}),console.log("***Hunk ranges: \n"),console.log(JSON.stringify(this._hunkRanges)));for(d=0;d<this._hunkRanges.length;d++)this._parseHunkBlock(d);this._DEBUG&&(console.log("***Original Hunk range blocks: \n"),console.log(JSON.stringify(this._oBlocks)),console.log("***New Hunk range blocks: \n"),console.log(JSON.stringify(this._nBlocks)));this._buildMap(f);this._DEBUG&&(console.log("***New Line at end of file(original): \n"),
console.log(JSON.stringify(this._oNewLineAtEnd)),console.log("***New Line at end of file(new): \n"),console.log(JSON.stringify(this._nNewLineAtEnd)),console.log("***Mapper: \n"),this._logMap(),console.log("***Total line number in original file: "+this._oFileContents.length));a||this._buildNewFile();return{outPutFile:this._nFileContents.join(this._diffLineDelimiter),mapper:this._deltaMap}},_logMap:function(){for(var d=0;d<this._deltaMap.length;d++)if(console.log(JSON.stringify(this._deltaMap[d])),
this._deltaMap[d][2]>0){console.log("    **Diff content on change/add: \n");for(var b=0;b<this._deltaMap[d][0];b++)console.log("    "+this._diffContents[this._deltaMap[d][2]+b-1])}},_logNewFile:function(){for(var d=0;d<this._nFileContents.length;d++)console.log(this._nFileContents[d])},_createBlock:function(d,b,f,a){a===f&&d===" "||(f=[f,a-f,"s"],d==="-"?f[2]="r":d==="+"?f[2]="a":d==="c"&&(f[2]="c"),b.push(f))},_createMinusBlock:function(d,b,f){var a=this._oBlocks.length;a===0||d!==this._oBlocks[a-
1][0]?(this._oBlocks.push([d===0?1:d,f]),this._nBlocks.push([b,0,-2])):this._oBlocks[a-1][1]+=f},_createPlusBlock:function(d,b,f,a){var e=this._nBlocks.length;e===0||b!==this._nBlocks[e-1][0]?(this._oBlocks.push([d===0?1:d,0]),this._nBlocks.push([b,f,a])):(this._nBlocks[e-1][1]+=f,this._nBlocks[e-1][2]=a)},_parseHunkBlock:function(d){for(var b=" ",f=this._hunkRanges[d][0]+1,a=d===this._hunkRanges.length-1?this._diffContents.length:this._hunkRanges[d+1][0],e=0,i=0,g=this._hunkRanges[d][1],c=this._hunkRanges[d][3],
l=f,h=f;h<a;h++)if(0!==this._diffContents[h].length){var j=this._diffContents[h][0];if(j==="\\"&&("\\ No newline at end of file"===this._diffContents[h].substring(0,this._diffContents[h].length-1)||"\\ No newline at end of file"===this._diffContents[h]))b==="-"?this._oNewLineAtEnd=!1:b===" "?this._oNewLineAtEnd=this._nNewLineAtEnd=!1:this._nNewLineAtEnd=!1,h>f&&this._diffContents[h-1][this._diffContents[h-1].length-1]==="\r"&&(this._diffContents[h-1]=this._diffContents[h-1].substring(0,this._diffContents[h-
1].length-1));else{switch(j){case "-":case "+":case " ":break;default:continue}if(b!==j){j==="+"&&(l=h);switch(b){case " ":g=this._hunkRanges[d][1]+e;c=this._hunkRanges[d][3]+i;break;case "-":this._createMinusBlock(g,c,this._hunkRanges[d][1]+e-g);break;case "+":this._createPlusBlock(g,c,this._hunkRanges[d][3]+i-c,l)}b=j}switch(j){case "-":e++;break;case "+":i++;break;case " ":e++,i++}}}switch(b){case "-":this._createMinusBlock(g,c,this._hunkRanges[d][1]+e-g);break;case "+":this._createPlusBlock(g,
c,this._hunkRanges[d][3]+i-c,l)}},_detectConflictes:function(d,b){if(d<0)return!1;for(var f=d+b,a=d;a<f;a++){var e=this._diffContents[a];if(e.indexOf("<<<<<")>-1||e.indexOf(">>>>>")>-1)return!0}return!1},_buildMap:function(d){var b=this._oBlocks.length,f=this._oFileContents.length,a=0,e;e=1;for(var i=0;i<b;i++)e=this._oBlocks[i][0]-e,e>0&&(this._deltaMap.push([e,e,0]),a+=e),d&&this._detectConflictes(this._nBlocks[i][2],this._nBlocks[i][1])?this._deltaMap.push([this._nBlocks[i][1],this._oBlocks[i][1],
this._nBlocks[i][2]+1,1]):this._deltaMap.push([this._nBlocks[i][1],this._oBlocks[i][1],this._nBlocks[i][2]+1]),a+=this._oBlocks[i][1],e=this._oBlocks[i][0]+this._oBlocks[i][1];0<f-e&&(this._deltaMap.push([f-e+1,f-e+1,0]),a+=f-e+1);a<f&&(e=f-a,d=this._deltaMap[this._deltaMap.length-1],d[2]===0?(d[0]+=e,d[1]+=e):d[2]===-1?this._deltaMap.push([e,e,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([e,e,0]):(this._nNewLineAtEnd&&(d[0]+=e),this._oNewLineAtEnd&&(d[1]+=e)))},_buildNewFile:function(){var d=
1,b=!1,f=this._deltaMap.length,a,e;for(a=0;a<f;a++){b=!1;if(this._deltaMap[a][2]===0){for(e=0;e<this._deltaMap[a][0];e++)this._nFileContents.push(this._oFileContents[d+e-1]);b=!0}else if(this._deltaMap[a][2]>0)for(e=0;e<this._deltaMap[a][0];e++)this._nFileContents.push(this._diffContents[this._deltaMap[a][2]+e-1].substring(1));d+=this._deltaMap[a][1]}this._nNewLineAtEnd&&!b&&this._nFileContents.push("")},_converHRangeBody:function(d,b){if(d){var f=parseInt(d,10);b.push(f>=0?f:1)}else b.push(1)},_parseHunkRange:function(d){var b=
this._diffContents[d],f=/^@@\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/,a=/^@@\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/.exec(b),e=null;if(a&&a.length===5)e=[d],this._converHRangeBody(a[1],e),this._converHRangeBody(a[2],e),this._converHRangeBody(a[3],e),this._converHRangeBody(a[4],e);else if((a=f.exec(b))&&a.length===5)e=[d],this._converHRangeBody(a[3],e),this._converHRangeBody(a[4],e),this._converHRangeBody(a[1],e),this._converHRangeBody(a[2],
e);return e}};return j}();return j});
define("orion/compare/compareUtils",["orion/URITemplate"],function(j){var k=k||{};k.compareUtils=k.compareUtils||{};k.compareUtils.lookUpMapper=function(h,d,b){for(var f=0,a=0;a<h.length;a++){var e=h[a][d];e===0&&(e=1);if(b>=f&&b<f+e)return{mapperIndex:a,startFrom:f};if(a===h.length-1)break;f+=h[a][d]}return{mapperIndex:h.length-1,startFrom:f}};k.compareUtils.lookUpLineIndex=function(h,d,b){if(b===0)return 0;for(var f=0,a=0;a<b;a++)f+=h[a][d];return f};k.compareUtils.updateMapper=function(h,d,b,f,
a){if(f!==a&&(f>0||a>0)){var e=k.compareUtils.lookUpMapper(h,d,b);if(!(e.mapperIndex<0)){if(f>0)for(var i=b-e.startFrom,b=e.mapperIndex;b<h.length;b++){i=h[b][d]-i;if(f<=i){h[b][d]-=f;break}h[b][d]-=i;f-=i;i=0}a>0&&(h[e.mapperIndex][d]+=a)}}};k.compareUtils.overlapMapper=function(h,d,b,f,a){h=b+h[d]-1;h<b&&(h=b);a<f&&(a=f);return h<f||a<b?!1:!0};k.compareUtils.findFirstDiff=function(h,d,b,f){for(var a=0,e=null,i=0;i<h.length;i++){if(a>f)break;if(k.compareUtils.overlapMapper(h[i],d,a,b,f)&&(e={mapperIndex:i,
startFrom:a},h[i][2]!==0))break;a+=h[i][d]}return e};k.compareUtils.matchMapper=function(h,d,b,f){if(h.length===0)return b;var a=b+Math.round((f-b)/3),e=k.compareUtils.findFirstDiff(h,d,b,f),i=h[e.mapperIndex][d]===0?e.startFrom:e.startFrom+h[e.mapperIndex][d]-1,g=k.compareUtils.lookUpLineIndex(h,1-d,e.mapperIndex),c=e.startFrom-b;return h[e.mapperIndex][2]===0?g-c:a>=e.startFrom&&a<=i?g-Math.round((f-b)/3):a<e.startFrom?g-c:(h[e.mapperIndex][1-d]===0?g:g+h[e.mapperIndex][1-d]-1)-(i-b)};k.compareUtils.getMapperLineCount=
function(h){for(var d=0,b=0;b<h.length;b++)d+=Math.max(h[b][0],h[b][1]);return d};k.compareUtils.getAnnotationIndex=function(h,d){for(var b=0;b<h.length;b++)if(h[b][0]===d)return b;return-1};k.compareUtils.getAnnotationMapperIndex=function(h,d){return h[d][1]};k.compareUtils.getAnnotationIndexByMapper=function(h,d){for(var b=0;b<h.length;b++)if(h[b][1]===d)return{current:b,prev:b-1,next:b+1};return{current:-1,prev:-1,next:-1}};k.compareUtils.isMapperConflict=function(h,d){return d<0?!1:!h[d][3]?!1:
h[d][3]===1};k.compareUtils.mergeDiffBlocks=function(h,d,b,f,a,e){for(var i=0;i<d.length;i++){var g=d[i][0],c=b[d[i][1]];if(c[0]>0){for(var l="",m=0;m<c[0];m++)l=l+f[c[2]-1+m].substring(a)+e;c=h.getLineCount();g>=c&&(g=h.getLineEnd(c-1),m=h.getLineEnd(c-1,!0),g===m?(h.setText(e,g,g),g=c):g=c-1);g=h.getLineStart(g);h.setText(l,g,g)}}};k.compareUtils.generateCompareHref=function(h,d){var b=require.toUrl("compare/compare.html");if(!d.conflict)d.conflict=void 0;if(!d.readonly)d.readonly=void 0;return(new j(b+
"#{,resource,params*}")).expand({resource:h,params:d})};k.compareUtils.generateCompareTreeHref=function(h,d){var b=require.toUrl("compare-tree/compare-tree.html");return(new j(b+"#{,resource,params*}")).expand({resource:h,params:d})};return k.compareUtils});
define("orion/compare/compareRulers",["orion/compare/compareUtils"],function(j){var k=k||{};k.CompareRuler=function(){function h(d,b,f){this._location=d||"left";this._overview=b||"page";this._rulerStyle=f;this._editor=null;var a=this;this._listener={onModelChanged:function(b){a._onModelChanged(b)}}}h.prototype={setView:function(d){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged);this._editor=d;this._onModelChanged&&this._editor&&this._editor.addEventListener("ModelChanged",
this._listener.onModelChanged)},getLocation:function(){return this._location},getOverview:function(){return this._overview},getAnnotationModel:function(){return null},addAnnotationType:function(){},isAnnotationTypeVisible:function(){return!1},removeAnnotationType:function(){},setAnnotationModel:function(){},getAnnotations:function(d,b){for(var f=[],a=d;a<b;a++){var e=this.getStyle(a);e&&(f[a]={html:this.getHTML(a),style:e})}return f},getWidestAnnotation:function(){return{html:this.getHTML(-1),style:this.getStyle(-1)}},
getRulerStyle:function(){return this.getStyle(void 0)}};return h}();k.LineNumberCompareRuler=function(){function h(d,b,f,a,e,i){k.CompareRuler.call(this,f,"page",a);this._diffNavigator=d;this._oddStyle=e||{style:{backgroundColor:"white"}};this._evenStyle=i||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._mapperColumnIndex=b}h.prototype=new k.CompareRuler;h.prototype.getStyle=function(d){return d===void 0?this._rulerStyle:this._evenStyle};h.prototype.getHTML=function(d){var b=this._editor.getModel(),
f=this._diffNavigator.getFeeder(this._mapperColumnIndex===0);return!f?"":d===-1?b.getLineCount():f.getLineNumber?(d=f.getLineNumber(d),d===-1?"":d+1):d+1};h.prototype._onModelChanged=function(d){var d=d.start,b=this._editor.getModel(),f=b.getLineCount(),a=(f+"").length;if(this._numOfDigits!==a)this._numOfDigits=a,this._editor.redrawLines(b.getLineAtOffset(d),f,this)};return h}();k.CompareOverviewRuler=function(){function h(d,b,f,a){this._diffNavigator=f;this._onClick=a;k.CompareRuler.call(this,d,
"document",b)}h.prototype=new k.CompareRuler;h.prototype.getStyle=function(d){var b,f;if(d===void 0)b=this._rulerStyle||{},f=b.style||(b.style={}),f.lineHeight="1px",f.fontSize="1px",f.width="14px";else if(b=d!==-1?{styleClass:"annotationOverview breakpoint"}:{},f=b.style||(b.style={}),f.cursor="pointer",f.width="8px",f.left="2px",d>=0){var a;if(this._diffNavigator&&this._diffNavigator.getFeeder())a=this._diffNavigator.getFeeder().getDiffBlocks();else return null;d=j.getAnnotationIndex(a,d);if(d===
-1)return null;a=j.getAnnotationMapperIndex(a,d);var e;e=this._diffNavigator.getMapper();if(a=j.isMapperConflict(e,a))f.border="1px #FF0000 solid";if(d===this._diffNavigator.getCurrentBlockIndex())f.backgroundColor=a?"red":"blue";d=this._diffNavigator.getFeeder().getDiffBlockH(d);a=this._diffNavigator.getFeeder().getOverviewLineCount();if(d<0)return null;e=this._editor.getClientArea();d=Math.floor(e.height*d/a);d<2&&(d=2);f.height=d+"px"}else return null;return b};h.prototype.setDiffNavigator=function(d){this._diffNavigator=
d};h.prototype.getHTML=function(){return"&nbsp;"};h.prototype.onClick=function(d){d!==void 0&&this._onClick(d,this)};h.prototype._onModelChanged=function(){this._editor.getModel().getLineCount()>0&&this._editor.redrawLines(0,1,this)};return h}();k.CompareCurveRuler=function(){function h(d){this._canvasDiv=d;this._mapper=void 0}h.prototype={init:function(d,b,f,a){this._rightIniting=this._rightIniting=this._leftIniting=!0;this._mapper=d;this._leftEditor=b;this._rightEditor=f;this._leftTextView=b.getTextView();
this._rightTextView=f.getTextView();this._diffNavigator=a;this.render()},matchPositionFrom:function(d){var b=d?this._leftTextView:this._rightTextView,f=d?this._rightTextView:this._leftTextView,a=b.getTopIndex(),b=b.getBottomIndex(),d=j.matchMapper(this._mapper,d?0:1,a,b);f.setTopIndex(d)},copyTo:function(d){if(this._diffNavigator.iterator){var b=this._diffNavigator.iterator.cursor();if(b&&(b.type==="word"?!b.copied&&!b.parent.copied:!b.copied)){var f=d?this._rightTextView.getText(b.oldA.start,b.oldA.end):
this._leftTextView.getText(b.newA.start,b.newA.end),a=d?b.newA:b.oldA;(d?this._leftTextView:this._rightTextView).setText(f,a.start,a.end);b.copied=!0}}},render:function(){if(this._mapper){var d=this._canvasDiv.getContext("2d");d.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height);d.strokeStyle="#AAAAAA";d.lineWidth=1;d.beginPath();var b=this._leftTextView.getTopIndex(),f=this._leftTextView.getBottomIndex(),a=this._rightTextView.getTopIndex(),e=this._rightTextView.getBottomIndex();this._leftLineH=
this._leftTextView.getLineHeight();this._rightLineH=this._rightTextView.getLineHeight();for(var i=0,g=0,c=!1,l=0;l<this._mapper.length;l++){if(this._mapper[l][2]!==0)if(j.overlapMapper(this._mapper[l],0,i,b,f)||j.overlapMapper(this._mapper[l],1,g,a,e))this._renderCurve(l,i,g,this._canvasDiv,d,b,f,a,e),c=!0;else if(c)break;i+=this._mapper[l][0];g+=this._mapper[l][1]}d.stroke()}},_renderCurve:function(d,b,f,a,e){var i=this._mapper[d],b=this._leftTextView.getLinePixel(b+i[0]/2)+i[0]%2*this._leftLineH/
3-this._leftTextView.getTopPixel(),f=this._rightTextView.getLinePixel(f+i[1]/2)+i[1]%2*this._rightLineH/3-this._rightTextView.getTopPixel(),a=a.parentNode.clientWidth;d===this._diffNavigator.getCurrentMapperIndex()?(e.stroke(),e.strokeStyle="#000",e.lineWidth=1,e.beginPath(),e.moveTo(0,b),e.bezierCurveTo(a/3,b,a*0.666,f,a,f),e.stroke(),e.strokeStyle="#AAAAAA",e.lineWidth=1,e.beginPath()):(e.moveTo(0,b),e.bezierCurveTo(a/3,b,a*0.666,f,a,f),e.stroke())},onChanged:function(d,b){var f=b?this._rightIniting:
this._leftIniting;if(d.removedLineCount!==d.addedLineCount){var a=b?this._rightTextView:this._leftTextView;f||j.updateMapper(this._mapper,b?1:0,a.getModel().getLineAtOffset(d.start),d.removedLineCount,d.addedLineCount);(d.removedLineCount>0||d.addedLineCount>0)&&this.render()}b?this._rightIniting=!1:this._leftIniting=!1;return f}};return h}();return k});define("orion/editor/i18n",{load:function(j,k,h){k.specified&&k.specified("orion/bootstrap")?k(["orion/i18n!"+j],function(d){h(d)}):h({})}});
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(j,k){var h={root:k},d;for(d in j)j.hasOwnProperty(d)&&typeof h[d]==="undefined"&&(h[d]=j[d]);return h});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(j,k,h){function d(b,d){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(b);this.setLineDelimiter(d)}d.prototype={destroy:function(){},find:function(b){if(this._text.length>1)this._text=[this._text.join("")];var d=b.string,a=b.regex,e=d,i="",g=b.caseInsensitive;if(e)if(a){if(d=k.parse(e))e=d.pattern,i=d.flags}else e=d.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),g&&(e=e.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var c=null,l;if(e){var d=b.reverse,h=b.wrap,a=b.wholeWord,j=b.start||0,b=b.end,o=b!==null&&b!==void 0;i.indexOf("g")===-1&&(i+="g");i.indexOf("m")===-1&&(i+="m");g&&i.indexOf("i")===-1&&(i+="i");a&&(e="\\b"+e+"\\b");var q=this._text[0],v,s,r=0;o&&(g=j<b?j:b,q=q.substring(g,j<b?b:j),r=g);var u=RegExp(e,i);if(d)l=function(){var a=null;for(u.lastIndex=0;;){s=u.lastIndex;v=u.exec(q);if(s===u.lastIndex)return null;if(v){if(!(v.index+r<j)){if(!h||a)break;j=q.length+r}a={start:v.index+
r,end:u.lastIndex+r}}else break}if(a)j=a.start;return a};else{if(!o)u.lastIndex=j;l=function(){for(;;){s=u.lastIndex;v=u.exec(q);if(s===u.lastIndex)break;if(v)return{start:v.index+r,end:u.lastIndex+r};if(!(s!==0&&h))break}return null}}c=l()}return{next:function(){var a=c;a&&(c=l());return a},hasNext:function(){return c!==null}}},getCharCount:function(){for(var b=0,d=0;d<this._text.length;d++)b+=this._text[d].length;return b},getLine:function(b,d){var a=this.getLineCount();if(!(0<=b&&b<a))return null;
var e=this._lineOffsets[b];if(b+1<a){a=this.getText(e,this._lineOffsets[b+1]);if(d)return a;for(var e=a.length,i;(i=a.charCodeAt(e-1))===10||i===13;)e--;return a.substring(0,e)}else return this.getText(e)},getLineAtOffset:function(b){var d=this.getCharCount();if(!(0<=b&&b<=d))return-1;var a=this.getLineCount();if(b===d)return a-1;var e,i,g=this._lastLineIndex;if(0<=g&&g<a&&(e=this._lineOffsets[g],i=g+1<a?this._lineOffsets[g+1]:d,e<=b&&b<i))return g;for(var c=a,l=-1;c-l>1;)if(g=Math.floor((c+l)/2),
e=this._lineOffsets[g],i=g+1<a?this._lineOffsets[g+1]:d,b<=e)c=g;else if(b<i){c=g;break}else l=g;return this._lastLineIndex=c},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(b,d){var a=this.getLineCount();if(!(0<=b&&b<a))return-1;if(b+1<a){a=this._lineOffsets[b+1];if(d)return a;for(var e=this.getText(Math.max(this._lineOffsets[b],a-2),a),i=e.length,g;(g=e.charCodeAt(i-1))===10||g===13;)i--;return a-(e.length-i)}else return this.getCharCount()},
getLineStart:function(b){return!(0<=b&&b<this.getLineCount())?-1:this._lineOffsets[b]},getText:function(b,d){b===void 0&&(b=0);d===void 0&&(d=this.getCharCount());if(b===d)return"";for(var a=0,e=0,i;e<this._text.length;){i=this._text[e].length;if(b<=a+i)break;a+=i;e++}for(var g=a,c=e;e<this._text.length;){i=this._text[e].length;if(d<=a+i)break;a+=i;e++}if(c===e)return this._text[c].substring(b-g,d-a);g=this._text[c].substring(b-g);a=this._text[e].substring(0,d-a);return g+this._text.slice(c+1,e).join("")+
a},onChanging:function(b){return this.dispatchEvent(b)},onChanged:function(b){return this.dispatchEvent(b)},setLineDelimiter:function(b,d){b==="auto"&&(b=void 0,this.getLineCount()>1&&(b=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=b?b:h.platformDelimiter;if(d){var a=this.getLineCount();if(a>1){for(var e=Array(a),i=0;i<a;i++)e[i]=this.getLine(i);this.setText(e.join(this._lineDelimiter))}}},setText:function(b,d,a){b===void 0&&(b="");d===void 0&&(d=0);a===void 0&&(a=
this.getCharCount());if(!(d===a&&b==="")){for(var e=this.getLineAtOffset(d),i=this.getLineAtOffset(a),g=d,c=a-d,l=i-e,h=b.length,j=0,o=this.getLineCount(),k=0,v=0,s=0,r=[];;){k!==-1&&k<=s&&(k=b.indexOf("\r",s));v!==-1&&v<=s&&(v=b.indexOf("\n",s));if(v===-1&&k===-1)break;s=k!==-1&&v!==-1?k+1===v?v+1:(k<v?k:v)+1:k!==-1?k+1:v+1;r.push(d+s);j++}this.onChanging({type:"Changing",text:b,start:g,removedCharCount:c,addedCharCount:h,removedLineCount:l,addedLineCount:j});r.length===0&&(s=this.getLineStart(e),
i=i+1<o?this.getLineStart(i+1):this.getCharCount(),d!==s&&(b=this.getText(s,d)+b,d=s),a!==i&&(b+=this.getText(a,i),a=i));s=h-c;for(i=e+l+1;i<o;i++)this._lineOffsets[i]+=s;if(r.length<5E4)e=[e+1,l].concat(r),Array.prototype.splice.apply(this._lineOffsets,e);else{s=e+1;this._lineOffsets.splice(s,l);for(o=0;o<r.length;o+=5E4)e=[s,0].concat(r.slice(o,Math.min(r.length,o+5E4))),Array.prototype.splice.apply(this._lineOffsets,e),s+=5E4}for(s=o=0;s<this._text.length;){i=this._text[s].length;if(d<=o+i)break;
o+=i;s++}e=o;for(r=s;s<this._text.length;){i=this._text[s].length;if(a<=o+i)break;o+=i;s++}i=this._text[s];d=this._text[r].substring(0,d-e);a=i.substring(a-o);r=[r,s-r+1];d&&r.push(d);b&&r.push(b);a&&r.push(a);Array.prototype.splice.apply(this._text,r);if(this._text.length===0)this._text=[""];this.onChanged({type:"Changed",start:g,removedCharCount:c,addedCharCount:h,removedLineCount:l,addedLineCount:j})}}};j.EventTarget.addMixin(d.prototype);return{TextModel:d}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(j,k){function h(b){if(b)this._view=b,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0}function d(b){h.call(this,b)}h.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(b){for(var d=[],a=this._keyBindings,e=0;e<a.length;e++)a[e].actionID===b&&d.push(a[e].keyBinding);return d},getView:function(){return this._view},isActive:function(){return this._view.getKeyModes().indexOf(this)!==-1},
match:function(b){if(b.type==="keydown")switch(b.keyCode){case 16:case 17:case 18:case 91:return}for(var d=this._keyBindingIndex,a=this._matchingKeyBindings||this._keyBindings,e=[],i=0;i<a.length;i++){var g=a[i],c=g.keyBinding.match(b,d);if(c===!0)return this._keyBindingIndex=0,this._matchingKeyBindings=null,g.actionID;else typeof c==="number"&&e.push(g)}if(e.length===0)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=e,"noop"},setKeyBinding:function(b,
d){for(var a=this._keyBindings,e=0;e<a.length;e++){var i=a[e];if(i.keyBinding.equals(b)){d?i.actionID=d:i.predefined?i.actionID="noop":a.splice(e,1);return}}d&&a.push({keyBinding:b,actionID:d})},setView:function(b){this._view=b}};d.prototype=new h;d.prototype.createKeyBindings=function(){var b=j.KeyBinding,d=[];d.push({actionID:"lineUp",keyBinding:new b(38),predefined:!0});d.push({actionID:"lineDown",keyBinding:new b(40),predefined:!0});d.push({actionID:"charPrevious",keyBinding:new b(37),predefined:!0});
d.push({actionID:"charNext",keyBinding:new b(39),predefined:!0});k.isMac?(d.push({actionID:"scrollPageUp",keyBinding:new b(33),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new b(34),predefined:!0}),d.push({actionID:"pageUp",keyBinding:new b(33,null,null,!0),predefined:!0}),d.push({actionID:"pageDown",keyBinding:new b(34,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(37,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(39,!0),predefined:!0}),
d.push({actionID:"wordPrevious",keyBinding:new b(37,null,null,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new b(39,null,null,!0),predefined:!0}),d.push({actionID:"scrollTextStart",keyBinding:new b(36),predefined:!0}),d.push({actionID:"scrollTextEnd",keyBinding:new b(35),predefined:!0}),d.push({actionID:"textStart",keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new b(40,!0),predefined:!0}),d.push({actionID:"scrollPageUp",keyBinding:new b(38,null,null,null,
!0),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new b(40,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(37,null,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(39,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(38,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(40,null,null,!0),predefined:!0})):(d.push({actionID:"pageUp",keyBinding:new b(33),predefined:!0}),d.push({actionID:"pageDown",
keyBinding:new b(34),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new b(36),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b(35),predefined:!0}),d.push({actionID:"wordPrevious",keyBinding:new b(37,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new b(39,!0),predefined:!0}),d.push({actionID:"textStart",keyBinding:new b(36,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new b(35,!0),predefined:!0}));k.isFirefox&&k.isLinux&&(d.push({actionID:"lineUp",keyBinding:new b(38,
!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new b(40,!0),predefined:!0}));k.isWindows&&(d.push({actionID:"scrollLineUp",keyBinding:new b(38,!0),predefined:!0}),d.push({actionID:"scrollLineDown",keyBinding:new b(40,!0),predefined:!0}));d.push({actionID:"selectLineUp",keyBinding:new b(38,null,!0),predefined:!0});d.push({actionID:"selectLineDown",keyBinding:new b(40,null,!0),predefined:!0});d.push({actionID:"selectCharPrevious",keyBinding:new b(37,null,!0),predefined:!0});d.push({actionID:"selectCharNext",
keyBinding:new b(39,null,!0),predefined:!0});d.push({actionID:"selectPageUp",keyBinding:new b(33,null,!0),predefined:!0});d.push({actionID:"selectPageDown",keyBinding:new b(34,null,!0),predefined:!0});k.isMac?(d.push({actionID:"selectLineStart",keyBinding:new b(37,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(39,!0,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",keyBinding:new b(37,null,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new b(39,
null,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(36,null,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(35,null,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(38,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(40,!0,!0),predefined:!0}),d.push({actionID:"selectLineStart",keyBinding:new b(37,null,!0,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(39,null,!0,null,!0),predefined:!0}),
d.push({actionID:"selectLineStart",keyBinding:new b(38,null,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(40,null,!0,!0),predefined:!0})):(k.isLinux&&(d.push({actionID:"selectWholeLineUp",keyBinding:new b(38,!0,!0),predefined:!0}),d.push({actionID:"selectWholeLineDown",keyBinding:new b(40,!0,!0),predefined:!0})),d.push({actionID:"selectLineStart",keyBinding:new b(36,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new b(35,null,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",
keyBinding:new b(37,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new b(39,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new b(36,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new b(35,!0,!0),predefined:!0}));d.push({actionID:"undo",keyBinding:new j.KeyBinding("z",!0),predefined:!0});k.isMac?d.push({actionID:"redo",keyBinding:new j.KeyBinding("z",!0,!0),predefined:!0}):d.push({actionID:"redo",keyBinding:new j.KeyBinding("y",!0),predefined:!0});
d.push({actionID:"deletePrevious",keyBinding:new b(8),predefined:!0});d.push({actionID:"deletePrevious",keyBinding:new b(8,null,!0),predefined:!0});d.push({actionID:"deleteNext",keyBinding:new b(46),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0,!0),predefined:!0});d.push({actionID:"deleteWordNext",keyBinding:new b(46,!0),predefined:!0});d.push({actionID:"tab",keyBinding:new b(9),predefined:!0});
d.push({actionID:"shiftTab",keyBinding:new b(9,null,!0),predefined:!0});d.push({actionID:"enter",keyBinding:new b(13),predefined:!0});d.push({actionID:"enter",keyBinding:new b(13,null,!0),predefined:!0});d.push({actionID:"selectAll",keyBinding:new b("a",!0),predefined:!0});d.push({actionID:"toggleTabMode",keyBinding:new b("m",!0),predefined:!0});k.isMac&&(d.push({actionID:"deleteNext",keyBinding:new b(46,null,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new b(8,null,null,!0),
predefined:!0}),d.push({actionID:"deleteWordNext",keyBinding:new b(46,null,null,!0),predefined:!0}));d.push({actionID:"toggleWrapMode",keyBinding:new j.KeyBinding("w",!0,!1,!0)});d.push({actionID:"toggleOverwriteMode",keyBinding:new j.KeyBinding(45)});if(!k.isFirefox){var a=k.isMac&&k.isChrome;d.push({actionID:"noop",keyBinding:new b("u",!a,!1,!1,a),predefined:!0});d.push({actionID:"noop",keyBinding:new b("i",!a,!1,!1,a),predefined:!0});d.push({actionID:"noop",keyBinding:new b("b",!a,!1,!1,a),predefined:!0})}k.isFirefox&&
(d.push({actionID:"copy",keyBinding:new b(45,!0),predefined:!0}),d.push({actionID:"paste",keyBinding:new b(45,null,!0),predefined:!0}),d.push({actionID:"cut",keyBinding:new b(46,null,!0),predefined:!0}));k.isMac&&(d.push({actionID:"lineStart",keyBinding:new b("a",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new b("e",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineUp",keyBinding:new b("p",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new b("n",!1,!1,
!1,!0),predefined:!0}),d.push({actionID:"charPrevious",keyBinding:new b("b",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"charNext",keyBinding:new b("f",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deletePrevious",keyBinding:new b("h",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteNext",keyBinding:new b("d",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineEnd",keyBinding:new b("k",!1,!1,!1,!0),predefined:!0}),k.isFirefox?(d.push({actionID:"scrollPageDown",keyBinding:new b("v",!1,
!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineStart",keyBinding:new b("u",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new b("w",!1,!1,!1,!0),predefined:!0})):(d.push({actionID:"pageDown",keyBinding:new b("v",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"centerLine",keyBinding:new b("l",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"enterNoCursor",keyBinding:new b("o",!1,!1,!1,!0),predefined:!0})));return d};return{KeyMode:h,DefaultKeyMode:d}});
define("orion/editor/util",[],function(){return{contains:function(j,k){if(!k)return!1;if(!j.compareDocumentPosition){for(var h=k;h;){if(j===h)return!0;h=h.parentNode}return!1}return j===k||(j.compareDocumentPosition(k)&16)!==0},addEventListener:function(j,k,h,d){typeof j.addEventListener==="function"?j.addEventListener(k,h,d===!0):j.attachEvent("on"+k,h)},removeEventListener:function(j,k,h,d){typeof j.removeEventListener==="function"?j.removeEventListener(k,h,d===!0):j.detachEvent("on"+k,h)}}});
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(j,k,h,d,b,f,a){function e(c,b,d){if(d){b.className="";for(var d=b.attributes,e=d.length;e-- >0;)(!a.isIE||a.isIE>=9||a.isIE<9&&d[e].specified)&&b.removeAttribute(d[e].name)}if(c){if(c.styleClass)b.className=c.styleClass;if(d=c.style)for(var g in d)d.hasOwnProperty(g)&&(b.style[g]=d[g]);if(c=c.attributes)for(var f in c)c.hasOwnProperty(f)&&
b.setAttribute(f,c[f])}}function i(a){return a instanceof Array?a.slice(0):a}function g(a,c){if(!a)return c;if(!c)return a;for(var b in c)c.hasOwnProperty(b)&&(a.hasOwnProperty(b)||(a[b]=c[b]));return a}function c(a,b){if(a===b)return!0;if(a&&!b||!a&&b)return!1;if(a&&a.constructor===String||b&&b.constructor===String)return!1;if(a instanceof Array||b instanceof Array){if(!(a instanceof Array&&b instanceof Array))return!1;if(a.length!==b.length)return!1;for(var d=0;d<a.length;d++)if(!c(a[d],b[d]))return!1;
return!0}if(!(a instanceof Object)||!(b instanceof Object))return!1;for(d in a)if(a.hasOwnProperty(d)){if(!b.hasOwnProperty(d))return!1;if(!c(a[d],b[d]))return!1}for(d in b)if(!a.hasOwnProperty(d))return!1;return!0}function l(a,c,b){for(var d=0,e=0,g=0,f=a.length;g<f;){d!==-1&&d<=g&&(d=a.indexOf("\r",g));e!==-1&&e<=g&&(e=a.indexOf("\n",g));var i=g,l;if(e===-1&&d===-1){c(a.substring(g));break}d!==-1&&e!==-1?d+1===e?(l=d,g=e+1):(l=d<e?d:e,g=(d<e?d:e)+1):d!==-1?(l=d,g=d+1):(l=e,g=e+1);c(a.substring(i,
l));b()}}function m(a){var c,b,d,e,g=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;if(g.getComputedStyle)a=g.getComputedStyle(a,null),c=a.getPropertyValue("padding-left"),b=a.getPropertyValue("padding-top"),d=a.getPropertyValue("padding-right"),e=a.getPropertyValue("padding-bottom");else if(a.currentStyle)c=a.currentStyle.paddingLeft,b=a.currentStyle.paddingTop,d=a.currentStyle.paddingRight,e=a.currentStyle.paddingBottom;return{left:parseInt(c,10)||0,top:parseInt(b,10)||0,right:parseInt(d,
10)||0,bottom:parseInt(e,10)||0}}function p(a){var c,b,d,e,g=a._trim;if(!g){var g=m(a),f=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;if(f.getComputedStyle)e=f.getComputedStyle(a,null),c=e.getPropertyValue("border-left-width"),b=e.getPropertyValue("border-top-width"),d=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width");else if(a.currentStyle)c=a.currentStyle.borderLeftWidth,b=a.currentStyle.borderTopWidth,d=a.currentStyle.borderRightWidth,e=a.currentStyle.borderBottomWidth;
c=parseInt(c,10)||0;b=parseInt(b,10)||0;d=parseInt(d,10)||0;e=parseInt(e,10)||0;g.left+=c;g.top+=b;g.right+=d;g.bottom+=e;a._trim=g}return g}function o(a,c,b){this.start=a;this.end=c;this.caret=b}function q(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function v(a,c,b){this.view=a;this.lineIndex=c;this._lineDiv=b}function s(a){this._init(a||{})}var r=f.addEventListener,u=f.removeEventListener,w=function(){function a(c){this.options=c}a.prototype.play=function(){var a=
typeof this.options.duration==="number"?this.options.duration:350,c=this.options.easing||this.defaultEasing,b=this.options.onAnimate||function(){},d=this.options.curve[0],n=this.options.curve[1],e=n-d,g=-1,f,i=this;this.interval=this.options.window.setInterval(function(){g=g===-1?(new Date).getTime():g;var l=((new Date).getTime()-g)/a;l<1?(l=c(l),f=d+l*e,b(f)):(b(n),i.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}};q.prototype={toString:function(){return"{l="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};v.prototype={create:function(a,c){if(!this._lineDiv){var b=this._lineDiv=this._createLine(a,c,this.lineIndex);b._line=
this;return b}},_createLine:function(b,d,g){var f=this.view,i=f._model,l=i.getLine(g),h=i.getLineStart(g),m={type:"LineStyle",textView:f,lineIndex:g,lineText:l,lineStart:h};if(l.length<2E3)f.onLineStyle(m);i=d||a.createElement(b.ownerDocument,"div");if(!d||!c(d.viewStyle,m.style)){e(m.style,i,d);if(d)d._trim=null;i.viewStyle=m.style;i.setAttribute("role","presentation")}i.lineIndex=g;g=[];this._createRanges(m.ranges,l,0,l.length,h,{tabOffset:0,ranges:g});l=" ";!f._fullSelection&&a.isIE<9&&(l="\ufeff");
m={text:l,style:f._metrics.largestFontStyle,ignoreChars:1};g.length===0||!g[g.length-1].style||g[g.length-1].style.tagName!=="div"?g.push(m):g.splice(g.length-1,0,m);var j,p,o,A,k,l=f=0,q,u;if(d){if(p=d.modelChangedEvent)p.removedLineCount===0&&p.addedLineCount===0?(u=p.start-h,q=p.addedCharCount-p.removedCharCount):u=-1,d.modelChangedEvent=void 0;p=d.firstChild}for(h=0;h<g.length;h++){m=g[h];A=m.text;f+=A.length;j=m.style;if(p)if(k=p.firstChild.data,o=p.viewStyle,k===A&&c(j,o)){l+=k.length;p._rectsCache=
void 0;j=p=p.nextSibling;continue}else for(;p;){if(u!==-1){o=f;o>=u&&(o-=q);k=(k=p.firstChild.data)?k.length:0;if(l+k>o)break;l+=k}o=p.nextSibling;i.removeChild(p);p=o}j=this._createSpan(i,A,j,m.ignoreChars);p?i.insertBefore(j,p):i.appendChild(j);if(d)d.lineWidth=void 0}if(d)for(b=j?j.nextSibling:null;b;)o=b.nextSibling,d.removeChild(b),b=o;else b.appendChild(i);return i},_createRanges:function(a,b,d,e,g,f){if(!(d>e)){if(a)for(var i=0;i<a.length;i++){var l=a[i];if(!(l.end<g+d)){var h=Math.max(g+d,
l.start)-g;if(h>e)break;var m=Math.min(g+e,l.end)-g;if(h<=m){h=Math.max(d,h);m=Math.min(e,m);d<h&&this._createRange(b,d,h,null,f);if(!l.style||!l.style.unmergeable)for(;i+1<a.length&&a[i+1].start-g===m&&c(l.style,a[i+1].style);)l=a[i+1],m=Math.min(g+e,l.end)-g,i++;this._createRange(b,h,m,l.style,f);d=m}}}d<e&&this._createRange(b,d,e,null,f)}},_createRange:function(a,c,b,d,e){if(!(c>b)){var g=this.view._customTabSize;if(g&&g!==8)for(var f=a.indexOf("\t",c);f!==-1&&f<b;){c<f&&(c={text:a.substring(c,
f),style:d},e.ranges.push(c),e.tabOffset+=c.text.length);c=g-e.tabOffset%g;if(c>0){for(var i="\u00a0",l=1;l<c;l++)i+=" ";c={text:i,style:d,ignoreChars:c-1};e.ranges.push(c);e.tabOffset+=c.text.length}c=f+1;if(c===b)return;f=a.indexOf("\t",c)}c<=b&&(c={text:a.substring(c,b),style:d},e.ranges.push(c),e.tabOffset+=c.text.length)}},_createSpan:function(c,b,d,g){var f=this.view,i="span";d&&d.tagName&&(i=d.tagName.toLowerCase());var l=i==="a";if(l)c.hasLink=!0;l&&!f._linksVisible&&(i="span");l=c.ownerDocument;
c=a.createElement(c.ownerDocument,i);d&&d.html?(c.innerHTML=d.html,c.ignore=!0):d&&d.node?(c.appendChild(d.node),c.ignore=!0):c.appendChild(l.createTextNode(d&&d.text?d.text:b));e(d,c);if(i==="a"){var h=f._getWindow();r(c,"click",function(a){return f._handleLinkClick(a?a:h.event)},!1)}c.viewStyle=d;if(g)c.ignoreChars=g;return c},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(c,b){var d=this._ensureCreated(),
e=this.view;if(c===void 0)return this._getLineBoundingClientRect(d,!0);var g=e._model,f=d.ownerDocument,i=this.lineIndex,l=null;if(c<g.getLineEnd(i)){i=g.getLineStart(i);for(g=d.firstChild;g;){if(!g.ignore){var h=g.firstChild,m=h.length;g.ignoreChars&&(m-=g.ignoreChars);if(i+m>c){l=c-i;if(h.length===1)l=new q(g.getBoundingClientRect());else if(e._isRangeRects)f=f.createRange(),f.setStart(h,l),f.setEnd(h,l+1),l=new q(f.getBoundingClientRect());else if(a.isIE){if(f=f.body.createTextRange(),f.moveToElementText(g),
f.collapse(),(i=l===0&&a.isIE===8)&&(l=1),f.moveEnd("character",l+1),f.moveStart("character",l),l=new q(f.getBoundingClientRect()),i)l.left=g.getClientRects()[0].left}else{var j=h.data;g.removeChild(h);g.appendChild(f.createTextNode(j.substring(0,l)));var p=a.createElement(f,"span");p.appendChild(f.createTextNode(j.substring(l,l+1)));g.appendChild(p);g.appendChild(f.createTextNode(j.substring(l+1)));l=new q(p.getBoundingClientRect());g.innerHTML="";g.appendChild(h);this._createdDiv||(f=e._getSelection(),
(i<=f.start&&f.start<i+m||i<=f.end&&f.end<i+m)&&e._updateDOMSelection())}a.isIE&&(f=d.ownerDocument.defaultView||d.ownerDocument.parentWindow,d=f.screen.logicalXDPI/f.screen.deviceXDPI,f=f.screen.logicalYDPI/f.screen.deviceYDPI,l.left*=d,l.right*=d,l.top*=f,l.bottom*=f);break}i+=m}g=g.nextSibling}}d=this.getBoundingClientRect();if(!l)e._wrapMode?(e=this.getClientRects(),l=e[e.length-1],l.left=l.right,l.left+=d.left,l.top+=d.top,l.right+=d.left,l.bottom+=d.top):(l=new q(d),l.left=l.right);if(b||b===
void 0)l.left-=d.left,l.top-=d.top,l.right-=d.left,l.bottom-=d.top;return l},_getClientRects:function(a,c){var b,d,e,g;if(!a._rectsCache){b=a.getClientRects();d=Array(b.length);for(g=0;g<b.length;g++)e=d[g]=new q(b[g]),e.left-=c.left,e.top-=c.top,e.right-=c.left,e.bottom-=c.top;a._rectsCache=d}b=a._rectsCache;d=[b.length];for(g=0;g<b.length;g++)d[g]=new q(b[g]);return d},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var c=this._ensureCreated(),b=[],d=
c.firstChild,e,g=c.getBoundingClientRect();d;){if(!d.ignore)for(var f=this._getClientRects(d,g),c=0;c<f.length;c++){var i=f[c],l;if(i.top!==i.bottom){var h=i.top+(i.bottom-i.top)/2;for(l=0;l<b.length;l++)if(e=b[l],e.top<=h&&h<e.bottom)break;if(l===b.length)b.push(i);else{if(i.left<e.left)e.left=i.left;if(i.top<e.top)e.top=i.top;if(i.right>e.right)e.right=i.right;if(i.bottom>e.bottom)e.bottom=i.bottom}}}d=d.nextSibling}return a!==void 0?b[a]:b},_getLineBoundingClientRect:function(a,c){var b=new q(a.getBoundingClientRect());
if(!this.view._wrapMode){b.right=b.left;for(var d=a.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(d)d=d.getBoundingClientRect(),b.right=d.right+p(a).right}c&&(d=p(a),b.left+=d.left,b.right-=d.right);return b},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;for(var c=this.getClientRects(),a=this.getBoundingClientRect(a),a=a.top+(a.bottom-a.top)/2,b=0;b<c.length;b++)if(c[b].top<=a&&
a<c[b].bottom)return b;return c.length-1},getLineStart:function(a){if(!this.view._wrapMode||a===0)return this.view._model.getLineStart(a);var c=this.getClientRects();return this.getOffset(c[a].left+1,c[a].top+1)},getOffset:function(c,b){var d=this.view,e=d._model,g=this.lineIndex,f=e.getLineStart(g),i=e.getLineEnd(g);if(f===i)return f;var l=this._ensureCreated(),h=this.getBoundingClientRect(),m,j;if(d._wrapMode){m=this.getClientRects();if(b<m[0].top)b=m[0].top;for(var p=0;p<m.length;p++)if(j=m[p],
j.top<=b&&b<j.bottom)break;if(c<j.left)c=j.left;c>j.right&&(c=j.right-1)}else c<0&&(c=0),c>h.right-h.left&&(c=h.right-h.left);var o=l.ownerDocument,p=o.defaultView||o.parentWindow,k=a.isIE?p.screen.logicalXDPI/p.screen.deviceXDPI:1,q=a.isIE?p.screen.logicalYDPI/p.screen.deviceYDPI:1,p=f,u=l.firstChild;a:for(;u;){if(!u.ignore){var v=u.firstChild,l=v.length;u.ignoreChars&&(l-=u.ignoreChars);var s,w,r;m=this._getClientRects(u,h);for(var J=0;J<m.length;J++)if(j=m[J],j.left<=c&&c<j.right&&(!d._wrapMode||
j.top<=b&&b<j.bottom)){var J=j.left+h.left,I;if(a.isIE||d._isRangeRects){for(var o=d._isRangeRects?o.createRange():o.body.createTextRange(),H=l,M=-1;H-M>1;){var T=Math.floor((H+M)/2);m=M+1;j=T===l-1&&u.ignoreChars?v.length:T+1;I=m===0&&a.isIE===8;d._isRangeRects?(o.setStart(v,m),o.setEnd(v,j)):(I&&(m=1),o.moveToElementText(u),o.move("character",m),o.moveEnd("character",j-m));m=o.getClientRects();for(var V=!1,U=0;U<m.length;U++)if(j=m[U],s=(I?J:j.left)*k-h.left,r=j.right*k-h.left,w=j.top*q-h.top,j=
j.bottom*q-h.top,s<=c&&c<r&&(!d._wrapMode||w<=b&&b<j)){V=!0;break}V?H=T:M=T}p+=H;m=H;j=H===l-1&&u.ignoreChars?v.length:Math.min(H+1,v.length);d._isRangeRects?(o.setStart(v,m),o.setEnd(v,j)):(o.moveToElementText(u),o.move("character",m),o.moveEnd("character",j-m));m=o.getClientRects();d=!1;m.length>0&&(j=m[0],s=(I?J:j.left)*k-h.left,r=j.right*k-h.left,d=c>s+(r-s)/2);h=p-f;e=e.getLine(g);g=e.charCodeAt(h);55296<=g&&g<=56319&&d?h<e.length&&(g=e.charCodeAt(h+1),56320<=g&&g<=57343&&(p+=1)):56320<=g&&g<=
57343&&!d&&h>0&&(g=e.charCodeAt(h-1),55296<=g&&g<=56319&&(p-=1));d&&p++}else{e=[];for(g=0;g<l;g++)e.push("<span>"),g===l-1?e.push(v.data.substring(g)):e.push(v.data.substring(g,g+1)),e.push("</span>");u.innerHTML=e.join("");for(e=u.firstChild;e;){j=e.getBoundingClientRect();s=j.left-h.left;r=j.right-h.left;if(s<=c&&c<r){c>s+(r-s)/2&&p++;break}p++;e=e.nextSibling}if(!this._createdDiv)u.innerHTML="",u.appendChild(v),h=d._getSelection(),(p<=h.start&&h.start<p+l||p<=h.end&&h.end<p+l)&&d._updateDOMSelection()}break a}p+=
l}u=u.nextSibling}return Math.min(i,Math.max(f,p))},getNextOffset:function(c,b){if(b.unit==="line"){var d=this.view._model,e=d.getLineAtOffset(c);if(b.count>0)return b.count--,d.getLineEnd(e);b.count++;return d.getLineStart(e)}return b.unit==="wordend"||b.unit==="wordWS"||b.unit==="wordendWS"?this._getNextOffset_W3C(c,b):a.isIE?this._getNextOffset_IE(c,b):this._getNextOffset_W3C(c,b)},_getNextOffset_W3C:function(a,c){function b(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,g=e.getLineAtOffset(a),f=e.getLine(g),i=e.getLineStart(g),e=e.getLineEnd(g),g=f.length,l=a-i,h,m=c.count<0?-1:1;if(c.unit==="word"||c.unit==="wordend"||c.unit==="wordWS"||c.unit==="wordendWS")for(var j,p,o;c.count!==0;){if(c.count>0){if(l===g)return e;h=f.charCodeAt(l);j=b(h);p=!j&&!d(h);for(l++;l<g;){h=f.charCodeAt(l);if(c.unit!=="wordWS"&&c.unit!=="wordendWS"){o=b(h);if(c.unit==="wordend"){if(!o&&j)break}else if(o&&!j)break;h=!o&&!d(h)}else h=
!d(h);if(c.unit==="wordend"||c.unit==="wordendWS"){if(!h&&p)break}else if(h&&!p)break;p=h;j=o;l++}}else{if(l===0)return i;l--;h=f.charCodeAt(l);j=b(h);for(p=!j&&!d(h);0<l;){h=f.charCodeAt(l-1);if(c.unit!=="wordWS"&&c.unit!=="wordendWS"){o=b(h);if(c.unit==="wordend"){if(o&&!j)break}else if(!o&&j)break;h=!o&&!d(h)}else h=!d(h);if(c.unit==="wordend"||c.unit==="wordendWS"){if(h&&!p)break}else if(!h&&p)break;p=h;j=o;l--}}c.count-=m}else for(;c.count!==0&&0<=l+m&&l+m<=g;)l+=m,h=f.charCodeAt(l),56320<=h&&
h<=57343&&l>0&&(h=f.charCodeAt(l-1),55296<=h&&h<=56319&&(l+=m)),c.count-=m;return i+l},_getNextOffset_IE:function(a,c){var b=this._ensureCreated(),d=this.view._model,e=this.lineIndex,g=0,f;f=d.getLineStart(e);var i=b.ownerDocument,l=c.count<0?-1:1;if(a===d.getLineEnd(e)){for(b=b.lastChild;b&&b.ignoreChars===b.firstChild.length;)b=b.previousSibling;if(!b)return f;g=i.body.createTextRange();g.moveToElementText(b);f=g.text.length;g.moveEnd(c.unit,l);g=a+g.text.length-f}else if(a===f&&c.count<0)g=f;else for(b=
b.firstChild;b;){d=b.firstChild.length;b.ignoreChars&&(d-=b.ignoreChars);if(f+d>a){g=i.body.createTextRange();if(a===f&&c.count<0){for(f=b.previousSibling;f;){if(f.firstChild&&f.firstChild.length)break;f=f.previousSibling}g.moveToElementText(f?f:b.previousSibling)}else g.moveToElementText(b),g.collapse(),g.moveEnd("character",a-f);f=g.text.length;g.moveEnd(c.unit,l);g=a+g.text.length-f;break}f=d+f;b=b.nextSibling}c.count-=l;return g},destroy:function(){var a=this._createdDiv;if(a)a.parentNode.removeChild(a),
this._createdDiv=null}};s.prototype={addKeyMode:function(a,c){var b=this._keyModes;c!==void 0?b.splice(c,0,a):b.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,c){a.setView(this);var b=this._rulers;if(c!==void 0){var d,e;for(d=0,e=0;d<b.length&&e<c;d++)a.getLocation()===b[d].getLocation()&&e++;b.splice(e,0,a);c=e}else b.push(a);this._createRuler(a,c);this._update()},computeSize:function(){var c=0,b=0,d=this._model,e=this._clientDiv;if(!e)return{width:c,height:b};var g=e.style.width;if(a.isWebkit)e.style.width=
"0x7fffffffpx";for(var d=d.getLineCount(),f=0;f<d;f++){var i=this._getLine(f),l=i.getBoundingClientRect(),c=Math.max(c,l.right-l.left);b+=l.bottom-l.top;i.destroy()}if(a.isWebkit)e.style.width=g;e=this._getViewPadding();c+=e.right+e.left+this._metrics.scrollWidth;b+=e.bottom+e.top+this._metrics.scrollWidth;return{width:c,height:b}},convert:function(a,c,b){if(this._clientDiv){var d=this._getScroll(),e=this._getViewPadding(),g=this._viewDiv.getBoundingClientRect();c==="document"&&(a.x!==void 0&&(a.x+=
-d.x+g.left+e.left),a.y!==void 0&&(a.y+=-d.y+g.top+e.top));b==="document"&&(a.x!==void 0&&(a.x+=d.x-g.left-e.left),a.y!==void 0&&(a.y+=d.y-g.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 c=[],b=this._actions,d;for(d in b)b.hasOwnProperty(d)&&(a||!b[d].defaultHandler)&&c.push(d);return c},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 c=[],b=this._keyModes,d=0;d<b.length;d++)c=c.concat(b[d].getKeyBindings(a));return c},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 c=this._model,a=Math.min(Math.max(0,a),c.getCharCount()),c=c.getLineAtOffset(a),b=this._getLine(c),a=b.getBoundingClientRect(a);b.destroy();b=a.left;c=this._getLinePixel(c)+a.top;return{x:b,y:c}},getNextOffset:function(a,
c){var b=new o(a,a,!1);this._doMove(c,b);return b.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 i(this["_"+a])}else{a={};for(var c in arguments)arguments.hasOwnProperty(c)&&(a[arguments[c]]=void 0)}for(var b in a)a.hasOwnProperty(b)&&(a[b]=i(this["_"+b]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,c){if(!this._clientDiv)return 0;var b=this._getLineIndex(c),
d=this._getLine(b),b=d.getOffset(a,c-this._getLinePixel(b));d.destroy();return b},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,c){return this._model.getText(a,c)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?
0:this._getScroll().y},invokeAction:function(a,c,b){if(this._clientDiv){if(a=this._actions[a]){if(!c&&a.handler&&a.handler(b))return!0;if(a.defaultHandler)return typeof a.defaultHandler(b)==="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,c){if(!(this._redrawCount>0))for(var b=this.getRulers(),d=0;d<b.length;d++)this.redrawLines(a,c,b[d])},redrawLines:function(a,c,b){if(!(this._redrawCount>0)&&(a===void 0&&(a=0),c===void 0&&(c=this._model.getLineCount()),a!==c)){var d=this._clientDiv;if(d){if(b)for(d=this._getRulerParent(b).firstChild;d;){if(d._ruler===
b)break;d=d.nextSibling}b?d.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,c);if(!b||b.getOverview()==="page")for(d=d.firstChild;d;){var e=d.lineIndex;if(a<=e&&e<c)d.lineChanged=!0;d=d.nextSibling}if(!b&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<c)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._queueUpdate()}}},redrawRange:function(a,c){if(!(this._redrawCount>0)){var b=this._model;a===void 0&&(a=0);c===void 0&&(c=b.getCharCount());
var d=b.getLineAtOffset(a),b=b.getLineAtOffset(Math.max(a,c-1))+1;this.redrawLines(d,b)}},removeKeyMode:function(a){for(var c=this._keyModes,b=0;b<c.length;b++)if(c[b]===a){c.splice(b,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var c=this._rulers,b=0;b<c.length;b++)if(c[b]===a){c.splice(b,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,c,b){if(a){var d=this._actions,e=d[a];
e||(e=d[a]={});e.handler=c;if(b!==void 0)e.actionDescription=b}},setKeyBinding:function(a,c){this._keyModes[0].setKeyBinding(a,c)},setCaretOffset:function(a,c,b){var d=this._model.getCharCount(),a=Math.max(0,Math.min(a,d));this._setSelection(new o(a,a,!1),c===void 0||c,!0,b)},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 c=this._model.getLineCount(),b=this._model.getCharCount(),d=a.getLineCount(),e=a.getCharCount(),g={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:b,addedCharCount:e,removedLineCount:c,addedLineCount:d};this.onModelChanging(g);this._model=a;g={type:"ModelChanged",start:0,removedCharCount:b,addedCharCount:e,removedLineCount:c,
addedLineCount:d};this.onModelChanged(g);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(a){var b=this._defaultOptions(),d;for(d in a)if(a.hasOwnProperty(d)){var e=a[d];if(!c(this["_"+d],e)){var g=b[d]?b[d].update:null;g?g.call(this,e):this["_"+d]=i(e)}}},setSelection:function(a,c,b,d){var e=a>c;if(e)var g=a,a=c,c=g;g=this._model.getCharCount();a=
Math.max(0,Math.min(a,g));c=Math.max(0,Math.min(c,g));this._setSelection(new o(a,c,e),b===void 0||b,!0,d)},setText:function(c,b,d){var e=b===void 0&&d===void 0;b===void 0&&(b=0);d===void 0&&(d=this._model.getCharCount());if(e)this._variableLineHeight=!1;this._modifyContent({text:c,start:b,end:d,_code:!0},!e);if(e)this._columnX=-1,this._setSelection(new o(0,0,!1),!0),a.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,c){this._clientDiv&&(a&&this._updateStyle(),c===void 0||c?this._update():this._queueUpdate())},_handleRootMouseDown:function(c){if(!this._ignoreEvent(c)){if(a.isFirefox&&c.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var b=this._overlayDiv||this._clientDiv;if(a.isIE<9)b=
this._viewDiv;for(var d=c.target?c.target:c.srcElement;d;){if(b===d)return;d=d.parentNode}c.preventDefault&&c.preventDefault();c.stopPropagation&&c.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(c){if(!this._ignoreEvent(c)&&a.isFirefox&&c.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(a.isIE<9&&!this._getSelection().isEmpty()){var c=this._rootDiv,b=a.createElement(c.ownerDocument,"div");c.appendChild(b);c.removeChild(b)}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",c=this._getWindow(),b=this._selDiv1.ownerDocument,c.getSelection){b=c.getSelection();for(c=b.anchorNode;c;){if(c===this._clientDiv){b.rangeCount>0&&b.removeAllRanges();
break}c=c.parentNode}}else if(b.selection){this._ignoreSelect=!1;for(c=b.selection.createRange().parentElement();c;){if(c===this._clientDiv){b.selection.empty();break}c=c.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(c){if(!this._ignoreEvent(c)){a.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var b=!1;this.isListening("ContextMenu")?(b=this._createMouseEvent("ContextMenu",c),b.screenX=c.screenX,b.screenY=c.screenY,this.onContextMenu(b),
b=b.defaultPrevented):a.isMac&&a.isFirefox&&c.button===0&&(b=!0);if(b)return c.preventDefault&&c.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(c){if(!this._ignoreEvent(c)){if(a.isFirefox){var b=this;this._getWindow().setTimeout(function(){b._clientDiv.contentEditable=!0;b._clientDiv.draggable=!1;b._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&this._dragOffset!==-1)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",c)),this._dragOffset=-1;else return c.preventDefault&&c.preventDefault(),
!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",a))},_handleDragEnd:function(c){if(!this._ignoreEvent(c)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",c));a.isFirefox&&(this._fixCaret(),c.dataTransfer.dropEffect==="none"&&!c.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(c){if(!this._ignoreEvent(c)){var b=!0;this._dropTarget=
!0;this.isListening("DragEnter")&&(b=!1,this.onDragEnter(this._createMouseEvent("DragEnter",c)));if(a.isWebkit||b)return c.preventDefault&&c.preventDefault(),!1}},_handleDragOver:function(c){if(!this._ignoreEvent(c)){var b=!0;this.isListening("DragOver")&&(b=!1,this.onDragOver(this._createMouseEvent("DragOver",c)));if(a.isWebkit||b){if(b)c.dataTransfer.dropEffect="none";c.preventDefault&&c.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;a.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 c=this._highlightRGB;this._selDiv1.style.background=
c;this._selDiv2.style.background=c;this._selDiv3.style.background=c}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(c){if(!this._ignoreEvent(c)){if(this.isListening("KeyDown")){var b=this._createKeyEvent("KeyDown",c);this.onKeyDown(b);if(b.defaultPrevented){if(a.isFirefox)this._keyDownPrevented=!0;c.preventDefault();return}}b=!1;switch(c.keyCode){case 16:case 17:case 18:case 91:b=!0;break;default:this._setLinksVisible(!1)}if(c.keyCode===229){if(this._readonly)return c.preventDefault&&
c.preventDefault(),!1;b=!0;if(a.isSafari&&a.isMac&&c.ctrlKey)b=!1,c.keyCode=129;b&&this._startIME()}else b||this._commitIME();if((a.isMac||a.isLinux)&&a.isFirefox<4||a.isOpera<12.16)return this._keyDownEvent=c,!0;if(this._doAction(c))return c.preventDefault?(c.preventDefault(),c.stopPropagation()):(c.cancelBubble=!0,c.returnValue=!1,c.keyCode=0),!1}},_handleKeyPress:function(c){if(!this._ignoreEvent(c))if(this._keyDownPrevented)c.preventDefault&&(c.preventDefault(),c.stopPropagation()),this._keyDownPrevented=
void 0;else{if(a.isMac&&a.isWebkit&&(63232<=c.keyCode&&c.keyCode<=63487||c.keyCode===13||c.keyCode===8))return c.preventDefault&&c.preventDefault(),!1;if(((a.isMac||a.isLinux)&&a.isFirefox<4||a.isOpera<12.16)&&this._doAction(this._keyDownEvent))return c.preventDefault&&c.preventDefault(),!1;var b=a.isMac?c.metaKey:c.ctrlKey;if(c.charCode!==void 0&&b)switch(c.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(b=this._createKeyEvent("KeyPress",c),this.onKeyPress(b),b.defaultPrevented)){c.preventDefault();
return}if(this._doAction(c))return c.preventDefault?(c.preventDefault(),c.stopPropagation()):(c.cancelBubble=!0,c.returnValue=!1,c.keyCode=0),!1;b=!1;if(a.isMac){if(c.ctrlKey||c.metaKey)b=!0}else if(a.isFirefox){if(c.ctrlKey||c.altKey)b=!0}else c.ctrlKey^c.altKey&&(b=!0);if(!b&&(b=a.isOpera?c.which:c.charCode!==void 0?c.charCode:c.keyCode,b>31))return this._doContent(String.fromCharCode(b)),c.preventDefault&&c.preventDefault(),!1}},_handleDocKeyUp:function(c){(a.isMac?c.metaKey:c.ctrlKey)||this._setLinksVisible(!1)},
_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var c=this._createKeyEvent("KeyUp",a);this.onKeyUp(c);if(c.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);a.keyCode===13&&this._commitIME()}},_handleLinkClick:function(c){if(!(a.isMac?c.metaKey:c.ctrlKey))return c.preventDefault&&c.preventDefault(),!1},_handleMouse:function(c){var b=this._getWindow(),d=!0,e=b;if(a.isIE||a.isFirefox&&!this._overlayDiv)e=this._clientDiv;if(this._overlayDiv){if(this._hasFocus)this._ignoreFocus=
!0;var g=this;b.setTimeout(function(){g.focus();g._ignoreFocus=!1},0)}this._clickCount===1?(d=this._setSelectionTo(c.clientX,c.clientY,c.shiftKey,(!a.isOpera||a.isOpera>=12.16)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(c.clientX,c.clientY,c.shiftKey),this._doubleClickSelection=this._getSelection());return d},_handleMouseDown:function(c){if(!this._ignoreEvent(c)){if(this._linksVisible)if((c.target||
c.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();var b=c.which;b||(c.button===4&&(b=2),c.button===2&&(b=3),c.button===1&&(b=1));var d=b!==2&&c.timeStamp?c.timeStamp:(new Date).getTime(),e=d-this._lastMouseTime,g=Math.abs(this._lastMouseX-c.clientX),f=Math.abs(this._lastMouseY-c.clientY),i=this._lastMouseButton===b;this._lastMouseX=c.clientX;this._lastMouseY=c.clientY;this._lastMouseTime=d;this._lastMouseButton=b;if(b===1)this._isMouseDown=!0,i&&e<=this._clickTime&&
g<=this._clickDist&&f<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&(d=this._createMouseEvent("MouseDown",c),this.onMouseDown(d),d.defaultPrevented)){c.preventDefault();return}if(b===1&&this._handleMouse(c)&&(a.isIE>=9||a.isOpera||a.isChrome||a.isSafari||a.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),c.preventDefault();a.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(c){if(!this._animation){var b=this._isClientDiv(c);if(this.isListening("MouseMove")&&b)this.onMouseMove(this._createMouseEvent("MouseMove",c));if(!this._dropTarget){var d=this._linksVisible||this._lastMouseMoveX!==
c.clientX||this._lastMouseMoveY!==c.clientY;this._lastMouseMoveX=c.clientX;this._lastMouseMoveY=c.clientY;this._setLinksVisible(d&&!this._isMouseDown&&(a.isMac?c.metaKey:c.ctrlKey));if(!this._isW3CEvents){if(c.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&c.button===1&&(this._clickCount&1)!==0&&b)return this._clickCount=2,this._handleMouse(c,this._clickCount)}if(this._isMouseDown&&this._dragOffset===-1){var b=c.clientX,c=c.clientY,e=this._getViewPadding(),g=this._viewDiv.getBoundingClientRect(),
f=this._getClientWidth(),i=this._getClientHeight(),d=g.left+e.left,l=g.top+e.top,f=g.left+e.left+f,e=g.top+e.top+i;c<l?this._doAutoScroll("up",b,c-l):c>e?this._doAutoScroll("down",b,c-e):b<d&&!this._wrapMode?this._doAutoScroll("left",b-d,c):b>f&&!this._wrapMode?this._doAutoScroll("right",b-f,c):(this._endAutoScroll(),this._setSelectionTo(b,c,!0))}}}},_isClientDiv:function(a){for(var c=this._overlayDiv||this._clientDiv,a=a.target?a.target:a.srcElement;a;){if(c===a)return!0;a=a.parentNode}return!1},
_createKeyEvent:function(a,c){return{type:a,event:c,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(a,c){var b=this.convert({x:c.clientX,y:c.clientY},"page","document");return{type:a,event:c,clickCount:this._clickCount,x:b.x,y:b.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(c){var b=c.which?c.button===0:c.button===1;if(this.isListening("MouseUp")&&(this._isClientDiv(c)||b&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",
c));if(!this._linksVisible&&b&&this._isMouseDown){if(this._dragOffset!==-1)b=this._getSelection(),b.extend(this._dragOffset),b.collapse(),this._setSelection(b,!0,!0),this._dragOffset=-1;this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null);a.isFirefox&&c.preventDefault()}},_handleMouseWheel:function(c){var b=this._getLineHeight(),d=0,e=0;a.isIE||a.isOpera?e=-c.wheelDelta/40*b:a.isFirefox?c.type==="wheel"?c.deltaMode?(d=Math.max(-256,Math.min(256,c.deltaX))*b,e=Math.max(-256,
Math.min(256,c.deltaY))*b):(d=c.deltaX,e=c.deltaY):(b=a.isMac?c.detail*3:Math.max(-256,Math.min(256,c.detail))*b,c.axis===c.HORIZONTAL_AXIS?d=b:e=b):a.isMac?(e=c.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=c.timeStamp,d=c.wheelDeltaX%120!==0?1:e<40?40/(40-e):40,e=c.wheelDeltaY%120!==0?1:e<40?40/(40-e):40,d=Math.ceil(-c.wheelDeltaX/d),-1<d&&d<0&&(d=-1),0<d&&d<1&&(d=1),e=Math.ceil(-c.wheelDeltaY/e),-1<e&&e<0&&(e=-1),0<e&&e<1&&(e=1)):(d=-c.wheelDeltaX,e=-c.wheelDeltaY/120*8*b);if(a.isSafari||
a.isChrome&&a.isMac){for(b=c.target;b&&b.lineIndex===void 0;)b=b.parentNode;this._mouseWheelLine=b}b=this._getScroll();this._scrollView(d,e);d=this._getScroll();if(b.x!==d.x||b.y!==d.y)return c.preventDefault&&c.preventDefault(),!1},_handlePaste:function(c){if(!this._ignoreEvent(c)&&!this._ignorePaste&&this._doPaste(c)){if(a.isIE){var b=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){b._updateDOMSelection();b._ignoreFocus=!1},0)}c.preventDefault&&c.preventDefault();return!1}},_handleResize:function(){var b=
this._rootDiv.clientWidth,d=this._rootDiv.clientHeight;if(this._rootWidth!==b||this._rootHeight!==d){this._rootWidth!==b&&this._wrapMode&&this._resetLineHeight();this._rootWidth=b;this._rootHeight=d;b=a.isIE<9;d=this._calculateMetrics();if(!c(d,this._metrics)){if(this._variableLineHeight)this._variableLineHeight=!1,this._resetLineHeight();this._metrics=d;b=!0}b?this._queueUpdate():this._update()}},_handleRulerEvent:function(a){for(var c=a.target?a.target:a.srcElement,b=c.lineIndex;c&&!c._ruler;){if(b===
void 0&&c.lineIndex!==void 0)b=c.lineIndex;c=c.parentNode}var d=c?c._ruler:null;if(b===void 0&&d&&d.getOverview()==="document"){var b=this._getClientHeight(),e=this._model.getLineCount(),g=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),b=Math.floor((a.clientY-f.top-this._metrics.scrollWidth)*e/(b+g.top+g.bottom-2*this._metrics.scrollWidth));0<=b&&b<e||(b=void 0)}if(d)switch(a.type){case "click":if(d.onClick)d.onClick(b,a);break;case "dblclick":if(d.onDblClick)d.onDblClick(b,a);break;
case "mousemove":if(d.onMouseMove)d.onMouseMove(b,a);break;case "mouseover":if(d.onMouseOver)d.onMouseOver(b,a);break;case "mouseout":if(d.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===c)return;e=e.parentNode}d.onMouseOut(b,a)}}},_handleScroll:function(){var a=this._getScroll(!1),c=this._hScroll,b=this._vScroll;if(c!==a.x||b!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(b===a.y),this.onScroll({type:"Scroll",oldValue:{x:c,y:b},newValue:a})},_handleSelectStart:function(a){if(this._ignoreSelect)return a&&
a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,c){if(a){var b;b=a.tagName==="DIV"?a:a.parentNode.parentNode;var d=0,e=b.lineIndex;if(a.tagName!=="DIV")for(b=b.firstChild;b;){var g=b.firstChild;if(g===a){b.ignoreChars&&(d-=b.ignoreChars);d+=c;break}b.ignoreChars&&(d-=b.ignoreChars);d+=g.data.length;b=b.nextSibling}return Math.max(0,d)+this._model.getLineStart(e)}},_updateSelectionFromDOM:function(){var a=this._getWindow().getSelection(),c=this._getModelOffset(a.anchorNode,a.anchorOffset),
a=this._getModelOffset(a.focusNode,a.focusOffset);c===void 0||a===void 0||this._setSelection(new o(c,a),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset===-1)if(a.isAndroid){var c=this._getWindow();this._selTimer&&c.clearTimeout(this._selTimer);var b=this;this._selTimer=c.setTimeout(function(){if(b._clientDiv)b._selTimer=null,b._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var c=this._getWindow().getSelection();
if(c.anchorNode!==this._anchorNode||c.focusNode!==this._focusNode||c.anchorOffset!==this._anchorOffset||c.focusOffset!==this._focusOffset){for(var b=c.anchorNode;b;){if(b.lineIndex!==void 0)break;b=b.parentNode}if(b){var d=this._model,e=b.lineIndex,g=d.getLine(e),f=g,i=0,d=d.getLineStart(e);if(c.rangeCount>0)c.getRangeAt(0).deleteContents(),e=b.ownerDocument.createTextNode(a.data),c.getRangeAt(0).insertNode(e),i=this._getDOMText(b,e),f=i.text,i=i.offset,e.parentNode.removeChild(e);b.lineRemoved=!0;
for(b=0;g.charCodeAt(b)===f.charCodeAt(b)&&b<i;)b++;c=g.length-1;for(e=f.length-g.length;g.charCodeAt(c)===f.charCodeAt(c+e)&&c+e>=i+a.data.length;)c--;c++;g=f.substring(b,c+e);b+=d;c+=d;this._modifyContent({text:g,start:b,end:c,_ignoreDOMSelection:!0},!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(c){this._commitIME();var b=this._getWindow();if(this._touchScrollTimer)this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",b.clearInterval(this._touchScrollTimer),
this._touchScrollTimer=null;var d=c.touches;if(d.length===1){var d=d[0],e=d.clientX,g=d.clientY;this._touchStartX=e;this._touchStartY=g;if(a.isAndroid&&(g<d.pageY-b.pageYOffset||e<d.pageX-b.pageXOffset))e=d.pageX-b.pageXOffset,g=d.pageY-b.pageYOffset;b=this.convert({x:e,y:g},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(b.x,b.y);this._touchStartTime=c.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var c=a.touches;if(c.length===1){c=c[0];this._touchCurrentX=c.clientX;
this._touchCurrentY=c.clientY;if(!this._touchScrollTimer&&a.timeStamp-this._touchStartTime<200){this._vScrollDiv.style.display="block";if(!this._wrapMode)this._hScrollDiv.style.display="block";var b=this,d=this._getWindow();this._touchScrollTimer=d.setInterval(function(){var a=0,c=0;if(b._touching)a=b._touchStartX-b._touchCurrentX,c=b._touchStartY-b._touchCurrentY,b._touchSpeedX=a/10,b._touchSpeedY=c/10,b._touchStartX=b._touchCurrentX,b._touchStartY=b._touchCurrentY;else if(Math.abs(b._touchSpeedX)<
0.1&&Math.abs(b._touchSpeedY)<0.1){b._vScrollDiv.style.display="none";b._hScrollDiv.style.display="none";d.clearInterval(b._touchScrollTimer);b._touchScrollTimer=null;return}else a=b._touchSpeedX*10,c=b._touchSpeedY*10,b._touchSpeedX*=0.95,b._touchSpeedY*=0.95;b._scrollView(a,c)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){if(a.touches.length===0)this._touching=!1},_doAction:function(a){var c,b,d=this._keyModes;for(b=d.length-1;b>=0;b--)if(c=d[b],typeof c.match===
"function"&&(c=c.match(a),c!==void 0))return this.invokeAction(c);return!1},_doMove:function(a,c){var b=this._model,d=c.getCaret(),e=b.getLineAtOffset(d);if(!a.count)a.count=1;for(;a.count!==0;){var g=b.getLineStart(e);if(a.count<0&&d===g)if(e>0)a.unit==="character"&&a.count++,e--,c.extend(b.getLineEnd(e));else break;else if(a.count>0&&d===b.getLineEnd(e))if(e+1<b.getLineCount())a.unit==="character"&&a.count--,e++,c.extend(b.getLineStart(e));else break;else{var f=!1;a.expandTab&&a.unit==="character"&&
(d-g)%this._tabSize===0&&(f=!/[^ ]/.test(b.getText(g,d)));f?(c.extend(d-this._tabSize),a.count+=a.count<0?1:-1):(g=this._getLine(e),c.extend(g.getNextOffset(d,a)),g.destroy())}d=c.getCaret()}return c},_doBackspace:function(a){var c=this._getSelection();if(c.isEmpty()){if(!a.count)a.count=1;a.count*=-1;a.expandTab=this._expandTab;this._doMove(a,c)}this._modifyContent({text:"",start:c.start,end:c.end},!0);return!0},_doCase:function(a){var c=this._getSelection();this._doMove(a,c);var b=this.getText(c.start,
c.end);this._setSelection(c,!0);switch(a.type){case "lower":b=b.toLowerCase();break;case "capitalize":b=b.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(c=0;c<b.length;c++){var d=b[c],e=d.toLowerCase(),d=e!==d?e:d.toUpperCase();a+=d}b=a;break;default:b=b.toUpperCase()}this._doContent(b);return!0},_doContent:function(a){var c=this._getSelection();if(this._overwriteMode&&c.isEmpty()){var b=this._model,d=b.getLineAtOffset(c.end);c.end<b.getLineEnd(d)&&(b=this._getLine(d),
c.extend(b.getNextOffset(c.getCaret(),{unit:"character",count:1})),b.destroy())}this._modifyContent({text:a,start:c.start,end:c.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var c=this._getSelection();return!c.isEmpty()?this._setClipboardText(this._getBaseText(c.start,c.end),a):!0},_doCursorNext:function(a){var c=this._getSelection();!c.isEmpty()&&!a.select?c.start=c.end:this._doMove(a,c);a.select||c.collapse();this._setSelection(c,!0);return!0},_doCursorPrevious:function(a){var c=this._getSelection();
if(!c.isEmpty()&&!a.select)c.end=c.start;else{if(!a.count)a.count=1;a.count*=-1;this._doMove(a,c)}a.select||c.collapse();this._setSelection(c,!0);return!0},_doCut:function(a){var c=this._getSelection();return!c.isEmpty()?(c=this._getBaseText(c.start,c.end),this._doContent(""),this._setClipboardText(c,a)):!0},_doDelete:function(a){var c=this._getSelection();c.isEmpty()&&this._doMove(a,c);this._modifyContent({text:"",start:c.start,end:c.end},!0);return!0},_doEnd:function(a){var c=this._getSelection(),
b=this._model,d;if(a.ctrl)c.extend(b.getCharCount()),d=function(){};else{var e=c.getCaret(),g=b.getLineAtOffset(e);if(this._wrapMode){var f=this._getLine(g),e=f.getLineIndex(e),e=e===f.getLineCount()-1?b.getLineEnd(g):f.getLineStart(e+1)-1;f.destroy()}else a.count&&a.count>0&&(g=Math.min(g+a.count-1,b.getLineCount()-1)),e=b.getLineEnd(g);c.extend(e)}a.select||c.collapse();this._setSelection(c,!0,!0,d);return!0},_doEnter:function(a){var c=this._model,b=this._getSelection();this._doContent(c.getLineDelimiter());
if(a&&a.noCursor)b.end=b.start,this._setSelection(b,!0);return!0},_doHome:function(a){var c=this._getSelection(),b=this._model,d;if(a.ctrl)c.extend(0),d=function(){};else{var e=c.getCaret(),g=b.getLineAtOffset(e);this._wrapMode?(b=this._getLine(g),e=b.getLineIndex(e),e=b.getLineStart(e),b.destroy()):e=b.getLineStart(g);c.extend(e)}a.select||c.collapse();this._setSelection(c,!0,!0,d);return!0},_doLineDown:function(c){var b=this._model,d=this._getSelection(),e=d.getCaret(),g=b.getLineAtOffset(e),f=
this._getLine(g),i=this._columnX,l=1,h=!1;if(i===-1||c.wholeLine||c.select&&a.isIE)i=c.wholeLine?b.getLineEnd(g+1):e,i=f.getBoundingClientRect(i).left;(e=f.getLineIndex(e))<f.getLineCount()-1?l=f.getClientRects(e+1).top+1:(e=b.getLineCount()-1,h=g===e,c.count&&c.count>0?g=Math.min(g+c.count,e):g++);e=!1;if(h){if(c.select||a.isMac||a.isLinux)d.extend(b.getCharCount()),e=!0}else f.lineIndex!==g&&(f.destroy(),f=this._getLine(g)),d.extend(f.getOffset(i,l)),e=!0;e&&(c.select||d.collapse(),this._setSelection(d,
!0,!0));this._columnX=i;f.destroy();return!0},_doLineUp:function(c){var b=this._model,d=this._getSelection(),e=d.getCaret(),g=b.getLineAtOffset(e),f=this._getLine(g),i=this._columnX,l=!1,h;if(i===-1||c.wholeLine||c.select&&a.isIE)i=c.wholeLine?b.getLineStart(g-1):e,i=f.getBoundingClientRect(i).left;(e=f.getLineIndex(e))>0?h=f.getClientRects(e-1).top+1:(l=g===0,l||(c.count&&c.count>0?g=Math.max(g-c.count,0):g--,h=this._getLineHeight(g)-1));e=!1;if(l){if(c.select||a.isMac||a.isLinux)d.extend(0),e=!0}else f.lineIndex!==
g&&(f.destroy(),f=this._getLine(g)),d.extend(f.getOffset(i,h)),e=!0;e&&(c.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=i;f.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(c){var b=this,d=this._model,e=this._getSelection(),g=e.getCaret(),f=d.getLineAtOffset(g),i=d.getLineCount(),l=this._getScroll(),d=this._getClientHeight(),h,m;if(this._lineHeight){h=this._columnX;l=this._getBoundsAtOffset(g);if(h===-1||c.select&&a.isIE)h=l.left;g=this._getLineIndex(l.top+d);
m=this._getLine(g);f=this._getLinePixel(g);g=m.getOffset(h,l.top+d-f);d=m.getBoundingClientRect(g);m.destroy();e.extend(g);c.select||e.collapse();this._setSelection(e,!0,!0,function(){b._columnX=h},d.top+f-l.top);return!0}if(f<i-1){var j=this._getLineHeight(),p=Math.min(i-f-1,Math.floor(d/j)),p=Math.max(1,p);h=this._columnX;if(h===-1||c.select&&a.isIE)m=this._getLine(f),h=m.getBoundingClientRect(g).left,m.destroy();m=this._getLine(f+p);e.extend(m.getOffset(h,0));m.destroy();c.select||e.collapse();
c=i*j;g=l.y+p*j;g+d>c&&(g=c-d);this._setSelection(e,!0,!0,function(){b._columnX=h},g-l.y)}return!0},_doPageUp:function(c){var b=this,d=this._model,e=this._getSelection(),g=e.getCaret(),f=d.getLineAtOffset(g),i=this._getScroll(),l=this._getClientHeight(),h;if(this._lineHeight){h=this._columnX;i=this._getBoundsAtOffset(g);if(h===-1||c.select&&a.isIE)h=i.left;g=this._getLineIndex(i.bottom-l);d=this._getLine(g);f=this._getLinePixel(g);g=d.getOffset(h,i.bottom-l-f);l=d.getBoundingClientRect(g);d.destroy();
e.extend(g);c.select||e.collapse();this._setSelection(e,!0,!0,function(){b._columnX=h},l.top+f-i.top);return!0}if(f>0){var m=this._getLineHeight(),l=Math.max(1,Math.min(f,Math.floor(l/m)));h=this._columnX;if(h===-1||c.select&&a.isIE)d=this._getLine(f),h=d.getBoundingClientRect(g).left,d.destroy();d=this._getLine(f-l);e.extend(d.getOffset(h,this._getLineHeight(f-l)-1));d.destroy();c.select||e.collapse();c=Math.max(0,i.y-l*m);this._setSelection(e,!0,!0,function(){b._columnX=h},c-i.y)}return!0},_doPaste:function(c){var b=
this;return this._getClipboardText(c,function(c){c&&(a.isLinux&&b._lastMouseButton===2&&(new Date).getTime()-b._lastMouseTime<=b._clickTime&&b._setSelectionTo(b._lastMouseX,b._lastMouseY),b._doContent(c))})!==null},_doScroll:function(a){var c=a.type,b=this._model,d=b.getLineCount(),a=this._getClientHeight(),e=this._getLineHeight();d*=e;var g=this._getScroll().y,f;switch(c){case "textStart":f=0;break;case "textEnd":f=d-a;break;case "pageDown":f=g+a;break;case "pageUp":f=g-a;break;case "lineDown":f=
g+e;break;case "lineUp":f=g-e;break;case "centerLine":c=this._getSelection(),f=b.getLineAtOffset(c.start),b=(b.getLineAtOffset(c.end)-f+1)*e,f=f*e-a/2+b/2}f!==void 0&&(f=Math.min(Math.max(0,f),d-a),this._scrollViewAnimated(0,f-g,function(){}));return!0},_doSelectAll:function(){var a=this._model,c=this._getSelection();c.setCaret(0);c.extend(a.getCharCount());this._setSelection(c,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var a="\t";if(this._expandTab)var c=this._model,a=this._getSelection().getCaret(),
b=c.getLineAtOffset(a),c=c.getLineStart(b),a=Array(this._tabSize-(a-c)%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 c=
this._model,b=this._getSelection(),d=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),e=b.getCaret(),g=c.getLineCount(),f=c.getLineAtOffset(e),i;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")e=this._autoScrollY/this._getLineHeight(),e=e<0?Math.floor(e):Math.ceil(e),i=Math.max(0,Math.min(g-1,f+e));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")i=this._getLineIndex(d.y),f=this._getLine(f),d.x+=f.getBoundingClientRect(e,!1).left,f.destroy();
i===0&&(a.isMac||a.isLinux)?b.extend(0):i===g-1&&(a.isMac||a.isLinux)?b.extend(c.getCharCount()):(f=this._getLine(i),b.extend(f.getOffset(d.x,d.y-this._getLinePixel(i))),f.destroy());this._setSelection(b,!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 c=this._model.getLineCount(),b=0;if(a){for(var a=
0,d=(new Date).getTime(),e=0;b<c;)if(this._lineHeight[b]||(a++,e||(e=b),this._lineHeight[b]=this._calculateLineHeight(b)),b++,(new Date).getTime()-d>100)break;this.redrawRulers(0,c);this._queueUpdate()}a=this._getWindow();if(b!==c){var g=this;this._calculateLHTimer=a.setTimeout(function(){g._calculateLHTimer=null;g._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(a){var a=this._getLine(a),
c=a.getBoundingClientRect();a.destroy();return Math.max(1,c.bottom-c.top)},_calculateMetrics:function(){var c=this._clientDiv,b=c.ownerDocument,d=a.createElement(b,"div");d.style.lineHeight="normal";var g={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(g);e(g.style,d);d.style.position="fixed";d.style.left="-1000px";var f=a.createElement(b,"span");f.appendChild(b.createTextNode(" "));d.appendChild(f);var i=a.createElement(b,"span");i.style.fontStyle=
"italic";i.appendChild(b.createTextNode(" "));d.appendChild(i);var l=a.createElement(b,"span");l.style.fontWeight="bold";l.appendChild(b.createTextNode(" "));d.appendChild(l);g=a.createElement(b,"span");g.style.fontWeight="bold";g.style.fontStyle="italic";g.appendChild(b.createTextNode(" "));d.appendChild(g);c.appendChild(d);var h=d.getBoundingClientRect(),f=f.getBoundingClientRect(),i=i.getBoundingClientRect(),l=l.getBoundingClientRect(),g=g.getBoundingClientRect(),f=f.bottom-f.top,i=i.bottom-i.top,
l=l.bottom-l.top,j=g.bottom-g.top,o=0,g=h.bottom-h.top<=0,h=Math.max(1,h.bottom-h.top);i>f&&(o=1);l>i&&(o=2);j>l&&(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=p(d);c.removeChild(d);j=m(this._viewDiv);d=a.createElement(b,"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=a.createElement(b,"div");j.style.width="100%";j.style.height="100%";d.appendChild(j);c.appendChild(d);o=d.getBoundingClientRect();i=j.getBoundingClientRect();l=0;if(!this._singleMode)d.style.overflow="hidden",j.style.height="200px",l=d.clientWidth,d.style.overflow="scroll",l-=d.clientWidth;c.removeChild(d);j={left:i.left-o.left,top:i.top-o.top,right:o.right-i.right,bottom:o.bottom-i.bottom};i=o=0;if(!g&&(this._wrapOffset||this._marginOffset))d=a.createElement(b,"div"),d.style.position="fixed",
d.style.left="-1000px",d.innerHTML=Array(this._wrapOffset+1).join(" "),c.appendChild(d),o=d.getBoundingClientRect(),o=Math.ceil(o.right-o.left),d.innerHTML=Array(this._marginOffset+1).join(" "),i=d.getBoundingClientRect(),i=Math.ceil(i.right-i.left),c.removeChild(d);return{lineHeight:h,largestFontStyle:k,lineTrim:f,viewPadding:j,scrollWidth:l,wrapWidth:o,marginWidth:i,invalid:g}},_cancelAnimation:function(){if(this._animation)this._animation.stop(),this._animation=null},_clearSelection:function(a){var c=
this._getSelection();if(c.isEmpty())return!1;a==="next"?c.start=c.end:c.end=c.start;this._setSelection(c,!0);return!0},_commitIME:function(){if(this._imeOffset!==-1){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,c=a.getLineAtOffset(this._imeOffset),b=a.getLineStart(c),d=this._getDOMText(this._getLineNode(c)).text,a=a.getLine(c),b=this._imeOffset-b,a=b+d.length-a.length;b!==a&&this._doContent(d.substring(b,a));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new h.DefaultKeyMode(this));
var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(c){return a._doLineUp(g(c,{select:!1}))},actionDescription:{name:j.lineUp}},lineDown:{defaultHandler:function(c){return a._doLineDown(g(c,{select:!1}))},actionDescription:{name:j.lineDown}},lineStart:{defaultHandler:function(c){return a._doHome(g(c,{select:!1,ctrl:!1}))},actionDescription:{name:j.lineStart}},lineEnd:{defaultHandler:function(c){return a._doEnd(g(c,{select:!1,ctrl:!1}))},actionDescription:{name:j.lineEnd}},
charPrevious:{defaultHandler:function(c){return a._doCursorPrevious(g(c,{select:!1,unit:"character"}))},actionDescription:{name:j.charPrevious}},charNext:{defaultHandler:function(c){return a._doCursorNext(g(c,{select:!1,unit:"character"}))},actionDescription:{name:j.charNext}},pageUp:{defaultHandler:function(c){return a._doPageUp(g(c,{select:!1}))},actionDescription:{name:j.pageUp}},pageDown:{defaultHandler:function(c){return a._doPageDown(g(c,{select:!1}))},actionDescription:{name:j.pageDown}},scrollPageUp:{defaultHandler:function(c){return a._doScroll(g(c,
{type:"pageUp"}))},actionDescription:{name:j.scrollPageUp}},scrollPageDown:{defaultHandler:function(c){return a._doScroll(g(c,{type:"pageDown"}))},actionDescription:{name:j.scrollPageDown}},scrollLineUp:{defaultHandler:function(c){return a._doScroll(g(c,{type:"lineUp"}))},actionDescription:{name:j.scrollLineUp}},scrollLineDown:{defaultHandler:function(c){return a._doScroll(g(c,{type:"lineDown"}))},actionDescription:{name:j.scrollLineDown}},wordPrevious:{defaultHandler:function(c){return a._doCursorPrevious(g(c,
{select:!1,unit:"word"}))},actionDescription:{name:j.wordPrevious}},wordNext:{defaultHandler:function(c){return a._doCursorNext(g(c,{select:!1,unit:"word"}))},actionDescription:{name:j.wordNext}},textStart:{defaultHandler:function(c){return a._doHome(g(c,{select:!1,ctrl:!0}))},actionDescription:{name:j.textStart}},textEnd:{defaultHandler:function(c){return a._doEnd(g(c,{select:!1,ctrl:!0}))},actionDescription:{name:j.textEnd}},scrollTextStart:{defaultHandler:function(c){return a._doScroll(g(c,{type:"textStart"}))},
actionDescription:{name:j.scrollTextStart}},scrollTextEnd:{defaultHandler:function(c){return a._doScroll(g(c,{type:"textEnd"}))},actionDescription:{name:j.scrollTextEnd}},centerLine:{defaultHandler:function(c){return a._doScroll(g(c,{type:"centerLine"}))},actionDescription:{name:j.centerLine}},selectLineUp:{defaultHandler:function(c){return a._doLineUp(g(c,{select:!0}))},actionDescription:{name:j.selectLineUp}},selectLineDown:{defaultHandler:function(c){return a._doLineDown(g(c,{select:!0}))},actionDescription:{name:j.selectLineDown}},
selectWholeLineUp:{defaultHandler:function(c){return a._doLineUp(g(c,{select:!0,wholeLine:!0}))},actionDescription:{name:j.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(c){return a._doLineDown(g(c,{select:!0,wholeLine:!0}))},actionDescription:{name:j.selectWholeLineDown}},selectLineStart:{defaultHandler:function(c){return a._doHome(g(c,{select:!0,ctrl:!1}))},actionDescription:{name:j.selectLineStart}},selectLineEnd:{defaultHandler:function(c){return a._doEnd(g(c,{select:!0,ctrl:!1}))},
actionDescription:{name:j.selectLineEnd}},selectCharPrevious:{defaultHandler:function(c){return a._doCursorPrevious(g(c,{select:!0,unit:"character"}))},actionDescription:{name:j.selectCharPrevious}},selectCharNext:{defaultHandler:function(c){return a._doCursorNext(g(c,{select:!0,unit:"character"}))},actionDescription:{name:j.selectCharNext}},selectPageUp:{defaultHandler:function(c){return a._doPageUp(g(c,{select:!0}))},actionDescription:{name:j.selectPageUp}},selectPageDown:{defaultHandler:function(c){return a._doPageDown(g(c,
{select:!0}))},actionDescription:{name:j.selectPageDown}},selectWordPrevious:{defaultHandler:function(c){return a._doCursorPrevious(g(c,{select:!0,unit:"word"}))},actionDescription:{name:j.selectWordPrevious}},selectWordNext:{defaultHandler:function(c){return a._doCursorNext(g(c,{select:!0,unit:"word"}))},actionDescription:{name:j.selectWordNext}},selectTextStart:{defaultHandler:function(c){return a._doHome(g(c,{select:!0,ctrl:!0}))},actionDescription:{name:j.selectTextStart}},selectTextEnd:{defaultHandler:function(c){return a._doEnd(g(c,
{select:!0,ctrl:!0}))},actionDescription:{name:j.selectTextEnd}},deletePrevious:{defaultHandler:function(c){return a._doBackspace(g(c,{unit:"character"}))},actionDescription:{name:j.deletePrevious}},deleteNext:{defaultHandler:function(c){return a._doDelete(g(c,{unit:"character"}))},actionDescription:{name:j.deleteNext}},deleteWordPrevious:{defaultHandler:function(c){return a._doBackspace(g(c,{unit:"word"}))},actionDescription:{name:j.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(c){return a._doDelete(g(c,
{unit:"word"}))},actionDescription:{name:j.deleteWordNext}},deleteLineStart:{defaultHandler:function(c){return a._doBackspace(g(c,{unit:"line"}))},actionDescription:{name:j.deleteLineStart}},deleteLineEnd:{defaultHandler:function(c){return a._doDelete(g(c,{unit:"line"}))},actionDescription:{name:j.deleteLineEnd}},tab:{defaultHandler:function(){return a._doTab()},actionDescription:{name:j.tab}},shiftTab:{defaultHandler:function(){return a._doShiftTab()},actionDescription:{name:j.shiftTab}},enter:{defaultHandler:function(){return a._doEnter()},
actionDescription:{name:j.enter}},enterNoCursor:{defaultHandler:function(c){return a._doEnter(g(c,{noCursor:!0}))},actionDescription:{name:j.enterNoCursor}},selectAll:{defaultHandler:function(){return a._doSelectAll()},actionDescription:{name:j.selectAll}},copy:{defaultHandler:function(){return a._doCopy()},actionDescription:{name:j.copy}},cut:{defaultHandler:function(){return a._doCut()},actionDescription:{name:j.cut}},paste:{defaultHandler:function(){return a._doPaste()},actionDescription:{name:j.paste}},
uppercase:{defaultHandler:function(c){return a._doCase(g(c,{type:"upper"}))},actionDescription:{name:j.uppercase}},lowercase:{defaultHandler:function(c){return a._doCase(g(c,{type:"lower"}))},actionDescription:{name:j.lowercase}},capitalize:{defaultHandler:function(c){return a._doCase(g(c,{unit:"word",type:"capitalize"}))},actionDescription:{name:j.capitalize}},reversecase:{defaultHandler:function(c){return a._doCase(g(c,{type:"reverse"}))},actionDescription:{name:j.reversecase}},toggleOverwriteMode:{defaultHandler:function(){return a._doOverwriteMode()},
actionDescription:{name:j.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(){return a._doTabMode()},actionDescription:{name:j.toggleTabMode}},toggleWrapMode:{defaultHandler:function(){return a._doWrapMode()},actionDescription:{name:j.toggleWrapMode}}}},_createRulerParent:function(c){var b=a.createElement(document,"div");b.className=c;b.tabIndex=-1;b.style.overflow="hidden";b.style.MozUserSelect="none";b.style.WebkitUserSelect="none";b.style.position="absolute";b.style.top="0px";b.style.bottom=
"0px";b.style.cursor="default";b.style.display="none";b.setAttribute("aria-hidden","true");this._rootDiv.appendChild(b);return b},_createRuler:function(c,b){if(this._clientDiv){var d=this._getRulerParent(c);if(d){if(d!==this._marginDiv||this._marginOffset)d.style.display="block";var e=a.createElement(d.ownerDocument,"div");e._ruler=c;e.rulerChanged=!0;e.style.position="relative";e.style.cssFloat="left";e.style.styleFloat="left";e.style.outline="none";if(b===void 0||b<0||b>=d.children.length)d.appendChild(e);
else{for(var g=d.firstChild;g&&b-- >0;)g=g.nextSibling;d.insertBefore(e,g)}}}},_createView:function(){if(!this._clientDiv){for(var c=this._parent;c.hasChildNodes();)c.removeChild(c.lastChild);var b=c.ownerDocument,d=a.createElement(b,"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");c.appendChild(d);this._leftDiv=this._createRulerParent("textviewLeftRuler");
c=a.createElement(b,"div");c.className="textviewScroll";this._viewDiv=c;c.tabIndex=-1;c.style.position="absolute";c.style.top="0px";c.style.bottom="0px";c.style.borderWidth="0px";c.style.margin="0px";c.style.outline="none";c.style.background="transparent";if(a.isMac&&a.isWebkit)c.style.pointerEvents="none",c.style.zIndex="2";d.appendChild(c);var e=this._createRulerParent("textviewRightRuler");this._rightDiv=e;e.style.right="0px";this._scrollDiv=e=a.createElement(b,"div");e.style.margin="0px";e.style.borderWidth=
"0px";e.style.padding="0px";c.appendChild(e);(this._marginDiv=this._createRulerParent("textviewMarginRuler")).style.zIndex="4";if(!a.isIE&&!a.isIOS)this._clipDiv=c=a.createElement(b,"div"),c.style.position="absolute",c.style.overflow="hidden",c.style.margin="0px",c.style.borderWidth="0px",c.style.padding="0px",c.style.background="transparent",d.appendChild(c),this._clipScrollDiv=e=a.createElement(b,"div"),e.style.position="absolute",e.style.height="1px",e.style.top="-1000px",e.style.background="transparent",
c.appendChild(e);this._setFullSelection(this._fullSelection,!0);c=a.createElement(b,"div");c.className="textviewContent";this._clientDiv=c;c.tabIndex=0;c.style.position="absolute";c.style.borderWidth="0px";c.style.margin="0px";c.style.padding="0px";c.style.outline="none";c.style.zIndex="1";c.style.WebkitUserSelect="text";c.setAttribute("spellcheck","false");if(a.isIOS||a.isAndroid)c.style.WebkitTapHighlightColor="transparent";(this._clipDiv||d).appendChild(c);if(a.isIOS||a.isAndroid)this._vScrollDiv=
e=a.createElement(b,"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=a.createElement(b,"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(a.isFirefox&&!c.setCapture)this._overlayDiv=b=a.createElement(b,"div"),b.style.position=c.style.position,b.style.borderWidth=c.style.borderWidth,b.style.margin=c.style.margin,b.style.padding=c.style.padding,b.style.cursor="text",b.style.zIndex="2",(this._clipDiv||
d).appendChild(b);c.contentEditable="true";c.setAttribute("role","textbox");c.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(b=0;b<d.length;b++)this._createRuler(d[b]);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:b.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var c=this._getRulerParent(a);if(c)for(var b=c.firstChild;b;){if(b._ruler===a){b._ruler=void 0;c.removeChild(b);if(c.children.length===0&&(c!==this._marginDiv||!this._marginOffset))c.style.display="none";break}b=b.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,c,b){this._autoScrollDir=a;this._autoScrollX=c;this._autoScrollY=b;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 c=this._hasFocus;this._ignoreFocus=!0;c&&a.blur();a.contentEditable=!1;a.contentEditable=!0;c&&a.focus();this._ignoreFocus=
!1}},_getBaseText:function(a,c){var b=this._model;b.getBaseModel&&(a=b.mapOffset(a),c=b.mapOffset(c),b=b.getBaseModel());return b.getText(a,c)},_getBottomIndex:function(a){var c=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=c.getBoundingClientRect(),b=this._clientDiv.getBoundingClientRect();a.bottom>b.bottom&&(c=this._getLinePrevious(c)||c)}return c.lineIndex},_getBoundsAtOffset:function(a){var c=this._getLine(this._model.getLineAtOffset(a)),a=c.getBoundingClientRect(a),
b=this._getLinePixel(c.lineIndex);a.top+=b;a.bottom+=b;c.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(c,b){var d=this._model.getLineDelimiter(),e,g,f=this._getWindow(),i=f.clipboardData;if(!i&&c)i=c.clipboardData;if(i)return e=[],g=i.getData(a.isIE?"Text":"text/plain"),
l(g,function(a){e.push(a)},function(){e.push(d)}),g=e.join(""),b&&b(g),g;if(a.isFirefox){this._ignoreFocus=!0;var h=this._clipboardDiv,i=this._rootDiv.ownerDocument;if(!h)this._clipboardDiv=h=a.createElement(i,"div"),h.style.position="fixed",h.style.whiteSpace="pre",h.style.left="-1000px",this._rootDiv.appendChild(h);h.innerHTML="<pre contenteditable=''></pre>";h.firstChild.focus();var m=this,j=function(){var a=m._getTextFromElement(h);h.innerHTML="";e=[];l(a,function(a){e.push(a)},function(){e.push(d)});
return e.join("")},p=!1;this._ignorePaste=!0;if(!a.isLinux||this._lastMouseButton!==2)try{p=i.execCommand("paste",!1,null)}catch(o){p=h.childNodes.length>1||h.firstChild&&h.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!p)return c?(f.setTimeout(function(){m.focus();(g=j())&&b&&b(g);m._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(g=j())&&b&&b(g);return g}return""},_getDOMText:function(a,c){for(var b=a.firstChild,d="",e=0;b;){var g;if(!b.ignore)if(b.ignoreChars){g=
b.lastChild;for(var f=0,i=[],l=-1;g;){var h=g.data;if(h)for(var m=h.length-1;m>=0;m--){var j=h.substring(m,m+1);f<b.ignoreChars&&(j===" "||j==="\u200b"||j==="\ufeff")?f++:i.push(j==="\u00a0"?"\t":j)}if(c===g)l=i.length;g=g.previousSibling}i=i.reverse().join("");l!==-1&&(e=d.length+i.length-l);d+=i}else for(g=b.firstChild;g;){if(c===g)e=d.length;d+=g.data;g=g.nextSibling}b=b.nextSibling}return{text:d,offset:e}},_getTextFromElement:function(a){var c=a.ownerDocument,b=c.defaultView;if(!b.getSelection)return a.innerText||
a.textContent;c=c.createRange();c.selectNode(a);var a=b.getSelection(),b=[],d;for(d=0;d<a.rangeCount;d++)b.push(a.getRangeAt(d));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(c);c=a.toString();a.removeAllRanges();for(d=0;d<b.length;d++)a.addRange(b[d]);this._ignoreSelect=!1;return c},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var c=this._getLineNode(a);return c&&!c.lineChanged&&!c.lineRemoved?c._line:new v(this,a)},_getLineHeight:function(a,c){if(a!==
void 0&&this._lineHeight){var b=this._lineHeight[a];if(b)return b;if(c||c===void 0)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var c=this._clientDiv.firstChild;c;){if(a===c.lineIndex)return c;c=c.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 c=this._getTopIndex(),b=-this._topIndexY+this._getScroll().y;if(a>c)for(;c<a;c++)b+=this._getLineHeight(c);else for(c-=1;c>=a;c--)b-=this._getLineHeight(c);return b}return this._getLineHeight()*a},_getLineIndex:function(a){var c,b=0,d=this._model.getLineCount();if(this._lineHeight){var b=this._getTopIndex(),e=-this._topIndexY+this._getScroll().y;if(a!==e)if(a<e)for(;a<
e&&b>0;)a+=this._getLineHeight(--b);else for(c=this._getLineHeight(b);a-c>=e&&b<d-1;)a-=c,c=this._getLineHeight(++b)}else c=this._getLineHeight(),b=Math.floor(a/c);return Math.max(0,Math.min(d-1,b))},_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 c=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=c.getBoundingClientRect(),b=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect();a.top<d.top+b.top&&(c=this._getLineNext(c)||c)}return c.lineIndex},_hookEvents:function(){var c=this;this._modelListener={onChanging:function(a){c._onModelChanging(a)},onChanged:function(a){c._onModelChanged(a)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",
this._modelListener.onChanged);this._themeListener={onChanged:function(){c._setThemeClass(c._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var b=this._handlers=[],d=this._clientDiv,e=this._viewDiv,g=this._rootDiv,f=this._overlayDiv||d,i=d.ownerDocument,l=this._getWindow(),h=a.isIE?i:l;b.push({target:l,type:"resize",handler:function(a){return c._handleResize(a?a:l.event)}});b.push({target:d,type:"blur",handler:function(a){return c._handleBlur(a?a:l.event)}});
b.push({target:d,type:"focus",handler:function(a){return c._handleFocus(a?a:l.event)}});b.push({target:e,type:"focus",handler:function(){d.focus()}});b.push({target:e,type:"scroll",handler:function(a){return c._handleScroll(a?a:l.event)}});b.push({target:d,type:"textInput",handler:function(a){return c._handleTextInput(a?a:l.event)}});b.push({target:d,type:"keydown",handler:function(a){return c._handleKeyDown(a?a:l.event)}});b.push({target:d,type:"keypress",handler:function(a){return c._handleKeyPress(a?
a:l.event)}});b.push({target:d,type:"keyup",handler:function(a){return c._handleKeyUp(a?a:l.event)}});a.isIE&&b.push({target:i,type:"keyup",handler:function(a){return c._handleDocKeyUp(a?a:l.event)}});b.push({target:d,type:"contextmenu",handler:function(a){return c._handleContextMenu(a?a:l.event)}});b.push({target:d,type:"copy",handler:function(a){return c._handleCopy(a?a:l.event)}});b.push({target:d,type:"cut",handler:function(a){return c._handleCut(a?a:l.event)}});b.push({target:d,type:"paste",
handler:function(a){return c._handlePaste(a?a:l.event)}});if(a.isIOS||a.isAndroid)b.push({target:i,type:"selectionchange",handler:function(a){return c._handleSelectionChange(a?a:l.event)}}),b.push({target:d,type:"touchstart",handler:function(a){return c._handleTouchStart(a?a:l.event)}}),b.push({target:d,type:"touchmove",handler:function(a){return c._handleTouchMove(a?a:l.event)}}),b.push({target:d,type:"touchend",handler:function(a){return c._handleTouchEnd(a?a:l.event)}});else{b.push({target:d,type:"selectstart",
handler:function(a){return c._handleSelectStart(a?a:l.event)}});b.push({target:d,type:"mousedown",handler:function(a){return c._handleMouseDown(a?a:l.event)}});b.push({target:d,type:"mouseover",handler:function(a){return c._handleMouseOver(a?a:l.event)}});b.push({target:d,type:"mouseout",handler:function(a){return c._handleMouseOut(a?a:l.event)}});b.push({target:h,type:"mouseup",handler:function(a){return c._handleMouseUp(a?a:l.event)}});b.push({target:h,type:"mousemove",handler:function(a){return c._handleMouseMove(a?
a:l.event)}});b.push({target:g,type:"mousedown",handler:function(a){return c._handleRootMouseDown(a?a:l.event)}});b.push({target:g,type:"mouseup",handler:function(a){return c._handleRootMouseUp(a?a:l.event)}});b.push({target:f,type:"dragstart",handler:function(a){return c._handleDragStart(a?a:l.event)}});b.push({target:f,type:"drag",handler:function(a){return c._handleDrag(a?a:l.event)}});b.push({target:f,type:"dragend",handler:function(a){return c._handleDragEnd(a?a:l.event)}});b.push({target:f,
type:"dragenter",handler:function(a){return c._handleDragEnter(a?a:l.event)}});b.push({target:f,type:"dragover",handler:function(a){return c._handleDragOver(a?a:l.event)}});b.push({target:f,type:"dragleave",handler:function(a){return c._handleDragLeave(a?a:l.event)}});b.push({target:f,type:"drop",handler:function(a){return c._handleDrop(a?a:l.event)}});b.push({target:this._clientDiv,type:a.isFirefox>26?"wheel":a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return c._handleMouseWheel(a?
a:l.event)}});this._clipDiv&&b.push({target:this._clipDiv,type:a.isFirefox>26?"wheel":a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return c._handleMouseWheel(a?a:l.event)}});if(a.isFirefox&&(!a.isWindows||a.isFirefox>=15))(e=l.MutationObserver||l.MozMutationObserver)?(this._mutationObserver=new e(function(a){c._handleDataModified(a)}),this._mutationObserver.observe(d,{subtree:!0,characterData:!0})):b.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(a){return c._handleDataModified(a?
a:l.event)}});this._overlayDiv&&(b.push({target:this._overlayDiv,type:"mousedown",handler:function(a){return c._handleMouseDown(a?a:l.event)}}),b.push({target:this._overlayDiv,type:"mouseover",handler:function(a){return c._handleMouseOver(a?a:l.event)}}),b.push({target:this._overlayDiv,type:"mouseout",handler:function(a){return c._handleMouseOut(a?a:l.event)}}),b.push({target:this._overlayDiv,type:"contextmenu",handler:function(a){return c._handleContextMenu(a?a:l.event)}}));this._isW3CEvents||b.push({target:this._clientDiv,
type:"dblclick",handler:function(a){return c._handleDblclick(a?a:l.event)}})}this._hookRulerEvents(this._leftDiv,b);this._hookRulerEvents(this._rightDiv,b);this._hookRulerEvents(this._marginDiv,b);for(e=0;e<b.length;e++)g=b[e],r(g.target,g.type,g.handler,g.capture)},_hookRulerEvents:function(c,b){if(c){var d=this,e=this._getWindow();a.isIE&&b.push({target:c,type:"selectstart",handler:function(){return!1}});b.push({target:c,type:a.isFirefox>26?"wheel":a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return d._handleMouseWheel(a?
a:e.event)}});b.push({target:c,type:"click",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,type:"dblclick",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,type:"mousemove",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,type:"mouseover",handler:function(a){d._handleRulerEvent(a?a:e.event)}});b.push({target:c,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(c){var b=c.parent;typeof b==="string"&&(b=(c.document||document).getElementById(b));if(!b)throw"no parent";c.parent=b;c.model=c.model||new k.TextModel;var d=this._defaultOptions(),e;for(e in d)d.hasOwnProperty(e)&&(this["_"+e]=c[e]!==void 0?c[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=(!a.isIE||a.isIE>=9)&&typeof b.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=b.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,c){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(a.text===null||a.text===void 0)){var b=this._model;try{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!0;b.setText(a.text,a.start,a.end)}finally{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!1}c&&(b=
this._getSelection(),b.setCaret(a.start+a.text.length),this._setSelection(b,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var c=a.start,b=a.addedCharCount,d=a.removedCharCount,e=a.addedLineCount,g=a.removedLineCount,f=this._getSelection();f.end>c&&(f.end>c&&f.start<c+d?f.setCaret(c+b):(f.start+=b-d,f.end+=b-d),this._setSelection(f,!1,!1));c=this._model.getLineAtOffset(c);for(b=this._getLineNext();b;){d=b.lineIndex;if(c<=
d&&d<=c+g)c===d&&!b.modelChangedEvent&&!b.lineRemoved?(b.modelChangedEvent=a,b.lineChanged=!0):(b.lineRemoved=!0,b.lineChanged=!1,b.modelChangedEvent=null);if(d>c+g)b.lineIndex=d+e-g,b._line.lineIndex=b.lineIndex;b=this._getLineNext(b)}this._lineHeight&&(a=[c,g].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));if(!this._wrapMode&&c<=this._maxLineIndex&&this._maxLineIndex<=c+g)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,c){if(this._wrapMode||this._variableLineHeight){if(a!==void 0&&c!==void 0)for(var b=a;b<c;b++)this._lineHeight[b]=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 c=this._clientDiv;if(c){for(var b=c.firstChild;b;)b.lineRemoved=!0,b=b.nextSibling;if(a.isFirefox)this._ignoreFocus=
!1,(b=this._hasFocus)&&c.blur(),c.contentEditable=!1,c.contentEditable=!0,b&&c.focus(),this._ignoreFocus=!1}},_scrollViewAnimated:function(a,c,b){var d=this._getWindow();if(b&&this._scrollAnimation){var e=this;this._animation=new w({window:d,duration:this._scrollAnimation,curve:[c,0],onAnimate:function(a){a=c-Math.floor(a);e._scrollView(0,a);c-=a},onEnd:function(){e._animation=null;e._scrollView(a,c);b&&d.setTimeout(b,0)}});this._animation.play()}else this._scrollView(a,c),b&&d.setTimeout(b,0)},_scrollView:function(a,
c){this._ensureCaretVisible=!1;var b=this._viewDiv;a&&(b.scrollLeft+=a);c&&(b.scrollTop+=c)},_setClipboardText:function(c,b){var d,e=this._getWindow(),g=e.clipboardData;if(!g&&b)g=b.clipboardData;if(g&&(d=[],l(c,function(a){d.push(a)},function(){d.push(a.platformDelimiter)}),g.setData(a.isIE?"Text":"text/plain",d.join(""))))return!0;var f=this._parent.ownerDocument,i=a.createElement(f,"pre");i.style.position="fixed";i.style.left="-1000px";l(c,function(a){i.appendChild(f.createTextNode(a))},function(){i.appendChild(a.createElement(f,
"br"))});i.appendChild(f.createTextNode(" "));this._clientDiv.appendChild(i);g=f.createRange();g.setStart(i.firstChild,0);g.setEndBefore(i.lastChild);var h=e.getSelection();h.rangeCount>0&&h.removeAllRanges();h.addRange(g);var m=this,g=function(){i&&i.parentNode===m._clientDiv&&m._clientDiv.removeChild(i);m._updateDOMSelection()},h=!1;this._ignoreCopy=!0;try{h=f.execCommand("copy",!1,null)}catch(j){}this._ignoreCopy=!1;if(!h&&b)return e.setTimeout(g,0),!1;g();return!0},_setDOMSelection:function(c,
b,d,e,g){for(var f,i,l,h,m=0,j=c.firstChild,p,o,k=this._model.getLine(c.lineIndex).length;j;){if(!j.ignore){p=j.firstChild;o=p.length;j.ignoreChars&&(o-=j.ignoreChars);if(m+o>b||m+o>=k){f=p;i=b-m;j.ignoreChars&&o>0&&i===o&&(i+=j.ignoreChars);break}m+=o}j=j.nextSibling}for(var m=0,j=d.firstChild,q=this._model.getLine(d.lineIndex).length;j;){if(!j.ignore){p=j.firstChild;o=p.length;j.ignoreChars&&(o-=j.ignoreChars);if(o+m>e||m+o>=q){l=p;h=e-m;j.ignoreChars&&o>0&&h===o&&(h+=j.ignoreChars);break}m+=o}j=
j.nextSibling}this._setDOMFullSelection(c,b,k,d,e,q);c=this._getWindow();b=this._parent.ownerDocument;if(c.getSelection){d=c.getSelection();c=b.createRange();c.setStart(f,i);c.setEnd(l,h);if(this._hasFocus&&(d.anchorNode!==f||d.anchorOffset!==i||d.focusNode!==l||d.focusOffset!==h||d.anchorNode!==l||d.anchorOffset!==h||d.focusNode!==f||d.focusOffset!==i))this._anchorNode=f,this._anchorOffset=i,this._focusNode=l,this._focusOffset=h,this._ignoreSelect=!1,d.rangeCount>0&&d.removeAllRanges(),d.addRange(c),
this._ignoreSelect=!0;if(this._cursorDiv&&(c=b.createRange(),g?(c.setStart(f,i),c.setEnd(f,i)):(c.setStart(l,h),c.setEnd(l,h)),l=c.getClientRects()[0],h=this._cursorDiv.parentNode,f=h.getBoundingClientRect(),l&&f))this._cursorDiv.style.top=l.top-f.top+h.scrollTop+"px",this._cursorDiv.style.left=l.left-f.left+h.scrollLeft+"px"}else if(b.selection&&this._hasFocus)g=b.body,c=a.createElement(b,"div"),g.appendChild(c),g.removeChild(c),c=g.createTextRange(),c.moveToElementText(f.parentNode),c.moveStart("character",
i),f=g.createTextRange(),f.moveToElementText(l.parentNode),f.moveStart("character",h),c.setEndPoint("EndToStart",f),this._ignoreSelect=!1,c.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(a,c,b,d,e){if(this._selDiv1&&(b=this._selDiv1,b.style.width="0px",b.style.height="0px",b=this._selDiv2,b.style.width="0px",b.style.height="0px",b=this._selDiv3,b.style.width="0px",b.style.height="0px",!(a===d&&c===e))){var g=this._model,f=this._getViewPadding(),i=this._clientDiv.getBoundingClientRect(),
l=this._viewDiv.getBoundingClientRect(),b=l.left+f.left,h=i.right,f=l.top+f.top,m=i.bottom,l=i=0;this._clipDiv?(l=this._clipDiv.getBoundingClientRect(),i=l.left-this._clipDiv.scrollLeft):(l=this._rootDiv.getBoundingClientRect(),i=l.left);l=l.top;this._ignoreDOMSelection=!0;var j=(new v(this,a.lineIndex,a)).getBoundingClientRect(g.getLineStart(a.lineIndex)+c,!1),p=j.left,c=(new v(this,d.lineIndex,d)).getBoundingClientRect(g.getLineStart(d.lineIndex)+e,!1),g=c.left;this._ignoreDOMSelection=!1;var o=
this._selDiv1,p=Math.min(h,Math.max(b,p)),k=Math.min(m,Math.max(f,j.top)),q=h,e=Math.min(m,Math.max(f,j.bottom));o.style.left=p-i+"px";o.style.top=k-l+"px";o.style.width=Math.max(0,q-p)+"px";o.style.height=Math.max(0,e-k)+"px";if(a.lineIndex===d.lineIndex)q=Math.min(g,h),o.style.width=Math.max(0,q-p)+"px";else if(j=Math.min(m,Math.max(f,c.top)),g=Math.min(h,Math.max(b,g)),f=Math.min(m,Math.max(f,c.bottom)),m=this._selDiv3,m.style.left=b-i+"px",m.style.top=j-l+"px",m.style.width=Math.max(0,g-b)+"px",
m.style.height=Math.max(0,f-j)+"px",Math.abs(a.lineIndex-d.lineIndex)>1)a=this._selDiv2,a.style.left=b-i+"px",a.style.top=e-l+"px",a.style.width=Math.max(0,h-b)+"px",a.style.height=Math.max(0,j-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(c){if(this._linksVisible!==c){this._linksVisible=c;if(a.isIE&&c)this._hadFocus=
this._hasFocus;var b=this._clientDiv;b.contentEditable=!c;this._hadFocus&&!c&&b.focus();if(this._overlayDiv)this._overlayDiv.style.zIndex=c?"-1":"1";for(c=this._getLineNext();c;){if(c.hasLink)for(b=c.firstChild;b;)if(b.ignore)b=b.nextSibling;else{var d=b.nextSibling,e=b.viewStyle;e&&e.tagName&&e.tagName.toLowerCase()==="a"&&c.replaceChild(c._line._createSpan(c,b.firstChild.data,e),b);b=d}c=this._getLineNext(c)}this._updateDOMSelection()}},_setSelection:function(a,c,b,d,e){if(a){this._columnX=-1;b===
void 0&&(b=!0);var g=this._selection;this._selection=a;c!==!1&&this._showCaret(!1,d,c,e);b&&this._updateDOMSelection();if(!g.equals(a))this.onSelection({type:"Selection",oldValue:{start:g.start,end:g.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,c,b,d){var e=this._model,g=this._getSelection(),c=this.convert({x:a,y:c},"page","document"),a=this._getLineIndex(c.y);if(this._clickCount===1){e=this._getLine(a);a=e.getOffset(c.x,c.y-this._getLinePixel(a));e.destroy();if(d&&!b&&g.start<=
a&&a<g.end)return this._dragOffset=a,!1;g.extend(a);b||g.collapse()}else(this._clickCount&1)===0?(e=this._getLine(a),a=e.getOffset(c.x,c.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(b=this._doubleClickSelection.start,d=e.getNextOffset(a,{unit:"wordend",count:1})):(b=e.getNextOffset(a,{unit:"word",count:-1}),d=this._doubleClickSelection.end):(b=e.getNextOffset(a,{unit:"word",count:-1}),d=e.getNextOffset(b,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?
(d=e.getLineAtOffset(this._doubleClickSelection.start),a>=d?(b=e.getLineStart(d),d=e.getLineEnd(a)):(b=e.getLineStart(a),d=e.getLineEnd(d))):(b=e.getLineStart(a),d=e.getLineEnd(a)),g.setCaret(b),g.extend(d);this._setSelection(g,!0,!0);return!0},_setFullSelection:function(c,b){this._fullSelection=c;if(a.isWebkit)this._fullSelection=!0;var d=this._clipDiv||this._rootDiv;if(d)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!a.isIOS){var e=d.ownerDocument;this._highlightRGB=a.isWebkit?
"transparent":"Highlight";var g=a.createElement(e,"div");this._selDiv1=g;g.style.position="absolute";g.style.borderWidth="0px";g.style.margin="0px";g.style.padding="0px";g.style.outline="none";g.style.background=this._highlightRGB;g.style.width="0px";g.style.height="0px";g.style.zIndex="0";d.appendChild(g);var f=a.createElement(e,"div");this._selDiv2=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);this._selDiv3=e=a.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(a.isFirefox&&a.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;g.style.background=d;f.style.background=d;e.style.background=d}b||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 c=a.createElement(document,"div");c.className="textviewBlockCursor";
this._cursorDiv=c;c.tabIndex=-1;c.style.zIndex="2";c.style.color="transparent";c.style.position="absolute";c.style.pointerEvents="none";c.innerHTML="&nbsp;";this._viewDiv.appendChild(c);this._updateDOMSelection()}}else if(this._cursorDiv)this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null},_setMarginOffset:function(a,c){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";if(!c)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setWrapOffset:function(a,
c){this._wrapOffset=a;if(!c)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,c){this._singleMode=a;this._updateOverflow();this._updateStyle(c)},_setTabSize:function(c,b){this._tabSize=c;this._customTabSize=void 0;var d=this._clientDiv;if(a.isOpera){if(d)d.style.OTabSize=this._tabSize+""}else if(a.isWebkit>=537.1){if(d)d.style.tabSize=this._tabSize+""}else if(a.isFirefox>=
4){if(d)d.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==8)this._customTabSize=this._tabSize;b||(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,c){this._themeClass=a;var b="textview",d=this._theme.getThemeClass();d&&(b+=" "+
d);this._themeClass&&d!==this._themeClass&&(b+=" "+this._themeClass);this._rootDiv.className=b;this._updateStyle(c)},_setWrapMode:function(a,c){this._wrapMode=a&&this._wrappable;var b=this._clientDiv;this._wrapMode?(b.style.whiteSpace="pre-wrap",b.style.wordWrap="break-word"):(b.style.whiteSpace="pre",b.style.wordWrap="normal");this._updateOverflow();c||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,c,b,d){if(this._clientDiv){var e=this._model,g=this._getSelection(),
f=this._getScroll(),i=g.getCaret(),l=g.start,h=g.end,m=e.getLineAtOffset(h),j=Math.max(Math.max(l,e.getLineStart(m)),h-1),e=this._getClientWidth(),m=this._getClientHeight(),p=e/4,o=this._getBoundsAtOffset(i===l?l:j),k=o.left,q=o.right,u=o.top,v=o.bottom;a&&!g.isEmpty()&&(o=this._getBoundsAtOffset(i===h?l:j),o.top===u?i===l?q=k+Math.min(o.right-k,e):k=q-Math.min(q-o.left,e):i===l?v=u+Math.min(o.bottom-u,m):u=v-Math.min(v-o.top,m));a=0;k<f.x&&(a=Math.min(k-f.x,-p));q>f.x+e&&(a=Math.max(q-f.x-e,p));
g=0;u<f.y?g=u-f.y:v>f.y+m&&(g=v-f.y-m);d&&(d>0?g>0&&(g=Math.max(g,d)):g<0&&(g=Math.min(g,d)));if(a!==0||g!==0)return g!==0&&typeof b==="number"&&(b<0&&(b=0),b>1&&(b=1),g+=Math.floor(g>0?b*m:-b*m)),this._scrollViewAnimated(a,g,c),m!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;else c&&c();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 c=this._handlers[a];u(c.target,c.type,c.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(),c=this._model,b=c.getLineAtOffset(a.start),d=c.getLineAtOffset(a.end),e=this._getLineNext();if(e){var g=this._getLinePrevious(),f;b<e.lineIndex?(f=e,b=0):b>g.lineIndex?(f=g,b=0):(f=this._getLineNode(b),b=a.start-c.getLineStart(b));d<e.lineIndex?c=0:d>g.lineIndex?(e=g,c=0):(e=this._getLineNode(d),c=a.end-c.getLineStart(d));this._setDOMSelection(f,b,e,c,a.caret)}}},
_update:function(c){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,c=!1;var b=this._clientDiv,d=this._viewDiv;if(b){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var e=this._model,g=this._getScroll(!1),f=this._getViewPadding(),i=e.getLineCount(),l=this._getLineHeight(),h=!1,m=!1,j=!1,p=this._metrics.scrollWidth;if(this._wrapMode)b.style.width=(this._metrics.wrapWidth||this._getClientWidth())+
"px";var o,k,q,u,s=0,w=0,r;if(this._lineHeight){for(;w<i;){r=this._getLineHeight(w);if(s+r>g.y)break;s+=r;w++}o=w;k=Math.max(0,o-1);q=e=g.y-s;o>0&&(e+=this._getLineHeight(o-1))}else u=Math.max(0,g.y)/l,o=Math.floor(u),k=Math.max(0,o-1),e=Math.round((u-k)*l),q=Math.round((u-o)*l);this._topIndexY=q;u=this._rootDiv;var O=u.clientWidth,J=u.clientHeight;if(c){l=0;this._leftDiv&&(o=this._leftDiv.getBoundingClientRect(),l=o.right-o.left);o=this._getClientWidth();u=this._getClientHeight();m=o;if(this._wrapMode){if(this._metrics.wrapWidth)m=
this._metrics.wrapWidth}else m=Math.max(this._maxLineWidth,m);for(;w<i;)r=this._getLineHeight(w,!1),s+=r,w++;i=s}else{u=this._getClientHeight();q=Math.min(o+Math.floor((u+q)/l),i-1);var g=Math.min(q+1,i-1),I;for(r=b.firstChild;r;){I=r.lineIndex;var H=r.nextSibling;if(!(k<=I&&I<=g)||r.lineRemoved||r.lineIndex===-1)this._mouseWheelLine===r?(r.style.display="none",r.lineIndex=-1):b.removeChild(r);r=H}r=this._getLineNext();var H=d.ownerDocument,M=H.createDocumentFragment();for(I=k;I<=g;I++)if(!r||r.lineIndex>
I)(new v(this,I)).create(M,null);else{M.firstChild&&(b.insertBefore(M,r),M=H.createDocumentFragment());if(r&&r.lineChanged)r=(new v(this,I)).create(M,r),r.lineChanged=!1;r=this._getLineNext(r)}M.firstChild&&b.insertBefore(M,r);if(a.isWebkit&&!this._wrapMode)b.style.width="0x7fffffffpx";r=this._getLineNext();I=u+e;for(M=!1;r;){k=r.lineWidth;if(k===void 0)if(H=r._line.getBoundingClientRect(),k=r.lineWidth=Math.ceil(H.right-H.left),H=H.bottom-H.top,this._lineHeight)this._lineHeight[r.lineIndex]=H;else if(l!==
0&&H!==0&&Math.ceil(l)!==Math.ceil(H))this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[r.lineIndex]=H;if(this._lineHeight&&!M&&(I-=this._lineHeight[r.lineIndex],I<0))q=r.lineIndex,M=!0;if(!this._wrapMode){if(k>=this._maxLineWidth)this._maxLineWidth=k,this._maxLineIndex=r.lineIndex;if(this._checkMaxLineIndex===r.lineIndex)this._checkMaxLineIndex=-1}if(r.lineIndex===o)this._topChild=r;if(r.lineIndex===q)this._bottomChild=r;r=this._getLineNext(r)}if(this._checkMaxLineIndex!==-1&&(I=this._checkMaxLineIndex,
this._checkMaxLineIndex=-1,0<=I&&I<i)){l=new v(this,I);H=l.getBoundingClientRect();k=H.right-H.left;if(k>=this._maxLineWidth)this._maxLineWidth=k,this._maxLineIndex=I;l.destroy()}for(;w<i;)r=this._getLineHeight(w,w<=q),s+=r,w++;i=s;this._updateRuler(this._leftDiv,o,g,J);this._updateRuler(this._rightDiv,o,g,J);this._updateRuler(this._marginDiv,o,g,J);l=0;this._leftDiv&&(o=this._leftDiv.getBoundingClientRect(),l=o.right-o.left);g=0;this._rightDiv&&(g=this._rightDiv.getBoundingClientRect(),g=g.right-
g.left);d.style.left=l+"px";d.style.right=g+"px";g=this._scrollDiv;g.style.height=i+"px";o=this._getClientWidth();if(!this._singleMode&&!this._wrapMode){s=h=u;(w=d.style.overflowX==="scroll")?h+=p:s-=p;r=q=o;(k=d.style.overflowY==="scroll")?q+=p:r-=p;u=h;o=q;i>u&&(j=!0,o=r);this._maxLineWidth>o&&(m=!0,u=s,i>u&&(j=!0,o=r));if(w!==m)d.style.overflowX=m?"scroll":"hidden";if(k!==j)d.style.overflowY=j?"scroll":"hidden";h=w!==m||k!==j}j=o;if(this._wrapMode){if(this._metrics.wrapWidth)j=this._metrics.wrapWidth}else j=
Math.max(this._maxLineWidth,j);m=j;if((!a.isIE||a.isIE>=9)&&this._maxLineWidth>o)j+=f.right+f.left;g.style.width=j+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width=j+"px";g=this._getScroll(!1)}if(this._vScrollDiv)j=u-8,s=Math.max(15,Math.ceil(Math.min(1,j/(i+f.top+f.bottom))*j)),this._vScrollDiv.style.left=l+o-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,g.y*j/i))+"px",this._vScrollDiv.style.height=s+"px";if(!this._wrapMode&&this._hScrollDiv)j=o-8,s=Math.max(15,Math.ceil(Math.min(1,
j/(this._maxLineWidth+f.left+f.right))*j)),this._hScrollDiv.style.left=l+Math.floor(Math.max(0,Math.floor(g.x*j/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=u-9+"px",this._hScrollDiv.style.width=s+"px";w=g.x;s=this._clipDiv;j=this._overlayDiv;if(q=this._marginDiv)q.style.left=-w+l+this._metrics.marginWidth+f.left+"px",q.style.bottom=(d.style.overflowX==="scroll"?p:0)+"px";if(s){s.scrollLeft=w;s.scrollTop=0;d=l+f.left;p=f.top;c=o;l=u;w=0;q=-e;if(g.x===0)d-=f.left,c+=f.left,w=f.left;g.x+o===
m&&(c+=f.right);g.y===0&&(p-=f.top,l+=f.top,q+=f.top);g.y+u===i&&(l+=f.bottom);s.style.left=d+"px";s.style.top=p+"px";s.style.right=O-c-d+"px";s.style.bottom=J-l-p+"px";b.style.left=w+"px";b.style.top=q+"px";b.style.width=m+"px";b.style.height=u+e+"px";if(j)j.style.left=b.style.left,j.style.top=b.style.top,j.style.width=b.style.width,j.style.height=b.style.height}else{d=w;p=e;O=w+o;J=e+u;d===0&&(d-=f.left);p===0&&(p-=f.top);O===m&&(O+=f.right);g.y+u===i&&(J+=f.bottom);b.style.clip="rect("+p+"px,"+
O+"px,"+J+"px,"+d+"px)";b.style.left=-w+l+f.left+"px";b.style.width=(this._wrapMode||a.isWebkit?m:o+w)+"px";if(!c)b.style.top=-e+f.top+"px",b.style.height=u+e+"px";if(j&&(j.style.clip=b.style.clip,j.style.left=b.style.left,j.style.width=b.style.width,!c))j.style.top=b.style.top,j.style.height=b.style.height}this._updateDOMSelection();if(h)b=this._ensureCaretVisible,this._ensureCaretVisible=!1,b&&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(c,b,d,g){if(c)for(var f=this._parent.ownerDocument,i=this._getLineHeight(),l=this._getViewPadding(),c=c.firstChild;c;){var h=c._ruler,m=i,j=h.getOverview();j==="page"&&(m+=this._topIndexY);c.style.top=-m+"px";c.style.height=g+m+"px";c.rulerChanged&&e(h.getRulerStyle(),c);var p,o=c.firstChild;o?(p=o,o=o.nextSibling):(p=a.createElement(f,"div"),p.style.visibility="hidden",c.appendChild(p));var k;
if(c.rulerChanged&&p){m=-1;if(k=h.getWidestAnnotation())if(e(k.style,p),k.html)p.innerHTML=k.html;p.lineIndex=m;p.style.height=i+l.top+"px"}var q;if(j==="page"){for(h=h.getAnnotations(b,d+1);o;)m=o.lineIndex,k=o.nextSibling,(!(b<=m&&m<=d)||o.lineChanged)&&c.removeChild(o),o=k;o=c.firstChild.nextSibling;q=f.createDocumentFragment();for(m=b;m<=d;m++)if(!o||o.lineIndex>m){p=a.createElement(f,"div");if(k=h[m]){e(k.style,p);if(k.html)p.innerHTML=k.html;p.annotation=k}p.lineIndex=m;p.style.height=this._getLineHeight(m)+
"px";q.appendChild(p)}else if(q.firstChild&&(c.insertBefore(q,o),q=f.createDocumentFragment()),o)o=o.nextSibling;q.firstChild&&c.insertBefore(q,o)}else{k=this._getClientHeight();m=this._model.getLineCount();o=k+l.top+l.bottom-2*this._metrics.scrollWidth;j=i*m<o?i:o/m;if(c.rulerChanged){for(k=c.childNodes.length;k>1;)c.removeChild(c.lastChild),k--;h=h.getAnnotations(0,m);q=f.createDocumentFragment();for(var u in h)if(m=u>>>0,!(m<0)){p=a.createElement(f,"div");k=h[u];e(k.style,p);p.style.position="absolute";
p.style.top=this._metrics.scrollWidth+i+Math.floor(m*j)+"px";if(k.html)p.innerHTML=k.html;p.annotation=k;p.lineIndex=m;q.appendChild(p)}c.appendChild(q)}else if(c._oldTrackHeight!==o)for(p=c.firstChild?c.firstChild.nextSibling:null;p;)p.style.top=this._metrics.scrollWidth+i+Math.floor(p.lineIndex*j)+"px",p=p.nextSibling;c._oldTrackHeight=o}c.rulerChanged=!1;c=c.nextSibling}},_updateStyleSheet:function(){var c="";a.isWebkit&&this._metrics.scrollWidth>0&&(c+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
a.isFirefox&&a.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(c+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(c){var b=document.getElementById("_textviewStyle");if(b)b.removeChild(b.firstChild),b.appendChild(document.createTextNode(c));else{b=a.createElement(document,"style");b.id="_textviewStyle";var d=document.getElementsByTagName("head")[0]||document.documentElement;b.appendChild(document.createTextNode(c));d.insertBefore(b,d.firstChild)}}},_updateStyle:function(c){if(!c&&
a.isIE)this._rootDiv.style.lineHeight="normal";var b=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=a.isIE?b.lineHeight-(b.lineTrim.top+b.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();c||(this.redraw(),this._resetLineWidth())}};d.EventTarget.addMixin(s.prototype);return{TextView:s}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(j,k){function h(d){this._model=d;this._projections=[];var b=this;this._listener={onChanged:function(d){b._onChanged(d)},onChanging:function(d){b._onChanging(d)}};d.addEventListener("postChanged",this._listener.onChanged);d.addEventListener("preChanging",this._listener.onChanging)}h.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(d){if(d){var b=this._model,f=this._projections;d._lineIndex=b.getLineAtOffset(d.start);d._lineCount=b.getLineAtOffset(d.end)-d._lineIndex;var a=d.text;a||(a="");d._model=typeof a==="string"?new j.TextModel(a,b.getLineDelimiter()):a;var b=this.mapOffset(d.start,!0),a=d.end-d.start,e=d._lineCount,i=d._model.getCharCount(),g=d._model.getLineCount()-1;this.onChanging({type:"Changing",text:d._model.getText(),
start:b,removedCharCount:a,addedCharCount:i,removedLineCount:e,addedLineCount:g});var c=this._binarySearch(f,d.start);f.splice(c,0,d);this.onChanged({type:"Changed",start:b,removedCharCount:a,addedCharCount:i,removedLineCount:e,addedLineCount:g})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(d,b){var f=this._projections,a=0,e,i;if(b){for(e=0;e<f.length;e++){i=f[e];if(i.start>d)break;if(i.end>d)return-1;a+=i._model.getCharCount()-
(i.end-i.start)}return d+a}for(e=0;e<f.length;e++){i=f[e];if(i.start>d-a)break;var g=i._model.getCharCount();if(i.start+g>d-a)return-1;a+=g-(i.end-i.start)}return d-a},removeProjection:function(d){var b,f=0;for(b=0;b<this._projections.length;b++){var a=this._projections[b];if(a===d){d=a;break}f+=a._model.getCharCount()-(a.end-a.start)}if(b<this._projections.length){var a=this._model,f=d.start+f,e=d.end-d.start,i=d._lineCount,g=d._model.getCharCount(),c=d._model.getLineCount()-1;this.onChanging({type:"Changing",
text:a.getText(d.start,d.end),start:f,removedCharCount:g,addedCharCount:e,removedLineCount:c,addedLineCount:i});this._projections.splice(b,1);this.onChanged({type:"Changed",start:f,removedCharCount:g,addedCharCount:e,removedLineCount:c,addedLineCount:i})}},_binarySearch:function(d,b){for(var f=d.length,a=-1,e;f-a>1;)e=Math.floor((f+a)/2),b<=d[e].start?f=e:a=e;return f},getCharCount:function(){for(var d=this._model.getCharCount(),b=this._projections,f=0;f<b.length;f++){var a=b[f];d+=a._model.getCharCount()-
(a.end-a.start)}return d},getLine:function(d,b){if(d<0)return null;var f=this._model,a=this._projections,e=0,i=[],g=0,c,l,h;for(c=0;c<a.length;c++){h=a[c];if(h._lineIndex>=d-e)break;l=h._model.getLineCount()-1;if(h._lineIndex+l>=d-e)if(g=d-(h._lineIndex+e),g<l)return h._model.getLine(g,b);else i.push(h._model.getLine(l));g=h.end;e+=l-h._lineCount}for(g=Math.max(g,f.getLineStart(d-e));c<a.length;c++){h=a[c];if(h._lineIndex>d-e)break;i.push(f.getText(g,h.start));l=h._model.getLineCount()-1;if(h._lineIndex+
l>d-e)return i.push(h._model.getLine(0,b)),i.join("");i.push(h._model.getText());g=h.end;e+=l-h._lineCount}a=f.getLineEnd(d-e,b);g<a&&i.push(f.getText(g,a));return i.join("")},getLineAtOffset:function(d){for(var b=this._model,f=this._projections,a=0,e=0,i=0;i<f.length;i++){var g=f[i];if(g.start>d-a)break;var c=g._model.getCharCount();if(g.start+c>d-a){f=d-(g.start+a);e+=g._model.getLineAtOffset(f);a+=f;break}e+=g._model.getLineCount()-1-g._lineCount;a+=c-(g.end-g.start)}return b.getLineAtOffset(d-
a)+e},getLineCount:function(){for(var d=this._projections,b=this._model.getLineCount(),f=0;f<d.length;f++){var a=d[f];b+=a._model.getLineCount()-1-a._lineCount}return b},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(d,b){if(d<0)return-1;for(var f=this._model,a=this._projections,e=0,i=0,g=0;g<a.length;g++){var c=a[g];if(c._lineIndex>d-e)break;var l=c._model.getLineCount()-1;if(c._lineIndex+l>d-e)return c._model.getLineEnd(d-(c._lineIndex+e),b)+c.start+i;i+=
c._model.getCharCount()-(c.end-c.start);e+=l-c._lineCount}return f.getLineEnd(d-e,b)+i},getLineStart:function(d){if(d<0)return-1;for(var b=this._model,f=this._projections,a=0,e=0,i=0;i<f.length;i++){var g=f[i];if(g._lineIndex>=d-a)break;var c=g._model.getLineCount()-1;if(g._lineIndex+c>=d-a)return g._model.getLineStart(d-(g._lineIndex+a))+g.start+e;e+=g._model.getCharCount()-(g.end-g.start);a+=c-g._lineCount}return b.getLineStart(d-a)+e},getText:function(d,b){d===void 0&&(d=0);var f=this._model,a=
this._projections,e=0,i=[],g,c,l;for(g=0;g<a.length;g++){c=a[g];if(c.start>d-e)break;l=c._model.getCharCount();if(c.start+l>d-e)if(b!==void 0&&c.start+l>b-e)return c._model.getText(d-(c.start+e),b-(c.start+e));else i.push(c._model.getText(d-(c.start+e))),d=c.end+e+l-(c.end-c.start);e+=l-(c.end-c.start)}var h=d-e;if(b!==void 0){for(;g<a.length;g++){c=a[g];if(c.start>b-e)break;i.push(f.getText(h,c.start));l=c._model.getCharCount();if(c.start+l>b-e)return i.push(c._model.getText(0,b-(c.start+e))),i.join("");
i.push(c._model.getText());h=c.end;e+=l-(c.end-c.start)}i.push(f.getText(h,b-e))}else{for(;g<a.length;g++)c=a[g],i.push(f.getText(h,c.start)),i.push(c._model.getText()),h=c.end;i.push(f.getText(h))}return i.join("")},_onChanged:function(){var d=this._change,b=d.baseStart,f=d.baseEnd,a,e,i=this._projections;for(a=0;a<i.length;a++)if(e=i[a],e.end>b)break;var g=a;for(a=0;a<i.length;a++)if(e=i[a],e.start>=f)break;var c=a,l=this._model,b=d.baseText.length-(f-b);for(a=c;a<i.length;a++)e=i[a],e.start+=b,
e.end+=b,e._lineIndex=l.getLineAtOffset(e.start);e=i.splice(g,c-g);for(a=0;a<e.length;a++)e[a].annotation&&e[a].annotation._expand();this.onChanged({type:"Changed",start:d.start,removedCharCount:d.removedCharCount,addedCharCount:d.addedCharCount,removedLineCount:d.removedLineCount,addedLineCount:d.addedLineCount});this._change=void 0},_onChanging:function(d){var b=!!this._change,f=this._change||{},a=d.start,e=a+d.removedCharCount;f.baseStart=a;f.baseEnd=e;f.baseText=d.text;f.addedLineCount=d.addedLineCount;
if(!b){this._change=f;f.text=d.text;var i=this._projections,g,c,l,d=function(a){for(c=0,g=0;c<i.length;c++){l=i[c];if(l.start>a)break;if(l.end>a)return-1;g+=l._model.getCharCount()-(l.end-l.start)}return a+g};f.start=d(a);if(f.start===-1)f.text=this._model.getText(l.start,a)+f.text,f.addedLineCount+=this._model.getLineAtOffset(a)-this._model.getLineAtOffset(l.start),f.start=l.start+g;f.end=d(e);if(f.end===-1)f.text+=this._model.getText(e,l.end),f.addedLineCount+=this._model.getLineAtOffset(l.end)-
this._model.getLineAtOffset(e),f.end=l.start+g}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(d){return this.dispatchEvent(d)},onChanged:function(d){return this.dispatchEvent(d)},setLineDelimiter:function(d){this._model.setLineDelimiter(d)},
setText:function(d,b,f){function a(a){for(g=0,i=0;g<e.length;g++){c=e[g];if(c.start>a-i)break;var b=c._model.getCharCount();if(c.start+b>a-i)return-1;i+=b-(c.end-c.start)}return a-i}this._change={text:d||"",start:b||0,end:f===void 0?this.getCharCount():f};var e=this._projections,i,g,c,l,h,d=a(this._change.start);if(d===-1)l={projection:c,start:this._change.start-(c.start+i)},d=c.end;b=a(this._change.end);if(b===-1)h={projection:c,end:this._change.end-(c.start+i)},b=c.start;if(l&&h&&l.projection===
h.projection)c._model.setText(this._change.text,l.start,h.end);else{this._model.setText(this._change.text,d,b);if(l)c=l.projection,c._model.setText("",l.start);if(h)c=h.projection,c._model.setText("",0,h.end),c.start=c.end,c._lineCount=0}this._change=void 0}};k.EventTarget.addMixin(h.prototype);return{ProjectionTextModel:h}});
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(j,k,h,d,b,f){function a(a){this._view=a;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(a.getOptions("parent").ownerDocument)}a.getTooltip=function(b){if(!b._tooltip)b._tooltip=new a(b);return b._tooltip};a.prototype={_create:function(a){if(!this._tooltipDiv){var d=
this._tooltipDiv=f.createElement(a,"div");d.tabIndex=0;d.className="textviewTooltip";d.setAttribute("aria-live","assertive");d.setAttribute("aria-atomic","true");var g=this._tooltipContents=f.createElement(a,"div");d.appendChild(g);a.body.appendChild(d);var c=this;b.addEventListener(d,"mouseover",function(){if(c._hideDelay){var a=c._getWindow();if(c._delayedHideTimeout)a.clearTimeout(c._delayedHideTimeout),c._delayedHideTimeout=null;if(c._hideTimeout)a.clearTimeout(c._hideTimeout),c._hideTimeout=
null;c._nextTarget=null}},!1);b.addEventListener(d,"mouseout",function(a){a=a.relatedTarget||a.toElement;a===d||c._hasFocus()||(!a||!b.contains(d,a))&&c._hide()},!1);b.addEventListener(d,"keydown",function(a){a.keyCode===27&&c._hide()},!1);b.addEventListener(a,"mousedown",this._mouseDownHandler=function(a){c.isVisible()&&(b.contains(d,a.target||a.srcElement)||c._hide())},!0);this._view.addEventListener("Destroy",function(){c.destroy()});this._hide()}},_getWindow:function(){var a=this._tooltipDiv.ownerDocument;
return a.defaultView||a.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var a=this._tooltipDiv.parentNode;a&&a.removeChild(this._tooltipDiv);b.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var a=this._tooltipDiv;return!a?!1:b.contains(a,a.ownerDocument.activeElement)},hide:function(a){if(a===void 0)a=this._hideDelay;var b=this._getWindow();if(this._delayedHideTimeout)b.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null;var d=this;a?d._delayedHideTimeout=b.setTimeout(function(){d._delayedHideTimeout=null;d._hide();d.setTarget(d._nextTarget,0)},a):(d._hide(),d.setTarget(d._nextTarget,0))},_hide:function(){var a=this._tooltipDiv;if(a){this._hasFocus()&&this._view.focus();if(this._contentsView)this._contentsView.destroy(),this._contentsView=null;if(this._tooltipContents)this._tooltipContents.innerHTML="";a.style.visibility="hidden";a=this._getWindow();if(this._showTimeout)a.clearTimeout(this._showTimeout),
this._showTimeout=null;if(this._delayedHideTimeout)a.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null;if(this._hideTimeout)a.clearTimeout(this._hideTimeout),this._hideTimeout=null;if(this._fadeTimeout)a.clearInterval(this._fadeTimeout),this._fadeTimeout=null}},isVisible:function(){return this._tooltipDiv&&this._tooltipDiv.style.visibility==="visible"},setTarget:function(a,b,d){if(this.isVisible()){if(!this._hasFocus())this._nextTarget=a,this.hide(d)}else if(this._target=a){var c=
this,a=c._getWindow();if(c._showTimeout)a.clearTimeout(c._showTimeout),c._showTimeout=null;b===0?c.show(!0):c._showTimeout=a.setTimeout(function(){c._showTimeout=null;c.show(!0)},b?b:c._showDelay)}},show:function(a){if(this._target){var b=this._target.getTooltipInfo();if(b){var g=this._tooltipDiv,c=this._tooltipContents;g.style.left=g.style.right=g.style.width=g.style.height=c.style.width=c.style.height="auto";var f=b.contents;f instanceof Array&&(f=this._getAnnotationContents(f));if(typeof f==="string")c.innerHTML=
f;else if(this._isNode(f))c.appendChild(f);else if(f instanceof d.ProjectionTextModel){var h=this._view,j=h.getOptions();j.wrapMode=!1;j.parent=c;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){h.onLineStyle(a)});j.setModel(f);f=j.computeSize();c.style.width=f.width+"px";c.style.height=f.height+"px";j.resize()}else return;c=g.ownerDocument.documentElement;
b.anchor==="right"?(f=c.clientWidth-b.x,g.style.right=f+"px"):(f=parseInt(this._getNodeStyle(g,"padding-left","0"),10),f+=parseInt(this._getNodeStyle(g,"border-left-width","0"),10),f=b.x-f,g.style.left=f+"px");g.style.maxWidth=c.clientWidth-f-10+"px";f=parseInt(this._getNodeStyle(g,"padding-top","0"),10);f+=parseInt(this._getNodeStyle(g,"border-top-width","0"),10);f=b.y-f;g.style.top=f+"px";g.style.maxHeight=c.clientHeight-f-10+"px";g.style.opacity="1";g.style.visibility="visible";if(a){var q=this,
v=this._getWindow();q._hideTimeout=v.setTimeout(function(){q._hideTimeout=null;var a=parseFloat(q._getNodeStyle(g,"opacity","1"));q._fadeTimeout=v.setInterval(function(){g.style.visibility==="visible"&&a>0?(a-=0.1,g.style.opacity=a):q._hide()},q._fadeDelay/10)},q._autoHideDelay)}}}},_getAnnotationContents:function(a){function i(a,c){var b=s.getLineStart(s.getLineAtOffset(a)),d=s.getLineEnd(s.getLineAtOffset(c),!0);return s.getText(b,d)}function g(a){var c=a.title,d=f.createElement(o,"div");d.className=
"tooltipRow";if(a.html)d.innerHTML=a.html,d.lastChild&&b.addEventListener(d.lastChild,"click",function(){var c=a.start,b=a.end;v.getBaseModel&&(c=v.mapOffset(c,!0),b=v.mapOffset(b,!0));k.setSelection(c,b,1/3,function(){p._hide()})},!1),d.appendChild(o.createTextNode("\u00a0"));c||(c=i(a.start,a.end));typeof c==="function"&&(c=a.title());if(typeof c==="string"){var e=f.createElement(o,"span");e.appendChild(o.createTextNode(c));c=e}d.appendChild(c);return d}for(var c,l=[],h=0;h<a.length;h++)c=a[h],
c.title!==""&&!c.groupAnnotation&&l.push(c);a=l;if(a.length===0)return null;var p=this,o=this._tooltipDiv.ownerDocument,k=this._view,v=k.getModel(),s=v.getBaseModel?v.getBaseModel():v;if(a.length===1)if(c=a[0],c.title!==void 0){c=g(c);if(c.firstChild)(a=c.firstChild.className)&&(a+=" "),a+="single",c.firstChild.className=a;return c}else return a=new d.ProjectionTextModel(s),l=s.getLineStart(s.getLineAtOffset(c.start)),h=s.getCharCount(),c.end!==h&&a.addProjection({start:c.end,end:h}),l>0&&a.addProjection({start:0,
end:l}),a;else{l=f.createElement(o,"div");c=f.createElement(o,"em");c.appendChild(o.createTextNode(j.multipleAnnotations));l.appendChild(c);for(h=0;h<a.length;h++)c=a[h],(c=g(c))&&l.appendChild(c);return l}},_getNodeStyle:function(a,b,d){var c;if(a&&(c=a.style[b],!c))if(a.currentStyle){for(c=0;(c=b.indexOf("-",c))!==-1;)b=b.substring(0,c)+b.substring(c+1,c+2).toUpperCase()+b.substring(c+2);c=a.currentStyle[b]}else c=(a=a.ownerDocument.defaultView.getComputedStyle(a,null))?a.getPropertyValue(b):null;
return c||d},_isNode:function(a){return typeof Node==="object"?a instanceof Node:a&&typeof a==="object"&&typeof a.nodeType==="number"&&typeof a.nodeName==="string"}};return{Tooltip:a}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(j,k){function h(a,c,b){this.start=a;this.end=c;this._projectionModel=b;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function d(){}function b(a,c){var b=a.lastIndexOf("."),b=a.substring(b+1),e={title:j[b],style:{styleClass:"annotation "+b},html:"<div class='annotationHTML "+b+"'></div>",overviewStyle:{styleClass:"annotationOverview "+b}};c?e.lineStyle={styleClass:"annotationLine "+
b}:e.rangeStyle={styleClass:"annotationRange "+b};d.registerType(a,e)}function f(){}function a(a){this._annotations=[];var c=this;this._listener={onChanged:function(a){c._onChanged(a)}};this.setTextModel(a)}function e(a,c){this._view=a;this._annotationModel=c;var b=this;this._listener={onDestroy:function(a){b._onDestroy(a)},onLineStyle:function(a){b._onLineStyle(a)},onChanged:function(a){b._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",
this._listener.onLineStyle);c.addEventListener("Changed",this._listener.onChanged)}h.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 a=this._projectionModel,c=a.getBaseModel();this._projection={annotation:this,start:c.getLineStart(c.getLineAtOffset(this.start)+1),end:c.getLineEnd(c.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},expand:function(){this._expand()&&
this._projectionModel.removeProjection(this._projection)}};d.ANNOTATION_ERROR="orion.annotation.error";d.ANNOTATION_WARNING="orion.annotation.warning";d.ANNOTATION_TASK="orion.annotation.task";d.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";d.ANNOTATION_BOOKMARK="orion.annotation.bookmark";d.ANNOTATION_FOLDING="orion.annotation.folding";d.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";d.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";d.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";
d.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";d.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";d.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";d.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";d.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";d.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";d.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";d.ANNOTATION_BLAME="orion.annotation.blame";d.ANNOTATION_CURRENT_BLAME=
"orion.annotation.currentBlame";var i={};d.registerType=function(a,c){var b=c;if(typeof b!=="function")b=function(a,c,b){this.start=a;this.end=c;if(b!==void 0)this.title=b},b.prototype=c;b.prototype.type=a;i[a]=b;return a};d.createAnnotation=function(a,c,b,d){return new (this.getType(a))(c,b,d)};d.getType=function(a){return i[a]};b(d.ANNOTATION_ERROR);b(d.ANNOTATION_WARNING);b(d.ANNOTATION_TASK);b(d.ANNOTATION_BREAKPOINT);b(d.ANNOTATION_BOOKMARK);b(d.ANNOTATION_CURRENT_BRACKET);b(d.ANNOTATION_MATCHING_BRACKET);
b(d.ANNOTATION_CURRENT_SEARCH);b(d.ANNOTATION_MATCHING_SEARCH);b(d.ANNOTATION_READ_OCCURRENCE);b(d.ANNOTATION_WRITE_OCCURRENCE);b(d.ANNOTATION_SELECTED_LINKED_GROUP);b(d.ANNOTATION_CURRENT_LINKED_GROUP);b(d.ANNOTATION_LINKED_GROUP);b(d.ANNOTATION_CURRENT_LINE,!0);b(d.ANNOTATION_BLAME,!0);b(d.ANNOTATION_CURRENT_BLAME,!0);d.registerType(d.ANNOTATION_FOLDING,h);f.addMixin=function(a){var c=f.prototype,b;for(b in c)c.hasOwnProperty(b)&&(a[b]=c[b])};f.prototype={addAnnotationType:function(a){if(!this._annotationTypes)this._annotationTypes=
[];this._annotationTypes.push(a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var c=0;c<this._annotationTypes.length;c++)if(this._annotationTypes[c]===a)return c+1;return 0},getAnnotationsByType:function(a,c,b){a=a.getAnnotations(c,b);for(b=[];a.hasNext();)c=a.next(),this.getAnnotationTypePriority(c.type)!==0&&b.push(c);var d=this;b.sort(function(a,c){return d.getAnnotationTypePriority(a.type)-d.getAnnotationTypePriority(c.type)});return b},isAnnotationTypeVisible:function(a){return this.getAnnotationTypePriority(a)!==
0},removeAnnotationType:function(a){if(this._annotationTypes)for(var c=0;c<this._annotationTypes.length;c++)if(this._annotationTypes[c]===a){this._annotationTypes.splice(c,1);break}}};a.prototype={addAnnotation:function(a){if(a){var c=this._annotations,b=this._binarySearch(c,a.start);c.splice(b,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,c){var b=this._annotations,d,e=0,f;f=a===
void 0&&c===void 0?function(){return e<b.length?b[e++]:null}:function(){for(;e<b.length;){var d=b[e++];if(a===d.start||(a>d.start?a<d.end:d.start<c))return d;if(d.start>=c)break}return null};d=f();return{next:function(){var a=d;a&&(d=f());return a},hasNext:function(){return d!==null}}},modifyAnnotation:function(a){if(a&&!(this._getAnnotationIndex(a)<0))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var c=
this._annotations,b,d;if(a){b=[];for(d=c.length-1;d>=0;d--){var e=c[d];if(e.type===a)c.splice(d,1),b.splice(0,0,e),e._annotationModel=null}}else b=c;this.onChanged({type:"Changed",removed:b,added:[],changed:[]})},removeAnnotation:function(a){if(a){var c=this._getAnnotationIndex(a);if(!(c<0))a._annotationModel=null,this.onChanged({type:"Changed",removed:this._annotations.splice(c,1),added:[],changed:[]})}},replaceAnnotations:function(a,c){var b=this._annotations,d,e,f,i=[];if(a)for(d=a.length-1;d>=
0;d--)if(f=a[d],e=this._getAnnotationIndex(f),!(e<0))f._annotationModel=null,b.splice(e,1),i.splice(0,0,f);c||(c=[]);for(d=0;d<c.length;d++)f=c[d],e=this._binarySearch(b,f.start),f._annotationModel=this,b.splice(e,0,f);this.onChanged({type:"Changed",removed:i,added:c,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_binarySearch:function(a,c){for(var b=
a.length,d=-1,e;b-d>1;)e=Math.floor((b+d)/2),c<=a[e].start?b=e:d=e;return b},_getAnnotationIndex:function(a){for(var c=this._annotations,b=this._binarySearch(c,a.start);b<c.length&&c[b].start===a.start;){if(c[b]===a)return b;b++}return-1},_onChanged:function(a){var c=a.start,b=a.removedCharCount,d=this._annotations,e=c+b;if(0<d.length){for(var f={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a},a=a.addedCharCount-b,b=0;b<d.length;b++){var i=d[b];if(i.start>=e)i._oldStart=i.start,
i._oldEnd=i.end,i.start+=a,i.end+=a,f.changed.push(i);else if(!(i.end<=c))i.start<c&&e<i.end?(i._oldStart=i.start,i._oldEnd=i.end,i.end+=a,f.changed.push(i)):(d.splice(b,1),f.removed.push(i),i._annotationModel=null,i.expand&&i.expand(),b--)}if(f.added.length>0||f.removed.length>0||f.changed.length>0)this.onChanged(f)}}};k.EventTarget.addMixin(a.prototype);e.prototype={destroy:function(){var a=this._view;if(a)a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",
this._listener.onLineStyle),this.view=null;(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,c){if(c){a||(a={});a.styleClass&&c.styleClass&&a.styleClass!==c.styleClass?a.styleClass+=" "+c.styleClass:a.styleClass=c.styleClass;var b;if(c.tagName&&!a.tagName)a.tagName=c.tagName;if(c.style){if(!a.style)a.style={};for(b in c.style)a.style[b]||(a.style[b]=c.style[b])}if(c.attributes){if(!a.attributes)a.attributes={};for(b in c.attributes)a.attributes[b]||
(a.attributes[b]=c.attributes[b])}}return a},_mergeStyleRanges:function(a,c){a||(a=[]);var b,d;for(d=0;d<a.length&&c;d++){var e=a[d];if(c.end<=e.start)break;if(!(c.start>=e.end)){b=this._mergeStyle({},e.style);b=this._mergeStyle(b,c.style);var f=[];f.push(d,1);c.start<e.start&&f.push({start:c.start,end:e.start,style:c.style});c.start>e.start&&f.push({start:e.start,end:c.start,style:e.style});f.push({start:Math.max(e.start,c.start),end:Math.min(e.end,c.end),style:b});c.end<e.end&&f.push({start:c.end,
end:e.end,style:e.style});c=c.end>e.end?{start:e.end,end:c.end,style:c.style}:null;Array.prototype.splice.apply(a,f)}}c&&(b=this._mergeStyle({},c.style),a.splice(d,0,{start:c.start,end:c.end,style:b}));return a},_onAnnotationModelChanged:function(a){function c(a,c){f.getBaseModel&&(a=f.mapOffset(a,!0),c=f.mapOffset(c,!0));a!==-1&&c!==-1&&d.redrawRange(a,c)}function b(a,d){for(var g=0;g<a.length;g++)if(e.isAnnotationTypeVisible(a[g].type)){var f=a[g];c(f.start,f.end);d&&f._oldStart!==void 0&&f._oldEnd&&
c(f._oldStart,f._oldEnd)}}var d=this._view;if(d){var e=this,f=d.getModel();b(a.added);b(a.removed);b(a.changed,!0)}},_onDestroy:function(){this.destroy()},_onLineStyle:function(a){var c=this._annotationModel,b=a.textView.getModel(),d=c.getTextModel(),e=a.lineStart,f=a.lineStart+a.lineText.length;d!==b&&(e=b.mapOffset(e),f=b.mapOffset(f));for(c=c.getAnnotations(e,f);c.hasNext();)if(e=c.next(),this.isAnnotationTypeVisible(e.type)){if(e.rangeStyle){var f=e.start,i=e.end;d!==b&&(f=b.mapOffset(f,!0),i=
b.mapOffset(i,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:f,end:i,style:e.rangeStyle})}if(e.lineStyle)a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,e.lineStyle)}}};f.addMixin(e.prototype);return{FoldingAnnotation:h,AnnotationType:d,AnnotationTypeList:f,AnnotationModel:a,AnnotationStyler:e}});
define("orion/editor/editor","i18n!orion/editor/nls/messages,orion/editor/eventTarget,orion/editor/tooltip,orion/editor/annotations,orion/objects,orion/util".split(","),function(j,k,h,d,b,f){function a(a){a=a||{};this._domNode=a.domNode;this._model=a.model;this._undoStack=a.undoStack;this._statusReporter=a.statusReporter;this._title=null;var c=this;this._listener={onChanged:function(a){c.onChanged(a)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function e(b){b=b||{};a.call(this,b);this._textViewFactory=b.textViewFactory;this._undoStackFactory=b.undoStackFactory;this._textDNDFactory=b.textDNDFactory;this._annotationFactory=b.annotationFactory;this._foldingRulerFactory=b.foldingRulerFactory;this._lineNumberRulerFactory=b.lineNumberRulerFactory;this._contentAssistFactory=b.contentAssistFactory;this._keyBindingFactory=b.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var i=d.AnnotationType;a.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(a,c){return this.getModel().getText(a,c)},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(a){return this.dispatchEvent(a)},onInputChanged:function(a){return this.dispatchEvent(a)},onChanged:function(){this.checkDirty()},reportStatus:function(a,c,b){this._statusReporter&&this._statusReporter(a,c,b)},resize:function(){},setDirty:function(a){if(this._dirty!==a)this._dirty=a,this.onDirtyChanged({type:"DirtyChanged"})},
_setModelText:function(a){this._model&&this._model.setText(a)},setInput:function(a,c,b,d){this._title=a;d||(c?this.reportStatus(c,"error"):b!==null&&b!==void 0&&typeof b==="string"&&this._setModelText(b),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:a,message:c,contents:b,contentsSaved:d})},setText:function(a,c,b){this.getModel().setText(a,c,b)},uninstall:function(){this.installed=!1}};k.EventTarget.addMixin(a.prototype);e.prototype=new a;
b.mixin(e.prototype,{destroy:function(){a.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 a=this._textView.getModel();a.getBaseModel&&(a=a.getBaseModel());return a},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(a,c){if(this._annotationRulerVisible!==a||c)if(this._annotationRulerVisible=a,this._annotationRuler){var b=this._textView;a?b.addRuler(this._annotationRuler,0):b.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(a,c){if(this._foldingRulerVisible!==a||c)if(this._foldingRulerVisible=
a,this._foldingRuler){var b=this._textView;b.getModel().getBaseModel&&(a?b.addRuler(this._foldingRuler):b.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(a,c){if(this._lineNumberRulerVisible!==a||c)if(this._lineNumberRulerVisible=a,this._lineNumberRuler){var b=this._textView;a?b.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):b.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(a,c){if(this._overviewRulerVisible!==a||c)if(this._overviewRulerVisible=
a,this._overviewRuler){var b=this._textView;a?b.addRuler(this._overviewRuler):b.removeRuler(this._overviewRuler)}},mapOffset:function(a,c){var b=this._textView.getModel();b.getBaseModel&&(a=b.mapOffset(a,c));return a},getLineAtOffset:function(a){return this.getModel().getLineAtOffset(this.mapOffset(a))},getLineStart:function(a){return this.getModel().getLineStart(a)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var a=this._textView,c=a.getSelection(),
a=a.getModel();if(a.getBaseModel)c.start=a.mapOffset(c.start),c.end=a.mapOffset(c.end);return c},_expandOffset:function(a){var c=this._textView.getModel(),b=this._annotationModel;if(b&&c.getBaseModel)for(a=b.getAnnotations(a,a+1);a.hasNext();)c=a.next(),c.type===i.ANNOTATION_FOLDING&&c.expand&&c.expand()},setCaretOffset:function(a,c,b){var d=this._textView,e=d.getModel();e.getBaseModel&&(this._expandOffset(a),a=e.mapOffset(a,!0));d.setCaretOffset(a,c,b)},setText:function(a,c,b){var d=this._textView,
e=d.getModel();e.getBaseModel&&(c!==void 0&&(this._expandOffset(c),c=e.mapOffset(c,!0)),b!==void 0&&(this._expandOffset(b),b=e.mapOffset(b,!0)));d.setText(a,c,b)},setSelection:function(a,c,b,d){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(a),this._expandOffset(c),a=f.mapOffset(a,!0),c=f.mapOffset(c,!0));e.setSelection(a,c,b,d)},moveSelection:function(a,c,b,d){var e=this._textView;this.setSelection(a,c||a,1/3,function(){(d===void 0||d)&&e.focus();b&&b()})},_getTooltipInfo:function(a,
c){var b=this._textView,d=this.getAnnotationModel();if(!d)return null;var e=this._annotationStyler;if(!e)return null;var f=b.getOffsetAtLocation(a,c);if(f===-1)return null;f=this.mapOffset(f);e=e.getAnnotationsByType(d,f,f+1);d=[];for(f=0;f<e.length;f++)e[f].rangeStyle&&d.push(e[f]);if(d.length===0)return null;b=b.convert({x:a,y:c},"document","page");return{contents:d,anchor:"left",x:b.x+10,y:b.y+20}},_highlightCurrentLine:function(a,c){var b=this._annotationModel;if(b){var d=this._textView;if(!d.getOptions("singleMode")){var e=
d.getModel(),f=c?e.getLineAtOffset(c.start):-1,h=e.getLineAtOffset(a.start),d=a.start===a.end,j=!c||c.start===c.end,k=e.getLineStart(h),r=e.getLineEnd(h);e.getBaseModel&&(k=e.mapOffset(k),r=e.mapOffset(r));e=this._currentLineAnnotation;if(!(f===h&&j&&d&&e&&e.start===k&&e.end===r)){var f=e?[e]:null,u;d&&(e=i.createAnnotation(i.ANNOTATION_CURRENT_LINE,k,r),u=[e]);this._currentLineAnnotation=e;b.replaceAnnotations(f,u)}}}},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 b=this,c=this._textView,d=this;this._listener={onModelChanged:function(){d.checkDirty()},onMouseOver:function(a){d._listener.onMouseMove(a)},onMouseMove:function(a){var b=
h.Tooltip.getTooltip(c);if(b&&!(d._listener.lastMouseX===a.event.clientX&&d._listener.lastMouseY===a.event.clientY))d._listener.lastMouseX=a.event.clientX,d._listener.lastMouseY=a.event.clientY,b.setTarget({x:a.x,y:a.y,getTooltipInfo:function(){return d._getTooltipInfo(this.x,this.y)}})},onMouseOut:function(a){var b=h.Tooltip.getTooltip(c);if(b&&!(d._listener.lastMouseX===a.event.clientX&&d._listener.lastMouseY===a.event.clientY))d._listener.lastMouseX=a.event.clientX,d._listener.lastMouseY=a.event.clientY,
b.setTarget(null)},onScroll:function(){var a=h.Tooltip.getTooltip(c);a&&a.setTarget(null,0,0)},onSelection:function(a){d._updateCursorStatus();d._highlightCurrentLine(a.newValue,a.oldValue)}};c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Selection",this._listener.onSelection);c.addEventListener("MouseOver",this._listener.onMouseOver);c.addEventListener("MouseOut",this._listener.onMouseOut);c.addEventListener("MouseMove",this._listener.onMouseMove);c.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var e;if(e=typeof this._keyBindingFactory==="function"?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(b,this._undoStack,this._contentAssist))this._textActions=e.textActions,this._linkedMode=e.linkedMode,this._sourceCodeActions=e.sourceCodeActions}e=function(a){if(a!==void 0&&a!==-1){for(var c=this.getView().getModel(),d=this.getAnnotationModel(),e=b.mapOffset(c.getLineStart(a)),
a=b.mapOffset(c.getLineEnd(a)),c=d.getAnnotations(e,a),f=null;c.hasNext();){var h=c.next();if(h.type===i.ANNOTATION_BOOKMARK){f=h;break}}f?d.removeAnnotation(f):(f=i.createAnnotation(i.ANNOTATION_BOOKMARK,e,a),f.title=void 0,d.addAnnotation(f))}};if(this._annotationFactory){var f=c.getModel();f.getBaseModel&&(f=f.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(f))if(f=this._annotationStyler=this._annotationFactory.createAnnotationStyler(c,this._annotationModel))f.addAnnotationType(i.ANNOTATION_CURRENT_SEARCH),
f.addAnnotationType(i.ANNOTATION_MATCHING_SEARCH),f.addAnnotationType(i.ANNOTATION_ERROR),f.addAnnotationType(i.ANNOTATION_WARNING),f.addAnnotationType(i.ANNOTATION_MATCHING_BRACKET),f.addAnnotationType(i.ANNOTATION_CURRENT_BRACKET),f.addAnnotationType(i.ANNOTATION_CURRENT_LINE),f.addAnnotationType(i.ANNOTATION_READ_OCCURRENCE),f.addAnnotationType(i.ANNOTATION_WRITE_OCCURRENCE),f.addAnnotationType(i.ANNOTATION_SELECTED_LINKED_GROUP),f.addAnnotationType(i.ANNOTATION_CURRENT_LINKED_GROUP),f.addAnnotationType(i.ANNOTATION_LINKED_GROUP),
f.addAnnotationType("orion.annotation.highlightError");var f=this._annotationFactory.createAnnotationRulers(this._annotationModel),j=this._annotationRuler=f.annotationRuler;if(j)j.onDblClick=e,j.setMultiAnnotationOverlay({html:"<div class='annotationHTML overlay'></div>"}),j.addAnnotationType(i.ANNOTATION_ERROR),j.addAnnotationType(i.ANNOTATION_WARNING),j.addAnnotationType(i.ANNOTATION_TASK),j.addAnnotationType(i.ANNOTATION_BOOKMARK);this.setAnnotationRulerVisible(this._annotationRulerVisible||this._annotationRulerVisible===
void 0,!0);if(j=this._overviewRuler=f.overviewRuler)j.addAnnotationType(i.ANNOTATION_CURRENT_SEARCH),j.addAnnotationType(i.ANNOTATION_MATCHING_SEARCH),j.addAnnotationType(i.ANNOTATION_READ_OCCURRENCE),j.addAnnotationType(i.ANNOTATION_WRITE_OCCURRENCE),j.addAnnotationType(i.ANNOTATION_CURRENT_BLAME),j.addAnnotationType(i.ANNOTATION_ERROR),j.addAnnotationType(i.ANNOTATION_WARNING),j.addAnnotationType(i.ANNOTATION_TASK),j.addAnnotationType(i.ANNOTATION_BOOKMARK),j.addAnnotationType(i.ANNOTATION_MATCHING_BRACKET),
j.addAnnotationType(i.ANNOTATION_CURRENT_BRACKET),j.addAnnotationType(i.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(i.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(i.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=e,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
this._lineNumberRulerVisible===void 0,!0);if(this._foldingRulerFactory)this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(i.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||this._foldingRulerVisible===void 0,!0);this.dispatchEvent({type:"TextViewInstalled",textView:c});a.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var b=this._textView;if(b)b.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:b}),a.prototype.uninstall.call(this)},_updateCursorStatus:function(){var a=
this.getModel(),c=this.getCaretOffset(),b=a.getLineAtOffset(c),a=a.getLineStart(b);c-=a;for(var a=this.getKeyModes(),d=0;d<a.length;d++){var e=a[d];if(e.isActive()&&e.isStatusActive&&e.isStatusActive())return}this.reportStatus(f.formatMessage(j.lineColumn,b+1,c+1))},showAnnotations:function(a,c,b,d){var e=this._annotationModel;if(e){for(var f=[],h=[],j=e.getTextModel(),k=e.getAnnotations(),r;k.hasNext();)r=k.next(),c.indexOf(r.type)!==-1&&r.creatorID===this&&f.push(r);if(a)for(c=0;c<a.length;c++)if(r=
a[c]){if(b)r=b(r);else{var u;typeof r.line==="number"?(u=j.getLineStart(r.line-1),k=u+r.start-1,u=u+r.end-1):(k=r.start,u=r.end);var w=d(r);if(!w)continue;r=i.createAnnotation(w,k,u,r.description)}r.creatorID=this;h.push(r)}e.replaceAnnotations(f,h)}},showProblems:function(a){this.showAnnotations(a,[i.ANNOTATION_ERROR,i.ANNOTATION_WARNING,i.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return i.ANNOTATION_ERROR;case "warning":return i.ANNOTATION_WARNING;case "task":return i.ANNOTATION_TASK}return null})},
showOccurrences:function(a){this.showAnnotations(a,[i.ANNOTATION_READ_OCCURRENCE,i.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?i.ANNOTATION_READ_OCCURRENCE:i.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(a){var c=this._blameRGB,e=this.getTextView().getOptions("parent").ownerDocument;if(!c){var h=f.createElement(e,"div");h.className="annotation blame";e.body.appendChild(h);var p=(e.defaultView||e.parentWindow).getComputedStyle(h).getPropertyValue("background-color");h.parentNode.removeChild(h);
var h=p.indexOf("("),k=p.indexOf(")"),p=p.substring(h+1,k);this._blameRGB=c=p.split(",").slice(0,3)}var q=function(){var a=d.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=b.mixin({},a.style);a.style.style=b.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},v=function(){var a=f.createElement(e,"div");a.className="tooltipTitle";var c=this.blame.Message.indexOf("\n");
if(c===-1)c=this.blame.Message.length;var b=f.createElement(e,"a");b.href=this.blame.CommitLink;b.appendChild(e.createTextNode(this.blame.Message.substring(0,c)));a.appendChild(b);a.appendChild(f.createElement(e,"br"));a.appendChild(e.createTextNode(f.formatMessage(j.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},s=this.getModel();this.showAnnotations(a,[i.ANNOTATION_BLAME,i.ANNOTATION_CURRENT_BLAME],function(a){var e=s.getLineStart(a.Start-1),g=s.getLineEnd(a.End-1,!0),e=d.AnnotationType.createAnnotation(i.ANNOTATION_BLAME,
e,g,v),g=c.slice(0);g.push(a.Shade);e.style=b.mixin({},e.style);e.style.style=b.mixin({},e.style.style);e.style.style.backgroundColor="rgba("+g.join()+")";e.groupId=a.Name;e.groupType=i.ANNOTATION_CURRENT_BLAME;e.createGroupAnnotation=q;e.html='<img class="annotationHTML blame" src="'+a.AuthorImage+'"/>';e.blame=a;return e})},showSelection:function(a,c,b,d,e){typeof a==="number"?(typeof c!=="number"&&(c=a),this.moveSelection(a,c)):typeof b==="number"&&(a=this.getModel().getLineStart(b-1),typeof d===
"number"&&(a+=d),typeof e!=="number"&&(e=0),this.moveSelection(a,a+e))},_setModelText:function(a){this._textView&&(this._textView.setText(a),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(b,c,d,e,f){a.prototype.setInput.call(this,b,c,d,e);this._textView&&!e&&!f&&this._textView.focus()},onGotoLine:function(a,c,b,d){if(this._textView){var e=this.getModel(),a=Math.max(0,Math.min(a,e.getLineCount()-1)),f=e.getLineStart(a),
i=0;b===void 0&&(b=0);typeof c==="string"?(a=e.getLine(a).indexOf(c),a!==-1&&(i=a,b=i+c.length)):(i=c,c=e.getLineEnd(a)-f,i=Math.min(i,c),b=Math.min(b,c));this.moveSelection(f+i,f+b,d)}}});return{BaseEditor:a,Editor:e}});
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(j,k,h,d,b,f,a){function e(a){var d=a.getTextView();h.KeyMode.call(this,d);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";d.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));d.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var e=this;this._listener={onVerify:function(a){var c=e.editor,d=c.getModel(),g=c.mapOffset(a.start),c=c.mapOffset(a.end),d=d.getText(g,c);if((d=e._prefix.match(RegExp("^"+b.escape(d),"i")))&&d.length>0)e._prefix+=a.text,e._success=!0,e._status(),e.find(e._forward,!0),a.text=null},onSelection:function(){e._ignoreSelection||e.setActive(!1)}}}function i(a,b,d){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 e=this;this._listeners={onEditorFocus:function(a){e._removeCurrentAnnotation(a)}};this.setOptions(d)}}var g={};e.prototype=new h.KeyMode;f.mixin(e.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 d=this._prefix;if(d.length===0)return!1;var e=this.editor,g=e.getModel(),g=a?this._success?b?this._start:e.getCaretOffset()+
1:0:this._success?b?this._start:e.getCaretOffset():g.getCharCount()-1;if(d=e.getModel().find({string:d,start:g,reverse:!a,caseInsensitive:d.toLowerCase()===d}).next()){if(!b)this._start=g;this._ignoreSelection=this._success=!0;e.moveSelection(a?d.start:d.end,a?d.end:d.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 c;c=this._forward?this._success?j.incrementalFindStr:j.incrementalFindStrNotFound:this._success?j.incrementalFindReverseStr:j.incrementalFindReverseStrNotFound;c=a.formatMessage(c,this._prefix);this.editor.reportStatus(c,this._success?"":"error")}else this.editor.reportStatus("")}});
g.IncrementalFind=e;i.prototype={find:function(a,b,d){this.setOptions({reverse:!a});var e=this.getFindString(),g;if(b)e=b.findString||e,g=b.count;a=this.getOptions();this.setOptions(b);b=d?this._startOffset:this.getStartOffset();if((g=this._doFind(e,b,g))&&!d)this._startOffset=g.start;this.setOptions(a);this._hideAfterFind&&this.hide();return g},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=b.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="",d=!1,e=this._editor.getModel().getLineDelimiter(),g=0;g<a.length;g++){var f=a.substring(g,g+1);if(d){switch(f){case "R":b+=e;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+f}d=!1}else f==="\\"?d=!0:b+=f}d&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,d=this._processReplaceString(this.getReplaceString()),e=b.getSelection().start;if(b=b.getModel().find({string:a,start:e,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,d),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var c=this.getFindString();if(c){this._replacingAll=!0;var b=this._editor,d=b.getTextView();b.reportStatus(j.replaceAll);var e=this._processReplaceString(this.getReplaceString()),g=this;window.setTimeout(function(){for(var f=0,i=0;;){var h=g._doFind(c,f,null,!0);if(!h)break;i++;i===1&&(d.setRedraw(!1),g.startUndo());g._doReplace(h.start,h.end,c,e);f=g.getStartOffset()}i>
0&&(g.endUndo(),d.setRedraw(!0));f>0?b.reportStatus(a.formatMessage(j.replacedMatches,i)):b.reportStatus(j.nothingReplaced,"error");g._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(d.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,d){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:d?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,e,g){var e=e||1,f=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var i,h;if(this._regex)try{h=this._find(a,b,g)}catch(k){f.reportStatus(k.message,
"error");return}else h=this._find(a,b,g);for(a=0;a<e&&h.hasNext();a++)i=h.next();if(!this._replacingAll){i?this._editor.reportStatus(""):this._editor.reportStatus(j.notFound,"error");if(this.isVisible()){e=d.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(h=f.getAnnotationModel())h.removeAnnotations(e),i&&h.addAnnotation(d.AnnotationType.createAnnotation(e,i.start,i.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var r=this;this._timer=window.setTimeout(function(){r._markAllOccurrences();
r._timer=null},500)}}this._findCallback?this._findCallback(i):i&&f.moveSelection(i.start,i.end,null,!1)}return i},_doReplace:function(a,b,d,e){var g=this._editor;if(this._regex&&(e=g.getText(a,b).replace(RegExp(d,this._caseInsensitive?"i":""),e),!e))return;g.setText(e,a,b);g.setSelection(a,a+e.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=d.AnnotationType.ANNOTATION_MATCHING_SEARCH,e=a.getAnnotations(),g=[],f;e.hasNext();){var i=e.next();i.type===
b&&g.push(i)}if(this.isVisible()){e=this.getFindString();e=this._editor.getModel().find({string:e,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(f=[];e.hasNext();)i=e.next(),f.push(d.AnnotationType.createAnnotation(b,i.start,i.end))}a.replaceAnnotations(g,f)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(d.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(d.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(){var a=this._editor.getAnnotationModel();a&&a.removeAnnotations(d.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};g.Find=i;return g});
define("orion/editor/actions","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/annotations,orion/editor/tooltip,orion/editor/find,orion/util".split(","),function(j,k,h,d,b,f){function a(a,d,e){this.editor=a;this.undoStack=d;this._incrementalFind=new b.IncrementalFind(a);this._find=e?e:new b.Find(a,d);this._lastEditLocation=null;this.init()}function e(a,b,d,e){this.editor=a;this.undoStack=b;this.contentAssist=d;this.linkedMode=e;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var i=h.AnnotationType,g={};a.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 c=1;if(a&&a.count)c=a.count;for(;c>0;)this.undoStack.undo(),--c;return!0}return!1}.bind(this),
{name:j.undo});a.setAction("redo",function(a){if(this.undoStack){var c=1;if(a&&a.count)c=a.count;for(;c>0;)this.undoStack.redo(),--c;return!0}return!1}.bind(this),{name:j.redo});a.setKeyBinding(new k.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(j.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:j.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:j.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:j.findPrevious});a.setKeyBinding(new k.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:j.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:j.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:j.unindentLines});a.setKeyBinding(new k.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:j.moveLinesUp});a.setKeyBinding(new k.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:j.moveLinesDown});a.setKeyBinding(new k.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:j.copyLinesUp});a.setKeyBinding(new k.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:j.copyLinesDown});a.setKeyBinding(new k.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:j.deleteLines});a.setKeyBinding(new k.KeyBinding("l",!f.isMac,!1,!1,f.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:j.gotoLine});a.setKeyBinding(new k.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:j.nextAnnotation});a.setKeyBinding(new k.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:j.prevAnnotation});a.setKeyBinding(new k.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:j.expand});a.setKeyBinding(new k.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:j.collapse});a.setKeyBinding(new k.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:j.expandAll});a.setKeyBinding(new k.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:j.collapseAll});a.setKeyBinding(new k.KeyBinding("q",!f.isMac,!1,!1,f.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:j.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=b.getLineStart(e),e=b.getLineEnd(d,!0),f=b.getLineCount(),i="",g=b.getText(g,e);d===f-1&&(g=(i=b.getLineDelimiter())+g);a.setText(g,e,e);a.setSelection(e+i.length,e+g.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-
1:d.end),e=b.getLineStart(e),g=b.getLineEnd(d,!0),f=b.getLineCount(),i="",g=b.getText(e,g);d===f-1&&(g+=i=b.getLineDelimiter());a.setText(g,e,e);a.setSelection(e,e+g.length-i.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=1;if(a&&a.count)d=a.count;var e=b.getSelection(),g=b.getModel(),f=g.getLineAtOffset(e.start),a=g.getLineStart(f),d=e.start!==e.end||d===1?g.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(f+d-1,g.getLineCount()-
1),d=g.getLineEnd(d,!0);b.setText("",a,d);return!0},expandAnnotation:function(a){var b=this.editor,d=b.getAnnotationModel();if(!d)return!0;var e=b.getModel(),g=b.getCaretOffset(),f=e.getLineAtOffset(g),g=e.getLineStart(f),f=e.getLineEnd(f,!0);e.getBaseModel&&(g=e.mapOffset(g),f=e.mapOffset(f),e.getBaseModel());for(var i,d=d.getAnnotations(g,f);!i&&d.hasNext();)e=d.next(),e.type===h.AnnotationType.ANNOTATION_FOLDING&&(i=e);i&&a!==i.expanded&&(a?i.expand():(b.setCaretOffset(i.start),i.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,d=b.getTextView(),e=b.getAnnotationModel();if(!e)return!0;b.getModel();e=e.getAnnotations();for(d.setRedraw(!1);e.hasNext();)b=e.next(),b.type===h.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());d.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var d=a.getModel(),e=a.getSelection(),g=d.getLineAtOffset(e.start),
f=d.getLineAtOffset(e.end>e.start?e.end-1:e.end);if(g!==f){var i=[];i.push("");for(var h=g;h<=f;h++)i.push(d.getLine(h,!0));h=d.getLineStart(g);d=d.getLineEnd(f,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(i.join(b),h,d);a.setSelection(h===e.start?e.start:e.start+b.length,e.end+(f-g+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(j.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(),d=a.getSelection(),e=b.getLineAtOffset(d.start),g=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineCount();if(g===f-1)return!0;var e=b.getLineStart(e),d=b.getLineEnd(g,!0),i=b.getLineEnd(g+1,!0)-(d-e),h=0;g!==f-2?b=b.getText(e,d):(g=b.getLineEnd(g),
b=b.getText(g,d)+b.getText(e,g),h+=d-g);this.startUndo();a.setText("",e,d);a.setText(b,i,i);a.setSelection(i+h,i+h+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start);if(e===0)return!0;var g=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineCount(),d=b.getLineStart(e-1),i=b.getLineStart(e),h=b.getLineEnd(g,!0),j=b.getText(i,h),k=0;g===f-1&&(g=b.getLineEnd(e-
1),e=b.getLineEnd(e-1,!0),j+=b.getText(g,e),i=g,k=e-g);this.startUndo();a.setText("",i,h);a.setText(j,d,d);a.setSelection(d,d+j.length-k);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===i.ANNOTATION_MATCHING_BRACKET||a.type===i.ANNOTATION_CURRENT_BRACKET||!f.isAnnotationTypeVisible(a.type)}var e=this.editor,g=e.getAnnotationModel();if(!g)return!0;var f=e.getOverviewRuler()||e.getAnnotationStyler();if(!f)return!0;for(var h=e.getModel(),j=e.getCaretOffset(),
k=g.getAnnotations(a?j:0,a?h.getCharCount():j),r=null;k.hasNext();){var u=k.next();if(a){if(u.start<=j)continue}else if(u.start>=j)continue;if(!b(u)&&(r=u,a))break}if(r){for(var w=[r],k=g.getAnnotations(r.start,r.start);k.hasNext();)u=k.next(),u!==r&&!b(u)&&w.push(u);var n=e.getTextView(),t=h.getLineAtOffset(r.start),y=d.Tooltip.getTooltip(n);if(!y)return e.moveSelection(r.start),!0;e.moveSelection(r.start,r.start,function(){y.setTarget({getTooltipInfo:function(){var a=n.convert({x:n.getLocationAtOffset(r.start).x,
y:n.getLocationAtOffset(h.getLineStart(t)).y},"document","page");return{contents:w,x:a.x,y:a.y+Math.floor(n.getLineHeight(t)*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 d=a.getModel(),e=a.getSelection(),g=d.getLineAtOffset(e.start),f=d.getLineAtOffset(e.end>e.start?e.end-1:e.end),i=b.getOptions("tabSize"),h=Array(i+1).join(" "),j=[],k=b=0,w=g;w<=f;w++){var n=d.getLine(w,!0);if(d.getLineStart(w)!==
d.getLineEnd(w))if(n.indexOf("\t")===0)n=n.substring(1),b++;else if(n.indexOf(h)===0)n=n.substring(i),b+=i;else return!0;w===g&&(k=b);j.push(n)}g=d.getLineStart(g);i=d.getLineEnd(f,!0);d=d.getLineStart(f);a.setText(j.join(""),g,i);f=g===e.start?e.start:e.start-k;e=Math.max(f,e.end-b+(e.end===d+1&&e.start!==e.end?1:0));a.setSelection(f,e);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};g.TextActions=
a;e.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:j.trimTrailingWhitespaces});a.setKeyBinding(new k.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:j.toggleLineComment});a.setKeyBinding(new k.KeyBinding(191,!0,!f.isMac,!1,f.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:j.addBlockComment});a.setKeyBinding(new k.KeyBinding(220,!0,!f.isMac,!1,f.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:j.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 d=a.getSelection();if(d.start===d.end){for(var e=a.getModel(),g=e.getLineAtOffset(d.start),f=e.getLine(g,!1),i=e.getLineStart(g),h=0,j=d.start-
i,k;h<j&&((k=f.charCodeAt(h))===32||k===9);)h++;var i=f.substring(0,h),b=b.getOptions("tabSize","expandTab"),w=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=e.getLineDelimiter(),n=/^[\s]*\/\*[\*]*[\s]*$/,t=/^[\s]*\*/,y=/\*\/[\s]*$/,z=f.substring(0,j),D=f.substring(j),E;if(this.smartIndentation&&f.charCodeAt(E=z.trimRight().length-1)===123)return e=j-E-1,D=D.length-D.trimLeft().length,f=f.charCodeAt(j+D)===125?b+i+w+b+i:b+i+w,a.setText(f,d.start-e,d.end+D),a.setCaretOffset(d.start+b.length+i.length+
w.length-e),!0;else if(this.autoCompleteComments&&!y.test(z)&&(n.test(z)||t.test(z))){if(h=n.exec(z)){f=b+i+" * ";f+=y.test(D)?D.substring(0,D.length-2).trim():D.trim();if(e.getLineCount()===g+1||!t.test(e.getLine(g+1)))f+=b+i+" */";a.setText(f,d.start,d.end+D.length);a.setCaretOffset(d.start+b.length+i.length+3);return!0}if(h=t.exec(z))for(g-=1;g>=0;g--)if(h=e.getLine(g,!1),n.test(h))return y.test(D)||f.charCodeAt(j)===47?(f=b+i+"*"+D,i=d.start+b.length+i.length+1):(f=b+i+"* "+D,i=d.start+b.length+
i.length+2),a.setText(f,d.start,d.end+D.length),a.setCaretOffset(i),!0;else if(!t.test(h))break}else if(y.test(z)&&i.charCodeAt(i.length-1)===32)return f=b+i.substring(0,i.length-1),a.setText(f,d.start,d.end),a.setCaretOffset(d.start+f.length),!0;else if(h>0){for(h=j;h<f.length&&((k=f.charCodeAt(h++))===32||k===9);)d.end++;a.setText(e.getLineDelimiter()+i,d.start,d.end);return!0}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),
d=a.getSelection(),e=this._findEnclosingComment(b,d.start,d.end);if(e.commentStart!==void 0&&e.commentEnd!==void 0)return!0;b=b.getText(d.start,d.end);if(b.length===0)return!0;var e=b.length,b=b.replace(/\/\*|\*\//g,""),g=b.length;a.setText("/*"+b+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(g-e));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 d=this.editor;if(d.getTextView().getOptions("readonly"))return!1;var e=d.getSelection(),g=d.getModel(),f=d.getCaretOffset()===g.getCharCount()?"":g.getText(e.start,e.start+1).trim(),i=/^$|[)}\]>]/;if(e.start===e.end&&i.test(f))return d.setText(a+b,e.start,e.start),d.setCaretOffset(e.start+1),!0;else if(e.start!==e.end)return g=g.getText(e.start,e.end),d.setText(a+g+b,e.start,e.end),d.setSelection(e.start+1,e.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 d=b.getSelection(),e=b.getModel(),g=b.getCaretOffset(),f=g===0?"":e.getText(d.start-1,d.start).trim(),i=g===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),g=/^"$|^'$/,h=/\w/,j=/^$|[)}\]>]/;if(d.start!==d.end){e=e.getText(d.start,d.end);if(g.test(e))return!1;b.setText(a+e+a,d.start,d.end);b.setSelection(d.start+1,d.end+1)}else if(i===a)b.setCaretOffset(d.start+1);else if(f===a||g.test(i)||h.test(f)||!j.test(i))return!1;
else b.setText(a+a,d.start,d.start),b.setCaretOffset(d.start+1);return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&a.positions.length>0&&this.linkedMode){for(var b=[],d=0;d<a.positions.length;++d)b[d]={positions:[{offset:a.positions[d].offset,length:a.positions[d].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 d=a.getModel(),e=a.getCaretOffset(),g=e===0?"":d.getText(b.start-1,b.start),d=e===d.getCharCount()?"":d.getText(b.start,b.start+1);(g==="("&&d===")"||g==="["&&d==="]"||g==="{"&&d==="}"||g==="<"&&d===">"||g==='"'&&d==='"'||g==="'"&&d==="'")&&a.setText("",b.start,b.start+
1);return!1},_findEnclosingComment:function(a,b,d){var e=a.getLineAtOffset(b),g=a.getLineAtOffset(d),f,i,h,j,k,w;for(f=e;f>=0;f--)if(i=a.getLine(f),h=f===e?b-a.getLineStart(e):i.length,j=i.lastIndexOf("/*",h),i=i.lastIndexOf("*/",h),i>j)break;else if(j!==-1){k=a.getLineStart(f)+j;break}for(f=g;f<a.getLineCount();f++)if(i=a.getLine(f),h=f===g?d-a.getLineStart(g):0,j=i.indexOf("/*",h),i=i.indexOf("*/",h),j!==-1&&j<i)break;else if(i!==-1){w=a.getLineStart(f)+i;break}return{commentStart:k,commentEnd:w}},
lineStart:function(){for(var a=this.editor,b=a.getModel(),d=a.getCaretOffset(),e=b.getLineAtOffset(d),g=b.getLineStart(e),b=b.getLine(e),e=0;e<b.length;e++){var f=b.charCodeAt(e);if(!(f===32||f===9))break}e+=g;return d!==e?(a.setSelection(e,e),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getText(d.start,d.end),g,f,i;for(i=0;i<e.length;i++)if(e.substring(i,i+2)==="/*"){g=d.start+i;break}for(;i<e.length;i++)if(e.substring(i,
i+2)==="*/"){f=d.start+i;break}if(g!==void 0&&f!==void 0)a.setText(b.getText(g+2,f),g,f+2),a.setSelection(g,f);else{e=this._findEnclosingComment(b,d.start,d.end);if(e.commentStart===void 0||e.commentEnd===void 0)return!0;b=b.getText(e.commentStart+2,e.commentEnd);a.setText(b,e.commentStart,e.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),
g=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=!0,i=[],h,j,k=e;k<=g;k++)if(h=b.getLine(k,!0),i.push(h),!f||(j=h.indexOf("//"))===-1)f=!1;else if(j!==0){var w;for(w=0;w<j;w++)if(f=h.charCodeAt(w),!(f===32||f===9))break;f=w===j}k=b.getLineStart(e);w=b.getLineEnd(g,!0);if(f){for(f=0;f<i.length;f++)h=i[f],j=h.indexOf("//"),i[f]=h.substring(0,j)+h.substring(j+2);i=i.join("");h=b.getLineStart(g);b=k===d.start?d.start:d.start-2;d=d.end-2*(g-e+1)+(d.end===h+1?2:0)}else i.splice(0,0,""),i=i.join("//"),
b=k===d.start?d.start:d.start+2,d=d.end+2*(g-e+1);a.setText(i,k,w);a.setSelection(b,d);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),d=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var e=/(\s+$)/,g=b.getLineCount(),f=0;f<g;f++){var i=b.getLine(f),h=e.exec(i);if(h){var j=b.getLineStart(f),i=h[0].length,h=j+h.index;b.setText("",h,h+i);if(d.start>h)d.start=Math.max(h,d.start-i);if(d.start!==d.end&&d.end>h)d.end=Math.max(h,d.end-
i)}}a.getUndoStack().endCompoundChange();a.getTextView().setRedraw(!0);a.setSelection(d.start,d.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),e=b.getModel();return(b.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1))===a?(b.setCaretOffset(d.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}};g.SourceCodeActions=e;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 g});
define("orion/editor/undoStack",[],function(){function j(d,b,f,a,e){this.model=d;this.offset=b;this.text=f;this.previousText=a;this.type=e}function k(d){this.owner=d;this.changes=[]}function h(d,b){this.size=b!==void 0?b:100;this.reset();var f=this;this._listener={onChanging:function(a){f._onChanging(a)},onDestroy:function(a){f._onDestroy(a)}};if(d.getModel){var a=d.getModel();a.getBaseModel&&(a=a.getBaseModel());this.model=a;this.setView(d)}else this.shared=!0,this.model=d;this.model.addEventListener("Changing",
this._listener.onChanging)}j.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(d,b){this._doUndoRedo(this.offset,this.previousText,this.text,d,b);return!0},redo:function(d,b){this._doUndoRedo(this.offset,this.text,this.previousText,d,b);return!0},merge:function(d,b,f,a,e){if(a===this.type)if(a===1&&d===
this.offset+this.text.length)return this.text+=b,!0;else if(a===-1&&e===this.offset)return this.offset=d,this.previousText=f+this.previousText,!0;else if(a===-1&&d===this.offset)return this.previousText+=f,!0;return!1},_doUndoRedo:function(d,b,f,a,e){this.model.setText(b,d,d+f.length);e&&a&&(f=a.getModel(),f!==this.model&&(d=f.mapOffset(d,!0)),a.setSelection(d,d+b.length))}};k.prototype={getRedoChanges:function(){for(var d=[],b=0;b<this.changes.length;b++)d=d.concat(this.changes[b].getRedoChanges());
return d},getUndoChanges:function(){for(var d=[],b=this.changes.length-1;b>=0;b--)d=d.concat(this.changes[b].getUndoChanges());return d},add:function(d){this.changes.push(d)},end:function(d){if(d)this.endSelection=d.getSelection(),this.endCaret=d.getCaretOffset();(d=this.owner)&&d.end&&d.end()},undo:function(d,b){this.changes.length>1&&d&&d.setRedraw(!1);for(var f=this.changes.length-1;f>=0;f--)this.changes[f].undo(d,!1);this.changes.length>1&&d&&d.setRedraw(!0);if(b&&d){var f=this.startSelection.start,
a=this.startSelection.end;d.setSelection(this.startCaret?f:a,this.startCaret?a:f)}(f=this.owner)&&f.undo&&f.undo();return this.changes.length>0},redo:function(d,b){this.changes.length>1&&d&&d.setRedraw(!1);for(var f=0;f<this.changes.length;f++)this.changes[f].redo(d,!1);d&&d.setRedraw(!0);if(b&&d){var f=this.endSelection.start,a=this.endSelection.end;d.setSelection(this.endCaret?f:a,this.endCaret?a:f)}(f=this.owner)&&f.redo&&f.redo();return this.changes.length>0},merge:function(d,b,f,a,e){var i=this.changes.length;
return i>0?this.changes[i-1].merge(d,b,f,a,e):!1},start:function(d){if(d)this.startSelection=d.getSelection(),this.startCaret=d.getCaretOffset();(d=this.owner)&&d.start&&d.start()}};h.prototype={destroy:function(){this._onDestroy()},add:function(d){this.compoundChange?this.compoundChange.add(d):(this.stack.splice(this.index,this.stack.length-this.index,d),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 d=[],b=this.index;b<this.stack.length;b++)d=d.concat(this.stack[b].getRedoChanges());
return d},getUndoChanges:function(){this._commitUndo();for(var d=[],b=this.index;b>=0;b--)d=d.concat(this.stack[b].getUndoChanges());return d},undo:function(){this._commitUndo();var d;d=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;d=this.stack[--this.index]}while(!(d=d.undo(this.view,!0)));this._ignoreUndo=!1;return d},redo:function(){this._commitUndo();var d;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;d=this.stack[this.index++]}while(!d.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(d){if(this.view!==d)this.view&&d.removeEventListener("Destroy",this._listener.onDestroy),(this.view=d)&&d.addEventListener("Destroy",this._listener.onDestroy)},startCompoundChange:function(d){this._commitUndo();d=new k(d);this.add(d);this.compoundChange=d;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(d){(!d||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);if(this.view)this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null},_onChanging:function(d){if(!this._ignoreUndo){var b=d.text,f=d.start,a=d.addedCharCount,e=d.removedCharCount,d=f+e,i=0;a===0&&e===1?i=-1:a===1&&e===0&&(i=1);a=this.stack.length;e=this.model.getText(f,d);(!(a>0&&this.index===a)||!this.stack[a-1].merge(f,b,e,i,d))&&this.add(new j(this.model,f,b,
e,i))}}};return{UndoStack:h}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(j,k,h,d){function b(a,b,d,e){this._location=b||"left";this._overview=d||"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(a)}function f(a,c,d,e,f){b.call(this,a,c,"page",d);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function a(a,c,d){b.call(this,a,c,"page",d)}function e(a,c,d){b.call(this,a,c,"document",d)}function i(b,c,d){a.call(this,b,c,d)}b.prototype={getAnnotations:function(a,b){var d=this._annotationModel;if(!d)return[];var e=this._view.getModel(),f=e.getLineStart(a),i=e.getLineEnd(b-1),h=e;e.getBaseModel&&(h=e.getBaseModel(),f=e.mapOffset(f),i=e.mapOffset(i));for(var j=[],d=this.getAnnotationsByType(d,f,i),f=0;f<
d.length;f++)for(var i=d[f],k=h.getLineAtOffset(i.start),r=h.getLineAtOffset(Math.max(i.start,i.end-1)),u=k;u<=r;u++){var w=u;if(e!==h){w=h.getLineStart(u);w=e.mapOffset(w,!0);if(w===-1)continue;w=e.getLineAtOffset(w)}if(a<=w&&w<b){var n=this._mergeAnnotation(j[w],i,u-k,r-k+1);n&&(j[w]=n)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var t in j)j[t]._multiple&&(j[t].html+=this._multiAnnotationOverlay.html);return j},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(a){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=a)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(a){this._multiAnnotation=a},setMultiAnnotationOverlay:function(a){this._multiAnnotationOverlay=
a},setView:function(a){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=a;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(a){if(a!==void 0){var b=this._view,d=b.getModel(),e=d,f=d.getLineStart(a),i=f,j=f,k=this._annotationModel;if(k){b=b.getSelection();j=d.getLineEnd(a,!0);if(f<=b.start&&b.start<j)f=b.start;d.getBaseModel&&(f=d.mapOffset(f),
j=d.mapOffset(j),e=d.getBaseModel());for(var s,j=k.getAnnotations(f,j),k=null;!s&&j.hasNext();)b=j.next(),this.isAnnotationTypeVisible(b.type)&&(k=b,b.start<=f||(s=b));if(k&&k.groupId!==void 0)this._currentClickGroup=this._currentClickGroup===k.groupId?null:k.groupId,this._setCurrentGroup(a);s&&e.getLineAtOffset(s.start)===e.getLineAtOffset(f)?(f=s.start,j=s.end):j=f=i;d.getBaseModel&&(f=d.mapOffset(f,!0),j=d.mapOffset(j,!0))}(a=h.Tooltip.getTooltip(this._view))&&a.setTarget(null);this._view.setSelection(j,
f,1/3,function(){})}},onDblClick:function(){},onMouseMove:function(a,b){var d=h.Tooltip.getTooltip(this._view);if(d&&!(d.isVisible()&&this._tooltipLineIndex===a)){this._tooltipLineIndex=a;var e=this;d.setTarget({y:b.clientY,getTooltipInfo:function(){return e._getTooltipInfo(e._tooltipLineIndex,this.y)}})}},onMouseOver:function(a,b){this.onMouseMove(a,b);this._currentClickGroup||this._setCurrentGroup(a)},onMouseOut:function(){this._currentClickGroup||this._setCurrentGroup(-1);var a=h.Tooltip.getTooltip(this._view);
a&&a.setTarget(null)},_getTooltipInfo:function(a,b){if(a!==void 0){var d=this._view,e=d.getModel(),f=this._annotationModel,i=[];if(f){var i=e.getLineStart(a),h=e.getLineEnd(a);e.getBaseModel&&(i=e.mapOffset(i),h=e.mapOffset(h));i=this.getAnnotationsByType(f,i,h)}f=this._getTooltipContents(a,i);if(!f)return null;f={contents:f,anchor:this.getLocation()};i=d.getClientArea();i.y=this.getOverview()==="document"?d.convert({y:b},"view","document").y:d.getLocationAtOffset(e.getLineStart(a)).y;d.convert(i,
"document","page");f.x=i.x;f.y=i.y;f.anchor==="right"&&(f.x+=i.width);return f}},_getTooltipContents:function(a,b){return b},_onAnnotationModelChanged:function(a){function b(a){for(var c=0;c<a.length;c++)if(f.isAnnotationTypeVisible(a[c].type)){var g=a[c].start,i=a[c].end;e.getBaseModel&&(g=e.mapOffset(g,!0),i=e.mapOffset(i,!0));g!==-1&&i!==-1&&d.redrawLines(e.getLineAtOffset(g),e.getLineAtOffset(Math.max(g,i-1))+1,f)}}var d=this._view;if(d){var e=d.getModel(),f=this,i=e.getLineCount();a.textModelChangedEvent?
(a=a.textModelChangedEvent.start,e.getBaseModel&&(a=e.mapOffset(a,!0)),a=e.getLineAtOffset(a),d.redrawLines(a,i,f)):(b(a.added),b(a.removed),b(a.changed))}},_mergeAnnotation:function(a,b,d){a||(a={});if(d===0)if(a.html&&b.html){if(b.html!==a.html&&!a._multiple&&this._multiAnnotation)a.html=this._multiAnnotation.html;a._multiple=!0}else a.html=b.html;a.style=this._mergeStyle(a.style,b.style);return a},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?
a.styleClass+=" "+b.styleClass:a.styleClass=b.styleClass;var d;if(b.style){if(!a.style)a.style={};for(d in b.style)a.style[d]===void 0&&(a.style[d]=b.style[d])}if(b.attributes){if(!a.attributes)a.attributes={};for(d in b.attributes)a.attributes[d]===void 0&&(a.attributes[d]=b.attributes[d])}}return a},_setCurrentGroup:function(a){var b=this._annotationModel,d=null,e=b.getTextModel(),f,i=this._currentGroupAnnotation;if(a!==-1){var h=e.getLineStart(a),j=e.getLineEnd(a);e.getBaseModel&&(h=e.mapOffset(h),
j=e.mapOffset(j));for(f=b.getAnnotations(h,j);f.hasNext();)if(e=f.next(),this.isAnnotationTypeVisible(e.type)&&e.start<=h&&e.end>=j&&e.groupId!==void 0){d=e;break}if(i&&d&&i.groupId===d.groupId)return}this._currentGroupAnnotation=null;i&&b.removeAnnotations(i.groupType);if(d&&a!==-1){this._currentGroupAnnotation=d;f=b.getAnnotations();for(a=[];f.hasNext();)e=f.next(),delete e.groupAnnotation,e.groupId===d.groupId&&(e=e.createGroupAnnotation(),a.push(e));b.replaceAnnotations(null,a)}}};k.AnnotationTypeList.addMixin(b.prototype);
f.prototype=new b;f.prototype.getAnnotations=function(a,c){for(var d=b.prototype.getAnnotations.call(this,a,c),e=this._view.getModel(),f=a;f<c;f++){var i=f&1?this._oddStyle:this._evenStyle,h=f;e.getBaseModel&&(h=e.getLineStart(h),h=e.getBaseModel().getLineAtOffset(e.mapOffset(h)));d[f]||(d[f]={});d[f].html=this._firstLine+h+"";if(!d[f].style)d[f].style=i}return d};f.prototype.getWidestAnnotation=function(){var a=this._view.getModel().getLineCount();return this.getAnnotations(a-1,a)[a-1]};f.prototype.setFirstLine=
function(a){this._firstLine=a!==void 0?a:1};f.prototype._onTextModelChanged=function(a){var a=a.start,b=this._view.getModel(),d=(this._firstLine+(b.getBaseModel?b.getBaseModel().getLineCount():b.getLineCount())-1+"").length;if(this._numOfDigits!==d)this._numOfDigits=d,this._view.redrawLines(b.getLineAtOffset(a),b.getLineCount(),this)};a.prototype=new b;e.prototype=new b;e.prototype.getRulerStyle=function(){var a={style:{lineHeight:"1px",fontSize:"1px"}};return a=this._mergeStyle(a,this._rulerStyle)};
e.prototype._getTooltipContents=function(a,c){if(c.length===0){var e=this._view.getModel(),f=a;e.getBaseModel&&(f=e.getLineStart(f),f=e.getBaseModel().getLineAtOffset(e.mapOffset(f)));return d.formatMessage(j.line,f+1)}return b.prototype._getTooltipContents.call(this,a,c)};e.prototype._mergeAnnotation=function(a,b,d,e){if(d===0){if(!a)a={html:"&nbsp;",style:{style:{height:3*e+"px"}}},a.style=this._mergeStyle(a.style,b.overviewStyle);return a}};i.prototype=new a;i.prototype.onClick=function(a){if(a!==
void 0){var b=this._annotationModel;if(b){var d=this._view.getModel(),e=d.getLineStart(a),a=d.getLineEnd(a,!0);d.getBaseModel&&(e=d.mapOffset(e),a=d.mapOffset(a),d=d.getBaseModel());for(var f,b=b.getAnnotations(e,a);!f&&b.hasNext();)a=b.next(),this.isAnnotationTypeVisible(a.type)&&(f=a);f&&d.getLineAtOffset(f.start)===d.getLineAtOffset(e)&&((d=h.Tooltip.getTooltip(this._view))&&d.setTarget(null),f.expanded?f.collapse():f.expand())}}};i.prototype._getTooltipContents=function(b,c){return c.length===
1&&c[0].expanded?null:a.prototype._getTooltipContents.call(this,b,c)};i.prototype._onAnnotationModelChanged=function(b){function c(a){for(i=0;i<a.length;i++)if(f.isAnnotationTypeVisible(a[i].type)){var b=a[i].start;e.getBaseModel&&(b=e.mapOffset(b,!0));b!==-1&&(j=Math.min(j,e.getLineAtOffset(b)))}}if(b.textModelChangedEvent)a.prototype._onAnnotationModelChanged.call(this,b);else{var d=this._view;if(d){var e=d.getModel(),f=this,i,h=e.getLineCount(),j=h;c(b.added);c(b.removed);c(b.changed);b=d.getRulers();
for(i=0;i<b.length;i++)d.redrawLines(j,h,b[i])}}};return{Ruler:b,AnnotationRuler:a,LineNumberRuler:f,OverviewRuler:e,FoldingRuler:i}});
define("orion/editor/textDND",["orion/util"],function(j){function k(h,d){this._view=h;this._undoStack=d;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var b=this;this._listener={onDragStart:function(d){b._onDragStart(d)},onDragEnd:function(d){b._onDragEnd(d)},onDragEnter:function(d){b._onDragEnter(d)},onDragOver:function(d){b._onDragOver(d)},onDrop:function(d){b._onDrop(d)},onDestroy:function(d){b._onDestroy(d)}};h.addEventListener("DragStart",this._listener.onDragStart);h.addEventListener("DragEnd",
this._listener.onDragEnd);h.addEventListener("DragEnter",this._listener.onDragEnter);h.addEventListener("DragOver",this._listener.onDragOver);h.addEventListener("Drop",this._listener.onDrop);h.addEventListener("Destroy",this._listener.onDestroy)}k.prototype={destroy:function(){var h=this._view;if(h)h.removeEventListener("DragStart",this._listener.onDragStart),h.removeEventListener("DragEnd",this._listener.onDragEnd),h.removeEventListener("DragEnter",this._listener.onDragEnter),h.removeEventListener("DragOver",
this._listener.onDragOver),h.removeEventListener("Drop",this._listener.onDrop),h.removeEventListener("Destroy",this._listener.onDestroy),this._view=null},_onDestroy:function(){this.destroy()},_onDragStart:function(h){var d=this._view,b=d.getSelection(),d=d.getModel();if(d.getBaseModel)b.start=d.mapOffset(b.start),b.end=d.mapOffset(b.end),d=d.getBaseModel();if(d=d.getText(b.start,b.end))this._dragSelection=b,h.event.dataTransfer.effectAllowed="copyMove",h.event.dataTransfer.setData("Text",d)},_onDragEnd:function(h){if(this._dragSelection){var d=
this._view,b=h.event.dataTransfer.dropEffect;if(!j.isFirefox&&(b!=="none"||this._dropText))b=h.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(h=b==="move")&&d.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var b=this._dropText,f=this._dropOffset;if(h)if(f>=this._dragSelection.end)f-=this._dragSelection.end-this._dragSelection.start;else if(f>=this._dragSelection.start)f=this._dragSelection.start;d.setText(b,
f,f);d.setSelection(f,f+b.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(h){this._onDragOver(h)},_onDragOver:function(h){var d=h.event.dataTransfer.types,b=!this._view.getOptions("readonly");b&&d&&(b=d.contains?d.contains("text/plain")||d.contains("Text"):d.indexOf("text/plain")!==-1||d.indexOf("Text")!==-1);if(b){if(!j.isFirefox)this._dropEffect=h.event.dataTransfer.dropEffect=(j.isMac?h.event.altKey:
h.event.ctrlKey)?"copy":"move"}else h.event.dataTransfer.dropEffect="none"},_onDrop:function(h){var d=this._view,b=h.event.dataTransfer.getData("Text");if(b){if(!j.isFirefox)h.event.dataTransfer.dropEffect=this._dropEffect;h=d.getOffsetAtLocation(h.x,h.y);this._dragSelection?(this._dropOffset=h,this._dropText=b):(d.setText(b,h,h),d.setSelection(h,h+b.length))}}};return{TextDND:k}});
define("orion/editor/templates",[],function(){function j(h,d,b,f){this.prefix=h;this.description=d;this.template=b;this.name=f;this._parse()}function k(h,d){this._keywords=h||[];this._templates=[];this.addTemplates(d||[])}j.prototype={getProposal:function(h,d,b){var h=d-h.length,d={},f,a=b.delimiter!==void 0?b.delimiter:"\n";b.indentation&&(a+=b.indentation);for(var e=b.tab!==void 0?b.tab:"\t",i=0,g=this.variables,c=this.segments,b=[],j=0;j<c.length;j++){var k=c[j],p=g[k];if(p!==void 0)switch(k){case "${tab}":k=
e;break;case "${delimiter}":k=a;break;case "${cursor}":k="";f=i;break;default:var o=d[k];o||(o=d[k]={data:p.data,positions:[]});k=p.substitution;o.data&&o.data.values&&(k=o.data.values[0]);o.positions.push({offset:h+i,length:k.length})}b.push(k);i+=k.length}var a=[],q;for(q in d)d.hasOwnProperty(q)&&a.push(d[q]);b=b.join("");if(f===void 0)f=b.length;return{proposal:b,name:this.name,description:this.description,groups:a,escapePosition:h+f,style:"noemphasis"}},match:function(h){return this.prefix.indexOf(h)===
0},_parse:function(){var h=this.template,d=[],b={},f,a=0,h=h.replace(/\n/g,"${delimiter}"),h=h.replace(/\t/g,"${tab}");h.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(e,i,g){var c=e.substring(2,e.length-1),i=e,j=c,k=null,p=j.indexOf(":");p!==-1&&(j=j.substring(0,p),i="${"+j+"}",k=JSON.parse(c.substring(p+1).replace("\\}","}").trim()));(c=b[i])||(c=b[i]={});c.substitution=j;if(k)c.data=k;(f=h.substring(a,g))&&d.push(f);d.push(i);a=g+e.length;return j});(f=h.substring(a,h.length))&&d.push(f);this.segments=
d;this.variables=b}};k.prototype={addTemplates:function(h){for(var d=this.getTemplates(),b=0;b<h.length;b++)d.push(new j(h[b].prefix,h[b].description,h[b].template,h[b].name))},computeProposals:function(h,d,b){var f=this.getPrefix(h,d,b),a=[];this.isValid(f,h,d,b)&&(a=a.concat(this.getTemplateProposals(f,d,b)),a=a.concat(this.getKeywordProposals(f)));return a},getKeywords:function(){return this._keywords},getKeywordProposals:function(h){var d=[],b=this.getKeywords();if(b){for(var f=0;f<b.length;f++)b[f].indexOf(h)===
0&&d.push({proposal:b[f].substring(h.length),description:b[f],style:"noemphasis_keyword"});0<d.length&&d.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return d},getPrefix:function(h,d,b){return b.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(h,d,b){for(var f=[],a=this.getTemplates(),e=0;e<a.length;e++){var i=a[e];i.match(h)&&(i=i.getProposal(h,d,b),this.removePrefix(h,i),f.push(i))}0<f.length&&(f.sort(function(a,
b){return a.name<b.name?-1:a.name>b.name?1:0}),f.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return f},removePrefix:function(h,d){if(!(d.overwrite=d.proposal.substring(0,h.length)!==h))d.proposal=d.proposal.substring(h.length)},isValid:function(){return!0}};return{Template:j,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(j,k,h,d,b,f){function a(a,b,c){var d=a.getTextView();h.KeyMode.call(this,d);this.editor=a;this.undoStack=b;this.contentAssist=c;this.linkedModeModel=null;d.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));d.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));d.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));d.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,g=0;g<d.length;++g){f=d[g];e=f.position;var i=e.offset<=b&&b<=e.offset+e.length;i&&!f.ansestor?(e.offset+=c,
e.length+=a,c+=a):(e.offset+=c,f.ansestor&&i&&(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,g;e;)if(f=this._getPositionChanged(e,c,d),g=f.position,g===void 0||g.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var i=this._compoundChange;i?i.owner.model===e&&i.owner.group===g.group||
(this.endUndo(),this.startUndo()):this.startUndo();e.selectedGroupIndex=g.group;var i=0,h=a.text.length-(d-c);f=f.positions;var j;c-=g.position.offset;for(var l=d-g.position.offset,k=0;k<f.length;++k)if(j=f[k],d=j.position,j.oldOffset=d.offset,j.model===e&&j.group===g.group?(d.offset+=i,d.length+=h,i+=h):(d.offset+=i,j.ansestor&&(d.length+=g.count*h)),j.escape)j.model.escapePosition=d.offset;this.ignoreVerify=!0;for(k=f.length-1;k>=0;k--)j=f[k],j.model===e&&j.group===g.group&&b.setText(a.text,j.oldOffset+
c,j.oldOffset+l);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var e={};a.prototype=new h.KeyMode;f.mixin(a.prototype,{createKeyBindings:function(){var a=k.KeyBinding,b=[];b.push({actionID:"linkedModeEnter",keyBinding:new a(13)});b.push({actionID:"linkedModeCancel",keyBinding:new a(27)});b.push({actionID:"linkedModeNextGroup",keyBinding:new a(9)});b.push({actionID:"linkedModePreviousGroup",keyBinding:new a(9,!1,!0)});return b},enterLinkedMode:function(a){if(!this.linkedModeModel){var b=
this.editor.getTextView();b.addKeyMode(this);b.addEventListener("Verify",this.linkedModeListener.onVerify);b.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(j.linkedModeEntered,null,!0)}this._sortedPositions=null;if(this.linkedModeModel)a.previousModel=this.linkedModeModel,a.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=a;this.linkedModeModel=
a;this.selectLinkedGroup(0)},exitLinkedMode:function(a){if(this.isActive()){if(this._compoundChange)this.endUndo(),this._compoundChange=null;this._sortedPositions=null;var b=this.linkedModeModel;this.linkedModeModel=b.previousModel;b.parentGroup=b.previousModel=void 0;if(this.linkedModeModel)this.linkedModeModel.nextModel=void 0;if(!this.linkedModeModel){var c=this.editor,d=c.getTextView();d.removeKeyMode(this);d.removeEventListener("Verify",this.linkedModeListener.onVerify);d.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);d=this.contentAssist;d.removeEventListener("Activating",this.linkedModeListener.onActivating);d.offset=void 0;this.editor.reportStatus(j.linkedModeExited,null,!0);a&&c.setCaretOffset(b.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var a=this,b=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:b,group:b.selectedGroupIndex,end:function(){a._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(a){var d=this.linkedModeModel;if(d){d.selectedGroupIndex=a;var a=d.groups[a],c=a.positions[0],e=this.editor;e.setSelection(c.offset,c.offset+c.length);if(d=this.contentAssist)if(d.offset=void 0,a.data&&a.data.type==="link"&&a.data.values)(this._groupContentAssistProvider=new b.TemplateContentAssist(a.data.values)).getPrefix=function(){var a=
e.getSelection();return a.start===a.end&&(a=e.getCaretOffset(),c.offset<=a&&a<=c.offset+c.length)?e.getText(c.offset,a):""},d.offset=c.offset,d.deactivate(),d.activate();else if(this._groupContentAssistProvider)this._groupContentAssistProvider=null,d.deactivate()}this._updateAnnotations()},_getModelPositions:function(a,b,c){for(var d=b.groups,e=0;e<d.length;e++)for(var f=d[e].positions,h=0;h<f.length;h++){var j=f[h];c&&(j={offset:j.offset+c,length:j.length});j={index:h,group:e,count:f.length,model:b,
position:j};a.push(j);if(b.nextModel&&b.nextModel.parentGroup===e)j.ansestor=!0,this._getModelPositions(a,b.nextModel,(c||0)+f[h].offset-f[0].offset)}},_getSortedPositions:function(a){var b=this._sortedPositions;if(!b){for(b=[];a.previousModel;)a=a.previousModel;for(this._getModelPositions(b,a);a;)a.escapePosition!==void 0&&b.push({escape:!0,model:a,position:{offset:a.escapePosition,length:0}}),a=a.nextModel;b.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=b}return b},
_getPositionChanged:function(a,b,c){for(var d,a=this._getSortedPositions(a),e=a.length-1;e>=0;e--){var f=a[e].position;if(f.offset<=b&&c<=f.offset+f.length){d=a[e];break}}return{position:d,positions:a}},_updateAnnotations:function(a){var b=this.editor.getAnnotationModel();if(b){var c=[],e=[];b.getTextModel();for(var f=b.getAnnotations(),h;f.hasNext();)switch(h=f.next(),h.type){case d.AnnotationType.ANNOTATION_LINKED_GROUP:case d.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case d.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:c.push(h)}if(f=
this.linkedModeModel)for(var a=a||this._getSortedPositions(f),j=0;j<a.length;j++)if(h=a[j],h.model===f){var k=d.AnnotationType.ANNOTATION_LINKED_GROUP;h.group===f.selectedGroupIndex&&(k=h.index===0?d.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:d.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);h=h.position;h=d.AnnotationType.createAnnotation(k,h.offset,h.offset+h.length,"");e.push(h)}b.replaceAnnotations(c,e)}}});e.LinkedMode=a;return e});
define("orion/editor/factories","orion/editor/actions,orion/editor/undoStack,orion/editor/rulers,orion/editor/annotations,orion/editor/textDND,orion/editor/linkedMode".split(","),function(j,k,h,d,b,f){function a(){}function e(){}function i(){}function g(){}function c(){}function l(){}var m={};a.prototype={createKeyBindings:function(a,b,c,d){var d=new j.TextActions(a,b,d),e=new f.LinkedMode(a,b,c),a=new j.SourceCodeActions(a,b,c,e);return{textActions:d,linkedMode:e,sourceCodeActions:a}}};m.KeyBindingsFactory=
a;e.prototype={createUndoStack:function(a){a=a.getTextView();return new k.UndoStack(a,200)}};m.UndoFactory=e;i.prototype={createLineNumberRuler:function(a){return new h.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};m.LineNumberRulerFactory=i;g.prototype={createFoldingRuler:function(a){return new h.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};m.FoldingRulerFactory=g;c.prototype={createAnnotationModel:function(a){return new d.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new d.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new h.AnnotationRuler(a,"left",{styleClass:"ruler annotations"}),a=new h.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};m.AnnotationFactory=c;l.prototype={createTextDND:function(a,c){return new b.TextDND(a.getTextView(),c)}};m.TextDNDFactory=l;return m});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(j,k,h,d){return d.mixin({},j,k,h)});
var JsDiff=function(){function j(a){for(var b=[],d=0;d<a.length;d++)a[d]&&b.push(a[d]);return b}function k(a){a=a.replace(/&/g,"&amp;");a=a.replace(/</g,"&lt;");a=a.replace(/>/g,"&gt;");return a=a.replace(/"/g,"&quot;")}var h=function(a){this.ignoreWhitespace=a};h.prototype={diff:function(a,b){if(b==a)return[{value:b}];if(!b)return[{value:a,removed:!0}];if(!a)return[{value:b,added:!0}];var b=this.tokenize(b),a=this.tokenize(a),d=b.length,c=a.length,f=d+c,h=[{newPos:-1,components:[]}],j=this.extractCommon(h[0],
b,a,0);if(h[0].newPos+1>=d&&j+1>=c)return h[0].components;for(var k=1;k<=f;k++)for(var q=-1*k;q<=k;q+=2){var v;v=h[q-1];var s=h[q+1],j=(s?s.newPos:0)-q;v&&(h[q-1]=void 0);var r=v&&v.newPos+1<d,u=s&&0<=j&&j<c;if(!r&&!u)h[q]=void 0;else if(!r||u&&v.newPos<s.newPos?(v={newPos:s.newPos,components:s.components.slice(0)},this.pushComponent(v.components,a[j],void 0,!0)):(v={newPos:v.newPos,components:v.components.slice(0)},v.newPos++,this.pushComponent(v.components,b[v.newPos],!0,void 0)),j=this.extractCommon(v,
b,a,q),v.newPos+1>=d&&j+1>=c)return v.components;else h[q]=v}},pushComponent:function(a,b,d,c){var f=a[a.length-1];f&&f.added===d&&f.removed===c?a[a.length-1]={value:this.join(f.value,b),added:d,removed:c}:a.push({value:b,added:d,removed:c})},extractCommon:function(a,b,d,c){for(var f=b.length,h=d.length,j=a.newPos,c=j-c;j+1<f&&c+1<h&&this.equals(b[j+1],d[c+1]);)j++,c++,this.pushComponent(a.components,b[j],void 0,void 0);a.newPos=j;return c},equals:function(a,b){var d=/\S/;return this.ignoreWhitespace&&
!d.test(a)&&!d.test(b)?!0:a==b},join:function(a,b){return a+b},tokenize:function(a){return a}};var d=new h,b=new h(!1);b.tokenize=function(a){return j(a.split(/(\s+|\b)/))};var f=new h(!0);f.tokenize=function(a){return j(a.split(/([{}:;,]|\s+)/))};var a=new h;a.tokenize=function(a){return a.split(/^/m)};return{diffChars:function(a,b){return d.diff(a,b)},diffWords:function(a,d){return b.diff(a,d)},diffLines:function(b,d){return a.diff(b,d)},diffCss:function(a,b){return f.diff(a,b)},createPatch:function(b,
d,f,c,h){var j=[];j.push("Index: "+b);j.push("===================================================================");j.push("--- "+b+"\t"+c);j.push("+++ "+b+"\t"+h);b=a.diff(d,f);b.push({value:"",lines:[]});for(var f=d=0,c=[],k=h=1,o=0;o<b.length;o++){var q=b[o],v=q.lines||q.value.replace(/\n$/,"").split("\n");q.lines=v;if(q.added||q.removed){if(!d){var s=b[o-1],d=h,f=k;s&&(c.push.apply(c,s.lines.slice(-4).map(function(a){return" "+a})),d-=4,f-=4)}c.push.apply(c,v.map(function(a){return(q.added?"+":
"-")+a}));q.added?k+=v.length:h+=v.length}else d&&(v.length<=8&&o<b.length-1?c.push.apply(c,v.map(function(a){return" "+a})):(s=Math.min(v.length,4),j.push("@@ -"+d+","+(h-d+s)+" +"+f+","+(k-f+s)+" @@"),j.push.apply(j,c),j.push.apply(j,v.slice(0,s).map(function(a){return" "+a})),f=d=0,c=[])),h+=v.length,k+=v.length}b.length>1&&!/\n$/.test(b[b.length-2].value)&&j.push("\\ No newline at end of file\n");return j.join("\n")},convertChangesToXML:function(a){for(var b=[],d=0;d<a.length;d++){var c=a[d];
c.added?b.push("<ins>"):c.removed&&b.push("<del>");b.push(k(c.value));c.added?b.push("</ins>"):c.removed&&b.push("</del>")}return b.join("")}}}();if(typeof module!=="undefined")module.exports=JsDiff;typeof define==="function"&&define.amd&&define("jsdiff/diff",[],function(){return JsDiff});
define("orion/compare/jsdiffAdapter",["jsdiff/diff"],function(j){var k=k||{};k.JSDiffAdapter=function(){function h(){}h.prototype={_specialLine:function(d,b,f){return b.value===d&&f!==d},adapt:function(d,b,f){f||(f="\n");for(var a=d.split(f),e=b.split(f),i=a[a.length-1]==="",e=e[e.length-1]==="",g=j.diffLines(d,b),d=[],b=[],c=0,h=0,k=-1,p=0,o=!0,q=f,v=0;v<g.length;v++){var s=g[v],r=s.lines||s.value.split(f),u=r.length,w=0;r.length>1&&r[r.length-1]===""&&u--;u>1&&!o&&r[0]===""&&(u--,w++);s.lines=r;
if(!s.added&&!s.removed){if(!this._specialLine(f,s,q)){if(c||h)d.push([c,h,k]),h=c=0,k=-1,p+=h;d.push([u,u,0]);p+=u}}else if(s.added){k===-1&&(k=b.length+1);c+=u;for(o=w;o<u+w;o++)b.push(s.lines[o])}else h+=u;o=!1;r.length>1&&r[r.length-1]===""&&(o=!0);q=s.value?s.value[s.value.length-1]:f}if(c||h)d.push([c,h,k]),p+=h;p<a.length&&a.length>1&&(f=d[d.length-1],f[2]===0?(f[0]+=1,f[1]+=1):f[2]===-1?d.push([1,1,0]):i===e?d.push([1,1,0]):(e&&(f[0]+=1),i&&(f[1]+=1)));return{mapper:d,changContents:{array:b,
index:0}}},adaptCharDiff:function(d,b,f){for(var d=f?j.diffWords(d,b):j.diffChars(d,b),b=[],a=f=0,e=0,i=0,g=0;g<d.length;g++){var c=d[g];if(!c.added&&!c.removed){if(e>0||i>0)b.push([a,a+e,f,f+i]),a+=e,f+=i,i=e=0;a+=c.value.length;f+=c.value.length}else c.added?e+=c.value.length:i+=c.value.length}(e>0||i>0)&&b.push([a,a+e,f,f+i]);return b}};return h}();return k});
define("orion/compare/diffTreeNavigator",["orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(j,k,h,d){var b={},f,a,e,i,g,c,l,m,p,o,q,v,s,r,u,w;b.DiffTreeNavigator=function(){function b(a,c,d,e,f,g){this._root={type:"root",children:[]};this._initialized=!1;this.initAll(a,c,d,e,f,g)}f="orion.annotation.diff.addedBlock";a="orion.annotation.diff.currentAddedBlock";e="orion.annotation.diff.deletedBlock";i="orion.annotation.diff.currentDeletedBlock";
g="orion.annotation.diff.blockTop";c="orion.annotation.diff.currentBlockTop";l="orion.annotation.diff.blockConflict";m="orion.annotation.diff.currentBlockConflict";p="orion.annotation.diff.addedWord";o="orion.annotation.diff.currentAddedWord";q="orion.annotation.diff.deletedWord";v="orion.annotation.diff.currentDeletedWord";s="orion.annotation.diff.emptyDeletedWordLeft";r="orion.annotation.diff.emptyDeletedWordRight";u="orion.annotation.diff.emptyAddedWordLeft";w="orion.annotation.diff.emptyAddedWordRight";
h.AnnotationType.registerType(f,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}});h.AnnotationType.registerType(a,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}});h.AnnotationType.registerType(e,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}});h.AnnotationType.registerType(i,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}});h.AnnotationType.registerType(g,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}});
h.AnnotationType.registerType(c,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}});h.AnnotationType.registerType(l,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}});h.AnnotationType.registerType(m,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}});h.AnnotationType.registerType(p,{title:"word added",html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}});h.AnnotationType.registerType(o,{title:"",
html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}});h.AnnotationType.registerType(q,{title:"word deleted",html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}});h.AnnotationType.registerType(v,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}});h.AnnotationType.registerType(s,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}});h.AnnotationType.registerType(r,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}});
h.AnnotationType.registerType(u,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}});h.AnnotationType.registerType(w,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});b.prototype={initAll:function(a,b,c,d,e,f,g){this._charOrWordDiff=a?a:"word";if(b)this._initialized=!0;this.editorWrapper=[{editor:b,diffFeeder:d},{editor:c,diffFeeder:e}];this._curveRuler=g;(this._overviewRuler=f)&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(a){if(a)for(var b=
0;b<this.editorWrapper.length;b++)this.editorWrapper[b].diffFeeder.init(this.editorWrapper[b].editor.getTextView().getModel(),a)},destroy:function(){this.initAll(this._charOrWordDiff)},renderAnnotations:function(){var a;for(a=0;a<this.editorWrapper.length;a++){this.editorWrapper[a].annoTypes=[];this.editorWrapper[a].diffFeeder.getBlockAnnoTypes(this.editorWrapper[a].annoTypes);this.editorWrapper[a].diffFeeder.getWordAnnoTypes(this.editorWrapper[a].annoTypes);for(var b=0;b<this.editorWrapper[a].annoTypes.length;b++)this.editorWrapper[a].annoTypes[b].current&&
this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].current),this.editorWrapper[a].annoTypes[b].normal&&this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].normal)}this._root.children=[];b=this.editorWrapper[0].diffFeeder.getDiffBlocks();if(!b||b.length===0)this.replaceAllAnnotations(!0,0,"block",!1,[]),this.replaceAllAnnotations(!0,1,"block",!1,[]),this.replaceAllAnnotations(!0,0,"word",!1,[]),
this.replaceAllAnnotations(!0,1,"word",!1,[]),this.replaceAllAnnotations(!0,0,"block",!0,[]),this.replaceAllAnnotations(!0,1,"block",!0,[]),this.replaceAllAnnotations(!0,0,"word",!0,[]),this.replaceAllAnnotations(!0,1,"word",!0,[]);else{var c=new d.JSDiffAdapter;for(a=0;a<b.length;a++){var e=this.generatePairBlockAnnotations(this._root,a);this._root.children.push(e);var f=this.generatePairWordAnnotations(e,a,c);if(f)e.children=f}this.replaceAllAnnotations(!1,0,"block",!0);this.replaceAllAnnotations(!1,
1,"block",!0);this.replaceAllAnnotations(!1,0,"word",!0);this.replaceAllAnnotations(!1,1,"word",!0);this.iterator=new j.TreeModelIterator(this._root.children)}},replaceAllAnnotations:function(a,b,c,d,e){if(this.editorWrapper[b].annoTypes)for(var f=0;f<this.editorWrapper[b].annoTypes.length;f++)this.editorWrapper[b].annoTypes[f].type===c&&this.replaceDiffAnnotations(this.editorWrapper[b].editor,e?e:this.editorWrapper[b].annoTypes[f].list,d?this.editorWrapper[b].annoTypes[f].normal:this.editorWrapper[b].annoTypes[f].current,
a)},getMapper:function(){return this.editorWrapper[0].diffFeeder.getMapper()},getFeeder:function(a){return a?this.editorWrapper[1].diffFeeder:this.editorWrapper[0].diffFeeder},iterateOnBlock:function(a,b){this.iterator&&(this.iterator.iterateOnTop(a,b),this.updateCurrentAnnotation(!0))},iterateOnChange:function(a){if(!this.iterator)return null;var b=this.iterator.iterate(a);if(b){var c=this.iterator.cursor();c.type==="block"&&c.children&&c.children.length>0&&this.iterator.iterate(a);this.updateCurrentAnnotation(!0)}return b},
gotoBlock:function(a,b){if(this.iterator){if(a<0||a>=this._root.children.length||this._root.children.length===0)a=0;b!==void 0&&b>=0&&this._root.children[a].children&&b<this._root.children[a].children.length?this.iterator.setCursor(this._root.children[a].children[b]):this.iterator.setCursor(this._root.children[a]);this.updateCurrentAnnotation(!1);this._positionDiffBlock()}},_hitDiffAnnotation:function(a,b,c){if(c===this.editorWrapper[a].editor.getTextView()){for(var d=0;d<this._root.children.length;d++){var c=
this._root.children[d],e=a===0?c.oldA:c.newA;if(b>=e.start&&b<=e.end){d=c;if(c.children&&c.children.length>0)for(e=0;e<c.children.length;e++){var f=c.children[e],g=a===0?f.oldA:f.newA;if(b>=g.start&&b<=g.end){d=f;break}}return d}}return null}},gotoChange:function(a,b){for(var c=0;c<this.editorWrapper.length;c++){var d=this._hitDiffAnnotation(c,a,b);if(d)return this.iterator.setCursor(d),this.updateCurrentAnnotation(!1,b),!0}return!1},getCurrentBlockIndex:function(){if(!this.iterator)return-1;var a=
this.iterator.cursor();return!a?-1:a.type==="block"?a.index:a.parent.index},getCurrentPosition:function(){if(!this.iterator)return{};var a=this.iterator.cursor();return a.type==="block"?{block:a.index+1}:{block:a.parent.index+1,change:a.index+1}},getCurrentMapperIndex:function(){var a=this.getCurrentBlockIndex();a<0&&(a=0);var b=this.getFeeder().getDiffBlocks();if(!b||b.length===0)return-1;a>b.length-1&&(a=0);return b[a][1]},replaceDiffAnnotations:function(a,b,c,d){if(b&&c&&(a=a.getAnnotationModel())){for(var e=
a.getAnnotations(),f=[];d&&e.hasNext();){var g=e.next();g.type===c&&f.push(g)}a.replaceAnnotations(f,b)}},updateCurrentAnnotation:function(a,b){this.replaceAllAnnotations(!0,0,"block",!1,[]);this.replaceAllAnnotations(!0,1,"block",!1,[]);this.replaceAllAnnotations(!0,0,"word",!1,[]);this.replaceAllAnnotations(!0,1,"word",!1,[]);if(this.iterator){var c=this.iterator.cursor();if(c){var d,e,f={start:c.oldA.start,end:c.oldA.end},g={start:c.newA.start,end:c.newA.end};c.type==="word"?(d=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(f,
this.editorWrapper[0].editor.getTextView().getModel()),e=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(g,this.editorWrapper[1].editor.getTextView().getModel())):(d=this.editorWrapper[0].diffFeeder.getCurrentBlockAnnoType(c.index),e=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(c.index));d&&this.replaceDiffAnnotations(this.editorWrapper[0].editor,[new (h.AnnotationType.getType(d.current))(f.start,f.end)],d,!0);e&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new (h.AnnotationType.getType(e.current))(g.start,
g.end)],e,!0);if(a)this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(c.oldA.start,c.oldA.end,!0),this.editorWrapper[1].editor.setSelection(c.newA.start,c.newA.end,!0),this.autoSelecting=!1;else if(b)this.autoSelecting=!0,b!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(c.oldA.start,c.oldA.end,!0),b!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(c.newA.start,c.newA.end,!0),this.autoSelecting=!1}}},generatePairBlockAnnotations:function(a,
b){var c=this.generateBlockDiffAnnotations(0,b),d=this.generateBlockDiffAnnotations(1,b);return{parent:a,index:b,type:"block",oldA:c,newA:d}},generatePairWordAnnotations:function(a,b,c){var d=this.editorWrapper[0].diffFeeder.getTextOnBlock(b),e=this.editorWrapper[1].diffFeeder.getTextOnBlock(b),b=null,f=0,g=0;if(d&&e&&d.text&&e.text&&d.text.length<=5E3&&e.text.length<=5E3)b=c.adaptCharDiff(d.text,e.text,this._charOrWordDiff==="word"),g=e.start,f=d.start;else return null;c=[];d=[];this.generateWordDiffAnnotations(0,
c,f,b,2,3);this.generateWordDiffAnnotations(1,d,g,b,0,1);b=[];for(f=0;f<c.length;f++)b.push({parent:a,index:f,type:"word",oldA:c[f],newA:d[f]});return b},getAnnoModelList:function(a,b,c){for(var d=0;d<this.editorWrapper[a].annoTypes.length;d++)if(this.editorWrapper[a].annoTypes[d].type===b&&this.editorWrapper[a].annoTypes[d].normal===c)return this.editorWrapper[a].annoTypes[d].list;return null},generateBlockDiffAnnotations:function(a,b){var c=this.editorWrapper[a].diffFeeder.getCurrentBlockAnnoType(b),
d=this.getAnnoModelList(a,"block",c.normal),e=this.editorWrapper[a].diffFeeder.getCharRange(b),c=h.AnnotationType.createAnnotation(c.normal,e.start,e.end);d&&d.push(c);return c},generateWordDiffAnnotations:function(a,b,c,d,e,f){if(d)for(var g=this.editorWrapper[a].diffFeeder.getCurrentWordAnnoType({start:-1,end:-1}),a=this.getAnnoModelList(a,"word",g.normal),i=0;i<d.length;i++){var j=h.AnnotationType.createAnnotation(g.normal,d[i][e]+c,d[i][f]+c);a.push(j);b.push(j)}},_updateOverviewRuler:function(){if(this._overviewRuler){var a=
this.editorWrapper[0].editor.getTextView().getTopIndex();this.editorWrapper[0].editor.getTextView().redrawLines(a,a+1,this._overviewRuler)}},_updateCurveRuler:function(){this._curveRuler&&this._curveRuler.render()},_setTextViewPosition:function(a,b){var c=a.getLineHeight(),d=a.getClientArea(),c=Math.floor(d.height/c/3);a.setTopIndex(b-c>0?b-c:0)},_positionDiffBlock:function(){var a=this.getCurrentBlockIndex();a<0&&(a=0);var b=this.getFeeder().getDiffBlocks();b.length!==0&&(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),
b[a][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor&&(a=k.lookUpLineIndex(this.getMapper(),0,b[a][1]),this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),a)),this._updateOverviewRuler(),this._updateCurveRuler())},matchPositionFromOverview:function(a){this._initialized&&this.gotoBlock(a<0?0:k.getAnnotationIndex(this.getFeeder().getDiffBlocks(),a))},gotoDiff:function(a,b){this.gotoChange(a,b)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,
!0);this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0);this._positionDiffBlock()},nextChange:function(){var a=this.iterateOnChange(!0);this._positionDiffBlock();return a},prevChange:function(){this.iterateOnChange(!1);this._positionDiffBlock()}};return b}();b.DiffBlockFeeder=function(){function a(){}a.prototype={_isAddedSide:function(){return this._mapperColumnIndex===0},getWordAnnoTypes:function(a){this._isAddedSide()?a.push({type:"word",current:o,normal:p,list:[]}):a.push({type:"word",
current:v,normal:q,list:[]});a.push({type:"word",current:s});a.push({type:"word",current:r});a.push({type:"word",current:u});a.push({type:"word",current:w})},getCurrentWordAnnoType:function(a,b){return a.start===a.end&&b?this._isAddedSide()?{current:this._repositionEmptyWord(a,b),normal:p}:{current:this._repositionEmptyWord(a,b),normal:q}:this._isAddedSide()?{current:o,normal:p}:{current:v,normal:q}},_repositionEmptyWord:function(a,b){var c=b.getLineAtOffset(a.start),d=b.getLineStart(c),e=b.getLineEnd(c);
if(d!==e){if(a.start===e)return a.start--,this._isAddedSide()?w:r;a.end++}else if(c>0&&(c--,d=b.getLineStart(c),e=b.getLineEnd(c),d!==e))return a.start=e-1,a.end=e,this._isAddedSide()?w:r;return this._isAddedSide()?u:s},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return-1;a=this._diffBlocks[a][1];return a===-1?0:this._mapper[a][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},
getLineNumber:function(a){return a},getCharRange:function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return null;var b=this._diffBlocks[a][0],c=b+this._mapper[this._diffBlocks[a][1]][this._mapperColumnIndex]-1,a=this._textModel.getLineStart(b);if(c<b)return{start:a,end:a};b=this._textModel.getLineEnd(c,!0);return{start:a,end:b}},getTextOnBlock:function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return null;a=this.getCharRange(a);return{start:a.start,text:this._textModel.getText(a.start,
a.end)}},isMapperEmpty:function(){return this._mapper.length===0}};return a}();b.TwoWayDiffBlockFeeder=function(){function d(a,b,c,e){this._mapperColumnIndex=c;this._reverseAnnotation=e;this.init(a,b)}d.prototype=new b.DiffBlockFeeder;d.prototype._isAddedSide=function(){return this._reverseAnnotation?this._mapperColumnIndex!==0:this._mapperColumnIndex===0};d.prototype.init=function(a,b){this._textModel=a;this._diffBlocks=void 0;if(b){this._mapper=b;this._diffBlocks=[];for(var c=0,d=0;d<this._mapper.length;d++)this._mapper[d][2]!==
0&&this._diffBlocks.push([c,d]),c+=this._mapper[d][this._mapperColumnIndex]}};d.prototype.getBlockAnnoTypes=function(b){this._isAddedSide()?b.push({type:"block",normal:f,current:a,list:[]}):b.push({type:"block",normal:e,current:i,list:[]});b.push({type:"block",normal:g,current:c,list:[]});b.push({type:"block",normal:l,current:m,list:[]})};d.prototype.getCurrentBlockAnnoType=function(b){if(!this._diffBlocks||this._diffBlocks.length===0||this._diffBlocks.length<=b)return null;b=this._diffBlocks[b][1];
if(this._mapper[b][this._mapperColumnIndex]===0)return{normal:g,current:c};else if(k.isMapperConflict(this.getMapper(),b))return{normal:l,current:m};else if(this._isAddedSide())return{type:"block",normal:f,current:a,list:[]};return{type:"block",normal:e,current:i,list:[]}};return d}();b.inlineDiffBlockFeeder=function(){function c(a,b){this._mapperColumnIndex=b;this.init(a)}c.prototype=new b.DiffBlockFeeder;c.prototype.setModel=function(a){this._textModel=a};c.prototype.init=function(a){this._diffBlocks=
void 0;if(a){this._mapper=a;this._diffBlocks=[];this._gapBlocks=[];for(var b=a=0,c=0;c<this._mapper.length;c++){if(this._mapper[c][2]!==0){if(this._isAddedSide()){var d=a+this._mapper[c][1];this._diffBlocks.push([d,c]);this._gapBlocks.push([d,d+this._mapper[c][0],b])}else this._diffBlocks.push([a,c]),this._gapBlocks.push([a,a+this._mapper[c][1],b]);a+=this._mapper[c][0]+this._mapper[c][1]}else this._gapBlocks.push([a,a+this._mapper[c][this._mapperColumnIndex],b]),a+=this._mapper[c][this._mapperColumnIndex];
b+=this._mapper[c][this._mapperColumnIndex]}}};c.prototype.getBlockAnnoTypes=function(b){this._isAddedSide()?b.push({type:"block",normal:f,current:a,list:[]}):b.push({type:"block",normal:e,current:i,list:[]});b.push({type:"block",normal:l,current:m,list:[]})};c.prototype.getCurrentBlockAnnoType=function(b){if(!this._diffBlocks||this._diffBlocks.length===0)return null;b=this._diffBlocks[b][1];if(this._mapper[b][this._mapperColumnIndex]===0)return{current:o,normal:p};else if(k.isMapperConflict(this.getMapper(),
b))return{normal:l,current:m};else if(this._isAddedSide())return{type:"block",normal:f,current:a,list:[]};return{type:"block",normal:e,current:i,list:[]}};c.prototype.getDiffBlockH=function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return-1;a=this._diffBlocks[a][1];return this._mapper[a][0]+this._mapper[a][1]};c.prototype.getLineNumber=function(a){for(var b=0;b<this._gapBlocks.length;b++)if(this._gapBlocks[b][0]!==this._gapBlocks[b][1]&&a>=this._gapBlocks[b][0]&&a<this._gapBlocks[b][1])return a-
this._gapBlocks[b][0]+this._gapBlocks[b][2];return-1};return c}();return b});
define("orion/compare/compareView","i18n!orion/compare/nls/messages,orion/Deferred,orion/webui/littlelib,orion/compare/diffParser,orion/compare/compareRulers,orion/editor/editor,orion/editor/editorFeatures,orion/keyBinding,orion/editor/textView,orion/compare/compareUIFactory,orion/compare/compareUtils,orion/compare/jsdiffAdapter,orion/compare/diffTreeNavigator".split(","),function(j,k,h,d,b,f,a,e,i,g,c,l,m){var p={};p.CompareView=function(){function a(){this._diffParser=new d.DiffParser}a.prototype=
{_clearOptions:function(){this.options={};this.options.blockNumber=1;this.options.changeNumber=0},_getLineDelim:function(){return"\n"},_generateMapper:function(a,b,c,d,e){var f=this._getLineDelim(a,c);this._diffParser.setLineDelim(f);if(this.options.mapper&&this.options.toggler)return{delim:f,mapper:this.options.mapper,output:this.options.newFile.Content,diffArray:this.options.diffArray};if(typeof b==="string"&&typeof a==="string"){a=(new l.JSDiffAdapter).adapt(a,b,f);if(this.options.toggler)this.options.mapper=
a.mapper,this.options.newFile.Content=b,this.options.diffArray=a.changContents;return{delim:f,mapper:a.mapper,output:b,diffArray:a.changContents}}else{b=this._diffParser.parse(a,c,d,e);a=this._diffParser.getDiffArray();if(this.options.toggler)this.options.mapper=b.mapper,this.options.newFile.Content=b.outPutFile,this.options.diffArray=a;return{delim:f,mapper:b.mapper,output:b.outPutFile,diffArray:a}}},_loadImageFile:function(a,b,c){var d=document.createElement("img");d.src=a;var e=new k;d.onload=
function(){b.appendChild(d);if(c){var a=document.createElement("hr");b.appendChild(a)}e.resolve(d.height)};d.onerror=function(){e.resolve(0)};return e},_initSyntaxHighlighter:function(a){this._syntaxHighlighters=null;if(this.options.highlighters&&this.options.highlighters.length>0&&!(a.length<1||a.length>2))this._syntaxHighlighters=[{highlighter:this.options.highlighters[0],target:a[0]}],a.length===2&&this.options.highlighters.length===2&&this._syntaxHighlighters.push({highlighter:this.options.highlighters[1],
target:a[1]})},_highlightSyntax:function(){if(this._syntaxHighlighters){var a=[];this._syntaxHighlighters.forEach(function(b){a.push(b.highlighter.highlight(b.target.fileName,b.target.contentType,b.target.editor))}.bind(this));k.all(a,function(a){return{_error:a}}).then(function(){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)}.bind(this))}else window.setTimeout(function(){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-
1,this.options.changeNumber-1)}.bind(this),50)},setOptions:function(a,b){b&&this._clearOptions();if(!this.options)this.options={};a&&Object.keys(a).forEach(function(b){this.options[b]=a[b]}.bind(this));if(a.newFileOnRight){var c=this.options.newFile;this.options.newFile=this.options.oldFile;this.options.oldFile=c}},getOptions:function(){return this.options},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},initDiffNav:function(){this._diffNavigator.gotoBlock(0,0)},nextDiff:function(){this._diffNavigator.nextDiff()},
prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){return this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},getWidget:function(){return this},startup:function(){this.initEditors();this.refresh(!0)},initEditors:function(){},initImageMode:function(){}};return a}();p.TwoWayCompareView=function(){function c(a){this.setOptions(a,!0);this._diffNavigator=new m.DiffTreeNavigator("word");this.type="twoWay";this._uiFactory=this.options.uiFactory;
if(!this._uiFactory)this._uiFactory=new g.TwoWayCompareUIFactory({parentDivID:this.options.parentDivId,showTitle:this.options.showTitle?this.options.showTitle:!1,showLineStatus:this.options.showLineStatus?this.options.showLineStatus:!1}),this._uiFactory.buildUI();this._viewLoadedCounter=0;this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._curveRuler=new b.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv())}c.prototype=new p.CompareView;c.prototype.initEditors=function(a){this._editors=
[];this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!1),this._uiFactory.getStatusDiv(!1),this.options.oldFile));this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!0),this._uiFactory.getStatusDiv(!0),this.options.newFile,!0));this._overviewRuler=new b.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));window.onbeforeunload=function(){if(this._editors&&this._editors.some(function(a){return a.isDirty()}))return j["There are unsaved changes."]}.bind(this)};
c.prototype.initImageMode=function(){if(this._editors)this._editors.forEach(function(a){a.destroy()}),this._editors=null;this._uiFactory.getEditorParentDiv(!0).classList.add("compareEditorParentImageMode");this._uiFactory.getEditorParentDiv().classList.add("compareEditorParentImageMode");this._uiFactory.disableTitle();this._uiFactory.disableLineStatus();this._imageMode=!0};c.prototype.getImageMode=function(){return this._imageMode};c.prototype.getEditors=function(){return this._editors};c.prototype.gotoDiff=
function(a,b,c){c=c?this._editors[1].getTextView():this._editors[0].getTextView();this._diffNavigator.gotoDiff(c.getModel().getLineStart(a)+b,c)};c.prototype.copyToLeft=function(){this._curveRuler.copyTo(!0)};c.prototype.copyToRight=function(){this._curveRuler.copyTo(!1)};c.prototype.resizeEditors=function(){this._editors.forEach(function(a){a.getTextView().resize()})};c.prototype.getSplitter=function(){return this._uiFactory.getSplitter()};c.prototype._createEditor=function(b,c,d,e,g){var h=typeof e.readonly===
"undefined"?!0:e.readonly,k=function(){var a=new i.TextView({parent:c,readonly:h,tabSize:4});this._viewLoadedCounter++;this._viewLoadedCounter===2&&this._diffNavigator.matchPositionFromOverview(-1);if(this.onLoad)this.onLoad();var b=this.getSplitter();b&&b.addResizeListener(function(b){if(b){var c=!1;(c=this._uiFactory.isLeftPane(b)?g:!g)&&a.resize()}}.bind(this));return a}.bind(this),l=e.keyBindingFactory;l||(l=new a.KeyBindingsFactory);var m=null;if(d)var z="",m=function(a,b){if(d)z=b?j["ERROR: "]+
a:a,d.textContent=""+z};k=new f.Editor({textViewFactory:k,undoStackFactory:new a.UndoFactory,annotationFactory:new a.AnnotationFactory,keyBindingFactory:l,statusReporter:m,domNode:c});k.installTextView();k.setInput(null,null,e.Content?e.Content:b);k.setOverviewRulerVisible(!1);var o=k.getTextView();o.addEventListener("Selection",function(a){a.newValue&&a.newValue.start!==a.newValue.end||!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&this._diffNavigator.gotoDiff(o.getCaretOffset(),
o)}.bind(this));o.getModel().addEventListener("Changed",function(a){if(!this._curveRuler.onChanged(a,!g))this.options.mapper=null}.bind(this));g?o.addEventListener("Scroll",function(){this._curveRuler&&(this._curveRuler.matchPositionFrom(!0),this._curveRuler.render());if(this.onScroll)this.onScroll()}.bind(this)):o.addEventListener("Scroll",function(){this._curveRuler&&this._curveRuler.render()}.bind(this));return k};c.prototype.destroy=function(){this._editors&&(this._diffNavigator.destroy(),this._editors.forEach(function(a){a.destroy()}),
this._uiFactory.destroy())};c.prototype.addRulers=function(){if(this._editors&&!this._hasRuler){var a=new b.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),c=new b.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._editors[1].getTextView().addRuler(a);this._editors[0].getTextView().addRuler(c);this._editors[0].getTextView().addRuler(this._overviewRuler);
this._hasRuler=!0}};c.prototype.refresh=function(a){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var b=this;return this._loadImageFile(this.options.newFile.URL,this._uiFactory.getEditorParentDiv(!0)).then(function(a){return b._loadImageFile(b.options.oldFile.URL,b._uiFactory.getEditorParentDiv()).then(function(b){return(new k).resolve(a>b?a:b)})})}var c=this.options.oldFile.Content,d=this.options.newFile.Content,e=this.options.diffContent;typeof d===
"string"?e=this._generateMapper(c,d,e,this.options.hasConflicts):(e=this._generateMapper(c,d,e,this.options.hasConflicts),d=e.output);var f=new m.TwoWayDiffBlockFeeder(this._editors[0].getTextView().getModel(),e.mapper,1,this.options.newFileOnRight),g=new m.TwoWayDiffBlockFeeder(this._editors[1].getTextView().getModel(),e.mapper,0,this.options.newFileOnRight);this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editors[0],this._editors[1],f,g,this._overviewRuler,this._curveRuler);
this._curveRuler.init(e.mapper,this._editors[1],this._editors[0],this._diffNavigator);a&&(this._editors[1].setInput(this.options.newFile.Name,null,d),this._editors[0].setInput(this.options.oldFile.Name,null,c));this._initSyntaxHighlighter([{fileName:this.options.newFile.Name,contentType:this.options.newFile.Type,editor:this._editors[1]},{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editors[0]}]);this._highlightSyntax();this.options.commandProvider&&this.options.commandProvider.renderCommands(this);
this.addRulers();this._viewLoadedCounter===2&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);this.refreshTitle(0);this.refreshTitle(1);a=this._editors[1].getTextView().getModel().getLineCount()*this._editors[1].getTextView().getLineHeight()+5;c=this._editors[0].getTextView().getModel().getLineCount()*this._editors[0].getTextView().getLineHeight()+5;return a>c?a:c};c.prototype.refreshTitle=function(a,b){if(a===1){var c=this._uiFactory.getTitleDiv(!0);c&&(h.empty(c),
c.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.newFile.Name+"*":this.options.newFile.Name)))}else if(c=this._uiFactory.getTitleDiv(!1))h.empty(c),c.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.oldFile.Name+"*":this.options.oldFile.Name))};return c}();p.InlineCompareView=function(){function d(a){this.setOptions(a,!0);this._diffNavigator=new m.DiffTreeNavigator("word");this.type="inline";this.options.commandProvider&&this.options.commandProvider.initCommands(this);
this._editorDiv=this.options.parentDivId}d.prototype=new p.CompareView;d.prototype.addRulers=function(){if(this._textView&&!this._hasRuler)this._textView.addRuler(this._rulerOrigin),this._textView.addRuler(this._rulerNew),this._textView.addRuler(this._overviewRuler),this._hasRuler=!0};d.prototype.removeRulers=function(){if(this._textView&&this._hasRuler)this._textView.removeRuler(this._rulerOrigin),this._textView.removeRuler(this._rulerNew),this._textView.removeRuler(this._overviewRuler),this._hasRuler=
!1};d.prototype.destroyEditor=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.setText(""),this.removeRulers())};d.prototype.destroy=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.destroy())};d.prototype.initEditors=function(c){var d=h.node(this._editorDiv),e=function(){return new i.TextView({parent:d,readonly:!0,tabSize:4})}.bind(this);this._editor=new f.Editor({textViewFactory:e,undoStackFactory:new a.UndoFactory,annotationFactory:new a.AnnotationFactory,
domNode:d});this._editor.installTextView();this._editor.setInput(null,null,c);this._editor.setOverviewRulerVisible(!1);this._editor.setAnnotationRulerVisible(!1);this._textView=this._editor.getTextView();this._rulerOrigin=new b.LineNumberCompareRuler(this._diffNavigator,1,"left",{styleClass:"ruler lines inlineRulerLeft"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._rulerNew=new b.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},
{styleClass:"rulerLines even"});this._overviewRuler=new b.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));this._textView.addEventListener("Selection",function(a){a.newValue&&a.newValue.start!==a.newValue.end||!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&this._diffNavigator.gotoDiff(this._textView.getCaretOffset(),this._textView)}.bind(this))};d.prototype.initImageMode=
function(){if(this._editor)this._editor.destroy(),this._editor=null;h.node(this._editorDiv).classList.add("compareEditorParentImageMode");this._imageMode=!0};d.prototype.getImageMode=function(){return this._imageMode};d.prototype._initDiffPosition=function(a){var b=a.getModel();if(b&&b.getAnnotations&&(b=b.getAnnotations(),b.length>0)){var b=b[0][0],c=a.getLineHeight(),d=a.getClientArea(),c=Math.floor(d.height/c/3);a.setTopIndex(b-c>0?b-c:0)}};d.prototype.refresh=function(){if(this._imageMode){this.options.commandProvider&&
this.options.commandProvider.renderCommands(this);var a=this;return this._loadImageFile(this.options.newFile.URL,h.node(this._editorDiv),!0).then(function(b){return a._loadImageFile(a.options.oldFile.URL,h.node(a._editorDiv)).then(function(a){return(new k).resolve(b+a+20)})})}var b=this.options.oldFile.Content,d=this.options.newFile.Content,e=this._generateMapper(b,d,this.options.diffContent,this.options.hasConflicts,!this.options.toggler);if(typeof d!=="string")d=e.output;this._textView.getModel().setText(b);
b=new m.inlineDiffBlockFeeder(e.mapper,1);d=new m.inlineDiffBlockFeeder(e.mapper,0);c.mergeDiffBlocks(this._textView.getModel(),d.getDiffBlocks(),e.mapper,e.diffArray.array,e.diffArray.index,this._diffParser._lineDelimiter);b.setModel(this._textView.getModel());d.setModel(this._textView.getModel());this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editor,this._editor,b,d,this._overviewRuler);this._initSyntaxHighlighter([{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,
editor:this._editor}]);this._highlightSyntax();this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();e=this._textView.getTopIndex();this._textView.redrawLines(e,e+1,this._overviewRuler);this._textView.redrawLines(e,e+1,this._rulerOrigin);this._textView.redrawLines(e,e+1,this._rulerNew);this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);return this._textView.getLineHeight()*this._textView.getModel().getLineCount()+5};d.prototype.setConflicting=
function(a){this._conflcit=a};return d}();p.toggleableCompareView=function(){function a(b,c){if(c)c.toggler=this;this._widget=b==="inline"?new p.InlineCompareView(c):new p.TwoWayCompareView(c)}a.prototype={startup:function(){this._widget.startup()},initImageMode:function(){this._imageMode=!0;this._widget.initImageMode()},toggle:function(){var a=this._widget.options;if(!this._imageMode){var b=this._widget.getCurrentDiffPos();a.blockNumber=b.block;a.changeNumber=b.change}this._widget.destroy();h.empty(h.node(a.parentDivId));
this._widget=this._widget.type==="inline"?new p.TwoWayCompareView(a):new p.InlineCompareView(a);this._imageMode?this._widget.initImageMode():this._widget.initEditors();this._widget.refresh(!0)},getWidget:function(){return this._widget}};return a}();return p});
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(j){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(","),j=j.grammars;j.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:j[j.length-1].id,grammars:j,keywords:k}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(j){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(","),j=j.grammars;j.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:j[j.length-1].id,grammars:j,keywords:k}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(j){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(","),j=
j.grammars;j.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:j[j.length-1].id,grammars:j,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(j,k,h,d){function b(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function f(){b.call(this,null,!0)}function a(a){b.call(this,null,a)}function e(){b.call(this,null,!1)}function i(d,i,h){this.commentStart="/*";this.commentEnd="*/";var j=[];switch(i){case "java":j=c;break;
case "js":j=g;break;case "css":j=l}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new b(j,this.whitespacesVisible);this._firstScanner=new e;this._commentScanner=new a(this.whitespacesVisible);this._whitespaceScanner=new f;if(i==="css")this._scanner.isCSS=!0,this._firstScanner.isCSS=!0;this.view=d;this.annotationModel=h;this._bracketAnnotations=void 0;var k=this;this._listener=
{onChanged:function(a){k._onModelChanged(a)},onDestroy:function(a){k._onDestroy(a)},onLineStyle:function(a){k._onLineStyle(a)},onMouseDown:function(a){k._onMouseDown(a)},onSelection:function(a){k._onSelection(a)}};i=d.getModel();i.getBaseModel&&(i=i.getBaseModel());i.addEventListener("Changed",this._listener.onChanged);d.addEventListener("MouseDown",this._listener.onMouseDown);d.addEventListener("Selection",this._listener.onSelection);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();d.redrawLines()}var g=k.keywords,c=h.keywords,l=d.keywords,m={styleClass:"comment"},p={styleClass:"comment"},o={styleClass:"comment block documentation"},q={styleClass:"keyword other documentation markup"},v={styleClass:"keyword other documentation task"},s={styleClass:"keyword other documentation tag"},r={styleClass:"string"},u={styleClass:"constant numeric"},w={styleClass:"keyword"},n={styleClass:"punctuation separator space",
unmergeable:!0},t={styleClass:"punctuation separator tab",unmergeable:!0},y={styleClass:"meta annotation currentLine"};b.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 b(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}}};a.prototype=new b(null);a.prototype.setType=function(a){this._type=a};a.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}}};e.prototype=new b(null);e.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};i.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(j.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var g=e[f];(g=this._createFoldingAnnotation(a,d,g.start,g.end))&&c.push(g)}b.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c),b=b.getLineAtOffset(d);return e===b?null:new (j.AnnotationType.getType(j.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 g=d.getAnnotations(b,c),e=[],i=j.AnnotationType.ANNOTATION_TASK;g.hasNext();){var h=g.next();h.type===i&&e.push(h)}g=[];h=this._commentScanner;h.setText(f.getText(b,c));for(var k;k=h.nextToken();){var l=h.getStartOffset()+b;k===14&&(k=f.getLineEnd(f.getLineAtOffset(l)),a!==6&&(k=Math.min(k,c-this.commentEnd.length)),g.push(j.AnnotationType.createAnnotation(i,l,k,f.getText(l,k))))}d.replaceAnnotations(e,
g)}}},_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,g=this.comments,i=this._binarySearch(g,c,!0);i<g.length;i++){if(g[i].start>=d)break;var h=g[i].start,j=g[i].end;f<h&&this._parse(b.substring(f-c,h-c),f,e);var k=g[i].type,l;switch(k){case 8:l=o;break;case 7:l=p;break;case 5:l=
r}f=Math.max(f,h);h=Math.min(d,j);(k===8||k===7)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,h-c),f,e,l,k):k===5&&this.whitespacesVisible?this._parseString(b.substring(f-c,h-c),f,e,r):e.push({start:f,end:h,style:l});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=u;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(d.getData(),e,c,r);continue}else f=r;break;case 8:this._parseComment(d.getData(),e,c,o,a);continue;case 6:this._parseComment(d.getData(),e,c,m,a);continue;case 7:this._parseComment(d.getData(),e,c,p,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=t);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=n)}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,g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=t);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=n);break;case 12:g=q;break;case 13:g=s;break;case 14:g=v;break;default:this.detectHyperlinks&&(g=this._detectHyperlinks(f.getData(),e,c,g))}g&&c.push({start:e,end:f.getOffset()+b,style:g})}},_parseString:function(a,b,c,d){var e=
this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=t);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=n)}g&&c.push({start:f,end:e.getOffset()+b,style:g})}},_detectHyperlinks:function(a,b,c,d){var e=null,f;if((f=a.indexOf("://"))>0){for(var e=a,g=f;g>0;){f=e.charCodeAt(g-1);if(!(97<=f&&f<=122||65<=f&&f<=90||45===f||48<=f&&f<=57))break;g--}if(g>0&&(f="\"\"''(){}[]<>".indexOf(e.substring(g-
1,g)),f!==-1&&(f&1)===0&&(f=e.lastIndexOf("\"\"''(){}[]<>".substring(f+1,f+2)))!==-1)){var i=f;f=this._clone(d);f.tagName="a";f.attributes={href:e.substring(g,i)};c.push({start:b,end:b+g,style:d});c.push({start:b+g,end:b+i,style:f});c.push({start:b+i,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 g=a.getLineAtOffset(b),c=a.getLine(g),i=a.getLineStart(g),h=a.getLineEnd(g),c=this._findBrackets(d,f,c,i,i,h),h=0;h<c.length;h++)if(i=c[h]>=0?1:-1,c[h]*i-1===b){var j=1;if(e&1){for(h--;h>=0;h--)if(i=c[h]>=0?1:-1,j+=i,j===0)return c[h]*i-1;for(g-=1;g>=0;){c=a.getLine(g);i=a.getLineStart(g);h=a.getLineEnd(g);c=this._findBrackets(d,f,c,i,i,h);for(e=c.length-1;e>=0;e--)if(i=c[e]>=0?1:-1,j+=i,j===0)return c[e]*i-1;g--}}else{for(h++;h<c.length;h++)if(i=c[h]>=0?1:-1,j+=i,j===0)return c[h]*
i-1;g+=1;for(e=a.getLineCount();g<e;){c=a.getLine(g);i=a.getLineStart(g);h=a.getLineEnd(g);c=this._findBrackets(d,f,c,i,i,h);for(h=0;h<c.length;h++)if(i=c[h]>=0?1:-1,j+=i,j===0)return c[h]*i-1;g++}}break}return-1},_findBrackets:function(a,b,c,d,e,f){for(var g=[],a=a.charCodeAt(0),b=b.charCodeAt(0),i=e,h=this._scanner,j,k=this.comments,l=this._binarySearch(k,e,!0);l<k.length;l++){if(k[l].start>=f)break;j=k[l].start;var n=k[l].end;if(i<j)for(h.setText(c.substring(i-e,j-e));j=h.nextToken();)j===a?g.push(h.getStartOffset()+
i-e+d+1):j===b&&g.push(-(h.getStartOffset()+i-e+d+1));i=n}if(i<f)for(h.setText(c.substring(i-e,f-e));j=h.nextToken();)j===a?g.push(h.getStartOffset()+i-e+d+1):j===b&&g.push(-(h.getStartOffset()+i-e+d+1));return g},_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 g=c.start===c.end,b=b.start===b.end;f===e&&b&&g||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&g&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,i,h;if(c.start===c.end&&(h=d.getCaretOffset())>0)h-=1,a.getBaseModel&&(h=a.mapOffset(h),a=a.getBaseModel()),a=this._findMatchingBracket(a,h),a!==-1&&(i=[j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_CURRENT_BRACKET,
h,h+1)]);this._bracketAnnotations=i;this.annotationModel.replaceAnnotations(b,i)}},_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,g=f.getCharCount(),i=this.comments.length,h=f.getLineStart(f.getLineAtOffset(b)),k=this._binarySearch(this.comments,h,!0),l=this._binarySearch(this.comments,c,!1,k-1,i);k<i&&this.comments[k].start<=h&&h<this.comments[k].end?(h=this.comments[k].start,h>b&&(h+=d)):h=k===i&&i>0&&g-d===this.comments[i-1].end?this.comments[i-1].start:h;var n;l<i?(n=this.comments[l].end,n>b&&(n+=d),l+=1):(l=i,n=g);for(var m,g=this._findComments(f.getText(h,n),h),
i=k;i<this.comments.length;i++)m=this.comments[i],m.start>b&&(m.start+=d),m.start>b&&(m.end+=d);var u=l-k!==g.length;if(!u)for(i=0;i<g.length;i++){m=this.comments[k+i];var o=g[i];if(m.start!==o.start||m.end!==o.end||m.type!==o.type){u=!0;break}}i=[k,l-k].concat(g);Array.prototype.splice.apply(this.comments,i);u&&(i=h,m=n,a!==f&&(i=a.mapOffset(i,!0),m=a.mapOffset(m,!0)),e.redrawRange(i,m));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=this.annotationModel;k=e.getAnnotations(h,n);h=[];for(n=
[];k.hasNext();)if(m=k.next(),m.type===j.AnnotationType.ANNOTATION_FOLDING){n.push(m);for(i=0;i<g.length;i++)if(m.start===g[i].start&&m.end===g[i].end)break;i===g.length?(h.push(m),m.expand()):(i=m.start,l=m.end,i>b&&(i-=d),l>b&&(l-=d),i<=b&&b<l&&i<=c&&c<l&&(i=f.getLineAtOffset(m.start),l=f.getLineAtOffset(m.end),i!==l?m.expanded||m.expand():e.removeAnnotation(m)))}b=[];for(i=0;i<g.length;i++){m=g[i];for(d=0;d<n.length;d++)if(n[d].start===m.start&&n[d].end===m.end)break;d===n.length&&(m=this._createFoldingAnnotation(a,
f,m.start,m.end))&&b.push(m)}e.replaceAnnotations(h,b)}}};return{TextStyler:i}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(j){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 h(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=s(d,d.getText(this.start,this.end),this,this.start)}function d(a){this._styler=a}function b(a,b,c,e){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,e);this._accessor=new d(this);this._bracketAnnotations=void 0;var f=this;this._listener={onChanged:function(a){f._onModelChanged(a)},onDestroy:function(a){f._onDestroy(a)},
onLineStyle:function(a){f._onLineStyle(a)},onMouseDown:function(a){f._onMouseDown(a)},onSelection:function(a){f._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);e=c.getCharCount();this._rootBlock=
new h({start:0,contentStart:0,end:e,contentEnd:e},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(e=[],r(this._rootBlock,c,e),b.replaceAnnotations([],e));a.redrawLines()}var f={styleClass:"meta annotation currentLine"},a=/$/,e=/\\(\d)/g,i=/(.*)(?:[\r\n]|$)/g,g={regex:/ /g,style:{styleClass:"punctuation separator space",unmergeable:!0}},c={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},l=function(a,b,c,d){var e=c,f=a.lastIndex;i.lastIndex=
c;var c=i.exec(b),g,h;a.lastIndex=0;if(c){for(h=c.index;0<=--h;)if(g=b.charAt(h),g==="\n"||g==="\r")break;g=b.substring(h+1,c.index+c[1].length);a.lastIndex=h=c.index-h-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+=e,j.index-=h,a.lastIndex=f,j;h=0;e+=c[0].length;if(c=i.exec(b))g=c[1],a.lastIndex=0}a.lastIndex=f;return null},m=function(a,b){var c=a.toString();e.lastIndex=0;if(!e.test(c))return a;e.lastIndex=0;
for(var d=e.exec(c);d;)c=c.replace(d[0],b[d[1]]||""),e.lastIndex=0,d=e.exec(c);return RegExp(c.substring(1,c.length-2),"g")},p=function(a,b,c,d){if(b=l(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 g=
b[f];if(g){var i=c+e;d.push({start:i,end:i+a[f].length,style:g.name})}e+=a[f].length}},q=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})},v=function(b,c,d,e,f){if(d=d.getLinePatterns()){var g=[];d.forEach(function(a){var c=a.regex||a.regexBegin;c.oldLastIndex=c.lastIndex;(c=l(c,b,0))&&g.push({result:c,pattern:a})});g.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 i=0;g.length>0;){var h=g[0];g.splice(0,1);if(!(h.result.index<i)){var j=h.result.index,k,r=[];if(h.pattern.regex){i=h.result;k=j+i[0].length;k={start:c+j,end:c+k,style:h.pattern.pattern.name};if(!f){h.pattern.pattern.captures&&o(i,h.pattern.pattern.captures,c+j,r);r.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(j=0;j<r.length-1;j++)if(r[j+1].start<r[j].end){var s={start:r[j+1].end,
end:r[j].end,style:r[j].style};r[j].end=r[j+1].start;r.splice(j+2,0,s)}}q(k,r,e)}else{i=h.pattern.regexEnd;i=m(i,h.result);i=l(i,b,h.result.index+h.result[0].length);if(!i)a.lastIndex=0,i=a.exec(b);k=i.index+i[0].length;e.push({start:c+j,end:c+k,style:h.pattern.pattern.name})}i=i.index+i[0].length}p(h,b,g,i)}d.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},s=function(b,c,d,e){var f=[];d.getBlockPatterns().forEach(function(a){var b=l(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 g=0,i=[];f.length>0;){var j=f[0];f.splice(0,1);if(!(j.result.index<g)){var k=b.getLineAtOffset(e+j.result.index),o=b.getLine(k),q=[];v(o,b.getLineStart(k),d,q);k=e+j.result.index;for(o=0;o<q.length;o++)if(q[o].start===k){var g=j.result.index,r=null,s=j.pattern.regexEnd;if(s){g+=j.result[0].length;
for(var s=m(s,j.result),A=g;!r;){A=l(s,c,A);if(!A)a.lastIndex=0,A=a.exec(c);var L=[],K=new h({start:k,end:e+A.index+A[0].length,contentStart:e+g,contentEnd:e+A.index},j.pattern,d.getStyler(),b,d);v(c.substring(g,A.index+A[0].length),g,K,L);if(!L.length||L[L.length-1].end<=A.index)r=K;A=A.index+A[0].length}}else r=new h({start:k,end:k+j.result[0].length,contentStart:k,contentEnd:k+j.result[0].length},j.pattern,d.getStyler(),b,d);i.push(r);g=r.end-e;break}o===q.length&&(g=j.result.index+1)}p(j,c,f,
g)}return i},r=function(a,b,c){if(a.getAnnotationModel()){var d=j.AnnotationType.ANNOTATION_TASK;if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&a.pattern.pattern.name.indexOf("comment")===0){var e=[];v(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(j.AnnotationType.createAnnotation(d,e[f].start,e[f].end,b.getText(e[f].start,e[f].end)))}a.getBlocks().forEach(function(a){r(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"};h.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,g;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);g=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);g=this.contentEnd}d.lastIndex=0;if(f=d.exec(f)){d=[];o(f,e,g,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))}};d.prototype={getStyles:function(a){return this._styler.getStyles(a)}};b.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),g=[];v(f,c.getLineStart(e),d,g);for(e=0;e<g.length;e++){if(a<g[e].start)break;if(g[e].start<=a&&a<g[e].end){b.push(g[e]);break}}for(;d;)(g=d.computeStyle(c,a))&&b.splice(0,0,g),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(j.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=b.getBaseModel(),f=0;f<a.length;f++){var g=a[f];(g=this._createFoldingAnnotation(b,e,g.start,g.end))&&d.push(g)}c.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c),
b=b.getLineAtOffset(d);return e===b?null:new (j.AnnotationType.getType(j.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 g=[],i=[],h=e,j=c.getBlocks(),k=this._binarySearch(j,e,!0);k<j.length;k++){if(j[k].start>=f)break;var l=j[k].start,m=j[k].end;h<l&&(v(d.substring(h-e,l-e),h,c,i),i.forEach(function(c){c.style.indexOf(a.pattern.name)===
0?g.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&g.push(-(c.start+1))}),i=[]);h=m}h<f&&(v(d.substring(h-e,f-e),h,c,i),i.forEach(function(c){c.style.indexOf(a.pattern.name)===0?g.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&g.push(-(c.start+1))}));return g},_findMatchingBracket:function(a,b,c){for(var d=a.getLineAtOffset(c),e=a.getLineEnd(d),f=a.getText(c,e),g,i=b.getEnclosurePatterns(),h=Object.keys(i),j=0;j<h.length;j++){var k=i[h[j]],m=l(k.regex,f,0);if(m&&m.index===0){g=k;break}}if(!g)return-1;
f=!1;g.pattern.name.indexOf(".begin")!==-1?(f=!0,j=g.pattern.name.replace(".begin",".end")):j=g.pattern.name.replace(".end",".begin");i=i[j];if(!i)return-1;h=a.getLine(d);k=a.getLineStart(d);e=this._findBrackets(g,i,b,h,k,e);for(j=0;j<e.length;j++)if(h=e[j]>=0?1:-1,e[j]*h-1===c){c=1;if(f){for(j++;j<e.length;j++)if(h=e[j]>=0?1:-1,c+=h,c===0)return e[j]*h-1;d+=1;for(j=a.getLineCount();d<j;){h=a.getLine(d);k=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,i,b,h,k,e);for(f=0;f<e.length;f++)if(h=
e[f]>=0?1:-1,c+=h,c===0)return e[f]*h-1;d++}}else{for(j--;j>=0;j--)if(h=e[j]>=0?1:-1,c+=h,c===0)return e[j]*h-1;for(d-=1;d>=0;){h=a.getLine(d);k=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,i,b,h,k,e);for(j=e.length-1;j>=0;j--)if(h=e[j]>=0?1:-1,c+=h,c===0)return e[j]*h-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=[],g=d,i=a.getBlocks(),h=this._binarySearch(i,d,!0);h<i.length;h++){if(i[h].start>=e)break;var j=i[h].start,k=i[h].end;g<j&&v(c.substring(g-d,j-d),g,a,f);var m=Math.max(g,j);if(m===j&&i[h].pattern.regexBegin){var p=l(i[h].pattern.regexBegin,c.substring(m-d),0);if(p){var A=i[h].pattern.pattern.beginCaptures||i[h].pattern.pattern.captures;
A?o(p,A,m,f):f.push({start:m,end:m+p[0].length,style:i[h].pattern.pattern.name});m+=p[0].length}}var j=Math.min(e,k),L=[];if(j===k&&i[h].pattern.regexEnd&&(g=c.substring(j-g-(i[h].end-i[h].contentEnd)),p=l(i[h].pattern.regexEnd,g,0)))(A=i[h].pattern.pattern.endCaptures||i[h].pattern.pattern.captures)?o(p,A,j-p[0].length,L):i[h].pattern.pattern.name&&L.push({start:j-p[0].length,end:j,style:i[h].pattern.pattern.name}),j-=p[0].length;var g=this._getStyles(i[h],b,c.substring(m-d,j-d),m),q=i[h].pattern.pattern.contentName||
i[h].pattern.pattern.name;if(q){var r=m;g.forEach(function(a){a.start-r&&f.push({start:r,end:a.start,style:q});f.push(a);r=a.end});j-r&&f.push({start:r,end:j,style:q})}else f=f.concat(g);f=f.concat(L);g=k}g<e&&v(c.substring(g-d,e-d),g,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(a){if(a.textView===this.view)a.style=this._getLineStyle(a.lineIndex);a.ranges=this._getStyles(this._rootBlock,a.textView.getModel(),a.lineText,a.lineStart);a.ranges.forEach(function(a){if(a.style)a.style={styleClass:a.style.replace(/\./g," ")}});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(g,a.ranges,a.lineText,a.lineStart),this.tabsVisible&&this._spliceStyles(c,a.ranges,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 g=c.start===c.end,b=b.start===b.end;f===e&&b&&g||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&g&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,i,h;if(c.start===c.end&&(h=d.getCaretOffset())>0)h-=1,a.getBaseModel&&(h=a.mapOffset(h),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,h),a=this._findMatchingBracket(a,c,h),a!==-1&&(i=[j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_MATCHING_BRACKET,
a,a+1),j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_CURRENT_BRACKET,h,h+1)]);this._bracketAnnotations=i;this.annotationModel.replaceAnnotations(b,i)}},_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 g=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,g,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,g=f.getCharCount(),i=this._rootBlock.getBlocks(),h=i.length,k=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(i,k,!0),m=this._binarySearch(i,c,!1,l-1,h),o;l<h&&i[l].start<=k&&k<i[l].end?(o=i[l].start,o>b&&(o+=a)):o=l===h&&h>0&&g-a===i[h-1].end?i[h-1].start:k;var A;do m<h?(A=i[m].end,A>b&&(A+=a),m+=1):
(m=h,A=g),k=f.getText(o,A),k=s(f,k,this._rootBlock,o);while(k.length&&i.length&&m<h&&k[k.length-1].pattern.pattern.id!==i[m-1].pattern.pattern.id);for(g=l;g<i.length;g++)h=i[g],h.start>b&&h.adjustStart(a),h.start>b&&h.adjustEnd(a);var p=m-l!==k.length;if(!p)for(g=0;g<k.length;g++){var h=i[l+g],q=k[g];if(h.start!==q.start||h.end!==q.end||h.type!==q.type){p=!0;break}}g=[l,m-l].concat(k);Array.prototype.splice.apply(i,g);p&&(g=o,h=A,e!==f&&(g=e.mapOffset(g,!0),h=e.mapOffset(h,!0)),d.redrawRange(g,h));
if(this.annotationModel){d=[];i=[];l=[];o=this.annotationModel.getAnnotations(o,A);for(A=this.foldingEnabled&&f!==e;o.hasNext();)if(h=o.next(),A&&h.type===j.AnnotationType.ANNOTATION_FOLDING){l.push(h);for(g=0;g<k.length;g++)if(h.start===k[g].start&&h.end===k[g].end)break;g===k.length?(d.push(h),h.expand()):(g=h.start,m=h.end,g>b&&(g-=a),m>b&&(m-=a),g<=b&&b<m&&g<=c&&c<m&&(g=f.getLineAtOffset(h.start),m=f.getLineAtOffset(h.end),g!==m?h.expanded||h.expand():this.annotationModel.removeAnnotation(h)));
for(g=0;g<k.length;g++){h=k[g];for(m=0;m<l.length;m++)if(l[m].start===h.start&&l[m].end===h.end)break;m===l.length&&(h=this._createFoldingAnnotation(e,f,h.start,h.end))&&i.push(h)}}else h.type===j.AnnotationType.ANNOTATION_TASK&&d.push(h);if(this.detectTasks)for(g=0;g<k.length;g++)r(k[g],f,i);this.annotationModel.replaceAnnotations(d,i)}},_spliceStyles:function(a,b,c,d){for(var e=a.regex,f=e.lastIndex=0,g=e.exec(c);g;){for(g=d+g.index;f<b.length;){if(g<b[f].end)break;f++}var i={start:g,end:g+1,style:a.style};
if(f<b.length&&b[f].start<=g){var h={start:g+1,end:b[f].end,style:b[f].style};b[f].end=g;b.splice(f+1,0,h);b.splice(f+1,0,i);f+=2}else b.splice(f,0,i),f++;g=e.exec(c)}}};return{TextStyler:b}});
define("orion/editor/textMateStyler",["orion/regex"],function(j){function k(b){var d;if(b instanceof Array){d=Array(b.length);for(var a=0;a<b.length;a++)d[a]=k(b[a])}else for(a in d={},b)if(Object.prototype.hasOwnProperty.call(b,a)){var e=b[a];d[a]=typeof e==="object"&&e!==null?k(e):e}return d}function h(b,d,a){this.initialize(b);this.grammar=k(d);this.externalGrammars=a?k(a):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var d={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(b){return b[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(b){function f(a,b){throw Error('Unsupported regex feature "'+a+'": "'+b[0]+'" at index: '+b.index+" in "+b.input);}var a="",e,b=d.processGlobalFlag("x",b,function(a){for(var b="",d=!1,e=a.length,f=0;f<e;){var i=a.charAt(f);if(!d&&i==="#")for(;f<e&&i!=="\r"&&i!=="\n";)i=a.charAt(++f);
else if(!d&&/\s/.test(i))for(;f<e&&/\s/.test(i);)i=a.charAt(++f);else i==="\\"?(b+=i,/\s/.test(a.charAt(f+1))||(b+=a.charAt(f+1),f+=1)):(i==="["?d=!0:i==="]"&&(d=!1),b+=i),f+=1}return b}),b=d.processGlobalFlag("i",b,function(b){a+="i";return b});for(e=0;e<this.unsupported.length;e++){var i;(i=this.unsupported[e].regex.exec(b))&&f(this.unsupported[e].func(i),i)}return RegExp(b,a)},processGlobalFlag:function(b,d,a){function e(a,b){for(var d=0,e=a.length,f=-1,i=b;i<e&&f===-1;i++)switch(a.charAt(i)){case "\\":i++;
break;case "(":d++;break;case ")":d--,d===0&&(f=i)}return f}var i="(?"+b+")",b="(?"+b+":";if(d.substring(0,i.length)===i)return a(d.substring(i.length));else if(d.substring(0,b.length)===b){i=e(d,0);if(i<d.length-1)throw Error("Only a "+b+") group that encloses the entire regex is supported in: "+d);return a(d.substring(b.length,i))}return d},hasBackReference:function(b){return/\\\d+/.test(b.source)},getSubstitutedRegex:function(b,d,a){for(var a=typeof a==="undefined"?!0:!1,b=b.source.split(/(\\\d+)/g),
e=[],i=0;i<b.length;i++){var g=b[i],c=/\\(\d+)/.exec(g);c?(g=d[c[1]]||"",e.push(a?j.escape(g):g)):e.push(g)}return RegExp(e.join(""))},groupify:function(b,d){for(var a=b.source,e=a.length,i=[],g=0,c=[],h=1,j=1,k=[],o={},q={},v=0;v<e;v++){var s=i[i.length-1],r=a.charAt(v);switch(r){case "(":if(s===4)i.pop(),k.push(")"),c[c.length-1].end=v;var u=v+2<e?a.charAt(v+1)+""+a.charAt(v+2):null;if(u==="?:"||u==="?="||u==="?!"){var w;u==="?:"?w=1:(w=3,g++);i.push(w);c.push({start:v,end:-1,type:w});k.push(r);
k.push(u);v+=u.length}else i.push(2),c.push({start:v,end:-1,type:2,oldNum:h,num:j}),k.push(r),g===0&&(q[j]=null),o[h]=j,h++,j++;break;case ")":s=i.pop();s===3&&g--;c[c.length-1].end=v;k.push(r);break;case "*":case "+":case "?":case "}":var n=r,t=a.charAt(v-1),u=v-1;if(r==="}"){for(w=v-1;a.charAt(w)!=="{"&&w>=0;w--);t=a.charAt(w-1);u=w-1;n=a.substring(w,v+1)}w=c[c.length-1];if(t===")"&&(w.type===2||w.type===4)){k.splice(w.start,0,"(");k.push(n);k.push(")");r={start:w.start,end:k.length-1,type:4,num:w.num};
for(t=0;t<c.length;t++)if(s=c[t],(s.type===2||s.type===4)&&s.start>=w.start&&s.end<=u)if(s.start+=1,s.end+=1,s.num+=1,s.type===2)o[s.oldNum]=s.num;c.push(r);j++;break}default:r!=="|"&&s!==2&&s!==4&&g===0&&(i.push(4),c.push({start:v,end:-1,type:4,num:j}),k.push("("),q[j]=null,j++),k.push(r),r==="\\"&&(r=a.charAt(v+1),k.push(r),v+=1)}}for(;i.length;)i.pop(),k.push(")");var a=RegExp(k.join("")),e={},d=d||o,y;for(y in d)d.hasOwnProperty(y)&&(e[y]="\\"+d[y]);a=this.getSubstitutedRegex(a,e,!1);return[a,
o,q]},complexCaptures:function(b){if(!b)return!1;for(var d in b)if(b.hasOwnProperty(d)&&d!=="0")return!0;return!1}};h.prototype={initialize:function(b){this.textView=b;this.textView.stylerOptions=this;var d=this;this._listener={onModelChanged:function(a){d.onModelChanged(a)},onDestroy:function(a){d.onDestroy(a)},onLineStyle:function(a){d.onLineStyle(a)},onStorage:function(a){d.onStorage(a)}};b.addEventListener("ModelChanged",this._listener.onModelChanged);b.addEventListener("Destroy",this._listener.onDestroy);
b.addEventListener("LineStyle",this._listener.onLineStyle);b.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(b){for(b=[b];b.length!==0;){var d=
b.pop();if(!d._resolvedRule||!d._typedRule)if(d._resolvedRule=this._resolve(d),d._typedRule=this._createTypedRule(d),this.addStyles(d.name),this.addStyles(d.contentName),this.addStylesForCaptures(d.captures),this.addStylesForCaptures(d.beginCaptures),this.addStylesForCaptures(d.endCaptures),d._resolvedRule!==d&&b.push(d._resolvedRule),d.patterns)for(var a=0;a<d.patterns.length;a++)b.push(d.patterns[a])}},addStyles:function(b){if(b&&!this._styles[b]){this._styles[b]=[];for(var d=b.split("."),a=0;a<
d.length;a++)this._styles[b].push(d.slice(0,a+1).join("-"))}},addStylesForCaptures:function(b){for(var d in b)b.hasOwnProperty(d)&&this.addStyles(b[d].name)},ContainerRule:function(){function b(b){this.rule=b;this.subrules=b.patterns}b.prototype.valueOf=function(){return"aa"};return b}(),BeginEndRule:function(){function b(b){this.rule=b;this.beginRegex=d.toRegExp(b.begin);this.endRegex=d.toRegExp(b.end);this.subrules=b.patterns||[];this.endRegexHasBackRef=d.hasBackReference(this.endRegex);var a=d.complexCaptures(b.captures),
b=d.complexCaptures(b.beginCaptures)||d.complexCaptures(b.endCaptures);if(this.isComplex=a||b)a=d.groupify(this.beginRegex),this.beginRegex=a[0],this.beginOld2New=a[1],this.beginConsuming=a[2],a=d.groupify(this.endRegex,this.beginOld2New),this.endRegex=a[0],this.endOld2New=a[1],this.endConsuming=a[2]}b.prototype.valueOf=function(){return this.beginRegex};return b}(),MatchRule:function(){function b(b){this.rule=b;this.matchRegex=d.toRegExp(b.match);if(this.isComplex=d.complexCaptures(b.captures))b=
d.groupify(this.matchRegex),this.matchRegex=b[0],this.matchOld2New=b[1],this.matchConsuming=b[2]}b.prototype.valueOf=function(){return this.matchRegex};return b}(),_createTypedRule:function(b){return b.match?new this.MatchRule(b):b.begin?new this.BeginEndRule(b):new this.ContainerRule(b)},_resolve:function(b){var d=b;if(b.include){if(b.begin||b.end||b.match)throw Error('Unexpected regex pattern in "include" rule '+b.include);b=b.include;if(b.charAt(0)==="#"){if(d=this.grammar.repository&&this.grammar.repository[b.substring(1)],
!d)throw Error("Couldn't find included rule "+b+" in grammar repository");}else if(b==="$self")d=this.grammar;else if(b==="$base")throw Error('Include "$base" is not supported');else if(d=this._allGrammars[b],!d)for(var a=0;a<this.externalGrammars.length;a++){var e=this.externalGrammars[a];if(e.scopeName===b){this.preprocess(e);d=this._allGrammars[b]=e;break}}}return d},ContainerNode:function(){function b(b,a){this.parent=b;this.rule=a;this.children=[];this.end=this.start=null}b.prototype.addChild=
function(b){this.children.push(b)};b.prototype.valueOf=function(){var b=this.rule;return"ContainerNode { "+(b.include||"")+" "+(b.name||"")+(b.comment||"")+"}"};return b}(),BeginEndNode:function(){function b(b,a,e){this.parent=b;this.rule=a;this.children=[];this.setStart(e);this.endMatch=this.end=null;this.endRegexSubstituted=a.endRegexHasBackRef?d.getSubstitutedRegex(a.endRegex,e):null}b.prototype.addChild=function(b){this.children.push(b)};b.prototype.getIndexInParent=function(){return this.parent?
this.parent.children.indexOf(this):-1};b.prototype.setStart=function(b){this.start=b.index;this.beginMatch=b};b.prototype.setEnd=function(b){b&&typeof b==="object"?(this.endMatch=b,this.end=b.index+b[0].length):(this.endMatch=null,this.end=b)};b.prototype.shiftStart=function(b){this.start+=b;this.beginMatch.index+=b};b.prototype.shiftEnd=function(b){this.end+=b;this.endMatch&&(this.endMatch.index+=b)};b.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+
"}"};return b}(),push:function(b,d){if(d)for(var a=d.length;a>0;)b.push(d[--a])},exec:function(b,d,a){(d=b.exec(d))&&(d.index+=a);b.lastIndex=0;return d},afterMatch:function(b){return b.index+b[0].length},getEndMatch:function(b,d,a){if(b instanceof this.BeginEndNode){var e=b.rule,b=b.endRegexSubstituted||e.endRegex;return!b?null:this.exec(b,d,a)}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(b){var d=b.addedCharCount,a=b.removedCharCount,b=b.start;if(this._tree){var e=this.textView.getModel(),i=e.getCharCount(),e=e.getLineEnd(e.getLineAtOffset(b)-1),g=this.getFirstDamaged(e,e),e=e===-1?0:e,d=g?this.parse(g,!0,e,b,d,a):i;this.textView.redrawRange(e,d)}else this.initialParse()},getFirstDamaged:function(b,d){if(b<0)return this._tree;for(var a=[this._tree],e=null;a.length;){var i=a.pop();if(!i.parent||this.isDamaged(i,b,d)){i instanceof this.BeginEndNode&&(e=
i);for(var g=0;g<i.children.length;g++)a.push(i.children[g])}}return e||this._tree},isDamaged:function(b,d,a){return b.start<=a&&b.end>d},parse:function(b,d,a,e,i,g){var c=this.textView.getModel(),h=c.getLineStart(c.getLineCount()-1),j=c.getCharCount(),k=this.getInitialExpected(b,a),o=-1;if(d)b.repaired=!0,b.endNeedsUpdate=!0,o=(o=b.children[b.children.length-1])?c.getLineEnd(c.getLineAtOffset(o.end+(i-g))):-1,e=c.getLineEnd(c.getLineAtOffset(e+g)),o=Math.max(o,e);for(var o=o===-1?j:o,e=k,q=b,v=!1,
s=a,r=-1;q&&(!d||s<o);){var u=this.getNextMatch(c,q,s);u||(s=s>=h?j:c.getLineStart(c.getLineAtOffset(s)+1));var w=u&&u.match,n=u&&u.rule,t=u&&u.isEnd;if(u&&u.isSub){if(s=this.afterMatch(w),n instanceof this.BeginEndRule)v=!0,d&&n===e.rule&&q===e.parent?(q=e,q.setStart(w),q.repaired=!0,q.endNeedsUpdate=!0,e=this.getNextExpected(e,"begin")):(d&&(this.prune(q,e),d=!1),w=new this.BeginEndNode(q,n,w),q.addChild(w),q=w)}else if(t||s===j){if(q instanceof this.BeginEndNode)w?(v=!0,r=Math.max(r,q.end),q.setEnd(w),
s=this.afterMatch(w),d&&q===e&&q.parent===e.parent?(q.repaired=!0,delete q.endNeedsUpdate,e=this.getNextExpected(e,"end")):d&&(this.prune(q,e),d=!1)):(q.setEnd(j),delete q.endNeedsUpdate);q=q.parent}d&&s>=o&&!v&&(this.prune(b,k),d=!1)}this.removeUnrepairedChildren(b,d,a);this.cleanup(d,b,a,o,j,i,g);return d?Math.max(r,s):s},removeUnrepairedChildren:function(b,d,a){if(d){for(var d=b.children,e=-1,i=0;i<d.length;i++){var g=d[i];if(!g.repaired&&this.isDamaged(g,a,Number.MAX_VALUE)){e=i;break}}if(e!==
-1)b.children.length=e}},cleanup:function(b,d,a,e,i,g,c){if(b){b=g-c;i=this.getIntersecting(e-b+1,i);d=this.getIntersecting(a,e);for(a=0;a<i.length;a++)e=i[a],!e.repaired&&e instanceof this.BeginEndNode&&(e.shiftEnd(b),e.shiftStart(b));for(a=0;a<d.length;a++)e=d[a],e.repaired&&e.endNeedsUpdate&&e.shiftEnd(b),delete e.endNeedsUpdate,delete e.repaired}else{d=this.getIntersecting(a,e);for(a=0;a<d.length;a++)delete d[a].repaired}},getNextMatch:function(b,d,a,e){var i=b.getLineAtOffset(a),i=b.getLineEnd(i),
g=b.getText(a,i),c=[],h=[],b=[],i=[];for(this.push(c,d.rule.subrules);c.length;){var j=c.length?c.pop():null,j=j&&j._resolvedRule._typedRule;if(j instanceof this.ContainerRule&&h.indexOf(j)===-1)h.push(j),this.push(c,j.subrules);else if(!j||!e||j.matchRegex){var k=j&&this.exec(j.matchRegex||j.beginRegex,g,a);k&&(b.push(k),i.push(j))}}c=Number.MAX_VALUE;h=-1;for(j=0;j<b.length;j++)if(k=b[j],k.index<c)c=k.index,h=j;if(!e&&(a=this.getEndMatch(d,g,a)))if(e=d.rule.applyEndPatternLast,h===-1||a.index<c||
!e&&a.index===c)return{isEnd:!0,rule:d.rule,match:a};return h===-1?null:{isSub:!0,rule:i[h],match:b[h]}},getInitialExpected:function(b,d){var a,e;if(b===this._tree)for(a=0;a<b.children.length;a++){if(e=b.children[a],e.start>=d)return e}else if(b instanceof this.BeginEndNode&&b.endMatch){var i=b.endMatch.index;for(a=0;a<b.children.length;a++)if(e=b.children[a],e.start>=d)break;if(e&&e.start<i)return e}return b},getNextExpected:function(b,d){if(d==="begin"){var a=b.children[0];return a?a:b}else if(d===
"end"&&(a=b.parent)){var e=a.children[a.children.indexOf(b)+1];return e?e:a}return null},prune:function(b,d){if(d.parent===b)b.children.length=d.getIndexInParent();else if(b instanceof this.BeginEndNode)b.endMatch=null,b.end=null;if(b.parent)b.parent.children.length=b.getIndexInParent()+1},onLineStyle:function(b){this._tree||this.initialParse();var d=b.lineStart,a=this.textView.getModel(),e=a.getLineEnd(b.lineIndex),i=a.getLineEnd(a.getLineAtOffset(d)-1),i=this.getFirstDamaged(i,i),d=this.getLineScope(a,
i,d,e);b.ranges=this.toStyleRanges(d);b.ranges.sort(function(a,b){return a.start-b.start})},getLineScope:function(b,d,a,e){for(var i=a,g=this.getInitialExpected(d,a),c=[],h=[];d&&i<e;){var j=this.getNextMatch(b,d,i);if(!j)break;var k=j&&j.match,o=j&&j.rule,q=j&&j.isSub,j=j&&j.isEnd;k.index!==i&&h.push({start:i,end:k.index,node:d});if(q)i=this.afterMatch(k),o instanceof this.BeginEndRule?(this.addBeginScope(c,k,o),d=g,g=this.getNextExpected(g,"begin")):this.addMatchScope(c,k,o);else if(j)i=this.afterMatch(k),
this.addEndScope(c,k,o),g=this.getNextExpected(g,"end"),d=d.parent}i<e&&h.push({start:i,end:e,node:d});b=this.getInheritedLineScope(h,a,e);return c.concat(b)},getInheritedLineScope:function(b){for(var d=[],a=0;a<b.length;a++)for(var e=b[a],i=e.node;i;){var g=i.rule.rule,c=g.name;if(g=g.contentName||c){this.addScopeRange(d,e.start,e.end,g);break}i=i.parent}return d},addBeginScope:function(b,d,a){var e=a.rule;this.addCapturesScope(b,d,e.beginCaptures||e.captures,a.isComplex,a.beginOld2New,a.beginConsuming)},
addEndScope:function(b,d,a){var e=a.rule;this.addCapturesScope(b,d,e.endCaptures||e.captures,a.isComplex,a.endOld2New,a.endConsuming)},addMatchScope:function(b,d,a){var e=a.rule,i=e.name;(e=e.captures)?this.addCapturesScope(b,d,e,a.isComplex,a.matchOld2New,a.matchConsuming):this.addScope(b,d,i)},addScope:function(b,d,a){a&&b.push({start:d.index,end:this.afterMatch(d),scope:a})},addScopeRange:function(b,d,a,e){e&&b.push({start:d,end:a,scope:e})},addCapturesScope:function(b,d,a,e,i,g){if(a)if(e){for(var e=
{1:0},c=0,h=1;d[h]!==void 0;h++)g[h]!==void 0&&(c+=d[h].length),d[h+1]!==void 0&&(e[h+1]=c);g=d.index;for(c=1;a[c];c++){var h=a[c].name,j=i[c],k=g+e[j];typeof d[j]!=="undefined"&&this.addScopeRange(b,k,k+d[j].length,h)}}else this.addScope(b,d,a[0]&&a[0].name)},getIntersecting:function(b,d){for(var a=[],e=this._tree?[this._tree]:[];e.length;){var i=e.pop(),g=!1;i instanceof this.ContainerNode?g=!0:this.isDamaged(i,b,d)&&(g=!0,a.push(i));if(g)for(var g=i.children.length,c=0;c<g;c++)e.push(i.children[c])}return a.reverse()},
toStyleRanges:function(b){for(var d=[],a=0;a<b.length;a++){var e=b[a],i=this._styles[e.scope];if(!i)throw Error("styles not found for "+e.scope);i=i.join(" ");d.push({start:e.start,end:e.end,style:{styleClass:i}})}return d}};return{RegexUtil:d,TextMateStyler:h}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(j,k){function h(a){return a.getProperty("objectClass").indexOf(b)!==-1&&a.getProperty("type")==="highlighter"}function d(a,b,d){this.initialize(a,b,d);this.lineStyles=[]}var b="orion.edit.highlighter",f=b+" service must be an event emitter";k.AnnotationType.registerType("orion.annotation.highlightError",{title:j.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});
d.prototype={initialize:function(a,d,f){this.textView=a;this.serviceRegistry=d;this.annotationModel=f;this.services=[];var g=this;this.listener={onModelChanging:function(a){g.onModelChanging(a)},onModelChanged:function(a){g.onModelChanged(a)},onDestroy:function(a){g.onDestroy(a)},onLineStyle:function(a){g.onLineStyle(a)},onStyleReady:function(a){g.onStyleReady(a)},onServiceAdded:function(a){g.onServiceAdded(a.serviceReference,g.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){g.onServiceRemoved(a.serviceReference,
g.serviceRegistry.getService(a.serviceReference))}};a.addEventListener("ModelChanging",this.listener.onModelChanging);a.addEventListener("ModelChanged",this.listener.onModelChanged);a.addEventListener("Destroy",this.listener.onDestroy);a.addEventListener("LineStyle",this.listener.onLineStyle);d.addEventListener("registered",this.listener.onServiceAdded);d.addEventListener("unregistering",this.listener.onServiceRemoved);a=d.getServiceReferences(b);for(f=0;f<a.length;f++){var c=a[f];h(c)&&this.addServiceListener(d.getService(c))}},
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 a=0;a<this.services.length;a++)this.removeServiceListener(this.services[a]);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(a){this.startLine=this.textView.getModel().getLineAtOffset(a.start)},onModelChanged:function(a){var b=this.startLine;(a.addedLineCount||a.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[b,a.removedLineCount].concat(this._getEmptyStyle(a.addedLineCount)))},
onStyleReady:function(a){var b=a.lineStyles||a.style,a=Number.MAX_VALUE,d=-1,f=this.textView.getModel(),c;for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&(this.lineStyles[c]=b[c],a=Math.min(a,c),d=Math.max(d,c));a=Math.max(a,0);d=Math.min(d,f.getLineCount());if(b=this.annotationModel){for(var h=b.getAnnotations(f.getLineStart(a),f.getLineEnd(d)),j=[];h.hasNext();){var p=h.next();p.type==="orion.annotation.highlightError"&&j.push(p)}h=[];for(p=a;p<=d;p++){c=p;var o=this.lineStyles[c],o=o&&o.errors;
c=f.getLineStart(c);if(o)for(var q=0;q<o.length;q++){var v=o[q];h.push(k.AnnotationType.createAnnotation("orion.annotation.highlightError",v.start+c,v.end+c))}}b.replaceAnnotations(j,h)}this.textView.redrawLines(a,d+1)},onLineStyle:function(a){function b(a,c){for(var d=a.length,e=[],f=0;f<d;f++){var h=a[f];e.push({start:h.start+c,end:h.end+c,style:h.style})}return e}var d=this.lineStyles[a.lineIndex];if(d)if(d.ranges)a.ranges=b(d.ranges,a.lineStart);else if(d.style)a.style=d.style},_getEmptyStyle:function(a){for(var b=
[],d=0;d<a;d++)b.push(null);return b},setContentType:function(a){this.contentType=a;if(this.services)for(a=0;a<this.services.length;a++){var b=this.services[a];if(b.setContentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}},onServiceAdded:function(a,b){h(a)&&this.addServiceListener(b)},onServiceRemoved:function(a,
b){this.services.indexOf(b)!==-1&&this.removeServiceListener(b)},addServiceListener:function(a){if(typeof a.addEventListener==="function"){if(a.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(a),a.setContentType&&this.contentType){var b=this.serviceRegistry.getService("orion.page.progress");b?b.progress(a.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):a.setContentType(this.contentType)}}else typeof console!==
"undefined"&&console.log(Error(f))},removeServiceListener:function(a){typeof a.removeEventListener==="function"?(a.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),a=this.services.indexOf(a),a!==-1&&this.services.splice(a,1)):typeof console!=="undefined"&&console.log(Error(f))}};return d});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(j,k,h,d,b){function f(a,f,c,l,m,p,o){function q(a,d){var e=a.getProperty("contentType")||a.getProperty("contentTypes"),h=a.getProperty("fileTypes");if(e)return b.when(f.isSomeExtensionOf(c,e)).then(function(b){return b?a:null});else if(d&&h&&h.indexOf(d)!==-1)return e=new b,e.resolve(a),e;return null}function v(a){var b=null;switch(a&&
a.id){case "application/javascript":case "application/json":b=new j.TextStyler(l,"js",m);break;case "text/x-java-source":b=new j.TextStyler(l,"java",m);break;case "text/css":b=new j.TextStyler(l,"css",m)}return b}if(!e){var s=v(c);if(s)return p=new b,p.resolve(s),p}if(e&&!this.orionGrammars)this.orionGrammars={};for(var s=p&&p.split(".").pop().toLowerCase(),p=a.getServiceReferences("orion.edit.highlighter"),r=[],u=[],w=0;w<p.length;w++){var n=p[w],t=n.getProperty("type");t==="grammar"||!e&&typeof t===
"undefined"?r.push(n.getProperty("grammar")):t!=="highlighter"&&(t=n.getProperty("id"))&&!this.orionGrammars[t]&&(this.orionGrammars[t]={id:t,contentTypes:n.getProperty("contentTypes"),patterns:n.getProperty("patterns"),repository:n.getProperty("repository")});(n=q(n,s))&&u.push(n)}return b.all(u,function(a){return{_error:a}}).then(function(b){for(var f,g=b.length-1;g>=0;g--){var j=b[g];if(j&&!j._error&&(o||j.getProperty("type")!=="highlighter")){f=j;break}}var n;if(f)if(b=f.getProperty("type"),b===
"highlighter")n=new d(l,a,m),n.setContentType(c);else if(b==="grammar"||!e&&typeof b==="undefined")f=f.getProperty("grammar"),n=new h.TextMateStyler(l,f,r);else if(e){n=[];for(var p in this.orionGrammars)n.push(this.orionGrammars[p]);n=new k.TextStyler(l,m,n,f.getProperty("id"))}return n})}function a(a,b){this.serviceRegistry=a;this.contentTypeService=b;this.styler=null}var e=1;a.prototype={setup:function(a,b,c,d,e){e=typeof e==="undefined"?!0:e;if(this.styler)this.styler.destroy&&this.styler.destroy(),
this.styler=null;var h=this;return f(this.serviceRegistry,this.contentTypeService?this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),a,b,c,d,e).then(function(a){return h.styler=a})},getStyler:function(){return this.styler}};return{createStyler:f,SyntaxHighlighter:a}});
define("orion/searchExplorer","i18n!orion/search/nls/messages,require,orion/Deferred,orion/webui/littlelib,orion/contentTypes,orion/i18nUtil,orion/explorers/explorer,orion/explorers/explorerNavHandler,orion/fileClient,orion/commands,orion/searchUtils,orion/globalSearch/search-features,orion/compare/compareUIFactory,orion/compare/compareView,orion/highlight,orion/explorers/navigationUtils,orion/webui/tooltip,orion/explorers/navigatorRenderer,orion/extensionCommands".split(","),function(j,k,h,d,b,f,
a,e,i,g,c,l,m,p,o,q,v,s,r){function u(a){(a=d.node(a))&&d.empty(a);return a}function w(a,b,c){(a=d.node(a))&&a.addEventListener(b,c,!1)}function n(a,b,c){if(b=d.node(b))c==="only"&&d.empty(b),b.appendChild(a)}function t(a,b,c,e){a=document.createElement(a);if(b)if(Array.isArray(b))for(var f=0;f<b.length;f++)a.classList.add(b[f]);else if(typeof b==="string")a.className=b;if(c)a.id=c;(b=d.node(e))&&b.appendChild(a);return a}function y(a,b,c,d,e){a=t("a",a,b,d);a.href=c;e&&a.appendChild(document.createTextNode(e));
return a}function z(a,b,c,d){a=t("span",a,b,c);d&&a.appendChild(document.createTextNode(d));return a}function D(a){return!a?null:a.type==="file"?a:a.parent}function E(a){return typeof a.getValidFileList==="function"?a.getValidFileList():a.getListRoot().children}function B(a,b){this._init(a);this.explorer=b}function F(a,b){this._init(a);this.options=a;this.explorer=b}function C(a,b,c){this.parentId=a;this.reportList=b;this.resultModel=c;this.renderer=new F({checkbox:!1},this)}function G(a){this._syntaxHighlither=
new o.SyntaxHighlighter(a)}function x(a,c){this.registry=a;this._commandService=c;this.fileClient=new i.FileClient(this.registry);this.defaulRows=40;this._contentTypeService=new b.ContentTypeRegistry(this.registry);this.declareCommands()}B.prototype=new a.SelectionRenderer;B.prototype.initCheckboxColumn=function(){if(this._useCheckboxSelection){var a=t("th"),b=t("span",null,null,a);b.classList.add("selectionCheckmarkSprite");b.classList.add("core-sprite-check");if(this.getCheckedFunc)b.checked=this.getCheckedFunc(this.explorer.model.getListRoot()),
b.classList.toggle("core-sprite-check_on");w(b,"click",function(a){this.onCheck(null,a.target,a.target.checked?!1:!0)}.bind(this));return a}};B.prototype.getCellHeaderElement=function(a){if(a>2)return null;var b,c;if(a!==0){b=t("th");c=t("h2","search_header",null,b);if(a===1)c.textContent=typeof this.explorer.model.getHeaderString==="function"?this.explorer.model.getHeaderString():j.Results;else if(a===2)c.textContent=j.Location;return b}else return t("th")};B.prototype.focus=function(){var a=d.node(this.explorer.getParentDivId());
window.setTimeout(function(){a.focus()},10)};B.prototype.staleFileElement=function(a,b){if(a.stale){var c=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!0):null;q.removeNavGrid(c,d.node(this.getItemLinkId(a)));c=d.node(this.getFileSpanId(a));u(c);n(document.createTextNode(b?b:this.explorer.model.getFileName(a)),c,"last");c=d.node(this.getFileIconId(a));u(c)}else this.explorer._prepareFilter(a)};B.prototype.replaceFileElement=function(a){var b=a.totalMatches?this.explorer.model.getFileName(a)+
" ("+f.formatMessage(j["${0} matches"],a.totalMatches)+")":this.explorer.model.getFileName(a)+" ("+j["No matches"]+")";a.totalMatches?(a=d.node(this.getItemLinkId(a)),n(document.createTextNode(b),a,"only")):(a.stale=!0,this.staleFileElement(a,b))};B.prototype.replaceDetailIcon=function(a,b){if(!this.explorer.model.replaceMode()&&a&&a.type==="detail"){var c=d.node(this.getDetailIconId(a));c&&(u(c),c=z(null,null,c),c.classList.add("imageSprite"),b==="right"?c.classList.add("core-sprite-rightarrow"):
b==="left"?c.classList.add("core-sprite-leftarrow"):c.classList.add("core-sprite-none"))}};B.prototype.renderFileElement=function(a,b,d){var e=null;this.explorer.model._provideSearchHelper&&(e=this.explorer.model._provideSearchHelper());e=e?c.generateFindURLBinding(e.params,e.inFileQuery,null,e.params.replace,!0):null;e=s.createLink(null,{Location:a.location,Name:this.explorer.model._filterText?null:d},this.explorer._commandService,this.explorer._contentTypeService,this.explorer._openWithCommands,
{id:this.getItemLinkId(a)},e,{holderDom:this._lastFileIconDom});b.appendChild(e);q.addNavGrid(this.explorer.getNavDict(),a,e);if(this.explorer.model._filterText){var a=t("span",null,null,e),b=c.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),searchStrLength:this.explorer.model._filterText.length},d.toLowerCase(),!1),f=[];f.push({name:d,startIndex:0,bold:!1,highlight:!1});b&&b.forEach(function(a){f=this._mergesingleSegment(f,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));
this._renderSegments(f,a)}};B.prototype.generateContextTip=function(a){for(var b=t("table"),c=0;c<a.context.length;c++){var d=t("tr",null,null,b);a.context[c].current?(d=t("td",null,null,d),d.noWrap=!0,d=t("span",null,null,d),this.generateDetailHighlight(a,d)):(d=t("td",null,null,d),d.noWrap=!0,d.textContent=a.context[c].context+"\u00a0")}return b};B.prototype._generateDetailSegments=function(a){for(var b=0,c=[],d=0;d<a.matches.length;d++){if(b>=a.lineString.length)break;if(!(this.explorer.model.replaceMode()&&
d!==a.matchNumber)&&(b!==a.matches[d].startIndex&&c.push({name:a.lineString.substring(b,a.matches[d].startIndex),startIndex:b,bold:!1,highlight:!1}),b=a.matches[d].length,c.push({name:a.lineString.substring(a.matches[d].startIndex,a.matches[d].startIndex+b),startIndex:a.matches[d].startIndex,bold:!0,highlight:!1}),b=a.matches[d].startIndex+b,this.explorer.model.replaceMode()))break}b<a.lineString.length-1&&c.push({name:a.lineString.substring(b),startIndex:b,bold:!1,highlight:!1});return c};B.prototype._mergesingleSegment=
function(a,b){var c=[];a.forEach(function(a){var d=a.startIndex,e=a.startIndex+a.name.length;b.start>d&&b.end<e?(c.push({name:a.name.substring(0,b.start-d),startIndex:a.startIndex,bold:a.bold,highlight:!1}),c.push({name:a.name.substring(b.start-d,b.end-d),startIndex:b.start,bold:a.bold,highlight:!0}),c.push({name:a.name.substring(b.end-d),startIndex:b.end,bold:a.bold,highlight:!1})):b.start>d&&b.start<e?(c.push({name:a.name.substring(0,b.start-d),startIndex:a.startIndex,bold:a.bold,highlight:!1}),
c.push({name:a.name.substring(b.start-d),startIndex:b.start,bold:a.bold,highlight:!0})):d>=b.start&&e<=b.end?(a.highlight=!0,c.push(a)):b.end>d&&b.end<e?(c.push({name:a.name.substring(0,b.end-d),startIndex:a.startIndex,bold:a.bold,highlight:!0}),c.push({name:a.name.substring(b.end-d),startIndex:b.end,bold:a.bold,highlight:!1})):c.push(a)}.bind(this));return c};B.prototype._mergeFilteredSegments=function(a,b){if(!this.explorer.model._filterText)return a;var d=c.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),
searchStrLength:this.explorer.model._filterText.length},b.toLowerCase(),!1),e=a;d&&d.forEach(function(a){e=this._mergesingleSegment(e,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));return e};B.prototype._renderSegments=function(a,b){a.forEach(function(a){var c=a.bold?t("b",null,null,b):t("span",null,null,b);a.highlight&&c.classList.add("search-filter-text");n(document.createTextNode(a.name),c,"only")}.bind(this))};B.prototype.generateDetailHighlight=function(a,b,c){var a=this.explorer.model.getDetailInfo(a),
d=this._generateDetailSegments(a);c&&(d=this._mergeFilteredSegments(d,a.lineString));this._renderSegments(d,b)};B.prototype.renderDetailElement=function(a,b,c,d){b=this.getDetailElement(a,b,c);d&&this.renderDetailLineNumber(a,b);this.generateDetailHighlight(a,b,!0)};B.prototype.renderDetailLineNumber=function(a,b){var c=this.explorer.model.getDetailInfo(a),d=c.lineNumber+1;!this.explorer.model.replaceMode()||c.matches.length<=1?n(document.createTextNode(d+":"),b,"last"):n(document.createTextNode(d+
"("+(c.matchNumber+1)+"):"),b,"last")};B.prototype.getDetailElement=function(a,b,d){var e=this,b=null;this.explorer.model._provideSearchHelper&&(b=this.explorer.model._provideSearchHelper());b=b?c.generateFindURLBinding(b.params,b.inFileQuery,a.lineNumber,b.params.replace,!0):null;b=s.createLink(null,{Location:a.parent.location,Name:null},this.explorer._commandService,this.explorer._contentTypeService,this.explorer._openWithCommands,{id:this.getItemLinkId(a)},b,{});d.appendChild(b);q.addNavGrid(this.explorer.getNavDict(),
a,b);w(b,"click",function(){e.explorer.getNavHandler().cursorOn(a)});return t("span",null,null,b)};B.prototype.getRowActionElement=function(a){return d.node(this.getItemLinkId(a))};B.prototype.getLocationSpanId=function(a){return this.explorer.model.getId(a)+"_locationSpan"};B.prototype.getFileSpanId=function(a){return this.explorer.model.getId(a)+"_fileSpan"};B.prototype.getFileIconId=function(a){return this.explorer.model.getId(a)+"_fileIcon"};B.prototype.getItemLinkId=function(a){return typeof a===
"string"?a+"_itemLink":this.explorer.model.getId(a)+"_itemLink"};B.prototype.getDetailIconId=function(a){return this.explorer.model.getId(a)+"_detailIcon"};B.prototype.renderLocationElement=function(a,b){var e=b?b:d.node(this.getLocationSpanId(a));u(e);var f=this.explorer.model.getScopingParams(a),e=y("navlink",null,f.href,e,this.explorer.model._filterText?null:f.name);e.title=f.tooltip;q.addNavGrid(this.explorer.getNavDict(),a,e);var g=this;w(e,"click",function(){g.explorer.closeContextTip()});if(this.explorer.model._filterText){var e=
t("span",null,null,e),h=c.searchOnelineLiteral({searchStr:this.explorer.model._filterText.toLowerCase(),searchStrLength:this.explorer.model._filterText.length},f.name.toLowerCase(),!1),i=[];i.push({name:f.name,startIndex:0,bold:!1,highlight:!1});h&&h.forEach(function(a){i=this._mergesingleSegment(i,{start:a.startIndex,end:a.startIndex+a.length})}.bind(this));this._renderSegments(i,e)}};B.prototype.getPrimColumnStyle=function(a){return a&&a.type==="file"?"search_primaryColumn":"search_primaryColumn_Details"};
B.prototype.getSecondaryColumnStyle=function(){return"search_secondaryColumn"};B.prototype.getCellElement=function(a,b,c){var d;switch(a){case 0:return a=t("td"),b.type==="file"?(a.noWrap=!0,this._lastFileIconDom=d=z(null,this.getFileIconId(b),a,null),this.explorer.model._provideSearchHelper&&this.explorer.model._provideSearchHelper().params.keyword===""||this.getExpandImage(c,d)):(d=z(null,null,a,null),a.noWrap=!0,a.align="right",this.renderDetailLineNumber(b,d)),a;case 1:return a=t("td"),d=z(null,
this.getFileSpanId(b),a,null),b.type==="file"?(c=b.totalMatches?this.explorer.model.getFileName(b)+" ("+b.totalMatches+" matches)":this.explorer.model.getFileName(b),this.renderFileElement(b,d,c)):(this.renderDetailElement(b,c,d),b=z(null,this.getDetailIconId(b),d,null),b=z(null,null,b,null),b.classList.add("imageSprite"),b.classList.add("core-sprite-none")),a;case 2:return a=t("td"),b.type==="file"&&(d=z(null,this.getLocationSpanId(b),a,null),b.parentLocation&&this.renderLocationElement(b,d)),a}};
B.prototype.constructor=B;F.prototype=new a.SelectionRenderer;F.prototype.getCellHeaderElement=function(a){switch(a){case 0:a=t("th","search_report",null,null);a=t("h2",null,null,a);a.textContent=j["Files replaced"];break;case 1:a=t("th","search_report",null,null),a=t("h2",null,null,a),a.textContent=j.Status}};F.prototype.getCellElement=function(a,b){switch(a){case 0:var c=t("td","search_report",null,null),d=t("div",null,null,c),e=t("span","primaryColumn",null,d);n(document.createTextNode(b.model.fullPathName+
"/"+this.explorer.resultModel.getFileName(b.model)),e,"only");w(e,"click",function(){window.open(b.model.linkLocation)});w(e,"mouseover",function(){e.style.cursor="pointer"});w(e,"mouseout",function(){e.style.cursor="default"});d=t("span",null,null,d);d.classList.add("imageSprite");if(b.status)switch(b.status){case "warning":d.classList.add("core-sprite-warning");break;case "failed":d.classList.add("core-sprite-error");break;case "pass":d.classList.add("core-sprite-ok")}return c;case 1:if(b.status){switch(b.status){case "warning":c=
b.message;break;case "failed":c=b.message;break;case "pass":c=b.model.totalMatches?f.formatMessage(j["${0} out of ${1}  matches replaced."],b.matchesReplaced,b.model.totalMatches):b.message}d=t("td","search_report",null,null);d.textContent=c;return d}}};F.prototype.constructor=F;C.prototype=new a.Explorer;C.prototype.report=function(){this.createTree(this.parentId,new a.ExplorerFlatModel(null,null,this.reportList))};C.prototype.constructor=C;G.prototype={highlight:function(a,b,c){return this._syntaxHighlither.setup(b,
c.getTextView(),null,a,!1)}};x.prototype=new a.Explorer;x.prototype.onchange=function(){};x.prototype.setResult=function(a,b){var c=this;this.parentNode=a;this.model=b;this.model.replaceMode()?(this.checkbox=this._hasCheckedItems=!0,this.renderer=new B({checkbox:!0,highlightSelection:!1,getCheckedFunc:function(a){return c.getItemChecked(a)},onCheckedFunc:function(a,b,d){c.onRowChecked(a,b,d)}},c)):(this.checkbox=!1,this.renderer=new B({checkbox:!1,highlightSelection:!1},this));this._reporting=!1;
this._currentPreviewModel=this._uiFactory=null;this._currentReplacedContents={contents:null};this._popUpContext=!1;this.timerRunning-=0;this.twoWayCompareView=this._filterTimer=this._timer=null};x.prototype.declareCommands=function(){var b=this,d=new g.Command({name:j["Apply Changes"],tooltip:j["Replace all selected matches"],id:"orion.globalSearch.replaceAll",callback:function(){b.replaceAll()},visibleWhen:function(){return b.model&&b.model.replaceMode()&&!b._reporting&&b._hasCheckedItems}}),e=new g.Command({name:j["Hide Compare"],
tooltip:j["Hide compare view of changes"],id:"orion.globalSearch.hideCompare",callback:function(){b.toggleCompare(!1)},visibleWhen:function(){return b.model&&b.model.replaceMode()&&!b._reporting&&b._uiFactory}}),f=new g.Command({name:j["Show Compare"],tooltip:j["Show compare view of changes"],id:"orion.globalSearch.showCompare",callback:function(){b.toggleCompare(!0)},visibleWhen:function(){return b.model&&b.model.replaceMode()&&!b._reporting&&!b._uiFactory}});this._commandService.addCommand(e);this._commandService.addCommand(f);
this._commandService.addCommand(d);this._commandService.addCommandGroup("pageActions","orion.searchActions.unlabeled",200);this._commandService.registerCommandContribution("pageActions","orion.globalSearch.hideCompare",1,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions","orion.globalSearch.showCompare",2,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions","orion.globalSearch.replaceAll",3,"orion.searchActions.unlabeled");
var d=new g.Command({name:j["Show All"],tooltip:j["Show all the results in one page"],id:"orion.search.showAll",hrefCallback:function(){if(!this.model._provideSearchHelper)return null;var a=c.copySearchParams(this.model._provideSearchHelper().params,!0);a.start=0;a.rows=this.model.getPagingParams().totalNumber;return c.generateSearchHref(a)}.bind(this),visibleWhen:function(){var a=this.model.getPagingParams();return!this._crawling&&a.totalNumber>a.rows}.bind(this)}),e=new g.Command({name:j["< Previous Page"],
tooltip:j["Show previous page of search result"],id:"orion.search.prevPage",hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculatePrevPage(),d=c.copySearchParams(b.model._provideSearchHelper().params,!0);d.start=a.start;return c.generateSearchHref(d)},visibleWhen:function(){var a=b.caculatePrevPage();return!this._crawling&&a.start!==b.model.getPagingParams().start}.bind(this)}),f=new g.Command({name:j["Next Page >"],tooltip:j["Show next page of search result"],id:"orion.search.nextPage",
hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculateNextPage(),d=c.copySearchParams(b.model._provideSearchHelper().params,!0);d.start=a.start;return c.generateSearchHref(d)},visibleWhen:function(){var a=b.caculateNextPage();return!this._crawling&&a.start!==b.model.getPagingParams().start}.bind(this)}),h=new g.Command({tooltip:j["Next result"],imageClass:"core-sprite-move-down",id:"orion.search.nextResult",groupId:"orion.searchGroup",visibleWhen:function(){return!b._reporting},
callback:function(){b.gotoNext(!0,!0)}}),i=new g.Command({tooltip:j["Previous result"],imageClass:"core-sprite-move-up",id:"orion.search.prevResult",groupId:"orion.searchGroup",visibleWhen:function(){return!b._reporting},callback:function(){b.gotoNext(!1,!0)}});this._commandService.addCommand(d);this._commandService.addCommand(e);this._commandService.addCommand(f);this._commandService.addCommand(h);this._commandService.addCommand(i);a.createExplorerCommands(this._commandService,function(a){var c=
!1;b.model._provideSearchHelper&&b.model._provideSearchHelper().params.keyword===""&&(c=!0);return!a._reporting&&!c});this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.expandAll",1);this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.collapseAll",2);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextResult",3);this._commandService.registerCommandContribution("pageNavigationActions",
"orion.search.prevResult",4);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.showAll",5);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.prevPage",6);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextPage",7)};x.prototype._checkStale=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Checing file "+a.location+" for stale").then(function(b){if(this.model.staleCheck(b))a.stale=
!1}.bind(this),function(a){console.error("Error loading file contents: "+a.message);throw a;}.bind(this))};x.prototype.staleCheck=function(){var a=[];E(this.model).forEach(function(b){a.push(this._loadFileMetaData(b))}.bind(this));return h.all(a,function(a){return{_error:a}})};x.prototype._loadFileMetaData=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location,!0),"Getting file metadata "+a.location).then(function(b){a.fullPathName=c.fullPathNameByMeta(b.Parents);
a.parentLocation=b.Parents[0].Location;a.stale=a.lastModified!==b.LocalTimeStamp;a.ETag=b.ETag;if(a.stale)return this._checkStale(a).then(function(){this.renderer.staleFileElement(a)}.bind(this));else this._prepareFilter(a);return a}.bind(this),function(b){console.error("Error loading file metadata: status "+b.status);a.stale=!0;this.renderer.staleFileElement(a);throw b;}.bind(this))};x.prototype.setCrawling=function(a){this._crawling=a};x.prototype.preview=function(){var a=this;this._commandService.openParameterCollector("pageActions",
function(b){var c=t("input",null,"globalSearchReplaceWith",b);c.type="text";c.name="ReplaceWith:";c.placeholder="Replace With";c.onkeydown=function(b){if(b.keyCode===13)return b=d.node("globalSearchReplaceWith"),a._commandService.closeParameterCollector(),a._doPreview(b.value);if(b.keyCode===27)return a._commandService.closeParameterCollector(),!1};t("span","parameters","globalSearchReplaceCommands",b);return c});var b=document.getElementById("globalSearchReplaceWith");b.value=this.model.defaultReplaceStr;
window.setTimeout(function(){b.select();b.focus()},10);this._commandService.addCommand(new g.Command({name:"Preview Changes",image:k.toUrl("images/replaceAll.gif"),id:"orion.globalSearch.innerReplaceAll",groupId:"orion.searchGroup",callback:function(){var b=d.node("globalSearchReplaceWith");a._commandService.closeParameterCollector();return a._doPreview(b.value)}}));this._commandService.registerCommandContribution("globalSearchReplaceCommands","orion.globalSearch.innerReplaceAll",1);this._commandService.renderCommands("globalSearchReplaceCommands",
"globalSearchReplaceCommands",this,this,"button")};x.prototype._fileExpanded=function(a,b){var c=E(this.model)[a];if(b===null||b===void 0)return{childrenNumber:0,childDiv:d.node(this.model.getId(c))};return c.children&&c.children.length>0?(b<0?b=c.children.length-1:b>=c.children.length&&(b=0),{childrenNumber:c.children.length,childDiv:d.node(this.model.getId(c.children[b]))}):{childrenNumber:0,childDiv:null}};x.prototype._doPreview=function(a,b){if(this.model._provideSearchHelper){this.model._storeGlobalStatus&&
this.model._storeGlobalStatus(a);var d=c.copySearchParams(this.model._provideSearchHelper().params,!0);d.replace=a;if(b)d.start=0,d.rows=this.model.getPagingParams().totalNumber;d=c.generateSearchHref(d);window.location.href=d}};x.prototype.searchAgain=function(){if(this.model._provideSearchHelper){var a=c.copySearchParams(this.model._provideSearchHelper().params,!0);a.replace=null;if(a.rows>this.defaulRows)a.rows=this.defaulRows;a=c.generateSearchHref(a);a===window.location.href?window.location.reload():
window.location.href=a}};x.prototype.replaceAll=function(){var a=[],b=this;this._reporting=!0;this.initCommands();this.reportStatus(j["Writing files..."]);this.model.writeReplacedContents(a).then(function(){u(b.getParentDivId());(new C(b.getParentDivId(),a,b.model)).report();b.reportStatus("")})};x.prototype.toggleCompare=function(a){this.replacePreview(!1,a)};x.prototype.replacePreview=function(a,b){u(this.getParentDivId());b?(this._uiFactory=new l.SearchUIFactory({parentDivID:this.getParentDivId()}),
this._uiFactory.buildUI()):(this._uiFactory&&this._uiFactory.destroy(),this._uiFactory=null);this._currentPreviewModel=this.twoWayCompareView=null;this.initCommands();a&&this.reportStatus(j["Preparing preview..."]);var c=this;this.createTree(this._uiFactory?this._uiFactory.getMatchDivID():this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,onCollapse:function(a){c.onCollapse(a)}});a?(this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null),
this.reportStatus(""),!this._crawling&&this.model.staleCheck&&this.staleCheck().then(function(){c.refreshValidFiles()})):this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null)};x.prototype.getItemChecked=function(a){if(a.checked===void 0)a.checked=!0;return a.checked};x.prototype._checkedItem=function(){for(var a=E(this.model),b=0;b<a.length;b++){if(a[b].checked)return!0;if(a[b].children)for(var c=0;c<a[b].children.length;c++)if(a[b].children[c].checked)return!0}return!1};
x.prototype.onRowChecked=function(a,b,c){if(a){if((a=d.node(a))&&a._item)this.onItemChecked(a._item,b,c);a=this._checkedItem()}else a=b,this.onItemChecked(this.model.getListRoot(),b,c);if(a!==this._hasCheckedItems)this._hasCheckedItems=a,this.initCommands()};x.prototype.onNewContentChanged=function(a){a===D(this.getNavHandler().currentModel())&&this.buildPreview(!0)};x.prototype.onItemChecked=function(a,b,c){a.checked=b;if(a.type==="file"||a===this.model.getListRoot()){if(a.children)for(c=0;c<a.children.length;c++){var e=
d.node(this.renderer.getCheckBoxId(this.model.getId(a.children[c])));if(e)this.renderer.onCheck(null,e,b,!1);else a.children[c].checked=b}if(a.type==="file")this.onNewContentChanged(a)}else if(c)this.onNewContentChanged(a.parent)};x.prototype.buildPreview=function(a){if(this._uiFactory&&E(this.model).length!==0){var b=this._uiFactory,c=D(this.getNavHandler().currentModel());this._currentPreviewModel=c;var d=this;this.model.provideFileContent(c,function(c){if(d.model.onMatchNumberChanged)d.model.onMatchNumberChanged(c);
d.model.getReplacedFileContent(d._currentReplacedContents,a,c);var e=d._currentReplacedContents.contents;Array.isArray(e)&&(e=d._currentReplacedContents.contents.join(d._currentReplacedContents.lineDelim));var g=d.model.getFileName(c),h=d._contentTypeService.getFilenameContentType(g),c={readonly:!0,hasConflicts:!1,newFileOnRight:!0,oldFile:{Name:c.location,Type:h,Content:d.model.getFileContents(c)},newFile:{Name:c.location,Type:h,Content:e}};d.twoWayCompareView?(d.twoWayCompareView.setOptions(c),
d.twoWayCompareView.refresh(!0)):(d.uiFactoryCompare=new m.TwoWayCompareUIFactory({parentDivID:b.getCompareDivID(),showTitle:!0,rightTitle:f.formatMessage(j["Replaced File (${0})"],g),leftTitle:f.formatMessage(j["Original File (${0})"],g),showLineStatus:!1}),d.uiFactoryCompare.buildUI(),c.uiFactory=d.uiFactoryCompare,c.parentDivID=b.getCompareDivID(),d.twoWayCompareView=new p.TwoWayCompareView(c),d.twoWayCompareView.setOptions({highlighters:[new G(d.registry),new G(d.registry)]}),d.twoWayCompareView.startup(),
d._uiFactory.setCompareWidget(d.twoWayCompareView));u(d.uiFactoryCompare.getTitleDiv());n(document.createTextNode(f.formatMessage(j["Replaced File (${0})"],g)),d.uiFactoryCompare.getTitleDiv(),"only");u(d.uiFactoryCompare.getTitleDiv(!0));n(document.createTextNode(f.formatMessage(j["Original File (${0})"],g)),d.uiFactoryCompare.getTitleDiv(!0),"only");window.setTimeout(function(){d.renderer.focus()},100)})}};x.prototype.addSavedSearch=function(a,b){this.registry.getService("orion.core.savedSearches").addSearch(a,
b)};x.prototype.saveSearch=function(a){if(this.model._provideSearchHelper){var b=c.generateSearchHref(a).split("#")[1],d=b;typeof this.model._provideSearchHelper().displayedSearchTerm==="string"&&typeof a.resource==="string"?(d="'"+this.model._provideSearchHelper().displayedSearchTerm+"' in ",a.resource.length>0?this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.resource,!0),"Getting file metadata "+a.resource).then(function(a){var e=c.fullPathNameByMeta(a.Parents);this.addSavedSearch(d+
(e.length===0?a.Name:e+"/"+a.Name),b)}.bind(this),function(a){console.error("Error loading file meta data: "+a.message);this.addSavedSearch(d+"root",b)}.bind(this)):this.addSavedSearch(d+"root",b)):this.addSavedSearch(d,b)}};x.prototype.caculateNextPage=function(){var a=this.model.getPagingParams();return a.start+a.rows>=a.totalNumber?{start:a.start}:{start:a.start+a.rows}};x.prototype.caculatePrevPage=function(){var a=this.model.getPagingParams(),a=a.start-a.rows;a<0&&(a=0);return{start:a}};x.prototype.initCommands=
function(){this._commandService.destroy("pageActions");this._commandService.renderCommands("pageActions","pageActions",this,this,"button");this._commandService.destroy("pageNavigationActions");this._commandService.renderCommands("pageNavigationActions","pageNavigationActions",this,this,"button")};x.prototype.reportStatus=function(a){this.registry.getService("orion.page.message").setProgressMessage(a)};x.prototype.isExpanded=function(a){return this.myTree.isExpanded(this.model.getId(a))};x.prototype.popupContext=
function(a){if(this.contextTip)this.contextTip.destroy(),this.contextTip=null;var b=this.renderer.getDetailIconId(a),a=this.renderer.generateContextTip(a),b=d.node(b),c=["below","right"];if(b)for(var e=this.myTree._parent.getClientRects()[0],f=b.getClientRects(),g=0,h=f.length;g<h;g++)if(f[g].bottom+100>e.bottom){c=["above","right"];break}this.contextTip=new v.Tooltip({node:b,showDelay:0,trigger:"none",position:c});this.contextTip.contentContainer().appendChild(a);this.contextTip.show()};x.prototype.closeContextTip=
function(a){if(!this.model.replaceMode()){if(this.contextTip)this.contextTip.destroy(),this.contextTip=null;if(!a)this._popUpContext=!1;this.renderer.replaceDetailIcon(this.getNavHandler().currentModel(),"right")}};x.prototype.onCollapse=function(a){var b=this.getNavHandler().currentModel();b&&b.type==="detail"&&D(a)===a&&this.getNavHandler().cursorOn(a)};x.prototype.onExpand=function(a,b){if(a&&a.children&&a.children.length>0&&typeof b==="string"){var c=0,c=b==="first"?0:b==="last"?a.children.length-
1:JSON.parse(b);if(typeof c==="string"||c<0||c>=a.children.length)c=0;this.getNavHandler().cursorOn(a.children[c])}};x.prototype.forceExpandFunc=function(a,b,c){this.myTree.expand(a,function(){this.onExpand(a,b,c)}.bind(this));return null};x.prototype.keyEventListeningDiv=function(a){return d.node(this.getParentDivId(a))};x.prototype.onFocus=function(a){a||this.closeContextTip()};x.prototype.preventDefaultFunc=function(a,b){if(!b)return!0;if(!this.model.replaceMode()&&!a.ctrlKey&&b.type==="detail"){if(a.keyCode===
37&&this._popUpContext)return this.closeContextTip(),a.preventDefault(),!0;if(a.keyCode===39&&!this._popUpContext)return this._popUpContext=!0,this.renderer.replaceDetailIcon(b,"left"),this.popupContext(b),a.preventDefault(),!0}return!1};x.prototype.onReplaceCursorChanged=function(a,b){D(this._currentPreviewModel)===D(b)||this.buildPreview();if(b.type==="detail"){var c=this.model.getDetailInfo(b);this.twoWayCompareView.gotoDiff(c.lineNumber,c.matches[c.matchNumber].startIndex,!1)}};x.prototype.onCursorChanged=
function(a,b){this.renderer.replaceDetailIcon(a,"none");this.model.storeLocationStatus&&this.model.storeLocationStatus(b);var c=this;if(this.model.replaceMode()){if(this._uiFactory)if(this._timer){if(this.timerRunning)window.clearTimeOut(this._timer),this._timer=window.setTimeout(function(){c.onReplaceCursorChanged(a,b);c.timerRunning=!1;c._timer=null},500)}else this._timer=window.setTimeout(function(){c.onReplaceCursorChanged(a,b);c.timerRunning=!1;c._timer=null},500)}else b.type==="detail"?this._popUpContext?
(this.popupContext(b),this.renderer.replaceDetailIcon(b,"left")):this.renderer.replaceDetailIcon(b,"right"):this._popUpContext&&this.closeContextTip(!0)};x.prototype._prepareFilter=function(a){this._validateFilter()&&(a?this.model.getChildren(a,function(){}):E(this.model).forEach(function(a){this.model.getChildren(a,function(){})}.bind(this)))};x.prototype._validateFilter=function(){return!this.model.replaceMode()&&typeof this.model.filterOn==="function"};x.prototype._startUp=function(){var a=u("filterBox"),
b=this.model.getPagingParams();if(this.model._provideSearchHelper)window.document.title=this.model._provideSearchHelper().displayedSearchTerm+" - "+f.formatMessage(j["${0} matches"],b.totalNumber);if(b.numberOnPage===0){if(a)a.style.visibility="hidden";a=j["No matches"];this.model._provideSearchHelper&&(a=f.formatMessage(j["No matches found for ${0}"],this.model._provideSearchHelper().displayedSearchTerm));this.parentNode.textContent="";b=t("b",null,null,this.parentNode);n(document.createTextNode(a),
b,"only");this.reportStatus("")}else{var c=this;if(a&&this._validateFilter()){a.style.visibility="visible";var d=t("input",["search-control","search-filter-input"],null,a);d.type="text";d.placeholder=j["Type filter text"];d.addEventListener("input",function(){this._filterTimer&&window.clearTimeout(this._filterTimer);this._filterTimer=window.setTimeout(function(){this._filterTimer=null;this._renderFiltered(d.value)}.bind(this),1E3)}.bind(this))}this.model.buildResultModel();this.model.replaceMode()?
c.replacePreview(!0,!0):(this.initCommands(),u(this.getParentDivId()),this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,getChildrenFunc:function(a){return this.model.getFilteredChildren(a)}.bind(this),onCollapse:function(a){c.onCollapse(a)}}),this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null),this.reportStatus(""),!this._crawling&&this.model.staleCheck?this.staleCheck().then(function(){c.refreshValidFiles()}):c._prepareFilter())}};
x.prototype.startUp=function(){if(this._openWithCommands)this._startUp();else{var a=r.createOpenWithCommands(this.registry,this._contentTypeService,this._commandService);h.when(a,function(a){this._openWithCommands=a;this._startUp()}.bind(this))}};x.prototype._incrementalRender=function(){var a=this;this.model.buildResultModel();this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",getChildrenFunc:function(a){return this.model.getFilteredChildren(a)}.bind(this),indent:0,
onCollapse:function(b){a.onCollapse(b)}})};x.prototype.incrementalRender=function(){if(this._openWithCommands)this._incrementalRender();else{var a=r.createOpenWithCommands(this.registry,this._contentTypeService,this._commandService);h.when(a,function(a){this._openWithCommands=a;this._incrementalRender()}.bind(this))}};x.prototype._renderFiltered=function(a){this.model.filterOn(a);this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"singleSelection",indent:0,onCollapse:function(a){this.onCollapse(a)}.bind(this)});
a&&this.expandAll()};x.prototype.refreshValidFiles=function(){for(var a=[],b=D(this.getNavHandler().currentModel()),c=E(this.model),d=0;d<c.length;d++)c[d].stale?b===c[d]&&(b=null):a.push(c[d]);this.model.setValidFileList&&this.model.setValidFileList(a);E(this.model).length===0?(this.getNavHandler().refreshModel(this.getNavDict(),this.model,E(this.model)),this.getNavHandler().cursorOn(null,!0)):b?this.getNavHandler().refreshModel(this.getNavDict(),this.model,E(this.model),!0):(this.getNavHandler().cursorOn(null,
!0),this.getNavHandler().refreshModel(this.getNavDict(),this.model,E(this.model)),this.gotoCurrent())};x.prototype.getItemCount=function(){return this.model.getListRoot().children.length};x.prototype.getParentDivId=function(a){return!this.model.replaceMode()||!a?this.parentNode.id:this._uiFactory?this._uiFactory.getMatchDivID():this.parentNode.id};x.prototype.gotoCurrent=function(a){var b=null,c="none";a?(b=a.file,c=a.detail):b=this.getNavHandler().currentModel();b||(b=E(this.model).length>0?E(this.model)[0]:
null);this.getNavHandler().cursorOn(b,!0);b&&c&&c!=="none"&&this.myTree.expand(b,function(){this.onExpand(b,c)}.bind(this))};x.prototype.gotoNext=function(a,b){E(this.model).length!==0&&this.getNavHandler().iterate(a,b)};x.prototype.constructor=x;return{SearchResultExplorer:x}});
define("orion/searchModel","i18n!orion/search/nls/messages,require,orion/Deferred,orion/i18nUtil,orion/explorers/explorer,orion/searchUtils".split(","),function(j,k,h,d,b,f){function a(a,b,d,c,h,j){this.registry=a;this.fileClient=b;this._resultLocation=d;this._numberOnPage=d.length;this._totalNumber=c;this._listRoot={isRoot:!0,children:[]};this._filteredRoot={isRoot:!0,children:[]};this._filterText=null;this._indexedFileItems=[];this._location2ModelMap=[];this._lineDelimiter="\n";this.onMatchNumberChanged=
j.onMatchNumberChanged;this._searchHelper=f.generateSearchHelper(h)}a.prototype=new b.ExplorerModel;a.prototype.getRoot=function(a){a(this.getListRoot())};a.prototype.getChildren=function(a,b){a&&(a.type==="file"&&this._filterText?a.filteredChildren?b(a.filteredChildren):b([]):a.children?b(a.children):a.type==="detail"?b([]):a.type==="file"&&a.location?this._searchHelper.params.keyword!==""&&this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Getting file contents "+
a.name).then(function(d){f.searchWithinFile(this._searchHelper.inFileQuery,a,d,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);if(this.onMatchNumberChanged)this.onMatchNumberChanged(a);b(a.children)}.bind(this),function(a){console.error("Error loading file content: "+a.message);b([])}.bind(this)):b([]))};a.prototype.getId=function(a){a===this.getListRoot()?a=this.rootId:(a=a.location,a=a.replace(/[^\.\:\-\_0-9A-Za-z]/g,""));return a};a.prototype.getListRoot=function(){return this._filterText?
this._filteredRoot:this._listRoot};a.prototype.buildResultModel=function(){this._restoreGlobalStatus();this._indexedFileItems=[];this.getListRoot().children=[];for(var a=0;a<this._resultLocation.length;a++){var b={parent:this.getListRoot(),type:"file",name:this._resultLocation[a].name,lastModified:this._resultLocation[a].lastModified,linkLocation:this._resultLocation[a].linkLocation,location:this._resultLocation[a].location,parentLocation:f.path2FolderName(this._resultLocation[a].location,this._resultLocation[a].name,
!0),fullPathName:f.path2FolderName(this._resultLocation[a].path,this._resultLocation[a].name)};this._location2ModelMap[b.location]=b;this.getListRoot().children.push(b);this._indexedFileItems.push(b)}};a.prototype.replaceMode=function(){return typeof this._searchHelper.params.replace==="string"};a.prototype.getPagingParams=function(){return{totalNumber:this._totalNumber,start:this._searchHelper.params.start,rows:this._searchHelper.params.rows,numberOnPage:this._numberOnPage}};a.prototype.getScopingParams=
function(a){var b=f.copySearchParams(this._searchHelper.params,!0);b.resource=a.parentLocation;b.start=0;var b=f.generateSearchHref(b),g=d.formatMessage(j['Search again in this folder with "${0}"'],this._searchHelper.displayedSearchTerm);return{name:a.fullPathName,href:b,tooltip:g}};a.prototype.getDetailInfo=function(a){return{lineString:a.name,lineNumber:a.lineNumber-1,matches:a.matches,matchNumber:a.matchNumber?a.matchNumber-1:0}};a.prototype.getFileName=function(a){return a.name};a.prototype.provideFileContent=
function(a,b){this._provideFileContent(a).then(function(){b(a)})};a.prototype._provideFileContent=function(a){return a.contents?(new h).resolve(a):this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Getting file contents "+a.Name).then(function(b){f.searchWithinFile(this._searchHelper.inFileQuery,a,b,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);return a}.bind(this),function(b){console.error("Error loading file content: "+b.message);
return a}.bind(this))};a.prototype.getFileContents=function(a){return a.contents.join(this._lineDelimiter)};a.prototype.getReplacedFileContent=function(a,b,d){f.generateNewContents(b,d.contents,a,d,this._searchHelper.params.replace,this._searchHelper.inFileQuery.searchStrLength);a.lineDelim=this._lineDelimiter};a.prototype.writeReplacedContents=function(a){var b=[];this.getValidFileList().forEach(function(d){b.push(this._writeOneFile(d,a))}.bind(this));return h.all(b,function(a){return{_error:a}})};
a.prototype.getHeaderString=function(){var a=j.Results;if(this._searchHelper.displayedSearchTerm){var b=this.getPagingParams();if(b.numberOnPage>0)var a=b.start+1,f=a+b.numberOnPage-1,a=this.replaceMode()?d.formatMessage(j["Replace ${0} with ${1} for files ${2} of ${3}"],this._searchHelper.displayedSearchTerm,this._searchHelper.params.replace,a+"-"+f,b.totalNumber):d.formatMessage(j["Files ${0} of ${1} matching ${2}"],a+"-"+f,b.totalNumber,this._searchHelper.displayedSearchTerm)}return a};a.prototype.getValidFileList=
function(){return this._indexedFileItems};a.prototype.setValidFileList=function(a){this._indexedFileItems=a};a.prototype.storeLocationStatus=function(a){if(a){var b;b=a?a.type==="file"?a:a.parent:null;if(b)window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentFileLocation"]=b.location,window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"]=a.type==="file"?"none":JSON.stringify(this._model2Index(a))}};a.prototype.restoreLocationStatus=function(){var a=
this._location2Model(window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentFileLocation"]),b="none",d=window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"];typeof d==="string"&&d.length>0&&(b=d);return{file:a,detail:b}};a.prototype.staleCheck=function(a){a=a.toLowerCase();return this._searchHelper.inFileQuery.wildCard?f.searchOnelineRegEx(this._searchHelper.inFileQuery,a,!0):f.searchOnelineLiteral(this._searchHelper.inFileQuery,a,!0)};
a.prototype.filterOn=function(a){if(this._filterText=a){var b=this._filterText.toLowerCase();this._filteredRoot.children=[];this._indexedFileItems.forEach(function(a){var c=!1;if(this._filterSingleString(a.name,b)||this._filterSingleString(a.fullPathName,b))c=!0;if(a.children)a.filteredChildren=[],a.children.forEach(function(d){this._filterSingleString(d.name,b)&&(a.filteredChildren.push(d),c=!0)}.bind(this));c&&this._filteredRoot.children.push(a)}.bind(this))}};a.prototype.getFilteredChildren=function(a){if(a.type===
"file"&&this._filterText&&a.filteredChildren)return a.filteredChildren;else if(a.isRoot&&this._filterText)return this._filteredRoot.children;return a.children};a.prototype._provideSearchHelper=function(){return this._searchHelper};a.prototype._filterSingleString=function(a,b){return a.toLowerCase().indexOf(b)>=0};a.prototype._model2Index=function(a,b){var d=b;if(!d&&a.parent)d=a.parent.children;if(d)for(var c=0;c<d.length;c++)if(d[c]===a)return c;return-1};a.prototype._location2Model=function(a){return a&&
this._location2ModelMap[a]?this._location2ModelMap[a]:this._indexedFileItems.length>0?this._indexedFileItems[0]:null};a.prototype._restoreGlobalStatus=function(){this.defaultReplaceStr=this._searchHelper.displayedSearchTerm;var a=window.sessionStorage.global_search_default_replace_string;if(typeof a==="string"&&a.length>0)this.defaultReplaceStr=a;this.sortByName=this._provideSearchHelper().params.sort.indexOf("Name")>-1};a.prototype._storeGlobalStatus=function(a){window.sessionStorage.global_search_default_replace_string=
a};a.prototype._writeOneFile=function(a,b){var d=this._matchesReplaced(a);return d>0?this._provideFileContent(a).then(function(){d=this._matchesReplaced(a);var c={};f.generateNewContents(!1,a.contents,c,a,this._searchHelper.params.replace,this._searchHelper.inFileQuery.searchStrLength);var c=c.contents.join(this._lineDelimiter),h=a.ETag,h=h?{ETag:h}:null;return this.registry.getService("orion.page.progress").progress(this.fileClient.write(a.location,c,h),"Saving changes to "+a.location).then(function(){b.push({model:a,
matchesReplaced:d,status:"pass"})}.bind(this),function(c){c.status===412?b.push({model:a,message:j["Resource has been changed by others."],matchesReplaced:d,status:"failed"}):(c.log=!0,b.push({model:a,message:j["Failed to write file."],matchesReplaced:d,status:"failed"}))}.bind(this))}.bind(this)):(new h).resolve(a)};a.prototype._matchesReplaced=function(a){var b=0;if(!a.children)return a.checked===!1?0:1;if(a.children)for(var d=0;d<a.children.length;d++)a.children[d].checked!==!1&&(b+=1);return b};
a.prototype.constructor=a;return{SearchResultModel:a}});
define("orion/searchResults","i18n!orion/search/nls/messages,orion/i18nUtil,require,orion/webui/littlelib,orion/searchExplorer,orion/searchModel,orion/searchUtils,orion/crawler/searchCrawler".split(","),function(j,k,h,d,b,f,a,e){function i(a,c,d,e,f,h){this.registry=a;this.fileService=e;this.resultsId=c;this.commandService=d;this.searcher=f;this.crawling=h;this.explorer=new b.SearchResultExplorer(this.registry,this.commandService)}i.prototype={_renderSearchResult:function(a,b,e,i,j){var k=!1,q=[];
d.empty(d.node(b));if(i.response.numFound>0)for(var v=0;v<i.response.docs.length;v++){var s=i.response.docs[v];if(!s.Directory){k||(k=!0);var r=s.Location;q.push({linkLocation:h.toUrl("edit/edit.html")+"#"+r,location:r,path:s.Path?s.Path:r,name:s.Name,lastModified:s.LastModified})}}this.explorer.setCrawling(a);var u=this,a=new f.SearchResultModel(this.registry,this.explorer.fileClient,q,i.response.numFound,e,{onMatchNumberChanged:function(a){u.explorer.renderer.replaceFileElement(a)}});this.explorer.setResult(b,
a);j?this.explorer.incrementalRender():this.explorer.startUp()},_search:function(a,b){this.crawling=b.regEx||b.caseSensitive;var f=d.node(this.resultsId),h=this;d.empty(d.node("pageNavigationActions"));d.empty(d.node("pageActions"));if(typeof b.keyword==="undefined")d.empty(f);else if(this.crawling)d.empty(f),f.appendChild(document.createTextNode("")),f=new e.SearchCrawler(this.registry,this.fileService,b,{childrenLocation:this.searcher.getChildrenLocation()}),f.search(function(d,e){h._renderSearchResult(!0,
a,b,d,e)});else{d.empty(f);this.registry.getService("orion.page.message").setProgressMessage(j["Searching..."]);try{this.registry.getService("orion.page.progress").progress(this.fileService.search(b),"Searching "+b.keyword).then(function(d){this.registry.getService("orion.page.message").setProgressMessage("");this._renderSearchResult(!1,a,b,d)}.bind(this),function(a){a=k.formatMessage(j["${0}. Try your search again."],a&&a.error?a.error:"Error");this.registry.getService("orion.page.message").setProgressResult({Message:a,
Severity:"Error"})}.bind(this))}catch(i){d.empty(f),f.appendChild(document.createTextNode("")),typeof i==="string"&&i.indexOf("search")>-1?(f=new e.SearchCrawler(this.registry,this.fileService,b,{childrenLocation:this.searcher.getChildrenLocation()}),f.search(function(d,e){h._renderSearchResult(!0,a,b,d,e)})):this.registry.getService("orion.page.message").setErrorMessage(i)}}},loadResults:function(a){this._search(d.node(this.resultsId),a)}};i.prototype.constructor=i;return{SearchResultsGenerator:i}});
define('built-search.js',"i18n!orion/search/nls/messages,require,orion/browserCompatibility,orion/bootstrap,orion/status,orion/progress,orion/dialogs,orion/commandRegistry,orion/searchOutliner,orion/searchClient,orion/fileClient,orion/operationsClient,orion/searchResults,orion/globalCommands,orion/contentTypes,orion/searchUtils,orion/PageUtil,orion/webui/littlelib".split(","),function(j,k,h,d,b,f,a,e,i,g,c,l,m,p,o,q,v,s){function r(a,b,c,d,e){a=!c||c===""||c==="root"?e.getSearchRootLocation():c;d=q.copySearchParams(d);
d.resource=a;b.href=q.generateSearchHref(d)}function u(a,b,c,d,e,f,g,h){var i=g.resource,k=g.replace?j["Replace All Matches"]:j["Search Results"];i?i===b.fileServiceRootURL(i)?(d.setRootLocationbyURL(i),d.setLocationbyURL(i),p.setPageTarget({task:"Search",title:k,serviceRegistry:a,commandService:c,searchService:d,fileService:b,breadcrumbRootName:b.fileServiceName(i),makeBreadcrumbLink:function(a,c){r(b,a,c,g,d)}}),d.setChildrenLocationbyURL(i),f.loadSearchParams(g),e.loadResults(g)):(h?h.progress(b.read(i,
!0),"Loading file metadata "+i):b.read(i,!0)).then(function(h){p.setPageTarget({task:"Search",title:k,target:h,serviceRegistry:a,fileService:b,commandService:c,searchService:d,breadcrumbRootName:"Search",makeBreadcrumbLink:function(a,c){r(b,a,c,g,d)}});f.loadSearchParams(g);e.loadResults(g)}.bind(this),function(a){window.console.error("Error loading file metadata: "+a.message)}.bind(this)):(p.setPageTarget({task:"Search",title:k,serviceRegistry:a,commandService:c,searchService:d,fileService:b,breadcrumbRootName:"Search",
makeBreadcrumbLink:function(a,c){r(b,a,c,g,d)}}),f.loadSearchParams(g),e.loadResults(g))}d.startup().then(function(d){var h=d.serviceRegistry,d=d.preferences;new a.DialogService(h);var j=new l.OperationsClient(h);new b.StatusReportingService(h,j,"statusPane","notifications","notificationArea");var k=new e.CommandRegistry({}),r=new f.ProgressService(h,j,k);new i.SavedSearches({serviceRegistry:h});var D=new c.FileClient(h);new o.ContentTypeRegistry(h);var E=new g.Searcher({serviceRegistry:h,commandService:k,
fileService:D});new i.SearchOutliner({parent:"searchProgress",serviceRegistry:h,commandService:k});var B=new i.SearchBuilder({parent:"searchBuilder",searcher:E,serviceRegistry:h,commandService:k});p.generateBanner("orion-searchResults",h,k,d,E,E,null,!1);var F=new m.SearchResultsGenerator(h,"results",k,D,E,!1),C=function(){var a=s.node("filterBox");a&&s.empty(a);a=v.matchResourceParameters();q.convertSearchParams(a);u(h,D,k,E,F,B,a,r);if(a=document.getElementById("pageActions"))k.destroy(a),k.renderCommands(a.id,
a,E,E,"button")};window.addEventListener("hashchange",function(){C()},!0);C()})});