/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 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) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/**
 * @license RequireJS i18n 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/requirejs 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) 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). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @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
 * 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). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @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, 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) 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) 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). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 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 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.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). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 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: 
 *		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) 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) 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: Anton McConville - 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) 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) 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). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @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 1.0.7 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/requirejs for details
 */
/*******************************************************************************
 * @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). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @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) 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) 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, 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). 
 * 
 ******************************************************************************/
/*******************************************************************************
 * @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, 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, 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
 *		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) 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) 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, 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, 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) 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) 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: 
 *		Anton McConville (IBM Corporation) - initial API and implementation
 *		Felipe Heidrich (IBM Corporation) - initial API and implementation 
 ******************************************************************************/
/******************************************************************************* 
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2011, 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, 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) 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, 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, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 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, 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) 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,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, 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) 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
 *     Andy Clement (vmware) - bug 344614
 *******************************************************************************/
/*******************************************************************************
 * @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, 2012 IBM Corporation and others. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 * 
 * Contributors: 
 *	IBM Corporation - initial API and implementation
 *	Adrian Aichner - regular expression capture group support in replace
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 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
 * 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) 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, 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) 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 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.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: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 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) 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). 


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


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

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

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

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

 Copyright (c) 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). 


 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
 RequireJS text 1.0.7 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs 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) 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) 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) 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 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (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: 
 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) 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
 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: 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, 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
 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: 
 Anton McConville (IBM Corporation) - initial API and implementation
 Felipe Heidrich (IBM Corporation) - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 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) 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) 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) 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,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) 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
 Andy Clement (vmware) - bug 344614

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

 Contributors: IBM Corporation - initial API and implementation

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

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

 Copyright (c) 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) 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) 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 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/jrburke/requirejs for details

 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 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.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
*/
(function(j,l){typeof define==="function"&&define.amd?define("orion/Deferred",[],l):typeof exports==="object"?module.exports=l():(j.orion=j.orion||{},j.orion.Deferred=l())})(this,function(){function j(){for(var b;b=e.shift()||d.shift();)b();c=!1}function l(b,h){(h?d:e).push(b);c||(c=!0,h?setTimeout(j,0):j())}function i(b){return function(){b.apply(null,arguments)}}function a(){}function f(){var b=Error("Cancel");b.name="Cancel";return b}function g(){function b(){for(var b;b=d.shift();){var k=b.deferred,
p=c==="resolved"?"resolve":"reject";if(typeof b[p]==="function")try{var n=b[p](h);n&&typeof n.then==="function"?(k.cancel=n.cancel||a,n.then(i(k.resolve),i(k.reject),k.progress)):k.resolve(n)}catch(u){k.reject(u)}else k[p](h)}}var h,c,d=[],e=this;this.reject=function(a){c||(c="rejected",h=a,d.length&&l(b));return e.promise};this.resolve=function(a){c||(c="resolved",h=a,d.length&&l(b));return e.promise};this.progress=function(b){c||d.forEach(function(k){k.progress&&k.progress(b)});return e.promise};
this.cancel=function(){c||e.reject(f())};this.then=function(h,k,p){var h={resolve:h,reject:k,progress:p,deferred:new g},n=h.deferred,u=this.cancel.bind(this),a=function(){l(function(){(n.cancel===a?u:n.cancel)()},!0)};n.cancel=a;k=n.promise;k.cancel=function(){n.cancel()};d.push(h);c&&l(b,!0);return k};this.promise={then:this.then,cancel:this.cancel}}var e=[],d=[],c=!1;g.all=function(b,h){function c(b,h){k||(e[b]=h,--d===0&&p.resolve(e))}function a(b,u){if(!k){if(h)try{c(b,h(u));return}catch(d){u=
d}p.reject(u)}}var d=b.length,e=[],k=!1,p=new g;p.then(null,function(){k=!0;b.forEach(function(k){k.cancel&&k.cancel()})});d===0?p.resolve(e):b.forEach(function(k,b){k.then(c.bind(null,b),a.bind(null,b))});return p.promise};g.when=function(b,h,c,a){var d;if(!(b&&typeof b.then==="function"))d=new g,d.resolve(b),b=d.promise;return b.then(h,c,a)};return g});
define("orion/EventTarget",[],function(){function j(){this._namedListeners={}}j.prototype={dispatchEvent:function(j){if(!j.type)throw Error("unspecified type");var i=this._namedListeners[j.type];i&&i.forEach(function(a){try{typeof a==="function"?a(j):a.handleEvent(j)}catch(f){typeof console!=="undefined"&&console.log(f)}});return!j.defaultPrevented},addEventListener:function(j,i){if(typeof i==="function"||i.handleEvent)this._namedListeners[j]=this._namedListeners[j]||[],this._namedListeners[j].push(i)},
removeEventListener:function(j,i){var a=this._namedListeners[j];if(a)for(var f=0;f<a.length;f++)if(a[f]===i){a.length===1?delete this._namedListeners[j]:a.splice(f,1);break}}};j.prototype.constructor=j;j.attach=function(l){var i=new j;l.dispatchEvent=i.dispatchEvent.bind(i);l.addEventListener=i.addEventListener.bind(i);l.removeEventListener=i.removeEventListener.bind(i)};return j});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(j,l){function i(a,c,b){this._properties=b||{};this._properties["service.id"]=a;this._properties.objectClass=c;this._properties["service.names"]=c}function a(a,c,b){this._serviceId=a;this._serviceReference=c;this._internalRegistry=b}function f(a,c){function b(b){return function(){var h;try{if(!c())throw Error("Service was unregistered");var e=a[b].apply(a,Array.prototype.slice.call(arguments));if(e&&typeof e.then==="function")return e;
else h=new j,h.resolve(e)}catch(f){h=new j,h.reject(f)}return h.promise}}for(var h in a)typeof a[h]==="function"&&(this[h]=b(h))}function g(a,c){this.type=a;this.serviceReference=c}function e(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new l;var a=this;this._internalRegistry={isRegistered:function(c){return a._entries[c]?!0:!1},unregisterService:function(c){var b=a._entries[c];if(!b)throw Error("already unregistered");var h=b.reference;a._serviceEventTarget.dispatchEvent(new g("unregistering",
h));a._entries[c]=null;h.getProperty("objectClass").forEach(function(b){for(var c=a._namedReferences[b],e=0;e<c.length;e++)if(c[e]===h){c.length===1?delete a._namedReferences[b]:c.splice(e,1);break}})},modifyService:function(c){c=a._entries[c];if(!c)throw Error("already unregistered");a._serviceEventTarget.dispatchEvent(new g("modified",c.reference))}}}i.prototype={getPropertyKeys:function(){var a=[],c;for(c in this._properties)this._properties.hasOwnProperty(c)&&a.push(c);return a},getProperty:function(a){return this._properties[a]}};
i.prototype.constructor=i;a.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("already unregistered");return this._serviceReference},setProperties:function(a){var c=this._serviceReference._properties;this._serviceReference._properties=a||{};a["service.id"]=this._serviceId;a.objectClass=c.objectClass;a["service.names"]=c["service.names"];this._internalRegistry.modifyService(this._serviceId)}};
a.prototype.constructor=a;e.prototype={getService:function(a){var c;if(typeof a==="string")(a=this._namedReferences[a])&&a.some(function(b){c=this._entries[b.getProperty("service.id")].service;return!!c},this);else if(a=this._entries[a.getProperty("service.id")])c=a.service;return c||null},getServiceReferences:function(a){if(a)return this._namedReferences[a]?this._namedReferences[a]:[];var c=[];this._entries.forEach(function(b){b&&c.push(b.reference)});return c},registerService:function(d,c,b){if(typeof c===
"undefined"||c===null)throw Error("invalid service");typeof d==="string"?d=[d]:Array.isArray(d)||(d=[]);var h=this._entries.length,m=new i(h,d,b),e=this._namedReferences;d.forEach(function(b){e[b]=e[b]||[];e[b].push(m)});d=new f(c,this._internalRegistry.isRegistered.bind(null,h));this._entries.push({reference:m,service:d});d=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new g("registered",m));return new a(h,m,d)},addEventListener:function(a,c){this._serviceEventTarget.addEventListener(a,
c)},removeEventListener:function(a,c){this._serviceEventTarget.removeEventListener(a,c)}};e.prototype.constructor=e;return{ServiceRegistry:e}});
define("orion/xhr",["orion/Deferred"],function(j){function l(i,a,f,g){var e=typeof f.response!=="undefined"?f.response:f.responseText,d;try{d=f.status}catch(c){d=0}i={args:a,response:e,responseText:typeof e==="string"?e:null,status:d,url:i,xhr:f};if(typeof g!=="undefined")i.error=g;return i}return function(i,a,f){var f=f||{},g=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,e=new j,d=f.headers||{},c=f.log||!1,b;typeof d["X-Requested-With"]==="undefined"&&(d["X-Requested-With"]="XMLHttpRequest");
if(typeof f.data!=="undefined"&&(i==="POST"||i==="PUT"))b=f.data;if(typeof f.responseType==="string")g.responseType=f.responseType;g.onprogress=function(b){b.xhr=g;e.progress(b)};g.onreadystatechange=function(){if(g.readyState===4){var b=l(a,f,g),h=g.status;200<=h&&h<400?e.resolve(b):(c&&typeof console!=="undefined"&&console.log(Error(g.statusText)),e.reject(b))}};try{g.open(i,a,!0);if(typeof f.timeout==="number")if(typeof g.timeout==="number")g.timeout=f.timeout,g.addEventListener("timeout",function(){e.reject(l(a,
f,g,"Timeout exceeded"))});else{var h=setTimeout(function(){e.reject(l(a,f,g,"Timeout exceeded"))},f.timeout);e.then(clearTimeout.bind(null,h),clearTimeout.bind(null,h))}Object.keys(d).forEach(function(b){g.setRequestHeader(b,d[b])});g.send(b)}catch(m){e.reject(l(a,f,g,m))}return e.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(j,l,i){function a(b,h){this._name=b;this._providers=h;this._flushPending=!1;this._cached=null;this._stores=[];this._dirty=[]}function f(b,h){return{get:function(a,c){if(h===0)return null;var d=localStorage.getItem(b+a);if(d===null)return null;d=JSON.parse(d);return c||h===-1||d._expires&&d._expires>(new Date).getTime()?(delete d._expires,d):null},set:function(a,c){if(h!==0){if(h!==-1)c._expires=(new Date).getTime()+1E3*h;
if(Object.keys(c).length===0)localStorage.removeItem(b+a);else{var d=JSON.stringify(c);localStorage.setItem(b+a,d);delete c._expires}}},remove:function(h){localStorage.removeItem(b+h)}}}function g(b){this._currentPromises={};this._cache=new f("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var h=b.getServiceReferences("orion.core.preference.provider");if(h.length>0)this._service=b.getService(h[0])}return!!this._service}}function e(b){this._location=
b;this._currentPromise=null;this._cache=new f("/orion/preferences/default",3600)}function d(){this._cache=new f("/orion/preferences/local",-1)}function c(b,h){this._userProvider=new g(b);this._localProvider=new d;h=h||"defaults.pref";h.indexOf("://")===-1&&(h=j.toUrl(h));this._defaultsProvider=new e(h);this._serviceRegistration=b.registerService("orion.core.preference",this)}a.prototype={_flush:function(){for(var b=[],h=0;h<this._stores.length;++h){var a=this._stores[h];this._dirty.indexOf(a)!==-1&&
b.push(this._providers[h].put(this._name,a))}this._dirty=[];return l.all(b)},_scheduleFlush:function(b){this._dirty.indexOf(b)===-1&&this._dirty.push(b);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 b=0;b<this._stores.length;++b){var h=this._stores[b],a;for(a in h)h.hasOwnProperty(a)&&typeof this._cached[a]==="undefined"&&(this._cached[a]=
h[a])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(b){return this._getCached()[b]},put:function(b,h){if(this._stores.length!==0){var a=this._stores[0];if(a[b]!==h)a[b]=h,this._cached=null,this._scheduleFlush(a)}},remove:function(b){for(var h=0;h<this._stores.length;++h){var a=this._stores[h];if(a.hasOwnProperty(b))return delete a[b],this._cached=null,this._scheduleFlush(a),!0}return!1},clear:function(){for(var b=0;b<this._stores.length;++b)this._stores[b]=
{},this._scheduleFlush(this._stores[b]);this._cached=null},sync:function(b){if(this._flushPending)return this._flushPending=!1,this._flush();for(var h=this,a=[],c=0;c<this._providers.length;++c)a.push(this._providers[c].get(this._name,b).then(function(b){return function(a){h._stores[b]=a}}(c)));return l.all(a).then(function(){h._cached=null;h._getCached()})},flush:function(){this._flush()}};g.prototype={get:function(b,h){if(this._currentPromises[b])return this._currentPromises[b];var a=new l,c=null;
h?this._cache.remove(b):c=this._cache.get(b);if(c!==null)a.resolve(c);else{this._currentPromises[b]=a;var d=this;this._service.get(b).then(function(h){d._cache.set(b,h);delete d._currentPromises[b];a.resolve(h)},function(h){h.status===404?(h={},d._cache.set(b,h),delete d._currentPromises[b],a.resolve(h)):(delete d._currentPromises[b],a.resolve(d._cache.get(b,!0)||{}))})}return a},put:function(b,h){this._cache.set(b,h);return this._service.put(b,h)}};e.prototype={get:function(b,h){if(this._currentPromise)return this._currentPromise;
var a=new l,c=null;h?this._cache.remove(b):c=this._cache.get(b);if(c!==null)a.resolve(c);else{this._currentPromise=a;var d=this;i("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(h){h=JSON.parse(h.response);d._cache.set(b,h[b]||{});d._currentPromise=null;a.resolve(h[b]||{})},function(h){h.xhr.status===401||h.xhr.status===404?(d._cache.set(b,{}),d._currentPromise=null,a.resolve({})):(d._currentPromise=null,h=d._cache.get(b,!0),h!==null?a.resolve(h[b]||{}):a.resolve({}))})}return a},
put:function(){var b=new l;b.resolve();return b}};d.prototype={get:function(b){var h=new l,b=this._cache.get(b);b!==null?h.resolve(b):h.resolve({});return h},put:function(b,h){var a=new l;this._cache.set(b,h);a.resolve();return a}};c.DEFAULT_SCOPE=1;c.LOCAL_SCOPE=2;c.USER_SCOPE=4;c.prototype={listenForChangedSettings:function(b){window.addEventListener("storage",b,!1);return"/orion/preferences/local/settings"},getPreferences:function(b,h){if(!h||typeof h!=="number"||h>7||h<1)h=c.DEFAULT_SCOPE|c.LOCAL_SCOPE|
c.USER_SCOPE;var d=[];c.USER_SCOPE&h&&this._userProvider.available()&&d.push(this._userProvider);c.LOCAL_SCOPE&h&&d.push(this._localProvider);c.DEFAULT_SCOPE&h&&d.push(this._defaultsProvider);var e=new a(b,d);return e.sync().then(function(){return e})},getSetting:function(b,h,a){for(var c,d=0;d<b.length;d++)if(b[d].label===h)for(var e=0;e<b[d].data.length;e++)if(b[d].data[e].label===a){c=b[d].data[e].value;break}return c}};return{PreferencesService:c}});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget"],function(j,l){function i(a,b){var h=Object.keys(a),d=Object.keys(b);if(h.length!==d.length)return!1;h.sort();d.sort();for(var e=0,f=h.length;e<f;e++){var g=h[e];if(g!==d[e])return!1;var k=a[g],g=b[g];if(k!==g&&JSON.stringify(k)!==JSON.stringify(g))return!1}return!0}function a(a){if(a.indexOf("://")===-1){var b=document.createElement("a");b.href=a;return b.href}return a}function f(a){var b=null;return{key:function(h){return(b=b||
Object.keys(a))[h]},getItem:function(b){return a[b]},setItem:function(h,d){a[h]=d;b=null},removeItem:function(h){delete a[h];b=null},clear:function(){(b=b||Object.keys(a)).forEach(function(b){delete a[b]}.bind(this));b=null}}}function g(a,b){return{type:a,plugin:b}}function e(a,b,h){function d(k,b,n){if(!B)return(new j).reject(Error("plugin not connected"));var a=y++,p=new j;p.then(null,function(k){z==="active"&&k instanceof Error&&k.name==="Cancel"&&h.postMessage({id:a,cancel:k.message||"Cancel"},
B)});H[String(a)]=p;h.postMessage({id:a,serviceId:k,method:b,params:n},B);return p.promise}function e(k){var b={};if(k.methods&&(k.methods.forEach(function(a){b[a]=function(){var b=Array.prototype.slice.call(arguments);return z==="active"?d(k.serviceId,a,b):n.start({"transient":!0}).then(function(){return d(k.serviceId,a,b)})}}),b.addEventListener&&b.removeEventListener)){var a=new l;b.dispatchEvent=a.dispatchEvent.bind(a);var p=b.addEventListener;b.addEventListener=function(k,b){a._namedListeners[k]||
p(k);a.addEventListener(k,b)};var h=b.removeEventListener;b.removeEventListener=function(k,b){a.removeEventListener(k,b);a._namedListeners[k]&&h(k)}}return b}function f(k){var b=JSON.parse(JSON.stringify(k.properties));b.__plugin__=a;k=k.names||k.type||[];Array.isArray(k)||(k=[k]);b.objectClass=k;return b}function q(k){var b=e(k),n=f(k),n=h.registerService(k.names||k.type,b,n);F[k.serviceId]={registration:n,proxy:b}}function k(){h.persist(a,{created:u,headers:s,services:w,autostart:v,lastModified:x})}
function p(k){var b;try{if(k.method)if("manifest"===k.method||"plugin"===k.method){var a=k.params[0];A({headers:a.headers,services:a.services}).then(function(){D.resolve(n)})}else if("dispatchEvent"===k.method){var p=F[k.serviceId].proxy;p.dispatchEvent.apply(p,k.params)}else if("progress"===k.method)b=H[String(k.requestId)],b.progress.apply(b,k.params);else if("timeout"===k.method)D&&D.reject(k.error);else throw Error("Bad response method: "+k.method);else if(b=H[String(k.id)],delete H[String(k.id)],
k.error){var u=h.handleServiceError(n,k.error);b.reject(u)}else b.resolve(k.result)}catch(c){console.log("Plugin._responseHandler "+c)}}var n=this,b=b||{},u=b.created||(new Date).getTime(),s=b.headers||{},w=b.services||[],v=b.autostart,x=b.lastModified||0,z="installed",t,D,B,F={},y=0,H={},A;this._persist=k;this._resolve=function(){z="resolved";h.dispatchEvent(new g("resolved",n))};this._getAutostart=function(){return v};this._getCreated=function(){return u};this.getLocation=function(){return a};this.getHeaders=
function(){return JSON.parse(JSON.stringify(s))};this.getName=function(){var k=this.getHeaders();return k?k.name||"":null};this.getVersion=function(){var k=this.getHeaders();return k?k.version||"0.0.0":null};this.getLastModified=function(){return x};this.getServiceReferences=function(){var k=[];Object.keys(F).forEach(function(b){k.push(F[b].registration.getReference())});return k};this.getState=function(){return z};this.start=function(b){if(z==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));
if(t)return t.promise.then(this.start.bind(this,b));if(z==="active")return(new j).resolve();if(!b||!b["transient"]){var u=b&&b.lazy?"lazy":"started";u!==v&&(v=u,k())}u=h.getState();if(u!=="starting"&&u!=="active")return b["transient"]?(new j).reject(Error("start transient error")):(new j).resolve();if(z==="installed")try{this._resolve()}catch(d){return(new j).reject(d)}z==="resolved"&&w.forEach(function(k){q(k)});if(b&&b.lazy)return z!=="starting"&&(z="starting",h.dispatchEvent(new g("lazy activation",
n))),(new j).resolve();var m=new j;t=m;z="starting";h.dispatchEvent(new g("starting",n));D=new j;B=h.connect(a,p);D.then(function(){D=null;z="active";h.dispatchEvent(new g("started",n));t=null;m.resolve()},function(){D=null;z="stopping";h.dispatchEvent(new g("stopping",n));Object.keys(F).forEach(function(k){F[k].registration.unregister();delete F[k]});h.disconnect(B);B=null;z="resolved";t=null;h.dispatchEvent(new g("stopped",n));m.reject(Error("plugin activation error"))});return m.promise};this.stop=
function(b){if(z==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(t)return t.promise.then(this.stop.bind(this,b));if((!b||!b["transient"])&&"stopped"!==v)v="stopped",k();if(z!=="active"&&z!=="starting")return(new j).resolve();t=b=new j;z="stopping";h.dispatchEvent(new g("stopping",n));Object.keys(F).forEach(function(k){F[k].registration.unregister();delete F[k]});B&&(h.disconnect(B),B=null);z="resolved";t=null;h.dispatchEvent(new g("stopped",n));b.resolve();return b.promise};
A=function(b){if(z==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(!b)return x===0&&(x=(new Date).getTime(),k()),h.loadManifest(a).then(A);var u=s,d=w,m=v;s=b.headers||{};w=b.services||{};v=b.autostart||v;b.lastModified?x=b.lastModified:(x=(new Date).getTime(),k());if(i(s,u)&&i(w,d)&&v===m)return(new j).resolve();if(z==="active"||z==="starting"){var e=[];Object.keys(w).forEach(function(k){var b=w[k];e.push(k);var n=F[k];if(n){if(i(b.methods,Object.keys(n.proxy))){var k=f(b),
a=n.registration.getReference(),p={};a.getPropertyKeys().forEach(function(k){p[k]=a.getProperty(k)});i(k,p)||n.registration.setProperties(k);return}n.registration.unregister();delete F[k]}q(b)});Object.keys(F).forEach(function(k){e.indexOf(k)===-1&&(F[k].registration.unregister(),delete F[k])})}z==="active"&&(h.disconnect(B),D=new j,B=h.connect(a,p),D.then(function(){D=null},function(){D=null;z="stopping";h.dispatchEvent(new g("stopping"),n);Object.keys(F).forEach(function(k){F[k].registration.unregister();
delete F[k]});h.disconnect(B);B=null;z="resolved";h.dispatchEvent(new g("stopped",n))}));return(new j).resolve()};this.update=function(k){return A(k).then(function(){h.dispatchEvent(new g("updated",n))})};this.uninstall=function(){if(z==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(z==="active"||z==="starting"||z==="stopping")return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));h.removePlugin(this);z="uninstalled";h.dispatchEvent(new g("uninstalled",
n));return(new j).resolve()}}var d=/^http[s]?/i;return{Plugin:e,PluginRegistry:function(c,b){function h(k){var b=k.source;i.some(function(n){if(b===n.target){if(typeof n.useStructuredClone==="undefined")n.useStructuredClone=typeof k.data!=="string";n.handler(n.useStructuredClone?k.data:JSON.parse(k.data));return!0}})}var b=b||{},m=b.storage||localStorage;m.getItem||(m=f(m));var o="installed",r=[],i=[],k=new l,p={},n={registerService:c.registerService.bind(c),connect:function(k,n,a){function p(k){k=
Error(k);k.name="timeout";n({method:"timeout",error:k})}var h={handler:n,url:k},c=setTimeout(p.bind(null,"Load timeout for: "+k),a||15E3),d=document.createElement("iframe");d.name=k+"_"+(new Date).getTime();if(!b.visible)d.style.display="none",d.style.visibility="hidden";d.src=k;d.onload=function(){clearTimeout(c);setTimeout(p.bind(null,"Plugin handshake timeout for: "+k),5E3)};d.sandbox="allow-scripts allow-same-origin";document.body.appendChild(d);h.target=d.contentWindow;h.close=function(){d&&
(document.body.removeChild(d),d=null)};i.push(h);return h},disconnect:function(k){for(var b=0;b<i.length;b++)if(k===i[b]){i.splice(b,1);try{k.close()}catch(n){}break}},removePlugin:function(k){for(var b=0;b<r.length;b++)if(k===r[b]){r.splice(b,1);break}m.removeItem("plugin."+k.getLocation())},persist:function(k,b){m.setItem("plugin."+k,JSON.stringify(b))},postMessage:function(k,b){b.target.postMessage(b.useStructuredClone?k:JSON.stringify(k),b.url)},dispatchEvent:function(b){try{k.dispatchEvent(b)}catch(n){console&&
console.log("PluginRegistry.dispatchEvent "+n)}},loadManifest:function(k){var b=new j,a=n.connect(k,function(k){a&&k.method&&("manifest"===k.method||"plugin"===k.method?(k=k.params[0],n.disconnect(a),a=null,b.resolve(k)):"timeout"===k.method&&(n.disconnect(a),a=null,b.reject(k.error)))});return b.promise},getState:function(){return o},handleServiceError:function(k,b){if(b&&b.status===401){var n=k.getHeaders(),a=k.getName()||k.getLocation(),p=document.createElement("span");p.appendChild(document.createTextNode("Authentication required for: "+
a+"."));if(n.login)p.appendChild(document.createTextNode(" ")),a=document.createElement("a"),a.target="_blank",a.textContent="Login",a.href=n.login,d.test(a.href)?(p.appendChild(a),p.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+n.login);return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(p)}}if(b.__isError){var h=b,b=Error(h.message);Object.keys(h).forEach(function(k){b[k]=h[k]});delete b.__isError}return b}};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(!(o==="starting"||o==="active"||o==="stopping")){addEventListener("message",h,!1);for(var k=[],p=0,c=m.length;p<c;p++)k.push(m.key(p));k.forEach(function(k){if(k.indexOf("plugin.")===0){var b=k.substring(7),k=JSON.parse(m.getItem(k));k.created&&r.push(new e(b,k,n))}});
r.sort(function(k,b){return k._getCreated()<b._getCreated()?-1:1});b.plugins&&Object.keys(b.plugins).forEach(function(k){k=a(k);if(!this.getPlugin(k)){var p=b.plugins[k],p=typeof p==="object"||{};p.autostart=p.autostart||b.defaultAutostart||"lazy";r.push(new e(k,p,n))}}.bind(this));o="starting"}};this.start=function(){o!=="starting"&&this.init();if(o!=="starting")return(new j).reject("Cannot start framework. Framework is already "+o+".");var k=[],b=(new Date).getTime();r.forEach(function(n){var a=
n._getAutostart();n.getLastModified()===0?k.push(n.update().then(function(){if("started"===a)return n.start({"transient":!0});if("lazy"===a)return n.start({lazy:!0,"transient":!0});n._resolve()})):"started"===a?k.push(n.start({"transient":!0})):"lazy"===a?(k.push(n.start({lazy:!0,"transient":!0})),b>n.getLastModified()+864E5&&n.update()):n._resolve()});return j.all(k,function(k){console.log("PluginRegistry.stop "+k)}).then(function(){o="active"})};this.stop=function(){if(o!=="starting"&&o!=="active")return(new j).reject("Cannot stop registry. Registry is already "+
o+".");o="stopping";var k=[];r.forEach(function(b){k.push(b.stop({"transient":!0}))});return j.all(k,function(k){console.log("PluginRegistry.stop "+k)}).then(function(){removeEventListener("message",h);o="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new j).reject("Cannot uninstall registry")};this.installPlugin=function(k,b){var k=a(k),h=this.getPlugin(k);if(h)return(new j).resolve(h);if(p[k])return p[k];if(b)return h=new e(k,b,n),r.push(h),
h._persist(),n.dispatchEvent(new g("installed",h)),(new j).resolve(h);var c=n.loadManifest(k).then(function(b){h=new e(k,b,n);r.push(h);h._persist();delete p[k];n.dispatchEvent(new g("installed",h));return h},function(b){delete p[k];throw b;});return p[k]=c};this.getPlugins=function(){return r.slice()};this.getPlugin=function(k){var b=null,k=a(k);r.some(function(n){if(k===n.getLocation())return b=n,!0});return b};this.addEventListener=k.addEventListener.bind(k);this.removeEventListener=k.removeEventListener.bind(k);
this.resolvePlugins=function(){var k=!0;r.forEach(function(b){k=k&&b._resolve()});return k}}}});
define("orion/serviceTracker",[],function(){function j(a,f){function g(b){var a=b.getProperty("service.id"),h=this.addingService(b);h&&(d[a]=b,c[a]=h)}function e(b){var a=b.getProperty("service.id"),h=c[a];delete d[a];delete c[a];this.removedService(b,h)}this.serviceRegistry=a;var d={},c={},b=l,h,m;this.close=function(){if(b!==i)throw"Already closed";b=l;a.removeEventListener("registered",h);a.removeEventListener("unregistering",m);m=h=null;var c=this;this.getServiceReferences().forEach(function(b){e.call(c,
b)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){return d.length?Object.keys(d).map(function(b){return d[b]}):null};this.open=function(){if(b!==l)throw"Already open";b=i;var c=this;h=function(b){if(b.serviceReference.getProperty("objectClass").indexOf(f)!==-1&&(g.call(c,b.serviceReference),typeof c.onServiceAdded==="function"))return c.onServiceAdded(b.serviceReference,c.serviceRegistry.getService(b.serviceReference))};m=function(b){b.serviceReference.getProperty("objectClass").indexOf(f)!==
-1&&e.call(c,b.serviceReference)};a.addEventListener("registered",h);a.addEventListener("unregistering",m);a.getServiceReferences(f).forEach(function(b){g.call(c,b)});if(typeof this.onOpen==="function")this.onOpen()}}var l=0,i=1;j.prototype={addingService:function(a){return this.serviceRegistry.getService(a)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return j});
define("orion/config",["orion/Deferred","orion/serviceTracker"],function(j,l){var i,a,f,g,e,d="pid";i=function(b,a,c){function e(k,b,c){b.forEach(function(d,m){try{var e=k[m].getProperty("__plugin__"),f=e&&a.getPlugin(e);(!e||f&&f.getState()==="active")&&b[m].updated(c)}catch(o){typeof console!=="undefined"&&console.log(o)}})}l.call(this,b,"orion.cm.managedservice");var f={},g={},k=function(k){var n=[];k.plugin.getServiceReferences().forEach(function(k){if(k.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var a=k.getProperty(d),k=b.getService(k);a&&k&&(a=(a=c._find(a))&&a.getProperties(),n.push(k.updated(a)))}});return j.all(n)};this.addingService=function(k){var n=k.getProperty(d),a=b.getService(k);if(!n||!a)return null;f[n]||(f[n]=[]);g[n]||(g[n]=[]);f[n].push(k);g[n].push(a);return a};this.onServiceAdded=function(k,b){var a=k.getProperty(d),a=c._find(a);e([k],[b],a&&a.getProperties())};this.onOpen=function(){a.addEventListener("started",k)};this.onClose=function(){a.removeEventListener("started",
k)};this.notifyUpdated=function(k){var b=k.getPid();e(f[b]||[],g[b]||[],k.getProperties())};this.notifyDeleted=function(k){k=k.getPid();e(f[k]||[],g[k]||[],null)};this.removedService=function(k,b){var a=k.getProperty(d),h=f[a],c=g[a];h.length>1?h.splice(h.indexOf(k),1):delete f[a];c.length>1?c.splice(c.indexOf(b),1):delete g[a]}};a=function(){function b(b,a,c){this.store=new f(this,c);this.configAdmin=new g(this,this.store);this.tracker=new i(b,a,this.store)}b.prototype={getConfigurationAdmin:function(){var b=
this;return this.configAdmin._init().then(function(a){b.tracker.open();return a})},notifyDeleted:function(b){this.tracker.notifyDeleted(b)},notifyUpdated:function(b){this.tracker.notifyUpdated(b)}};return b}();g=function(){function b(b,a){this.factory=b;this.store=a}b.prototype={_init:function(){var b=this;return this.store._init().then(function(){return b})},getConfiguration:function(b){return this.store.get(b)},listConfigurations:function(){return this.store.list()}};return b}();var c="/cm/configurations";
f=function(){function b(b,a){this.factory=b;this.prefsService=a;this.configs=Object.create(null);this.pref=null;var f=this;this.initPromise=this.prefsService.getPreferences(c).then(function(b){f.pref=b;b.keys().forEach(function(a){if(!f.configs[a]){var k=b.get(a);typeof k==="object"&&k!==null&&Object.keys(k).length>0&&(k[d]=a,f.configs[a]=new e(f.factory,f,k))}})})}b.prototype={_init:function(){return this.initPromise},_find:function(b){return this.configs[b]||null},get:function(b){var a=this._find(b);
a||(a=new e(this.factory,this,b),this.configs[b]=a);return a},list:function(){var b=this,a=[];this.pref.keys().forEach(function(c){(c=b._find(c))&&c.getProperties()!==null&&a.push(c)});return a},remove:function(b){this.pref.remove(b);delete this.configs[b]},save:function(b,a){this.pref.put(b,a.getProperties(!0)||{})}};return b}();e=function(){function b(b){for(var a={},h=Object.keys(b),c=0;c<h.length;c++){var k=h[c],p=b[k];a[k]=p instanceof Array?p.slice():p}return a}function a(h,c,e){this.factory=
h;this.store=c;if(e!==null&&typeof e==="object")this.pid=e[d],h=b(e),delete h[d],this.properties=h;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(a){this._checkRemoved();var h=null;if(this.properties&&(h=b(this.properties),!a))h[d]=this.pid;return h},remove:function(){this._checkRemoved();
this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=!0},update:function(a){this._checkRemoved();a=b(a);delete a[d];this.properties=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:a}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(j,l,i,a,f,g){var e;return{startup:function(){if(e)return e;e=new l;var d=window.serviceRegistry=new i.ServiceRegistry,c=new a.PreferencesService(d);return c.getPreferences("/plugins").then(function(b){var a={plugins:{}};b.keys().forEach(function(c){var d=j.toUrl(c);a.plugins[d]=b[c]});var m=window.pluginRegistry=new f.PluginRegistry(d,a);return m.start().then(function(){if(d.getServiceReferences("orion.core.preference.provider").length>
0)return c.getPreferences("/plugins",c.USER_SCOPE).then(function(b){var a=[];b.keys().forEach(function(b){b=j.toUrl(b);m.getPlugin(b)||a.push(m.installPlugin(b,{autostart:"lazy"}).then(function(k){return k.update().then(function(){return k.start({lazy:!0})})}))});return l.all(a,function(b){console.log(b)})})}).then(function(){return(new g.ConfigurationAdminFactory(d,m,c)).getConfigurationAdmin().then(d.registerService.bind(d,"orion.cm.configadmin"))}).then(function(){var b=d.getService("orion.core.auth");
if(b){var a=b.getUser().then(function(k){if(k)localStorage.setItem("lastLogin",(new Date).getTime());else return b.getAuthForm(window.location.href).then(function(k){window.location=k})}),h=localStorage.getItem("lastLogin");if(!h||h<(new Date).getTime()-9E5)return a}}).then(function(){var b={serviceRegistry:d,preferences:c,pluginRegistry:m};e.resolve(b);return b})})}}});
define("orion/webui/littlelib",["require"],function(){function j(a,c){c||(c=document);return c.querySelectorAll(a)}function l(a,c){var b=a.compareDocumentPosition(c);return a===c||Boolean(b&16)}function i(a){if(a.tabIndex>=0)return a;if(a.hasChildNodes())for(var c=0;c<a.childNodes.length;c++){var b=i(a.childNodes[c]);if(b)return b}return null}function a(d){if(d.tabIndex>=0)return d;if(d.hasChildNodes())for(var c=d.childNodes.length-1;c>=0;c--){var b=a(d.childNodes[c]);if(b)return b}return null}function f(a,
c){if(a.nodeType===3){var b=g.exec(a.nodeValue);b&&b.length>1&&a.parentNode.replaceChild(document.createTextNode(c[b[1]]||b[1]),a)}if(a.hasChildNodes())for(b=0;b<a.childNodes.length;b++)f(a.childNodes[b],c)}var g=/\$\{([^\}]+)\}/,e=[];return{$:function(a,c){c||(c=document);return c.querySelector(a)},$$:j,$$array:function(a,c){return Array.prototype.slice.call(j(a,c))},node:function(a){var c=a;typeof a==="string"&&(c=document.getElementById(a));return c},contains:l,bounds:function(a){a=a.getBoundingClientRect();
return{left:a.left+document.body.scrollLeft,top:a.top+document.body.scrollTop,width:a.width,height:a.height}},empty:function(a){for(;a.hasChildNodes();)a.removeChild(a.firstChild)},firstTabbable:i,lastTabbable:a,stop:function(a){window.document.all?a.keyCode=0:(a.preventDefault(),a.stopPropagation())},processTextNodes:f,addAutoDismiss:function(a,c){e.length===0&&document.addEventListener("click",function(b){for(var a=[],c=0;c<e.length;c++){for(var d=e[c].excludeNodes,f=e[c].dismiss,g=!1,k=!0,p=0;p<
d.length;p++)if((g=document.compareDocumentPosition(document,d[p])!==1)&&l(d[p],b.target)){k=!1;break}k&&(f(),g=document.compareDocumentPosition(document,d[p])!==1);g&&a.push(e[c])}e=a},!0);e.push({excludeNodes:a,dismiss:c})},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}}});
(function(){function j(a,g,e,d,c,b){g[a]&&(e.push(a),(g[a]===!0||g[a]===1)&&d.push(c+a+"/"+b))}function l(a,g,e,d,c){g=d+g+"/"+c;require._fileExists(a.toUrl(g))&&e.push(g)}var i=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/,a={};define("i18n",{version:"1.0.0",load:function(f,g,e,d){var d=d||{},c=i.exec(f),b=c[1],h=c[4],m=c[5],o=h.split("-"),r=[],q={},k,p,n="";c[5]?(b=c[1],f=b+m):(m=c[4],h=d.locale||(d.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),
o=h.split("-"));if(d.isBuild){r.push(f);l(g,"root",r,b,m);for(k=0;p=o[k];k++)n+=(n?"-":"")+p,l(g,n,r,b,m);g(r,function(){e()})}else g([f],function(h){var c=[];j("root",h,c,r,b,m);for(k=0;p=o[k];k++)n+=(n?"-":"")+p,j(n,h,c,r,b,m);g(r,function(){var k,n;for(k=c.length-1;k>-1&&(p=c[k]);k--){n=h[p];if(n===!0||n===1)n=g(b+p+"/"+m);var d=q,f=void 0;for(f in n)!(f in a)&&!(f in d)&&(d[f]=n[f])}e(q)})})}})})();
define("orion/i18n",[],function(){return{load:function(j,l,i,a){var a=a||{},f=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,g=f.exec(j);if(g)if(l.defined(j))i(l(j));else if(a.isBuild||a.isTest)i({});else{var e=g[1],d=g[3]?g[2]:"",c=g[3]||g[2];l(["orion/bootstrap"],function(b){b.startup().then(function(b){var m=b.serviceRegistry,b=m.getServiceReferences("orion.i18n.message");if(d)b.some(function(b){return j===b.getProperty("name")?(m.getService(b).getMessageBundle().then(function(k){i(k)},function(){i({})}),
!0):!1})||i({});else{var o={},r;b.forEach(function(b){var k=b.getProperty("name");if((g=f.exec(k))&&e===g[1]&&c===(g[3]||g[2]))if(d=g[3]?g[2]:""){if((b=a.locale||(typeof navigator!=="undefined"?navigator.language||navigator.userLanguage:null))&&b.indexOf(d)===0)o[d]=!0,l.specified(k)||define(k,["orion/i18n!"+k],function(k){return k})}else r=b});l.specified(j)?i(o):r?m.getService(r).getMessageBundle().then(function(b){Object.keys(o).forEach(function(k){typeof b[k]==="undefined"&&(b[k]=o[k])});define(j,
[],b);i(b)},function(){define(j,[],o);i(o)}):(define(j,[],o),i(o))}})})}else i(null)}}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Repositories:"Repositories",Shell:"Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor","Orion Editor":"Orion 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",
" is already a favorite.":" is already a favorite.","Add to the favorites list":"Add to the favorites list","Make Favorite":"Make Favorite","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 "," has been added to the favorites list.":" has been added to the favorites list.",Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Report a Bug",
"Privacy Policy":"Privacy Policy","Terms of Use":"Terms of Use","Copyright Agent":"Copyright Agent","Orion Logo":"Orion Logo","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"Orion build I20130222-1257. See the FAQ for terms of service","Add this page to the favorites list":"Add this page to the favorites list","LOG: ":"LOG: ",Switch:"Switch","Switch the type of outliner used":"Switch the type of outliner used",
Outliner:"Outliner","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?","Orion Home":"Orion Home","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations",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","Are you sure you want to delete '${0}' from the favorites?":"Are you sure you want to delete '${0}' from the favorites?","Are you sure you want to delete these ${0} favorites?":"Are you sure you want to delete these ${0} favorites?","You can create favorites by selecting any file or folder in the navigator and choosing ${0} from the More menu.":"You can create favorites by selecting any file or folder in the navigator and choosing ${0} from the More menu.",
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","Open in new tab":"Open in new tab","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 Outliner":"Toggle Outliner","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."});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
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,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(j,l){function i(a){this._init(a)}i.prototype={_init:function(a){this._node=l.node(a.node);if(!this._node)throw"no dom node for tooltip found";this._position=a.position||["right","above","below","left"];this._text=a.text;this._hideDelay=a.hideDelay===void 0?200:a.hideDelay;this._tailSize=a.tailSize||10;this._trigger=a.trigger||"mouseover";this._afterShowing=a.afterShowing;this._afterHiding=a.afterHiding;var f=this;if(this._trigger===
"click")this._showDelay=0,this._node.addEventListener("click",function(a){a.target===f._node&&(f.show(),l.stop(a))},!1);else if(this._trigger==="mouseover"){this._showDelay=a.showDelay===void 0?1E3:a.showDelay;a=["mouseout","click"];this._node.addEventListener("mouseover",function(a){l.contains(f._node,a.target)&&(f.show(),l.stop(a))},!1);for(var g=0;g<a.length;g++)this._node.addEventListener(a[g],function(a){l.contains(f._node,a.target)&&f.hide()},!1)}},_makeTipNode:function(){if(!this._tip){this._tip=
document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("span");this._tipInner.classList.add("tooltip");this._text&&this._tipInner.appendChild(document.createTextNode(this._text));this._tip.appendChild(this._tipInner);document.body.appendChild(this._tip);var a=this;l.addAutoDismiss([this._tip,this._node],function(){a.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(a._timeout)window.clearTimeout(a._timeout),a._timeout=null;a._tip.addEventListener("mouseout",function(f){l.contains(a._tip,f.target)&&(a.hide(),l.stop(f))},!1)},!1)}return this._tip},_positionTip:function(a,f){this._makeTipNode();if(this._tailBorder)this._tip.removeChild(this._tailBorder),this._tailBorder=null,this._tip.removeChild(this._tail),this._tail=null;a==="left"?this._tipInner.classList.add("left"):
this._tipInner.classList.remove("left");var g=l.bounds(this._node),e=l.bounds(this._tipInner),d;switch(a){case "above":d=g.top-e.height-this._tailSize-1;g=g.left-this._tailSize;break;case "below":d=g.top+g.height+this._tailSize+1;g=g.left-this._tailSize;break;case "left":d=g.top-this._tailSize/2;g=g.left-e.width-this._tailSize-1;break;default:d=g.top-this._tailSize/2,g=g.left+g.width+this._tailSize+1}var c=l.bounds(document.documentElement);if(d+e.height>c.height)if(f)d=c.height-e.height-1;else return!1;
if(g+e.width>c.width)if(f)g=c.width-e.width-1;else return!1;if(g<0)if(f)g=4;else return!1;if(d<0)if(f)d=4;else return!1;this._tailBorder=document.createElement("span");this._tailBorder.classList.add("tooltipTailBorderFrom"+a);this._tail=document.createElement("span");this._tail.classList.add("tooltipTailFrom"+a);a==="above"||a==="left"?(this._tip.appendChild(this._tailBorder),this._tip.appendChild(this._tail)):(this._tip.insertBefore(this._tailBorder,this._tipInner),this._tip.insertBefore(this._tail,
this._tipInner));this._tip.style.top=d+"px";this._tip.style.left=g+"px";this._tip.style.width=e.width+"px";this._tip.style.height=e.height+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing")){var a=this;if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._timeout=window.setTimeout(function(){for(var f=!1,g=0;!f&&g<a._position.length;)f=a._positionTip(a._position[g]),
g++;f||a._positionTip(a._position[0],!0);a._tip.classList.add("tooltipShowing");a._afterShowing&&a._afterShowing()},this._showDelay)}},hide:function(a){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;if(this._tip&&this._tip.classList.contains("tooltipShowing")){if(a===void 0)a=this._hideDelay;var f=this;this._timeout=window.setTimeout(function(){f._tip.classList.remove("tooltipShowing");f._afterHiding&&f._afterHiding()},a)}},destroy:function(){if(this._timeout)window.clearTimeout(this._timeout),
this._timeout=null;if(this._tip)document.body.removeChild(this._tip),this._tailBorder=this._tail=this._tipInner=this._tip=null}};i.prototype.constructor=i;return{Tooltip:i}});
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","Populating favorites...":"Populating favorites...",Favorite:"Favorite","Searching...":"Searching...",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","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}'."});define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(j,l,i,a){function f(){}f.prototype={_initialize:function(f,e,d,c,b){this._tooltip=new a.Tooltip({node:f,hideDelay:b||0,afterShowing:this._afterShowingFunction(e).bind(this),afterHiding:d,trigger:c?c:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";f=document.createRange();f.selectNode(this.$parent);f=f.createContextualFragment(this.TEMPLATE);
this.messages&&i.processTextNodes(f,j);this.$parent.appendChild(f);var h=this._tooltip;this.$parent.addEventListener("keydown",function(b){b.keyCode===i.KEY.ESCAPE&&h.hide()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent)},_bindElements:function(a){for(var e=0;e<a.childNodes.length;e++){var d=a.childNodes[e];d.id&&(this["$"+d.id]=d);this._bindElements(d)}},_afterShowingFunction:function(a){return function(){a&&a.bind(this)();if(!this.customFocus){var e=
i.firstTabbable(this.$parent);e&&e.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};f.prototype.constructor=f;return{PopupDialog:f}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(j,l){function i(a,d,c){return a[d].apply(a,c)}function a(a){this._location=a}function f(){var a=new l;a.reject(j["No Matching OperationService for location:"]+this._location);return a}function g(e){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=e.getService("orion.core.preference");for(var d=e.getServiceReferences("orion.core.operation"),
c=0;c<d.length;c++){var b=e.getService(d[c]);this._services[c]=b;b=d[c].getProperty("pattern")||".*";b[0]!=="^"&&(b="^"+b);this._patterns[c]=RegExp(b)}this._getService=function(b){if(!b)return this._services[0];for(var c=0;c<this._patterns.length;++c)if(this._patterns[c].test(b))return this._services[c];return new a(b)}}a.prototype={getOperation:f,getOperations:f,removeCompletedOperations:f,removeOperation:f,cancelOperation:f};a.prototype.constructor=a;g.prototype={getOperations:function(){var a=
new l;if(this._operations)return a.resolve(this._operations),a;var d=this;this._preferenceService.getPreferences("/operations").then(function(c){d._operations=c;a.resolve(d._operations)});return a},getOperation:function(a){return i(this._getService(a),"getOperation",arguments)},removeCompletedOperations:function(){for(var a=[],d=this,c=0;c<this._services.length;c++){var b=this._patterns[c],h=new l;a[c]=h.promise;i(this._services[c],"removeCompletedOperations").then(function(a){return function(h){Array.isArray(h)&&
d.getOperations.bind(d)().then(function(c){for(var d=c.keys(),k=0;k<d.length;k++){var p=d[k];b.test(p)&&h.indexOf(p)<0&&c.remove(p)}a.resolve()})}}(h),function(b){return function(a){b.reject(a)}}(h))}return l.all(a)},removeOperation:function(a){var d=this;return i(this._getService(a),"removeOperation",arguments).then(function(){d.getOperations.bind(d)().then(function(c){c.remove(a)})},function(a){return a},function(a){return a})}};g.prototype.constructor=g;return{OperationsClient:g}});
define("orion/uiUtils",["i18n!orion/nls/messages","orion/webui/littlelib"],function(j,l){function i(a){var f=window.navigator.platform.indexOf("Mac")!==-1;return f&&a.metaKey||!f&&a.ctrlKey}return{getUserKeyString:function(a){var f="",g=navigator.platform.indexOf("Mac")!==-1;a.mod1&&(f+=g?"Cmd+":"Ctrl+");a.mod2&&(f+="Shift+");a.mod3&&(f+="Alt+");a.mod4&&g&&(f+="Ctrl+");if(a.alphaKey)return f+a.alphaKey;for(var e in l.KEY)if(typeof(l.KEY[e]==="number")&&l.KEY[e]===a.keyCode)return f+e;var d;switch(a.keyCode){case 59:d=
a.mod2?":":";";break;case 61:d=a.mod2?"+":"=";break;case 188:d=a.mod2?"<":",";break;case 190:d=a.mod2?">":".";break;case 191:d=a.mod2?"?":"/";break;case 192:d=a.mod2?"~":"`";break;case 219:d=a.mod2?"{":"[";break;case 220:d=a.mod2?"|":"\\";break;case 221:d=a.mod2?"}":"]";break;case 222:d=a.mod2?'"':"'"}return d?f+d:a.keyCode>=112&&a.keyCode<=123?f+"F"+(a.keyCode-111):f+String.fromCharCode(a.keyCode)},getUserText:function(a,f,g,e,d,c,b,h,m){var o=!1,b=function(b){return function(k){if(!o){var p=l.node(a),
n=p.value;if(p)if(b&&k.keyCode===l.KEY.ESCAPE){if(g)f.style.display="inline";p.parentNode.removeChild(p);o=!0;c&&c()}else if(!(b&&k.keyCode!==l.KEY.ENTER)){if(n.length===0||!m&&n===e){if(g)f.style.display="inline"}else d(n);o=!0;p.parentNode&&p.parentNode.removeChild(p);c&&c()}}}},r=document.createElement("input");r.id=a;r.value=e||"";f.parentNode.insertBefore(r,f.nextSibling);r.classList.add("userEditBoxPrompt");if(g)f.style.display="none";r.addEventListener("keydown",b(!0),!1);r.addEventListener("blur",
b(!1),!1);window.setTimeout(function(){r.focus();if(e){var b=l.node(a),k=h?e.indexOf(h):-1;if(k>0)if(b.createTextRange)b=b.createTextRange(),b.collapse(!0),b.moveStart("character",0),b.moveEnd("character",k),b.select();else if(b.setSelectionRange)b.setSelectionRange(0,k);else{if(b.selectionStart!==void 0)b.selectionStart=0,b.selectionEnd=k}else b.select()}},0)},openInNewWindow:i,followLink:function(a,f){f&&i(f)?window.open(a):window.location=a},createButton:function(a,f){var g=document.createElement("span");
g.role="button";g.tabIndex=0;g.appendChild(document.createTextNode(a));g.className="commandButton commandMargins";g.addEventListener("click",function(a){f();l.stop(a)},!1);g.addEventListener("keydown",function(a){if(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)f(),l.stop(a)},!1);return g}}});
define("orion/webui/dropdown",["require","orion/webui/littlelib"],function(j,l){function i(a){this._init(a)}i.prototype={_init:function(a){this._dropdownNode=l.node(a.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._triggerNode=l.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";this._populate=a.populate;var f=this;this._triggerNode.addEventListener("click",function(a){f.toggle()&&l.stop(a)},!1);this._triggerNode.tagName.toLowerCase()===
"span"&&this._triggerNode.addEventListener("keydown",function(a){if(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)f.toggle(),l.stop(a)},!1);this._dropdownNode.addEventListener("keydown",this._dropdownKeyDown.bind(this),!1)},toggle:function(){return this._triggerNode.classList.contains("dropdownTriggerOpen")?this.close():this.open()},open:function(){this._populate&&(this.empty(),this._populate(this._dropdownNode));var a=this.getItems();if(a.length>0){if(!this._hookedAutoDismiss)l.addAutoDismiss([this._triggerNode,
this._dropdownNode],this.close.bind(this)),this._hookedAutoDismiss=!0;this._positionDropdown();this._triggerNode.classList.add("dropdownTriggerOpen");this._dropdownNode.classList.add("dropdownMenuOpen");a[0].focus();return!0}return!1},_positionDropdown:function(){this._dropdownNode.style.left="";var a=l.bounds(this._dropdownNode),f=l.bounds(this._boundingNode(this._triggerNode));if(a.left+a.width>f.left+f.width)this._dropdownNode.style.right=0},_boundingNode:function(a){return a.style.right!==""||
a.style.position==="absolute"||!a.parentNode||!a.parentNode.style?a:this._boundingNode(a.parentNode)},close:function(a){this._triggerNode.classList.remove("dropdownTriggerOpen");this._dropdownNode.classList.remove("dropdownMenuOpen");a&&this._triggerNode.focus();return!0},getItems:function(){var a=[],f=this;l.$$array("li:not(.dropdownSeparator) > .dropdownMenuItem",this._dropdownNode,!0).forEach(function(g){g.parentNode.parentNode===f._dropdownNode&&a.push(g)});return a},empty:function(){var a=this;
l.$$array("li",this._dropdownNode).forEach(function(f){f.parentNode===a._dropdownNode&&f.parentNode.removeChild(f)})},_dropdownKeyDown:function(a){if(a.keyCode===l.KEY.UP||a.keyCode===l.KEY.DOWN||a.keyCode===l.KEY.RIGHT||a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.LEFT){var f=this.getItems(),g=document.activeElement;if(f.length&&f.length>0&&g){var e=f.indexOf(g);e>=0&&(a.keyCode===l.KEY.UP&&e>0?(e--,f[e].focus()):a.keyCode===l.KEY.DOWN&&e<f.length-1?(e++,f[e].focus()):a.keyCode===l.KEY.ENTER||a.keyCode===
l.KEY.RIGHT?g.classList.contains("dropdownTrigger")&&g.dropdown&&g.dropdown.open():a.keyCode===l.KEY.LEFT&&g.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&this.close(!0),l.stop(a))}}else a.keyCode===l.KEY.ESCAPE&&(this.close(!0),l.stop(a))}};i.prototype.constructor=i;return{Dropdown:i}});
define("orion/explorers/navigationUtils",[],function(){function j(i,a){if(!l&&i)i.push({domNode:a}),a.tabIndex=-1,a.style.outline="none"}var l=navigator.userAgent.indexOf("iPad")!==-1;return{addNavGrid:function(i,a,f){i&&(i=i.getGridNavHolder(a,!0))&&j(i,f)},generateNavGrid:j,removeNavGrid:function(i,a){if(i)for(var f=0;f<i.length;f++)if(i[f].domNode===a){i.splice(f,1);break}}}});
define("orion/i18nUtil",["require","orion/Deferred"],function(j,l){function i(a){if(a=localStorage.getItem("orion/messageBundle/"+a))if(a=JSON.parse(a),a._expires&&a._expires>(new Date).getTime())return delete a._expires,a;return null}var a={};return{getMessageBundle:function(f){function g(){j(["i18n!"+f],function(b){if(b){var a=f;b._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+a,JSON.stringify(b));delete b._expires}e.resolve(b)})}if(a[f])return a[f];var e=new l;a[f]=
e;var d=i(f);if(d)return e.resolve(d),e;try{j([f],g)}catch(c){j(["orion/i18n!"+f],g)}return e},formatMessage:function(a){var g=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,d){return g[(d<<0)+1]})}}});
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","Make Favorite":"Make Favorite","Delete the selected files or folders":"Delete the selected files or folders","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}'?","Are you sure you want to delete '${0}' from the favorites?":"Are you sure you want to delete '${0}' from the favorites?","Are you sure you want to delete these ${0} favorites?":"Are you sure you want to delete these ${0} favorites?",
"You can create favorites by selecting any file or folder in the navigator and choosing ${0} from the ${1} menu.":"You can create favorites by selecting any file or folder in the navigator and choosing ${0} from the ${1} menu.","Export as zip":"Export as 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":"New File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"New 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","Import local file...":"Import local file...",
"Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP from...","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 to...","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location","Exporting from ${0}":"Exporting from ${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","Copy Items":"Copy Items","Copy the selected items to the copy/paste buffer":"Copy the selected items to the copy/paste buffer","Paste Items":"Paste Items","Paste items from the copy/paste buffer":"Paste items from the copy/paste buffer",
"Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With","Loading ":"Loading ",New:"New","Click on an item to make a selection, then use this menu to see what actions are available.":"Click on an item to make a selection, then use this menu to see what actions are available.",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",Favorites:"Favorites",
"Import from HTTP...":"Import from 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}?"});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(j,l,i){function a(a,d,c){if(!a[d])throw d+j[" is not supported in this file system"];return a[d].apply(a,c)}function f(e,d,c,b){if(!e.readBlob)throw j["source file service does not support binary read"];if(!c.writeBlob)throw j["target file service does not support binary write"];if(d[d.length-1]!=="/")return a(e,"readBlob",[d]).then(function(h){return a(c,"writeBlob",[b,h])});var h=b.substring(0,
b.length-1),m=decodeURIComponent(h.substring(h.lastIndexOf("/")+1)),h=h.substring(0,h.lastIndexOf("/")+1);return a(c,"createFolder",[h,m]).then(function(){},function(){}).then(function(){return a(e,"fetchChildren",[d]).then(function(a){for(var h=[],d=0;d<a.length;++d){var k=a[d].Location,p=k;a[d].Directory&&(p=k.substring(0,k.length-1));p=decodeURIComponent(p.substring(p.lastIndexOf("/")+1));p=b+encodeURIComponent(p);a[d].Directory&&(p+="/");h[d]=f(e,k,c,p)}return l.all(h)})})}function g(a,d){function c(k){var b=
new l;b.reject(j["No Matching FileService for location:"]+k);return b}var b=a.getServiceReferences("orion.core.file"),h=b;if(d)for(var h=[],m=0;m<b.length;++m)d(b[m])&&h.push(b[m]);for(var f=[],g=[],q=[],k=[],p={fetchChildren:function(){var b=new l;b.resolve(k);return b},createWorkspace:function(){var k=new l;k.reject(j["no file service"]);return k},loadWorkspaces:function(){var k=new l;k.reject(j["no file service"]);return k},loadWorkspace:function(){var b=new l;window.setTimeout(function(){b.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:j["File Servers"],Location:"/",Children:k,ChildrenLocation:"/"})},100);return b},search:c,createProject:c,createFolder:c,createFile:c,deleteFile:c,moveFile:c,copyFile:c,read:c,write:c},b=0;b<h.length;++b)k[b]={Directory:!0,Length:0,LocalTimeStamp:0,Location:h[b].getProperty("top"),ChildrenLocation:h[b].getProperty("top"),Name:h[b].getProperty("Name")},m=h[b].getProperty("pattern")||".*",m[0]!=="^"&&(m="^"+m),f[b]=RegExp(m),g[b]=a.getService(h[b]),q[b]=h[b].getProperty("Name"),
h[b].getProperty("NameKey")&&h[b].getProperty("nls")&&i.getMessageBundle(h[b].getProperty("nls")).then(function(b,a){k[b].Name=a[h[b].getProperty("NameKey")];q[b]=a[h[b].getProperty("NameKey")]}.bind(this,b));this._getServiceIndex=function(k){if(k==="/")return-1;else if(!k||k.length&&k.length===0)return g[0]?0:-1;for(var b=0;b<f.length;++b)if(f[b].test(k))return b;throw j["No Matching FileService for location:"]+k;};this._getService=function(k){k=this._getServiceIndex(k);return k===-1?p:g[k]};this._getServiceName=
function(k){k=this._getServiceIndex(k);return k===-1?p.Name:q[k]};this._getServiceRootURL=function(b){b=this._getServiceIndex(b);return b===-1?p.Location:k[b].Location}}g.prototype={getService:function(a){return this._getService(a)},fileServiceName:function(a){return this._getServiceName(a)},fileServiceRootURL:function(a){return this._getServiceRootURL(a)},fetchChildren:function(f){return a(this._getService(f),"fetchChildren",arguments)},createWorkspace:function(f){return a(this._getService(),"createWorkspace",
arguments)},loadWorkspaces:function(){return a(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(f){return a(this._getService(f),"loadWorkspace",arguments)},createProject:function(f,d,c,b){return a(this._getService(f),"createProject",arguments)},createFolder:function(f,d){return a(this._getService(f),"createFolder",arguments)},createFile:function(f,d){return a(this._getService(f),"createFile",arguments)},deleteFile:function(f){return a(this._getService(f),"deleteFile",arguments)},
moveFile:function(e,d,c){var b=this._getService(e),h=this._getService(d);if(b===h)return a(b,"moveFile",arguments);var m=e[e.length-1]==="/",g=d;g[g.length-1]!=="/"&&(g+="/");if(c)g+=encodeURIComponent(c);else{var r=e;m&&(r=r.substring(0,r.length-1));g+=r.substring(r.lastIndexOf("/")+1)}m&&g[g.length-1]!=="/"&&(g+="/");return f(b,e,h,g).then(function(){return a(b,"deleteFile",[e])})},copyFile:function(e,d,c){var b=this._getService(e),h=this._getService(d);if(b===h)return a(b,"copyFile",arguments);
var m=e[e.length-1]==="/",g=d;g[g.length-1]!=="/"&&(g+="/");if(c)g+=encodeURIComponent(c);else{var r=e;m&&(r=r.substring(0,r.length-1));g+=r.substring(r.lastIndexOf("/")+1)}m&&g[g.length-1]!=="/"&&(g+="/");return f(b,e,h,g)},read:function(f,d){return a(this._getService(f),"read",arguments)},write:function(f,d,c){return a(this._getService(f),"write",arguments)},remoteImport:function(f,d){return a(this._getService(f),"remoteImport",arguments)},remoteExport:function(f,d){return a(this._getService(f),
"remoteExport",arguments)},search:function(f){return a(this._getService(f.resource),"search",arguments)}};g.prototype.constructor=g;return{FileClient:g}});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Case sensitive":"Case sensitive","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",Replace:"Replace","Replace All":"Replace All",
"Not found":"Not found","Replacing all...":"Replacing all..."," matches":" matches","Replaced ":"Replaced ","Nothing replaced":"Nothing replaced","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.","Save Search":"Save Search","Save search query":"Save search query",
"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","Search Again":"Search Again","Search again":"Search again","< 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",Searches:"Searches","You can save frequently used by searches by choosing ${0} in the search toolbar.":"You can save frequently used by searches by choosing ${0} in the search toolbar."});define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/editor/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/URITemplate",[],function(){function j(a){this._text=a}function l(a,b){if(b==="U")return encodeURIComponent(a).replace(/[!'()*]/g,function(b){return"%"+b.charCodeAt(0).toString(16).toUpperCase()});if(b==="U+R")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]");if(b==="U+R-,")return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function i(a,b,h){for(var d=[],f=0;f<a.length;f++)typeof a[f]!=="undefined"&&
d.push(l(a[f],b));return d.join(h)}function a(a,b,h,d){for(var f=Object.keys(a),e=[],g=0;g<f.length;g++)typeof a[f[g]]!=="undefined"&&e.push(l(f[g],b)+h+l(a[f[g]],b));return e.join(d)}function f(a){if(a.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=e[a[0]])?a=a.substring(1):this._operator=e.NUL;for(var b=[],h=a.split(","),f=0;f<h.length;f++){var g=h[f].match(d);if(g===null)throw Error("Bad VarSpec: "+a);b.push({name:g[1],explode:!!g[2],prefix:g[3]?parseInt(g[3],
10):-1})}this._varSpecList=b}function g(a){for(var b=[],h=0,d=a.indexOf("{",h);d!==-1;){b.push(new j(a.substring(h,d)));h=a.indexOf("}",d+1);if(h===-1)throw Error("Invalid template: "+a);b.push(new f(a.substring(d+1,h)));h+=1;d=a.indexOf("{",h)}b.push(new j(a.substring(h)));this._templateComponents=b}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-,"}},d=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/;j.prototype={expand:function(){return encodeURI(this._text)}};f.prototype={expand:function(c){for(var b=[],h=
0;h<this._varSpecList.length;h++){var d=this._varSpecList[h],f=d.name,e=c[f],g=typeof e;if(g!=="undefined"&&e!==null){var k=b.length===0?this._operator.first:this._operator.sep;if(g==="string")this._operator.named&&(k+=l(f,"U+R"),k+=e.length===0?this._operator.ifemp:"="),d.prefix!==-1&&d.prefix<e.length&&(e=e.substring(0,d.prefix)),k+=l(e,this._operator.allow);else if(Array.isArray(e))d.explode?k+=i(e,this._operator.allow,this._operator.sep):(this._operator.named&&(k+=l(f,"U+R"),k+=e.length===0?this._operator.ifemp:
"="),k+=i(e,this._operator.allow,","));else if(g==="object")d.explode?k+=a(e,this._operator.allow,"=",this._operator.sep):(this._operator.named&&(k+=l(f,"U+R"),k+=Object.keys(e).length===0?this._operator.ifemp:"="),k+=a(e,this._operator.allow,",",","));else throw Error("bad param type: "+f+" : "+g);b.push(k)}}return b.join("")}};g.prototype={expand:function(a){for(var b=[],h=0;h<this._templateComponents.length;h++)b.push(this._templateComponents[h].expand(a));return b.join("")}};return g});
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?"});
define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(j,l,i){function a(a,g){this._activeContainer=null;this._getElementsFunction=a;this._toolbarLayoutFunction=g}a.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&i.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&i.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(a,g,e){typeof a==="string"&&(a=i.node(a));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===a)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(a))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=e;var d=g(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!d)return!1;this._activeElements.focusNode=d;a=i.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(a.length===0){g=this._activeElements.dismissArea||
this._activeElements.parameterArea;a=document.createElement("span");a.id="closebox";a.role="button";a.tabIndex=0;a.classList.add("imageSprite");a.classList.add("core-sprite-close");a.classList.add("dismiss");a.title=j.Close;g.appendChild(a);var c=this;a.addEventListener("click",function(){c.close()},!1);a.addEventListener("keydown",function(b){(b.keyCode===i.KEY.ENTER||b.keyCode===i.KEY.SPACE)&&c.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);
if(d)this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){d.focus();d.select()},0);this._activeElements.commandNode&&this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(a,g){i.$$array("input",g).forEach(function(e){e.type==="checkbox"?a.parameters.setValue(e.parameterName,e.checked):e.type!=="button"&&a.parameters.setValue(e.parameterName,e.value.trim())});i.$$array("textArea",g).forEach(function(e){a.parameters.setValue(e.parameterName,
e.value.trim())});a.command.callback&&a.command.callback.call(a.handler,a)},collectParameters:function(a){return a.parameters?(a.domNode&&a.domNode.classList.add("commandMarker"),this.open(a.domNode||a.domParent,this.getFillFunction(a))):!1},getFillFunction:function(a,g){var e=this;return function(d,c){var b=null,h=function(){g&&g();e.close()},m=function(k){k.keyCode===i.KEY.ENTER&&e._collectAndCall(a,d);if(k.keyCode===i.KEY.ESCAPE||k.keyCode===i.KEY.ENTER)h(),i.stop(k)};a.parameters.forEach(function(k){var a=
null;if(k.label)a=document.createElement("label"),a.classList.add("parameterInput"),a.setAttribute("for",k.name+"parameterCollector"),a.textContent=k.label,d.appendChild(a);var c=k.name+"parameterCollector",f=a||d;if(k.type==="text"&&typeof k.lines==="number"&&k.lines>1)a=document.createElement("textarea"),a.rows=k.lines,a.type="textarea",a.id=c,f.appendChild(a),m=function(k){k.keyCode===i.KEY.ESCAPE&&(h(),i.stop(k))};else if(k.type==="boolean"){if(a=document.createElement("input"),a.type="checkbox",
a.id=c,f.appendChild(a),k.value)a.checked=!0}else if(a=document.createElement("input"),a.type=k.type,a.id=c,f.appendChild(a),k.value)a.value=k.value;a.classList.add("parameterInput");a.classList.add("parameterInput"+a.type);a.setAttribute("speech","speech");a.setAttribute("x-webkit-speech","x-webkit-speech");a.parameterName=k.name;b||(b=a);a.addEventListener("keydown",m,!1)});var o=c;if(!o)o=document.createElement("span"),o.className="layoutRight parametersDismiss",d.appendChild(o);var r=function(k){k._collectAndCall(a,
d);h()},q=function(k,b){var a=document.createElement("span");a.role="button";a.tabIndex=0;b.appendChild(a);k&&a.appendChild(document.createTextNode(k));a.classList.add("dismiss");return a};if(a.parameters.hasOptionalParameters()){a.parameters.optionsRequested=!1;var k=q(j.More,o);k.addEventListener("click",function(){a.parameters.optionsRequested=!0;r(e)},!1);k.addEventListener("keydown",function(k){if(k.keyCode===i.KEY.ENTER||k.keyCode===i.KEY.SPACE)a.parameters.optionsRequested=!0,r(e)},!1)}k=q(j.Submit,
o);k.addEventListener("click",function(){r(e)},!1);k.addEventListener("keydown",function(k){(k.keyCode===i.KEY.ENTER||k.keyCode===i.KEY.SPACE)&&r(e)},!1);o=q(null,o);o.id="closebox";o.classList.add("imageSprite");o.classList.add("core-sprite-close");o.title=j.Close;o.addEventListener("click",function(){h()},!1);o.addEventListener("keydown",function(k){(k.keyCode===i.KEY.ENTER||k.keyCode===i.KEY.SPACE)&&h()},!1);return b}}};a.prototype.constructor=a;return{CommandParameterCollector:a}});
(function(){function j(b){return b?b.slice(1).split("&"):[]}function l(b){return b.length===0?"":"?"+b.join("&")}function i(b){var a=/([^=]*)(?:=?)(.*)/.exec(b),b=a[1]?decodeURIComponent(a[1]):"",a=a[2]?decodeURIComponent(a[2]):"";return[b,a]}function a(b){var a=encodeURIComponent(b[0]);b[1]&&(a+="="+encodeURIComponent(b[1]));return a}function f(b,a){var h="",k=[],p=0;return{next:function(){if(h!==b.search)h=b.search,k=j(h);if(p<k.length){var n=i(k[p++]);switch(a){case "keys":return n[0];case "values":return n[1];
case "keys+values":return[n[0],n[1]];default:throw new TypeError;}}throw m;}}}function g(b){if(typeof b!=="string")throw new TypeError;}function e(b){var a=b.protocol;return!a||a===":"||a==="http:"&&!b.hostname?!1:!0}function d(b){Object.defineProperty(this,"_anchor",{value:b})}function c(b,a){b=b||"";if(typeof b!=="string")throw new TypeError("url");a=a?a.href||a:"";if(typeof a!=="string")throw new TypeError("base");Object.defineProperty(this,"_input",{value:b,writable:!0});var h=document.implementation.createHTMLDocument("");
if(a){var k=h.createElement("a");k.href=a;if(k.protocol.length<2||!k.host)throw Error("InvalidStateError");var p=h.createElement("base");p.href=k.href;h.head.appendChild(p)}var n=h.createElement("a");n.href=b;h.body.appendChild(n);Object.defineProperty(this,"_urlAnchor",{value:n});var c=new d(n);Object.defineProperty(this,"query",{get:function(){return e(n)?c:null},enumerable:!0})}try{if(typeof window.URL==="function"&&window.URL.length!==0&&(new window.URL("http://www.w3.org")).protocol==="http:")return}catch(b){}var h=
/([^:]*):?(.*)/,m=typeof StopIteration!=="undefined"?StopIteration:Error("Stop Iteration");Object.defineProperties(d.prototype,{get:{value:function(b){g(b);var a;j(this._anchor.search).some(function(h){h=i(h);if(h[0]===b)return a=h[1],!0});return a},enumerable:!0},set:{value:function(b,h){g(b);g(h);var c=j(this._anchor.search);c.some(function(k,p){var n=i(k);if(n[0]===b)return n[1]=h,c[p]=a(n),!0})||c.push(a([b,h]));this._anchor.search=l(c)},enumerable:!0},has:{value:function(b){g(b);return j(this._anchor.search).some(function(a){if(i(a)[0]===
b)return!0})},enumerable:!0},"delete":{value:function(b){g(b);var a=j(this._anchor.search),h=a.filter(function(k){return i(k)[0]!==b});return h.length!==a.length?(this._anchor.search=l(h),!0):!1},enumerable:!0},clear:{value:function(){this._anchor.search=""},enumerable:!0},forEach:{value:function(b,a){if(typeof b!=="function")throw new TypeError;var h=f(this._anchor,"keys+values");try{for(;;){var k=h.next();b.call(a,k[1],k[0],this)}}catch(p){if(p!==m)throw p;}},enumerable:!0},keys:{value:function(){return f(this._anchor,
"keys")},enumerable:!0},values:{value:function(){return f(this._anchor,"values")},enumerable:!0},items:{value:function(){return f(this._anchor,"keys+values")}},size:{get:function(){return j(this._anchor.search).length},enumerable:!0},getAll:{value:function(b){g(b);var a=[];j(this._anchor.search).forEach(function(h){h=i(h);h[0]===b&&a.push(h[1])});return a},enumerable:!0},append:{value:function(b,h){g(b);g(h);var c=j(this._anchor.search);c.push(a([b,h]));this._anchor.search=l(c)},enumerable:!0}});
Object.defineProperties(c.prototype,{href:{get:function(){return e(this._urlAnchor)?this._urlAnchor.href:this._input},set:function(b){g(b);this._input=b;this._urlAnchor.href=b},enumerable:!0},origin:{get:function(){return e(this._urlAnchor)?this._urlAnchor.protocol+"//"+this._urlAnchor.host:""},enumerable:!0},protocol:{get:function(){return e(this._urlAnchor)?this._urlAnchor.protocol:":"},set:function(b){g(b);this._urlAnchor.protocol=b},enumerable:!0},_userinfo:{get:function(){return!e(this._urlAnchor)?
"":RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host).exec(this._urlAnchor.href)[2]||""},set:function(b){g(b);this._urlAnchor.href=this._urlAnchor.href.replace(RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host),this._urlAnchor.protocol+"//"+(b?b+"@":"")+this._urlAnchor.host)}},username:{get:function(){if(!e(this._urlAnchor))return"";var b=h.exec(this._userinfo);return decodeURIComponent(b[1]||"")},set:function(b){g(b);var a=h.exec(this._userinfo),
b=[encodeURIComponent(b||"")];a[2]&&b.push(a[2]);this._userinfo=b.join(":")},enumerable:!0},password:{get:function(){if(!e(this._urlAnchor))return"";var b=h.exec(this._userinfo);return decodeURIComponent(b[2]||"")},set:function(b){g(b);var a=[h.exec(this._userinfo)[1]||""];b&&a.push(encodeURIComponent(b));this._userinfo=a.join(":")},enumerable:!0},host:{get:function(){return e(this._urlAnchor)?this._urlAnchor.host:""},set:function(b){g(b);this._urlAnchor.host=b},enumerable:!0},hostname:{get:function(){return e(this._urlAnchor)?
this._urlAnchor.hostname:""},set:function(b){g(b);this._urlAnchor.hostname=b},enumerable:!0},port:{get:function(){return e(this._urlAnchor)?this._urlAnchor.port:""},set:function(b){g(b);this._urlAnchor.port=b},enumerable:!0},pathname:{get:function(){return e(this._urlAnchor)?this._urlAnchor.pathname:""},set:function(b){g(b);this._urlAnchor.pathname=b},enumerable:!0},search:{get:function(){return e(this._urlAnchor)?this._urlAnchor.search:""},set:function(b){g(b);this._urlAnchor.search=b},enumerable:!0},
hash:{get:function(){return e(this._urlAnchor)?this._urlAnchor.hash:""},set:function(b){g(b);this._urlAnchor.hash=b},enumerable:!0}});window.URL&&window.URL.createObjectURL&&(Object.defineProperty(c,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(c,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),enumerable:!1}));window.URL=c})();define("orion/URL-shim",function(){});
define("orion/editor/util",[],function(){var j=navigator.userAgent,l=parseFloat(j.split("MSIE")[1])||void 0,i=parseFloat(j.split("Firefox/")[1]||j.split("Minefield/")[1])||void 0,a=j.indexOf("Opera")!==-1,f=parseFloat(j.split("Chrome/")[1])||void 0,g=j.indexOf("Safari")!==-1&&!f,e=parseFloat(j.split("WebKit/")[1])||void 0,d=j.indexOf("Android")!==-1,c=j.indexOf("iPad")!==-1,j=j.indexOf("iPhone")!==-1,b=c||j,h=navigator.platform.indexOf("Mac")!==-1,m=navigator.platform.indexOf("Win")!==-1,o=navigator.platform.indexOf("Linux")!==
-1;return{formatMessage:function(b){var a=arguments;return b.replace(/\$\{([^\}]+)\}/g,function(k,b){return a[(b<<0)+1]})},createElement:function(b,a){return b.createElementNS?b.createElementNS("http://www.w3.org/1999/xhtml",a):b.createElement(a)},isIE:l,isFirefox:i,isOpera:a,isChrome:f,isSafari:g,isWebkit:e,isAndroid:d,isIPad:c,isIPhone:j,isIOS:b,isMac:h,isWindows:m,isLinux:o,platformDelimiter:m?"\r\n":"\n"}});
define("orion/editor/keyBinding",["orion/editor/util"],function(j){function l(i,a,f,g,e){this.keyCode=typeof i==="string"?i.toUpperCase().charCodeAt(0):i;this.mod1=a!==void 0&&a!==null?a:!1;this.mod2=f!==void 0&&f!==null?f:!1;this.mod3=g!==void 0&&g!==null?g:!1;this.mod4=e!==void 0&&e!==null?e:!1}l.prototype={match:function(i){return this.keyCode===i.keyCode?this.mod1!==(j.isMac?i.metaKey:i.ctrlKey)?!1:this.mod2!==i.shiftKey?!1:this.mod3!==i.altKey?!1:j.isMac&&this.mod4!==i.ctrlKey?!1:!0:!1},equals:function(i){return!i?
!1:this.keyCode!==i.keyCode?!1:this.mod1!==i.mod1?!1:this.mod2!==i.mod2?!1:this.mod3!==i.mod3?!1:this.mod4!==i.mod4?!1:!0}};return{KeyBinding:l}});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(j,l){function i(a){this._init(a)}i.prototype={_init:function(a){var f=l.node(a.container);if(!f)throw"no parent container";this._container=f;f.classList.remove("currentLocation");this._id=a.id||"eclipse.breadcrumbs";this._resource=a.resource||null;this._rootSegmentName=a.rootSegmentName;this._workspaceRootSegmentName=a.workspaceRootSegmentName;this._makeHref=a.makeHref;this.path="";this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var a;
this._resource&&this._resource.Parents?(a=document.createElement("a"),this._makeHref?this._makeHref(a,""):a.href=j.toUrl("navigate/table.html")+"#"):a=document.createElement("span");l.empty(a);a.appendChild(document.createTextNode(this._workspaceRootSegmentName));return a}return null},render:function(){var a=this._container,f=l.node(this._id);f?l.empty(f):(f=document.createElement("span"),f.id=this._id,a.appendChild(f));var g;if(g=this.getNavigatorWorkspaceRootSegment())if(g.classList.add("breadcrumb"),
f.appendChild(g),this._resource&&this._resource.Parents)g=document.createElement("span"),g.appendChild(document.createTextNode(" / ")),this.path+="/",g.classList.add("breadcrumbSeparator"),f.appendChild(g);else{g.href="";g.classList.remove("breadcrumb");g.classList.add("currentLocation");return}a=this._rootSegmentName;if(this._resource){if(this._resource.Parents)for(var e=this._resource.Parents,d=e.length;--d>=0;)g=document.createElement("a"),g.classList.add("breadcrumb"),a?(g.appendChild(document.createTextNode(a)),
a=null):g.appendChild(document.createTextNode(e[d].Name)),this.path+=e[d].Name,this._makeHref?this._makeHref(g,e[d].Location):g.href=j.toUrl("navigate/table.html")+"#"+e[d].ChildrenLocation,f.appendChild(g),g=document.createElement("span"),g.appendChild(document.createTextNode(" / ")),this.path+="/",g.classList.add("breadcrumbSeparator"),f.appendChild(g);g=document.createElement("span");a?(g.appendChild(document.createTextNode(a)),a=null):g.appendChild(document.createTextNode(this._resource.Name));
g.classList.add("currentLocation");this.path+=this._resource.Name;f.appendChild(g)}f.childNodes.length===0&&(g=document.createElement("span"),g.appendChild(document.createTextNode(a||document.title)),g.classList.add("breadcrumb"),g.classList.add("currentLocation"),f.appendChild(g))}};i.prototype.constructor=i;return{BreadCrumbs:i}});
define("orion/webui/splitter",["require","orion/webui/littlelib"],function(j,l){function i(a){this._init(a)}i.prototype={_init:function(a){this._tracking=null;this._resizeListeners=[];this._animationDelay=501;this.$node=l.node(a.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=l.node(a.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=l.node(a.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";this._vertical=a.vertical;
this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");if(a.toggle)this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),this._thumb.classList.add("splitThumb"),this._thumb.classList.add("splitThumbLayout");this._initializeFromStoredSettings();this._closed?(this._closed=!1,this._thumbDown()):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)},toggleSidePanel:function(){this._thumbDown()},openSidePanel:function(){this._closed||this._thumbDown()},addResizeListener:function(a){this._resizeListeners.push(a)},_initializeFromStoredSettings:function(){this._closed=localStorage.getItem(this._prefix+"/toggleState")==="closed";var a;if(this._vertical){if(a=localStorage.getItem(this._prefix+"/yPosition"))this._splitTop=
parseInt(a,10)}else if(a=localStorage.getItem(this._prefix+"/xPosition"))this._splitLeft=parseInt(a,10)},_adjustToSplitPosition:function(a){var f=l.bounds(this.$node),g=l.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=f.height;if(a||!this._splitTop)this._splitTop=f.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);a=this._splitTop;this.$node.parentNode.style.position==="relative"&&(a=this._splitTop-g.top);this.$sideNode.style.height=a+"px";this.$sideNode.style.bottom=
a-1+"px";this.$sideNode.style.display="block";this.$node.style.top=a+"px"}else{this._splitWidth=f.width;if(a||!this._splitLeft)this._splitLeft=f.left,localStorage.setItem(this._prefix+"/xPosition",this._splitLeft);a=this._splitLeft;this.$node.parentNode.style.position==="relative"&&(a=this._splitLeft-g.left);this.$sideNode.style.width=a+"px";this.$sideNode.style.right=a-1+"px";this.$sideNode.style.display="block";this.$node.style.left=a+"px"}this._resize()},_resize:function(a){var a=a||0,f=l.bounds(this.$node.parentNode),
g=l.bounds(this.$node);this._vertical?this.$mainNode.style.height=f.height-(g.top-f.top+g.height)+"px":this.$mainNode.style.width=f.width-(g.left-f.left+g.width)+"px";var e=this;window.setTimeout(function(){e._notifyResizeListeners(e.$mainNode)},a);window.setTimeout(function(){e._notifyResizeListeners(e.$sideNode)},a)},_notifyResizeListeners:function(a){for(var f=0;f<this._resizeListeners.length;f++)this._resizeListeners[f](a)},_thumbDown:function(){this._closed?(this._closed=!1,this._addAnimation(),
this._vertical?(this.$sideNode.style.height=this._splitTop+"px",this.$node.style.top=this._splitTop+"px"):(this.$sideNode.style.width=this._splitLeft+"px",this.$node.style.left=this._splitLeft+"px")):(this._closed=!0,this._addAnimation(),this._vertical?(this.$sideNode.style.top=0,this.$node.style.top="1px"):(this.$sideNode.style.width=0,this.$node.style.left="1px"));this._resize(this._animationDelay);this._removeAnimation();localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null)},
_removeAnimation:function(){var a=this;window.setTimeout(function(){a.$sideNode.classList.remove("sidePanelLayoutAnimation");a.$mainNode.classList.remove("mainPanelLayoutAnimation");a.$node.classList.remove("splitLayoutAnimation");a._thumb.classList.remove("splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add("sidePanelLayoutAnimation");this.$mainNode.classList.add("mainPanelLayoutAnimation");this.$node.classList.add("splitLayoutAnimation");this._thumb&&
this._thumb.classList.add("splitLayoutAnimation")},_mouseDown:function(a){if(a.target===this._thumb)return l.stop(a),this._thumbDown(a);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),l.stop(a)},_mouseMove:function(a){if(this._tracking){var f;this._vertical?(f=this._splitTop=a.clientY,this.$node.parentNode.style.position===
"relative"&&(f=l.bounds(this.$node.parentNode),f=this._splitTop-f.top),this.$node.style.top=f+"px"):(f=this._splitLeft=a.clientX,this.$node.parentNode.style.position==="relative"&&(f=l.bounds(this.$node.parentNode),f=this._splitLeft-f.left),this.$node.style.left=f+"px");this._adjustToSplitPosition(!0);l.stop(a)}},_mouseUp:function(a){if(this._tracking)window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),
this.$sideNode.classList.remove("panelTracking"),l.stop(a)}};i.prototype.constructor=i;return{Splitter:i}});define("orion/fileUtils",["i18n!orion/nls/messages"],function(){return{makeRelative:function(j){if(!j)return j;var l=window.location.protocol+"//"+window.location.host;return j.indexOf(l)===0?j.substring(l.length):j},isAtRoot:function(j){return this.makeRelative(j).indexOf("/workspace")===0}}});
define("orion/favorites",["require","orion/fileUtils","orion/EventTarget"],function(j,l,i){function a(a){this._favorites=[];i.attach(this);this._init(a);this._initializeFavorites()}a.prototype={_init:function(a){this._registry=a.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.favorite",this)},_notifyListeners:function(){this.dispatchEvent({type:"favoritesChanged",navigator:this._favorites,registry:this._registry})},makeFavorites:function(a){for(var a=Array.isArray(a)?
a:[a],g=0;g<a.length;g++){var e=a[g],d=e.ChildrenLocation?e.ChildrenLocation:e.Location,d=l.makeRelative(d);this.addFavorite(e.Name,d,e.Directory)}this._storeFavorites();this._notifyListeners()},addFavoriteUrl:function(a){this.addFavorite(a,a,!1,!0)},addFavorite:function(a,g,e){this._favorites.push({name:a,path:g,directory:e,isFavorite:!0});this._favorites.sort(this._sorter);this._storeFavorites();this._notifyListeners()},removeFavorite:function(a){for(var g in this._favorites)if(this._favorites[g].path===
a){this._favorites.splice(g,1);break}this._favorites.sort(this._sorter);this._storeFavorites();this._notifyListeners()},renameFavorite:function(a,g){var e=!1,d;for(d in this._favorites)if(this._favorites[d].path===a){var c=this._favorites[d];if(c.name!==g)c.name=g,e=!0}e&&(this._favorites.sort(this._sorter),this._storeFavorites(),this._notifyListeners())},hasFavorite:function(a){for(var g in this._favorites)if(this._favorites[g].path===a)return!0;return!1},_SPECIAL_CHARS:"^$\\+[]().",queryFavorites:function(a){var g;
if(!a)return this._favorites;var e="";for(g=0;g<a.length;g++){var d=a.charAt(g);e+=d==="*"?".*":d==="?"?".?":this._SPECIAL_CHARS.indexOf(d)>=0?"\\"+d:d}e+=".*";a=RegExp(e);e=[];for(g in this._favorites)this._favorites[g].name.search(a)===0&&e.push(this._favorites[g]);return e},_initializeFavorites:function(){var a=this;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(g){var e,g=g.get("navigate");typeof g==="string"&&(g=JSON.parse(g));if(g)for(e in g)g[e].isFavorite=
!0,a._favorites.push(g[e]);a._favorites.sort(a._sorter);a._notifyListeners()})},_storeFavorites:function(){var a=this._favorites;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(g){g.put("navigate",a)})},_sorter:function(a,g){var e=a.name.toLowerCase(),d=g.name.toLowerCase();return e>d?1:e<d?-1:0},getFavorites:function(){return{navigator:this._favorites}}};a.prototype.constructor=a;return{FavoritesService:a}});
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 l(){}l.prototype.navbar="#333";l.prototype.button="#777777";l.prototype.location="#EFEFEF";l.prototype.selection="FEC";l.prototype.sidepanel="#FBFBFB";l.prototype.mainpanel="white";l.prototype.navtext="#bfbfbf";l.prototype.content="#3087B3";l.prototype.search="#444";l.prototype.toolpanel="white";l.prototype.writeNavigationStyle=function(){var i="",a=[],f=new j.ThemeClass("orionPage");
f.style.backgroundColor="#fdfdfd";f.style.width="100%";f.style.height="100%";a.push(f);f=new j.ThemeClass("topRowBanner");f.style.margin="0";f.style.border="0";f.style.backgroundColor=this.navbar;f.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+this.navbar+"), color-stop(100%,"+this.navbar+"))";f.style.background="-moz-linear-gradient(top,"+this.navbar+"0%,"+this.navbar+"100%)";f.style.height="28px";a.push(f);f=new j.ThemeClass("a");f.style.textDecoration="none";
f.style.color=this.content;a.push(f);f=new j.ThemeClass("navlink");f.style.display="inline-block";f.style.padding="2px";f.style.color=this.content;a.push(f);f=new j.ThemeClass("primaryNav");f.style.color=this.navtext;f.style.fontSize="8pt";f.style.fontWeight="normal";f.style.paddingTop="6px";f.style.verticalAlign="baseline";a.push(f);f=new j.ThemeClass("primaryNav a");f.style.fontSize="8pt";f.style.color=this.navtext;f.style.marginRight="6px";f.style.marginLeft="6px";f.style.verticalAlign="baseline";
f.style.textDecoration="none";a.push(f);f=new j.ThemeClass("primaryNav a:hover");f.style.color="#bfbfbf";f.style.cursor="hand";f.style.color="white";f.style.fontWeight="normal";a.push(f);for(var g in a)i+=a[g].toString();return i};l.prototype.writeLocationStyle=function(){var i="",a=[],f=new j.ThemeClass("titleArea");f.style.margin="0";f.style.paddingTop="5px";f.style.border="0";f.style.background=this.location;f.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+this.location+
"), color-stop(100%,"+this.location+"))";f.style.borderBottom="1px solid "+this.location;f.style.minHeight="20px";a.push(f);f=new j.ThemeClass("breadcrumb");f.style.fontSize="8pt";f.style.textDecoration="none";f.style.color=this.content;f.style.paddingTop="2px";a.push(f);f=new j.ThemeClass("a.breadcrumb:hover");f.style.textDecoration="none";f.style.borderBottom="1px dotted";f.style.color="#F58B0F";f.style.cursor="pointer";a.push(f);f=new j.ThemeClass("breadcrumbSeparator");f.style.fontSize="8pt";
f.style.textDecoration="none";f.style.color=this.navbar;f.style.fontWeight="bold";a.push(f);f=new j.ThemeClass("currentLocation");f.style.fontWeight="bold";f.style.fontSize="8pt";f.style.color=this.navbar;f.style.textDecoration="none";f.style.textWrap="normal";f.style.lineHeight="10pt";a.push(f);f=new j.ThemeClass("a.currentLocation:hover");f.style.fontWeight="bold";f.style.fontSize="10pt";f.style.color="#666666";f.style.textDecoration="none";f.style.borderBottom="0";a.push(f);f=new j.ThemeClass("navlinkonpage");
f.style.color=this.content;a.push(f);for(var g in a)i+=a[g].toString();return i};l.prototype.writeButtonStyle=function(){var i="",a=[],f=new j.ThemeClass("commandButton");f.style.color="#222";f.style.border="1px solid #dedede";f.style.backgroundColor=this.button;f.style.textAlign="center";f.style.verticalAlign="baseline";f.style.cursor="pointer";f.style.display="inline-block";f.style.padding="6px";f.style.paddingTop="4px";f.style.borderRadius="1px";f.style.lineHeight="12px";f.style.fontSize="8pt";
f.style.userSelect="none";a.push(f);f=new j.ThemeClass("commandButton:over");f.style.backgroundColor="#e6e6e6";f.style.border="1px solid #808080";a.push(f);f=new j.ThemeClass("commandMenu");f.style.color="#222";f.style.display="inline-block";f.style.verticalAlign="baseline";f.style.margin="0";f.style.fontSize="8pt";f.style.fontWeight="normal";f.style.border="1px solid #dedede";f.style.backgroundColor="#efefef";f.style.cursor="pointer";f.style.borderRadius="1px";a.push(f);f=new j.ThemeClass("commandMenuItem");
f.style.border="0";f.style.padding="0";f.style.margin="0";a.push(f);for(var g in a)i+=a[g].toString();return i};l.prototype.writeMainStyle=function(){var i="",a=[],f=new j.ThemeClass("searchbox");f.style.backgroundImage="url(../images/core_sprites.png)";f.style.backgroundRepeat="no-repeat";f.style.backgroundPosition="4px -297px";f.style.width="12px";f.style.height="12px";f.style.backgroundColor=this.search;f.style.border="1px solid "+this.search;f.style.fontSize="11px";f.style.width="15em";f.style.height=
"16px";f.style.borderRadius="10px";f.style.color="#999";f.style.padding="0";f.style.paddingLeft="20px";f.style.marginLeft="5px";f.style.marginTop="6px !important";f.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";a.push(f);f=new j.ThemeClass("searchbox:focus");f.style.color="white";f.style.outline="none";a.push(f);f=new j.ThemeClass("checkedRow");f.style.cssText="background-color:"+this.selection+" !important;";a.push(f);f=new j.ThemeClass("navbar-item-selected");
f.style.background=this.selection;f.style.color=this.content;a.push(f);f=new j.ThemeClass("auxpane");f.style.border="0";f.style.background=this.sidepanel;f.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+this.sidepanel+"), color-stop(100%,"+this.sidepanel+"))";f.style.background="-moz-linear-gradient(top, "+this.sidepanel+" 0%, "+this.sidepanel+" 100%)";f.style.overflowX="auto";f.style.minWidth="200px";f.style.paddingTop="16px";a.push(f);f=new j.ThemeClass("mainpane");
f.style.background=this.mainpanel;f.style.border=0;a.push(f);f=new j.ThemeClass("mainToolbar");f.style.background=this.toolpanel;f.style.height="31px";f.style.borderBottom="1px solid #ebebeb";a.push(f);for(var g in a)i+=a[g].toString();return i};l.prototype.render=function(){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};l.prototype.getSheet=function(i){i.navbar.value?(this.navbar=i.navbar.value,
this.button=i.button.value,this.location=i.location.value,this.selection=i.selection.value,this.sidepanel=i.sidepanel.value,this.mainpanel=i.mainpanel.value,this.navtext=i.navtext.value,this.search=i.search.value,this.content=i.content.value,this.toolpanel=i.toolpanel.value):(this.navbar=i.navbar,this.button=i.button,this.location=i.location,this.selection=i.selection,this.sidepanel=i.sidepanel,this.mainpanel=i.mainpanel,this.navtext=i.navtext,this.search=i.search,this.content=i.content,this.toolpanel=
i.toolpanel);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};return{ThemeSheetWriter:l}});
define("orion/inputCompletion/inputCompletion",[],function(){function j(j,i,a){this._inputField=j;if(typeof this._inputField==="string")this._inputField=document.getElementById(this._inputField);this._binderFunc=i;(j=a?a.group:null)||(j=this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=j+"__completion__";this._proposeFromStart=a?a.proposeFromStart:!1;this._extendedProvider=a?a.extendedProvider:null;this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;
this._dataList=[];this._initUI();var f=this;this._completionUIContainer.addEventListener("mousedown",function(){f._mouseDown=!0});this._completionUIContainer.addEventListener("mouseup",function(){f._mouseDown=!1});this._inputField.addEventListener("blur",function(){f._mouseDown?window.setTimeout(function(){f._inputField.focus()},200):f._dismiss()});this._inputField.addEventListener("keydown",function(a){f.onKeyDown(a)});this._inputField.addEventListener("input",function(){f._proposeOn(f._inputField.value)});
this._inputField.addEventListener("focus",function(){if(f._dismissed&&f._binderFunc)f._dismissing?f._dismissing=!1:f._binderFunc&&f._binderFunc(function(a){f._bind(a);f._proposeOn(f._inputField.value)})})}j.prototype.onKeyDown=function(j){if(this._dismissed)return!0;var i=j.charCode||j.keyCode;if(i===13){if(this._proposalList&&this._proposalList.length>0&&this._proposalIndex>=0&&this._proposalIndex<this._proposalList.length)return j.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,
j.ctrlKey),j.stopPropagation(),!1}else if((i===40||i===38)&&this._proposalList&&this._proposalList.length>0)return j.preventDefault(),this._walk(i===40),j.stopPropagation(),!1;else if(i===27)return j.preventDefault(),this._dismiss(),!1;return!0};j.prototype._bind=function(j){this._dataList=j};j.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};j.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};j.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)};j.prototype._createProposalLink=function(j,i,a,f){var g=document.createElement("a");g.href=require.toUrl(i);g.appendChild(this._createBoldText(j,
a,f));return g};j.prototype._createBoldText=function(j,i,a){if(i<0)return document.createTextNode(j);var f=document.createElement("span"),g;0!==i&&(g=document.createTextNode(j.substring(0,i)),f.appendChild(g));var e=document.createElement("b");f.appendChild(e);g=document.createTextNode(j.substring(i,i+a));e.appendChild(g);i+a<j.length-1&&(g=document.createTextNode(j.substring(i+a)),f.appendChild(g));return f};j.prototype._proposeOnCategory=function(j,i){if(i.length!==0){var a=this;if(j){var f=document.createElement("li");
f.className="inputCompletionLICategory";var g=document.createTextNode(j);f.appendChild(g);this._completionUL.appendChild(f)}for(g=0;g<i.length;g++){f=document.createElement("li");f.onmouseover=function(d){a._selectProposal(d.currentTarget)};f.onclick=function(d){a._dismiss(d.currentTarget.completionItem.value)};f.className="inputCompletionLINormal";f.completionItem=i[g].item;if(typeof i[g].item.value==="string"){var e=this._createBoldText(i[g].item.value,i[g].boldIndex,i[g].boldLength);f.appendChild(e)}else i[g].item.value.name&&
i[g].item.value.type==="link"&&f.appendChild(this._createProposalLink(i[g].item.value.name,i[g].item.value.value,i[g].boldIndex,i[g].boldLength));this._completionUL.appendChild(f);this._proposalList.push({item:i[g].item,domNode:f})}}};j.prototype._domNode2Index=function(j){for(var i=0;i<this._proposalList.length;i++)if(this._proposalList[i].domNode===j)return i;return-1};j.prototype._highlight=function(j,i){var a=j,f=!1;isNaN(a)||(f=!0,a=this._proposalList&&j>=0&&j<this._proposalList.length?this._proposalList[j].domNode:
null);if(a)a.className=i?"inputCompletionLISelected":"inputCompletionLINormal",i&&f&&(a.offsetTop<this._completionUIContainer.scrollTop?a.scrollIntoView(!0):a.offsetTop+a.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&a.scrollIntoView(!1))};j.prototype._selectProposal=function(j){var i=j;isNaN(i)&&(i=this._domNode2Index(j));if(i!==this._proposalIndex)this._highlight(this._proposalIndex,!1),this._proposalIndex=i,this._highlight(this._proposalIndex,!0)};
j.prototype._dismiss=function(j,i){if(!this._mouseDown){this._dismissed=!0;this._proposalList=null;this._proposalIndex=-1;if(typeof j==="string")this._inputField.value=j,this._dismissing=!0,this._inputField.focus();else if(j&&j.name&&j.type==="link")i?window.open(j.value):window.location.href=j.value;var a=this;window.setTimeout(function(){a._completionUIContainer.style.display="none"},200)}};j.prototype._show=function(){if(this._proposalList&&this._proposalList.length>0){for(var j=0,i=0,a=this._inputField;a;)j+=
a.offsetLeft,i+=a.offsetTop,a=a.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=i+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=j+"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"};j.prototype._walk=function(j){j=this._proposalIndex+(j?
1:-1);j<-1?j=this._proposalList.length-1:j>=this._proposalList.length&&(j=-1);this._selectProposal(j)};j.prototype._proposeOnList=function(j,i,a){for(var f="",g=[],e=i?i.length:0,d=0;d<j.length;d++)if(j[d].type==="category")this._proposeOnCategory(f,g),f=j[d].label,g=[];else{var c=!0,b=-1;if(i&&a){var h;typeof j[d].value==="string"?h=j[d].value.toLowerCase():j[d].value.name&&(h=j[d].value.name.toLowerCase());b=h.indexOf(i);b<0?c=!1:this._proposeFromStart&&(c=b===0)}c&&g.push({item:j[d],boldIndex:b,
boldLength:e})}this._proposeOnCategory(f,g)};j.prototype._proposeOn=function(j){this._completionUL.textContent="";var i=j?j.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,i,!0);if(this._extendedProvider&&i){var a=this;this._extendedProvider(j,function(f){if(f)for(var g=0;g<f.length;g++)a._proposeOnList(f[g].proposals,f[g].filterForMe?i:j,f[g].filterForMe);a._show()},[])}else this._show()};j.prototype.constructor=j;return{InputCompletion:j}});
define("orion/globalSearch/nls/root/messages",{"Files that contain:":"Files that contain:",Search:"Search","All types":"All types","File type:":"File type:","All ${0} files":"All ${0} files","Type a search term":"Type a search term","Case sensitive":"Case sensitive","Regular expression":"Regular expression"});
define("orion/globalSearch/nls/messages",["orion/i18n!orion/globalSearch/nls/messages","orion/globalSearch/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(j,l,i,a){function f(){}f.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'<div class="dialog" role="dialog"><div class="dialogTitle"><span id="title" class="dialogTitleText layoutLeft"></span><span tabindex="0" role="button" aria-label="Close" class="dialogDismiss layoutRight core-sprite-close imageSprite" id="closeDialog"></span></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 e=document.createRange();e.selectNode(a);e=e.createContextualFragment(this.CONTAINERTEMPLATE);a.appendChild(e);this.$frame=a.lastChild;this.title&&i.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=i.$("#closeDialog",this.$frame);var d=this;this.$close.addEventListener("click",function(){d.hide()},!1);this.$parent=i.$(".dialogContent",this.$frame);e=document.createRange();e.selectNode(this.$parent);
a=e.createContextualFragment(this.TEMPLATE);this.messages&&i.processTextNodes(a,this.messages);this.$parent.appendChild(a);this.$buttonContainer=i.$(".dialogButtons",this.$frame);this._makeButtons();this.$close.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&d.hide()},!1);this.$frame.addEventListener("keydown",function(a){a.keyCode===i.KEY.ESCAPE?d.hide():a.keyCode===i.KEY.ENTER&&typeof d._defaultCallback==="function"&&d._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 f=this;this.buttons.forEach(function(e){var d=a.createButton(e.text,e.callback);if(e.id)d.id=e.id,f["$"+d.id]=d;if(e.isDefault)f._defaultCallback=e.callback,f._defaultButton=d;f.$buttonContainer.appendChild(d)})}},_makeModal:function(){var a=this;this.$frame.addEventListener("blur",function(b){a.$lastFocusedElement=b.target},
!0);this._modalListener=function(b){var c=!i.contains(a.$frame,b.target);if(c)for(var d=0;d<a.$$modalExclusions.length;d++)if(i.contains(a.$$modalExclusions[d],b.target)){c=!1;break}c&&(window.setTimeout(function(){(a.$lastFocusedElement||a.$parent).focus()},0),i.stop(b))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);var e=this.$frameParent.childNodes,d=!1;this._addedBackdrop=[];for(var c=0;c<e.length;c++){for(var b=
0;b<this.$$modalExclusions.length;b++)if(i.contains(this.$$modalExclusions[b],e[c])){d=!0;break}!d&&e[c]!==a.$frame&&e[c].classList&&!e[c].classList.contains("tooltipContainer")&&(b=e[c],b.classList.contains("modalBackdrop")||(b.classList.add("modalBackdrop"),this._addedBackdrop.push(b)))}(e=i.lastTabbable(this.$buttonContainer)||i.lastTabbable(this.$parent))&&e.addEventListener("keydown",function(b){if(b.keyCode===i.KEY.TAB){var c=a._getFirstFocusField();c&&c!==b.target&&c.focus();i.stop(b)}},!1)},
_addChildDialog:function(a){this.$$modalExclusions.push(a.$frame||a.$parent)},_bindElements:function(a){for(var e=0;e<a.childNodes.length;e++){var d=a.childNodes[e];d.id&&(this["$"+d.id]=d);this._bindElements(d)}},hide:function(){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");typeof this._afterHiding===
"function"&&this._afterHiding();var a=this;this.keepAlive||window.setTimeout(function(){a.destroy()},0)},show:function(a){typeof this._beforeShowing==="function"&&this._beforeShowing();var e=i.bounds(this.$frame),d=i.bounds(document.documentElement),c;a?(c=i.bounds(a),a=c.top+c.height+4,c=c.left+4,a+e.height>d.height&&(a=Math.max(0,d.height-e.height-4)),c+e.width>d.width&&(c=Math.max(0,d.width-e.width-4))):(c=Math.max(0,(d.width-e.width)/2),a=Math.max(0,(d.height-e.height)/2));this.$lastFocusedElement=
document.activeElement;this.$frame.style.top=a+"px";this.$frame.style.left=c+"px";this.$frame.classList.add("dialogShowing");typeof this._afterShowing==="function"&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return i.firstTabbable(this.$parent)||this._defaultButton||i.firstTabbable(this.$buttonContainer)||this.$close},destroy:function(){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}};f.prototype.constructor=f;return{Dialog:f}});
(function(){var j=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],l=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,i=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,a=typeof location!=="undefined"&&location.href,f=a&&location.protocol&&location.protocol.replace(/\:/,""),g=a&&location.hostname,e=a&&(location.port||void 0),d=[];define("text",[],function(){var c,b,h;typeof window!=="undefined"&&window.navigator&&window.document?b=function(b,a){var h=c.createXhr();h.open("GET",b,!0);h.onreadystatechange=
function(){h.readyState===4&&a(h.responseText)};h.send(null)}:typeof process!=="undefined"&&process.versions&&process.versions.node?(h=require.nodeRequire("fs"),b=function(b,a){var c=h.readFileSync(b,"utf8");c.indexOf("\ufeff")===0&&(c=c.substring(1));a(c)}):typeof Packages!=="undefined"&&(b=function(b,a){var h=new java.io.File(b),c=java.lang.System.getProperty("line.separator"),h=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(h),"utf-8")),k,p,n="";try{k=new java.lang.StringBuffer;
(p=h.readLine())&&p.length()&&p.charAt(0)===65279&&(p=p.substring(1));for(k.append(p);(p=h.readLine())!==null;)k.append(c),k.append(p);n=String(k.toString())}finally{h.close()}a(n)});return c={version:"1.0.7",strip:function(b){if(b){var b=b.replace(l,""),a=b.match(i);a&&(b=a[1])}else b="";return b},jsEscape:function(b){return b.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r")},createXhr:function(){var b,a,
h;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else for(a=0;a<3;a++){h=j[a];try{b=new ActiveXObject(h)}catch(c){}if(b){j=[h];break}}if(!b)throw Error("createXhr(): XMLHttpRequest not available");return b},get:b,parseName:function(b){var a=!1,h=b.indexOf("."),c=b.substring(0,h),b=b.substring(h+1,b.length),h=b.indexOf("!");h!==-1&&(a=b.substring(h+1,b.length),a=a==="strip",b=b.substring(0,h));return{moduleName:c,ext:b,strip:a}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(b,
a,h,d){var k=c.xdRegExp.exec(b),p;if(!k)return!0;b=k[2];k=k[3];k=k.split(":");p=k[1];k=k[0];return(!b||b===a)&&(!k||k===h)&&(!p&&!k||p===d)},finishLoad:function(b,a,h,e,k){h=a?c.strip(h):h;k.isBuild&&(d[b]=h);e(h)},load:function(b,h,d,i){if(i.isBuild&&!i.inlineText)d();else{var k=c.parseName(b),p=k.moduleName+"."+k.ext,n=h.toUrl(p),u=i&&i.text&&i.text.useXhr||c.useXhr;!a||u(n,f,g,e)?c.get(n,function(a){c.finishLoad(b,k.strip,a,d,i)}):h([p],function(b){c.finishLoad(k.moduleName+"."+k.ext,k.strip,b,
d,i)})}},write:function(b,a,h){if(a in d){var e=c.jsEscape(d[a]);h.asModule(b+"!"+a,"define(function () { return '"+e+"';});\n")}},writeFile:function(b,a,h,d,k){var a=c.parseName(a),p=a.moduleName+"."+a.ext,n=h.toUrl(a.moduleName+"."+a.ext)+".js";c.load(p,h,function(){var a=function(k){return d(n,k)};a.asModule=function(k,b){return d.asModule(k,n,b)};c.write(b,p,a,k)},k)}}})})();define("text!orion/banner/banner.html",[],function(){return'<header id="banner" role="banner" class="headerLayout">\n\t<\!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\>\n\t<\!-- Top row:  Logo + discovery links + search + user --\>\n\t<div id="staticBanner" class="primaryNav layoutBlock topRowBanner">\n\t\t<a id="home" class="layoutLeft logo"></a>\n\t\t<nav id="primaryNav" class="layoutLeft" role="navigation"></nav>\n\t\t<div class="layoutRight">\n\t\t\t<div id="globalActions" class="spacingLeft layoutLeft"></div>\n\t\t\t<div id="relatedLinks" class="spacingLeft layoutLeft" style="padding-top:1px;">\n\t\t\t\t<span tabindex="0" role="button" id="relatedTrigger" class="dropdownTrigger hidden">${Related}<span class="dropdownArrowDown"></span></span>\n\t\t\t\t<ul id="relatedDropdown" class="dropdownMenu" role="menu"></ul>\n\t\t\t</div>\n\t\t\t<input type="text" id="search" autocomplete="off" class="layoutLeft spacingLeft searchbox" role="search">\n\t\t\t<div id="searchOptions" class="layoutLeft" style="padding-top:1px;"></div>\n\t\t\t<div id="userMenu" class="spacingLeft layoutLeft">\n\t\t\t\t<span id="userTrigger" tabindex="0" role="button" class="dropdownTrigger">${Options}<span class="dropdownArrowDown"></span></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\t<\!-- Task + resource (title) area --\>\n\t<div id="titleArea" class="layoutBlock titleArea">\n\t\t<div class="clear" style="padding-bottom:5px;display:inline;"><span id="location" class="currentLocation"></span><span id="dirty" class="currentLocation"></span></div>\n\t\t<div class="layoutRight pageNav">\n\t\t\t<img class="progressPane" id="progressPane" tabindex="0" role="progressbar"></img>\n\t\t</div>\n\t</div>\n</header>'});
define("text!orion/banner/footer.html",[],function(){return'<footer id="footerContent" class="layoutBlock footerLayout" role="contentinfo">\n\t<\!-- Requires some js code to bind the NLS variables  --\>\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<a href="http://wiki.eclipse.org/Orion/FAQ" target="_blank">${FAQ}</a>\n\t\t<a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Orion&version=2.0" target="_blank">${Report a Bug}</a>|\n\t\t<a href="http://www.eclipse.org/legal/privacy.php" target="_blank">${Privacy Policy}</a>|\n\t\t<a href="http://www.eclipse.org/legal/termsofuse.php" target="_blank">${Terms of Use}</a>|\n\t\t<a href="http://www.eclipse.org/legal/copyright.php" target="_blank">${Copyright Agent}</a>\n\t</div>\n</footer>'});
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<div class="layoutRight" style="padding-left:7px;padding-right:7px;margin-top:3px;" id="settingsTab" style="visibility:hidden;">\n\t<div class="layoutRight core-sprite-settings" id="settingsAction" role="settings" aria-live="off" style="visibility:hidden;"></div>\n</div>\n<div class="layoutRight status" id="statusPane" role="status" aria-live="off"></div>\n<ul class="layoutRight commandList pageActions" id="pageNavigationActions"></ul>\n<div id="notificationArea" class="layoutLeft layoutBlock slideContainer">\n\t<div class="layoutLeft" id="notifications" aria-live="assertive" aria-atomic="true"></div>\n\t<div class="layoutRight"><span tabindex="0" role="button" class="layoutRight core-sprite-close imageSprite" id="closeNotifications"></span></div>\n</div>\n\t\t\n\t'});
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,l,i){return{slideoutHTMLFragment:function(a){var f=document.createElement("div");f.innerHTML=i;var g=l.$("#slideContainer",f);g.id=a+g.id;g=l.$("#pageCommandParameters",f);g.id=a+g.id;g=l.$("#pageCommandDismiss",f);g.id=a+g.id;return f.innerHTML}}});define("text!orion/compare/compare-features.html",[],function(){return'<div id="topWidget_id" style="height:100%;width:100%;position:relative">\n\t<div class="leftPanelLayout ">\n\t\t<div class="titleContainer" id="left_title_id"></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="titleContainer" id="right_title_id"></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/nls/root/messages",{"Copy current change from right to left":"Copy current change from right to left","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:"});
define("orion/compare/nls/messages",["orion/i18n!orion/compare/nls/messages","orion/compare/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/compare/diff-parser",[],function(){var j=j||{};j.DiffParser=function(){function j(a,f){this._lineDelimiter=a?a:i?"\r\n":"\n";this._diffLineDelimiter=f?f:this._lineDelimiter;this._DEBUG=!1}var i=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(a){this._diffLineDelimiter=this._lineDelimiter=a},getDiffArray:function(){return{array:this._diffContents,index:this._diffContentIndex}},parse:function(a,f,g,e){this._init();if(f==="")return{outPutFile:a,mapper:[]};this._oFileContents=a===""?[]:a.split(this._lineDelimiter);this._diffContents=f.split(this._diffLineDelimiter);f=this._diffContents.length;this._hunkRanges=[];for(var d=0;d<f;d++){var c=this._parseHunkRange(d);c&&this._hunkRanges.push(c)}if(0===this._hunkRanges.length)return{outPutFile:a,
mapper:[]};if(this._DEBUG){console.log("***Diff contents: \n");for(a=0;a<this._diffContents.length;a++)console.log(this._diffContents[a]);console.log("***Hunk ranges: \n");console.log(JSON.stringify(this._hunkRanges))}for(a=0;a<this._hunkRanges.length;a++)this._parseHunkBlock(a);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(g);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));(e===void 0||!e)&&this._buildNewFile();return{outPutFile:this._nFileContents.join(this._diffLineDelimiter),mapper:this._deltaMap}},_logMap:function(){for(var a=0;a<this._deltaMap.length;a++)if(console.log(JSON.stringify(this._deltaMap[a])),
this._deltaMap[a][2]>0){console.log("    **Diff content on change/add: \n");for(var f=0;f<this._deltaMap[a][0];f++)console.log("    "+this._diffContents[this._deltaMap[a][2]+f-1])}},_logNewFile:function(){for(var a=0;a<this._nFileContents.length;a++)console.log(this._nFileContents[a])},_createBlock:function(a,f,g,e){e===g&&a===" "||(g=[g,e-g,"s"],a==="-"?g[2]="r":a==="+"?g[2]="a":a==="c"&&(g[2]="c"),f.push(g))},_createMinusBlock:function(a,f,g){var e=this._oBlocks.length;e===0||a!==this._oBlocks[e-
1][0]?(this._oBlocks.push([a===0?1:a,g]),this._nBlocks.push([f,0,-2])):this._oBlocks[e-1][1]+=g},_createPlusBlock:function(a,f,g,e){var d=this._nBlocks.length;d===0||f!==this._nBlocks[d-1][0]?(this._oBlocks.push([a===0?1:a,0]),this._nBlocks.push([f,g,e])):(this._nBlocks[d-1][1]+=g,this._nBlocks[d-1][2]=e)},_parseHunkBlock:function(a){for(var f=" ",g=this._hunkRanges[a][0]+1,e=a===this._hunkRanges.length-1?this._diffContents.length:this._hunkRanges[a+1][0],d=0,c=0,b=this._hunkRanges[a][1],h=this._hunkRanges[a][3],
m=g,o=g;o<e;o++)if(0!==this._diffContents[o].length){var i=this._diffContents[o][0];if(i==="\\"&&("\\ No newline at end of file"===this._diffContents[o].substring(0,this._diffContents[o].length-1)||"\\ No newline at end of file"===this._diffContents[o]))f==="-"?this._oNewLineAtEnd=!1:f===" "?this._oNewLineAtEnd=this._nNewLineAtEnd=!1:this._nNewLineAtEnd=!1,o>g&&this._diffContents[o-1][this._diffContents[o-1].length-1]==="\r"&&(this._diffContents[o-1]=this._diffContents[o-1].substring(0,this._diffContents[o-
1].length-1));else{switch(i){case "-":case "+":case " ":break;default:continue}if(f!==i){i==="+"&&(m=o);switch(f){case " ":b=this._hunkRanges[a][1]+d;h=this._hunkRanges[a][3]+c;break;case "-":this._createMinusBlock(b,h,this._hunkRanges[a][1]+d-b);break;case "+":this._createPlusBlock(b,h,this._hunkRanges[a][3]+c-h,m)}f=i}switch(i){case "-":d++;break;case "+":c++;break;case " ":d++,c++}}}switch(f){case "-":this._createMinusBlock(b,h,this._hunkRanges[a][1]+d-b);break;case "+":this._createPlusBlock(b,
h,this._hunkRanges[a][3]+c-h,m)}},_detectConflictes:function(a,f){if(a<0)return!1;for(var g=a+f,e=a;e<g;e++){var d=this._diffContents[e];if(d.indexOf("<<<<<")>-1||d.indexOf(">>>>>")>-1)return!0}return!1},_buildMap:function(a){for(var f=this._oBlocks.length,g=this._oFileContents.length,e=0,d=1,c=0;c<f;c++)d=this._oBlocks[c][0]-d,d>0&&(this._deltaMap.push([d,d,0]),e+=d),a&&this._detectConflictes(this._nBlocks[c][2],this._nBlocks[c][1])?this._deltaMap.push([this._nBlocks[c][1],this._oBlocks[c][1],this._nBlocks[c][2]+
1,1]):this._deltaMap.push([this._nBlocks[c][1],this._oBlocks[c][1],this._nBlocks[c][2]+1]),e+=this._oBlocks[c][1],d=this._oBlocks[c][0]+this._oBlocks[c][1];0<g-d&&(this._deltaMap.push([g-d+1,g-d+1,0]),e+=g-d+1);e<g&&(d=g-e,a=this._deltaMap[this._deltaMap.length-1],a[2]===0?(a[0]+=d,a[1]+=d):a[2]===-1?this._deltaMap.push([d,d,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([d,d,0]):(this._nNewLineAtEnd&&(a[0]+=d),this._oNewLineAtEnd&&(a[1]+=d)))},_buildNewFile:function(){for(var a=
1,f=!1,g=this._deltaMap.length,e=0;e<g;e++){f=!1;if(this._deltaMap[e][2]===0){for(var d=0;d<this._deltaMap[e][0];d++)this._nFileContents.push(this._oFileContents[a+d-1]);f=!0}else if(this._deltaMap[e][2]>0)for(d=0;d<this._deltaMap[e][0];d++)this._nFileContents.push(this._diffContents[this._deltaMap[e][2]+d-1].substring(1));a+=this._deltaMap[e][1]}this._nNewLineAtEnd&&!f&&this._nFileContents.push("")},_parseHRangeBody:function(a,f){if(0<a.indexOf(",")){var g=a.split(","),e=parseInt(g[0]),g=parseInt(g[1]);
f.push(e>=0?e:1);f.push(g>=0?g:1)}else e=parseInt(a),f.push(e>=0?e:1),f.push(1)},_parseHunkRange:function(a){var f=this._diffContents[a];if(!(8>f.length)&&"@@"===f.substring(0,2)){var f=f.substring(2),g=f.indexOf("@@");if(!(g<0)){var f=f.substring(0,g),g=f.indexOf("-"),e=f.indexOf("+");if(!(g<0||e<0))return a=[a],g<e?(f=f.substring(g+1).split("+"),this._parseHRangeBody(f[0],a),this._parseHRangeBody(f[1],a)):(f=f.substring(e+1).split("-"),this._parseHRangeBody(f[1],a),this._parseHRangeBody(f[0],a)),
a}}}};return j}();return j});
define("orion/editor/eventTarget",[],function(){function j(){}j.addMixin=function(l){var i=j.prototype,a;for(a in i)i.hasOwnProperty(a)&&(l[a]=i[a])};j.prototype={addEventListener:function(j,i,a){if(!this._eventTypes)this._eventTypes={};var f=this._eventTypes[j];f||(f=this._eventTypes[j]={level:0,listeners:[]});f.listeners.push({listener:i,useCapture:a})},dispatchEvent:function(j){var i=j.type;this._dispatchEvent("pre"+i,j);this._dispatchEvent(i,j);this._dispatchEvent("post"+i,j)},_dispatchEvent:function(j,
i){var a=this._eventTypes?this._eventTypes[j]:null;if(a){var f=a.listeners;try{if(a.level++,f)for(var g=0,e=f.length;g<e;g++)if(f[g]){var d=f[g].listener;typeof d==="function"?d.call(this,i):d.handleEvent&&typeof d.handleEvent==="function"&&d.handleEvent(i)}}finally{if(a.level--,a.compact&&a.level===0){for(g=f.length-1;g>=0;g--)f[g]||f.splice(g,1);f.length===0&&delete this._eventTypes[j];a.compact=!1}}}},isListening:function(j){return!this._eventTypes?!1:this._eventTypes[j]!==void 0},removeEventListener:function(j,
i,a){if(this._eventTypes){var f=this._eventTypes[j];if(f){for(var g=f.listeners,e=0,d=g.length;e<d;e++){var c=g[e];if(c&&c.listener===i&&c.useCapture===a){f.level!==0?(g[e]=null,f.compact=!0):g.splice(e,1);break}}g.length===0&&delete this._eventTypes[j]}}}};return{EventTarget:j}});define("orion/editor/i18n",{load:function(j,l,i){l.specified&&l.specified("orion/bootstrap")?l(["orion/i18n!"+j],function(a){i(a)}):i({})}});
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",Comment:"Comment","Flat outline":"Flat outline",incrementalFind:"Incremental find: ${0}",incrementalFindNotFound:"Incremental find: ${0} (not found)",find:"Find...",
undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",findPrevious:"Find Previous Occurrence",incrementalFindKey:"Incremental Find",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",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}"});
define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(j,l){var i={root:l},a;for(a in j)j.hasOwnProperty(a)&&typeof i[a]==="undefined"&&(i[a]=j[a]);return i});
define("orion/editor/contentAssist",["i18n!orion/editor/nls/messages","orion/editor/keyBinding","orion/editor/eventTarget","orion/Deferred","orion/editor/util"],function(j,l,i,a,f){var g,e,d;function c(b){this.textView=b;this.state=g;this.providers=[];var a=this;this.contentAssistListener={onModelChanging:function(b){a.isDeactivatingChange(b)?a.setState(g):a.state===e&&a.setState(d)},onScroll:function(){a.setState(g)},onSelection:function(){var b=a.state;if(b===e||b===d)a.computeProposals(),a.setState(d)}};
b.setKeyBinding(f.isMac?new l.KeyBinding(" ",!1,!1,!1,!0):new l.KeyBinding(" ",!0),"contentAssist");b.setAction("contentAssist",function(){a.activate();return!0},{name:j.contentAssist})}function b(b,a){this.contentAssist=b;this.widget=a;this.proposals=[];var h=this;this.contentAssist.addEventListener("ProposalsComputed",function(k){h.proposals=k.data.proposals;h.selectedIndex=h.proposals.length?0:-1})}function h(b,a){this.contentAssist=b;this.textView=this.contentAssist.getTextView();this.isShowing=
this.textViewListenerAdded=!1;var h=this.textView.getOptions("parent").ownerDocument;this.parentNode=typeof a==="string"?h.getElementById(a):a;if(!this.parentNode){this.parentNode=f.createElement(h,"div");this.parentNode.className="contentassist";var k=h.getElementsByTagName("body")[0];if(k)k.appendChild(this.parentNode);else throw Error("parentNode is required");}var p=this;this.textViewListener={onMouseDown:function(k){k.event.target.parentElement!==p.parentNode&&p.contentAssist.deactivate()}};
this.contentAssist.addEventListener("ProposalsComputed",function(k){p.setProposals(k.data.proposals);p.show();if(!p.textViewListenerAdded)p.textView.addEventListener("MouseDown",p.textViewListener.onMouseDown),p.textViewListenerAdded=!0});this.contentAssist.addEventListener("Deactivating",function(){p.setProposals([]);p.hide();if(p.textViewListenerAdded)p.textView.removeEventListener("MouseDown",p.textViewListener.onMouseDown),p.textViewListenerAdded=!1;p.textViewListenerAdded=!1});this.scrollListener=
function(){p.isShowing&&p.position()};h.addEventListener("scroll",this.scrollListener)}g=1;e=2;d=3;var m={selected:" selected",hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",dfault:"proposal-default"};c.prototype={apply:function(b){if(!b)return!1;var a=this.textView.getCaretOffset(),h={proposal:b,start:a,end:a};this.setState(g);this.textView.setText(b.proposal||b,a,a);this.dispatchEvent({type:"ProposalApplied",data:h});return!0},activate:function(){this.state===g&&
this.setState(e)},deactivate:function(){this.setState(g)},getTextView:function(){return this.textView},isActive:function(){return this.state===e||this.state===d},isDeactivatingChange:function(b){var a=b.removedCharCount>0&&b.addedCharCount===0,h=this.textView,h=b.start+1<=h.getModel().getCharCount()&&/^\s*$/.test(h.getText(b.start,b.start+1));return b.removedLineCount>0||b.addedLineCount>0||a&&h},setState:function(b){var a;b===e?a="Activating":b===g&&(a="Deactivating");a&&this.dispatchEvent({type:a});
this.state=b;this.onStateChange(b)},onStateChange:function(b){if(b===g){if(this.listenerAdded)this.textView.removeEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.removeEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.removeEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!1}else if(b===e){if(!this.listenerAdded)this.textView.addEventListener("ModelChanging",this.contentAssistListener.onModelChanging),
this.textView.addEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.addEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!0;this.computeProposals()}},computeProposals:function(){var b=this;this._computeProposals(this.textView.getCaretOffset()).then(function(a){b.dispatchEvent({type:"ProposalsComputed",data:{proposals:a}})})},getPrefixStart:function(b){for(;b>0&&/[A-Za-z0-9_]/.test(this.textView.getText(b-1,b));)b--;return b},handleError:function(b){typeof console!==
"undefined"&&(console.log("Error retrieving content assist proposals"),console.log(b))},_computeProposals:function(b){var h=this.providers,c=this.textView,k=c.getModel(),p=c.getText(),n={line:k.getLine(k.getLineAtOffset(b)),prefix:c.getText(this.getPrefixStart(b),b),selection:c.getSelection()},u=this,h=h.map(function(k){var h=k.computeProposals||k.getProposals,c;try{typeof h==="function"&&(c=u.progress?u.progress.progress(h.apply(k,[p,b,n]),"Generating content assist proposal"):h.apply(k,[p,b,n]))}catch(d){u.handleError(d)}return a.when(c)});
return a.all(h,this.handleError).then(function(k){return k.reduce(function(k,b){return b instanceof Array?k.concat(b):k},[])})},setProviders:function(b){this.providers=b.slice(0)},setProgress:function(b){this.progress=b}};i.EventTarget.addMixin(c.prototype);b.prototype={cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},isActive:function(){return this.getContentAssist().isActive()},lineUp:function(){for(var b=this.selectedIndex===0?this.proposals.length-
1:this.selectedIndex-1;this.proposals[b].unselectable&&b>0;)b--;this.selectedIndex=b;this.widget&&this.widget.setSelectedIndex(this.selectedIndex);return!0},lineDown:function(){for(var b=this.selectedIndex===this.proposals.length-1?0:this.selectedIndex+1;this.proposals[b].unselectable&&b<this.proposals.length-1;)b++;this.selectedIndex=b;this.widget&&this.widget.setSelectedIndex(this.selectedIndex);return!0},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},
tab:function(){return this.widget?(this.widget.createAccessible(this),this.widget.parentNode.focus(),!0):!1}};h.prototype={onClick:function(b){this.contentAssist.apply(this.getProposal(b.target));this.textView.focus()},createDiv:function(b,a,h,k){var p=h.ownerDocument,n=f.createElement(p,"div");n.id="contentoption"+k;n.setAttribute("role","option");b.style==="hr"?b=f.createElement(p,"hr"):(n.className=this.calculateClasses(b.style,a),b=p.createTextNode(this.getDisplayString(b)),a&&this.parentNode.setAttribute("aria-activedescendant",
n.id));n.appendChild(b,n);h.appendChild(n)},createAccessible:function(b){this._isAccessible||this.parentNode.addEventListener("keydown",function(a){a.preventDefault();if(a.keyCode===27)return b.cancel();else if(a.keyCode===38)return b.lineUp();else if(a.keyCode===40)return b.lineDown();else if(a.keyCode===13)return b.enter();return!1});this._isAccessible=!0},calculateClasses:function(b,a){var h=m[b];if(!h)h=m.dfault;return a?h+m.selected:h},getDisplayString:function(b){return typeof b==="string"?
b:b.description&&typeof b.description==="string"?b.description:b.proposal},getProposal:function(b){for(var a=0,h=this.parentNode.firstChild;h!==null;h=h.nextSibling){if(h===b)return this.proposals[a]||null;a++}return null},setSelectedIndex:function(b){this.selectedIndex=b;this.selectNode(this.parentNode.childNodes[this.selectedIndex])},selectNode:function(b){for(var a=this.parentNode.childNodes,h=0;h<a.length;h++){var k=a[h],p=k.className.indexOf(m.selected);if(p>=0)k.className=k.className.substring(0,
p)+k.className.substring(p+m.selected.length);k===b&&(k.className+=m.selected,this.parentNode.setAttribute("aria-activedescendant",k.id),k.focus(),k.offsetTop<this.parentNode.scrollTop?k.scrollIntoView(!0):k.offsetTop+k.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight&&k.scrollIntoView(!1))}},setProposals:function(b){this.proposals=b},show:function(){if(this.proposals.length===0)this.hide();else{this.parentNode.innerHTML="";for(var b=0;b<this.proposals.length;b++)this.createDiv(this.proposals[b],
b===0,this.parentNode,b);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1},position:function(){var b=this.textView.getLocationAtOffset(this.textView.getCaretOffset());b.y+=this.textView.getLineHeight();this.textView.convert(b,"document","page");this.parentNode.style.position="fixed";
this.parentNode.style.left=b.x+"px";this.parentNode.style.top=b.y+"px";this.parentNode.style.display="block";this.parentNode.scrollTop=0;var a=this.parentNode.ownerDocument,h=a.documentElement.clientWidth;if(b.y+this.parentNode.offsetHeight>a.documentElement.clientHeight)this.parentNode.style.top=b.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px";if(b.x+this.parentNode.offsetWidth>h)this.parentNode.style.left=h-this.parentNode.offsetWidth+"px"}};return{ContentAssist:c,ContentAssistMode:b,
ContentAssistWidget:h}});
define("orion/editor/undoStack",[],function(){function j(a,f,g){this.offset=a;this.text=f;this.previousText=g}function l(){this.changes=[]}function i(a,f){this.view=a;this.size=f!==void 0?f:100;this.reset();var g=a.getModel();g.getBaseModel&&(g=g.getBaseModel());this.model=g;var e=this;this._listener={onChanging:function(a){e._onChanging(a)},onDestroy:function(a){e._onDestroy(a)}};g.addEventListener("Changing",this._listener.onChanging);a.addEventListener("Destroy",this._listener.onDestroy)}j.prototype=
{undo:function(a,f){this._doUndoRedo(this.offset,this.previousText,this.text,a,f)},redo:function(a,f){this._doUndoRedo(this.offset,this.text,this.previousText,a,f)},_doUndoRedo:function(a,f,g,e,d){var c=e.getModel();if(c.mapOffset&&e.annotationModel){var b=c.mapOffset(a,!0);if(b<0)for(var h=e.annotationModel.getAnnotations(a,a+1);h.hasNext();){var m=h.next();if(m.type==="orion.annotation.folding"){m.expand();b=c.mapOffset(a,!0);break}}if(b<0)return;a=b}e.setText(f,a,a+g.length);d&&e.setSelection(a,
a+f.length)}};l.prototype={add:function(a){this.changes.push(a)},end:function(a){this.endSelection=a.getSelection();this.endCaret=a.getCaretOffset()},undo:function(a,f){for(var g=this.changes.length-1;g>=0;g--)this.changes[g].undo(a,!1);if(f){var g=this.startSelection.start,e=this.startSelection.end;a.setSelection(this.startCaret?g:e,this.startCaret?e:g)}},redo:function(a,f){for(var g=0;g<this.changes.length;g++)this.changes[g].redo(a,!1);if(f){var g=this.endSelection.start,e=this.endSelection.end;
a.setSelection(this.endCaret?g:e,this.endCaret?e:g)}},start:function(a){this.startSelection=a.getSelection();this.startCaret=a.getCaretOffset()}};i.prototype={add:function(a){this.compoundChange?this.compoundChange.add(a):(this.stack.splice(this.index,this.stack.length-this.index,a),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--,this.cleanIndex--))},markClean:function(){this.endCompoundChange();this._commitUndo();this.cleanIndex=this.index},isClean:function(){return this.cleanIndex===
this.getSize().undo},canUndo:function(){return this.getSize().undo>0},canRedo:function(){return this.getSize().redo>0},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){var a=this.index,f=this.stack.length;this._undoStart!==void 0&&a++;return{undo:a,redo:f-a}},undo:function(){this._commitUndo();if(this.index<=0)return!1;var a=this.stack[--this.index];this._ignoreUndo=!0;a.undo(this.view,!0);this._ignoreUndo=!1;return!0},
redo:function(){this._commitUndo();if(this.index>=this.stack.length)return!1;var a=this.stack[this.index++];this._ignoreUndo=!0;a.redo(this.view,!0);this._ignoreUndo=!1;return!0},reset:function(){this.index=this.cleanIndex=0;this.stack=[];this._undoStart=void 0;this._undoText="";this._undoType=0;this._ignoreUndo=!1;this._compoundChange=void 0},startCompoundChange:function(){this._commitUndo();var a=new l;this.add(a);this.compoundChange=a;this.compoundChange.start(this.view)},_commitUndo:function(){if(this._undoStart!==
void 0)this._undoType===-1?this.add(new j(this._undoStart,"",this._undoText)):this.add(new j(this._undoStart,this._undoText,"")),this._undoStart=void 0,this._undoText="",this._undoType=0},_onDestroy:function(){this.model.removeEventListener("Changing",this._listener.onChanging);this.view.removeEventListener("Destroy",this._listener.onDestroy)},_onChanging:function(a){var f=a.text,g=a.start,e=a.removedCharCount,a=a.addedCharCount;if(!this._ignoreUndo){this._undoStart!==void 0&&!(a===1&&e===0&&this._undoType===
1&&g===this._undoStart+this._undoText.length||a===0&&e===1&&this._undoType===-1&&(g+1===this._undoStart||g===this._undoStart))&&this._commitUndo();if(!this.compoundChange)if(a===1&&e===0){if(this._undoStart===void 0)this._undoStart=g;this._undoText+=f;this._undoType=1;return}else if(a===0&&e===1){f=this._undoText.length>0&&this._undoStart===g;this._undoStart=g;this._undoType=-1;f?this._undoText+=this.model.getText(g,g+e):this._undoText=this.model.getText(g,g+e)+this._undoText;return}this.add(new j(g,
f,this.model.getText(g,g+e)))}}};return{UndoStack:i}});
define("orion/edit/nls/root/messages",{"Fetching ":"Fetching ","An error occurred: ":"An error occurred: ","No File Selected":"No File Selected","There are unsaved changes.  Do you still want to navigate away?":"There are unsaved changes.  Do you still want to navigate away?","Search Files":"Search Files","Enter search term:":"Enter search term:","Searching for occurrences of ":"Searching for occurrences of ","Toggle Outliner":"Toggle Outliner","There are unsaved changes.":"There are unsaved changes.",
Save:"Save","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?","Save this file":"Save this file","Go to Line":"Go to Line","Go to specified line number":"Go to specified line number","Go to line:":"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find","No response from server.  Check your internet connection and try again.":"No response from server.  Check your internet connection and try again.","Saving file {0}":"Saving file {0}",
"Running {0}":"Running {0}"});define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(j,l){var i={root:l};Object.keys(j).forEach(function(a){typeof i[a]==="undefined"&&(i[a]=j[a])});return i});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(j,l){function i(b,a,c){this.start=b;this.end=a;this._projectionModel=c;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function a(){}function f(b,h){var c=b.lastIndexOf("."),c=b.substring(c+1),d={title:j[c],style:{styleClass:"annotation "+c},html:"<div class='annotationHTML "+c+"'></div>",overviewStyle:{styleClass:"annotationOverview "+c}};h?d.lineStyle={styleClass:"annotationLine "+
c}:d.rangeStyle={styleClass:"annotationRange "+c};a.registerType(b,d)}function g(){}function e(b){this._annotations=[];var a=this;this._listener={onChanged:function(b){a._onChanged(b)}};this.setTextModel(b)}function d(b,a){this._view=b;this._annotationModel=a;var c=this;this._listener={onDestroy:function(b){c._onDestroy(b)},onLineStyle:function(b){c._onLineStyle(b)},onChanged:function(b){c._onAnnotationModelChanged(b)}};b.addEventListener("Destroy",this._listener.onDestroy);b.addEventListener("postLineStyle",
this._listener.onLineStyle);a.addEventListener("Changed",this._listener.onChanged)}i.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){this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;var b=this._projectionModel,a=b.getBaseModel();this._projection=
{start:a.getLineStart(a.getLineAtOffset(this.start)+1),end:a.getLineEnd(a.getLineAtOffset(this.end),!0)};b.addProjection(this._projection)}},expand:function(){if(!this.expanded)this.expanded=!0,this.html=this._expandedHTML,this.style=this._expandedStyle,this._projectionModel.removeProjection(this._projection)}};a.ANNOTATION_ERROR="orion.annotation.error";a.ANNOTATION_WARNING="orion.annotation.warning";a.ANNOTATION_TASK="orion.annotation.task";a.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";
a.ANNOTATION_BOOKMARK="orion.annotation.bookmark";a.ANNOTATION_FOLDING="orion.annotation.folding";a.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";a.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";a.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";a.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";a.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";a.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";a.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";
var c={};a.registerType=function(b,a){var d=a;if(typeof d!=="function")d=function(b,a,h){this.start=b;this.end=a;if(h)this.title=h},d.prototype=a;d.prototype.type=b;c[b]=d;return b};a.createAnnotation=function(b,a,c,d){return new (this.getType(b))(a,c,d)};a.getType=function(b){return c[b]};f(a.ANNOTATION_ERROR);f(a.ANNOTATION_WARNING);f(a.ANNOTATION_TASK);f(a.ANNOTATION_BREAKPOINT);f(a.ANNOTATION_BOOKMARK);f(a.ANNOTATION_CURRENT_BRACKET);f(a.ANNOTATION_MATCHING_BRACKET);f(a.ANNOTATION_CURRENT_SEARCH);
f(a.ANNOTATION_MATCHING_SEARCH);f(a.ANNOTATION_READ_OCCURRENCE);f(a.ANNOTATION_WRITE_OCCURRENCE);f(a.ANNOTATION_CURRENT_LINE,!0);a.registerType(a.ANNOTATION_FOLDING,i);g.addMixin=function(b){var a=g.prototype,c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c])};g.prototype={addAnnotationType:function(b){if(!this._annotationTypes)this._annotationTypes=[];this._annotationTypes.push(b)},getAnnotationTypePriority:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===
b)return a+1;return 0},getAnnotationsByType:function(b,a,c){b=b.getAnnotations(a,c);for(c=[];b.hasNext();)a=b.next(),this.getAnnotationTypePriority(a.type)!==0&&c.push(a);var d=this;c.sort(function(b,a){return d.getAnnotationTypePriority(b.type)-d.getAnnotationTypePriority(a.type)});return c},isAnnotationTypeVisible:function(b){return this.getAnnotationTypePriority(b)!==0},removeAnnotationType:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===
b){this._annotationTypes.splice(a,1);break}}};e.prototype={addAnnotation:function(b){if(b){var a=this._annotations,c=this._binarySearch(a,b.start);a.splice(c,0,b);this.onChanged({type:"Changed",added:[b],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(b,a){var c=this._annotations,d,e=0,f=function(){for(;e<c.length;){var k=c[e++];if(b===k.start||(b>k.start?b<k.end:k.start<a))return k;if(k.start>=a)break}return null};d=f();return{next:function(){var b=d;
b&&(d=f());return b},hasNext:function(){return d!==null}}},modifyAnnotation:function(b){if(b&&!(this._getAnnotationIndex(b)<0))this.onChanged({type:"Changed",added:[],removed:[],changed:[b]})},onChanged:function(b){return this.dispatchEvent(b)},removeAnnotations:function(b){var a=this._annotations,c,d;if(b){c=[];for(d=a.length-1;d>=0;d--){var e=a[d];e.type===b&&a.splice(d,1);c.splice(0,0,e)}}else c=a;this.onChanged({type:"Changed",removed:c,added:[],changed:[]})},removeAnnotation:function(b){if(b&&
(b=this._getAnnotationIndex(b),!(b<0)))this.onChanged({type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]})},replaceAnnotations:function(b,a){var c=this._annotations,d,e,f,k=[];if(b)for(d=b.length-1;d>=0;d--)f=b[d],e=this._getAnnotationIndex(f),e<0||(c.splice(e,1),k.splice(0,0,f));a||(a=[]);for(d=0;d<a.length;d++)f=a[d],e=this._binarySearch(c,f.start),c.splice(e,0,f);this.onChanged({type:"Changed",removed:k,added:a,changed:[]})},setTextModel:function(b){this._model&&this._model.removeEventListener("Changed",
this._listener.onChanged);(this._model=b)&&this._model.addEventListener("Changed",this._listener.onChanged)},_binarySearch:function(b,a){for(var c=b.length,d=-1,e;c-d>1;)e=Math.floor((c+d)/2),a<=b[e].start?c=e:d=e;return c},_getAnnotationIndex:function(b){for(var a=this._annotations,c=this._binarySearch(a,b.start);c<a.length&&a[c].start===b.start;){if(a[c]===b)return c;c++}return-1},_onChanged:function(b){var a=b.start,c=b.removedCharCount,d=this._annotations,e=a+c;if(0<d.length){for(var f={type:"Changed",
added:[],removed:[],changed:[],textModelChangedEvent:b},b=b.addedCharCount-c,c=0;c<d.length;c++){var k=d[c];k.start>=e?(k.start+=b,k.end+=b,f.changed.push(k)):k.end<=a||(k.start<a&&e<k.end?(k.end+=b,f.changed.push(k)):(d.splice(c,1),f.removed.push(k),c--))}if(f.added.length>0||f.removed.length>0||f.changed.length>0)this.onChanged(f)}}};l.EventTarget.addMixin(e.prototype);d.prototype={destroy:function(){var b=this._view;if(b)b.removeEventListener("Destroy",this._listener.onDestroy),b.removeEventListener("LineStyle",
this._listener.onLineStyle),this.view=null;(b=this._annotationModel)&&b.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var c;if(a.style){if(!b.style)b.style={};for(c in a.style)b.style[c]||(b.style[c]=a.style[c])}if(a.attributes){if(!b.attributes)b.attributes={};for(c in a.attributes)b.attributes[c]||(b.attributes[c]=a.attributes[c])}}return b},
_mergeStyleRanges:function(b,a){b||(b=[]);var c,d;for(d=0;d<b.length&&a;d++){var e=b[d];if(a.end<=e.start)break;if(!(a.start>=e.end)){c=this._mergeStyle({},e.style);c=this._mergeStyle(c,a.style);var f=[];f.push(d,1);a.start<e.start&&f.push({start:a.start,end:e.start,style:a.style});a.start>e.start&&f.push({start:e.start,end:a.start,style:e.style});f.push({start:Math.max(e.start,a.start),end:Math.min(e.end,a.end),style:c});a.end<e.end&&f.push({start:a.end,end:e.end,style:e.style});a=a.end>e.end?{start:e.end,
end:a.end,style:a.style}:null;Array.prototype.splice.apply(b,f)}}a&&(c=this._mergeStyle({},a.style),b.splice(d,0,{start:a.start,end:a.end,style:c}));return b},_onAnnotationModelChanged:function(b){function a(b){for(var k=0;k<b.length;k++)if(d.isAnnotationTypeVisible(b[k].type)){var h=b[k].start,n=b[k].end;e.getBaseModel&&(h=e.mapOffset(h,!0),n=e.mapOffset(n,!0));h!==-1&&n!==-1&&c.redrawRange(h,n)}}if(!b.textModelChangedEvent){var c=this._view;if(c){var d=this,e=c.getModel();a(b.added);a(b.removed);
a(b.changed)}}},_onDestroy:function(){this.destroy()},_onLineStyle:function(b){var a=this._annotationModel,c=b.textView.getModel(),d=a.getTextModel(),e=b.lineStart,f=b.lineStart+b.lineText.length;d!==c&&(e=c.mapOffset(e),f=c.mapOffset(f));for(a=a.getAnnotations(e,f);a.hasNext();)if(e=a.next(),this.isAnnotationTypeVisible(e.type)){if(e.rangeStyle){var f=e.start,k=e.end;d!==c&&(f=c.mapOffset(f,!0),k=c.mapOffset(k,!0));b.ranges=this._mergeStyleRanges(b.ranges,{start:f,end:k,style:e.rangeStyle})}if(e.lineStyle)b.style=
this._mergeStyle({},b.style),b.style=this._mergeStyle(b.style,e.lineStyle)}}};g.addMixin(d.prototype);return{FoldingAnnotation:i,AnnotationType:a,AnnotationTypeList:g,AnnotationModel:e,AnnotationStyler:d}});
define("orion/editor/textDND",[],function(){function j(j,i){this._view=j;this._undoStack=i;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var a=this;this._listener={onDragStart:function(f){a._onDragStart(f)},onDragEnd:function(f){a._onDragEnd(f)},onDragEnter:function(f){a._onDragEnter(f)},onDragOver:function(f){a._onDragOver(f)},onDrop:function(f){a._onDrop(f)},onDestroy:function(f){a._onDestroy(f)}};j.addEventListener("DragStart",this._listener.onDragStart);j.addEventListener("DragEnd",
this._listener.onDragEnd);j.addEventListener("DragEnter",this._listener.onDragEnter);j.addEventListener("DragOver",this._listener.onDragOver);j.addEventListener("Drop",this._listener.onDrop);j.addEventListener("Destroy",this._listener.onDestroy)}j.prototype={destroy:function(){var j=this._view;if(j)j.removeEventListener("DragStart",this._listener.onDragStart),j.removeEventListener("DragEnd",this._listener.onDragEnd),j.removeEventListener("DragEnter",this._listener.onDragEnter),j.removeEventListener("DragOver",
this._listener.onDragOver),j.removeEventListener("Drop",this._listener.onDrop),j.removeEventListener("Destroy",this._listener.onDestroy),this._view=null},_onDestroy:function(){this.destroy()},_onDragStart:function(j){var i=this._view,a=i.getSelection(),i=i.getModel();if(i.getBaseModel)a.start=i.mapOffset(a.start),a.end=i.mapOffset(a.end),i=i.getBaseModel();if(i=i.getText(a.start,a.end))this._dragSelection=a,j.event.dataTransfer.effectAllowed="copyMove",j.event.dataTransfer.setData("Text",i)},_onDragEnd:function(j){var i=
this._view;if(this._dragSelection){this._undoStack&&this._undoStack.startCompoundChange();(j=j.event.dataTransfer.dropEffect==="move")&&i.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var a=this._dropText,f=this._dropOffset;if(j)if(f>=this._dragSelection.end)f-=this._dragSelection.end-this._dragSelection.start;else if(f>=this._dragSelection.start)f=this._dragSelection.start;i.setText(a,f,f);i.setSelection(f,f+a.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&
this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(j){this._onDragOver(j)},_onDragOver:function(j){var i=j.event.dataTransfer.types;if(i){var a=!this._view.getOptions("readonly");a&&(a=i.contains?i.contains("text/plain"):i.indexOf("text/plain")!==-1);if(!a)j.event.dataTransfer.dropEffect="none"}},_onDrop:function(j){var i=this._view,a=j.event.dataTransfer.getData("Text");if(a)j=i.getOffsetAtLocation(j.x,j.y),this._dragSelection?(this._dropOffset=j,this._dropText=a):
(i.setText(a,j,j),i.setSelection(j,j+a.length))}};return{TextDND:j}});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/editor/util"],function(j,l){function i(a,f){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(a);this.setLineDelimiter(f)}i.prototype={find:function(a){if(this._text.length>1)this._text=[this._text.join("")];var f=a.string,g=f;!a.regex&&f&&(g=f.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"));var e=null,d;if(g){var f=a.reverse,c=a.wrap,b=a.wholeWord,h=a.caseInsensitive,m=a.start||0,i=a.end,a=a.end!==void 0,j=
"";j.indexOf("g")===-1&&(j+="g");h&&j.indexOf("i")===-1&&(j+="i");b&&(g="\\b"+g+"\\b");var q=this._text[0],k,p,n=0;a&&(q=q.substring(m,i),n=m);var u=RegExp(g,j);if(f)d=function(){var b=null;for(u.lastIndex=0;;){p=u.lastIndex;k=u.exec(q);if(p===u.lastIndex)return null;if(k){if(!(k.index<m)){if(!c||b)break;m=q.length}b={start:k.index+n,end:u.lastIndex+n}}else break}if(b)m=b.start;return b};else{if(!a)u.lastIndex=m;d=function(){for(;;){p=u.lastIndex;k=u.exec(q);if(p===u.lastIndex)break;if(k)return{start:k.index+
n,end:u.lastIndex+n};if(!(p!==0&&c))break}return null}}e=d()}return{next:function(){var b=e;b&&(e=d());return b},hasNext:function(){return e!==null}}},getCharCount:function(){for(var a=0,f=0;f<this._text.length;f++)a+=this._text[f].length;return a},getLine:function(a,f){var g=this.getLineCount();if(!(0<=a&&a<g))return null;var e=this._lineOffsets[a];if(a+1<g){g=this.getText(e,this._lineOffsets[a+1]);if(f)return g;for(var e=g.length,d;(d=g.charCodeAt(e-1))===10||d===13;)e--;return g.substring(0,e)}else return this.getText(e)},
getLineAtOffset:function(a){var f=this.getCharCount();if(!(0<=a&&a<=f))return-1;var g=this.getLineCount();if(a===f)return g-1;var e,d,c=this._lastLineIndex;if(0<=c&&c<g&&(e=this._lineOffsets[c],d=c+1<g?this._lineOffsets[c+1]:f,e<=a&&a<d))return c;for(var b=g,h=-1;b-h>1;)if(c=Math.floor((b+h)/2),e=this._lineOffsets[c],d=c+1<g?this._lineOffsets[c+1]:f,a<=e)b=c;else if(a<d){b=c;break}else h=c;return this._lastLineIndex=b},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},
getLineEnd:function(a,f){var g=this.getLineCount();if(!(0<=a&&a<g))return-1;if(a+1<g){g=this._lineOffsets[a+1];if(f)return g;for(var e=this.getText(Math.max(this._lineOffsets[a],g-2),g),d=e.length,c;(c=e.charCodeAt(d-1))===10||c===13;)d--;return g-(e.length-d)}else return this.getCharCount()},getLineStart:function(a){return!(0<=a&&a<this.getLineCount())?-1:this._lineOffsets[a]},getText:function(a,f){a===void 0&&(a=0);f===void 0&&(f=this.getCharCount());if(a===f)return"";for(var g=0,e=0,d;e<this._text.length;){d=
this._text[e].length;if(a<=g+d)break;g+=d;e++}for(var c=g,b=e;e<this._text.length;){d=this._text[e].length;if(f<=g+d)break;g+=d;e++}if(b===e)return this._text[b].substring(a-c,f-g);c=this._text[b].substring(a-c);g=this._text[e].substring(0,f-g);return c+this._text.slice(b+1,e).join("")+g},onChanging:function(a){return this.dispatchEvent(a)},onChanged:function(a){return this.dispatchEvent(a)},setLineDelimiter:function(a,f){a==="auto"&&(a=void 0,this.getLineCount()>1&&(a=this.getText(this.getLineEnd(0),
this.getLineEnd(0,!0))));this._lineDelimiter=a?a:l.platformDelimiter;if(f){var g=this.getLineCount();if(g>1){for(var e=Array(g),d=0;d<g;d++)e[d]=this.getLine(d);this.setText(e.join(this._lineDelimiter))}}},setText:function(a,f,g){a===void 0&&(a="");f===void 0&&(f=0);g===void 0&&(g=this.getCharCount());if(!(f===g&&a==="")){for(var e=this.getLineAtOffset(f),d=this.getLineAtOffset(g),c=f,b=g-f,h=d-e,m=a.length,i=0,j=this.getLineCount(),q=0,k=0,p=0,n=[];;){q!==-1&&q<=p&&(q=a.indexOf("\r",p));k!==-1&&
k<=p&&(k=a.indexOf("\n",p));if(k===-1&&q===-1)break;p=q!==-1&&k!==-1?q+1===k?k+1:(q<k?q:k)+1:q!==-1?q+1:k+1;n.push(f+p);i++}this.onChanging({type:"Changing",text:a,start:c,removedCharCount:b,addedCharCount:m,removedLineCount:h,addedLineCount:i});n.length===0&&(q=this.getLineStart(e),d=d+1<j?this.getLineStart(d+1):this.getCharCount(),f!==q&&(a=this.getText(q,f)+a,f=q),g!==d&&(a+=this.getText(g,d),g=d));d=m-b;for(q=e+h+1;q<j;q++)this._lineOffsets[q]+=d;e=[e+1,h].concat(n);Array.prototype.splice.apply(this._lineOffsets,
e);for(d=n=0;d<this._text.length;){q=this._text[d].length;if(f<=n+q)break;n+=q;d++}j=n;for(e=d;d<this._text.length;){q=this._text[d].length;if(g<=n+q)break;n+=q;d++}q=this._text[d];f=this._text[e].substring(0,f-j);g=q.substring(g-n);e=[e,d-e+1];f&&e.push(f);a&&e.push(a);g&&e.push(g);Array.prototype.splice.apply(this._text,e);if(this._text.length===0)this._text=[""];this.onChanged({type:"Changed",start:c,removedCharCount:b,addedCharCount:m,removedLineCount:h,addedLineCount:i})}}};j.EventTarget.addMixin(i.prototype);
return{TextModel:i}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(j,l){function i(a){this._model=a;this._projections=[]}i.prototype={addProjection:function(a){if(a){var f=this._model,g=this._projections;a._lineIndex=f.getLineAtOffset(a.start);a._lineCount=f.getLineAtOffset(a.end)-a._lineIndex;var e=a.text;e||(e="");a._model=typeof e==="string"?new j.TextModel(e,f.getLineDelimiter()):e;var f=this.mapOffset(a.start,!0),e=a.end-a.start,d=a._lineCount,c=a._model.getCharCount(),
b=a._model.getLineCount()-1;this.onChanging({type:"Changing",text:a._model.getText(),start:f,removedCharCount:e,addedCharCount:c,removedLineCount:d,addedLineCount:b});var h=this._binarySearch(g,a.start);g.splice(h,0,a);this.onChanged({type:"Changed",start:f,removedCharCount:e,addedCharCount:c,removedLineCount:d,addedLineCount:b})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(a,f){var g=this._projections,e=0,d,c;if(f){for(d=
0;d<g.length;d++){c=g[d];if(c.start>a)break;if(c.end>a)return-1;e+=c._model.getCharCount()-(c.end-c.start)}return a+e}for(d=0;d<g.length;d++){c=g[d];if(c.start>a-e)break;var b=c._model.getCharCount();if(c.start+b>a-e)return-1;e+=b-(c.end-c.start)}return a-e},removeProjection:function(a){var f,g=0;for(f=0;f<this._projections.length;f++){var e=this._projections[f];if(e===a){a=e;break}g+=e._model.getCharCount()-(e.end-e.start)}if(f<this._projections.length){var e=this._model,g=a.start+g,d=a.end-a.start,
c=a._lineCount,b=a._model.getCharCount(),h=a._model.getLineCount()-1;this.onChanging({type:"Changing",text:e.getText(a.start,a.end),start:g,removedCharCount:b,addedCharCount:d,removedLineCount:h,addedLineCount:c});this._projections.splice(f,1);this.onChanged({type:"Changed",start:g,removedCharCount:b,addedCharCount:d,removedLineCount:h,addedLineCount:c})}},_binarySearch:function(a,f){for(var g=a.length,e=-1,d;g-e>1;)d=Math.floor((g+e)/2),f<=a[d].start?g=d:e=d;return g},getCharCount:function(){for(var a=
this._model.getCharCount(),f=this._projections,g=0;g<f.length;g++){var e=f[g];a+=e._model.getCharCount()-(e.end-e.start)}return a},getLine:function(a,f){if(a<0)return null;var g=this._model,e=this._projections,d=0,c=[],b=0,h,m,i;for(h=0;h<e.length;h++){i=e[h];if(i._lineIndex>=a-d)break;m=i._model.getLineCount()-1;if(i._lineIndex+m>=a-d)if(b=a-(i._lineIndex+d),b<m)return i._model.getLine(b,f);else c.push(i._model.getLine(m));b=i.end;d+=m-i._lineCount}for(b=Math.max(b,g.getLineStart(a-d));h<e.length;h++){i=
e[h];if(i._lineIndex>a-d)break;c.push(g.getText(b,i.start));m=i._model.getLineCount()-1;if(i._lineIndex+m>a-d)return c.push(i._model.getLine(0,f)),c.join("");c.push(i._model.getText());b=i.end;d+=m-i._lineCount}e=g.getLineEnd(a-d,f);b<e&&c.push(g.getText(b,e));return c.join("")},getLineAtOffset:function(a){for(var f=this._model,g=this._projections,e=0,d=0,c=0;c<g.length;c++){var b=g[c];if(b.start>a-e)break;var h=b._model.getCharCount();if(b.start+h>a-e){g=a-(b.start+e);d+=b._model.getLineAtOffset(g);
e+=g;break}d+=b._model.getLineCount()-1-b._lineCount;e+=h-(b.end-b.start)}return f.getLineAtOffset(a-e)+d},getLineCount:function(){for(var a=this._projections,f=this._model.getLineCount(),g=0;g<a.length;g++){var e=a[g];f+=e._model.getLineCount()-1-e._lineCount}return f},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(a,f){if(a<0)return-1;for(var g=this._model,e=this._projections,d=0,c=0,b=0;b<e.length;b++){var h=e[b];if(h._lineIndex>a-d)break;var m=h._model.getLineCount()-
1;if(h._lineIndex+m>a-d)return h._model.getLineEnd(a-(h._lineIndex+d),f)+h.start+c;c+=h._model.getCharCount()-(h.end-h.start);d+=m-h._lineCount}return g.getLineEnd(a-d,f)+c},getLineStart:function(a){if(a<0)return-1;for(var f=this._model,g=this._projections,e=0,d=0,c=0;c<g.length;c++){var b=g[c];if(b._lineIndex>=a-e)break;var h=b._model.getLineCount()-1;if(b._lineIndex+h>=a-e)return b._model.getLineStart(a-(b._lineIndex+e))+b.start+d;d+=b._model.getCharCount()-(b.end-b.start);e+=h-b._lineCount}return f.getLineStart(a-
e)+d},getText:function(a,f){a===void 0&&(a=0);var g=this._model,e=this._projections,d=0,c=[],b,h,m;for(b=0;b<e.length;b++){h=e[b];if(h.start>a-d)break;m=h._model.getCharCount();if(h.start+m>a-d)if(f!==void 0&&h.start+m>f-d)return h._model.getText(a-(h.start+d),f-(h.start+d));else c.push(h._model.getText(a-(h.start+d))),a=h.end+d+m-(h.end-h.start);d+=m-(h.end-h.start)}var i=a-d;if(f!==void 0){for(;b<e.length;b++){h=e[b];if(h.start>f-d)break;c.push(g.getText(i,h.start));m=h._model.getCharCount();if(h.start+
m>f-d)return c.push(h._model.getText(0,f-(h.start+d))),c.join("");c.push(h._model.getText());i=h.end;d+=m-(h.end-h.start)}c.push(g.getText(i,f-d))}else{for(;b<e.length;b++)h=e[b],c.push(g.getText(i,h.start)),c.push(h._model.getText()),i=h.end;c.push(g.getText(i))}return c.join("")},_onChanging:function(a,f,g,e,d,c){for(var b=this._model,h=this._projections,m,i=0,j,q=f+g;m<h.length;m++){g=h[m];if(g.start>f)break;i+=g._model.getCharCount()-(g.end-g.start)}f+=i;for(var k=m;m<h.length;m++){g=h[m];if(g.start>
q)break;i+=g._model.getCharCount()-(g.end-g.start);j+=g._model.getLineCount()-1-g._lineCount}g=q+i;i=m;this.onChanging(f,g-f,e,d+j,c);h.splice(h,i-k);for(a=a.length-(g-f);m<h.length;m++)g=h[m],g.start+=a,g.end+=a,g._lineIndex=b.getLineAtOffset(g.start)},onChanging:function(a){return this.dispatchEvent(a)},onChanged:function(a){return this.dispatchEvent(a)},setLineDelimiter:function(a){this._model.setLineDelimiter(a)},setText:function(a,f,g){a===void 0&&(a="");f===void 0&&(f=0);var e=f,d=g,c=this._model,
b=this._projections,h=0,m=0,i,j,q,k,p,n=0;for(i=0;i<b.length;i++){j=b[i];if(j.start>f-h)break;q=j._model.getCharCount();if(j.start+q>f-h)if(g!==void 0&&j.start+q>g-h){j._model.setText(a,f-(j.start+h),g-(j.start+h));return}else n=j._model.getLineCount()-1-j._model.getLineAtOffset(f-(j.start+h)),k={projection:j,start:f-(j.start+h)},f=j.end+h+q-(j.end-j.start);m+=j._model.getLineCount()-1-j._lineCount;h+=q-(j.end-j.start)}f-=h;var u=i,n=c.getLineAtOffset(f)+m-n;if(g!==void 0)for(;i<b.length;i++){j=b[i];
if(j.start>g-h)break;q=j._model.getCharCount();if(j.start+q>g-h){m+=j._model.getLineAtOffset(g-(j.start+h));q=g-(j.start+h);g=j.end+h;p={projection:j,end:q};break}m+=j._model.getLineCount()-1-j._lineCount;h+=q-(j.end-j.start)}else{for(;i<b.length;i++)j=b[i],m+=j._model.getLineCount()-1-j._lineCount,h+=j._model.getCharCount()-(j.end-j.start);g=d=c.getCharCount()+h}g-=h;j=c.getLineAtOffset(g)+m;d-=e;for(var m=j-n,n=a.length,s=q=j=h=0;;){j!==-1&&j<=s&&(j=a.indexOf("\r",s));q!==-1&&q<=s&&(q=a.indexOf("\n",
s));if(q===-1&&j===-1)break;s=j!==-1&&q!==-1?j+1===q?q+1:(j<q?j:q)+1:j!==-1?j+1:q+1;h++}this.onChanging({type:"Changing",text:a,start:e,removedCharCount:d,addedCharCount:n,removedLineCount:m,addedLineCount:h});c.setText(a,f,g);if(k)j=k.projection,j._model.setText("",k.start);if(p)j=p.projection,j._model.setText("",0,p.end),j.start=j.end,j._lineCount=0;b.splice(u,i-u);for(a=a.length-(g-f);i<b.length;i++)j=b[i],j.start+=a,j.end+=a,j._lineIndex=c.getLineAtOffset(j.start);this.onChanged({type:"Changed",
start:e,removedCharCount:d,addedCharCount:n,removedLineCount:m,addedLineCount:h})}};l.EventTarget.addMixin(i.prototype);return{ProjectionTextModel:i}});
define("orion/editor/textView",["orion/editor/textModel","orion/editor/keyBinding","orion/editor/eventTarget","orion/editor/util"],function(j,l,i,a){function f(b,a,n,c){typeof b.addEventListener==="function"?b.addEventListener(a,n,c===!0):b.attachEvent("on"+a,n)}function g(b,c,n){if(n){c.className="";for(var n=c.attributes,h=n.length;h-- >0;)(!a.isIE||a.isIE>=9||a.isIE<9&&n[h].specified)&&c.removeAttribute(n[h].name)}if(b){if(b.styleClass)c.className=b.styleClass;if(n=b.style)for(var d in n)n.hasOwnProperty(d)&&
(c.style[d]=n[d]);if(b=b.attributes)for(var e in b)b.hasOwnProperty(e)&&c.setAttribute(e,b[e])}}function e(b){return b instanceof Array?b.slice(0):b}function d(b,a){if(b===a)return!0;if(b&&!a||!b&&a)return!1;if(b&&b.constructor===String||a&&a.constructor===String)return!1;if(b instanceof Array||a instanceof Array){if(!(b instanceof Array&&a instanceof Array))return!1;if(b.length!==a.length)return!1;for(var n=0;n<b.length;n++)if(!d(b[n],a[n]))return!1;return!0}if(!(b instanceof Object)||!(a instanceof
Object))return!1;for(n in b)if(b.hasOwnProperty(n)){if(!a.hasOwnProperty(n))return!1;if(!d(b[n],a[n]))return!1}for(n in a)if(!b.hasOwnProperty(n))return!1;return!0}function c(b,a,n){for(var c=0,h=0,d=0,e=b.length;d<e;){c!==-1&&c<=d&&(c=b.indexOf("\r",d));h!==-1&&h<=d&&(h=b.indexOf("\n",d));var f=d,g;if(h===-1&&c===-1){a(b.substring(d));break}c!==-1&&h!==-1?c+1===h?(g=c,d=h+1):(g=c<h?c:h,d=(c<h?c:h)+1):c!==-1?(g=c,d=c+1):(g=h,d=h+1);a(b.substring(f,g));n()}}function b(b){var a,n,c,h,d=b.ownerDocument.defaultView||
b.ownerDocument.parentWindow;if(d.getComputedStyle)b=d.getComputedStyle(b,null),a=b.getPropertyValue("padding-left"),n=b.getPropertyValue("padding-top"),c=b.getPropertyValue("padding-right"),h=b.getPropertyValue("padding-bottom");else if(b.currentStyle)a=b.currentStyle.paddingLeft,n=b.currentStyle.paddingTop,c=b.currentStyle.paddingRight,h=b.currentStyle.paddingBottom;return{left:parseInt(a,10)||0,top:parseInt(n,10)||0,right:parseInt(c,10)||0,bottom:parseInt(h,10)||0}}function h(a){var c,n,h,d,e=
a._trim;if(!e){var e=b(a),f=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;if(f.getComputedStyle)d=f.getComputedStyle(a,null),c=d.getPropertyValue("border-left-width"),n=d.getPropertyValue("border-top-width"),h=d.getPropertyValue("border-right-width"),d=d.getPropertyValue("border-bottom-width");else if(a.currentStyle)c=a.currentStyle.borderLeftWidth,n=a.currentStyle.borderTopWidth,h=a.currentStyle.borderRightWidth,d=a.currentStyle.borderBottomWidth;c=parseInt(c,10)||0;n=parseInt(n,10)||
0;h=parseInt(h,10)||0;d=parseInt(d,10)||0;e.left+=c;e.top+=n;e.right+=h;e.bottom+=d;a._trim=e}return e}function m(b,a,n){this.start=b;this.end=a;this.caret=n}function o(b){this.left=b.left;this.top=b.top;this.right=b.right;this.bottom=b.bottom}function r(b,a,n){this.view=b;this.lineIndex=a;this._lineDiv=n}function q(b){this._init(b)}m.prototype={clone:function(){return new m(this.start,this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(b){this.caret?
this.start=b:this.end=b;if(this.start>this.end)b=this.start,this.start=this.end,this.end=b,this.caret=!this.caret},setCaret:function(b){this.end=this.start=b;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(b){return this.caret===b.caret&&this.start===b.start&&this.end===b.end}};o.prototype={toString:function(){return"{l="+
this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};r.prototype={create:function(b,a){if(!this._lineDiv){var n=this._lineDiv=this._createLine(b,a,this.lineIndex);n._line=this;return n}},_createLine:function(b,c,n){var h=this.view,e=h._model,f=e.getLine(n),m=e.getLineStart(n),x={type:"LineStyle",textView:h,lineIndex:n,lineText:f,lineStart:m};if(f.length<2E3)h.onLineStyle(x);e=c||a.createElement(b.ownerDocument,"div");if(!c||!d(c.viewStyle,x.style)){g(x.style,e,c);if(c)c._trim=null;
e.viewStyle=x.style;e.setAttribute("role","presentation")}e.lineIndex=n;n=[];this._createRanges(x.ranges,f,0,f.length,m,{tabOffset:0,ranges:n});f=" ";!h._fullSelection&&a.isIE<9&&(f="\ufeff");a.isWebkit&&(f="\u200c");n.push({text:f,style:h._metrics.largestFontStyle,ignoreChars:1});var i,t,j,o,r,f=h=0,q,l;if(c){if(t=c.modelChangedEvent)t.removedLineCount===0&&t.addedLineCount===0?(l=t.start-m,q=t.addedCharCount-t.removedCharCount):l=-1,c.modelChangedEvent=void 0;t=c.firstChild}for(m=0;m<n.length;m++){i=
n[m];o=i.text;h+=o.length;x=i.style;if(t)if(r=t.firstChild.data,j=t.viewStyle,r===o&&d(x,j)){f+=r.length;t._rectsCache=void 0;i=t=t.nextSibling;continue}else for(;t;){if(l!==-1){j=h;j>=l&&(j-=q);r=(r=t.firstChild.data)?r.length:0;if(f+r>j)break;f+=r}j=t.nextSibling;e.removeChild(t);t=j}i=this._createSpan(e,o,x,i.ignoreChars);t?e.insertBefore(i,t):e.appendChild(i);if(c)c.lineWidth=void 0}if(c)for(b=i?i.nextSibling:null;b;)j=b.nextSibling,c.removeChild(b),b=j;else b.appendChild(e);return e},_createRanges:function(b,
a,c,h,e,f){if(!(c>=h)){if(b)for(var g=0;g<b.length;g++){var m=b[g];if(!(m.end<=e+c)){var i=Math.max(e+c,m.start)-e;if(i>=h)break;var t=Math.min(e+h,m.end)-e;if(i<t){i=Math.max(c,i);t=Math.min(h,t);for(c<i&&this._createRange(a,c,i,null,f);g+1<b.length&&b[g+1].start-e===t&&d(m.style,b[g+1].style);)m=b[g+1],t=Math.min(e+h,m.end)-e,g++;this._createRange(a,i,t,m.style,f);c=t}}}c<h&&this._createRange(a,c,h,null,f)}},_createRange:function(b,a,c,h,d){if(!(a>=c)){var e=this.view._customTabSize;if(e&&e!==8)for(var f=
b.indexOf("\t",a);f!==-1&&f<c;){a<f&&(a={text:b.substring(a,f),style:h},d.ranges.push(a),d.tabOffset+=a.text.length);a=e-d.tabOffset%e;if(a>0){for(var g="\u00a0",m=1;m<a;m++)g+=" ";a={text:g,style:h,ignoreChars:a-1};d.ranges.push(a);d.tabOffset+=a.text.length}a=f+1;f=b.indexOf("\t",a)}a<c&&(a={text:b.substring(a,c),style:h},d.ranges.push(a),d.tabOffset+=a.text.length)}},_createSpan:function(b,c,n,h){var d=n&&n.tagName==="A";if(d)b.hasLink=!0;var d=d&&this.view._linksVisible?"a":"span",e=b.ownerDocument,
b=a.createElement(b.ownerDocument,d);b.appendChild(e.createTextNode(c));g(n,b);if(d==="A"){var m=this.view,x=this._getWindow();f(b,"click",function(b){return m._handleLinkClick(b?b:x.event)},!1)}b.viewStyle=n;if(h)b.ignoreChars=h;return b},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(b,c){var n=this._ensureCreated(),h=this.view;if(b===void 0)return this._getLineBoundingClientRect(n,!0);var d=h._model,
e=n.ownerDocument,f=this.lineIndex,g=null;if(b<d.getLineEnd(f)){d=d.getLineStart(f);for(f=n.firstChild;f;){var m=f.firstChild,t=m.length;f.ignoreChars&&(t-=f.ignoreChars);if(d+t>b){g=b-d;if(h._isRangeRects)e=e.createRange(),e.setStart(m,g),e.setEnd(m,g+1),g=new o(e.getBoundingClientRect());else if(a.isIE)e=e.body.createTextRange(),e.moveToElementText(f),e.collapse(),e.moveEnd("character",g+1),e.moveStart("character",g),g=new o(e.getBoundingClientRect());else{var i=m.data;f.removeChild(m);f.appendChild(e.createTextNode(i.substring(0,
g)));var j=a.createElement(e,"span");j.appendChild(e.createTextNode(i.substring(g,g+1)));f.appendChild(j);f.appendChild(e.createTextNode(i.substring(g+1)));g=new o(j.getBoundingClientRect());f.innerHTML="";f.appendChild(m);this._createdDiv||(e=h._getSelection(),(d<=e.start&&e.start<d+t||d<=e.end&&e.end<d+t)&&h._updateDOMSelection())}a.isIE&&(e=n.ownerDocument.defaultView||n.ownerDocument.parentWindow,n=e.screen.logicalXDPI/e.screen.deviceXDPI,e=e.screen.logicalYDPI/e.screen.deviceYDPI,g.left*=n,g.right*=
n,g.top*=e,g.bottom*=e);break}d+=t;f=f.nextSibling}}n=this.getBoundingClientRect();if(!g)h._wrapMode?(h=this.getClientRects(),g=h[h.length-1],g.left=g.right,g.left+=n.left,g.top+=n.top,g.right+=n.left,g.bottom+=n.top):(g=new o(n),g.left=g.right);if(c||c===void 0)g.left-=n.left,g.top-=n.top,g.right-=n.left,g.bottom-=n.top;return g},_getClientRects:function(b,a){var c,h,d,e;if(!b._rectsCache){c=b.getClientRects();h=Array(c.length);for(e=0;e<c.length;e++)d=h[e]=new o(c[e]),d.left-=a.left,d.top-=a.top,
d.right-=a.left,d.bottom-=a.top;b._rectsCache=h}c=b._rectsCache;h=[c.length];for(e=0;e<c.length;e++)h[e]=new o(c[e]);return h},getClientRects:function(b){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var a=this._ensureCreated(),c=[],h=a.firstChild,d,e=a.getBoundingClientRect();h;){for(var f=this._getClientRects(h,e),a=0;a<f.length;a++){var g=f[a],m;if(g.top!==g.bottom){var t=g.top+(g.bottom-g.top)/2;for(m=0;m<c.length;m++)if(d=c[m],d.top<=t&&t<d.bottom)break;if(m===c.length)c.push(g);
else{if(g.left<d.left)d.left=g.left;if(g.top<d.top)d.top=g.top;if(g.right>d.right)d.right=g.right;if(g.bottom>d.bottom)d.bottom=g.bottom}}}h=h.nextSibling}return b!==void 0?c[b]:c},_getLineBoundingClientRect:function(b,a){var c=new o(b.getBoundingClientRect());if(!this.view._wrapMode){c.right=c.left;for(var d=b.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(d)d=d.getBoundingClientRect(),c.right=d.right+h(b).right}a&&(d=h(b),c.left+=d.left,c.right-=d.right);return c},getLineCount:function(){return!this.view._wrapMode?
1:this.getClientRects().length},getLineIndex:function(b){if(!this.view._wrapMode)return 0;for(var a=this.getClientRects(),b=this.getBoundingClientRect(b),b=b.top+(b.bottom-b.top)/2,c=0;c<a.length;c++)if(a[c].top<=b&&b<a[c].bottom)return c;return a.length-1},getLineStart:function(b){if(!this.view._wrapMode||b===0)return this.view._model.getLineStart(b);var a=this.getClientRects();return this.getOffset(a[b].left+1,a[b].top+1)},getOffset:function(b,c){var h=this.view,d=h._model,e=this.lineIndex,f=d.getLineStart(e),
d=d.getLineEnd(e);if(f===d)return f;var g=this._ensureCreated(),e=this.getBoundingClientRect(),m,i;if(h._wrapMode){m=this.getClientRects();if(c<m[0].top)c=m[0].top;for(var t=0;t<m.length;t++)if(i=m[t],i.top<=c&&c<i.bottom)break;if(b<i.left)b=i.left;b>i.right&&(b=i.right-1)}else b<0&&(b=0),b>e.right-e.left&&(b=e.right-e.left);var j=g.ownerDocument,t=j.defaultView||j.parentWindow,o=a.isIE?t.screen.logicalXDPI/t.screen.deviceXDPI:1,r=a.isIE?t.screen.logicalYDPI/t.screen.deviceYDPI:1,t=f,q=g.firstChild;
a:for(;q;){var l=q.firstChild,g=l.length;q.ignoreChars&&(g-=q.ignoreChars);var A,E,G;m=this._getClientRects(q,e);for(var C=0;C<m.length;C++)if(i=m[C],i.left<=b&&b<i.right&&(!h._wrapMode||i.top<=c&&c<i.bottom)){if(a.isIE||h._isRangeRects){for(var j=h._isRangeRects?j.createRange():j.body.createTextRange(),C=g,I=-1;C-I>1;){var L=Math.floor((C+I)/2);i=I+1;m=L===g-1&&q.ignoreChars?l.length:L+1;h._isRangeRects?(j.setStart(l,i),j.setEnd(l,m)):(j.moveToElementText(q),j.move("character",i),j.moveEnd("character",
m-i));m=j.getClientRects();for(var P=!1,M=0;M<m.length;M++)if(i=m[M],A=i.left*o-e.left,G=i.right*o-e.left,E=i.top*r-e.top,i=i.bottom*r-e.top,A<=b&&b<G&&(!h._wrapMode||E<=c&&c<i)){P=!0;break}P?C=L:I=L}t+=C;i=C;m=C===g-1&&q.ignoreChars?l.length:Math.min(C+1,l.length);h._isRangeRects?(j.setStart(l,i),j.setEnd(l,m)):(j.moveToElementText(q),j.move("character",i),j.moveEnd("character",m-i));i=j.getClientRects()[0];A=i.left*o-e.left;G=i.right*o-e.left;b>A+(G-A)/2&&t++}else{i=[];for(o=0;o<g;o++)i.push("<span>"),
o===g-1?i.push(l.data.substring(o)):i.push(l.data.substring(o,o+1)),i.push("</span>");q.innerHTML=i.join("");for(o=q.firstChild;o;){i=o.getBoundingClientRect();A=i.left-e.left;G=i.right-e.left;if(A<=b&&b<G){b>A+(G-A)/2&&t++;break}t++;o=o.nextSibling}if(!this._createdDiv)q.innerHTML="",q.appendChild(l),e=h._getSelection(),(t<=e.start&&e.start<t+g||t<=e.end&&e.end<t+g)&&h._updateDOMSelection()}break a}t+=g;q=q.nextSibling}return Math.min(d,Math.max(f,t))},getNextOffset:function(b,c,h){return c==="line"?
(c=this.view._model,b=c.getLineAtOffset(b),h>0?c.getLineEnd(b):c.getLineStart(b)):c==="wordend"?this._getNextOffset_W3C(b,c,h):a.isIE?this._getNextOffset_IE(b,c,h):this._getNextOffset_W3C(b,c,h)},_getNextOffset_W3C:function(b,a,c){function h(b){return 33<=b&&b<=47||58<=b&&b<=64||91<=b&&b<=94||b===96||123<=b&&b<=126}if(a==="word"||a==="wordend"){var d=this.view._model,e=d.getLineAtOffset(b),f=d.getLine(e),g=d.getLineStart(e),e=d.getLineEnd(e),d=f.length;b-=g;var m,t;if(c>0){if(b===d)return e;m=f.charCodeAt(b);
t=h(m);c=!t&&!(m===32||m===9);for(b++;b<d;){m=f.charCodeAt(b);e=h(m);if(a==="wordend"){if(!e&&t)break}else if(e&&!t)break;m=!e&&!(m===32||m===9);if(a==="wordend"){if(!m&&c)break}else if(m&&!c)break;c=m;t=e;b++}}else{if(b===0)return g;b--;m=f.charCodeAt(b);t=h(m);for(c=!t&&!(m===32||m===9);0<b;){m=f.charCodeAt(b-1);e=h(m);if(a==="wordend"){if(e&&!t)break}else if(!e&&t)break;m=!e&&!(m===32||m===9);if(a==="wordend"){if(m&&!c)break}else if(!m&&c)break;c=m;t=e;b--}}return g+b}return b+c},_getNextOffset_IE:function(b,
a,c){var h=this._ensureCreated(),d=this.view._model,e=this.lineIndex,f=0,g;g=d.getLineStart(e);var m=h.ownerDocument;if(b===d.getLineEnd(e))f=m.body.createTextRange(),f.moveToElementText(h.lastChild),g=f.text.length,f.moveEnd(a,c),f=b+f.text.length-g;else if(b===g&&c<0)f=g;else for(h=h.firstChild;h;){d=h.firstChild.length;h.ignoreChars&&(d-=h.ignoreChars);if(g+d>b){f=m.body.createTextRange();b===g&&c<0?f.moveToElementText(h.previousSibling):(f.moveToElementText(h),f.collapse(),f.moveEnd("character",
b-g));g=f.text.length;f.moveEnd(a,c);f=b+f.text.length-g;break}g=d+g;h=h.nextSibling}return f},destroy:function(){var b=this._createdDiv;if(b)b.parentNode.removeChild(b),this._createdDiv=null}};q.prototype={addRuler:function(b,a){b.setView(this);var c=this._rulers;if(a!==void 0){var h,d;for(h=0,d=0;h<c.length&&d<a;h++)b.getLocation()===c[h].getLocation()&&d++;c.splice(d,0,b);a=d}else c.push(b);this._createRuler(b,a);this._update()},computeSize:function(){var b=0,c=0,h=this._model,d=this._clientDiv;
if(!d)return{width:b,height:c};var e=d.style.width;if(a.isWebkit)d.style.width="0x7fffffffpx";for(var h=h.getLineCount(),f=0;f<h;f++){var g=this._getLine(f),m=g.getBoundingClientRect(),b=Math.max(b,m.right-m.left);c+=m.bottom-m.top;g.destroy()}if(a.isWebkit)d.style.width=e;d=this._getViewPadding();b+=d.right+d.left;c+=d.bottom+d.top;return{width:b,height:c}},convert:function(b,a,c){if(this._clientDiv){var h=this._getScroll(),d=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect();a==="document"&&
(b.x!==void 0&&(b.x+=-h.x+e.left+d.left),b.y!==void 0&&(b.y+=-h.y+e.top+d.top));c==="document"&&(b.x!==void 0&&(b.x+=h.x-e.left-d.left),b.y!==void 0&&(b.y+=h.y-e.top-d.top));return b}},destroy:function(){for(var b=0;b<this._rulers.length;b++)this._rulers[b].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._actions=this._keyBindings=this._doubleClickSelection=this._selection=this._model=this._parent=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),
a.isOpera&&this._clientDiv.blur(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(b){if(b=this._actions[b])return b.actionDescription},getActions:function(b){var a=[],c=this._actions,h;for(h in c)c.hasOwnProperty(h)&&(b||!c[h].defaultHandler)&&a.push(h);return a},getBottomIndex:function(b){return!this._clientDiv?0:this._getBottomIndex(b)},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 b=this._getScroll();return{x:b.x,y:b.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(b){for(var a=[],c=this._keyBindings,h=0;h<c.length;h++)c[h].actionID===b&&a.push(c[h].keyBinding);return a},getLineHeight:function(b){return!this._clientDiv?
0:this._getLineHeight(b)},getLineIndex:function(b){return!this._clientDiv?0:this._getLineIndex(b)},getLinePixel:function(b){return!this._clientDiv?0:this._getLinePixel(b)},getLocationAtOffset:function(b){if(!this._clientDiv)return{x:0,y:0};var a=this._model,b=Math.min(Math.max(0,b),a.getCharCount()),a=a.getLineAtOffset(b),c=this._getLine(a),b=c.getBoundingClientRect(b);c.destroy();c=b.left;a=this._getLinePixel(a)+b.top;return{x:c,y:a}},getOptions:function(){var b;if(arguments.length===0)b=this._defaultOptions();
else if(arguments.length===1){if(b=arguments[0],typeof b==="string")return e(this["_"+b])}else{b={};for(var a in arguments)arguments.hasOwnProperty(a)&&(b[arguments[a]]=void 0)}for(var c in b)b.hasOwnProperty(c)&&(b[c]=e(this["_"+c]));return b},getModel:function(){return this._model},getOffsetAtLocation:function(b,a){if(!this._clientDiv)return 0;var c=this._getLineIndex(a),h=this._getLine(c),c=h.getOffset(b,a-this._getLinePixel(c));h.destroy();return c},getRulers:function(){return this._rulers.slice(0)},
getSelection:function(){var b=this._getSelection();return{start:b.start,end:b.end}},getText:function(b,a){return this._model.getText(b,a)},getTopIndex:function(b){return!this._clientDiv?0:this._getTopIndex(b)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(b,a){if(this._clientDiv){var c=this._actions[b];if(c){if(!a&&c.handler&&c.handler())return;if(c.defaultHandler)return c.defaultHandler()}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(b){return this.dispatchEvent(b)},
onDragStart:function(b){return this.dispatchEvent(b)},onDrag:function(b){return this.dispatchEvent(b)},onDragEnd:function(b){return this.dispatchEvent(b)},onDragEnter:function(b){return this.dispatchEvent(b)},onDragOver:function(b){return this.dispatchEvent(b)},onDragLeave:function(b){return this.dispatchEvent(b)},onDrop:function(b){return this.dispatchEvent(b)},onDestroy:function(b){return this.dispatchEvent(b)},onLineStyle:function(b){return this.dispatchEvent(b)},onModelChanged:function(b){return this.dispatchEvent(b)},
onModelChanging:function(b){return this.dispatchEvent(b)},onModify:function(b){return this.dispatchEvent(b)},onMouseDown:function(b){return this.dispatchEvent(b)},onMouseUp:function(b){return this.dispatchEvent(b)},onMouseMove:function(b){return this.dispatchEvent(b)},onMouseOver:function(b){return this.dispatchEvent(b)},onMouseOut:function(b){return this.dispatchEvent(b)},onSelection:function(b){return this.dispatchEvent(b)},onScroll:function(b){return this.dispatchEvent(b)},onVerify:function(b){return this.dispatchEvent(b)},
onFocus:function(b){return this.dispatchEvent(b)},onBlur:function(b){return this.dispatchEvent(b)},redraw:function(){if(!(this._redrawCount>0)){var b=this._model.getLineCount();this.redrawRulers(0,b);this.redrawLines(0,b)}},redrawRulers:function(b,a){if(!(this._redrawCount>0))for(var c=this.getRulers(),h=0;h<c.length;h++)this.redrawLines(b,a,c[h])},redrawLines:function(b,a,c){if(!(this._redrawCount>0)&&(b===void 0&&(b=0),a===void 0&&(a=this._model.getLineCount()),b!==a)){var h=this._clientDiv;if(h){if(c)for(var d=
(c.getLocation()==="left"?this._leftDiv:this._rightDiv).firstChild.rows[0].cells,e=0;e<d.length;e++)if(d[e].firstChild._ruler===c){h=d[e].firstChild;break}c?h.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(b,a);if(!c||c.getOverview()==="page")for(h=h.firstChild;h;){d=h.lineIndex;if(b<=d&&d<a)h.lineChanged=!0;h=h.nextSibling}if(!c&&!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<a)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._queueUpdate()}}},
redrawRange:function(b,a){if(!(this._redrawCount>0)){var c=this._model;b===void 0&&(b=0);a===void 0&&(a=c.getCharCount());var h=c.getLineAtOffset(b),c=c.getLineAtOffset(Math.max(b,a-1))+1;this.redrawLines(h,c)}},removeRuler:function(b){for(var a=this._rulers,c=0;c<a.length;c++)if(a[c]===b){a.splice(c,1);b.setView(null);this._destroyRuler(b);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(b,a,c){if(b){var h=this._actions,d=h[b];d||(d=h[b]={});
d.handler=a;d.actionDescription=c}},setKeyBinding:function(b,a){for(var c=this._keyBindings,h=0;h<c.length;h++){var d=c[h];if(d.keyBinding.equals(b)){a?d.actionID=a:d.predefined?d.actionID=null:c.splice(h,1);return}}a&&c.push({keyBinding:b,actionID:a})},setCaretOffset:function(b,a){var c=this._model.getCharCount(),b=Math.max(0,Math.min(b,c));this._setSelection(new m(b,b,!1),a===void 0||a)},setHorizontalPixel:function(b){this._clientDiv&&(b=Math.max(0,b),this._scrollView(b-this._getScroll().x,0))},
setRedraw:function(b){b?--this._redrawCount===0&&this.redraw():this._redrawCount++},setModel:function(b){if(b&&b!==this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var a=this._model.getLineCount(),c=this._model.getCharCount(),h=b.getLineCount(),d=b.getCharCount(),e={type:"ModelChanging",text:b.getText(),start:0,removedCharCount:c,addedCharCount:d,removedLineCount:a,addedLineCount:h};
this.onModelChanging(e);this._model=b;e={type:"ModelChanged",start:0,removedCharCount:c,addedCharCount:d,removedLineCount:a,addedLineCount:h};this.onModelChanged(e);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(b){var a=this._defaultOptions(),c;for(c in b)if(b.hasOwnProperty(c)){var h=b[c];if(!d(this["_"+c],h)){var f=a[c]?a[c].update:null;f?f.call(this,
h):this["_"+c]=e(h)}}},setSelection:function(b,a,c){var h=b>a;if(h)var d=b,b=a,a=d;d=this._model.getCharCount();b=Math.max(0,Math.min(b,d));a=Math.max(0,Math.min(a,d));this._setSelection(new m(b,a,h),c===void 0||c)},setText:function(b,c,h){var d=c===void 0&&h===void 0;c===void 0&&(c=0);h===void 0&&(h=this._model.getCharCount());this._modifyContent({text:b,start:c,end:h,_code:!0},!d);if(d)this._columnX=-1,this._setSelection(new m(0,0,!1),!0),a.isFirefox&&this._fixCaret()},setTopIndex:function(b){this._clientDiv&&
this._scrollView(0,this._getLinePixel(Math.max(0,b))-this._getScroll().y)},setTopPixel:function(b){this._clientDiv&&this._scrollView(0,Math.max(0,b)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(b,a){this._clientDiv&&(b&&this._updateStyle(),a===void 0||a?this._update():this._queueUpdate())},_handleRootMouseDown:function(b){if(a.isFirefox&&b.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var c=
this._overlayDiv||this._clientDiv;if(a.isIE<9)c=this._viewDiv;for(var h=b.target?b.target:b.srcElement;h;){if(c===h)return;h=h.parentNode}b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();if(!this._isW3CEvents){var d=this;this._getWindow().setTimeout(function(){d._clientDiv.focus()},0)}},_handleRootMouseUp:function(b){if(a.isFirefox&&b.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 b=this._rootDiv,c=a.createElement(b.ownerDocument,"div");b.appendChild(c);b.removeChild(c)}if(this._selDiv1)if(this._selDiv1.style.background="lightgray",this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",b=this._getWindow(),c=this._selDiv1.ownerDocument,b.getSelection){c=b.getSelection();for(b=c.anchorNode;b;){if(b===this._clientDiv){c.rangeCount>0&&c.removeAllRanges();break}b=b.parentNode}}else if(c.selection){this._ignoreSelect=
!1;for(b=c.selection.createRange().parentElement();b;){if(b===this._clientDiv){c.selection.empty();break}b=b.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(b){a.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var c=!1;if(this.isListening("ContextMenu"))c=this._createMouseEvent("ContextMenu",b),c.screenX=b.screenX,c.screenY=b.screenY,this.onContextMenu(c),c=c.defaultPrevented;if(c)return b.preventDefault&&b.preventDefault(),
!1},_handleCopy:function(b){if(!this._ignoreCopy&&this._doCopy(b))return b.preventDefault&&b.preventDefault(),!1},_handleCut:function(b){if(this._doCut(b))return b.preventDefault&&b.preventDefault(),!1},_handleDataModified:function(){this._startIME()},_handleDblclick:function(b){this._lastMouseTime=b.timeStamp?b.timeStamp:(new Date).getTime();if(this._clickCount!==2)this._clickCount=2,this._handleMouse(b)},_handleDragStart:function(b){if(a.isFirefox){var c=this;this._getWindow().setTimeout(function(){c._clientDiv.contentEditable=
!0;c._clientDiv.draggable=!1;c._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&this._dragOffset!==-1)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",b)),this._dragOffset=-1;else return b.preventDefault&&b.preventDefault(),!1},_handleDrag:function(b){if(this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",b))},_handleDragEnd:function(b){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",
b));a.isFirefox&&(this._fixCaret(),b.dataTransfer.dropEffect==="none"&&!b.dataTransfer.mozUserCancelled&&this._fixCaret())},_handleDragEnter:function(b){var c=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(c=!1,this.onDragEnter(this._createMouseEvent("DragEnter",b)));if(a.isWebkit||c)return b.preventDefault&&b.preventDefault(),!1},_handleDragOver:function(b){var c=!0;this.isListening("DragOver")&&(c=!1,this.onDragOver(this._createMouseEvent("DragOver",b)));if(a.isWebkit||c){if(c)b.dataTransfer.dropEffect=
"none";b.preventDefault&&b.preventDefault();return!1}},_handleDragLeave:function(b){this._dropTarget=!1;if(this.isListening("DragLeave"))this.onDragLeave(this._createMouseEvent("DragLeave",b))},_handleDrop:function(b){this._dropTarget=!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",b));b.preventDefault&&b.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._selDiv1){var b=this._highlightRGB;this._selDiv1.style.background=b;this._selDiv2.style.background=b;this._selDiv3.style.background=b}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(b){var c=!1;switch(b.keyCode){case 16:case 17:case 18:case 91:c=!0;break;default:this._setLinksVisible(!1)}if(b.keyCode===229){if(this._readonly)return b.preventDefault&&b.preventDefault(),!1;c=!0;a.isSafari&&a.isMac&&b.ctrlKey&&(c=!1);c&&this._startIME()}else c||
this._commitIME();if((a.isMac||a.isLinux)&&a.isFirefox<4||a.isOpera)return this._keyDownEvent=b,!0;if(this._doAction(b))return b.preventDefault?(b.preventDefault(),b.stopPropagation()):(b.cancelBubble=!0,b.returnValue=!1,b.keyCode=0),!1},_handleKeyPress:function(b){if(a.isMac&&a.isWebkit&&(63232<=b.keyCode&&b.keyCode<=63487||b.keyCode===13||b.keyCode===8))return b.preventDefault&&b.preventDefault(),!1;if(((a.isMac||a.isLinux)&&a.isFirefox<4||a.isOpera)&&this._doAction(this._keyDownEvent))return b.preventDefault&&
b.preventDefault(),!1;var c=a.isMac?b.metaKey:b.ctrlKey;if(b.charCode!==void 0&&c)switch(b.charCode){case 99:case 118:case 120:return!0}c=!1;if(a.isMac){if(b.ctrlKey||b.metaKey)c=!0}else if(a.isFirefox){if(b.ctrlKey||b.altKey)c=!0}else b.ctrlKey^b.altKey&&(c=!0);if(!c&&(c=a.isOpera?b.which:b.charCode!==void 0?b.charCode:b.keyCode,c>31))return this._doContent(String.fromCharCode(c)),b.preventDefault&&b.preventDefault(),!1},_handleKeyUp:function(b){(a.isMac?b.metaKey:b.ctrlKey)||this._setLinksVisible(!1);
b.keyCode===13&&this._commitIME()},_handleLinkClick:function(b){if(!(a.isMac?b.metaKey:b.ctrlKey))return b.preventDefault&&b.preventDefault(),!1},_handleMouse:function(b){var c=this._getWindow(),h=!0,d=c;if(a.isIE||a.isFirefox&&!this._overlayDiv)d=this._clientDiv;if(this._overlayDiv){if(this._hasFocus)this._ignoreFocus=!0;var e=this;c.setTimeout(function(){e.focus();e._ignoreFocus=!1},0)}this._clickCount===1?(h=this._setSelectionTo(b.clientX,b.clientY,b.shiftKey,!a.isOpera&&this._hasFocus&&this.isListening("DragStart")))&&
this._setGrab(d):(this._isW3CEvents&&this._setGrab(d),this._doubleClickSelection=null,this._setSelectionTo(b.clientX,b.clientY,b.shiftKey),this._doubleClickSelection=this._getSelection());return h},_handleMouseDown:function(b){if(this._linksVisible)if((b.target||b.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();var c=b.which;c||(b.button===4&&(c=2),b.button===2&&(c=3),b.button===1&&(c=1));var h=c!==2&&b.timeStamp?b.timeStamp:(new Date).getTime(),d=h-this._lastMouseTime,
e=Math.abs(this._lastMouseX-b.clientX),f=Math.abs(this._lastMouseY-b.clientY),g=this._lastMouseButton===c;this._lastMouseX=b.clientX;this._lastMouseY=b.clientY;this._lastMouseTime=h;this._lastMouseButton=c;if(c===1)this._isMouseDown=!0,g&&d<=this._clickTime&&e<=this._clickDist&&f<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&(h=this._createMouseEvent("MouseDown",b),this.onMouseDown(h),h.defaultPrevented)){b.preventDefault();return}if(c===1&&this._handleMouse(b)&&
(a.isIE>=9||a.isOpera||a.isChrome||a.isSafari||a.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),b.preventDefault();a.isFirefox&&this._lastMouseButton===3&&this._updateDOMSelection()},_handleMouseOver:function(b){if(this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",b))},_handleMouseOut:function(b){if(this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",b))},_handleMouseMove:function(b){var c=this._isClientDiv(b);if(this.isListening("MouseMove")&&
c)this.onMouseMove(this._createMouseEvent("MouseMove",b));if(!this._dropTarget){var h=this._linksVisible||this._lastMouseMoveX!==b.clientX||this._lastMouseMoveY!==b.clientY;this._lastMouseMoveX=b.clientX;this._lastMouseMoveY=b.clientY;this._setLinksVisible(h&&!this._isMouseDown&&(a.isMac?b.metaKey:b.ctrlKey));if(!this._isW3CEvents){if(b.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&b.button===1&&(this._clickCount&1)!==0&&c)return this._clickCount=2,this._handleMouse(b,this._clickCount)}if(this._isMouseDown&&
this._dragOffset===-1){var c=b.clientX,b=b.clientY,d=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect(),f=this._getClientWidth(),g=this._getClientHeight(),h=e.left+d.left,m=e.top+d.top,f=e.left+d.left+f,d=e.top+d.top+g,e=this._model,g=e.getLineAtOffset(this._getSelection().getCaret());b<m&&g!==0?this._doAutoScroll("up",c,b-m):b>d&&g!==e.getLineCount()-1?this._doAutoScroll("down",c,b-d):c<h&&!this._wrapMode?this._doAutoScroll("left",c-h,b):c>f&&!this._wrapMode?this._doAutoScroll("right",
c-f,b):(this._endAutoScroll(),this._setSelectionTo(c,b,!0))}}},_isClientDiv:function(b){for(var a=this._overlayDiv||this._clientDiv,b=b.target?b.target:b.srcElement;b;){if(a===b)return!0;b=b.parentNode}return!1},_createMouseEvent:function(b,a){var c=this.convert({x:a.clientX,y:a.clientY},"page","document");return{type:b,event:a,clickCount:this._clickCount,x:c.x,y:c.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(b){var c=b.which?b.button===0:b.button===1;if(this.isListening("MouseUp")&&
(this._isClientDiv(b)||c&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",b));if(!this._linksVisible&&c&&this._isMouseDown){if(this._dragOffset!==-1)c=this._getSelection(),c.extend(this._dragOffset),c.collapse(),this._setSelection(c,!0,!0),this._dragOffset=-1;this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null);a.isFirefox&&b.preventDefault()}},_handleMouseWheel:function(b){var c=this._getLineHeight(),h=0,d=0;a.isIE||a.isOpera?d=-b.wheelDelta/40*c:a.isFirefox?
(c=a.isMac?b.detail*3:Math.max(-256,Math.min(256,b.detail))*c,b.axis===b.HORIZONTAL_AXIS?h=c:d=c):a.isMac?(d=h=40,b.wheelDeltaX%120!==0&&(h=1),b.wheelDeltaY%120!==0&&(d=1),h=-b.wheelDeltaX/h,-1<h&&h<0&&(h=-1),0<h&&h<1&&(h=1),d=-b.wheelDeltaY/d,-1<d&&d<0&&(d=-1),0<d&&d<1&&(d=1)):(h=-b.wheelDeltaX,d=-b.wheelDeltaY/120*8*c);if(a.isSafari){for(c=b.target;c&&c.lineIndex===void 0;)c=c.parentNode;this._mouseWheelLine=c}c=this._getScroll();this._scrollView(h,d);h=this._getScroll();if(c.x!==h.x||c.y!==h.y)return b.preventDefault&&
b.preventDefault(),!1},_handlePaste:function(b){if(!this._ignorePaste&&this._doPaste(b)){if(a.isIE){var c=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){c._updateDOMSelection();c._ignoreFocus=!1},0)}b.preventDefault&&b.preventDefault();return!1}},_handleResize:function(){var b=this._parent.clientWidth,c=this._parent.clientHeight;if(this._parentWidth!==b||this._parentHeight!==c)this._parentWidth!==b&&this._resetLineHeight(),this._parentWidth=b,this._parentHeight=c,a.isIE<9?this._queueUpdate():
this._update()},_handleRulerEvent:function(b){for(var a=b.target?b.target:b.srcElement,c=a.lineIndex;a&&!a._ruler;){if(c===void 0&&a.lineIndex!==void 0)c=a.lineIndex;a=a.parentNode}a=a?a._ruler:null;if(c===void 0&&a&&a.getOverview()==="document"){var c=this._getClientHeight(),h=this._model.getLineCount(),d=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect(),c=Math.floor((b.clientY-e.top-this._metrics.scrollWidth)*h/(c+d.top+d.bottom-2*this._metrics.scrollWidth));0<=c&&c<h||(c=void 0)}if(a)switch(b.type){case "click":if(a.onClick)a.onClick(c,
b);break;case "dblclick":if(a.onDblClick)a.onDblClick(c,b);break;case "mousemove":if(a.onMouseMove)a.onMouseMove(c,b);break;case "mouseover":if(a.onMouseOver)a.onMouseOver(c,b);break;case "mouseout":if(a.onMouseOut)a.onMouseOut(c,b)}},_handleScroll:function(){var b=this._getScroll(),a=this._hScroll,c=this._vScroll;if(a!==b.x||c!==b.y)this._checkOverlayScroll(),this._hScroll=b.x,this._vScroll=b.y,this._commitIME(),this._update(c===b.y),this.onScroll({type:"Scroll",oldValue:{x:a,y:c},newValue:b})},
_handleSelectStart:function(b){if(this._ignoreSelect)return b&&b.preventDefault&&b.preventDefault(),!1},_getModelOffset:function(b,a){if(b){var c;c=b.tagName==="DIV"?b:b.parentNode.parentNode;var h=0,d=c.lineIndex;if(b.tagName!=="DIV")for(c=c.firstChild;c;){var e=c.firstChild;if(e===b){c.ignoreChars&&(h-=c.ignoreChars);h+=a;break}c.ignoreChars&&(h-=c.ignoreChars);h+=e.data.length;c=c.nextSibling}return Math.max(0,h)+this._model.getLineStart(d)}},_updateSelectionFromDOM:function(){var b=this._getWindow().getSelection(),
a=this._getModelOffset(b.anchorNode,b.anchorOffset),b=this._getModelOffset(b.focusNode,b.focusOffset);a===void 0||b===void 0||this._setSelection(new m(a,b),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset===-1)if(a.isAndroid){var b=this._getWindow();this._selTimer&&b.clearTimeout(this._selTimer);var c=this;this._selTimer=b.setTimeout(function(){if(c._clientDiv)c._selTimer=null,c._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(b){this._imeOffset=
-1;if(a.isAndroid){for(var c=this._getWindow().getSelection(),h=c.anchorNode;h;){if(h.lineIndex!==void 0)break;h=h.parentNode}if(h){var d=this._model,e=h.lineIndex,f=d.getLine(e),g=f,m=0,d=d.getLineStart(e);if(c.rangeCount>0)c.getRangeAt(0).deleteContents(),e=h.ownerDocument.createTextNode(b.data),c.getRangeAt(0).insertNode(e),m=this._getDOMText(h,e),g=m.text,m=m.offset,e.parentNode.removeChild(e);h.lineRemoved=!0;for(h=0;f.charCodeAt(h)===g.charCodeAt(h)&&h<m;)h++;c=f.length-1;for(e=g.length-f.length;f.charCodeAt(c)===
g.charCodeAt(c+e)&&c+e>=m+b.data.length;)c--;c++;f=g.substring(h,c+e);h+=d;c+=d;this._modifyContent({text:f,start:h,end:c,_ignoreDOMSelection:!0},!0)}}else this._doContent(b.data);b.preventDefault()},_handleTouchStart:function(b){this._commitIME();var c=this._getWindow();if(this._touchScrollTimer)this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",c.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null;var h=b.touches;if(h.length===1){var h=h[0],d=h.clientX,e=h.clientY;
this._touchStartX=d;this._touchStartY=e;if(a.isAndroid&&(e<h.pageY-c.pageYOffset||d<h.pageX-c.pageXOffset))d=h.pageX-c.pageXOffset,e=h.pageY-c.pageYOffset;c=this.convert({x:d,y:e},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(c.x,c.y);this._touchStartTime=b.timeStamp;this._touching=!0}},_handleTouchMove:function(b){var a=b.touches;if(a.length===1){a=a[0];this._touchCurrentX=a.clientX;this._touchCurrentY=a.clientY;if(!this._touchScrollTimer&&b.timeStamp-this._touchStartTime<200){this._vScrollDiv.style.display=
"block";if(!this._wrapMode)this._hScrollDiv.style.display="block";var c=this,h=this._getWindow();this._touchScrollTimer=h.setInterval(function(){var b=0,a=0;if(c._touching)b=c._touchStartX-c._touchCurrentX,a=c._touchStartY-c._touchCurrentY,c._touchSpeedX=b/10,c._touchSpeedY=a/10,c._touchStartX=c._touchCurrentX,c._touchStartY=c._touchCurrentY;else if(Math.abs(c._touchSpeedX)<0.1&&Math.abs(c._touchSpeedY)<0.1){c._vScrollDiv.style.display="none";c._hScrollDiv.style.display="none";h.clearInterval(c._touchScrollTimer);
c._touchScrollTimer=null;return}else b=c._touchSpeedX*10,a=c._touchSpeedY*10,c._touchSpeedX*=0.95,c._touchSpeedY*=0.95;c._scrollView(b,a)},10)}this._touchScrollTimer&&b.preventDefault()}},_handleTouchEnd:function(b){if(b.touches.length===0)this._touching=!1},_doAction:function(b){for(var a=this._keyBindings,c=0;c<a.length;c++){var h=a[c];if(h.keyBinding.match(b)){if(h.actionID&&(b=this._actions[h.actionID]))if(b.handler){if(!b.handler())return b.defaultHandler?typeof b.defaultHandler()==="boolean":
!1}else if(b.defaultHandler)return typeof b.defaultHandler()==="boolean";return!0}}return!1},_doBackspace:function(b){var a=this._getSelection();if(a.isEmpty()){var c=this._model,h=a.getCaret(),d=c.getLineAtOffset(h),e=c.getLineStart(d);if(h===e)d>0&&a.extend(c.getLineEnd(d-1));else{var f=!1;this._expandTab&&b.unit==="character"&&(h-e)%this._tabSize===0&&(f=!/[^ ]/.test(c.getText(e,h)));f?a.extend(h-this._tabSize):(c=this._getLine(d),a.extend(c.getNextOffset(h,b.unit,-1)),c.destroy())}}this._modifyContent({text:"",
start:a.start,end:a.end},!0);return!0},_doContent:function(b){var a=this._getSelection();this._modifyContent({text:b,start:a.start,end:a.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(b){var a=this._getSelection();return!a.isEmpty()?this._setClipboardText(this._getBaseText(a.start,a.end),b):!0},_doCursorNext:function(b){if(!b.select&&this._clearSelection("next"))return!0;var a=this._model,c=this._getSelection(),h=c.getCaret(),d=a.getLineAtOffset(h);h===a.getLineEnd(d)?d+1<a.getLineCount()&&c.extend(a.getLineStart(d+
1)):(a=this._getLine(d),c.extend(a.getNextOffset(h,b.unit,1)),a.destroy());b.select||c.collapse();this._setSelection(c,!0);return!0},_doCursorPrevious:function(b){if(!b.select&&this._clearSelection("previous"))return!0;var a=this._model,c=this._getSelection(),h=c.getCaret(),d=a.getLineAtOffset(h);h===a.getLineStart(d)?d>0&&c.extend(a.getLineEnd(d-1)):(a=this._getLine(d),c.extend(a.getNextOffset(h,b.unit,-1)),a.destroy());b.select||c.collapse();this._setSelection(c,!0);return!0},_doCut:function(b){var a=
this._getSelection();return!a.isEmpty()?(a=this._getBaseText(a.start,a.end),this._doContent(""),this._setClipboardText(a,b)):!0},_doDelete:function(b){var a=this._getSelection();if(a.isEmpty()){var c=this._model,h=a.getCaret(),d=c.getLineAtOffset(h);h===c.getLineEnd(d)?d+1<c.getLineCount()&&a.extend(c.getLineStart(d+1)):(c=this._getLine(d),a.extend(c.getNextOffset(h,b.unit,1)),c.destroy())}this._modifyContent({text:"",start:a.start,end:a.end},!0);return!0},_doEnd:function(b){var a=this._getSelection(),
c=this._model;if(b.ctrl)a.extend(c.getCharCount());else{var h=a.getCaret(),d=c.getLineAtOffset(h);if(this._wrapMode){var e=this._getLine(d),h=e.getLineIndex(h),h=h===e.getLineCount()-1?c.getLineEnd(d):e.getLineStart(h+1)-1;e.destroy()}else h=c.getLineEnd(d);a.extend(h)}b.select||a.collapse();this._setSelection(a,!0);return!0},_doEnter:function(b){var a=this._model,c=this._getSelection();this._doContent(a.getLineDelimiter());if(b&&b.noCursor)c.end=c.start,this._setSelection(c);return!0},_doHome:function(b){var a=
this._getSelection(),c=this._model;if(b.ctrl)a.extend(0);else{var h=a.getCaret(),d=c.getLineAtOffset(h);this._wrapMode?(c=this._getLine(d),h=c.getLineIndex(h),h=c.getLineStart(h),c.destroy()):h=c.getLineStart(d);a.extend(h)}b.select||a.collapse();this._setSelection(a,!0);return!0},_doLineDown:function(b){var c=this._model,h=this._getSelection(),d=h.getCaret(),e=c.getLineAtOffset(d),f=this._getLine(e),g=this._columnX,m=1,i=!1;if(g===-1||b.wholeLine||b.select&&a.isIE)g=b.wholeLine?c.getLineEnd(e+1):
d,g=f.getBoundingClientRect(g).left;(d=f.getLineIndex(d))<f.getLineCount()-1?m=f.getClientRects(d+1).top+1:(i=e===c.getLineCount()-1,e++);i?b.select&&(h.extend(c.getCharCount()),this._setSelection(h,!0,!0)):(f.lineIndex!==e&&(f.destroy(),f=this._getLine(e)),h.extend(f.getOffset(g,m)),b.select||h.collapse(),this._setSelection(h,!0,!0));this._columnX=g;f.destroy();return!0},_doLineUp:function(b){var c=this._model,h=this._getSelection(),d=h.getCaret(),e=c.getLineAtOffset(d),f=this._getLine(e),g=this._columnX,
m=!1,i;if(g===-1||b.wholeLine||b.select&&a.isIE)g=b.wholeLine?c.getLineStart(e-1):d,g=f.getBoundingClientRect(g).left;(d=f.getLineIndex(d))>0?i=f.getClientRects(d-1).top+1:(m=e===0,m||(e--,i=this._getLineHeight(e)-1));m?b.select&&(h.extend(0),this._setSelection(h,!0,!0)):(f.lineIndex!==e&&(f.destroy(),f=this._getLine(e)),h.extend(f.getOffset(g,i)),b.select||h.collapse(),this._setSelection(h,!0,!0));this._columnX=g;f.destroy();return!0},_doPageDown:function(b){var c=this._model,h=this._getSelection(),
d=h.getCaret(),e=c.getLineAtOffset(d),f=c.getLineCount(),g=this._getScroll(),m=this._getClientHeight(),i;if(this._lineHeight){c=this._columnX;g=this._getBoundsAtOffset(d);if(c===-1||b.select&&a.isIE)c=g.left;d=this._getLineIndex(g.top+m);i=this._getLine(d);e=this._getLinePixel(d);d=i.getOffset(c,g.top+m-e);m=i.getBoundingClientRect(d);i.destroy();h.extend(d);b.select||h.collapse();this._setSelection(h,!0,!0,m.top+e-g.top);this._columnX=c;return!0}if(e<f-1){var t=this._getLineHeight(),j=Math.min(f-
e-1,Math.floor(m/t)),j=Math.max(1,j),c=this._columnX;if(c===-1||b.select&&a.isIE)i=this._getLine(e),c=i.getBoundingClientRect(d).left,i.destroy();i=this._getLine(e+j);h.extend(i.getOffset(c,0));i.destroy();b.select||h.collapse();b=f*t;d=g.y+j*t;d+m>b&&(d=b-m);this._setSelection(h,!0,!0,d-g.y);this._columnX=c}return!0},_doPageUp:function(b){var c=this._model,h=this._getSelection(),d=h.getCaret(),e=c.getLineAtOffset(d),f=this._getScroll(),g=this._getClientHeight(),m;if(this._lineHeight){c=this._columnX;
f=this._getBoundsAtOffset(d);if(c===-1||b.select&&a.isIE)c=f.left;d=this._getLineIndex(f.bottom-g);m=this._getLine(d);e=this._getLinePixel(d);d=m.getOffset(c,f.bottom-g-e);g=m.getBoundingClientRect(d);m.destroy();h.extend(d);b.select||h.collapse();this._setSelection(h,!0,!0,g.top+e-f.top);this._columnX=c;return!0}if(e>0){var i=this._getLineHeight(),g=Math.max(1,Math.min(e,Math.floor(g/i))),c=this._columnX;if(c===-1||b.select&&a.isIE)m=this._getLine(e),c=m.getBoundingClientRect(d).left,m.destroy();
m=this._getLine(e-g);h.extend(m.getOffset(c,this._getLineHeight(e-g)-1));m.destroy();b.select||h.collapse();b=Math.max(0,f.y-g*i);this._setSelection(h,!0,!0,b-f.y);this._columnX=c}return!0},_doPaste:function(b){var c=this;return this._getClipboardText(b,function(b){b&&(a.isLinux&&c._lastMouseButton===2&&(new Date).getTime()-c._lastMouseTime<=c._clickTime&&c._setSelectionTo(c._lastMouseX,c._lastMouseY),c._doContent(b))})!==null},_doScroll:function(b){var a=b.type,c=this._model,h=c.getLineCount(),b=
this._getClientHeight(),d=this._getLineHeight();h*=d;var e=this._getScroll().y,f;switch(a){case "textStart":f=0;break;case "textEnd":f=h-b;break;case "pageDown":f=e+b;break;case "pageUp":f=e-b;break;case "centerLine":a=this._getSelection(),f=c.getLineAtOffset(a.start),c=(c.getLineAtOffset(a.end)-f+1)*d,f=f*d-b/2+c/2}f!==void 0&&(f=Math.min(Math.max(0,f),h-b),this._scrollView(0,f-e));return!0},_doSelectAll:function(){var b=this._model,a=this._getSelection();a.setCaret(0);a.extend(b.getCharCount());
this._setSelection(a,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var b="\t";if(this._expandTab)var a=this._model,b=this._getSelection().getCaret(),c=a.getLineAtOffset(b),a=a.getLineStart(c),b=Array(this._tabSize-(b-a)%this._tabSize+1).join(" ");this._doContent(b);return!0}},_doShiftTab:function(){return!this._tabMode||this._readonly?void 0:!0},_doTabMode:function(){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(){this.setOptions({wrapMode:!this.getOptions("wrapMode")});
return!0},_autoScroll:function(){var b=this._getSelection(),a=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),c=b.getCaret(),h=this._model.getLineAtOffset(c),d;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")c=this._autoScrollY/this._getLineHeight(),c=c<0?Math.floor(c):Math.ceil(c),d=h,d=Math.max(0,Math.min(this._model.getLineCount()-1,d+c));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")d=this._getLineIndex(a.y),h=this._getLine(h),a.x+=h.getBoundingClientRect(c,
!1).left,h.destroy();h=this._getLine(d);b.extend(h.getOffset(a.x,a.y-this._getLinePixel(d)));h.destroy();this._setSelection(b,!0)},_autoScrollTimer:function(){this._autoScroll();var b=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){b._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(b){if(this._lineHeight&&!this._calculateLHTimer){var a=this._model.getLineCount(),c=0;if(b){for(var b=0,h=(new Date).getTime(),d=0;c<a;)if(this._lineHeight[c]||(b++,d||
(d=c),this._lineHeight[c]=this._calculateLineHeight(c)),c++,(new Date).getTime()-h>100)break;this.redrawRulers(0,a);this._queueUpdate()}b=this._getWindow();if(c!==a){var e=this;this._calculateLHTimer=b.setTimeout(function(){e._calculateLHTimer=null;e._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)b.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(b){var b=this._getLine(b),a=b.getBoundingClientRect();b.destroy();return Math.max(1,
Math.ceil(a.bottom-a.top))},_calculateMetrics:function(){var c=this._clientDiv,d=c.ownerDocument,e=a.createElement(d,"div");e.style.lineHeight="normal";var f={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(f);g(f.style,e);e.style.position="fixed";e.style.left="-1000px";var m=a.createElement(d,"span");m.appendChild(d.createTextNode(" "));e.appendChild(m);var i=a.createElement(d,"span");i.style.fontStyle="italic";i.appendChild(d.createTextNode(" "));
e.appendChild(i);var v=a.createElement(d,"span");v.style.fontWeight="bold";v.appendChild(d.createTextNode(" "));e.appendChild(v);f=a.createElement(d,"span");f.style.fontWeight="bold";f.style.fontStyle="italic";f.appendChild(d.createTextNode(" "));e.appendChild(f);c.appendChild(e);var j=e.getBoundingClientRect(),m=m.getBoundingClientRect(),i=i.getBoundingClientRect(),v=v.getBoundingClientRect(),f=f.getBoundingClientRect(),m=m.bottom-m.top,i=i.bottom-i.top,v=v.bottom-v.top,o=f.bottom-f.top,t=0,f=j.bottom-
j.top<=0,j=Math.max(1,j.bottom-j.top);i>m&&(t=1);v>i&&(t=2);o>v&&(t=3);var D;if(t!==0){D={style:{}};if((t&1)!==0)D.style.fontStyle="italic";if((t&2)!==0)D.style.fontWeight="bold"}m=h(e);c.removeChild(e);i=b(this._viewDiv);e=a.createElement(d,"div");e.style.position="fixed";e.style.left="-1000px";e.style.paddingLeft=i.left+"px";e.style.paddingTop=i.top+"px";e.style.paddingRight=i.right+"px";e.style.paddingBottom=i.bottom+"px";e.style.width="100px";e.style.height="100px";v=a.createElement(d,"div");
v.style.width="100%";v.style.height="100%";e.appendChild(v);c.appendChild(e);d=e.getBoundingClientRect();i=v.getBoundingClientRect();e.style.overflow="hidden";v.style.height="200px";v=e.clientWidth;e.style.overflow="scroll";o=e.clientWidth;c.removeChild(e);i={left:i.left-d.left,top:i.top-d.top,right:d.right-i.right,bottom:d.bottom-i.bottom};return{lineHeight:j,largestFontStyle:D,lineTrim:m,viewPadding:i,scrollWidth:v-o,invalid:f}},_checkOverlayScroll:function(){if(a.isMac){var b=this,c=this._getWindow();
this._overlayScrollTimer&&c.clearTimeout(this._overlayScrollTimer);var h=function(){var a=b._isOverOverlayScroll();a.vertical||a.horizontal?b._overlayScrollTimer=c.setTimeout(h,200):(b._overlayScrollTimer=void 0,b._update())};this._overlayScrollTimer=c.setTimeout(h,200)}},_clearSelection:function(b){var a=this._getSelection();if(a.isEmpty())return!1;b==="next"?a.start=a.end:a.end=a.start;this._setSelection(a,!0);return!0},_commitIME:function(){if(this._imeOffset!==-1){this._scrollDiv.focus();this._clientDiv.focus();
var b=this._model,a=b.getLineAtOffset(this._imeOffset),c=b.getLineStart(a),h=this._getDOMText(this._getLineNode(a)).text,b=b.getLine(a),c=this._imeOffset-c,b=c+h.length-b.length;c!==b&&this._doContent(h.substring(c,b));this._imeOffset=-1}},_createActions:function(){var b=l.KeyBinding,c=this._keyBindings=[];c.push({actionID:"lineUp",keyBinding:new b(38),predefined:!0});c.push({actionID:"lineDown",keyBinding:new b(40),predefined:!0});c.push({actionID:"charPrevious",keyBinding:new b(37),predefined:!0});
c.push({actionID:"charNext",keyBinding:new b(39),predefined:!0});a.isMac?(c.push({actionID:"scrollPageUp",keyBinding:new b(33),predefined:!0}),c.push({actionID:"scrollPageDown",keyBinding:new b(34),predefined:!0}),c.push({actionID:"pageUp",keyBinding:new b(33,null,null,!0),predefined:!0}),c.push({actionID:"pageDown",keyBinding:new b(34,null,null,!0),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new b(37,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new b(39,!0),predefined:!0}),
c.push({actionID:"wordPrevious",keyBinding:new b(37,null,null,!0),predefined:!0}),c.push({actionID:"wordNext",keyBinding:new b(39,null,null,!0),predefined:!0}),c.push({actionID:"scrollTextStart",keyBinding:new b(36),predefined:!0}),c.push({actionID:"scrollTextEnd",keyBinding:new b(35),predefined:!0}),c.push({actionID:"textStart",keyBinding:new b(38,!0),predefined:!0}),c.push({actionID:"textEnd",keyBinding:new b(40,!0),predefined:!0}),c.push({actionID:"scrollPageUp",keyBinding:new b(38,null,null,null,
!0),predefined:!0}),c.push({actionID:"scrollPageDown",keyBinding:new b(40,null,null,null,!0),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new b(37,null,null,null,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new b(39,null,null,null,!0),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new b(38,null,null,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new b(40,null,null,!0),predefined:!0})):(c.push({actionID:"pageUp",keyBinding:new b(33),predefined:!0}),c.push({actionID:"pageDown",
keyBinding:new b(34),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new b(36),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new b(35),predefined:!0}),c.push({actionID:"wordPrevious",keyBinding:new b(37,!0),predefined:!0}),c.push({actionID:"wordNext",keyBinding:new b(39,!0),predefined:!0}),c.push({actionID:"textStart",keyBinding:new b(36,!0),predefined:!0}),c.push({actionID:"textEnd",keyBinding:new b(35,!0),predefined:!0}));a.isFirefox&&a.isLinux&&(c.push({actionID:"lineUp",keyBinding:new b(38,
!0),predefined:!0}),c.push({actionID:"lineDown",keyBinding:new b(40,!0),predefined:!0}));c.push({actionID:"selectLineUp",keyBinding:new b(38,null,!0),predefined:!0});c.push({actionID:"selectLineDown",keyBinding:new b(40,null,!0),predefined:!0});c.push({actionID:"selectCharPrevious",keyBinding:new b(37,null,!0),predefined:!0});c.push({actionID:"selectCharNext",keyBinding:new b(39,null,!0),predefined:!0});c.push({actionID:"selectPageUp",keyBinding:new b(33,null,!0),predefined:!0});c.push({actionID:"selectPageDown",
keyBinding:new b(34,null,!0),predefined:!0});a.isMac?(c.push({actionID:"selectLineStart",keyBinding:new b(37,!0,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new b(39,!0,!0),predefined:!0}),c.push({actionID:"selectWordPrevious",keyBinding:new b(37,null,!0,!0),predefined:!0}),c.push({actionID:"selectWordNext",keyBinding:new b(39,null,!0,!0),predefined:!0}),c.push({actionID:"selectTextStart",keyBinding:new b(36,null,!0),predefined:!0}),c.push({actionID:"selectTextEnd",keyBinding:new b(35,
null,!0),predefined:!0}),c.push({actionID:"selectTextStart",keyBinding:new b(38,!0,!0),predefined:!0}),c.push({actionID:"selectTextEnd",keyBinding:new b(40,!0,!0),predefined:!0}),c.push({actionID:"selectLineStart",keyBinding:new b(37,null,!0,null,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new b(39,null,!0,null,!0),predefined:!0}),c.push({actionID:"selectLineStart",keyBinding:new b(38,null,!0,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new b(40,null,!0,!0),
predefined:!0})):(a.isLinux&&(c.push({actionID:"selectWholeLineUp",keyBinding:new b(38,!0,!0),predefined:!0}),c.push({actionID:"selectWholeLineDown",keyBinding:new b(40,!0,!0),predefined:!0})),c.push({actionID:"selectLineStart",keyBinding:new b(36,null,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new b(35,null,!0),predefined:!0}),c.push({actionID:"selectWordPrevious",keyBinding:new b(37,!0,!0),predefined:!0}),c.push({actionID:"selectWordNext",keyBinding:new b(39,!0,!0),predefined:!0}),
c.push({actionID:"selectTextStart",keyBinding:new b(36,!0,!0),predefined:!0}),c.push({actionID:"selectTextEnd",keyBinding:new b(35,!0,!0),predefined:!0}));c.push({actionID:"undo",keyBinding:new l.KeyBinding("z",!0),predefined:!0});a.isMac?c.push({actionID:"redo",keyBinding:new l.KeyBinding("z",!0,!0),predefined:!0}):c.push({actionID:"redo",keyBinding:new l.KeyBinding("y",!0),predefined:!0});c.push({actionID:"deletePrevious",keyBinding:new b(8),predefined:!0});c.push({actionID:"deletePrevious",keyBinding:new b(8,
null,!0),predefined:!0});c.push({actionID:"deleteNext",keyBinding:new b(46),predefined:!0});c.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0),predefined:!0});c.push({actionID:"deleteWordPrevious",keyBinding:new b(8,!0,!0),predefined:!0});c.push({actionID:"deleteWordNext",keyBinding:new b(46,!0),predefined:!0});c.push({actionID:"tab",keyBinding:new b(9),predefined:!0});c.push({actionID:"shiftTab",keyBinding:new b(9,null,!0),predefined:!0});c.push({actionID:"enter",keyBinding:new b(13),predefined:!0});
c.push({actionID:"enter",keyBinding:new b(13,null,!0),predefined:!0});c.push({actionID:"selectAll",keyBinding:new b("a",!0),predefined:!0});c.push({actionID:"toggleTabMode",keyBinding:new b("m",!0),predefined:!0});a.isMac&&(c.push({actionID:"deleteNext",keyBinding:new b(46,null,!0),predefined:!0}),c.push({actionID:"deleteWordPrevious",keyBinding:new b(8,null,null,!0),predefined:!0}),c.push({actionID:"deleteWordNext",keyBinding:new b(46,null,null,!0),predefined:!0}));if(!a.isFirefox){var h=a.isMac&&
a.isChrome;c.push({actionID:null,keyBinding:new b("u",!h,!1,!1,h),predefined:!0});c.push({actionID:null,keyBinding:new b("i",!h,!1,!1,h),predefined:!0});c.push({actionID:null,keyBinding:new b("b",!h,!1,!1,h),predefined:!0})}a.isFirefox&&(c.push({actionID:"copy",keyBinding:new b(45,!0),predefined:!0}),c.push({actionID:"paste",keyBinding:new b(45,null,!0),predefined:!0}),c.push({actionID:"cut",keyBinding:new b(46,null,!0),predefined:!0}));a.isMac&&(c.push({actionID:"lineStart",keyBinding:new b("a",
!1,!1,!1,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new b("e",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"lineUp",keyBinding:new b("p",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"lineDown",keyBinding:new b("n",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"charPrevious",keyBinding:new b("b",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"charNext",keyBinding:new b("f",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deletePrevious",keyBinding:new b("h",!1,!1,!1,!0),predefined:!0}),
c.push({actionID:"deleteNext",keyBinding:new b("d",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deleteLineEnd",keyBinding:new b("k",!1,!1,!1,!0),predefined:!0}),a.isFirefox?(c.push({actionID:"scrollPageDown",keyBinding:new b("v",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deleteLineStart",keyBinding:new b("u",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deleteWordPrevious",keyBinding:new b("w",!1,!1,!1,!0),predefined:!0})):(c.push({actionID:"pageDown",keyBinding:new b("v",!1,!1,!1,!0),predefined:!0}),
c.push({actionID:"centerLine",keyBinding:new b("l",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"enterNoCursor",keyBinding:new b("o",!1,!1,!1,!0),predefined:!0})));var d=this;this._actions={lineUp:{defaultHandler:function(){return d._doLineUp({select:!1})}},lineDown:{defaultHandler:function(){return d._doLineDown({select:!1})}},lineStart:{defaultHandler:function(){return d._doHome({select:!1,ctrl:!1})}},lineEnd:{defaultHandler:function(){return d._doEnd({select:!1,ctrl:!1})}},charPrevious:{defaultHandler:function(){return d._doCursorPrevious({select:!1,
unit:"character"})}},charNext:{defaultHandler:function(){return d._doCursorNext({select:!1,unit:"character"})}},pageUp:{defaultHandler:function(){return d._doPageUp({select:!1})}},pageDown:{defaultHandler:function(){return d._doPageDown({select:!1})}},scrollPageUp:{defaultHandler:function(){return d._doScroll({type:"pageUp"})}},scrollPageDown:{defaultHandler:function(){return d._doScroll({type:"pageDown"})}},wordPrevious:{defaultHandler:function(){return d._doCursorPrevious({select:!1,unit:"word"})}},
wordNext:{defaultHandler:function(){return d._doCursorNext({select:!1,unit:"word"})}},textStart:{defaultHandler:function(){return d._doHome({select:!1,ctrl:!0})}},textEnd:{defaultHandler:function(){return d._doEnd({select:!1,ctrl:!0})}},scrollTextStart:{defaultHandler:function(){return d._doScroll({type:"textStart"})}},scrollTextEnd:{defaultHandler:function(){return d._doScroll({type:"textEnd"})}},centerLine:{defaultHandler:function(){return d._doScroll({type:"centerLine"})}},selectLineUp:{defaultHandler:function(){return d._doLineUp({select:!0})}},
selectLineDown:{defaultHandler:function(){return d._doLineDown({select:!0})}},selectWholeLineUp:{defaultHandler:function(){return d._doLineUp({select:!0,wholeLine:!0})}},selectWholeLineDown:{defaultHandler:function(){return d._doLineDown({select:!0,wholeLine:!0})}},selectLineStart:{defaultHandler:function(){return d._doHome({select:!0,ctrl:!1})}},selectLineEnd:{defaultHandler:function(){return d._doEnd({select:!0,ctrl:!1})}},selectCharPrevious:{defaultHandler:function(){return d._doCursorPrevious({select:!0,
unit:"character"})}},selectCharNext:{defaultHandler:function(){return d._doCursorNext({select:!0,unit:"character"})}},selectPageUp:{defaultHandler:function(){return d._doPageUp({select:!0})}},selectPageDown:{defaultHandler:function(){return d._doPageDown({select:!0})}},selectWordPrevious:{defaultHandler:function(){return d._doCursorPrevious({select:!0,unit:"word"})}},selectWordNext:{defaultHandler:function(){return d._doCursorNext({select:!0,unit:"word"})}},selectTextStart:{defaultHandler:function(){return d._doHome({select:!0,
ctrl:!0})}},selectTextEnd:{defaultHandler:function(){return d._doEnd({select:!0,ctrl:!0})}},deletePrevious:{defaultHandler:function(){return d._doBackspace({unit:"character"})}},deleteNext:{defaultHandler:function(){return d._doDelete({unit:"character"})}},deleteWordPrevious:{defaultHandler:function(){return d._doBackspace({unit:"word"})}},deleteWordNext:{defaultHandler:function(){return d._doDelete({unit:"word"})}},deleteLineStart:{defaultHandler:function(){return d._doBackspace({unit:"line"})}},
deleteLineEnd:{defaultHandler:function(){return d._doDelete({unit:"line"})}},tab:{defaultHandler:function(){return d._doTab()}},shiftTab:{defaultHandler:function(){return d._doShiftTab()}},enter:{defaultHandler:function(){return d._doEnter()}},enterNoCursor:{defaultHandler:function(){return d._doEnter({noCursor:!0})}},selectAll:{defaultHandler:function(){return d._doSelectAll()}},copy:{defaultHandler:function(){return d._doCopy()}},cut:{defaultHandler:function(){return d._doCut()}},paste:{defaultHandler:function(){return d._doPaste()}},
toggleWrapMode:{defaultHandler:function(){return d._doWrapMode()}},toggleTabMode:{defaultHandler:function(){return d._doTabMode()}}}},_createRuler:function(b,c){if(this._clientDiv){var h=b.getLocation()==="left"?this._leftDiv:this._rightDiv;h.style.display="block";var d=a.createElement(h.ownerDocument,"div");d._ruler=b;d.rulerChanged=!0;d.style.position="relative";var h=h.firstChild.rows[0],e=h.cells.length,h=h.insertCell(c===void 0||c<0||c>e?e:c);h.vAlign="top";h.style.verticalAlign="top";h.style.borderWidth=
"0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.appendChild(d)}},_createView:function(){if(!this._clientDiv){for(var b=this._parent;b.hasChildNodes();)b.removeChild(b.lastChild);var c=b.ownerDocument,h=a.createElement(c,"div");this._rootDiv=h;h.tabIndex=-1;h.style.position="relative";h.style.overflow="hidden";h.style.width="100%";h.style.height="100%";b.style.overflow="hidden";h.setAttribute("role","application");b.appendChild(h);b=a.createElement(c,"div");b.className="textviewLeftRuler";
this._leftDiv=b;b.tabIndex=-1;b.style.overflow="hidden";b.style.MozUserSelect="none";b.style.WebkitUserSelect="none";b.style.position="absolute";b.style.cursor="default";b.style.display="none";b.setAttribute("aria-hidden","true");var d=a.createElement(c,"table");b.appendChild(d);d.cellPadding="0px";d.cellSpacing="0px";d.border="0px";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.lineHeight="normal";d=d.insertRow(0);d.style.borderWidth="0px";d.style.margin=
"0px";d.style.padding="0px";d.style.outline="none";d.style.lineHeight="normal";h.appendChild(b);b=a.createElement(c,"div");b.className="textview";this._viewDiv=b;b.tabIndex=-1;b.style.overflow="auto";b.style.position="absolute";b.style.top="0px";b.style.bottom="0px";b.style.borderWidth="0px";b.style.margin="0px";b.style.outline="none";h.appendChild(b);var e=a.createElement(c,"div");e.className="textviewRightRuler";this._rightDiv=e;e.tabIndex=-1;e.style.display="none";e.style.overflow="hidden";e.style.MozUserSelect=
"none";e.style.WebkitUserSelect="none";e.style.position="absolute";e.style.cursor="default";e.style.right="0px";e.setAttribute("aria-hidden","true");d=a.createElement(c,"table");e.appendChild(d);d.cellPadding="0px";d.cellSpacing="0px";d.border="0px";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.lineHeight="normal";d=d.insertRow(0);d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.lineHeight="normal";
h.appendChild(e);this._scrollDiv=d=a.createElement(c,"div");d.style.margin="0px";d.style.borderWidth="0px";d.style.padding="0px";b.appendChild(d);if(a.isFirefox)this._clipboardDiv=b=a.createElement(c,"div"),b.style.position="fixed",b.style.whiteSpace="pre",b.style.left="-1000px",h.appendChild(b);if(!a.isIE&&!a.isIOS)this._clipDiv=b=a.createElement(c,"div"),b.style.position="absolute",b.style.overflow="hidden",b.style.margin="0px",b.style.borderWidth="0px",b.style.padding="0px",h.appendChild(b),this._clipScrollDiv=
d=a.createElement(c,"div"),d.style.position="absolute",d.style.height="1px",d.style.top="-1000px",b.appendChild(d);this._setFullSelection(this._fullSelection,!0);b=a.createElement(c,"div");b.className="textviewContent";this._clientDiv=b;b.style.position="absolute";b.style.borderWidth="0px";b.style.margin="0px";b.style.padding="0px";b.style.outline="none";b.style.zIndex="1";b.style.WebkitUserSelect="text";b.setAttribute("spellcheck","false");if(a.isIOS||a.isAndroid)b.style.WebkitTapHighlightColor=
"transparent";(this._clipDiv||h).appendChild(b);if(a.isIOS||a.isAndroid)this._vScrollDiv=d=a.createElement(c,"div"),d.style.position="absolute",d.style.borderWidth="1px",d.style.borderColor="white",d.style.borderStyle="solid",d.style.borderRadius="4px",d.style.backgroundColor="black",d.style.opacity="0.5",d.style.margin="0px",d.style.padding="0px",d.style.outline="none",d.style.zIndex="3",d.style.width="8px",d.style.display="none",h.appendChild(d),this._hScrollDiv=d=a.createElement(c,"div"),d.style.position=
"absolute",d.style.borderWidth="1px",d.style.borderColor="white",d.style.borderStyle="solid",d.style.borderRadius="4px",d.style.backgroundColor="black",d.style.opacity="0.5",d.style.margin="0px",d.style.padding="0px",d.style.outline="none",d.style.zIndex="3",d.style.height="8px",d.style.display="none",h.appendChild(d);if(a.isFirefox&&!b.setCapture)this._overlayDiv=d=a.createElement(c,"div"),d.style.position=b.style.position,d.style.borderWidth=b.style.borderWidth,d.style.margin=b.style.margin,d.style.padding=
b.style.padding,d.style.cursor="text",d.style.zIndex="2",(this._clipDiv||h).appendChild(d);b.contentEditable="true";b.setAttribute("role","textbox");b.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);if(!c.getElementById("_textviewStyle")&&(h="",a.isWebkit&&this._metrics.scrollWidth>0&&(h+="\n.textviewContainer ::-webkit-scrollbar-corner {background: #eeeeee;}"),
a.isFirefox&&a.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(h+="\n.textviewContainer ::-moz-selection {background: "+this._highlightRGB+";}"),h))b=a.createElement(c,"style"),b.id="_textviewStyle",d=c.getElementsByTagName("head")[0]||c.documentElement,b.appendChild(c.createTextNode(h)),d.insertBefore(b,d.firstChild);this._hookEvents();c=this._rulers;for(h=0;h<c.length;h++)this._createRuler(c[h]);this._update()}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,
update:this.setModel},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},wrapMode:{value:!1,update:this._setWrapMode},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(b){var a=b.getLocation()==="left"?this._leftDiv:this._rightDiv;if(a){for(var c=a.firstChild.rows[0],h=c.cells,d=0;d<h.length;d++)if(h[d].firstChild._ruler===
b)break;if(d!==h.length&&(c.cells[d]._ruler=void 0,c.deleteCell(d),h.length===0))a.style.display="none"}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var b=this._getWindow();if(this._autoScrollTimerID)b.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null;if(this._updateTimer)b.clearTimeout(this._updateTimer),this._updateTimer=null;b=this._rootDiv;b.parentNode.removeChild(b);this._hScrollDiv=this._vScrollDiv=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(b,a,c){this._autoScrollDir=b;this._autoScrollX=a;this._autoScrollY=c;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var b=this._clientDiv;
if(b){var a=this._hasFocus;this._ignoreFocus=!0;a&&b.blur();b.contentEditable=!1;b.contentEditable=!0;a&&b.focus();this._ignoreFocus=!1}},_getBaseText:function(b,a){var c=this._model;c.getBaseModel&&(b=c.mapOffset(b),a=c.mapOffset(a),c=c.getBaseModel());return c.getText(b,a)},_getBottomIndex:function(b){var a=this._bottomChild;if(b&&this._getClientHeight()>this._getLineHeight()){var b=a.getBoundingClientRect(),c=this._clientDiv.getBoundingClientRect();b.bottom>c.bottom&&(a=this._getLinePrevious(a)||
a)}return a.lineIndex},_getBoundsAtOffset:function(b){var a=this._getLine(this._model.getLineAtOffset(b)),b=a.getBoundingClientRect(b),c=this._getLinePixel(a.lineIndex);b.top+=c;b.bottom+=c;a.destroy();return b},_getClientHeight:function(){var b=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-b.top-b.bottom)},_getClientWidth:function(){var b=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-b.left-b.right)},_getClipboardText:function(b,h){var d=this._model.getLineDelimiter(),
e,f,g=this._getWindow();if(g.clipboardData)return e=[],f=g.clipboardData.getData("Text"),c(f,function(b){e.push(b)},function(){e.push(d)}),f=e.join(""),h&&h(f),f;if(a.isFirefox){this._ignoreFocus=!0;var m=this._clipboardDiv;m.innerHTML="<pre contenteditable=''></pre>";m.firstChild.focus();var i=this,j=function(){var b=i._getTextFromElement(m);m.innerHTML="";e=[];c(b,function(b){e.push(b)},function(){e.push(d)});return e.join("")},t=!1;this._ignorePaste=!0;if(!a.isLinux||this._lastMouseButton!==2)try{t=
m.ownerDocument.execCommand("paste",!1,null)}catch(o){t=m.childNodes.length>1||m.firstChild&&m.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!t)return b?(g.setTimeout(function(){i.focus();(f=j())&&h&&h(f);i._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(f=j())&&h&&h(f);return f}return b&&b.clipboardData?(e=[],f=b.clipboardData.getData("text/plain"),c(f,function(b){e.push(b)},function(){e.push(d)}),(f=e.join(""))&&h&&h(f),f):""},_getDOMText:function(b,
a){for(var c=b.firstChild,h="",d=0;c;){var e;if(c.ignoreChars){e=c.lastChild;for(var f=0,g=[],m=-1;e;){for(var t=e.data,i=t.length-1;i>=0;i--){var j=t.substring(i,i+1);f<c.ignoreChars&&(j===" "||j==="\u200c"||j==="\ufeff")?f++:g.push(j==="\u00a0"?"\t":j)}if(a===e)m=g.length;e=e.previousSibling}g=g.reverse().join("");m!==-1&&(d=h.length+g.length-m);h+=g}else for(e=c.firstChild;e;){if(a===e)d=h.length;h+=e.data;e=e.nextSibling}c=c.nextSibling}return{text:h,offset:d}},_getTextFromElement:function(b){var a=
b.ownerDocument,c=a.defaultView;if(!c.getSelection)return b.innerText||b.textContent;a=a.createRange();a.selectNode(b);var b=c.getSelection(),c=[],h;for(h=0;h<b.rangeCount;h++)c.push(b.getRangeAt(h));this._ignoreSelect=!0;b.removeAllRanges();b.addRange(a);a=b.toString();b.removeAllRanges();for(h=0;h<c.length;h++)b.addRange(c[h]);this._ignoreSelect=!1;return a},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(b){var a=this._getLineNode(b);return a&&!a.lineChanged&&!a.lineRemoved?
a._line:new r(this,b)},_getLineHeight:function(b,a){if(b!==void 0&&this._lineHeight){var c=this._lineHeight[b];if(c)return c;if(a||a===void 0)return this._lineHeight[b]=this._calculateLineHeight(b)}return this._metrics.lineHeight},_getLineNode:function(b){for(var a=this._clientDiv.firstChild;a;){if(b===a.lineIndex)return a;a=a.nextSibling}},_getLineNext:function(b){for(b=b?b.nextSibling:this._clientDiv.firstChild;b&&b.lineIndex===-1;)b=b.nextSibling;return b},_getLinePrevious:function(b){for(b=b?
b.previousSibling:this._clientDiv.lastChild;b&&b.lineIndex===-1;)b=b.previousSibling;return b},_getLinePixel:function(b){b=Math.min(Math.max(0,b),this._model.getLineCount());if(this._lineHeight){var a=this._getTopIndex(),c=-this._topIndexY+this._getScroll().y;if(b>a)for(;a<b;a++)c+=this._getLineHeight(a);else for(a-=1;a>=b;a--)c-=this._getLineHeight(a);return c}return this._getLineHeight()*b},_getLineIndex:function(b){var a,c=0,h=this._model.getLineCount();if(this._lineHeight){var c=this._getTopIndex(),
d=-this._topIndexY+this._getScroll().y;if(b!==d)if(b<d)for(;b<d&&c>0;)b+=this._getLineHeight(--c);else for(a=this._getLineHeight(c);b-a>=d&&c<h-1;)b-=a,a=this._getLineHeight(++c)}else a=this._getLineHeight(),c=Math.floor(b/a);return Math.max(0,Math.min(h-1,c))},_getScroll:function(){var b=this._viewDiv;return{x:b.scrollLeft,y:b.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(b){var a=this._topChild;if(b&&this._getClientHeight()>this._getLineHeight()){var b=
a.getBoundingClientRect(),c=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect();b.top<h.top+c.top&&(a=this._getLineNext(a)||a)}return a.lineIndex},_hookEvents:function(){var b=this;this._modelListener={onChanging:function(a){b._onModelChanging(a)},onChanged:function(a){b._onModelChanged(a)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);var c=this._handlers=[],h=this._clientDiv,d=this._viewDiv,
e=this._rootDiv,g=this._overlayDiv||h,m=h.ownerDocument,i=this._getWindow(),j=a.isIE?m:i;c.push({target:i,type:"resize",handler:function(a){return b._handleResize(a?a:i.event)}});c.push({target:h,type:"blur",handler:function(a){return b._handleBlur(a?a:i.event)}});c.push({target:h,type:"focus",handler:function(a){return b._handleFocus(a?a:i.event)}});c.push({target:d,type:"focus",handler:function(){h.focus()}});c.push({target:d,type:"scroll",handler:function(a){return b._handleScroll(a?a:i.event)}});
c.push({target:h,type:"textInput",handler:function(a){return b._handleTextInput(a?a:i.event)}});c.push({target:h,type:"keydown",handler:function(a){return b._handleKeyDown(a?a:i.event)}});c.push({target:h,type:"keypress",handler:function(a){return b._handleKeyPress(a?a:i.event)}});c.push({target:h,type:"keyup",handler:function(a){return b._handleKeyUp(a?a:i.event)}});c.push({target:h,type:"contextmenu",handler:function(a){return b._handleContextMenu(a?a:i.event)}});c.push({target:h,type:"copy",handler:function(a){return b._handleCopy(a?
a:i.event)}});c.push({target:h,type:"cut",handler:function(a){return b._handleCut(a?a:i.event)}});c.push({target:h,type:"paste",handler:function(a){return b._handlePaste(a?a:i.event)}});if(a.isIOS||a.isAndroid)c.push({target:m,type:"selectionchange",handler:function(a){return b._handleSelectionChange(a?a:i.event)}}),c.push({target:h,type:"touchstart",handler:function(a){return b._handleTouchStart(a?a:i.event)}}),c.push({target:h,type:"touchmove",handler:function(a){return b._handleTouchMove(a?a:i.event)}}),
c.push({target:h,type:"touchend",handler:function(a){return b._handleTouchEnd(a?a:i.event)}});else{c.push({target:h,type:"selectstart",handler:function(a){return b._handleSelectStart(a?a:i.event)}});c.push({target:h,type:"mousedown",handler:function(a){return b._handleMouseDown(a?a:i.event)}});c.push({target:h,type:"mouseover",handler:function(a){return b._handleMouseOver(a?a:i.event)}});c.push({target:h,type:"mouseout",handler:function(a){return b._handleMouseOut(a?a:i.event)}});c.push({target:j,
type:"mouseup",handler:function(a){return b._handleMouseUp(a?a:i.event)}});c.push({target:j,type:"mousemove",handler:function(a){return b._handleMouseMove(a?a:i.event)}});c.push({target:e,type:"mousedown",handler:function(a){return b._handleRootMouseDown(a?a:i.event)}});c.push({target:e,type:"mouseup",handler:function(a){return b._handleRootMouseUp(a?a:i.event)}});c.push({target:g,type:"dragstart",handler:function(a){return b._handleDragStart(a?a:i.event)}});c.push({target:g,type:"drag",handler:function(a){return b._handleDrag(a?
a:i.event)}});c.push({target:g,type:"dragend",handler:function(a){return b._handleDragEnd(a?a:i.event)}});c.push({target:g,type:"dragenter",handler:function(a){return b._handleDragEnter(a?a:i.event)}});c.push({target:g,type:"dragover",handler:function(a){return b._handleDragOver(a?a:i.event)}});c.push({target:g,type:"dragleave",handler:function(a){return b._handleDragLeave(a?a:i.event)}});c.push({target:g,type:"drop",handler:function(a){return b._handleDrop(a?a:i.event)}});c.push({target:this._clientDiv,
type:a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return b._handleMouseWheel(a?a:i.event)}});if(a.isFirefox&&(!a.isWindows||a.isFirefox>=15))(d=i.MutationObserver||i.MozMutationObserver)?(this._mutationObserver=new d(function(a){b._handleDataModified(a)}),this._mutationObserver.observe(h,{subtree:!0,characterData:!0})):c.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(a){return b._handleDataModified(a?a:i.event)}});this._overlayDiv&&(c.push({target:this._overlayDiv,
type:"mousedown",handler:function(a){return b._handleMouseDown(a?a:i.event)}}),c.push({target:this._overlayDiv,type:"mouseover",handler:function(a){return b._handleMouseOver(a?a:i.event)}}),c.push({target:this._overlayDiv,type:"mouseout",handler:function(a){return b._handleMouseOut(a?a:i.event)}}),c.push({target:this._overlayDiv,type:"contextmenu",handler:function(a){return b._handleContextMenu(a?a:i.event)}}));this._isW3CEvents||c.push({target:this._clientDiv,type:"dblclick",handler:function(a){return b._handleDblclick(a?
a:i.event)}})}d=this._leftDiv;e=this._rightDiv;a.isIE&&c.push({target:d,type:"selectstart",handler:function(){return!1}});c.push({target:d,type:a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return b._handleMouseWheel(a?a:i.event)}});c.push({target:d,type:"click",handler:function(a){b._handleRulerEvent(a?a:i.event)}});c.push({target:d,type:"dblclick",handler:function(a){b._handleRulerEvent(a?a:i.event)}});c.push({target:d,type:"mousemove",handler:function(a){b._handleRulerEvent(a?a:
i.event)}});c.push({target:d,type:"mouseover",handler:function(a){b._handleRulerEvent(a?a:i.event)}});c.push({target:d,type:"mouseout",handler:function(a){b._handleRulerEvent(a?a:i.event)}});a.isIE&&c.push({target:e,type:"selectstart",handler:function(){return!1}});c.push({target:e,type:a.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return b._handleMouseWheel(a?a:i.event)}});c.push({target:e,type:"click",handler:function(a){b._handleRulerEvent(a?a:i.event)}});c.push({target:e,type:"dblclick",
handler:function(a){b._handleRulerEvent(a?a:i.event)}});c.push({target:e,type:"mousemove",handler:function(a){b._handleRulerEvent(a?a:i.event)}});c.push({target:e,type:"mouseover",handler:function(a){b._handleRulerEvent(a?a:i.event)}});c.push({target:e,type:"mouseout",handler:function(a){b._handleRulerEvent(a?a:i.event)}});for(d=0;d<c.length;d++)e=c[d],f(e.target,e.type,e.handler,e.capture)},_getWindow:function(){return this._parent.ownerDocument.defaultView||this._parent.ownerDocument.parentWindow},
_init:function(b){var c=b.parent;typeof c==="string"&&(c=(b.document||document).getElementById(c));if(!c)throw"no parent";b.parent=c;b.model=b.model||new j.TextModel;var h=this._defaultOptions(),d;for(d in h)h.hasOwnProperty(d)&&(this["_"+d]=b[d]!==void 0?b[d]:h[d].value);this._rulers=[];this._selection=new m(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 c.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=c.addEventListener;this._autoScrollTimerID=this._autoScrollY=this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;
this._createActions();this._createView()},_isOverOverlayScroll:function(){if(!a.isMac)return{};var b=this._viewDiv.getBoundingClientRect(),c=this._lastMouseMoveX,h=this._lastMouseMoveY;return{vertical:b.top<=h&&h<b.bottom&&b.right-15<=c&&c<b.right,horizontal:b.bottom-15<=h&&h<b.bottom&&b.left<=c&&c<b.right}},_modifyContent:function(b,a){if(!this._readonly||b._code)if(b.type="Verify",this.onVerify(b),!(b.text===null||b.text===void 0)){var c=this._model;try{if(b._ignoreDOMSelection)this._ignoreDOMSelection=
!0;c.setText(b.text,b.start,b.end)}finally{if(b._ignoreDOMSelection)this._ignoreDOMSelection=!1}a&&(c=this._getSelection(),c.setCaret(b.start+b.text.length),this._setSelection(c,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(b){b.type="ModelChanged";this.onModelChanged(b);b.type="Changed";var a=b.start,c=b.addedCharCount,h=b.removedCharCount,d=b.addedLineCount,e=b.removedLineCount,f=this._getSelection();f.end>a&&(f.end>a&&f.start<a+h?f.setCaret(a+c):(f.start+=c-h,f.end+=c-h),this._setSelection(f,
!1,!1));a=this._model.getLineAtOffset(a);for(c=this._getLineNext();c;){h=c.lineIndex;if(a<=h&&h<=a+e)a===h&&!c.modelChangedEvent&&!c.lineRemoved?(c.modelChangedEvent=b,c.lineChanged=!0):(c.lineRemoved=!0,c.lineChanged=!1,c.modelChangedEvent=null);if(h>a+e)c.lineIndex=h+d-e,c._line.lineIndex=c.lineIndex;c=this._getLineNext(c)}if(!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<=a+e)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._update()},_onModelChanging:function(b){b.type=
"ModelChanging";this.onModelChanging(b);b.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var b=this;this._updateTimer=this._getWindow().setTimeout(function(){b._updateTimer=null;b._update()},0)}},_resetLineHeight:function(b,a){if(this._wrapMode){if(b!==void 0&&a!==void 0)for(var c=b;c<a;c++)this._lineHeight[c]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var b=
this._clientDiv;if(b)for(b=b.firstChild;b;)b.lineWidth=void 0,b=b.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._resetLineHeight();this._setSelection(new m(0,0,!1),!1,!1);if(this._viewDiv)this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0;var b=this._clientDiv;if(b){for(var c=b.firstChild;c;)c.lineRemoved=!0,c=c.nextSibling;if(a.isFirefox)this._ignoreFocus=!1,(c=this._hasFocus)&&b.blur(),b.contentEditable=
!1,b.contentEditable=!0,c&&b.focus(),this._ignoreFocus=!1}},_scrollView:function(b,a){this._ensureCaretVisible=!1;var c=this._viewDiv;b&&(c.scrollLeft+=b);a&&(c.scrollTop+=a)},_setClipboardText:function(b,h){var d,e=this._parent.ownerDocument,f=this._getWindow();if(f.clipboardData)return d=[],c(b,function(b){d.push(b)},function(){d.push(a.platformDelimiter)}),f.clipboardData.setData("Text",d.join(""));if(h&&h.clipboardData&&(d=[],c(b,function(b){d.push(b)},function(){d.push(a.platformDelimiter)}),
h.clipboardData.setData("text/plain",d.join(""))))return!0;var g=a.createElement(e,"pre");g.style.position="fixed";g.style.left="-1000px";c(b,function(b){g.appendChild(e.createTextNode(b))},function(){g.appendChild(a.createElement(e,"br"))});g.appendChild(e.createTextNode(" "));this._clientDiv.appendChild(g);var m=e.createRange();m.setStart(g.firstChild,0);m.setEndBefore(g.lastChild);var i=f.getSelection();i.rangeCount>0&&i.removeAllRanges();i.addRange(m);var j=this,m=function(){g&&g.parentNode===
j._clientDiv&&j._clientDiv.removeChild(g);j._updateDOMSelection()},i=!1;this._ignoreCopy=!0;try{i=e.execCommand("copy",!1,null)}catch(t){}this._ignoreCopy=!1;if(!i&&h)return f.setTimeout(m,0),!1;m();return!0},_setDOMSelection:function(b,c,h,d){for(var e,f,g,m,i=0,j=b.firstChild,o,r,q=this._model.getLine(b.lineIndex).length;j;){o=j.firstChild;r=o.length;j.ignoreChars&&(r-=j.ignoreChars);if(i+r>c||i+r>=q){e=o;f=c-i;j.ignoreChars&&r>0&&f===r&&(f+=j.ignoreChars);break}i+=r;j=j.nextSibling}for(var i=0,
j=h.firstChild,l=this._model.getLine(h.lineIndex).length;j;){o=j.firstChild;r=o.length;j.ignoreChars&&(r-=j.ignoreChars);if(r+i>d||i+r>=l){g=o;m=d-i;j.ignoreChars&&r>0&&m===r&&(m+=j.ignoreChars);break}i+=r;j=j.nextSibling}this._setDOMFullSelection(b,c,q,h,d,l);if(this._hasFocus)if(c=this._getWindow(),b=this._parent.ownerDocument,c.getSelection){if(c=c.getSelection(),!(c.anchorNode===e&&c.anchorOffset===f&&c.focusNode===g&&c.focusOffset===m||c.anchorNode===g&&c.anchorOffset===m&&c.focusNode===e&&c.focusOffset===
f))b=b.createRange(),b.setStart(e,f),b.setEnd(g,m),this._ignoreSelect=!1,c.rangeCount>0&&c.removeAllRanges(),c.addRange(b),this._ignoreSelect=!0}else if(b.selection)c=b.body,b=a.createElement(b,"div"),c.appendChild(b),c.removeChild(b),b=c.createTextRange(),b.moveToElementText(e.parentNode),b.moveStart("character",f),e=c.createTextRange(),e.moveToElementText(g.parentNode),e.moveStart("character",m),b.setEndPoint("EndToStart",e),this._ignoreSelect=!1,b.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(b,
a,c,h,d){if(this._selDiv1&&(c=this._selDiv1,c.style.width="0px",c.style.height="0px",c=this._selDiv2,c.style.width="0px",c.style.height="0px",c=this._selDiv3,c.style.width="0px",c.style.height="0px",!(b===h&&a===d))){var e=this._model,f=this._getViewPadding(),g=this._clientDiv.getBoundingClientRect(),m=this._viewDiv.getBoundingClientRect(),c=m.left+f.left,i=g.right,f=m.top+f.top,j=g.bottom,m=g=0;this._clipDiv?(m=this._clipDiv.getBoundingClientRect(),g=m.left-this._clipDiv.scrollLeft):(m=this._rootDiv.getBoundingClientRect(),
g=m.left);m=m.top;this._ignoreDOMSelection=!0;var b=(new r(this,b.lineIndex,b)).getBoundingClientRect(e.getLineStart(b.lineIndex)+a,!1),o=b.left,d=(new r(this,h.lineIndex,h)).getBoundingClientRect(e.getLineStart(h.lineIndex)+d,!1),a=d.left;this._ignoreDOMSelection=!1;var e=this._selDiv1,o=Math.min(i,Math.max(c,o)),q=Math.min(j,Math.max(f,b.top)),l=i,h=Math.min(j,Math.max(f,b.bottom));e.style.left=o-g+"px";e.style.top=q-m+"px";e.style.width=Math.max(0,l-o)+"px";e.style.height=Math.max(0,h-q)+"px";
if(b.top===d.top)l=Math.min(a,i),e.style.width=Math.max(0,l-o)+"px";else if(b=Math.min(j,Math.max(f,d.top)),a=Math.min(i,Math.max(c,a)),f=Math.min(j,Math.max(f,d.bottom)),j=this._selDiv3,j.style.left=c-g+"px",j.style.top=b-m+"px",j.style.width=Math.max(0,a-c)+"px",j.style.height=Math.max(0,f-b)+"px",b-h>0)f=this._selDiv2,f.style.left=c-g+"px",f.style.top=h-m+"px",f.style.width=Math.max(0,i-c)+"px",f.style.height=Math.max(0,b-h)+"px"}},_setGrab:function(b){if(b!==this._grabControl)b?(b.setCapture&&
b.setCapture(),this._grabControl=b):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null)},_setLinksVisible:function(b){if(this._linksVisible!==b){this._linksVisible=b;if(a.isIE&&b)this._hadFocus=this._hasFocus;var c=this._clientDiv;c.contentEditable=!b;this._hadFocus&&!b&&c.focus();if(this._overlayDiv)this._overlayDiv.style.zIndex=b?"-1":"1";for(b=this._getLineNext();b;){if(b.hasLink)for(c=b.firstChild;c;){var h=c.nextSibling,d=c.viewStyle;d&&d.tagName==="A"&&
b.replaceChild(b._line._createSpan(b,c.firstChild.data,d),c);c=h}b=this._getLineNext(b)}}},_setSelection:function(b,a,c,h){if(b){this._columnX=-1;c===void 0&&(c=!0);var d=this._selection;this._selection=b;a&&this._showCaret(!1,h);c&&this._updateDOMSelection();if(!d.equals(b))this.onSelection({type:"Selection",oldValue:{start:d.start,end:d.end},newValue:{start:b.start,end:b.end}})}},_setSelectionTo:function(b,a,c,h){var d=this._model,e=this._getSelection(),a=this.convert({x:b,y:a},"page","document"),
b=this._getLineIndex(a.y);if(this._clickCount===1){d=this._getLine(b);b=d.getOffset(a.x,a.y-this._getLinePixel(b));d.destroy();if(h&&!c&&e.start<=b&&b<e.end)return this._dragOffset=b,!1;e.extend(b);c||e.collapse()}else(this._clickCount&1)===0?(d=this._getLine(b),b=d.getOffset(a.x,a.y-this._getLinePixel(b)),this._doubleClickSelection?b>=this._doubleClickSelection.start?(c=this._doubleClickSelection.start,h=d.getNextOffset(b,"wordend",1)):(c=d.getNextOffset(b,"word",-1),h=this._doubleClickSelection.end):
(c=d.getNextOffset(b,"word",-1),h=d.getNextOffset(c,"wordend",1)),d.destroy()):this._doubleClickSelection?(h=d.getLineAtOffset(this._doubleClickSelection.start),b>=h?(c=d.getLineStart(h),h=d.getLineEnd(b)):(c=d.getLineStart(b),h=d.getLineEnd(h))):(c=d.getLineStart(b),h=d.getLineEnd(b)),e.setCaret(c),e.extend(h);this._setSelection(e,!0,!0);return!0},_setFullSelection:function(b,c){this._fullSelection=b;if(a.isWebkit)this._fullSelection=!0;var h=this._clipDiv||this._rootDiv;if(h)if(this._fullSelection){if(!this._selDiv1&&
this._fullSelection&&!a.isIOS){var d=h.ownerDocument;this._highlightRGB=a.isWebkit?"transparent":"Highlight";var e=a.createElement(d,"div");this._selDiv1=e;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";h.appendChild(e);var f=a.createElement(d,"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";h.appendChild(f);this._selDiv3=d=a.createElement(d,"div");d.style.position="absolute";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.background=this._highlightRGB;d.style.width="0px";d.style.height="0px";d.style.zIndex="0";h.appendChild(d);if(a.isFirefox&&a.isMac){h=this._getWindow().getComputedStyle(d,
null).getPropertyValue("background-color");switch(h){case "rgb(119, 141, 168)":h="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":h="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":h="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":h="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":h="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":h="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":h="rgb(232, 184, 255)";break;default:h="rgb(180, 213, 255)"}this._highlightRGB=h;e.style.background=
h;f.style.background=h;d.style.background=h}c||this._updateDOMSelection()}}else{if(this._selDiv1)h.removeChild(this._selDiv1),this._selDiv1=null;if(this._selDiv2)h.removeChild(this._selDiv2),this._selDiv2=null;if(this._selDiv3)h.removeChild(this._selDiv3),this._selDiv3=null}},_setReadOnly:function(b){this._readonly=b;this._clientDiv.setAttribute("aria-readonly",b?"true":"false")},_setTabSize:function(b,c){this._tabSize=b;this._customTabSize=void 0;var h=this._clientDiv;if(a.isOpera){if(h)h.style.OTabSize=
this._tabSize+""}else if(a.isWebkit>=537.1){if(h)h.style.tabSize=this._tabSize+""}else if(a.isFirefox>=4){if(h)h.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==8)this._customTabSize=this._tabSize;c||(this.redrawLines(),this._resetLineWidth())},_setThemeClass:function(b,a){this._themeClass=b;var c="textviewContainer";this._themeClass&&(c+=" "+this._themeClass);this._rootDiv.className=c;this._updateStyle(a)},_setWrapMode:function(b,a){this._wrapMode=b;var c=this._clientDiv,h=this._viewDiv;
b?(c.style.whiteSpace="pre-wrap",c.style.wordWrap="break-word",h.style.overflowX="hidden",h.style.overflowY="scroll"):(c.style.whiteSpace="pre",c.style.wordWrap="normal",h.style.overflowX="auto",h.style.overflowY="auto");a||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(b,a){if(this._clientDiv){var c=this._model,h=this._getSelection(),d=this._getScroll(),e=h.getCaret(),f=h.start,g=h.end,m=c.getLineAtOffset(g),i=Math.max(Math.max(f,c.getLineStart(m)),g-1),c=this._getClientWidth(),
m=this._getClientHeight(),j=c/4,o=this._getBoundsAtOffset(e===f?f:i),r=o.left,q=o.right,l=o.top,A=o.bottom;b&&!h.isEmpty()&&(o=this._getBoundsAtOffset(e===g?f:i),o.top===l?e===f?q=r+Math.min(o.right-r,c):r=q-Math.min(q-o.left,c):e===f?A=l+Math.min(o.bottom-l,m):l=A-Math.min(A-o.top,m));h=0;r<d.x&&(h=Math.min(r-d.x,-j));q>d.x+c&&(h=Math.max(q-d.x-c,j));e=0;l<d.y?e=l-d.y:A>d.y+m&&(e=A-d.y-m);a&&(a>0?e>0&&(e=Math.max(e,a)):e<0&&(e=Math.min(e,a)));return h!==0||e!==0?(this._scrollView(h,e),m!==this._getClientHeight()||
c!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0):!1}},_startIME:function(){if(this._imeOffset===-1){var b=this._getSelection();b.isEmpty()||this._modifyContent({text:"",start:b.start,end:b.end},!0);this._imeOffset=b.start}},_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);this._modelListener=null;for(var b=0;b<this._handlers.length;b++){var a=
this._handlers[b],c=a.target,h=a.type,a=a.handler;typeof c.removeEventListener==="function"?c.removeEventListener(h,a,!1):c.detachEvent("on"+h,a)}this._handlers=null;if(this._mutationObserver)this._mutationObserver.disconnect(),this._mutationObserver=null},_updateDOMSelection:function(){if(!this._ignoreDOMSelection&&this._clientDiv){var b=this._getSelection(),a=this._model,c=a.getLineAtOffset(b.start),h=a.getLineAtOffset(b.end),d=this._getLineNext();if(d){var e=this._getLinePrevious(),f;c<d.lineIndex?
(f=d,c=0):c>e.lineIndex?(f=e,c=0):(f=this._getLineNode(c),c=b.start-a.getLineStart(c));h<d.lineIndex?b=0:h>e.lineIndex?(d=e,b=0):(d=this._getLineNode(h),b=b.end-a.getLineStart(h));this._setDOMSelection(f,c,d,b)}}},_update:function(b){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,b=!1;var c=this._clientDiv;if(c){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var h=this._model,
d=this._getScroll(),e=this._getViewPadding(),f=h.getLineCount(),g=this._getLineHeight(),m=this._getClientWidth();if(this._wrapMode)c.style.width=m+"px";var i,j,o,q,l=0,y=0;if(this._lineHeight){for(;y<f;){o=this._getLineHeight(y);if(l+o>d.y)break;l+=o;y++}i=y;j=Math.max(0,i-1);o=h=d.y-l;i>0&&(h+=this._getLineHeight(i-1))}else q=Math.max(0,d.y)/g,i=Math.floor(q),j=Math.max(0,i-1),h=Math.round((q-j)*g),o=Math.round((q-i)*g);this._topIndexY=o;q=this._parent;var H=q.clientWidth,A=q.clientHeight;q=this._getClientHeight();
if(b){j=0;this._leftDiv&&(i=this._leftDiv.getBoundingClientRect(),j=i.right-i.left);i=m;for(this._wrapMode||(i=Math.max(this._maxLineWidth,i));y<f;)o=this._getLineHeight(y,!1),l+=o,y++;f=l}else{for(var m=this._viewDiv,d=Math.min(i+Math.floor((q+o)/g),f-1),E=Math.min(d+1,f-1),g=c.firstChild;g;){o=g.lineIndex;var G=g.nextSibling;if(!(j<=o&&o<=E)||g.lineRemoved||g.lineIndex===-1)this._mouseWheelLine===g?(g.style.display="none",g.lineIndex=-1):c.removeChild(g);g=G}var g=this._getLineNext(),G=m.ownerDocument,
C=G.createDocumentFragment();for(o=j;o<=E;o++)if(!g||g.lineIndex>o)(new r(this,o)).create(C,null);else{C.firstChild&&(c.insertBefore(C,g),C=G.createDocumentFragment());if(g&&g.lineChanged)g=(new r(this,o)).create(C,g),g.lineChanged=!1;g=this._getLineNext(g)}C.firstChild&&c.insertBefore(C,g);if(a.isWebkit&&!this._wrapMode)c.style.width="0x7fffffffpx";g=this._getLineNext();o=q+h;for(G=!1;g;){j=g.lineWidth;if(j===void 0)E=g._line.getBoundingClientRect(),j=g.lineWidth=Math.ceil(E.right-E.left),this._lineHeight&&
(this._lineHeight[g.lineIndex]=Math.ceil(E.bottom-E.top));if(this._lineHeight&&!G&&(o-=this._lineHeight[g.lineIndex],o<0))d=g.lineIndex,G=!0;if(!this._wrapMode){if(j>=this._maxLineWidth)this._maxLineWidth=j,this._maxLineIndex=g.lineIndex;if(this._checkMaxLineIndex===g.lineIndex)this._checkMaxLineIndex=-1}if(g.lineIndex===i)this._topChild=g;if(g.lineIndex===d)this._bottomChild=g;g=this._getLineNext(g)}if(this._checkMaxLineIndex!==-1&&(o=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=o&&o<f)){g=
new r(this,o);E=g.getBoundingClientRect();j=E.right-E.left;if(j>=this._maxLineWidth)this._maxLineWidth=j,this._maxLineIndex=o;g.destroy()}for(;y<f;)o=this._getLineHeight(y,y<=d),l+=o,y++;f=l;this._updateRuler(this._leftDiv,i,d);this._updateRuler(this._rightDiv,i,d);j=0;this._leftDiv&&(i=this._leftDiv.getBoundingClientRect(),j=i.right-i.left);d=0;this._rightDiv&&(d=this._rightDiv.getBoundingClientRect(),d=d.right-d.left);m.style.left=j+"px";m.style.right=d+"px";d=this._scrollDiv;d.style.height=f+"px";
l=m=this._getClientWidth();this._wrapMode||(l=Math.max(this._maxLineWidth,l));i=l;if((!a.isIE||a.isIE>=9)&&this._maxLineWidth>m)l+=e.right+e.left;d.style.width=l+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width=l+"px";d=this._getScroll();l=q+e.top+e.bottom;this._updateRulerSize(this._leftDiv,l);this._updateRulerSize(this._rightDiv,l)}if(this._vScrollDiv)l=q-8,y=Math.max(15,Math.ceil(Math.min(1,l/(f+e.top+e.bottom))*l)),this._vScrollDiv.style.left=j+m-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,
d.y*l/f))+"px",this._vScrollDiv.style.height=y+"px";if(!this._wrapMode&&this._hScrollDiv)l=m-8,y=Math.max(15,Math.ceil(Math.min(1,l/(this._maxLineWidth+e.left+e.right))*l)),this._hScrollDiv.style.left=j+Math.floor(Math.max(0,Math.floor(d.x*l/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=q-9+"px",this._hScrollDiv.style.width=y+"px";E=d.x;o=this._clipDiv;l=this._overlayDiv;if(o){o.scrollLeft=E;y=j+e.left;g=e.top;b=m;j=q;E=0;G=-h;if(d.x===0)y-=e.left,b+=e.left,E=e.left;d.x+m===i&&(b+=e.right);
d.y===0&&(g-=e.top,j+=e.top,G+=e.top);d.y+q===f&&(j+=e.bottom);o.style.left=y+"px";o.style.top=g+"px";e=this._isOverOverlayScroll();o.style.right=H-b-y+(this._overlayScrollTimer&&e.vertical?15:0)+"px";o.style.bottom=A-j-g+(this._overlayScrollTimer&&e.horizontal?15:0)+"px";c.style.left=E+"px";c.style.top=G+"px";c.style.width=i+"px";c.style.height=q+h+"px";if(l)l.style.left=c.style.left,l.style.top=c.style.top,l.style.width=c.style.width,l.style.height=c.style.height}else{y=E;g=h;H=E+m;A=h+q;y===0&&
(y-=e.left);g===0&&(g-=e.top);H===i&&(H+=e.right);d.y+q===f&&(A+=e.bottom);c.style.clip="rect("+g+"px,"+H+"px,"+A+"px,"+y+"px)";c.style.left=-E+j+e.left+"px";c.style.width=(a.isWebkit?i:m+E)+"px";if(!b)c.style.top=-h+e.top+"px",c.style.height=q+h+"px";if(l&&(l.style.clip=c.style.clip,l.style.left=c.style.left,l.style.width=c.style.width,!b))l.style.top=c.style.top,l.style.height=c.style.height}this._updateDOMSelection();c=this._ensureCaretVisible;this._ensureCaretVisible=!1;q!==this._getClientHeight()&&
(this._update(),c&&this._showCaret())}}},_updateRulerSize:function(b,a){if(b){for(var c=this._topIndexY,h=this._getLineHeight(),d=b.firstChild.rows[0].cells,e=0;e<d.length;e++){var f=d[e].firstChild,g=h;f._ruler.getOverview()==="page"&&(g+=c);f.style.top=-g+"px";f.style.height=a+g+"px"}b.style.height=a+"px"}},_updateRuler:function(b,c,h){if(b)for(var b=b.firstChild.rows[0].cells,d=this._parent.ownerDocument,e=this._getLineHeight(),f=this._getViewPadding(),m=0;m<b.length;m++){var i=b[m].firstChild,
j=i._ruler;i.rulerChanged&&g(j.getRulerStyle(),i);var o,r=i.firstChild;r?(o=r,r=r.nextSibling):(o=a.createElement(d,"div"),o.style.visibility="hidden",i.appendChild(o));var q,l;if(i.rulerChanged&&o){q=-1;if(l=j.getWidestAnnotation())if(g(l.style,o),l.html)o.innerHTML=l.html;o.lineIndex=q;o.style.height=e+f.top+"px"}var y,H;if(j.getOverview()==="page"){for(j=j.getAnnotations(c,h+1);r;)q=r.lineIndex,l=r.nextSibling,(!(c<=q&&q<=h)||r.lineChanged)&&i.removeChild(r),r=l;r=i.firstChild.nextSibling;H=d.createDocumentFragment();
for(q=c;q<=h;q++)if(!r||r.lineIndex>q){y=a.createElement(d,"div");if(l=j[q]){g(l.style,y);if(l.html)y.innerHTML=l.html;y.annotation=l}y.lineIndex=q;y.style.height=this._getLineHeight(q)+"px";H.appendChild(y)}else if(H.firstChild&&(i.insertBefore(H,r),H=d.createDocumentFragment()),r)r=r.nextSibling;H.firstChild&&i.insertBefore(H,r)}else{l=this._getClientHeight();q=this._model.getLineCount();r=l+f.top+f.bottom-2*this._metrics.scrollWidth;o=e*q<r?e:r/q;if(i.rulerChanged){for(l=i.childNodes.length;l>
1;)i.removeChild(i.lastChild),l--;j=j.getAnnotations(0,q);H=d.createDocumentFragment();for(var A in j)if(q=A>>>0,!(q<0)){y=a.createElement(d,"div");l=j[A];g(l.style,y);y.style.position="absolute";y.style.top=this._metrics.scrollWidth+e+Math.floor(q*o)+"px";if(l.html)y.innerHTML=l.html;y.annotation=l;y.lineIndex=q;H.appendChild(y)}i.appendChild(H)}else if(i._oldTrackHeight!==r)for(y=i.firstChild?i.firstChild.nextSibling:null;y;)y.style.top=this._metrics.scrollWidth+e+Math.floor(y.lineIndex*o)+"px",
y=y.nextSibling;i._oldTrackHeight=r}i.rulerChanged=!1}},_updateStyle:function(b){if(!b&&a.isIE)this._rootDiv.style.lineHeight="normal";var c=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=a.isIE?c.lineHeight-(c.lineTrim.top+c.lineTrim.bottom)+"px":"normal";b||(this.redraw(),this._resetLineWidth())}};i.EventTarget.addMixin(q.prototype);return{TextView:q}});
define("orion/editor/tooltip",["i18n!orion/editor/nls/messages","orion/editor/textView","orion/editor/textModel","orion/editor/projectionTextModel","orion/editor/util"],function(j,l,i,a,f){function g(a){this._view=a;this._create(a.getOptions("parent").ownerDocument);a.addEventListener("Destroy",this,this.destroy)}g.getTooltip=function(a){if(!a._tooltip)a._tooltip=new g(a);return a._tooltip};g.prototype={_create:function(a){if(!this._tooltipDiv){var d=this._tooltipDiv=f.createElement(a,"div");d.className=
"textviewTooltip";d.setAttribute("aria-live","assertive");d.setAttribute("aria-atomic","true");var c=this._tooltipContents=f.createElement(a,"div");d.appendChild(c);a.body.appendChild(d);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);this._tooltipDiv=null}},hide:function(){if(this._contentsView)this._contentsView.destroy(),
this._contentsView=null;if(this._tooltipContents)this._tooltipContents.innerHTML="";if(this._tooltipDiv)this._tooltipDiv.style.visibility="hidden";var a=this._getWindow();if(this._showTimeout)a.clearTimeout(this._showTimeout),this._showTimeout=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,
d){if(this.target!==a&&(this._target=a,this.hide(),a)){var c=this;if(d===0)c.show(!0);else{var b=this._getWindow();c._showTimeout=b.setTimeout(function(){c.show(!0)},d?d:500)}}},show:function(e){if(this._target){var d=this._target.getTooltipInfo();if(d){var c=this._tooltipDiv,b=this._tooltipContents;c.style.left=c.style.right=c.style.width=c.style.height=b.style.width=b.style.height="auto";var h=d.contents;h instanceof Array&&(h=this._getAnnotationContents(h));if(typeof h==="string")b.innerHTML=h;
else if(this._isNode(h))b.appendChild(h);else if(h instanceof a.ProjectionTextModel){var f=this._view,g=f.getOptions();g.wrapMode=!1;g.parent=b;var i=g.themeClass;i?((i=i.replace("tooltip",""))&&(i=" "+i),i="tooltip"+i):i="tooltip";g.themeClass=i;g=this._contentsView=new l.TextView(g);g._clientDiv.contentEditable=!1;g.addEventListener("LineStyle",function(b){f.onLineStyle(b)});g.setModel(h);h=g.computeSize();b.style.width=h.width+20+"px";b.style.height=h.height+"px";g.resize()}else return;b=c.ownerDocument.documentElement;
d.anchor==="right"?(h=b.clientWidth-d.x,c.style.right=h+"px"):(h=parseInt(this._getNodeStyle(c,"padding-left","0"),10),h+=parseInt(this._getNodeStyle(c,"border-left-width","0"),10),h=d.x-h,c.style.left=h+"px");c.style.maxWidth=b.clientWidth-h-10+"px";h=parseInt(this._getNodeStyle(c,"padding-top","0"),10);h+=parseInt(this._getNodeStyle(c,"border-top-width","0"),10);h=d.y-h;c.style.top=h+"px";c.style.maxHeight=b.clientHeight-h-10+"px";c.style.opacity="1";c.style.visibility="visible";if(e){var j=this,
k=this._getWindow();j._hideTimeout=k.setTimeout(function(){var b=parseFloat(j._getNodeStyle(c,"opacity","1"));j._fadeTimeout=k.setInterval(function(){c.style.visibility==="visible"&&b>0?(b-=0.1,c.style.opacity=b):j.hide()},50)},5E3)}}}},_getAnnotationContents:function(e){function d(a){var c=a.title;if(c==="")return null;var h="<div>";a.html&&(h+=a.html+"&nbsp;");if(!c)c=a.end,a=b.getLineStart(b.getLineAtOffset(a.start)),c=b.getLineEnd(b.getLineAtOffset(c),!0),c=b.getText(a,c);c=c.replace(/</g,"&lt;").replace(/>/g,
"&gt;");h+="<span style='vertical-align:middle;'>"+c+"</span><div>";return h}if(e.length===0)return null;var c=this._view.getModel(),b=c.getBaseModel?c.getBaseModel():c;if(e.length===1)if(c=e[0],c.title!==void 0)return d(c);else{var e=new a.ProjectionTextModel(b),h=b.getLineStart(b.getLineAtOffset(c.start)),f=b.getCharCount();c.end!==f&&e.addProjection({start:c.end,end:f});h>0&&e.addProjection({start:0,end:h});return e}else{h="<div><em>"+j.multipleAnnotations+"</em></div>";for(f=0;f<e.length;f++)c=
e[f],(c=d(c))&&(h+=c);return h}},_getNodeStyle:function(a,d,c){var b;if(a&&(b=a.style[d],!b))if(a.currentStyle){for(b=0;(b=d.indexOf("-",b))!==-1;)d=d.substring(0,b)+d.substring(b+1,b+2).toUpperCase()+d.substring(b+2);b=a.currentStyle[d]}else b=(a=a.ownerDocument.defaultView.getComputedStyle(a,null))?a.getPropertyValue(d):null;return b||c},_isNode:function(a){return typeof Node==="object"?a instanceof Node:a&&typeof a==="object"&&typeof a.nodeType==="number"&&typeof a.nodeName==="string"}};return{Tooltip:g}});
define("orion/editor/editor","i18n!orion/editor/nls/messages,orion/editor/keyBinding,orion/editor/eventTarget,orion/editor/tooltip,orion/editor/annotations,orion/editor/util".split(","),function(j,l,i,a,f,g){function e(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._statusReporter=b.statusReporter;this._domNode=b.domNode;this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=this._annotationStyler=null;this._dirty=!1;this._title=this._contentAssist=null;this._keyModes=[]}function d(b){var a=this,c=Array.prototype.slice.call(arguments,1);return c.length?function(){return arguments.length?a.apply(b,c.concat(Array.prototype.slice.call(arguments))):
a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}var c;e.prototype={destroy:function(){this.uninstallTextView();this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=this._statusReporter=this._domNode=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},
getAnnotationStyler:function(){return this._annotationStyler},getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getTitle:function(){return this._title},getKeyModes:function(){return this._keyModes},isDirty:function(){return this._dirty},
setAnnotationRulerVisible:function(b){if(this._annotationRulerVisible!==b&&(this._annotationRulerVisible=b,this._annotationRuler)){var a=this._textView;b?a.addRuler(this._annotationRuler,0):a.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b){if(this._foldingRulerVisible!==b&&(this._foldingRulerVisible=b,this._foldingRuler)){var a=this._textView;a.getModel().getBaseModel&&(b?a.addRuler(this._foldingRuler,100):a.removeRuler(this._foldingRuler))}},setDirty:function(b){if(this._dirty!==
b)this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"})},setLineNumberRulerVisible:function(b){if(this._lineNumberRulerVisible!==b&&(this._lineNumberRulerVisible=b,this._lineNumberRuler)){var a=this._textView;b?a.addRuler(this._lineNumberRuler,1):a.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b){if(this._overviewRulerVisible!==b&&(this._overviewRulerVisible=b,this._overviewRuler)){var a=this._textView;b?a.addRuler(this._overviewRuler):a.removeRuler(this._overviewRuler)}},
mapOffset:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(b=c.mapOffset(b,a));return b},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var b=this._textView,a=b.getSelection(),b=b.getModel();if(b.getBaseModel)a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end);return a},getText:function(b,a){var c=this._textView.getModel();c.getBaseModel&&(c=c.getBaseModel());return c.getText(b,a)},_expandOffset:function(b){var a=this._textView.getModel(),
c=this._annotationModel;if(c&&a.getBaseModel)for(b=c.getAnnotations(b,b+1);b.hasNext();)a=b.next(),a.type===f.AnnotationType.ANNOTATION_FOLDING&&a.expand&&(a.expand(),c.modifyAnnotation(a))},setCaretOffset:function(b){var a=this._textView,c=a.getModel();c.getBaseModel&&(this._expandOffset(b),b=c.mapOffset(b,!0));a.setCaretOffset(b)},setText:function(b,a,c){var d=this._textView,e=d.getModel();e.getBaseModel&&(a!==void 0&&(this._expandOffset(a),a=e.mapOffset(a,!0)),c!==void 0&&(this._expandOffset(c),
c=e.mapOffset(c,!0)));d.setText(b,a,c)},setFoldingEnabled:function(b){this.setFoldingRulerVisible(b)},setSelection:function(b,a,c){var d=this._textView,e=d.getModel();e.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=e.mapOffset(b,!0),a=e.mapOffset(a,!0));d.setSelection(b,a,c)},moveSelection:function(b,a,d,e){var f=this._textView;this.setSelection(b,a||b,!1);var a=f.getTopPixel(),g=f.getBottomPixel(),b=this.getModel().getLineAtOffset(b),b=f.getLinePixel(b);b<a||b>g?(g=Math.max(0,b-Math.floor((b<
a?3:1)*(g-a)/4)),(new c({node:f,duration:300,curve:[a,g],onAnimate:function(b){f.setTopPixel(Math.floor(b))},onEnd:function(){f.showSelection();(e===void 0||e)&&f.focus();d&&d()}})).play()):(f.showSelection(),(e===void 0||e)&&f.focus(),d&&d())},checkDirty:function(){this.setDirty(!this._undoStack.isClean())},reportStatus:function(b,a,c){this._statusReporter&&this._statusReporter(b,a,c)},_getTooltipInfo:function(b,a){var c=this._textView,d=this.getAnnotationModel();if(!d)return null;var e=this._annotationStyler;
if(!e)return null;var f=c.getOffsetAtLocation(b,a);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;c=c.convert({x:b,y:a},"document","page");return{contents:d,anchor:"left",x:c.x+10,y:c.y+20}},_highlightCurrentLine:function(b,a){var c=this._annotationModel;if(c){var d=this._textView.getModel(),e=a?d.getLineAtOffset(a.start):-1,g=d.getLineAtOffset(b.start),i=b.start===b.end,j=!a||a.start===
a.end,n=d.getLineStart(g),u=d.getLineEnd(g);d.getBaseModel&&(n=d.mapOffset(n),u=d.mapOffset(u));d=this._currentLineAnnotation;if(!(e===g&&j&&i&&d&&d.start===n&&d.end===u)){var e=d?[d]:null,s;i&&(d=f.AnnotationType.createAnnotation(f.AnnotationType.ANNOTATION_CURRENT_LINE,n,u),s=[d]);this._currentLineAnnotation=d;c.replaceAnnotations(e,s)}}},installTextView:function(){this._textView=this._textViewFactory();if(this._undoStackFactory)this._undoStack=this._undoStackFactory.createUndoStack(this);if(this._textDNDFactory)this._textDND=
this._textDNDFactory.createTextDND(this,this._undoStack);if(this._contentAssistFactory){var b=this._contentAssistFactory.createContentAssistMode(this);this._keyModes.push(b);this._contentAssist=b.getContentAssist()}var c=this,d=this._textView,e=this;this._listener={onModelChanged:function(){e.checkDirty()},onMouseOver:function(b){e._listener.onMouseMove(b)},onMouseMove:function(b){var c=a.Tooltip.getTooltip(d);c&&c.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return e._getTooltipInfo(this.x,this.y)}})},
onMouseOut:function(){var b=a.Tooltip.getTooltip(d);b&&b.setTarget(null)},onSelection:function(b){e._updateCursorStatus();e._highlightCurrentLine(b.newValue,b.oldValue)}};d.addEventListener("ModelChanged",this._listener.onModelChanged);d.addEventListener("Selection",this._listener.onSelection);d.addEventListener("MouseOver",this._listener.onMouseOver);d.addEventListener("MouseOut",this._listener.onMouseOut);d.addEventListener("MouseMove",this._listener.onMouseMove);this._keyBindingFactory&&this._keyBindingFactory(this,
this._keyModes,this._undoStack,this._contentAssist);d.setKeyBinding(new l.KeyBinding(27),"cancelMode");d.setAction("cancelMode",function(){for(var b=!1,a=0;a<this._keyModes.length;a++)this._keyModes[a].isActive()&&(b=this._keyModes[a].cancel()||b);return b}.bind(this),{name:j.cancelMode});d.setAction("lineUp",function(){for(var b=0;b<this._keyModes.length;b++)if(this._keyModes[b].isActive())return this._keyModes[b].lineUp();return!1}.bind(this));d.setAction("lineDown",function(){for(var b=0;b<this._keyModes.length;b++)if(this._keyModes[b].isActive())return this._keyModes[b].lineDown();
return!1}.bind(this));d.setAction("enter",function(){for(var b=0;b<this._keyModes.length;b++)if(this._keyModes[b].isActive())return this._keyModes[b].enter();return!1}.bind(this));b=function(b){if(b!==void 0&&b!==-1){for(var a=this.getView().getModel(),d=this.getAnnotationModel(),e=c.mapOffset(a.getLineStart(b)),b=c.mapOffset(a.getLineEnd(b)),a=d.getAnnotations(e,b),g=null;a.hasNext();){var m=a.next();if(m.type===f.AnnotationType.ANNOTATION_BOOKMARK){g=m;break}}g?d.removeAnnotation(g):(g=f.AnnotationType.createAnnotation(f.AnnotationType.ANNOTATION_BOOKMARK,
e,b),g.title=void 0,d.addAnnotation(g))}};if(this._annotationFactory){var g=d.getModel();g.getBaseModel&&(g=g.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(g))if(g=this._annotationStyler=this._annotationFactory.createAnnotationStyler(d,this._annotationModel))g.addAnnotationType(f.AnnotationType.ANNOTATION_CURRENT_SEARCH),g.addAnnotationType(f.AnnotationType.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(f.AnnotationType.ANNOTATION_ERROR),g.addAnnotationType(f.AnnotationType.ANNOTATION_WARNING),
g.addAnnotationType(f.AnnotationType.ANNOTATION_MATCHING_BRACKET),g.addAnnotationType(f.AnnotationType.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(f.AnnotationType.ANNOTATION_CURRENT_LINE),g.addAnnotationType(f.AnnotationType.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(f.AnnotationType.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType("orion.annotation.highlightError");d.annotationModel=this._annotationModel;var g=this._annotationFactory.createAnnotationRulers(this._annotationModel),i=this._annotationRuler=
g.annotationRuler;if(i)i.onClick=function(b){if(b!==void 0&&b!==-1)for(var a=this.getView().getModel(),d=this.getAnnotationModel(),e=c.mapOffset(a.getLineStart(b)),b=c.mapOffset(a.getLineEnd(b)),b=d.getAnnotations(e,b);b.hasNext();)if(d=b.next(),this.isAnnotationTypeVisible(d.type)){b=c.getModel();c.onGotoLine(b.getLineAtOffset(e),d.start-e,d.end-e);break}},i.onDblClick=b,i.setMultiAnnotationOverlay({html:"<div class='annotationHTML overlay'></div>"}),i.addAnnotationType(f.AnnotationType.ANNOTATION_ERROR),
i.addAnnotationType(f.AnnotationType.ANNOTATION_WARNING),i.addAnnotationType(f.AnnotationType.ANNOTATION_TASK),i.addAnnotationType(f.AnnotationType.ANNOTATION_BOOKMARK);this.setAnnotationRulerVisible(!0);if(i=this._overviewRuler=g.overviewRuler)i.onClick=function(b){b!==void 0&&(b=d.getModel().getLineStart(b),c.moveSelection(c.mapOffset(b)))},i.addAnnotationType(f.AnnotationType.ANNOTATION_CURRENT_SEARCH),i.addAnnotationType(f.AnnotationType.ANNOTATION_MATCHING_SEARCH),i.addAnnotationType(f.AnnotationType.ANNOTATION_ERROR),
i.addAnnotationType(f.AnnotationType.ANNOTATION_WARNING),i.addAnnotationType(f.AnnotationType.ANNOTATION_TASK),i.addAnnotationType(f.AnnotationType.ANNOTATION_BOOKMARK),i.addAnnotationType(f.AnnotationType.ANNOTATION_MATCHING_BRACKET),i.addAnnotationType(f.AnnotationType.ANNOTATION_CURRENT_BRACKET),i.addAnnotationType(f.AnnotationType.ANNOTATION_CURRENT_LINE),i.addAnnotationType(f.AnnotationType.ANNOTATION_READ_OCCURRENCE),i.addAnnotationType(f.AnnotationType.ANNOTATION_WRITE_OCCURRENCE);this.setOverviewRulerVisible(!0)}if(this._lineNumberRulerFactory)this._lineNumberRuler=
this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.onDblClick=b,this.setLineNumberRulerVisible(!0);if(this._foldingRulerFactory)this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(f.AnnotationType.ANNOTATION_FOLDING),this.setFoldingRulerVisible(!1);this.dispatchEvent({type:"TextViewInstalled",textView:d})},uninstallTextView: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._keyModes=[],this.dispatchEvent({type:"TextViewUninstalled",textView:b})},_updateCursorStatus:function(){var b=this.getModel(),a=this.getCaretOffset(),c=b.getLineAtOffset(a),b=b.getLineStart(c);a-=b;for(b=0;b<this._keyModes.length;b++){var d=this._keyModes[b];
if(d.isActive()&&d.isStatusActive&&d.isStatusActive())return}this.reportStatus(g.formatMessage(j.lineColumn,c+1,a+1))},showProblems:function(b){var a=this._annotationModel;if(a){for(var c=[],d=[],e=a.getTextModel(),g=a.getAnnotations(0,e.getCharCount()),i;g.hasNext();)i=g.next(),(i.type===f.AnnotationType.ANNOTATION_ERROR||i.type===f.AnnotationType.ANNOTATION_WARNING)&&c.push(i);if(b)for(g=0;g<b.length;g++)if(i=b[g]){var j=i.description.replace(/'/g,"&#39;").replace(/"/g,"&#34;"),n=e.getLineStart(i.line-
1);i=f.AnnotationType.createAnnotation(i.severity==="error"?f.AnnotationType.ANNOTATION_ERROR:f.AnnotationType.ANNOTATION_WARNING,n+i.start-1,n+i.end,j);d.push(i)}a.replaceAnnotations(c,d)}},showOccurrences:function(b){var a=this._annotationModel;if(a){for(var c=[],d=[],e=a.getTextModel(),g=a.getAnnotations(0,e.getCharCount()),i;g.hasNext();)i=g.next(),(i.type===f.AnnotationType.ANNOTATION_READ_OCCURRENCE||i.type===f.AnnotationType.ANNOTATION_WRITE_OCCURRENCE)&&c.push(i);if(b)for(g=0;g<b.length;g++)if(i=
b[g]){var j=e.getLineStart(i.line-1);i=f.AnnotationType.createAnnotation(i.readAccess===!0?f.AnnotationType.ANNOTATION_READ_OCCURRENCE:f.AnnotationType.ANNOTATION_WRITE_OCCURRENCE,j+i.start-1,j+i.end,i.description);d.push(i)}a.replaceAnnotations(c,d)}},showSelection:function(b,a,c,d,e){typeof b==="number"?(typeof a!=="number"&&(a=b),this.moveSelection(b,a)):typeof c==="number"&&(b=this.getModel().getLineStart(c-1),typeof d==="number"&&(b+=d),typeof e!=="number"&&(e=0),this.moveSelection(b,b+e))},
setInput:function(b,a,c,d){this._title=b;this._textView&&(d?(this._undoStack.markClean(),this.checkDirty()):(a?this._textView.setText(a):c!==null&&c!==void 0&&(this._textView.setText(c),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection())),this._undoStack.reset(),this.checkDirty(),this._textView.focus()));this.onInputChanged({type:"InputChanged",title:b,message:a,contents:c,contentsSaved:d})},onInputChanged:function(b){return this.dispatchEvent(b)},
onGotoLine:function(b,a,c){if(this._textView){var d=this.getModel(),e=d.getLineStart(b),f=0;c===void 0&&(c=0);typeof a==="string"?(b=d.getLine(b).indexOf(a),b!==-1&&(f=b,c=f+a.length)):(f=a,a=d.getLineEnd(b)-e,f=Math.min(f,a),c=Math.min(c,a));this.moveSelection(e+f,e+c)}},onDirtyChanged:function(b){return this.dispatchEvent(b)}};i.EventTarget.addMixin(e.prototype);c=function(){function b(b){this.options=b}b.prototype.play=function(){var b=typeof this.options.duration==="number"?this.options.duration:
350,a=this.options.easing||this.defaultEasing,c=this.options.onAnimate||function(){},d=this.options.onEnd||function(){},e=this.options.curve[0],f=this.options.curve[1]-e,g,i,j=-1;i=setInterval(function(){j=j===-1?(new Date).getTime():j;var s=((new Date).getTime()-j)/b;s<1?(s=a(s),g=e+s*f,c(g)):(clearInterval(i),d())},typeof this.options.rate==="number"?this.options.rate:20)};b.prototype.defaultEasing=function(b){return Math.sin(b*(Math.PI/2))};return b}();if(!Function.prototype.bind)Function.prototype.bind=
d;return{Editor:e,util:{bind:d}}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/editor/util"],function(j,l,i,a){function f(b,a,c,d){this._location=a||"left";this._overview=c||"page";this._rulerStyle=d;this._view=null;var e=this;this._listener={onTextModelChanged:function(b){e._onTextModelChanged(b)},onAnnotationModelChanged:function(b){e._onAnnotationModelChanged(b)}};this.setAnnotationModel(b)}function g(b,a,c,d,e){f.call(this,b,a,"page",c);this._oddStyle=
d||{style:{backgroundColor:"white"}};this._evenStyle=e||{style:{backgroundColor:"white"}};this._numOfDigits=0}function e(b,a,c){f.call(this,b,a,"page",c)}function d(b,a,c){f.call(this,b,a,"document",c)}function c(b,a,c){e.call(this,b,a,c)}f.prototype={getAnnotations:function(b,a){var c=this._annotationModel;if(!c)return[];var d=this._view.getModel(),e=d.getLineStart(b),f=d.getLineEnd(a-1),g=d;d.getBaseModel&&(g=d.getBaseModel(),e=d.mapOffset(e),f=d.mapOffset(f));for(var i=[],c=this.getAnnotationsByType(c,
e,f),e=0;e<c.length;e++)for(var f=c[e],j=g.getLineAtOffset(f.start),u=g.getLineAtOffset(Math.max(f.start,f.end-1)),s=j;s<=u;s++){var l=s;if(d!==g){l=g.getLineStart(s);l=d.mapOffset(l,!0);if(l===-1)continue;l=d.getLineAtOffset(l)}if(b<=l&&l<a){var v=this._mergeAnnotation(i[l],f,s-j,u-j+1);v&&(i[l]=v)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var x in i)i[x]._multiple&&(i[x].html+=this._multiAnnotationOverlay.html);return i},getAnnotationModel:function(){return this._annotationModel},
getLocation:function(){return this._location},getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(b){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=b)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(b){this._multiAnnotation=
b},setMultiAnnotationOverlay:function(b){this._multiAnnotationOverlay=b},setView:function(b){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=b;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(){},onDblClick:function(){},onMouseMove:function(b,a){var c=i.Tooltip.getTooltip(this._view);if(c&&!(c.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=
b;var d=this;c.setTarget({y:a.clientY,getTooltipInfo:function(){return d._getTooltipInfo(d._tooltipLineIndex,this.y)}})}},onMouseOver:function(b,a){this.onMouseMove(b,a)},onMouseOut:function(){var b=i.Tooltip.getTooltip(this._view);b&&b.setTarget(null)},_getTooltipInfo:function(b,a){if(b!==void 0){var c=this._view,d=c.getModel(),e=this._annotationModel,f=[];if(e){var f=d.getLineStart(b),g=d.getLineEnd(b);d.getBaseModel&&(f=d.mapOffset(f),g=d.mapOffset(g));f=this.getAnnotationsByType(e,f,g)}e=this._getTooltipContents(b,
f);if(!e)return null;e={contents:e,anchor:this.getLocation()};f=c.getClientArea();f.y=this.getOverview()==="document"?c.convert({y:a},"view","document").y:c.getLocationAtOffset(d.getLineStart(b)).y;c.convert(f,"document","page");e.x=f.x;e.y=f.y;e.anchor==="right"&&(e.x+=f.width);return e}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(b){for(var h=0;h<b.length;h++)if(e.isAnnotationTypeVisible(b[h].type)){var f=b[h].start,g=b[h].end;d.getBaseModel&&(f=
d.mapOffset(f,!0),g=d.mapOffset(g,!0));f!==-1&&g!==-1&&c.redrawLines(d.getLineAtOffset(f),d.getLineAtOffset(Math.max(f,g-1))+1,e)}}var c=this._view;if(c){var d=c.getModel(),e=this,f=d.getLineCount();b.textModelChangedEvent?(b=b.textModelChangedEvent.start,d.getBaseModel&&(b=d.mapOffset(b,!0)),b=d.getLineAtOffset(b),c.redrawLines(b,f,e)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,c){b||(b={});if(c===0)if(b.html&&a.html){if(a.html!==b.html&&!b._multiple&&this._multiAnnotation)b.html=
this._multiAnnotation.html;b._multiple=!0}else b.html=a.html;b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var c;if(a.style){if(!b.style)b.style={};for(c in a.style)b.style[c]||(b.style[c]=a.style[c])}if(a.attributes){if(!b.attributes)b.attributes={};for(c in a.attributes)b.attributes[c]||(b.attributes[c]=a.attributes[c])}}return b}};l.AnnotationTypeList.addMixin(f.prototype);
g.prototype=new f;g.prototype.getAnnotations=function(b,a){for(var c=f.prototype.getAnnotations.call(this,b,a),d=this._view.getModel(),e=b;e<a;e++){var g=e&1?this._oddStyle:this._evenStyle,i=e;d.getBaseModel&&(i=d.getLineStart(i),i=d.getBaseModel().getLineAtOffset(d.mapOffset(i)));c[e]||(c[e]={});c[e].html=i+1+"";if(!c[e].style)c[e].style=g}return c};g.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();return this.getAnnotations(b-1,b)[b-1]};g.prototype._onTextModelChanged=
function(b){var b=b.start,a=this._view.getModel(),c=((a.getBaseModel?a.getBaseModel().getLineCount():a.getLineCount())+"").length;if(this._numOfDigits!==c)this._numOfDigits=c,this._view.redrawLines(a.getLineAtOffset(b),a.getLineCount(),this)};e.prototype=new f;d.prototype=new f;d.prototype.getRulerStyle=function(){var b={style:{lineHeight:"1px",fontSize:"1px"}};return b=this._mergeStyle(b,this._rulerStyle)};d.prototype.onClick=function(b){b!==void 0&&this._view.setTopIndex(b)};d.prototype._getTooltipContents=
function(b,c){if(c.length===0){var d=this._view.getModel(),e=b;d.getBaseModel&&(e=d.getLineStart(e),e=d.getBaseModel().getLineAtOffset(d.mapOffset(e)));return a.formatMessage(j.line,e+1)}return f.prototype._getTooltipContents.call(this,b,c)};d.prototype._mergeAnnotation=function(b,a,c,d){if(c===0){if(!b)b={html:"&nbsp;",style:{style:{height:3*d+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle);return b}};c.prototype=new e;c.prototype.onClick=function(b){if(b!==void 0){var a=this._annotationModel;
if(a){var c=this._view.getModel(),d=c.getLineStart(b),b=c.getLineEnd(b,!0);c.getBaseModel&&(d=c.mapOffset(d),b=c.mapOffset(b),c=c.getBaseModel());for(var e,a=a.getAnnotations(d,b);!e&&a.hasNext();)b=a.next(),this.isAnnotationTypeVisible(b.type)&&(e=b);e&&c.getLineAtOffset(e.start)===c.getLineAtOffset(d)&&((c=i.Tooltip.getTooltip(this._view))&&c.setTarget(null),e.expanded?e.collapse():e.expand(),this._annotationModel.modifyAnnotation(e))}}};c.prototype._getTooltipContents=function(b,a){return a.length===
1&&a[0].expanded?null:e.prototype._getTooltipContents.call(this,b,a)};c.prototype._onAnnotationModelChanged=function(b){function a(b){for(g=0;g<b.length;g++)if(f.isAnnotationTypeVisible(b[g].type)){var c=b[g].start;d.getBaseModel&&(c=d.mapOffset(c,!0));c!==-1&&(j=Math.min(j,d.getLineAtOffset(c)))}}if(b.textModelChangedEvent)e.prototype._onAnnotationModelChanged.call(this,b);else{var c=this._view;if(c){var d=c.getModel(),f=this,g,i=d.getLineCount(),j=i;a(b.added);a(b.removed);a(b.changed);b=c.getRulers();
for(g=0;g<b.length;g++)c.redrawLines(j,i,b[g])}}};return{Ruler:f,AnnotationRuler:e,LineNumberRuler:g,OverviewRuler:d,FoldingRuler:c}});
define("orion/editor/editorFeatures","i18n!orion/editor/nls/messages,orion/editor/undoStack,orion/editor/keyBinding,orion/editor/rulers,orion/editor/annotations,orion/editor/tooltip,orion/editor/textDND,orion/editor/regex,orion/editor/util".split(","),function(j,l,i,a,f,g,e,d,c){function b(){}function h(){}function m(){}function o(){}function r(){}function q(b,a,c){this.editor=b;this.textView=b.getTextView();this.undoStack=a;this._incrementalFindActive=!1;this._incrementalFindSuccess=!0;this._incrementalFindIgnoreSelection=
!1;this._incrementalFindPrefix="";this._searcher=c;this._lastEditLocation=null;this.init()}function k(b,a,c,d){this.editor=b;this.textView=b.getTextView();this.undoStack=a;this.contentAssist=c;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",this.contentAssistProposalApplied.bind(this));this.init()}function p(b){this.editor=b;this.textView=b.getTextView();this.linkedModeActive=!1;this.linkedModePositions=[];this.linkedModeEscapePosition=this.linkedModeCurrentPositionIndex=
0;this.linkedModeListener={onVerify:function(b){for(var a=!1,c=0,d=0;d<this.linkedModePositions.length;++d){var h=this.linkedModePositions[d];if(a)h.offset+=c;else if(b.start>=h.offset&&b.end<=h.offset+h.length)a=h.length,h.length=b.start-h.offset+b.text.length+(h.offset+h.length-b.end),c=h.length-a,a=!0}a?this.linkedModeEscapePosition+=c:this.cancel()}.bind(this)}}b.prototype={createUndoStack:function(b){var b=b.getTextView(),a=new l.UndoStack(b,200);b.setAction("undo",function(){a.undo();return!0},
{name:j.undo});b.setAction("redo",function(){a.redo();return!0},{name:j.redo});return a}};h.prototype={createLineNumberRuler:function(b){return new a.LineNumberRuler(b,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};m.prototype={createFoldingRuler:function(b){return new a.FoldingRuler(b,"left",{styleClass:"ruler folding"})}};o.prototype={createAnnotationModel:function(b){return new f.AnnotationModel(b)},createAnnotationStyler:function(b,a){return new f.AnnotationStyler(b,
a)},createAnnotationRulers:function(b){var c=new a.AnnotationRuler(b,"left",{styleClass:"ruler annotations"}),b=new a.OverviewRuler(b,"right",{styleClass:"ruler overview"});return{annotationRuler:c,overviewRuler:b}}};r.prototype={createTextDND:function(b,a){return new e.TextDND(b.getTextView(),a)}};q.prototype={init:function(){var b=this;this._incrementalFindListener={onVerify:function(a){var h=b.editor,e=h.getModel(),f=h.mapOffset(a.start),g=h.mapOffset(a.end),f=e.getText(f,g),e=b._incrementalFindPrefix;
if((e=e.match(RegExp("^"+d.escape(f),"i")))&&e.length>0)e=b._incrementalFindPrefix+=a.text,b.editor.reportStatus(c.formatMessage(j.incrementalFind,e)),f=h.getSelection().start,(f=h.getModel().find({string:e,start:f,caseInsensitive:e.toLowerCase()===e}).next())?(b._incrementalFindSuccess=!0,b._incrementalFindIgnoreSelection=!0,h.moveSelection(f.start,f.end),b._incrementalFindIgnoreSelection=!1):(h.reportStatus(c.formatMessage(j.incrementalFindNotFound,e),"error"),b._incrementalFindSuccess=!1),a.text=
null},onSelection:function(){b._incrementalFindIgnoreSelection||b.toggleIncrementalFind()}};this._lastEditListener={onModelChanged:function(a){if(b.editor.isDirty())b._lastEditLocation=a.start+a.addedCharCount}};this.textView.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);this.textView.setKeyBinding(new i.KeyBinding("k",!0),"findNext");this.textView.setAction("findNext",function(){if(this._searcher){var b=this.textView.getSelection();b.start<b.end?this._searcher.findNext(!0,
this.textView.getText(b.start,b.end)):this._searcher.findNext(!0);return!0}return!1}.bind(this),{name:j.findNext});this.textView.setKeyBinding(new i.KeyBinding("k",!0,!0),"findPrevious");this.textView.setAction("findPrevious",function(){if(this._searcher){var b=this.textView.getSelection();b.start<b.end?this._searcher.findNext(!1,this.textView.getText(b.start,b.end)):this._searcher.findNext(!1);return!0}return!1}.bind(this),{name:j.findPrevious});this.textView.setKeyBinding(new i.KeyBinding("j",!0),
"incrementalFind");this.textView.setAction("incrementalFind",function(){if(this._searcher&&this._searcher.visible())return!0;var b=this.editor;if(this._incrementalFindActive){var a=this._incrementalFindPrefix;if(a.length!==0){var d;d=0;this._incrementalFindSuccess&&(d=b.getSelection().start+1);(d=b.getModel().find({string:a,start:d,caseInsensitive:a.toLowerCase()===a}).next())?(this._incrementalFindIgnoreSelection=this._incrementalFindSuccess=!0,b.moveSelection(d.start,d.end),this._incrementalFindIgnoreSelection=
!1,b.reportStatus(c.formatMessage(j.incrementalFind,a))):(b.reportStatus(c.formatMessage(j.incrementalFindNotFound,a),"error"),this._incrementalFindSuccess=!1)}}else b.setCaretOffset(b.getCaretOffset()),this.toggleIncrementalFind();return!0}.bind(this),{name:j.incrementalFindKey});this.textView.setAction("deletePrevious",function(){if(this._incrementalFindActive){var b=this.editor,a=this._incrementalFindPrefix,a=this._incrementalFindPrefix=a.substring(0,a.length-1);if(a.length===0)return this._incrementalFindIgnoreSelection=
this._incrementalFindSuccess=!0,b.setCaretOffset(b.getSelection().start),this._incrementalFindIgnoreSelection=!1,this.toggleIncrementalFind(),!0;b.reportStatus(c.formatMessage(j.incrementalFind,a));var d=b.getModel().find({string:a,start:b.getCaretOffset()-a.length-1,reverse:!0,caseInsensitive:a.toLowerCase()===a}).next();d?(this._incrementalFindIgnoreSelection=this._incrementalFindSuccess=!0,b.moveSelection(d.start,d.end),this._incrementalFindIgnoreSelection=!1):b.reportStatus(c.formatMessage(j.incrementalFindNotFound,
a),"error");return!0}return!1}.bind(this));this.textView.setAction("tab",function(){if(this.textView.getOptions("readonly"))return!1;if(this.textView.getOptions("tabMode")){var b=this.editor,a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),h=a.getLineAtOffset(c.end>c.start?c.end-1:c.end);if(d!==h){var e=[];e.push("");for(var f=d;f<=h;f++)e.push(a.getLine(f,!0));var f=a.getLineStart(d),a=a.getLineEnd(h,!0),g=this.textView.getOptions("tabSize","expandTab"),g=g.expandTab?Array(g.tabSize+
1).join(" "):"\t";b.setText(e.join(g),f,a);b.setSelection(f===c.start?c.start:c.start+g.length,c.end+(h-d+1)*g.length);return!0}b=b.getKeyModes();for(c=0;c<b.length;c++)if(b[c].isActive())return b[c].tab();return!1}}.bind(this));this.textView.setAction("shiftTab",function(){if(this.textView.getOptions("readonly"))return!1;if(this.textView.getOptions("tabMode")){for(var b=this.editor,a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),h=a.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=this.textView.getOptions("tabSize"),
f=Array(e+1).join(" "),g=[],i=0,m=0,j=d;j<=h;j++){var k=a.getLine(j,!0);if(a.getLineStart(j)!==a.getLineEnd(j))if(k.indexOf("\t")===0)k=k.substring(1),i++;else if(k.indexOf(f)===0)k=k.substring(e),i+=e;else return!0;j===d&&(m=i);g.push(k)}d=a.getLineStart(d);e=a.getLineEnd(h,!0);a=a.getLineStart(h);b.setText(g.join(""),d,e);g=d===c.start?c.start:c.start-m;c=Math.max(g,c.end-i+(c.end===a+1&&c.start!==c.end?1:0));b.setSelection(g,c);return!0}}.bind(this),{name:j.unindentLines});this.textView.setKeyBinding(new i.KeyBinding(38,
!1,!1,!0),"moveLinesUp");this.textView.setAction("moveLinesUp",function(){if(this.textView.getOptions("readonly"))return!1;var b=this.editor,a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start);if(d===0)return!0;var h=a.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=a.getLineCount(),c=a.getLineStart(d-1),f=a.getLineStart(d),g=a.getLineEnd(h,!0),i=a.getText(f,g),m=0;h===e-1&&(h=a.getLineEnd(d-1),d=a.getLineEnd(d-1,!0),i+=a.getText(h,d),f=h,m=d-h);this.startUndo();b.setText("",f,g);b.setText(i,
c,c);b.setSelection(c,c+i.length-m);this.endUndo();return!0}.bind(this),{name:j.moveLinesUp});this.textView.setKeyBinding(new i.KeyBinding(40,!1,!1,!0),"moveLinesDown");this.textView.setAction("moveLinesDown",function(){if(this.textView.getOptions("readonly"))return!1;var b=this.editor,a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),h=a.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=a.getLineCount();if(h===e-1)return!0;var d=a.getLineStart(d),c=a.getLineEnd(h,!0),f=a.getLineEnd(h+1,
!0)-(c-d),g=0;h!==e-2?a=a.getText(d,c):(h=a.getLineEnd(h),a=a.getText(h,c)+a.getText(d,h),g+=c-h);this.startUndo();b.setText("",d,c);b.setText(a,f,f);b.setSelection(f+g,f+g+a.length);this.endUndo();return!0}.bind(this),{name:j.moveLinesDown});this.textView.setKeyBinding(new i.KeyBinding(38,!0,!1,!0),"copyLinesUp");this.textView.setAction("copyLinesUp",function(){if(this.textView.getOptions("readonly"))return!1;var b=this.editor,a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),c=a.getLineAtOffset(c.end>
c.start?c.end-1:c.end),d=a.getLineStart(d),h=a.getLineEnd(c,!0),e=a.getLineCount(),f="",h=a.getText(d,h);c===e-1&&(h+=f=a.getLineDelimiter());b.setText(h,d,d);b.setSelection(d,d+h.length-f.length);return!0}.bind(this),{name:j.copyLinesUp});this.textView.setKeyBinding(new i.KeyBinding(40,!0,!1,!0),"copyLinesDown");this.textView.setAction("copyLinesDown",function(){if(this.textView.getOptions("readonly"))return!1;var b=this.editor,a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),c=a.getLineAtOffset(c.end>
c.start?c.end-1:c.end),h=a.getLineStart(d),d=a.getLineEnd(c,!0),e=a.getLineCount(),f="",h=a.getText(h,d);c===e-1&&(h=(f=a.getLineDelimiter())+h);b.setText(h,d,d);b.setSelection(d+f.length,d+h.length);return!0}.bind(this),{name:j.copyLinesDown});this.textView.setKeyBinding(new i.KeyBinding("d",!0,!1,!1),"deleteLines");this.textView.setAction("deleteLines",function(){if(this.textView.getOptions("readonly"))return!1;var b=this.editor,a=b.getSelection(),c=b.getModel(),d=c.getLineAtOffset(a.start),a=c.getLineAtOffset(a.end>
a.start?a.end-1:a.end),d=c.getLineStart(d),c=c.getLineEnd(a,!0);b.setText("",d,c);return!0}.bind(this),{name:j.deleteLines});this.textView.setKeyBinding(new i.KeyBinding("l",!0),"gotoLine");this.textView.setAction("gotoLine",function(){var b=this.editor,a=b.getModel().getLineAtOffset(b.getCaretOffset());if(a=prompt(j.gotoLinePrompty,a+1))a=parseInt(a,10),b.onGotoLine(a-1,0);return!0}.bind(this),{name:j.gotoLine});this.textView.setKeyBinding(new i.KeyBinding(190,!0),"nextAnnotation");this.textView.setAction("nextAnnotation",
function(){var b=this.editor,a=b.getAnnotationModel();if(!a)return!0;for(var c=b.getModel(),d=b.getCaretOffset(),a=a.getAnnotations(d,c.getCharCount());a.hasNext();){var h=a.next();if(!(h.start<=d)&&!(h.type!==f.AnnotationType.ANNOTATION_ERROR&&h.type!==f.AnnotationType.ANNOTATION_WARNING&&h.type!==f.AnnotationType.ANNOTATION_TASK&&h.type!==f.AnnotationType.ANNOTATION_BOOKMARK)){var e=g.Tooltip.getTooltip(this.textView);if(!e){b.moveSelection(h.start);break}var i=c.getLineAtOffset(h.start),m=this.textView;
b.moveSelection(h.start,h.start,function(){setTimeout(function(){e.setTarget({getTooltipInfo:function(){var b=m.convert({x:m.getLocationAtOffset(h.start).x,y:m.getLocationAtOffset(c.getLineStart(i)).y},"document","page");return{contents:[h],x:b.x,y:b.y+Math.floor(m.getLineHeight(i)*1.33)}}},0)},0)});break}}return!0}.bind(this),{name:j.nextAnnotation});this.textView.setKeyBinding(new i.KeyBinding(188,!0),"previousAnnotation");this.textView.setAction("previousAnnotation",function(){var b=this.editor,
a=b.getAnnotationModel();if(!a)return!0;for(var c=b.getModel(),d=b.getCaretOffset(),a=a.getAnnotations(0,d),h=null;a.hasNext();){var e=a.next();e.start>=d||e.type!==f.AnnotationType.ANNOTATION_ERROR&&e.type!==f.AnnotationType.ANNOTATION_WARNING&&e.type!==f.AnnotationType.ANNOTATION_TASK&&e.type!==f.AnnotationType.ANNOTATION_BOOKMARK||(h=e)}if(h){var i=c.getLineAtOffset(h.start),m=g.Tooltip.getTooltip(this.textView);if(!m)return b.moveSelection(h.start),!0;var j=this.textView;b.moveSelection(h.start,
h.start,function(){setTimeout(function(){m.setTarget({getTooltipInfo:function(){var b=j.convert({x:j.getLocationAtOffset(h.start).x,y:j.getLocationAtOffset(c.getLineStart(i)).y},"document","page");return{contents:[h],x:b.x,y:b.y+Math.floor(j.getLineHeight(i)*1.33)}}},0)},0)})}return!0}.bind(this),{name:j.prevAnnotation});this.textView.setKeyBinding(new i.KeyBinding("e",!0,!1,!0,!1),"expand");this.textView.setAction("expand",function(){var b=this.editor,a=b.getAnnotationModel();if(!a)return!0;var c=
b.getModel(),b=b.getCaretOffset(),d=c.getLineAtOffset(b),b=c.getLineStart(d),d=c.getLineEnd(d,!0);c.getBaseModel&&(b=c.mapOffset(b),d=c.mapOffset(d),c.getBaseModel());for(var h,c=a.getAnnotations(b,d);!h&&c.hasNext();)b=c.next(),b.type===f.AnnotationType.ANNOTATION_FOLDING&&(b.expanded||(h=b));h&&!h.expanded&&(h.expand(),a.modifyAnnotation(h));return!0}.bind(this),{name:j.expand});this.textView.setKeyBinding(new i.KeyBinding("c",!0,!1,!0,!1),"collapse");this.textView.setAction("collapse",function(){var b=
this.editor,a=b.getAnnotationModel();if(!a)return!0;var c=b.getModel(),d=b.getCaretOffset(),h=c.getLineAtOffset(d),d=c.getLineStart(h),h=c.getLineEnd(h,!0);c.getBaseModel&&(d=c.mapOffset(d),h=c.mapOffset(h),c.getBaseModel());for(var e,c=a.getAnnotations(d,h);!e&&c.hasNext();)d=c.next(),d.type===f.AnnotationType.ANNOTATION_FOLDING&&(e=d);e&&e.expanded&&(b.setCaretOffset(e.start),e.collapse(),a.modifyAnnotation(e));return!0}.bind(this),{name:j.collapse});this.textView.setKeyBinding(new i.KeyBinding("e",
!0,!0,!0,!1),"expandAll");this.textView.setAction("expandAll",function(){var b=this.editor,a=b.getAnnotationModel();if(!a)return!0;var b=b.getModel(),c=a.getAnnotations(0,b.getCharCount());for(this.textView.setRedraw(!1);c.hasNext();)b=c.next(),b.type===f.AnnotationType.ANNOTATION_FOLDING&&!b.expanded&&(b.expand(),a.modifyAnnotation(b));this.textView.setRedraw(!0);return!0}.bind(this),{name:j.expandAll});this.textView.setKeyBinding(new i.KeyBinding("c",!0,!0,!0,!1),"collapseAll");this.textView.setAction("collapseAll",
function(){var b=this.editor,a=b.getAnnotationModel();if(!a)return!0;var b=b.getModel(),c=a.getAnnotations(0,b.getCharCount());for(this.textView.setRedraw(!1);c.hasNext();)b=c.next(),b.type===f.AnnotationType.ANNOTATION_FOLDING&&b.expanded&&(b.collapse(),a.modifyAnnotation(b));this.textView.setRedraw(!0);return!0}.bind(this),{name:j.collapseAll});this.textView.setKeyBinding(new i.KeyBinding("q",!c.isMac,!1,!1,c.isMac),"lastEdit");this.textView.setAction("lastEdit",function(){typeof this._lastEditLocation===
"number"&&this.editor.showSelection(this._lastEditLocation);return!0}.bind(this),{name:j.lastEdit})},toggleIncrementalFind:function(){(this._incrementalFindActive=!this._incrementalFindActive)?(this.editor.reportStatus(c.formatMessage(j.incrementalFind,this._incrementalFindPrefix)),this.textView.addEventListener("Verify",this._incrementalFindListener.onVerify),this.textView.addEventListener("Selection",this._incrementalFindListener.onSelection)):(this._incrementalFindPrefix="",this.editor.reportStatus(""),
this.textView.removeEventListener("Verify",this._incrementalFindListener.onVerify),this.textView.removeEventListener("Selection",this._incrementalFindListener.onSelection),this.textView.setCaretOffset(this.textView.getCaretOffset()))},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},cancel:function(){this.toggleIncrementalFind()},isActive:function(){return this._incrementalFindActive},isStatusActive:function(){return this._incrementalFindActive},
lineUp:function(){if(this._incrementalFindActive){var b=this._incrementalFindPrefix;if(b.length===0)return!1;var a=this.editor,d=a.getModel(),d=this._incrementalFindSuccess?a.getCaretOffset()-b.length-1:d.getCharCount()-1;(d=a.getModel().find({string:b,start:d,reverse:!0,caseInsensitive:b.toLowerCase()===b}).next())?(this._incrementalFindIgnoreSelection=this._incrementalFindSuccess=!0,a.moveSelection(d.start,d.end),this._incrementalFindIgnoreSelection=!1,a.reportStatus(c.formatMessage(j.incrementalFind,
b))):(a.reportStatus(c.formatMessage(j.incrementalFindNotFound,b),"error"),this._incrementalFindSuccess=!1);return!0}return!1},lineDown:function(){if(this._incrementalFindActive){var b=this._incrementalFindPrefix;if(b.length===0)return!1;var a=this.editor,d=0;this._incrementalFindSuccess&&(d=a.getSelection().start+1);(d=a.getModel().find({string:b,start:d,caseInsensitive:b.toLowerCase()===b}).next())?(this._incrementalFindIgnoreSelection=this._incrementalFindSuccess=!0,a.moveSelection(d.start,d.end),
this._incrementalFindIgnoreSelection=!1,a.reportStatus(c.formatMessage(j.incrementalFind,b))):(a.reportStatus(c.formatMessage(j.incrementalFindNotFound,b),"error"),this._incrementalFindSuccess=!1);return!0}return!1},enter:function(){return!1}};k.prototype={startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},init:function(){function b(a,c,d){var h=a.getLineAtOffset(c),e=a.getLineAtOffset(d),f,g,i,m,j,k;for(f=
h;f>=0;f--)if(g=a.getLine(f),i=f===h?c-a.getLineStart(h):g.length,m=g.lastIndexOf("/*",i),g=g.lastIndexOf("*/",i),g>m)break;else if(m!==-1){j=a.getLineStart(f)+m;break}for(f=e;f<a.getLineCount();f++)if(g=a.getLine(f),i=f===e?d-a.getLineStart(e):0,m=g.indexOf("/*",i),g=g.indexOf("*/",i),m!==-1&&m<g)break;else if(g!==-1){k=a.getLineStart(f)+g;break}return{commentStart:j,commentEnd:k}}this.textView.setAction("lineStart",function(){for(var b=this.editor,a=b.getModel(),c=b.getCaretOffset(),d=a.getLineAtOffset(c),
h=a.getLineStart(d),a=a.getLine(d),d=0;d<a.length;d++){var e=a.charCodeAt(d);if(!(e===32||e===9))break}d+=h;return c!==d?(b.setSelection(d,d),!0):!1}.bind(this));this.textView.setKeyBinding(new i.KeyBinding(191,!0),"toggleLineComment");this.textView.setAction("toggleLineComment",function(){if(this.textView.getOptions("readonly"))return!1;for(var b=this.editor,a=b.getModel(),c=b.getSelection(),d=a.getLineAtOffset(c.start),h=a.getLineAtOffset(c.end>c.start?c.end-1:c.end),e=!0,f=[],g,i,m=d;m<=h;m++)if(g=
a.getLine(m,!0),f.push(g),!e||(i=g.indexOf("//"))===-1)e=!1;else if(i!==0){var j;for(j=0;j<i;j++)if(e=g.charCodeAt(j),!(e===32||e===9))break;e=j===i}m=a.getLineStart(d);j=a.getLineEnd(h,!0);if(e){for(e=0;e<f.length;e++)g=f[e],i=g.indexOf("//"),f[e]=g.substring(0,i)+g.substring(i+2);f=f.join("");g=a.getLineStart(h);a=m===c.start?c.start:c.start-2;c=c.end-2*(h-d+1)+(c.end===g+1?2:0)}else f.splice(0,0,""),f=f.join("//"),a=m===c.start?c.start:c.start+2,c=c.end+2*(h-d+1);b.setText(f,m,j);b.setSelection(a,
c);return!0}.bind(this),{name:j.toggleLineComment});this.textView.setKeyBinding(new i.KeyBinding(191,!0,!c.isMac,!1,c.isMac),"addBlockComment");this.textView.setAction("addBlockComment",function(){if(this.textView.getOptions("readonly"))return!1;var a=this.editor,c=a.getModel(),d=a.getSelection(),h=RegExp("/\\*|\\*/","g"),e=b(c,d.start,d.end);if(e.commentStart!==void 0&&e.commentEnd!==void 0)return!0;c=c.getText(d.start,d.end);if(c.length===0)return!0;e=c.length;c=c.replace(h,"");h=c.length;a.setText("/*"+
c+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(h-e));return!0}.bind(this),{name:j.addBlockComment});this.textView.setKeyBinding(new i.KeyBinding(220,!0,!c.isMac,!1,c.isMac),"removeBlockComment");this.textView.setAction("removeBlockComment",function(){if(this.textView.getOptions("readonly"))return!1;var a=this.editor,c=a.getModel(),d=a.getSelection(),h=c.getText(d.start,d.end),e,f,g;for(g=0;g<h.length;g++)if(h.substring(g,g+2)==="/*"){e=d.start+g;break}for(;g<h.length;g++)if(h.substring(g,
g+2)==="*/"){f=d.start+g;break}if(e!==void 0&&f!==void 0)a.setText(c.getText(e+2,f),e,f+2),a.setSelection(e,f);else{h=b(c,d.start,d.end);if(h.commentStart===void 0||h.commentEnd===void 0)return!0;c=c.getText(h.commentStart+2,h.commentEnd);a.setText(c,h.commentStart,h.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0}.bind(this),{name:j.removeBlockComment})},contentAssistProposalApplied:function(b){b=b.data.proposal;if(b.positions&&this.linkedMode){for(var a=[],c=0;c<b.positions.length;++c)a[c]=
{positions:[{offset:b.positions[c].offset,length:b.positions[c].length}]};this.linkedMode.enterLinkedMode({groups:a,escapePosition:b.escapePosition})}else b.escapePosition&&this.textView.setCaretOffset(b.escapePosition);return!0},cancel:function(){return!1},isActive:function(){return!0},isStatusActive:function(){return!1},lineUp:function(){return!1},lineDown:function(){return!1},enter:function(){if(this.textView.getOptions("readonly"))return!1;var b=this.editor,a=b.getSelection();if(a.start===a.end){for(var c=
b.getModel(),d=c.getLineAtOffset(a.start),h=c.getLine(d,!0),e=c.getLineStart(d),d=0,e=a.start-e,f;d<e&&((f=h.charCodeAt(d))===32||f===9);)d++;if(d>0){for(var g=h.substring(0,d),d=e;d<h.length&&((f=h.charCodeAt(d++))===32||f===9);)a.end++;b.setText(c.getLineDelimiter()+g,a.start,a.end);return!0}}return!1},tab:function(){return!1}};p.prototype={enterLinkedMode:function(b){if(!this.linkedModeActive){this.linkedModeActive=!0;this.linkedModePositions=[];for(var a=0;a<b.groups.length;++a){var c=b.groups[a];
this.linkedModePositions[a]={offset:c.positions[0].offset,length:c.positions[0].length}}this.linkedModeEscapePosition=b.escapePosition;this.linkedModeCurrentPositionIndex=0;this.selectTextForLinkedModePosition(this.linkedModePositions[this.linkedModeCurrentPositionIndex]);this.textView.addEventListener("Verify",this.linkedModeListener.onVerify);this.textView.setKeyBinding(new i.KeyBinding(9),"nextLinkedModePosition");this.textView.setAction("nextLinkedModePosition",function(){this.linkedModeCurrentPositionIndex=
++this.linkedModeCurrentPositionIndex%this.linkedModePositions.length;this.selectTextForLinkedModePosition(this.linkedModePositions[this.linkedModeCurrentPositionIndex]);return!0}.bind(this));this.textView.setKeyBinding(new i.KeyBinding(9,!1,!0),"previousLinkedModePosition");this.textView.setAction("previousLinkedModePosition",function(){this.linkedModeCurrentPositionIndex=this.linkedModeCurrentPositionIndex>0?this.linkedModeCurrentPositionIndex-1:this.linkedModePositions.length-1;this.selectTextForLinkedModePosition(this.linkedModePositions[this.linkedModeCurrentPositionIndex]);
return!0}.bind(this));this.editor.reportStatus(j.linkedModeEntered,null,!0)}},isActive:function(){return this.linkedModeActive},isStatusActive:function(){return this.linkedModeActive},enter:function(){this.cancel();return!0},cancel:function(b){if(this.linkedModeActive)this.linkedModeActive=!1,this.textView.removeEventListener("Verify",this.linkedModeListener.onVerify),this.textView.setKeyBinding(new i.KeyBinding(9),"tab"),this.textView.setKeyBinding(new i.KeyBinding(9,!1,!0),"shiftTab"),b||this.textView.setCaretOffset(this.linkedModeEscapePosition,
!1),this.editor.reportStatus(j.linkedModeExited,null,!0)},lineUp:function(){this.cancel(!0);return!1},lineDown:function(){this.cancel(!0);return!1},selectTextForLinkedModePosition:function(b){this.textView.setSelection(b.offset,b.offset+b.length)}};return{UndoFactory:b,LineNumberRulerFactory:h,FoldingRulerFactory:m,AnnotationFactory:o,TextDNDFactory:r,TextActions:q,SourceCodeActions:k,LinkedMode:p}});
define("orion/compare/diff-provider",["i18n!orion/compare/nls/messages","orion/Deferred"],function(j,l){function i(a,g,e){var d=new l;a[g].apply(a,e).then(function(a){d.resolve(a)},function(a){d.reject(a)});return d}function a(a,g){var e=a.getServiceReferences("orion.core.diff"),d=e;if(g)for(var d=[],c=0;c<e.length;++c)g(e[c])&&d.push(e[c]);for(var b=[],h=[],c=0;c<d.length;++c)b[c]=RegExp(d[c].getProperty("pattern")||".*"),h[c]=a.getService(d[c]);this._getService=function(a){if(a.indexOf("://")===
-1){var c=document.createElement("a");c.href=a;a=c.href}for(c=0;c<b.length;++c)if(b[c].test(a))return h[c];throw j["No Matching DiffService for location:"]+a;}}a.prototype={getDiffContent:function(a){return i(this._getService(a),"getDiffContent",arguments)},getDiffFileURI:function(a){return i(this._getService(a),"getDiffFileURI",arguments)}};return{DiffProvider:a}});
var JsDiff=function(){function j(a){for(var c=[],b=0;b<a.length;b++)a[b]&&c.push(a[b]);return c}function l(a){a=a.replace(/&/g,"&amp;");a=a.replace(/</g,"&lt;");a=a.replace(/>/g,"&gt;");return a=a.replace(/"/g,"&quot;")}var i=function(a){this.ignoreWhitespace=a};i.prototype={diff:function(a,c){if(c==a)return[{value:c}];if(!c)return[{value:a,removed:!0}];if(!a)return[{value:c,added:!0}];var c=this.tokenize(c),a=this.tokenize(a),b=c.length,h=a.length,e=b+h,f=[{newPos:-1,components:[]}],g=this.extractCommon(f[0],
c,a,0);if(f[0].newPos+1>=b&&g+1>=h)return f[0].components;for(var i=1;i<=e;i++)for(var j=-1*i;j<=i;j+=2){var l;l=f[j-1];var n=f[j+1],g=(n?n.newPos:0)-j;l&&(f[j-1]=void 0);var u=l&&l.newPos+1<b,s=n&&0<=g&&g<h;if(!u&&!s)f[j]=void 0;else if(!u||s&&l.newPos<n.newPos?(l={newPos:n.newPos,components:n.components.slice(0)},this.pushComponent(l.components,a[g],void 0,!0)):(l={newPos:l.newPos,components:l.components.slice(0)},l.newPos++,this.pushComponent(l.components,c[l.newPos],!0,void 0)),g=this.extractCommon(l,
c,a,j),l.newPos+1>=b&&g+1>=h)return l.components;else f[j]=l}},pushComponent:function(a,c,b,h){var e=a[a.length-1];e&&e.added===b&&e.removed===h?a[a.length-1]={value:this.join(e.value,c),added:b,removed:h}:a.push({value:c,added:b,removed:h})},extractCommon:function(a,c,b,h){for(var e=c.length,f=b.length,g=a.newPos,h=g-h;g+1<e&&h+1<f&&this.equals(c[g+1],b[h+1]);)g++,h++,this.pushComponent(a.components,c[g],void 0,void 0);a.newPos=g;return h},equals:function(a,c){var b=/\S/;return this.ignoreWhitespace&&
!b.test(a)&&!b.test(c)?!0:a==c},join:function(a,c){return a+c},tokenize:function(a){return a}};var a=new i,f=new i(!1);f.tokenize=function(a){return j(a.split(/(\s+|\b)/))};var g=new i(!0);g.tokenize=function(a){return j(a.split(/([{}:;,]|\s+)/))};var e=new i;e.tokenize=function(a){return a.split(/^/m)};return{diffChars:function(d,c){return a.diff(d,c)},diffWords:function(a,c){return f.diff(a,c)},diffLines:function(a,c){return e.diff(a,c)},diffCss:function(a,c){return g.diff(a,c)},createPatch:function(a,
c,b,h,f){var g=[];g.push("Index: "+a);g.push("===================================================================");g.push("--- "+a+"\t"+h);g.push("+++ "+a+"\t"+f);a=e.diff(c,b);a.push({value:"",lines:[]});for(var b=c=0,h=[],i=f=1,j=0;j<a.length;j++){var k=a[j],l=k.lines||k.value.replace(/\n$/,"").split("\n");k.lines=l;if(k.added||k.removed){if(!c){var n=a[j-1],c=f,b=i;n&&(h.push.apply(h,n.lines.slice(-4).map(function(b){return" "+b})),c-=4,b-=4)}h.push.apply(h,l.map(function(b){return(k.added?"+":
"-")+b}));k.added?i+=l.length:f+=l.length}else c&&(l.length<=8&&j<a.length-1?h.push.apply(h,l.map(function(b){return" "+b})):(n=Math.min(l.length,4),g.push("@@ -"+c+","+(f-c+n)+" +"+b+","+(i-b+n)+" @@"),g.push.apply(g,h),g.push.apply(g,l.slice(0,n).map(function(b){return" "+b})),b=c=0,h=[])),f+=l.length,i+=l.length}a.length>1&&!/\n$/.test(a[a.length-2].value)&&g.push("\\ No newline at end of file\n");return g.join("\n")},convertChangesToXML:function(a){for(var c=[],b=0;b<a.length;b++){var h=a[b];
h.added?c.push("<ins>"):h.removed&&c.push("<del>");c.push(l(h.value));h.added?c.push("</ins>"):h.removed&&c.push("</del>")}return c.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 l=l||{};l.JSDiffAdapter=function(){function i(){}i.prototype={adapt:function(a,f,g){g||(g="\n");for(var e=a.split(g),d=f.split(g),c=e[e.length-1]==="",d=d[d.length-1]==="",b=j.diffLines(a,f),a=[],f=[],h=0,i=0,o=-1,l=0,q=!0,k=0;k<b.length;k++){var p=b[k],n=p.lines||p.value.split(g),u=n.length,s=0;n.length>1&&n[n.length-1]===""&&u--;u>1&&!q&&n[0]===""&&(u--,s++);p.lines=n;if(!p.added&&!p.removed){if(h||i)a.push([h,i,o]),i=h=0,o=-1,
l+=i;a.push([u,u,0]);l+=u}else if(p.added){o===-1&&(o=f.length+1);h+=u;for(q=s;q<u+s;q++)f.push(p.lines[q])}else i+=u;q=!1;n.length>1&&n[n.length-1]===""&&(q=!0)}if(h||i)a.push([h,i,o]),l+=i;l<e.length&&e.length>1&&(g=a[a.length-1],g[2]===0?(g[0]+=1,g[1]+=1):g[2]===-1?a.push([1,1,0]):c===d?a.push([1,1,0]):(d&&(g[0]+=1),c&&(g[1]+=1)));return{mapper:a,changContents:{array:f,index:0}}},adaptCharDiff:function(a,f,g){for(var a=g?j.diffWords(a,f):j.diffChars(a,f),f=[],e=g=0,d=0,c=0,b=0;b<a.length;b++){var h=
a[b];if(!h.added&&!h.removed){if(d>0||c>0)f.push([e,e+d,g,g+c]),e+=d,g+=c,c=d=0;e+=h.value.length;g+=h.value.length}else h.added?d+=h.value.length:c+=h.value.length}(d>0||c>0)&&f.push([e,e+d,g,g+c]);return f}};return i}();return l});
define("examples/editor/textStyler",["orion/editor/annotations"],function(j){function l(b,a){this.keywords=b;this.whitespacesVisible=a;this.setText("")}function i(){l.call(this,null,!0)}function a(b){l.call(this,null,b)}function f(){l.call(this,null,!1)}function g(b,h,g){this.commentStart="/*";this.commentEnd="*/";var m=[];switch(h){case "java":m=d;break;case "js":m=e;break;case "css":m=c}this.whitespacesVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=
!0;this._scanner=new l(m,this.whitespacesVisible);this._firstScanner=new f;this._commentScanner=new a(this.whitespacesVisible);this._whitespaceScanner=new i;if(h==="css")this._scanner.isCSS=!0,this._firstScanner.isCSS=!0;this.view=b;this.annotationModel=g;this._bracketAnnotations=void 0;var j=this;this._listener={onChanged:function(b){j._onModelChanged(b)},onDestroy:function(b){j._onDestroy(b)},onLineStyle:function(b){j._onLineStyle(b)},onMouseDown:function(b){j._onMouseDown(b)},onSelection:function(b){j._onSelection(b)}};
h=b.getModel();h.getBaseModel&&(h=h.getBaseModel());h.addEventListener("Changed",this._listener.onChanged);b.addEventListener("MouseDown",this._listener.onMouseDown);b.addEventListener("Selection",this._listener.onSelection);b.addEventListener("Destroy",this._listener.onDestroy);b.addEventListener("LineStyle",this._listener.onLineStyle);this._computeComments();this._computeFolding();b.redrawLines()}var e="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(","),
d="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(","),c="alignment-adjust,alignment-baseline,animation,animation-delay,animation-direction,animation-duration,animation-iteration-count,animation-name,animation-play-state,animation-timing-function,appearance,azimuth,backface-visibility,background,background-attachment,background-clip,background-color,background-image,background-origin,background-position,background-repeat,background-size,baseline-shift,binding,bleed,bookmark-label,bookmark-level,bookmark-state,bookmark-target,border,border-bottom,border-bottom-color,border-bottom-left-radius,border-bottom-right-radius,border-bottom-style,border-bottom-width,border-collapse,border-color,border-image,border-image-outset,border-image-repeat,border-image-slice,border-image-source,border-image-width,border-left,border-left-color,border-left-style,border-left-width,border-radius,border-right,border-right-color,border-right-style,border-right-width,border-spacing,border-style,border-top,border-top-color,border-top-left-radius,border-top-right-radius,border-top-style,border-top-width,border-width,bottom,box-align,box-decoration-break,box-direction,box-flex,box-flex-group,box-lines,box-ordinal-group,box-orient,box-pack,box-shadow,box-sizing,break-after,break-before,break-inside,caption-side,clear,clip,color,color-profile,column-count,column-fill,column-gap,column-rule,column-rule-color,column-rule-style,column-rule-width,column-span,column-width,columns,content,counter-increment,counter-reset,crop,cue,cue-after,cue-before,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,fit-position,flex-align,flex-flow,flex-inline-pack,flex-order,flex-pack,float,float-offset,font,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,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,line-stacking-ruby,line-stacking-shift,line-stacking-strategy,list-style,list-style-image,list-style-position,list-style-type,margin,margin-bottom,margin-left,margin-right,margin-top,mark,mark-after,mark-before,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,outline-color,outline-offset,outline-style,outline-width,overflow,overflow-style,overflow-x,overflow-y,padding,padding-bottom,padding-left,padding-right,padding-top,page,page-break-after,page-break-before,page-break-inside,page-policy,pause,pause-after,pause-before,perspective,perspective-origin,phonemes,pitch,pitch-range,play-during,position,presentation-level,punctuation-trim,quotes,rendering-intent,resize,rest,rest-after,rest-before,richness,right,rotation,rotation-point,ruby-align,ruby-overhang,ruby-position,ruby-span,size,speak,speak-header,speak-numeral,speak-punctuation,speech-rate,stress,string-set,table-layout,target,target-name,target-new,target-position,text-align,text-align-last,text-decoration,text-emphasis,text-height,text-indent,text-justify,text-outline,text-shadow,text-transform,text-wrap,top,transform,transform-origin,transform-style,transition,transition-delay,transition-duration,transition-property,transition-timing-function,unicode-bidi,vertical-align,visibility,voice-balance,voice-duration,voice-family,voice-pitch,voice-pitch-range,voice-rate,voice-stress,voice-volume,volume,white-space,white-space-collapse,widows,width,word-break,word-spacing,word-wrap,z-index".split(","),
b={styleClass:"comment"},h={styleClass:"token_multiline_comment"},m={styleClass:"token_doc_comment"},o={styleClass:"token_doc_html_markup"},r={styleClass:"token_task_tag"},q={styleClass:"token_doc_tag"},k={styleClass:"token-string"},p={styleClass:"token_number"},n={styleClass:"token_keyword"},u={styleClass:"token_space"},s={styleClass:"token_tab"},w={styleClass:"line_caret"};l.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(b){switch(b){case 32:case 9:if(this.whitespacesVisible)return b===32?11:10;do b=this._read();while(b===32||b===9);this._unread(b);return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return b;default:var a=this.isCSS,c=this.offset-1;if(!a&&48<=b&&b<=57){var d=a=!1,h=!1,e=b;do if(b=this._read(),b===46&&!a)a=!0;else if(b===101&&!d)a=d=!0,b=this._read(),b!==45&&this._unread(b);else if(b===
120&&e===48&&this.offset-c===2)a=d=h=!0;else if(!(48<=b&&b<=57||h&&(65<=b&&b<=70||97<=b&&b<=102)))break;while(1);this._unread(b);return 3}if(97<=b&&b<=122||65<=b&&b<=90||b===95||45===b&&a){do b=this._read();while(97<=b&&b<=122||65<=b&&b<=90||b===95||48<=b&&b<=57||45===b&&a);this._unread(b);b=this.keywords;if(b.length>0){c=this.text.substring(c,this.offset);for(a=0;a<b.length;a++)if(this.keywords[a]===c)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):
-1},_unread:function(b){b!==-1&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var b=this._read(),a;switch(b){case -1:return null;case 47:b=this._read();if(!this.isCSS&&b===47)for(;;)if(b=this._read(),b===-1||b===10||b===13)return this._unread(b),6;if(b===42){b=this._read();a=7;for(b===42&&(a=8);;){for(;b===42;)if(b=this._read(),b===47)return a;if(b===-1)return this._unread(b),a;b=this._read()}}this._unread(b);return 1;case 39:for(a=4;;)switch(b=this._read(),b){case 39:return a;
case 13:case 10:case -1:return this._unread(b),a;case 92:switch(b=this._read(),b){case 10:a=5;break;case 13:a=5,b=this._read(),b!==10&&this._unread(b)}}break;case 34:for(a=4;;)switch(b=this._read(),b){case 34:return a;case 13:case 10:case -1:return this._unread(b),a;case 92:switch(b=this._read(),b){case 10:a=5;break;case 13:a=5,b=this._read(),b!==10&&this._unread(b)}}break;default:return this._default(b)}}},setText:function(b){this.text=b;this.startOffset=this.offset=0}};i.prototype=new l(null);i.prototype.nextToken=
function(){for(this.startOffset=this.offset;;){var b=this._read();switch(b){case -1:return null;case 32:return 11;case 9:return 10;default:do b=this._read();while(!(b===32||b===9||b===-1));this._unread(b);return 1}}};a.prototype=new l(null);a.prototype.setType=function(b){this._type=b};a.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var b=this._read();switch(b){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return b===32?11:10;do b=this._read();while(b===32||b===
9);this._unread(b);return 9;case 60:if(this._type===8){do b=this._read();while(!(b===62||b===-1));if(b===62)return 12}return 1;case 64:if(this._type===8){do b=this._read();while(97<=b&&b<=122||65<=b&&b<=90||b===95||48<=b&&b<=57);this._unread(b);return 13}return 1;case 84:if((b=this._read())===79)if((b=this._read())===68)if((b=this._read())===79)if(b=this._read(),!(97<=b&&b<=122||65<=b&&b<=90||b===95||48<=b&&b<=57))return this._unread(b),14;this._unread(b);default:do b=this._read();while(!(b===32||
b===9||b===-1||b===60||b===64||b===84));this._unread(b);return 1}}};f.prototype=new l(null);f.prototype._default=function(b){for(;;)switch(b=this._read(),b){case 47:case 34:case 39:case -1:return this._unread(b),1}};g.prototype={getClassNameForToken:function(a){switch(a){case "singleLineComment":return b.styleClass;case "multiLineComment":return h.styleClass;case "docComment":return m.styleClass;case "docHtmlComment":return o.styleClass;case "tasktag":return r.styleClass;case "doctag":return q.styleClass;
case "string":return k.styleClass;case "number":return p.styleClass;case "keyword":return n.styleClass;case "space":return u.styleClass;case "tab":return s.styleClass;case "caretLine":return w.styleClass;case "rulerStyle":return"ruler";case "annotationsStyle":return;case "rulerFolding":return;case "rulerOverview":return"ruler.overview";case "rulerLines":return;case "rulerLinesEven":return"rulerLines.even";case "rulerLinesOdd":return"rulerLines.odd"}return null},destroy:function(){var b=this.view;
if(b){var a=b.getModel();a.getBaseModel&&(a=a.getBaseModel());a.removeEventListener("Changed",this._listener.onChanged);b.removeEventListener("MouseDown",this._listener.onMouseDown);b.removeEventListener("Selection",this._listener.onSelection);b.removeEventListener("Destroy",this._listener.onDestroy);b.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(b){this.highlightCaretLine=b},setWhitespacesVisible:function(b){this.whitespacesVisible=b;
this._scanner.whitespacesVisible=b;this._commentScanner.whitespacesVisible=b},setDetectHyperlinks:function(b){this.detectHyperlinks=b},setFoldingEnabled:function(b){this.foldingEnabled=b},setDetectTasks:function(b){this.detectTasks=b},_binarySearch:function(b,a,c,d,h){var e;d===void 0&&(d=-1);if(h===void 0)h=b.length;for(;h-d>1;)if(e=Math.floor((h+d)/2),a<=b[e].start)h=e;else if(c&&a<b[e].end){h=e;break}else d=e;return h},_computeComments:function(){var b=this.view.getModel();b.getBaseModel&&(b=b.getBaseModel());
this.comments=this._findComments(b.getText())},_computeFolding:function(){if(this.foldingEnabled){var b=this.view.getModel();if(b.getBaseModel){var a=this.annotationModel;if(a){a.removeAnnotations(j.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=b.getBaseModel(),h=this.comments,e=0;e<h.length;e++){var f=h[e];(f=this._createFoldingAnnotation(b,d,f.start,f.end))&&c.push(f)}a.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(b,a,c,d){var h=a.getLineAtOffset(c),a=a.getLineAtOffset(d);
return h===a?null:new (j.AnnotationType.getType(j.AnnotationType.ANNOTATION_FOLDING))(c,d,b)},_computeTasks:function(b,a,c){if(this.detectTasks){var d=this.annotationModel;if(d){var h=this.view.getModel(),e=h;h.getBaseModel&&(e=h.getBaseModel());for(var f=d.getAnnotations(a,c),h=[],g=j.AnnotationType.ANNOTATION_TASK;f.hasNext();){var i=f.next();i.type===g&&h.push(i)}f=[];i=this._commentScanner;i.setText(e.getText(a,c));for(var m;m=i.nextToken();){var k=i.getStartOffset()+a;m===14&&(m=e.getLineEnd(e.getLineAtOffset(k)),
b!==6&&(m=Math.min(m,c-this.commentEnd.length)),f.push(j.AnnotationType.createAnnotation(g,k,m,e.getText(k,m))))}d.replaceAnnotations(h,f)}}},_getLineStyle:function(b){if(this.highlightCaretLine){var a=this.view,c=a.getModel(),a=a.getSelection();if(a.start===a.end&&c.getLineAtOffset(a.start)===b)return w}return null},_getStyles:function(b,a,c){b.getBaseModel&&(c=b.mapOffset(c));for(var d=c+a.length,e=[],f=c,g=this.comments,i=this._binarySearch(g,c,!0);i<g.length;i++){if(g[i].start>=d)break;var j=
g[i].start,n=g[i].end;f<j&&this._parse(a.substring(f-c,j-c),f,e);var o=g[i].type,l;switch(o){case 8:l=m;break;case 7:l=h;break;case 5:l=k}f=Math.max(f,j);j=Math.min(d,n);(o===8||o===7)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(a.substring(f-c,j-c),f,e,l,o):o===5&&this.whitespacesVisible?this._parseString(a.substring(f-c,j-c),f,e,k):e.push({start:f,end:j,style:l});f=n}f<d&&this._parse(a.substring(f-c,d-c),f,e);if(b.getBaseModel)for(a=0;a<e.length;a++)c=e[a].end-e[a].start,
e[a].start=b.mapOffset(e[a].start,!0),e[a].end=e[a].start+c;return e},_parse:function(a,c,d){var e=this._scanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+c,g=null;switch(a){case 2:g=n;break;case 3:g=p;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(e.getData(),f,d,k);continue}else g=k;break;case 8:this._parseComment(e.getData(),f,d,m,a);continue;case 6:this._parseComment(e.getData(),f,d,b,a);continue;case 7:this._parseComment(e.getData(),f,d,h,a);continue;case 10:this.whitespacesVisible&&
(g=s);break;case 11:this.whitespacesVisible&&(g=u)}d.push({start:f,end:e.getOffset()+c,style:g})}},_parseComment:function(b,a,c,d,h){var e=this._commentScanner;e.setText(b);for(e.setType(h);b=e.nextToken();){var h=e.getStartOffset()+a,f=d;switch(b){case 10:this.whitespacesVisible&&(f=s);break;case 11:this.whitespacesVisible&&(f=u);break;case 12:f=o;break;case 13:f=q;break;case 14:f=r;break;default:this.detectHyperlinks&&(f=this._detectHyperlinks(e.getData(),h,c,f))}f&&c.push({start:h,end:e.getOffset()+
a,style:f})}},_parseString:function(b,a,c,d){var h=this._whitespaceScanner;for(h.setText(b);b=h.nextToken();){var e=h.getStartOffset()+a,f=d;switch(b){case 10:this.whitespacesVisible&&(f=s);break;case 11:this.whitespacesVisible&&(f=u)}f&&c.push({start:e,end:h.getOffset()+a,style:f})}},_detectHyperlinks:function(b,a,c,d){var h=null,e;if((e=b.indexOf("://"))>0){for(var h=b,f=e;f>0;){e=h.charCodeAt(f-1);if(!(97<=e&&e<=122||65<=e&&e<=90||45===e||48<=e&&e<=57))break;f--}if(f>0&&(e="\"\"''(){}[]<>".indexOf(h.substring(f-
1,f)),e!==-1&&(e&1)===0&&(e=h.lastIndexOf("\"\"''(){}[]<>".substring(e+1,e+2)))!==-1)){var g=e;e=this._clone(d);e.tagName="A";e.attributes={href:h.substring(f,g)};c.push({start:a,end:a+f,style:d});c.push({start:a+f,end:a+g,style:e});c.push({start:a+g,end:a+b.length,style:d});return null}}else b.toLowerCase().indexOf("bug#")===0&&(h="https://bugs.eclipse.org/bugs/show_bug.cgi?id="+parseInt(b.substring(4),10));return h?(e=this._clone(d),e.tagName="A",e.attributes={href:h},e):d},_clone:function(b){if(!b)return b;
var a={},c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a},_findComments:function(b,a){var a=a||0,c=this._firstScanner,d;c.setText(b);for(var h=[];d=c.nextToken();)(d===7||d===8||d===5)&&h.push({start:c.getStartOffset()+a,end:c.getOffset()+a,type:d}),(d===6||d===7||d===8)&&this._computeTasks(d,c.getStartOffset()+a,c.getOffset()+a);return h},_findMatchingBracket:function(b,a){var c="{}()[]<>",d=b.getText(a,a+1),h=c.indexOf(d,0);if(h===-1)return-1;var e;e=h&1?c.substring(h-1,h):c.substring(h+
1,h+2);for(var f=b.getLineAtOffset(a),c=b.getLine(f),g=b.getLineStart(f),i=b.getLineEnd(f),c=this._findBrackets(d,e,c,g,g,i),i=0;i<c.length;i++)if(g=c[i]>=0?1:-1,c[i]*g-1===a){var m=1;if(h&1){for(i--;i>=0;i--)if(g=c[i]>=0?1:-1,m+=g,m===0)return c[i]*g-1;for(f-=1;f>=0;){c=b.getLine(f);g=b.getLineStart(f);i=b.getLineEnd(f);c=this._findBrackets(d,e,c,g,g,i);for(h=c.length-1;h>=0;h--)if(g=c[h]>=0?1:-1,m+=g,m===0)return c[h]*g-1;f--}}else{for(i++;i<c.length;i++)if(g=c[i]>=0?1:-1,m+=g,m===0)return c[i]*
g-1;f+=1;for(h=b.getLineCount();f<h;){c=b.getLine(f);g=b.getLineStart(f);i=b.getLineEnd(f);c=this._findBrackets(d,e,c,g,g,i);for(i=0;i<c.length;i++)if(g=c[i]>=0?1:-1,m+=g,m===0)return c[i]*g-1;f++}}break}return-1},_findBrackets:function(b,a,c,d,h,e){for(var f=[],b=b.charCodeAt(0),a=a.charCodeAt(0),g=h,i=this._scanner,m,j=this.comments,k=this._binarySearch(j,h,!0);k<j.length;k++){if(j[k].start>=e)break;m=j[k].start;var n=j[k].end;if(g<m)for(i.setText(c.substring(g-h,m-h));m=i.nextToken();)m===b?f.push(i.getStartOffset()+
g-h+d+1):m===a&&f.push(-(i.getStartOffset()+g-h+d+1));g=n}if(g<e)for(i.setText(c.substring(g-h,e-h));m=i.nextToken();)m===b?f.push(i.getStartOffset()+g-h+d+1):m===a&&f.push(-(i.getStartOffset()+g-h+d+1));return f},_onDestroy:function(){this.destroy()},_onLineStyle:function(b){if(b.textView===this.view)b.style=this._getLineStyle(b.lineIndex);b.ranges=this._getStyles(b.textView.getModel(),b.lineText,b.lineStart)},_onSelection:function(b){var a=b.oldValue,c=b.newValue,d=this.view,b=d.getModel(),h;if(this.highlightCaretLine){var e=
b.getLineAtOffset(a.start);h=b.getLineAtOffset(c.start);var f=c.start===c.end,a=a.start===a.end;e===h&&a&&f||(a&&d.redrawLines(e,e+1),(e!==h||!a)&&f&&d.redrawLines(h,h+1))}if(this.annotationModel){var a=this._bracketAnnotations,g,i;if(c.start===c.end&&(i=d.getCaretOffset())>0)i-=1,b.getBaseModel&&(i=b.mapOffset(i),b=b.getBaseModel()),b=this._findMatchingBracket(b,i),b!==-1&&(g=[j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_MATCHING_BRACKET,b,b+1),j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_CURRENT_BRACKET,
i,i+1)]);this._bracketAnnotations=g;this.annotationModel.replaceAnnotations(a,g)}},_onMouseDown:function(b){if(b.clickCount===2){var a=this.view,c=a.getModel(),d=a.getOffsetAtLocation(b.x,b.y);if(d>0){var h=d-1,e=c;c.getBaseModel&&(h=c.mapOffset(h),e=c.getBaseModel());h=this._findMatchingBracket(e,h);h!==-1&&(b.preventDefault(),b=h,c.getBaseModel&&(b=c.mapOffset(b,!0)),d>b&&(d--,b++),a.setSelection(b,d))}}},_onModelChanged:function(b){var a=b.start,c=b.removedCharCount,d=b.addedCharCount-c,h=this.view,
b=h.getModel(),e=b.getBaseModel?b.getBaseModel():b,c=a+c,f=e.getCharCount(),g=this.comments.length,i=e.getLineStart(e.getLineAtOffset(a)),m=this._binarySearch(this.comments,i,!0),k=this._binarySearch(this.comments,c,!1,m-1,g);m<g&&this.comments[m].start<=i&&i<this.comments[m].end?(i=this.comments[m].start,i>a&&(i+=d)):i=m===g&&g>0&&f-d===this.comments[g-1].end?this.comments[g-1].start:i;var n;k<g?(n=this.comments[k].end,n>a&&(n+=d),k+=1):(k=g,n=f);for(var o,f=this._findComments(e.getText(i,n),i),
g=m;g<this.comments.length;g++)o=this.comments[g],o.start>a&&(o.start+=d),o.start>a&&(o.end+=d);var l=k-m!==f.length;if(!l)for(g=0;g<f.length;g++){o=this.comments[m+g];var r=f[g];if(o.start!==r.start||o.end!==r.end||o.type!==r.type){l=!0;break}}g=[m,k-m].concat(f);Array.prototype.splice.apply(this.comments,g);l&&(g=i,o=n,b!==e&&(g=b.mapOffset(g,!0),o=b.mapOffset(o,!0)),h.redrawRange(g,o));if(this.foldingEnabled&&e!==b&&this.annotationModel){h=this.annotationModel;m=h.getAnnotations(i,n);i=[];for(n=
[];m.hasNext();)if(o=m.next(),o.type===j.AnnotationType.ANNOTATION_FOLDING){n.push(o);for(g=0;g<f.length;g++)if(o.start===f[g].start&&o.end===f[g].end)break;g===f.length?(i.push(o),o.expand()):(g=o.start,k=o.end,g>a&&(g-=d),k>a&&(k-=d),g<=a&&a<k&&g<=c&&c<k&&(g=e.getLineAtOffset(o.start),k=e.getLineAtOffset(o.end),g!==k?o.expanded||(o.expand(),h.modifyAnnotation(o)):h.removeAnnotation(o)))}a=[];for(g=0;g<f.length;g++){o=f[g];for(d=0;d<n.length;d++)if(n[d].start===o.start&&n[d].end===o.end)break;d===
n.length&&(o=this._createFoldingAnnotation(b,e,o.start,o.end))&&a.push(o)}h.replaceAnnotations(i,a)}}};return{TextStyler:g}});
define("orion/editor/textMateStyler",["orion/editor/regex"],function(j){function l(a,b){var d=b.textView._parent.ownerDocument,e=b._stylesheet=b.util.createElement(d,"style");e.appendChild(d.createTextNode(b._styleSheet(a,"",b.util)));(d.getElementsByTagName("head")[0]||d.documentElement).appendChild(e);b.textView.update(!0)}function i(a,b){var d,e=this;a.getPreferences("/settings",2).then(function(a){if(a.get("JavaScript Editor")!==void 0&&(d=JSON.parse(a.get("JavaScript Editor")))){if(e._stylesheet)e._stylesheet.parentNode.removeChild(e._stylesheet),
e._stylesheet=null;e._update(d,e,b)}})}function a(a,b){for(var d=[],e=0;e<a.length;e++)d[a[e].element]=a[e].value;e=[];e.push("");var f=d.fontFamily,f=f==="sans serif"?'"Menlo", "Consolas", "Vera Mono", "monospace"':"monospace";e.push(b+" .textviewContainer {");e.push("\u0008ackground-color:"+d.background+";");e.push("\tfont-family: "+f+";");e.push("\tfont-size: "+d.fontSize+";");e.push("\tmin-width: 50px;");e.push("\tmin-height: 50px;");e.push("\tcolor: "+d.text+";");e.push("}");e.push(b+" {");e.push("\tfont-family: "+
f+";");e.push("\tfont-size: "+d.fontSize+";");e.push("\tcolor: "+d.text+";");e.push("}");e.push(b+" .textview {");e.push("\tbackground-color: "+d.background+";");e.push("}");e.push(b+".ruler.annotations{");e.push("\tbackground-color: white;");e.push("}");e.push(b+" .ruler {");e.push("\tbackground-color: "+d.annotationRuler+";");e.push("}");e.push(b+" .rulerLines {");e.push("\tcolor: "+d.lineNumber+";");e.push("\tbackground-color: "+d.annotationRuler+";");e.push("}");e.push(b+" .rulerLines.even {");
e.push("\tcolor: "+d.lineNumber+";");e.push("\tbackground-color: "+d.annotationRuler+";");e.push("}");e.push(b+" .rulerLines.odd {");e.push("\tcolor: "+d.lineNumber+";");e.push("\tbackground-color: "+d.annotationRuler+";");e.push("}");e.push(b+" .annotationLine.currentLine {");e.push("\tbackground-color: "+d.currentLine+";");e.push("}");e.push(b+" .entity-name-tag {");e.push("color: "+d.keyword+";");e.push("}");return e.join("\n")}function f(a){var b;if(a instanceof Array){b=Array(a.length);for(var d=
0;d<a.length;d++)b[d]=f(a[d])}else for(d in b={},a)if(Object.prototype.hasOwnProperty.call(a,d)){var e=a[d];b[d]=typeof e==="object"&&e!==null?f(e):e}return b}function g(c,b,d,e,g){this.initialize(c,e);this.grammar=f(b);this.externalGrammars=d?f(d):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar);this._updateStylesheet=i;this._update=l;this._styleSheet=a;this.util=g}var e,d={unsupported:[{regex:/\(\?[ims\-]:/,func:function(){return"option on/off for subexp"}},
{regex:/\(\?<([=!])/,func:function(a){return a[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(a){function b(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var h="",e,a=d.processGlobalFlag("x",a,function(b){for(var a="",c=!1,d=b.length,h=0;h<d;){var e=b.charAt(h);if(!c&&e==="#")for(;h<d&&e!=="\r"&&e!=="\n";)e=b.charAt(++h);else if(!c&&/\s/.test(e))for(;h<d&&/\s/.test(e);)e=
b.charAt(++h);else e==="\\"?(a+=e,/\s/.test(b.charAt(h+1))||(a+=b.charAt(h+1),h+=1)):(e==="["?c=!0:e==="]"&&(c=!1),a+=e),h+=1}return a}),a=d.processGlobalFlag("i",a,function(b){h+="i";return b});for(e=0;e<this.unsupported.length;e++){var f;(f=this.unsupported[e].regex.exec(a))&&b(this.unsupported[e].func(f),f)}return RegExp(a,h)},processGlobalFlag:function(a,b,d){function e(b,a){for(var c=0,d=b.length,h=-1,f=a;f<d&&h===-1;f++)switch(b.charAt(f)){case "\\":f++;break;case "(":c++;break;case ")":c--,
c===0&&(h=f)}return h}var f="(?"+a+")",a="(?"+a+":";if(b.substring(0,f.length)===f)return d(b.substring(f.length));else if(b.substring(0,a.length)===a){f=e(b,0);if(f<b.length-1)throw Error("Only a "+a+") group that encloses the entire regex is supported in: "+b);return d(b.substring(a.length,f))}return b},hasBackReference:function(a){return/\\\d+/.test(a.source)},getSubstitutedRegex:function(a,b,d){for(var d=typeof d==="undefined"?!0:!1,a=a.source.split(/(\\\d+)/g),e=[],f=0;f<a.length;f++){var g=
a[f],i=/\\(\d+)/.exec(g);i?(g=b[i[1]]||"",e.push(d?j.escape(g):g)):e.push(g)}return RegExp(e.join(""))},groupify:function(a,b){for(var d=a.source,e=d.length,f=[],g=0,i=[],j=1,l=1,n=[],u={},s={},w=0;w<e;w++){var v=f[f.length-1],x=d.charAt(w);switch(x){case "(":if(v===4)f.pop(),n.push(")"),i[i.length-1].end=w;var z=w+2<e?d.charAt(w+1)+""+d.charAt(w+2):null;if(z==="?:"||z==="?="||z==="?!"){var t;z==="?:"?t=1:(t=3,g++);f.push(t);i.push({start:w,end:-1,type:t});n.push(x);n.push(z);w+=z.length}else f.push(2),
i.push({start:w,end:-1,type:2,oldNum:j,num:l}),n.push(x),g===0&&(s[l]=null),u[j]=l,j++,l++;break;case ")":v=f.pop();v===3&&g--;i[i.length-1].end=w;n.push(x);break;case "*":case "+":case "?":case "}":var D=x,B=d.charAt(w-1),z=w-1;if(x==="}"){for(t=w-1;d.charAt(t)!=="{"&&t>=0;t--);B=d.charAt(t-1);z=t-1;D=d.substring(t,w+1)}t=i[i.length-1];if(B===")"&&(t.type===2||t.type===4)){n.splice(t.start,0,"(");n.push(D);n.push(")");x={start:t.start,end:n.length-1,type:4,num:t.num};for(B=0;B<i.length;B++)if(v=
i[B],(v.type===2||v.type===4)&&v.start>=t.start&&v.end<=z)if(v.start+=1,v.end+=1,v.num+=1,v.type===2)u[v.oldNum]=v.num;i.push(x);l++;break}default:x!=="|"&&v!==2&&v!==4&&g===0&&(f.push(4),i.push({start:w,end:-1,type:4,num:l}),n.push("("),s[l]=null,l++),n.push(x),x==="\\"&&(x=d.charAt(w+1),n.push(x),w+=1)}}for(;f.length;)f.pop(),n.push(")");var d=RegExp(n.join("")),e={},b=b||u,F;for(F in b)b.hasOwnProperty(F)&&(e[F]="\\"+b[F]);d=this.getSubstitutedRegex(d,e,!1);return[d,u,s]},complexCaptures:function(a){if(!a)return!1;
for(var b in a)if(a.hasOwnProperty(b)&&b!=="0")return!0;return!1}};g.prototype={initialize:function(a,b,d){this.textView=a;this.textView.stylerOptions=this;var f=this;this.textView&&b&&b.startup().then(function(b){e=b.preferences;f.preferences=e;f._updateStylesheet(e,d);f.storageKey=e.listenForChangedSettings(f._listener.onStorage)});this._listener={onModelChanged:function(b){f.onModelChanged(b)},onDestroy:function(b){f.onDestroy(b)},onLineStyle:function(b){f.onLineStyle(b)},onStorage:function(b){f.onStorage(b)}};
a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);a.redrawLines()},onDestroy:function(){this.destroy()},onStorage:function(a){a.key===this.storageKey&&this._updateStylesheet(this.preferences)},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(a){for(a=[a];a.length!==0;){var b=a.pop();if(!b._resolvedRule||!b._typedRule)if(b._resolvedRule=this._resolve(b),b._typedRule=this._createTypedRule(b),this.addStyles(b.name),this.addStyles(b.contentName),this.addStylesForCaptures(b.captures),this.addStylesForCaptures(b.beginCaptures),this.addStylesForCaptures(b.endCaptures),b._resolvedRule!==
b&&a.push(b._resolvedRule),b.patterns)for(var d=0;d<b.patterns.length;d++)a.push(b.patterns[d])}},addStyles:function(a){if(a&&!this._styles[a]){this._styles[a]=[];for(var b=a.split("."),d=0;d<b.length;d++)this._styles[a].push(b.slice(0,d+1).join("-"))}},addStylesForCaptures:function(a){for(var b in a)a.hasOwnProperty(b)&&this.addStyles(a[b].name)},ContainerRule:function(){function a(b){this.rule=b;this.subrules=b.patterns}a.prototype.valueOf=function(){return"aa"};return a}(),BeginEndRule:function(){function a(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 c=d.complexCaptures(b.captures),b=d.complexCaptures(b.beginCaptures)||d.complexCaptures(b.endCaptures);if(this.isComplex=c||b)c=d.groupify(this.beginRegex),this.beginRegex=c[0],this.beginOld2New=c[1],this.beginConsuming=c[2],c=d.groupify(this.endRegex,this.beginOld2New),this.endRegex=c[0],this.endOld2New=c[1],this.endConsuming=c[2]}a.prototype.valueOf=
function(){return this.beginRegex};return a}(),MatchRule:function(){function a(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]}a.prototype.valueOf=function(){return this.matchRegex};return a}(),_createTypedRule:function(a){return a.match?new this.MatchRule(a):a.begin?new this.BeginEndRule(a):new this.ContainerRule(a)},_resolve:function(a){var b=a;if(a.include){if(a.begin||
a.end||a.match)throw Error('Unexpected regex pattern in "include" rule '+a.include);a=a.include;if(a.charAt(0)==="#"){if(b=this.grammar.repository&&this.grammar.repository[a.substring(1)],!b)throw Error("Couldn't find included rule "+a+" in grammar repository");}else if(a==="$self")b=this.grammar;else if(a==="$base")throw Error('Include "$base" is not supported');else if(b=this._allGrammars[a],!b)for(var d=0;d<this.externalGrammars.length;d++){var e=this.externalGrammars[d];if(e.scopeName===a){this.preprocess(e);
b=this._allGrammars[a]=e;break}}}return b},ContainerNode:function(){function a(b,c){this.parent=b;this.rule=c;this.children=[];this.end=this.start=null}a.prototype.addChild=function(b){this.children.push(b)};a.prototype.valueOf=function(){var b=this.rule;return"ContainerNode { "+(b.include||"")+" "+(b.name||"")+(b.comment||"")+"}"};return a}(),BeginEndNode:function(){function a(b,c,e){this.parent=b;this.rule=c;this.children=[];this.setStart(e);this.endMatch=this.end=null;this.endRegexSubstituted=
c.endRegexHasBackRef?d.getSubstitutedRegex(c.endRegex,e):null}a.prototype.addChild=function(b){this.children.push(b)};a.prototype.getIndexInParent=function(){return this.parent?this.parent.children.indexOf(this):-1};a.prototype.setStart=function(b){this.start=b.index;this.beginMatch=b};a.prototype.setEnd=function(b){b&&typeof b==="object"?(this.endMatch=b,this.end=b.index+b[0].length):(this.endMatch=null,this.end=b)};a.prototype.shiftStart=function(b){this.start+=b;this.beginMatch.index+=b};a.prototype.shiftEnd=
function(b){this.end+=b;this.endMatch&&(this.endMatch.index+=b)};a.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+"}"};return a}(),push:function(a,b){if(b)for(var d=b.length;d>0;)a.push(b[--d])},exec:function(a,b,d){(b=a.exec(b))&&(b.index+=d);a.lastIndex=0;return b},afterMatch:function(a){return a.index+a[0].length},getEndMatch:function(a,b,d){if(a instanceof this.BeginEndNode){var e=a.rule,a=a.endRegexSubstituted||e.endRegex;return!a?null:this.exec(a,
b,d)}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(a){var b=a.addedCharCount,d=a.removedCharCount,a=a.start;if(this._tree){var e=this.textView.getModel(),f=e.getCharCount(),e=e.getLineEnd(e.getLineAtOffset(a)-1),g=this.getFirstDamaged(e,e),e=e===-1?0:e,b=g?this.parse(g,!0,e,a,b,d):f;this.textView.redrawRange(e,b)}else this.initialParse()},getFirstDamaged:function(a,
b){if(a<0)return this._tree;for(var d=[this._tree],e=null;d.length;){var f=d.pop();if(!f.parent||this.isDamaged(f,a,b)){f instanceof this.BeginEndNode&&(e=f);for(var g=0;g<f.children.length;g++)d.push(f.children[g])}}return e||this._tree},isDamaged:function(a,b,d){return a.start<=d&&a.end>b},parse:function(a,b,d,e,f,g){var i=this.textView.getModel(),j=i.getLineStart(i.getLineCount()-1),l=i.getCharCount(),n=this.getInitialExpected(a,d),u=-1;if(b)a.repaired=!0,a.endNeedsUpdate=!0,u=(u=a.children[a.children.length-
1])?i.getLineEnd(i.getLineAtOffset(u.end+(f-g))):-1,e=i.getLineEnd(i.getLineAtOffset(e+g)),u=Math.max(u,e);for(var u=u===-1?l:u,e=n,s=a,w=!1,v=d,x=-1;s&&(!b||v<u);){var z=this.getNextMatch(i,s,v);z||(v=v>=j?l:i.getLineStart(i.getLineAtOffset(v)+1));var t=z&&z.match,D=z&&z.rule,B=z&&z.isEnd;if(z&&z.isSub){if(v=this.afterMatch(t),D instanceof this.BeginEndRule)w=!0,b&&D===e.rule&&s===e.parent?(s=e,s.setStart(t),s.repaired=!0,s.endNeedsUpdate=!0,e=this.getNextExpected(e,"begin")):(b&&(this.prune(s,e),
b=!1),t=new this.BeginEndNode(s,D,t),s.addChild(t),s=t)}else if(B||v===l){if(s instanceof this.BeginEndNode)t?(w=!0,x=Math.max(x,s.end),s.setEnd(t),v=this.afterMatch(t),b&&s===e&&s.parent===e.parent?(s.repaired=!0,delete s.endNeedsUpdate,e=this.getNextExpected(e,"end")):b&&(this.prune(s,e),b=!1)):(s.setEnd(l),delete s.endNeedsUpdate);s=s.parent}b&&v>=u&&!w&&(this.prune(a,n),b=!1)}this.removeUnrepairedChildren(a,b,d);this.cleanup(b,a,d,u,l,f,g);return b?Math.max(x,v):v},removeUnrepairedChildren:function(a,
b,d){if(b){for(var b=a.children,e=-1,f=0;f<b.length;f++){var g=b[f];if(!g.repaired&&this.isDamaged(g,d,Number.MAX_VALUE)){e=f;break}}if(e!==-1)a.children.length=e}},cleanup:function(a,b,d,e,f,g,i){if(a){a=g-i;f=this.getIntersecting(e-a+1,f);b=this.getIntersecting(d,e);for(d=0;d<f.length;d++)e=f[d],!e.repaired&&e instanceof this.BeginEndNode&&(e.shiftEnd(a),e.shiftStart(a));for(d=0;d<b.length;d++)e=b[d],e.repaired&&e.endNeedsUpdate&&e.shiftEnd(a),delete e.endNeedsUpdate,delete e.repaired}else{b=this.getIntersecting(d,
e);for(d=0;d<b.length;d++)delete b[d].repaired}},getNextMatch:function(a,b,d,e){var f=a.getLineAtOffset(d),f=a.getLineEnd(f),g=a.getText(d,f),i=[],j=[],a=[],f=[];for(this.push(i,b.rule.subrules);i.length;){var l=i.length?i.pop():null,l=l&&l._resolvedRule._typedRule;if(l instanceof this.ContainerRule&&j.indexOf(l)===-1)j.push(l),this.push(i,l.subrules);else if(!l||!e||l.matchRegex){var n=l&&this.exec(l.matchRegex||l.beginRegex,g,d);n&&(a.push(n),f.push(l))}}i=Number.MAX_VALUE;j=-1;for(l=0;l<a.length;l++)if(n=
a[l],n.index<i)i=n.index,j=l;if(!e&&(d=this.getEndMatch(b,g,d)))if(e=b.rule.applyEndPatternLast,j===-1||d.index<i||!e&&d.index===i)return{isEnd:!0,rule:b.rule,match:d};return j===-1?null:{isSub:!0,rule:f[j],match:a[j]}},getInitialExpected:function(a,b){var d,e;if(a===this._tree)for(d=0;d<a.children.length;d++){if(e=a.children[d],e.start>=b)return e}else if(a instanceof this.BeginEndNode&&a.endMatch){var f=a.endMatch.index;for(d=0;d<a.children.length;d++)if(e=a.children[d],e.start>=b)break;if(e&&e.start<
f)return e}return a},getNextExpected:function(a,b){if(b==="begin"){var d=a.children[0];return d?d:a}else if(b==="end"&&(d=a.parent)){var e=d.children[d.children.indexOf(a)+1];return e?e:d}return null},prune:function(a,b){if(b.parent===a)a.children.length=b.getIndexInParent();else if(a instanceof this.BeginEndNode)a.endMatch=null,a.end=null;if(a.parent)a.parent.children.length=a.getIndexInParent()+1},onLineStyle:function(a){this._tree||this.initialParse();var b=a.lineStart,d=this.textView.getModel(),
e=d.getLineEnd(a.lineIndex),f=d.getLineEnd(d.getLineAtOffset(b)-1),f=this.getFirstDamaged(f,f),b=this.getLineScope(d,f,b,e);a.ranges=this.toStyleRanges(b);a.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(a,b,d,e){for(var f=d,g=this.getInitialExpected(b,d),i=[],j=[];b&&f<e;){var l=this.getNextMatch(a,b,f);if(!l)break;var n=l&&l.match,u=l&&l.rule,s=l&&l.isSub,l=l&&l.isEnd;n.index!==f&&j.push({start:f,end:n.index,node:b});if(s)f=this.afterMatch(n),u instanceof this.BeginEndRule?
(this.addBeginScope(i,n,u),b=g,g=this.getNextExpected(g,"begin")):this.addMatchScope(i,n,u);else if(l)f=this.afterMatch(n),this.addEndScope(i,n,u),g=this.getNextExpected(g,"end"),b=b.parent}f<e&&j.push({start:f,end:e,node:b});a=this.getInheritedLineScope(j,d,e);return i.concat(a)},getInheritedLineScope:function(a){for(var b=[],d=0;d<a.length;d++)for(var e=a[d],f=e.node;f;){var g=f.rule.rule,i=g.name;if(g=g.contentName||i){this.addScopeRange(b,e.start,e.end,g);break}f=f.parent}return b},addBeginScope:function(a,
b,d){var e=d.rule;this.addCapturesScope(a,b,e.beginCaptures||e.captures,d.isComplex,d.beginOld2New,d.beginConsuming)},addEndScope:function(a,b,d){var e=d.rule;this.addCapturesScope(a,b,e.endCaptures||e.captures,d.isComplex,d.endOld2New,d.endConsuming)},addMatchScope:function(a,b,d){var e=d.rule,f=e.name;(e=e.captures)?this.addCapturesScope(a,b,e,d.isComplex,d.matchOld2New,d.matchConsuming):this.addScope(a,b,f)},addScope:function(a,b,d){d&&a.push({start:b.index,end:this.afterMatch(b),scope:d})},addScopeRange:function(a,
b,d,e){e&&a.push({start:b,end:d,scope:e})},addCapturesScope:function(a,b,d,e,f,g){if(d)if(e){for(var e={1:0},i=0,j=1;b[j]!==void 0;j++)g[j]!==void 0&&(i+=b[j].length),b[j+1]!==void 0&&(e[j+1]=i);g=b.index;for(i=1;d[i];i++){var j=d[i].name,l=f[i],n=g+e[l];typeof b[l]!=="undefined"&&this.addScopeRange(a,n,n+b[l].length,j)}}else this.addScope(a,b,d[0]&&d[0].name)},getIntersecting:function(a,b){for(var d=[],e=this._tree?[this._tree]:[];e.length;){var f=e.pop(),g=!1;f instanceof this.ContainerNode?g=!0:
this.isDamaged(f,a,b)&&(g=!0,d.push(f));if(g)for(var g=f.children.length,i=0;i<g;i++)e.push(f.children[i])}return d.reverse()},toStyleRanges:function(a){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this._styles[e.scope];if(!f)throw Error("styles not found for "+e.scope);f=f.join(" ");b.push({start:e.start,end:e.end,style:{styleClass:f}})}return b}};return{RegexUtil:d,TextMateStyler:g}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(j,l){function i(a){return a.getProperty("objectClass").indexOf(f)!==-1&&a.getProperty("type")==="highlighter"}function a(a,d,c){this.initialize(a,d,c);this.lineStyles=[]}var f="orion.edit.highlighter",g=f+" service must be an event emitter";l.AnnotationType.registerType("orion.annotation.highlightError",{title:j.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});
a.prototype={initialize:function(a,d,c){this.textView=a;this.serviceRegistry=d;this.annotationModel=c;this.services=[];var b=this;this.listener={onModelChanging:function(a){b.onModelChanging(a)},onModelChanged:function(a){b.onModelChanged(a)},onDestroy:function(a){b.onDestroy(a)},onLineStyle:function(a){b.onLineStyle(a)},onStyleReady:function(a){b.onStyleReady(a)},onServiceAdded:function(a){b.onServiceAdded(a.serviceReference,b.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){b.onServiceRemoved(a.serviceReference,
b.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(f);for(c=0;c<a.length;c++){var h=a[c];i(h)&&this.addServiceListener(d.getService(h))}},
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 d=this.startLine;(a.addedLineCount||a.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[d,a.removedLineCount].concat(this._getEmptyStyle(a.addedLineCount)))},
onStyleReady:function(a){var d=a.lineStyles||a.style,a=Number.MAX_VALUE,c=-1,b=this.textView.getModel(),h;for(h in d)d.hasOwnProperty(h)&&(this.lineStyles[h]=d[h],a=Math.min(a,h),c=Math.max(c,h));a=Math.max(a,0);c=Math.min(c,b.getLineCount());if(d=this.annotationModel){for(var f=d.getAnnotations(b.getLineStart(a),b.getLineEnd(c)),g=[];f.hasNext();){var i=f.next();i.type==="orion.annotation.highlightError"&&g.push(i)}f=[];for(i=a;i<=c;i++){h=i;var j=this.lineStyles[h],j=j&&j.errors;h=b.getLineStart(h);
if(j)for(var k=0;k<j.length;k++){var p=j[k];f.push(l.AnnotationType.createAnnotation("orion.annotation.highlightError",p.start+h,p.end+h))}}d.replaceAnnotations(g,f)}this.textView.redrawLines(a,c+1)},onLineStyle:function(a){function d(b,a){for(var c=b.length,d=[],e=0;e<c;e++){var f=b[e];d.push({start:f.start+a,end:f.end+a,style:f.style})}return d}var c=this.lineStyles[a.lineIndex];if(c)if(c.ranges)a.ranges=d(c.ranges,a.lineStart);else if(c.style)a.style=c.style},_getEmptyStyle:function(a){for(var d=
[],c=0;c<a;c++)d.push(null);return d},setContentType:function(a){this.contentType=a;if(this.services)for(a=0;a<this.services.length;a++){var d=this.services[a];if(d.setContentType){var c=this.serviceRegistry.getService("orion.page.progress");c?c.progress(d.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):d.setContentType(this.contentType)}}},onServiceAdded:function(a,d){i(a)&&this.addServiceListener(d)},onServiceRemoved:function(a,
d){this.services.indexOf(d)!==-1&&this.removeServiceListener(d)},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 d=this.serviceRegistry.getService("orion.page.progress");d?d.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(g))},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(g))}};return a});
define("examples/editor/textStylerOptions",["orion/bootstrap","orion/editor/util"],function(j,l){function i(f){this._styler=f;this._view=this._styler.view;this._view.stylerOptions=this;var g=this;this._listener={onStorage:function(a){g._onStorage(a)}};var e=this;this._view&&j.startup().then(function(d){a=d.preferences;e.preferences=a;e._updateStylesheet(a);e.storageKey=a.listenForChangedSettings(e._listener.onStorage)})}var a;i.prototype={_getSetting:function(a,g,e){for(var d,c=0;c<a.length;c++)if(a[c].label===
g)for(var b=0;b<a[c].data.length;b++)if(a[c].data[b].label===e){d=a[c].data[b].value;break}return d},_styleSheet:function(a,g){function e(a,c){var e=h.getClassNameForToken(a);if(e){var f=d[c];b.push("."+g+" ."+e+" {");b.push("\tcolor: "+f+";");b.push("}")}}for(var d=[],c=0;c<a.length;c++)d[a[c].element]=a[c].value;var b=[];b.push("");c=d.fontFamily;c=c==="sans serif"?'"Menlo", "Consolas", "Vera Mono", "monospace"':"monospace";b.push("."+g+" {");b.push("\tfont-family: "+c+";");b.push("\tfont-size: "+
d.fontSize+";");b.push("\tcolor: "+d.text+";");b.push("}");b.push("."+g+" .textview {");b.push("\tbackground-color: "+d.background+";");b.push("}");b.push("."+g+".ruler.annotations{");b.push("\tbackground-color: red;");b.push("}");b.push("."+g+" .ruler {");b.push("\tbackground-color: "+d.annotationRuler+";");b.push("}");b.push("."+g+" .rulerLines {");b.push("\tcolor: "+d.lineNumber+";");b.push("\tbackground-color: "+d.annotationRuler+";");b.push("}");b.push("."+g+" .rulerLines.even {");b.push("\tcolor: "+
d.lineNumber+";");b.push("\tbackground-color: "+d.annotationRuler+";");b.push("}");b.push("."+g+" .rulerLines.odd {");b.push("\tcolor: "+d.lineNumber+";");b.push("\tbackground-color: "+d.annotationRuler+";");b.push("}");b.push("."+g+" .annotationLine.currentLine {");b.push("\tbackground-color: "+d.currentLine+";");b.push("}");var h=this._styler;h.getClassNameForToken&&(e("keyword","keyword"),e("string","string"),e("singleLineComment","comment"),e("multiLineComment","comment"),e("docComment","comment"),
e("docHtmlComment","comment"));return b.join("\n")},_onStorage:function(a){a.key===this.storageKey&&this._updateStylesheet(this.preferences)},_update:function(a,g,e){if(a){if(g._stylesheet)g._stylesheet.parentNode.removeChild(g._stylesheet),g._stylesheet=null;var d=g._view,c=d.getOptions("parent").ownerDocument,b=g._stylesheet=l.createElement(c,"style");b.appendChild(c.createTextNode(g._styleSheet(a,"userTheme",e)));(c.getElementsByTagName("head")[0]||c.documentElement).appendChild(b);a={themeClass:null};
d.getOptions(a);(g=a.themeClass)?((g=g.replace("userTheme",""))&&(g+=" "),g+="userTheme"):g="userTheme";a.themeClass=g;d.setOptions(a);d.update(!0)}},_updateStylesheet:function(a,g){var e,d=this;a.getPreferences("/settings",2).then(function(a){a.get("JavaScript Editor")!==void 0&&(e=JSON.parse(a.get("JavaScript Editor")),d._update(e,d,g))})}};return{TextStylerOptions:i}});
define("orion/highlight","examples/editor/textStyler,orion/editor/textMateStyler,orion/editor/AsyncStyler,examples/editor/textStylerOptions,orion/bootstrap,orion/editor/util,orion/Deferred".split(","),function(j,l,i,a,f,g,e){function d(b,c,d,o,r,q,k){function p(b,a){var f=b.getProperty("contentType"),g=b.getProperty("fileTypes");if(f)return c.isSomeExtensionOf(d,f).then(function(a){return a?b:null});else if(a&&g&&g.indexOf(a)!==-1)return f=new e,f.resolve(b),f;return null}var n=function(b){var c=
null;switch(b&&b.id){case "application/javascript":case "application/json":c=new j.TextStyler(o,"js",r);break;case "text/x-java-source":c=new j.TextStyler(o,"java",r);break;case "text/css":c=new j.TextStyler(o,"css",r)}c&&new a.TextStylerOptions(c);return c}(d);if(n)return q=new e,q.resolve(n),q;for(var n=q&&q.split(".").pop().toLowerCase(),q=b.getServiceReferences("orion.edit.highlighter"),u=[],s=[],w=0;w<q.length;w++){var v=q[w];v.getProperty("type")==="grammar"&&u.push(v.getProperty("grammar"));
(v=p(v,n))&&s.push(v)}return e.all(s,function(b){return{_error:b}}).then(function(a){for(var c,e=a.length-1;e>=0;e--){var h=a[e];if(h&&!h._error&&(k||h.getProperty("type")!=="highlighter")){c=h;break}}var j;if(c)if(a=c.getProperty("type"),a==="highlighter")j=new i(o,b,r),j.setContentType(d);else if(a==="grammar"||typeof a==="undefined")c=c.getProperty("grammar"),j=new l.TextMateStyler(o,c,u,f,g);return j})}function c(b){this.serviceRegistry=b;this.styler=null}c.prototype={setup:function(b,a,c,e,f){f=
typeof f==="undefined"?!0:f;if(this.styler)this.styler.destroy&&this.styler.destroy(),this.styler=null;var g=this;return d(this.serviceRegistry,this.serviceRegistry.getService("orion.core.contenttypes"),b,a,c,e,f).then(function(b){return g.styler=b})},getStyler:function(){return this.styler}};return{createStyler:d,SyntaxHighlighter:c}});
define("orion/treeModelIterator",[],function(){var j={};j.TreeModelIterator=function(){function j(i,a){this.firstLevelChildren=i;this.reset();this._init(a)}j.prototype={_init:function(i){if(i)this.isExpanded=i.isExpanded,this.isExpandable=i.isExpandable,this.forceExpandFunc=i.forceExpandFunc},topLevel:function(i){return i.parent?i.parent===this.root:!0},_expanded:function(i){if(!i)return!0;var a=i.children&&i.children.length>0;this.isExpanded&&a&&(a=this.isExpanded(i));return a},_expandable:function(i){return!i?
!0:this.isExpandable?this.isExpandable(i):!1},_diveIn:function(i){return this._expanded(i)?(this.setCursor(i.children[0]),this.cursor()):null},_drillToLast:function(i){return this._expanded(i)?this._drillToLast(i.children[i.children.length-1]):i},_forward:function(i){if(!this._cursor)return null;var a=this._diveIn(this._cursor);if(!a){if(i&&this._expandable(this._cursor)&&this.forceExpandFunc){var f=this;return this.forceExpandFunc(this._cursor,"first",function(a){a&&f.setCursor(a)})}(a=this._findSibling(this._cursor,
!0))&&this.setCursor(a)}return a},_backward:function(i){if(!this._cursor)return null;var a=this._findSibling(this._cursor,!1);a&&a!==this._cursor.parent&&(a=this._drillToLast(a));if(i&&a&&this._expandable(a)&&this.forceExpandFunc&&a!==this._cursor.parent){var f=this;return this.forceExpandFunc(a,"last",function(a){a&&f.setCursor(a)})}a&&this.setCursor(a);return a},_findSibling:function(i,a){for(var f=this.topLevel(i),g=f?this.firstLevelChildren:i.parent.children,e=0;e<g.length;e++)if(g[e]===i)return e===
0&&!a?f?null:i.parent:e===g.length-1&&a?f?null:this._findSibling(i.parent,a):a?g[e+1]:g[e-1];return null},_inParentChain:function(i,a){for(var f=i.parent;f;){if(f===a)return!0;f=f.parent}return!1},_getTopLevelParent:function(i){if(this.topLevel(i))return i;for(i=i.parent;i;){if(this.topLevel(i))return i;i=i.parent}return null},_onCollapse:function(i){return this._expanded(i.parent)?i:this._onCollapse(i.parent)},_scan:function(i,a,f){this.setCursor(a);var g=[];for(g.push(a);;){if(this.iterate(i))g.push(this.cursor());
else break;if(f===this.cursor())return g}return null},setCursor:function(i){this._prevCursor=this._cursor;this._cursor=i},setTree:function(i){this.firstLevelChildren=i;if(this.firstLevelChildren.length>0)this.root=this.firstLevelChildren[0].parent},scan:function(i,a){var f=this.cursor(),g=this._scan(!0,i,a);g||(g=this._scan(!1,i,a));this.setCursor(f);return g},iterate:function(i,a){return i?this._forward(a):this._backward(a)},iterateOnTop:function(i,a){var f=this._findSibling(this._getTopLevelParent(this.cursor()),
i);f?this.setCursor(f):a&&this.firstLevelChildren.length>0&&this.setCursor(i?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(i){if(!this._cursor)return null;return this._inParentChain(this._cursor,i)?(this.setCursor(i),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/compare/compareUtils",["orion/URITemplate"],function(j){var l=l||{};l.compareUtils=l.compareUtils||{};l.compareUtils.lookUpMapper=function(i,a,f){for(var g=0,e=0;e<i.length;e++){var d=i[e][a];d===0&&(d=1);if(f>=g&&f<g+d)return{mapperIndex:e,startFrom:g};if(e===i.length-1)break;g+=i[e][a]}return{mapperIndex:i.length-1,startFrom:g}};l.compareUtils.lookUpLineIndex=function(i,a,f){if(f===0)return 0;for(var g=0,e=0;e<f;e++)g+=i[e][a];return g};l.compareUtils.updateMapper=function(i,a,f,g,
e){if(g!==e&&(g>0||e>0)){var d=l.compareUtils.lookUpMapper(i,a,f);if(!(d.mapperIndex<0)){if(g>0)for(var c=f-d.startFrom,f=d.mapperIndex;f<i.length;f++){c=i[f][a]-c;if(g<=c){i[f][a]-=g;break}i[f][a]-=c;g-=c;c=0}e>0&&(i[d.mapperIndex][a]+=e)}}};l.compareUtils.overlapMapper=function(i,a,f,g,e){i=f+i[a]-1;i<f&&(i=f);e<g&&(e=g);return i<g||e<f?!1:!0};l.compareUtils.findFirstDiff=function(i,a,f,g){for(var e=0,d=void 0,c=0;c<i.length;c++){if(e>g)break;if(l.compareUtils.overlapMapper(i[c],a,e,f,g)&&(d={mapperIndex:c,
startFrom:e},i[c][2]!==0))break;e+=i[c][a]}return d};l.compareUtils.matchMapper=function(i,a,f,g){if(i.length===0)return f;var e=f+Math.round((g-f)/3),d=l.compareUtils.findFirstDiff(i,a,f,g),c=i[d.mapperIndex][a]===0?d.startFrom:d.startFrom+i[d.mapperIndex][a]-1,b=l.compareUtils.lookUpLineIndex(i,1-a,d.mapperIndex),h=d.startFrom-f;return i[d.mapperIndex][2]===0?b-h:e>=d.startFrom&&e<=c?b-Math.round((g-f)/3):e<d.startFrom?b-h:(i[d.mapperIndex][1-a]===0?b:b+i[d.mapperIndex][1-a]-1)-(c-f)};l.compareUtils.getMapperLineCount=
function(i){for(var a=0,f=0;f<i.length;f++)a+=Math.max(i[f][0],i[f][1]);return a};l.compareUtils.getAnnotationIndex=function(i,a){for(var f=0;f<i.length;f++)if(i[f][0]===a)return f;return-1};l.compareUtils.getAnnotationMapperIndex=function(i,a){return i[a][1]};l.compareUtils.getAnnotationIndexByMapper=function(i,a){for(var f=0;f<i.length;f++)if(i[f][1]===a)return{current:f,prev:f-1,next:f+1};return{current:-1,prev:-1,next:-1}};l.compareUtils.isMapperConflict=function(i,a){return a<0?!1:!i[a][3]?!1:
i[a][3]===1};l.compareUtils.mergeDiffBlocks=function(i,a,f,g,e,d){for(var c=0;c<a.length;c++){var b=a[c][0],h=f[a[c][1]];if(h[0]>0){for(var j="",l=0;l<h[0];l++)j=j+g[h[2]-1+l].substring(e)+d;h=i.getLineCount();b>=h&&(b=h-1);b=i.getLineStart(b);i.setText(j,b,b)}}};l.compareUtils.generateCompareHref=function(i,a){var f=require.toUrl("compare/compare.html");if(!a.conflict)a.conflict=void 0;if(!a.readonly)a.readonly=void 0;return(new j(f+"#{,resource,params*}")).expand({resource:i,params:a})};l.compareUtils.generateCompareTreeHref=
function(i,a){var f=require.toUrl("compare-tree/compare-tree.html");return(new j(f+"#{,resource,params*}")).expand({resource:i,params:a})};return l.compareUtils});
define("orion/compare/compare-features",["i18n!orion/compare/nls/messages","orion/compare/compareUtils","orion/webui/littlelib","orion/webui/splitter","text!orion/compare/compare-features.html"],function(j,l,i,a,f){var g=g||{};g.TwoWayCompareUIFactory=function(){function e(a){this._parentDivID=a.parentDivID;this._commandSpanId=a.commandSpanId;this._showTitle=a.showTitle;this._leftTitle=a.leftTitle;this._rightTitle=a.rightTitle;this._showLineStatus=a.showLineStatus}e.prototype={_init:function(){var a=
this._parentDivID+"_";this._topWidgetDiv=i.node("topWidget_id");this._topWidgetDiv.id=a+"topWidget_id";this._leftEditorParentDiv=i.node("left_editor_id");this._leftEditorParentDiv.id=a+"left_editor_id";this._rightEditorParentDiv=i.node("right_editor_id");this._rightEditorParentDiv.id=a+"right_editor_id";this._rightEditorWrapperDiv=i.node("right_editor_wrapper_id");this._rightEditorWrapperDiv.id=a+"right_editor_wrapper_id";this._leftTitleDiv=i.node("left_title_id");this._leftTitleDiv.id=a+"left_title_id";
this._rightTitleDiv=i.node("right_title_id");this._rightTitleDiv.id=a+"right_title_id";this._leftStatusDiv=i.node("left_status_id");this._leftStatusDiv.id=a+"left_status_id";this._rightStatusDiv=i.node("right_status_id");this._rightStatusDiv.id=a+"right_status_id";this._diffCanvasDiv=i.node("diff_canvas_id");this._diffCanvasDiv.id=a+"diff_canvas_id";this._splitterId=a+"orion_splitter";if(!this._showTitle)this._leftEditorParentDiv.style.top="0px",this._rightEditorWrapperDiv.style.top="0px",this._leftTitleDiv.style.height=
"0px",this._rightTitleDiv.style.height="0px";if(!this._showLineStatus)this._leftEditorParentDiv.style.marginBottom="0px",this._rightEditorWrapperDiv.style.marginBottom="0px",this._leftStatusDiv.style.height="0px",this._rightStatusDiv.style.height="0px"},_createSplitter:function(){var d=i.$(".split",this._topWidgetDiv);d.id=this._splitterId;var c=i.$(".leftPanelLayout",this._topWidgetDiv),b=i.$(".rightPanelLayout",this._topWidgetDiv);if(d&&c&&b)this._splitter=new a.Splitter({node:d,sidePanel:c,mainPanel:b})},
buildUI:function(){i.node(this._parentDivID).innerHTML=f;this._init();this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(a){return i.$(".leftPanelLayout",this._topWidgetDiv)===a},getEditorParentDiv:function(a){return a?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(a){return a?this._leftTitleDiv:this._rightTitleDiv},getStatusDiv:function(a){return a?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},
getDiffCanvasDiv:function(){return this._diffCanvasDiv}};return e}();return g});
define("orion/compare/diffTreeNavigator",["orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(j,l,i,a){var f={},g,e,d,c,b,h,m,o,r,q,k,p,n,u,s,w;f.DiffTreeNavigator=function(){function f(b,a,c,d,e,h){this._root={type:"root",children:[]};this._initialized=!1;this.initAll(b,a,c,d,e,h)}g="orion.annotation.diff.addedBlock";e="orion.annotation.diff.currentAddedBlock";d="orion.annotation.diff.deletedBlock";c="orion.annotation.diff.currentDeletedBlock";
b="orion.annotation.diff.blockTop";h="orion.annotation.diff.currentBlockTop";m="orion.annotation.diff.blockConflict";o="orion.annotation.diff.currentBlockConflict";r="orion.annotation.diff.addedWord";q="orion.annotation.diff.currentAddedWord";k="orion.annotation.diff.deletedWord";p="orion.annotation.diff.currentDeletedWord";n="orion.annotation.diff.emptyDeletedWordLeft";u="orion.annotation.diff.emptyDeletedWordRight";s="orion.annotation.diff.emptyAddedWordLeft";w="orion.annotation.diff.emptyAddedWordRight";
i.AnnotationType.registerType(g,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}});i.AnnotationType.registerType(e,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}});i.AnnotationType.registerType(d,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}});i.AnnotationType.registerType(c,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}});i.AnnotationType.registerType(b,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}});
i.AnnotationType.registerType(h,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}});i.AnnotationType.registerType(m,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}});i.AnnotationType.registerType(o,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}});i.AnnotationType.registerType(r,{title:"word added",html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}});i.AnnotationType.registerType(q,{title:"",
html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}});i.AnnotationType.registerType(k,{title:"word deleted",html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}});i.AnnotationType.registerType(p,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}});i.AnnotationType.registerType(n,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}});i.AnnotationType.registerType(u,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}});
i.AnnotationType.registerType(s,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}});i.AnnotationType.registerType(w,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});f.prototype={initAll:function(b,a,c,d,e,h,f){this._charOrWordDiff=b?b:"word";if(a)this._initialized=!0;this.editorWrapper=[{editor:a,diffFeeder:d},{editor:c,diffFeeder:e}];this._curveRuler=f;(this._overviewRuler=h)&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(b){if(b)for(var a=
0;a<this.editorWrapper.length;a++)this.editorWrapper[a].diffFeeder.init(this.editorWrapper[a].editor.getTextView().getModel(),b)},destroy:function(){this.initAll(this._charOrWordDiff)},renderAnnotations:function(){var b;for(b=0;b<this.editorWrapper.length;b++){this.editorWrapper[b].annoTypes=[];this.editorWrapper[b].diffFeeder.getBlockAnnoTypes(this.editorWrapper[b].annoTypes);this.editorWrapper[b].diffFeeder.getWordAnnoTypes(this.editorWrapper[b].annoTypes);for(var c=0;c<this.editorWrapper[b].annoTypes.length;c++)this.editorWrapper[b].annoTypes[c].current&&
this.editorWrapper[b].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[b].annoTypes[c].current),this.editorWrapper[b].annoTypes[c].normal&&this.editorWrapper[b].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[b].annoTypes[c].normal)}this._root.children=[];c=this.editorWrapper[0].diffFeeder.getDiffBlocks();if(!c||c.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 d=new a.JSDiffAdapter;for(b=0;b<c.length;b++){var e=this.generatePairBlockAnnotations(this._root,b);this._root.children.push(e);var h=this.generatePairWordAnnotations(e,b,d);if(h)e.children=h}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(b,a,c,d,e){if(this.editorWrapper[a].annoTypes)for(var h=0;h<this.editorWrapper[a].annoTypes.length;h++)this.editorWrapper[a].annoTypes[h].type===c&&this.replaceDiffAnnotations(this.editorWrapper[a].editor,e?e:this.editorWrapper[a].annoTypes[h].list,d?this.editorWrapper[a].annoTypes[h].normal:this.editorWrapper[a].annoTypes[h].current,
b)},getMapper:function(){return this.editorWrapper[0].diffFeeder.getMapper()},getFeeder:function(b){return b?this.editorWrapper[1].diffFeeder:this.editorWrapper[0].diffFeeder},iterateOnBlock:function(b,a){this.iterator&&(this.iterator.iterateOnTop(b,a),this.updateCurrentAnnotation(!0))},iterateOnChange:function(b){if(this.iterator){this.iterator.iterate(b);var a=this.iterator.cursor();a.type==="block"&&a.children&&a.children.length>0&&this.iterator.iterate(b);this.updateCurrentAnnotation(!0)}},gotoBlock:function(b,
a){if(this.iterator){if(b<0||b>=this._root.children.length||this._root.children.length===0)b=0;a!==void 0&&a>=0&&this._root.children[b].children&&a<this._root.children[b].children.length?this.iterator.setCursor(this._root.children[b].children[a]):this.iterator.setCursor(this._root.children[b]);this.updateCurrentAnnotation(!1);this._positionDiffBlock()}},_hitDiffAnnotation:function(b,a,c){if(c===this.editorWrapper[b].editor.getTextView()){for(var d=0;d<this._root.children.length;d++){var c=this._root.children[d],
e=b===0?c.oldA:c.newA;if(a>=e.start&&a<=e.end){d=c;if(c.children&&c.children.length>0)for(e=0;e<c.children.length;e++){var h=c.children[e],f=b===0?h.oldA:h.newA;if(a>=f.start&&a<=f.end){d=h;break}}return d}}return null}},gotoChange:function(b,a){for(var c=0;c<this.editorWrapper.length;c++){var d=this._hitDiffAnnotation(c,b,a);if(d)return this.iterator.setCursor(d),this.updateCurrentAnnotation(!1,a),!0}return!1},getCurrentBlockIndex:function(){if(!this.iterator)return-1;var b=this.iterator.cursor();
return!b?-1:b.type==="block"?b.index:b.parent.index},getCurrentPosition:function(){if(!this.iterator)return{};var b=this.iterator.cursor();return b.type==="block"?{block:b.index+1}:{block:b.parent.index+1,change:b.index+1}},getCurrentMapperIndex:function(){var b=this.getCurrentBlockIndex();b<0&&(b=0);var a=this.getFeeder().getDiffBlocks();if(!a||a.length===0)return-1;b>a.length-1&&(b=0);return a[b][1]},replaceDiffAnnotations:function(b,a,c,d){if(a&&c&&(b=b.getAnnotationModel())){for(var e=b.getAnnotations(0,
b.getTextModel().getCharCount()),h=[];d&&e.hasNext();){var f=e.next();f.type===c&&h.push(f)}b.replaceAnnotations(h,a)}},updateCurrentAnnotation:function(b,a){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,h={start:c.oldA.start,end:c.oldA.end},f={start:c.newA.start,end:c.newA.end};c.type==="word"?(d=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(h,
this.editorWrapper[0].editor.getTextView().getModel()),e=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(f,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 (i.AnnotationType.getType(d.current))(h.start,h.end)],d,!0);e&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new (i.AnnotationType.getType(e.current))(f.start,
f.end)],e,!0);if(b)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(a)this.autoSelecting=!0,a!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(c.oldA.start,c.oldA.end,!0),a!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(c.newA.start,c.newA.end,!0),this.autoSelecting=!1}}},generatePairBlockAnnotations:function(b,
a){var c=this.generateBlockDiffAnnotations(0,a),d=this.generateBlockDiffAnnotations(1,a);return{parent:b,index:a,type:"block",oldA:c,newA:d}},generatePairWordAnnotations:function(b,a,c){var d=this.editorWrapper[0].diffFeeder.getTextOnBlock(a),e=this.editorWrapper[1].diffFeeder.getTextOnBlock(a),a=null,h=0,f=0;if(d&&e&&d.text&&e.text&&d.text.length<=5E3&&e.text.length<=5E3)a=c.adaptCharDiff(d.text,e.text,this._charOrWordDiff==="word"),f=e.start,h=d.start;else return null;c=[];d=[];this.generateWordDiffAnnotations(0,
c,h,a,2,3);this.generateWordDiffAnnotations(1,d,f,a,0,1);a=[];for(h=0;h<c.length;h++)a.push({parent:b,index:h,type:"word",oldA:c[h],newA:d[h]});return a},getAnnoModelList:function(b,a,c){for(var d=0;d<this.editorWrapper[b].annoTypes.length;d++)if(this.editorWrapper[b].annoTypes[d].type===a&&this.editorWrapper[b].annoTypes[d].normal===c)return this.editorWrapper[b].annoTypes[d].list;return null},generateBlockDiffAnnotations:function(b,a){var c=this.editorWrapper[b].diffFeeder.getCurrentBlockAnnoType(a),
d=this.getAnnoModelList(b,"block",c.normal),e=this.editorWrapper[b].diffFeeder.getCharRange(a),c=i.AnnotationType.createAnnotation(c.normal,e.start,e.end);d&&d.push(c);return c},generateWordDiffAnnotations:function(b,a,c,d,e,h){if(d)for(var f=this.editorWrapper[b].diffFeeder.getCurrentWordAnnoType({start:-1,end:-1}),b=this.getAnnoModelList(b,"word",f.normal),g=0;g<d.length;g++){var j=i.AnnotationType.createAnnotation(f.normal,d[g][e]+c,d[g][h]+c);b.push(j);a.push(j)}},_updateOverviewRuler:function(){if(this._overviewRuler){var b=
this.editorWrapper[0].editor.getTextView().getTopIndex();this.editorWrapper[0].editor.getTextView().redrawLines(b,b+1,this._overviewRuler)}},_updateCurveRuler:function(){this._curveRuler&&this._curveRuler.render()},_setTextViewPosition:function(b,a){var c=b.getLineHeight(),d=b.getClientArea(),c=Math.floor(d.height/c/3);b.setTopIndex(a-c>0?a-c:0)},_positionDiffBlock:function(){var b=this.getCurrentBlockIndex();b<0&&(b=0);var a=this.getFeeder().getDiffBlocks();a.length!==0&&(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),
a[b][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor&&(b=l.lookUpLineIndex(this.getMapper(),0,a[b][1]),this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),b)),this._updateOverviewRuler(),this._updateCurveRuler())},matchPositionFromOverview:function(b){this._initialized&&this.gotoBlock(b<0?0:l.getAnnotationIndex(this.getFeeder().getDiffBlocks(),b))},gotoDiff:function(b,a){this.gotoChange(b,a)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,
!0);this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0);this._positionDiffBlock()},nextChange:function(){this.iterateOnChange(!0);this._positionDiffBlock()},prevChange:function(){this.iterateOnChange(!1);this._positionDiffBlock()}};return f}();f.DiffBlockFeeder=function(){function b(){}b.prototype={getWordAnnoTypes:function(b){this._mapperColumnIndex===0?b.push({type:"word",current:q,normal:r,list:[]}):b.push({type:"word",current:p,normal:k,list:[]});b.push({type:"word",current:n});
b.push({type:"word",current:u});b.push({type:"word",current:s});b.push({type:"word",current:w})},getCurrentWordAnnoType:function(b,a){return b.start===b.end&&a?this._mapperColumnIndex===0?{current:this._repositionEmptyWord(b,a),normal:r}:{current:this._repositionEmptyWord(b,a),normal:k}:this._mapperColumnIndex===0?{current:q,normal:r}:{current:p,normal:k}},_repositionEmptyWord:function(b,a){var c=a.getLineAtOffset(b.start),d=a.getLineStart(c),e=a.getLineEnd(c);if(d!==e){if(b.start===e)return b.start--,
this._mapperColumnIndex===0?w:u;b.end++}else if(c>0&&(c--,d=a.getLineStart(c),e=a.getLineEnd(c),d!==e))return b.start=e-1,b.end=e,this._mapperColumnIndex===0?w:u;return this._mapperColumnIndex===0?s:n},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(b){if(!this._diffBlocks||this._diffBlocks.length===0)return-1;b=this._diffBlocks[b][1];return b===-1?0:this._mapper[b][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},
getLineNumber:function(b){return b},getCharRange:function(b){if(!this._diffBlocks||this._diffBlocks.length===0)return null;var a=this._diffBlocks[b][0],c=a+this._mapper[this._diffBlocks[b][1]][this._mapperColumnIndex]-1,b=this._textModel.getLineStart(a);if(c<a)return{start:b,end:b};a=this._textModel.getLineEnd(c,!0);return{start:b,end:a}},getTextOnBlock:function(b){if(!this._diffBlocks||this._diffBlocks.length===0)return null;b=this.getCharRange(b);return{start:b.start,text:this._textModel.getText(b.start,
b.end)}},isMapperEmpty:function(){return this._mapper.length===0}};return b}();f.TwoWayDiffBlockFeeder=function(){function a(b,c,d){this._mapperColumnIndex=d;this.init(b,c)}a.prototype=new f.DiffBlockFeeder;a.prototype.init=function(b,a){this._textModel=b;this._diffBlocks=void 0;if(a){this._mapper=a;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]}};a.prototype.getBlockAnnoTypes=function(a){this._mapperColumnIndex===
0?a.push({type:"block",normal:g,current:e,list:[]}):a.push({type:"block",normal:d,current:c,list:[]});a.push({type:"block",normal:b,current:h,list:[]});a.push({type:"block",normal:m,current:o,list:[]})};a.prototype.getCurrentBlockAnnoType=function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return null;a=this._diffBlocks[a][1];if(this._mapper[a][this._mapperColumnIndex]===0)return{normal:b,current:h};else if(l.isMapperConflict(this.getMapper(),a))return{normal:m,current:o};else if(this._mapperColumnIndex===
0)return{type:"block",normal:g,current:e,list:[]};return{type:"block",normal:d,current:c,list:[]}};return a}();f.inlineDiffBlockFeeder=function(){function b(a,c){this._mapperColumnIndex=c;this.init(a)}b.prototype=new f.DiffBlockFeeder;b.prototype.setModel=function(b){this._textModel=b};b.prototype.init=function(b){this._diffBlocks=void 0;if(b){this._mapper=b;this._diffBlocks=[];this._gapBlocks=[];for(var a=b=0,c=0;c<this._mapper.length;c++){if(this._mapper[c][2]!==0){if(this._mapperColumnIndex===
0){var d=b+this._mapper[c][1];this._diffBlocks.push([d,c]);this._gapBlocks.push([d,d+this._mapper[c][0],a])}else this._diffBlocks.push([b,c]),this._gapBlocks.push([b,b+this._mapper[c][1],a]);b+=this._mapper[c][0]+this._mapper[c][1]}else this._gapBlocks.push([b,b+this._mapper[c][this._mapperColumnIndex],a]),b+=this._mapper[c][this._mapperColumnIndex];a+=this._mapper[c][this._mapperColumnIndex]}}};b.prototype.getBlockAnnoTypes=function(b){this._mapperColumnIndex===0?b.push({type:"block",normal:g,current:e,
list:[]}):b.push({type:"block",normal:d,current:c,list:[]});b.push({type:"block",normal:m,current:o,list:[]})};b.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:q,normal:r};else if(l.isMapperConflict(this.getMapper(),b))return{normal:m,current:o};else if(this._mapperColumnIndex===0)return{type:"block",normal:g,current:e,list:[]};return{type:"block",normal:d,
current:c,list:[]}};b.prototype.getDiffBlockH=function(b){if(!this._diffBlocks||this._diffBlocks.length===0)return-1;b=this._diffBlocks[b][1];return this._mapper[b][0]+this._mapper[b][1]};b.prototype.getLineNumber=function(b){for(var a=0;a<this._gapBlocks.length;a++)if(this._gapBlocks[a][0]!==this._gapBlocks[a][1]&&b>=this._gapBlocks[a][0]&&b<this._gapBlocks[a][1])return b-this._gapBlocks[a][0]+this._gapBlocks[a][2];return-1};return b}();return f});
define("orion/compare/compare-rulers",["orion/compare/compareUtils","orion/compare/diffTreeNavigator"],function(j){var l=l||{};l.CompareRuler=function(){function i(a,f,g){this._location=a||"left";this._overview=f||"page";this._rulerStyle=g;this._editor=null;var e=this;this._listener={onModelChanged:function(a){e._onModelChanged(a)}}}i.prototype={setView:function(a){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged);this._editor=a;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(a,f){for(var g=[],e=a;e<f;e++){var d=this.getStyle(e);d&&(g[e]={html:this.getHTML(e),style:d})}return g},getWidestAnnotation:function(){return{html:this.getHTML(-1),
style:this.getStyle(-1)}},getRulerStyle:function(){return this.getStyle(void 0)}};return i}();l.LineNumberCompareRuler=function(){function i(a,f,g,e,d,c){l.CompareRuler.call(this,g,"page",e);this._diffNavigator=a;this._oddStyle=d||{style:{backgroundColor:"white"}};this._evenStyle=c||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._mapperColumnIndex=f}i.prototype=new l.CompareRuler;i.prototype.getStyle=function(a){return a===void 0?this._rulerStyle:this._evenStyle};i.prototype.getHTML=function(a){var f=
this._editor.getModel(),g=this._diffNavigator.getFeeder(this._mapperColumnIndex===0);return!g?"":a===-1?f.getLineCount():g.getLineNumber?(a=g.getLineNumber(a),a===-1?"":a+1):a+1};i.prototype._onModelChanged=function(a){var a=a.start,f=this._editor.getModel(),g=f.getLineCount(),e=(g+"").length;if(this._numOfDigits!==e)this._numOfDigits=e,this._editor.redrawLines(f.getLineAtOffset(a),g,this)};return i}();l.CompareOverviewRuler=function(){function i(a,f,g,e){this._diffNavigator=g;this._onClick=e;l.CompareRuler.call(this,
a,"document",f)}i.prototype=new l.CompareRuler;i.prototype.getStyle=function(a){var f,g;if(a===void 0)f=this._rulerStyle||{},g=f.style||(f.style={}),g.lineHeight="1px",g.fontSize="1px",g.width="14px";else if(f=a!==-1?{styleClass:"annotationOverview breakpoint"}:{},g=f.style||(f.style={}),g.cursor="pointer",g.width="8px",g.left="2px",this._editor.getModel(),a>=0){var e;if(this._diffNavigator&&this._diffNavigator.getFeeder())e=this._diffNavigator.getFeeder().getDiffBlocks();else return null;a=j.getAnnotationIndex(e,
a);if(a===-1)return null;e=j.getAnnotationMapperIndex(e,a);var d;d=this._diffNavigator.getMapper();if(e=j.isMapperConflict(d,e))g.border="1px #FF0000 solid";if(a===this._diffNavigator.getCurrentBlockIndex())g.backgroundColor=e?"red":"blue";a=this._diffNavigator.getFeeder().getDiffBlockH(a);e=this._diffNavigator.getFeeder().getOverviewLineCount();if(a<0)return null;d=this._editor.getClientArea();a=Math.floor(d.height*a/e);a<2&&(a=2);g.height=a+"px"}else return g.height="3px";return f};i.prototype.setDiffNavigator=
function(a){this._diffNavigator=a};i.prototype.getHTML=function(){return"&nbsp;"};i.prototype.onClick=function(a){a!==void 0&&this._onClick(a,this)};i.prototype._onModelChanged=function(){this._editor.getModel().getLineCount()>0&&this._editor.redrawLines(0,1,this)};return i}();l.CompareCurveRuler=function(){function i(a){this._canvasDiv=a;this._mapper=void 0;this._initialized=!1}i.prototype={init:function(a,f,g,e){this._initing=this._initialized=!0;this._mapper=a;this._leftEditor=f;this._rightEditor=
g;this._leftTextView=f.getTextView();this._rightTextView=g.getTextView();this._diffNavigator=e;this.render()},matchPositionFrom:function(a){var f=a?this._leftTextView:this._rightTextView,g=a?this._rightTextView:this._leftTextView,e=f.getTopIndex(),f=f.getBottomIndex(),a=j.matchMapper(this._mapper,a?0:1,e,f);g.setTopIndex(a)},copyToLeft:function(){if(this._diffNavigator.iterator){var a=this._diffNavigator.iterator.cursor();a&&this._leftTextView.setText(this._rightTextView.getText(a.oldA.start,a.oldA.end),
a.newA.start,a.newA.end)}},render:function(){if(this._mapper){var a=this._canvasDiv.getContext("2d");a.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height);a.strokeStyle="#AAAAAA";a.lineWidth=1;a.beginPath();var f=this._leftTextView.getTopIndex(),g=this._leftTextView.getBottomIndex(),e=this._rightTextView.getTopIndex(),d=this._rightTextView.getBottomIndex();this._leftLineH=this._leftTextView.getLineHeight();this._rightLineH=this._rightTextView.getLineHeight();for(var c=0,b=0,h=!1,i=0;i<this._mapper.length;i++){if(this._mapper[i][2]!==
0)if(j.overlapMapper(this._mapper[i],0,c,f,g)||j.overlapMapper(this._mapper[i],1,b,e,d))this._renderCurve(i,c,b,this._canvasDiv,a,f,g,e,d),h=!0;else if(h)break;c+=this._mapper[i][0];b+=this._mapper[i][1]}a.stroke()}},_renderCurve:function(a,f,g,e,d){var c=this._mapper[a],f=this._leftTextView.getLinePixel(f+c[0]/2)+c[0]%2*this._leftLineH/3-this._leftTextView.getTopPixel(),g=this._rightTextView.getLinePixel(g+c[1]/2)+c[1]%2*this._rightLineH/3-this._rightTextView.getTopPixel(),e=e.parentNode.clientWidth;
a===this._diffNavigator.getCurrentMapperIndex()?(d.stroke(),d.strokeStyle="#000",d.lineWidth=1,d.beginPath(),d.moveTo(0,f),d.bezierCurveTo(e/3,f,e*0.666,g,e,g),d.stroke(),d.strokeStyle="#AAAAAA",d.lineWidth=1,d.beginPath()):(d.moveTo(0,f),d.bezierCurveTo(e/3,f,e*0.666,g,e,g),d.stroke())},onChanged:function(a){if(a.removedLineCount!==a.addedLineCount)this._initing||j.updateMapper(this._mapper,0,this._leftTextView.getModel().getLineAtOffset(a.start),a.removedLineCount,a.addedLineCount),this._initing=
!1,(a.removedLineCount>0||a.addedLineCount>0)&&this.render()}};return i}();return l});
define("orion/contentTypes",[],function(){function j(a,e){function d(b,a,c,d){var c=a.filename.indexOf(c)>=0,e=a.extension.indexOf(d)>=0;if(c||e)if(!b||c&&b.extension.indexOf(d)>=0)return a;return b}for(var c=a&&a.split(".").pop(),b=null,h=0;h<e.length;h++){var f=e[h];d(b,f,a,c)===f&&(b=f)}return b}function l(g){this.serviceRegistry=g;this.map=function(e){function d(b){return b===null||typeof b==="undefined"?[]:b instanceof Array?b:[b]}for(var e=e.getServiceReferences(a).concat(e.getServiceReferences(f)),
c={},b=0;b<e.length;b++)for(var h=d(e[b].getProperty("contentTypes")),g=0;g<h.length;g++){var i=h[g];c[i.id]||(c[i.id]={id:i.id,name:i.name,image:i.image,"extends":i["extends"],extension:d(i.extension),filename:d(i.filename)})}return c}(g);g.registerService(i,this)}var i="orion.core.contenttypes",a="orion.core.contenttype",f="orion.file.contenttype";l.prototype={getContentTypes:function(){var a=this.getContentTypesMap(),e=[],d;for(d in a)a.hasOwnProperty(d)&&e.push(a[d]);return e},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,e){a=typeof a==="string"?this.getContentType(a):a;e=typeof e==="string"?this.getContentType(e):e;if(!a||!e)return!1;if(a.id===e.id)return!0;else for(var d=a,c={};d&&(d=this.getContentType(d["extends"]));){if(d.id===e.id)return!0;if(c[d.id])throw Error("Cycle: "+d.id);c[d.id]=!0}return!1},
isSomeExtensionOf:function(a,e){for(var d=0;d<e.length;d++)if(this.isExtensionOf(a,e[d]))return!0;return!1}};return{ContentTypeService:l,getFilenameContentType:j}});
define("orion/PageUtil",[],function(){var j=/^http[s]?/i;return{matchResourceParameters:function(j){var j=j||window.location.toString(),i={resource:""},a=j.indexOf("#");if(a!==-1&&(j=j.substring(a+1),j.length!==0)){j=j.split(",");Object.defineProperty(i,"resourceRaw",{value:j[0]});i.resource=decodeURIComponent(j[0]);for(a=1;a<j.length;a++){var f=/([^=]*)(=?)(.*)/.exec(j[a]),g=decodeURIComponent(f[1]||""),f=decodeURIComponent(f[3]||"");g!==""&&g!=="resource"&&(i[g]=f)}}return i},validateURLScheme:function(l,
i){var a=l;if(l.indexOf("://")===-1){var f=document.createElement("a");f.href=l;a=f.href}f=!1;return(f=i?i.some(function(f){return RegExp("^"+f+":","i").test(a)}):j.test(a))?l:(console.log("Illegal URL Scheme: '"+l+"'"),"")}}});
define("orion/commands","i18n!orion/nls/messages,require,orion/uiUtils,orion/PageUtil,orion/webui/littlelib,orion/webui/dropdown,orion/webui/tooltip,orion/explorers/navigationUtils".split(","),function(j,l,i,a,f,g,e,d){function c(b,a,c,d,e){this.commandService=b;this.handler=a;this.items=c;this.userData=d;this.command=e;if(e.parameters)this.parameters=e.parameters.makeCopy();this.id=e.id}function b(b){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};
this._init(b);this._parameterCollector=null}function h(b,a,c){a.classList.add("commandImage");var d;b.imageClass?(d=document.createElement("span"),a.appendChild(d),d.classList.add(b.spriteClass),d.classList.add(b.imageClass)):(d=new Image,d.alt=b.name,d.name=c,d.id=c,d.src=b.image,a.appendChild(d));return d}function m(b){this._init(b)}function o(b,a,c,d,e,h,g){this.keyCode=typeof b==="string"?b.toUpperCase().charCodeAt(0):b;this.mod1=a!==void 0&&a!==null?a:!1;this.mod2=c!==void 0&&c!==null?c:!1;this.mod3=
d!==void 0&&d!==null?d:!1;this.mod4=e!==void 0&&e!==null?e:!1;this.domScope=f.node(h);this.scopeName=g||(h?h.id:null)}function r(b,a){this.token=b;this.parameterName=a}function q(b,a,c,d,e){this.name=b;this.type=a;this.label=c;this.value=d;this.lines=e||1}function k(b,a,c){this._storeParameters(b);this._hasOptionalParameters=a&&a.hasOptionalParameters;this._options=a;this.optionsRequested=!1;this.getParameters=c;this.clientCollect=a&&a.clientCollect}var p=window.navigator.platform.indexOf("Mac")!==
-1;c.prototype={collectsParameters:function(){return this.commandService&&this.commandService.collectsParameters()},makeCopy:function(b){var a=new c(this.commandService,this.handler,this.items,this.userData,this.command);a.domNode=this.domNode;a.domParent=this.domParent;if(b)a.parameters=b.makeCopy();else if(this.parameters)a.parameters=this.parameters.makeCopy();return a}};c.prototype.constructor=c;b.prototype={_init:function(b){this._registry=b.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.page.command",
this);this._defaultSelectionService=b.selection;var a=this;window.document.addEventListener("keydown",function(b){b=b||window.event;if(function(b){if(p){if(b.metaKey&&!b.altKey)return!b.shiftKey&&!b.ctrlKey&&(b.keyCode===65||b.keyCode===67||b.keyCode===86||b.keyCode===88||b.keyCode===90)?!0:!1}else{if(b.ctrlKey&&!b.altKey)return!b.shiftKey&&(b.keyCode===65||b.keyCode===67||b.keyCode===86||b.keyCode===88||b.keyCode===90)?!0:!1;if(b.altKey&&!b.ctrlKey)return!1}if(b["char"])return b["char"].length>0;
else if(b.charCode||b.keyCode)switch(b=b.charCode||b.keyCode,b){case 8:case 9:case 13:case 46:return!0;default:return b>=32&&b<112||b>123}return!1}(b)){if(b.target.contentEditable==="true")return;var c=b.target.nodeName.toLowerCase();if(c==="input")switch(b.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(c===
"textarea")return}a._processKey(b)},!1)},_processKey:function(b){function a(b){window.document.all?b.keyCode=0:(b.preventDefault(),b.stopPropagation())}for(var c in this._activeBindings)if(this._activeBindings[c]&&this._activeBindings[c].keyBinding&&this._activeBindings[c].command&&this._activeBindings[c].keyBinding.match(b)){var d=this._activeBindings[c],e=d.invocation;if(e)if(d=d.command,d.hrefCallback){a(b);b=d.hrefCallback.call(e.handler||window,e);b.then?b.then(function(b){window.open(b)}):window.open(b);
break}else if(d.callback){a(b);var h=this;window.setTimeout(function(){h._invoke(e)},0);break}}},processURL:function(b){for(var a in this._urlBindings)if(this._urlBindings[a]&&this._urlBindings[a].urlBinding&&this._urlBindings[a].command){var c=this._urlBindings[a].urlBinding.match(b);if(c){var d=this._urlBindings[a],e=d.command,h=d.invocation;if(h&&h.parameters&&e.callback){h.parameters.setValue(c.parameterName,c.parameterValue);var f=this;window.setTimeout(function(){f._invoke(h)},0);break}}}},
findCommand:function(b){return this._commandList[b]},runCommand:function(b,a,d,e){a?(b=this._commandList[b])&&(b.visibleWhen?b.visibleWhen(a):1)&&b.callback&&this._invoke(new c(this,d,a,null,b),e):(a=this._urlBindings[b])&&a.command&&a.command.callback&&this._invoke(a.invocation,e)},getSelectionService:function(){return this._defaultSelectionService},setParameterCollector:function(b){this._parameterCollector=b},openParameterCollector:function(b,a,c){this._parameterCollector&&(this._parameterCollector.close(),
this._parameterCollector.open(b,a,c))},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(b,a){return this._collectAndInvoke(b.makeCopy(a),!1)},_collectAndInvoke:function(b,a){if(b)if(this._parameterCollector&&b.parameters&&b.parameters.hasParameters()&&(a||b.parameters.shouldCollectParameters())){var c=!1;b.parameters.updateParameters(b);c=this._parameterCollector.collectParameters(b);
if(!c){var d=new e.Tooltip({node:b.domNode,trigger:"click",position:["below","right","above","left"]}),c=d.contentContainer();c.classList.add("parameterPopup");var h=window.document.activeElement,f=this._parameterCollector.getFillFunction(b,function(){h&&h.focus();d.destroy()})(c);d.show();window.setTimeout(function(){f.focus();f.select()},0);c=!0}c||b.command.callback.call(b.handler||window,b)}else b.command.callback.call(b.handler||window,b);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},
collectParameters:function(b){this._collectAndInvoke(b,!0)},showKeyBindings:function(b){var a={},c,d,e,h;for(h in this._activeBindings)if((d=this._activeBindings[h])&&d.keyBinding&&d.command)d.keyBinding.scopeName?(a[d.keyBinding.scopeName]||(a[d.keyBinding.scopeName]=[]),a[d.keyBinding.scopeName].push(d)):(c=i.getUserKeyString(d.keyBinding),e=document.createElement("span"),e.role="listitem",e.appendChild(document.createTextNode(c+" = "+d.command.name)),e.appendChild(document.createElement("br")),
b.appendChild(e));for(var f in a)if(a[f].length&&a[f].length>0){c=document.createElement("h2");b.appendChild(c);c.appendChild(document.createTextNode(f));for(h=0;h<a[f].length;h++)d=a[f][h],c=i.getUserKeyString(d.keyBinding),e=document.createElement("span"),e.role="listitem",e.appendChild(document.createTextNode(c+" = "+d.command.name)),e.appendChild(document.createElement("br")),b.appendChild(e)}},addCommand:function(b){this._commandList[b.id]=b},addCommandGroup:function(b,a,c,d,e,h){this._contributionsByScopeId[b]||
(this._contributionsByScopeId[b]={});b=this._contributionsByScopeId[b];e&&(b=this._createEntryForPath(b,e));if(b[a]){if(d)b[a].title=d;if(c)b[a].position=c;b[a].emptyGroupMessage=h}else b[a]={title:d,position:c,emptyGroupMessage:h,children:{}},b.sortedContributions=null},_createEntryForPath:function(b,a){if(a)for(var c=a.split("/"),d=0;d<c.length;d++)if(c[d].length>1)b[c[d]]||(b[c[d]]={position:0,children:{}}),b=b[c[d]].children;return b},registerSelectionService:function(b,a){this._contributionsByScopeId[b]||
(this._contributionsByScopeId[b]={});this._contributionsByScopeId[b].localSelectionService=a},registerCommandContribution:function(b,a,c,d,e,h,f){this._contributionsByScopeId[b]||(this._contributionsByScopeId[b]={});b=this._contributionsByScopeId[b];d&&(b=this._createEntryForPath(b,d));b[a]={position:c};h&&(c=this._commandList[a])&&(this._activeBindings[a]={command:c,keyBinding:h,bindingOnly:e});f&&(c=this._commandList[a])&&(this._urlBindings[a]={command:c,urlBinding:f,bindingOnly:e});b.sortedContributions=
null},_checkForTrailingSeparator:function(b,a,c){var d;if(a==="tool"||a==="button")if((d=b.childNodes.length>0?b.childNodes[b.childNodes.length-1]:null)&&d.classList.contains("commandSeparator"))return c?(b.removeChild(d),!1):!0;if(a==="menu"&&(b=f.$$array("li > *",b),b.length>0&&b[b.length-1].classList.contains("dropdownSeparator")))if(d=b[b.length-1],c)d.parentNode.parentNode.removeChild(d.parentNode);else return!0;return!1},renderCommands:function(b,a,c,d,e,h,g){if(typeof b!=="string")throw"a scope id for rendering must be specified";
a=f.node(a);if(!a)throw"no parent";var i=this._contributionsByScopeId[b];if(!c&&i){var c=i.localSelectionService||this._defaultSelectionService,j=this;c&&c.getSelections(function(c){j.renderCommands(b,a,c,d,e,h)})}else i&&(this._render(this._contributionsByScopeId[b],a,c,d,e||"button",h,g),this._checkForTrailingSeparator(a,e,!0))},destroy:function(b){b=f.node(b);if(!b)throw"no parent";for(;b.hasChildNodes();){var a=b.firstChild;a.commandTooltip&&a.commandTooltip.destroy();a.emptyGroupTooltip&&a.emptyGroupTooltip.destroy();
this.destroy(a);b.removeChild(a)}},_render:function(b,a,h,f,g,i,j){var m=b.sortedContributions;if(!m){var m=[],k=!1,l;for(l in b)if(!b.hasOwnProperty||b.hasOwnProperty(l)){var o=b[l];if(o&&typeof o.position==="number")o.id=l,m.push(o),k=!0}if(k)m.sort(function(b,a){return b.position-a.position}),b.sortedContributions=m}for(b=0;b<m.length;b++){var p;if(m[b].children&&Object.getOwnPropertyNames(m[b].children).length>0){var o=m[b],k=m[b].children,r=this,q;if(g==="tool"||g==="button")if(o.title){q=this._createDropdownMenu(a,
o.title);j&&d.generateNavGrid(j,q.menuButton);var E=k,G=o;window.setTimeout(function(){r._render(E,q.menu,h,f,"menu",i,j);r._checkForTrailingSeparator(q.menu,"menu",!0);if(q.menu.childNodes.length===0)if(G.emptyGroupMessage){if(!q.menuButton.emptyGroupTooltip)q.menuButton.emptyGroupTooltip=new e.Tooltip({node:q.menuButton,text:G.emptyGroupMessage,trigger:"click",position:["below","right","above","left"]})}else j&&d.removeNavGrid(j,q.menuButton),q.menu.parentNode&&q.menu.parentNode.removeChild(q.menu),
q.destroyButton&&q.destroyButton.parentNode&&q.destroyButton.parentNode.removeChild(q.destroyButton);else q.menuButton.style.visibility="visible"},0)}else{var C;a.childNodes.length>0&&!this._checkForTrailingSeparator(a,g)&&(C=this.generateSeparatorImage(a));r._render(k,a,h,f,g,i,j);a.childNodes.length>0&&a.childNodes[a.childNodes.length-1]!==C&&(C=this.generateSeparatorImage(a))}else o.title?(l=document.createElement("li"),a.appendChild(l),o=this._createDropdownMenu(l,o.title,!0),r._render(k,o.menu,
h,f,"menu",i,j),o.menu.childNodes.length===0&&a.removeChild(l)):(a.childNodes.length>0&&this._generateMenuSeparator(a),r._render(k,a,h,f,g,i,j),this._generateMenuSeparator(a))}else{l=(k=this._commandList[m[b].id])?!0:!1;var I=null,I=null;if(k){p=new c(this,f,h,i,k);p.domParent=a;o=l&&(k.visibleWhen?k.visibleWhen(h):!0);if(this._activeBindings[k.id]&&this._activeBindings[k.id].keyBinding)I=this._activeBindings[k.id],I.invocation=o?p:null,I.bindingOnly&&(l=!1);if(this._urlBindings[k.id]&&this._urlBindings[k.id].urlBinding)I=
this._urlBindings[k.id],I.invocation=o?p:null,I.bindingOnly&&(l=!1);l=l&&o}if(l)if(k.choiceCallback){g==="tool"||g==="button"?(l=a,o=!1,a.nodeName.toLowerCase()==="ul"&&(l=document.createElement("li"),a.appendChild(l))):(l=a,o=!0);var L=this;this._createDropdownMenu(l,k.name,o,function(b){this.populateChoicesMenu(b,h,f,i,L)}.bind(k))}else g==="tool"?(l="tool"+k.id+b,k._addTool(a,l,p,j)):g==="button"?(l="button"+k.id+b,k._addButton(a,l,p,j)):g==="menu"&&k._addMenuItem(a,p,j)}}},_createDropdownMenu:function(b,
a,c,d){var b=f.node(b),e,h=document.createElement("span");h.classList.add("dropdownTrigger");c?(h.classList.add("dropdownMenuItem"),e="dropdownSubMenu",c="dropdownArrowRight",h.tabIndex=0,h.role="menuitem"):(h.classList.add("commandButton"),c="dropdownArrowDown",h.tabIndex=0,h.role="button");a=document.createTextNode(a);h.appendChild(a);a=document.createElement("span");a.classList.add(c);h.appendChild(a);c=b;b.nodeName.toLowerCase()==="ul"?(c=document.createElement("li"),b.appendChild(c),b=c):(h.classList.add("commandMargins"),
b=h);c.appendChild(h);e&&c.classList.add(e);e=document.createElement("ul");c.appendChild(e);e.classList.add("dropdownMenu");h.dropdown=new g.Dropdown({dropdown:e,populate:d});e.dropdown=h.dropdown;return{menuButton:h,menu:e,dropdown:h.dropdown,destroyButton:b}},_generateCheckedMenuItem:function(b,a,c,d){var e=document.createElement("li");b.appendChild(e);b=document.createElement("label");b.classList.add("dropdownMenuItem");var h=document.createElement("input");h.type="checkbox";h.role="menuitem";
h.checked=c;h.classList.add("checkedMenuItem");b.appendChild(h);a=document.createTextNode(a);b.appendChild(a);e.appendChild(b);h.addEventListener("change",d,!1)},_generateMenuSeparator:function(b){if(!this._checkForTrailingSeparator(b,"menu")){var a=document.createElement("li");a.classList.add("dropdownSeparator");var c=document.createElement("span");c.classList.add("dropdownSeparator");a.appendChild(c);b.appendChild(a)}},generateSeparatorImage:function(b){var a;a=b.nodeName.toLowerCase()==="ul"?
document.createElement("li"):document.createElement("span");b.appendChild(a);a.classList.add("core-sprite-sep");a.classList.add("imageSprite");a.classList.add("commandSeparator");return a}};b.prototype.constructor=b;m.prototype={_init:function(b){this.id=b.id;this.name=b.name;this.tooltip=b.tooltip||b.name;this.callback=b.callback;this.hrefCallback=b.hrefCallback;this.choiceCallback=b.choiceCallback;this.image=b.image||l.toUrl("images/none.png");this.imageClass=b.imageClass;this.spriteClass=b.spriteClass||
"commandSprite";this.visibleWhen=b.visibleWhen;this.parameters=b.parameters},_addTool:function(b,a,c,f){c.handler=c.handler||this;var g;if(this.hrefCallback){if(g=this._makeLink(b,c,"commandLink"),!g)return}else g=document.createElement("span"),g.tabIndex=f?-1:0,g.role="button",this.hasImage()?(h(this,g,a),this.name&&g.setAttribute("aria-label",this.name)):(a=window.document.createTextNode(this.name),g.appendChild(a),g.classList.add("commandMissingImageButton"),g.classList.add("commandButton")),this._hookCallback(g,
c);c.domNode=g;c.domParent=b;if(this.tooltip)g.commandTooltip=new e.Tooltip({node:g,text:this.tooltip,position:["above","below","right","left"]});b.nodeName.toLowerCase()==="ul"?(a=document.createElement("li"),b.appendChild(a),b=a):g.classList.add("commandMargins");b.appendChild(g);d.generateNavGrid(f,c.domNode)},_addButton:function(b,a,c,f){c.handler=c.handler||this;var g;if(this.hrefCallback)g=this._makeLink(b,c,"commandLink");else if(!this.name&&this.hasImage()){if(g=document.createElement("span"),
g.tabIndex=0,g.role="button",h(this,g,a),this.tooltip&&g.setAttribute("aria-label",this.tooltip),this._hookCallback(g,c),this.tooltip)g.commandTooltip=new e.Tooltip({node:g,text:this.tooltip,position:["above","below","right","left"]})}else g=this._makeButton(b,c,"commandButton"),this._hookCallback(g,c);c.domParent=b;b.nodeName.toLowerCase()==="ul"?(a=document.createElement("li"),b.appendChild(a),b=a):g.classList.add("commandMargins");b.appendChild(g);d.generateNavGrid(f,c.domNode)},_addMenuItem:function(b,
a,c){a.domParent=b;var e,h=b.dropdown;this.hrefCallback?e=this._makeLink(b,a,"dropdownMenuItem",["right","left","above","below"]):(e=this._makeButton(b,a,"dropdownMenuItem",["right","left","above","below"]),this.callback&&this._hookCallback(e,a,function(){h.close(!0)}));e.role="menuitem";d.generateNavGrid(c,a.domNode);b.nodeName.toLowerCase()==="ul"?(a=document.createElement("li"),b.appendChild(a),b=a):e.classList.add("commandMargins");b.appendChild(e)},_makeButton:function(b,a,c,d){b=document.createElement("span");
b.role="button";b.tabIndex=0;b.id=this.name;var h=document.createTextNode(this.name);b.appendChild(h);c&&b.classList.add(c);if(this.tooltip)b.commandTooltip=new e.Tooltip({node:b,text:this.tooltip,position:d||["above","below","right","left"]});return a.domNode=b},_makeLink:function(b,a,c,d){var h=document.createElement("a");h.id=this.name;c&&h.classList.add(c);h.appendChild(document.createTextNode(this.name));if(this.hrefCallback)b=this.hrefCallback.call(a.handler,a),b.then?b.then(function(b){h.href=
b}):h.href=b?b:"#";if(this.tooltip)h.commandTooltip=new e.Tooltip({node:h,text:this.tooltip,position:d||["above","below","right","left"]});return a.domNode=h},_hookCallback:function(b,a,c,d){b.addEventListener("click",function(b){c&&c();a.commandService._invoke(a);d&&d();f.stop(b)},!1);b.addEventListener("keydown",function(b){if(b.keyCode===f.KEY.ENTER||b.keyCode===f.KEY.SPACE)c&&c(),a.commandService._invoke(a),d&&d(),f.stop(b)},!1)},populateChoicesMenu:function(b,a,c,d,e){c=this.getChoices(a,c,d);
for(d=0;d<c.length;d++){var h=c[d];if(h.name){var g=document.createElement("li");b.appendChild(g);var i=document.createElement("span");i.tabIndex=0;i.role="menuitem";i.classList.add("dropdownMenuItem");var j=document.createTextNode(h.name);i.appendChild(j);g.appendChild(i);i.choice=h;i.addEventListener("click",function(b){b.target.choice&&b.target.choice.callback.call(b.target.choice,a)},!1);i.addEventListener("keydown",function(b){(b.keyCode===f.KEY.ENTER||b.keyCode===f.KEY.SPACE)&&b.target.choice&&
b.target.choice.callback.call(b.target.choice,a)},!1)}else e._generateMenuSeparator(b)}},getChoices:function(b,a,c){return this.choiceCallback?this.choiceCallback.call(a,b,c):null},makeChoiceCallback:function(b,a){return function(c){b.callback&&b.callback.call(b,a,c)}},hasImage:function(){return this.imageClass||this.image!==l.toUrl("images/none.png")}};m.prototype.constructor=m;o.prototype={match:function(b){if(this.keyCode===b.keyCode){if(this.mod1!==(p?b.metaKey:b.ctrlKey))return!1;if(this.mod2!==
b.shiftKey)return!1;if(this.mod3!==b.altKey)return!1;if(p&&this.mod4!==b.ctrlKey)return!1;if(!this.domScope)return!0;for(b=b.target;b;){if(b===window.document)break;if(b===this.domScope)return!0;b=b.parentNode}}return!1},equals:function(b){return!b?!1:this.keyCode!==b.keyCode?!1:this.mod1!==b.mod1?!1:this.mod2!==b.mod2?!1:this.mod3!==b.mod3?!1:this.mod4!==b.mod4?!1:this.domScope!==b.domScope?!1:!0}};o.prototype.constructor=o;r.prototype={match:function(b){b=a.matchResourceParameters(b);return typeof b[this.token]!==
"undefined"?(this.parameterValue=b[this.token],this):null}};r.prototype.constructor=r;q.prototype={optionsRequested:function(){return this.optionsRequested}};q.prototype.constructor=q;k.prototype={_storeParameters:function(b){this.parameterTable=null;if(b){this.parameterTable={};for(var a=0;a<b.length;a++)this.parameterTable[b[a].name]=b[a]}},updateParameters:function(b){typeof this.getParameters==="function"&&this._storeParameters(this.getParameters(b))},hasParameters:function(){return this.parameterTable!==
null},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(b){return this.parameterTable[b]},valueFor:function(b){return(b=this.parameterTable[b])?b.value:null},setValue:function(b,a){var c=this.parameterTable[b];if(c)c.value=a},forEach:function(b){for(var a in this.parameterTable)this.parameterTable[a].type&&this.parameterTable[a].name&&b(this.parameterTable[a])},makeCopy:function(){var b=[];this.forEach(function(a){a=new q(a.name,a.type,a.label,
a.value,a.lines);b.push(a)});var a=new k(b,this._options,this.getParameters);a.clientCollect=this.clientCollect;return a},hasOptionalParameters:function(){return this._hasOptionalParameters}};k.prototype.constructor=k;return{CommandService:b,CommandKeyBinding:o,Command:m,CommandInvocation:c,URLBinding:r,ParametersDescription:k,CommandParameter:q}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(j,l,i,a){var f={};(function(){var g=!1;f.updateNavTools=function(a,d,c,b,h){var f=a.getService("orion.page.command"),l=i.node(c);if(l)f.destroy(l);else throw j["could not find toolbar "]+c;f.renderCommands(c,l,h,d,"button");if(b&&(c=i.node(b)))f.destroy(c),f.renderCommands(b,c,null,d,"button");g||(g=!0,a.getService("orion.page.selection").addEventListener("selectionChanged",
function(c){var h=i.node(b);if(h){var f=a.getService("orion.page.command");f.destroy(h);f.renderCommands(b,h,c.selections,d,"button")}}))};f.createOperationsCommands=function(e,d,c){function b(b){return!b.operation||!b.operation.type?!1:b.operation.type==="loadstart"||b.operation.type==="progress"}var h=new a.Command({name:j["Remove Completed"],tooltip:j["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(){c.removeCompletedOperations().then(function(){d.loadOperations.bind(d)()})},
visibleWhen:function(){return!0}});e.addCommand(h);h=new a.Command({name:j.Remove,tooltip:j["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(b){for(var b=Array.isArray(b.items)?b.items:[b.items],a=0;a<b.length;a++){var e=b[a];c.removeOperation.bind(c)(e.Location).then(function(){d.loadOperations.bind(d)()},function(){d.loadOperations.bind(d)()})}},visibleWhen:function(a){if(!Array.isArray(a)||a.length===0)return!b(a);for(var c in a)if(b(a[c]))return!1;
return!0}});e.addCommand(h);h=new a.Command({name:j.Cancel,tooltip:j["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(b){for(var b=Array.isArray(b.items)?b.items:[b.items],a=0;a<b.length;a++){var c=b[a];c.deferred&&c.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||a.length===0)return b(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var c in a)if(!b(a[c])||!a[c].operation||!a[c].operation.cancelable)return!1;
return!0}});e.addCommand(h)}})();return f});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(j,l,i,a,f){function g(a){this._options=a}g.prototype=new a.PopupDialog;g.prototype.TEMPLATE='<table style="width: 360px;"><tr><td><h2>Recent operations</h2></td><td style="text-align: right;"><a id="allOperationsLink">All Operations</a></td></tr></table><span id="operationsExist"><span class="secondaryColumn" id="myOperationsListEmpty">No operations running on this page.</span><table id="myOperationsList" style="display: none;"></table></span><span class="secondaryColumn" id="operationsDontExist">No operations running.</span>';g.prototype._init=
function(a){this._myOperations=[];this._operationsDeferreds=[];this._commandService=a.serviceRegistry.getService("orion.page.command");f.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(a.triggerNode)};g.prototype._bindToDom=function(){this.$allOperationsLink.href=l.toUrl("operations/list.html");this._setOperationsVisibility()};g.prototype.setOperations=function(a,d){this._myOperations||
this._init(this._options);this._myOperations=[];this._operationsDeferreds=[];if(a)for(var c in a)this._myOperations.push(a[c]),this._operationsDeferreds.push(d[c]);this._renderOperations()};g.prototype.parseProgressResult=function(a){if(!a)return{};a=a.responseText||a;try{a=JSON.parse(a)}catch(d){}var c={Message:a.Message||a,Severity:a.Severity};if(a.DetailedMessage&&a.DetailedMessage!==c.Message)c.DetailedMessage=a.DetailedMessage;return c};g.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};g.prototype._renderOperationsTable=function(a,d,c){i.empty(a);for(var b=0;b<d.length;b++){var h=d[b],f=document.createElement("tr"),g=document.createElement("td");g.style.paddingLeft="5px;";g.style.paddingRight="5px;";g.textContent=h.Name;f.appendChild(g);var l=document.createElement("div");g.appendChild(l);g=document.createElement("span");l.appendChild(g);g.classList.add("imageSprite");var q=document.createElement("span");q.classList.add("primaryColumn");
l.appendChild(q);q.appendChild(document.createTextNode(h.Name));switch(h.type){case "Warning":g.classList.add("core-sprite-warning");g.setAttribute("aria-label",j["Operation resulted in a warning."]);break;case "error":g.classList.add("core-sprite-error");g.setAttribute("aria-label",j["Operation resulted in an error."]);break;case "loadstart":case "progress":g.classList.add("core-sprite-start");g.setAttribute("aria-label",j["Operation is running."]);break;case "abort":g.classList.add("core-sprite-stop");
g.setAttribute("aria-label",j["Operation is canceled."]);break;case "load":case "loadend":g.classList.add("core-sprite-ok"),g.setAttribute("aria-label","Operation ok.")}if(h.error)g=h.error.Message||h.error,h.error.DetailedMessage&&h.error.DetailedMessage!==""&&(g+=": "+h.error.DetailedMessage),l.appendChild(document.createElement("br")),q=document.createElement("span"),q.classList.add("secondaryColumn"),q.style.marginLeft="18px;",l.appendChild(q),q.textContent=g;g=document.createElement("span");
l.appendChild(g);this._commandService.renderCommands("operationsDialogItems",l,{operation:h,deferred:c[b]},this,"tool");a.appendChild(f)}this._setOperationsVisibility()};g.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"};g.prototype.constructor=g;return{OperationsDialog:g}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(j,l,i,a,f){function g(d,c){if(!this._progressPane){this._progressPane=a.node(d);this._operationsDialog=new f.OperationsDialog({triggerNode:this._progressPane,serviceRegistry:c});var b=this;this._progressPane.addEventListener("keydown",function(c){(c.charOrCode===" "||c.keyCode===a.KEY.ENTER)&&b._operationsDialog.show()})}}function e(a,c,b){this._serviceRegistry=
a;this._serviceRegistration=a.registerService("orion.page.progress",this);this._operationsClient=c;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=b}g.prototype={_switchIconTo:function(a){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);this._lastIconClass=a;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(a,c){var b={},e;for(e in a)a[e].progressMonitor||
(b[e]=a[e]);if(this._isEmpty(b))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(e in b){var g=b[e];if(g.type&&(g.type==="loadstart"||g.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(b,c)},_isEmpty:function(a){for(var c in a)return!1;return!0}};g.prototype.constructon=g;e.prototype=
{init:function(a){if(!this._progressMonitorClass)this._progressMonitorTool=new g(a,this._serviceRegistry)},progress:function(a,c,b){var e=this,f=this._operationsIndex++;!b&&this._progressMonitorClass&&(b=new this._progressMonitorClass,b.begin(c));a.then(function(){if(e._operations[f]){var g=e._operations[f];if(c)g.Name=c;e._lastOperation=g;g.type="loadend";if(b)g.progressMonitor=b;e.writeOperation.bind(e)(f,g,a);g.Location||e._removeOperationFromTheList.bind(e)(f)}},function(g){if(e._operations[f]){var i=
e._operations[f];if(c)i.Name=c;if(b)i.progressMonitor=b;e._lastOperation=i;i.type=g.canceled?"abort":"error";i.error=g;e.writeOperation.bind(e)(f,i,a);i.Location||e._removeOperationFromTheList.bind(e)(f)}},function(g){if(c)g.Name=c;if(b)g.progressMonitor=b;e.writeOperation.bind(e)(f,g,a)});return a},removeOperation:function(a){for(var c in this._operations)if(this._operations[c].Location&&this._operations[c].Location===a){this._removeOperationFromTheList(c);break}this._operationsClient.removeOperation.bind(this._operationsClient)(a)},
_removeOperationFromTheList:function(a){var c=this._operations[a].progressMonitor;delete this._operations[a];delete this._operationDeferrds[a];c?c.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},removeCompletedOperations:function(){for(var a in this._operations){var c=this._operations[a];if(c.type&&c.type!=="loadstart"&&c.type!=="progress")(c=this._operations[a].progressMonitor)&&c.done(),delete this._operations[a],delete this._operationDeferrds[a]}this._progressMonitorTool.generateOperationsInfo(operations,
this._operationDeferrds)},setProgressResult:function(a){this._serviceRegistry.getService("orion.page.message").setProgressResult(a)},showWhile:function(a,c){c&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(c);var b=this;a.then(function(){b._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){b.setProgressResult.bind(b)(a);return a});return this.progress(a,c)},writeOperation:function(a,c,b){this._operations[a]=c;this._operationDeferrds[a]=
b;c.Location&&serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(b){b.put(c.Location,{Name:c.Name,expires:c.expires})});c.progressMonitor?c.progressMonitor.progress(c.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};e.prototype.constructor=e;return{ProgressService:e}});
define("orion/extensionCommands","require,orion/Deferred,orion/commands,orion/editor/regex,orion/contentTypes,orion/URITemplate,orion/i18nUtil,orion/URL-shim".split(","),function(j,l,i,a,f,g,e){var d={},c=(new URL(j.toUrl("."),window.location)).href.slice(0,-1);d._cloneItemWithoutChildren=function h(a){if(a===null||typeof a!=="object")return a;var c=a.constructor(),d;for(d in a)d!=="children"&&d!=="Children"&&(c[d]=h(a[d]));return c};d._createOpenWithCommands=function(a){function c(a,d){for(var e=
a.getServiceReferences("orion.navigate.openWith"),h=[],f=0;f<e.length;f++){var g=e[f];g.getProperty("editor")===d.id&&(g=g.getProperty("contentType"),g instanceof Array?h=h.concat(g):g!==null&&typeof g!=="undefined"&&h.push(g))}return h}for(var d=function(){for(var c=a.getServiceReferences("orion.edit.editor"),d=[],e=0;e<c.length;e++){var f=c[e],g=f.getProperty("id");d.push({id:g,name:f.getProperty("name"),nameKey:f.getProperty("nameKey"),nls:f.getProperty("nls"),uriTemplate:f.getProperty("orionTemplate")||
f.getProperty("uriTemplate")})}return d}(),e=function(a){for(a=a.getServiceReferences("orion.navigate.openWith.default");0<a.length;)return{editor:a[0].getProperty("editor")};return null}(a),f=[],g=0;g<d.length;g++){var i=d[g],j=e&&e.editor===i.id,l=c(a,i);l.length&&f.push({properties:{name:i.name||i.id,nameKey:i.nameKey,id:"eclipse.openWithCommand."+i.id,tooltip:i.name,tooltipKey:i.nameKey,contentType:l,uriTemplate:i.uriTemplate,nls:i.nls,forceSingleItem:!0,isEditor:j?"default":"editor"},service:{}})}return f};
d._makeValidator=function(a,d,e,i){function j(a,c,d,e){var h=d.match,f;if(c.indexOf("|")>=0)return f=c.substring(0,c.indexOf("|")),c=c.substring(c.indexOf("|")+1),j(a,f,d,e)?!0:j(a,c,d,e);else if(c.indexOf(":")>=0)return f=c.substring(0,c.indexOf(":")),c=c.substring(c.indexOf(":")+1),a[f]?j(a[f],c,d,e):!1;else{a:{f=!1;var g;if(a[c]){if(h)if(typeof h==="string"){if(!typeof(a[c]==="string")){d=!1;break a}if(d.variableName){if(h=RegExp(h).exec(a[c]))f=h[0],g=d.variableMatchPosition==="before"?a[c].substring(0,
h.index):d.variableMatchPosition==="after"?a[c].substring(h.index+f.length):d.variableMatchPosition==="only"?f:a[c],f=!0}else{d=RegExp(h).test(a[c]);break a}}else a[c]===h&&(g=a[c],f=!0);else g=a[c],f=!0;if(f&&d.variableName&&(e[d.variableName]=g,e.itemCached=a,d.replacements))for(a=0;a<d.replacements.length;a++)c=!1,d.replacements[a].pattern?e[d.variableName]=e[d.variableName].replace(RegExp(d.replacements[a].pattern),d.replacements[a].replacement||""):c=!0,c&&window.console.log("Invalid replacements specified in validation property.  "+
d.replacements[a]);d=f}else d=!1}return d}}return{info:a,validationFunction:function(c){typeof i==="function"&&(c=i.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 d=0;d<c.length;d++){var g;a:{var m=c[d],l=e;if(this.info.validationProperties)for(g=0;g<this.info.validationProperties.length;g++){var w=this.info.validationProperties[g];if(w.source){if(!j(m,w.source,w,this)){g=!1;break a}}else{window.console.log("Invalid validationProperties in "+
a.id+".  No source property specified.");g=!1;break a}}if(this.info.contentType&&l){w=!1;if(m=f.getFilenameContentType(m.Name,l))for(g=0;g<this.info.contentType.length;g++)if(m.id===this.info.contentType[g]){w=!0;break}g=w}else g=!0}if(!g)return!1}return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var d={},e;for(e in a)a.hasOwnProperty(e)&&(d[e]=a[e]);if(this.info.validationProperties)for(e=0;e<this.info.validationProperties.length;e++){var h=
this.info.validationProperties[e];h.source&&h.variableName&&(this.itemCached===a&&this[h.variableName]||j(a,h.source,h,this),a[h.variableName]?window.console.log("Variable name "+h.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):d[h.variableName]=this[h.variableName])}d.OrionHome=c;a=new g(this.info.uriTemplate);return window.decodeURIComponent(a.expand(d))}return null}}};d._createCommandOptions=function(a,c,f,g,i,j){function p(e,l){var n=
d._makeValidator(a,f,g,j);e.visibleWhen=n.validationFunction.bind(n);if(i)if(n.generatesURI.bind(n)())e.hrefCallback=function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return n.getURI.bind(n)(a)};else{var p=a;e.callback=function(a){var h;if(p.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,h=d._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){h=[];for(var g=0;g<a.items.length;g++)h.push(d._cloneItemWithoutChildren(a.items[g]))}else h=d._cloneItemWithoutChildren(a.items);
if(f)var i=f.getService("orion.page.progress");c.run?i?i.progress(c.run(h),"Running command: "+e.name):c.run(h):f&&(i?i.progress(f.getService(c).run(h),"Running command: "+e.name):f.getService(c).run(h))}}l.resolve(e)}var n=new l;a.nls?e.getMessageBundle(a.nls).then(function(c){p({name:a.nameKey?c[a.nameKey]:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltipKey?c[a.tooltipKey]:a.tooltip,isEditor:a.isEditor},n)}):p({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor},
n);return n};d.getOpenWithCommands=function(a){var c=[],d;for(d in a._commandList){var e=a._commandList[d];e.isEditor&&c.push(e)}return c};return d});
define("orion/searchUtils","i18n!orion/nls/messages,require,orion/editor/regex,orion/commands,orion/PageUtil,orion/URITemplate".split(","),function(j,l,i,a,f,g){function e(a,b,d){var e="";d&&(e="^");if(e=i.parse("/"+e+a.searchStr+"/"))d=e.pattern,e=e.flags,e.indexOf("i")===-1&&!b.caseSensitive&&(e+="i"),a.regExp={pattern:d,flags:e},a.wildCard=!0}var d=d||{};d.searchUtils=d.searchUtils||{};d.searchUtils.ALL_FILE_TYPE="*.*";d.searchUtils.doSearch=function(a,b,e,f){if(a){var g=!0;e==="*"&&(e="");e===
""&&(g=f&&f.type!==d.searchUtils.ALL_FILE_TYPE);if(g){e!==""&&d.searchUtils.addRecentSearch(b,e,f?f.regEx:!1);var a=a.createSearchParams(e,!1,!1,f),i=d.searchUtils.generateSearchHref(a);d.searchUtils.getOpenSearchPref(b,function(b){b?window.open(i):window.location=i})}}else window.alert(j["Can't search: no search service is available"])};d.searchUtils.generateSearchHelper=function(a,b){var h=a.keyword,f=h,g={};a.fileType&&a.fileType!==d.searchUtils.ALL_FILE_TYPE&&h===""&&(f="*."+a.fileType);if(a.regEx)g.searchStr=
h,e(g,a,b);else{var i=h.indexOf("*")>-1,j=h.indexOf("?")>-1;i&&(h=h.split("*").join(".*"));j&&(h=h.split("?").join("."));!i&&!j&&!a.nameSearch?(g.searchStr=a.caseSensitive?h.split("\\").join(""):h.split("\\").join("").toLowerCase(),g.wildCard=!1):(g.searchStr=a.caseSensitive?h:h.toLowerCase(),e(g,a,b),g.wildCard=!0)}g.searchStrLength=g.searchStr.length;return{params:a,inFileQuery:g,displayedSearchTerm:f}};d.searchUtils.convertSearchParams=function(a){if(a.rows!==void 0)a.rows=parseInt(a.rows);if(a.start!==
void 0)a.start=parseInt(a.start);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"};d.searchUtils.copySearchParams=function(a,b){var d={},e;for(e in a)if(a[e]!==void 0&&a[e]!==null&&(b||e!=="replace"))d[e]=a[e];return d};d.searchUtils.generateSearchHref=function(a){var b=l.toUrl("search/search.html"),a=d.searchUtils.copySearchParams(a,
!0),e=a.resource;a.resource=void 0;return(new g(b+"#{,resource,params*}")).expand({resource:e,params:a})};d.searchUtils.generateFindURLBinding=function(a,b,d,e){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 d==="number"?d:void 0};return","+(new g("{,params*}")).expand({params:a})};d.searchUtils.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)};d.searchUtils.replaceRegEx=function(a,b,d){return a.replace(RegExp(b.pattern,b.flags),d)};d.searchUtils.replaceStringLiteral=function(a,b,e){b=i.parse("/"+b+"/gim");return d.searchUtils.replaceRegEx(a,b,e)};d.searchUtils.searchOnelineLiteral=function(a,b,d){var e;e=0;for(var f=!1,g=[];;)if(e=b.indexOf(a.searchStr,e),e<0)break;else{g.push({startIndex:e,length:a.searchStrLength});
f=!0;if(d)break;e+=a.searchStrLength}return f?g:null};d.searchUtils.findRegExp=function(a,b,d,e){if(!b)return null;d=d||"";d+=(d.indexOf("g")===-1?"g":"")+(d.indexOf("m")===-1?"m":"");var f=null;return(f=RegExp(b,d).exec(a.substring(e)))&&{startIndex:f.index+e,length:f[0].length}};d.searchUtils.searchOnelineRegEx=function(a,b,e){for(var f=0,g=!1,i=[];;)if(f=d.searchUtils.findRegExp(b,a.regExp.pattern,a.regExp.flags,f)){i.push(f);g=!0;if(e)break;f=f.startIndex+f.length}else break;return g?i:null};
d.searchUtils.generateNewContents=function(a,b,e,f,g,i){if(f&&b){if(!a)e.contents=[];for(var j=0;j<b.length;j++){for(var k=b[j],l=!1,n=!1,u=[],s,w=0,v=0;v<f.children.length;v++)if(f.children[v].lineNumber-1===j){w=v;for(l=0;l<f.children[v].matches.length;l++)f.children[v+l].checked!==!1&&u.push(l);n=u.length>0;s=f.children[v].matches;l=!0;break}if(l){if(n){u=d.searchUtils.replaceCheckedMatches(k,g,s,u,i);k=u.replacedStr;for(l=0;l<f.children[w].matches.length;l++)f.children[w+l].newMatches=u.newMatches}else for(l=
0;l<f.children[w].matches.length;l++)f.children[w+l].newMatches=f.children[w+l].matches;a?e.contents[j]=k:e.contents.push(k)}else a||e.contents.push(k)}}};d.searchUtils.generateMatchContext=function(a,b,d){var e=[],f=a*2+1,g;b.length<=f?(g=0,a=b.length-1):(g=d-a,g<0?(g=0,a=g+f-1):(a=d+a,a>b.length-1&&(a=b.length-1,g=a-f+1)));for(f=g;f<=a;f++)e.push({context:b[f],current:f===d});return e};d.searchUtils.splitFile=function(a){for(var b=0,d=0,e=0,f=0,g=[];;){b!==-1&&b<=e&&(b=a.indexOf("\r",e));d!==-1&&
d<=e&&(d=a.indexOf("\n",e));if(d===-1&&b===-1){g.push(a.substring(f));break}var i=1;b!==-1&&d!==-1?b+1===d?(i=2,e=d+1):e=(b<d?b:d)+1:e=b!==-1?b+1:d+1;g.push(a.substring(f,e-i));f=e}return g};d.searchUtils.searchWithinFile=function(a,b,e,f,g,i){e=d.searchUtils.splitFile(e);if(g)b.contents=e;if(b){b.children=[];for(var j=f=0;j<e.length;j++){var k=e[j];if(k&&k.length>0){var l=i?k:k.toLowerCase();if(l=a.wildCard?d.searchUtils.searchOnelineRegEx(a,l):d.searchUtils.searchOnelineLiteral(a,l)){var n=j+1;
if(g)for(var u=0;u<l.length;u++){var s=u+1,s={parent:b,checked:b.checked,type:"detail",matches:l,lineNumber:n,matchNumber:s,name:k,location:b.location+"-"+n+"-"+s};b.children.push(s)}else s={parent:b,context:d.searchUtils.generateMatchContext(2,e,j),checked:b.checked,type:"detail",matches:l,lineNumber:n,name:k,location:b.location+"-"+n},b.children.push(s);f+=l.length}}}b.totalMatches=f}};d.searchUtils.replaceCheckedMatches=function(a,b,d,e,f){for(var g=0,i="",j=[],l=0;l<d.length;l++){g!==d[l].startIndex&&
(i+=a.substring(g,d[l].startIndex));if(d[l].length)f=d[l].length;for(var g=!1,n=0;n<e.length;n++)if(e[n]===l){g=!0;break}g?(j.push({startIndex:i.length,length:b.length}),i+=b):(j.push({startIndex:i.length,length:f}),i+=a.substring(d[l].startIndex,d[l].startIndex+f));g=d[l].startIndex+f}g<a.length&&(i+=a.substring(g));return{replacedStr:i,newMatches:j}};d.searchUtils.fullPathNameByMeta=function(a){var b=a.length,d="";if(b>0)for(b-=1;b>-1;b--)d=d+(d===""?"":"/")+a[b].Name;return d};d.searchUtils.path2FolderName=
function(a,b,d){return a.substring(0,a.length-b.length-(d?0:1))};d.searchUtils._storeRecentSearch=function(a,b){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("recentSearch",b)})};d.searchUtils.addRecentSearch=function(a,b,e){typeof b==="string"&&b&&a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(f){var g,f=f.get("recentSearch");typeof f==="string"&&(f=JSON.parse(f));if(f){for(g in f)if(f[g].name===b)return;
f.length>=20&&f.splice(19,f.length-20+1)}else f=[];f.splice(0,0,{name:b,regEx:e});d.searchUtils._storeRecentSearch(a,f)})};d.searchUtils.getSearches=function(a,b,d){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a=a.get(b);typeof a==="string"&&(a=JSON.parse(a));a&&d&&d(a)})};d.searchUtils.getMixedSearches=function(a,b,e,f){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var c,g=a.get("recentSearch");typeof g===
"string"&&(g=JSON.parse(g));if(b)for(c in a=a.get("search"),typeof a==="string"&&(a=JSON.parse(a)),a)if(e){var i=d.searchUtils.parseQueryStr(a[c].query);g.some(function(b){return i.searchStrTitle===b.name})||g.push({name:i.searchStrTitle,label:a[c].name})}else g.push({name:null,label:a[c].name,value:a[c].query});g&&f&&f(g)})};d.searchUtils.getOpenSearchPref=function(a,b){a.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");b(a&&a["links.newtab"]!==
"undefined"?a["links.newtab"]?!0:!1:!1)})};d.searchUtils.setOpenSearchPref=function(a,b){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",{openInNewTab:b})})};return d.searchUtils});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages,require,orion/i18nUtil,orion/searchUtils,orion/contentTypes,orion/Deferred".split(","),function(j,l,i,a,f,g){function e(d,c,b,e){this.registry=d;this.fileClient=c;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=e&&e.searchOnName;this._buildSkeletonOnly=e&&e.buildSkeletonOnly;this._fetchChildrenCallBack=e&&e.fetchChildrenCallBack;this._searchParams=b;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:a.generateSearchHelper(b);this._location=e&&e.location;this._childrenLocation=e&&e.childrenLocation?e.childrenLocation:this._location}e.prototype.search=function(a){var c=this.registry.getService("orion.core.contenttypes");this._onSearchComplete=a;var b=this;this.registry.getService("orion.page.dialog").confirm(j["The search term on this location will not use indexed files."]+"\n"+j["It will take longer time. Do you want to proceed?"],function(a){a&&c.getContentTypes().then(function(a){b.contentTypesCache=
a;b._visitRecursively(b._childrenLocation).then(function(){b._sort(b.fileLocations);b._onSearchComplete({response:{numFound:b.fileLocations.length,docs:b.fileLocations}})})})})};e.prototype.searchName=function(d,c){if(d)this.searchHelper=a.generateSearchHelper(d,!0);if(c)this.onSearchNameComplete=c;var b=[];this._sort(this.fileSkeleton);if(this.fileSkeleton.length>0){for(var e=0;e<this.fileSkeleton.length;e++){var f=this.fileSkeleton[e].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?
a.searchOnelineRegEx(this.searchHelper.inFileQuery,f,!0):a.searchOnelineLiteral(this.searchHelper.inFileQuery,f,!0))if(b.push(this.fileSkeleton[e]),b.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:b.length,docs:b}})}};e.prototype.buildSkeleton=function(a,c){this._buildingSkeleton=!0;var b=this.registry.getService("orion.core.contenttypes"),e=this;a();b.getContentTypes().then(function(b){e.contentTypesCache=b;e._visitRecursively(e._childrenLocation).then(function(){e._buildingSkeleton=
!1;c();e.searchHelper&&!e._buildSkeletonOnly&&e.searchName()})})};e.prototype._searchCompleted=function(){console.log("Search Completed.")};e.prototype._searchFiles=function(){var a=[],c;if(this.fileLocations.length>0){c=this;for(var b=0;b<c.fileLocations.length;b++)a.push(c._sniffSearch(c.fileLocations[b]))}return g.all(a)};e.prototype._sort=function(a){a.sort(function(a,b){var d=a.Name&&a.Name.toLowerCase(),e=b.Name&&b.Name.toLowerCase();return d<e?-1:d>e?1:0})};e.prototype._onFileType=function(d){return this.searchHelper.params.fileType?
this.searchHelper.params.fileType===a.ALL_FILE_TYPE?!0:d.extension.indexOf(this.searchHelper.params.fileType)>=0:!0};e.prototype._visitRecursively=function(a){var c=[],b=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(a);var e=b.registry.getService("orion.page.progress");return(e?e.progress(b.fileClient.fetchChildren(a),"Crawling search for children of "+a):b.fileClient.fetchChildren(a)).then(function(a){for(var d=0;d<a.length;d++)if(a[d].Directory!==void 0&&a[d].Directory===!1)if(b._searchOnName)c.push(b._buildSingleSkeleton(a[d]));
else if(b._buildSkeletonOnly)c.push(b._buildSingleSkeleton(a[d]));else{var e=f.getFilenameContentType(a[d].Name,b.contentTypesCache);e&&(e["extends"]==="text/plain"||e.id==="text/plain")&&b._onFileType(e)&&c.push(b._sniffSearch(a[d]))}else a[d].Location&&c.push(b._visitRecursively(a[d].ChildrenLocation));return g.all(c)})};e.prototype._hitOnceWithinFile=function(d){d=this._searchParams.caseSensitive?d:d.toLowerCase();return this.searchHelper.inFileQuery.wildCard?a.searchOnelineRegEx(this.searchHelper.inFileQuery,
d,!0):a.searchOnelineLiteral(this.searchHelper.inFileQuery,d,!0)};e.prototype._reportSingleHit=function(a){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)};e.prototype._sniffSearch=function(a){this._totalCounter++;var c=this;if(this.searchHelper.params.keyword==="")this._reportSingleHit(a),this.registry.getService("orion.page.message").setProgressResult({Message:i.formatMessage(j["${0} files found out of ${1}"],
this._hitCounter,this._totalCounter)});else return this.registry.getService("orion.page.progress").progress(c.fileClient.read(a.Location),"Reading file "+a.Location).then(function(b){c._hitOnceWithinFile(b)&&c._reportSingleHit(a);c.registry.getService("orion.page.message").setProgressResult({Message:i.formatMessage(j["${0} files found out of ${1}"],c._hitCounter,c._totalCounter)})},function(b){console.error("Error loading file content: "+b.message)})};e.prototype._buildSingleSkeleton=function(a){this._totalCounter++;
this.fileSkeleton.push(a);this.searchHelper&&!this._buildSkeletonOnly&&this._totalCounter%100===0&&this.searchName();a=new g;a.resolve(this._totalCounter);return a};e.prototype.constructor=e;return{SearchCrawler:e}});
define("orion/searchClient","i18n!orion/search/nls/messages,require,orion/webui/littlelib,orion/i18nUtil,orion/searchUtils,orion/crawler/searchCrawler".split(","),function(j,l,i,a,f,g){function e(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;(this._fileService=a.fileService)||console.error("No file service on search client")}e.prototype={search:function(a,c,b){var e=function(b){for(var a=[],c=0;c<b.response.docs.length;c++){var d=b.response.docs[c];a.push({name:d.Name,path:d.Location,
folderName:f.path2FolderName(d.Path?d.Path:d.Location,d.Name),directory:d.Directory,lineNumber:d.LineNumber})}return a};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(a){b(e(a),null)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(c){var f=a.keyword,f=f.substring(f.indexOf("}")+1),f=f.substring(f.indexOf(":")+1);b(e(c),f)},function(a){b(null,null,a)})}catch(i){typeof i==="string"&&i.indexOf("search")>
-1&&this._crawler?this._crawler.searchName(a,function(a){b(e(a),null)}):typeof i==="string"&&i.indexOf("search")>-1&&!a.nameSearch?(new g.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(a){b(e(a),null)}):this.registry.getService("orion.page.message").setErrorMessage(i)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=a},handleError:function(a,c){console.error(a);i.empty(c);c.appendChild(document.createTextNode(a));
return a},setLocationByMetaData:function(d,c){var b="",e=null;this._searchRootLocation=this._fileService.fileServiceRootURL(d.Location);c&&d&&d.Parents&&d.Parents.length>0?e=c.index==="last"?d.Parents[d.Parents.length-1]:d.Parents[0]:d&&d.Directory&&d.Location&&d.Parents&&(e=d);if(e)this.setLocationbyURL(e.Location),b=e.Name,this._childrenLocation=e.ChildrenLocation;else if(d)this.setLocationbyURL(this._searchRootLocation),b=this._fileService.fileServiceName(d.Location),this._childrenLocation=d.ChildrenLocation;
e=i.node("search");b||(b="");if(e&&e.placeholder){e.value="";var f=a.formatMessage(j["Search ${0}"],b);e.placeholder=f.length>30?f.substring(0,27)+"...":a.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,e){b=b?this.getSearchRootLocation():this.getSearchLocation();return c?{resource:b,sort:"NameLower asc",rows:100,start:0,nameSearch:!0,keyword:a}:{resource:b,sort:"Path asc",
rows:40,start:0,caseSensitive:e?e.caseSensitive:void 0,regEx:e?e.regEx:void 0,fileType:e?e.type:void 0,keyword:a}},defaultRenderer:{makeRenderFunction:function(d,c,b,e,f){function g(b){return!d?!0:(b=d.getFilenameContentType(b))&&(b["extends"]==="text/plain"||b.id==="text/plain")?!0:!1}return function(d,q,k){if(k)i.empty(c),d=document.createElement("div"),d.appendChild(document.createTextNode(j["Search failed."])),c.appendChild(d),typeof e==="function"&&e(c);else{var k=function(){function b(a,c){var d=
c.folderName?c.folderName:c.path,e=document.createElement("span");e.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");e.appendChild(document.createTextNode(" - "+d+" "));a.appendChild(e)}var a={};return function(c,d){var e=d.name;if(a.hasOwnProperty(e)){b(c,d);var f=a[e];typeof f==="function"&&(a[e]=null,f())}else a[e]=function(){b(c,d)}}}(),p=!1;i.empty(c);if(d&&d.length>0){var n=document.createElement("table");n.setAttribute("role","presentation");for(var u=0;u<d.length;u++){var s=d[u],w;if(!p&&(p=!0,b))w=
n.insertRow(0).insertCell(0),w.textContent=b;w=n.insertRow(-1).insertCell(0);w.colspan=2;f&&f(w);var v=document.createElement("a");v.appendChild(document.createTextNode(s.name));s.LineNumber&&v.appendChild(document.createTextNode(" (Line "+s.LineNumber+")"));var x=s.location;s.isExternalResource?x=s.path:(x=s.directory?l.toUrl("navigate/table.html")+"#"+s.path:g(s.name)?l.toUrl("edit/edit.html")+"#"+s.path:s.path,x==="#"&&(x=""));v.setAttribute("href",x);v.setAttribute("aria-describedby",(s.folderName?
s.folderName:s.path).replace(/[^a-zA-Z0-9_\.:\-]/g,""));v.style.verticalAlign="middle";w.appendChild(v);k(w,s)}c.appendChild(n);typeof e==="function"&&e(c)}!p&&q&&(d=a.formatMessage(j["No matches found for ${0}"],q),i.empty(c),c.appendChild(document.createTextNode(d)),typeof e==="function"&&e(c))}}}}};e.prototype.constructor=e;return{Searcher:e}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages,orion/crawler/searchCrawler,orion/contentTypes,require,orion/webui/littlelib,orion/webui/dialog".split(","),function(j,l,i,a,f,g){function e(a){this._init(a)}e.prototype=new g.Dialog;e.prototype.TEMPLATE='<div role="search"><div><label 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="'+
a.toUrl("../../../images/progress_running.gif")+'" class="progressPane_running_dialog" id="crawlingProgress"></img></div><div id="favresults" style="max-height:400px; height:auto; overflow-y:auto;"></div><div id="results" style="max-height:400px; 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 i.ContentTypeService(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._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._favService=a.favoriteService;if(!this._favService)throw Error(j["Missing required argument: favService"]);this._initialize()};e.prototype._bindToDom=function(a){var c=this;c.$crawlingProgress.style.display="none";this.$fileName.setAttribute("placeholder",j.Search);this.$fileName.addEventListener("input",function(){c._time=+new Date;c._timeoutId&&clearTimeout(c._timeoutId);c._timeoutId=setTimeout(c.checkSearch.bind(c),0)},
!1);this.$fileName.addEventListener("keydown",function(b){if(b.keyCode===f.KEY.ENTER){var a=f.$("a",c.$results);a&&(f.stop(b),window.open(a.href),c.hide())}},!1);a.addEventListener("keydown",function(b){var a,d,e,g,i;if(b.keyCode===f.KEY.DOWN||b.keyCode===f.KEY.UP)d=f.$$array("a",c.$results),a=f.$$array("a",c.$favresults),e=document.activeElement,i=d.indexOf(e),g=a.indexOf(e),b.keyCode===f.KEY.DOWN?g>=0?(g<a.length-1?a[g+1]:d.length>0?d[0]:a[0]).focus():i>=0?(i<d.length-1?d[i+1]:a.length>0?a[0]:d[0]).focus():
(d.length>0||a.length>0)&&(-1<a.length-1?a[0]:d[0]).focus():g>=0?(e=c.$fileName,(g>0?a[g-1]:e).focus()):i>=0?(e=c.$fileName,(i>0?d[i-1]:a.length>0?a[a.length-1]:e).focus()):d.length>0?d[d.length-1].focus():a.length>0&&a[a.length-1].focus(),f.stop(b)});a.addEventListener("mouseup",function(b){b.target.focus()},!1);this.populateFavorites();setTimeout(function(){if(c._forceUseCrawler||!c._fileService.getService(c._searcher.getSearchLocation()).search){var b=c._searchOnRoot?c._searcher.getSearchRootLocation():
c._searcher.getChildrenLocation(),b=new l.SearchCrawler(c._searcher.registry,c._fileService,"",{searchOnName:!0,location:b});c._searcher.setCrawler(b);b.buildSkeleton(function(){c.$crawlingProgress.style.display="inline";c.$progress.appendChild(document.createTextNode(j["Building file skeleton..."]))},function(){c.$crawlingProgress.style.display="none";c.$progress.removeChild(c.$progress.lastChild)})}},0)};e.prototype.populateFavorites=function(){var a=document.createElement("div");a.appendChild(document.createTextNode(j["Populating favorites&#x2026;"]));
f.empty(this.$favresults);this.$favresults.appendChild(a);this._progress?this._progress.progress(this._favService.getFavorites(),"Getting favorites").then(this.showFavorites()):this._favService.getFavorites().then(this.showFavorites());this._favService.addEventListener("favoritesChanged",this.showFavorites())};e.prototype.showFavorites=function(){var a=this;return function(c){if(c.navigator)c=c.navigator;a._searchRenderer.makeRenderFunction(a._contentTypeService,a.$favresults,!1,a.decorateResult.bind(a),
a.showFavoritesImage)(c);if(c&&c.length>0)c=document.createElement("div"),c.style.borderBottom="1px dashed #BBBBBB",c.style.padding="5px",a.$favresults.appendChild(c)}};e.prototype.showFavoritesImage=function(d){var c=new Image;c.classList.add("modelDecorationSprite");c.classList.add("core-sprite-makeFavorite");c.src=a.toUrl("images/none.png");c.title=j.Favorite;d.appendChild(c);c.style.verticalAlign="middle"};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.doSearch=function(){var a=this.$fileName.value,c=this.showFavorites();this._progress?this._progress.progress(this._favService.queryFavorites(a),"Getting favorites for: "+a).then(function(b){c(b)}):this._favService.queryFavorites(a).then(function(b){c(b)});if(a){var b=document.createElement("div");b.appendChild(document.createTextNode(j["Searching..."]));f.empty(this.$favresults);
this.$results.appendChild(b);var e=this;setTimeout(function(){var b=e._searcher.createSearchParams(a,!0,e._searchOnRoot),c=e._searchRenderer.makeRenderFunction(e._contentTypeService,e.$results,!1,e.decorateResult.bind(e));e._searcher.search(b,!1,c)},0)}};e.prototype.decorateResult=function(a){for(var c=this,a=f.$$array("a",a),b=0;b<a.length;b++){var e=a[b];e.addEventListener("mouseup",function(b){b.button===0&&!b.ctrlKey&&!b.metaKey&&c.hide()},!1);e.addEventListener("keyup",function(b){b.keyCode===
f.KEY.ENTER&&c.hide()},!1)}};e.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};e.prototype._afterHiding=function(){this._onHide&&this._onHide()};e.prototype.constructor=e;return{OpenResourceDialog:e}});
define("orion/globalSearch/advSearchOptContainer",["i18n!orion/globalSearch/nls/messages","require","orion/searchUtils","orion/contentTypes","orion/i18nUtil"],function(j,l,i,a,f){function g(a,c,b,f){this._inputField=a;if(typeof this._inputField==="string")this._inputField=document.getElementById(this._inputField);(a=f?f.group:null)||(a=this._inputField.id?this._inputField.id:"default__dropDown__group");this._idPrefix=a+"__dropDown__";this.containerId=this._idPrefix+"UIContainer";this._dismissed=!0;
var g=this;this._optRenderer=new e(c,b,function(){g.dismiss();g._inputField.focus()});this._initUI()}function e(a,c,b){this._searcher=a;this._serviceRegistry=c;this._cancelCallBack=b}g.prototype._initUI=function(){this._optUIContainer=document.getElementById(this.containerId);if(!this._optUIContainer)this._optUIContainer=document.createElement("div"),this._optUIContainer.id=this.containerId,this._optUIContainer.style.display="none",this._optUIContainer.className="advSearchOptContainer",document.body.appendChild(this._optUIContainer),
this._optRenderer.render(this._optUIContainer)};g.prototype.dismiss=function(){this._dismissed=!0;this._optUIContainer.style.display="none"};g.prototype.show=function(a){for(var c=0,b=0,e=this._inputField;e;)c+=e.offsetLeft,b+=e.offsetTop,e=e.offsetParent;this._optUIContainer.style.display="block";this._optUIContainer.style.top=b+this._inputField.offsetHeight+2+"px";this._optUIContainer.style.left=c+"px";this._optUIContainer.style.width=this._inputField.offsetWidth+"px";this._optRenderer._searchBox.value=
a;this._optRenderer._searchBox.focus();this._dismissed=this._mouseDown=!1};g.prototype.toggle=function(){this._dismissed?this.show(this._inputField.value):this.dismiss()};g.prototype.constructor=g;e.prototype.getOptions=function(){return{searchStr:this._searchBox.value,caseSensitive:this._caseSensitiveCB.checked,regEx:this._regExCB.checked,type:this._fileTypes.options[this._fileTypes.selectedIndex].value}};e.prototype.render=function(d,c){this._parentDiv=d;if(typeof this._parentDiv==="string")this._parentDiv=
document.getElementById(this._parentDiv);var b=this._serviceRegistry.getService("orion.core.contenttypes");if(b){var e=this;b.getContentTypes().then(function(b){e.contentTypesCache=b;e._render(c)})}else b=new a.ContentTypeService(this._serviceRegistry),this.contentTypesCache=b.getContentTypes(),this._render(c)};e.prototype._render=function(a){a?this._renderHTML(a):this._renderRaw()};e.prototype._submitSearch=function(){var a=this.getOptions();i.doSearch(this._searcher,this._serviceRegistry,a.searchStr,
a)};e.prototype._initControls=function(){this._searchBox=document.getElementById("advSearchInput");this._fileTypes=document.getElementById("advSearchTypes");this._caseSensitiveCB=document.getElementById("advSearchCaseSensitive");this._regExCB=document.getElementById("advSearchRegEx");this._submitButton=document.getElementById("advSearchSubmit");for(var a=[{label:j["All types"],value:i.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]});for(c=0;c<a.length;c++){var b=document.createElement("option"),e=document.createTextNode(a[c].label);b.appendChild(e);this._fileTypes.appendChild(b);b.value=a[c].value}var g=this;this._searchBox.addEventListener("keydown",function(b){b=b.charCode||b.keyCode;b===13&&g._submitSearch();b===27&&g._cancelCallBack&&g._cancelCallBack()});
this._fileTypes.addEventListener("change",function(){var b=g._fileTypes.options[g._fileTypes.selectedIndex].value;g._searchBox.placeholder=b===i.ALL_FILE_TYPE?j["Type a search term"]:f.formatMessage(j["All ${0} files"],b)});this._submitButton.onclick=function(){g._submitSearch()}};e.prototype._initHTMLLabels=function(){document.getElementById("advSearchLabel").appendChild(document.createTextNode(j["Files that contain:"]));document.getElementById("advSearchInput").placeholder=j["Type a search term"];
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("advSearchSubmit").value=j.Search};e.prototype._renderHTML=function(a){var c=this,b=new XMLHttpRequest;b.open("GET",l.toUrl(a),!0);b.onreadystatechange=function(){if(this.readyState===
4&&this.status===200)c._parentDiv.innerHTML=this.responseText,c._initHTMLLabels(),c._initControls()};b.send()};e.prototype._htmlTemplate='<ul class="advSearchOptUL"><li class="advSearchOptLILabel"><label>'+j["Files that contain:"]+'</label></li><li class="advSearchOptLIControl"><input type="text" id="advSearchInput" placeholder="'+j["Type a search term"]+'"></input></li><li class="advSearchOptLIControl"><label>'+j["File type:"]+'</label><select id="advSearchTypes"></select></li><li class="advSearchOptLIControl"><label>'+
j["Case sensitive"]+'</label><input type="checkbox" id="advSearchCaseSensitive"></input></li><li class="advSearchOptLIControl"><label>'+j["Regular expression"]+'</label><input type="checkbox" id="advSearchRegEx"></input></li><li class="advSearchOptLIControl"><input type="button" class="advSearchOptButton" id="advSearchSubmit" value="'+j.Search+'"></input></li></ul>';e.prototype._renderRaw=function(){this._parentDiv.innerHTML=this._htmlTemplate;this._initControls()};e.prototype.constructor=e;return{advSearchOptContainer:g,
advSearchOptRenderer:e}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages,require,orion/webui/littlelib,orion/editor/annotations,orion/commands,orion/searchUtils".split(","),function(j,l,i,a){var f=f||{};f.TextSearcher=function(){function f(a,d,c,b){this._editor=a;this._commandService=d;this._undoStack=c;this._wrapSearch=this._ignoreCase=this._showAllOccurrence=!0;this._wholeWord=!1;this._incremental=!0;this._useRegExp=!1;this._findAfterReplace=!0;this._reverse=!1;this.isMac=navigator.platform.indexOf("Mac")!==
-1;this._timer=this._searchRange=null;this._searchOnRange=!1;this._lastSearchString="";var g=this;this._listeners={onEditorFocus:function(b){g.removeCurrentAnnotation(b)}};this.setOptions(b)}f.prototype={_createActionTable:function(){var e=this;this._commandService.openParameterCollector("pageNavigationActions",function(d){var c=document.createElement("input");c.type="text";c.name=j["Find:"];c.id="localSearchFindWith";c.placeholder=j["Find With"];c.onkeyup=function(b){return e._handleKeyUp(b)};c.onkeydown=
function(b){return e._handleKeyDown(b,!0)};d.appendChild(c);e.createButton("Next",d,function(){e.findNext(!0)});e.createButton("Previous",d,function(){e.findNext(!1)});var b=document.createElement("input");b.type="text";b.name=j["ReplaceWith:"];b.id="localSearchReplaceWith";b.placeholder=j["Replace With"];b.classList.add("searchCmdGroupMargin");b.onkeydown=function(b){return e._handleKeyDown(b,!1)};d.appendChild(b);e.createButton(j.Replace,d,function(){e.replace()});e.createButton(j["Replace All"],
d,function(){e.replaceAll()});b=document.createElement("div");d.appendChild(b);b.classList.add("findOptionsDiv");var f=e._commandService._createDropdownMenu(b,j.Options);f.menuButton.classList.add("findSlideoutMenu");e._commandService._generateCheckedMenuItem(f.menu,j["Show all"],e._showAllOccurrence,function(b){b=b.target.checked;e.setOptions({showAllOccurrence:b});b?e.markAllOccurrences(!0):(b=e._editor.getAnnotationModel())&&b.removeAnnotations(a.AnnotationType.ANNOTATION_MATCHING_SEARCH);f.dropdown.close(!0)});
e._commandService._generateCheckedMenuItem(f.menu,j["Case sensitive"],!e._ignoreCase,function(b){e.setOptions({ignoreCase:!b.target.checked});f.dropdown.close(!0);e.findNext(!0,null,!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Wrap search"],e._wrapSearch,function(b){e.setOptions({wrapSearch:b.target.checked});f.dropdown.close(!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Incremental search"],e._incremental,function(b){e.setOptions({incremental:b.target.checked});f.dropdown.close(!0)});
e._commandService._generateCheckedMenuItem(f.menu,j["Whole Word"],e._wholeWord,function(b){e.setOptions({wholeWord:b.target.checked});f.dropdown.close(!0);e.findNext(!0,null,!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Regular expression"],e._useRegExp,function(b){e.setOptions({useRegExp:b.target.checked});f.dropdown.close(!0);e.findNext(!0,null,!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Find after replace"],e._findAfterReplace,function(b){e.setOptions({findAfterReplace:b.target.checked});
f.dropdown.close(!0)});return c},function(){e.closeUI()})},visible:function(){return document.getElementById("localSearchFindWith")?!0:!1},_handleKeyUp:function(){if(this._incremental&&!this._keyUpHandled)this._noSelection?this._noSelection=!1:this.findNext(!0,null,!0);this._keyUpHandled=!1;return!0},_handleKeyDown:function(a,d){var c=(this.isMac?a.metaKey:a.ctrlKey)&&!a.altKey&&!a.shiftKey;if(c&&a.keyCode===70)return this._keyUpHandled=d,a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,!1;
if((this.isMac?a.metaKey:a.ctrlKey)&&!a.altKey&&a.keyCode===75||a.keyCode===13)return a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,this.findNext(!a.shiftKey),this._keyUpHandled=d,!1;if(c&&a.keyCode===82)return a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,d||this.replace(),this._keyUpHandled=d,!1;return a.keyCode===27?(this.closeUI(),this._keyUpHandled=d,!1):!0},closeUI:function(){this.visible()&&this._commandService.closeParameterCollector();this._editor.getTextView().removeEventListener("Focus",
this._listeners.onEditorFocus);this._editor.getTextView().focus();var e=this._editor.getAnnotationModel();e&&(e.removeAnnotations(a.AnnotationType.ANNOTATION_CURRENT_SEARCH),e.removeAnnotations(a.AnnotationType.ANNOTATION_MATCHING_SEARCH))},removeCurrentAnnotation:function(){var e=this._editor.getAnnotationModel();e&&e.removeAnnotations(a.AnnotationType.ANNOTATION_CURRENT_SEARCH)},createButton:function(a,d,c){var b=document.createElement("span");b.tabIndex=0;b.role="button";b.addEventListener("click",
c.bind(this),!1);var f=this;b.addEventListener("keydown",function(b){b.keyCode===i.KEY.ENTER||b.keyCode===i.KEY.SPACE?c.bind(f)():b.keyCode===i.KEY.ESCAPE&&f.closeUI()});b.appendChild(document.createTextNode(a));b.classList.add("findSlideoutButton");d.appendChild(b)},buildToolBar:function(a,d){this._keyUpHandled=!0;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var c=document.getElementById("localSearchFindWith");if(this.visible())a.length>0?c.value=a:this._noSelection=
!0;else{this._createActionTable();if(typeof d==="string")document.getElementById("localSearchReplaceWith").value=d;c=document.getElementById("localSearchFindWith");c.value=a}window.setTimeout(function(){c.select();c.focus()},10)},setOptions:function(a){if(a){if(a.showAllOccurrence===!0||a.showAllOccurrence===!1)this._showAllOccurrence=a.showAllOccurrence;if(a.ignoreCase===!0||a.ignoreCase===!1)this._ignoreCase=a.ignoreCase;if(a.wrapSearch===!0||a.wrapSearch===!1)this._wrapSearch=a.wrapSearch;if(a.wholeWord===
!0||a.wholeWord===!1)this._wholeWord=a.wholeWord;if(a.incremental===!0||a.incremental===!1)this._incremental=a.incremental;if(a.useRegExp===!0||a.useRegExp===!1)this._useRegExp=a.useRegExp;if(a.findAfterReplace===!0||a.findAfterReplace===!1)this._findAfterReplace=a.findAfterReplace;if(a.reverse===!0||a.reverse===!1)this._reverse=a.reverse;if(a.toolBarId)this._toolBarId=a.toolBarId;if(a.searchRange)this._searchRange=a.searchRange;if(a.searchOnRange===!0||a.searchOnRange===!1)this._searchOnRange=a.searchOnRange}},
getSearchStartIndex:function(a,d){var c=this._editor.getCaretOffset();if(a){var b=this._editor.getSelection(),f=b.end>b.start?b.end-b.start:0;return!d?c-f-1>0?c-f-1:0:b.end>0?b.end:0}return c>0?c:0},findNext:function(a,d,c){this.setOptions({reverse:!a});var b=document.getElementById("localSearchFindWith"),c=this.getSearchStartIndex(c?!0:!a);d||(d=b?b.value:this._lastSearchString);return this._doFind(d,c,!a,this._wrapSearch)},startUndo:function(){this._undoStack&&this._undoStack.startCompoundChange()},
endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_doReplace:function(a,d,c,b){var f=this._editor;if(this._useRegExp){if(c=f.getText().substring(a,d).replace(RegExp(c,this._ignoreCase?"i":""),b))f.setText(c,a,d),f.setSelection(a,a+c.length,!0)}else f.setText(b,a,d),f.setSelection(a,a+b.length,!0)},replace:function(){this.startUndo();var a=document.getElementById("localSearchReplaceWith").value,d=this._editor,c=d.getSelection(),b=document.getElementById("localSearchFindWith").value,
c=c?c.start:0;b&&(d=d.getModel().find({string:b,start:c,reverse:!1,wrap:this._wrapSearch,regex:this._useRegExp,wholeWord:this._wholeWord,caseInsensitive:this._ignoreCase}).next())&&this._doReplace(d.start,d.end,b,a);this.endUndo();this._findAfterReplace&&b&&this._doFind(b,this.getSearchStartIndex(!1),!1,this._wrapSearch)},_doFind:function(e,d,c,b){var f=this._editor,g=f.getAnnotationModel();if(!e)return g&&(g.removeAnnotations(a.AnnotationType.ANNOTATION_CURRENT_SEARCH),g.removeAnnotations(a.AnnotationType.ANNOTATION_MATCHING_SEARCH)),
null;this._lastSearchString=e;var i=f.getModel().find({string:e,start:d,reverse:c,wrap:b,regex:this._useRegExp,wholeWord:this._wholeWord,caseInsensitive:this._ignoreCase}).next();if(!this._replacingAll&&(i?this._editor.reportStatus(""):this._editor.reportStatus(j["Not found"],"error"),this.visible()&&(e=a.AnnotationType.ANNOTATION_CURRENT_SEARCH,g&&(g.removeAnnotations(e),i&&g.addAnnotation(a.AnnotationType.createAnnotation(e,i.start,i.end))),this._showAllOccurrence))){this._timer&&window.clearTimeout(this._timer);
var l=this;this._timer=window.setTimeout(function(){l.markAllOccurrences(i);l._timer=null},500)}i&&f.moveSelection(i.start,i.end,null,!1);return i},replaceAll:function(){var a=document.getElementById("localSearchFindWith").value;if(a){this._replacingAll=!0;var d=this._editor;d.reportStatus("");d.reportStatus(j["Replacing all..."],"progress");var c=document.getElementById("localSearchReplaceWith").value,b=this;window.setTimeout(function(){for(var f=0,g=0;;){if(!b._doFind(a,f))break;g++;g===1&&b.startUndo();
f=d.getSelection();b._doReplace(f.start,f.end,a,c);f=b.getSearchStartIndex(!0,!0)}g>0&&b.endUndo();d.reportStatus("","progress");f>0?d.reportStatus(j["Replaced "]+g+j[" matches"]):d.reportStatus(j["Nothing replaced"],"error");b._replacingAll=!1},100)}},markAllOccurrences:function(e){var d=this._editor.getAnnotationModel();if(d){for(var c=a.AnnotationType.ANNOTATION_MATCHING_SEARCH,b=d.getAnnotations(0,d.getTextModel().getCharCount()),f=[],g;b.hasNext();){var i=b.next();i.type===c&&f.push(i)}b=document.getElementById("localSearchFindWith").value;
if(e&&b){b=this._editor.getModel().find({string:b,regex:this._useRegExp,wholeWord:this._wholeWord,caseInsensitive:this._ignoreCase});for(g=[];b.hasNext();)e=b.next(),g.push(a.AnnotationType.createAnnotation(c,e.start,e.end))}d.replaceAnnotations(f,g)}}};return f}();return f});
define("orion/PageLinks",["require","orion/Deferred","orion/PageUtil","orion/URITemplate","orion/URL-shim"],function(j,l,i,a){function f(f,e){for(var d=f.getServiceReferences(e||"orion.page.link"),c=i.matchResourceParameters(window.location.href),b={OrionHome:(new URL(j.toUrl("."),window.location)).href.slice(0,-1),Location:c.resource},c=[],h=0;h<d.length;h++){for(var m={},o=d[h].getPropertyKeys(),r=0;r<o.length;r++)m[o[r]]=d[h].getProperty(o[r]);if(m.uriTemplate&&m.nls&&(m.name||m.nameKey)){var q=
new l;j(["i18n!"+m.nls],function(c){var d=new a(m.uriTemplate),d=window.decodeURIComponent(d.expand(b)),d=i.validateURLScheme(d);m.href=d;m.textContent=m.nameKey?c[m.nameKey]:m.name;q.resolve(m)});c.push(q)}else if(m.uriTemplate&&m.name)o=new a(m.uriTemplate),o=window.decodeURIComponent(o.expand(b)),o=i.validateURLScheme(o),m.href=o,m.textContent=m.name,c.push((new l).resolve(m))}return l.all(c)}return{createPageLinks:function(a,e){return f(a,e).then(function(a){return a.map(function(a){var b=a.href,
a=a.textContent,d=document.createElement("a");d.href=b;d.target="_self";d.classList.add("targetSelector");d.textContent=a;return d})})},getPageLinksInfo:f}});
define("orion/widgets/UserMenu",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/PageLinks"],function(j,l,i,a){function f(a){this._init(a)}f.prototype={_init:function(a){this._dropdownNode=i.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={}},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 e=0,d;for(d in a)a.hasOwnProperty(d)&&e++;return e},_makeMenuItem:function(a,e){var d=document.createElement("span");d.role="menuitem";d.tabIndex=0;var c=document.createTextNode(a);d.appendChild(c);d.classList.add("dropdownMenuItem");d.addEventListener("click",e,!1);d.addEventListener("keydown",function(b){(b.keyCode===
i.KEY.ENTER||b.keyCode===i.KEY.SPACE)&&e()},!1);return d},_renderAuthenticatedService:function(a){var e=this,d=this.authenticatedServices[a].authService;if(d&&d.logout){var c=document.createElement("li"),b=this._makeMenuItem(j["Sign Out"],function(){d.logout().then(function(){e.addUserItem(a,d,e.authenticatedServices[a].label);localStorage.removeItem(a);localStorage.removeItem("lastLogin");for(var b=localStorage.length-1;b>=0;b--){var c=localStorage.key(b);c&&c.indexOf("/orion/preferences/user")===
0&&localStorage.removeItem(c)}d.getAuthForm(window.location.href).then(function(b){window.location=b})})});c.appendChild(b);this._dropdownNode.appendChild(c)}},renderServices:function(){function f(a){d[a]||(d[a]=e.createDocumentFragment());return d[a]}var e=document,d=[];a.getPageLinksInfo(this._serviceRegistry,"orion.page.link.user").then(function(a){this._dropdown.empty();a.forEach(function(b){var a=f(typeof b.category==="number"?b.category:1),c=e.createElement("li"),d=e.createElement("a");d.role=
"menuitem";d.classList.add("dropdownMenuItem");d.href=b.href;d.textContent=b.textContent;c.appendChild(d);a.appendChild(c)});if(this.keyAssistFunction){var a=document.createElement("li"),b=this._makeMenuItem(j["Keyboard Shortcuts"],this.keyAssistFunction);b.classList.add("key-assist-menuitem");a.appendChild(b);f(0).appendChild(a)}var h=this;d.sort(function(b,a){return b-a}).forEach(function(b,a){if(a<d.length-1){var c=document.createElement("li");c.classList.add("dropdownSeparator");var e=document.createElement("span");
e.classList.add("dropdownSeparator");c.appendChild(e);b.appendChild(c)}h._dropdownNode.appendChild(b)});if(this.isSingleService())for(var i in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(i)&&this._renderAuthenticatedService(i,0)}.bind(this))},setKeyAssist:function(a){this.keyAssistFunction=a;this.renderServices()},addUserItem:function(a,e,d,c){c?(this.unauthenticatedServices[a]&&delete this.unauthenticatedServices[a],this.authenticatedServices[a]={authService:e,label:d,data:c}):
(this.authenticatedServices[a]&&delete this.authenticatedServices[a],this.unauthenticatedServices[a]=this.unauthenticatedServices[a]?{authService:e,label:d,pending:this.unauthenticatedServices[a].pending}:{authService:e,label:d});this.renderServices()}};f.prototype.constructor=f;return{UserMenu:f}});
define("orion/globalCommands","i18n!orion/nls/messages,require,orion/commonHTMLFragments,orion/commands,orion/parameterCollectors,orion/extensionCommands,orion/uiUtils,orion/editor/keyBinding,orion/breadcrumbs,orion/webui/littlelib,orion/webui/splitter,orion/webui/dropdown,orion/webui/tooltip,orion/favorites,orion/contentTypes,orion/URITemplate,orion/PageUtil,orion/widgets/themes/container/ThemeSheetWriter,orion/searchUtils,orion/inputCompletion/inputCompletion,orion/globalSearch/advSearchOptContainer,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".split(","),function(j,
l,i,a,f,g,e,d,c,b,h,m,o,r,q,k,p,n,u,s,w,v,x,z,t,D,B,F){function y(b,a){if(b.getLabel)return b.getLabel();else{var c=new v;c.resolve(a.properties.name);return c}}function H(a){b.node("progressPane").setAttribute("aria-label",j["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function A(b,a){var c=b.getService("orion.core.auth");c!==null&&c.getUser().then(function(b){var c;b.Name?c=document.createTextNode(b.Name):b.login&&
(c=document.createTextNode(b.login));c&&(a.childNodes.length>0?a.childNodes[0].nodeType===3?a.replaceChild(c,a.childNodes[0]):a.insertBefore(c,a.childNodes[0]):a.appendChild(c))})}function E(a,c){var d=a.getServiceReferences("orion.core.auth");R=[];if(b.node("userMenu")){var e=b.node("userDropdown"),f=new m.Dropdown({dropdown:e}),g=new x.UserMenu({dropdownNode:e,dropdown:f,serviceRegistry:a}),e=b.node("userTrigger");new o.Tooltip({node:e,text:j.Options,position:["below","left"]});A(a,e);g.setKeyAssist(c);
for(e=0;e<d.length;e++){var f=d[e],h=a.getService(f);y(h,f).then(function(b){h.getKey().then(function(a){R.push(a);h.getUser().then(function(c){g.addUserItem(a,h,b,c)},function(c,d){g.addUserItem(a,h,b,d)});window.addEventListener("storage",function(){N[a]!==localStorage.getItem(a)&&(N[a]=localStorage.getItem(a),h.getUser().then(function(c){g.addUserItem(a,h,b,c)},function(){g.addUserItem(a,h,b)}))},!1)})})}}}function G(a){var c=document.createElement("span");c.id="advancedSearchDropDown";b.node("searchOptions").appendChild(c);
c.tabIndex=0;c.classList.add("advancedSearchDecorationSprite");c.classList.add("core-sprite-openarrow");c.title=j["Advanced search"];c.onclick=function(){a.toggle()};c.addEventListener("keydown",function(b){(b.charCode||b.keyCode)===13&&a.toggle()});c.classList.add("bannerMenuSearchOptions")}function C(a,c){var d=b.node("relatedDropdown");K||(K=new m.Dropdown({dropdown:d}));a._addMenuItem(d,c)}function I(c,d,e,f,h){var i,j=c.getServiceReferences("orion.page.link.related");j.length<=0||b.node("relatedLinks")&&
v.when(function(){if(i)return i;var b=c.getService("orion.core.contenttypes");b||(b=new q.ContentTypeService(c),b=c.getService("orion.core.contenttypes"));return b.getContentTypes().then(function(b){return i=b})}(),function(){var k;b.node("relatedLinks")&&K&&(K.close(),K.empty());for(var l=[],m=0;m<j.length;m++){var n={},t,o=j[m].getPropertyKeys();for(t=0;t<o.length;t++)n[o[t]]=j[m].getProperty(o[t]);if(n.id){var q=function(b){if(b)if(!b.visibleWhen||b.visibleWhen(d)){var c=new a.CommandInvocation(f,
d,d,null,b);C(b,c)}else typeof h==="function"&&(k||(k=h()),v.when(k,function(c){c&&d===S&&(!b.visibleWhen||b.visibleWhen(c))&&C(b,new a.CommandInvocation(f,c,c,null,b))}))},p=null;t=null;if(e.indexOf(n.id)<0)if((n.nls&&n.nameKey||n.name)&&n.uriTemplate)t=g._createCommandOptions(n,j[m],c,i,!0),l.push(t),t.then(function(b){b=new a.Command(b);q(b)});else{if(!p&&(p=f.findCommand(n.id))){q(p);continue}if(!p){var B=c.getServiceReferences("orion.navigate.command");for(t=0;t<B.length;t++)if(B[t].getProperty("id")===
n.id){for(var n={},o=B[t].getPropertyKeys(),r=0;r<o.length;r++)n[o[r]]=B[t].getProperty(o[r]);t=g._createCommandOptions(n,B[t],c,i,!0);l.push(t);t.then(function(b){p=new a.Command(b);q(p)});break}}}}}v.all(l,function(b){return b}).then(function(){var a=b.node("relatedTrigger");if(K&&a)a.style.visibility=K.getItems().length===0?"hidden":"visible"})})}function L(a){var c=b.node("globalActions");c&&(a.destroy(c),a.renderCommands(c.id,c,{},{},"tool"))}function P(b){b.getPreferences("/themes",2).then(function(b){var a=
b.get("selected");if(a&&(a=JSON.parse(a),b=b.get("styles"))){var b=JSON.parse(b),c;for(c in b)if(b[c].name===a.selected){c=b[c];c=(new n.ThemeSheetWriter).getSheet(c);a=document.createElement("STYLE");a.appendChild(document.createTextNode(c));(document.getElementsByTagName("HEAD")[0]||document.documentElement).appendChild(a);break}}})}function M(a){var c={},d=null;typeof a==="string"&&(a=b.node(a));a||(a=b.node("pageActions"));for(var e=a;e&&e.classList;){if(e.classList.contains("toolComposite")){d=
e;break}e=e.parentNode}if(a.classList.contains("commandMarker"))c.commandNode=a;if(d&&(c.slideContainer=b.$(".slideParameters",d),c.parameterArea=b.$(".parameters",d),c.dismissArea=b.$(".parametersDismiss",d),c.notifications=b.$("#notificationArea",d),d.parentNode&&(c.toolbarTarget=b.$(".toolbarTarget",d.parentNode),c.toolbarTarget)))a=b.bounds(d),c.toolbarTargetY=a.height+1;return c}function Q(a){if(a.toolbarTarget&&a.toolbarTargetY){var c=0,d;a.notifications&&a.notifications.classList.contains("slideContainerActive")&&
(d=b.bounds(a.notifications),c+=d.height);a.slideContainer&&a.slideContainer.classList.contains("slideContainerActive")&&(d=b.bounds(a.slideContainer),c+=d.height);c>0&&(c+=8);a.toolbarTarget.style.top=a.toolbarTargetY+c+"px";a.toolbarTarget.style.bottom=0}}var k=function(b){var a=document.createElement("a");a.href=b;return a.href}(l.toUrl("auth/NotifyAuthentication.html")),N={},R=[],K,S,T=[],J,O=null;return{addSettings:function(a){var c=document.getElementById("settingsTab"),d=document.getElementById("settingsAction"),
e=!1,f;c.style.visibility="";d.style.visibility="";d.onclick=function(){if(!e){e=!0;c.style.backgroundColor="#555";c.style.zIndex="99";c.style.borderTopRightRadius="3px";c.style.borderTopLeftRadius="3px";d.className="core-sprite-settings-white";c.id="settingsNode";d.id="settingsButton";var g=document.getElementById("innerPanels"),h=g.getBoundingClientRect(),i=c.getBoundingClientRect();f?f.style.visibility="visible":(f=document.createElement("div"),f.className="settingsPanel",f.style.width="150px",
f.style.height="150px",f.style.backgroundColor="#555",f.style.zIndex="99",f.style.top=i.top-h.top+24-4+"px",f.id="settingsPanel",f.style.borderTopLeftRadius="3px",f.style.borderBottomRightRadius="3px",f.style.borderBottomLeftRadius="3px",g.appendChild(f),b.addAutoDismiss([d,c,f],function(){d.className="core-sprite-settings";c.style.backgroundColor="white";f.style.visibility="hidden";e=!1}));b.empty(f);a.appendTo(f)}}},generateBanner:function(c,g,k,m,n,q,p,y){function C(a){a.registerService("orion.cm.managedservice",
{updated:function(a){for(var a=a&&a["links.newtab"]!=="undefined"?a["links.newtab"]?"_blank":"_self":"_self",c=b.$$array(".targetSelector"),d=0;d<c.length;d++)c[d].target=a}},{pid:"nav.config"})}P(m);m=b.node(c);if(!m)throw j["could not find banner parent, id was "]+c;c=document.createRange();c.selectNode(m);c=c.createContextualFragment(D);b.processTextNodes(c,j);m.firstChild?m.insertBefore(c,m.firstChild):m.appendChild(c);c=b.node("home");c.href=l.toUrl("navigate/table.html");c.setAttribute("aria-label",
j["Orion Home"]);b.node("progressPane").src=l.toUrl("images/none.png");if(c=b.node("pageToolbar"))c.classList.add("toolbarLayout"),c.innerHTML=F+i.slideoutHTMLFragment("mainToolbar");(c=b.node("closeNotifications"))&&c.setAttribute("aria-label",j["Close notification"]);if(c=b.node("footer"))c.innerHTML=B,b.processTextNodes(c,j);k.setParameterCollector(new f.CommandParameterCollector(M,Q));var A=document.createElement("div");A.id="keyAssist";A.style.display="none";A.classList.add("keyAssistFloat");
A.role="list";A.setAttribute("aria-atomic","true");A.setAttribute("aria-live","assertive");document.body.appendChild(A);document.addEventListener("keydown",function(a){if(a.charOrCode===b.KEY.ESCAPE)A.style.display="none"},!1);b.addAutoDismiss([A],function(){A.style.display="none"});var x=b.node("primaryNav");x&&z.createPageLinks(g,"orion.page.link").then(function(b){b.forEach(function(b){x.appendChild(b)})});var I=b.node("search");if(!I)throw"failed to generate HTML for banner";I.setAttribute("placeholder",
j.Search);new o.Tooltip({node:I,text:j["Type a keyword or wild card to search in root"],position:["below","left"]});var N=new w.advSearchOptContainer(I,n,g,{group:"advancedSearch"});new s.InputCompletion(I,function(b){u.getMixedSearches(g,!0,!1,function(a){var c,d=[],e=!1,f=!1;for(c in a)a[c].label&&a[c].value?(e||(d.push({type:"category",label:j["Saved searches"]}),e=!0),d.push({type:"proposal",value:{name:a[c].label,value:l.toUrl("search/search.html")+"#"+a[c].value,type:"link"}})):(f||(d.push({type:"category",
label:j["Recent searches"]}),f=!0),d.push({type:"proposal",label:a[c].name,value:a[c].name}));b(d)})},{group:"globalSearch",extendedProvider:function(b,a){var c=g.getServiceReferences("orion.search.proposal");if(!c||c.length===0)a(null);else{var d=[];c.forEach(function(a){var c=a.getProperty("filterForMe");d.push(g.getService(a).run(b).then(function(b){for(var a={filterForMe:c,proposals:[]},d=0;d<b.length;d++){a.proposals.push({type:"category",label:b[d].category});for(var e=0;e<b[d].datalist.length;e++)a.proposals.push({type:"proposal",
label:b[d].datalist[e],value:b[d].datalist[e]})}return a}))});v.all(d).then(function(b){a(b)})}}});I.addEventListener("keydown",function(b){b.defaultPrevented||(b.charCode||b.keyCode)===13&&u.doSearch(n,g,I.value)});G(N);b.addAutoDismiss([b.node(N.containerId),b.node("advancedSearchDropDown")],function(){N.dismiss()});if(c=b.$(".split")){var m=b.$(".sidePanelLayout"),K=b.$(".mainPanelLayout");if(m&&K)O={side:m,main:K},O.splitter=new h.Splitter({node:c,sidePanel:m,mainPanel:K,toggle:!0}),c=new a.Command({name:j["Toggle side panel"],
tooltip:j["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){O.splitter.toggleSidePanel()}}),k.addCommand(c),k.registerCommandContribution("pageActions","orion.toggleSidePane",1,null,!0,new a.CommandKeyBinding("o",!0)),p&&(O.splitter.addResizeListener(function(b){p&&b===K&&p.getTextView().resize()}),p.getTextView().setKeyBinding(new d.KeyBinding("o",!0),"toggleOutliner"),p.getTextView().setAction("toggleOutliner",function(){O.splitter.toggleSidePanel();return!0},{name:j["Toggle Outliner"]}))}c=
new a.Command({name:j["Make Favorite"],tooltip:j["Add to the favorites list"],imageClass:"core-sprite-makeFavorite",id:"orion.makeFavorite",visibleWhen:function(b){b=Array.isArray(b)?b:[b];if(b.length===0)return!1;for(var a=0;a<b.length;a++)if(!b[a].Location)return!1;return!0},callback:function(b){for(var b=Array.isArray(b.items)?b.items:[b.items],a=g.getService("orion.core.favorite"),c=g.getService("orion.page.progress"),d=function(b){return function(d){d?g.getService("orion.page.message").setMessage(b.Name+
j[" is already a favorite."],2E3):c.progress(a.makeFavorites(b),"Making favorite "+b.Name)}},e=0;e<b.length;e++){var f=b[e];c.progress(a.hasFavorite(f.ChildrenLocation||f.Location),"Checking favorite "+f.Name).then(d(f))}}});k.addCommand(c);var J=function(b,a,c){var d=a.getService("orion.core.favorite"),e=a.getService("orion.page.progress");d||(d=new r.FavoritesService({serviceRegistry:a}),d=a.getService("orion.core.favorite"));var f=new t.OpenResourceDialog({searcher:b,progress:e,searchRenderer:b.defaultRenderer,
favoriteService:d,onHide:function(){c&&c.getTextView().focus()}});window.setTimeout(function(){f.show()},0)},c=new a.Command({name:j["Find File Named..."],tooltip:j["Choose a file by name and open an editor on it"],id:"eclipse.openResource",callback:function(){J(n,g,p)}});p&&(p.getTextView().setKeyBinding(new d.KeyBinding("f",!0,!0,!1),c.id),p.getTextView().setAction(c.id,function(){J(n,g,p);return!0},c));k.addCommand(c);k.registerCommandContribution("globalActions","eclipse.openResource",100,null,
!0,new a.CommandKeyBinding("f",!0,!0));c=new a.Command({name:j["Global search"],tooltip:j["Global search"],id:"eclipse.globalSearch",callback:function(){var a=b.node("search");a&&a.focus()}});p&&(p.getTextView().setKeyBinding(new d.KeyBinding("h",!0,!1,!0),c.id),p.getTextView().setAction(c.id,function(){var a=p.getSelection(),c=null;a.end>a.start&&(c=p.getModel().getText(a.start,a.end));if(a=b.node("search")){if(c)a.value=c;a.focus()}return!0},c));k.addCommand(c);k.registerCommandContribution("globalActions",
"eclipse.globalSearch",101,null,!0,new a.CommandKeyBinding("h",!0,!1,!0));c=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 a=b.node("banner"),c=b.node("footer"),d=b.$(".content-fixedHeight");a.style.display==="none"?(a.style.display="block",c.style.display="block",d.classList.remove("content-fixedHeight-maximized")):(a.style.display="none",c.style.display="none",d.classList.add("content-fixedHeight-maximized"));
p&&p.getTextView().resize();return!0}});k.addCommand(c);k.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new a.CommandKeyBinding("m",!0,!0));p&&(p.getTextView().setKeyBinding(new a.CommandKeyBinding("m",!0,!0),c.id),p.getTextView().setAction(c.id,c.callback,c));y&&y.addHandler({isActive:function(){return A.style.display==="block"},cancel:function(){return this.isActive()?(A.style.display="none",!0):!1}});y=new a.Command({name:j["System Configuration Details"],tooltip:j["System Config Tooltip"],
id:"orion.configDetailsPage",hrefCallback:function(){return l.toUrl("help/about.html")}});k.addCommand(y);k.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new a.CommandKeyBinding(112,!0,!0));y=new a.Command({name:j["Background Operations"],tooltip:j["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return l.toUrl("operations/list.html")}});k.addCommand(y);k.registerCommandContribution("globalActions","orion.backgroundOperations",
100,null,!0,new a.CommandKeyBinding("o",!0,!0));y=new a.Command({name:j["Show Keys"],tooltip:j["Show a list of all the keybindings on this page"],id:"eclipse.keyAssist",callback:function(){if(A.style.display==="none"){var a;b.empty(A);if(p){a=document.createElement("h2");a.appendChild(document.createTextNode(j.Editor));A.appendChild(a);a=p.getTextView().getActions(!1);for(var c=0;c<a.length;c++){var d=a[c],f=d,g=p.getTextView(),h=g.getActionDescription(d);if(h&&h.name)f=h.name;d=g.getKeyBindings(d);
for(g=0;g<d.length;g++){var h=e.getUserKeyString(d[g]),i=document.createElement("span");i.role="listitem";i.appendChild(document.createTextNode(h+" = "+f));i.appendChild(document.createElement("br"));A.appendChild(i)}}}a=document.createElement("h2");a.appendChild(document.createTextNode(j.Global));A.appendChild(a);k.showKeyBindings(A);A.style.display="block"}else A.style.display="none";return!0}});k.addCommand(y);k.registerCommandContribution("globalActions","eclipse.keyAssist",100,null,!0,new a.CommandKeyBinding(191,
!1,!0));p&&(c=window.navigator.platform.indexOf("Mac")!==-1,p.getTextView().setKeyBinding(new a.CommandKeyBinding(191,!1,!0,!c,c),y.id),p.getTextView().setAction(y.id,y.callback,y));L(k);E(g,y.callback);H(g);window.addEventListener("hashchange",function(){k.processURL(window.location.href)},!1);window.setTimeout(function(){C(g)},0)},getToolbarElements:M,getMainSplitter:function(){return O},layoutToolbarElements:Q,setPageTarget:function(a){var d,e,f=a.breadcrumbRootName;a.target?(a.searchService&&
a.searchService.setLocationByMetaData(a.target),a.fileService&&!a.breadcrumbTarget&&(e=f?f+" ":"",e+=a.fileService.fileServiceName(a.target.Location),f=null),d=a.name||a.target.Name,S=a.target,I(a.serviceRegistry,a.target,T,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||(f=f||a.task||a.name),d=a.name);(J=a.title)||(J=d?d+" - "+a.task:a.task);window.document.title=J;b.empty(b.node("location"));new c.BreadCrumbs({container:"location",resource:a.breadcrumbTarget||a.target,rootSegmentName:f,
workspaceRootSegmentName:e,makeHref:a.makeBreadcrumbLink})},setDirtyIndicator:function(a){if(J)J.charAt(0)==="*"&&!a&&(J=J.substring(1)),a&&J.charAt(0)!=="*"&&(J="*"+J),window.document.title=J;var c=b.node("dirty");if(c)c.textContent=a?"*":""},setPageCommandExclusions:function(a){T=a},notifyAuthenticationSite:k}});
define("orion/status",["require","orion/webui/littlelib","orion/globalCommands"],function(j,l,i){function a(a,e,d,c,b){this._serviceRegistry=a;this._serviceRegistration=a.registerService("orion.page.message",this);this._operationsClient=e;this.notificationContainerDomId=b;this.domId=d;this.progressDomId=c||d;this._hookedClose=!1}function f(a,e,d,c){this.statusService=a;this.progressId=e;if(d){this.deferred=d;this.begin(c);var b=this;d.then(function(){b.done.bind(b)()},function(){b.done.bind(b)()})}}
a.prototype={_init:function(){var a=l.node("closeNotifications"),e=this;a&&!this._hookedClose&&(a.addEventListener("click",function(){e.setProgressMessage("")},!1),a.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&e.setProgressMessage("")},!1))},_getNotifierElements:function(){if(!this._notifierElements)this._notifierElements=i.getToolbarElements(this.notificationContainerDomId);return this._notifierElements},setMessage:function(a,e,d){this._init();this.currentMessage=
a;var c=l.node(this.domId);if(typeof d==="boolean"){var b=this,f=c.getAttribute("aria-live");c.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){a===b.currentMessage&&(l.empty(c),c.appendChild(document.createTextNode(a)),window.setTimeout(function(){c.setAttribute("aria-live",f)},100))},100)}else l.empty(c),c.appendChild(document.createTextNode(a));typeof e==="number"&&(b=this,window.setTimeout(function(){a===b.currentMessage&&(l.empty(c),c.appendChild(document.createTextNode("")))},
e))},setErrorMessage:function(a){this.currentMessage=a;this._init();var e=a.responseText||a.message||a;try{e=JSON.parse(e)}catch(d){}var a=e.Message||e,c="red";if(e.Severity)switch(e.Severity){case "Warning":c="#FFCC00";break;case "Error":c="red";break;case "Info":case "Ok":c="green"}e=document.createElement("span");e.style.color=c;e.appendChild(document.createTextNode(a));a=l.node(this.domId);l.empty(a);a.appendChild(e)},setProgressMessage:function(a){this._init();this.currentMessage=a;var e=document.createElement("span");
e.classList.add("imageSprite");e.classList.add("core-sprite-progress");var d=l.node(this.progressDomId);l.empty(d);d.appendChild(e);d.appendChild(document.createTextNode(a));e=l.node(this.notificationContainerDomId);e.classList.add("progressNormal");if(a&&a.length>0)e.classList.add("slideContainerActive");else if(this._progressMonitors&&this._progressMonitors.length>0)return this._renderOngoingMonitors();else e.classList.remove("slideContainerActive");i.layoutToolbarElements(this._getNotifierElements())},
setProgressResult:function(a){this.currentMessage=a;var e=a.responseText||a;try{e=JSON.parse(e)}catch(d){}this._init();var c=e.Message||e,b="core-sprite-info",f="progressInfo",j=document.createElement("span");j.classList.add("imageSprite");a=[];if(e.Severity)switch(e.Severity){case "Warning":b="core-sprite-warning";f="progressWarning";a.push("progressInfo");a.push("progressError");a.push("progressNormal");break;case "Error":b="core-sprite-error";f="progressError";a.push("progressWarning");a.push("progressInfo");
a.push("progressNormal");break;default:a.push("progressWarning"),a.push("progressError"),a.push("progressNormal")}j.classList.add(b);var o=l.node(this.progressDomId),b=l.node(this.notificationContainerDomId);l.empty(o);o.appendChild(j);e.HTML?(e=document.createElement("span"),e.innerHTML=c,o.appendChild(e)):o.appendChild(document.createTextNode("   "+c));if(f&&this.progressDomId!==this.domId){b.classList.add(f);for(c=0;c<a.length;c++)b.classList.remove(a[c])}b.classList.add("slideContainerActive");
i.layoutToolbarElements(this._getNotifierElements())},showWhile:function(a,e){var d=this;if(e){d.setProgressMessage(e);var c=function(){e===d.currentMessage&&d.setProgressMessage("")};a.then(c,c)}return a},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(a,e){return new f(this,++this._lastProgressId,a,e)},_renderOngoingMonitors:function(){if(this._progressMonitors.length>0){var a="",e=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(e||(a+=", "),
a+=this._progressMonitors[d].status,e=!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()}};
a.prototype.constructor=a;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:a,ProgressMonitor:f}});
define("orion/editorCommands","i18n!orion/edit/nls/messages,orion/i18nUtil,orion/webui/littlelib,orion/Deferred,orion/URITemplate,orion/commands,orion/globalCommands,orion/extensionCommands,orion/contentTypes,orion/editor/keyBinding,orion/editor/undoStack,orion/searchUtils,orion/PageUtil".split(","),function(j,l,i,a,f,g,e,d,c,b,h,m,o){var e={},r=null;e.EditorCommandFactory=function(){function e(a,b,c,d,f,g,h,i){this.serviceRegistry=a;this.commandService=b;this.fileClient=c;this.inputManager=d;this.toolbarId=
f;this.pageNavId=h;this.isReadOnly=g;this._searcher=i}e.prototype={generateEditorCommands:function(e){function h(a){if(r)return r;var b=a.getService("orion.core.contenttypes");b||(b=new c.ContentTypeService(a),b=a.getService("orion.core.contenttypes"));return b.getContentTypes().then(function(a){return r=a})}function n(a){var c=new b.KeyBinding;b.KeyBinding.apply(c,a);return c}function q(a){var b={Severity:"Error"};a.status===0?b.Message=j["No response from server.  Check your internet connection and try again."]:
b=a;(a=serviceRegistry.getService("orion.page.message"))?a.setProgressResult(b):window.console.log(b)}if(!this.isReadOnly){e.getTextView().setKeyBinding(new b.KeyBinding("s",!0),"save");var s=this;this.inputManager.onSave?e.getTextView().setAction("save",function(){var a=e.getText();s.inputManager.onSave(s.inputManager.getInput(),a,function(){e.setInput(s.inputManager.getInput(),null,a,!0);s.inputManager.afterSave&&s.inputManager.afterSave()},function(a){a.log=!0});return!0},{name:j.Save}):e.getTextView().setAction("save",
function(){var a=e.getText(),b={ETag:s.inputManager.getFileMetadata().ETag},b=s.fileClient.write(s.inputManager.getInput(),a,b),c=s.serviceRegistry.getService("orion.page.progress");c&&c.progress(b,l.formatMessage(j["Saving file {0}"],s.inputManager.getInput()));b.then(function(b){s.inputManager.getFileMetadata().ETag=b.ETag;e.setInput(s.inputManager.getInput(),null,a,!0);s.inputManager.afterSave&&s.inputManager.afterSave()},function(b){b.status===412?confirm(j["Resource is out of sync with the server. Do you want to save it anyway?"])&&
(b=s.fileClient.write(s.inputManager.getInput(),a),c&&c.progress(b,l.formatMessage(j["Saving file {0}"],s.inputManager.getInput())),b.then(function(b){s.inputManager.getFileMetadata().ETag=b.ETag;e.setInput(s.inputManager.getInput(),null,a,!0);s.inputManager.afterSave&&s.inputManager.afterSave()},q)):q(b)});return!0},{name:j.Save});this.commandService.addCommand(new g.Command({name:j.Save,tooltip:j["Save this file"],id:"orion.save",callback:function(){e.getTextView().invokeAction("save")}}));this.commandService.registerCommandContribution(this.toolbarId,
"orion.save",1,null,!1,new g.CommandKeyBinding("s",!0));var w=new g.ParametersDescription([new g.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var a=e.getModel().getLineAtOffset(e.getCaretOffset())+1;return[new g.CommandParameter("line","number","Line:",a.toString())]}),w=new g.Command({name:j["Go to Line"],tooltip:j["Go to specified line number"],id:"orion.gotoLine",parameters:w,callback:function(a){var b=e.getModel();a.parameters&&a.parameters.valueFor("line")?
a=a.parameters.valueFor("line"):(a=b.getLineAtOffset(e.getCaretOffset()),(a=prompt(j["Go to line:"],a+1))&&(a=parseInt(a,10)));if(a)e.onGotoLine(a-1,0)}});this.commandService.addCommand(w);this.commandService.registerCommandContribution(this.pageNavId,"orion.gotoLine",1,null,!0,new g.CommandKeyBinding("l",!0),new g.URLBinding("gotoLine","line"));e.getTextView().setKeyBinding(new b.KeyBinding("l",!0),"gotoLine");e.getTextView().setAction("gotoLine",function(){s.commandService.runCommand("orion.gotoLine");
return!0},w);var w=new g.ParametersDescription([new g.CommandParameter("find","text","Find:")],{clientCollect:!0},function(){var a=e.getSelection(),b="";a.end>a.start&&(b=e.getModel().getText(a.start,a.end));return[new g.CommandParameter("find","text","Find:",b)]}),v=this,w=new g.Command({name:j.Find,tooltip:j.Find,id:"orion.editor.find",parameters:w,callback:function(a){if(v._searcher){var b="",c=null,d=e.getSelection();d.end>d.start?b=e.getModel().getText(d.start,d.end):a.parameters&&a.parameters.valueFor("find")&&
(b=a.parameters.valueFor("find"),c=o.matchResourceParameters(),m.convertFindURLBinding(c));c?(v._searcher.setOptions({useRegExp:c.regEx,ignoreCase:!c.caseSensitive}),c.atLine?(a=e.getModel().getLineStart(c.atLine-1),e.moveSelection(a,a,function(){v._searcher.buildToolBar(b,c.replaceWith);v._searcher.findNext(!0)},focus)):(v._searcher.buildToolBar(b,c.replaceWith),v._searcher.findNext(!0))):v._searcher.buildToolBar(b);return!0}return!1}});this.commandService.addCommand(w);this.commandService.registerCommandContribution(this.pageNavId,
"orion.editor.find",2,null,!0,new g.CommandKeyBinding("f",!0),new g.URLBinding("find","find"));e.getTextView().setKeyBinding(new b.KeyBinding("f",!0),"find");e.getTextView().setAction("find",function(){s.commandService.runCommand("orion.editor.find");return!0},w);var x=this.serviceRegistry.getServiceReferences("orion.edit.command"),z=this.inputManager,t=this.serviceRegistry.getService("orion.page.progress"),D=function(a,b,c){c.callback=function(){e=this;var c=e.getSelection(),d=e.getModel(),g=d.getText(),
h=function(a){a&&a.text?(e.setText(a.text),a.selection&&(e.setSelection(a.selection.start,a.selection.end),e.getTextView().focus())):typeof a==="string"&&(e.setText(a,c.start,c.end),e.setSelection(c.start,c.start+a.length),e.getTextView().focus())};t.progress(b.run(d.getText(c.start,c.end),g,c,z.getInput()),l.formatMessage(j["Running {0}"],a.name)).then(function(b){if(b&&b.uriTemplate){var c=(new f(b.uriTemplate)).expand(z.getFileMetadata()),d=document.createElement("iframe");d.id=a.id;d.name=a.id;
d.type="text/html";d.sandbox="allow-scripts allow-same-origin";d.frameborder=1;d.src=c;d.className="delegatedUI";if(b.width)d.style.width=b.width;if(b.height)d.style.height=b.height;window.document.body.appendChild(d);window.addEventListener("message",function M(b){b.source===d.contentWindow&&typeof b.data==="string"&&(b=JSON.parse(b.data),b.pageService==="orion.page.delegatedUI"&&b.source===a.id&&(b.cancelled||b.result&&h(b.result),window.removeEventListener("message",M,!1),window.document.body.removeChild(d)))},
!1)}else h(b)});return!0};c.callback=c.callback.bind(e);return new g.Command(c)};a.when(h(this.serviceRegistry),function(){var b=[],c=100;x.forEach(function(a){for(var f=s.serviceRegistry.getService(a),g={},h=a.getPropertyKeys(),i=0;i<h.length;i++)g[h[i]]=a.getProperty(h[i]);g.forceSingleItem=!0;a=d._createCommandOptions(g,a,s.serviceRegistry,r,!1,function(){return z.getFileMetadata()});b.push(a);a.then(function(a){a=D(g,f,a);s.commandService.addCommand(a);s.commandService.registerCommandContribution(s.toolbarId,
a.id,c);if(g.key){var b=e.getTextView();b.setKeyBinding(n(g.key),a.id);b.setAction(a.id,a.callback,a)}});c++});a.all(b,function(a){return{_error:a}}).then(function(){if(z.getFileMetadata()){var a=i.node("pageActions");a&&(s.commandService.destroy(a),s.commandService.renderCommands(a.id,a,e,e,"button"));if(a=i.node("pageNavigationActions"))s.commandService.destroy(a),s.commandService.renderCommands(a.id,a,e,e,"button")}})})}}};return e}();e.UndoCommandFactory=function(){function a(b,c,d){this.serviceRegistry=
b;this.commandService=c;this.toolbarId=d}a.prototype={createUndoStack:function(a){var b=new h.UndoStack(a.getTextView(),200),c=new g.Command({name:j.Undo,id:"orion.undo",callback:function(){this.getTextView().invokeAction("undo")}});a.getTextView().setAction("undo",function(){b.undo();return!0},c);this.commandService.addCommand(c);c=new g.Command({name:j.Redo,id:"orion.redo",callback:function(){this.getTextView().invokeAction("redo")}});a.getTextView().setAction("redo",function(){b.redo();return!0},
c);this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.toolbarId,"orion.undo",400,null,!0,a.getTextView().getKeyBindings("undo")[0]);this.commandService.registerCommandContribution(this.toolbarId,"orion.redo",401,null,!0,a.getTextView().getKeyBindings("redo")[0]);return b}};return a}();return e});
define("orion/compare/compare-container","i18n!orion/compare/nls/messages,require,orion/Deferred,orion/webui/littlelib,orion/compare/diff-parser,orion/compare/compare-rulers,orion/editor/contentAssist,orion/editorCommands,orion/editor/editor,orion/editor/editorFeatures,orion/globalCommands,orion/commands,orion/editor/textModel,orion/editor/textView,orion/compare/compare-features,orion/compare/compareUtils,orion/compare/diff-provider,orion/compare/jsdiffAdapter,orion/highlight,orion/compare/diffTreeNavigator,orion/searchAndReplace/textSearcher,orion/fileClient".split(","),function(j,
l,i,a,f,g,e,d,c,b,h,m,o,r,q,k,p,n,u,s,w,v){var x={};x.DefaultDiffProvider=function(){function a(b){this.serviceRegistry=b;this._diffProvider=new p.DiffProvider(b)}a.prototype={_resolveTwoFiles:function(a,b,c){var d=this;i.all([d._getContentType(a),d._getContentType(b)],function(a){return{_error:a}}).then(function(e){if(Array.isArray(e)&&e.length===2&&e[0]&&e[1]){e[0]._error&&c&&c(e[0]._error);e[1]._error&&c&&c(e[1]._error);var f=e[0],e=e[1];d.callBack({baseFile:{URL:a,Name:d._resolveFileName(a),Type:f},
newFile:{URL:b,Name:d._resolveFileName(b),Type:e},diff:d._diffContent})}else f=a?d._resolveFileName(a):"",e=b?d._resolveFileName(b):"",d.callBack({baseFile:{URL:a,Name:f,Type:null},newFile:{URL:b,Name:e,Type:null},diff:d._diffContent})})},_resolveDiff:function(a,b,c,d){if(b)this._resolveTwoFiles(b,a,d);else if(this._diffProvider){var e=this;e._diffProvider.getDiffContent(a).then(function(b){e._diffContent=e._hasConflicts?b.split("diff --git")[1]:b;c?e.callBack({diff:e._diffContent}):e._resolveComplexFileURL(a)},
d)}else console.log("A diff provider is needed for compound diff URL")},_resolveFileName:function(a){return a.split("?")[0]},_getContentType:function(a){a=this._resolveFileName(a);return this.serviceRegistry.getService("orion.core.contenttypes").getFilenameContentType(a)},_resolveComplexFileURL:function(a,b){var c=this;this._diffProvider.getDiffFileURI(a).then(function(a){c._resolveTwoFiles(a.Old,a.New,b)},b)},provide:function(a,b,c,d,e,f){this.callBack=e;this._hasConflicts=d;this._resolveDiff(a,
b,c,f)}};return a}();x.CompareStyler=function(){function a(b){this._syntaxHighlither=new u.SyntaxHighlighter(b)}a.prototype={highlight:function(a,b,c,d,e){this._syntaxHighlither.setup(b,c.getTextView(),null,a,!1).then(function(){d&&e&&(c.setAnnotationRulerVisible(!1),d._highlighterLoaded++,d._highlighterLoaded===e&&(d._diffNavigator.renderAnnotations(),d._diffNavigator.gotoBlock(d.options.blockNumber-1,d.options.changeNumber-1)))})}};return a}();x.CompareContainer=function(){function b(){this._diffParser=
new f.DiffParser}b.prototype={_clearOptions:function(){this.options={};this.options.baseFile={URL:"",Name:"",Type:""};this.options.newFile={URL:"",Name:"",Type:""};this.options.blockNumber=1;this.options.changeNumber=0},setOptions:function(a,b){b&&this._clearOptions();if(a)this.options.mapper=a.mapper?a.mapper:this.options.mapper,this.options.commandSpanId=typeof a.commandSpanId==="string"?a.commandSpanId:this.options.commandSpanId,this.options.generateLink=a.generateLink!==void 0&&a.generateLink!==
null?a.generateLink:this.options.generateLink,this.options.editableInComparePage=a.editableInComparePage!==void 0&&a.editableInComparePage!==null?a.editableInComparePage:this.options.editableInComparePage,this.options.gridRenderer=a.gridRenderer||this.options.gridRenderer,this.options.readonly=a.readonly!==void 0&&a.readonly!==null?a.readonly:this.options.readonly,this.options.onPage=a.onPage!==void 0&&a.onPage!==null?a.onPage:this.options.onPage,this.options.wordLevelNav=a.wordLevelNav!==void 0&&
a.wordLevelNav!==null?a.wordLevelNav:this.options.wordLevelNav,this.options.charDiff=a.charDiff!==void 0&&a.charDiff!==null?a.charDiff:this.options.charDiff,this.options.hasConflicts=a.hasConflicts!==void 0&&a.hasConflicts!==null?a.hasConflicts:this.options.hasConflicts,this.options.diffProvider=a.diffProvider?a.diffProvider:this.options.diffProvider,this.options.resource=a.resource?a.resource:this.options.resource,this.options.compareTo=a.compareTo?a.compareTo:this.options.compareTo,this.options.baseFile.URL=
a.baseFile&&a.baseFile.URL?a.baseFile.URL:this.options.baseFile.URL,this.options.baseFile.Name=a.baseFile&&typeof a.baseFile.Name==="string"?a.baseFile.Name:this.options.baseFile.Name,this.options.baseFile.Type=a.baseFile&&a.baseFile.Type?a.baseFile.Type:this.options.baseFile.Type,this.options.baseFile.Content=a.baseFile&&typeof a.baseFile.Content==="string"?a.baseFile.Content:this.options.baseFile.Content,this.options.newFile.URL=a.newFile&&a.newFile.URL?a.newFile.URL:this.options.newFile.URL,this.options.newFile.Name=
a.newFile&&typeof a.newFile.Name==="string"?a.newFile.Name:this.options.newFile.Name,this.options.newFile.Type=a.newFile&&a.newFile.Type?a.newFile.Type:this.options.newFile.Type,this.options.newFile.Content=a.newFile&&typeof a.newFile.Content==="string"?a.newFile.Content:this.options.newFile.Content,this.options.diffURL=a.diffURL?a.diffURL:this.options.diffURL,this.options.diffContent=a.diffContent?a.diffContent:this.options.diffContent,this.options.diffArray=a.diffArray?a.diffArray:this.options.diffArray,
this.options.blockNumber=a.blockNumber?a.blockNumber:this.options.blockNumber,this.options.changeNumber=a.changeNumber?a.changeNumber:this.options.changeNumber,this.options.onSave=a.onSave?a.onSave:this.options.onSave,this.options.callback=a.callback?a.callback:this.options.callback,this._errorCallback=a.errorCallback?a.errorCallback:this._errorCallback,this.options.onSetTitle=a.onSetTitle?a.onSetTitle:this.options.onSetTitle,this.options.toggler=a.toggler?a.toggler:this.options.toggler},initCommands:function(){var a=
this.getCommandSpanId();if(a){var b=new m.Command({name:j["Copy current change from right to left"],tooltip:j["Copy current change from right to left"],imageClass:"core-sprite-leftarrow",id:"orion.compare.copyToLeft",groupId:"orion.compareGroup",callback:function(a){a.items.copyToLeft()}}),c=new m.Command({tooltip:j["Switch to unified diff"],name:j.Unified,id:"orion.compare.toggle2Inline",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.toggler&&a.options.toggler.widgetType===
"twoWay"},callback:function(a){a.items.options.toggler.toggle()}}),d=new m.Command({tooltip:j["Switch to side by side diff"],name:j["Side by side"],id:"orion.compare.toggle2TwoWay",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.toggler&&a.options.toggler.widgetType==="inline"},callback:function(a){a.items.options.toggler.toggle()}}),e=new m.Command({tooltip:j["Generate link of the current diff"],name:j["Generate Link"],id:"orion.compare.generateLink",groupId:"orion.compareGroup",
visibleWhen:function(a){return a.options.resource&&a.options.generateLink},callback:function(a){a.items.generateLink()}}),f=new m.Command({tooltip:j["Open the compare page"],name:j.Compare,id:"orion.compare.openComparePage",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.resource&&!a.options.generateLink},hrefCallback:function(a){return a.items.openComparePage()}}),g=new m.Command({name:j["Next diff block"],tooltip:j["Next diff block"],imageClass:"core-sprite-move_down",id:"orion.compare.nextDiff",
groupId:"orion.compareGroup",callback:function(a){a.items.nextDiff()}}),h=new m.Command({name:j["Previous diff block"],tooltip:j["Previous diff block"],imageClass:"core-sprite-move_up",id:"orion.compare.prevDiff",groupId:"orion.compareGroup",callback:function(a){a.items.prevDiff()}}),i=new m.Command({name:j["Next diff change"],tooltip:j["Next diff change"],imageClass:"core-sprite-move_down",id:"orion.compare.nextChange",groupId:"orion.compareGroup",callback:function(a){a.items.nextChange()}}),k=new m.Command({name:j["Previous diff change"],
tooltip:j["Previous diff change"],imageClass:"core-sprite-move_up",id:"orion.compare.prevChange",groupId:"orion.compareGroup",callback:function(a){a.items.prevChange(a)}});this._commandService.addCommand(b);this._commandService.addCommand(d);this._commandService.addCommand(c);this._commandService.addCommand(e);this._commandService.addCommand(f);this._commandService.addCommand(g);this._commandService.addCommand(h);this._commandService.addCommand(i);this._commandService.addCommand(k);this._commandService.registerCommandContribution(a,
"orion.compare.openComparePage",107);this._commandService.registerCommandContribution(a,"orion.compare.generateLink",108,null,!1,new m.CommandKeyBinding("l",!0,!0));this.options.readonly||this._commandService.registerCommandContribution(a,"orion.compare.copyToLeft",109,null,!1,new m.CommandKeyBinding(37,!0,!1,!0));this._commandService.registerCommandContribution(a,"orion.compare.toggle2Inline",110);this._commandService.registerCommandContribution(a,"orion.compare.toggle2TwoWay",111);this._commandService.registerCommandContribution(a,
"orion.compare.nextDiff",112,null,!1,new m.CommandKeyBinding(40,!0));this._commandService.registerCommandContribution(a,"orion.compare.prevDiff",113,null,!1,new m.CommandKeyBinding(38,!0));this.options.wordLevelNav?(this._commandService.registerCommandContribution(a,"orion.compare.nextChange",114,null,!1,new m.CommandKeyBinding(40,!0,!0)),this._commandService.registerCommandContribution(a,"orion.compare.prevChange",115,null,!1,new m.CommandKeyBinding(38,!0,!0))):(this._commandService.registerCommandContribution(a,
"orion.compare.nextChange",114,null,!0,new m.CommandKeyBinding(40,!0,!0)),this._commandService.registerCommandContribution(a,"orion.compare.prevChange",115,null,!0,new m.CommandKeyBinding(38,!0,!0)))}},getCommandSpanId:function(){var a=this.options.commandSpanId;!a&&this.getDefaultCommandSpanId&&(a=this.getDefaultCommandSpanId());return a},renderCommands:function(){var b=this.getCommandSpanId();b&&(a.empty(a.node(b)),this.options.gridRenderer&&this.options.gridRenderer.navGridHolder?(this.options.gridRenderer.navGridHolder.splice(0,
this.options.gridRenderer.navGridHolder.length),this.options.gridRenderer.additionalCmdRender?this.options.gridRenderer.before?(this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder),this._commandService.renderCommands(b,b,this,this,"tool",null,this.options.gridRenderer.navGridHolder)):(this._commandService.renderCommands(b,b,this,this,"tool",null,this.options.gridRenderer.navGridHolder),this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder)):
this._commandService.renderCommands(b,b,this,this,"tool",null,this.options.gridRenderer.navGridHolder)):this._commandService.renderCommands(b,b,this,this,"tool",null))},generateLink:function(){var a=this.getCurrentDiffPos(),a=k.generateCompareHref(this.options.resource,{compareTo:this.options.compareTo,readonly:this.options.readonly,conflict:this.options.hasConflicts,block:a.block?a.block:1,change:a.change?a.change:0});prompt(j["Copy the link URL:"],a)},openComparePage:function(){var a=this.getCurrentDiffPos();
return k.generateCompareHref(this.options.resource,{compareTo:this.options.compareTo,readonly:!this.options.editableInComparePage,conflict:this.options.hasConflicts,block:a.block?a.block:1,change:a.change?a.change:0})},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},nextDiff:function(){this._diffNavigator.nextDiff()},prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},
clearContent:function(){if(this.options.baseFile)this.options.baseFile.Content=null;if(this.options.newFile)this.options.newFile.Content=null},_getLineDelim:function(){return"\n"},resolveDiffByProvider:function(a){if(this.options.diffProvider){var b=this;b.options.diffProvider.provide(b.options.resource,b.options.compareTo,a,b.options.hasConflicts,function(c){b.options.baseFile.URL=c.baseFile&&typeof c.baseFile.URL==="string"?c.baseFile.URL:b.options.baseFile.URL;b.options.baseFile.Name=c.baseFile&&
typeof c.baseFile.Name==="string"?c.baseFile.Name:b.options.baseFile.Name;b.options.baseFile.Type=c.baseFile&&typeof c.baseFile.Type==="object"?c.baseFile.Type:b.options.baseFile.Type;b.options.baseFile.Content=c.baseFile&&typeof c.baseFile.Content==="string"?c.baseFile.Content:b.options.baseFile.Content;b.options.newFile.URL=c.newFile&&typeof c.newFile.URL==="string"?c.newFile.URL:b.options.newFile.URL;b.options.newFile.Name=c.newFile&&typeof c.newFile.Name==="string"?c.newFile.Name:b.options.newFile.Name;
b.options.newFile.Type=c.newFile&&typeof c.newFile.Type==="object"?c.newFile.Type:b.options.newFile.Type;b.options.newFile.Content=c.newFile&&typeof c.newFile.Content==="string"?c.newFile.Content:b.options.newFile.Content;b.options.diffContent=typeof c.diff==="string"?c.diff:b.options.diffContent;a||typeof b.options.baseFile.Content==="string"?b.setEditor(a):(b.options.callback&&b.options.callback(b.options.baseFile.Name,b.options.newFile.Name),b.getFilesContents(b.options.diffContent?[b.options.baseFile]:
[b.options.baseFile,b.options.newFile]).then(function(){var a=this.setEditor();this._onLoadContents&&this._onLoadContents(a)}.bind(b)))},b.options.errorCallback)}else console.log("A diff provider is needed for Complex diff URL")},resolveDiffByContents:function(a){if(typeof this.options.baseFile.Content==="string"&&typeof this.options.newFile.Content==="string"){if(!this.options.diffContent&&!this._mapper)this.options.diffContent="";this._onLoadContents&&this._onLoadContents();this.setEditor(a);return!0}else return!1},
getFilesContents:function(a){var b=[];a.forEach(function(a){b.push(this._loadSingleFile(a))}.bind(this));return i.all(b,function(a){return{_error:a}})},_loadSingleFile:function(a){return this._registry.getService("orion.page.progress").progress(this._fileClient.read(a.URL),"Getting contents of "+a.URL).then(function(b){a.Content=b;return a}.bind(this),function(b,c){b.status===404?a.Content="":this.errorCallback&&this.errorCallback(b,c);return a}.bind(this))},parseMapper: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(b){a=(new n.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}}},startup:function(a,b){this._onLoadContents=b;this.options.resource?this.resolveDiffByProvider(a):this.resolveDiffByContents(a)}};return b}();x.TwoWayCompareContainer=function(){function e(b,c,d,f){this._diffNavigator=new s.DiffTreeNavigator("word");this._registry=b;this._commandService=this._registry.getService("orion.page.command");
this._fileClient=new v.FileClient(b);this._searchService=this._registry.getService("orion.core.search");this._progress=this._registry.getService("orion.page.progress");this._uiFactory=d;if(!this._uiFactory)this._uiFactory=new q.TwoWayCompareUIFactory({parentDivID:c,showTitle:!1,showLineStatus:!1}),this._uiFactory.buildUI();this._viewLoadedCounter=0;this.setOptions(f,!0);var i=this,k=this._uiFactory.getTitleDiv(!0);k&&a.empty(k);var l=this._uiFactory.getTitleDiv(!1);l&&a.empty(l);if(!this.options.callback)this.options.callback=
function(a,b){k&&l&&(k.appendChild(document.createTextNode(b)),l.appendChild(document.createTextNode(a)))};if(!this._errorCallback)this._errorCallback=function(a,b){if(k&&l){var c=typeof a.message==="string"?a.message:b.xhr.statusText;k.appendChild(document.createTextNode(c));l.appendChild(document.createTextNode(c));k.style.color="red";l.style.color="red"}};this._leftEditorDiv=this._uiFactory.getEditorParentDiv(!0);this._rightEditorDiv=this._uiFactory.getEditorParentDiv(!1);this.initCommands();this._inputManager=
{filePath:"",getInput:function(){return this.filePath},setDirty:function(a){h.setDirtyIndicator(a)},getFileMetadata:function(){return this._fileMetadata},setInput:function(a){if(this.onSetTitle)this.onSetTitle(a,function(a){this.setTitle(a)}.bind(this),function(b){console.error("Error loading file metadata: "+b.message);this.setTitle(a)}.bind(this));else i._progress.progress(i._fileClient.read(a,!0),"Getting file metadata "+a).then(function(a){this._fileMetadata=a;this.setTitle(a.Location,a)}.bind(this),
function(b){console.error("Error loading file metadata: "+b.message);this.setTitle(a)}.bind(this));this.lastFilePath=a},setTitle:function(a,c){var d;if(c)d=c.Name;h.setPageTarget({task:j.Compare,name:d,target:c,serviceRegistry:b,commandService:this._commandService,searchService:this._searchService,fileService:this._fileClient});a.charAt(0)==="*"?(h.setDirtyIndicator(!0),a.substring(1)):h.setDirtyIndicator(!1)},afterSave:function(){i.startup(!0)}};if(this.options.onSave)this._inputManager.onSave=this.options.onSave;
if(this.options.onSetTitle)this._inputManager.onSetTitle=this.options.onSetTitle;this._curveRuler=new g.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv());this._highlighter=[];this._highlighter.push(new x.CompareStyler(this._registry));this._highlighter.push(new x.CompareStyler(this._registry));this.initEditorContainers("\n",j["fetching..."],j["fetching..."],[])}e.prototype=new x.CompareContainer;e.prototype.initEditorContainers=function(b,c,d,e,f){this._leftEditor=this.createEditorContainer(c,
b,e,0,this._leftEditorDiv,this._uiFactory.getStatusDiv(!0),this.options.readonly,f,this.options.newFile);if(this.options.onPage&&(c=a.node("pageActions")))this._commandService.destroy(c),this._commandService.renderCommands(c.id,c,this._leftEditor,this._leftEditor,"button");this._leftTextView=this._leftEditor.getTextView();this._rightEditor=this.createEditorContainer(d,b,e,1,this._rightEditorDiv,this._uiFactory.getStatusDiv(!1),!0,f,this.options.baseFile);this._rightTextView=this._rightEditor.getTextView();
var h=this;this._overviewRuler=new g.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a){h._diffNavigator.matchPositionFromOverview(a)});window.onbeforeunload=function(){if(h._leftEditor.isDirty())return j["There are unsaved changes."]}};e.prototype.getDefaultCommandSpanId=function(){return this._uiFactory.getCommandSpanId()};e.prototype.gotoDiff=function(a,b,c){c=c?this._leftTextView:this._rightTextView;this._diffNavigator.gotoDiff(c.getModel().getLineStart(a)+b,c)};e.prototype.gotoMatch=
function(a,b,c,d,e,f){if(!this.onScroll)this.onScroll=e;if(!this.onLoad)this.onLoad=f;a=this._leftTextView.getModel().getLineStart(a)+c.startIndex;this._leftEditor.moveSelection(a,a)};e.prototype.copyToLeft=function(){this._curveRuler.copyToLeft()};e.prototype.resizeEditors=function(){this._leftTextView&&this._leftTextView.resize();this._rightTextView&&this._rightTextView.resize()};e.prototype.getSplitter=function(){return this._uiFactory.getSplitter()};e.prototype.createEditorContainer=function(a,
e,f,g,h,i,k,l,m){var n=this,p=new o.TextModel(a,e),q="",a=k?new b.UndoFactory:new d.UndoCommandFactory(n._registry,n._commandService,"pageActions"),e=new b.AnnotationFactory,s=new c.Editor({textViewFactory:function(){var a=new r.TextView({parent:h,model:p,readonly:k,tabSize:4});n._viewLoadedCounter++;n._viewLoadedCounter===2&&n._diffNavigator.matchPositionFromOverview(-1);if(n.onLoad)n.onLoad();var b=n.getSplitter();if(b){var c=g===0;b.addResizeListener(function(b){if(b){var d=!1;(d=n._uiFactory.isLeftPane(b)?
c:!c)&&a.resize()}})}return a},undoStackFactory:a,annotationFactory:e,keyBindingFactory:function(a,c,e,f){if(k)n._commandService.addCommandGroup("pageActions","orion.editorActions.unlabeled",200);else{var g=new w.TextSearcher(a,n._commandService,e);(new d.EditorCommandFactory(n._registry,n._commandService,n._fileClient,n._inputManager,"pageActions",k,"pageNavigationActions",g)).generateEditorCommands(a);g=new b.TextActions(a,e);c.push(g);a=new b.SourceCodeActions(a,e,f);c.push(a)}},statusReporter:function(a,
b){if(i)q=b?j["ERROR: "]+a:a,i.textContent=""+q},domNode:h});s.installTextView();s.setOverviewRulerVisible(!1);if(!k){var u=this._inputManager;s.addEventListener("DirtyChanged",function(){u.setDirty(s.isDirty())})}var v=s.getTextView();l&&m&&typeof m.Name==="string"&&typeof m.Type==="string"&&(s.setInput(m.Name),this._highlighter[g].highlight(m.Name,m.Type,s));v.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!n._diffNavigator.autoSelecting&&n._diffNavigator.editorWrapper[0].diffFeeder&&
(a=v.getCaretOffset(),n._diffNavigator.gotoDiff(a,v))});g===0?(v.getModel().addEventListener("Changed",function(a){n._curveRuler.onChanged(a)}),v.addEventListener("Scroll",function(){n._curveRuler&&(n._curveRuler.matchPositionFrom(!0),n._curveRuler.render());if(n.onScroll)n.onScroll()})):v.addEventListener("Scroll",function(){n._curveRuler&&n._curveRuler.render()});return s};e.prototype.destroy=function(){this._leftTextView&&(this._diffNavigator.destroy(),this._leftEditor.destroy(),this._rightEditor.destroy(),
this._uiFactory.destroy())};e.prototype.addRulers=function(){if(this._rightTextView&&this._leftTextView&&!this._hasRuler)this._leftTextViewRuler=new g.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),this._rightTextViewRuler=new g.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),this._leftTextView.addRuler(this._leftTextViewRuler),
this._rightTextView.addRuler(this._rightTextViewRuler),this._rightTextView.addRuler(this._overviewRuler),this._hasRuler=!0};e.prototype.setEditor=function(a){var b=this.options.baseFile.Content,c=this.options.newFile.Content,d=this.options.diffContent;c?d=this.parseMapper(b,c,d,this.options.hasConflicts,!0):(d=this.parseMapper(b,c,d,this.options.hasConflicts,a),c=d.output);this._highlighterLoaded=0;if(this._leftEditor)if(a)this._diffNavigator.initMapper(d.mapper),this._curveRuler.init(d.mapper,this._leftEditor,
this._rightEditor,this._diffNavigator),this.renderCommands(),this._leftTextView.redrawRange(),this._rightTextView.redrawRange();else{var a=new s.TwoWayDiffBlockFeeder(this._rightTextView.getModel(),d.mapper,1),e=new s.TwoWayDiffBlockFeeder(this._leftTextView.getModel(),d.mapper,0);this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._rightEditor,this._leftEditor,a,e,this._overviewRuler,this._curveRuler);this._curveRuler.init(d.mapper,this._leftEditor,this._rightEditor,this._diffNavigator);
this._inputManager.filePath=this.options.newFile.URL;this._rightEditor.setInput(this.options.baseFile.Name,null,b);this._leftEditor.setInput(this.options.newFile.Name,null,c);this._highlighter[0].highlight(this.options.newFile.Name,this.options.newFile.Type,this._leftEditor,this,2);this._highlighter[1].highlight(this.options.baseFile.Name,this.options.baseFile.Type,this._rightEditor,this,2);this.renderCommands();this.addRulers();this.options.readonly||this._inputManager.setInput(this.options.newFile.URL,
this._leftEditor)}else this.initEditorContainers(d.delim,c,b,d.mapper,!0);this._viewLoadedCounter>1&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);b=this._leftTextView.getModel().getLineCount()*this._leftTextView.getLineHeight()+5;c=this._rightTextView.getModel().getLineCount()*this._rightTextView.getLineHeight()+5;return b>c?b:c};return e}();x.InlineCompareContainer=function(){function d(b,c,e){this._diffNavigator=new s.DiffTreeNavigator("word");this._registry=
b;this._commandService=this._registry.getService("orion.page.command");this._fileClient=new v.FileClient(b);this._statusService=this._registry.getService("orion.page.message");this._progress=this._registry.getService("orion.page.progress");this.setOptions(e,!0);this.setOptions({readonly:!0});var f=this;if(!this.options.callback)this.options.callback=function(){var b=a.node("fileNameInViewer");if(b)a.empty(b),b.appendChild(document.createTextNode(f._diffTitle)),b.style.color="#6d6d6d";f._statusService.setProgressMessage("")};
if(!this._errorCallback)this._errorCallback=function(a,b){var c=[];c.Severity="Error";c.HTML=!1;try{var d=JSON.parse(a.responseText);c.Message=d.DetailedMessage?d.DetailedMessage:d.Message}catch(e){c.Message=typeof a.message==="string"?a.message:b.xhr.statusText}this._statusService.setProgressResult(c)};this.initCommands();this._highlighter=[];this._highlighter.push(new x.CompareStyler(this._registry));this._editorDivId=c;this.initEditorContainers("","\n",[],[]);this.hasContent=!1}d.prototype=new x.CompareContainer;
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());this.hasContent=!1};d.prototype.destroy=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.destroy())};d.prototype.createEditorContainer=function(d,e,f,h,i,j){var k=a.node(this._editorDivId),l=this,m=new o.TextModel(d,e),d=new b.UndoFactory,e=new b.AnnotationFactory,d=new c.Editor({textViewFactory:function(){return new r.TextView({parent:k,model:m,readonly:!0,tabSize:4})},undoStackFactory:d,annotationFactory:e,keyBindingFactory:function(){},
statusReporter:function(){},domNode:k});d.installTextView();d.setOverviewRulerVisible(!1);d.setAnnotationRulerVisible(!1);i&&j&&d.setInput(j.Name);var n=d.getTextView();this._rulerOrigin=new g.LineNumberCompareRuler(this._diffNavigator,1,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._rulerNew=new g.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._overviewRuler=
new g.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a){l._diffNavigator.matchPositionFromOverview(a)});n.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!l._diffNavigator.autoSelecting&&l._diffNavigator.editorWrapper[0].diffFeeder&&(a=n.getCaretOffset(),l._diffNavigator.gotoDiff(a,n))});return d};d.prototype.initEditorContainers=function(a,b,c,d){this._editor=this.createEditorContainer(b,a,c,d,this.options.newFile);this._textView=
this._editor.getTextView()};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.setDiffTitle=function(a){this._diffTitle=a};d.prototype.setEditor=function(){var a=this.options.baseFile.Content,b=this.options.newFile.Content,c=this.options.diffContent;this.hasContent=!0;b=this.parseMapper(a,b,c,this.options.hasConflicts,
!this.options.toggler);this._highlighterLoaded=0;this._textView?(this._textView.getModel().setText(a),a=new s.inlineDiffBlockFeeder(b.mapper,1),c=new s.inlineDiffBlockFeeder(b.mapper,0),k.mergeDiffBlocks(this._textView.getModel(),c.getDiffBlocks(),b.mapper,b.diffArray.array,b.diffArray.index,this._diffParser._lineDelimiter),a.setModel(this._textView.getModel()),c.setModel(this._textView.getModel()),this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editor,this._editor,a,c,this._overviewRuler),
this._highlighter[0].highlight(this.options.baseFile.Name,this.options.baseFile.Type,this._editor,this,1),this.renderCommands(),this.addRulers(),a=this._textView.getTopIndex(),this._textView.redrawLines(a,a+1,this._overviewRuler),this._textView.redrawLines(a,a+1,this._rulerOrigin),this._textView.redrawLines(a,a+1,this._rulerNew),this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)):this.initEditorContainers(b.delim,a,b.mapper,b.diffArray,!0);return this._textView.getLineHeight()*
this._textView.getModel().getLineCount()+5};d.prototype.setConflicting=function(a){this._conflcit=a};return d}();x.toggleableCompareContainer=function(){function b(a,c,d,e){if(e)e.toggler=this;d==="inline"?(this.widgetType="inline",this._widget=new x.InlineCompareContainer(a,c,e)):(this.widgetType="twoWay",this._widget=new x.TwoWayCompareContainer(a,c,null,e));this._parentDivId=c;this._serviceRegistry=a}b.prototype={startup:function(a){this._widget.startup(!1,a)},toggle:function(){var b=this._widget.options,
c=this._widget.getCurrentDiffPos();b.blockNumber=c.block;b.changeNumber=c.change;this._widget.destroy();a.empty(a.node(this._parentDivId));this.widgetType==="inline"?(this.widgetType="twoWay",this._widget=new x.TwoWayCompareContainer(this._serviceRegistry,this._parentDivId,null,b)):(this.widgetType="inline",this._widget=new x.InlineCompareContainer(this._serviceRegistry,this._parentDivId,b));this._widget.setEditor()}};return b}();return x});
define("compare/compare","orion/bootstrap,orion/status,orion/progress,orion/operationsClient,orion/commands,orion/fileClient,orion/searchClient,orion/globalCommands,orion/compare/compare-features,orion/compare/compare-container,orion/compare/compareUtils,orion/contentTypes,orion/PageUtil".split(","),function(j,l,i,a,f,g,e,d,c,b,h,m,o){j.startup().then(function(h){var j=h.serviceRegistry,h=h.preferences,k=new f.CommandService({serviceRegistry:j}),p=new g.FileClient(j);new m.ContentTypeService(j);var p=
new e.Searcher({serviceRegistry:j,commandService:k,fileService:p}),n=new a.OperationsClient(j);new l.StatusReportingService(j,n,"statusPane","notifications","notificationArea");new i.ProgressService(j,n);d.generateBanner("orion-compare",j,k,h,p);var u=new c.TwoWayCompareUIFactory({parentDivID:"compareContainer",showTitle:!0,showLineStatus:!0});u.buildUI();var s=new b.DefaultDiffProvider(j),w=function(){var a=o.matchResourceParameters();(new b.TwoWayCompareContainer(j,"compareContainer",u,{readonly:a.readonly===
"true",onPage:!0,generateLink:!0,commandSpanId:"pageNavigationActions",hasConflicts:a.conflict==="true",diffProvider:s,resource:a.resource,compareTo:a.compareTo,blockNumber:a.block,changeNumber:a.change})).startup()};w();window.addEventListener("hashchange",function(){w()},!1)})});