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

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


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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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


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


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

 Contributors:
 IBM Corporation - initial API and implementation

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


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


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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://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) 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) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://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

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


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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - _initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation
 RequireJS i18n 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) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and 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 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and 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(){function j(b,g,e,d,c,a){g[b]&&(e.push(b),(g[b]===!0||g[b]===1)&&d.push(c+b+"/"+a))}function k(b,g,e,d,c){g=d+g+"/"+c;require._fileExists(b.toUrl(g))&&e.push(g)}var i=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/,b={};define("i18n",{version:"1.0.0",load:function(f,g,e,d){var d=d||{},c=i.exec(f),a=c[1],h=c[4],l=c[5],n=h.split("-"),q=[],p={},m,t,o="";c[5]?(a=c[1],f=a+l):(l=c[4],h=d.locale||(d.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),
n=h.split("-"));if(d.isBuild){q.push(f);k(g,"root",q,a,l);for(m=0;t=n[m];m++)o+=(o?"-":"")+t,k(g,o,q,a,l);g(q,function(){e()})}else g([f],function(c){var h=[];j("root",c,h,q,a,l);for(m=0;t=n[m];m++)o+=(o?"-":"")+t,j(o,c,h,q,a,l);g(q,function(){var m,o;for(m=h.length-1;m>-1&&(t=h[m]);m--){o=c[t];if(o===!0||o===1)o=g(a+t+"/"+l);var d=p,n=void 0;for(n in o)!(n in b)&&!(n in d)&&(d[n]=o[n])}e(p)})})}})})();
define("orion/i18n",[],function(){return{load:function(j,k,i,b){var b=b||{},f=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,g=f.exec(j);if(g)if(k.defined(j))i(k(j));else if(b.isBuild||b.isTest)i({});else{var e=g[1],d=g[3]?g[2]:"",c=g[3]||g[2];k(["orion/bootstrap"],function(a){a.startup().then(function(a){var l=a.serviceRegistry,a=l.getServiceReferences("orion.i18n.message");if(d)a.some(function(a){return j===a.getProperty("name")?(l.getService(a).getMessageBundle().then(function(m){i(m)},function(){i({})}),
!0):!1})||i({});else{var n={},q;a.forEach(function(a){var m=a.getProperty("name");if((g=f.exec(m))&&e===g[1]&&c===(g[3]||g[2]))if(d=g[3]?g[2]:""){if((a=b.locale||(typeof navigator!=="undefined"?navigator.language||navigator.userLanguage:null))&&a.indexOf(d)===0)n[d]=!0,k.specified(m)||define(m,["orion/i18n!"+m],function(m){return m})}else q=a});k.specified(j)?i(n):q?l.getService(q).getMessageBundle().then(function(a){Object.keys(n).forEach(function(m){typeof a[m]==="undefined"&&(a[m]=n[m])});define(j,
[],a);i(a)},function(){define(j,[],n);i(n)}):(define(j,[],n),i(n))}})})}else i(null)}}});
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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});return i});
(function(j,k){typeof define==="function"&&define.amd?define("orion/Deferred",[],k):typeof exports==="object"?module.exports=k():(j.orion=j.orion||{},j.orion.Deferred=k())})(this,function(){function j(){for(var a;a=e.shift()||d.shift();)a();c=!1}function k(a,h){(h?d:e).push(a);c||(c=!0,h?setTimeout(j,0):j())}function i(a){return function(){a.apply(null,arguments)}}function b(){}function f(){var a=Error("Cancel");a.name="Cancel";return a}function g(){function a(){for(var a;a=e.shift();){var m=a.deferred,
t=d==="resolved"?"resolve":"reject";if(typeof a[t]==="function")try{var o=a[t](c);o&&typeof o.then==="function"?(m.cancel=o.cancel||b,o.then(i(m.resolve),i(m.reject),m.progress)):m.resolve(o)}catch(w){m.reject(w)}else m[t](c)}}var c,d,e=[],q=this;this.reject=function(b){d||(d="rejected",c=b,e.length&&k(a));return q.promise};this.resolve=function(b){d||(d="resolved",c=b,e.length&&k(a));return q.promise};this.progress=function(a){d||e.forEach(function(m){m.progress&&m.progress(a)});return q.promise};
this.cancel=function(){d||q.reject(f())};this.then=function(c,m,h){var c={resolve:c,reject:m,progress:h,deferred:new g},o=c.deferred,b=this.cancel.bind(this),f=function(){k(function(){(o.cancel===f?b:o.cancel)()},!0)};o.cancel=f;m=o.promise;m.cancel=function(){o.cancel()};e.push(c);d&&k(a,!0);return m};this.promise={then:this.then,cancel:this.cancel}}var e=[],d=[],c=!1;g.all=function(a,c){function d(a,c){m||(f[a]=c,--e===0&&t.resolve(f))}function b(a,e){if(!m){if(c)try{d(a,c(e));return}catch(n){e=
n}t.reject(e)}}var e=a.length,f=[],m=!1,t=new g;t.then(null,function(){m=!0;a.forEach(function(m){m.cancel&&m.cancel()})});e===0?t.resolve(f):a.forEach(function(m,a){m.then(d.bind(null,a),b.bind(null,a))});return t.promise};g.when=function(a,c,d,e){var b;if(!(a&&typeof a.then==="function"))b=new g,b.resolve(a),a=b.promise;return a.then(c,d,e)};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(b){try{typeof b==="function"?b(j):b.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 b=this._namedListeners[j];if(b)for(var f=0;f<b.length;f++)if(b[f]===i){b.length===1?delete this._namedListeners[j]:b.splice(f,1);break}}};j.prototype.constructor=j;j.attach=function(k){var i=new j;k.dispatchEvent=i.dispatchEvent.bind(i);k.addEventListener=i.addEventListener.bind(i);k.removeEventListener=i.removeEventListener.bind(i)};return j});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(j,k){function i(d,c,a){this._properties=a||{};this._properties["service.id"]=d;this._properties.objectClass=c;this._properties["service.names"]=c}function b(d,c,a){this._serviceId=d;this._serviceReference=c;this._internalRegistry=a}function f(d,c){function a(a){return function(){var h;try{if(!c())throw Error("Service was unregistered");var e=d[a].apply(d,Array.prototype.slice.call(arguments));if(e&&typeof e.then==="function")return e;
else h=new j,h.resolve(e)}catch(b){h=new j,h.reject(b)}return h.promise}}for(var h in d)typeof d[h]==="function"&&(this[h]=a(h))}function g(d,c){this.type=d;this.serviceReference=c}function e(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new k;var d=this;this._internalRegistry={isRegistered:function(c){return d._entries[c]?!0:!1},unregisterService:function(c){var a=d._entries[c];if(!a)throw Error("already unregistered");var h=a.reference;d._serviceEventTarget.dispatchEvent(new g("unregistering",
h));d._entries[c]=null;h.getProperty("objectClass").forEach(function(a){for(var c=d._namedReferences[a],e=0;e<c.length;e++)if(c[e]===h){c.length===1?delete d._namedReferences[a]:c.splice(e,1);break}})},modifyService:function(c){c=d._entries[c];if(!c)throw Error("already unregistered");d._serviceEventTarget.dispatchEvent(new g("modified",c.reference))}}}i.prototype={getPropertyKeys:function(){var d=[],c;for(c in this._properties)this._properties.hasOwnProperty(c)&&d.push(c);return d},getProperty:function(d){return this._properties[d]}};
i.prototype.constructor=i;b.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(d){var c=this._serviceReference._properties;this._serviceReference._properties=d||{};d["service.id"]=this._serviceId;d.objectClass=c.objectClass;d["service.names"]=c["service.names"];this._internalRegistry.modifyService(this._serviceId)}};
b.prototype.constructor=b;e.prototype={getService:function(d){var c;if(typeof d==="string")(d=this._namedReferences[d])&&d.some(function(a){c=this._entries[a.getProperty("service.id")].service;return!!c},this);else if(d=this._entries[d.getProperty("service.id")])c=d.service;return c||null},getServiceReferences:function(d){if(d)return this._namedReferences[d]?this._namedReferences[d]:[];var c=[];this._entries.forEach(function(a){a&&c.push(a.reference)});return c},registerService:function(d,c,a){if(typeof c===
"undefined"||c===null)throw Error("invalid service");typeof d==="string"?d=[d]:Array.isArray(d)||(d=[]);var h=this._entries.length,e=new i(h,d,a),n=this._namedReferences;d.forEach(function(a){n[a]=n[a]||[];n[a].push(e)});d=new f(c,this._internalRegistry.isRegistered.bind(null,h));this._entries.push({reference:e,service:d});d=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new g("registered",e));return new b(h,e,d)},addEventListener:function(d,c){this._serviceEventTarget.addEventListener(d,
c)},removeEventListener:function(d,c){this._serviceEventTarget.removeEventListener(d,c)}};e.prototype.constructor=e;return{ServiceRegistry:e}});
define("orion/xhr",["orion/Deferred"],function(j){function k(i,b,f,g){var e=typeof f.response!=="undefined"?f.response:f.responseText,d;try{d=f.status}catch(c){d=0}i={args:b,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,b,f){var f=f||{},g=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,e=new j,d=f.headers||{},c=f.log||!1,a;typeof d["X-Requested-With"]==="undefined"&&(d["X-Requested-With"]="XMLHttpRequest");
if(typeof f.data!=="undefined"&&(i==="POST"||i==="PUT"))a=f.data;if(typeof f.responseType==="string")g.responseType=f.responseType;g.onprogress=function(a){a.xhr=g;e.progress(a)};g.onreadystatechange=function(){if(g.readyState===4){var a=k(b,f,g),h=g.status;200<=h&&h<400?e.resolve(a):(c&&typeof console!=="undefined"&&console.log(Error(g.statusText)),e.reject(a))}};try{g.open(i,b,!0);if(typeof f.timeout==="number")if(typeof g.timeout==="number")g.timeout=f.timeout,g.addEventListener("timeout",function(){e.reject(k(b,
f,g,"Timeout exceeded"))});else{var h=setTimeout(function(){e.reject(k(b,f,g,"Timeout exceeded"))},f.timeout);e.then(clearTimeout.bind(null,h),clearTimeout.bind(null,h))}Object.keys(d).forEach(function(a){g.setRequestHeader(a,d[a])});g.send(a)}catch(l){e.reject(k(b,f,g,l))}return e.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(j,k,i){function b(a,c){this._name=a;this._providers=c;this._flushPending=!1;this._cached=null;this._stores=[];this._dirty=[]}function f(a,c){return{get:function(d,e){if(c===0)return null;var b=localStorage.getItem(a+d);if(b===null)return null;b=JSON.parse(b);return e||c===-1||b._expires&&b._expires>(new Date).getTime()?(delete b._expires,b):null},set:function(d,e){if(c!==0){if(c!==-1)e._expires=(new Date).getTime()+1E3*c;
if(Object.keys(e).length===0)localStorage.removeItem(a+d);else{var b=JSON.stringify(e);localStorage.setItem(a+d,b);delete e._expires}}},remove:function(c){localStorage.removeItem(a+c)}}}function g(a){this._currentPromises={};this._cache=new f("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var c=a.getServiceReferences("orion.core.preference.provider");if(c.length>0)this._service=a.getService(c[0])}return!!this._service}}function e(a){this._location=
a;this._currentPromise=null;this._cache=new f("/orion/preferences/default",3600)}function d(){this._cache=new f("/orion/preferences/local",-1)}function c(a,c){this._userProvider=new g(a);this._localProvider=new d;c=c||"defaults.pref";c.indexOf("://")===-1&&(c=j.toUrl(c));this._defaultsProvider=new e(c);this._serviceRegistration=a.registerService("orion.core.preference",this)}b.prototype={_flush:function(){for(var a=[],c=0;c<this._stores.length;++c){var d=this._stores[c];this._dirty.indexOf(d)!==-1&&
a.push(this._providers[c].put(this._name,d))}this._dirty=[];return k.all(a)},_scheduleFlush:function(a){this._dirty.indexOf(a)===-1&&this._dirty.push(a);if(!this._flushPending)this._flushPending=!0,window.setTimeout(function(){if(this._flushPending)this._flushPending=!1,this._flush()}.bind(this),0)},_getCached:function(){if(!this._cached){this._cached={};for(var a=0;a<this._stores.length;++a){var c=this._stores[a],d;for(d in c)c.hasOwnProperty(d)&&typeof this._cached[d]==="undefined"&&(this._cached[d]=
c[d])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(a){return this._getCached()[a]},put:function(a,c){if(this._stores.length!==0){var d=this._stores[0];if(d[a]!==c)d[a]=c,this._cached=null,this._scheduleFlush(d)}},remove:function(a){for(var c=0;c<this._stores.length;++c){var d=this._stores[c];if(d.hasOwnProperty(a))return delete d[a],this._cached=null,this._scheduleFlush(d),!0}return!1},clear:function(){for(var a=0;a<this._stores.length;++a)this._stores[a]=
{},this._scheduleFlush(this._stores[a]);this._cached=null},sync:function(a){if(this._flushPending)return this._flushPending=!1,this._flush();for(var c=this,d=[],e=0;e<this._providers.length;++e)d.push(this._providers[e].get(this._name,a).then(function(a){return function(d){c._stores[a]=d}}(e)));return k.all(d).then(function(){c._cached=null;c._getCached()})},flush:function(){this._flush()}};g.prototype={get:function(a,c){if(this._currentPromises[a])return this._currentPromises[a];var d=new k,e=null;
c?this._cache.remove(a):e=this._cache.get(a);if(e!==null)d.resolve(e);else{this._currentPromises[a]=d;var b=this;this._service.get(a).then(function(c){b._cache.set(a,c);delete b._currentPromises[a];d.resolve(c)},function(c){c.status===404?(c={},b._cache.set(a,c),delete b._currentPromises[a],d.resolve(c)):(delete b._currentPromises[a],d.resolve(b._cache.get(a,!0)||{}))})}return d},put:function(a,c){this._cache.set(a,c);return this._service.put(a,c)}};e.prototype={get:function(a,c){if(this._currentPromise)return this._currentPromise;
var d=new k,e=null;c?this._cache.remove(a):e=this._cache.get(a);if(e!==null)d.resolve(e);else{this._currentPromise=d;var b=this;i("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=JSON.parse(c.response);b._cache.set(a,c[a]||{});b._currentPromise=null;d.resolve(c[a]||{})},function(c){c.xhr.status===401||c.xhr.status===404?(b._cache.set(a,{}),b._currentPromise=null,d.resolve({})):(b._currentPromise=null,c=b._cache.get(a,!0),c!==null?d.resolve(c[a]||{}):d.resolve({}))})}return d},
put:function(){var a=new k;a.resolve();return a}};d.prototype={get:function(a){var c=new k,a=this._cache.get(a);a!==null?c.resolve(a):c.resolve({});return c},put:function(a,c){var d=new k;this._cache.set(a,c);d.resolve();return d}};c.DEFAULT_SCOPE=1;c.LOCAL_SCOPE=2;c.USER_SCOPE=4;c.prototype={listenForChangedSettings:function(a){window.addEventListener("storage",a,!1);return"/orion/preferences/local/settings"},getPreferences:function(a,d){if(!d||typeof d!=="number"||d>7||d<1)d=c.DEFAULT_SCOPE|c.LOCAL_SCOPE|
c.USER_SCOPE;var e=[];c.USER_SCOPE&d&&this._userProvider.available()&&e.push(this._userProvider);c.LOCAL_SCOPE&d&&e.push(this._localProvider);c.DEFAULT_SCOPE&d&&e.push(this._defaultsProvider);var n=new b(a,e);return n.sync().then(function(){return n})},getSetting:function(a,c,d){for(var e,b=0;b<a.length;b++)if(a[b].label===c)for(var f=0;f<a[b].data.length;f++)if(a[b].data[f].label===d){e=a[b].data[f].value;break}return e}};return{PreferencesService:c}});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget"],function(j,k){function i(c,a){var d=Object.keys(c),e=Object.keys(a);if(d.length!==e.length)return!1;d.sort();e.sort();for(var b=0,f=d.length;b<f;b++){var g=d[b];if(g!==e[b])return!1;var m=c[g],g=a[g];if(m!==g&&JSON.stringify(m)!==JSON.stringify(g))return!1}return!0}function b(c){if(c.indexOf("://")===-1){var a=document.createElement("a");a.href=c;return a.href}return c}function f(c){var a=null;return{key:function(d){return(a=a||
Object.keys(c))[d]},getItem:function(a){return c[a]},setItem:function(d,e){c[d]=e;a=null},removeItem:function(d){delete c[d];a=null},clear:function(){(a=a||Object.keys(c)).forEach(function(a){delete c[a]}.bind(this));a=null}}}function g(c,a){return{type:c,plugin:a}}function e(c,a,d){function e(m,a,c){if(!E)return(new j).reject(Error("plugin not connected"));var o=v++,b=new j;b.then(null,function(m){z==="active"&&m instanceof Error&&m.name==="Cancel"&&d.postMessage({id:o,cancel:m.message||"Cancel"},
E)});F[String(o)]=b;d.postMessage({id:o,serviceId:m,method:a,params:c},E);return b.promise}function b(m){var a={};if(m.methods&&(m.methods.forEach(function(c){a[c]=function(){var a=Array.prototype.slice.call(arguments);return z==="active"?e(m.serviceId,c,a):o.start({"transient":!0}).then(function(){return e(m.serviceId,c,a)})}}),a.addEventListener&&a.removeEventListener)){var c=new k;a.dispatchEvent=c.dispatchEvent.bind(c);var d=a.addEventListener;a.addEventListener=function(a,m){c._namedListeners[a]||
d(a);c.addEventListener(a,m)};var h=a.removeEventListener;a.removeEventListener=function(a,m){c.removeEventListener(a,m);c._namedListeners[a]&&h(a)}}return a}function f(a){var m=JSON.parse(JSON.stringify(a.properties));m.__plugin__=c;a=a.names||a.type||[];Array.isArray(a)||(a=[a]);m.objectClass=a;return m}function p(a){var m=b(a),c=f(a),c=d.registerService(a.names||a.type,m,c);y[a.serviceId]={registration:c,proxy:m}}function m(){d.persist(c,{created:w,headers:s,services:x,autostart:u,lastModified:A})}
function t(a){var m;try{if(a.method)if("manifest"===a.method||"plugin"===a.method){var c=a.params[0];C({headers:c.headers,services:c.services}).then(function(){D.resolve(o)})}else if("dispatchEvent"===a.method){var e=y[a.serviceId].proxy;e.dispatchEvent.apply(e,a.params)}else if("progress"===a.method)m=F[String(a.requestId)],m.progress.apply(m,a.params);else if("timeout"===a.method)D&&D.reject(a.error);else throw Error("Bad response method: "+a.method);else if(m=F[String(a.id)],delete F[String(a.id)],
a.error){var b=d.handleServiceError(o,a.error);m.reject(b)}else m.resolve(a.result)}catch(t){console.log("Plugin._responseHandler "+t)}}var o=this,a=a||{},w=a.created||(new Date).getTime(),s=a.headers||{},x=a.services||[],u=a.autostart,A=a.lastModified||0,z="installed",r,D,E,y={},v=0,F={},C;this._persist=m;this._resolve=function(){z="resolved";d.dispatchEvent(new g("resolved",o))};this._getAutostart=function(){return u};this._getCreated=function(){return w};this.getLocation=function(){return c};this.getHeaders=
function(){return JSON.parse(JSON.stringify(s))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return A};this.getServiceReferences=function(){var a=[];Object.keys(y).forEach(function(m){a.push(y[m].registration.getReference())});return a};this.getState=function(){return z};this.start=function(a){if(z==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));
if(r)return r.promise.then(this.start.bind(this,a));if(z==="active")return(new j).resolve();if(!a||!a["transient"]){var e=a&&a.lazy?"lazy":"started";e!==u&&(u=e,m())}e=d.getState();if(e!=="starting"&&e!=="active")return a["transient"]?(new j).reject(Error("start transient error")):(new j).resolve();if(z==="installed")try{this._resolve()}catch(b){return(new j).reject(b)}z==="resolved"&&x.forEach(function(a){p(a)});if(a&&a.lazy)return z!=="starting"&&(z="starting",d.dispatchEvent(new g("lazy activation",
o))),(new j).resolve();var w=new j;r=w;z="starting";d.dispatchEvent(new g("starting",o));D=new j;E=d.connect(c,t);D.then(function(){D=null;z="active";d.dispatchEvent(new g("started",o));r=null;w.resolve()},function(){D=null;z="stopping";d.dispatchEvent(new g("stopping",o));Object.keys(y).forEach(function(a){y[a].registration.unregister();delete y[a]});d.disconnect(E);E=null;z="resolved";r=null;d.dispatchEvent(new g("stopped",o));w.reject(Error("plugin activation error"))});return w.promise};this.stop=
function(a){if(z==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(r)return r.promise.then(this.stop.bind(this,a));if((!a||!a["transient"])&&"stopped"!==u)u="stopped",m();if(z!=="active"&&z!=="starting")return(new j).resolve();r=a=new j;z="stopping";d.dispatchEvent(new g("stopping",o));Object.keys(y).forEach(function(a){y[a].registration.unregister();delete y[a]});E&&(d.disconnect(E),E=null);z="resolved";r=null;d.dispatchEvent(new g("stopped",o));a.resolve();return a.promise};
C=function(a){if(z==="uninstalled")return(new j).reject(Error("Plugin is uninstalled"));if(!a)return A===0&&(A=(new Date).getTime(),m()),d.loadManifest(c).then(C);var e=s,b=x,w=u;s=a.headers||{};x=a.services||{};u=a.autostart||u;a.lastModified?A=a.lastModified:(A=(new Date).getTime(),m());if(i(s,e)&&i(x,b)&&u===w)return(new j).resolve();if(z==="active"||z==="starting"){var l=[];Object.keys(x).forEach(function(a){var m=x[a];l.push(a);var c=y[a];if(c){if(i(m.methods,Object.keys(c.proxy))){var a=f(m),
d=c.registration.getReference(),o={};d.getPropertyKeys().forEach(function(a){o[a]=d.getProperty(a)});i(a,o)||c.registration.setProperties(a);return}c.registration.unregister();delete y[a]}p(m)});Object.keys(y).forEach(function(a){l.indexOf(a)===-1&&(y[a].registration.unregister(),delete y[a])})}z==="active"&&(d.disconnect(E),D=new j,E=d.connect(c,t),D.then(function(){D=null},function(){D=null;z="stopping";d.dispatchEvent(new g("stopping"),o);Object.keys(y).forEach(function(a){y[a].registration.unregister();
delete y[a]});d.disconnect(E);E=null;z="resolved";d.dispatchEvent(new g("stopped",o))}));return(new j).resolve()};this.update=function(a){return C(a).then(function(){d.dispatchEvent(new g("updated",o))})};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));d.removePlugin(this);z="uninstalled";d.dispatchEvent(new g("uninstalled",
o));return(new j).resolve()}}var d=/^http[s]?/i;return{Plugin:e,PluginRegistry:function(c,a){function h(a){var m=a.source;i.some(function(c){if(m===c.target){if(typeof c.useStructuredClone==="undefined")c.useStructuredClone=typeof a.data!=="string";c.handler(c.useStructuredClone?a.data:JSON.parse(a.data));return!0}})}var a=a||{},l=a.storage||localStorage;l.getItem||(l=f(l));var n="installed",q=[],i=[],m=new k,t={},o={registerService:c.registerService.bind(c),connect:function(m,c,d){function o(a){a=
Error(a);a.name="timeout";c({method:"timeout",error:a})}var h={handler:c,url:m},e=setTimeout(o.bind(null,"Load timeout for: "+m),d||15E3),b=document.createElement("iframe");b.name=m+"_"+(new Date).getTime();if(!a.visible)b.style.display="none",b.style.visibility="hidden";b.src=m;b.onload=function(){clearTimeout(e);setTimeout(o.bind(null,"Plugin handshake timeout for: "+m),5E3)};b.sandbox="allow-scripts allow-same-origin";document.body.appendChild(b);h.target=b.contentWindow;h.close=function(){b&&
(document.body.removeChild(b),b=null)};i.push(h);return h},disconnect:function(a){for(var m=0;m<i.length;m++)if(a===i[m]){i.splice(m,1);try{a.close()}catch(c){}break}},removePlugin:function(a){for(var m=0;m<q.length;m++)if(a===q[m]){q.splice(m,1);break}l.removeItem("plugin."+a.getLocation())},persist:function(a,m){l.setItem("plugin."+a,JSON.stringify(m))},postMessage:function(a,m){m.target.postMessage(m.useStructuredClone?a:JSON.stringify(a),m.url)},dispatchEvent:function(a){try{m.dispatchEvent(a)}catch(c){console&&
console.log("PluginRegistry.dispatchEvent "+c)}},loadManifest:function(a){var m=new j,c=o.connect(a,function(a){c&&a.method&&("manifest"===a.method||"plugin"===a.method?(a=a.params[0],o.disconnect(c),c=null,m.resolve(a)):"timeout"===a.method&&(o.disconnect(c),c=null,m.reject(a.error)))});return m.promise},getState:function(){return n},handleServiceError:function(a,m){if(m&&m.status===401){var c=a.getHeaders(),o=a.getName()||a.getLocation(),h=document.createElement("span");h.appendChild(document.createTextNode("Authentication required for: "+
o+"."));if(c.login)h.appendChild(document.createTextNode(" ")),o=document.createElement("a"),o.target="_blank",o.textContent="Login",o.href=c.login,d.test(o.href)?(h.appendChild(o),h.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+c.login);return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(h)}}if(m.__isError){var e=m,m=Error(e.message);Object.keys(e).forEach(function(a){m[a]=e[a]});delete m.__isError}return m}};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=o.getState;this.init=function(){if(!(n==="starting"||n==="active"||n==="stopping")){addEventListener("message",h,!1);for(var m=[],c=0,d=l.length;c<d;c++)m.push(l.key(c));m.forEach(function(a){if(a.indexOf("plugin.")===0){var m=a.substring(7),a=JSON.parse(l.getItem(a));a.created&&q.push(new e(m,a,o))}});
q.sort(function(a,m){return a._getCreated()<m._getCreated()?-1:1});a.plugins&&Object.keys(a.plugins).forEach(function(m){m=b(m);if(!this.getPlugin(m)){var c=a.plugins[m],c=typeof c==="object"||{};c.autostart=c.autostart||a.defaultAutostart||"lazy";q.push(new e(m,c,o))}}.bind(this));n="starting"}};this.start=function(){n!=="starting"&&this.init();if(n!=="starting")return(new j).reject("Cannot start framework. Framework is already "+n+".");var a=[],m=(new Date).getTime();q.forEach(function(c){var d=
c._getAutostart();c.getLastModified()===0?a.push(c.update().then(function(){if("started"===d)return c.start({"transient":!0});if("lazy"===d)return c.start({lazy:!0,"transient":!0});c._resolve()})):"started"===d?a.push(c.start({"transient":!0})):"lazy"===d?(a.push(c.start({lazy:!0,"transient":!0})),m>c.getLastModified()+864E5&&c.update()):c._resolve()});return j.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){n="active"})};this.stop=function(){if(n!=="starting"&&n!=="active")return(new j).reject("Cannot stop registry. Registry is already "+
n+".");n="stopping";var a=[];q.forEach(function(m){a.push(m.stop({"transient":!0}))});return j.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){removeEventListener("message",h);n="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new j).reject("Cannot uninstall registry")};this.installPlugin=function(a,m){var a=b(a),c=this.getPlugin(a);if(c)return(new j).resolve(c);if(t[a])return t[a];if(m)return c=new e(a,m,o),q.push(c),
c._persist(),o.dispatchEvent(new g("installed",c)),(new j).resolve(c);var d=o.loadManifest(a).then(function(m){c=new e(a,m,o);q.push(c);c._persist();delete t[a];o.dispatchEvent(new g("installed",c));return c},function(m){delete t[a];throw m;});return t[a]=d};this.getPlugins=function(){return q.slice()};this.getPlugin=function(a){var m=null,a=b(a);q.some(function(c){if(a===c.getLocation())return m=c,!0});return m};this.addEventListener=m.addEventListener.bind(m);this.removeEventListener=m.removeEventListener.bind(m);
this.resolvePlugins=function(){var a=!0;q.forEach(function(m){a=a&&m._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function j(b,f){function g(a){var h=a.getProperty("service.id"),e=this.addingService(a);e&&(d[h]=a,c[h]=e)}function e(a){var h=a.getProperty("service.id"),e=c[h];delete d[h];delete c[h];this.removedService(a,e)}this.serviceRegistry=b;var d={},c={},a=k,h,l;this.close=function(){if(a!==i)throw"Already closed";a=k;b.removeEventListener("registered",h);b.removeEventListener("unregistering",l);l=h=null;var c=this;this.getServiceReferences().forEach(function(a){e.call(c,
a)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){return d.length?Object.keys(d).map(function(a){return d[a]}):null};this.open=function(){if(a!==k)throw"Already open";a=i;var c=this;h=function(a){if(a.serviceReference.getProperty("objectClass").indexOf(f)!==-1&&(g.call(c,a.serviceReference),typeof c.onServiceAdded==="function"))return c.onServiceAdded(a.serviceReference,c.serviceRegistry.getService(a.serviceReference))};l=function(a){a.serviceReference.getProperty("objectClass").indexOf(f)!==
-1&&e.call(c,a.serviceReference)};b.addEventListener("registered",h);b.addEventListener("unregistering",l);b.getServiceReferences(f).forEach(function(a){g.call(c,a)});if(typeof this.onOpen==="function")this.onOpen()}}var k=0,i=1;j.prototype={addingService:function(b){return this.serviceRegistry.getService(b)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return j});
define("orion/config",["orion/Deferred","orion/serviceTracker"],function(j,k){var i,b,f,g,e,d="pid";i=function(a,c,e){function b(a,m,d){m.forEach(function(e,b){try{var l=a[b].getProperty("__plugin__"),f=l&&c.getPlugin(l);(!l||f&&f.getState()==="active")&&m[b].updated(d)}catch(n){typeof console!=="undefined"&&console.log(n)}})}k.call(this,a,"orion.cm.managedservice");var f={},g={},m=function(m){var c=[];m.plugin.getServiceReferences().forEach(function(m){if(m.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var h=m.getProperty(d),m=a.getService(m);h&&m&&(h=(h=e._find(h))&&h.getProperties(),c.push(m.updated(h)))}});return j.all(c)};this.addingService=function(m){var c=m.getProperty(d),h=a.getService(m);if(!c||!h)return null;f[c]||(f[c]=[]);g[c]||(g[c]=[]);f[c].push(m);g[c].push(h);return h};this.onServiceAdded=function(a,m){var c=a.getProperty(d),c=e._find(c);b([a],[m],c&&c.getProperties())};this.onOpen=function(){c.addEventListener("started",m)};this.onClose=function(){c.removeEventListener("started",
m)};this.notifyUpdated=function(a){var m=a.getPid();b(f[m]||[],g[m]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();b(f[a]||[],g[a]||[],null)};this.removedService=function(a,m){var c=a.getProperty(d),h=f[c],e=g[c];h.length>1?h.splice(h.indexOf(a),1):delete f[c];e.length>1?e.splice(e.indexOf(m),1):delete g[c]}};b=function(){function a(a,c,d){this.store=new f(this,d);this.configAdmin=new g(this,this.store);this.tracker=new i(a,c,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(c){a.tracker.open();return c})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();g=function(){function a(a,c){this.factory=a;this.store=c}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var c="/cm/configurations";
f=function(){function a(a,b){this.factory=a;this.prefsService=b;this.configs=Object.create(null);this.pref=null;var f=this;this.initPromise=this.prefsService.getPreferences(c).then(function(a){f.pref=a;a.keys().forEach(function(c){if(!f.configs[c]){var m=a.get(c);typeof m==="object"&&m!==null&&Object.keys(m).length>0&&(m[d]=c,f.configs[c]=new e(f.factory,f,m))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var c=this._find(a);
c||(c=new e(this.factory,this,a),this.configs[a]=c);return c},list:function(){var a=this,c=[];this.pref.keys().forEach(function(d){(d=a._find(d))&&d.getProperties()!==null&&c.push(d)});return c},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,c){this.pref.put(a,c.getProperties(!0)||{})}};return a}();e=function(){function a(a){for(var c={},d=Object.keys(a),h=0;h<d.length;h++){var m=d[h],e=a[m];c[m]=e instanceof Array?e.slice():e}return c}function c(h,e,b){this.factory=
h;this.store=e;if(b!==null&&typeof b==="object")this.pid=b[d],h=a(b),delete h[d],this.properties=h;else if(typeof b==="string")this.pid=b,this.properties=null;else throw Error("Invalid pid/properties "+b);}c.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(c){this._checkRemoved();var h=null;if(this.properties&&(h=a(this.properties),!c))h[d]=this.pid;return h},remove:function(){this._checkRemoved();
this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=!0},update:function(c){this._checkRemoved();c=a(c);delete c[d];this.properties=c;this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return c}();return{ConfigurationAdminFactory:b}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(j,k,i,b,f,g){var e;return{startup:function(){if(e)return e;e=new k;var d=window.serviceRegistry=new i.ServiceRegistry,c=new b.PreferencesService(d);return c.getPreferences("/plugins").then(function(a){var h={plugins:{}};a.keys().forEach(function(c){var d=j.toUrl(c);h.plugins[d]=a[c]});var b=window.pluginRegistry=new f.PluginRegistry(d,h);return b.start().then(function(){if(d.getServiceReferences("orion.core.preference.provider").length>
0)return c.getPreferences("/plugins",c.USER_SCOPE).then(function(a){var c=[];a.keys().forEach(function(a){a=j.toUrl(a);b.getPlugin(a)||c.push(b.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return k.all(c,function(a){console.log(a)})})}).then(function(){return(new g.ConfigurationAdminFactory(d,b,c)).getConfigurationAdmin().then(d.registerService.bind(d,"orion.cm.configadmin"))}).then(function(){var a=d.getService("orion.core.auth");
if(a){var c=a.getUser().then(function(m){if(m)localStorage.setItem("lastLogin",(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){window.location=a})}),h=localStorage.getItem("lastLogin");if(!h||h<(new Date).getTime()-9E5)return c}}).then(function(){var a={serviceRegistry:d,preferences:c,pluginRegistry:b};e.resolve(a);return a})})}}});
define("orion/webui/littlelib",["require"],function(){function j(d,c){c||(c=document);return c.querySelectorAll(d)}function k(d,c){var a=d.compareDocumentPosition(c);return d===c||Boolean(a&16)}function i(d){if(d.tabIndex>=0)return d;if(d.hasChildNodes())for(var c=0;c<d.childNodes.length;c++){var a=i(d.childNodes[c]);if(a)return a}return null}function b(d){if(d.tabIndex>=0)return d;if(d.hasChildNodes())for(var c=d.childNodes.length-1;c>=0;c--){var a=b(d.childNodes[c]);if(a)return a}return null}function f(d,
c){if(d.nodeType===3){var a=g.exec(d.nodeValue);a&&a.length>1&&d.parentNode.replaceChild(document.createTextNode(c[a[1]]||a[1]),d)}if(d.hasChildNodes())for(a=0;a<d.childNodes.length;a++)f(d.childNodes[a],c)}var g=/\$\{([^\}]+)\}/,e=[];return{$:function(d,c){c||(c=document);return c.querySelector(d)},$$:j,$$array:function(d,c){return Array.prototype.slice.call(j(d,c))},node:function(d){var c=d;typeof d==="string"&&(c=document.getElementById(d));return c},contains:k,bounds:function(d){d=d.getBoundingClientRect();
return{left:d.left+document.body.scrollLeft,top:d.top+document.body.scrollTop,width:d.width,height:d.height}},empty:function(d){for(;d.hasChildNodes();)d.removeChild(d.firstChild)},firstTabbable:i,lastTabbable:b,stop:function(d){window.document.all?d.keyCode=0:(d.preventDefault(),d.stopPropagation())},processTextNodes:f,addAutoDismiss:function(d,c){e.length===0&&document.addEventListener("click",function(a){for(var c=[],d=0;d<e.length;d++){for(var b=e[d].excludeNodes,f=e[d].dismiss,g=!1,m=!0,t=0;t<
b.length;t++)if((g=document.compareDocumentPosition(document,b[t])!==1)&&k(b[t],a.target)){m=!1;break}m&&(f(),g=document.compareDocumentPosition(document,b[t])!==1);g&&c.push(e[d])}e=c},!0);e.push({excludeNodes:d,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}}});
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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});return i});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(j,k){function i(b){this._init(b)}i.prototype={_init:function(b){this._node=k.node(b.node);if(!this._node)throw"no dom node for tooltip found";this._position=b.position||["right","above","below","left"];this._text=b.text;this._hideDelay=b.hideDelay===void 0?200:b.hideDelay;this._tailSize=b.tailSize||10;this._trigger=b.trigger||"mouseover";this._afterShowing=b.afterShowing;this._afterHiding=b.afterHiding;var f=this;if(this._trigger===
"click")this._showDelay=0,this._node.addEventListener("click",function(b){b.target===f._node&&(f.show(),k.stop(b))},!1);else if(this._trigger==="mouseover"){this._showDelay=b.showDelay===void 0?1E3:b.showDelay;b=["mouseout","click"];this._node.addEventListener("mouseover",function(b){k.contains(f._node,b.target)&&(f.show(),k.stop(b))},!1);for(var g=0;g<b.length;g++)this._node.addEventListener(b[g],function(b){k.contains(f._node,b.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 b=this;k.addAutoDismiss([this._tip,this._node],function(){b.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(b._timeout)window.clearTimeout(b._timeout),b._timeout=null;b._tip.addEventListener("mouseout",function(f){k.contains(b._tip,f.target)&&(b.hide(),k.stop(f))},!1)},!1)}return this._tip},_positionTip:function(b,f){this._makeTipNode();if(this._tailBorder)this._tip.removeChild(this._tailBorder),this._tailBorder=null,this._tip.removeChild(this._tail),this._tail=null;b==="left"?this._tipInner.classList.add("left"):
this._tipInner.classList.remove("left");var g=k.bounds(this._node),e=k.bounds(this._tipInner),d;switch(b){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=k.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"+b);this._tail=document.createElement("span");this._tail.classList.add("tooltipTailFrom"+b);b==="above"||b==="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 b=this;if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;this._timeout=window.setTimeout(function(){for(var f=!1,g=0;!f&&g<b._position.length;)f=b._positionTip(b._position[g]),
g++;f||b._positionTip(b._position[0],!0);b._tip.classList.add("tooltipShowing");b._afterShowing&&b._afterShowing()},this._showDelay)}},hide:function(b){if(this._timeout)window.clearTimeout(this._timeout),this._timeout=null;if(this._tip&&this._tip.classList.contains("tooltipShowing")){if(b===void 0)b=this._hideDelay;var f=this;this._timeout=window.setTimeout(function(){f._tip.classList.remove("tooltipShowing");f._afterHiding&&f._afterHiding()},b)}},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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});return i});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(j,k,i,b){function f(){}f.prototype={_initialize:function(f,e,d,c,a){this._tooltip=new b.Tooltip({node:f,hideDelay:a||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(a){a.keyCode===i.KEY.ESCAPE&&h.hide()},!1);this._bindElements(this.$parent);typeof this._bindToDom==="function"&&this._bindToDom(this.$parent)},_bindElements:function(b){for(var e=0;e<b.childNodes.length;e++){var d=b.childNodes[e];d.id&&(this["$"+d.id]=d);this._bindElements(d)}},_afterShowingFunction:function(b){return function(){b&&b.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/dialogs",[],function(){function j(j){this._serviceRegistry=j;this._serviceRegistration=j.registerService("orion.page.dialog",this)}j.prototype={confirm:function(j,i){i(window.confirm(j))},openFiles:function(){}};j.prototype.constructor=j;return{DialogService:j}});
define("orion/uiUtils",["i18n!orion/nls/messages","orion/webui/littlelib"],function(j,k){function i(b){var f=window.navigator.platform.indexOf("Mac")!==-1;return f&&b.metaKey||!f&&b.ctrlKey}return{getUserKeyString:function(b){var f="",g=navigator.platform.indexOf("Mac")!==-1;b.mod1&&(f+=g?"Cmd+":"Ctrl+");b.mod2&&(f+="Shift+");b.mod3&&(f+="Alt+");b.mod4&&g&&(f+="Ctrl+");if(b.alphaKey)return f+b.alphaKey;for(var e in k.KEY)if(typeof(k.KEY[e]==="number")&&k.KEY[e]===b.keyCode)return f+e;var d;switch(b.keyCode){case 59:d=
b.mod2?":":";";break;case 61:d=b.mod2?"+":"=";break;case 188:d=b.mod2?"<":",";break;case 190:d=b.mod2?">":".";break;case 191:d=b.mod2?"?":"/";break;case 192:d=b.mod2?"~":"`";break;case 219:d=b.mod2?"{":"[";break;case 220:d=b.mod2?"|":"\\";break;case 221:d=b.mod2?"}":"]";break;case 222:d=b.mod2?'"':"'"}return d?f+d:b.keyCode>=112&&b.keyCode<=123?f+"F"+(b.keyCode-111):f+String.fromCharCode(b.keyCode)},getUserText:function(b,f,g,e,d,c,a,h,l){var n=!1,a=function(a){return function(m){if(!n){var h=k.node(b),
o=h.value;if(h)if(a&&m.keyCode===k.KEY.ESCAPE){if(g)f.style.display="inline";h.parentNode.removeChild(h);n=!0;c&&c()}else if(!(a&&m.keyCode!==k.KEY.ENTER)){if(o.length===0||!l&&o===e){if(g)f.style.display="inline"}else d(o);n=!0;h.parentNode&&h.parentNode.removeChild(h);c&&c()}}}},q=document.createElement("input");q.id=b;q.value=e||"";f.parentNode.insertBefore(q,f.nextSibling);q.classList.add("userEditBoxPrompt");if(g)f.style.display="none";q.addEventListener("keydown",a(!0),!1);q.addEventListener("blur",
a(!1),!1);window.setTimeout(function(){q.focus();if(e){var a=k.node(b),m=h?e.indexOf(h):-1;if(m>0)if(a.createTextRange)a=a.createTextRange(),a.collapse(!0),a.moveStart("character",0),a.moveEnd("character",m),a.select();else if(a.setSelectionRange)a.setSelectionRange(0,m);else{if(a.selectionStart!==void 0)a.selectionStart=0,a.selectionEnd=m}else a.select()}},0)},openInNewWindow:i,followLink:function(b,f){f&&i(f)?window.open(b):window.location=b},createButton:function(b,f){var g=document.createElement("span");
g.role="button";g.tabIndex=0;g.appendChild(document.createTextNode(b));g.className="commandButton commandMargins";g.addEventListener("click",function(b){f();k.stop(b)},!1);g.addEventListener("keydown",function(b){if(b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.SPACE)f(),k.stop(b)},!1);return g}}});
define("orion/webui/dropdown",["require","orion/webui/littlelib"],function(j,k){function i(b){this._init(b)}i.prototype={_init:function(b){this._dropdownNode=k.node(b.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._triggerNode=k.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";this._populate=b.populate;var f=this;this._triggerNode.addEventListener("click",function(b){f.toggle()&&k.stop(b)},!1);this._triggerNode.tagName.toLowerCase()===
"span"&&this._triggerNode.addEventListener("keydown",function(b){if(b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.SPACE)f.toggle(),k.stop(b)},!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 b=this.getItems();if(b.length>0){if(!this._hookedAutoDismiss)k.addAutoDismiss([this._triggerNode,
this._dropdownNode],this.close.bind(this)),this._hookedAutoDismiss=!0;this._positionDropdown();this._triggerNode.classList.add("dropdownTriggerOpen");this._dropdownNode.classList.add("dropdownMenuOpen");b[0].focus();return!0}return!1},_positionDropdown:function(){this._dropdownNode.style.left="";var b=k.bounds(this._dropdownNode),f=k.bounds(this._boundingNode(this._triggerNode));if(b.left+b.width>f.left+f.width)this._dropdownNode.style.right=0},_boundingNode:function(b){return b.style.right!==""||
b.style.position==="absolute"||!b.parentNode||!b.parentNode.style?b:this._boundingNode(b.parentNode)},close:function(b){this._triggerNode.classList.remove("dropdownTriggerOpen");this._dropdownNode.classList.remove("dropdownMenuOpen");b&&this._triggerNode.focus();return!0},getItems:function(){var b=[],f=this;k.$$array("li:not(.dropdownSeparator) > .dropdownMenuItem",this._dropdownNode,!0).forEach(function(g){g.parentNode.parentNode===f._dropdownNode&&b.push(g)});return b},empty:function(){var b=this;
k.$$array("li",this._dropdownNode).forEach(function(f){f.parentNode===b._dropdownNode&&f.parentNode.removeChild(f)})},_dropdownKeyDown:function(b){if(b.keyCode===k.KEY.UP||b.keyCode===k.KEY.DOWN||b.keyCode===k.KEY.RIGHT||b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.LEFT){var f=this.getItems(),g=document.activeElement;if(f.length&&f.length>0&&g){var e=f.indexOf(g);e>=0&&(b.keyCode===k.KEY.UP&&e>0?(e--,f[e].focus()):b.keyCode===k.KEY.DOWN&&e<f.length-1?(e++,f[e].focus()):b.keyCode===k.KEY.ENTER||b.keyCode===
k.KEY.RIGHT?g.classList.contains("dropdownTrigger")&&g.dropdown&&g.dropdown.open():b.keyCode===k.KEY.LEFT&&g.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&this.close(!0),k.stop(b))}}else b.keyCode===k.KEY.ESCAPE&&(this.close(!0),k.stop(b))}};i.prototype.constructor=i;return{Dropdown:i}});
define("orion/explorers/navigationUtils",[],function(){function j(i,b){if(!k&&i)i.push({domNode:b}),b.tabIndex=-1,b.style.outline="none"}var k=navigator.userAgent.indexOf("iPad")!==-1;return{addNavGrid:function(i,b,f){i&&(i=i.getGridNavHolder(b,!0))&&j(i,f)},generateNavGrid:j,removeNavGrid:function(i,b){if(i)for(var f=0;f<i.length;f++)if(i[f].domNode===b){i.splice(f,1);break}}}});
define("orion/fileUtils",["i18n!orion/nls/messages"],function(){return{makeRelative:function(j){if(!j)return j;var k=window.location.protocol+"//"+window.location.host;return j.indexOf(k)===0?j.substring(k.length):j},isAtRoot:function(j){return this.makeRelative(j).indexOf("/workspace")===0}}});
define("orion/favorites",["require","orion/fileUtils","orion/EventTarget"],function(j,k,i){function b(b){this._favorites=[];i.attach(this);this._init(b);this._initializeFavorites()}b.prototype={_init:function(b){this._registry=b.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.favorite",this)},_notifyListeners:function(){this.dispatchEvent({type:"favoritesChanged",navigator:this._favorites,registry:this._registry})},makeFavorites:function(b){for(var b=Array.isArray(b)?
b:[b],g=0;g<b.length;g++){var e=b[g],d=e.ChildrenLocation?e.ChildrenLocation:e.Location,d=k.makeRelative(d);this.addFavorite(e.Name,d,e.Directory)}this._storeFavorites();this._notifyListeners()},addFavoriteUrl:function(b){this.addFavorite(b,b,!1,!0)},addFavorite:function(b,g,e){this._favorites.push({name:b,path:g,directory:e,isFavorite:!0});this._favorites.sort(this._sorter);this._storeFavorites();this._notifyListeners()},removeFavorite:function(b){for(var g in this._favorites)if(this._favorites[g].path===
b){this._favorites.splice(g,1);break}this._favorites.sort(this._sorter);this._storeFavorites();this._notifyListeners()},renameFavorite:function(b,g){var e=!1,d;for(d in this._favorites)if(this._favorites[d].path===b){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(b){for(var g in this._favorites)if(this._favorites[g].path===b)return!0;return!1},_SPECIAL_CHARS:"^$\\+[]().",queryFavorites:function(b){var g;
if(!b)return this._favorites;var e="";for(g=0;g<b.length;g++){var d=b.charAt(g);e+=d==="*"?".*":d==="?"?".?":this._SPECIAL_CHARS.indexOf(d)>=0?"\\"+d:d}e+=".*";b=RegExp(e);e=[];for(g in this._favorites)this._favorites[g].name.search(b)===0&&e.push(this._favorites[g]);return e},_initializeFavorites:function(){var b=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,b._favorites.push(g[e]);b._favorites.sort(b._sorter);b._notifyListeners()})},_storeFavorites:function(){var b=this._favorites;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(g){g.put("navigate",b)})},_sorter:function(b,g){var e=b.name.toLowerCase(),d=g.name.toLowerCase();return e>d?1:e<d?-1:0},getFavorites:function(){return{navigator:this._favorites}}};b.prototype.constructor=b;return{FavoritesService:b}});
define("orion/i18nUtil",["require","orion/Deferred"],function(j,k){function i(b){if(b=localStorage.getItem("orion/messageBundle/"+b))if(b=JSON.parse(b),b._expires&&b._expires>(new Date).getTime())return delete b._expires,b;return null}var b={};return{getMessageBundle:function(f){function g(){j(["i18n!"+f],function(a){if(a){var c=f;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+c,JSON.stringify(a));delete a._expires}e.resolve(a)})}if(b[f])return b[f];var e=new k;b[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(b){var g=arguments;return b.replace(/\$\{([^\}]+)\}/g,function(b,d){return g[(d<<0)+1]})}}});
(function(){var j=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],k=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,i=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,b=typeof location!=="undefined"&&location.href,f=b&&location.protocol&&location.protocol.replace(/\:/,""),g=b&&location.hostname,e=b&&(location.port||void 0),d=[];define("text",[],function(){var c,a,h;typeof window!=="undefined"&&window.navigator&&window.document?a=function(a,d){var b=c.createXhr();b.open("GET",a,!0);b.onreadystatechange=
function(){b.readyState===4&&d(b.responseText)};b.send(null)}:typeof process!=="undefined"&&process.versions&&process.versions.node?(h=require.nodeRequire("fs"),a=function(a,c){var d=h.readFileSync(a,"utf8");d.indexOf("\ufeff")===0&&(d=d.substring(1));c(d)}):typeof Packages!=="undefined"&&(a=function(a,c){var d=new java.io.File(a),b=java.lang.System.getProperty("line.separator"),d=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(d),"utf-8")),m,h,o="";try{m=new java.lang.StringBuffer;
(h=d.readLine())&&h.length()&&h.charAt(0)===65279&&(h=h.substring(1));for(m.append(h);(h=d.readLine())!==null;)m.append(b),m.append(h);o=String(m.toString())}finally{d.close()}c(o)});return c={version:"1.0.7",strip:function(a){if(a){var a=a.replace(k,""),c=a.match(i);c&&(a=c[1])}else a="";return a},jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r")},createXhr:function(){var a,c,
d;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else for(c=0;c<3;c++){d=j[c];try{a=new ActiveXObject(d)}catch(b){}if(a){j=[d];break}}if(!a)throw Error("createXhr(): XMLHttpRequest not available");return a},get:a,parseName:function(a){var c=!1,d=a.indexOf("."),b=a.substring(0,d),a=a.substring(d+1,a.length),d=a.indexOf("!");d!==-1&&(c=a.substring(d+1,a.length),c=c==="strip",a=a.substring(0,d));return{moduleName:b,ext:a,strip:c}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,
d,b,h){var m=c.xdRegExp.exec(a),e;if(!m)return!0;a=m[2];m=m[3];m=m.split(":");e=m[1];m=m[0];return(!a||a===d)&&(!m||m===b)&&(!e&&!m||e===h)},finishLoad:function(a,b,h,e,m){h=b?c.strip(h):h;m.isBuild&&(d[a]=h);e(h)},load:function(a,d,h,i){if(i.isBuild&&!i.inlineText)h();else{var m=c.parseName(a),t=m.moduleName+"."+m.ext,o=d.toUrl(t),w=i&&i.text&&i.text.useXhr||c.useXhr;!b||w(o,f,g,e)?c.get(o,function(d){c.finishLoad(a,m.strip,d,h,i)}):d([t],function(a){c.finishLoad(m.moduleName+"."+m.ext,m.strip,a,
h,i)})}},write:function(a,b,h){if(b in d){var e=c.jsEscape(d[b]);h.asModule(a+"!"+b,"define(function () { return '"+e+"';});\n")}},writeFile:function(a,d,b,h,m){var d=c.parseName(d),e=d.moduleName+"."+d.ext,o=b.toUrl(d.moduleName+"."+d.ext)+".js";c.load(e,b,function(){var d=function(a){return h(o,a)};d.asModule=function(a,m){return h.asModule(a,o,m)};c.write(a,e,d,m)},m)}}})})();define("text!orion/banner/slideout.html",[],function(){return'<div id="slideContainer" class="slideParameters slideContainer">\n\t<span id="pageCommandParameters" class="layoutLeft parameters"></span>\n\t<span id="pageCommandDismiss" class="layoutRight parametersDismiss"></span>\n</div>'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(j,k,i){return{slideoutHTMLFragment:function(b){var f=document.createElement("div");f.innerHTML=i;var g=k.$("#slideContainer",f);g.id=b+g.id;g=k.$("#pageCommandParameters",f);g.id=b+g.id;g=k.$("#pageCommandDismiss",f);g.id=b+g.id;return f.innerHTML}}});
define("orion/selection",["orion/EventTarget"],function(j){function k(i,b){b||(b="orion.page.selection");this._serviceRegistry=i;j.attach(this);this._serviceRegistration=i.registerService(b,this);this._selections=null}k.prototype={getSelection:function(i){i(this._getSingleSelection())},getSelections:function(i){i(this._selections||[])},_getSingleSelection:function(){return this._selections&&this._selections.length>0?this._selections[0]:null},setSelections:function(i){var b=this._selections;this._selections=
Array.isArray(i)?i.length>0?i:null:i?[i]:null;b!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};k.prototype.constructor=k;return{Selection:k}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(j,k){function i(b){this._init(b)}i.prototype={_init:function(b){var f=b.parent,g=this,f=k.node(f);if(!f)throw j["no parent"];if(!b.model)throw j["no tree model"];if(!b.renderer)throw j["no renderer"];this._parent=f;this._treeModel=b.model;this._renderer=b.renderer;this._showRoot=b.showRoot===void 0?!1:b.showRoot;this._indent=b.indent===void 0?16:b.indent;this._onCollapse=b.onCollapse;this._labelColumnIndex=
b.labelColumnIndex===void 0?0:b.labelColumnIndex;this._id=b.id===void 0?"treetable":b.id;this._tableStyle=b.tableStyle;this._tableElement=b.tableElement||"table";this._tableBodyElement=b.tableBodyElement||"tbody";this._tableRowElement=b.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(b){g._showRoot?(b._depth=0,g._generate([b],0)):g._treeModel.getChildren(b,function(d){g._generate(d,0)})})},_generate:function(b,f){k.empty(this._parent);var g=document.createElement(this._tableElement);
g.id=this._id;this._tableStyle&&g.classList.add(this._tableStyle);this._renderer.initTable(g,this);this._bodyElement=document.createElement(this._tableBodyElement);this._bodyElement.id=this._id+"tbody";this._generateChildren(b,f);g.appendChild(this._bodyElement);this._parent.appendChild(g);this._rowsChanged()},_generateChildren:function(b,f,g){for(var e=0;e<b.length;e++){var d=document.createElement(this._tableRowElement);d.id=this._treeModel.getId(b[e]);d._depth=f;d._item=b[e];this._renderer.render(b[e],
d);d.childNodes[this._labelColumnIndex].style.paddingLeft=this._indent*f+"px";g?(this._bodyElement.insertBefore(d,g.nextSibling),g&&(g=d)):this._bodyElement.appendChild(d)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(b,f,g){var e=this._treeModel.getId(b),d;if(e===this._id)this._removeChildRows(e),this._generateChildren(f,0),this._rowsChanged();else{var c=k.node(e);c?(c._item=b,c&&(g||
c._expanded)?(c._expanded=!0,this._removeChildRows(e),this._renderer.updateExpandVisuals(c,!0),f?(this._generateChildren(f,c._depth+1,c),this._rowsChanged()):(d=this,f=this._treeModel.getChildren(c._item,function(a){d._generateChildren(a,c._depth+1,c);d._rowsChanged()}))):this._renderer.updateExpandVisuals(c,!1)):console.log(j["could not find table row "]+e)}},getItem:function(b){var f=k.node(b);return f&&f._item?f._item:b},toggle:function(b){var f=k.node(b);f&&(f._expanded?(this.collapse(b),this._renderer.updateExpandVisuals(f,
!1)):(this.expand(b),this._renderer.updateExpandVisuals(f,!0)))},isExpanded:function(b){return(b=k.node(b))?b._expanded:!1},expand:function(b,f,g){var b=typeof b==="string"?b:this._treeModel.getId(b),e=k.node(b);if(e&&!e._expanded){e._expanded=!0;var d=this;this._renderer.updateExpandVisuals(e,!0);this._treeModel.getChildren(e._item,function(c){d._generateChildren(c,e._depth+1,e);d._rowsChanged();f&&f.apply(d,g)})}},_removeChildRows:function(b){for(var f=b===this._id,g=!1,e=-1,d=[],c=k.$$array(".treeTableRow",
this._parent),a=0;a<c.length;a++){var h=c[a];if(g)break;if(f)h._depth>e?d.push(h):g=!0;else if(h.id===b)f=!0,e=h._depth}for(b=0;b<d.length;b++)f=d[b],f.parentNode.removeChild(f)},collapse:function(b){var b=typeof b==="string"?b:this._treeModel.getId(b),f=k.node(b);if(f){if(!f._expanded)return;f._expanded=!1;this._renderer.updateExpandVisuals(f,!1);this._removeChildRows(b);this._rowsChanged()}this._onCollapse&&this._onCollapse(f._item)}};i.prototype.constructor=i;return{TableTree:i}});
define("orion/treeModelIterator",[],function(){var j={};j.TreeModelIterator=function(){function j(i,b){this.firstLevelChildren=i;this.reset();this._init(b)}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 b=i.children&&i.children.length>0;this.isExpanded&&b&&(b=this.isExpanded(i));return b},_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 b=this._diveIn(this._cursor);if(!b){if(i&&this._expandable(this._cursor)&&this.forceExpandFunc){var f=this;return this.forceExpandFunc(this._cursor,"first",function(b){b&&f.setCursor(b)})}(b=this._findSibling(this._cursor,
!0))&&this.setCursor(b)}return b},_backward:function(i){if(!this._cursor)return null;var b=this._findSibling(this._cursor,!1);b&&b!==this._cursor.parent&&(b=this._drillToLast(b));if(i&&b&&this._expandable(b)&&this.forceExpandFunc&&b!==this._cursor.parent){var f=this;return this.forceExpandFunc(b,"last",function(b){b&&f.setCursor(b)})}b&&this.setCursor(b);return b},_findSibling:function(i,b){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&&!b?f?null:i.parent:e===g.length-1&&b?f?null:this._findSibling(i.parent,b):b?g[e+1]:g[e-1];return null},_inParentChain:function(i,b){for(var f=i.parent;f;){if(f===b)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,b,f){this.setCursor(b);var g=[];for(g.push(b);;){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,b){var f=this.cursor(),g=this._scan(!0,i,b);g||(g=this._scan(!1,i,b));this.setCursor(f);return g},iterate:function(i,b){return i?this._forward(b):this._backward(b)},iterateOnTop:function(i,b){var f=this._findSibling(this._getTopLevelParent(this.cursor()),
i);f?this.setCursor(f):b&&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/explorers/explorerNavHandler",["i18n!orion/nls/messages","orion/webui/littlelib","orion/treeModelIterator"],function(j,k,i){var j={},b=navigator.userAgent.indexOf("iPad")!==-1,f=window.navigator.platform.indexOf("Mac")!==-1;j.ExplorerNavHandler=function(){function g(b,d,c){this.explorer=b;this.model=this.explorer.model;this._navDict=d;this._listeners=[];this._selections=[];this._currentColumn=0;var a=this._getEventListeningDiv();a.tabIndex=0;a.classList.add("selectionModelContainer");
var h=this;this._modelIterator=new i.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),isExpandable:this.explorer.renderer.isExpandable?function(a){return h.explorer.renderer.isExpandable(a)}:function(a){return h.isExpandable(a)},forceExpandFunc:this.explorer.forceExpandFunc?function(a,c,d){return h.explorer.forceExpandFunc(a,c,d)}:void 0});this._init(c);(!c||c.setFocus!==!1)&&a.focus();b=function(c){if(c.target===a){if(h.explorer.preventDefaultFunc&&h.explorer.preventDefaultFunc(c,h._modelIterator.cursor()))return!0;
if(c.keyCode===k.KEY.DOWN)return h.onDownArrow(c);else if(c.keyCode===k.KEY.UP)return h.onUpArrow(c);else if(c.keyCode===k.KEY.RIGHT)return h.onRightArrow(c);else if(c.keyCode===k.KEY.LEFT)return h.onLeftArrow(c);else if(c.keyCode===k.KEY.SPACE)return h.onSpace(c);else if(c.keyCode===k.KEY.ENTER)return h.onEnter(c)}};a.addEventListener("keydown",b,!1);this._listeners.push({type:"keydown",listener:b});b=function(){if(h.explorer.onFocus)h.explorer.onFocus(!1);else h.toggleCursor(null,!1)};a.addEventListener("blur",
b,!1);this._listeners.push({type:"blur",listener:b});b=function(){if(h.explorer.onFocus)h.explorer.onFocus(!0);else h.toggleCursor(null,!0)};a.addEventListener("focus",b,!1);this._listeners.push({type:"focus",listener:b});this._parentDiv=a}g.prototype={_init:function(b){this._linearGridMove=!1;if(b)this._selectionPolicy=b.selectionPolicy,this.preventDefaultFunc=b.preventDefaultFunc,this.postDefaultFunc=b.postDefaultFunc},_ctrlKeyOn:function(b){return f?b.metaKey:b.ctrlKey},removeListeners:function(){if(this._listeners)for(var b=
0;b<this._listeners.length;b++)this._parentDiv.removeEventListener(this._listeners[b].type,this._listeners[b].listener,!1)},focus:function(){var b=this._getEventListeningDiv();b&&b.focus()},_getEventListeningDiv:function(b){return this.explorer.keyEventListeningDiv&&typeof this.explorer.keyEventListeningDiv==="function"?this.explorer.keyEventListeningDiv(b):k.node(this.explorer._parentId)},isExpandable:function(b){return!b?!1:k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)))?
!0:!1},isExpanded:function(b){return!b?!1:this.explorer.myTree.isExpanded(this.model.getId(b))},refreshSelection:function(b){var d=this;this.explorer.selection&&this.explorer.selection.getSelections(function(c){d._clearSelection();for(var a=0;a<c.length;a++)d._selections.push(c[a]);d._selections.length>0&&d.cursorOn(d._selections[0],!0,!1,b)})},refreshModel:function(b,d,c,a){this._currentColumn=0;this.topIterationNodes=[];this.model=d;this._navDict=b;if(this.model.getTopIterationNodes)this.topIterationNodes=
this.model.getTopIterationNodes();else if(c)this.topIterationNodes=c;this._modelIterator.setTree(this.topIterationNodes);!a&&this.explorer.selection&&this._modelIterator.reset();this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(b){for(var d=0;d<this._selections.length;d++)if(b===this._selections[d])return d;return-1},_clearSelection:function(b){if(b)for(b=0;b<this._selections.length;b++)this._checkRow(this._selections[b],!0);
this._selections=[]},setSelection:function(b,d){if(this._selectionPolicy==="cursorOnly")d&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(b,!0);else if(this._isRowSelectable(b)){if(!d||this._selectionPolicy==="singleSelection")this._clearSelection(!0),this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b;else{var c=this._inSelection(b);c>=0?(this._checkRow(b,!0),this._selections.splice(c,1)):(this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b)}this.explorer.selection&&
(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))}},moveColumn:function(b,d){b||(b=this.currentModel());var c=this._getGridChildren(b);if(c&&c.length>1||d===0&&c){d!==0&&this.toggleCursor(b,!1);var a=this._currentColumn,h=!0;a+=d;a<0?(this._linearGridMove&&d!==0&&(this._modelIterator.iterate(!1)?b=this.currentModel():h=!1),a=h?c.length-1:this._currentColumn):a>=c.length&&(this._linearGridMove&&d!==0&&(this._modelIterator.iterate(!0)?b=this.currentModel():
h=!1),a=h?0:this._currentColumn);this._currentColumn=a;d!==0&&this.toggleCursor(b,!0);return!0}return!1},_getGridChildren:function(b){return this._navDict?this._navDict.getGridNavHolder(b):null},getCurrentGrid:function(b){b||(b=this.currentModel());return(b=this._getGridChildren(b))&&b.length>0?b[this._currentColumn]:null},toggleCursor:function(b,d){var c=this.getRowDiv(b),a=this.getCurrentGrid(b);a?(c&&(d?c.classList.add("treeIterationCursorRow"):c.classList.remove("treeIterationCursorRow")),a.domNode&&
(d?a.domNode.classList.add("treeIterationCursor"):a.domNode.classList.remove("treeIterationCursor"))):c&&(d?c.classList.add("treeIterationCursorRow_Dotted"):c.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(b,d,c,a){var c=c===void 0?!1:c,h,l;if(b||d){if(l===this._modelIterator.cursor())return;h=this._modelIterator.cursor();l=b;this._modelIterator.setCursor(l)}else h=this._modelIterator.prevCursor(),l=this._modelIterator.cursor();
if(h!==l||d)if(this.toggleCursor(h,!1),!d||l)if(this.moveColumn(null,0),this.toggleCursor(l,!0),(b=this.getRowDiv())&&!a&&!this._visible(b)&&b.scrollIntoView(!c),this.explorer.onCursorChanged)this.explorer.onCursorChanged(h,l)},getSelection:function(){return this._selections},getSelectionIds:function(){for(var b=[],d=0;d<this._selections.length;d++)b.push(this.model.getId(this._selections[d]));return b},getRowDiv:function(b){b=b?b:this._modelIterator.cursor();if(!b)return null;var b=this.model.getId(b),
d=this._navDict.getValue(b);return d&&d.rowDomNode?d.rowDomNode:k.node(b)},iterate:function(b,d,c){this.topIterationNodes.length!==0&&this._modelIterator.iterate(b,d)&&(this.cursorOn(null,!1,b),c&&this.setSelection(this.currentModel(),!0))},_checkRow:function(b,d){if(this.explorer.renderer._useCheckboxSelection){var c=this.getRowDiv(b);if(c){var a=k.node(this.explorer.renderer.getCheckBoxId(c.id)),h=d?!a.checked:!0;if(h!==a.checked)this.explorer.renderer.onCheck(c,a,h,!0)}}else this._select(b,d)},
_vpWidth:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},_vpHeight:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},_getToolBarHeight:function(b){return(b=k.node(b))?k.bounds(b).height:0},_visible:function(b){if(b.offsetWidth===0||b.offsetHeight===0)return!1;var d=0;d+=this._getToolBarHeight("staticBanner");d+=this._getToolBarHeight("titleArea");d+=this._getToolBarHeight("pageToolbar");var c=
this._getEventListeningDiv(!0).getClientRects()[0],a=this._vpHeight();this._vpWidth();for(var d=c.top>d?c.top:d,c=c.bottom<a?c.bottom:a,b=b.getClientRects(),a=0,h=b.length;a<h;a++){var l=b[a];if(l.top>=d&&l.top<=c&&l.bottom>=d&&l.bottom<=c)return!0}return!1},_select:function(b){b||(b=this._modelIterator.cursor());var d=this.getRowDiv(b);d&&(this._inSelection(b)<0?d.classList.add("checkedRow"):d.classList.remove("checkedRow"))},_onModelGrid:function(b,d){var c=this._getGridChildren(b);if(c)for(var a=
0;a<c.length;a++)if(d.target===c[a].domNode)return!0;return!1},onClick:function(e,d){var c=k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(e)));if(d.target!==c&&!this._onModelGrid(e,d))if(this.cursorOn(e,!0,!1,!0),b)this.setSelection(e,!0);else if(this._ctrlKeyOn(d))this.setSelection(e,!0);else if(d.shiftKey&&this._lastSelection){if(c=this._modelIterator.scan(this._lastSelection,e)){this._clearSelection(!0);for(var a=0;a<c.length;a++)this.setSelection(c[a],!0)}}else this.setSelection(e,
!1)},onCollapse:function(b){this._modelIterator.collapse(b)&&this.cursorOn()},onUpArrow:function(b){this.iterate(!1,!1,b.shiftKey);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1);b.preventDefault();return!1},onDownArrow:function(b){this.iterate(!0,!1,b.shiftKey);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1);b.preventDefault();return!1},_shouldMoveColumn:function(b){var d=this.currentModel(),c=this._getGridChildren(d);return c&&c.length>1?this.isExpandable(d)?
this._ctrlKeyOn(b):!0:!1},onLeftArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,-1),b.preventDefault(),!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&this.isExpanded(d))return this.explorer.myTree.collapse(d),b.preventDefault(),!0;this._modelIterator.topLevel(d)?this.explorer.scopeUp&&typeof this.explorer.scopeUp==="function"&&this.explorer.scopeUp():(this.cursorOn(d.parent),this.setSelection(d.parent,!1))},onRightArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,
1),b.preventDefault(),!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&!this.isExpanded(d))return this.explorer.myTree.expand(d),b.preventDefault(),!1},_isRowSelectable:function(b){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(b):!0},onSpace:function(b){this.setSelection(this.currentModel(),!0);b.preventDefault()},onEnter:function(b){var d=this.getCurrentGrid(this._modelIterator.cursor());if(d)if(d.widget)if(typeof d.onClick==="function")d.onClick();
else typeof d.widget.focus==="function"&&d.widget.focus();else{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(b),!1,!1,!1,0,null);d.domNode.dispatchEvent(c)}else if(this.explorer.renderer.getRowActionElement&&(d=this._modelIterator.cursor()))if(d=this.explorer.renderer.getRowActionElement(this.model.getId(d)),d.href)this._ctrlKeyOn(b)?window.open(d.href):window.location.href=d.href}};return g}();j.ExplorerNavDict=function(){function b(e){this._dict=
{};this._model=e}b.prototype={addRow:function(b,d){this._dict[this._model.getId(b)]={model:b,rowDomNode:d}},getValue:function(b){return this._dict[b]},getGridNavHolder:function(b,d){if(!b)return null;var c=this._model.getId(b);if(this._dict[c]){if(!this._dict[c].gridChildren&&d)this._dict[c].gridChildren=[];return this._dict[c].gridChildren}return null},initGridNavHolder:function(b){if(!b)return null;b=this._model.getId(b);if(this._dict[b])this._dict[b].gridChildren=null}};return b}();return j});
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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});return i});
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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});return i});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(j,k,i){function b(b,d,c){if(!b[d])throw d+j[" is not supported in this file system"];return b[d].apply(b,c)}function f(e,d,c,a){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 b(e,"readBlob",[d]).then(function(d){return b(c,"writeBlob",[a,d])});var h=a.substring(0,
a.length-1),l=decodeURIComponent(h.substring(h.lastIndexOf("/")+1)),h=h.substring(0,h.lastIndexOf("/")+1);return b(c,"createFolder",[h,l]).then(function(){},function(){}).then(function(){return b(e,"fetchChildren",[d]).then(function(b){for(var d=[],h=0;h<b.length;++h){var m=b[h].Location,t=m;b[h].Directory&&(t=m.substring(0,m.length-1));t=decodeURIComponent(t.substring(t.lastIndexOf("/")+1));t=a+encodeURIComponent(t);b[h].Directory&&(t+="/");d[h]=f(e,m,c,t)}return k.all(d)})})}function g(b,d){function c(a){var m=
new k;m.reject(j["No Matching FileService for location:"]+a);return m}var a=b.getServiceReferences("orion.core.file"),h=a;if(d)for(var h=[],l=0;l<a.length;++l)d(a[l])&&h.push(a[l]);for(var f=[],g=[],p=[],m=[],t={fetchChildren:function(){var a=new k;a.resolve(m);return a},createWorkspace:function(){var a=new k;a.reject(j["no file service"]);return a},loadWorkspaces:function(){var a=new k;a.reject(j["no file service"]);return a},loadWorkspace:function(){var a=new k;window.setTimeout(function(){a.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:j["File Servers"],Location:"/",Children:m,ChildrenLocation:"/"})},100);return a},search:c,createProject:c,createFolder:c,createFile:c,deleteFile:c,moveFile:c,copyFile:c,read:c,write:c},a=0;a<h.length;++a)m[a]={Directory:!0,Length:0,LocalTimeStamp:0,Location:h[a].getProperty("top"),ChildrenLocation:h[a].getProperty("top"),Name:h[a].getProperty("Name")},l=h[a].getProperty("pattern")||".*",l[0]!=="^"&&(l="^"+l),f[a]=RegExp(l),g[a]=b.getService(h[a]),p[a]=h[a].getProperty("Name"),
h[a].getProperty("NameKey")&&h[a].getProperty("nls")&&i.getMessageBundle(h[a].getProperty("nls")).then(function(a,c){m[a].Name=c[h[a].getProperty("NameKey")];p[a]=c[h[a].getProperty("NameKey")]}.bind(this,a));this._getServiceIndex=function(a){if(a==="/")return-1;else if(!a||a.length&&a.length===0)return g[0]?0:-1;for(var m=0;m<f.length;++m)if(f[m].test(a))return m;throw j["No Matching FileService for location:"]+a;};this._getService=function(a){a=this._getServiceIndex(a);return a===-1?t:g[a]};this._getServiceName=
function(a){a=this._getServiceIndex(a);return a===-1?t.Name:p[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return a===-1?t.Location:m[a].Location}}g.prototype={getService:function(b){return this._getService(b)},fileServiceName:function(b){return this._getServiceName(b)},fileServiceRootURL:function(b){return this._getServiceRootURL(b)},fetchChildren:function(e){return b(this._getService(e),"fetchChildren",arguments)},createWorkspace:function(e){return b(this._getService(),"createWorkspace",
arguments)},loadWorkspaces:function(){return b(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(e){return b(this._getService(e),"loadWorkspace",arguments)},createProject:function(e,d,c,a){return b(this._getService(e),"createProject",arguments)},createFolder:function(e,d){return b(this._getService(e),"createFolder",arguments)},createFile:function(e,d){return b(this._getService(e),"createFile",arguments)},deleteFile:function(e){return b(this._getService(e),"deleteFile",arguments)},
moveFile:function(e,d,c){var a=this._getService(e),h=this._getService(d);if(a===h)return b(a,"moveFile",arguments);var l=e[e.length-1]==="/",g=d;g[g.length-1]!=="/"&&(g+="/");if(c)g+=encodeURIComponent(c);else{var q=e;l&&(q=q.substring(0,q.length-1));g+=q.substring(q.lastIndexOf("/")+1)}l&&g[g.length-1]!=="/"&&(g+="/");return f(a,e,h,g).then(function(){return b(a,"deleteFile",[e])})},copyFile:function(e,d,c){var a=this._getService(e),h=this._getService(d);if(a===h)return b(a,"copyFile",arguments);
var l=e[e.length-1]==="/",g=d;g[g.length-1]!=="/"&&(g+="/");if(c)g+=encodeURIComponent(c);else{var q=e;l&&(q=q.substring(0,q.length-1));g+=q.substring(q.lastIndexOf("/")+1)}l&&g[g.length-1]!=="/"&&(g+="/");return f(a,e,h,g)},read:function(e,d){return b(this._getService(e),"read",arguments)},write:function(e,d,c){return b(this._getService(e),"write",arguments)},remoteImport:function(e,d){return b(this._getService(e),"remoteImport",arguments)},remoteExport:function(e,d){return b(this._getService(e),
"remoteExport",arguments)},search:function(e){return b(this._getService(e.resource),"search",arguments)}};g.prototype.constructor=g;return{FileClient:g}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(j,k){function i(b,d,c){return b[d].apply(b,c)}function b(b){this._location=b}function f(){var b=new k;b.reject(j["No Matching OperationService for location:"]+this._location);return b}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 a=e.getService(d[c]);this._services[c]=a;a=d[c].getProperty("pattern")||".*";a[0]!=="^"&&(a="^"+a);this._patterns[c]=RegExp(a)}this._getService=function(a){if(!a)return this._services[0];for(var c=0;c<this._patterns.length;++c)if(this._patterns[c].test(a))return this._services[c];return new b(a)}}b.prototype={getOperation:f,getOperations:f,removeCompletedOperations:f,removeOperation:f,cancelOperation:f};b.prototype.constructor=b;g.prototype={getOperations:function(){var b=
new k;if(this._operations)return b.resolve(this._operations),b;var d=this;this._preferenceService.getPreferences("/operations").then(function(c){d._operations=c;b.resolve(d._operations)});return b},getOperation:function(b){return i(this._getService(b),"getOperation",arguments)},removeCompletedOperations:function(){for(var b=[],d=this,c=0;c<this._services.length;c++){var a=this._patterns[c],h=new k;b[c]=h.promise;i(this._services[c],"removeCompletedOperations").then(function(c){return function(b){Array.isArray(b)&&
d.getOperations.bind(d)().then(function(d){for(var h=d.keys(),m=0;m<h.length;m++){var t=h[m];a.test(t)&&b.indexOf(t)<0&&d.remove(t)}c.resolve()})}}(h),function(a){return function(c){a.reject(c)}}(h))}return k.all(b)},removeOperation:function(b){var d=this;return i(this._getService(b),"removeOperation",arguments).then(function(){d.getOperations.bind(d)().then(function(c){c.remove(b)})},function(c){return c},function(c){return c})}};g.prototype.constructor=g;return{OperationsClient:g}});
define("orion/webui/splitter",["require","orion/webui/littlelib"],function(j,k){function i(b){this._init(b)}i.prototype={_init:function(b){this._tracking=null;this._resizeListeners=[];this._animationDelay=501;this.$node=k.node(b.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=k.node(b.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=k.node(b.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";this._vertical=b.vertical;
this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");if(b.toggle)this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),this._thumb.classList.add("splitThumb"),this._thumb.classList.add("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(b){this._resizeListeners.push(b)},_initializeFromStoredSettings:function(){this._closed=localStorage.getItem(this._prefix+"/toggleState")==="closed";var b;if(this._vertical){if(b=localStorage.getItem(this._prefix+"/yPosition"))this._splitTop=
parseInt(b,10)}else if(b=localStorage.getItem(this._prefix+"/xPosition"))this._splitLeft=parseInt(b,10)},_adjustToSplitPosition:function(b){var f=k.bounds(this.$node),g=k.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=f.height;if(b||!this._splitTop)this._splitTop=f.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);b=this._splitTop;this.$node.parentNode.style.position==="relative"&&(b=this._splitTop-g.top);this.$sideNode.style.height=b+"px";this.$sideNode.style.bottom=
b-1+"px";this.$sideNode.style.display="block";this.$node.style.top=b+"px"}else{this._splitWidth=f.width;if(b||!this._splitLeft)this._splitLeft=f.left,localStorage.setItem(this._prefix+"/xPosition",this._splitLeft);b=this._splitLeft;this.$node.parentNode.style.position==="relative"&&(b=this._splitLeft-g.left);this.$sideNode.style.width=b+"px";this.$sideNode.style.right=b-1+"px";this.$sideNode.style.display="block";this.$node.style.left=b+"px"}this._resize()},_resize:function(b){var b=b||0,f=k.bounds(this.$node.parentNode),
g=k.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)},b);window.setTimeout(function(){e._notifyResizeListeners(e.$sideNode)},b)},_notifyResizeListeners:function(b){for(var f=0;f<this._resizeListeners.length;f++)this._resizeListeners[f](b)},_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 b=this;window.setTimeout(function(){b.$sideNode.classList.remove("sidePanelLayoutAnimation");b.$mainNode.classList.remove("mainPanelLayoutAnimation");b.$node.classList.remove("splitLayoutAnimation");b._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(b){if(b.target===this._thumb)return k.stop(b),this._thumbDown(b);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),k.stop(b)},_mouseMove:function(b){if(this._tracking){var f;this._vertical?(f=this._splitTop=b.clientY,this.$node.parentNode.style.position===
"relative"&&(f=k.bounds(this.$node.parentNode),f=this._splitTop-f.top),this.$node.style.top=f+"px"):(f=this._splitLeft=b.clientX,this.$node.parentNode.style.position==="relative"&&(f=k.bounds(this.$node.parentNode),f=this._splitLeft-f.left),this.$node.style.left=f+"px");this._adjustToSplitPosition(!0);k.stop(b)}},_mouseUp:function(b){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"),k.stop(b)}};i.prototype.constructor=i;return{Splitter:i}});define("text!orion/globalSearch/search-features.html",[],function(){return'<div id="replaceTopWidget_id" style="height:100%;width:100%;position:relative;">\n\t<div id="replaceTop" class="topPanelLayout">\n\t</div>\n\t<div class="replaceSplitLayout"></div>\n\t<div id="replaceBottom" class="bottomPanelLayout">\n\t</div>\n</div>'});
define("orion/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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});return i});
define("orion/URITemplate",[],function(){function j(c){this._text=c}function k(c,a){if(a==="U")return encodeURIComponent(c).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if(a==="U+R")return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]");if(a==="U+R-,")return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+a);}function i(c,a,b){for(var d=[],e=0;e<c.length;e++)typeof c[e]!=="undefined"&&
d.push(k(c[e],a));return d.join(b)}function b(c,a,b,d){for(var e=Object.keys(c),f=[],g=0;g<e.length;g++)typeof c[e[g]]!=="undefined"&&f.push(k(e[g],a)+b+k(c[e[g]],a));return f.join(d)}function f(c){if(c.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=e[c[0]])?c=c.substring(1):this._operator=e.NUL;for(var a=[],b=c.split(","),l=0;l<b.length;l++){var f=b[l].match(d);if(f===null)throw Error("Bad VarSpec: "+c);a.push({name:f[1],explode:!!f[2],prefix:f[3]?parseInt(f[3],
10):-1})}this._varSpecList=a}function g(c){for(var a=[],b=0,d=c.indexOf("{",b);d!==-1;){a.push(new j(c.substring(b,d)));b=c.indexOf("}",d+1);if(b===-1)throw Error("Invalid template: "+c);a.push(new f(c.substring(d+1,b)));b+=1;d=c.indexOf("{",b)}a.push(new j(c.substring(b)));this._templateComponents=a}var e={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},"/":{first:"/",sep:"/",named:!1,ifemp:"",
allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"&",named:!0,ifemp:"=",allow:"U"},"&":{first:"&",sep:"&",named:!0,ifemp:"=",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},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 a=[],d=
0;d<this._varSpecList.length;d++){var e=this._varSpecList[d],f=e.name,g=c[f],j=typeof g;if(j!=="undefined"&&g!==null){var m=a.length===0?this._operator.first:this._operator.sep;if(j==="string")this._operator.named&&(m+=k(f,"U+R"),m+=g.length===0?this._operator.ifemp:"="),e.prefix!==-1&&e.prefix<g.length&&(g=g.substring(0,e.prefix)),m+=k(g,this._operator.allow);else if(Array.isArray(g))e.explode?m+=i(g,this._operator.allow,this._operator.sep):(this._operator.named&&(m+=k(f,"U+R"),m+=g.length===0?this._operator.ifemp:
"="),m+=i(g,this._operator.allow,","));else if(j==="object")e.explode?m+=b(g,this._operator.allow,"=",this._operator.sep):(this._operator.named&&(m+=k(f,"U+R"),m+=Object.keys(g).length===0?this._operator.ifemp:"="),m+=b(g,this._operator.allow,",",","));else throw Error("bad param type: "+f+" : "+j);a.push(m)}}return a.join("")}};g.prototype={expand:function(c){for(var a=[],b=0;b<this._templateComponents.length;b++)a.push(this._templateComponents[b].expand(c));return a.join("")}};return g});
define("orion/compare/compareUtils",["orion/URITemplate"],function(j){var k=k||{};k.compareUtils=k.compareUtils||{};k.compareUtils.lookUpMapper=function(i,b,f){for(var g=0,e=0;e<i.length;e++){var d=i[e][b];d===0&&(d=1);if(f>=g&&f<g+d)return{mapperIndex:e,startFrom:g};if(e===i.length-1)break;g+=i[e][b]}return{mapperIndex:i.length-1,startFrom:g}};k.compareUtils.lookUpLineIndex=function(i,b,f){if(f===0)return 0;for(var g=0,e=0;e<f;e++)g+=i[e][b];return g};k.compareUtils.updateMapper=function(i,b,f,g,
e){if(g!==e&&(g>0||e>0)){var d=k.compareUtils.lookUpMapper(i,b,f);if(!(d.mapperIndex<0)){if(g>0)for(var c=f-d.startFrom,f=d.mapperIndex;f<i.length;f++){c=i[f][b]-c;if(g<=c){i[f][b]-=g;break}i[f][b]-=c;g-=c;c=0}e>0&&(i[d.mapperIndex][b]+=e)}}};k.compareUtils.overlapMapper=function(i,b,f,g,e){i=f+i[b]-1;i<f&&(i=f);e<g&&(e=g);return i<g||e<f?!1:!0};k.compareUtils.findFirstDiff=function(i,b,f,g){for(var e=0,d=void 0,c=0;c<i.length;c++){if(e>g)break;if(k.compareUtils.overlapMapper(i[c],b,e,f,g)&&(d={mapperIndex:c,
startFrom:e},i[c][2]!==0))break;e+=i[c][b]}return d};k.compareUtils.matchMapper=function(i,b,f,g){if(i.length===0)return f;var e=f+Math.round((g-f)/3),d=k.compareUtils.findFirstDiff(i,b,f,g),c=i[d.mapperIndex][b]===0?d.startFrom:d.startFrom+i[d.mapperIndex][b]-1,a=k.compareUtils.lookUpLineIndex(i,1-b,d.mapperIndex),h=d.startFrom-f;return i[d.mapperIndex][2]===0?a-h:e>=d.startFrom&&e<=c?a-Math.round((g-f)/3):e<d.startFrom?a-h:(i[d.mapperIndex][1-b]===0?a:a+i[d.mapperIndex][1-b]-1)-(c-f)};k.compareUtils.getMapperLineCount=
function(i){for(var b=0,f=0;f<i.length;f++)b+=Math.max(i[f][0],i[f][1]);return b};k.compareUtils.getAnnotationIndex=function(i,b){for(var f=0;f<i.length;f++)if(i[f][0]===b)return f;return-1};k.compareUtils.getAnnotationMapperIndex=function(i,b){return i[b][1]};k.compareUtils.getAnnotationIndexByMapper=function(i,b){for(var f=0;f<i.length;f++)if(i[f][1]===b)return{current:f,prev:f-1,next:f+1};return{current:-1,prev:-1,next:-1}};k.compareUtils.isMapperConflict=function(i,b){return b<0?!1:!i[b][3]?!1:
i[b][3]===1};k.compareUtils.mergeDiffBlocks=function(i,b,f,g,e,d){for(var c=0;c<b.length;c++){var a=b[c][0],h=f[b[c][1]];if(h[0]>0){for(var l="",n=0;n<h[0];n++)l=l+g[h[2]-1+n].substring(e)+d;h=i.getLineCount();a>=h&&(a=h-1);a=i.getLineStart(a);i.setText(l,a,a)}}};k.compareUtils.generateCompareHref=function(i,b){var f=require.toUrl("compare/compare.html");if(!b.conflict)b.conflict=void 0;if(!b.readonly)b.readonly=void 0;return(new j(f+"#{,resource,params*}")).expand({resource:i,params:b})};k.compareUtils.generateCompareTreeHref=
function(i,b){var f=require.toUrl("compare-tree/compare-tree.html");return(new j(f+"#{,resource,params*}")).expand({resource:i,params:b})};return k.compareUtils});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/compare-features",["i18n!orion/compare/nls/messages","orion/compare/compareUtils","orion/webui/littlelib","orion/webui/splitter","text!orion/compare/compare-features.html"],function(j,k,i,b,f){var g=g||{};g.TwoWayCompareUIFactory=function(){function e(b){this._parentDivID=b.parentDivID;this._commandSpanId=b.commandSpanId;this._showTitle=b.showTitle;this._leftTitle=b.leftTitle;this._rightTitle=b.rightTitle;this._showLineStatus=b.showLineStatus}e.prototype={_init:function(){var b=
this._parentDivID+"_";this._topWidgetDiv=i.node("topWidget_id");this._topWidgetDiv.id=b+"topWidget_id";this._leftEditorParentDiv=i.node("left_editor_id");this._leftEditorParentDiv.id=b+"left_editor_id";this._rightEditorParentDiv=i.node("right_editor_id");this._rightEditorParentDiv.id=b+"right_editor_id";this._rightEditorWrapperDiv=i.node("right_editor_wrapper_id");this._rightEditorWrapperDiv.id=b+"right_editor_wrapper_id";this._leftTitleDiv=i.node("left_title_id");this._leftTitleDiv.id=b+"left_title_id";
this._rightTitleDiv=i.node("right_title_id");this._rightTitleDiv.id=b+"right_title_id";this._leftStatusDiv=i.node("left_status_id");this._leftStatusDiv.id=b+"left_status_id";this._rightStatusDiv=i.node("right_status_id");this._rightStatusDiv.id=b+"right_status_id";this._diffCanvasDiv=i.node("diff_canvas_id");this._diffCanvasDiv.id=b+"diff_canvas_id";this._splitterId=b+"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),a=i.$(".rightPanelLayout",this._topWidgetDiv);if(d&&c&&a)this._splitter=new b.Splitter({node:d,sidePanel:c,mainPanel:a})},
buildUI:function(){i.node(this._parentDivID).innerHTML=f;this._init();this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(b){return i.$(".leftPanelLayout",this._topWidgetDiv)===b},getEditorParentDiv:function(b){return b?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(b){return b?this._leftTitleDiv:this._rightTitleDiv},getStatusDiv:function(b){return b?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},
getDiffCanvasDiv:function(){return this._diffCanvasDiv}};return e}();return g});
define("orion/compare/diff-parser",[],function(){var j=j||{};j.DiffParser=function(){function j(b,f){this._lineDelimiter=b?b: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(b){this._diffLineDelimiter=this._lineDelimiter=b},getDiffArray:function(){return{array:this._diffContents,index:this._diffContentIndex}},parse:function(b,f,g,e){this._init();if(f==="")return{outPutFile:b,mapper:[]};this._oFileContents=b===""?[]:b.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:b,
mapper:[]};if(this._DEBUG){console.log("***Diff contents: \n");for(b=0;b<this._diffContents.length;b++)console.log(this._diffContents[b]);console.log("***Hunk ranges: \n");console.log(JSON.stringify(this._hunkRanges))}for(b=0;b<this._hunkRanges.length;b++)this._parseHunkBlock(b);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 b=0;b<this._deltaMap.length;b++)if(console.log(JSON.stringify(this._deltaMap[b])),
this._deltaMap[b][2]>0){console.log("    **Diff content on change/add: \n");for(var f=0;f<this._deltaMap[b][0];f++)console.log("    "+this._diffContents[this._deltaMap[b][2]+f-1])}},_logNewFile:function(){for(var b=0;b<this._nFileContents.length;b++)console.log(this._nFileContents[b])},_createBlock:function(b,f,g,e){e===g&&b===" "||(g=[g,e-g,"s"],b==="-"?g[2]="r":b==="+"?g[2]="a":b==="c"&&(g[2]="c"),f.push(g))},_createMinusBlock:function(b,f,g){var e=this._oBlocks.length;e===0||b!==this._oBlocks[e-
1][0]?(this._oBlocks.push([b===0?1:b,g]),this._nBlocks.push([f,0,-2])):this._oBlocks[e-1][1]+=g},_createPlusBlock:function(b,f,g,e){var d=this._nBlocks.length;d===0||f!==this._nBlocks[d-1][0]?(this._oBlocks.push([b===0?1:b,0]),this._nBlocks.push([f,g,e])):(this._nBlocks[d-1][1]+=g,this._nBlocks[d-1][2]=e)},_parseHunkBlock:function(b){for(var f=" ",g=this._hunkRanges[b][0]+1,e=b===this._hunkRanges.length-1?this._diffContents.length:this._hunkRanges[b+1][0],d=0,c=0,a=this._hunkRanges[b][1],h=this._hunkRanges[b][3],
l=g,n=g;n<e;n++)if(0!==this._diffContents[n].length){var q=this._diffContents[n][0];if(q==="\\"&&("\\ No newline at end of file"===this._diffContents[n].substring(0,this._diffContents[n].length-1)||"\\ No newline at end of file"===this._diffContents[n]))f==="-"?this._oNewLineAtEnd=!1:f===" "?this._oNewLineAtEnd=this._nNewLineAtEnd=!1:this._nNewLineAtEnd=!1,n>g&&this._diffContents[n-1][this._diffContents[n-1].length-1]==="\r"&&(this._diffContents[n-1]=this._diffContents[n-1].substring(0,this._diffContents[n-
1].length-1));else{switch(q){case "-":case "+":case " ":break;default:continue}if(f!==q){q==="+"&&(l=n);switch(f){case " ":a=this._hunkRanges[b][1]+d;h=this._hunkRanges[b][3]+c;break;case "-":this._createMinusBlock(a,h,this._hunkRanges[b][1]+d-a);break;case "+":this._createPlusBlock(a,h,this._hunkRanges[b][3]+c-h,l)}f=q}switch(q){case "-":d++;break;case "+":c++;break;case " ":d++,c++}}}switch(f){case "-":this._createMinusBlock(a,h,this._hunkRanges[b][1]+d-a);break;case "+":this._createPlusBlock(a,
h,this._hunkRanges[b][3]+c-h,l)}},_detectConflictes:function(b,f){if(b<0)return!1;for(var g=b+f,e=b;e<g;e++){var d=this._diffContents[e];if(d.indexOf("<<<<<")>-1||d.indexOf(">>>>>")>-1)return!0}return!1},_buildMap:function(b){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),b&&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,b=this._deltaMap[this._deltaMap.length-1],b[2]===0?(b[0]+=d,b[1]+=d):b[2]===-1?this._deltaMap.push([d,d,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([d,d,0]):(this._nNewLineAtEnd&&(b[0]+=d),this._oNewLineAtEnd&&(b[1]+=d)))},_buildNewFile:function(){for(var b=
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[b+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));b+=this._deltaMap[e][1]}this._nNewLineAtEnd&&!f&&this._nFileContents.push("")},_parseHRangeBody:function(b,f){if(0<b.indexOf(",")){var g=b.split(","),e=parseInt(g[0]),g=parseInt(g[1]);
f.push(e>=0?e:1);f.push(g>=0?g:1)}else e=parseInt(b),f.push(e>=0?e:1),f.push(1)},_parseHunkRange:function(b){var f=this._diffContents[b];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 b=[b],g<e?(f=f.substring(g+1).split("+"),this._parseHRangeBody(f[0],b),this._parseHRangeBody(f[1],b)):(f=f.substring(e+1).split("-"),this._parseHRangeBody(f[1],b),this._parseHRangeBody(f[0],b)),
b}}}};return j}();return j});define("orion/editor/i18n",{load:function(j,k,i){k.specified&&k.specified("orion/bootstrap")?k(["orion/i18n!"+j],function(b){i(b)}):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,k){var i={root:k},b;for(b in j)j.hasOwnProperty(b)&&typeof i[b]==="undefined"&&(i[b]=j[b]);return i});
define("orion/editor/eventTarget",[],function(){function j(){}j.addMixin=function(k){var i=j.prototype,b;for(b in i)i.hasOwnProperty(b)&&(k[b]=i[b])};j.prototype={addEventListener:function(j,i,b){if(!this._eventTypes)this._eventTypes={};var f=this._eventTypes[j];f||(f=this._eventTypes[j]={level:0,listeners:[]});f.listeners.push({listener:i,useCapture:b})},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 b=this._eventTypes?this._eventTypes[j]:null;if(b){var f=b.listeners;try{if(b.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(b.level--,b.compact&&b.level===0){for(g=f.length-1;g>=0;g--)f[g]||f.splice(g,1);f.length===0&&delete this._eventTypes[j];b.compact=!1}}}},isListening:function(j){return!this._eventTypes?!1:this._eventTypes[j]!==void 0},removeEventListener:function(j,
i,b){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===b){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/util",[],function(){var j=navigator.userAgent,k=parseFloat(j.split("MSIE")[1])||void 0,i=parseFloat(j.split("Firefox/")[1]||j.split("Minefield/")[1])||void 0,b=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,a=c||j,h=navigator.platform.indexOf("Mac")!==-1,l=navigator.platform.indexOf("Win")!==-1,n=navigator.platform.indexOf("Linux")!==
-1;return{formatMessage:function(a){var c=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,b){return c[(b<<0)+1]})},createElement:function(a,c){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",c):a.createElement(c)},isIE:k,isFirefox:i,isOpera:b,isChrome:f,isSafari:g,isWebkit:e,isAndroid:d,isIPad:c,isIPhone:j,isIOS:a,isMac:h,isWindows:l,isLinux:n,platformDelimiter:l?"\r\n":"\n"}});
define("orion/editor/keyBinding",["orion/editor/util"],function(j){function k(i,b,f,g,e){this.keyCode=typeof i==="string"?i.toUpperCase().charCodeAt(0):i;this.mod1=b!==void 0&&b!==null?b:!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}k.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:k}});
define("orion/editor/contentAssist",["i18n!orion/editor/nls/messages","orion/editor/keyBinding","orion/editor/eventTarget","orion/Deferred","orion/editor/util"],function(j,k,i,b,f){var g,e,d;function c(a){this.textView=a;this.state=g;this.providers=[];var c=this;this.contentAssistListener={onModelChanging:function(a){c.isDeactivatingChange(a)?c.setState(g):c.state===e&&c.setState(d)},onScroll:function(){c.setState(g)},onSelection:function(){var a=c.state;if(a===e||a===d)c.computeProposals(),c.setState(d)}};
a.setKeyBinding(f.isMac?new k.KeyBinding(" ",!1,!1,!1,!0):new k.KeyBinding(" ",!0),"contentAssist");a.setAction("contentAssist",function(){c.activate();return!0},{name:j.contentAssist})}function a(a,c){this.contentAssist=a;this.widget=c;this.proposals=[];var b=this;this.contentAssist.addEventListener("ProposalsComputed",function(a){b.proposals=a.data.proposals;b.selectedIndex=b.proposals.length?0:-1})}function h(a,c){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=
this.textViewListenerAdded=!1;var b=this.textView.getOptions("parent").ownerDocument;this.parentNode=typeof c==="string"?b.getElementById(c):c;if(!this.parentNode){this.parentNode=f.createElement(b,"div");this.parentNode.className="contentassist";var m=b.getElementsByTagName("body")[0];if(m)m.appendChild(this.parentNode);else throw Error("parentNode is required");}var d=this;this.textViewListener={onMouseDown:function(a){a.event.target.parentElement!==d.parentNode&&d.contentAssist.deactivate()}};
this.contentAssist.addEventListener("ProposalsComputed",function(a){d.setProposals(a.data.proposals);d.show();if(!d.textViewListenerAdded)d.textView.addEventListener("MouseDown",d.textViewListener.onMouseDown),d.textViewListenerAdded=!0});this.contentAssist.addEventListener("Deactivating",function(){d.setProposals([]);d.hide();if(d.textViewListenerAdded)d.textView.removeEventListener("MouseDown",d.textViewListener.onMouseDown),d.textViewListenerAdded=!1;d.textViewListenerAdded=!1});this.scrollListener=
function(){d.isShowing&&d.position()};b.addEventListener("scroll",this.scrollListener)}g=1;e=2;d=3;var l={selected:" selected",hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",dfault:"proposal-default"};c.prototype={apply:function(a){if(!a)return!1;var c=this.textView.getCaretOffset(),b={proposal:a,start:c,end:c};this.setState(g);this.textView.setText(a.proposal||a,c,c);this.dispatchEvent({type:"ProposalApplied",data:b});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(a){var c=a.removedCharCount>0&&a.addedCharCount===0,b=this.textView,b=a.start+1<=b.getModel().getCharCount()&&/^\s*$/.test(b.getText(a.start,a.start+1));return a.removedLineCount>0||a.addedLineCount>0||c&&b},setState:function(a){var c;a===e?c="Activating":a===g&&(c="Deactivating");c&&this.dispatchEvent({type:c});
this.state=a;this.onStateChange(a)},onStateChange:function(a){if(a===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(a===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 a=this;this._computeProposals(this.textView.getCaretOffset()).then(function(c){a.dispatchEvent({type:"ProposalsComputed",data:{proposals:c}})})},getPrefixStart:function(a){for(;a>0&&/[A-Za-z0-9_]/.test(this.textView.getText(a-1,a));)a--;return a},handleError:function(a){typeof console!==
"undefined"&&(console.log("Error retrieving content assist proposals"),console.log(a))},_computeProposals:function(a){var c=this.providers,d=this.textView,m=d.getModel(),h=d.getText(),o={line:m.getLine(m.getLineAtOffset(a)),prefix:d.getText(this.getPrefixStart(a),a),selection:d.getSelection()},e=this,c=c.map(function(m){var c=m.computeProposals||m.getProposals,d;try{typeof c==="function"&&(d=e.progress?e.progress.progress(c.apply(m,[h,a,o]),"Generating content assist proposal"):c.apply(m,[h,a,o]))}catch(f){e.handleError(f)}return b.when(d)});
return b.all(c,this.handleError).then(function(a){return a.reduce(function(a,m){return m instanceof Array?a.concat(m):a},[])})},setProviders:function(a){this.providers=a.slice(0)},setProgress:function(a){this.progress=a}};i.EventTarget.addMixin(c.prototype);a.prototype={cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},isActive:function(){return this.getContentAssist().isActive()},lineUp:function(){for(var a=this.selectedIndex===0?this.proposals.length-
1:this.selectedIndex-1;this.proposals[a].unselectable&&a>0;)a--;this.selectedIndex=a;this.widget&&this.widget.setSelectedIndex(this.selectedIndex);return!0},lineDown:function(){for(var a=this.selectedIndex===this.proposals.length-1?0:this.selectedIndex+1;this.proposals[a].unselectable&&a<this.proposals.length-1;)a++;this.selectedIndex=a;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(a){this.contentAssist.apply(this.getProposal(a.target));this.textView.focus()},createDiv:function(a,c,b,m){var d=b.ownerDocument,h=f.createElement(d,"div");h.id="contentoption"+m;h.setAttribute("role","option");a.style==="hr"?a=f.createElement(d,"hr"):(h.className=this.calculateClasses(a.style,c),a=d.createTextNode(this.getDisplayString(a)),c&&this.parentNode.setAttribute("aria-activedescendant",
h.id));h.appendChild(a,h);b.appendChild(h)},createAccessible:function(a){this._isAccessible||this.parentNode.addEventListener("keydown",function(c){c.preventDefault();if(c.keyCode===27)return a.cancel();else if(c.keyCode===38)return a.lineUp();else if(c.keyCode===40)return a.lineDown();else if(c.keyCode===13)return a.enter();return!1});this._isAccessible=!0},calculateClasses:function(a,c){var b=l[a];if(!b)b=l.dfault;return c?b+l.selected:b},getDisplayString:function(a){return typeof a==="string"?
a:a.description&&typeof a.description==="string"?a.description:a.proposal},getProposal:function(a){for(var c=0,b=this.parentNode.firstChild;b!==null;b=b.nextSibling){if(b===a)return this.proposals[c]||null;c++}return null},setSelectedIndex:function(a){this.selectedIndex=a;this.selectNode(this.parentNode.childNodes[this.selectedIndex])},selectNode:function(a){for(var c=this.parentNode.childNodes,b=0;b<c.length;b++){var m=c[b],d=m.className.indexOf(l.selected);if(d>=0)m.className=m.className.substring(0,
d)+m.className.substring(d+l.selected.length);m===a&&(m.className+=l.selected,this.parentNode.setAttribute("aria-activedescendant",m.id),m.focus(),m.offsetTop<this.parentNode.scrollTop?m.scrollIntoView(!0):m.offsetTop+m.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight&&m.scrollIntoView(!1))}},setProposals:function(a){this.proposals=a},show:function(){if(this.proposals.length===0)this.hide();else{this.parentNode.innerHTML="";for(var a=0;a<this.proposals.length;a++)this.createDiv(this.proposals[a],
a===0,this.parentNode,a);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 a=this.textView.getLocationAtOffset(this.textView.getCaretOffset());a.y+=this.textView.getLineHeight();this.textView.convert(a,"document","page");this.parentNode.style.position="fixed";
this.parentNode.style.left=a.x+"px";this.parentNode.style.top=a.y+"px";this.parentNode.style.display="block";this.parentNode.scrollTop=0;var c=this.parentNode.ownerDocument,b=c.documentElement.clientWidth;if(a.y+this.parentNode.offsetHeight>c.documentElement.clientHeight)this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px";if(a.x+this.parentNode.offsetWidth>b)this.parentNode.style.left=b-this.parentNode.offsetWidth+"px"}};return{ContentAssist:c,ContentAssistMode:a,
ContentAssistWidget:h}});
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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});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}}});
(function(){function j(a){return a?a.slice(1).split("&"):[]}function k(a){return a.length===0?"":"?"+a.join("&")}function i(a){var c=/([^=]*)(?:=?)(.*)/.exec(a),a=c[1]?decodeURIComponent(c[1]):"",c=c[2]?decodeURIComponent(c[2]):"";return[a,c]}function b(a){var c=encodeURIComponent(a[0]);a[1]&&(c+="="+encodeURIComponent(a[1]));return c}function f(a,c){var b="",m=[],d=0;return{next:function(){if(b!==a.search)b=a.search,m=j(b);if(d<m.length){var h=i(m[d++]);switch(c){case "keys":return h[0];case "values":return h[1];
case "keys+values":return[h[0],h[1]];default:throw new TypeError;}}throw l;}}}function g(a){if(typeof a!=="string")throw new TypeError;}function e(a){var c=a.protocol;return!c||c===":"||c==="http:"&&!a.hostname?!1:!0}function d(a){Object.defineProperty(this,"_anchor",{value:a})}function c(a,c){a=a||"";if(typeof a!=="string")throw new TypeError("url");c=c?c.href||c:"";if(typeof c!=="string")throw new TypeError("base");Object.defineProperty(this,"_input",{value:a,writable:!0});var b=document.implementation.createHTMLDocument("");
if(c){var m=b.createElement("a");m.href=c;if(m.protocol.length<2||!m.host)throw Error("InvalidStateError");var h=b.createElement("base");h.href=m.href;b.head.appendChild(h)}var o=b.createElement("a");o.href=a;b.body.appendChild(o);Object.defineProperty(this,"_urlAnchor",{value:o});var w=new d(o);Object.defineProperty(this,"query",{get:function(){return e(o)?w:null},enumerable:!0})}try{if(typeof window.URL==="function"&&window.URL.length!==0&&(new window.URL("http://www.w3.org")).protocol==="http:")return}catch(a){}var h=
/([^:]*):?(.*)/,l=typeof StopIteration!=="undefined"?StopIteration:Error("Stop Iteration");Object.defineProperties(d.prototype,{get:{value:function(a){g(a);var c;j(this._anchor.search).some(function(b){b=i(b);if(b[0]===a)return c=b[1],!0});return c},enumerable:!0},set:{value:function(a,c){g(a);g(c);var d=j(this._anchor.search);d.some(function(m,h){var o=i(m);if(o[0]===a)return o[1]=c,d[h]=b(o),!0})||d.push(b([a,c]));this._anchor.search=k(d)},enumerable:!0},has:{value:function(a){g(a);return j(this._anchor.search).some(function(c){if(i(c)[0]===
a)return!0})},enumerable:!0},"delete":{value:function(a){g(a);var c=j(this._anchor.search),b=c.filter(function(m){return i(m)[0]!==a});return b.length!==c.length?(this._anchor.search=k(b),!0):!1},enumerable:!0},clear:{value:function(){this._anchor.search=""},enumerable:!0},forEach:{value:function(a,c){if(typeof a!=="function")throw new TypeError;var b=f(this._anchor,"keys+values");try{for(;;){var m=b.next();a.call(c,m[1],m[0],this)}}catch(d){if(d!==l)throw d;}},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(a){g(a);var c=[];j(this._anchor.search).forEach(function(b){b=i(b);b[0]===a&&c.push(b[1])});return c},enumerable:!0},append:{value:function(a,c){g(a);g(c);var d=j(this._anchor.search);d.push(b([a,c]));this._anchor.search=k(d)},enumerable:!0}});
Object.defineProperties(c.prototype,{href:{get:function(){return e(this._urlAnchor)?this._urlAnchor.href:this._input},set:function(a){g(a);this._input=a;this._urlAnchor.href=a},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(a){g(a);this._urlAnchor.protocol=a},enumerable:!0},_userinfo:{get:function(){return!e(this._urlAnchor)?
"":RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host).exec(this._urlAnchor.href)[2]||""},set:function(a){g(a);this._urlAnchor.href=this._urlAnchor.href.replace(RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host),this._urlAnchor.protocol+"//"+(a?a+"@":"")+this._urlAnchor.host)}},username:{get:function(){if(!e(this._urlAnchor))return"";var a=h.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){g(a);var c=h.exec(this._userinfo),
a=[encodeURIComponent(a||"")];c[2]&&a.push(c[2]);this._userinfo=a.join(":")},enumerable:!0},password:{get:function(){if(!e(this._urlAnchor))return"";var a=h.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){g(a);var c=[h.exec(this._userinfo)[1]||""];a&&c.push(encodeURIComponent(a));this._userinfo=c.join(":")},enumerable:!0},host:{get:function(){return e(this._urlAnchor)?this._urlAnchor.host:""},set:function(a){g(a);this._urlAnchor.host=a},enumerable:!0},hostname:{get:function(){return e(this._urlAnchor)?
this._urlAnchor.hostname:""},set:function(a){g(a);this._urlAnchor.hostname=a},enumerable:!0},port:{get:function(){return e(this._urlAnchor)?this._urlAnchor.port:""},set:function(a){g(a);this._urlAnchor.port=a},enumerable:!0},pathname:{get:function(){return e(this._urlAnchor)?this._urlAnchor.pathname:""},set:function(a){g(a);this._urlAnchor.pathname=a},enumerable:!0},search:{get:function(){return e(this._urlAnchor)?this._urlAnchor.search:""},set:function(a){g(a);this._urlAnchor.search=a},enumerable:!0},
hash:{get:function(){return e(this._urlAnchor)?this._urlAnchor.hash:""},set:function(a){g(a);this._urlAnchor.hash=a},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/undoStack",[],function(){function j(b,f,g){this.offset=b;this.text=f;this.previousText=g}function k(){this.changes=[]}function i(b,f){this.view=b;this.size=f!==void 0?f:100;this.reset();var g=b.getModel();g.getBaseModel&&(g=g.getBaseModel());this.model=g;var e=this;this._listener={onChanging:function(b){e._onChanging(b)},onDestroy:function(b){e._onDestroy(b)}};g.addEventListener("Changing",this._listener.onChanging);b.addEventListener("Destroy",this._listener.onDestroy)}j.prototype=
{undo:function(b,f){this._doUndoRedo(this.offset,this.previousText,this.text,b,f)},redo:function(b,f){this._doUndoRedo(this.offset,this.text,this.previousText,b,f)},_doUndoRedo:function(b,f,g,e,d){var c=e.getModel();if(c.mapOffset&&e.annotationModel){var a=c.mapOffset(b,!0);if(a<0)for(var h=e.annotationModel.getAnnotations(b,b+1);h.hasNext();){var l=h.next();if(l.type==="orion.annotation.folding"){l.expand();a=c.mapOffset(b,!0);break}}if(a<0)return;b=a}e.setText(f,b,b+g.length);d&&e.setSelection(b,
b+f.length)}};k.prototype={add:function(b){this.changes.push(b)},end:function(b){this.endSelection=b.getSelection();this.endCaret=b.getCaretOffset()},undo:function(b,f){for(var g=this.changes.length-1;g>=0;g--)this.changes[g].undo(b,!1);if(f){var g=this.startSelection.start,e=this.startSelection.end;b.setSelection(this.startCaret?g:e,this.startCaret?e:g)}},redo:function(b,f){for(var g=0;g<this.changes.length;g++)this.changes[g].redo(b,!1);if(f){var g=this.endSelection.start,e=this.endSelection.end;
b.setSelection(this.endCaret?g:e,this.endCaret?e:g)}},start:function(b){this.startSelection=b.getSelection();this.startCaret=b.getCaretOffset()}};i.prototype={add:function(b){this.compoundChange?this.compoundChange.add(b):(this.stack.splice(this.index,this.stack.length-this.index,b),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 b=this.index,f=this.stack.length;this._undoStart!==void 0&&b++;return{undo:b,redo:f-b}},undo:function(){this._commitUndo();if(this.index<=0)return!1;var b=this.stack[--this.index];this._ignoreUndo=!0;b.undo(this.view,!0);this._ignoreUndo=!1;return!0},
redo:function(){this._commitUndo();if(this.index>=this.stack.length)return!1;var b=this.stack[this.index++];this._ignoreUndo=!0;b.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 b=new k;this.add(b);this.compoundChange=b;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(b){var f=b.text,g=b.start,e=b.removedCharCount,b=b.addedCharCount;if(!this._ignoreUndo){this._undoStart!==void 0&&!(b===1&&e===0&&this._undoType===
1&&g===this._undoStart+this._undoText.length||b===0&&e===1&&this._undoType===-1&&(g+1===this._undoStart||g===this._undoStart))&&this._commitUndo();if(!this.compoundChange)if(b===1&&e===0){if(this._undoStart===void 0)this._undoStart=g;this._undoText+=f;this._undoType=1;return}else if(b===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/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(j,k){function i(a,c,b){this.start=a;this.end=c;this._projectionModel=b;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function b(){}function f(a,c){var d=a.lastIndexOf("."),d=a.substring(d+1),e={title:j[d],style:{styleClass:"annotation "+d},html:"<div class='annotationHTML "+d+"'></div>",overviewStyle:{styleClass:"annotationOverview "+d}};c?e.lineStyle={styleClass:"annotationLine "+
d}:e.rangeStyle={styleClass:"annotationRange "+d};b.registerType(a,e)}function g(){}function e(a){this._annotations=[];var c=this;this._listener={onChanged:function(a){c._onChanged(a)}};this.setTextModel(a)}function d(a,c){this._view=a;this._annotationModel=c;var b=this;this._listener={onDestroy:function(a){b._onDestroy(a)},onLineStyle:function(a){b._onLineStyle(a)},onChanged:function(a){b._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",
this._listener.onLineStyle);c.addEventListener("Changed",this._listener.onChanged)}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 a=this._projectionModel,c=a.getBaseModel();this._projection=
{start:c.getLineStart(c.getLineAtOffset(this.start)+1),end:c.getLineEnd(c.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},expand:function(){if(!this.expanded)this.expanded=!0,this.html=this._expandedHTML,this.style=this._expandedStyle,this._projectionModel.removeProjection(this._projection)}};b.ANNOTATION_ERROR="orion.annotation.error";b.ANNOTATION_WARNING="orion.annotation.warning";b.ANNOTATION_TASK="orion.annotation.task";b.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";
b.ANNOTATION_BOOKMARK="orion.annotation.bookmark";b.ANNOTATION_FOLDING="orion.annotation.folding";b.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";b.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";b.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";b.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";b.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";b.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";b.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";
var c={};b.registerType=function(a,b){var d=b;if(typeof d!=="function")d=function(a,c,b){this.start=a;this.end=c;if(b)this.title=b},d.prototype=b;d.prototype.type=a;c[a]=d;return a};b.createAnnotation=function(a,c,b,d){return new (this.getType(a))(c,b,d)};b.getType=function(a){return c[a]};f(b.ANNOTATION_ERROR);f(b.ANNOTATION_WARNING);f(b.ANNOTATION_TASK);f(b.ANNOTATION_BREAKPOINT);f(b.ANNOTATION_BOOKMARK);f(b.ANNOTATION_CURRENT_BRACKET);f(b.ANNOTATION_MATCHING_BRACKET);f(b.ANNOTATION_CURRENT_SEARCH);
f(b.ANNOTATION_MATCHING_SEARCH);f(b.ANNOTATION_READ_OCCURRENCE);f(b.ANNOTATION_WRITE_OCCURRENCE);f(b.ANNOTATION_CURRENT_LINE,!0);b.registerType(b.ANNOTATION_FOLDING,i);g.addMixin=function(a){var c=g.prototype,b;for(b in c)c.hasOwnProperty(b)&&(a[b]=c[b])};g.prototype={addAnnotationType:function(a){if(!this._annotationTypes)this._annotationTypes=[];this._annotationTypes.push(a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var c=0;c<this._annotationTypes.length;c++)if(this._annotationTypes[c]===
a)return c+1;return 0},getAnnotationsByType:function(a,c,b){a=a.getAnnotations(c,b);for(b=[];a.hasNext();)c=a.next(),this.getAnnotationTypePriority(c.type)!==0&&b.push(c);var d=this;b.sort(function(a,c){return d.getAnnotationTypePriority(a.type)-d.getAnnotationTypePriority(c.type)});return b},isAnnotationTypeVisible:function(a){return this.getAnnotationTypePriority(a)!==0},removeAnnotationType:function(a){if(this._annotationTypes)for(var c=0;c<this._annotationTypes.length;c++)if(this._annotationTypes[c]===
a){this._annotationTypes.splice(c,1);break}}};e.prototype={addAnnotation:function(a){if(a){var c=this._annotations,b=this._binarySearch(c,a.start);c.splice(b,0,a);this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,c){var b=this._annotations,d,e=0,f=function(){for(;e<b.length;){var m=b[e++];if(a===m.start||(a>m.start?a<m.end:m.start<c))return m;if(m.start>=c)break}return null};d=f();return{next:function(){var a=d;
a&&(d=f());return a},hasNext:function(){return d!==null}}},modifyAnnotation:function(a){if(a&&!(this._getAnnotationIndex(a)<0))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var c=this._annotations,b,d;if(a){b=[];for(d=c.length-1;d>=0;d--){var e=c[d];e.type===a&&c.splice(d,1);b.splice(0,0,e)}}else b=c;this.onChanged({type:"Changed",removed:b,added:[],changed:[]})},removeAnnotation:function(a){if(a&&
(a=this._getAnnotationIndex(a),!(a<0)))this.onChanged({type:"Changed",removed:this._annotations.splice(a,1),added:[],changed:[]})},replaceAnnotations:function(a,c){var b=this._annotations,d,e,f,m=[];if(a)for(d=a.length-1;d>=0;d--)f=a[d],e=this._getAnnotationIndex(f),e<0||(b.splice(e,1),m.splice(0,0,f));c||(c=[]);for(d=0;d<c.length;d++)f=c[d],e=this._binarySearch(b,f.start),b.splice(e,0,f);this.onChanged({type:"Changed",removed:m,added:c,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",
this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_binarySearch:function(a,c){for(var b=a.length,d=-1,e;b-d>1;)e=Math.floor((b+d)/2),c<=a[e].start?b=e:d=e;return b},_getAnnotationIndex:function(a){for(var c=this._annotations,b=this._binarySearch(c,a.start);b<c.length&&c[b].start===a.start;){if(c[b]===a)return b;b++}return-1},_onChanged:function(a){var c=a.start,b=a.removedCharCount,d=this._annotations,e=c+b;if(0<d.length){for(var f={type:"Changed",
added:[],removed:[],changed:[],textModelChangedEvent:a},a=a.addedCharCount-b,b=0;b<d.length;b++){var m=d[b];m.start>=e?(m.start+=a,m.end+=a,f.changed.push(m)):m.end<=c||(m.start<c&&e<m.end?(m.end+=a,f.changed.push(m)):(d.splice(b,1),f.removed.push(m),b--))}if(f.added.length>0||f.removed.length>0||f.changed.length>0)this.onChanged(f)}}};k.EventTarget.addMixin(e.prototype);d.prototype={destroy:function(){var a=this._view;if(a)a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",
this._listener.onLineStyle),this.view=null;(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,c){if(c){a||(a={});a.styleClass&&c.styleClass&&a.styleClass!==c.styleClass?a.styleClass+=" "+c.styleClass:a.styleClass=c.styleClass;var b;if(c.style){if(!a.style)a.style={};for(b in c.style)a.style[b]||(a.style[b]=c.style[b])}if(c.attributes){if(!a.attributes)a.attributes={};for(b in c.attributes)a.attributes[b]||(a.attributes[b]=c.attributes[b])}}return a},
_mergeStyleRanges:function(a,c){a||(a=[]);var b,d;for(d=0;d<a.length&&c;d++){var e=a[d];if(c.end<=e.start)break;if(!(c.start>=e.end)){b=this._mergeStyle({},e.style);b=this._mergeStyle(b,c.style);var f=[];f.push(d,1);c.start<e.start&&f.push({start:c.start,end:e.start,style:c.style});c.start>e.start&&f.push({start:e.start,end:c.start,style:e.style});f.push({start:Math.max(e.start,c.start),end:Math.min(e.end,c.end),style:b});c.end<e.end&&f.push({start:c.end,end:e.end,style:e.style});c=c.end>e.end?{start:e.end,
end:c.end,style:c.style}:null;Array.prototype.splice.apply(a,f)}}c&&(b=this._mergeStyle({},c.style),a.splice(d,0,{start:c.start,end:c.end,style:b}));return a},_onAnnotationModelChanged:function(a){function c(a){for(var m=0;m<a.length;m++)if(d.isAnnotationTypeVisible(a[m].type)){var h=a[m].start,o=a[m].end;e.getBaseModel&&(h=e.mapOffset(h,!0),o=e.mapOffset(o,!0));h!==-1&&o!==-1&&b.redrawRange(h,o)}}if(!a.textModelChangedEvent){var b=this._view;if(b){var d=this,e=b.getModel();c(a.added);c(a.removed);
c(a.changed)}}},_onDestroy:function(){this.destroy()},_onLineStyle:function(a){var c=this._annotationModel,b=a.textView.getModel(),d=c.getTextModel(),e=a.lineStart,f=a.lineStart+a.lineText.length;d!==b&&(e=b.mapOffset(e),f=b.mapOffset(f));for(c=c.getAnnotations(e,f);c.hasNext();)if(e=c.next(),this.isAnnotationTypeVisible(e.type)){if(e.rangeStyle){var f=e.start,m=e.end;d!==b&&(f=b.mapOffset(f,!0),m=b.mapOffset(m,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:f,end:m,style:e.rangeStyle})}if(e.lineStyle)a.style=
this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,e.lineStyle)}}};g.addMixin(d.prototype);return{FoldingAnnotation:i,AnnotationType:b,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 b=this;this._listener={onDragStart:function(f){b._onDragStart(f)},onDragEnd:function(f){b._onDragEnd(f)},onDragEnter:function(f){b._onDragEnter(f)},onDragOver:function(f){b._onDragOver(f)},onDrop:function(f){b._onDrop(f)},onDestroy:function(f){b._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,b=i.getSelection(),i=i.getModel();if(i.getBaseModel)b.start=i.mapOffset(b.start),b.end=i.mapOffset(b.end),i=i.getBaseModel();if(i=i.getText(b.start,b.end))this._dragSelection=b,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 b=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(b,f,f);i.setSelection(f,f+b.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 b=!this._view.getOptions("readonly");b&&(b=i.contains?i.contains("text/plain"):i.indexOf("text/plain")!==-1);if(!b)j.event.dataTransfer.dropEffect="none"}},_onDrop:function(j){var i=this._view,b=j.event.dataTransfer.getData("Text");if(b)j=i.getOffsetAtLocation(j.x,j.y),this._dragSelection?(this._dropOffset=j,this._dropText=b):
(i.setText(b,j,j),i.setSelection(j,j+b.length))}};return{TextDND:j}});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/editor/util"],function(j,k){function i(b,f){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(b);this.setLineDelimiter(f)}i.prototype={find:function(b){if(this._text.length>1)this._text=[this._text.join("")];var f=b.string,g=f;!b.regex&&f&&(g=f.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"));var e=null,d;if(g){var f=b.reverse,c=b.wrap,a=b.wholeWord,h=b.caseInsensitive,l=b.start||0,n=b.end,b=b.end!==void 0,i=
"";i.indexOf("g")===-1&&(i+="g");h&&i.indexOf("i")===-1&&(i+="i");a&&(g="\\b"+g+"\\b");var j=this._text[0],m,t,o=0;b&&(j=j.substring(l,n),o=l);var w=RegExp(g,i);if(f)d=function(){var a=null;for(w.lastIndex=0;;){t=w.lastIndex;m=w.exec(j);if(t===w.lastIndex)return null;if(m){if(!(m.index<l)){if(!c||a)break;l=j.length}a={start:m.index+o,end:w.lastIndex+o}}else break}if(a)l=a.start;return a};else{if(!b)w.lastIndex=l;d=function(){for(;;){t=w.lastIndex;m=w.exec(j);if(t===w.lastIndex)break;if(m)return{start:m.index+
o,end:w.lastIndex+o};if(!(t!==0&&c))break}return null}}e=d()}return{next:function(){var a=e;a&&(e=d());return a},hasNext:function(){return e!==null}}},getCharCount:function(){for(var b=0,f=0;f<this._text.length;f++)b+=this._text[f].length;return b},getLine:function(b,f){var g=this.getLineCount();if(!(0<=b&&b<g))return null;var e=this._lineOffsets[b];if(b+1<g){g=this.getText(e,this._lineOffsets[b+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(b){var f=this.getCharCount();if(!(0<=b&&b<=f))return-1;var g=this.getLineCount();if(b===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<=b&&b<d))return c;for(var a=g,h=-1;a-h>1;)if(c=Math.floor((a+h)/2),e=this._lineOffsets[c],d=c+1<g?this._lineOffsets[c+1]:f,b<=e)a=c;else if(b<d){a=c;break}else h=c;return this._lastLineIndex=a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},
getLineEnd:function(b,f){var g=this.getLineCount();if(!(0<=b&&b<g))return-1;if(b+1<g){g=this._lineOffsets[b+1];if(f)return g;for(var e=this.getText(Math.max(this._lineOffsets[b],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(b){return!(0<=b&&b<this.getLineCount())?-1:this._lineOffsets[b]},getText:function(b,f){b===void 0&&(b=0);f===void 0&&(f=this.getCharCount());if(b===f)return"";for(var g=0,e=0,d;e<this._text.length;){d=
this._text[e].length;if(b<=g+d)break;g+=d;e++}for(var c=g,a=e;e<this._text.length;){d=this._text[e].length;if(f<=g+d)break;g+=d;e++}if(a===e)return this._text[a].substring(b-c,f-g);c=this._text[a].substring(b-c);g=this._text[e].substring(0,f-g);return c+this._text.slice(a+1,e).join("")+g},onChanging:function(b){return this.dispatchEvent(b)},onChanged:function(b){return this.dispatchEvent(b)},setLineDelimiter:function(b,f){b==="auto"&&(b=void 0,this.getLineCount()>1&&(b=this.getText(this.getLineEnd(0),
this.getLineEnd(0,!0))));this._lineDelimiter=b?b:k.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(b,f,g){b===void 0&&(b="");f===void 0&&(f=0);g===void 0&&(g=this.getCharCount());if(!(f===g&&b==="")){for(var e=this.getLineAtOffset(f),d=this.getLineAtOffset(g),c=f,a=g-f,h=d-e,l=b.length,n=0,i=this.getLineCount(),j=0,m=0,t=0,o=[];;){j!==-1&&j<=t&&(j=b.indexOf("\r",t));m!==-1&&
m<=t&&(m=b.indexOf("\n",t));if(m===-1&&j===-1)break;t=j!==-1&&m!==-1?j+1===m?m+1:(j<m?j:m)+1:j!==-1?j+1:m+1;o.push(f+t);n++}this.onChanging({type:"Changing",text:b,start:c,removedCharCount:a,addedCharCount:l,removedLineCount:h,addedLineCount:n});o.length===0&&(j=this.getLineStart(e),d=d+1<i?this.getLineStart(d+1):this.getCharCount(),f!==j&&(b=this.getText(j,f)+b,f=j),g!==d&&(b+=this.getText(g,d),g=d));d=l-a;for(j=e+h+1;j<i;j++)this._lineOffsets[j]+=d;e=[e+1,h].concat(o);Array.prototype.splice.apply(this._lineOffsets,
e);for(d=o=0;d<this._text.length;){j=this._text[d].length;if(f<=o+j)break;o+=j;d++}i=o;for(e=d;d<this._text.length;){j=this._text[d].length;if(g<=o+j)break;o+=j;d++}j=this._text[d];f=this._text[e].substring(0,f-i);g=j.substring(g-o);e=[e,d-e+1];f&&e.push(f);b&&e.push(b);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:a,addedCharCount:l,removedLineCount:h,addedLineCount:n})}}};j.EventTarget.addMixin(i.prototype);
return{TextModel:i}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(j,k){function i(b){this._model=b;this._projections=[]}i.prototype={addProjection:function(b){if(b){var f=this._model,g=this._projections;b._lineIndex=f.getLineAtOffset(b.start);b._lineCount=f.getLineAtOffset(b.end)-b._lineIndex;var e=b.text;e||(e="");b._model=typeof e==="string"?new j.TextModel(e,f.getLineDelimiter()):e;var f=this.mapOffset(b.start,!0),e=b.end-b.start,d=b._lineCount,c=b._model.getCharCount(),
a=b._model.getLineCount()-1;this.onChanging({type:"Changing",text:b._model.getText(),start:f,removedCharCount:e,addedCharCount:c,removedLineCount:d,addedLineCount:a});var h=this._binarySearch(g,b.start);g.splice(h,0,b);this.onChanged({type:"Changed",start:f,removedCharCount:e,addedCharCount:c,removedLineCount:d,addedLineCount:a})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(b,f){var g=this._projections,e=0,d,c;if(f){for(d=
0;d<g.length;d++){c=g[d];if(c.start>b)break;if(c.end>b)return-1;e+=c._model.getCharCount()-(c.end-c.start)}return b+e}for(d=0;d<g.length;d++){c=g[d];if(c.start>b-e)break;var a=c._model.getCharCount();if(c.start+a>b-e)return-1;e+=a-(c.end-c.start)}return b-e},removeProjection:function(b){var f,g=0;for(f=0;f<this._projections.length;f++){var e=this._projections[f];if(e===b){b=e;break}g+=e._model.getCharCount()-(e.end-e.start)}if(f<this._projections.length){var e=this._model,g=b.start+g,d=b.end-b.start,
c=b._lineCount,a=b._model.getCharCount(),h=b._model.getLineCount()-1;this.onChanging({type:"Changing",text:e.getText(b.start,b.end),start:g,removedCharCount:a,addedCharCount:d,removedLineCount:h,addedLineCount:c});this._projections.splice(f,1);this.onChanged({type:"Changed",start:g,removedCharCount:a,addedCharCount:d,removedLineCount:h,addedLineCount:c})}},_binarySearch:function(b,f){for(var g=b.length,e=-1,d;g-e>1;)d=Math.floor((g+e)/2),f<=b[d].start?g=d:e=d;return g},getCharCount:function(){for(var b=
this._model.getCharCount(),f=this._projections,g=0;g<f.length;g++){var e=f[g];b+=e._model.getCharCount()-(e.end-e.start)}return b},getLine:function(b,f){if(b<0)return null;var g=this._model,e=this._projections,d=0,c=[],a=0,h,l,n;for(h=0;h<e.length;h++){n=e[h];if(n._lineIndex>=b-d)break;l=n._model.getLineCount()-1;if(n._lineIndex+l>=b-d)if(a=b-(n._lineIndex+d),a<l)return n._model.getLine(a,f);else c.push(n._model.getLine(l));a=n.end;d+=l-n._lineCount}for(a=Math.max(a,g.getLineStart(b-d));h<e.length;h++){n=
e[h];if(n._lineIndex>b-d)break;c.push(g.getText(a,n.start));l=n._model.getLineCount()-1;if(n._lineIndex+l>b-d)return c.push(n._model.getLine(0,f)),c.join("");c.push(n._model.getText());a=n.end;d+=l-n._lineCount}e=g.getLineEnd(b-d,f);a<e&&c.push(g.getText(a,e));return c.join("")},getLineAtOffset:function(b){for(var f=this._model,g=this._projections,e=0,d=0,c=0;c<g.length;c++){var a=g[c];if(a.start>b-e)break;var h=a._model.getCharCount();if(a.start+h>b-e){g=b-(a.start+e);d+=a._model.getLineAtOffset(g);
e+=g;break}d+=a._model.getLineCount()-1-a._lineCount;e+=h-(a.end-a.start)}return f.getLineAtOffset(b-e)+d},getLineCount:function(){for(var b=this._projections,f=this._model.getLineCount(),g=0;g<b.length;g++){var e=b[g];f+=e._model.getLineCount()-1-e._lineCount}return f},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(b,f){if(b<0)return-1;for(var g=this._model,e=this._projections,d=0,c=0,a=0;a<e.length;a++){var h=e[a];if(h._lineIndex>b-d)break;var l=h._model.getLineCount()-
1;if(h._lineIndex+l>b-d)return h._model.getLineEnd(b-(h._lineIndex+d),f)+h.start+c;c+=h._model.getCharCount()-(h.end-h.start);d+=l-h._lineCount}return g.getLineEnd(b-d,f)+c},getLineStart:function(b){if(b<0)return-1;for(var f=this._model,g=this._projections,e=0,d=0,c=0;c<g.length;c++){var a=g[c];if(a._lineIndex>=b-e)break;var h=a._model.getLineCount()-1;if(a._lineIndex+h>=b-e)return a._model.getLineStart(b-(a._lineIndex+e))+a.start+d;d+=a._model.getCharCount()-(a.end-a.start);e+=h-a._lineCount}return f.getLineStart(b-
e)+d},getText:function(b,f){b===void 0&&(b=0);var g=this._model,e=this._projections,d=0,c=[],a,h,l;for(a=0;a<e.length;a++){h=e[a];if(h.start>b-d)break;l=h._model.getCharCount();if(h.start+l>b-d)if(f!==void 0&&h.start+l>f-d)return h._model.getText(b-(h.start+d),f-(h.start+d));else c.push(h._model.getText(b-(h.start+d))),b=h.end+d+l-(h.end-h.start);d+=l-(h.end-h.start)}var n=b-d;if(f!==void 0){for(;a<e.length;a++){h=e[a];if(h.start>f-d)break;c.push(g.getText(n,h.start));l=h._model.getCharCount();if(h.start+
l>f-d)return c.push(h._model.getText(0,f-(h.start+d))),c.join("");c.push(h._model.getText());n=h.end;d+=l-(h.end-h.start)}c.push(g.getText(n,f-d))}else{for(;a<e.length;a++)h=e[a],c.push(g.getText(n,h.start)),c.push(h._model.getText()),n=h.end;c.push(g.getText(n))}return c.join("")},_onChanging:function(b,f,g,e,d,c){for(var a=this._model,h=this._projections,l,n=0,i,j=f+g;l<h.length;l++){g=h[l];if(g.start>f)break;n+=g._model.getCharCount()-(g.end-g.start)}f+=n;for(var m=l;l<h.length;l++){g=h[l];if(g.start>
j)break;n+=g._model.getCharCount()-(g.end-g.start);i+=g._model.getLineCount()-1-g._lineCount}g=j+n;n=l;this.onChanging(f,g-f,e,d+i,c);h.splice(h,n-m);for(b=b.length-(g-f);l<h.length;l++)g=h[l],g.start+=b,g.end+=b,g._lineIndex=a.getLineAtOffset(g.start)},onChanging:function(b){return this.dispatchEvent(b)},onChanged:function(b){return this.dispatchEvent(b)},setLineDelimiter:function(b){this._model.setLineDelimiter(b)},setText:function(b,f,g){b===void 0&&(b="");f===void 0&&(f=0);var e=f,d=g,c=this._model,
a=this._projections,h=0,l=0,n,i,j,m,t,o=0;for(n=0;n<a.length;n++){i=a[n];if(i.start>f-h)break;j=i._model.getCharCount();if(i.start+j>f-h)if(g!==void 0&&i.start+j>g-h){i._model.setText(b,f-(i.start+h),g-(i.start+h));return}else o=i._model.getLineCount()-1-i._model.getLineAtOffset(f-(i.start+h)),m={projection:i,start:f-(i.start+h)},f=i.end+h+j-(i.end-i.start);l+=i._model.getLineCount()-1-i._lineCount;h+=j-(i.end-i.start)}f-=h;var w=n,o=c.getLineAtOffset(f)+l-o;if(g!==void 0)for(;n<a.length;n++){i=a[n];
if(i.start>g-h)break;j=i._model.getCharCount();if(i.start+j>g-h){l+=i._model.getLineAtOffset(g-(i.start+h));j=g-(i.start+h);g=i.end+h;t={projection:i,end:j};break}l+=i._model.getLineCount()-1-i._lineCount;h+=j-(i.end-i.start)}else{for(;n<a.length;n++)i=a[n],l+=i._model.getLineCount()-1-i._lineCount,h+=i._model.getCharCount()-(i.end-i.start);g=d=c.getCharCount()+h}g-=h;i=c.getLineAtOffset(g)+l;d-=e;for(var l=i-o,o=b.length,s=j=i=h=0;;){i!==-1&&i<=s&&(i=b.indexOf("\r",s));j!==-1&&j<=s&&(j=b.indexOf("\n",
s));if(j===-1&&i===-1)break;s=i!==-1&&j!==-1?i+1===j?j+1:(i<j?i:j)+1:i!==-1?i+1:j+1;h++}this.onChanging({type:"Changing",text:b,start:e,removedCharCount:d,addedCharCount:o,removedLineCount:l,addedLineCount:h});c.setText(b,f,g);if(m)i=m.projection,i._model.setText("",m.start);if(t)i=t.projection,i._model.setText("",0,t.end),i.start=i.end,i._lineCount=0;a.splice(w,n-w);for(b=b.length-(g-f);n<a.length;n++)i=a[n],i.start+=b,i.end+=b,i._lineIndex=c.getLineAtOffset(i.start);this.onChanged({type:"Changed",
start:e,removedCharCount:d,addedCharCount:o,removedLineCount:l,addedLineCount:h})}};k.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,k,i,b){function f(a,c,b,d){typeof a.addEventListener==="function"?a.addEventListener(c,b,d===!0):a.attachEvent("on"+c,b)}function g(a,c,d){if(d){c.className="";for(var d=c.attributes,h=d.length;h-- >0;)(!b.isIE||b.isIE>=9||b.isIE<9&&d[h].specified)&&c.removeAttribute(d[h].name)}if(a){if(a.styleClass)c.className=a.styleClass;if(d=a.style)for(var e in d)d.hasOwnProperty(e)&&
(c.style[e]=d[e]);if(a=a.attributes)for(var f in a)a.hasOwnProperty(f)&&c.setAttribute(f,a[f])}}function e(a){return a instanceof Array?a.slice(0):a}function d(a,c){if(a===c)return!0;if(a&&!c||!a&&c)return!1;if(a&&a.constructor===String||c&&c.constructor===String)return!1;if(a instanceof Array||c instanceof Array){if(!(a instanceof Array&&c instanceof Array))return!1;if(a.length!==c.length)return!1;for(var b=0;b<a.length;b++)if(!d(a[b],c[b]))return!1;return!0}if(!(a instanceof Object)||!(c instanceof
Object))return!1;for(b in a)if(a.hasOwnProperty(b)){if(!c.hasOwnProperty(b))return!1;if(!d(a[b],c[b]))return!1}for(b in c)if(!a.hasOwnProperty(b))return!1;return!0}function c(a,c,b){for(var d=0,h=0,e=0,f=a.length;e<f;){d!==-1&&d<=e&&(d=a.indexOf("\r",e));h!==-1&&h<=e&&(h=a.indexOf("\n",e));var g=e,l;if(h===-1&&d===-1){c(a.substring(e));break}d!==-1&&h!==-1?d+1===h?(l=d,e=h+1):(l=d<h?d:h,e=(d<h?d:h)+1):d!==-1?(l=d,e=d+1):(l=h,e=h+1);c(a.substring(g,l));b()}}function a(a){var c,b,d,h,e=a.ownerDocument.defaultView||
a.ownerDocument.parentWindow;if(e.getComputedStyle)a=e.getComputedStyle(a,null),c=a.getPropertyValue("padding-left"),b=a.getPropertyValue("padding-top"),d=a.getPropertyValue("padding-right"),h=a.getPropertyValue("padding-bottom");else if(a.currentStyle)c=a.currentStyle.paddingLeft,b=a.currentStyle.paddingTop,d=a.currentStyle.paddingRight,h=a.currentStyle.paddingBottom;return{left:parseInt(c,10)||0,top:parseInt(b,10)||0,right:parseInt(d,10)||0,bottom:parseInt(h,10)||0}}function h(c){var b,d,h,e,f=
c._trim;if(!f){var f=a(c),g=c.ownerDocument.defaultView||c.ownerDocument.parentWindow;if(g.getComputedStyle)e=g.getComputedStyle(c,null),b=e.getPropertyValue("border-left-width"),d=e.getPropertyValue("border-top-width"),h=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width");else if(c.currentStyle)b=c.currentStyle.borderLeftWidth,d=c.currentStyle.borderTopWidth,h=c.currentStyle.borderRightWidth,e=c.currentStyle.borderBottomWidth;b=parseInt(b,10)||0;d=parseInt(d,10)||
0;h=parseInt(h,10)||0;e=parseInt(e,10)||0;f.left+=b;f.top+=d;f.right+=h;f.bottom+=e;c._trim=f}return f}function l(a,c,b){this.start=a;this.end=c;this.caret=b}function n(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function q(a,c,b){this.view=a;this.lineIndex=c;this._lineDiv=b}function p(a){this._init(a)}l.prototype={clone:function(){return new l(this.start,this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(a){this.caret?
this.start=a:this.end=a;if(this.start>this.end)a=this.start,this.start=this.end,this.end=a,this.caret=!this.caret},setCaret:function(a){this.end=this.start=a;this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},toString:function(){return"start="+this.start+" end="+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===this.end},equals:function(a){return this.caret===a.caret&&this.start===a.start&&this.end===a.end}};n.prototype={toString:function(){return"{l="+
this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};q.prototype={create:function(a,c){if(!this._lineDiv){var b=this._lineDiv=this._createLine(a,c,this.lineIndex);b._line=this;return b}},_createLine:function(a,c,h){var e=this.view,f=e._model,l=f.getLine(h),u=f.getLineStart(h),A={type:"LineStyle",textView:e,lineIndex:h,lineText:l,lineStart:u};if(l.length<2E3)e.onLineStyle(A);f=c||b.createElement(a.ownerDocument,"div");if(!c||!d(c.viewStyle,A.style)){g(A.style,f,c);if(c)c._trim=null;
f.viewStyle=A.style;f.setAttribute("role","presentation")}f.lineIndex=h;h=[];this._createRanges(A.ranges,l,0,l.length,u,{tabOffset:0,ranges:h});l=" ";!e._fullSelection&&b.isIE<9&&(l="\ufeff");b.isWebkit&&(l="\u200c");h.push({text:l,style:e._metrics.largestFontStyle,ignoreChars:1});var i,r,n,j,q,l=e=0,v,k;if(c){if(r=c.modelChangedEvent)r.removedLineCount===0&&r.addedLineCount===0?(k=r.start-u,v=r.addedCharCount-r.removedCharCount):k=-1,c.modelChangedEvent=void 0;r=c.firstChild}for(u=0;u<h.length;u++){i=
h[u];j=i.text;e+=j.length;A=i.style;if(r)if(q=r.firstChild.data,n=r.viewStyle,q===j&&d(A,n)){l+=q.length;r._rectsCache=void 0;i=r=r.nextSibling;continue}else for(;r;){if(k!==-1){n=e;n>=k&&(n-=v);q=(q=r.firstChild.data)?q.length:0;if(l+q>n)break;l+=q}n=r.nextSibling;f.removeChild(r);r=n}i=this._createSpan(f,j,A,i.ignoreChars);r?f.insertBefore(i,r):f.appendChild(i);if(c)c.lineWidth=void 0}if(c)for(a=i?i.nextSibling:null;a;)n=a.nextSibling,c.removeChild(a),a=n;else a.appendChild(f);return f},_createRanges:function(a,
c,b,h,e,f){if(!(b>=h)){if(a)for(var g=0;g<a.length;g++){var l=a[g];if(!(l.end<=e+b)){var i=Math.max(e+b,l.start)-e;if(i>=h)break;var r=Math.min(e+h,l.end)-e;if(i<r){i=Math.max(b,i);r=Math.min(h,r);for(b<i&&this._createRange(c,b,i,null,f);g+1<a.length&&a[g+1].start-e===r&&d(l.style,a[g+1].style);)l=a[g+1],r=Math.min(e+h,l.end)-e,g++;this._createRange(c,i,r,l.style,f);b=r}}}b<h&&this._createRange(c,b,h,null,f)}},_createRange:function(a,c,b,d,h){if(!(c>=b)){var e=this.view._customTabSize;if(e&&e!==8)for(var f=
a.indexOf("\t",c);f!==-1&&f<b;){c<f&&(c={text:a.substring(c,f),style:d},h.ranges.push(c),h.tabOffset+=c.text.length);c=e-h.tabOffset%e;if(c>0){for(var g="\u00a0",l=1;l<c;l++)g+=" ";c={text:g,style:d,ignoreChars:c-1};h.ranges.push(c);h.tabOffset+=c.text.length}c=f+1;f=a.indexOf("\t",c)}c<b&&(c={text:a.substring(c,b),style:d},h.ranges.push(c),h.tabOffset+=c.text.length)}},_createSpan:function(a,c,d,h){var e=d&&d.tagName==="A";if(e)a.hasLink=!0;var e=e&&this.view._linksVisible?"a":"span",l=a.ownerDocument,
a=b.createElement(a.ownerDocument,e);a.appendChild(l.createTextNode(c));g(d,a);if(e==="A"){var u=this.view,A=this._getWindow();f(a,"click",function(a){return u._handleLinkClick(a?a:A.event)},!1)}a.viewStyle=d;if(h)a.ignoreChars=h;return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,c){var d=this._ensureCreated(),h=this.view;if(a===void 0)return this._getLineBoundingClientRect(d,!0);var e=h._model,
f=d.ownerDocument,g=this.lineIndex,l=null;if(a<e.getLineEnd(g)){e=e.getLineStart(g);for(g=d.firstChild;g;){var i=g.firstChild,r=i.length;g.ignoreChars&&(r-=g.ignoreChars);if(e+r>a){l=a-e;if(h._isRangeRects)f=f.createRange(),f.setStart(i,l),f.setEnd(i,l+1),l=new n(f.getBoundingClientRect());else if(b.isIE)f=f.body.createTextRange(),f.moveToElementText(g),f.collapse(),f.moveEnd("character",l+1),f.moveStart("character",l),l=new n(f.getBoundingClientRect());else{var j=i.data;g.removeChild(i);g.appendChild(f.createTextNode(j.substring(0,
l)));var q=b.createElement(f,"span");q.appendChild(f.createTextNode(j.substring(l,l+1)));g.appendChild(q);g.appendChild(f.createTextNode(j.substring(l+1)));l=new n(q.getBoundingClientRect());g.innerHTML="";g.appendChild(i);this._createdDiv||(f=h._getSelection(),(e<=f.start&&f.start<e+r||e<=f.end&&f.end<e+r)&&h._updateDOMSelection())}b.isIE&&(f=d.ownerDocument.defaultView||d.ownerDocument.parentWindow,d=f.screen.logicalXDPI/f.screen.deviceXDPI,f=f.screen.logicalYDPI/f.screen.deviceYDPI,l.left*=d,l.right*=
d,l.top*=f,l.bottom*=f);break}e+=r;g=g.nextSibling}}d=this.getBoundingClientRect();if(!l)h._wrapMode?(h=this.getClientRects(),l=h[h.length-1],l.left=l.right,l.left+=d.left,l.top+=d.top,l.right+=d.left,l.bottom+=d.top):(l=new n(d),l.left=l.right);if(c||c===void 0)l.left-=d.left,l.top-=d.top,l.right-=d.left,l.bottom-=d.top;return l},_getClientRects:function(a,c){var b,d,h,e;if(!a._rectsCache){b=a.getClientRects();d=Array(b.length);for(e=0;e<b.length;e++)h=d[e]=new n(b[e]),h.left-=c.left,h.top-=c.top,
h.right-=c.left,h.bottom-=c.top;a._rectsCache=d}b=a._rectsCache;d=[b.length];for(e=0;e<b.length;e++)d[e]=new n(b[e]);return d},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var c=this._ensureCreated(),b=[],d=c.firstChild,h,e=c.getBoundingClientRect();d;){for(var f=this._getClientRects(d,e),c=0;c<f.length;c++){var g=f[c],l;if(g.top!==g.bottom){var r=g.top+(g.bottom-g.top)/2;for(l=0;l<b.length;l++)if(h=b[l],h.top<=r&&r<h.bottom)break;if(l===b.length)b.push(g);
else{if(g.left<h.left)h.left=g.left;if(g.top<h.top)h.top=g.top;if(g.right>h.right)h.right=g.right;if(g.bottom>h.bottom)h.bottom=g.bottom}}}d=d.nextSibling}return a!==void 0?b[a]:b},_getLineBoundingClientRect:function(a,c){var b=new n(a.getBoundingClientRect());if(!this.view._wrapMode){b.right=b.left;for(var d=a.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(d)d=d.getBoundingClientRect(),b.right=d.right+h(a).right}c&&(d=h(a),b.left+=d.left,b.right-=d.right);return b},getLineCount:function(){return!this.view._wrapMode?
1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;for(var c=this.getClientRects(),a=this.getBoundingClientRect(a),a=a.top+(a.bottom-a.top)/2,b=0;b<c.length;b++)if(c[b].top<=a&&a<c[b].bottom)return b;return c.length-1},getLineStart:function(a){if(!this.view._wrapMode||a===0)return this.view._model.getLineStart(a);var c=this.getClientRects();return this.getOffset(c[a].left+1,c[a].top+1)},getOffset:function(a,c){var d=this.view,h=d._model,e=this.lineIndex,f=h.getLineStart(e),
h=h.getLineEnd(e);if(f===h)return f;var g=this._ensureCreated(),e=this.getBoundingClientRect(),l,i;if(d._wrapMode){l=this.getClientRects();if(c<l[0].top)c=l[0].top;for(var r=0;r<l.length;r++)if(i=l[r],i.top<=c&&c<i.bottom)break;if(a<i.left)a=i.left;a>i.right&&(a=i.right-1)}else a<0&&(a=0),a>e.right-e.left&&(a=e.right-e.left);var n=g.ownerDocument,r=n.defaultView||n.parentWindow,j=b.isIE?r.screen.logicalXDPI/r.screen.deviceXDPI:1,q=b.isIE?r.screen.logicalYDPI/r.screen.deviceYDPI:1,r=f,v=g.firstChild;
a:for(;v;){var k=v.firstChild,g=k.length;v.ignoreChars&&(g-=v.ignoreChars);var p,G,H;l=this._getClientRects(v,e);for(var B=0;B<l.length;B++)if(i=l[B],i.left<=a&&a<i.right&&(!d._wrapMode||i.top<=c&&c<i.bottom)){if(b.isIE||d._isRangeRects){for(var n=d._isRangeRects?n.createRange():n.body.createTextRange(),B=g,I=-1;B-I>1;){var L=Math.floor((B+I)/2);i=I+1;l=L===g-1&&v.ignoreChars?k.length:L+1;d._isRangeRects?(n.setStart(k,i),n.setEnd(k,l)):(n.moveToElementText(v),n.move("character",i),n.moveEnd("character",
l-i));l=n.getClientRects();for(var P=!1,M=0;M<l.length;M++)if(i=l[M],p=i.left*j-e.left,H=i.right*j-e.left,G=i.top*q-e.top,i=i.bottom*q-e.top,p<=a&&a<H&&(!d._wrapMode||G<=c&&c<i)){P=!0;break}P?B=L:I=L}r+=B;i=B;l=B===g-1&&v.ignoreChars?k.length:Math.min(B+1,k.length);d._isRangeRects?(n.setStart(k,i),n.setEnd(k,l)):(n.moveToElementText(v),n.move("character",i),n.moveEnd("character",l-i));i=n.getClientRects()[0];p=i.left*j-e.left;H=i.right*j-e.left;a>p+(H-p)/2&&r++}else{i=[];for(j=0;j<g;j++)i.push("<span>"),
j===g-1?i.push(k.data.substring(j)):i.push(k.data.substring(j,j+1)),i.push("</span>");v.innerHTML=i.join("");for(j=v.firstChild;j;){i=j.getBoundingClientRect();p=i.left-e.left;H=i.right-e.left;if(p<=a&&a<H){a>p+(H-p)/2&&r++;break}r++;j=j.nextSibling}if(!this._createdDiv)v.innerHTML="",v.appendChild(k),e=d._getSelection(),(r<=e.start&&e.start<r+g||r<=e.end&&e.end<r+g)&&d._updateDOMSelection()}break a}r+=g;v=v.nextSibling}return Math.min(h,Math.max(f,r))},getNextOffset:function(a,c,d){return c==="line"?
(c=this.view._model,a=c.getLineAtOffset(a),d>0?c.getLineEnd(a):c.getLineStart(a)):c==="wordend"?this._getNextOffset_W3C(a,c,d):b.isIE?this._getNextOffset_IE(a,c,d):this._getNextOffset_W3C(a,c,d)},_getNextOffset_W3C:function(a,c,b){function d(a){return 33<=a&&a<=47||58<=a&&a<=64||91<=a&&a<=94||a===96||123<=a&&a<=126}if(c==="word"||c==="wordend"){var h=this.view._model,e=h.getLineAtOffset(a),f=h.getLine(e),g=h.getLineStart(e),e=h.getLineEnd(e),h=f.length;a-=g;var l,r;if(b>0){if(a===h)return e;l=f.charCodeAt(a);
r=d(l);b=!r&&!(l===32||l===9);for(a++;a<h;){l=f.charCodeAt(a);e=d(l);if(c==="wordend"){if(!e&&r)break}else if(e&&!r)break;l=!e&&!(l===32||l===9);if(c==="wordend"){if(!l&&b)break}else if(l&&!b)break;b=l;r=e;a++}}else{if(a===0)return g;a--;l=f.charCodeAt(a);r=d(l);for(b=!r&&!(l===32||l===9);0<a;){l=f.charCodeAt(a-1);e=d(l);if(c==="wordend"){if(e&&!r)break}else if(!e&&r)break;l=!e&&!(l===32||l===9);if(c==="wordend"){if(l&&!b)break}else if(!l&&b)break;b=l;r=e;a--}}return g+a}return a+b},_getNextOffset_IE:function(a,
c,b){var d=this._ensureCreated(),h=this.view._model,e=this.lineIndex,f=0,g;g=h.getLineStart(e);var l=d.ownerDocument;if(a===h.getLineEnd(e))f=l.body.createTextRange(),f.moveToElementText(d.lastChild),g=f.text.length,f.moveEnd(c,b),f=a+f.text.length-g;else if(a===g&&b<0)f=g;else for(d=d.firstChild;d;){h=d.firstChild.length;d.ignoreChars&&(h-=d.ignoreChars);if(g+h>a){f=l.body.createTextRange();a===g&&b<0?f.moveToElementText(d.previousSibling):(f.moveToElementText(d),f.collapse(),f.moveEnd("character",
a-g));g=f.text.length;f.moveEnd(c,b);f=a+f.text.length-g;break}g=h+g;d=d.nextSibling}return f},destroy:function(){var a=this._createdDiv;if(a)a.parentNode.removeChild(a),this._createdDiv=null}};p.prototype={addRuler:function(a,c){a.setView(this);var b=this._rulers;if(c!==void 0){var d,h;for(d=0,h=0;d<b.length&&h<c;d++)a.getLocation()===b[d].getLocation()&&h++;b.splice(h,0,a);c=h}else b.push(a);this._createRuler(a,c);this._update()},computeSize:function(){var a=0,c=0,d=this._model,h=this._clientDiv;
if(!h)return{width:a,height:c};var e=h.style.width;if(b.isWebkit)h.style.width="0x7fffffffpx";for(var d=d.getLineCount(),f=0;f<d;f++){var g=this._getLine(f),l=g.getBoundingClientRect(),a=Math.max(a,l.right-l.left);c+=l.bottom-l.top;g.destroy()}if(b.isWebkit)h.style.width=e;h=this._getViewPadding();a+=h.right+h.left;c+=h.bottom+h.top;return{width:a,height:c}},convert:function(a,c,b){if(this._clientDiv){var d=this._getScroll(),h=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect();c==="document"&&
(a.x!==void 0&&(a.x+=-d.x+e.left+h.left),a.y!==void 0&&(a.y+=-d.y+e.top+h.top));b==="document"&&(a.x!==void 0&&(a.x+=d.x-e.left-h.left),a.y!==void 0&&(a.y+=d.y-e.top-h.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._actions=this._keyBindings=this._doubleClickSelection=this._selection=this._model=this._parent=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),
b.isOpera&&this._clientDiv.blur(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var c=[],b=this._actions,d;for(d in b)b.hasOwnProperty(d)&&(a||!b[d].defaultHandler)&&c.push(d);return c},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()},
getCaretOffset:function(){return this._getSelection().getCaret()},getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(a){for(var c=[],b=this._keyBindings,d=0;d<b.length;d++)b[d].actionID===a&&c.push(b[d].keyBinding);return c},getLineHeight:function(a){return!this._clientDiv?
0:this._getLineHeight(a)},getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var c=this._model,a=Math.min(Math.max(0,a),c.getCharCount()),c=c.getLineAtOffset(a),b=this._getLine(c),a=b.getBoundingClientRect(a);b.destroy();b=a.left;c=this._getLinePixel(c)+a.top;return{x:b,y:c}},getOptions:function(){var a;if(arguments.length===0)a=this._defaultOptions();
else if(arguments.length===1){if(a=arguments[0],typeof a==="string")return e(this["_"+a])}else{a={};for(var c in arguments)arguments.hasOwnProperty(c)&&(a[arguments[c]]=void 0)}for(var b in a)a.hasOwnProperty(b)&&(a[b]=e(this["_"+b]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,c){if(!this._clientDiv)return 0;var b=this._getLineIndex(c),d=this._getLine(b),b=d.getOffset(a,c-this._getLinePixel(b));d.destroy();return b},getRulers:function(){return this._rulers.slice(0)},
getSelection:function(){var a=this._getSelection();return{start:a.start,end:a.end}},getText:function(a,c){return this._model.getText(a,c)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,c){if(this._clientDiv){var b=this._actions[a];if(b){if(!c&&b.handler&&b.handler())return;if(b.defaultHandler)return b.defaultHandler()}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},
onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},onDragOver:function(a){return this.dispatchEvent(a)},onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},
onModelChanging:function(a){return this.dispatchEvent(a)},onModify:function(a){return this.dispatchEvent(a)},onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},
onFocus:function(a){return this.dispatchEvent(a)},onBlur:function(a){return this.dispatchEvent(a)},redraw:function(){if(!(this._redrawCount>0)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,c){if(!(this._redrawCount>0))for(var b=this.getRulers(),d=0;d<b.length;d++)this.redrawLines(a,c,b[d])},redrawLines:function(a,c,b){if(!(this._redrawCount>0)&&(a===void 0&&(a=0),c===void 0&&(c=this._model.getLineCount()),a!==c)){var d=this._clientDiv;if(d){if(b)for(var h=
(b.getLocation()==="left"?this._leftDiv:this._rightDiv).firstChild.rows[0].cells,e=0;e<h.length;e++)if(h[e].firstChild._ruler===b){d=h[e].firstChild;break}b?d.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,c);if(!b||b.getOverview()==="page")for(d=d.firstChild;d;){h=d.lineIndex;if(a<=h&&h<c)d.lineChanged=!0;d=d.nextSibling}if(!b&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<c)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._queueUpdate()}}},
redrawRange:function(a,c){if(!(this._redrawCount>0)){var b=this._model;a===void 0&&(a=0);c===void 0&&(c=b.getCharCount());var d=b.getLineAtOffset(a),b=b.getLineAtOffset(Math.max(a,c-1))+1;this.redrawLines(d,b)}},removeRuler:function(a){for(var c=this._rulers,b=0;b<c.length;b++)if(c[b]===a){c.splice(b,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,c,b){if(a){var d=this._actions,h=d[a];h||(h=d[a]={});
h.handler=c;h.actionDescription=b}},setKeyBinding:function(a,c){for(var b=this._keyBindings,d=0;d<b.length;d++){var h=b[d];if(h.keyBinding.equals(a)){c?h.actionID=c:h.predefined?h.actionID=null:b.splice(d,1);return}}c&&b.push({keyBinding:a,actionID:c})},setCaretOffset:function(a,c){var b=this._model.getCharCount(),a=Math.max(0,Math.min(a,b));this._setSelection(new l(a,a,!1),c===void 0||c)},setHorizontalPixel:function(a){this._clientDiv&&(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},
setRedraw:function(a){a?--this._redrawCount===0&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var c=this._model.getLineCount(),b=this._model.getCharCount(),d=a.getLineCount(),h=a.getCharCount(),e={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:b,addedCharCount:h,removedLineCount:c,addedLineCount:d};
this.onModelChanging(e);this._model=a;e={type:"ModelChanged",start:0,removedCharCount:b,addedCharCount:h,removedLineCount:c,addedLineCount:d};this.onModelChanged(e);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(a){var c=this._defaultOptions(),b;for(b in a)if(a.hasOwnProperty(b)){var h=a[b];if(!d(this["_"+b],h)){var f=c[b]?c[b].update:null;f?f.call(this,
h):this["_"+b]=e(h)}}},setSelection:function(a,c,b){var d=a>c;if(d)var h=a,a=c,c=h;h=this._model.getCharCount();a=Math.max(0,Math.min(a,h));c=Math.max(0,Math.min(c,h));this._setSelection(new l(a,c,d),b===void 0||b)},setText:function(a,c,d){var h=c===void 0&&d===void 0;c===void 0&&(c=0);d===void 0&&(d=this._model.getCharCount());this._modifyContent({text:a,start:c,end:d,_code:!0},!h);if(h)this._columnX=-1,this._setSelection(new l(0,0,!1),!0),b.isFirefox&&this._fixCaret()},setTopIndex:function(a){this._clientDiv&&
this._scrollView(0,this._getLinePixel(Math.max(0,a))-this._getScroll().y)},setTopPixel:function(a){this._clientDiv&&this._scrollView(0,Math.max(0,a)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(a,c){this._clientDiv&&(a&&this._updateStyle(),c===void 0||c?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){if(b.isFirefox&&a.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var c=
this._overlayDiv||this._clientDiv;if(b.isIE<9)c=this._viewDiv;for(var d=a.target?a.target:a.srcElement;d;){if(c===d)return;d=d.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var h=this;this._getWindow().setTimeout(function(){h._clientDiv.focus()},0)}},_handleRootMouseUp:function(a){if(b.isFirefox&&a.which===1)this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1},_handleBlur:function(){if(!this._ignoreBlur){this._hasFocus=
!1;if(b.isIE<9&&!this._getSelection().isEmpty()){var a=this._rootDiv,c=b.createElement(a.ownerDocument,"div");a.appendChild(c);a.removeChild(c)}if(this._selDiv1)if(this._selDiv1.style.background="lightgray",this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",a=this._getWindow(),c=this._selDiv1.ownerDocument,a.getSelection){c=a.getSelection();for(a=c.anchorNode;a;){if(a===this._clientDiv){c.rangeCount>0&&c.removeAllRanges();break}a=a.parentNode}}else if(c.selection){this._ignoreSelect=
!1;for(a=c.selection.createRange().parentElement();a;){if(a===this._clientDiv){c.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(a){b.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var c=!1;if(this.isListening("ContextMenu"))c=this._createMouseEvent("ContextMenu",a),c.screenX=a.screenX,c.screenY=a.screenY,this.onContextMenu(c),c=c.defaultPrevented;if(c)return a.preventDefault&&a.preventDefault(),
!1},_handleCopy:function(a){if(!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){if(this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(){this._startIME()},_handleDblclick:function(a){this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime();if(this._clickCount!==2)this._clickCount=2,this._handleMouse(a)},_handleDragStart:function(a){if(b.isFirefox){var c=this;this._getWindow().setTimeout(function(){c._clientDiv.contentEditable=
!0;c._clientDiv.draggable=!1;c._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&this._dragOffset!==-1)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&a.preventDefault(),!1},_handleDrag:function(a){if(this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",a))},_handleDragEnd:function(a){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",
a));b.isFirefox&&(this._fixCaret(),a.dataTransfer.dropEffect==="none"&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())},_handleDragEnter:function(a){var c=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(c=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(b.isWebkit||c)return a.preventDefault&&a.preventDefault(),!1},_handleDragOver:function(a){var c=!0;this.isListening("DragOver")&&(c=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(b.isWebkit||c){if(c)a.dataTransfer.dropEffect=
"none";a.preventDefault&&a.preventDefault();return!1}},_handleDragLeave:function(a){this._dropTarget=!1;if(this.isListening("DragLeave"))this.onDragLeave(this._createMouseEvent("DragLeave",a))},_handleDrop:function(a){this._dropTarget=!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1},_handleFocus:function(){this._hasFocus=!0;b.isIOS&&this._lastTouchOffset!==void 0?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=
void 0):this._updateDOMSelection();if(this._selDiv1){var a=this._highlightRGB;this._selDiv1.style.background=a;this._selDiv2.style.background=a;this._selDiv3.style.background=a}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(a){var c=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:c=!0;break;default:this._setLinksVisible(!1)}if(a.keyCode===229){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;c=!0;b.isSafari&&b.isMac&&a.ctrlKey&&(c=!1);c&&this._startIME()}else c||
this._commitIME();if((b.isMac||b.isLinux)&&b.isFirefox<4||b.isOpera)return this._keyDownEvent=a,!0;if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1},_handleKeyPress:function(a){if(b.isMac&&b.isWebkit&&(63232<=a.keyCode&&a.keyCode<=63487||a.keyCode===13||a.keyCode===8))return a.preventDefault&&a.preventDefault(),!1;if(((b.isMac||b.isLinux)&&b.isFirefox<4||b.isOpera)&&this._doAction(this._keyDownEvent))return a.preventDefault&&
a.preventDefault(),!1;var c=b.isMac?a.metaKey:a.ctrlKey;if(a.charCode!==void 0&&c)switch(a.charCode){case 99:case 118:case 120:return!0}c=!1;if(b.isMac){if(a.ctrlKey||a.metaKey)c=!0}else if(b.isFirefox){if(a.ctrlKey||a.altKey)c=!0}else a.ctrlKey^a.altKey&&(c=!0);if(!c&&(c=b.isOpera?a.which:a.charCode!==void 0?a.charCode:a.keyCode,c>31))return this._doContent(String.fromCharCode(c)),a.preventDefault&&a.preventDefault(),!1},_handleKeyUp:function(a){(b.isMac?a.metaKey:a.ctrlKey)||this._setLinksVisible(!1);
a.keyCode===13&&this._commitIME()},_handleLinkClick:function(a){if(!(b.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var c=this._getWindow(),d=!0,h=c;if(b.isIE||b.isFirefox&&!this._overlayDiv)h=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?(d=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,!b.isOpera&&this._hasFocus&&this.isListening("DragStart")))&&
this._setGrab(h):(this._isW3CEvents&&this._setGrab(h),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return d},_handleMouseDown:function(a){if(this._linksVisible)if((a.target||a.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();var c=a.which;c||(a.button===4&&(c=2),a.button===2&&(c=3),a.button===1&&(c=1));var d=c!==2&&a.timeStamp?a.timeStamp:(new Date).getTime(),h=d-this._lastMouseTime,
e=Math.abs(this._lastMouseX-a.clientX),f=Math.abs(this._lastMouseY-a.clientY),g=this._lastMouseButton===c;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=d;this._lastMouseButton=c;if(c===1)this._isMouseDown=!0,g&&h<=this._clickTime&&e<=this._clickDist&&f<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&(d=this._createMouseEvent("MouseDown",a),this.onMouseDown(d),d.defaultPrevented)){a.preventDefault();return}if(c===1&&this._handleMouse(a)&&
(b.isIE>=9||b.isOpera||b.isChrome||b.isSafari||b.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();b.isFirefox&&this._lastMouseButton===3&&this._updateDOMSelection()},_handleMouseOver:function(a){if(this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",a))},_handleMouseOut:function(a){if(this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){var c=this._isClientDiv(a);if(this.isListening("MouseMove")&&
c)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var d=this._linksVisible||this._lastMouseMoveX!==a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;this._setLinksVisible(d&&!this._isMouseDown&&(b.isMac?a.metaKey:a.ctrlKey));if(!this._isW3CEvents){if(a.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&a.button===1&&(this._clickCount&1)!==0&&c)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&
this._dragOffset===-1){var c=a.clientX,a=a.clientY,h=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect(),f=this._getClientWidth(),g=this._getClientHeight(),d=e.left+h.left,l=e.top+h.top,f=e.left+h.left+f,h=e.top+h.top+g,e=this._model,g=e.getLineAtOffset(this._getSelection().getCaret());a<l&&g!==0?this._doAutoScroll("up",c,a-l):a>h&&g!==e.getLineCount()-1?this._doAutoScroll("down",c,a-h):c<d&&!this._wrapMode?this._doAutoScroll("left",c-d,a):c>f&&!this._wrapMode?this._doAutoScroll("right",
c-f,a):(this._endAutoScroll(),this._setSelectionTo(c,a,!0))}}},_isClientDiv:function(a){for(var c=this._overlayDiv||this._clientDiv,a=a.target?a.target:a.srcElement;a;){if(c===a)return!0;a=a.parentNode}return!1},_createMouseEvent:function(a,c){var b=this.convert({x:c.clientX,y:c.clientY},"page","document");return{type:a,event:c,clickCount:this._clickCount,x:b.x,y:b.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var c=a.which?a.button===0:a.button===1;if(this.isListening("MouseUp")&&
(this._isClientDiv(a)||c&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",a));if(!this._linksVisible&&c&&this._isMouseDown){if(this._dragOffset!==-1)c=this._getSelection(),c.extend(this._dragOffset),c.collapse(),this._setSelection(c,!0,!0),this._dragOffset=-1;this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null);b.isFirefox&&a.preventDefault()}},_handleMouseWheel:function(a){var c=this._getLineHeight(),d=0,h=0;b.isIE||b.isOpera?h=-a.wheelDelta/40*c:b.isFirefox?
(c=b.isMac?a.detail*3:Math.max(-256,Math.min(256,a.detail))*c,a.axis===a.HORIZONTAL_AXIS?d=c:h=c):b.isMac?(h=d=40,a.wheelDeltaX%120!==0&&(d=1),a.wheelDeltaY%120!==0&&(h=1),d=-a.wheelDeltaX/d,-1<d&&d<0&&(d=-1),0<d&&d<1&&(d=1),h=-a.wheelDeltaY/h,-1<h&&h<0&&(h=-1),0<h&&h<1&&(h=1)):(d=-a.wheelDeltaX,h=-a.wheelDeltaY/120*8*c);if(b.isSafari){for(c=a.target;c&&c.lineIndex===void 0;)c=c.parentNode;this._mouseWheelLine=c}c=this._getScroll();this._scrollView(d,h);d=this._getScroll();if(c.x!==d.x||c.y!==d.y)return a.preventDefault&&
a.preventDefault(),!1},_handlePaste:function(a){if(!this._ignorePaste&&this._doPaste(a)){if(b.isIE){var c=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){c._updateDOMSelection();c._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(){var a=this._parent.clientWidth,c=this._parent.clientHeight;if(this._parentWidth!==a||this._parentHeight!==c)this._parentWidth!==a&&this._resetLineHeight(),this._parentWidth=a,this._parentHeight=c,b.isIE<9?this._queueUpdate():
this._update()},_handleRulerEvent:function(a){for(var c=a.target?a.target:a.srcElement,b=c.lineIndex;c&&!c._ruler;){if(b===void 0&&c.lineIndex!==void 0)b=c.lineIndex;c=c.parentNode}c=c?c._ruler:null;if(b===void 0&&c&&c.getOverview()==="document"){var b=this._getClientHeight(),d=this._model.getLineCount(),h=this._getViewPadding(),e=this._viewDiv.getBoundingClientRect(),b=Math.floor((a.clientY-e.top-this._metrics.scrollWidth)*d/(b+h.top+h.bottom-2*this._metrics.scrollWidth));0<=b&&b<d||(b=void 0)}if(c)switch(a.type){case "click":if(c.onClick)c.onClick(b,
a);break;case "dblclick":if(c.onDblClick)c.onDblClick(b,a);break;case "mousemove":if(c.onMouseMove)c.onMouseMove(b,a);break;case "mouseover":if(c.onMouseOver)c.onMouseOver(b,a);break;case "mouseout":if(c.onMouseOut)c.onMouseOut(b,a)}},_handleScroll:function(){var a=this._getScroll(),c=this._hScroll,b=this._vScroll;if(c!==a.x||b!==a.y)this._checkOverlayScroll(),this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(b===a.y),this.onScroll({type:"Scroll",oldValue:{x:c,y:b},newValue:a})},
_handleSelectStart:function(a){if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,c){if(a){var b;b=a.tagName==="DIV"?a:a.parentNode.parentNode;var d=0,h=b.lineIndex;if(a.tagName!=="DIV")for(b=b.firstChild;b;){var e=b.firstChild;if(e===a){b.ignoreChars&&(d-=b.ignoreChars);d+=c;break}b.ignoreChars&&(d-=b.ignoreChars);d+=e.data.length;b=b.nextSibling}return Math.max(0,d)+this._model.getLineStart(h)}},_updateSelectionFromDOM:function(){var a=this._getWindow().getSelection(),
c=this._getModelOffset(a.anchorNode,a.anchorOffset),a=this._getModelOffset(a.focusNode,a.focusOffset);c===void 0||a===void 0||this._setSelection(new l(c,a),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset===-1)if(b.isAndroid){var a=this._getWindow();this._selTimer&&a.clearTimeout(this._selTimer);var c=this;this._selTimer=a.setTimeout(function(){if(c._clientDiv)c._selTimer=null,c._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(a){this._imeOffset=
-1;if(b.isAndroid){for(var c=this._getWindow().getSelection(),d=c.anchorNode;d;){if(d.lineIndex!==void 0)break;d=d.parentNode}if(d){var h=this._model,e=d.lineIndex,f=h.getLine(e),g=f,l=0,h=h.getLineStart(e);if(c.rangeCount>0)c.getRangeAt(0).deleteContents(),e=d.ownerDocument.createTextNode(a.data),c.getRangeAt(0).insertNode(e),l=this._getDOMText(d,e),g=l.text,l=l.offset,e.parentNode.removeChild(e);d.lineRemoved=!0;for(d=0;f.charCodeAt(d)===g.charCodeAt(d)&&d<l;)d++;c=f.length-1;for(e=g.length-f.length;f.charCodeAt(c)===
g.charCodeAt(c+e)&&c+e>=l+a.data.length;)c--;c++;f=g.substring(d,c+e);d+=h;c+=h;this._modifyContent({text:f,start:d,end:c,_ignoreDOMSelection:!0},!0)}}else this._doContent(a.data);a.preventDefault()},_handleTouchStart:function(a){this._commitIME();var c=this._getWindow();if(this._touchScrollTimer)this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",c.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null;var d=a.touches;if(d.length===1){var d=d[0],h=d.clientX,e=d.clientY;
this._touchStartX=h;this._touchStartY=e;if(b.isAndroid&&(e<d.pageY-c.pageYOffset||h<d.pageX-c.pageXOffset))h=d.pageX-c.pageXOffset,e=d.pageY-c.pageYOffset;c=this.convert({x:h,y:e},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(c.x,c.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var c=a.touches;if(c.length===1){c=c[0];this._touchCurrentX=c.clientX;this._touchCurrentY=c.clientY;if(!this._touchScrollTimer&&a.timeStamp-this._touchStartTime<200){this._vScrollDiv.style.display=
"block";if(!this._wrapMode)this._hScrollDiv.style.display="block";var b=this,d=this._getWindow();this._touchScrollTimer=d.setInterval(function(){var a=0,c=0;if(b._touching)a=b._touchStartX-b._touchCurrentX,c=b._touchStartY-b._touchCurrentY,b._touchSpeedX=a/10,b._touchSpeedY=c/10,b._touchStartX=b._touchCurrentX,b._touchStartY=b._touchCurrentY;else if(Math.abs(b._touchSpeedX)<0.1&&Math.abs(b._touchSpeedY)<0.1){b._vScrollDiv.style.display="none";b._hScrollDiv.style.display="none";d.clearInterval(b._touchScrollTimer);
b._touchScrollTimer=null;return}else a=b._touchSpeedX*10,c=b._touchSpeedY*10,b._touchSpeedX*=0.95,b._touchSpeedY*=0.95;b._scrollView(a,c)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){if(a.touches.length===0)this._touching=!1},_doAction:function(a){for(var c=this._keyBindings,b=0;b<c.length;b++){var d=c[b];if(d.keyBinding.match(a)){if(d.actionID&&(a=this._actions[d.actionID]))if(a.handler){if(!a.handler())return a.defaultHandler?typeof a.defaultHandler()==="boolean":
!1}else if(a.defaultHandler)return typeof a.defaultHandler()==="boolean";return!0}}return!1},_doBackspace:function(a){var c=this._getSelection();if(c.isEmpty()){var b=this._model,d=c.getCaret(),h=b.getLineAtOffset(d),e=b.getLineStart(h);if(d===e)h>0&&c.extend(b.getLineEnd(h-1));else{var f=!1;this._expandTab&&a.unit==="character"&&(d-e)%this._tabSize===0&&(f=!/[^ ]/.test(b.getText(e,d)));f?c.extend(d-this._tabSize):(b=this._getLine(h),c.extend(b.getNextOffset(d,a.unit,-1)),b.destroy())}}this._modifyContent({text:"",
start:c.start,end:c.end},!0);return!0},_doContent:function(a){var c=this._getSelection();this._modifyContent({text:a,start:c.start,end:c.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var c=this._getSelection();return!c.isEmpty()?this._setClipboardText(this._getBaseText(c.start,c.end),a):!0},_doCursorNext:function(a){if(!a.select&&this._clearSelection("next"))return!0;var c=this._model,b=this._getSelection(),d=b.getCaret(),h=c.getLineAtOffset(d);d===c.getLineEnd(h)?h+1<c.getLineCount()&&b.extend(c.getLineStart(h+
1)):(c=this._getLine(h),b.extend(c.getNextOffset(d,a.unit,1)),c.destroy());a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){if(!a.select&&this._clearSelection("previous"))return!0;var c=this._model,b=this._getSelection(),d=b.getCaret(),h=c.getLineAtOffset(d);d===c.getLineStart(h)?h>0&&b.extend(c.getLineEnd(h-1)):(c=this._getLine(h),b.extend(c.getNextOffset(d,a.unit,-1)),c.destroy());a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var c=
this._getSelection();return!c.isEmpty()?(c=this._getBaseText(c.start,c.end),this._doContent(""),this._setClipboardText(c,a)):!0},_doDelete:function(a){var c=this._getSelection();if(c.isEmpty()){var b=this._model,d=c.getCaret(),h=b.getLineAtOffset(d);d===b.getLineEnd(h)?h+1<b.getLineCount()&&c.extend(b.getLineStart(h+1)):(b=this._getLine(h),c.extend(b.getNextOffset(d,a.unit,1)),b.destroy())}this._modifyContent({text:"",start:c.start,end:c.end},!0);return!0},_doEnd:function(a){var c=this._getSelection(),
b=this._model;if(a.ctrl)c.extend(b.getCharCount());else{var d=c.getCaret(),h=b.getLineAtOffset(d);if(this._wrapMode){var e=this._getLine(h),d=e.getLineIndex(d),d=d===e.getLineCount()-1?b.getLineEnd(h):e.getLineStart(d+1)-1;e.destroy()}else d=b.getLineEnd(h);c.extend(d)}a.select||c.collapse();this._setSelection(c,!0);return!0},_doEnter:function(a){var c=this._model,b=this._getSelection();this._doContent(c.getLineDelimiter());if(a&&a.noCursor)b.end=b.start,this._setSelection(b);return!0},_doHome:function(a){var c=
this._getSelection(),b=this._model;if(a.ctrl)c.extend(0);else{var d=c.getCaret(),h=b.getLineAtOffset(d);this._wrapMode?(b=this._getLine(h),d=b.getLineIndex(d),d=b.getLineStart(d),b.destroy()):d=b.getLineStart(h);c.extend(d)}a.select||c.collapse();this._setSelection(c,!0);return!0},_doLineDown:function(a){var c=this._model,d=this._getSelection(),h=d.getCaret(),e=c.getLineAtOffset(h),f=this._getLine(e),g=this._columnX,l=1,i=!1;if(g===-1||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?c.getLineEnd(e+1):
h,g=f.getBoundingClientRect(g).left;(h=f.getLineIndex(h))<f.getLineCount()-1?l=f.getClientRects(h+1).top+1:(i=e===c.getLineCount()-1,e++);i?a.select&&(d.extend(c.getCharCount()),this._setSelection(d,!0,!0)):(f.lineIndex!==e&&(f.destroy(),f=this._getLine(e)),d.extend(f.getOffset(g,l)),a.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=g;f.destroy();return!0},_doLineUp:function(a){var c=this._model,d=this._getSelection(),h=d.getCaret(),e=c.getLineAtOffset(h),f=this._getLine(e),g=this._columnX,
l=!1,i;if(g===-1||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?c.getLineStart(e-1):h,g=f.getBoundingClientRect(g).left;(h=f.getLineIndex(h))>0?i=f.getClientRects(h-1).top+1:(l=e===0,l||(e--,i=this._getLineHeight(e)-1));l?a.select&&(d.extend(0),this._setSelection(d,!0,!0)):(f.lineIndex!==e&&(f.destroy(),f=this._getLine(e)),d.extend(f.getOffset(g,i)),a.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=g;f.destroy();return!0},_doPageDown:function(a){var c=this._model,d=this._getSelection(),
h=d.getCaret(),e=c.getLineAtOffset(h),f=c.getLineCount(),g=this._getScroll(),l=this._getClientHeight(),i;if(this._lineHeight){c=this._columnX;g=this._getBoundsAtOffset(h);if(c===-1||a.select&&b.isIE)c=g.left;h=this._getLineIndex(g.top+l);i=this._getLine(h);e=this._getLinePixel(h);h=i.getOffset(c,g.top+l-e);l=i.getBoundingClientRect(h);i.destroy();d.extend(h);a.select||d.collapse();this._setSelection(d,!0,!0,l.top+e-g.top);this._columnX=c;return!0}if(e<f-1){var r=this._getLineHeight(),n=Math.min(f-
e-1,Math.floor(l/r)),n=Math.max(1,n),c=this._columnX;if(c===-1||a.select&&b.isIE)i=this._getLine(e),c=i.getBoundingClientRect(h).left,i.destroy();i=this._getLine(e+n);d.extend(i.getOffset(c,0));i.destroy();a.select||d.collapse();a=f*r;h=g.y+n*r;h+l>a&&(h=a-l);this._setSelection(d,!0,!0,h-g.y);this._columnX=c}return!0},_doPageUp:function(a){var c=this._model,d=this._getSelection(),h=d.getCaret(),e=c.getLineAtOffset(h),f=this._getScroll(),g=this._getClientHeight(),l;if(this._lineHeight){c=this._columnX;
f=this._getBoundsAtOffset(h);if(c===-1||a.select&&b.isIE)c=f.left;h=this._getLineIndex(f.bottom-g);l=this._getLine(h);e=this._getLinePixel(h);h=l.getOffset(c,f.bottom-g-e);g=l.getBoundingClientRect(h);l.destroy();d.extend(h);a.select||d.collapse();this._setSelection(d,!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||a.select&&b.isIE)l=this._getLine(e),c=l.getBoundingClientRect(h).left,l.destroy();
l=this._getLine(e-g);d.extend(l.getOffset(c,this._getLineHeight(e-g)-1));l.destroy();a.select||d.collapse();a=Math.max(0,f.y-g*i);this._setSelection(d,!0,!0,a-f.y);this._columnX=c}return!0},_doPaste:function(a){var c=this;return this._getClipboardText(a,function(a){a&&(b.isLinux&&c._lastMouseButton===2&&(new Date).getTime()-c._lastMouseTime<=c._clickTime&&c._setSelectionTo(c._lastMouseX,c._lastMouseY),c._doContent(a))})!==null},_doScroll:function(a){var c=a.type,b=this._model,d=b.getLineCount(),a=
this._getClientHeight(),h=this._getLineHeight();d*=h;var e=this._getScroll().y,f;switch(c){case "textStart":f=0;break;case "textEnd":f=d-a;break;case "pageDown":f=e+a;break;case "pageUp":f=e-a;break;case "centerLine":c=this._getSelection(),f=b.getLineAtOffset(c.start),b=(b.getLineAtOffset(c.end)-f+1)*h,f=f*h-a/2+b/2}f!==void 0&&(f=Math.min(Math.max(0,f),d-a),this._scrollView(0,f-e));return!0},_doSelectAll:function(){var a=this._model,c=this._getSelection();c.setCaret(0);c.extend(a.getCharCount());
this._setSelection(c,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var a="\t";if(this._expandTab)var c=this._model,a=this._getSelection().getCaret(),b=c.getLineAtOffset(a),c=c.getLineStart(b),a=Array(this._tabSize-(a-c)%this._tabSize+1).join(" ");this._doContent(a);return!0}},_doShiftTab:function(){return!this._tabMode||this._readonly?void 0:!0},_doTabMode:function(){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(){this.setOptions({wrapMode:!this.getOptions("wrapMode")});
return!0},_autoScroll:function(){var a=this._getSelection(),c=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),b=a.getCaret(),d=this._model.getLineAtOffset(b),h;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")b=this._autoScrollY/this._getLineHeight(),b=b<0?Math.floor(b):Math.ceil(b),h=d,h=Math.max(0,Math.min(this._model.getLineCount()-1,h+b));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")h=this._getLineIndex(c.y),d=this._getLine(d),c.x+=d.getBoundingClientRect(b,
!1).left,d.destroy();d=this._getLine(h);a.extend(d.getOffset(c.x,c.y-this._getLinePixel(h)));d.destroy();this._setSelection(a,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var c=this._model.getLineCount(),b=0;if(a){for(var a=0,d=(new Date).getTime(),h=0;b<c;)if(this._lineHeight[b]||(a++,h||
(h=b),this._lineHeight[b]=this._calculateLineHeight(b)),b++,(new Date).getTime()-d>100)break;this.redrawRulers(0,c);this._queueUpdate()}a=this._getWindow();if(b!==c){var e=this;this._calculateLHTimer=a.setTimeout(function(){e._calculateLHTimer=null;e._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(a){var a=this._getLine(a),c=a.getBoundingClientRect();a.destroy();return Math.max(1,
Math.ceil(c.bottom-c.top))},_calculateMetrics:function(){var c=this._clientDiv,d=c.ownerDocument,e=b.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 l=b.createElement(d,"span");l.appendChild(d.createTextNode(" "));e.appendChild(l);var i=b.createElement(d,"span");i.style.fontStyle="italic";i.appendChild(d.createTextNode(" "));
e.appendChild(i);var u=b.createElement(d,"span");u.style.fontWeight="bold";u.appendChild(d.createTextNode(" "));e.appendChild(u);f=b.createElement(d,"span");f.style.fontWeight="bold";f.style.fontStyle="italic";f.appendChild(d.createTextNode(" "));e.appendChild(f);c.appendChild(e);var n=e.getBoundingClientRect(),l=l.getBoundingClientRect(),i=i.getBoundingClientRect(),u=u.getBoundingClientRect(),f=f.getBoundingClientRect(),l=l.bottom-l.top,i=i.bottom-i.top,u=u.bottom-u.top,j=f.bottom-f.top,r=0,f=n.bottom-
n.top<=0,n=Math.max(1,n.bottom-n.top);i>l&&(r=1);u>i&&(r=2);j>u&&(r=3);var q;if(r!==0){q={style:{}};if((r&1)!==0)q.style.fontStyle="italic";if((r&2)!==0)q.style.fontWeight="bold"}l=h(e);c.removeChild(e);i=a(this._viewDiv);e=b.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";u=b.createElement(d,"div");
u.style.width="100%";u.style.height="100%";e.appendChild(u);c.appendChild(e);d=e.getBoundingClientRect();i=u.getBoundingClientRect();e.style.overflow="hidden";u.style.height="200px";u=e.clientWidth;e.style.overflow="scroll";j=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:n,largestFontStyle:q,lineTrim:l,viewPadding:i,scrollWidth:u-j,invalid:f}},_checkOverlayScroll:function(){if(b.isMac){var a=this,c=this._getWindow();
this._overlayScrollTimer&&c.clearTimeout(this._overlayScrollTimer);var d=function(){var b=a._isOverOverlayScroll();b.vertical||b.horizontal?a._overlayScrollTimer=c.setTimeout(d,200):(a._overlayScrollTimer=void 0,a._update())};this._overlayScrollTimer=c.setTimeout(d,200)}},_clearSelection:function(a){var c=this._getSelection();if(c.isEmpty())return!1;a==="next"?c.start=c.end:c.end=c.start;this._setSelection(c,!0);return!0},_commitIME:function(){if(this._imeOffset!==-1){this._scrollDiv.focus();this._clientDiv.focus();
var a=this._model,c=a.getLineAtOffset(this._imeOffset),b=a.getLineStart(c),d=this._getDOMText(this._getLineNode(c)).text,a=a.getLine(c),b=this._imeOffset-b,a=b+d.length-a.length;b!==a&&this._doContent(d.substring(b,a));this._imeOffset=-1}},_createActions:function(){var a=k.KeyBinding,c=this._keyBindings=[];c.push({actionID:"lineUp",keyBinding:new a(38),predefined:!0});c.push({actionID:"lineDown",keyBinding:new a(40),predefined:!0});c.push({actionID:"charPrevious",keyBinding:new a(37),predefined:!0});
c.push({actionID:"charNext",keyBinding:new a(39),predefined:!0});b.isMac?(c.push({actionID:"scrollPageUp",keyBinding:new a(33),predefined:!0}),c.push({actionID:"scrollPageDown",keyBinding:new a(34),predefined:!0}),c.push({actionID:"pageUp",keyBinding:new a(33,null,null,!0),predefined:!0}),c.push({actionID:"pageDown",keyBinding:new a(34,null,null,!0),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new a(37,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new a(39,!0),predefined:!0}),
c.push({actionID:"wordPrevious",keyBinding:new a(37,null,null,!0),predefined:!0}),c.push({actionID:"wordNext",keyBinding:new a(39,null,null,!0),predefined:!0}),c.push({actionID:"scrollTextStart",keyBinding:new a(36),predefined:!0}),c.push({actionID:"scrollTextEnd",keyBinding:new a(35),predefined:!0}),c.push({actionID:"textStart",keyBinding:new a(38,!0),predefined:!0}),c.push({actionID:"textEnd",keyBinding:new a(40,!0),predefined:!0}),c.push({actionID:"scrollPageUp",keyBinding:new a(38,null,null,null,
!0),predefined:!0}),c.push({actionID:"scrollPageDown",keyBinding:new a(40,null,null,null,!0),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new a(37,null,null,null,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new a(39,null,null,null,!0),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new a(38,null,null,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new a(40,null,null,!0),predefined:!0})):(c.push({actionID:"pageUp",keyBinding:new a(33),predefined:!0}),c.push({actionID:"pageDown",
keyBinding:new a(34),predefined:!0}),c.push({actionID:"lineStart",keyBinding:new a(36),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new a(35),predefined:!0}),c.push({actionID:"wordPrevious",keyBinding:new a(37,!0),predefined:!0}),c.push({actionID:"wordNext",keyBinding:new a(39,!0),predefined:!0}),c.push({actionID:"textStart",keyBinding:new a(36,!0),predefined:!0}),c.push({actionID:"textEnd",keyBinding:new a(35,!0),predefined:!0}));b.isFirefox&&b.isLinux&&(c.push({actionID:"lineUp",keyBinding:new a(38,
!0),predefined:!0}),c.push({actionID:"lineDown",keyBinding:new a(40,!0),predefined:!0}));c.push({actionID:"selectLineUp",keyBinding:new a(38,null,!0),predefined:!0});c.push({actionID:"selectLineDown",keyBinding:new a(40,null,!0),predefined:!0});c.push({actionID:"selectCharPrevious",keyBinding:new a(37,null,!0),predefined:!0});c.push({actionID:"selectCharNext",keyBinding:new a(39,null,!0),predefined:!0});c.push({actionID:"selectPageUp",keyBinding:new a(33,null,!0),predefined:!0});c.push({actionID:"selectPageDown",
keyBinding:new a(34,null,!0),predefined:!0});b.isMac?(c.push({actionID:"selectLineStart",keyBinding:new a(37,!0,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new a(39,!0,!0),predefined:!0}),c.push({actionID:"selectWordPrevious",keyBinding:new a(37,null,!0,!0),predefined:!0}),c.push({actionID:"selectWordNext",keyBinding:new a(39,null,!0,!0),predefined:!0}),c.push({actionID:"selectTextStart",keyBinding:new a(36,null,!0),predefined:!0}),c.push({actionID:"selectTextEnd",keyBinding:new a(35,
null,!0),predefined:!0}),c.push({actionID:"selectTextStart",keyBinding:new a(38,!0,!0),predefined:!0}),c.push({actionID:"selectTextEnd",keyBinding:new a(40,!0,!0),predefined:!0}),c.push({actionID:"selectLineStart",keyBinding:new a(37,null,!0,null,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new a(39,null,!0,null,!0),predefined:!0}),c.push({actionID:"selectLineStart",keyBinding:new a(38,null,!0,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new a(40,null,!0,!0),
predefined:!0})):(b.isLinux&&(c.push({actionID:"selectWholeLineUp",keyBinding:new a(38,!0,!0),predefined:!0}),c.push({actionID:"selectWholeLineDown",keyBinding:new a(40,!0,!0),predefined:!0})),c.push({actionID:"selectLineStart",keyBinding:new a(36,null,!0),predefined:!0}),c.push({actionID:"selectLineEnd",keyBinding:new a(35,null,!0),predefined:!0}),c.push({actionID:"selectWordPrevious",keyBinding:new a(37,!0,!0),predefined:!0}),c.push({actionID:"selectWordNext",keyBinding:new a(39,!0,!0),predefined:!0}),
c.push({actionID:"selectTextStart",keyBinding:new a(36,!0,!0),predefined:!0}),c.push({actionID:"selectTextEnd",keyBinding:new a(35,!0,!0),predefined:!0}));c.push({actionID:"undo",keyBinding:new k.KeyBinding("z",!0),predefined:!0});b.isMac?c.push({actionID:"redo",keyBinding:new k.KeyBinding("z",!0,!0),predefined:!0}):c.push({actionID:"redo",keyBinding:new k.KeyBinding("y",!0),predefined:!0});c.push({actionID:"deletePrevious",keyBinding:new a(8),predefined:!0});c.push({actionID:"deletePrevious",keyBinding:new a(8,
null,!0),predefined:!0});c.push({actionID:"deleteNext",keyBinding:new a(46),predefined:!0});c.push({actionID:"deleteWordPrevious",keyBinding:new a(8,!0),predefined:!0});c.push({actionID:"deleteWordPrevious",keyBinding:new a(8,!0,!0),predefined:!0});c.push({actionID:"deleteWordNext",keyBinding:new a(46,!0),predefined:!0});c.push({actionID:"tab",keyBinding:new a(9),predefined:!0});c.push({actionID:"shiftTab",keyBinding:new a(9,null,!0),predefined:!0});c.push({actionID:"enter",keyBinding:new a(13),predefined:!0});
c.push({actionID:"enter",keyBinding:new a(13,null,!0),predefined:!0});c.push({actionID:"selectAll",keyBinding:new a("a",!0),predefined:!0});c.push({actionID:"toggleTabMode",keyBinding:new a("m",!0),predefined:!0});b.isMac&&(c.push({actionID:"deleteNext",keyBinding:new a(46,null,!0),predefined:!0}),c.push({actionID:"deleteWordPrevious",keyBinding:new a(8,null,null,!0),predefined:!0}),c.push({actionID:"deleteWordNext",keyBinding:new a(46,null,null,!0),predefined:!0}));if(!b.isFirefox){var d=b.isMac&&
b.isChrome;c.push({actionID:null,keyBinding:new a("u",!d,!1,!1,d),predefined:!0});c.push({actionID:null,keyBinding:new a("i",!d,!1,!1,d),predefined:!0});c.push({actionID:null,keyBinding:new a("b",!d,!1,!1,d),predefined:!0})}b.isFirefox&&(c.push({actionID:"copy",keyBinding:new a(45,!0),predefined:!0}),c.push({actionID:"paste",keyBinding:new a(45,null,!0),predefined:!0}),c.push({actionID:"cut",keyBinding:new a(46,null,!0),predefined:!0}));b.isMac&&(c.push({actionID:"lineStart",keyBinding:new a("a",
!1,!1,!1,!0),predefined:!0}),c.push({actionID:"lineEnd",keyBinding:new a("e",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"lineUp",keyBinding:new a("p",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"lineDown",keyBinding:new a("n",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"charPrevious",keyBinding:new a("b",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"charNext",keyBinding:new a("f",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deletePrevious",keyBinding:new a("h",!1,!1,!1,!0),predefined:!0}),
c.push({actionID:"deleteNext",keyBinding:new a("d",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deleteLineEnd",keyBinding:new a("k",!1,!1,!1,!0),predefined:!0}),b.isFirefox?(c.push({actionID:"scrollPageDown",keyBinding:new a("v",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deleteLineStart",keyBinding:new a("u",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"deleteWordPrevious",keyBinding:new a("w",!1,!1,!1,!0),predefined:!0})):(c.push({actionID:"pageDown",keyBinding:new a("v",!1,!1,!1,!0),predefined:!0}),
c.push({actionID:"centerLine",keyBinding:new a("l",!1,!1,!1,!0),predefined:!0}),c.push({actionID:"enterNoCursor",keyBinding:new a("o",!1,!1,!1,!0),predefined:!0})));var h=this;this._actions={lineUp:{defaultHandler:function(){return h._doLineUp({select:!1})}},lineDown:{defaultHandler:function(){return h._doLineDown({select:!1})}},lineStart:{defaultHandler:function(){return h._doHome({select:!1,ctrl:!1})}},lineEnd:{defaultHandler:function(){return h._doEnd({select:!1,ctrl:!1})}},charPrevious:{defaultHandler:function(){return h._doCursorPrevious({select:!1,
unit:"character"})}},charNext:{defaultHandler:function(){return h._doCursorNext({select:!1,unit:"character"})}},pageUp:{defaultHandler:function(){return h._doPageUp({select:!1})}},pageDown:{defaultHandler:function(){return h._doPageDown({select:!1})}},scrollPageUp:{defaultHandler:function(){return h._doScroll({type:"pageUp"})}},scrollPageDown:{defaultHandler:function(){return h._doScroll({type:"pageDown"})}},wordPrevious:{defaultHandler:function(){return h._doCursorPrevious({select:!1,unit:"word"})}},
wordNext:{defaultHandler:function(){return h._doCursorNext({select:!1,unit:"word"})}},textStart:{defaultHandler:function(){return h._doHome({select:!1,ctrl:!0})}},textEnd:{defaultHandler:function(){return h._doEnd({select:!1,ctrl:!0})}},scrollTextStart:{defaultHandler:function(){return h._doScroll({type:"textStart"})}},scrollTextEnd:{defaultHandler:function(){return h._doScroll({type:"textEnd"})}},centerLine:{defaultHandler:function(){return h._doScroll({type:"centerLine"})}},selectLineUp:{defaultHandler:function(){return h._doLineUp({select:!0})}},
selectLineDown:{defaultHandler:function(){return h._doLineDown({select:!0})}},selectWholeLineUp:{defaultHandler:function(){return h._doLineUp({select:!0,wholeLine:!0})}},selectWholeLineDown:{defaultHandler:function(){return h._doLineDown({select:!0,wholeLine:!0})}},selectLineStart:{defaultHandler:function(){return h._doHome({select:!0,ctrl:!1})}},selectLineEnd:{defaultHandler:function(){return h._doEnd({select:!0,ctrl:!1})}},selectCharPrevious:{defaultHandler:function(){return h._doCursorPrevious({select:!0,
unit:"character"})}},selectCharNext:{defaultHandler:function(){return h._doCursorNext({select:!0,unit:"character"})}},selectPageUp:{defaultHandler:function(){return h._doPageUp({select:!0})}},selectPageDown:{defaultHandler:function(){return h._doPageDown({select:!0})}},selectWordPrevious:{defaultHandler:function(){return h._doCursorPrevious({select:!0,unit:"word"})}},selectWordNext:{defaultHandler:function(){return h._doCursorNext({select:!0,unit:"word"})}},selectTextStart:{defaultHandler:function(){return h._doHome({select:!0,
ctrl:!0})}},selectTextEnd:{defaultHandler:function(){return h._doEnd({select:!0,ctrl:!0})}},deletePrevious:{defaultHandler:function(){return h._doBackspace({unit:"character"})}},deleteNext:{defaultHandler:function(){return h._doDelete({unit:"character"})}},deleteWordPrevious:{defaultHandler:function(){return h._doBackspace({unit:"word"})}},deleteWordNext:{defaultHandler:function(){return h._doDelete({unit:"word"})}},deleteLineStart:{defaultHandler:function(){return h._doBackspace({unit:"line"})}},
deleteLineEnd:{defaultHandler:function(){return h._doDelete({unit:"line"})}},tab:{defaultHandler:function(){return h._doTab()}},shiftTab:{defaultHandler:function(){return h._doShiftTab()}},enter:{defaultHandler:function(){return h._doEnter()}},enterNoCursor:{defaultHandler:function(){return h._doEnter({noCursor:!0})}},selectAll:{defaultHandler:function(){return h._doSelectAll()}},copy:{defaultHandler:function(){return h._doCopy()}},cut:{defaultHandler:function(){return h._doCut()}},paste:{defaultHandler:function(){return h._doPaste()}},
toggleWrapMode:{defaultHandler:function(){return h._doWrapMode()}},toggleTabMode:{defaultHandler:function(){return h._doTabMode()}}}},_createRuler:function(a,c){if(this._clientDiv){var d=a.getLocation()==="left"?this._leftDiv:this._rightDiv;d.style.display="block";var h=b.createElement(d.ownerDocument,"div");h._ruler=a;h.rulerChanged=!0;h.style.position="relative";var d=d.firstChild.rows[0],e=d.cells.length,d=d.insertCell(c===void 0||c<0||c>e?e:c);d.vAlign="top";d.style.verticalAlign="top";d.style.borderWidth=
"0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.appendChild(h)}},_createView:function(){if(!this._clientDiv){for(var a=this._parent;a.hasChildNodes();)a.removeChild(a.lastChild);var c=a.ownerDocument,d=b.createElement(c,"div");this._rootDiv=d;d.tabIndex=-1;d.style.position="relative";d.style.overflow="hidden";d.style.width="100%";d.style.height="100%";a.style.overflow="hidden";d.setAttribute("role","application");a.appendChild(d);a=b.createElement(c,"div");a.className="textviewLeftRuler";
this._leftDiv=a;a.tabIndex=-1;a.style.overflow="hidden";a.style.MozUserSelect="none";a.style.WebkitUserSelect="none";a.style.position="absolute";a.style.cursor="default";a.style.display="none";a.setAttribute("aria-hidden","true");var h=b.createElement(c,"table");a.appendChild(h);h.cellPadding="0px";h.cellSpacing="0px";h.border="0px";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.lineHeight="normal";h=h.insertRow(0);h.style.borderWidth="0px";h.style.margin=
"0px";h.style.padding="0px";h.style.outline="none";h.style.lineHeight="normal";d.appendChild(a);a=b.createElement(c,"div");a.className="textview";this._viewDiv=a;a.tabIndex=-1;a.style.overflow="auto";a.style.position="absolute";a.style.top="0px";a.style.bottom="0px";a.style.borderWidth="0px";a.style.margin="0px";a.style.outline="none";d.appendChild(a);var e=b.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");h=b.createElement(c,"table");e.appendChild(h);h.cellPadding="0px";h.cellSpacing="0px";h.border="0px";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.lineHeight="normal";h=h.insertRow(0);h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.lineHeight="normal";
d.appendChild(e);this._scrollDiv=h=b.createElement(c,"div");h.style.margin="0px";h.style.borderWidth="0px";h.style.padding="0px";a.appendChild(h);if(b.isFirefox)this._clipboardDiv=a=b.createElement(c,"div"),a.style.position="fixed",a.style.whiteSpace="pre",a.style.left="-1000px",d.appendChild(a);if(!b.isIE&&!b.isIOS)this._clipDiv=a=b.createElement(c,"div"),a.style.position="absolute",a.style.overflow="hidden",a.style.margin="0px",a.style.borderWidth="0px",a.style.padding="0px",d.appendChild(a),this._clipScrollDiv=
h=b.createElement(c,"div"),h.style.position="absolute",h.style.height="1px",h.style.top="-1000px",a.appendChild(h);this._setFullSelection(this._fullSelection,!0);a=b.createElement(c,"div");a.className="textviewContent";this._clientDiv=a;a.style.position="absolute";a.style.borderWidth="0px";a.style.margin="0px";a.style.padding="0px";a.style.outline="none";a.style.zIndex="1";a.style.WebkitUserSelect="text";a.setAttribute("spellcheck","false");if(b.isIOS||b.isAndroid)a.style.WebkitTapHighlightColor=
"transparent";(this._clipDiv||d).appendChild(a);if(b.isIOS||b.isAndroid)this._vScrollDiv=h=b.createElement(c,"div"),h.style.position="absolute",h.style.borderWidth="1px",h.style.borderColor="white",h.style.borderStyle="solid",h.style.borderRadius="4px",h.style.backgroundColor="black",h.style.opacity="0.5",h.style.margin="0px",h.style.padding="0px",h.style.outline="none",h.style.zIndex="3",h.style.width="8px",h.style.display="none",d.appendChild(h),this._hScrollDiv=h=b.createElement(c,"div"),h.style.position=
"absolute",h.style.borderWidth="1px",h.style.borderColor="white",h.style.borderStyle="solid",h.style.borderRadius="4px",h.style.backgroundColor="black",h.style.opacity="0.5",h.style.margin="0px",h.style.padding="0px",h.style.outline="none",h.style.zIndex="3",h.style.height="8px",h.style.display="none",d.appendChild(h);if(b.isFirefox&&!a.setCapture)this._overlayDiv=h=b.createElement(c,"div"),h.style.position=a.style.position,h.style.borderWidth=a.style.borderWidth,h.style.margin=a.style.margin,h.style.padding=
a.style.padding,h.style.cursor="text",h.style.zIndex="2",(this._clipDiv||d).appendChild(h);a.contentEditable="true";a.setAttribute("role","textbox");a.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);if(!c.getElementById("_textviewStyle")&&(d="",b.isWebkit&&this._metrics.scrollWidth>0&&(d+="\n.textviewContainer ::-webkit-scrollbar-corner {background: #eeeeee;}"),
b.isFirefox&&b.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(d+="\n.textviewContainer ::-moz-selection {background: "+this._highlightRGB+";}"),d))a=b.createElement(c,"style"),a.id="_textviewStyle",h=c.getElementsByTagName("head")[0]||c.documentElement,a.appendChild(c.createTextNode(d)),h.insertBefore(a,h.firstChild);this._hookEvents();c=this._rulers;for(d=0;d<c.length;d++)this._createRuler(c[d]);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(a){var c=a.getLocation()==="left"?this._leftDiv:this._rightDiv;if(c){for(var b=c.firstChild.rows[0],d=b.cells,h=0;h<d.length;h++)if(d[h].firstChild._ruler===
a)break;if(h!==d.length&&(b.cells[h]._ruler=void 0,b.deleteCell(h),d.length===0))c.style.display="none"}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();if(this._autoScrollTimerID)a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null;if(this._updateTimer)a.clearTimeout(this._updateTimer),this._updateTimer=null;a=this._rootDiv;a.parentNode.removeChild(a);this._hScrollDiv=this._vScrollDiv=this._rightDiv=this._leftDiv=this._overlayDiv=
this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,c,b){this._autoScrollDir=a;this._autoScrollX=c;this._autoScrollY=b;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;
if(a){var c=this._hasFocus;this._ignoreFocus=!0;c&&a.blur();a.contentEditable=!1;a.contentEditable=!0;c&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,c){var b=this._model;b.getBaseModel&&(a=b.mapOffset(a),c=b.mapOffset(c),b=b.getBaseModel());return b.getText(a,c)},_getBottomIndex:function(a){var c=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=c.getBoundingClientRect(),b=this._clientDiv.getBoundingClientRect();a.bottom>b.bottom&&(c=this._getLinePrevious(c)||
c)}return c.lineIndex},_getBoundsAtOffset:function(a){var c=this._getLine(this._model.getLineAtOffset(a)),a=c.getBoundingClientRect(a),b=this._getLinePixel(c.lineIndex);a.top+=b;a.bottom+=b;c.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,d){var h=this._model.getLineDelimiter(),
e,f,g=this._getWindow();if(g.clipboardData)return e=[],f=g.clipboardData.getData("Text"),c(f,function(a){e.push(a)},function(){e.push(h)}),f=e.join(""),d&&d(f),f;if(b.isFirefox){this._ignoreFocus=!0;var l=this._clipboardDiv;l.innerHTML="<pre contenteditable=''></pre>";l.firstChild.focus();var i=this,n=function(){var a=i._getTextFromElement(l);l.innerHTML="";e=[];c(a,function(a){e.push(a)},function(){e.push(h)});return e.join("")},r=!1;this._ignorePaste=!0;if(!b.isLinux||this._lastMouseButton!==2)try{r=
l.ownerDocument.execCommand("paste",!1,null)}catch(j){r=l.childNodes.length>1||l.firstChild&&l.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!r)return a?(g.setTimeout(function(){i.focus();(f=n())&&d&&d(f);i._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(f=n())&&d&&d(f);return f}return a&&a.clipboardData?(e=[],f=a.clipboardData.getData("text/plain"),c(f,function(a){e.push(a)},function(){e.push(h)}),(f=e.join(""))&&d&&d(f),f):""},_getDOMText:function(a,
c){for(var b=a.firstChild,d="",h=0;b;){var e;if(b.ignoreChars){e=b.lastChild;for(var f=0,g=[],l=-1;e;){for(var i=e.data,n=i.length-1;n>=0;n--){var j=i.substring(n,n+1);f<b.ignoreChars&&(j===" "||j==="\u200c"||j==="\ufeff")?f++:g.push(j==="\u00a0"?"\t":j)}if(c===e)l=g.length;e=e.previousSibling}g=g.reverse().join("");l!==-1&&(h=d.length+g.length-l);d+=g}else for(e=b.firstChild;e;){if(c===e)h=d.length;d+=e.data;e=e.nextSibling}b=b.nextSibling}return{text:d,offset:h}},_getTextFromElement:function(a){var c=
a.ownerDocument,b=c.defaultView;if(!b.getSelection)return a.innerText||a.textContent;c=c.createRange();c.selectNode(a);var a=b.getSelection(),b=[],d;for(d=0;d<a.rangeCount;d++)b.push(a.getRangeAt(d));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(c);c=a.toString();a.removeAllRanges();for(d=0;d<b.length;d++)a.addRange(b[d]);this._ignoreSelect=!1;return c},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var c=this._getLineNode(a);return c&&!c.lineChanged&&!c.lineRemoved?
c._line:new q(this,a)},_getLineHeight:function(a,c){if(a!==void 0&&this._lineHeight){var b=this._lineHeight[a];if(b)return b;if(c||c===void 0)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var c=this._clientDiv.firstChild;c;){if(a===c.lineIndex)return c;c=c.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&a.lineIndex===-1;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?
a.previousSibling:this._clientDiv.lastChild;a&&a.lineIndex===-1;)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var c=this._getTopIndex(),b=-this._topIndexY+this._getScroll().y;if(a>c)for(;c<a;c++)b+=this._getLineHeight(c);else for(c-=1;c>=a;c--)b-=this._getLineHeight(c);return b}return this._getLineHeight()*a},_getLineIndex:function(a){var c,b=0,d=this._model.getLineCount();if(this._lineHeight){var b=this._getTopIndex(),
h=-this._topIndexY+this._getScroll().y;if(a!==h)if(a<h)for(;a<h&&b>0;)a+=this._getLineHeight(--b);else for(c=this._getLineHeight(b);a-c>=h&&b<d-1;)a-=c,c=this._getLineHeight(++b)}else c=this._getLineHeight(),b=Math.floor(a/c);return Math.max(0,Math.min(d-1,b))},_getScroll:function(){var a=this._viewDiv;return{x:a.scrollLeft,y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var c=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=
c.getBoundingClientRect(),b=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect();a.top<d.top+b.top&&(c=this._getLineNext(c)||c)}return c.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(c){a._onModelChanging(c)},onChanged:function(c){a._onModelChanged(c)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);var c=this._handlers=[],d=this._clientDiv,h=this._viewDiv,
e=this._rootDiv,g=this._overlayDiv||d,l=d.ownerDocument,i=this._getWindow(),n=b.isIE?l:i;c.push({target:i,type:"resize",handler:function(c){return a._handleResize(c?c:i.event)}});c.push({target:d,type:"blur",handler:function(c){return a._handleBlur(c?c:i.event)}});c.push({target:d,type:"focus",handler:function(c){return a._handleFocus(c?c:i.event)}});c.push({target:h,type:"focus",handler:function(){d.focus()}});c.push({target:h,type:"scroll",handler:function(c){return a._handleScroll(c?c:i.event)}});
c.push({target:d,type:"textInput",handler:function(c){return a._handleTextInput(c?c:i.event)}});c.push({target:d,type:"keydown",handler:function(c){return a._handleKeyDown(c?c:i.event)}});c.push({target:d,type:"keypress",handler:function(c){return a._handleKeyPress(c?c:i.event)}});c.push({target:d,type:"keyup",handler:function(c){return a._handleKeyUp(c?c:i.event)}});c.push({target:d,type:"contextmenu",handler:function(c){return a._handleContextMenu(c?c:i.event)}});c.push({target:d,type:"copy",handler:function(c){return a._handleCopy(c?
c:i.event)}});c.push({target:d,type:"cut",handler:function(c){return a._handleCut(c?c:i.event)}});c.push({target:d,type:"paste",handler:function(c){return a._handlePaste(c?c:i.event)}});if(b.isIOS||b.isAndroid)c.push({target:l,type:"selectionchange",handler:function(c){return a._handleSelectionChange(c?c:i.event)}}),c.push({target:d,type:"touchstart",handler:function(c){return a._handleTouchStart(c?c:i.event)}}),c.push({target:d,type:"touchmove",handler:function(c){return a._handleTouchMove(c?c:i.event)}}),
c.push({target:d,type:"touchend",handler:function(c){return a._handleTouchEnd(c?c:i.event)}});else{c.push({target:d,type:"selectstart",handler:function(c){return a._handleSelectStart(c?c:i.event)}});c.push({target:d,type:"mousedown",handler:function(c){return a._handleMouseDown(c?c:i.event)}});c.push({target:d,type:"mouseover",handler:function(c){return a._handleMouseOver(c?c:i.event)}});c.push({target:d,type:"mouseout",handler:function(c){return a._handleMouseOut(c?c:i.event)}});c.push({target:n,
type:"mouseup",handler:function(c){return a._handleMouseUp(c?c:i.event)}});c.push({target:n,type:"mousemove",handler:function(c){return a._handleMouseMove(c?c:i.event)}});c.push({target:e,type:"mousedown",handler:function(c){return a._handleRootMouseDown(c?c:i.event)}});c.push({target:e,type:"mouseup",handler:function(c){return a._handleRootMouseUp(c?c:i.event)}});c.push({target:g,type:"dragstart",handler:function(c){return a._handleDragStart(c?c:i.event)}});c.push({target:g,type:"drag",handler:function(c){return a._handleDrag(c?
c:i.event)}});c.push({target:g,type:"dragend",handler:function(c){return a._handleDragEnd(c?c:i.event)}});c.push({target:g,type:"dragenter",handler:function(c){return a._handleDragEnter(c?c:i.event)}});c.push({target:g,type:"dragover",handler:function(c){return a._handleDragOver(c?c:i.event)}});c.push({target:g,type:"dragleave",handler:function(c){return a._handleDragLeave(c?c:i.event)}});c.push({target:g,type:"drop",handler:function(c){return a._handleDrop(c?c:i.event)}});c.push({target:this._clientDiv,
type:b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(c){return a._handleMouseWheel(c?c:i.event)}});if(b.isFirefox&&(!b.isWindows||b.isFirefox>=15))(h=i.MutationObserver||i.MozMutationObserver)?(this._mutationObserver=new h(function(c){a._handleDataModified(c)}),this._mutationObserver.observe(d,{subtree:!0,characterData:!0})):c.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(c){return a._handleDataModified(c?c:i.event)}});this._overlayDiv&&(c.push({target:this._overlayDiv,
type:"mousedown",handler:function(c){return a._handleMouseDown(c?c:i.event)}}),c.push({target:this._overlayDiv,type:"mouseover",handler:function(c){return a._handleMouseOver(c?c:i.event)}}),c.push({target:this._overlayDiv,type:"mouseout",handler:function(c){return a._handleMouseOut(c?c:i.event)}}),c.push({target:this._overlayDiv,type:"contextmenu",handler:function(c){return a._handleContextMenu(c?c:i.event)}}));this._isW3CEvents||c.push({target:this._clientDiv,type:"dblclick",handler:function(c){return a._handleDblclick(c?
c:i.event)}})}h=this._leftDiv;e=this._rightDiv;b.isIE&&c.push({target:h,type:"selectstart",handler:function(){return!1}});c.push({target:h,type:b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(c){return a._handleMouseWheel(c?c:i.event)}});c.push({target:h,type:"click",handler:function(c){a._handleRulerEvent(c?c:i.event)}});c.push({target:h,type:"dblclick",handler:function(c){a._handleRulerEvent(c?c:i.event)}});c.push({target:h,type:"mousemove",handler:function(c){a._handleRulerEvent(c?c:
i.event)}});c.push({target:h,type:"mouseover",handler:function(c){a._handleRulerEvent(c?c:i.event)}});c.push({target:h,type:"mouseout",handler:function(c){a._handleRulerEvent(c?c:i.event)}});b.isIE&&c.push({target:e,type:"selectstart",handler:function(){return!1}});c.push({target:e,type:b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(c){return a._handleMouseWheel(c?c:i.event)}});c.push({target:e,type:"click",handler:function(c){a._handleRulerEvent(c?c:i.event)}});c.push({target:e,type:"dblclick",
handler:function(c){a._handleRulerEvent(c?c:i.event)}});c.push({target:e,type:"mousemove",handler:function(c){a._handleRulerEvent(c?c:i.event)}});c.push({target:e,type:"mouseover",handler:function(c){a._handleRulerEvent(c?c:i.event)}});c.push({target:e,type:"mouseout",handler:function(c){a._handleRulerEvent(c?c:i.event)}});for(h=0;h<c.length;h++)e=c[h],f(e.target,e.type,e.handler,e.capture)},_getWindow:function(){return this._parent.ownerDocument.defaultView||this._parent.ownerDocument.parentWindow},
_init:function(a){var c=a.parent;typeof c==="string"&&(c=(a.document||document).getElementById(c));if(!c)throw"no parent";a.parent=c;a.model=a.model||new j.TextModel;var d=this._defaultOptions(),h;for(h in d)d.hasOwnProperty(h)&&(this["_"+h]=a[h]!==void 0?a[h]:d[h].value);this._rulers=[];this._selection=new l(0,0,!1);this._linksVisible=!1;this._maxLineWidth=this._redrawCount=0;this._maxLineIndex=-1;this._ignoreSelect=!0;this._hasFocus=this._ignoreFocus=!1;this._dragOffset=this._columnX=-1;this._isRangeRects=
(!b.isIE||b.isIE>=9)&&typeof c.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=c.addEventListener;this._autoScrollTimerID=this._autoScrollY=this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;
this._createActions();this._createView()},_isOverOverlayScroll:function(){if(!b.isMac)return{};var a=this._viewDiv.getBoundingClientRect(),c=this._lastMouseMoveX,d=this._lastMouseMoveY;return{vertical:a.top<=d&&d<a.bottom&&a.right-15<=c&&c<a.right,horizontal:a.bottom-15<=d&&d<a.bottom&&a.left<=c&&c<a.right}},_modifyContent:function(a,c){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(a.text===null||a.text===void 0)){var b=this._model;try{if(a._ignoreDOMSelection)this._ignoreDOMSelection=
!0;b.setText(a.text,a.start,a.end)}finally{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!1}c&&(b=this._getSelection(),b.setCaret(a.start+a.text.length),this._setSelection(b,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var c=a.start,b=a.addedCharCount,d=a.removedCharCount,h=a.addedLineCount,e=a.removedLineCount,f=this._getSelection();f.end>c&&(f.end>c&&f.start<c+d?f.setCaret(c+b):(f.start+=b-d,f.end+=b-d),this._setSelection(f,
!1,!1));c=this._model.getLineAtOffset(c);for(b=this._getLineNext();b;){d=b.lineIndex;if(c<=d&&d<=c+e)c===d&&!b.modelChangedEvent&&!b.lineRemoved?(b.modelChangedEvent=a,b.lineChanged=!0):(b.lineRemoved=!0,b.lineChanged=!1,b.modelChangedEvent=null);if(d>c+e)b.lineIndex=d+h-e,b._line.lineIndex=b.lineIndex;b=this._getLineNext(b)}if(!this._wrapMode&&c<=this._maxLineIndex&&this._maxLineIndex<=c+e)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._update()},_onModelChanging:function(a){a.type=
"ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,c){if(this._wrapMode){if(a!==void 0&&c!==void 0)for(var b=a;b<c;b++)this._lineHeight[b]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var a=
this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._resetLineHeight();this._setSelection(new l(0,0,!1),!1,!1);if(this._viewDiv)this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0;var a=this._clientDiv;if(a){for(var c=a.firstChild;c;)c.lineRemoved=!0,c=c.nextSibling;if(b.isFirefox)this._ignoreFocus=!1,(c=this._hasFocus)&&a.blur(),a.contentEditable=
!1,a.contentEditable=!0,c&&a.focus(),this._ignoreFocus=!1}},_scrollView:function(a,c){this._ensureCaretVisible=!1;var b=this._viewDiv;a&&(b.scrollLeft+=a);c&&(b.scrollTop+=c)},_setClipboardText:function(a,d){var h,e=this._parent.ownerDocument,f=this._getWindow();if(f.clipboardData)return h=[],c(a,function(a){h.push(a)},function(){h.push(b.platformDelimiter)}),f.clipboardData.setData("Text",h.join(""));if(d&&d.clipboardData&&(h=[],c(a,function(a){h.push(a)},function(){h.push(b.platformDelimiter)}),
d.clipboardData.setData("text/plain",h.join(""))))return!0;var g=b.createElement(e,"pre");g.style.position="fixed";g.style.left="-1000px";c(a,function(a){g.appendChild(e.createTextNode(a))},function(){g.appendChild(b.createElement(e,"br"))});g.appendChild(e.createTextNode(" "));this._clientDiv.appendChild(g);var l=e.createRange();l.setStart(g.firstChild,0);l.setEndBefore(g.lastChild);var i=f.getSelection();i.rangeCount>0&&i.removeAllRanges();i.addRange(l);var n=this,l=function(){g&&g.parentNode===
n._clientDiv&&n._clientDiv.removeChild(g);n._updateDOMSelection()},i=!1;this._ignoreCopy=!0;try{i=e.execCommand("copy",!1,null)}catch(r){}this._ignoreCopy=!1;if(!i&&d)return f.setTimeout(l,0),!1;l();return!0},_setDOMSelection:function(a,c,d,h){for(var e,f,g,l,i=0,n=a.firstChild,j,q,k=this._model.getLine(a.lineIndex).length;n;){j=n.firstChild;q=j.length;n.ignoreChars&&(q-=n.ignoreChars);if(i+q>c||i+q>=k){e=j;f=c-i;n.ignoreChars&&q>0&&f===q&&(f+=n.ignoreChars);break}i+=q;n=n.nextSibling}for(var i=0,
n=d.firstChild,v=this._model.getLine(d.lineIndex).length;n;){j=n.firstChild;q=j.length;n.ignoreChars&&(q-=n.ignoreChars);if(q+i>h||i+q>=v){g=j;l=h-i;n.ignoreChars&&q>0&&l===q&&(l+=n.ignoreChars);break}i+=q;n=n.nextSibling}this._setDOMFullSelection(a,c,k,d,h,v);if(this._hasFocus)if(c=this._getWindow(),a=this._parent.ownerDocument,c.getSelection){if(c=c.getSelection(),!(c.anchorNode===e&&c.anchorOffset===f&&c.focusNode===g&&c.focusOffset===l||c.anchorNode===g&&c.anchorOffset===l&&c.focusNode===e&&c.focusOffset===
f))a=a.createRange(),a.setStart(e,f),a.setEnd(g,l),this._ignoreSelect=!1,c.rangeCount>0&&c.removeAllRanges(),c.addRange(a),this._ignoreSelect=!0}else if(a.selection)c=a.body,a=b.createElement(a,"div"),c.appendChild(a),c.removeChild(a),a=c.createTextRange(),a.moveToElementText(e.parentNode),a.moveStart("character",f),e=c.createTextRange(),e.moveToElementText(g.parentNode),e.moveStart("character",l),a.setEndPoint("EndToStart",e),this._ignoreSelect=!1,a.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(a,
c,b,d,h){if(this._selDiv1&&(b=this._selDiv1,b.style.width="0px",b.style.height="0px",b=this._selDiv2,b.style.width="0px",b.style.height="0px",b=this._selDiv3,b.style.width="0px",b.style.height="0px",!(a===d&&c===h))){var e=this._model,f=this._getViewPadding(),g=this._clientDiv.getBoundingClientRect(),l=this._viewDiv.getBoundingClientRect(),b=l.left+f.left,i=g.right,f=l.top+f.top,n=g.bottom,l=g=0;this._clipDiv?(l=this._clipDiv.getBoundingClientRect(),g=l.left-this._clipDiv.scrollLeft):(l=this._rootDiv.getBoundingClientRect(),
g=l.left);l=l.top;this._ignoreDOMSelection=!0;var a=(new q(this,a.lineIndex,a)).getBoundingClientRect(e.getLineStart(a.lineIndex)+c,!1),j=a.left,h=(new q(this,d.lineIndex,d)).getBoundingClientRect(e.getLineStart(d.lineIndex)+h,!1),c=h.left;this._ignoreDOMSelection=!1;var e=this._selDiv1,j=Math.min(i,Math.max(b,j)),k=Math.min(n,Math.max(f,a.top)),v=i,d=Math.min(n,Math.max(f,a.bottom));e.style.left=j-g+"px";e.style.top=k-l+"px";e.style.width=Math.max(0,v-j)+"px";e.style.height=Math.max(0,d-k)+"px";
if(a.top===h.top)v=Math.min(c,i),e.style.width=Math.max(0,v-j)+"px";else if(a=Math.min(n,Math.max(f,h.top)),c=Math.min(i,Math.max(b,c)),f=Math.min(n,Math.max(f,h.bottom)),n=this._selDiv3,n.style.left=b-g+"px",n.style.top=a-l+"px",n.style.width=Math.max(0,c-b)+"px",n.style.height=Math.max(0,f-a)+"px",a-d>0)f=this._selDiv2,f.style.left=b-g+"px",f.style.top=d-l+"px",f.style.width=Math.max(0,i-b)+"px",f.style.height=Math.max(0,a-d)+"px"}},_setGrab:function(a){if(a!==this._grabControl)a?(a.setCapture&&
a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null)},_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;if(b.isIE&&a)this._hadFocus=this._hasFocus;var c=this._clientDiv;c.contentEditable=!a;this._hadFocus&&!a&&c.focus();if(this._overlayDiv)this._overlayDiv.style.zIndex=a?"-1":"1";for(a=this._getLineNext();a;){if(a.hasLink)for(c=a.firstChild;c;){var d=c.nextSibling,h=c.viewStyle;h&&h.tagName==="A"&&
a.replaceChild(a._line._createSpan(a,c.firstChild.data,h),c);c=d}a=this._getLineNext(a)}}},_setSelection:function(a,c,b,d){if(a){this._columnX=-1;b===void 0&&(b=!0);var h=this._selection;this._selection=a;c&&this._showCaret(!1,d);b&&this._updateDOMSelection();if(!h.equals(a))this.onSelection({type:"Selection",oldValue:{start:h.start,end:h.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,c,b,d){var h=this._model,e=this._getSelection(),c=this.convert({x:a,y:c},"page","document"),
a=this._getLineIndex(c.y);if(this._clickCount===1){h=this._getLine(a);a=h.getOffset(c.x,c.y-this._getLinePixel(a));h.destroy();if(d&&!b&&e.start<=a&&a<e.end)return this._dragOffset=a,!1;e.extend(a);b||e.collapse()}else(this._clickCount&1)===0?(h=this._getLine(a),a=h.getOffset(c.x,c.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(b=this._doubleClickSelection.start,d=h.getNextOffset(a,"wordend",1)):(b=h.getNextOffset(a,"word",-1),d=this._doubleClickSelection.end):
(b=h.getNextOffset(a,"word",-1),d=h.getNextOffset(b,"wordend",1)),h.destroy()):this._doubleClickSelection?(d=h.getLineAtOffset(this._doubleClickSelection.start),a>=d?(b=h.getLineStart(d),d=h.getLineEnd(a)):(b=h.getLineStart(a),d=h.getLineEnd(d))):(b=h.getLineStart(a),d=h.getLineEnd(a)),e.setCaret(b),e.extend(d);this._setSelection(e,!0,!0);return!0},_setFullSelection:function(a,c){this._fullSelection=a;if(b.isWebkit)this._fullSelection=!0;var d=this._clipDiv||this._rootDiv;if(d)if(this._fullSelection){if(!this._selDiv1&&
this._fullSelection&&!b.isIOS){var h=d.ownerDocument;this._highlightRGB=b.isWebkit?"transparent":"Highlight";var e=b.createElement(h,"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";d.appendChild(e);var f=b.createElement(h,"div");this._selDiv2=f;f.style.position="absolute";f.style.borderWidth="0px";f.style.margin=
"0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width="0px";f.style.height="0px";f.style.zIndex="0";d.appendChild(f);this._selDiv3=h=b.createElement(h,"div");h.style.position="absolute";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.background=this._highlightRGB;h.style.width="0px";h.style.height="0px";h.style.zIndex="0";d.appendChild(h);if(b.isFirefox&&b.isMac){d=this._getWindow().getComputedStyle(h,
null).getPropertyValue("background-color");switch(d){case "rgb(119, 141, 168)":d="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":d="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":d="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":d="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":d="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":d="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":d="rgb(232, 184, 255)";break;default:d="rgb(180, 213, 255)"}this._highlightRGB=d;e.style.background=
d;f.style.background=d;h.style.background=d}c||this._updateDOMSelection()}}else{if(this._selDiv1)d.removeChild(this._selDiv1),this._selDiv1=null;if(this._selDiv2)d.removeChild(this._selDiv2),this._selDiv2=null;if(this._selDiv3)d.removeChild(this._selDiv3),this._selDiv3=null}},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setTabSize:function(a,c){this._tabSize=a;this._customTabSize=void 0;var d=this._clientDiv;if(b.isOpera){if(d)d.style.OTabSize=
this._tabSize+""}else if(b.isWebkit>=537.1){if(d)d.style.tabSize=this._tabSize+""}else if(b.isFirefox>=4){if(d)d.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==8)this._customTabSize=this._tabSize;c||(this.redrawLines(),this._resetLineWidth())},_setThemeClass:function(a,c){this._themeClass=a;var b="textviewContainer";this._themeClass&&(b+=" "+this._themeClass);this._rootDiv.className=b;this._updateStyle(c)},_setWrapMode:function(a,c){this._wrapMode=a;var b=this._clientDiv,d=this._viewDiv;
a?(b.style.whiteSpace="pre-wrap",b.style.wordWrap="break-word",d.style.overflowX="hidden",d.style.overflowY="scroll"):(b.style.whiteSpace="pre",b.style.wordWrap="normal",d.style.overflowX="auto",d.style.overflowY="auto");c||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,c){if(this._clientDiv){var b=this._model,d=this._getSelection(),h=this._getScroll(),e=d.getCaret(),f=d.start,g=d.end,l=b.getLineAtOffset(g),i=Math.max(Math.max(f,b.getLineStart(l)),g-1),b=this._getClientWidth(),
l=this._getClientHeight(),n=b/4,j=this._getBoundsAtOffset(e===f?f:i),q=j.left,v=j.right,k=j.top,p=j.bottom;a&&!d.isEmpty()&&(j=this._getBoundsAtOffset(e===g?f:i),j.top===k?e===f?v=q+Math.min(j.right-q,b):q=v-Math.min(v-j.left,b):e===f?p=k+Math.min(j.bottom-k,l):k=p-Math.min(p-j.top,l));d=0;q<h.x&&(d=Math.min(q-h.x,-n));v>h.x+b&&(d=Math.max(v-h.x-b,n));e=0;k<h.y?e=k-h.y:p>h.y+l&&(e=p-h.y-l);c&&(c>0?e>0&&(e=Math.max(e,c)):e<0&&(e=Math.min(e,c)));return d!==0||e!==0?(this._scrollView(d,e),l!==this._getClientHeight()||
b!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0):!1}},_startIME:function(){if(this._imeOffset===-1){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var c=
this._handlers[a],b=c.target,d=c.type,c=c.handler;typeof b.removeEventListener==="function"?b.removeEventListener(d,c,!1):b.detachEvent("on"+d,c)}this._handlers=null;if(this._mutationObserver)this._mutationObserver.disconnect(),this._mutationObserver=null},_updateDOMSelection:function(){if(!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),c=this._model,b=c.getLineAtOffset(a.start),d=c.getLineAtOffset(a.end),h=this._getLineNext();if(h){var e=this._getLinePrevious(),f;b<h.lineIndex?
(f=h,b=0):b>e.lineIndex?(f=e,b=0):(f=this._getLineNode(b),b=a.start-c.getLineStart(b));d<h.lineIndex?a=0:d>e.lineIndex?(h=e,a=0):(h=this._getLineNode(d),a=a.end-c.getLineStart(d));this._setDOMSelection(f,b,h,a)}}},_update:function(a){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,a=!1;var c=this._clientDiv;if(c){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var d=this._model,
h=this._getScroll(),e=this._getViewPadding(),f=d.getLineCount(),g=this._getLineHeight(),l=this._getClientWidth();if(this._wrapMode)c.style.width=l+"px";var i,n,j,k,p=0,v=0;if(this._lineHeight){for(;v<f;){j=this._getLineHeight(v);if(p+j>h.y)break;p+=j;v++}i=v;n=Math.max(0,i-1);j=d=h.y-p;i>0&&(d+=this._getLineHeight(i-1))}else k=Math.max(0,h.y)/g,i=Math.floor(k),n=Math.max(0,i-1),d=Math.round((k-n)*g),j=Math.round((k-i)*g);this._topIndexY=j;k=this._parent;var F=k.clientWidth,C=k.clientHeight;k=this._getClientHeight();
if(a){n=0;this._leftDiv&&(i=this._leftDiv.getBoundingClientRect(),n=i.right-i.left);i=l;for(this._wrapMode||(i=Math.max(this._maxLineWidth,i));v<f;)j=this._getLineHeight(v,!1),p+=j,v++;f=p}else{for(var l=this._viewDiv,h=Math.min(i+Math.floor((k+j)/g),f-1),G=Math.min(h+1,f-1),g=c.firstChild;g;){j=g.lineIndex;var H=g.nextSibling;if(!(n<=j&&j<=G)||g.lineRemoved||g.lineIndex===-1)this._mouseWheelLine===g?(g.style.display="none",g.lineIndex=-1):c.removeChild(g);g=H}var g=this._getLineNext(),H=l.ownerDocument,
B=H.createDocumentFragment();for(j=n;j<=G;j++)if(!g||g.lineIndex>j)(new q(this,j)).create(B,null);else{B.firstChild&&(c.insertBefore(B,g),B=H.createDocumentFragment());if(g&&g.lineChanged)g=(new q(this,j)).create(B,g),g.lineChanged=!1;g=this._getLineNext(g)}B.firstChild&&c.insertBefore(B,g);if(b.isWebkit&&!this._wrapMode)c.style.width="0x7fffffffpx";g=this._getLineNext();j=k+d;for(H=!1;g;){n=g.lineWidth;if(n===void 0)G=g._line.getBoundingClientRect(),n=g.lineWidth=Math.ceil(G.right-G.left),this._lineHeight&&
(this._lineHeight[g.lineIndex]=Math.ceil(G.bottom-G.top));if(this._lineHeight&&!H&&(j-=this._lineHeight[g.lineIndex],j<0))h=g.lineIndex,H=!0;if(!this._wrapMode){if(n>=this._maxLineWidth)this._maxLineWidth=n,this._maxLineIndex=g.lineIndex;if(this._checkMaxLineIndex===g.lineIndex)this._checkMaxLineIndex=-1}if(g.lineIndex===i)this._topChild=g;if(g.lineIndex===h)this._bottomChild=g;g=this._getLineNext(g)}if(this._checkMaxLineIndex!==-1&&(j=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=j&&j<f)){g=
new q(this,j);G=g.getBoundingClientRect();n=G.right-G.left;if(n>=this._maxLineWidth)this._maxLineWidth=n,this._maxLineIndex=j;g.destroy()}for(;v<f;)j=this._getLineHeight(v,v<=h),p+=j,v++;f=p;this._updateRuler(this._leftDiv,i,h);this._updateRuler(this._rightDiv,i,h);n=0;this._leftDiv&&(i=this._leftDiv.getBoundingClientRect(),n=i.right-i.left);h=0;this._rightDiv&&(h=this._rightDiv.getBoundingClientRect(),h=h.right-h.left);l.style.left=n+"px";l.style.right=h+"px";h=this._scrollDiv;h.style.height=f+"px";
p=l=this._getClientWidth();this._wrapMode||(p=Math.max(this._maxLineWidth,p));i=p;if((!b.isIE||b.isIE>=9)&&this._maxLineWidth>l)p+=e.right+e.left;h.style.width=p+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width=p+"px";h=this._getScroll();p=k+e.top+e.bottom;this._updateRulerSize(this._leftDiv,p);this._updateRulerSize(this._rightDiv,p)}if(this._vScrollDiv)p=k-8,v=Math.max(15,Math.ceil(Math.min(1,p/(f+e.top+e.bottom))*p)),this._vScrollDiv.style.left=n+l-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,
h.y*p/f))+"px",this._vScrollDiv.style.height=v+"px";if(!this._wrapMode&&this._hScrollDiv)p=l-8,v=Math.max(15,Math.ceil(Math.min(1,p/(this._maxLineWidth+e.left+e.right))*p)),this._hScrollDiv.style.left=n+Math.floor(Math.max(0,Math.floor(h.x*p/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=k-9+"px",this._hScrollDiv.style.width=v+"px";G=h.x;j=this._clipDiv;p=this._overlayDiv;if(j){j.scrollLeft=G;v=n+e.left;g=e.top;a=l;n=k;G=0;H=-d;if(h.x===0)v-=e.left,a+=e.left,G=e.left;h.x+l===i&&(a+=e.right);
h.y===0&&(g-=e.top,n+=e.top,H+=e.top);h.y+k===f&&(n+=e.bottom);j.style.left=v+"px";j.style.top=g+"px";e=this._isOverOverlayScroll();j.style.right=F-a-v+(this._overlayScrollTimer&&e.vertical?15:0)+"px";j.style.bottom=C-n-g+(this._overlayScrollTimer&&e.horizontal?15:0)+"px";c.style.left=G+"px";c.style.top=H+"px";c.style.width=i+"px";c.style.height=k+d+"px";if(p)p.style.left=c.style.left,p.style.top=c.style.top,p.style.width=c.style.width,p.style.height=c.style.height}else{v=G;g=d;F=G+l;C=d+k;v===0&&
(v-=e.left);g===0&&(g-=e.top);F===i&&(F+=e.right);h.y+k===f&&(C+=e.bottom);c.style.clip="rect("+g+"px,"+F+"px,"+C+"px,"+v+"px)";c.style.left=-G+n+e.left+"px";c.style.width=(b.isWebkit?i:l+G)+"px";if(!a)c.style.top=-d+e.top+"px",c.style.height=k+d+"px";if(p&&(p.style.clip=c.style.clip,p.style.left=c.style.left,p.style.width=c.style.width,!a))p.style.top=c.style.top,p.style.height=c.style.height}this._updateDOMSelection();c=this._ensureCaretVisible;this._ensureCaretVisible=!1;k!==this._getClientHeight()&&
(this._update(),c&&this._showCaret())}}},_updateRulerSize:function(a,c){if(a){for(var b=this._topIndexY,d=this._getLineHeight(),h=a.firstChild.rows[0].cells,e=0;e<h.length;e++){var f=h[e].firstChild,g=d;f._ruler.getOverview()==="page"&&(g+=b);f.style.top=-g+"px";f.style.height=c+g+"px"}a.style.height=c+"px"}},_updateRuler:function(a,c,d){if(a)for(var a=a.firstChild.rows[0].cells,h=this._parent.ownerDocument,e=this._getLineHeight(),f=this._getViewPadding(),l=0;l<a.length;l++){var i=a[l].firstChild,
n=i._ruler;i.rulerChanged&&g(n.getRulerStyle(),i);var j,q=i.firstChild;q?(j=q,q=q.nextSibling):(j=b.createElement(h,"div"),j.style.visibility="hidden",i.appendChild(j));var k,p;if(i.rulerChanged&&j){k=-1;if(p=n.getWidestAnnotation())if(g(p.style,j),p.html)j.innerHTML=p.html;j.lineIndex=k;j.style.height=e+f.top+"px"}var v,F;if(n.getOverview()==="page"){for(n=n.getAnnotations(c,d+1);q;)k=q.lineIndex,p=q.nextSibling,(!(c<=k&&k<=d)||q.lineChanged)&&i.removeChild(q),q=p;q=i.firstChild.nextSibling;F=h.createDocumentFragment();
for(k=c;k<=d;k++)if(!q||q.lineIndex>k){v=b.createElement(h,"div");if(p=n[k]){g(p.style,v);if(p.html)v.innerHTML=p.html;v.annotation=p}v.lineIndex=k;v.style.height=this._getLineHeight(k)+"px";F.appendChild(v)}else if(F.firstChild&&(i.insertBefore(F,q),F=h.createDocumentFragment()),q)q=q.nextSibling;F.firstChild&&i.insertBefore(F,q)}else{p=this._getClientHeight();k=this._model.getLineCount();q=p+f.top+f.bottom-2*this._metrics.scrollWidth;j=e*k<q?e:q/k;if(i.rulerChanged){for(p=i.childNodes.length;p>
1;)i.removeChild(i.lastChild),p--;n=n.getAnnotations(0,k);F=h.createDocumentFragment();for(var C in n)if(k=C>>>0,!(k<0)){v=b.createElement(h,"div");p=n[C];g(p.style,v);v.style.position="absolute";v.style.top=this._metrics.scrollWidth+e+Math.floor(k*j)+"px";if(p.html)v.innerHTML=p.html;v.annotation=p;v.lineIndex=k;F.appendChild(v)}i.appendChild(F)}else if(i._oldTrackHeight!==q)for(v=i.firstChild?i.firstChild.nextSibling:null;v;)v.style.top=this._metrics.scrollWidth+e+Math.floor(v.lineIndex*j)+"px",
v=v.nextSibling;i._oldTrackHeight=q}i.rulerChanged=!1}},_updateStyle:function(a){if(!a&&b.isIE)this._rootDiv.style.lineHeight="normal";var c=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=b.isIE?c.lineHeight-(c.lineTrim.top+c.lineTrim.bottom)+"px":"normal";a||(this.redraw(),this._resetLineWidth())}};i.EventTarget.addMixin(p.prototype);return{TextView:p}});
define("orion/editor/tooltip",["i18n!orion/editor/nls/messages","orion/editor/textView","orion/editor/textModel","orion/editor/projectionTextModel","orion/editor/util"],function(j,k,i,b,f){function g(b){this._view=b;this._create(b.getOptions("parent").ownerDocument);b.addEventListener("Destroy",this,this.destroy)}g.getTooltip=function(b){if(!b._tooltip)b._tooltip=new g(b);return b._tooltip};g.prototype={_create:function(b){if(!this._tooltipDiv){var d=this._tooltipDiv=f.createElement(b,"div");d.className=
"textviewTooltip";d.setAttribute("aria-live","assertive");d.setAttribute("aria-atomic","true");var c=this._tooltipContents=f.createElement(b,"div");d.appendChild(c);b.body.appendChild(d);this.hide()}},_getWindow:function(){var b=this._tooltipDiv.ownerDocument;return b.defaultView||b.parentWindow},destroy:function(){if(this._tooltipDiv){this.hide();var b=this._tooltipDiv.parentNode;b&&b.removeChild(this._tooltipDiv);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 b=this._getWindow();if(this._showTimeout)b.clearTimeout(this._showTimeout),this._showTimeout=null;if(this._hideTimeout)b.clearTimeout(this._hideTimeout),this._hideTimeout=null;if(this._fadeTimeout)b.clearInterval(this._fadeTimeout),this._fadeTimeout=null},isVisible:function(){return this._tooltipDiv&&this._tooltipDiv.style.visibility==="visible"},setTarget:function(b,
d){if(this.target!==b&&(this._target=b,this.hide(),b)){var c=this;if(d===0)c.show(!0);else{var a=this._getWindow();c._showTimeout=a.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,a=this._tooltipContents;c.style.left=c.style.right=c.style.width=c.style.height=a.style.width=a.style.height="auto";var h=d.contents;h instanceof Array&&(h=this._getAnnotationContents(h));if(typeof h==="string")a.innerHTML=h;
else if(this._isNode(h))a.appendChild(h);else if(h instanceof b.ProjectionTextModel){var f=this._view,g=f.getOptions();g.wrapMode=!1;g.parent=a;var i=g.themeClass;i?((i=i.replace("tooltip",""))&&(i=" "+i),i="tooltip"+i):i="tooltip";g.themeClass=i;g=this._contentsView=new k.TextView(g);g._clientDiv.contentEditable=!1;g.addEventListener("LineStyle",function(a){f.onLineStyle(a)});g.setModel(h);h=g.computeSize();a.style.width=h.width+20+"px";a.style.height=h.height+"px";g.resize()}else return;a=c.ownerDocument.documentElement;
d.anchor==="right"?(h=a.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=a.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=a.clientHeight-h-10+"px";c.style.opacity="1";c.style.visibility="visible";if(e){var j=this,
m=this._getWindow();j._hideTimeout=m.setTimeout(function(){var a=parseFloat(j._getNodeStyle(c,"opacity","1"));j._fadeTimeout=m.setInterval(function(){c.style.visibility==="visible"&&a>0?(a-=0.1,c.style.opacity=a):j.hide()},50)},5E3)}}}},_getAnnotationContents:function(e){function d(c){var b=c.title;if(b==="")return null;var d="<div>";c.html&&(d+=c.html+"&nbsp;");if(!b)b=c.end,c=a.getLineStart(a.getLineAtOffset(c.start)),b=a.getLineEnd(a.getLineAtOffset(b),!0),b=a.getText(c,b);b=b.replace(/</g,"&lt;").replace(/>/g,
"&gt;");d+="<span style='vertical-align:middle;'>"+b+"</span><div>";return d}if(e.length===0)return null;var c=this._view.getModel(),a=c.getBaseModel?c.getBaseModel():c;if(e.length===1)if(c=e[0],c.title!==void 0)return d(c);else{var e=new b.ProjectionTextModel(a),h=a.getLineStart(a.getLineAtOffset(c.start)),f=a.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(b,d,c){var a;if(b&&(a=b.style[d],!a))if(b.currentStyle){for(a=0;(a=d.indexOf("-",a))!==-1;)d=d.substring(0,a)+d.substring(a+1,a+2).toUpperCase()+d.substring(a+2);a=b.currentStyle[d]}else a=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(d):null;return a||c},_isNode:function(b){return typeof Node==="object"?b instanceof Node:b&&typeof b==="object"&&typeof b.nodeType==="number"&&typeof b.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,k,i,b,f,g){function e(a){this._textViewFactory=a.textViewFactory;this._undoStackFactory=a.undoStackFactory;this._textDNDFactory=a.textDNDFactory;this._annotationFactory=a.annotationFactory;this._foldingRulerFactory=a.foldingRulerFactory;this._lineNumberRulerFactory=a.lineNumberRulerFactory;this._contentAssistFactory=
a.contentAssistFactory;this._keyBindingFactory=a.keyBindingFactory;this._statusReporter=a.statusReporter;this._domNode=a.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(a){var c=this,b=Array.prototype.slice.call(arguments,1);return b.length?function(){return arguments.length?c.apply(a,b.concat(Array.prototype.slice.call(arguments))):
c.apply(a,b)}:function(){return arguments.length?c.apply(a,arguments):c.call(a)}}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 a=this._textView.getModel();a.getBaseModel&&(a=a.getBaseModel());return a},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(a){if(this._annotationRulerVisible!==a&&(this._annotationRulerVisible=a,this._annotationRuler)){var c=this._textView;a?c.addRuler(this._annotationRuler,0):c.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(a){if(this._foldingRulerVisible!==a&&(this._foldingRulerVisible=a,this._foldingRuler)){var c=this._textView;c.getModel().getBaseModel&&(a?c.addRuler(this._foldingRuler,100):c.removeRuler(this._foldingRuler))}},setDirty:function(a){if(this._dirty!==
a)this._dirty=a,this.onDirtyChanged({type:"DirtyChanged"})},setLineNumberRulerVisible:function(a){if(this._lineNumberRulerVisible!==a&&(this._lineNumberRulerVisible=a,this._lineNumberRuler)){var c=this._textView;a?c.addRuler(this._lineNumberRuler,1):c.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(a){if(this._overviewRulerVisible!==a&&(this._overviewRulerVisible=a,this._overviewRuler)){var c=this._textView;a?c.addRuler(this._overviewRuler):c.removeRuler(this._overviewRuler)}},
mapOffset:function(a,c){var b=this._textView.getModel();b.getBaseModel&&(a=b.mapOffset(a,c));return a},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var a=this._textView,c=a.getSelection(),a=a.getModel();if(a.getBaseModel)c.start=a.mapOffset(c.start),c.end=a.mapOffset(c.end);return c},getText:function(a,c){var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b.getText(a,c)},_expandOffset:function(a){var c=this._textView.getModel(),
b=this._annotationModel;if(b&&c.getBaseModel)for(a=b.getAnnotations(a,a+1);a.hasNext();)c=a.next(),c.type===f.AnnotationType.ANNOTATION_FOLDING&&c.expand&&(c.expand(),b.modifyAnnotation(c))},setCaretOffset:function(a){var c=this._textView,b=c.getModel();b.getBaseModel&&(this._expandOffset(a),a=b.mapOffset(a,!0));c.setCaretOffset(a)},setText:function(a,c,b){var d=this._textView,e=d.getModel();e.getBaseModel&&(c!==void 0&&(this._expandOffset(c),c=e.mapOffset(c,!0)),b!==void 0&&(this._expandOffset(b),
b=e.mapOffset(b,!0)));d.setText(a,c,b)},setFoldingEnabled:function(a){this.setFoldingRulerVisible(a)},setSelection:function(a,c,b){var d=this._textView,e=d.getModel();e.getBaseModel&&(this._expandOffset(a),this._expandOffset(c),a=e.mapOffset(a,!0),c=e.mapOffset(c,!0));d.setSelection(a,c,b)},moveSelection:function(a,b,d,e){var f=this._textView;this.setSelection(a,b||a,!1);var b=f.getTopPixel(),g=f.getBottomPixel(),a=this.getModel().getLineAtOffset(a),a=f.getLinePixel(a);a<b||a>g?(g=Math.max(0,a-Math.floor((a<
b?3:1)*(g-b)/4)),(new c({node:f,duration:300,curve:[b,g],onAnimate:function(a){f.setTopPixel(Math.floor(a))},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(a,c,b){this._statusReporter&&this._statusReporter(a,c,b)},_getTooltipInfo:function(a,c){var b=this._textView,d=this.getAnnotationModel();if(!d)return null;var e=this._annotationStyler;
if(!e)return null;var f=b.getOffsetAtLocation(a,c);if(f===-1)return null;f=this.mapOffset(f);e=e.getAnnotationsByType(d,f,f+1);d=[];for(f=0;f<e.length;f++)e[f].rangeStyle&&d.push(e[f]);if(d.length===0)return null;b=b.convert({x:a,y:c},"document","page");return{contents:d,anchor:"left",x:b.x+10,y:b.y+20}},_highlightCurrentLine:function(a,c){var b=this._annotationModel;if(b){var d=this._textView.getModel(),e=c?d.getLineAtOffset(c.start):-1,g=d.getLineAtOffset(a.start),i=a.start===a.end,j=!c||c.start===
c.end,o=d.getLineStart(g),w=d.getLineEnd(g);d.getBaseModel&&(o=d.mapOffset(o),w=d.mapOffset(w));d=this._currentLineAnnotation;if(!(e===g&&j&&i&&d&&d.start===o&&d.end===w)){var e=d?[d]:null,s;i&&(d=f.AnnotationType.createAnnotation(f.AnnotationType.ANNOTATION_CURRENT_LINE,o,w),s=[d]);this._currentLineAnnotation=d;b.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 a=this._contentAssistFactory.createContentAssistMode(this);this._keyModes.push(a);this._contentAssist=a.getContentAssist()}var c=this,d=this._textView,e=this;this._listener={onModelChanged:function(){e.checkDirty()},onMouseOver:function(a){e._listener.onMouseMove(a)},onMouseMove:function(a){var c=b.Tooltip.getTooltip(d);c&&c.setTarget({x:a.x,y:a.y,getTooltipInfo:function(){return e._getTooltipInfo(this.x,this.y)}})},
onMouseOut:function(){var a=b.Tooltip.getTooltip(d);a&&a.setTarget(null)},onSelection:function(a){e._updateCursorStatus();e._highlightCurrentLine(a.newValue,a.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 k.KeyBinding(27),"cancelMode");d.setAction("cancelMode",function(){for(var a=!1,c=0;c<this._keyModes.length;c++)this._keyModes[c].isActive()&&(a=this._keyModes[c].cancel()||a);return a}.bind(this),{name:j.cancelMode});d.setAction("lineUp",function(){for(var a=0;a<this._keyModes.length;a++)if(this._keyModes[a].isActive())return this._keyModes[a].lineUp();return!1}.bind(this));d.setAction("lineDown",function(){for(var a=0;a<this._keyModes.length;a++)if(this._keyModes[a].isActive())return this._keyModes[a].lineDown();
return!1}.bind(this));d.setAction("enter",function(){for(var a=0;a<this._keyModes.length;a++)if(this._keyModes[a].isActive())return this._keyModes[a].enter();return!1}.bind(this));a=function(a){if(a!==void 0&&a!==-1){for(var b=this.getView().getModel(),d=this.getAnnotationModel(),e=c.mapOffset(b.getLineStart(a)),a=c.mapOffset(b.getLineEnd(a)),b=d.getAnnotations(e,a),g=null;b.hasNext();){var l=b.next();if(l.type===f.AnnotationType.ANNOTATION_BOOKMARK){g=l;break}}g?d.removeAnnotation(g):(g=f.AnnotationType.createAnnotation(f.AnnotationType.ANNOTATION_BOOKMARK,
e,a),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(a){if(a!==void 0&&a!==-1)for(var b=this.getView().getModel(),d=this.getAnnotationModel(),e=c.mapOffset(b.getLineStart(a)),a=c.mapOffset(b.getLineEnd(a)),a=d.getAnnotations(e,a);a.hasNext();)if(d=a.next(),this.isAnnotationTypeVisible(d.type)){a=c.getModel();c.onGotoLine(a.getLineAtOffset(e),d.start-e,d.end-e);break}},i.onDblClick=a,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(a){a!==void 0&&(a=d.getModel().getLineStart(a),c.moveSelection(c.mapOffset(a)))},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=a,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 a=this._textView;if(a)a.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:a})},_updateCursorStatus:function(){var a=this.getModel(),c=this.getCaretOffset(),b=a.getLineAtOffset(c),a=a.getLineStart(b);c-=a;for(a=0;a<this._keyModes.length;a++){var d=this._keyModes[a];
if(d.isActive()&&d.isStatusActive&&d.isStatusActive())return}this.reportStatus(g.formatMessage(j.lineColumn,b+1,c+1))},showProblems:function(a){var c=this._annotationModel;if(c){for(var b=[],d=[],e=c.getTextModel(),g=c.getAnnotations(0,e.getCharCount()),i;g.hasNext();)i=g.next(),(i.type===f.AnnotationType.ANNOTATION_ERROR||i.type===f.AnnotationType.ANNOTATION_WARNING)&&b.push(i);if(a)for(g=0;g<a.length;g++)if(i=a[g]){var j=i.description.replace(/'/g,"&#39;").replace(/"/g,"&#34;"),o=e.getLineStart(i.line-
1);i=f.AnnotationType.createAnnotation(i.severity==="error"?f.AnnotationType.ANNOTATION_ERROR:f.AnnotationType.ANNOTATION_WARNING,o+i.start-1,o+i.end,j);d.push(i)}c.replaceAnnotations(b,d)}},showOccurrences:function(a){var c=this._annotationModel;if(c){for(var b=[],d=[],e=c.getTextModel(),g=c.getAnnotations(0,e.getCharCount()),i;g.hasNext();)i=g.next(),(i.type===f.AnnotationType.ANNOTATION_READ_OCCURRENCE||i.type===f.AnnotationType.ANNOTATION_WRITE_OCCURRENCE)&&b.push(i);if(a)for(g=0;g<a.length;g++)if(i=
a[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)}c.replaceAnnotations(b,d)}},showSelection:function(a,c,b,d,e){typeof a==="number"?(typeof c!=="number"&&(c=a),this.moveSelection(a,c)):typeof b==="number"&&(a=this.getModel().getLineStart(b-1),typeof d==="number"&&(a+=d),typeof e!=="number"&&(e=0),this.moveSelection(a,a+e))},
setInput:function(a,c,b,d){this._title=a;this._textView&&(d?(this._undoStack.markClean(),this.checkDirty()):(c?this._textView.setText(c):b!==null&&b!==void 0&&(this._textView.setText(b),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection())),this._undoStack.reset(),this.checkDirty(),this._textView.focus()));this.onInputChanged({type:"InputChanged",title:a,message:c,contents:b,contentsSaved:d})},onInputChanged:function(a){return this.dispatchEvent(a)},
onGotoLine:function(a,c,b){if(this._textView){var d=this.getModel(),e=d.getLineStart(a),f=0;b===void 0&&(b=0);typeof c==="string"?(a=d.getLine(a).indexOf(c),a!==-1&&(f=a,b=f+c.length)):(f=c,c=d.getLineEnd(a)-e,f=Math.min(f,c),b=Math.min(b,c));this.moveSelection(e+f,e+b)}},onDirtyChanged:function(a){return this.dispatchEvent(a)}};i.EventTarget.addMixin(e.prototype);c=function(){function a(a){this.options=a}a.prototype.play=function(){var a=typeof this.options.duration==="number"?this.options.duration:
350,c=this.options.easing||this.defaultEasing,b=this.options.onAnimate||function(){},d=this.options.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)/a;s<1?(s=c(s),g=e+s*f,b(g)):(clearInterval(i),d())},typeof this.options.rate==="number"?this.options.rate:20)};a.prototype.defaultEasing=function(a){return Math.sin(a*(Math.PI/2))};return a}();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,k,i,b){function f(a,c,b,d){this._location=c||"left";this._overview=b||"page";this._rulerStyle=d;this._view=null;var e=this;this._listener={onTextModelChanged:function(a){e._onTextModelChanged(a)},onAnnotationModelChanged:function(a){e._onAnnotationModelChanged(a)}};this.setAnnotationModel(a)}function g(a,c,b,d,e){f.call(this,a,c,"page",b);this._oddStyle=
d||{style:{backgroundColor:"white"}};this._evenStyle=e||{style:{backgroundColor:"white"}};this._numOfDigits=0}function e(a,c,b){f.call(this,a,c,"page",b)}function d(a,c,b){f.call(this,a,c,"document",b)}function c(a,c,b){e.call(this,a,c,b)}f.prototype={getAnnotations:function(a,c){var b=this._annotationModel;if(!b)return[];var d=this._view.getModel(),e=d.getLineStart(a),f=d.getLineEnd(c-1),g=d;d.getBaseModel&&(g=d.getBaseModel(),e=d.mapOffset(e),f=d.mapOffset(f));for(var i=[],b=this.getAnnotationsByType(b,
e,f),e=0;e<b.length;e++)for(var f=b[e],j=g.getLineAtOffset(f.start),w=g.getLineAtOffset(Math.max(f.start,f.end-1)),s=j;s<=w;s++){var k=s;if(d!==g){k=g.getLineStart(s);k=d.mapOffset(k,!0);if(k===-1)continue;k=d.getLineAtOffset(k)}if(a<=k&&k<c){var u=this._mergeAnnotation(i[k],f,s-j,w-j+1);u&&(i[k]=u)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var A in i)i[A]._multiple&&(i[A].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(a){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=a)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(a){this._multiAnnotation=
a},setMultiAnnotationOverlay:function(a){this._multiAnnotationOverlay=a},setView:function(a){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=a;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(){},onDblClick:function(){},onMouseMove:function(a,c){var b=i.Tooltip.getTooltip(this._view);if(b&&!(b.isVisible()&&this._tooltipLineIndex===a)){this._tooltipLineIndex=
a;var d=this;b.setTarget({y:c.clientY,getTooltipInfo:function(){return d._getTooltipInfo(d._tooltipLineIndex,this.y)}})}},onMouseOver:function(a,c){this.onMouseMove(a,c)},onMouseOut:function(){var a=i.Tooltip.getTooltip(this._view);a&&a.setTarget(null)},_getTooltipInfo:function(a,c){if(a!==void 0){var b=this._view,d=b.getModel(),e=this._annotationModel,f=[];if(e){var f=d.getLineStart(a),g=d.getLineEnd(a);d.getBaseModel&&(f=d.mapOffset(f),g=d.mapOffset(g));f=this.getAnnotationsByType(e,f,g)}e=this._getTooltipContents(a,
f);if(!e)return null;e={contents:e,anchor:this.getLocation()};f=b.getClientArea();f.y=this.getOverview()==="document"?b.convert({y:c},"view","document").y:b.getLocationAtOffset(d.getLineStart(a)).y;b.convert(f,"document","page");e.x=f.x;e.y=f.y;e.anchor==="right"&&(e.x+=f.width);return e}},_getTooltipContents:function(a,c){return c},_onAnnotationModelChanged:function(a){function c(a){for(var h=0;h<a.length;h++)if(e.isAnnotationTypeVisible(a[h].type)){var f=a[h].start,g=a[h].end;d.getBaseModel&&(f=
d.mapOffset(f,!0),g=d.mapOffset(g,!0));f!==-1&&g!==-1&&b.redrawLines(d.getLineAtOffset(f),d.getLineAtOffset(Math.max(f,g-1))+1,e)}}var b=this._view;if(b){var d=b.getModel(),e=this,f=d.getLineCount();a.textModelChangedEvent?(a=a.textModelChangedEvent.start,d.getBaseModel&&(a=d.mapOffset(a,!0)),a=d.getLineAtOffset(a),b.redrawLines(a,f,e)):(c(a.added),c(a.removed),c(a.changed))}},_mergeAnnotation:function(a,c,b){a||(a={});if(b===0)if(a.html&&c.html){if(c.html!==a.html&&!a._multiple&&this._multiAnnotation)a.html=
this._multiAnnotation.html;a._multiple=!0}else a.html=c.html;a.style=this._mergeStyle(a.style,c.style);return a},_mergeStyle:function(a,c){if(c){a||(a={});a.styleClass&&c.styleClass&&a.styleClass!==c.styleClass?a.styleClass+=" "+c.styleClass:a.styleClass=c.styleClass;var b;if(c.style){if(!a.style)a.style={};for(b in c.style)a.style[b]||(a.style[b]=c.style[b])}if(c.attributes){if(!a.attributes)a.attributes={};for(b in c.attributes)a.attributes[b]||(a.attributes[b]=c.attributes[b])}}return a}};k.AnnotationTypeList.addMixin(f.prototype);
g.prototype=new f;g.prototype.getAnnotations=function(a,c){for(var b=f.prototype.getAnnotations.call(this,a,c),d=this._view.getModel(),e=a;e<c;e++){var g=e&1?this._oddStyle:this._evenStyle,i=e;d.getBaseModel&&(i=d.getLineStart(i),i=d.getBaseModel().getLineAtOffset(d.mapOffset(i)));b[e]||(b[e]={});b[e].html=i+1+"";if(!b[e].style)b[e].style=g}return b};g.prototype.getWidestAnnotation=function(){var a=this._view.getModel().getLineCount();return this.getAnnotations(a-1,a)[a-1]};g.prototype._onTextModelChanged=
function(a){var a=a.start,c=this._view.getModel(),b=((c.getBaseModel?c.getBaseModel().getLineCount():c.getLineCount())+"").length;if(this._numOfDigits!==b)this._numOfDigits=b,this._view.redrawLines(c.getLineAtOffset(a),c.getLineCount(),this)};e.prototype=new f;d.prototype=new f;d.prototype.getRulerStyle=function(){var a={style:{lineHeight:"1px",fontSize:"1px"}};return a=this._mergeStyle(a,this._rulerStyle)};d.prototype.onClick=function(a){a!==void 0&&this._view.setTopIndex(a)};d.prototype._getTooltipContents=
function(a,c){if(c.length===0){var d=this._view.getModel(),e=a;d.getBaseModel&&(e=d.getLineStart(e),e=d.getBaseModel().getLineAtOffset(d.mapOffset(e)));return b.formatMessage(j.line,e+1)}return f.prototype._getTooltipContents.call(this,a,c)};d.prototype._mergeAnnotation=function(a,c,b,d){if(b===0){if(!a)a={html:"&nbsp;",style:{style:{height:3*d+"px"}}},a.style=this._mergeStyle(a.style,c.overviewStyle);return a}};c.prototype=new e;c.prototype.onClick=function(a){if(a!==void 0){var c=this._annotationModel;
if(c){var b=this._view.getModel(),d=b.getLineStart(a),a=b.getLineEnd(a,!0);b.getBaseModel&&(d=b.mapOffset(d),a=b.mapOffset(a),b=b.getBaseModel());for(var e,c=c.getAnnotations(d,a);!e&&c.hasNext();)a=c.next(),this.isAnnotationTypeVisible(a.type)&&(e=a);e&&b.getLineAtOffset(e.start)===b.getLineAtOffset(d)&&((b=i.Tooltip.getTooltip(this._view))&&b.setTarget(null),e.expanded?e.collapse():e.expand(),this._annotationModel.modifyAnnotation(e))}}};c.prototype._getTooltipContents=function(a,c){return c.length===
1&&c[0].expanded?null:e.prototype._getTooltipContents.call(this,a,c)};c.prototype._onAnnotationModelChanged=function(a){function c(a){for(g=0;g<a.length;g++)if(f.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;d.getBaseModel&&(b=d.mapOffset(b,!0));b!==-1&&(j=Math.min(j,d.getLineAtOffset(b)))}}if(a.textModelChangedEvent)e.prototype._onAnnotationModelChanged.call(this,a);else{var b=this._view;if(b){var d=b.getModel(),f=this,g,i=d.getLineCount(),j=i;c(a.added);c(a.removed);c(a.changed);a=b.getRulers();
for(g=0;g<a.length;g++)b.redrawLines(j,i,a[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,k,i,b,f,g,e,d,c){function a(){}function h(){}function l(){}function n(){}function q(){}function p(a,c,b){this.editor=a;this.textView=a.getTextView();this.undoStack=c;this._incrementalFindActive=!1;this._incrementalFindSuccess=!0;this._incrementalFindIgnoreSelection=
!1;this._incrementalFindPrefix="";this._searcher=b;this._lastEditLocation=null;this.init()}function m(a,c,b,d){this.editor=a;this.textView=a.getTextView();this.undoStack=c;this.contentAssist=b;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",this.contentAssistProposalApplied.bind(this));this.init()}function t(a){this.editor=a;this.textView=a.getTextView();this.linkedModeActive=!1;this.linkedModePositions=[];this.linkedModeEscapePosition=this.linkedModeCurrentPositionIndex=
0;this.linkedModeListener={onVerify:function(a){for(var c=!1,b=0,d=0;d<this.linkedModePositions.length;++d){var e=this.linkedModePositions[d];if(c)e.offset+=b;else if(a.start>=e.offset&&a.end<=e.offset+e.length)c=e.length,e.length=a.start-e.offset+a.text.length+(e.offset+e.length-a.end),b=e.length-c,c=!0}c?this.linkedModeEscapePosition+=b:this.cancel()}.bind(this)}}a.prototype={createUndoStack:function(a){var a=a.getTextView(),c=new k.UndoStack(a,200);a.setAction("undo",function(){c.undo();return!0},
{name:j.undo});a.setAction("redo",function(){c.redo();return!0},{name:j.redo});return c}};h.prototype={createLineNumberRuler:function(a){return new b.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};l.prototype={createFoldingRuler:function(a){return new b.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};n.prototype={createAnnotationModel:function(a){return new f.AnnotationModel(a)},createAnnotationStyler:function(a,c){return new f.AnnotationStyler(a,
c)},createAnnotationRulers:function(a){var c=new b.AnnotationRuler(a,"left",{styleClass:"ruler annotations"}),a=new b.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:c,overviewRuler:a}}};q.prototype={createTextDND:function(a,c){return new e.TextDND(a.getTextView(),c)}};p.prototype={init:function(){var a=this;this._incrementalFindListener={onVerify:function(b){var e=a.editor,h=e.getModel(),f=e.mapOffset(b.start),g=e.mapOffset(b.end),f=h.getText(f,g),h=a._incrementalFindPrefix;
if((h=h.match(RegExp("^"+d.escape(f),"i")))&&h.length>0)h=a._incrementalFindPrefix+=b.text,a.editor.reportStatus(c.formatMessage(j.incrementalFind,h)),f=e.getSelection().start,(f=e.getModel().find({string:h,start:f,caseInsensitive:h.toLowerCase()===h}).next())?(a._incrementalFindSuccess=!0,a._incrementalFindIgnoreSelection=!0,e.moveSelection(f.start,f.end),a._incrementalFindIgnoreSelection=!1):(e.reportStatus(c.formatMessage(j.incrementalFindNotFound,h),"error"),a._incrementalFindSuccess=!1),b.text=
null},onSelection:function(){a._incrementalFindIgnoreSelection||a.toggleIncrementalFind()}};this._lastEditListener={onModelChanged:function(c){if(a.editor.isDirty())a._lastEditLocation=c.start+c.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 a=this.textView.getSelection();a.start<a.end?this._searcher.findNext(!0,
this.textView.getText(a.start,a.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 a=this.textView.getSelection();a.start<a.end?this._searcher.findNext(!1,this.textView.getText(a.start,a.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 a=this.editor;if(this._incrementalFindActive){var b=this._incrementalFindPrefix;if(b.length!==0){var d;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)}}else a.setCaretOffset(a.getCaretOffset()),this.toggleIncrementalFind();return!0}.bind(this),{name:j.incrementalFindKey});this.textView.setAction("deletePrevious",function(){if(this._incrementalFindActive){var a=this.editor,b=this._incrementalFindPrefix,b=this._incrementalFindPrefix=b.substring(0,b.length-1);if(b.length===0)return this._incrementalFindIgnoreSelection=
this._incrementalFindSuccess=!0,a.setCaretOffset(a.getSelection().start),this._incrementalFindIgnoreSelection=!1,this.toggleIncrementalFind(),!0;a.reportStatus(c.formatMessage(j.incrementalFind,b));var d=a.getModel().find({string:b,start:a.getCaretOffset()-b.length-1,reverse:!0,caseInsensitive:b.toLowerCase()===b}).next();d?(this._incrementalFindIgnoreSelection=this._incrementalFindSuccess=!0,a.moveSelection(d.start,d.end),this._incrementalFindIgnoreSelection=!1):a.reportStatus(c.formatMessage(j.incrementalFindNotFound,
b),"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 a=this.editor,c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),e=c.getLineAtOffset(b.end>b.start?b.end-1:b.end);if(d!==e){var h=[];h.push("");for(var f=d;f<=e;f++)h.push(c.getLine(f,!0));var f=c.getLineStart(d),c=c.getLineEnd(e,!0),g=this.textView.getOptions("tabSize","expandTab"),g=g.expandTab?Array(g.tabSize+
1).join(" "):"\t";a.setText(h.join(g),f,c);a.setSelection(f===b.start?b.start:b.start+g.length,b.end+(e-d+1)*g.length);return!0}a=a.getKeyModes();for(b=0;b<a.length;b++)if(a[b].isActive())return a[b].tab();return!1}}.bind(this));this.textView.setAction("shiftTab",function(){if(this.textView.getOptions("readonly"))return!1;if(this.textView.getOptions("tabMode")){for(var a=this.editor,c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),e=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),h=this.textView.getOptions("tabSize"),
f=Array(h+1).join(" "),g=[],i=0,l=0,j=d;j<=e;j++){var n=c.getLine(j,!0);if(c.getLineStart(j)!==c.getLineEnd(j))if(n.indexOf("\t")===0)n=n.substring(1),i++;else if(n.indexOf(f)===0)n=n.substring(h),i+=h;else return!0;j===d&&(l=i);g.push(n)}d=c.getLineStart(d);h=c.getLineEnd(e,!0);c=c.getLineStart(e);a.setText(g.join(""),d,h);g=d===b.start?b.start:b.start-l;b=Math.max(g,b.end-i+(b.end===c+1&&b.start!==b.end?1:0));a.setSelection(g,b);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 a=this.editor,c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start);if(d===0)return!0;var e=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),h=c.getLineCount(),b=c.getLineStart(d-1),f=c.getLineStart(d),g=c.getLineEnd(e,!0),i=c.getText(f,g),l=0;e===h-1&&(e=c.getLineEnd(d-1),d=c.getLineEnd(d-1,!0),i+=c.getText(e,d),f=e,l=d-e);this.startUndo();a.setText("",f,g);a.setText(i,
b,b);a.setSelection(b,b+i.length-l);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 a=this.editor,c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),e=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),h=c.getLineCount();if(e===h-1)return!0;var d=c.getLineStart(d),b=c.getLineEnd(e,!0),f=c.getLineEnd(e+1,
!0)-(b-d),g=0;e!==h-2?c=c.getText(d,b):(e=c.getLineEnd(e),c=c.getText(e,b)+c.getText(d,e),g+=b-e);this.startUndo();a.setText("",d,b);a.setText(c,f,f);a.setSelection(f+g,f+g+c.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 a=this.editor,c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),b=c.getLineAtOffset(b.end>
b.start?b.end-1:b.end),d=c.getLineStart(d),e=c.getLineEnd(b,!0),h=c.getLineCount(),f="",e=c.getText(d,e);b===h-1&&(e+=f=c.getLineDelimiter());a.setText(e,d,d);a.setSelection(d,d+e.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 a=this.editor,c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),b=c.getLineAtOffset(b.end>
b.start?b.end-1:b.end),e=c.getLineStart(d),d=c.getLineEnd(b,!0),h=c.getLineCount(),f="",e=c.getText(e,d);b===h-1&&(e=(f=c.getLineDelimiter())+e);a.setText(e,d,d);a.setSelection(d+f.length,d+e.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 a=this.editor,c=a.getSelection(),b=a.getModel(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>
c.start?c.end-1:c.end),d=b.getLineStart(d),b=b.getLineEnd(c,!0);a.setText("",d,b);return!0}.bind(this),{name:j.deleteLines});this.textView.setKeyBinding(new i.KeyBinding("l",!0),"gotoLine");this.textView.setAction("gotoLine",function(){var a=this.editor,c=a.getModel().getLineAtOffset(a.getCaretOffset());if(c=prompt(j.gotoLinePrompty,c+1))c=parseInt(c,10),a.onGotoLine(c-1,0);return!0}.bind(this),{name:j.gotoLine});this.textView.setKeyBinding(new i.KeyBinding(190,!0),"nextAnnotation");this.textView.setAction("nextAnnotation",
function(){var a=this.editor,c=a.getAnnotationModel();if(!c)return!0;for(var b=a.getModel(),d=a.getCaretOffset(),c=c.getAnnotations(d,b.getCharCount());c.hasNext();){var e=c.next();if(!(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)){var h=g.Tooltip.getTooltip(this.textView);if(!h){a.moveSelection(e.start);break}var i=b.getLineAtOffset(e.start),l=this.textView;
a.moveSelection(e.start,e.start,function(){setTimeout(function(){h.setTarget({getTooltipInfo:function(){var a=l.convert({x:l.getLocationAtOffset(e.start).x,y:l.getLocationAtOffset(b.getLineStart(i)).y},"document","page");return{contents:[e],x:a.x,y:a.y+Math.floor(l.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 a=this.editor,
c=a.getAnnotationModel();if(!c)return!0;for(var b=a.getModel(),d=a.getCaretOffset(),c=c.getAnnotations(0,d),e=null;c.hasNext();){var h=c.next();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||(e=h)}if(e){var i=b.getLineAtOffset(e.start),l=g.Tooltip.getTooltip(this.textView);if(!l)return a.moveSelection(e.start),!0;var j=this.textView;a.moveSelection(e.start,
e.start,function(){setTimeout(function(){l.setTarget({getTooltipInfo:function(){var a=j.convert({x:j.getLocationAtOffset(e.start).x,y:j.getLocationAtOffset(b.getLineStart(i)).y},"document","page");return{contents:[e],x:a.x,y:a.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 a=this.editor,c=a.getAnnotationModel();if(!c)return!0;var b=
a.getModel(),a=a.getCaretOffset(),d=b.getLineAtOffset(a),a=b.getLineStart(d),d=b.getLineEnd(d,!0);b.getBaseModel&&(a=b.mapOffset(a),d=b.mapOffset(d),b.getBaseModel());for(var e,b=c.getAnnotations(a,d);!e&&b.hasNext();)a=b.next(),a.type===f.AnnotationType.ANNOTATION_FOLDING&&(a.expanded||(e=a));e&&!e.expanded&&(e.expand(),c.modifyAnnotation(e));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 a=
this.editor,c=a.getAnnotationModel();if(!c)return!0;var b=a.getModel(),d=a.getCaretOffset(),e=b.getLineAtOffset(d),d=b.getLineStart(e),e=b.getLineEnd(e,!0);b.getBaseModel&&(d=b.mapOffset(d),e=b.mapOffset(e),b.getBaseModel());for(var h,b=c.getAnnotations(d,e);!h&&b.hasNext();)d=b.next(),d.type===f.AnnotationType.ANNOTATION_FOLDING&&(h=d);h&&h.expanded&&(a.setCaretOffset(h.start),h.collapse(),c.modifyAnnotation(h));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 a=this.editor,c=a.getAnnotationModel();if(!c)return!0;var a=a.getModel(),b=c.getAnnotations(0,a.getCharCount());for(this.textView.setRedraw(!1);b.hasNext();)a=b.next(),a.type===f.AnnotationType.ANNOTATION_FOLDING&&!a.expanded&&(a.expand(),c.modifyAnnotation(a));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 a=this.editor,c=a.getAnnotationModel();if(!c)return!0;var a=a.getModel(),b=c.getAnnotations(0,a.getCharCount());for(this.textView.setRedraw(!1);b.hasNext();)a=b.next(),a.type===f.AnnotationType.ANNOTATION_FOLDING&&a.expanded&&(a.collapse(),c.modifyAnnotation(a));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 a=this._incrementalFindPrefix;if(a.length===0)return!1;var b=this.editor,d=b.getModel(),d=this._incrementalFindSuccess?b.getCaretOffset()-a.length-1:d.getCharCount()-1;(d=b.getModel().find({string:a,start:d,reverse:!0,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);return!0}return!1},lineDown:function(){if(this._incrementalFindActive){var a=this._incrementalFindPrefix;if(a.length===0)return!1;var b=this.editor,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);return!0}return!1},enter:function(){return!1}};m.prototype={startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},init:function(){function a(c,b,d){var e=c.getLineAtOffset(b),h=c.getLineAtOffset(d),f,g,i,l,j,n;for(f=
e;f>=0;f--)if(g=c.getLine(f),i=f===e?b-c.getLineStart(e):g.length,l=g.lastIndexOf("/*",i),g=g.lastIndexOf("*/",i),g>l)break;else if(l!==-1){j=c.getLineStart(f)+l;break}for(f=h;f<c.getLineCount();f++)if(g=c.getLine(f),i=f===h?d-c.getLineStart(h):0,l=g.indexOf("/*",i),g=g.indexOf("*/",i),l!==-1&&l<g)break;else if(g!==-1){n=c.getLineStart(f)+g;break}return{commentStart:j,commentEnd:n}}this.textView.setAction("lineStart",function(){for(var a=this.editor,c=a.getModel(),b=a.getCaretOffset(),d=c.getLineAtOffset(b),
e=c.getLineStart(d),c=c.getLine(d),d=0;d<c.length;d++){var h=c.charCodeAt(d);if(!(h===32||h===9))break}d+=e;return b!==d?(a.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 a=this.editor,c=a.getModel(),b=a.getSelection(),d=c.getLineAtOffset(b.start),e=c.getLineAtOffset(b.end>b.start?b.end-1:b.end),h=!0,f=[],g,i,l=d;l<=e;l++)if(g=
c.getLine(l,!0),f.push(g),!h||(i=g.indexOf("//"))===-1)h=!1;else if(i!==0){var j;for(j=0;j<i;j++)if(h=g.charCodeAt(j),!(h===32||h===9))break;h=j===i}l=c.getLineStart(d);j=c.getLineEnd(e,!0);if(h){for(h=0;h<f.length;h++)g=f[h],i=g.indexOf("//"),f[h]=g.substring(0,i)+g.substring(i+2);f=f.join("");g=c.getLineStart(e);c=l===b.start?b.start:b.start-2;b=b.end-2*(e-d+1)+(b.end===g+1?2:0)}else f.splice(0,0,""),f=f.join("//"),c=l===b.start?b.start:b.start+2,b=b.end+2*(e-d+1);a.setText(f,l,j);a.setSelection(c,
b);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 c=this.editor,b=c.getModel(),d=c.getSelection(),e=RegExp("/\\*|\\*/","g"),h=a(b,d.start,d.end);if(h.commentStart!==void 0&&h.commentEnd!==void 0)return!0;b=b.getText(d.start,d.end);if(b.length===0)return!0;h=b.length;b=b.replace(e,"");e=b.length;c.setText("/*"+
b+"*/",d.start,d.end);c.setSelection(d.start+2,d.end+2+(e-h));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 c=this.editor,b=c.getModel(),d=c.getSelection(),e=b.getText(d.start,d.end),h,f,g;for(g=0;g<e.length;g++)if(e.substring(g,g+2)==="/*"){h=d.start+g;break}for(;g<e.length;g++)if(e.substring(g,
g+2)==="*/"){f=d.start+g;break}if(h!==void 0&&f!==void 0)c.setText(b.getText(h+2,f),h,f+2),c.setSelection(h,f);else{e=a(b,d.start,d.end);if(e.commentStart===void 0||e.commentEnd===void 0)return!0;b=b.getText(e.commentStart+2,e.commentEnd);c.setText(b,e.commentStart,e.commentEnd+2);c.setSelection(d.start-2,d.end-2)}return!0}.bind(this),{name:j.removeBlockComment})},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&this.linkedMode){for(var c=[],b=0;b<a.positions.length;++b)c[b]=
{positions:[{offset:a.positions[b].offset,length:a.positions[b].length}]};this.linkedMode.enterLinkedMode({groups:c,escapePosition:a.escapePosition})}else a.escapePosition&&this.textView.setCaretOffset(a.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 a=this.editor,c=a.getSelection();if(c.start===c.end){for(var b=
a.getModel(),d=b.getLineAtOffset(c.start),e=b.getLine(d,!0),h=b.getLineStart(d),d=0,h=c.start-h,f;d<h&&((f=e.charCodeAt(d))===32||f===9);)d++;if(d>0){for(var g=e.substring(0,d),d=h;d<e.length&&((f=e.charCodeAt(d++))===32||f===9);)c.end++;a.setText(b.getLineDelimiter()+g,c.start,c.end);return!0}}return!1},tab:function(){return!1}};t.prototype={enterLinkedMode:function(a){if(!this.linkedModeActive){this.linkedModeActive=!0;this.linkedModePositions=[];for(var c=0;c<a.groups.length;++c){var b=a.groups[c];
this.linkedModePositions[c]={offset:b.positions[0].offset,length:b.positions[0].length}}this.linkedModeEscapePosition=a.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(a){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"),a||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(a){this.textView.setSelection(a.offset,a.offset+a.length)}};return{UndoFactory:a,LineNumberRulerFactory:h,FoldingRulerFactory:l,AnnotationFactory:n,TextDNDFactory:q,TextActions:p,SourceCodeActions:m,LinkedMode:t}});
define("orion/compare/diff-provider",["i18n!orion/compare/nls/messages","orion/Deferred"],function(j,k){function i(b,g,e){var d=new k;b[g].apply(b,e).then(function(c){d.resolve(c)},function(c){d.reject(c)});return d}function b(b,g){var e=b.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 a=[],h=[],c=0;c<d.length;++c)a[c]=RegExp(d[c].getProperty("pattern")||".*"),h[c]=b.getService(d[c]);this._getService=function(c){if(c.indexOf("://")===
-1){var b=document.createElement("a");b.href=c;c=b.href}for(b=0;b<a.length;++b)if(a[b].test(c))return h[b];throw j["No Matching DiffService for location:"]+c;}}b.prototype={getDiffContent:function(b){return i(this._getService(b),"getDiffContent",arguments)},getDiffFileURI:function(b){return i(this._getService(b),"getDiffFileURI",arguments)}};return{DiffProvider:b}});
var JsDiff=function(){function j(b){for(var c=[],a=0;a<b.length;a++)b[a]&&c.push(b[a]);return c}function k(b){b=b.replace(/&/g,"&amp;");b=b.replace(/</g,"&lt;");b=b.replace(/>/g,"&gt;");return b=b.replace(/"/g,"&quot;")}var i=function(b){this.ignoreWhitespace=b};i.prototype={diff:function(b,c){if(c==b)return[{value:c}];if(!c)return[{value:b,removed:!0}];if(!b)return[{value:c,added:!0}];var c=this.tokenize(c),b=this.tokenize(b),a=c.length,e=b.length,f=a+e,g=[{newPos:-1,components:[]}],i=this.extractCommon(g[0],
c,b,0);if(g[0].newPos+1>=a&&i+1>=e)return g[0].components;for(var j=1;j<=f;j++)for(var m=-1*j;m<=j;m+=2){var k;k=g[m-1];var o=g[m+1],i=(o?o.newPos:0)-m;k&&(g[m-1]=void 0);var w=k&&k.newPos+1<a,s=o&&0<=i&&i<e;if(!w&&!s)g[m]=void 0;else if(!w||s&&k.newPos<o.newPos?(k={newPos:o.newPos,components:o.components.slice(0)},this.pushComponent(k.components,b[i],void 0,!0)):(k={newPos:k.newPos,components:k.components.slice(0)},k.newPos++,this.pushComponent(k.components,c[k.newPos],!0,void 0)),i=this.extractCommon(k,
c,b,m),k.newPos+1>=a&&i+1>=e)return k.components;else g[m]=k}},pushComponent:function(b,c,a,e){var f=b[b.length-1];f&&f.added===a&&f.removed===e?b[b.length-1]={value:this.join(f.value,c),added:a,removed:e}:b.push({value:c,added:a,removed:e})},extractCommon:function(b,c,a,e){for(var f=c.length,g=a.length,i=b.newPos,e=i-e;i+1<f&&e+1<g&&this.equals(c[i+1],a[e+1]);)i++,e++,this.pushComponent(b.components,c[i],void 0,void 0);b.newPos=i;return e},equals:function(b,c){var a=/\S/;return this.ignoreWhitespace&&
!a.test(b)&&!a.test(c)?!0:b==c},join:function(b,c){return b+c},tokenize:function(b){return b}};var b=new i,f=new i(!1);f.tokenize=function(b){return j(b.split(/(\s+|\b)/))};var g=new i(!0);g.tokenize=function(b){return j(b.split(/([{}:;,]|\s+)/))};var e=new i;e.tokenize=function(b){return b.split(/^/m)};return{diffChars:function(d,c){return b.diff(d,c)},diffWords:function(b,c){return f.diff(b,c)},diffLines:function(b,c){return e.diff(b,c)},diffCss:function(b,c){return g.diff(b,c)},createPatch:function(b,
c,a,h,f){var g=[];g.push("Index: "+b);g.push("===================================================================");g.push("--- "+b+"\t"+h);g.push("+++ "+b+"\t"+f);b=e.diff(c,a);b.push({value:"",lines:[]});for(var a=c=0,h=[],i=f=1,j=0;j<b.length;j++){var m=b[j],k=m.lines||m.value.replace(/\n$/,"").split("\n");m.lines=k;if(m.added||m.removed){if(!c){var o=b[j-1],c=f,a=i;o&&(h.push.apply(h,o.lines.slice(-4).map(function(a){return" "+a})),c-=4,a-=4)}h.push.apply(h,k.map(function(a){return(m.added?"+":
"-")+a}));m.added?i+=k.length:f+=k.length}else c&&(k.length<=8&&j<b.length-1?h.push.apply(h,k.map(function(a){return" "+a})):(o=Math.min(k.length,4),g.push("@@ -"+c+","+(f-c+o)+" +"+a+","+(i-a+o)+" @@"),g.push.apply(g,h),g.push.apply(g,k.slice(0,o).map(function(a){return" "+a})),a=c=0,h=[])),f+=k.length,i+=k.length}b.length>1&&!/\n$/.test(b[b.length-2].value)&&g.push("\\ No newline at end of file\n");return g.join("\n")},convertChangesToXML:function(b){for(var c=[],a=0;a<b.length;a++){var e=b[a];
e.added?c.push("<ins>"):e.removed&&c.push("<del>");c.push(k(e.value));e.added?c.push("</ins>"):e.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 k=k||{};k.JSDiffAdapter=function(){function i(){}i.prototype={adapt:function(b,f,g){g||(g="\n");for(var e=b.split(g),d=f.split(g),c=e[e.length-1]==="",d=d[d.length-1]==="",a=j.diffLines(b,f),b=[],f=[],h=0,i=0,n=-1,k=0,p=!0,m=0;m<a.length;m++){var t=a[m],o=t.lines||t.value.split(g),w=o.length,s=0;o.length>1&&o[o.length-1]===""&&w--;w>1&&!p&&o[0]===""&&(w--,s++);t.lines=o;if(!t.added&&!t.removed){if(h||i)b.push([h,i,n]),i=h=0,n=-1,
k+=i;b.push([w,w,0]);k+=w}else if(t.added){n===-1&&(n=f.length+1);h+=w;for(p=s;p<w+s;p++)f.push(t.lines[p])}else i+=w;p=!1;o.length>1&&o[o.length-1]===""&&(p=!0)}if(h||i)b.push([h,i,n]),k+=i;k<e.length&&e.length>1&&(g=b[b.length-1],g[2]===0?(g[0]+=1,g[1]+=1):g[2]===-1?b.push([1,1,0]):c===d?b.push([1,1,0]):(d&&(g[0]+=1),c&&(g[1]+=1)));return{mapper:b,changContents:{array:f,index:0}}},adaptCharDiff:function(b,f,g){for(var b=g?j.diffWords(b,f):j.diffChars(b,f),f=[],e=g=0,d=0,c=0,a=0;a<b.length;a++){var h=
b[a];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 k});
define("examples/editor/textStyler",["orion/editor/annotations"],function(j){function k(a,c){this.keywords=a;this.whitespacesVisible=c;this.setText("")}function i(){k.call(this,null,!0)}function b(a){k.call(this,null,a)}function f(){k.call(this,null,!1)}function g(a,h,g){this.commentStart="/*";this.commentEnd="*/";var l=[];switch(h){case "java":l=d;break;case "js":l=e;break;case "css":l=c}this.whitespacesVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=
!0;this._scanner=new k(l,this.whitespacesVisible);this._firstScanner=new f;this._commentScanner=new b(this.whitespacesVisible);this._whitespaceScanner=new i;if(h==="css")this._scanner.isCSS=!0,this._firstScanner.isCSS=!0;this.view=a;this.annotationModel=g;this._bracketAnnotations=void 0;var j=this;this._listener={onChanged:function(a){j._onModelChanged(a)},onDestroy:function(a){j._onDestroy(a)},onLineStyle:function(a){j._onLineStyle(a)},onMouseDown:function(a){j._onMouseDown(a)},onSelection:function(a){j._onSelection(a)}};
h=a.getModel();h.getBaseModel&&(h=h.getBaseModel());h.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);this._computeComments();this._computeFolding();a.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(","),
a={styleClass:"comment"},h={styleClass:"token_multiline_comment"},l={styleClass:"token_doc_comment"},n={styleClass:"token_doc_html_markup"},q={styleClass:"token_task_tag"},p={styleClass:"token_doc_tag"},m={styleClass:"token-string"},t={styleClass:"token_number"},o={styleClass:"token_keyword"},w={styleClass:"token_space"},s={styleClass:"token_tab"},x={styleClass:"line_caret"};k.prototype={getOffset:function(){return this.offset},getStartOffset:function(){return this.startOffset},getData:function(){return this.text.substring(this.startOffset,
this.offset)},getDataLength:function(){return this.offset-this.startOffset},_default:function(a){switch(a){case 32:case 9:if(this.whitespacesVisible)return a===32?11:10;do a=this._read();while(a===32||a===9);this._unread(a);return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var c=this.isCSS,b=this.offset-1;if(!c&&48<=a&&a<=57){var d=c=!1,e=!1,h=a;do if(a=this._read(),a===46&&!c)c=!0;else if(a===101&&!d)c=d=!0,a=this._read(),a!==45&&this._unread(a);else if(a===
120&&h===48&&this.offset-b===2)c=d=e=!0;else if(!(48<=a&&a<=57||e&&(65<=a&&a<=70||97<=a&&a<=102)))break;while(1);this._unread(a);return 3}if(97<=a&&a<=122||65<=a&&a<=90||a===95||45===a&&c){do a=this._read();while(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57||45===a&&c);this._unread(a);a=this.keywords;if(a.length>0){b=this.text.substring(b,this.offset);for(c=0;c<a.length;c++)if(this.keywords[c]===b)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):
-1},_unread:function(a){a!==-1&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),c;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&a===47)for(;;)if(a=this._read(),a===-1||a===10||a===13)return this._unread(a),6;if(a===42){a=this._read();c=7;for(a===42&&(c=8);;){for(;a===42;)if(a=this._read(),a===47)return c;if(a===-1)return this._unread(a),c;a=this._read()}}this._unread(a);return 1;case 39:for(c=4;;)switch(a=this._read(),a){case 39:return c;
case 13:case 10:case -1:return this._unread(a),c;case 92:switch(a=this._read(),a){case 10:c=5;break;case 13:c=5,a=this._read(),a!==10&&this._unread(a)}}break;case 34:for(c=4;;)switch(a=this._read(),a){case 34:return c;case 13:case 10:case -1:return this._unread(a),c;case 92:switch(a=this._read(),a){case 10:c=5;break;case 13:c=5,a=this._read(),a!==10&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};i.prototype=new k(null);i.prototype.nextToken=
function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(a===32||a===9||a===-1));this._unread(a);return 1}}};b.prototype=new k(null);b.prototype.setType=function(a){this._type=a};b.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return a===32?11:10;do a=this._read();while(a===32||a===
9);this._unread(a);return 9;case 60:if(this._type===8){do a=this._read();while(!(a===62||a===-1));if(a===62)return 12}return 1;case 64:if(this._type===8){do a=this._read();while(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57);this._unread(a);return 13}return 1;case 84:if((a=this._read())===79)if((a=this._read())===68)if((a=this._read())===79)if(a=this._read(),!(97<=a&&a<=122||65<=a&&a<=90||a===95||48<=a&&a<=57))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(a===32||
a===9||a===-1||a===60||a===64||a===84));this._unread(a);return 1}}};f.prototype=new k(null);f.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),1}};g.prototype={getClassNameForToken:function(c){switch(c){case "singleLineComment":return a.styleClass;case "multiLineComment":return h.styleClass;case "docComment":return l.styleClass;case "docHtmlComment":return n.styleClass;case "tasktag":return q.styleClass;case "doctag":return p.styleClass;
case "string":return m.styleClass;case "number":return t.styleClass;case "keyword":return o.styleClass;case "space":return w.styleClass;case "tab":return s.styleClass;case "caretLine":return x.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 a=this.view;
if(a){var c=a.getModel();c.getBaseModel&&(c=c.getBaseModel());c.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a){this.whitespacesVisible=a;
this._scanner.whitespacesVisible=a;this._commentScanner.whitespacesVisible=a},setDetectHyperlinks:function(a){this.detectHyperlinks=a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,c,b,d,e){var h;d===void 0&&(d=-1);if(e===void 0)e=a.length;for(;e-d>1;)if(h=Math.floor((e+d)/2),c<=a[h].start)e=h;else if(b&&c<a[h].end){e=h;break}else d=h;return e},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());
this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();if(a.getBaseModel){var c=this.annotationModel;if(c){c.removeAnnotations(j.AnnotationType.ANNOTATION_FOLDING);for(var b=[],d=a.getBaseModel(),e=this.comments,h=0;h<e.length;h++){var f=e[h];(f=this._createFoldingAnnotation(a,d,f.start,f.end))&&b.push(f)}c.replaceAnnotations(null,b)}}}},_createFoldingAnnotation:function(a,c,b,d){var e=c.getLineAtOffset(b),c=c.getLineAtOffset(d);
return e===c?null:new (j.AnnotationType.getType(j.AnnotationType.ANNOTATION_FOLDING))(b,d,a)},_computeTasks:function(a,c,b){if(this.detectTasks){var d=this.annotationModel;if(d){var e=this.view.getModel(),h=e;e.getBaseModel&&(h=e.getBaseModel());for(var f=d.getAnnotations(c,b),e=[],g=j.AnnotationType.ANNOTATION_TASK;f.hasNext();){var i=f.next();i.type===g&&e.push(i)}f=[];i=this._commentScanner;i.setText(h.getText(c,b));for(var l;l=i.nextToken();){var n=i.getStartOffset()+c;l===14&&(l=h.getLineEnd(h.getLineAtOffset(n)),
a!==6&&(l=Math.min(l,b-this.commentEnd.length)),f.push(j.AnnotationType.createAnnotation(g,n,l,h.getText(n,l))))}d.replaceAnnotations(e,f)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var c=this.view,b=c.getModel(),c=c.getSelection();if(c.start===c.end&&b.getLineAtOffset(c.start)===a)return x}return null},_getStyles:function(a,c,b){a.getBaseModel&&(b=a.mapOffset(b));for(var d=b+c.length,e=[],f=b,g=this.comments,i=this._binarySearch(g,b,!0);i<g.length;i++){if(g[i].start>=d)break;var j=
g[i].start,n=g[i].end;f<j&&this._parse(c.substring(f-b,j-b),f,e);var o=g[i].type,k;switch(o){case 8:k=l;break;case 7:k=h;break;case 5:k=m}f=Math.max(f,j);j=Math.min(d,n);(o===8||o===7)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(c.substring(f-b,j-b),f,e,k,o):o===5&&this.whitespacesVisible?this._parseString(c.substring(f-b,j-b),f,e,m):e.push({start:f,end:j,style:k});f=n}f<d&&this._parse(c.substring(f-b,d-b),f,e);if(a.getBaseModel)for(c=0;c<e.length;c++)b=e[c].end-e[c].start,
e[c].start=a.mapOffset(e[c].start,!0),e[c].end=e[c].start+b;return e},_parse:function(c,b,d){var e=this._scanner;for(e.setText(c);c=e.nextToken();){var f=e.getStartOffset()+b,g=null;switch(c){case 2:g=o;break;case 3:g=t;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(e.getData(),f,d,m);continue}else g=m;break;case 8:this._parseComment(e.getData(),f,d,l,c);continue;case 6:this._parseComment(e.getData(),f,d,a,c);continue;case 7:this._parseComment(e.getData(),f,d,h,c);continue;case 10:this.whitespacesVisible&&
(g=s);break;case 11:this.whitespacesVisible&&(g=w)}d.push({start:f,end:e.getOffset()+b,style:g})}},_parseComment:function(a,c,b,d,e){var h=this._commentScanner;h.setText(a);for(h.setType(e);a=h.nextToken();){var e=h.getStartOffset()+c,f=d;switch(a){case 10:this.whitespacesVisible&&(f=s);break;case 11:this.whitespacesVisible&&(f=w);break;case 12:f=n;break;case 13:f=p;break;case 14:f=q;break;default:this.detectHyperlinks&&(f=this._detectHyperlinks(h.getData(),e,b,f))}f&&b.push({start:e,end:h.getOffset()+
c,style:f})}},_parseString:function(a,c,b,d){var e=this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var h=e.getStartOffset()+c,f=d;switch(a){case 10:this.whitespacesVisible&&(f=s);break;case 11:this.whitespacesVisible&&(f=w)}f&&b.push({start:h,end:e.getOffset()+c,style:f})}},_detectHyperlinks:function(a,c,b,d){var e=null,h;if((h=a.indexOf("://"))>0){for(var e=a,f=h;f>0;){h=e.charCodeAt(f-1);if(!(97<=h&&h<=122||65<=h&&h<=90||45===h||48<=h&&h<=57))break;f--}if(f>0&&(h="\"\"''(){}[]<>".indexOf(e.substring(f-
1,f)),h!==-1&&(h&1)===0&&(h=e.lastIndexOf("\"\"''(){}[]<>".substring(h+1,h+2)))!==-1)){var g=h;h=this._clone(d);h.tagName="A";h.attributes={href:e.substring(f,g)};b.push({start:c,end:c+f,style:d});b.push({start:c+f,end:c+g,style:h});b.push({start:c+g,end:c+a.length,style:d});return null}}else a.toLowerCase().indexOf("bug#")===0&&(e="https://bugs.eclipse.org/bugs/show_bug.cgi?id="+parseInt(a.substring(4),10));return e?(h=this._clone(d),h.tagName="A",h.attributes={href:e},h):d},_clone:function(a){if(!a)return a;
var c={},b;for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);return c},_findComments:function(a,c){var c=c||0,b=this._firstScanner,d;b.setText(a);for(var e=[];d=b.nextToken();)(d===7||d===8||d===5)&&e.push({start:b.getStartOffset()+c,end:b.getOffset()+c,type:d}),(d===6||d===7||d===8)&&this._computeTasks(d,b.getStartOffset()+c,b.getOffset()+c);return e},_findMatchingBracket:function(a,c){var b="{}()[]<>",d=a.getText(c,c+1),e=b.indexOf(d,0);if(e===-1)return-1;var h;h=e&1?b.substring(e-1,e):b.substring(e+
1,e+2);for(var f=a.getLineAtOffset(c),b=a.getLine(f),g=a.getLineStart(f),i=a.getLineEnd(f),b=this._findBrackets(d,h,b,g,g,i),i=0;i<b.length;i++)if(g=b[i]>=0?1:-1,b[i]*g-1===c){var l=1;if(e&1){for(i--;i>=0;i--)if(g=b[i]>=0?1:-1,l+=g,l===0)return b[i]*g-1;for(f-=1;f>=0;){b=a.getLine(f);g=a.getLineStart(f);i=a.getLineEnd(f);b=this._findBrackets(d,h,b,g,g,i);for(e=b.length-1;e>=0;e--)if(g=b[e]>=0?1:-1,l+=g,l===0)return b[e]*g-1;f--}}else{for(i++;i<b.length;i++)if(g=b[i]>=0?1:-1,l+=g,l===0)return b[i]*
g-1;f+=1;for(e=a.getLineCount();f<e;){b=a.getLine(f);g=a.getLineStart(f);i=a.getLineEnd(f);b=this._findBrackets(d,h,b,g,g,i);for(i=0;i<b.length;i++)if(g=b[i]>=0?1:-1,l+=g,l===0)return b[i]*g-1;f++}}break}return-1},_findBrackets:function(a,c,b,d,e,h){for(var f=[],a=a.charCodeAt(0),c=c.charCodeAt(0),g=e,i=this._scanner,l,j=this.comments,n=this._binarySearch(j,e,!0);n<j.length;n++){if(j[n].start>=h)break;l=j[n].start;var m=j[n].end;if(g<l)for(i.setText(b.substring(g-e,l-e));l=i.nextToken();)l===a?f.push(i.getStartOffset()+
g-e+d+1):l===c&&f.push(-(i.getStartOffset()+g-e+d+1));g=m}if(g<h)for(i.setText(b.substring(g-e,h-e));l=i.nextToken();)l===a?f.push(i.getStartOffset()+g-e+d+1):l===c&&f.push(-(i.getStartOffset()+g-e+d+1));return f},_onDestroy:function(){this.destroy()},_onLineStyle:function(a){if(a.textView===this.view)a.style=this._getLineStyle(a.lineIndex);a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var c=a.oldValue,b=a.newValue,d=this.view,a=d.getModel(),e;if(this.highlightCaretLine){var h=
a.getLineAtOffset(c.start);e=a.getLineAtOffset(b.start);var f=b.start===b.end,c=c.start===c.end;h===e&&c&&f||(c&&d.redrawLines(h,h+1),(h!==e||!c)&&f&&d.redrawLines(e,e+1))}if(this.annotationModel){var c=this._bracketAnnotations,g,i;if(b.start===b.end&&(i=d.getCaretOffset())>0)i-=1,a.getBaseModel&&(i=a.mapOffset(i),a=a.getBaseModel()),a=this._findMatchingBracket(a,i),a!==-1&&(g=[j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),j.AnnotationType.createAnnotation(j.AnnotationType.ANNOTATION_CURRENT_BRACKET,
i,i+1)]);this._bracketAnnotations=g;this.annotationModel.replaceAnnotations(c,g)}},_onMouseDown:function(a){if(a.clickCount===2){var c=this.view,b=c.getModel(),d=c.getOffsetAtLocation(a.x,a.y);if(d>0){var e=d-1,h=b;b.getBaseModel&&(e=b.mapOffset(e),h=b.getBaseModel());e=this._findMatchingBracket(h,e);e!==-1&&(a.preventDefault(),a=e,b.getBaseModel&&(a=b.mapOffset(a,!0)),d>a&&(d--,a++),c.setSelection(a,d))}}},_onModelChanged:function(a){var c=a.start,b=a.removedCharCount,d=a.addedCharCount-b,e=this.view,
a=e.getModel(),h=a.getBaseModel?a.getBaseModel():a,b=c+b,f=h.getCharCount(),g=this.comments.length,i=h.getLineStart(h.getLineAtOffset(c)),l=this._binarySearch(this.comments,i,!0),n=this._binarySearch(this.comments,b,!1,l-1,g);l<g&&this.comments[l].start<=i&&i<this.comments[l].end?(i=this.comments[l].start,i>c&&(i+=d)):i=l===g&&g>0&&f-d===this.comments[g-1].end?this.comments[g-1].start:i;var m;n<g?(m=this.comments[n].end,m>c&&(m+=d),n+=1):(n=g,m=f);for(var o,f=this._findComments(h.getText(i,m),i),
g=l;g<this.comments.length;g++)o=this.comments[g],o.start>c&&(o.start+=d),o.start>c&&(o.end+=d);var k=n-l!==f.length;if(!k)for(g=0;g<f.length;g++){o=this.comments[l+g];var q=f[g];if(o.start!==q.start||o.end!==q.end||o.type!==q.type){k=!0;break}}g=[l,n-l].concat(f);Array.prototype.splice.apply(this.comments,g);k&&(g=i,o=m,a!==h&&(g=a.mapOffset(g,!0),o=a.mapOffset(o,!0)),e.redrawRange(g,o));if(this.foldingEnabled&&h!==a&&this.annotationModel){e=this.annotationModel;l=e.getAnnotations(i,m);i=[];for(m=
[];l.hasNext();)if(o=l.next(),o.type===j.AnnotationType.ANNOTATION_FOLDING){m.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,n=o.end,g>c&&(g-=d),n>c&&(n-=d),g<=c&&c<n&&g<=b&&b<n&&(g=h.getLineAtOffset(o.start),n=h.getLineAtOffset(o.end),g!==n?o.expanded||(o.expand(),e.modifyAnnotation(o)):e.removeAnnotation(o)))}c=[];for(g=0;g<f.length;g++){o=f[g];for(d=0;d<m.length;d++)if(m[d].start===o.start&&m[d].end===o.end)break;d===
m.length&&(o=this._createFoldingAnnotation(a,h,o.start,o.end))&&c.push(o)}e.replaceAnnotations(i,c)}}};return{TextStyler:g}});
define("orion/editor/textMateStyler",["orion/editor/regex"],function(j){function k(c,a){var b=a.textView._parent.ownerDocument,d=a._stylesheet=a.util.createElement(b,"style");d.appendChild(b.createTextNode(a._styleSheet(c,"",a.util)));(b.getElementsByTagName("head")[0]||b.documentElement).appendChild(d);a.textView.update(!0)}function i(c,a){var b,d=this;c.getPreferences("/settings",2).then(function(c){if(c.get("JavaScript Editor")!==void 0&&(b=JSON.parse(c.get("JavaScript Editor")))){if(d._stylesheet)d._stylesheet.parentNode.removeChild(d._stylesheet),
d._stylesheet=null;d._update(b,d,a)}})}function b(c,a){for(var b=[],d=0;d<c.length;d++)b[c[d].element]=c[d].value;d=[];d.push("");var e=b.fontFamily,e=e==="sans serif"?'"Menlo", "Consolas", "Vera Mono", "monospace"':"monospace";d.push(a+" .textviewContainer {");d.push("\u0008ackground-color:"+b.background+";");d.push("\tfont-family: "+e+";");d.push("\tfont-size: "+b.fontSize+";");d.push("\tmin-width: 50px;");d.push("\tmin-height: 50px;");d.push("\tcolor: "+b.text+";");d.push("}");d.push(a+" {");d.push("\tfont-family: "+
e+";");d.push("\tfont-size: "+b.fontSize+";");d.push("\tcolor: "+b.text+";");d.push("}");d.push(a+" .textview {");d.push("\tbackground-color: "+b.background+";");d.push("}");d.push(a+".ruler.annotations{");d.push("\tbackground-color: white;");d.push("}");d.push(a+" .ruler {");d.push("\tbackground-color: "+b.annotationRuler+";");d.push("}");d.push(a+" .rulerLines {");d.push("\tcolor: "+b.lineNumber+";");d.push("\tbackground-color: "+b.annotationRuler+";");d.push("}");d.push(a+" .rulerLines.even {");
d.push("\tcolor: "+b.lineNumber+";");d.push("\tbackground-color: "+b.annotationRuler+";");d.push("}");d.push(a+" .rulerLines.odd {");d.push("\tcolor: "+b.lineNumber+";");d.push("\tbackground-color: "+b.annotationRuler+";");d.push("}");d.push(a+" .annotationLine.currentLine {");d.push("\tbackground-color: "+b.currentLine+";");d.push("}");d.push(a+" .entity-name-tag {");d.push("color: "+b.keyword+";");d.push("}");return d.join("\n")}function f(c){var a;if(c instanceof Array){a=Array(c.length);for(var b=
0;b<c.length;b++)a[b]=f(c[b])}else for(b in a={},c)if(Object.prototype.hasOwnProperty.call(c,b)){var d=c[b];a[b]=typeof d==="object"&&d!==null?f(d):d}return a}function g(c,a,d,e,g){this.initialize(c,e);this.grammar=f(a);this.externalGrammars=d?f(d):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar);this._updateStylesheet=i;this._update=k;this._styleSheet=b;this.util=g}var e,d={unsupported:[{regex:/\(\?[ims\-]:/,func:function(){return"option on/off for subexp"}},
{regex:/\(\?<([=!])/,func:function(c){return c[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(c){function a(a,c){throw Error('Unsupported regex feature "'+a+'": "'+c[0]+'" at index: '+c.index+" in "+c.input);}var b="",e,c=d.processGlobalFlag("x",c,function(a){for(var c="",b=!1,d=a.length,e=0;e<d;){var h=a.charAt(e);if(!b&&h==="#")for(;e<d&&h!=="\r"&&h!=="\n";)h=a.charAt(++e);else if(!b&&/\s/.test(h))for(;e<d&&/\s/.test(h);)h=
a.charAt(++e);else h==="\\"?(c+=h,/\s/.test(a.charAt(e+1))||(c+=a.charAt(e+1),e+=1)):(h==="["?b=!0:h==="]"&&(b=!1),c+=h),e+=1}return c}),c=d.processGlobalFlag("i",c,function(a){b+="i";return a});for(e=0;e<this.unsupported.length;e++){var f;(f=this.unsupported[e].regex.exec(c))&&a(this.unsupported[e].func(f),f)}return RegExp(c,b)},processGlobalFlag:function(c,a,b){function d(a,c){for(var b=0,e=a.length,h=-1,f=c;f<e&&h===-1;f++)switch(a.charAt(f)){case "\\":f++;break;case "(":b++;break;case ")":b--,
b===0&&(h=f)}return h}var e="(?"+c+")",c="(?"+c+":";if(a.substring(0,e.length)===e)return b(a.substring(e.length));else if(a.substring(0,c.length)===c){e=d(a,0);if(e<a.length-1)throw Error("Only a "+c+") group that encloses the entire regex is supported in: "+a);return b(a.substring(c.length,e))}return a},hasBackReference:function(c){return/\\\d+/.test(c.source)},getSubstitutedRegex:function(c,a,b){for(var b=typeof b==="undefined"?!0:!1,c=c.source.split(/(\\\d+)/g),d=[],e=0;e<c.length;e++){var f=
c[e],g=/\\(\d+)/.exec(f);g?(f=a[g[1]]||"",d.push(b?j.escape(f):f)):d.push(f)}return RegExp(d.join(""))},groupify:function(c,a){for(var b=c.source,d=b.length,e=[],f=0,g=[],i=1,j=1,o=[],k={},s={},x=0;x<d;x++){var u=e[e.length-1],A=b.charAt(x);switch(A){case "(":if(u===4)e.pop(),o.push(")"),g[g.length-1].end=x;var z=x+2<d?b.charAt(x+1)+""+b.charAt(x+2):null;if(z==="?:"||z==="?="||z==="?!"){var r;z==="?:"?r=1:(r=3,f++);e.push(r);g.push({start:x,end:-1,type:r});o.push(A);o.push(z);x+=z.length}else e.push(2),
g.push({start:x,end:-1,type:2,oldNum:i,num:j}),o.push(A),f===0&&(s[j]=null),k[i]=j,i++,j++;break;case ")":u=e.pop();u===3&&f--;g[g.length-1].end=x;o.push(A);break;case "*":case "+":case "?":case "}":var D=A,E=b.charAt(x-1),z=x-1;if(A==="}"){for(r=x-1;b.charAt(r)!=="{"&&r>=0;r--);E=b.charAt(r-1);z=r-1;D=b.substring(r,x+1)}r=g[g.length-1];if(E===")"&&(r.type===2||r.type===4)){o.splice(r.start,0,"(");o.push(D);o.push(")");A={start:r.start,end:o.length-1,type:4,num:r.num};for(E=0;E<g.length;E++)if(u=
g[E],(u.type===2||u.type===4)&&u.start>=r.start&&u.end<=z)if(u.start+=1,u.end+=1,u.num+=1,u.type===2)k[u.oldNum]=u.num;g.push(A);j++;break}default:A!=="|"&&u!==2&&u!==4&&f===0&&(e.push(4),g.push({start:x,end:-1,type:4,num:j}),o.push("("),s[j]=null,j++),o.push(A),A==="\\"&&(A=b.charAt(x+1),o.push(A),x+=1)}}for(;e.length;)e.pop(),o.push(")");var b=RegExp(o.join("")),d={},a=a||k,y;for(y in a)a.hasOwnProperty(y)&&(d[y]="\\"+a[y]);b=this.getSubstitutedRegex(b,d,!1);return[b,k,s]},complexCaptures:function(c){if(!c)return!1;
for(var a in c)if(c.hasOwnProperty(a)&&a!=="0")return!0;return!1}};g.prototype={initialize:function(c,a,b){this.textView=c;this.textView.stylerOptions=this;var d=this;this.textView&&a&&a.startup().then(function(a){e=a.preferences;d.preferences=e;d._updateStylesheet(e,b);d.storageKey=e.listenForChangedSettings(d._listener.onStorage)});this._listener={onModelChanged:function(a){d.onModelChanged(a)},onDestroy:function(a){d.onDestroy(a)},onLineStyle:function(a){d.onLineStyle(a)},onStorage:function(a){d.onStorage(a)}};
c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Destroy",this._listener.onDestroy);c.addEventListener("LineStyle",this._listener.onLineStyle);c.redrawLines()},onDestroy:function(){this.destroy()},onStorage:function(c){c.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(c){for(c=[c];c.length!==0;){var a=c.pop();if(!a._resolvedRule||!a._typedRule)if(a._resolvedRule=this._resolve(a),a._typedRule=this._createTypedRule(a),this.addStyles(a.name),this.addStyles(a.contentName),this.addStylesForCaptures(a.captures),this.addStylesForCaptures(a.beginCaptures),this.addStylesForCaptures(a.endCaptures),a._resolvedRule!==
a&&c.push(a._resolvedRule),a.patterns)for(var b=0;b<a.patterns.length;b++)c.push(a.patterns[b])}},addStyles:function(c){if(c&&!this._styles[c]){this._styles[c]=[];for(var a=c.split("."),b=0;b<a.length;b++)this._styles[c].push(a.slice(0,b+1).join("-"))}},addStylesForCaptures:function(c){for(var a in c)c.hasOwnProperty(a)&&this.addStyles(c[a].name)},ContainerRule:function(){function c(a){this.rule=a;this.subrules=a.patterns}c.prototype.valueOf=function(){return"aa"};return c}(),BeginEndRule:function(){function c(a){this.rule=
a;this.beginRegex=d.toRegExp(a.begin);this.endRegex=d.toRegExp(a.end);this.subrules=a.patterns||[];this.endRegexHasBackRef=d.hasBackReference(this.endRegex);var c=d.complexCaptures(a.captures),a=d.complexCaptures(a.beginCaptures)||d.complexCaptures(a.endCaptures);if(this.isComplex=c||a)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]}c.prototype.valueOf=
function(){return this.beginRegex};return c}(),MatchRule:function(){function c(a){this.rule=a;this.matchRegex=d.toRegExp(a.match);if(this.isComplex=d.complexCaptures(a.captures))a=d.groupify(this.matchRegex),this.matchRegex=a[0],this.matchOld2New=a[1],this.matchConsuming=a[2]}c.prototype.valueOf=function(){return this.matchRegex};return c}(),_createTypedRule:function(c){return c.match?new this.MatchRule(c):c.begin?new this.BeginEndRule(c):new this.ContainerRule(c)},_resolve:function(c){var a=c;if(c.include){if(c.begin||
c.end||c.match)throw Error('Unexpected regex pattern in "include" rule '+c.include);c=c.include;if(c.charAt(0)==="#"){if(a=this.grammar.repository&&this.grammar.repository[c.substring(1)],!a)throw Error("Couldn't find included rule "+c+" in grammar repository");}else if(c==="$self")a=this.grammar;else if(c==="$base")throw Error('Include "$base" is not supported');else if(a=this._allGrammars[c],!a)for(var b=0;b<this.externalGrammars.length;b++){var d=this.externalGrammars[b];if(d.scopeName===c){this.preprocess(d);
a=this._allGrammars[c]=d;break}}}return a},ContainerNode:function(){function c(a,c){this.parent=a;this.rule=c;this.children=[];this.end=this.start=null}c.prototype.addChild=function(a){this.children.push(a)};c.prototype.valueOf=function(){var a=this.rule;return"ContainerNode { "+(a.include||"")+" "+(a.name||"")+(a.comment||"")+"}"};return c}(),BeginEndNode:function(){function c(a,c,b){this.parent=a;this.rule=c;this.children=[];this.setStart(b);this.endMatch=this.end=null;this.endRegexSubstituted=
c.endRegexHasBackRef?d.getSubstitutedRegex(c.endRegex,b):null}c.prototype.addChild=function(a){this.children.push(a)};c.prototype.getIndexInParent=function(){return this.parent?this.parent.children.indexOf(this):-1};c.prototype.setStart=function(a){this.start=a.index;this.beginMatch=a};c.prototype.setEnd=function(a){a&&typeof a==="object"?(this.endMatch=a,this.end=a.index+a[0].length):(this.endMatch=null,this.end=a)};c.prototype.shiftStart=function(a){this.start+=a;this.beginMatch.index+=a};c.prototype.shiftEnd=
function(a){this.end+=a;this.endMatch&&(this.endMatch.index+=a)};c.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+"}"};return c}(),push:function(c,a){if(a)for(var b=a.length;b>0;)c.push(a[--b])},exec:function(c,a,b){(a=c.exec(a))&&(a.index+=b);c.lastIndex=0;return a},afterMatch:function(c){return c.index+c[0].length},getEndMatch:function(c,a,b){if(c instanceof this.BeginEndNode){var d=c.rule,c=c.endRegexSubstituted||d.endRegex;return!c?null:this.exec(c,
a,b)}return null},initialParse:function(){this.textView.getModel().getCharCount();this._tree=new this.ContainerNode(null,this.grammar._typedRule);this.parse(this._tree,!1,0)},onModelChanged:function(c){var a=c.addedCharCount,b=c.removedCharCount,c=c.start;if(this._tree){var d=this.textView.getModel(),e=d.getCharCount(),d=d.getLineEnd(d.getLineAtOffset(c)-1),f=this.getFirstDamaged(d,d),d=d===-1?0:d,a=f?this.parse(f,!0,d,c,a,b):e;this.textView.redrawRange(d,a)}else this.initialParse()},getFirstDamaged:function(c,
a){if(c<0)return this._tree;for(var b=[this._tree],d=null;b.length;){var e=b.pop();if(!e.parent||this.isDamaged(e,c,a)){e instanceof this.BeginEndNode&&(d=e);for(var f=0;f<e.children.length;f++)b.push(e.children[f])}}return d||this._tree},isDamaged:function(c,a,b){return c.start<=b&&c.end>a},parse:function(c,a,b,d,e,f){var g=this.textView.getModel(),i=g.getLineStart(g.getLineCount()-1),j=g.getCharCount(),o=this.getInitialExpected(c,b),k=-1;if(a)c.repaired=!0,c.endNeedsUpdate=!0,k=(k=c.children[c.children.length-
1])?g.getLineEnd(g.getLineAtOffset(k.end+(e-f))):-1,d=g.getLineEnd(g.getLineAtOffset(d+f)),k=Math.max(k,d);for(var k=k===-1?j:k,d=o,s=c,x=!1,u=b,A=-1;s&&(!a||u<k);){var z=this.getNextMatch(g,s,u);z||(u=u>=i?j:g.getLineStart(g.getLineAtOffset(u)+1));var r=z&&z.match,D=z&&z.rule,E=z&&z.isEnd;if(z&&z.isSub){if(u=this.afterMatch(r),D instanceof this.BeginEndRule)x=!0,a&&D===d.rule&&s===d.parent?(s=d,s.setStart(r),s.repaired=!0,s.endNeedsUpdate=!0,d=this.getNextExpected(d,"begin")):(a&&(this.prune(s,d),
a=!1),r=new this.BeginEndNode(s,D,r),s.addChild(r),s=r)}else if(E||u===j){if(s instanceof this.BeginEndNode)r?(x=!0,A=Math.max(A,s.end),s.setEnd(r),u=this.afterMatch(r),a&&s===d&&s.parent===d.parent?(s.repaired=!0,delete s.endNeedsUpdate,d=this.getNextExpected(d,"end")):a&&(this.prune(s,d),a=!1)):(s.setEnd(j),delete s.endNeedsUpdate);s=s.parent}a&&u>=k&&!x&&(this.prune(c,o),a=!1)}this.removeUnrepairedChildren(c,a,b);this.cleanup(a,c,b,k,j,e,f);return a?Math.max(A,u):u},removeUnrepairedChildren:function(c,
a,b){if(a){for(var a=c.children,d=-1,e=0;e<a.length;e++){var f=a[e];if(!f.repaired&&this.isDamaged(f,b,Number.MAX_VALUE)){d=e;break}}if(d!==-1)c.children.length=d}},cleanup:function(c,a,b,d,e,f,g){if(c){c=f-g;e=this.getIntersecting(d-c+1,e);a=this.getIntersecting(b,d);for(b=0;b<e.length;b++)d=e[b],!d.repaired&&d instanceof this.BeginEndNode&&(d.shiftEnd(c),d.shiftStart(c));for(b=0;b<a.length;b++)d=a[b],d.repaired&&d.endNeedsUpdate&&d.shiftEnd(c),delete d.endNeedsUpdate,delete d.repaired}else{a=this.getIntersecting(b,
d);for(b=0;b<a.length;b++)delete a[b].repaired}},getNextMatch:function(c,a,b,d){var e=c.getLineAtOffset(b),e=c.getLineEnd(e),f=c.getText(b,e),g=[],i=[],c=[],e=[];for(this.push(g,a.rule.subrules);g.length;){var j=g.length?g.pop():null,j=j&&j._resolvedRule._typedRule;if(j instanceof this.ContainerRule&&i.indexOf(j)===-1)i.push(j),this.push(g,j.subrules);else if(!j||!d||j.matchRegex){var o=j&&this.exec(j.matchRegex||j.beginRegex,f,b);o&&(c.push(o),e.push(j))}}g=Number.MAX_VALUE;i=-1;for(j=0;j<c.length;j++)if(o=
c[j],o.index<g)g=o.index,i=j;if(!d&&(b=this.getEndMatch(a,f,b)))if(d=a.rule.applyEndPatternLast,i===-1||b.index<g||!d&&b.index===g)return{isEnd:!0,rule:a.rule,match:b};return i===-1?null:{isSub:!0,rule:e[i],match:c[i]}},getInitialExpected:function(c,a){var b,d;if(c===this._tree)for(b=0;b<c.children.length;b++){if(d=c.children[b],d.start>=a)return d}else if(c instanceof this.BeginEndNode&&c.endMatch){var e=c.endMatch.index;for(b=0;b<c.children.length;b++)if(d=c.children[b],d.start>=a)break;if(d&&d.start<
e)return d}return c},getNextExpected:function(c,a){if(a==="begin"){var b=c.children[0];return b?b:c}else if(a==="end"&&(b=c.parent)){var d=b.children[b.children.indexOf(c)+1];return d?d:b}return null},prune:function(c,a){if(a.parent===c)c.children.length=a.getIndexInParent();else if(c instanceof this.BeginEndNode)c.endMatch=null,c.end=null;if(c.parent)c.parent.children.length=c.getIndexInParent()+1},onLineStyle:function(c){this._tree||this.initialParse();var a=c.lineStart,b=this.textView.getModel(),
d=b.getLineEnd(c.lineIndex),e=b.getLineEnd(b.getLineAtOffset(a)-1),e=this.getFirstDamaged(e,e),a=this.getLineScope(b,e,a,d);c.ranges=this.toStyleRanges(a);c.ranges.sort(function(a,c){return a.start-c.start})},getLineScope:function(c,a,b,d){for(var e=b,f=this.getInitialExpected(a,b),g=[],i=[];a&&e<d;){var j=this.getNextMatch(c,a,e);if(!j)break;var o=j&&j.match,k=j&&j.rule,s=j&&j.isSub,j=j&&j.isEnd;o.index!==e&&i.push({start:e,end:o.index,node:a});if(s)e=this.afterMatch(o),k instanceof this.BeginEndRule?
(this.addBeginScope(g,o,k),a=f,f=this.getNextExpected(f,"begin")):this.addMatchScope(g,o,k);else if(j)e=this.afterMatch(o),this.addEndScope(g,o,k),f=this.getNextExpected(f,"end"),a=a.parent}e<d&&i.push({start:e,end:d,node:a});c=this.getInheritedLineScope(i,b,d);return g.concat(c)},getInheritedLineScope:function(c){for(var a=[],b=0;b<c.length;b++)for(var d=c[b],e=d.node;e;){var f=e.rule.rule,g=f.name;if(f=f.contentName||g){this.addScopeRange(a,d.start,d.end,f);break}e=e.parent}return a},addBeginScope:function(c,
a,b){var d=b.rule;this.addCapturesScope(c,a,d.beginCaptures||d.captures,b.isComplex,b.beginOld2New,b.beginConsuming)},addEndScope:function(c,a,b){var d=b.rule;this.addCapturesScope(c,a,d.endCaptures||d.captures,b.isComplex,b.endOld2New,b.endConsuming)},addMatchScope:function(c,a,b){var d=b.rule,e=d.name;(d=d.captures)?this.addCapturesScope(c,a,d,b.isComplex,b.matchOld2New,b.matchConsuming):this.addScope(c,a,e)},addScope:function(c,a,b){b&&c.push({start:a.index,end:this.afterMatch(a),scope:b})},addScopeRange:function(c,
a,b,d){d&&c.push({start:a,end:b,scope:d})},addCapturesScope:function(c,a,b,d,e,f){if(b)if(d){for(var d={1:0},g=0,i=1;a[i]!==void 0;i++)f[i]!==void 0&&(g+=a[i].length),a[i+1]!==void 0&&(d[i+1]=g);f=a.index;for(g=1;b[g];g++){var i=b[g].name,j=e[g],o=f+d[j];typeof a[j]!=="undefined"&&this.addScopeRange(c,o,o+a[j].length,i)}}else this.addScope(c,a,b[0]&&b[0].name)},getIntersecting:function(c,a){for(var b=[],d=this._tree?[this._tree]:[];d.length;){var e=d.pop(),f=!1;e instanceof this.ContainerNode?f=!0:
this.isDamaged(e,c,a)&&(f=!0,b.push(e));if(f)for(var f=e.children.length,g=0;g<f;g++)d.push(e.children[g])}return b.reverse()},toStyleRanges:function(c){for(var a=[],b=0;b<c.length;b++){var d=c[b],e=this._styles[d.scope];if(!e)throw Error("styles not found for "+d.scope);e=e.join(" ");a.push({start:d.start,end:d.end,style:{styleClass:e}})}return a}};return{RegexUtil:d,TextMateStyler:g}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(j,k){function i(b){return b.getProperty("objectClass").indexOf(f)!==-1&&b.getProperty("type")==="highlighter"}function b(b,d,c){this.initialize(b,d,c);this.lineStyles=[]}var f="orion.edit.highlighter",g=f+" service must be an event emitter";k.AnnotationType.registerType("orion.annotation.highlightError",{title:j.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});
b.prototype={initialize:function(b,d,c){this.textView=b;this.serviceRegistry=d;this.annotationModel=c;this.services=[];var a=this;this.listener={onModelChanging:function(c){a.onModelChanging(c)},onModelChanged:function(c){a.onModelChanged(c)},onDestroy:function(c){a.onDestroy(c)},onLineStyle:function(c){a.onLineStyle(c)},onStyleReady:function(c){a.onStyleReady(c)},onServiceAdded:function(c){a.onServiceAdded(c.serviceReference,a.serviceRegistry.getService(c.serviceReference))},onServiceRemoved:function(c){a.onServiceRemoved(c.serviceReference,
a.serviceRegistry.getService(c.serviceReference))}};b.addEventListener("ModelChanging",this.listener.onModelChanging);b.addEventListener("ModelChanged",this.listener.onModelChanged);b.addEventListener("Destroy",this.listener.onDestroy);b.addEventListener("LineStyle",this.listener.onLineStyle);d.addEventListener("registered",this.listener.onServiceAdded);d.addEventListener("unregistering",this.listener.onServiceRemoved);b=d.getServiceReferences(f);for(c=0;c<b.length;c++){var h=b[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 b=0;b<this.services.length;b++)this.removeServiceListener(this.services[b]);this.services=
null}if(this.serviceRegistry)this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null;this.lineStyles=this.listener=null},onModelChanging:function(b){this.startLine=this.textView.getModel().getLineAtOffset(b.start)},onModelChanged:function(b){var d=this.startLine;(b.addedLineCount||b.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[d,b.removedLineCount].concat(this._getEmptyStyle(b.addedLineCount)))},
onStyleReady:function(b){var d=b.lineStyles||b.style,b=Number.MAX_VALUE,c=-1,a=this.textView.getModel(),h;for(h in d)d.hasOwnProperty(h)&&(this.lineStyles[h]=d[h],b=Math.min(b,h),c=Math.max(c,h));b=Math.max(b,0);c=Math.min(c,a.getLineCount());if(d=this.annotationModel){for(var f=d.getAnnotations(a.getLineStart(b),a.getLineEnd(c)),g=[];f.hasNext();){var i=f.next();i.type==="orion.annotation.highlightError"&&g.push(i)}f=[];for(i=b;i<=c;i++){h=i;var j=this.lineStyles[h],j=j&&j.errors;h=a.getLineStart(h);
if(j)for(var m=0;m<j.length;m++){var t=j[m];f.push(k.AnnotationType.createAnnotation("orion.annotation.highlightError",t.start+h,t.end+h))}}d.replaceAnnotations(g,f)}this.textView.redrawLines(b,c+1)},onLineStyle:function(b){function d(a,c){for(var b=a.length,d=[],e=0;e<b;e++){var f=a[e];d.push({start:f.start+c,end:f.end+c,style:f.style})}return d}var c=this.lineStyles[b.lineIndex];if(c)if(c.ranges)b.ranges=d(c.ranges,b.lineStart);else if(c.style)b.style=c.style},_getEmptyStyle:function(b){for(var d=
[],c=0;c<b;c++)d.push(null);return d},setContentType:function(b){this.contentType=b;if(this.services)for(b=0;b<this.services.length;b++){var d=this.services[b];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(b,d){i(b)&&this.addServiceListener(d)},onServiceRemoved:function(b,
d){this.services.indexOf(d)!==-1&&this.removeServiceListener(d)},addServiceListener:function(b){if(typeof b.addEventListener==="function"){if(b.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(b),b.setContentType&&this.contentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}else typeof console!==
"undefined"&&console.log(Error(g))},removeServiceListener:function(b){typeof b.removeEventListener==="function"?(b.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),b=this.services.indexOf(b),b!==-1&&this.services.splice(b,1)):typeof console!=="undefined"&&console.log(Error(g))}};return b});
define("examples/editor/textStylerOptions",["orion/bootstrap","orion/editor/util"],function(j,k){function i(f){this._styler=f;this._view=this._styler.view;this._view.stylerOptions=this;var g=this;this._listener={onStorage:function(b){g._onStorage(b)}};var e=this;this._view&&j.startup().then(function(d){b=d.preferences;e.preferences=b;e._updateStylesheet(b);e.storageKey=b.listenForChangedSettings(e._listener.onStorage)})}var b;i.prototype={_getSetting:function(b,g,e){for(var d,c=0;c<b.length;c++)if(b[c].label===
g)for(var a=0;a<b[c].data.length;a++)if(b[c].data[a].label===e){d=b[c].data[a].value;break}return d},_styleSheet:function(b,g){function e(c,b){var e=h.getClassNameForToken(c);if(e){var f=d[b];a.push("."+g+" ."+e+" {");a.push("\tcolor: "+f+";");a.push("}")}}for(var d=[],c=0;c<b.length;c++)d[b[c].element]=b[c].value;var a=[];a.push("");c=d.fontFamily;c=c==="sans serif"?'"Menlo", "Consolas", "Vera Mono", "monospace"':"monospace";a.push("."+g+" {");a.push("\tfont-family: "+c+";");a.push("\tfont-size: "+
d.fontSize+";");a.push("\tcolor: "+d.text+";");a.push("}");a.push("."+g+" .textview {");a.push("\tbackground-color: "+d.background+";");a.push("}");a.push("."+g+".ruler.annotations{");a.push("\tbackground-color: red;");a.push("}");a.push("."+g+" .ruler {");a.push("\tbackground-color: "+d.annotationRuler+";");a.push("}");a.push("."+g+" .rulerLines {");a.push("\tcolor: "+d.lineNumber+";");a.push("\tbackground-color: "+d.annotationRuler+";");a.push("}");a.push("."+g+" .rulerLines.even {");a.push("\tcolor: "+
d.lineNumber+";");a.push("\tbackground-color: "+d.annotationRuler+";");a.push("}");a.push("."+g+" .rulerLines.odd {");a.push("\tcolor: "+d.lineNumber+";");a.push("\tbackground-color: "+d.annotationRuler+";");a.push("}");a.push("."+g+" .annotationLine.currentLine {");a.push("\tbackground-color: "+d.currentLine+";");a.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 a.join("\n")},_onStorage:function(b){b.key===this.storageKey&&this._updateStylesheet(this.preferences)},_update:function(b,g,e){if(b){if(g._stylesheet)g._stylesheet.parentNode.removeChild(g._stylesheet),g._stylesheet=null;var d=g._view,c=d.getOptions("parent").ownerDocument,a=g._stylesheet=k.createElement(c,"style");a.appendChild(c.createTextNode(g._styleSheet(b,"userTheme",e)));(c.getElementsByTagName("head")[0]||c.documentElement).appendChild(a);b={themeClass:null};
d.getOptions(b);(g=b.themeClass)?((g=g.replace("userTheme",""))&&(g+=" "),g+="userTheme"):g="userTheme";b.themeClass=g;d.setOptions(b);d.update(!0)}},_updateStylesheet:function(b,g){var e,d=this;b.getPreferences("/settings",2).then(function(c){c.get("JavaScript Editor")!==void 0&&(e=JSON.parse(c.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,k,i,b,f,g,e){function d(a,c,d,n,q,p,m){function t(a,b){var f=a.getProperty("contentType"),g=a.getProperty("fileTypes");if(f)return c.isSomeExtensionOf(d,f).then(function(c){return c?a:null});else if(b&&g&&g.indexOf(b)!==-1)return f=new e,f.resolve(a),f;return null}var o=function(a){var c=
null;switch(a&&a.id){case "application/javascript":case "application/json":c=new j.TextStyler(n,"js",q);break;case "text/x-java-source":c=new j.TextStyler(n,"java",q);break;case "text/css":c=new j.TextStyler(n,"css",q)}c&&new b.TextStylerOptions(c);return c}(d);if(o)return p=new e,p.resolve(o),p;for(var o=p&&p.split(".").pop().toLowerCase(),p=a.getServiceReferences("orion.edit.highlighter"),w=[],s=[],x=0;x<p.length;x++){var u=p[x];u.getProperty("type")==="grammar"&&w.push(u.getProperty("grammar"));
(u=t(u,o))&&s.push(u)}return e.all(s,function(a){return{_error:a}}).then(function(c){for(var b,e=c.length-1;e>=0;e--){var h=c[e];if(h&&!h._error&&(m||h.getProperty("type")!=="highlighter")){b=h;break}}var j;if(b)if(c=b.getProperty("type"),c==="highlighter")j=new i(n,a,q),j.setContentType(d);else if(c==="grammar"||typeof c==="undefined")b=b.getProperty("grammar"),j=new k.TextMateStyler(n,b,w,f,g);return j})}function c(a){this.serviceRegistry=a;this.styler=null}c.prototype={setup:function(a,c,b,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"),a,c,b,e,f).then(function(a){return g.styler=a})},getStyler:function(){return this.styler}};return{createStyler:d,SyntaxHighlighter:c}});
define("orion/compare/diffTreeNavigator",["orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(j,k,i,b){var f={},g,e,d,c,a,h,l,n,q,p,m,t,o,w,s,x;f.DiffTreeNavigator=function(){function f(a,c,b,d,e,h){this._root={type:"root",children:[]};this._initialized=!1;this.initAll(a,c,b,d,e,h)}g="orion.annotation.diff.addedBlock";e="orion.annotation.diff.currentAddedBlock";d="orion.annotation.diff.deletedBlock";c="orion.annotation.diff.currentDeletedBlock";
a="orion.annotation.diff.blockTop";h="orion.annotation.diff.currentBlockTop";l="orion.annotation.diff.blockConflict";n="orion.annotation.diff.currentBlockConflict";q="orion.annotation.diff.addedWord";p="orion.annotation.diff.currentAddedWord";m="orion.annotation.diff.deletedWord";t="orion.annotation.diff.currentDeletedWord";o="orion.annotation.diff.emptyDeletedWordLeft";w="orion.annotation.diff.emptyDeletedWordRight";s="orion.annotation.diff.emptyAddedWordLeft";x="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(a,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}});
i.AnnotationType.registerType(h,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}});i.AnnotationType.registerType(l,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}});i.AnnotationType.registerType(n,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}});i.AnnotationType.registerType(q,{title:"word added",html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}});i.AnnotationType.registerType(p,{title:"",
html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}});i.AnnotationType.registerType(m,{title:"word deleted",html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}});i.AnnotationType.registerType(t,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}});i.AnnotationType.registerType(o,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}});i.AnnotationType.registerType(w,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}});
i.AnnotationType.registerType(s,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}});i.AnnotationType.registerType(x,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});f.prototype={initAll:function(a,c,b,d,e,h,f){this._charOrWordDiff=a?a:"word";if(c)this._initialized=!0;this.editorWrapper=[{editor:c,diffFeeder:d},{editor:b,diffFeeder:e}];this._curveRuler=f;(this._overviewRuler=h)&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(a){if(a)for(var c=
0;c<this.editorWrapper.length;c++)this.editorWrapper[c].diffFeeder.init(this.editorWrapper[c].editor.getTextView().getModel(),a)},destroy:function(){this.initAll(this._charOrWordDiff)},renderAnnotations:function(){var a;for(a=0;a<this.editorWrapper.length;a++){this.editorWrapper[a].annoTypes=[];this.editorWrapper[a].diffFeeder.getBlockAnnoTypes(this.editorWrapper[a].annoTypes);this.editorWrapper[a].diffFeeder.getWordAnnoTypes(this.editorWrapper[a].annoTypes);for(var c=0;c<this.editorWrapper[a].annoTypes.length;c++)this.editorWrapper[a].annoTypes[c].current&&
this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[c].current),this.editorWrapper[a].annoTypes[c].normal&&this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].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 b.JSDiffAdapter;for(a=0;a<c.length;a++){var e=this.generatePairBlockAnnotations(this._root,a);this._root.children.push(e);var h=this.generatePairWordAnnotations(e,a,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(a,c,b,d,e){if(this.editorWrapper[c].annoTypes)for(var h=0;h<this.editorWrapper[c].annoTypes.length;h++)this.editorWrapper[c].annoTypes[h].type===b&&this.replaceDiffAnnotations(this.editorWrapper[c].editor,e?e:this.editorWrapper[c].annoTypes[h].list,d?this.editorWrapper[c].annoTypes[h].normal:this.editorWrapper[c].annoTypes[h].current,
a)},getMapper:function(){return this.editorWrapper[0].diffFeeder.getMapper()},getFeeder:function(a){return a?this.editorWrapper[1].diffFeeder:this.editorWrapper[0].diffFeeder},iterateOnBlock:function(a,c){this.iterator&&(this.iterator.iterateOnTop(a,c),this.updateCurrentAnnotation(!0))},iterateOnChange:function(a){if(this.iterator){this.iterator.iterate(a);var c=this.iterator.cursor();c.type==="block"&&c.children&&c.children.length>0&&this.iterator.iterate(a);this.updateCurrentAnnotation(!0)}},gotoBlock:function(a,
c){if(this.iterator){if(a<0||a>=this._root.children.length||this._root.children.length===0)a=0;c!==void 0&&c>=0&&this._root.children[a].children&&c<this._root.children[a].children.length?this.iterator.setCursor(this._root.children[a].children[c]):this.iterator.setCursor(this._root.children[a]);this.updateCurrentAnnotation(!1);this._positionDiffBlock()}},_hitDiffAnnotation:function(a,c,b){if(b===this.editorWrapper[a].editor.getTextView()){for(var d=0;d<this._root.children.length;d++){var b=this._root.children[d],
e=a===0?b.oldA:b.newA;if(c>=e.start&&c<=e.end){d=b;if(b.children&&b.children.length>0)for(e=0;e<b.children.length;e++){var h=b.children[e],f=a===0?h.oldA:h.newA;if(c>=f.start&&c<=f.end){d=h;break}}return d}}return null}},gotoChange:function(a,c){for(var b=0;b<this.editorWrapper.length;b++){var d=this._hitDiffAnnotation(b,a,c);if(d)return this.iterator.setCursor(d),this.updateCurrentAnnotation(!1,c),!0}return!1},getCurrentBlockIndex:function(){if(!this.iterator)return-1;var a=this.iterator.cursor();
return!a?-1:a.type==="block"?a.index:a.parent.index},getCurrentPosition:function(){if(!this.iterator)return{};var a=this.iterator.cursor();return a.type==="block"?{block:a.index+1}:{block:a.parent.index+1,change:a.index+1}},getCurrentMapperIndex:function(){var a=this.getCurrentBlockIndex();a<0&&(a=0);var c=this.getFeeder().getDiffBlocks();if(!c||c.length===0)return-1;a>c.length-1&&(a=0);return c[a][1]},replaceDiffAnnotations:function(a,c,b,d){if(c&&b&&(a=a.getAnnotationModel())){for(var e=a.getAnnotations(0,
a.getTextModel().getCharCount()),h=[];d&&e.hasNext();){var f=e.next();f.type===b&&h.push(f)}a.replaceAnnotations(h,c)}},updateCurrentAnnotation:function(a,c){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 b=this.iterator.cursor();if(b){var d,e,h={start:b.oldA.start,end:b.oldA.end},f={start:b.newA.start,end:b.newA.end};b.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(b.index),e=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(b.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(a)this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(b.oldA.start,b.oldA.end,!0),this.editorWrapper[1].editor.setSelection(b.newA.start,b.newA.end,!0),this.autoSelecting=!1;else if(c)this.autoSelecting=!0,c!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(b.oldA.start,b.oldA.end,!0),c!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(b.newA.start,b.newA.end,!0),this.autoSelecting=!1}}},generatePairBlockAnnotations:function(a,
c){var b=this.generateBlockDiffAnnotations(0,c),d=this.generateBlockDiffAnnotations(1,c);return{parent:a,index:c,type:"block",oldA:b,newA:d}},generatePairWordAnnotations:function(a,c,b){var d=this.editorWrapper[0].diffFeeder.getTextOnBlock(c),e=this.editorWrapper[1].diffFeeder.getTextOnBlock(c),c=null,h=0,f=0;if(d&&e&&d.text&&e.text&&d.text.length<=5E3&&e.text.length<=5E3)c=b.adaptCharDiff(d.text,e.text,this._charOrWordDiff==="word"),f=e.start,h=d.start;else return null;b=[];d=[];this.generateWordDiffAnnotations(0,
b,h,c,2,3);this.generateWordDiffAnnotations(1,d,f,c,0,1);c=[];for(h=0;h<b.length;h++)c.push({parent:a,index:h,type:"word",oldA:b[h],newA:d[h]});return c},getAnnoModelList:function(a,c,b){for(var d=0;d<this.editorWrapper[a].annoTypes.length;d++)if(this.editorWrapper[a].annoTypes[d].type===c&&this.editorWrapper[a].annoTypes[d].normal===b)return this.editorWrapper[a].annoTypes[d].list;return null},generateBlockDiffAnnotations:function(a,c){var b=this.editorWrapper[a].diffFeeder.getCurrentBlockAnnoType(c),
d=this.getAnnoModelList(a,"block",b.normal),e=this.editorWrapper[a].diffFeeder.getCharRange(c),b=i.AnnotationType.createAnnotation(b.normal,e.start,e.end);d&&d.push(b);return b},generateWordDiffAnnotations:function(a,c,b,d,e,h){if(d)for(var f=this.editorWrapper[a].diffFeeder.getCurrentWordAnnoType({start:-1,end:-1}),a=this.getAnnoModelList(a,"word",f.normal),g=0;g<d.length;g++){var j=i.AnnotationType.createAnnotation(f.normal,d[g][e]+b,d[g][h]+b);a.push(j);c.push(j)}},_updateOverviewRuler:function(){if(this._overviewRuler){var a=
this.editorWrapper[0].editor.getTextView().getTopIndex();this.editorWrapper[0].editor.getTextView().redrawLines(a,a+1,this._overviewRuler)}},_updateCurveRuler:function(){this._curveRuler&&this._curveRuler.render()},_setTextViewPosition:function(a,c){var b=a.getLineHeight(),d=a.getClientArea(),b=Math.floor(d.height/b/3);a.setTopIndex(c-b>0?c-b:0)},_positionDiffBlock:function(){var a=this.getCurrentBlockIndex();a<0&&(a=0);var c=this.getFeeder().getDiffBlocks();c.length!==0&&(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),
c[a][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor&&(a=k.lookUpLineIndex(this.getMapper(),0,c[a][1]),this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),a)),this._updateOverviewRuler(),this._updateCurveRuler())},matchPositionFromOverview:function(a){this._initialized&&this.gotoBlock(a<0?0:k.getAnnotationIndex(this.getFeeder().getDiffBlocks(),a))},gotoDiff:function(a,c){this.gotoChange(a,c)&&(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 a(){}a.prototype={getWordAnnoTypes:function(a){this._mapperColumnIndex===0?a.push({type:"word",current:p,normal:q,list:[]}):a.push({type:"word",current:t,normal:m,list:[]});a.push({type:"word",current:o});
a.push({type:"word",current:w});a.push({type:"word",current:s});a.push({type:"word",current:x})},getCurrentWordAnnoType:function(a,c){return a.start===a.end&&c?this._mapperColumnIndex===0?{current:this._repositionEmptyWord(a,c),normal:q}:{current:this._repositionEmptyWord(a,c),normal:m}:this._mapperColumnIndex===0?{current:p,normal:q}:{current:t,normal:m}},_repositionEmptyWord:function(a,c){var b=c.getLineAtOffset(a.start),d=c.getLineStart(b),e=c.getLineEnd(b);if(d!==e){if(a.start===e)return a.start--,
this._mapperColumnIndex===0?x:w;a.end++}else if(b>0&&(b--,d=c.getLineStart(b),e=c.getLineEnd(b),d!==e))return a.start=e-1,a.end=e,this._mapperColumnIndex===0?x:w;return this._mapperColumnIndex===0?s:o},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return-1;a=this._diffBlocks[a][1];return a===-1?0:this._mapper[a][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},
getLineNumber:function(a){return a},getCharRange:function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return null;var c=this._diffBlocks[a][0],b=c+this._mapper[this._diffBlocks[a][1]][this._mapperColumnIndex]-1,a=this._textModel.getLineStart(c);if(b<c)return{start:a,end:a};c=this._textModel.getLineEnd(b,!0);return{start:a,end:c}},getTextOnBlock:function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return null;a=this.getCharRange(a);return{start:a.start,text:this._textModel.getText(a.start,
a.end)}},isMapperEmpty:function(){return this._mapper.length===0}};return a}();f.TwoWayDiffBlockFeeder=function(){function b(a,c,d){this._mapperColumnIndex=d;this.init(a,c)}b.prototype=new f.DiffBlockFeeder;b.prototype.init=function(a,c){this._textModel=a;this._diffBlocks=void 0;if(c){this._mapper=c;this._diffBlocks=[];for(var b=0,d=0;d<this._mapper.length;d++)this._mapper[d][2]!==0&&this._diffBlocks.push([b,d]),b+=this._mapper[d][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:a,current:h,list:[]});b.push({type:"block",normal:l,current:n,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{normal:a,current:h};else if(k.isMapperConflict(this.getMapper(),b))return{normal:l,current:n};else if(this._mapperColumnIndex===
0)return{type:"block",normal:g,current:e,list:[]};return{type:"block",normal:d,current:c,list:[]}};return b}();f.inlineDiffBlockFeeder=function(){function a(c,b){this._mapperColumnIndex=b;this.init(c)}a.prototype=new f.DiffBlockFeeder;a.prototype.setModel=function(a){this._textModel=a};a.prototype.init=function(a){this._diffBlocks=void 0;if(a){this._mapper=a;this._diffBlocks=[];this._gapBlocks=[];for(var c=a=0,b=0;b<this._mapper.length;b++){if(this._mapper[b][2]!==0){if(this._mapperColumnIndex===
0){var d=a+this._mapper[b][1];this._diffBlocks.push([d,b]);this._gapBlocks.push([d,d+this._mapper[b][0],c])}else this._diffBlocks.push([a,b]),this._gapBlocks.push([a,a+this._mapper[b][1],c]);a+=this._mapper[b][0]+this._mapper[b][1]}else this._gapBlocks.push([a,a+this._mapper[b][this._mapperColumnIndex],c]),a+=this._mapper[b][this._mapperColumnIndex];c+=this._mapper[b][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:l,current:n,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{current:p,normal:q};else if(k.isMapperConflict(this.getMapper(),a))return{normal:l,current:n};else if(this._mapperColumnIndex===0)return{type:"block",normal:g,current:e,list:[]};return{type:"block",normal:d,
current:c,list:[]}};a.prototype.getDiffBlockH=function(a){if(!this._diffBlocks||this._diffBlocks.length===0)return-1;a=this._diffBlocks[a][1];return this._mapper[a][0]+this._mapper[a][1]};a.prototype.getLineNumber=function(a){for(var c=0;c<this._gapBlocks.length;c++)if(this._gapBlocks[c][0]!==this._gapBlocks[c][1]&&a>=this._gapBlocks[c][0]&&a<this._gapBlocks[c][1])return a-this._gapBlocks[c][0]+this._gapBlocks[c][2];return-1};return a}();return f});
define("orion/compare/compare-rulers",["orion/compare/compareUtils","orion/compare/diffTreeNavigator"],function(j){var k=k||{};k.CompareRuler=function(){function i(b,f,g){this._location=b||"left";this._overview=f||"page";this._rulerStyle=g;this._editor=null;var e=this;this._listener={onModelChanged:function(b){e._onModelChanged(b)}}}i.prototype={setView:function(b){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged);this._editor=b;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(b,f){for(var g=[],e=b;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}();k.LineNumberCompareRuler=function(){function i(b,f,g,e,d,c){k.CompareRuler.call(this,g,"page",e);this._diffNavigator=b;this._oddStyle=d||{style:{backgroundColor:"white"}};this._evenStyle=c||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._mapperColumnIndex=f}i.prototype=new k.CompareRuler;i.prototype.getStyle=function(b){return b===void 0?this._rulerStyle:this._evenStyle};i.prototype.getHTML=function(b){var f=
this._editor.getModel(),g=this._diffNavigator.getFeeder(this._mapperColumnIndex===0);return!g?"":b===-1?f.getLineCount():g.getLineNumber?(b=g.getLineNumber(b),b===-1?"":b+1):b+1};i.prototype._onModelChanged=function(b){var b=b.start,f=this._editor.getModel(),g=f.getLineCount(),e=(g+"").length;if(this._numOfDigits!==e)this._numOfDigits=e,this._editor.redrawLines(f.getLineAtOffset(b),g,this)};return i}();k.CompareOverviewRuler=function(){function i(b,f,g,e){this._diffNavigator=g;this._onClick=e;k.CompareRuler.call(this,
b,"document",f)}i.prototype=new k.CompareRuler;i.prototype.getStyle=function(b){var f,g;if(b===void 0)f=this._rulerStyle||{},g=f.style||(f.style={}),g.lineHeight="1px",g.fontSize="1px",g.width="14px";else if(f=b!==-1?{styleClass:"annotationOverview breakpoint"}:{},g=f.style||(f.style={}),g.cursor="pointer",g.width="8px",g.left="2px",this._editor.getModel(),b>=0){var e;if(this._diffNavigator&&this._diffNavigator.getFeeder())e=this._diffNavigator.getFeeder().getDiffBlocks();else return null;b=j.getAnnotationIndex(e,
b);if(b===-1)return null;e=j.getAnnotationMapperIndex(e,b);var d;d=this._diffNavigator.getMapper();if(e=j.isMapperConflict(d,e))g.border="1px #FF0000 solid";if(b===this._diffNavigator.getCurrentBlockIndex())g.backgroundColor=e?"red":"blue";b=this._diffNavigator.getFeeder().getDiffBlockH(b);e=this._diffNavigator.getFeeder().getOverviewLineCount();if(b<0)return null;d=this._editor.getClientArea();b=Math.floor(d.height*b/e);b<2&&(b=2);g.height=b+"px"}else return g.height="3px";return f};i.prototype.setDiffNavigator=
function(b){this._diffNavigator=b};i.prototype.getHTML=function(){return"&nbsp;"};i.prototype.onClick=function(b){b!==void 0&&this._onClick(b,this)};i.prototype._onModelChanged=function(){this._editor.getModel().getLineCount()>0&&this._editor.redrawLines(0,1,this)};return i}();k.CompareCurveRuler=function(){function i(b){this._canvasDiv=b;this._mapper=void 0;this._initialized=!1}i.prototype={init:function(b,f,g,e){this._initing=this._initialized=!0;this._mapper=b;this._leftEditor=f;this._rightEditor=
g;this._leftTextView=f.getTextView();this._rightTextView=g.getTextView();this._diffNavigator=e;this.render()},matchPositionFrom:function(b){var f=b?this._leftTextView:this._rightTextView,g=b?this._rightTextView:this._leftTextView,e=f.getTopIndex(),f=f.getBottomIndex(),b=j.matchMapper(this._mapper,b?0:1,e,f);g.setTopIndex(b)},copyToLeft:function(){if(this._diffNavigator.iterator){var b=this._diffNavigator.iterator.cursor();b&&this._leftTextView.setText(this._rightTextView.getText(b.oldA.start,b.oldA.end),
b.newA.start,b.newA.end)}},render:function(){if(this._mapper){var b=this._canvasDiv.getContext("2d");b.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height);b.strokeStyle="#AAAAAA";b.lineWidth=1;b.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,a=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,a,e,d))this._renderCurve(i,c,a,this._canvasDiv,b,f,g,e,d),h=!0;else if(h)break;c+=this._mapper[i][0];a+=this._mapper[i][1]}b.stroke()}},_renderCurve:function(b,f,g,e,d){var c=this._mapper[b],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;
b===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(b){if(b.removedLineCount!==b.addedLineCount)this._initing||j.updateMapper(this._mapper,0,this._leftTextView.getModel().getLineAtOffset(b.start),b.removedLineCount,b.addedLineCount),this._initing=
!1,(b.removedLineCount>0||b.addedLineCount>0)&&this.render()}};return i}();return k});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(j,k,i){function b(b,g){this._activeContainer=null;this._getElementsFunction=b;this._toolbarLayoutFunction=g}b.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(b,g,e){typeof b==="string"&&(b=i.node(b));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===b)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(b))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=e;var d=g(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!d)return!1;this._activeElements.focusNode=d;b=i.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(b.length===0){g=this._activeElements.dismissArea||
this._activeElements.parameterArea;b=document.createElement("span");b.id="closebox";b.role="button";b.tabIndex=0;b.classList.add("imageSprite");b.classList.add("core-sprite-close");b.classList.add("dismiss");b.title=j.Close;g.appendChild(b);var c=this;b.addEventListener("click",function(){c.close()},!1);b.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.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(b,g){i.$$array("input",g).forEach(function(e){e.type==="checkbox"?b.parameters.setValue(e.parameterName,e.checked):e.type!=="button"&&b.parameters.setValue(e.parameterName,e.value.trim())});i.$$array("textArea",g).forEach(function(e){b.parameters.setValue(e.parameterName,
e.value.trim())});b.command.callback&&b.command.callback.call(b.handler,b)},collectParameters:function(b){return b.parameters?(b.domNode&&b.domNode.classList.add("commandMarker"),this.open(b.domNode||b.domParent,this.getFillFunction(b))):!1},getFillFunction:function(b,g){var e=this;return function(d,c){var a=null,h=function(){g&&g();e.close()},l=function(a){a.keyCode===i.KEY.ENTER&&e._collectAndCall(b,d);if(a.keyCode===i.KEY.ESCAPE||a.keyCode===i.KEY.ENTER)h(),i.stop(a)};b.parameters.forEach(function(c){var b=
null;if(c.label)b=document.createElement("label"),b.classList.add("parameterInput"),b.setAttribute("for",c.name+"parameterCollector"),b.textContent=c.label,d.appendChild(b);var e=c.name+"parameterCollector",f=b||d;if(c.type==="text"&&typeof c.lines==="number"&&c.lines>1)b=document.createElement("textarea"),b.rows=c.lines,b.type="textarea",b.id=e,f.appendChild(b),l=function(a){a.keyCode===i.KEY.ESCAPE&&(h(),i.stop(a))};else if(c.type==="boolean"){if(b=document.createElement("input"),b.type="checkbox",
b.id=e,f.appendChild(b),c.value)b.checked=!0}else if(b=document.createElement("input"),b.type=c.type,b.id=e,f.appendChild(b),c.value)b.value=c.value;b.classList.add("parameterInput");b.classList.add("parameterInput"+b.type);b.setAttribute("speech","speech");b.setAttribute("x-webkit-speech","x-webkit-speech");b.parameterName=c.name;a||(a=b);b.addEventListener("keydown",l,!1)});var n=c;if(!n)n=document.createElement("span"),n.className="layoutRight parametersDismiss",d.appendChild(n);var k=function(a){a._collectAndCall(b,
d);h()},p=function(a,c){var b=document.createElement("span");b.role="button";b.tabIndex=0;c.appendChild(b);a&&b.appendChild(document.createTextNode(a));b.classList.add("dismiss");return b};if(b.parameters.hasOptionalParameters()){b.parameters.optionsRequested=!1;var m=p(j.More,n);m.addEventListener("click",function(){b.parameters.optionsRequested=!0;k(e)},!1);m.addEventListener("keydown",function(a){if(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)b.parameters.optionsRequested=!0,k(e)},!1)}m=p(j.Submit,
n);m.addEventListener("click",function(){k(e)},!1);m.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&k(e)},!1);n=p(null,n);n.id="closebox";n.classList.add("imageSprite");n.classList.add("core-sprite-close");n.title=j.Close;n.addEventListener("click",function(){h()},!1);n.addEventListener("keydown",function(a){(a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&h()},!1);return a}}};b.prototype.constructor=b;return{CommandParameterCollector:b}});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(j,k){function i(b){this._init(b)}i.prototype={_init:function(b){var f=k.node(b.container);if(!f)throw"no parent container";this._container=f;f.classList.remove("currentLocation");this._id=b.id||"eclipse.breadcrumbs";this._resource=b.resource||null;this._rootSegmentName=b.rootSegmentName;this._workspaceRootSegmentName=b.workspaceRootSegmentName;this._makeHref=b.makeHref;this.path="";this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var b;
this._resource&&this._resource.Parents?(b=document.createElement("a"),this._makeHref?this._makeHref(b,""):b.href=j.toUrl("navigate/table.html")+"#"):b=document.createElement("span");k.empty(b);b.appendChild(document.createTextNode(this._workspaceRootSegmentName));return b}return null},render:function(){var b=this._container,f=k.node(this._id);f?k.empty(f):(f=document.createElement("span"),f.id=this._id,b.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}b=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"),b?(g.appendChild(document.createTextNode(b)),
b=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");b?(g.appendChild(document.createTextNode(b)),b=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(b||document.title)),g.classList.add("breadcrumb"),g.classList.add("currentLocation"),f.appendChild(g))}};i.prototype.constructor=i;return{BreadCrumbs:i}});
define("orion/widgets/themes/ThemeClass",[],function(){function j(j){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=j;this.classString="."+j+"{ "}j.prototype.className=null;j.prototype.classString=void 0;j.prototype.style=void 0;j.prototype.closeString=" }\n";j.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:j}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(j){function k(){}k.prototype.navbar="#333";k.prototype.button="#777777";k.prototype.location="#EFEFEF";k.prototype.selection="FEC";k.prototype.sidepanel="#FBFBFB";k.prototype.mainpanel="white";k.prototype.navtext="#bfbfbf";k.prototype.content="#3087B3";k.prototype.search="#444";k.prototype.toolpanel="white";k.prototype.writeNavigationStyle=function(){var i="",b=[],f=new j.ThemeClass("orionPage");
f.style.backgroundColor="#fdfdfd";f.style.width="100%";f.style.height="100%";b.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";b.push(f);f=new j.ThemeClass("a");f.style.textDecoration="none";
f.style.color=this.content;b.push(f);f=new j.ThemeClass("navlink");f.style.display="inline-block";f.style.padding="2px";f.style.color=this.content;b.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";b.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";b.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";b.push(f);for(var g in b)i+=b[g].toString();return i};k.prototype.writeLocationStyle=function(){var i="",b=[],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";b.push(f);f=new j.ThemeClass("breadcrumb");f.style.fontSize="8pt";f.style.textDecoration="none";f.style.color=this.content;f.style.paddingTop="2px";b.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";b.push(f);f=new j.ThemeClass("breadcrumbSeparator");f.style.fontSize="8pt";
f.style.textDecoration="none";f.style.color=this.navbar;f.style.fontWeight="bold";b.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";b.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";b.push(f);f=new j.ThemeClass("navlinkonpage");
f.style.color=this.content;b.push(f);for(var g in b)i+=b[g].toString();return i};k.prototype.writeButtonStyle=function(){var i="",b=[],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";b.push(f);f=new j.ThemeClass("commandButton:over");f.style.backgroundColor="#e6e6e6";f.style.border="1px solid #808080";b.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";b.push(f);f=new j.ThemeClass("commandMenuItem");
f.style.border="0";f.style.padding="0";f.style.margin="0";b.push(f);for(var g in b)i+=b[g].toString();return i};k.prototype.writeMainStyle=function(){var i="",b=[],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";b.push(f);f=new j.ThemeClass("searchbox:focus");f.style.color="white";f.style.outline="none";b.push(f);f=new j.ThemeClass("checkedRow");f.style.cssText="background-color:"+this.selection+" !important;";b.push(f);f=new j.ThemeClass("navbar-item-selected");
f.style.background=this.selection;f.style.color=this.content;b.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";b.push(f);f=new j.ThemeClass("mainpane");
f.style.background=this.mainpanel;f.style.border=0;b.push(f);f=new j.ThemeClass("mainToolbar");f.style.background=this.toolpanel;f.style.height="31px";f.style.borderBottom="1px solid #ebebeb";b.push(f);for(var g in b)i+=b[g].toString();return i};k.prototype.render=function(){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};k.prototype.getSheet=function(i){i.navbar.value?(this.navbar=i.navbar.value,
this.button=i.button.value,this.location=i.location.value,this.selection=i.selection.value,this.sidepanel=i.sidepanel.value,this.mainpanel=i.mainpanel.value,this.navtext=i.navtext.value,this.search=i.search.value,this.content=i.content.value,this.toolpanel=i.toolpanel.value):(this.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:k}});
define("orion/inputCompletion/inputCompletion",[],function(){function j(j,i,b){this._inputField=j;if(typeof this._inputField==="string")this._inputField=document.getElementById(this._inputField);this._binderFunc=i;(j=b?b.group:null)||(j=this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=j+"__completion__";this._proposeFromStart=b?b.proposeFromStart:!1;this._extendedProvider=b?b.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(b){f.onKeyDown(b)});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(b){f._bind(b);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,b,f){var g=document.createElement("a");g.href=require.toUrl(i);g.appendChild(this._createBoldText(j,
b,f));return g};j.prototype._createBoldText=function(j,i,b){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+b));e.appendChild(g);i+b<j.length-1&&(g=document.createTextNode(j.substring(i+b)),f.appendChild(g));return f};j.prototype._proposeOnCategory=function(j,i){if(i.length!==0){var b=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){b._selectProposal(d.currentTarget)};f.onclick=function(d){b._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 b=j,f=!1;isNaN(b)||(f=!0,b=this._proposalList&&j>=0&&j<this._proposalList.length?this._proposalList[j].domNode:
null);if(b)b.className=i?"inputCompletionLISelected":"inputCompletionLINormal",i&&f&&(b.offsetTop<this._completionUIContainer.scrollTop?b.scrollIntoView(!0):b.offsetTop+b.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&b.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 b=this;window.setTimeout(function(){b._completionUIContainer.style.display="none"},200)}};j.prototype._show=function(){if(this._proposalList&&this._proposalList.length>0){for(var j=0,i=0,b=this._inputField;b;)j+=
b.offsetLeft,i+=b.offsetTop,b=b.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,b){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,a=-1;if(i&&b){var h;typeof j[d].value==="string"?h=j[d].value.toLowerCase():j[d].value.name&&(h=j[d].value.name.toLowerCase());a=h.indexOf(i);a<0?c=!1:this._proposeFromStart&&(c=a===0)}c&&g.push({item:j[d],boldIndex:a,
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 b=this;this._extendedProvider(j,function(f){if(f)for(var g=0;g<f.length;g++)b._proposeOnList(f[g].proposals,f[g].filterForMe?i:j,f[g].filterForMe);b._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,k){var i={root:k};Object.keys(j).forEach(function(b){typeof i[b]==="undefined"&&(i[b]=j[b])});return i});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(j,k,i,b){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 b=
document.body;this.$frameParent=b;this.$$modalExclusions=this.$$modalExclusions||[];var e=document.createRange();e.selectNode(b);e=e.createContextualFragment(this.CONTAINERTEMPLATE);b.appendChild(e);this.$frame=b.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);
b=e.createContextualFragment(this.TEMPLATE);this.messages&&i.processTextNodes(b,this.messages);this.$parent.appendChild(b);this.$buttonContainer=i.$(".dialogButtons",this.$frame);this._makeButtons();this.$close.addEventListener("keydown",function(c){(c.keyCode===i.KEY.ENTER||c.keyCode===i.KEY.SPACE)&&d.hide()},!1);this.$frame.addEventListener("keydown",function(c){c.keyCode===i.KEY.ESCAPE?d.hide():c.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=b.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 b=this;this.$frame.addEventListener("blur",function(a){b.$lastFocusedElement=a.target},
!0);this._modalListener=function(a){var c=!i.contains(b.$frame,a.target);if(c)for(var d=0;d<b.$$modalExclusions.length;d++)if(i.contains(b.$$modalExclusions[d],a.target)){c=!1;break}c&&(window.setTimeout(function(){(b.$lastFocusedElement||b.$parent).focus()},0),i.stop(a))};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 a=
0;a<this.$$modalExclusions.length;a++)if(i.contains(this.$$modalExclusions[a],e[c])){d=!0;break}!d&&e[c]!==b.$frame&&e[c].classList&&!e[c].classList.contains("tooltipContainer")&&(a=e[c],a.classList.contains("modalBackdrop")||(a.classList.add("modalBackdrop"),this._addedBackdrop.push(a)))}(e=i.lastTabbable(this.$buttonContainer)||i.lastTabbable(this.$parent))&&e.addEventListener("keydown",function(a){if(a.keyCode===i.KEY.TAB){var c=b._getFirstFocusField();c&&c!==a.target&&c.focus();i.stop(a)}},!1)},
_addChildDialog:function(b){this.$$modalExclusions.push(b.$frame||b.$parent)},_bindElements:function(b){for(var e=0;e<b.childNodes.length;e++){var d=b.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 b=this;this.keepAlive||window.setTimeout(function(){b.destroy()},0)},show:function(b){typeof this._beforeShowing==="function"&&this._beforeShowing();var e=i.bounds(this.$frame),d=i.bounds(document.documentElement),c;b?(c=i.bounds(b),b=c.top+c.height+4,c=c.left+4,b+e.height>d.height&&(b=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),b=Math.max(0,(d.height-e.height)/2));this.$lastFocusedElement=
document.activeElement;this.$frame.style.top=b+"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(b){b.classList.remove("modalBackdrop")});
this.$frameParent.removeEventListener("focus",this._modalListener,!0);this.$frameParent.removeEventListener("click",this._modalListener,!0);this.$frameParent.removeChild(this.$frame);this.$parent=this.$frame=void 0}};f.prototype.constructor=f;return{Dialog:f}});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("orion/contentTypes",[],function(){function j(b,e){function d(a,c,b,d){var b=c.filename.indexOf(b)>=0,e=c.extension.indexOf(d)>=0;if(b||e)if(!a||b&&a.extension.indexOf(d)>=0)return c;return a}for(var c=b&&b.split(".").pop(),a=null,h=0;h<e.length;h++){var f=e[h];d(a,f,b,c)===f&&(a=f)}return a}function k(g){this.serviceRegistry=g;this.map=function(e){function d(a){return a===null||typeof a==="undefined"?[]:a instanceof Array?a:[a]}for(var e=e.getServiceReferences(b).concat(e.getServiceReferences(f)),
c={},a=0;a<e.length;a++)for(var h=d(e[a].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",b="orion.core.contenttype",f="orion.file.contenttype";k.prototype={getContentTypes:function(){var b=this.getContentTypesMap(),e=[],d;for(d in b)b.hasOwnProperty(d)&&e.push(b[d]);return e},getContentTypesMap:function(){return this.map},
getFileContentType:function(b){return j(b.Name,this.getContentTypes())},getFilenameContentType:function(b){return j(b,this.getContentTypes())},getContentType:function(b){return this.map[b]||null},isExtensionOf:function(b,e){b=typeof b==="string"?this.getContentType(b):b;e=typeof e==="string"?this.getContentType(e):e;if(!b||!e)return!1;if(b.id===e.id)return!0;else for(var d=b,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(b,e){for(var d=0;d<e.length;d++)if(this.isExtensionOf(b,e[d]))return!0;return!1}};return{ContentTypeService:k,getFilenameContentType:j}});
define("orion/PageUtil",[],function(){var j=/^http[s]?/i;return{matchResourceParameters:function(j){var j=j||window.location.toString(),i={resource:""},b=j.indexOf("#");if(b!==-1&&(j=j.substring(b+1),j.length!==0)){j=j.split(",");Object.defineProperty(i,"resourceRaw",{value:j[0]});i.resource=decodeURIComponent(j[0]);for(b=1;b<j.length;b++){var f=/([^=]*)(=?)(.*)/.exec(j[b]),g=decodeURIComponent(f[1]||""),f=decodeURIComponent(f[3]||"");g!==""&&g!=="resource"&&(i[g]=f)}}return i},validateURLScheme:function(k,
i){var b=k;if(k.indexOf("://")===-1){var f=document.createElement("a");f.href=k;b=f.href}f=!1;return(f=i?i.some(function(f){return RegExp("^"+f+":","i").test(b)}):j.test(b))?k:(console.log("Illegal URL Scheme: '"+k+"'"),"")}}});
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,k,i,b,f,g,e,d){function c(a,c,b,d,e){this.commandService=a;this.handler=c;this.items=b;this.userData=d;this.command=e;if(e.parameters)this.parameters=e.parameters.makeCopy();this.id=e.id}function a(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};
this._init(a);this._parameterCollector=null}function h(a,c,b){c.classList.add("commandImage");var d;a.imageClass?(d=document.createElement("span"),c.appendChild(d),d.classList.add(a.spriteClass),d.classList.add(a.imageClass)):(d=new Image,d.alt=a.name,d.name=b,d.id=b,d.src=a.image,c.appendChild(d));return d}function l(a){this._init(a)}function n(a,c,b,d,e,h,g){this.keyCode=typeof a==="string"?a.toUpperCase().charCodeAt(0):a;this.mod1=c!==void 0&&c!==null?c:!1;this.mod2=b!==void 0&&b!==null?b:!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 q(a,c){this.token=a;this.parameterName=c}function p(a,c,b,d,e){this.name=a;this.type=c;this.label=b;this.value=d;this.lines=e||1}function m(a,c,b){this._storeParameters(a);this._hasOptionalParameters=c&&c.hasOptionalParameters;this._options=c;this.optionsRequested=!1;this.getParameters=b;this.clientCollect=c&&c.clientCollect}var t=window.navigator.platform.indexOf("Mac")!==
-1;c.prototype={collectsParameters:function(){return this.commandService&&this.commandService.collectsParameters()},makeCopy:function(a){var b=new c(this.commandService,this.handler,this.items,this.userData,this.command);b.domNode=this.domNode;b.domParent=this.domParent;if(a)b.parameters=a.makeCopy();else if(this.parameters)b.parameters=this.parameters.makeCopy();return b}};c.prototype.constructor=c;a.prototype={_init:function(a){this._registry=a.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.page.command",
this);this._defaultSelectionService=a.selection;var c=this;window.document.addEventListener("keydown",function(a){a=a||window.event;if(function(a){if(t){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(a.keyCode===65||a.keyCode===67||a.keyCode===86||a.keyCode===88||a.keyCode===90)?!0:!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(a.keyCode===65||a.keyCode===67||a.keyCode===86||a.keyCode===88||a.keyCode===90)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return a["char"].length>0;
else if(a.charCode||a.keyCode)switch(a=a.charCode||a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return a>=32&&a<112||a>123}return!1}(a)){if(a.target.contentEditable==="true")return;var b=a.target.nodeName.toLowerCase();if(b==="input")switch(a.target.type.toLowerCase()){case "text":case "password":case "search":case "color":case "date":case "datetime":case "datetime-local":case "email":case "month":case "number":case "range":case "tel":case "time":case "url":case "week":return}else if(b===
"textarea")return}c._processKey(a)},!1)},_processKey:function(a){function c(a){window.document.all?a.keyCode=0:(a.preventDefault(),a.stopPropagation())}for(var b in this._activeBindings)if(this._activeBindings[b]&&this._activeBindings[b].keyBinding&&this._activeBindings[b].command&&this._activeBindings[b].keyBinding.match(a)){var d=this._activeBindings[b],e=d.invocation;if(e)if(d=d.command,d.hrefCallback){c(a);a=d.hrefCallback.call(e.handler||window,e);a.then?a.then(function(a){window.open(a)}):window.open(a);
break}else if(d.callback){c(a);var h=this;window.setTimeout(function(){h._invoke(e)},0);break}}},processURL:function(a){for(var c in this._urlBindings)if(this._urlBindings[c]&&this._urlBindings[c].urlBinding&&this._urlBindings[c].command){var b=this._urlBindings[c].urlBinding.match(a);if(b){var d=this._urlBindings[c],e=d.command,h=d.invocation;if(h&&h.parameters&&e.callback){h.parameters.setValue(b.parameterName,b.parameterValue);var f=this;window.setTimeout(function(){f._invoke(h)},0);break}}}},
findCommand:function(a){return this._commandList[a]},runCommand:function(a,b,d,e){b?(a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(b):1)&&a.callback&&this._invoke(new c(this,d,b,null,a),e):(b=this._urlBindings[a])&&b.command&&b.command.callback&&this._invoke(b.invocation,e)},getSelectionService:function(){return this._defaultSelectionService},setParameterCollector:function(a){this._parameterCollector=a},openParameterCollector:function(a,c,b){this._parameterCollector&&(this._parameterCollector.close(),
this._parameterCollector.open(a,c,b))},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(a,c){return this._collectAndInvoke(a.makeCopy(c),!1)},_collectAndInvoke:function(a,c){if(a)if(this._parameterCollector&&a.parameters&&a.parameters.hasParameters()&&(c||a.parameters.shouldCollectParameters())){var b=!1;a.parameters.updateParameters(a);b=this._parameterCollector.collectParameters(a);
if(!b){var d=new e.Tooltip({node:a.domNode,trigger:"click",position:["below","right","above","left"]}),b=d.contentContainer();b.classList.add("parameterPopup");var h=window.document.activeElement,f=this._parameterCollector.getFillFunction(a,function(){h&&h.focus();d.destroy()})(b);d.show();window.setTimeout(function(){f.focus();f.select()},0);b=!0}b||a.command.callback.call(a.handler||window,a)}else a.command.callback.call(a.handler||window,a);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},
collectParameters:function(a){this._collectAndInvoke(a,!0)},showKeyBindings:function(a){var c={},b,d,e,h;for(h in this._activeBindings)if((d=this._activeBindings[h])&&d.keyBinding&&d.command)d.keyBinding.scopeName?(c[d.keyBinding.scopeName]||(c[d.keyBinding.scopeName]=[]),c[d.keyBinding.scopeName].push(d)):(b=i.getUserKeyString(d.keyBinding),e=document.createElement("span"),e.role="listitem",e.appendChild(document.createTextNode(b+" = "+d.command.name)),e.appendChild(document.createElement("br")),
a.appendChild(e));for(var f in c)if(c[f].length&&c[f].length>0){b=document.createElement("h2");a.appendChild(b);b.appendChild(document.createTextNode(f));for(h=0;h<c[f].length;h++)d=c[f][h],b=i.getUserKeyString(d.keyBinding),e=document.createElement("span"),e.role="listitem",e.appendChild(document.createTextNode(b+" = "+d.command.name)),e.appendChild(document.createElement("br")),a.appendChild(e)}},addCommand:function(a){this._commandList[a.id]=a},addCommandGroup:function(a,c,b,d,e,h){this._contributionsByScopeId[a]||
(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];e&&(a=this._createEntryForPath(a,e));if(a[c]){if(d)a[c].title=d;if(b)a[c].position=b;a[c].emptyGroupMessage=h}else a[c]={title:d,position:b,emptyGroupMessage:h,children:{}},a.sortedContributions=null},_createEntryForPath:function(a,c){if(c)for(var b=c.split("/"),d=0;d<b.length;d++)if(b[d].length>1)a[b[d]]||(a[b[d]]={position:0,children:{}}),a=a[b[d]].children;return a},registerSelectionService:function(a,c){this._contributionsByScopeId[a]||
(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=c},registerCommandContribution:function(a,c,b,d,e,h,f){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];d&&(a=this._createEntryForPath(a,d));a[c]={position:b};h&&(b=this._commandList[c])&&(this._activeBindings[c]={command:b,keyBinding:h,bindingOnly:e});f&&(b=this._commandList[c])&&(this._urlBindings[c]={command:b,urlBinding:f,bindingOnly:e});a.sortedContributions=
null},_checkForTrailingSeparator:function(a,c,b){var d;if(c==="tool"||c==="button")if((d=a.childNodes.length>0?a.childNodes[a.childNodes.length-1]:null)&&d.classList.contains("commandSeparator"))return b?(a.removeChild(d),!1):!0;if(c==="menu"&&(a=f.$$array("li > *",a),a.length>0&&a[a.length-1].classList.contains("dropdownSeparator")))if(d=a[a.length-1],b)d.parentNode.parentNode.removeChild(d.parentNode);else return!0;return!1},renderCommands:function(a,c,b,d,e,h,g){if(typeof a!=="string")throw"a scope id for rendering must be specified";
c=f.node(c);if(!c)throw"no parent";var i=this._contributionsByScopeId[a];if(!b&&i){var b=i.localSelectionService||this._defaultSelectionService,j=this;b&&b.getSelections(function(b){j.renderCommands(a,c,b,d,e,h)})}else i&&(this._render(this._contributionsByScopeId[a],c,b,d,e||"button",h,g),this._checkForTrailingSeparator(c,e,!0))},destroy:function(a){a=f.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var c=a.firstChild;c.commandTooltip&&c.commandTooltip.destroy();c.emptyGroupTooltip&&c.emptyGroupTooltip.destroy();
this.destroy(c);a.removeChild(c)}},_render:function(a,b,h,f,g,i,j){var l=a.sortedContributions;if(!l){var l=[],n=!1,m;for(m in a)if(!a.hasOwnProperty||a.hasOwnProperty(m)){var k=a[m];if(k&&typeof k.position==="number")k.id=m,l.push(k),n=!0}if(n)l.sort(function(a,c){return a.position-c.position}),a.sortedContributions=l}for(a=0;a<l.length;a++){var v;if(l[a].children&&Object.getOwnPropertyNames(l[a].children).length>0){var k=l[a],n=l[a].children,q=this,p;if(g==="tool"||g==="button")if(k.title){p=this._createDropdownMenu(b,
k.title);j&&d.generateNavGrid(j,p.menuButton);var t=n,H=k;window.setTimeout(function(){q._render(t,p.menu,h,f,"menu",i,j);q._checkForTrailingSeparator(p.menu,"menu",!0);if(p.menu.childNodes.length===0)if(H.emptyGroupMessage){if(!p.menuButton.emptyGroupTooltip)p.menuButton.emptyGroupTooltip=new e.Tooltip({node:p.menuButton,text:H.emptyGroupMessage,trigger:"click",position:["below","right","above","left"]})}else j&&d.removeNavGrid(j,p.menuButton),p.menu.parentNode&&p.menu.parentNode.removeChild(p.menu),
p.destroyButton&&p.destroyButton.parentNode&&p.destroyButton.parentNode.removeChild(p.destroyButton);else p.menuButton.style.visibility="visible"},0)}else{var B;b.childNodes.length>0&&!this._checkForTrailingSeparator(b,g)&&(B=this.generateSeparatorImage(b));q._render(n,b,h,f,g,i,j);b.childNodes.length>0&&b.childNodes[b.childNodes.length-1]!==B&&(B=this.generateSeparatorImage(b))}else k.title?(m=document.createElement("li"),b.appendChild(m),k=this._createDropdownMenu(m,k.title,!0),q._render(n,k.menu,
h,f,"menu",i,j),k.menu.childNodes.length===0&&b.removeChild(m)):(b.childNodes.length>0&&this._generateMenuSeparator(b),q._render(n,b,h,f,g,i,j),this._generateMenuSeparator(b))}else{m=(n=this._commandList[l[a].id])?!0:!1;var I=null,I=null;if(n){v=new c(this,f,h,i,n);v.domParent=b;k=m&&(n.visibleWhen?n.visibleWhen(h):!0);if(this._activeBindings[n.id]&&this._activeBindings[n.id].keyBinding)I=this._activeBindings[n.id],I.invocation=k?v:null,I.bindingOnly&&(m=!1);if(this._urlBindings[n.id]&&this._urlBindings[n.id].urlBinding)I=
this._urlBindings[n.id],I.invocation=k?v:null,I.bindingOnly&&(m=!1);m=m&&k}if(m)if(n.choiceCallback){g==="tool"||g==="button"?(m=b,k=!1,b.nodeName.toLowerCase()==="ul"&&(m=document.createElement("li"),b.appendChild(m))):(m=b,k=!0);var L=this;this._createDropdownMenu(m,n.name,k,function(a){this.populateChoicesMenu(a,h,f,i,L)}.bind(n))}else g==="tool"?(m="tool"+n.id+a,n._addTool(b,m,v,j)):g==="button"?(m="button"+n.id+a,n._addButton(b,m,v,j)):g==="menu"&&n._addMenuItem(b,v,j)}}},_createDropdownMenu:function(a,
c,b,d){var a=f.node(a),e,h=document.createElement("span");h.classList.add("dropdownTrigger");b?(h.classList.add("dropdownMenuItem"),e="dropdownSubMenu",b="dropdownArrowRight",h.tabIndex=0,h.role="menuitem"):(h.classList.add("commandButton"),b="dropdownArrowDown",h.tabIndex=0,h.role="button");c=document.createTextNode(c);h.appendChild(c);c=document.createElement("span");c.classList.add(b);h.appendChild(c);b=a;a.nodeName.toLowerCase()==="ul"?(b=document.createElement("li"),a.appendChild(b),a=b):(h.classList.add("commandMargins"),
a=h);b.appendChild(h);e&&b.classList.add(e);e=document.createElement("ul");b.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:a}},_generateCheckedMenuItem:function(a,c,b,d){var e=document.createElement("li");a.appendChild(e);a=document.createElement("label");a.classList.add("dropdownMenuItem");var h=document.createElement("input");h.type="checkbox";h.role="menuitem";
h.checked=b;h.classList.add("checkedMenuItem");a.appendChild(h);c=document.createTextNode(c);a.appendChild(c);e.appendChild(a);h.addEventListener("change",d,!1)},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,"menu")){var c=document.createElement("li");c.classList.add("dropdownSeparator");var b=document.createElement("span");b.classList.add("dropdownSeparator");c.appendChild(b);a.appendChild(c)}},generateSeparatorImage:function(a){var c;c=a.nodeName.toLowerCase()==="ul"?
document.createElement("li"):document.createElement("span");a.appendChild(c);c.classList.add("core-sprite-sep");c.classList.add("imageSprite");c.classList.add("commandSeparator");return c}};a.prototype.constructor=a;l.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip||a.name;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;this.image=a.image||k.toUrl("images/none.png");this.imageClass=a.imageClass;this.spriteClass=a.spriteClass||
"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters},_addTool:function(a,c,b,f){b.handler=b.handler||this;var g;if(this.hrefCallback){if(g=this._makeLink(a,b,"commandLink"),!g)return}else g=document.createElement("span"),g.tabIndex=f?-1:0,g.role="button",this.hasImage()?(h(this,g,c),this.name&&g.setAttribute("aria-label",this.name)):(c=window.document.createTextNode(this.name),g.appendChild(c),g.classList.add("commandMissingImageButton"),g.classList.add("commandButton")),this._hookCallback(g,
b);b.domNode=g;b.domParent=a;if(this.tooltip)g.commandTooltip=new e.Tooltip({node:g,text:this.tooltip,position:["above","below","right","left"]});a.nodeName.toLowerCase()==="ul"?(c=document.createElement("li"),a.appendChild(c),a=c):g.classList.add("commandMargins");a.appendChild(g);d.generateNavGrid(f,b.domNode)},_addButton:function(a,c,b,f){b.handler=b.handler||this;var g;if(this.hrefCallback)g=this._makeLink(a,b,"commandLink");else if(!this.name&&this.hasImage()){if(g=document.createElement("span"),
g.tabIndex=0,g.role="button",h(this,g,c),this.tooltip&&g.setAttribute("aria-label",this.tooltip),this._hookCallback(g,b),this.tooltip)g.commandTooltip=new e.Tooltip({node:g,text:this.tooltip,position:["above","below","right","left"]})}else g=this._makeButton(a,b,"commandButton"),this._hookCallback(g,b);b.domParent=a;a.nodeName.toLowerCase()==="ul"?(c=document.createElement("li"),a.appendChild(c),a=c):g.classList.add("commandMargins");a.appendChild(g);d.generateNavGrid(f,b.domNode)},_addMenuItem:function(a,
c,b){c.domParent=a;var e,h=a.dropdown;this.hrefCallback?e=this._makeLink(a,c,"dropdownMenuItem",["right","left","above","below"]):(e=this._makeButton(a,c,"dropdownMenuItem",["right","left","above","below"]),this.callback&&this._hookCallback(e,c,function(){h.close(!0)}));e.role="menuitem";d.generateNavGrid(b,c.domNode);a.nodeName.toLowerCase()==="ul"?(c=document.createElement("li"),a.appendChild(c),a=c):e.classList.add("commandMargins");a.appendChild(e)},_makeButton:function(a,c,b,d){a=document.createElement("span");
a.role="button";a.tabIndex=0;a.id=this.name;var h=document.createTextNode(this.name);a.appendChild(h);b&&a.classList.add(b);if(this.tooltip)a.commandTooltip=new e.Tooltip({node:a,text:this.tooltip,position:d||["above","below","right","left"]});return c.domNode=a},_makeLink:function(a,c,b,d){var h=document.createElement("a");h.id=this.name;b&&h.classList.add(b);h.appendChild(document.createTextNode(this.name));if(this.hrefCallback)a=this.hrefCallback.call(c.handler,c),a.then?a.then(function(a){h.href=
a}):h.href=a?a:"#";if(this.tooltip)h.commandTooltip=new e.Tooltip({node:h,text:this.tooltip,position:d||["above","below","right","left"]});return c.domNode=h},_hookCallback:function(a,c,b,d){a.addEventListener("click",function(a){b&&b();c.commandService._invoke(c);d&&d();f.stop(a)},!1);a.addEventListener("keydown",function(a){if(a.keyCode===f.KEY.ENTER||a.keyCode===f.KEY.SPACE)b&&b(),c.commandService._invoke(c),d&&d(),f.stop(a)},!1)},populateChoicesMenu:function(a,c,b,d,e){b=this.getChoices(c,b,d);
for(d=0;d<b.length;d++){var h=b[d];if(h.name){var g=document.createElement("li");a.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(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,c)},!1);i.addEventListener("keydown",function(a){(a.keyCode===f.KEY.ENTER||a.keyCode===f.KEY.SPACE)&&a.target.choice&&
a.target.choice.callback.call(a.target.choice,c)},!1)}else e._generateMenuSeparator(a)}},getChoices:function(a,c,b){return this.choiceCallback?this.choiceCallback.call(c,a,b):null},makeChoiceCallback:function(a,c){return function(b){a.callback&&a.callback.call(a,c,b)}},hasImage:function(){return this.imageClass||this.image!==k.toUrl("images/none.png")}};l.prototype.constructor=l;n.prototype={match:function(a){if(this.keyCode===a.keyCode){if(this.mod1!==(t?a.metaKey:a.ctrlKey))return!1;if(this.mod2!==
a.shiftKey)return!1;if(this.mod3!==a.altKey)return!1;if(t&&this.mod4!==a.ctrlKey)return!1;if(!this.domScope)return!0;for(a=a.target;a;){if(a===window.document)break;if(a===this.domScope)return!0;a=a.parentNode}}return!1},equals:function(a){return!a?!1:this.keyCode!==a.keyCode?!1:this.mod1!==a.mod1?!1:this.mod2!==a.mod2?!1:this.mod3!==a.mod3?!1:this.mod4!==a.mod4?!1:this.domScope!==a.domScope?!1:!0}};n.prototype.constructor=n;q.prototype={match:function(a){a=b.matchResourceParameters(a);return typeof a[this.token]!==
"undefined"?(this.parameterValue=a[this.token],this):null}};q.prototype.constructor=q;p.prototype={optionsRequested:function(){return this.optionsRequested}};p.prototype.constructor=p;m.prototype={_storeParameters:function(a){this.parameterTable=null;if(a){this.parameterTable={};for(var c=0;c<a.length;c++)this.parameterTable[a[c].name]=a[c]}},updateParameters:function(a){typeof this.getParameters==="function"&&this._storeParameters(this.getParameters(a))},hasParameters:function(){return this.parameterTable!==
null},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(a){return this.parameterTable[a]},valueFor:function(a){return(a=this.parameterTable[a])?a.value:null},setValue:function(a,c){var b=this.parameterTable[a];if(b)b.value=c},forEach:function(a){for(var c in this.parameterTable)this.parameterTable[c].type&&this.parameterTable[c].name&&a(this.parameterTable[c])},makeCopy:function(){var a=[];this.forEach(function(c){c=new p(c.name,c.type,c.label,
c.value,c.lines);a.push(c)});var c=new m(a,this._options,this.getParameters);c.clientCollect=this.clientCollect;return c},hasOptionalParameters:function(){return this._hasOptionalParameters}};m.prototype.constructor=m;return{CommandService:a,CommandKeyBinding:n,Command:l,CommandInvocation:c,URLBinding:q,ParametersDescription:m,CommandParameter:p}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(j,k,i,b){var f={};(function(){var g=!1;f.updateNavTools=function(b,d,c,a,h){var f=b.getService("orion.page.command"),n=i.node(c);if(n)f.destroy(n);else throw j["could not find toolbar "]+c;f.renderCommands(c,n,h,d,"button");if(a&&(c=i.node(a)))f.destroy(c),f.renderCommands(a,c,null,d,"button");g||(g=!0,b.getService("orion.page.selection").addEventListener("selectionChanged",
function(c){var h=i.node(a);if(h){var f=b.getService("orion.page.command");f.destroy(h);f.renderCommands(a,h,c.selections,d,"button")}}))};f.createOperationsCommands=function(e,d,c){function a(a){return!a.operation||!a.operation.type?!1:a.operation.type==="loadstart"||a.operation.type==="progress"}var h=new b.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 b.Command({name:j.Remove,tooltip:j["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(a){for(var a=Array.isArray(a.items)?a.items:[a.items],b=0;b<a.length;b++){var e=a[b];c.removeOperation.bind(c)(e.Location).then(function(){d.loadOperations.bind(d)()},function(){d.loadOperations.bind(d)()})}},visibleWhen:function(c){if(!Array.isArray(c)||c.length===0)return!a(c);for(var b in c)if(a(c[b]))return!1;
return!0}});e.addCommand(h);h=new b.Command({name:j.Cancel,tooltip:j["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){for(var a=Array.isArray(a.items)?a.items:[a.items],c=0;c<a.length;c++){var b=a[c];b.deferred&&b.deferred.cancel()}},visibleWhen:function(c){if(!Array.isArray(c)||c.length===0)return a(c)&&(c.operation&&c.operation.cancelable?!0:!1);for(var b in c)if(!a(c[b])||!c[b].operation||!c[b].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,k,i,b,f){function g(b){this._options=b}g.prototype=new b.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(b){this._myOperations=[];this._operationsDeferreds=[];this._commandService=b.serviceRegistry.getService("orion.page.command");f.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(b.triggerNode)};g.prototype._bindToDom=function(){this.$allOperationsLink.href=k.toUrl("operations/list.html");this._setOperationsVisibility()};g.prototype.setOperations=function(b,d){this._myOperations||
this._init(this._options);this._myOperations=[];this._operationsDeferreds=[];if(b)for(var c in b)this._myOperations.push(b[c]),this._operationsDeferreds.push(d[c]);this._renderOperations()};g.prototype.parseProgressResult=function(b){if(!b)return{};b=b.responseText||b;try{b=JSON.parse(b)}catch(d){}var c={Message:b.Message||b,Severity:b.Severity};if(b.DetailedMessage&&b.DetailedMessage!==c.Message)c.DetailedMessage=b.DetailedMessage;return c};g.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};g.prototype._renderOperationsTable=function(b,d,c){i.empty(b);for(var a=0;a<d.length;a++){var h=d[a],f=document.createElement("tr"),g=document.createElement("td");g.style.paddingLeft="5px;";g.style.paddingRight="5px;";g.textContent=h.Name;f.appendChild(g);var k=document.createElement("div");g.appendChild(k);g=document.createElement("span");k.appendChild(g);g.classList.add("imageSprite");var p=document.createElement("span");p.classList.add("primaryColumn");
k.appendChild(p);p.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),k.appendChild(document.createElement("br")),p=document.createElement("span"),p.classList.add("secondaryColumn"),p.style.marginLeft="18px;",k.appendChild(p),p.textContent=g;g=document.createElement("span");
k.appendChild(g);this._commandService.renderCommands("operationsDialogItems",k,{operation:h,deferred:c[a]},this,"tool");b.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,k,i,b,f){function g(d,c){if(!this._progressPane){this._progressPane=b.node(d);this._operationsDialog=new f.OperationsDialog({triggerNode:this._progressPane,serviceRegistry:c});var a=this;this._progressPane.addEventListener("keydown",function(c){(c.charOrCode===" "||c.keyCode===b.KEY.ENTER)&&a._operationsDialog.show()})}}function e(b,c,a){this._serviceRegistry=
b;this._serviceRegistration=b.registerService("orion.page.progress",this);this._operationsClient=c;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=a}g.prototype={_switchIconTo:function(b){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);this._lastIconClass=b;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(b,c){var a={},e;for(e in b)b[e].progressMonitor||
(a[e]=b[e]);if(this._isEmpty(a))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 a){var g=a[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(a,c)},_isEmpty:function(b){for(var c in b)return!1;return!0}};g.prototype.constructon=g;e.prototype=
{init:function(b){if(!this._progressMonitorClass)this._progressMonitorTool=new g(b,this._serviceRegistry)},progress:function(b,c,a){var e=this,f=this._operationsIndex++;!a&&this._progressMonitorClass&&(a=new this._progressMonitorClass,a.begin(c));b.then(function(){if(e._operations[f]){var g=e._operations[f];if(c)g.Name=c;e._lastOperation=g;g.type="loadend";if(a)g.progressMonitor=a;e.writeOperation.bind(e)(f,g,b);g.Location||e._removeOperationFromTheList.bind(e)(f)}},function(g){if(e._operations[f]){var i=
e._operations[f];if(c)i.Name=c;if(a)i.progressMonitor=a;e._lastOperation=i;i.type=g.canceled?"abort":"error";i.error=g;e.writeOperation.bind(e)(f,i,b);i.Location||e._removeOperationFromTheList.bind(e)(f)}},function(g){if(c)g.Name=c;if(a)g.progressMonitor=a;e.writeOperation.bind(e)(f,g,b)});return b},removeOperation:function(b){for(var c in this._operations)if(this._operations[c].Location&&this._operations[c].Location===b){this._removeOperationFromTheList(c);break}this._operationsClient.removeOperation.bind(this._operationsClient)(b)},
_removeOperationFromTheList:function(b){var c=this._operations[b].progressMonitor;delete this._operations[b];delete this._operationDeferrds[b];c?c.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},removeCompletedOperations:function(){for(var b in this._operations){var c=this._operations[b];if(c.type&&c.type!=="loadstart"&&c.type!=="progress")(c=this._operations[b].progressMonitor)&&c.done(),delete this._operations[b],delete this._operationDeferrds[b]}this._progressMonitorTool.generateOperationsInfo(operations,
this._operationDeferrds)},setProgressResult:function(b){this._serviceRegistry.getService("orion.page.message").setProgressResult(b)},showWhile:function(b,c){c&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(c);var a=this;b.then(function(){a._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(c){a.setProgressResult.bind(a)(c);return c});return this.progress(b,c)},writeOperation:function(b,c,a){this._operations[b]=c;this._operationDeferrds[b]=
a;c.Location&&serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(a){a.put(c.Location,{Name:c.Name,expires:c.expires})});c.progressMonitor?c.progressMonitor.progress(c.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};e.prototype.constructor=e;return{ProgressService:e}});
define("orion/section",["orion/webui/littlelib","orion/selection","orion/commands","orion/commonHTMLFragments"],function(j,k,i,b){function f(e,d){var c=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!d.id)throw Error("Missing required argument: id");this.id=d.id;if(!d.title)throw Error("Missing required argument: title");var a=d.useAuxStyle?["sectionWrapper","sectionWrapperAux","toolComposite"]:
["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");e.appendChild(this.domNode);for(var h=0;h<a.length;h++)this.domNode.classList.add(a[h]);this.domNode.id=d.id;if(d.canHide)this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitle"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=0,this.domNode.addEventListener("click",
function(a){(a.target===c.titleNode||a.target===c.twistie)&&c._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(a){a.keyCode===j.KEY.ENTER&&(a.target===c.domNode||a.target===c.titleNode||a.target===c.twistie)&&c._changeExpandedState()},!1);if(d.iconClass){var f=document.createElement("span");f.classList.add("sectionIcon");this.domNode.appendChild(f);(Array.isArray(d.iconClass)?d.iconClass:[d.iconClass]).forEach(function(a){f.classList.add(a)})}this.titleNode=document.createElement("div");
this.titleNode.id=d.id+"Title";this.titleNode.classList.add("sectionAnchor");this.titleNode.classList.add("sectionTitle");this.titleNode.classList.add("layoutLeft");this.domNode.appendChild(this.titleNode);this.titleNode.textContent=d.title;if(typeof d.getItemCount==="function")a=document.createElement("div"),a.classList.add("layoutLeft"),a.classList.add("sectionItemCount"),this.domNode.appendChild(a),a.textContent=d.getItemCount(this);this._progressNode=document.createElement("div");this._progressNode.id=
d.id+"Progress";this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.visibility="hidden";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);a=document.createElement("div");a.id=d.id+"FilterSearchBox";this.domNode.appendChild(a);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=d.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");
this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("div");this.actionsNode.id=d.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("sectionActions");this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("div");this.selectionNode.id=d.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("sectionActions");
this.domNode.appendChild(this.selectionNode);d.slideout&&(a=b.slideoutHTMLFragment(d.id),h=document.createRange(),h.selectNode(this.domNode),a=h.createContextualFragment(a),this.domNode.appendChild(a));this._contentParent=document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);e.appendChild(this._contentParent);d.content&&this.setContent(d.content);
this.hidden=d.hidden;if(typeof d.onExpandCollapse==="function")this._onExpandCollapse=d.onExpandCollapse;this._preferenceService=d.preferenceService;this._contentParent.style.display="none";if(this._preferenceService){var g=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=a.get(g.id);if(a!==void 0)g.hidden=!a;if(!g.hidden)g._contentParent.style.display="block";g._updateExpandedState(!g.hidden,!1)})}else{if(!this.hidden)this._contentParent.style.display="block";this._updateExpandedState(!this.hidden,
!1)}this._commandService=d.commandService;this._lastMonitor=0;this._loading={}}function g(b){this._section=b;this._id=++b._lastMonitor}f.prototype={setTitle:function(b){this.titleNode.textContent=b},setContent:function(b){typeof b==="string"?this._contentParent.innerHTML=b:(this._contentParent.innerHTML="",this._contentParent.appendChild(b))},getContentElement:function(){return this._contentParent},createProgressMonitor:function(){return new g(this)},_setMonitorMessage:function(b,d){this._progressNode.style.visibility=
"visible";this._loading[b]=d;var c="",a;for(a in this._loading)c!==""&&(c+="\n"),c+=this._loading[a];this._progressNode.title=c},_monitorDone:function(b){delete this._loading[b];var b="",d;for(d in this._loading)b!==""&&(b+="\n"),b+=this._loading[d];this._progressNode.title=b;if(b==="")this._progressNode.style.visibility="hidden"},_changeExpandedState:function(){this.hidden?(this._contentParent.style.display="block",this.hidden=!1):(this._contentParent.style.display="none",this.hidden=!0);this._updateExpandedState(!this.hidden,
!0)},_updateExpandedState:function(b,d){var c=this.twistie,a=this.id;c&&(c.classList.add(b?this._expandImageClass:this._collapseImageClass),c.classList.remove(b?this._collapseImageClass:this._expandImageClass));this._preferenceService&&d&&this._preferenceService.getPreferences("/window/views").then(function(c){c.put(a,b)});this._onExpandCollapse&&this._onExpandCollapse(b,this)}};f.prototype.constructor=f;g.prototype={begin:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},worked:function(b){this.status=
b;this._section._setMonitorMessage(this.id,b)},done:function(b){this.status=b;this._section._monitorDone(this.id)}};g.prototype.constructor=g;return{Section:f}});
define("orion/explorers/explorer","i18n!orion/nls/messages,require,orion/webui/littlelib,orion/webui/treetable,orion/explorers/explorerNavHandler,orion/commands".split(","),function(j,k,i,b,f,g){var e={};e.Explorer=function(){function d(c,a,b){this.registry=c;this.renderer=b;this.selection=a;this.myTree=null}d.prototype={changedItem:function(c,a){this.myTree&&this.myTree.refresh.bind(this.myTree)(c,a,!0)},updateCommands:function(c){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(c)},
makeNewItemPlaceHolder:function(c,a,b){c=this.getRow(c);if(b)return c=c.childNodes[b],c.appendChild(document.createElement("br")),b=document.createElement("span"),b.id=a+"placeHolderRow",c.appendChild(b),{tempNode:b,refNode:b};if(c){b=document.createElement("tr");b.id=a+"placeHolderRow";var d=document.createElement("td");d.id=a+"placeHolderCol";b.appendChild(d);c.appendChild(b);b=i.node(a+"placeHolderRow");c=i.node(a+"placeHolderCol");if(b&&c)return{tempNode:b,refNode:c}}return null},getRow:function(c){if(c=
this.model.getId(c))return i.node(c)},collapseAll:function(){for(var c=this._navHandler.getTopLevelNodes(),a=0;a<c.length;a++)this.myTree.collapse(c[a])},expandAll:function(c){if(c)this._expandRecursively(c);else if(this._navHandler)for(var c=this._navHandler.getTopLevelNodes(),a=0;a<c.length;a++)this._expandRecursively(c[a])},_expandRecursively:function(c){if(this._navHandler&&this._navHandler.isExpandable(c)){var a=this;this.myTree.expand(c,function(){a.model.getChildren(c,function(c){if(!(c===
void 0||c===null))for(var b=c.length,d=0;d<b;d++)a._expandRecursively(c[d])})})}},createTree:function(c,a,d){this.selection&&this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var e=c+"innerTree",g=i.node(e);g&&i.empty(g);if(a)a.rootId=e;this.model=a;this._parentId=c;this._treeOptions=d;if(!d||d&&!d.noSelection)this.selectionPolicy=d?d.selectionPolicy:"",this._navDict=new f.ExplorerNavDict(this.model);this.myTree=new b.TableTree({id:e,model:a,parent:c,labelColumnIndex:this.renderer.getLabelColumnIndex(),
renderer:this.renderer,showRoot:d?!!d.showRoot:!1,indent:d?d.indent:void 0,onCollapse:d?d.onCollapse:void 0,tableElement:d?d.tableElement:void 0,tableBodyElement:d?d.tableBodyElement:void 0,tableRowElement:d?d.tableRowElement:void 0});this.renderer._initializeUIState();this.selectionPolicy==="cursorOnly"&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var c=this.getNavHandler(),a=[];
if(c&&this.getNavDict())for(var b=c.getSelection(),d=0;d<b.length;d++){var e=c.getRowDiv(b[d]);e&&e.parentNode&&(e=this.getNavDict().getValue(this.model.getId(b[d])),e.model&&a.push(e.model))}this.selection.setSelections(a)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var c=this._treeOptions;if(!c||c&&!c.noSelection){if(!this.getNavHandler())this._navHandler=new f.ExplorerNavHandler(this,this._navDict,{setFocus:c&&c.setFocus,
selectionPolicy:c?c.selectionPolicy:null});var a=this;this.model.getRoot(function(b){b instanceof Array?a.getNavHandler().refreshModel(a.getNavDict(),a.model,b):b.children&&b.children instanceof Array&&a.getNavHandler().refreshModel(a.getNavDict(),a.model,b.children);c&&c.setFocus&&a.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,checkbox:!1};return d}();e.createExplorerCommands=function(b,c){function a(a){return typeof a.getItemCount==="function"?a.getItemCount()>0?c?c(a):!0:!1:!1}var e=
new g.Command({tooltip:j["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(c){return a(c)},callback:function(a){a.items.expandAll()}}),f=new g.Command({tooltip:j["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",visibleWhen:function(c){return a(c)},callback:function(a){a.items.collapseAll()}});b.addCommand(e);b.addCommand(f)};e.ExplorerModel=function(){function b(c,
a,d){this.rootPath=c;this.fetchItems=a;this.idPrefix=d||""}b.prototype={destroy:function(){},getRoot:function(c){var a=this;this.fetchItems(this.rootPath).then(function(b){a.root=b;c(b)})},getChildren:function(c,a){c.Children?a(c.Children):c.ChildrenLocation?this.fetchItems(c.ChildrenLocation).then(function(b){c.Children=b;a(b)}):a([])},getId:function(c){if(c.Location===this.root.Location)return this.rootId;for(var c=c.Location.replace(/[\\\/]/g,""),a=this.idPrefix,b=0;b<c.length;b++)a+=c[b].match(/[^\.\:\-\_0-9A-Za-z]/g)?
c.charCodeAt(b):c[b];return a}};return b}();e.ExplorerFlatModel=function(){function b(c,a,d){this.rootPath=c;this.fetchItems=a;this.root=d}b.prototype=new e.ExplorerModel;b.prototype.getRoot=function(c){if(this.root)c(this.root);else{var a=this;this.fetchItems(this.rootPath).then(function(b){a.root=b;c(b)})}};b.prototype.getChildren=function(c,a){c===this.root?a(this.root):a([])};return b}();e.ExplorerRenderer=function(){function b(c,a){this.explorer=a;this._init(c);this._expandImageClass="core-sprite-openarrow";
this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite"}b.prototype={_init:function(c){if(c){this._useCheckboxSelection=c.checkbox===void 0?!1:c.checkbox;this.selectionPolicy=c.singleSelection?"singleSelection":"";this._cachePrefix=c.cachePrefix;this.getCheckedFunc=c.getCheckedFunc;this.onCheckedFunc=c.onCheckedFunc;this._highlightSelection=!0;this._treeTableClass=c.treeTableClass||"treetable";if(c.highlightSelection===!1)this._highlightSelection=!1;if(!this.actionScopeId)this.actionScopeId=
c.actionScopeId}},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(c,a){this.tableTree=a;i.empty(c);this._treeTableClass&&c.classList.add(this._treeTableClass);this.renderTableHeader(c)},getActionsColumn:function(c,a,b,d,e){var b=b||"tool",f=this.explorer.registry.getService("orion.page.command"),g=document.createElement("td");g.id=a.id+"actionswrapper";d&&g.classList.add(d);this.actionScopeId?f.renderCommands(this.actionScopeId,g,c,this.explorer,b,null,e&&this.explorer.getNavDict()?
this.explorer.getNavDict().getGridNavHolder(c,!0):null):window.console.log("Warning, no action scope was specified.  No commands rendered.");return g},initCheckboxColumn:function(){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(c,a){if(this._useCheckboxSelection){var b=document.createElement("td"),d=document.createElement("span");d.id=this.getCheckBoxId(a.id);d.classList.add("core-sprite-check");d.classList.add("selectionCheckmarkSprite");d.rowId=a.id;
if(this.getCheckedFunc)d.checked=this.getCheckedFunc(c),d.checked?(this._highlightSelection&&a.classList.add("checkedRow"),d.classList.add("core-sprite-check_on")):(this._highlightSelection&&a.classList.remove("checkedRow"),d.classList.remove("core-sprite-check_on"));b.appendChild(d);var e=this;d.addEventListener("click",function(c){e.onCheck(a,c.target,c.target.checked?!1:!0,!0)},!1);return b}},getCheckBoxId:function(c){return c+"selectedState"},onCheck:function(c,a,b,d,e){(a.checked=b)?a.classList.add("core-sprite-check_on"):
a.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(a.rowId,b,d);this.explorer.getNavHandler()&&e&&this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(c.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var c=this.explorer.getNavHandler().getSelectionIds(),a=this._getUIStatePreferencePath();a&&window.sessionStorage&&(window.sessionStorage[a+"selection"]=JSON.stringify(c))}},_restoreSelections:function(c){c=window.sessionStorage[c+
"selection"];typeof c==="string"&&(c=c.length>0?JSON.parse(c):null);var a;if(c&&this.explorer.getNavDict()){var b=[];for(a=0;a<c.length;a++){var d=this.explorer.getNavDict().getValue(c[a]);if(d&&d.rowDomNode&&d.model&&(b.push(d.model),this._highlightSelection&&d.rowDomNode.classList.add("checkedRow"),d=i.node(this.getCheckBoxId(d.rowDomNode.id))))d.checked=!0,d.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(b),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},
_storeExpansions:function(c){window.sessionStorage[c+"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(c){var a=!1,b=window.sessionStorage[c+"expanded"];typeof b==="string"&&(b=b.length>0?JSON.parse(b):null);var d;if(b)for(d=0;d<b.length;d++)if(i.node(b[d])){this._expanded.push(b[d]);var e=this;this.tableTree.expand(b[d],function(){e._restoreSelections(c)});a=!0}return!a},_getUIStatePreferencePath:function(){if(this.explorer){var c=this.explorer.getRootPath();if(this._cachePrefix&&
c)return"/"+this._cachePrefix+"/"+c.replace(/[^\.\:\-\_0-9A-Za-z]/g,"")+"/uiState"}return null},expandCollapseImageId:function(c){return c+"__expand"},updateExpandVisuals:function(c,a){var b=i.node(this.expandCollapseImageId(c.id));b&&(b.classList.add(a?this._expandImageClass:this._collapseImageClass),b.classList.remove(a?this._collapseImageClass:this._expandImageClass))},getExpandImage:function(c,a,b,d){var e=document.createElement("span");e.id=this.expandCollapseImageId(c.id);a.appendChild(e);e.classList.add(this._twistieSpriteClass);
e.classList.add(this._collapseImageClass);if(b){var f=document.createElement("span");a.appendChild(f);f.classList.add(d||"imageSprite");f.classList.add(b)}var g=this;e.onclick=function(){g.tableTree.toggle(c.id);if(g.tableTree.isExpanded(c.id))g._expanded.push(c.id);else for(var a in g._expanded)if(g._expanded[a]===c.id){g._expanded.splice(a,1);break}(a=g._getUIStatePreferencePath())&&window.sessionStorage&&g._storeExpansions(a)};return e},render:function(c,a){a.classList.add("navRow");this.renderRow(c,
a)},rowsChanged:function(){this.explorer.selectionPolicy!=="cursorOnly"&&(this.explorer.refreshSelection(),this.explorer.initNavHandler())},updateCommands:function(){for(var c=this.explorer.registry,a=i.$$array(".treeTableRow"),b=0;b<a.length;b++){var d=a[b],e=i.node(d.id+"actionswrapper"),f=c.getService("orion.page.command");f.destroy(e);this.actionScopeId&&f.renderCommands(this.actionScopeId,e,d._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=[];var c=this._getUIStatePreferencePath();
c&&window.sessionStorage&&this._restoreExpansions(c)&&this._restoreSelections(c)}};return b}();e.SelectionRenderer=function(){function b(c,a){this._init(c);this.explorer=a}b.prototype=new e.ExplorerRenderer;b.prototype.renderTableHeader=function(c){var a=document.createElement("thead"),b=document.createElement("tr");a.classList.add("navTableHeading");this._useCheckboxSelection&&b.appendChild(this.initCheckboxColumn(c));for(var d=0,e=this.getCellHeaderElement(d);e;)e.innerHTML.length>0&&e.classList.add("navColumn"),
b.appendChild(e),e=this.getCellHeaderElement(++d);a.appendChild(b);c.appendChild(a)};b.prototype.renderRow=function(c,a){a.verticalAlign="baseline";a.classList.add("treeTableRow");var b=this.explorer.getNavDict();if(b){b.addRow(c,a);var d=this;a.addEventListener("click",function(a){if(d.explorer.getNavHandler())d.explorer.getNavHandler().onClick(c,a)},!1)}if(b=this.getCheckboxColumn(c,a))b.classList.add("checkColumn"),a.appendChild(b);for(var b=0,e=this.getCellElement(b,c,a);e;)a.appendChild(e),b===
0?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle()):e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++b,c,a)};b.prototype.getCellHeaderElement=function(){};b.prototype.getCellElement=function(){};return b}();e.SimpleFlatModel=function(){function b(c,a,d){this.items=c;this.getKey=d;this.idPrefix=a;this.root={children:c}}b.prototype=new e.ExplorerModel;b.prototype.getRoot=
function(c){c(this.root)};b.prototype.destroy=function(){};b.prototype.getId=function(c){for(var c=this.getKey(c).replace(/[\\\/]/g,""),a="",b=0;b<c.length;b++)a+=c[b].match(/[^\.\:\-\_0-9A-Za-z]/g)?c.charCodeAt(b):c[b];return this.idPrefix+a};b.prototype.getChildren=function(c,a){c===this.root?a(this.items):a([])};return b}();return e});
define("orion/searchOutliner","i18n!orion/search/nls/messages,require,orion/webui/littlelib,orion/i18nUtil,orion/section,orion/commands,orion/selection,orion/explorers/explorer,orion/EventTarget".split(","),function(j,k,i,b,f,g,e,d,c){function a(a){this._searches=[];c.attach(this);this._init(a);this._initializeSearches()}function h(a,c){this.explorer=c;this._init(a)}function l(a,c){this.selection=c;this.registry=a;this.renderer=new h({checkbox:!1},this)}function n(a){var c=i.node(a.parent);if(!c)throw"no parent";
if(!a.serviceRegistry)throw"no service registry";this._parent=c;var d=this._registry=a.serviceRegistry,c=new g.Command({name:j.Rename,imageClass:"core-sprite-rename",id:"eclipse.renameSearch",parameters:new g.ParametersDescription([new g.CommandParameter("name","text","Name:","")]),visibleWhen:function(a){a=Array.isArray(a)?a:[a];return a.length===1&&a[0].query},callback:function(a){var c=Array.isArray(a.items)?a.items[0]:a.items;a.parameters&&a.parameters.valueFor("name")&&d.getService("orion.core.savedSearches").renameSearch(c.query,
a.parameters.valueFor("name"))}.bind(this)}),e=new g.Command({name:"Delete",imageClass:"core-sprite-delete",id:"eclipse.deleteSearch",visibleWhen:function(a){a=Array.isArray(a)?a:[a];if(a.length===0)return!1;for(var c=0;c<a.length;c++)if(!a[c].query)return!1;return!0},callback:function(c){var c=Array.isArray(c.items)?c.items:[c.items],d=c.length===1?b.formatMessage("Are you sure you want to delete '${0}' from the searches?",c[0].name):b.formatMessage("Are you sure you want to delete these ${0} searches?",
c.length);if(window.confirm(d))for(d=0;d<c.length;d++)a.serviceRegistry.getService("orion.core.savedSearches").removeSearch(c[d].query)}});this.commandService=this._registry.getService("orion.page.command");this.commandService.addCommand(c);this.commandService.addCommand(e);if(c=this._registry.getService("orion.core.savedSearches")){var f=this._registry;c.getSearches().then(function(a){this.render(a.searches,f)}.bind(this));c.addEventListener("searchesChanged",function(a){this.render(a.searches,a.registry)}.bind(this))}}
a.prototype={_init:function(a){this._registry=a.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.savedSearches",this)},_notifyListeners:function(){this.dispatchEvent({type:"searchesChanged",searches:this._searches,registry:this._registry})},_initializeSearches:function(){var a=this;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var b,c=c.get("search");typeof c==="string"&&(c=JSON.parse(c));if(c)for(b in c)a._searches.push(c[b]);
a._notifyListeners()})},_storeSearches:function(){var a=this._searches;this._registry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("search",a)})},addSearch:function(a,c){var b=!1,d;for(d in this._searches)if(this._searches[d].query===c)this._searches[d].name=a,b=!0;b?this._registry.getService("orion.page.message").setMessage(a+" is already saved.",2E3):this._searches.push({name:a,query:c});this._searches.sort(this._sorter);this._storeSearches();this._notifyListeners()},
removeSearch:function(a){for(var c in this._searches)if(this._searches[c].query===a){this._searches.splice(c,1);break}this._searches.sort(this._sorter);this._storeSearches();this._notifyListeners()},renameSearch:function(a,c){var b=!1,d;for(d in this._searches)if(this._searches[d].query===a){var e=this._searches[d];if(e.name!==c)e.name=c,b=!0}b&&(this._searches.sort(this._sorter),this._storeSearches(),this._notifyListeners())},getSearches:function(){return{searches:this._searches}},_sorter:function(a,
c){var b=a.name.toLowerCase(),d=c.name.toLowerCase();return b>d?1:b<d?-1:0}};h.prototype=d.SelectionRenderer.prototype;h.prototype.constructor=h;h.prototype.getLabelColumnIndex=function(){return 0};h.prototype.getCellElement=function(a,c,b){if(c.query){var a=k.toUrl("search/search.html")+"#"+c.query,d=document.createElement("td");b.appendChild(d);d.classList.add("mainNavColumn");d.classList.add("singleNavColumn");b=document.createElement("a");b.href=a;b.className="navlinkonpage";d.appendChild(b);
b.appendChild(window.document.createTextNode(c.name))}};l.prototype=d.Explorer.prototype;l.prototype.constructor=l;n.prototype={render:function(a,c){var h=this.commandService;if(!this.searchesSection){this.searchesSection=new f.Section(this._parent,{id:"searchSection",title:j.Searches,content:'<div id="searchContent"></div>',useAuxStyle:!0,preferenceService:c.getService("orion.core.preference"),slideout:!0});this.searchSelection=new e.Selection(c,"orion.searches.selection");var k=this.searchesSection.selectionNode.id;
this.commandService.registerCommandContribution(k,"eclipse.renameSearch",1,null,!1,new g.CommandKeyBinding(113,!1,!1,!1,!1,"searchContent"));this.commandService.registerCommandContribution(k,"eclipse.deleteSearch",2,null,!1,new g.CommandKeyBinding(46,!1,!1,!1,!1,"searchContent"));h.registerSelectionService(k,this.searchSelection);c.getService("orion.searches.selection").addEventListener("selectionChanged",function(a){var c=i.node(k);c&&(h.destroy(c),h.renderCommands(k,c,a.selections,this,"button"))})}if(a.length>
0)this.searchTable=(new l(c,this.searchSelection)).createTree("searchContent",new d.SimpleFlatModel(a,"srch",function(a){return a.query}));else{var n=i.node("searchContent");if(n)n.innerHTML="<p>"+b.formatMessage(j["You can save frequently used by searches by choosing ${0} in the search toolbar."],["<b>Save Search</b>"])+"</p>"}}};n.prototype.constructor=n;return{SavedSearches:a,SearchOutliner:n}});
define("orion/extensionCommands","require,orion/Deferred,orion/commands,orion/editor/regex,orion/contentTypes,orion/URITemplate,orion/i18nUtil,orion/URL-shim".split(","),function(j,k,i,b,f,g,e){var d={},c=(new URL(j.toUrl("."),window.location)).href.slice(0,-1);d._cloneItemWithoutChildren=function h(c){if(c===null||typeof c!=="object")return c;var b=c.constructor(),d;for(d in c)d!=="children"&&d!=="Children"&&(b[d]=h(c[d]));return b};d._createOpenWithCommands=function(c){function b(c,d){for(var e=
c.getServiceReferences("orion.navigate.openWith"),f=[],h=0;h<e.length;h++){var g=e[h];g.getProperty("editor")===d.id&&(g=g.getProperty("contentType"),g instanceof Array?f=f.concat(g):g!==null&&typeof g!=="undefined"&&f.push(g))}return f}for(var d=function(){for(var b=c.getServiceReferences("orion.edit.editor"),d=[],e=0;e<b.length;e++){var f=b[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(c){for(c=c.getServiceReferences("orion.navigate.openWith.default");0<c.length;)return{editor:c[0].getProperty("editor")};return null}(c),f=[],g=0;g<d.length;g++){var i=d[g],j=e&&e.editor===i.id,k=b(c,i);k.length&&f.push({properties:{name:i.name||i.id,nameKey:i.nameKey,id:"eclipse.openWithCommand."+i.id,tooltip:i.name,tooltipKey:i.nameKey,contentType:k,uriTemplate:i.uriTemplate,nls:i.nls,forceSingleItem:!0,isEditor:j?"default":"editor"},service:{}})}return f};
d._makeValidator=function(b,d,e,i){function j(c,b,d,e){var f=d.match,h;if(b.indexOf("|")>=0)return h=b.substring(0,b.indexOf("|")),b=b.substring(b.indexOf("|")+1),j(c,h,d,e)?!0:j(c,b,d,e);else if(b.indexOf(":")>=0)return h=b.substring(0,b.indexOf(":")),b=b.substring(b.indexOf(":")+1),c[h]?j(c[h],b,d,e):!1;else{a:{h=!1;var g;if(c[b]){if(f)if(typeof f==="string"){if(!typeof(c[b]==="string")){d=!1;break a}if(d.variableName){if(f=RegExp(f).exec(c[b]))h=f[0],g=d.variableMatchPosition==="before"?c[b].substring(0,
f.index):d.variableMatchPosition==="after"?c[b].substring(f.index+h.length):d.variableMatchPosition==="only"?h:c[b],h=!0}else{d=RegExp(f).test(c[b]);break a}}else c[b]===f&&(g=c[b],h=!0);else g=c[b],h=!0;if(h&&d.variableName&&(e[d.variableName]=g,e.itemCached=c,d.replacements))for(c=0;c<d.replacements.length;c++)b=!1,d.replacements[c].pattern?e[d.variableName]=e[d.variableName].replace(RegExp(d.replacements[c].pattern),d.replacements[c].replacement||""):b=!0,b&&window.console.log("Invalid replacements specified in validation property.  "+
d.replacements[c]);d=h}else d=!1}return d}}return{info:b,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 l=c[d],k=e;if(this.info.validationProperties)for(g=0;g<this.info.validationProperties.length;g++){var x=this.info.validationProperties[g];if(x.source){if(!j(l,x.source,x,this)){g=!1;break a}}else{window.console.log("Invalid validationProperties in "+
b.id+".  No source property specified.");g=!1;break a}}if(this.info.contentType&&k){x=!1;if(l=f.getFilenameContentType(l.Name,k))for(g=0;g<this.info.contentType.length;g++)if(l.id===this.info.contentType[g]){x=!0;break}g=x}else g=!0}if(!g)return!1}return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(b){if(this.info.uriTemplate){var d={},e;for(e in b)b.hasOwnProperty(e)&&(d[e]=b[e]);if(this.info.validationProperties)for(e=0;e<this.info.validationProperties.length;e++){var f=
this.info.validationProperties[e];f.source&&f.variableName&&(this.itemCached===b&&this[f.variableName]||j(b,f.source,f,this),b[f.variableName]?window.console.log("Variable name "+f.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):d[f.variableName]=this[f.variableName])}d.OrionHome=c;b=new g(this.info.uriTemplate);return window.decodeURIComponent(b.expand(d))}return null}}};d._createCommandOptions=function(c,b,f,g,i,j){function t(e,k){var o=
d._makeValidator(c,f,g,j);e.visibleWhen=o.validationFunction.bind(o);if(i)if(o.generatesURI.bind(o)())e.hrefCallback=function(c){c=Array.isArray(c.items)?c.items[0]:c.items;return o.getURI.bind(o)(c)};else{var t=c;e.callback=function(c){var g;if(t.forceSingleItem)c=Array.isArray(c.items)?c.items[0]:c.items,g=d._cloneItemWithoutChildren(c);else if(Array.isArray(c.items)){g=[];for(var h=0;h<c.items.length;h++)g.push(d._cloneItemWithoutChildren(c.items[h]))}else g=d._cloneItemWithoutChildren(c.items);
if(f)var i=f.getService("orion.page.progress");b.run?i?i.progress(b.run(g),"Running command: "+e.name):b.run(g):f&&(i?i.progress(f.getService(b).run(g),"Running command: "+e.name):f.getService(b).run(g))}}k.resolve(e)}var o=new k;c.nls?e.getMessageBundle(c.nls).then(function(b){t({name:c.nameKey?b[c.nameKey]:c.name,image:c.image,id:c.id||c.name,tooltip:c.tooltipKey?b[c.tooltipKey]:c.tooltip,isEditor:c.isEditor},o)}):t({name:c.name,image:c.image,id:c.id||c.name,tooltip:c.tooltip,isEditor:c.isEditor},
o);return o};d.getOpenWithCommands=function(c){var b=[],d;for(d in c._commandList){var e=c._commandList[d];e.isEditor&&b.push(e)}return b};return d});
define("orion/PageLinks",["require","orion/Deferred","orion/PageUtil","orion/URITemplate","orion/URL-shim"],function(j,k,i,b){function f(f,e){for(var d=f.getServiceReferences(e||"orion.page.link"),c=i.matchResourceParameters(window.location.href),a={OrionHome:(new URL(j.toUrl("."),window.location)).href.slice(0,-1),Location:c.resource},c=[],h=0;h<d.length;h++){for(var l={},n=d[h].getPropertyKeys(),q=0;q<n.length;q++)l[n[q]]=d[h].getProperty(n[q]);if(l.uriTemplate&&l.nls&&(l.name||l.nameKey)){var p=
new k;j(["i18n!"+l.nls],function(c){var d=new b(l.uriTemplate),d=window.decodeURIComponent(d.expand(a)),d=i.validateURLScheme(d);l.href=d;l.textContent=l.nameKey?c[l.nameKey]:l.name;p.resolve(l)});c.push(p)}else if(l.uriTemplate&&l.name)n=new b(l.uriTemplate),n=window.decodeURIComponent(n.expand(a)),n=i.validateURLScheme(n),l.href=n,l.textContent=l.name,c.push((new k).resolve(l))}return k.all(c)}return{createPageLinks:function(b,e){return f(b,e).then(function(b){return b.map(function(c){var a=c.href,
c=c.textContent,b=document.createElement("a");b.href=a;b.target="_self";b.classList.add("targetSelector");b.textContent=c;return b})})},getPageLinksInfo:f}});
define("orion/widgets/UserMenu",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/PageLinks"],function(j,k,i,b){function f(b){this._init(b)}f.prototype={_init:function(b){this._dropdownNode=i.node(b.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=b.dropdown;this._serviceRegistry=b.serviceRegistry;this.authenticatedServices={};this.unauthenticatedServices={}},isSingleService:function(){return this.length(this.unauthenticatedServices)+
this.length(this.authenticatedServices)===1},hasServices:function(){return this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)>0},length:function(b){var e=0,d;for(d in b)b.hasOwnProperty(d)&&e++;return e},_makeMenuItem:function(b,e){var d=document.createElement("span");d.role="menuitem";d.tabIndex=0;var c=document.createTextNode(b);d.appendChild(c);d.classList.add("dropdownMenuItem");d.addEventListener("click",e,!1);d.addEventListener("keydown",function(a){(a.keyCode===
i.KEY.ENTER||a.keyCode===i.KEY.SPACE)&&e()},!1);return d},_renderAuthenticatedService:function(b){var e=this,d=this.authenticatedServices[b].authService;if(d&&d.logout){var c=document.createElement("li"),a=this._makeMenuItem(j["Sign Out"],function(){d.logout().then(function(){e.addUserItem(b,d,e.authenticatedServices[b].label);localStorage.removeItem(b);localStorage.removeItem("lastLogin");for(var a=localStorage.length-1;a>=0;a--){var c=localStorage.key(a);c&&c.indexOf("/orion/preferences/user")===
0&&localStorage.removeItem(c)}d.getAuthForm(window.location.href).then(function(a){window.location=a})})});c.appendChild(a);this._dropdownNode.appendChild(c)}},renderServices:function(){function f(c){d[c]||(d[c]=e.createDocumentFragment());return d[c]}var e=document,d=[];b.getPageLinksInfo(this._serviceRegistry,"orion.page.link.user").then(function(c){this._dropdown.empty();c.forEach(function(a){var c=f(typeof a.category==="number"?a.category:1),b=e.createElement("li"),d=e.createElement("a");d.role=
"menuitem";d.classList.add("dropdownMenuItem");d.href=a.href;d.textContent=a.textContent;b.appendChild(d);c.appendChild(b)});if(this.keyAssistFunction){var c=document.createElement("li"),a=this._makeMenuItem(j["Keyboard Shortcuts"],this.keyAssistFunction);a.classList.add("key-assist-menuitem");c.appendChild(a);f(0).appendChild(c)}var b=this;d.sort(function(a,c){return a-c}).forEach(function(a,c){if(c<d.length-1){var e=document.createElement("li");e.classList.add("dropdownSeparator");var f=document.createElement("span");
f.classList.add("dropdownSeparator");e.appendChild(f);a.appendChild(e)}b._dropdownNode.appendChild(a)});if(this.isSingleService())for(var i in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(i)&&this._renderAuthenticatedService(i,0)}.bind(this))},setKeyAssist:function(b){this.keyAssistFunction=b;this.renderServices()},addUserItem:function(b,e,d,c){c?(this.unauthenticatedServices[b]&&delete this.unauthenticatedServices[b],this.authenticatedServices[b]={authService:e,label:d,data:c}):
(this.authenticatedServices[b]&&delete this.authenticatedServices[b],this.unauthenticatedServices[b]=this.unauthenticatedServices[b]?{authService:e,label:d,pending:this.unauthenticatedServices[b].pending}:{authService:e,label:d});this.renderServices()}};f.prototype.constructor=f;return{UserMenu:f}});
define("orion/searchUtils","i18n!orion/nls/messages,require,orion/editor/regex,orion/commands,orion/PageUtil,orion/URITemplate".split(","),function(j,k,i,b,f,g){function e(c,a,b){var d="";b&&(d="^");if(d=i.parse("/"+d+c.searchStr+"/"))b=d.pattern,d=d.flags,d.indexOf("i")===-1&&!a.caseSensitive&&(d+="i"),c.regExp={pattern:b,flags:d},c.wildCard=!0}var d=d||{};d.searchUtils=d.searchUtils||{};d.searchUtils.ALL_FILE_TYPE="*.*";d.searchUtils.doSearch=function(c,a,b,e){if(c){var f=!0;b==="*"&&(b="");b===
""&&(f=e&&e.type!==d.searchUtils.ALL_FILE_TYPE);if(f){b!==""&&d.searchUtils.addRecentSearch(a,b,e?e.regEx:!1);var c=c.createSearchParams(b,!1,!1,e),g=d.searchUtils.generateSearchHref(c);d.searchUtils.getOpenSearchPref(a,function(a){a?window.open(g):window.location=g})}}else window.alert(j["Can't search: no search service is available"])};d.searchUtils.generateSearchHelper=function(c,a){var b=c.keyword,f=b,g={};c.fileType&&c.fileType!==d.searchUtils.ALL_FILE_TYPE&&b===""&&(f="*."+c.fileType);if(c.regEx)g.searchStr=
b,e(g,c,a);else{var i=b.indexOf("*")>-1,j=b.indexOf("?")>-1;i&&(b=b.split("*").join(".*"));j&&(b=b.split("?").join("."));!i&&!j&&!c.nameSearch?(g.searchStr=c.caseSensitive?b.split("\\").join(""):b.split("\\").join("").toLowerCase(),g.wildCard=!1):(g.searchStr=c.caseSensitive?b:b.toLowerCase(),e(g,c,a),g.wildCard=!0)}g.searchStrLength=g.searchStr.length;return{params:c,inFileQuery:g,displayedSearchTerm:f}};d.searchUtils.convertSearchParams=function(c){if(c.rows!==void 0)c.rows=parseInt(c.rows);if(c.start!==
void 0)c.start=parseInt(c.start);if(typeof c.regEx==="string")c.regEx=c.regEx.toLowerCase()==="true";if(typeof c.caseSensitive==="string")c.caseSensitive=c.caseSensitive.toLowerCase()==="true";if(typeof c.nameSearch==="string")c.nameSearch=c.nameSearch.toLowerCase()==="true"};d.searchUtils.copySearchParams=function(c,a){var b={},d;for(d in c)if(c[d]!==void 0&&c[d]!==null&&(a||d!=="replace"))b[d]=c[d];return b};d.searchUtils.generateSearchHref=function(c){var a=k.toUrl("search/search.html"),c=d.searchUtils.copySearchParams(c,
!0),b=c.resource;c.resource=void 0;return(new g(a+"#{,resource,params*}")).expand({resource:b,params:c})};d.searchUtils.generateFindURLBinding=function(c,a,b,d){c={find:a.searchStr,regEx:a.wildCard?!0:void 0,caseSensitive:c.caseSensitive?!0:void 0,replaceWith:typeof d==="string"?d:void 0,atLine:typeof b==="number"?b:void 0};return","+(new g("{,params*}")).expand({params:c})};d.searchUtils.convertFindURLBinding=function(c){if(typeof c.regEx==="string")c.regEx=c.regEx.toLowerCase()==="true";if(typeof c.caseSensitive===
"string")c.caseSensitive=c.caseSensitive.toLowerCase()==="true";if(typeof c.atLine==="string")c.atLine=parseInt(c.atLine)};d.searchUtils.replaceRegEx=function(c,a,b){return c.replace(RegExp(a.pattern,a.flags),b)};d.searchUtils.replaceStringLiteral=function(c,a,b){a=i.parse("/"+a+"/gim");return d.searchUtils.replaceRegEx(c,a,b)};d.searchUtils.searchOnelineLiteral=function(c,a,b){var d;d=0;for(var e=!1,f=[];;)if(d=a.indexOf(c.searchStr,d),d<0)break;else{f.push({startIndex:d,length:c.searchStrLength});
e=!0;if(b)break;d+=c.searchStrLength}return e?f:null};d.searchUtils.findRegExp=function(c,a,b,d){if(!a)return null;b=b||"";b+=(b.indexOf("g")===-1?"g":"")+(b.indexOf("m")===-1?"m":"");var e=null;return(e=RegExp(a,b).exec(c.substring(d)))&&{startIndex:e.index+d,length:e[0].length}};d.searchUtils.searchOnelineRegEx=function(c,a,b){for(var e=0,f=!1,g=[];;)if(e=d.searchUtils.findRegExp(a,c.regExp.pattern,c.regExp.flags,e)){g.push(e);f=!0;if(b)break;e=e.startIndex+e.length}else break;return f?g:null};
d.searchUtils.generateNewContents=function(c,a,b,e,f,g){if(e&&a){if(!c)b.contents=[];for(var i=0;i<a.length;i++){for(var j=a[i],k=!1,o=!1,w=[],s,x=0,u=0;u<e.children.length;u++)if(e.children[u].lineNumber-1===i){x=u;for(k=0;k<e.children[u].matches.length;k++)e.children[u+k].checked!==!1&&w.push(k);o=w.length>0;s=e.children[u].matches;k=!0;break}if(k){if(o){w=d.searchUtils.replaceCheckedMatches(j,f,s,w,g);j=w.replacedStr;for(k=0;k<e.children[x].matches.length;k++)e.children[x+k].newMatches=w.newMatches}else for(k=
0;k<e.children[x].matches.length;k++)e.children[x+k].newMatches=e.children[x+k].matches;c?b.contents[i]=j:b.contents.push(j)}else c||b.contents.push(j)}}};d.searchUtils.generateMatchContext=function(c,a,b){var d=[],e=c*2+1,f;a.length<=e?(f=0,c=a.length-1):(f=b-c,f<0?(f=0,c=f+e-1):(c=b+c,c>a.length-1&&(c=a.length-1,f=c-e+1)));for(e=f;e<=c;e++)d.push({context:a[e],current:e===b});return d};d.searchUtils.splitFile=function(c){for(var a=0,b=0,d=0,e=0,f=[];;){a!==-1&&a<=d&&(a=c.indexOf("\r",d));b!==-1&&
b<=d&&(b=c.indexOf("\n",d));if(b===-1&&a===-1){f.push(c.substring(e));break}var g=1;a!==-1&&b!==-1?a+1===b?(g=2,d=b+1):d=(a<b?a:b)+1:d=a!==-1?a+1:b+1;f.push(c.substring(e,d-g));e=d}return f};d.searchUtils.searchWithinFile=function(c,a,b,e,f,g){b=d.searchUtils.splitFile(b);if(f)a.contents=b;if(a){a.children=[];for(var i=e=0;i<b.length;i++){var j=b[i];if(j&&j.length>0){var k=g?j:j.toLowerCase();if(k=c.wildCard?d.searchUtils.searchOnelineRegEx(c,k):d.searchUtils.searchOnelineLiteral(c,k)){var o=i+1;
if(f)for(var w=0;w<k.length;w++){var s=w+1,s={parent:a,checked:a.checked,type:"detail",matches:k,lineNumber:o,matchNumber:s,name:j,location:a.location+"-"+o+"-"+s};a.children.push(s)}else s={parent:a,context:d.searchUtils.generateMatchContext(2,b,i),checked:a.checked,type:"detail",matches:k,lineNumber:o,name:j,location:a.location+"-"+o},a.children.push(s);e+=k.length}}}a.totalMatches=e}};d.searchUtils.replaceCheckedMatches=function(c,a,b,d,e){for(var f=0,g="",i=[],j=0;j<b.length;j++){f!==b[j].startIndex&&
(g+=c.substring(f,b[j].startIndex));if(b[j].length)e=b[j].length;for(var f=!1,k=0;k<d.length;k++)if(d[k]===j){f=!0;break}f?(i.push({startIndex:g.length,length:a.length}),g+=a):(i.push({startIndex:g.length,length:e}),g+=c.substring(b[j].startIndex,b[j].startIndex+e));f=b[j].startIndex+e}f<c.length&&(g+=c.substring(f));return{replacedStr:g,newMatches:i}};d.searchUtils.fullPathNameByMeta=function(c){var a=c.length,b="";if(a>0)for(a-=1;a>-1;a--)b=b+(b===""?"":"/")+c[a].Name;return b};d.searchUtils.path2FolderName=
function(c,a,b){return c.substring(0,c.length-a.length-(b?0:1))};d.searchUtils._storeRecentSearch=function(c,a){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("recentSearch",a)})};d.searchUtils.addRecentSearch=function(c,a,b){typeof a==="string"&&a&&c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){var f,e=e.get("recentSearch");typeof e==="string"&&(e=JSON.parse(e));if(e){for(f in e)if(e[f].name===a)return;
e.length>=20&&e.splice(19,e.length-20+1)}else e=[];e.splice(0,0,{name:a,regEx:b});d.searchUtils._storeRecentSearch(c,e)})};d.searchUtils.getSearches=function(c,a,b){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c=c.get(a);typeof c==="string"&&(c=JSON.parse(c));c&&b&&b(c)})};d.searchUtils.getMixedSearches=function(c,a,b,e){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var f,g=c.get("recentSearch");typeof g===
"string"&&(g=JSON.parse(g));if(a)for(f in c=c.get("search"),typeof c==="string"&&(c=JSON.parse(c)),c)if(b){var i=d.searchUtils.parseQueryStr(c[f].query);g.some(function(a){return i.searchStrTitle===a.name})||g.push({name:i.searchStrTitle,label:c[f].name})}else g.push({name:null,label:c[f].name,value:c[f].query});g&&e&&e(g)})};d.searchUtils.getOpenSearchPref=function(c,a){c.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(c){c=c.get("nav.config");a(c&&c["links.newtab"]!==
"undefined"?c["links.newtab"]?!0:!1:!1)})};d.searchUtils.setOpenSearchPref=function(c,a){c.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){c.put("openSearchPref",{openInNewTab:a})})};return d.searchUtils});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages,require,orion/i18nUtil,orion/searchUtils,orion/contentTypes,orion/Deferred".split(","),function(j,k,i,b,f,g){function e(d,c,a,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=a;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:b.generateSearchHelper(a);this._location=e&&e.location;this._childrenLocation=e&&e.childrenLocation?e.childrenLocation:this._location}e.prototype.search=function(b){var c=this.registry.getService("orion.core.contenttypes");this._onSearchComplete=b;var a=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(b){b&&c.getContentTypes().then(function(c){a.contentTypesCache=
c;a._visitRecursively(a._childrenLocation).then(function(){a._sort(a.fileLocations);a._onSearchComplete({response:{numFound:a.fileLocations.length,docs:a.fileLocations}})})})})};e.prototype.searchName=function(d,c){if(d)this.searchHelper=b.generateSearchHelper(d,!0);if(c)this.onSearchNameComplete=c;var a=[];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?
b.searchOnelineRegEx(this.searchHelper.inFileQuery,f,!0):b.searchOnelineLiteral(this.searchHelper.inFileQuery,f,!0))if(a.push(this.fileSkeleton[e]),a.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:a.length,docs:a}})}};e.prototype.buildSkeleton=function(b,c){this._buildingSkeleton=!0;var a=this.registry.getService("orion.core.contenttypes"),e=this;b();a.getContentTypes().then(function(a){e.contentTypesCache=a;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 b=[],c;if(this.fileLocations.length>0){c=this;for(var a=0;a<c.fileLocations.length;a++)b.push(c._sniffSearch(c.fileLocations[a]))}return g.all(b)};e.prototype._sort=function(b){b.sort(function(c,a){var b=c.Name&&c.Name.toLowerCase(),d=a.Name&&a.Name.toLowerCase();return b<d?-1:b>d?1:0})};e.prototype._onFileType=function(d){return this.searchHelper.params.fileType?
this.searchHelper.params.fileType===b.ALL_FILE_TYPE?!0:d.extension.indexOf(this.searchHelper.params.fileType)>=0:!0};e.prototype._visitRecursively=function(b){var c=[],a=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(b);var e=a.registry.getService("orion.page.progress");return(e?e.progress(a.fileClient.fetchChildren(b),"Crawling search for children of "+b):a.fileClient.fetchChildren(b)).then(function(b){for(var d=0;d<b.length;d++)if(b[d].Directory!==void 0&&b[d].Directory===!1)if(a._searchOnName)c.push(a._buildSingleSkeleton(b[d]));
else if(a._buildSkeletonOnly)c.push(a._buildSingleSkeleton(b[d]));else{var e=f.getFilenameContentType(b[d].Name,a.contentTypesCache);e&&(e["extends"]==="text/plain"||e.id==="text/plain")&&a._onFileType(e)&&c.push(a._sniffSearch(b[d]))}else b[d].Location&&c.push(a._visitRecursively(b[d].ChildrenLocation));return g.all(c)})};e.prototype._hitOnceWithinFile=function(d){d=this._searchParams.caseSensitive?d:d.toLowerCase();return this.searchHelper.inFileQuery.wildCard?b.searchOnelineRegEx(this.searchHelper.inFileQuery,
d,!0):b.searchOnelineLiteral(this.searchHelper.inFileQuery,d,!0)};e.prototype._reportSingleHit=function(b){b.LastModified=b.LocalTimeStamp;this.fileLocations.push(b);this._hitCounter++;this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0)};e.prototype._sniffSearch=function(b){this._totalCounter++;var c=this;if(this.searchHelper.params.keyword==="")this._reportSingleHit(b),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(b.Location),"Reading file "+b.Location).then(function(a){c._hitOnceWithinFile(a)&&c._reportSingleHit(b);c.registry.getService("orion.page.message").setProgressResult({Message:i.formatMessage(j["${0} files found out of ${1}"],c._hitCounter,c._totalCounter)})},function(a){console.error("Error loading file content: "+a.message)})};e.prototype._buildSingleSkeleton=function(b){this._totalCounter++;
this.fileSkeleton.push(b);this.searchHelper&&!this._buildSkeletonOnly&&this._totalCounter%100===0&&this.searchName();b=new g;b.resolve(this._totalCounter);return b};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,k,i,b,f,g){function e(b){this.registry=b.serviceRegistry;this._commandService=b.commandService;(this._fileService=b.fileService)||console.error("No file service on search client")}e.prototype={search:function(b,c,a){var e=function(a){for(var c=[],b=0;b<a.response.docs.length;b++){var d=a.response.docs[b];c.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 c};if(this._crawler&&b.nameSearch)this._crawler.searchName(b,function(c){a(e(c),null)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(b),"Searching "+b.keyword).then(function(c){var f=b.keyword,f=f.substring(f.indexOf("}")+1),f=f.substring(f.indexOf(":")+1);a(e(c),f)},function(c){a(null,null,c)})}catch(i){typeof i==="string"&&i.indexOf("search")>
-1&&this._crawler?this._crawler.searchName(b,function(c){a(e(c),null)}):typeof i==="string"&&i.indexOf("search")>-1&&!b.nameSearch?(new g.SearchCrawler(this.registry,this._fileService,b,{childrenLocation:this.getChildrenLocation()})).search(function(c){a(e(c),null)}):this.registry.getService("orion.page.message").setErrorMessage(i)}},getFileService:function(){return this._fileService},setCrawler:function(b){this._crawler=b},handleError:function(b,c){console.error(b);i.empty(c);c.appendChild(document.createTextNode(b));
return b},setLocationByMetaData:function(d,c){var a="",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),a=e.Name,this._childrenLocation=e.ChildrenLocation;else if(d)this.setLocationbyURL(this._searchRootLocation),a=this._fileService.fileServiceName(d.Location),this._childrenLocation=d.ChildrenLocation;
e=i.node("search");a||(a="");if(e&&e.placeholder){e.value="";var f=b.formatMessage(j["Search ${0}"],a);e.placeholder=f.length>30?f.substring(0,27)+"...":b.formatMessage(j["Search ${0}"],a)}if(e&&e.title)e.title=j["Type a keyword or wild card to search in "]+a},setLocationbyURL:function(b){this._searchLocation=b},setRootLocationbyURL:function(b){this._searchRootLocation=b},setChildrenLocationbyURL:function(b){this._childrenLocation=b},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(b,c,a,e){a=a?this.getSearchRootLocation():this.getSearchLocation();return c?{resource:a,sort:"NameLower asc",rows:100,start:0,nameSearch:!0,keyword:b}:{resource:a,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:b}},defaultRenderer:{makeRenderFunction:function(d,c,a,e,f){function g(a){return!d?!0:(a=d.getFilenameContentType(a))&&(a["extends"]==="text/plain"||a.id==="text/plain")?!0:!1}return function(d,p,m){if(m)i.empty(c),d=document.createElement("div"),d.appendChild(document.createTextNode(j["Search failed."])),c.appendChild(d),typeof e==="function"&&e(c);else{var m=function(){function a(c,b){var d=
b.folderName?b.folderName:b.path,e=document.createElement("span");e.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");e.appendChild(document.createTextNode(" - "+d+" "));c.appendChild(e)}var c={};return function(b,d){var e=d.name;if(c.hasOwnProperty(e)){a(b,d);var f=c[e];typeof f==="function"&&(c[e]=null,f())}else c[e]=function(){a(b,d)}}}(),t=!1;i.empty(c);if(d&&d.length>0){var o=document.createElement("table");o.setAttribute("role","presentation");for(var w=0;w<d.length;w++){var s=d[w],x;if(!t&&(t=!0,a))x=
o.insertRow(0).insertCell(0),x.textContent=a;x=o.insertRow(-1).insertCell(0);x.colspan=2;f&&f(x);var u=document.createElement("a");u.appendChild(document.createTextNode(s.name));s.LineNumber&&u.appendChild(document.createTextNode(" (Line "+s.LineNumber+")"));var A=s.location;s.isExternalResource?A=s.path:(A=s.directory?k.toUrl("navigate/table.html")+"#"+s.path:g(s.name)?k.toUrl("edit/edit.html")+"#"+s.path:s.path,A==="#"&&(A=""));u.setAttribute("href",A);u.setAttribute("aria-describedby",(s.folderName?
s.folderName:s.path).replace(/[^a-zA-Z0-9_\.:\-]/g,""));u.style.verticalAlign="middle";x.appendChild(u);m(x,s)}c.appendChild(o);typeof e==="function"&&e(c)}!t&&p&&(d=b.formatMessage(j["No matches found for ${0}"],p),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,k,i,b,f,g){function e(b){this._init(b)}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="'+
b.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(b){this.title=b.title||j["Find File Named"];this.modal=!0;this.messages=j;this._searcher=b.searcher;this._progress=b.progress;this._onHide=b.onHide;
this._contentTypeService=new i.ContentTypeService(this._searcher.registry);if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=b.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(j["Missing required argument: fileService"]);this._searchRenderer=b.searchRenderer;if(!this._searchRenderer||typeof this._searchRenderer.makeRenderFunction!==
"function")throw Error(j["Missing required argument: searchRenderer"]);this._favService=b.favoriteService;if(!this._favService)throw Error(j["Missing required argument: favService"]);this._initialize()};e.prototype._bindToDom=function(b){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(a){if(a.keyCode===f.KEY.ENTER){var b=f.$("a",c.$results);b&&(f.stop(a),window.open(b.href),c.hide())}},!1);b.addEventListener("keydown",function(a){var b,d,e,g,i;if(a.keyCode===f.KEY.DOWN||a.keyCode===f.KEY.UP)d=f.$$array("a",c.$results),b=f.$$array("a",c.$favresults),e=document.activeElement,i=d.indexOf(e),g=b.indexOf(e),a.keyCode===f.KEY.DOWN?g>=0?(g<b.length-1?b[g+1]:d.length>0?d[0]:b[0]).focus():i>=0?(i<d.length-1?d[i+1]:b.length>0?b[0]:d[0]).focus():
(d.length>0||b.length>0)&&(-1<b.length-1?b[0]:d[0]).focus():g>=0?(e=c.$fileName,(g>0?b[g-1]:e).focus()):i>=0?(e=c.$fileName,(i>0?d[i-1]:b.length>0?b[b.length-1]:e).focus()):d.length>0?d[d.length-1].focus():b.length>0&&b[b.length-1].focus(),f.stop(a)});b.addEventListener("mouseup",function(a){a.target.focus()},!1);this.populateFavorites();setTimeout(function(){if(c._forceUseCrawler||!c._fileService.getService(c._searcher.getSearchLocation()).search){var a=c._searchOnRoot?c._searcher.getSearchRootLocation():
c._searcher.getChildrenLocation(),a=new k.SearchCrawler(c._searcher.registry,c._fileService,"",{searchOnName:!0,location:a});c._searcher.setCrawler(a);a.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 b=document.createElement("div");b.appendChild(document.createTextNode(j["Populating favorites&#x2026;"]));
f.empty(this.$favresults);this.$favresults.appendChild(b);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 b=this;return function(c){if(c.navigator)c=c.navigator;b._searchRenderer.makeRenderFunction(b._contentTypeService,b.$favresults,!1,b.decorateResult.bind(b),
b.showFavoritesImage)(c);if(c&&c.length>0)c=document.createElement("div"),c.style.borderBottom="1px dashed #BBBBBB",c.style.padding="5px",b.$favresults.appendChild(c)}};e.prototype.showFavoritesImage=function(d){var c=new Image;c.classList.add("modelDecorationSprite");c.classList.add("core-sprite-makeFavorite");c.src=b.toUrl("images/none.png");c.title=j.Favorite;d.appendChild(c);c.style.verticalAlign="middle"};e.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var b=(new Date).getTime();
b-this._time>this._searchDelay?(this._time=b,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};e.prototype.doSearch=function(){var b=this.$fileName.value,c=this.showFavorites();this._progress?this._progress.progress(this._favService.queryFavorites(b),"Getting favorites for: "+b).then(function(a){c(a)}):this._favService.queryFavorites(b).then(function(a){c(a)});if(b){var a=document.createElement("div");a.appendChild(document.createTextNode(j["Searching..."]));f.empty(this.$favresults);
this.$results.appendChild(a);var e=this;setTimeout(function(){var a=e._searcher.createSearchParams(b,!0,e._searchOnRoot),c=e._searchRenderer.makeRenderFunction(e._contentTypeService,e.$results,!1,e.decorateResult.bind(e));e._searcher.search(a,!1,c)},0)}};e.prototype.decorateResult=function(b){for(var c=this,b=f.$$array("a",b),a=0;a<b.length;a++){var e=b[a];e.addEventListener("mouseup",function(a){a.button===0&&!a.ctrlKey&&!a.metaKey&&c.hide()},!1);e.addEventListener("keyup",function(a){a.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/searchAndReplace/textSearcher","i18n!orion/search/nls/messages,require,orion/webui/littlelib,orion/editor/annotations,orion/commands,orion/searchUtils".split(","),function(j,k,i,b){var f=f||{};f.TextSearcher=function(){function f(b,d,c,a){this._editor=b;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(a){g.removeCurrentAnnotation(a)}};this.setOptions(a)}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(a){return e._handleKeyUp(a)};c.onkeydown=
function(a){return e._handleKeyDown(a,!0)};d.appendChild(c);e.createButton("Next",d,function(){e.findNext(!0)});e.createButton("Previous",d,function(){e.findNext(!1)});var a=document.createElement("input");a.type="text";a.name=j["ReplaceWith:"];a.id="localSearchReplaceWith";a.placeholder=j["Replace With"];a.classList.add("searchCmdGroupMargin");a.onkeydown=function(a){return e._handleKeyDown(a,!1)};d.appendChild(a);e.createButton(j.Replace,d,function(){e.replace()});e.createButton(j["Replace All"],
d,function(){e.replaceAll()});a=document.createElement("div");d.appendChild(a);a.classList.add("findOptionsDiv");var f=e._commandService._createDropdownMenu(a,j.Options);f.menuButton.classList.add("findSlideoutMenu");e._commandService._generateCheckedMenuItem(f.menu,j["Show all"],e._showAllOccurrence,function(a){a=a.target.checked;e.setOptions({showAllOccurrence:a});a?e.markAllOccurrences(!0):(a=e._editor.getAnnotationModel())&&a.removeAnnotations(b.AnnotationType.ANNOTATION_MATCHING_SEARCH);f.dropdown.close(!0)});
e._commandService._generateCheckedMenuItem(f.menu,j["Case sensitive"],!e._ignoreCase,function(a){e.setOptions({ignoreCase:!a.target.checked});f.dropdown.close(!0);e.findNext(!0,null,!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Wrap search"],e._wrapSearch,function(a){e.setOptions({wrapSearch:a.target.checked});f.dropdown.close(!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Incremental search"],e._incremental,function(a){e.setOptions({incremental:a.target.checked});f.dropdown.close(!0)});
e._commandService._generateCheckedMenuItem(f.menu,j["Whole Word"],e._wholeWord,function(a){e.setOptions({wholeWord:a.target.checked});f.dropdown.close(!0);e.findNext(!0,null,!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Regular expression"],e._useRegExp,function(a){e.setOptions({useRegExp:a.target.checked});f.dropdown.close(!0);e.findNext(!0,null,!0)});e._commandService._generateCheckedMenuItem(f.menu,j["Find after replace"],e._findAfterReplace,function(a){e.setOptions({findAfterReplace:a.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(b,d){var c=(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&!b.shiftKey;if(c&&b.keyCode===70)return this._keyUpHandled=d,b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,!1;
if((this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&b.keyCode===75||b.keyCode===13)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this.findNext(!b.shiftKey),this._keyUpHandled=d,!1;if(c&&b.keyCode===82)return b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,d||this.replace(),this._keyUpHandled=d,!1;return b.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(b.AnnotationType.ANNOTATION_CURRENT_SEARCH),e.removeAnnotations(b.AnnotationType.ANNOTATION_MATCHING_SEARCH))},removeCurrentAnnotation:function(){var e=this._editor.getAnnotationModel();e&&e.removeAnnotations(b.AnnotationType.ANNOTATION_CURRENT_SEARCH)},createButton:function(b,d,c){var a=document.createElement("span");a.tabIndex=0;a.role="button";a.addEventListener("click",
c.bind(this),!1);var f=this;a.addEventListener("keydown",function(a){a.keyCode===i.KEY.ENTER||a.keyCode===i.KEY.SPACE?c.bind(f)():a.keyCode===i.KEY.ESCAPE&&f.closeUI()});a.appendChild(document.createTextNode(b));a.classList.add("findSlideoutButton");d.appendChild(a)},buildToolBar:function(b,d){this._keyUpHandled=!0;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var c=document.getElementById("localSearchFindWith");if(this.visible())b.length>0?c.value=b:this._noSelection=
!0;else{this._createActionTable();if(typeof d==="string")document.getElementById("localSearchReplaceWith").value=d;c=document.getElementById("localSearchFindWith");c.value=b}window.setTimeout(function(){c.select();c.focus()},10)},setOptions:function(b){if(b){if(b.showAllOccurrence===!0||b.showAllOccurrence===!1)this._showAllOccurrence=b.showAllOccurrence;if(b.ignoreCase===!0||b.ignoreCase===!1)this._ignoreCase=b.ignoreCase;if(b.wrapSearch===!0||b.wrapSearch===!1)this._wrapSearch=b.wrapSearch;if(b.wholeWord===
!0||b.wholeWord===!1)this._wholeWord=b.wholeWord;if(b.incremental===!0||b.incremental===!1)this._incremental=b.incremental;if(b.useRegExp===!0||b.useRegExp===!1)this._useRegExp=b.useRegExp;if(b.findAfterReplace===!0||b.findAfterReplace===!1)this._findAfterReplace=b.findAfterReplace;if(b.reverse===!0||b.reverse===!1)this._reverse=b.reverse;if(b.toolBarId)this._toolBarId=b.toolBarId;if(b.searchRange)this._searchRange=b.searchRange;if(b.searchOnRange===!0||b.searchOnRange===!1)this._searchOnRange=b.searchOnRange}},
getSearchStartIndex:function(b,d){var c=this._editor.getCaretOffset();if(b){var a=this._editor.getSelection(),f=a.end>a.start?a.end-a.start:0;return!d?c-f-1>0?c-f-1:0:a.end>0?a.end:0}return c>0?c:0},findNext:function(b,d,c){this.setOptions({reverse:!b});var a=document.getElementById("localSearchFindWith"),c=this.getSearchStartIndex(c?!0:!b);d||(d=a?a.value:this._lastSearchString);return this._doFind(d,c,!b,this._wrapSearch)},startUndo:function(){this._undoStack&&this._undoStack.startCompoundChange()},
endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_doReplace:function(b,d,c,a){var f=this._editor;if(this._useRegExp){if(c=f.getText().substring(b,d).replace(RegExp(c,this._ignoreCase?"i":""),a))f.setText(c,b,d),f.setSelection(b,b+c.length,!0)}else f.setText(a,b,d),f.setSelection(b,b+a.length,!0)},replace:function(){this.startUndo();var b=document.getElementById("localSearchReplaceWith").value,d=this._editor,c=d.getSelection(),a=document.getElementById("localSearchFindWith").value,
c=c?c.start:0;a&&(d=d.getModel().find({string:a,start:c,reverse:!1,wrap:this._wrapSearch,regex:this._useRegExp,wholeWord:this._wholeWord,caseInsensitive:this._ignoreCase}).next())&&this._doReplace(d.start,d.end,a,b);this.endUndo();this._findAfterReplace&&a&&this._doFind(a,this.getSearchStartIndex(!1),!1,this._wrapSearch)},_doFind:function(e,d,c,a){var f=this._editor,g=f.getAnnotationModel();if(!e)return g&&(g.removeAnnotations(b.AnnotationType.ANNOTATION_CURRENT_SEARCH),g.removeAnnotations(b.AnnotationType.ANNOTATION_MATCHING_SEARCH)),
null;this._lastSearchString=e;var i=f.getModel().find({string:e,start:d,reverse:c,wrap:a,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=b.AnnotationType.ANNOTATION_CURRENT_SEARCH,g&&(g.removeAnnotations(e),i&&g.addAnnotation(b.AnnotationType.createAnnotation(e,i.start,i.end))),this._showAllOccurrence))){this._timer&&window.clearTimeout(this._timer);
var k=this;this._timer=window.setTimeout(function(){k.markAllOccurrences(i);k._timer=null},500)}i&&f.moveSelection(i.start,i.end,null,!1);return i},replaceAll:function(){var b=document.getElementById("localSearchFindWith").value;if(b){this._replacingAll=!0;var d=this._editor;d.reportStatus("");d.reportStatus(j["Replacing all..."],"progress");var c=document.getElementById("localSearchReplaceWith").value,a=this;window.setTimeout(function(){for(var f=0,g=0;;){if(!a._doFind(b,f))break;g++;g===1&&a.startUndo();
f=d.getSelection();a._doReplace(f.start,f.end,b,c);f=a.getSearchStartIndex(!0,!0)}g>0&&a.endUndo();d.reportStatus("","progress");f>0?d.reportStatus(j["Replaced "]+g+j[" matches"]):d.reportStatus(j["Nothing replaced"],"error");a._replacingAll=!1},100)}},markAllOccurrences:function(e){var d=this._editor.getAnnotationModel();if(d){for(var c=b.AnnotationType.ANNOTATION_MATCHING_SEARCH,a=d.getAnnotations(0,d.getTextModel().getCharCount()),f=[],g;a.hasNext();){var i=a.next();i.type===c&&f.push(i)}a=document.getElementById("localSearchFindWith").value;
if(e&&a){a=this._editor.getModel().find({string:a,regex:this._useRegExp,wholeWord:this._wholeWord,caseInsensitive:this._ignoreCase});for(g=[];a.hasNext();)e=a.next(),g.push(b.AnnotationType.createAnnotation(c,e.start,e.end))}d.replaceAnnotations(f,g)}}};return f}();return f});
define("orion/searchModel","i18n!orion/search/nls/messages,require,orion/Deferred,orion/i18nUtil,orion/explorers/explorer,orion/searchUtils".split(","),function(j,k,i,b,f,g){function e(b,c,a,e,f,i){this.registry=b;this.fileClient=c;this._resultLocation=a;this._numberOnPage=a.length;this._totalNumber=e;this._listRoot={isRoot:!0,children:[]};this._indexedFileItems=[];this._location2ModelMap=[];this._lineDelimiter="\n";this.onMatchNumberChanged=i.onMatchNumberChanged;this._searchHelper=g.generateSearchHelper(f)}
e.prototype=new f.ExplorerModel;e.prototype.getRoot=function(b){b(this.getListRoot())};e.prototype.getChildren=function(b,c){b&&(b.children?c(b.children):b.type==="detail"?c([]):b.type==="file"&&b.location?this._searchHelper.params.keyword!==""&&this.registry.getService("orion.page.progress").progress(this.fileClient.read(b.location),"Getting file contents "+b.name).then(function(a){g.searchWithinFile(this._searchHelper.inFileQuery,b,a,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);
if(this.onMatchNumberChanged)this.onMatchNumberChanged(b);c(b.children)}.bind(this),function(a){console.error("Error loading file content: "+a.message);c([])}.bind(this)):c([]))};e.prototype.getId=function(b){b===this.getListRoot()?b=this.rootId:(b=b.location,b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,""));return b};e.prototype.getListRoot=function(){return this._listRoot};e.prototype.buildResultModel=function(){this._restoreGlobalStatus();this._indexedFileItems=[];for(var b=0;b<this._resultLocation.length;b++){var c=
{parent:this.getListRoot(),type:"file",name:this._resultLocation[b].name,lastModified:this._resultLocation[b].lastModified,linkLocation:this._resultLocation[b].linkLocation,location:this._resultLocation[b].location,parentLocation:g.path2FolderName(this._resultLocation[b].location,this._resultLocation[b].name,!0),fullPathName:g.path2FolderName(this._resultLocation[b].path,this._resultLocation[b].name)};this._location2ModelMap[c.location]=c;this.getListRoot().children.push(c);this._indexedFileItems.push(c)}};
e.prototype.replaceMode=function(){return typeof this._searchHelper.params.replace==="string"};e.prototype.getPagingParams=function(){return{totalNumber:this._totalNumber,start:this._searchHelper.params.start,rows:this._searchHelper.params.rows,numberOnPage:this._numberOnPage}};e.prototype.getScopingParams=function(d){var c=g.copySearchParams(this._searchHelper.params,!0);c.resource=d.parentLocation;c.start=0;var c=g.generateSearchHref(c),a=b.formatMessage(j['Search again in this folder with "${0}"'],
this._searchHelper.displayedSearchTerm);return{name:d.fullPathName,href:c,tooltip:a}};e.prototype.getDetailInfo=function(b){return{lineString:b.name,lineNumber:b.lineNumber-1,matches:b.matches,matchNumber:b.matchNumber?b.matchNumber-1:0}};e.prototype.getFileName=function(b){return b.name};e.prototype.provideFileContent=function(b,c){this._provideFileContent(b).then(function(){c(b)})};e.prototype._provideFileContent=function(b){return b.contents?(new i).resolve(b):this.registry.getService("orion.page.progress").progress(this.fileClient.read(b.location),
"Getting file contents "+b.Name).then(function(c){g.searchWithinFile(this._searchHelper.inFileQuery,b,c,this._lineDelimiter,this.replaceMode(),this._searchHelper.params.caseSensitive);return b}.bind(this),function(c){console.error("Error loading file content: "+c.message);return b}.bind(this))};e.prototype.getFileContents=function(b){return b.contents.join(this._lineDelimiter)};e.prototype.getReplacedFileContent=function(b,c,a){g.generateNewContents(c,a.contents,b,a,this._searchHelper.params.replace,
this._searchHelper.inFileQuery.searchStrLength);b.lineDelim=this._lineDelimiter};e.prototype.writeReplacedContents=function(b){var c=[];this.getValidFileList().forEach(function(a){c.push(this._writeOneFile(a,b))}.bind(this));return i.all(c,function(a){return{_error:a}})};e.prototype.getHeaderString=function(){var d=j.Results;if(this._searchHelper.displayedSearchTerm){var c=this.getPagingParams();if(c.numberOnPage>0)var d=c.start+1,a=d+c.numberOnPage-1,d=this.replaceMode()?b.formatMessage(j["Replace ${0} with ${1} for files ${2} of ${3}"],
this._searchHelper.displayedSearchTerm,this._searchHelper.params.replace,d+"-"+a,c.totalNumber):b.formatMessage(j["Files ${0} of ${1} matching ${2}"],d+"-"+a,c.totalNumber,this._searchHelper.displayedSearchTerm)}return d};e.prototype.getValidFileList=function(){return this._indexedFileItems};e.prototype.setValidFileList=function(b){this._indexedFileItems=b};e.prototype.storeLocationStatus=function(b){if(b){var c;c=b?b.type==="file"?b:b.parent:null;if(c)window.sessionStorage[this._searchHelper.params.keyword+
"_search_result_currentFileLocation"]=c.location,window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"]=b.type==="file"?"none":JSON.stringify(this._model2Index(b))}};e.prototype.restoreLocationStatus=function(){var b=this._location2Model(window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentFileLocation"]),c="none",a=window.sessionStorage[this._searchHelper.params.keyword+"_search_result_currentDetailIndex"];typeof a==="string"&&a.length>
0&&(c=a);return{file:b,detail:c}};e.prototype.staleCheck=function(b){b=b.toLowerCase();return this._searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this._searchHelper.inFileQuery,b,!0):g.searchOnelineLiteral(this._searchHelper.inFileQuery,b,!0)};e.prototype._provideSearchHelper=function(){return this._searchHelper};e.prototype._model2Index=function(b,c){var a=c;if(!a&&b.parent)a=b.parent.children;if(a)for(var e=0;e<a.length;e++)if(a[e]===b)return e;return-1};e.prototype._location2Model=function(b){return b&&
this._location2ModelMap[b]?this._location2ModelMap[b]:this._indexedFileItems.length>0?this._indexedFileItems[0]:null};e.prototype._restoreGlobalStatus=function(){this.defaultReplaceStr=this._searchHelper.displayedSearchTerm;var b=window.sessionStorage.global_search_default_replace_string;if(typeof b==="string"&&b.length>0)this.defaultReplaceStr=b;this.sortByName=this._provideSearchHelper().params.sort.indexOf("Name")>-1};e.prototype._storeGlobalStatus=function(b){window.sessionStorage.global_search_default_replace_string=
b};e.prototype._writeOneFile=function(b,c){var a=this._matchesReplaced(b);return a>0?this._provideFileContent(b).then(function(){a=this._matchesReplaced(b);var e={};g.generateNewContents(!1,b.contents,e,b,this._searchHelper.params.replace,this._searchHelper.inFileQuery.searchStrLength);var e=e.contents.join(this._lineDelimiter),f=b.ETag,f=f?{ETag:f}:null;return this.registry.getService("orion.page.progress").progress(this.fileClient.write(b.location,e,f),"Saving changes to "+b.location).then(function(){c.push({model:b,
matchesReplaced:a,status:"pass"})}.bind(this),function(e){e.status===412?c.push({model:b,message:j["Resource has been changed by others."],matchesReplaced:a,status:"failed"}):(e.log=!0,c.push({model:b,message:j["Failed to write file."],matchesReplaced:a,status:"failed"}))}.bind(this))}.bind(this)):(new i).resolve(b)};e.prototype._matchesReplaced=function(b){var c=0;if(!b.children)return b.checked===!1?0:1;if(b.children)for(var a=0;a<b.children.length;a++)b.children[a].checked!==!1&&(c+=1);return c};
e.prototype.constructor=e;return{SearchResultModel:e}});
define("orion/globalSearch/advSearchOptContainer",["i18n!orion/globalSearch/nls/messages","require","orion/searchUtils","orion/contentTypes","orion/i18nUtil"],function(j,k,i,b,f){function g(b,c,a,f){this._inputField=b;if(typeof this._inputField==="string")this._inputField=document.getElementById(this._inputField);(b=f?f.group:null)||(b=this._inputField.id?this._inputField.id:"default__dropDown__group");this._idPrefix=b+"__dropDown__";this.containerId=this._idPrefix+"UIContainer";this._dismissed=!0;
var g=this;this._optRenderer=new e(c,a,function(){g.dismiss();g._inputField.focus()});this._initUI()}function e(b,c,a){this._searcher=b;this._serviceRegistry=c;this._cancelCallBack=a}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(b){for(var c=0,a=0,e=this._inputField;e;)c+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;this._optUIContainer.style.display="block";this._optUIContainer.style.top=a+this._inputField.offsetHeight+2+"px";this._optUIContainer.style.left=c+"px";this._optUIContainer.style.width=this._inputField.offsetWidth+"px";this._optRenderer._searchBox.value=
b;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 a=this._serviceRegistry.getService("orion.core.contenttypes");if(a){var e=this;a.getContentTypes().then(function(a){e.contentTypesCache=a;e._render(c)})}else a=new b.ContentTypeService(this._serviceRegistry),this.contentTypesCache=a.getContentTypes(),this._render(c)};e.prototype._render=function(b){b?this._renderHTML(b):this._renderRaw()};e.prototype._submitSearch=function(){var b=this.getOptions();i.doSearch(this._searcher,this._serviceRegistry,b.searchStr,
b)};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 b=[{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 a=0;a<this.contentTypesCache[c].extension.length;a++)b.push({label:this.contentTypesCache[c].extension[a],value:this.contentTypesCache[c].extension[a]});for(c=0;c<b.length;c++){var a=document.createElement("option"),e=document.createTextNode(b[c].label);a.appendChild(e);this._fileTypes.appendChild(a);a.value=b[c].value}var g=this;this._searchBox.addEventListener("keydown",function(a){a=a.charCode||a.keyCode;a===13&&g._submitSearch();a===27&&g._cancelCallBack&&g._cancelCallBack()});
this._fileTypes.addEventListener("change",function(){var a=g._fileTypes.options[g._fileTypes.selectedIndex].value;g._searchBox.placeholder=a===i.ALL_FILE_TYPE?j["Type a search term"]:f.formatMessage(j["All ${0} files"],a)});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(b){var c=this,a=new XMLHttpRequest;a.open("GET",k.toUrl(b),!0);a.onreadystatechange=function(){if(this.readyState===
4&&this.status===200)c._parentDiv.innerHTML=this.responseText,c._initHTMLLabels(),c._initControls()};a.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/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,
k,i,b,f,g,e,d,c,a,h,l,n,q,p,m,t,o,w,s,x,u,A,z,r,D,E,y){function v(a,b){if(a.getLabel)return a.getLabel();else{var c=new u;c.resolve(b.properties.name);return c}}function F(b){a.node("progressPane").setAttribute("aria-label",j["Operations - Press spacebar to show current operations"]);(b=b.getService("orion.page.progress"))&&b.init.bind(b)("progressPane")}function C(a,b){var c=a.getService("orion.core.auth");c!==null&&c.getUser().then(function(a){var c;a.Name?c=document.createTextNode(a.Name):a.login&&
(c=document.createTextNode(a.login));c&&(b.childNodes.length>0?b.childNodes[0].nodeType===3?b.replaceChild(c,b.childNodes[0]):b.insertBefore(c,b.childNodes[0]):b.appendChild(c))})}function G(b,c){var d=b.getServiceReferences("orion.core.auth");R=[];if(a.node("userMenu")){var e=a.node("userDropdown"),f=new l.Dropdown({dropdown:e}),g=new A.UserMenu({dropdownNode:e,dropdown:f,serviceRegistry:b}),e=a.node("userTrigger");new n.Tooltip({node:e,text:j.Options,position:["below","left"]});C(b,e);g.setKeyAssist(c);
for(e=0;e<d.length;e++){var f=d[e],h=b.getService(f);v(h,f).then(function(a){h.getKey().then(function(b){R.push(b);h.getUser().then(function(c){g.addUserItem(b,h,a,c)},function(c,d){g.addUserItem(b,h,a,d)});window.addEventListener("storage",function(){N[b]!==localStorage.getItem(b)&&(N[b]=localStorage.getItem(b),h.getUser().then(function(c){g.addUserItem(b,h,a,c)},function(){g.addUserItem(b,h,a)}))},!1)})})}}}function H(b){var c=document.createElement("span");c.id="advancedSearchDropDown";a.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(){b.toggle()};c.addEventListener("keydown",function(a){(a.charCode||a.keyCode)===13&&b.toggle()});c.classList.add("bannerMenuSearchOptions")}function B(b,c){var d=a.node("relatedDropdown");K||(K=new l.Dropdown({dropdown:d}));b._addMenuItem(d,c)}function I(c,d,e,f,h){var i,j=c.getServiceReferences("orion.page.link.related");j.length<=0||a.node("relatedLinks")&&
u.when(function(){if(i)return i;var a=c.getService("orion.core.contenttypes");a||(a=new p.ContentTypeService(c),a=c.getService("orion.core.contenttypes"));return a.getContentTypes().then(function(a){return i=a})}(),function(){var k;a.node("relatedLinks")&&K&&(K.close(),K.empty());for(var l=[],v=0;v<j.length;v++){var m={},r,n=j[v].getPropertyKeys();for(r=0;r<n.length;r++)m[n[r]]=j[v].getProperty(n[r]);if(m.id){var F=function(a){if(a)if(!a.visibleWhen||a.visibleWhen(d)){var c=new b.CommandInvocation(f,
d,d,null,a);B(a,c)}else typeof h==="function"&&(k||(k=h()),u.when(k,function(c){c&&d===S&&(!a.visibleWhen||a.visibleWhen(c))&&B(a,new b.CommandInvocation(f,c,c,null,a))}))},o=null;r=null;if(e.indexOf(m.id)<0)if((m.nls&&m.nameKey||m.name)&&m.uriTemplate)r=g._createCommandOptions(m,j[v],c,i,!0),l.push(r),r.then(function(a){a=new b.Command(a);F(a)});else{if(!o&&(o=f.findCommand(m.id))){F(o);continue}if(!o){var C=c.getServiceReferences("orion.navigate.command");for(r=0;r<C.length;r++)if(C[r].getProperty("id")===
m.id){for(var m={},n=C[r].getPropertyKeys(),q=0;q<n.length;q++)m[n[q]]=C[r].getProperty(n[q]);r=g._createCommandOptions(m,C[r],c,i,!0);l.push(r);r.then(function(a){o=new b.Command(a);F(o)});break}}}}}u.all(l,function(a){return a}).then(function(){var b=a.node("relatedTrigger");if(K&&b)b.style.visibility=K.getItems().length===0?"hidden":"visible"})})}function L(b){var c=a.node("globalActions");c&&(b.destroy(c),b.renderCommands(c.id,c,{},{},"tool"))}function P(a){a.getPreferences("/themes",2).then(function(a){var b=
a.get("selected");if(b&&(b=JSON.parse(b),a=a.get("styles"))){var a=JSON.parse(a),c;for(c in a)if(a[c].name===b.selected){c=a[c];c=(new o.ThemeSheetWriter).getSheet(c);b=document.createElement("STYLE");b.appendChild(document.createTextNode(c));(document.getElementsByTagName("HEAD")[0]||document.documentElement).appendChild(b);break}}})}function M(b){var c={},d=null;typeof b==="string"&&(b=a.node(b));b||(b=a.node("pageActions"));for(var e=b;e&&e.classList;){if(e.classList.contains("toolComposite")){d=
e;break}e=e.parentNode}if(b.classList.contains("commandMarker"))c.commandNode=b;if(d&&(c.slideContainer=a.$(".slideParameters",d),c.parameterArea=a.$(".parameters",d),c.dismissArea=a.$(".parametersDismiss",d),c.notifications=a.$("#notificationArea",d),d.parentNode&&(c.toolbarTarget=a.$(".toolbarTarget",d.parentNode),c.toolbarTarget)))b=a.bounds(d),c.toolbarTargetY=b.height+1;return c}function Q(b){if(b.toolbarTarget&&b.toolbarTargetY){var c=0,d;b.notifications&&b.notifications.classList.contains("slideContainerActive")&&
(d=a.bounds(b.notifications),c+=d.height);b.slideContainer&&b.slideContainer.classList.contains("slideContainerActive")&&(d=a.bounds(b.slideContainer),c+=d.height);c>0&&(c+=8);b.toolbarTarget.style.top=b.toolbarTargetY+c+"px";b.toolbarTarget.style.bottom=0}}var m=function(a){var b=document.createElement("a");b.href=a;return b.href}(k.toUrl("auth/NotifyAuthentication.html")),N={},R=[],K,S,T=[],J,O=null;return{addSettings:function(b){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),a.addAutoDismiss([d,c,f],function(){d.className="core-sprite-settings";c.style.backgroundColor="white";f.style.visibility="hidden";e=!1}));a.empty(f);b.appendTo(f)}}},generateBanner:function(c,g,l,v,m,o,C,p){function t(b){b.registerService("orion.cm.managedservice",
{updated:function(b){for(var b=b&&b["links.newtab"]!=="undefined"?b["links.newtab"]?"_blank":"_self":"_self",c=a.$$array(".targetSelector"),d=0;d<c.length;d++)c[d].target=b}},{pid:"nav.config"})}P(v);v=a.node(c);if(!v)throw j["could not find banner parent, id was "]+c;c=document.createRange();c.selectNode(v);c=c.createContextualFragment(D);a.processTextNodes(c,j);v.firstChild?v.insertBefore(c,v.firstChild):v.appendChild(c);c=a.node("home");c.href=k.toUrl("navigate/table.html");c.setAttribute("aria-label",
j["Orion Home"]);a.node("progressPane").src=k.toUrl("images/none.png");if(c=a.node("pageToolbar"))c.classList.add("toolbarLayout"),c.innerHTML=y+i.slideoutHTMLFragment("mainToolbar");(c=a.node("closeNotifications"))&&c.setAttribute("aria-label",j["Close notification"]);if(c=a.node("footer"))c.innerHTML=E,a.processTextNodes(c,j);l.setParameterCollector(new f.CommandParameterCollector(M,Q));var B=document.createElement("div");B.id="keyAssist";B.style.display="none";B.classList.add("keyAssistFloat");
B.role="list";B.setAttribute("aria-atomic","true");B.setAttribute("aria-live","assertive");document.body.appendChild(B);document.addEventListener("keydown",function(b){if(b.charOrCode===a.KEY.ESCAPE)B.style.display="none"},!1);a.addAutoDismiss([B],function(){B.style.display="none"});var A=a.node("primaryNav");A&&z.createPageLinks(g,"orion.page.link").then(function(a){a.forEach(function(a){A.appendChild(a)})});var I=a.node("search");if(!I)throw"failed to generate HTML for banner";I.setAttribute("placeholder",
j.Search);new n.Tooltip({node:I,text:j["Type a keyword or wild card to search in root"],position:["below","left"]});var N=new x.advSearchOptContainer(I,m,g,{group:"advancedSearch"});new s.InputCompletion(I,function(a){w.getMixedSearches(g,!0,!1,function(b){var c,d=[],e=!1,f=!1;for(c in b)b[c].label&&b[c].value?(e||(d.push({type:"category",label:j["Saved searches"]}),e=!0),d.push({type:"proposal",value:{name:b[c].label,value:k.toUrl("search/search.html")+"#"+b[c].value,type:"link"}})):(f||(d.push({type:"category",
label:j["Recent searches"]}),f=!0),d.push({type:"proposal",label:b[c].name,value:b[c].name}));a(d)})},{group:"globalSearch",extendedProvider:function(a,b){var c=g.getServiceReferences("orion.search.proposal");if(!c||c.length===0)b(null);else{var d=[];c.forEach(function(b){var c=b.getProperty("filterForMe");d.push(g.getService(b).run(a).then(function(a){for(var b={filterForMe:c,proposals:[]},d=0;d<a.length;d++){b.proposals.push({type:"category",label:a[d].category});for(var e=0;e<a[d].datalist.length;e++)b.proposals.push({type:"proposal",
label:a[d].datalist[e],value:a[d].datalist[e]})}return b}))});u.all(d).then(function(a){b(a)})}}});I.addEventListener("keydown",function(a){a.defaultPrevented||(a.charCode||a.keyCode)===13&&w.doSearch(m,g,I.value)});H(N);a.addAutoDismiss([a.node(N.containerId),a.node("advancedSearchDropDown")],function(){N.dismiss()});if(c=a.$(".split")){var v=a.$(".sidePanelLayout"),K=a.$(".mainPanelLayout");if(v&&K)O={side:v,main:K},O.splitter=new h.Splitter({node:c,sidePanel:v,mainPanel:K,toggle:!0}),c=new b.Command({name:j["Toggle side panel"],
tooltip:j["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){O.splitter.toggleSidePanel()}}),l.addCommand(c),l.registerCommandContribution("pageActions","orion.toggleSidePane",1,null,!0,new b.CommandKeyBinding("o",!0)),C&&(O.splitter.addResizeListener(function(a){C&&a===K&&C.getTextView().resize()}),C.getTextView().setKeyBinding(new d.KeyBinding("o",!0),"toggleOutliner"),C.getTextView().setAction("toggleOutliner",function(){O.splitter.toggleSidePanel();return!0},{name:j["Toggle Outliner"]}))}c=
new b.Command({name:j["Make Favorite"],tooltip:j["Add to the favorites list"],imageClass:"core-sprite-makeFavorite",id:"orion.makeFavorite",visibleWhen:function(a){a=Array.isArray(a)?a:[a];if(a.length===0)return!1;for(var b=0;b<a.length;b++)if(!a[b].Location)return!1;return!0},callback:function(a){for(var a=Array.isArray(a.items)?a.items:[a.items],b=g.getService("orion.core.favorite"),c=g.getService("orion.page.progress"),d=function(a){return function(d){d?g.getService("orion.page.message").setMessage(a.Name+
j[" is already a favorite."],2E3):c.progress(b.makeFavorites(a),"Making favorite "+a.Name)}},e=0;e<a.length;e++){var f=a[e];c.progress(b.hasFavorite(f.ChildrenLocation||f.Location),"Checking favorite "+f.Name).then(d(f))}}});l.addCommand(c);var J=function(a,b,c){var d=b.getService("orion.core.favorite"),e=b.getService("orion.page.progress");d||(d=new q.FavoritesService({serviceRegistry:b}),d=b.getService("orion.core.favorite"));var f=new r.OpenResourceDialog({searcher:a,progress:e,searchRenderer:a.defaultRenderer,
favoriteService:d,onHide:function(){c&&c.getTextView().focus()}});window.setTimeout(function(){f.show()},0)},c=new b.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(m,g,C)}});C&&(C.getTextView().setKeyBinding(new d.KeyBinding("f",!0,!0,!1),c.id),C.getTextView().setAction(c.id,function(){J(m,g,C);return!0},c));l.addCommand(c);l.registerCommandContribution("globalActions","eclipse.openResource",100,null,
!0,new b.CommandKeyBinding("f",!0,!0));c=new b.Command({name:j["Global search"],tooltip:j["Global search"],id:"eclipse.globalSearch",callback:function(){var b=a.node("search");b&&b.focus()}});C&&(C.getTextView().setKeyBinding(new d.KeyBinding("h",!0,!1,!0),c.id),C.getTextView().setAction(c.id,function(){var b=C.getSelection(),c=null;b.end>b.start&&(c=C.getModel().getText(b.start,b.end));if(b=a.node("search")){if(c)b.value=c;b.focus()}return!0},c));l.addCommand(c);l.registerCommandContribution("globalActions",
"eclipse.globalSearch",101,null,!0,new b.CommandKeyBinding("h",!0,!1,!0));c=new b.Command({name:j["Toggle banner and footer"],tooltip:j["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var b=a.node("banner"),c=a.node("footer"),d=a.$(".content-fixedHeight");b.style.display==="none"?(b.style.display="block",c.style.display="block",d.classList.remove("content-fixedHeight-maximized")):(b.style.display="none",c.style.display="none",d.classList.add("content-fixedHeight-maximized"));
C&&C.getTextView().resize();return!0}});l.addCommand(c);l.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new b.CommandKeyBinding("m",!0,!0));C&&(C.getTextView().setKeyBinding(new b.CommandKeyBinding("m",!0,!0),c.id),C.getTextView().setAction(c.id,c.callback,c));p&&p.addHandler({isActive:function(){return B.style.display==="block"},cancel:function(){return this.isActive()?(B.style.display="none",!0):!1}});p=new b.Command({name:j["System Configuration Details"],tooltip:j["System Config Tooltip"],
id:"orion.configDetailsPage",hrefCallback:function(){return k.toUrl("help/about.html")}});l.addCommand(p);l.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new b.CommandKeyBinding(112,!0,!0));p=new b.Command({name:j["Background Operations"],tooltip:j["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return k.toUrl("operations/list.html")}});l.addCommand(p);l.registerCommandContribution("globalActions","orion.backgroundOperations",
100,null,!0,new b.CommandKeyBinding("o",!0,!0));p=new b.Command({name:j["Show Keys"],tooltip:j["Show a list of all the keybindings on this page"],id:"eclipse.keyAssist",callback:function(){if(B.style.display==="none"){var b;a.empty(B);if(C){b=document.createElement("h2");b.appendChild(document.createTextNode(j.Editor));B.appendChild(b);b=C.getTextView().getActions(!1);for(var c=0;c<b.length;c++){var d=b[c],f=d,g=C.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"));B.appendChild(i)}}}b=document.createElement("h2");b.appendChild(document.createTextNode(j.Global));B.appendChild(b);l.showKeyBindings(B);B.style.display="block"}else B.style.display="none";return!0}});l.addCommand(p);l.registerCommandContribution("globalActions","eclipse.keyAssist",100,null,!0,new b.CommandKeyBinding(191,
!1,!0));C&&(c=window.navigator.platform.indexOf("Mac")!==-1,C.getTextView().setKeyBinding(new b.CommandKeyBinding(191,!1,!0,!c,c),p.id),C.getTextView().setAction(p.id,p.callback,p));L(l);G(g,p.callback);F(g);window.addEventListener("hashchange",function(){l.processURL(window.location.href)},!1);window.setTimeout(function(){t(g)},0)},getToolbarElements:M,getMainSplitter:function(){return O},layoutToolbarElements:Q,setPageTarget:function(b){var d,e,f=b.breadcrumbRootName;b.target?(b.searchService&&
b.searchService.setLocationByMetaData(b.target),b.fileService&&!b.breadcrumbTarget&&(e=f?f+" ":"",e+=b.fileService.fileServiceName(b.target.Location),f=null),d=b.name||b.target.Name,S=b.target,I(b.serviceRegistry,b.target,T,b.commandService,b.makeAlternate)):(b.breadcrumbTarget||(f=f||b.task||b.name),d=b.name);(J=b.title)||(J=d?d+" - "+b.task:b.task);window.document.title=J;a.empty(a.node("location"));new c.BreadCrumbs({container:"location",resource:b.breadcrumbTarget||b.target,rootSegmentName:f,
workspaceRootSegmentName:e,makeHref:b.makeBreadcrumbLink})},setDirtyIndicator:function(b){if(J)J.charAt(0)==="*"&&!b&&(J=J.substring(1)),b&&J.charAt(0)!=="*"&&(J="*"+J),window.document.title=J;var c=a.node("dirty");if(c)c.textContent=b?"*":""},setPageCommandExclusions:function(a){T=a},notifyAuthenticationSite:m}});
define("orion/status",["require","orion/webui/littlelib","orion/globalCommands"],function(j,k,i){function b(b,e,d,c,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.message",this);this._operationsClient=e;this.notificationContainerDomId=a;this.domId=d;this.progressDomId=c||d;this._hookedClose=!1}function f(b,e,d,c){this.statusService=b;this.progressId=e;if(d){this.deferred=d;this.begin(c);var a=this;d.then(function(){a.done.bind(a)()},function(){a.done.bind(a)()})}}
b.prototype={_init:function(){var b=k.node("closeNotifications"),e=this;b&&!this._hookedClose&&(b.addEventListener("click",function(){e.setProgressMessage("")},!1),b.addEventListener("keydown",function(b){(b.keyCode===k.KEY.ENTER||b.keyCode===k.KEY.SPACE)&&e.setProgressMessage("")},!1))},_getNotifierElements:function(){if(!this._notifierElements)this._notifierElements=i.getToolbarElements(this.notificationContainerDomId);return this._notifierElements},setMessage:function(b,e,d){this._init();this.currentMessage=
b;var c=k.node(this.domId);if(typeof d==="boolean"){var a=this,f=c.getAttribute("aria-live");c.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){b===a.currentMessage&&(k.empty(c),c.appendChild(document.createTextNode(b)),window.setTimeout(function(){c.setAttribute("aria-live",f)},100))},100)}else k.empty(c),c.appendChild(document.createTextNode(b));typeof e==="number"&&(a=this,window.setTimeout(function(){b===a.currentMessage&&(k.empty(c),c.appendChild(document.createTextNode("")))},
e))},setErrorMessage:function(b){this.currentMessage=b;this._init();var e=b.responseText||b.message||b;try{e=JSON.parse(e)}catch(d){}var b=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(b));b=k.node(this.domId);k.empty(b);b.appendChild(e)},setProgressMessage:function(b){this._init();this.currentMessage=b;var e=document.createElement("span");
e.classList.add("imageSprite");e.classList.add("core-sprite-progress");var d=k.node(this.progressDomId);k.empty(d);d.appendChild(e);d.appendChild(document.createTextNode(b));e=k.node(this.notificationContainerDomId);e.classList.add("progressNormal");if(b&&b.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(b){this.currentMessage=b;var e=b.responseText||b;try{e=JSON.parse(e)}catch(d){}this._init();var c=e.Message||e,a="core-sprite-info",f="progressInfo",j=document.createElement("span");j.classList.add("imageSprite");b=[];if(e.Severity)switch(e.Severity){case "Warning":a="core-sprite-warning";f="progressWarning";b.push("progressInfo");b.push("progressError");b.push("progressNormal");break;case "Error":a="core-sprite-error";f="progressError";b.push("progressWarning");b.push("progressInfo");
b.push("progressNormal");break;default:b.push("progressWarning"),b.push("progressError"),b.push("progressNormal")}j.classList.add(a);var n=k.node(this.progressDomId),a=k.node(this.notificationContainerDomId);k.empty(n);n.appendChild(j);e.HTML?(e=document.createElement("span"),e.innerHTML=c,n.appendChild(e)):n.appendChild(document.createTextNode("   "+c));if(f&&this.progressDomId!==this.domId){a.classList.add(f);for(c=0;c<b.length;c++)a.classList.remove(b[c])}a.classList.add("slideContainerActive");
i.layoutToolbarElements(this._getNotifierElements())},showWhile:function(b,e){var d=this;if(e){d.setProgressMessage(e);var c=function(){e===d.currentMessage&&d.setProgressMessage("")};b.then(c,c)}return b},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(b,e){return new f(this,++this._lastProgressId,b,e)},_renderOngoingMonitors:function(){if(this._progressMonitors.length>0){var b="",e=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(e||(b+=", "),
b+=this._progressMonitors[d].status,e=!1);this.setProgressMessage(b)}else this.setProgressMessage("")},_beginProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._renderOngoingMonitors()},_doneProgressMonitor:function(b){delete this._progressMonitors[b.progressId];this._progressMonitors.length--;b.status?this.setProgressResult(b.status):this._renderOngoingMonitors()}};
b.prototype.constructor=b;f.prototype.begin=function(b){this.status=b;this.statusService._beginProgressMonitor(this)};f.prototype.done=function(b){this.status=b;this.statusService._doneProgressMonitor(this)};f.prototype.worked=function(b){this.status=b;this.statusService._workedProgressMonitor(this)};f.prototype.constructor=f;return{StatusReportingService:b,ProgressMonitor:f}});
define("orion/globalSearch/search-features",["orion/webui/littlelib","orion/webui/splitter","orion/globalCommands","text!orion/globalSearch/search-features.html"],function(j,k,i,b){var f=f||{};f.SearchUIFactory=function(){function f(b){this._parentDivID=b.parentDivID}f.prototype={buildUI:function(){var e=j.node(this._parentDivID);e.innerHTML=b;var d=j.$("#replaceTop",e),c=j.$("#replaceBottom",e),e=j.$(".replaceSplitLayout",e);e.id="replaceSplitter";var a=new k.Splitter({node:e,sidePanel:d,mainPanel:c,
vertical:!0});window.setTimeout(function(){a._adjustToSplitPosition(!0)},100);a.addResizeListener(function(a){a===c&&this._compareWidget&&this._compareWidget.resizeEditors&&this._compareWidget.resizeEditors()}.bind(this));var f=i.getMainSplitter();f&&f.splitter&&f.splitter.addResizeListener(function(a){a===f.main&&this._compareWidget&&this._compareWidget.getSplitter()&&this._compareWidget.getSplitter()._adjustToSplitPosition(!0)}.bind(this))},destroy:function(){},setCompareWidget:function(b){this._compareWidget=
b},getMatchDivID:function(){return"replaceTop"},getCompareDivID:function(){return"replaceBottom"}};return f}();return 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,k,i,b,f,g,e,d,c,a,h,l,n){var e={},q=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(q)return q;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 q=a})}function o(b){var c=new a.KeyBinding;a.KeyBinding.apply(c,b);return c}function p(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 a.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,k.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,k.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()},p)):p(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 x=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())]}),x=new g.Command({name:j["Go to Line"],tooltip:j["Go to specified line number"],id:"orion.gotoLine",parameters:x,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(x);this.commandService.registerCommandContribution(this.pageNavId,"orion.gotoLine",1,null,!0,new g.CommandKeyBinding("l",!0),new g.URLBinding("gotoLine","line"));e.getTextView().setKeyBinding(new a.KeyBinding("l",!0),"gotoLine");e.getTextView().setAction("gotoLine",function(){s.commandService.runCommand("orion.gotoLine");
return!0},x);var x=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)]}),u=this,x=new g.Command({name:j.Find,tooltip:j.Find,id:"orion.editor.find",parameters:x,callback:function(a){if(u._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=n.matchResourceParameters(),l.convertFindURLBinding(c));c?(u._searcher.setOptions({useRegExp:c.regEx,ignoreCase:!c.caseSensitive}),c.atLine?(a=e.getModel().getLineStart(c.atLine-1),e.moveSelection(a,a,function(){u._searcher.buildToolBar(b,c.replaceWith);u._searcher.findNext(!0)},focus)):(u._searcher.buildToolBar(b,c.replaceWith),u._searcher.findNext(!0))):u._searcher.buildToolBar(b);return!0}return!1}});this.commandService.addCommand(x);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 a.KeyBinding("f",!0),"find");e.getTextView().setAction("find",function(){s.commandService.runCommand("orion.editor.find");return!0},x);var A=this.serviceRegistry.getServiceReferences("orion.edit.command"),z=this.inputManager,r=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())};r.progress(b.run(d.getText(c.start,c.end),g,c,z.getInput()),k.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)};b.when(h(this.serviceRegistry),function(){var a=[],c=100;A.forEach(function(b){for(var f=s.serviceRegistry.getService(b),g={},h=b.getPropertyKeys(),i=0;i<h.length;i++)g[h[i]]=b.getProperty(h[i]);g.forceSingleItem=!0;b=d._createCommandOptions(g,b,s.serviceRegistry,q,!1,function(){return z.getFileMetadata()});a.push(b);b.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(o(g.key),a.id);b.setAction(a.id,a.callback,a)}});c++});b.all(a,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,
k,i,b,f,g,e,d,c,a,h,l,n,q,p,m,t,o,w,s,x,u){var A={};A.DefaultDiffProvider=function(){function a(b){this.serviceRegistry=b;this._diffProvider=new t.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}();A.CompareStyler=function(){function a(b){this._syntaxHighlither=new w.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}();A.CompareContainer=function(){function a(){this._diffParser=
new f.DiffParser}a.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 l.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 l.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 l.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 l.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 l.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 l.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 l.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 l.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 l.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 l.CommandKeyBinding("l",!0,!0));this.options.readonly||this._commandService.registerCommandContribution(a,"orion.compare.copyToLeft",109,null,!1,new l.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 l.CommandKeyBinding(40,!0));this._commandService.registerCommandContribution(a,"orion.compare.prevDiff",113,null,!1,new l.CommandKeyBinding(38,!0));this.options.wordLevelNav?(this._commandService.registerCommandContribution(a,"orion.compare.nextChange",114,null,!1,new l.CommandKeyBinding(40,!0,!0)),this._commandService.registerCommandContribution(a,"orion.compare.prevChange",115,null,!1,new l.CommandKeyBinding(38,!0,!0))):(this._commandService.registerCommandContribution(a,
"orion.compare.nextChange",114,null,!0,new l.CommandKeyBinding(40,!0,!0)),this._commandService.registerCommandContribution(a,"orion.compare.prevChange",115,null,!0,new l.CommandKeyBinding(38,!0,!0)))}},getCommandSpanId:function(){var a=this.options.commandSpanId;!a&&this.getDefaultCommandSpanId&&(a=this.getDefaultCommandSpanId());return a},renderCommands:function(){var a=this.getCommandSpanId();a&&(b.empty(b.node(a)),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(a,a,this,this,"tool",null,this.options.gridRenderer.navGridHolder)):(this._commandService.renderCommands(a,a,this,this,"tool",null,this.options.gridRenderer.navGridHolder),this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder)):
this._commandService.renderCommands(a,a,this,this,"tool",null,this.options.gridRenderer.navGridHolder)):this._commandService.renderCommands(a,a,this,this,"tool",null))},generateLink:function(){var a=this.getCurrentDiffPos(),a=m.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 m.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 o.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 a}();A.TwoWayCompareContainer=function(){function e(a,c,d,f){this._diffNavigator=new s.DiffTreeNavigator("word");this._registry=a;this._commandService=this._registry.getService("orion.page.command");
this._fileClient=new u.FileClient(a);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 p.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&&b.empty(k);var l=this._uiFactory.getTitleDiv(!1);l&&b.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(b,c){var d;if(c)d=c.Name;h.setPageTarget({task:j.Compare,name:d,target:c,serviceRegistry:a,commandService:this._commandService,searchService:this._searchService,fileService:this._fileClient});b.charAt(0)==="*"?(h.setDirtyIndicator(!0),b.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 A.CompareStyler(this._registry));this._highlighter.push(new A.CompareStyler(this._registry));this.initEditorContainers("\n",j["fetching..."],j["fetching..."],[])}e.prototype=new A.CompareContainer;e.prototype.initEditorContainers=function(a,c,d,e,f){this._leftEditor=this.createEditorContainer(c,
a,e,0,this._leftEditorDiv,this._uiFactory.getStatusDiv(!0),this.options.readonly,f,this.options.newFile);if(this.options.onPage&&(c=b.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,a,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(b,
e,f,g,h,i,k,l,m){var o=this,p=new n.TextModel(b,e),s="",b=k?new a.UndoFactory:new d.UndoCommandFactory(o._registry,o._commandService,"pageActions"),e=new a.AnnotationFactory,t=new c.Editor({textViewFactory:function(){var a=new q.TextView({parent:h,model:p,readonly:k,tabSize:4});o._viewLoadedCounter++;o._viewLoadedCounter===2&&o._diffNavigator.matchPositionFromOverview(-1);if(o.onLoad)o.onLoad();var b=o.getSplitter();if(b){var c=g===0;b.addResizeListener(function(b){if(b){var d=!1;(d=o._uiFactory.isLeftPane(b)?
c:!c)&&a.resize()}})}return a},undoStackFactory:b,annotationFactory:e,keyBindingFactory:function(b,c,e,f){if(k)o._commandService.addCommandGroup("pageActions","orion.editorActions.unlabeled",200);else{var g=new x.TextSearcher(b,o._commandService,e);(new d.EditorCommandFactory(o._registry,o._commandService,o._fileClient,o._inputManager,"pageActions",k,"pageNavigationActions",g)).generateEditorCommands(b);g=new a.TextActions(b,e);c.push(g);b=new a.SourceCodeActions(b,e,f);c.push(b)}},statusReporter:function(a,
b){if(i)s=b?j["ERROR: "]+a:a,i.textContent=""+s},domNode:h});t.installTextView();t.setOverviewRulerVisible(!1);if(!k){var u=this._inputManager;t.addEventListener("DirtyChanged",function(){u.setDirty(t.isDirty())})}var w=t.getTextView();l&&m&&typeof m.Name==="string"&&typeof m.Type==="string"&&(t.setInput(m.Name),this._highlighter[g].highlight(m.Name,m.Type,t));w.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!o._diffNavigator.autoSelecting&&o._diffNavigator.editorWrapper[0].diffFeeder&&
(a=w.getCaretOffset(),o._diffNavigator.gotoDiff(a,w))});g===0?(w.getModel().addEventListener("Changed",function(a){o._curveRuler.onChanged(a)}),w.addEventListener("Scroll",function(){o._curveRuler&&(o._curveRuler.matchPositionFrom(!0),o._curveRuler.render());if(o.onScroll)o.onScroll()})):w.addEventListener("Scroll",function(){o._curveRuler&&o._curveRuler.render()});return t};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}();A.InlineCompareContainer=function(){function d(a,c,e){this._diffNavigator=new s.DiffTreeNavigator("word");this._registry=
a;this._commandService=this._registry.getService("orion.page.command");this._fileClient=new u.FileClient(a);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 a=b.node("fileNameInViewer");if(a)b.empty(a),a.appendChild(document.createTextNode(f._diffTitle)),a.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 A.CompareStyler(this._registry));this._editorDivId=c;this.initEditorContainers("","\n",[],[]);this.hasContent=!1}d.prototype=new A.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=b.node(this._editorDivId),l=this,m=new n.TextModel(d,e),d=new a.UndoFactory,e=new a.AnnotationFactory,d=new c.Editor({textViewFactory:function(){return new q.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 o=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)});o.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!l._diffNavigator.autoSelecting&&l._diffNavigator.editorWrapper[0].diffFeeder&&(a=o.getCaretOffset(),l._diffNavigator.gotoDiff(a,o))});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),m.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}();A.toggleableCompareContainer=function(){function a(b,c,d,e){if(e)e.toggler=this;d==="inline"?(this.widgetType="inline",this._widget=new A.InlineCompareContainer(b,c,e)):(this.widgetType="twoWay",this._widget=new A.TwoWayCompareContainer(b,c,null,e));this._parentDivId=c;this._serviceRegistry=b}a.prototype={startup:function(a){this._widget.startup(!1,a)},toggle:function(){var a=this._widget.options,
c=this._widget.getCurrentDiffPos();a.blockNumber=c.block;a.changeNumber=c.change;this._widget.destroy();b.empty(b.node(this._parentDivId));this.widgetType==="inline"?(this.widgetType="twoWay",this._widget=new A.TwoWayCompareContainer(this._serviceRegistry,this._parentDivId,null,a)):(this.widgetType="inline",this._widget=new A.InlineCompareContainer(this._serviceRegistry,this._parentDivId,a));this._widget.setEditor()}};return a}();return A});
define("orion/searchExplorer","i18n!orion/search/nls/messages,require,orion/Deferred,orion/webui/littlelib,orion/contentTypes,orion/i18nUtil,orion/explorers/explorer,orion/explorers/explorerNavHandler,orion/fileClient,orion/commands,orion/searchUtils,orion/globalSearch/search-features,orion/compare/compare-features,orion/compare/compare-container,orion/explorers/navigationUtils,orion/webui/tooltip".split(","),function(j,k,i,b,f,g,e,d,c,a,h,l,n,q,p,m){function t(a){(a=b.node(a))&&b.empty(a)}function o(a,
c,d){(a=b.node(a))&&a.addEventListener(c,d,!1)}function w(a,c,d){if(c=b.node(c))d==="only"&&b.empty(c),c.appendChild(a)}function s(a,c,d,e){a=document.createElement(a);if(c)if(Array.isArray(c))for(var f=0;f<c.length;f++)a.classList.add(c[f]);else if(typeof c==="string")a.className=c;if(d)a.id=d;(c=b.node(e))&&c.appendChild(a);return a}function x(a,b,c,d,e){a=s("a",a,b,d);a.href=c;e&&a.appendChild(document.createTextNode(e));return a}function u(a,b,c,d){a=s("span",a,b,c);d&&a.appendChild(document.createTextNode(d));
return a}function A(a){return!a?null:a.type==="file"?a:a.parent}function z(a){return typeof a.getValidFileList==="function"?a.getValidFileList():a.getListRoot().children}function r(a,b){this._init(a);this.explorer=b}function D(a,b){this._init(a);this.options=a;this.explorer=b}function E(a,b,c){this.parentId=a;this.reportList=b;this.resultModel=c;this.renderer=new D({checkbox:!1},this)}function y(a,b){this.registry=a;this._commandService=b;this.fileClient=new c.FileClient(this.registry);this.defaulRows=
40;this.declareCommands()}r.prototype=new e.SelectionRenderer;r.prototype.initCheckboxColumn=function(){if(this._useCheckboxSelection){var a=s("th"),b=s("span",null,null,a);b.classList.add("selectionCheckmarkSprite");b.classList.add("core-sprite-check");if(this.getCheckedFunc)b.checked=this.getCheckedFunc(this.explorer.model.getListRoot()),b.classList.toggle("core-sprite-check_on");o(b,"click",function(a){this.onCheck(null,a.target,a.target.checked?!1:!0)}.bind(this));return a}};r.prototype.getCellHeaderElement=
function(a){if(a>2)return null;var b,c;if(a!==0){b=s("th");c=s("h2","search_header",null,b);if(a===1)c.textContent=typeof this.explorer.model.getHeaderString==="function"?this.explorer.model.getHeaderString():j.Results;else if(a===2)c.textContent=j.Location;return b}else return s("th")};r.prototype.focus=function(){var a=b.node(this.explorer.getParentDivId());window.setTimeout(function(){a.focus()},10)};r.prototype.staleFileElement=function(a){if(a.stale){var c=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,
!0):null;p.removeNavGrid(c,b.node(this.getItemLinkId(a)));c=b.node(this.getFileSpanId(a));t(c);w(document.createTextNode(this.explorer.model.getFileName(a)),c,"last");c=b.node(this.getFileIconId(a));t(c)}};r.prototype.replaceFileElement=function(a){var c=a.totalMatches?this.explorer.model.getFileName(a)+" ("+a.totalMatches+" matches)":this.explorer.model.getFileName(a),a=b.node(this.getItemLinkId(a));w(document.createTextNode(c),a,"only")};r.prototype.replaceDetailIcon=function(a,c){if(!this.explorer.model.replaceMode()&&
a&&a.type==="detail"){var d=b.node(this.getDetailIconId(a));d&&(t(d),d=u(null,null,d),d.classList.add("imageSprite"),c==="right"?d.classList.add("core-sprite-rightarrow"):c==="left"?d.classList.add("core-sprite-leftarrow"):d.classList.add("core-sprite-none"))}};r.prototype.renderFileElement=function(a,b,c){var d=null;this.explorer.model._provideSearchHelper&&(d=this.explorer.model._provideSearchHelper());d=a.linkLocation+(d?h.generateFindURLBinding(d.params,d.inFileQuery,null,d.params.replace):"");
b=x("navlink",this.getItemLinkId(a),d,b,c);p.addNavGrid(this.explorer.getNavDict(),a,b)};r.prototype.generateContextTip=function(a){for(var b=s("table","search_context_tip"),c=0;c<a.context.length;c++){var d=s("tr",null,null,b);a.context[c].current?(d=s("td",null,null,d),d.noWrap=!0,d=s("span","primaryColumn",null,d),this.generateDetailHighlight(a,d)):(d=s("td",null,null,d),d.noWrap=!0,d.textContent=a.context[c].context+"\u00a0")}return b};r.prototype.generateDetailHighlight=function(a,b){for(var c=
0,d=this.explorer.model.getDetailInfo(a),e=0;e<d.matches.length;e++){if(c>=d.lineString.length)break;if(!(this.explorer.model.replaceMode()&&e!==d.matchNumber)){c!==d.matches[e].startIndex&&w(document.createTextNode(d.lineString.substring(c,d.matches[e].startIndex)),b,"last");var c=s("b",null,null,b),f=d.matches[e].length;w(document.createTextNode(d.lineString.substring(d.matches[e].startIndex,d.matches[e].startIndex+f)),c,"only");c=d.matches[e].startIndex+f;if(this.explorer.model.replaceMode())break}}c<
d.lineString.length-1&&w(document.createTextNode(d.lineString.substring(c)),b,"last")};r.prototype.renderDetailElement=function(a,b,c,d){b=this.getDetailElement(a,b,c);d&&this.renderDetailLineNumber(a,b);this.generateDetailHighlight(a,b)};r.prototype.renderDetailLineNumber=function(a,b){var c=this.explorer.model.getDetailInfo(a),d=c.lineNumber+1;!this.explorer.model.replaceMode()||c.matches.length<=1?w(document.createTextNode(d+":"),b,"last"):w(document.createTextNode(d+"("+(c.matchNumber+1)+"):"),
b,"last")};r.prototype.getDetailElement=function(a,b,c){var d=this,b=null;this.explorer.model._provideSearchHelper&&(b=this.explorer.model._provideSearchHelper());b=a.parent.linkLocation+(b?h.generateFindURLBinding(b.params,b.inFileQuery,a.lineNumber,b.params.replace):"");c=x("navlink",this.getItemLinkId(a),b,c);p.addNavGrid(this.explorer.getNavDict(),a,c);o(c,"click",function(){d.explorer.getNavHandler().cursorOn(a)});return s("span",null,null,c)};r.prototype.getRowActionElement=function(a){return b.node(this.getItemLinkId(a))};
r.prototype.getLocationSpanId=function(a){return this.explorer.model.getId(a)+"_locationSpan"};r.prototype.getFileSpanId=function(a){return this.explorer.model.getId(a)+"_fileSpan"};r.prototype.getFileIconId=function(a){return this.explorer.model.getId(a)+"_fileIcon"};r.prototype.getItemLinkId=function(a){return typeof a==="string"?a+"_itemLink":this.explorer.model.getId(a)+"_itemLink"};r.prototype.getDetailIconId=function(a){return this.explorer.model.getId(a)+"_detailIcon"};r.prototype.renderLocationElement=
function(a,c){var d=c?c:b.node(this.getLocationSpanId(a));t(d);var e=this.explorer.model.getScopingParams(a),d=x("navlinkonpage",null,e.href,d,e.name);d.title=e.tooltip;p.addNavGrid(this.explorer.getNavDict(),a,d);var f=this;o(d,"click",function(){f.explorer.closeContextTip()})};r.prototype.getPrimColumnStyle=function(){return"search_primaryColumn"};r.prototype.getSecondaryColumnStyle=function(){return"search_secondaryColumn"};r.prototype.getCellElement=function(a,b,c){var d;switch(a){case 0:return a=
s("td"),b.type==="file"?(a.noWrap=!0,d=u(null,this.getFileIconId(b),a,null),this.explorer.model._provideSearchHelper&&this.explorer.model._provideSearchHelper().params.keyword===""?(b=u(null,null,a,null),b.classList.add("imageSprite"),b.classList.add("core-sprite-file")):this.getExpandImage(c,d,"core-sprite-file")):(d=u(null,null,a,null),a.noWrap=!0,a.align="right",this.renderDetailLineNumber(b,d)),a;case 1:return a=s("td"),d=u(null,this.getFileSpanId(b),a,null),b.type==="file"?(c=b.totalMatches?
this.explorer.model.getFileName(b)+" ("+b.totalMatches+" matches)":this.explorer.model.getFileName(b),this.renderFileElement(b,d,c)):(this.renderDetailElement(b,c,d),b=u(null,this.getDetailIconId(b),d,null),b=u(null,null,b,null),b.classList.add("imageSprite"),b.classList.add("core-sprite-none")),a;case 2:return a=s("td"),b.type==="file"&&(d=u(null,this.getLocationSpanId(b),a,null),b.parentLocation&&this.renderLocationElement(b,d)),a}};r.prototype.constructor=r;D.prototype=new e.SelectionRenderer;
D.prototype.getCellHeaderElement=function(a){switch(a){case 0:a=s("th","search_report",null,null);a=s("h2",null,null,a);a.textContent=j["Files replaced"];break;case 1:a=s("th","search_report",null,null),a=s("h2",null,null,a),a.textContent=j.Status}};D.prototype.getCellElement=function(a,b){switch(a){case 0:var c=s("td","search_report",null,null),d=s("div",null,null,c),e=s("span","primaryColumn",null,d);w(document.createTextNode(b.model.fullPathName+"/"+this.explorer.resultModel.getFileName(b.model)),
e,"only");o(e,"click",function(){window.open(b.model.linkLocation)});o(e,"mouseover",function(){e.style.cursor="pointer"});o(e,"mouseout",function(){e.style.cursor="default"});d=s("span",null,null,d);d.classList.add("imageSprite");if(b.status)switch(b.status){case "warning":d.classList.add("core-sprite-warning");break;case "failed":d.classList.add("core-sprite-error");break;case "pass":d.classList.add("core-sprite-ok")}return c;case 1:if(b.status){switch(b.status){case "warning":c=b.message;break;
case "failed":c=b.message;break;case "pass":c=b.model.totalMatches?g.formatMessage(j["${0} out of ${1}  matches replaced."],b.matchesReplaced,b.model.totalMatches):b.message}d=s("td","search_report",null,null);d.textContent=c;return d}}};D.prototype.constructor=D;E.prototype=new e.Explorer;E.prototype.report=function(){this.createTree(this.parentId,new e.ExplorerFlatModel(null,null,this.reportList))};E.prototype.constructor=E;y.prototype=new e.Explorer;y.prototype.onchange=function(){};y.prototype.setResult=
function(a,b){var c=this;this.parentNode=a;this.model=b;this.model.replaceMode()?(this.checkbox=this._hasCheckedItems=!0,this.renderer=new r({checkbox:!0,highlightSelection:!1,getCheckedFunc:function(a){return c.getItemChecked(a)},onCheckedFunc:function(a,b,d){c.onRowChecked(a,b,d)}},c)):(this.checkbox=!1,this.renderer=new r({checkbox:!1,highlightSelection:!1},this));this._reporting=!1;this._currentPreviewModel=this._uiFactory=null;this._currentReplacedContents={contents:null};this._popUpContext=
!1;this.timerRunning-=0;this.twoWayCompareContainer=this._timer=null};y.prototype.declareCommands=function(){var b=this,c=new a.Command({name:j["Save Search"],tooltip:j["Save search query"],id:"orion.saveSearchResults",callback:function(){b.saveSearch(b.model._searchHelper.params)},visibleWhen:function(){return b.model&&b.model._provideSearchHelper&&!b.model.replaceMode()}}),d=new a.Command({name:j.Replace,tooltip:j["Replace all matches with..."],id:"orion.previewCurrentPage",callback:function(){b.preview()},
visibleWhen:function(){return b.model&&!b.model.replaceMode()&&b.model._provideSearchHelper&&b.model._provideSearchHelper().params.keyword!==""}}),f=new a.Command({name:j["Apply Changes"],tooltip:j["Replace all selected matches"],id:"orion.globalSearch.replaceAll",callback:function(){b.replaceAll()},visibleWhen:function(){return b.model&&b.model.replaceMode()&&!b._reporting&&b._hasCheckedItems}}),g=new a.Command({name:j["Hide Compare"],tooltip:j["Hide compare view of changes"],id:"orion.globalSearch.hideCompare",
callback:function(){b.toggleCompare(!1)},visibleWhen:function(){return b.model&&b.model.replaceMode()&&!b._reporting&&b._uiFactory}}),i=new a.Command({name:j["Show Compare"],tooltip:j["Show compare view of changes"],id:"orion.globalSearch.showCompare",callback:function(){b.toggleCompare(!0)},visibleWhen:function(){return b.model&&b.model.replaceMode()&&!b._reporting&&!b._uiFactory}}),k=new a.Command({name:j["Search Again"],tooltip:j["Search again"],id:"orion.globalSearch.searchAgain",callback:function(){return b.searchAgain()},
visibleWhen:function(){return b.model._provideSearchHelper?b._reporting||b.model&&b.model.replaceMode():!1}});this._commandService.addCommand(c);this._commandService.addCommand(d);this._commandService.addCommand(k);this._commandService.addCommand(g);this._commandService.addCommand(i);this._commandService.addCommand(f);this._commandService.addCommandGroup("pageActions","orion.searchActions.unlabeled",200);this._commandService.registerCommandContribution("pageActions","orion.saveSearchResults",1,"orion.searchActions.unlabeled");
this._commandService.registerCommandContribution("pageActions","orion.previewCurrentPage",2,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions","orion.globalSearch.searchAgain",3,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions","orion.globalSearch.hideCompare",4,"orion.searchActions.unlabeled");this._commandService.registerCommandContribution("pageActions","orion.globalSearch.showCompare",5,"orion.searchActions.unlabeled");
this._commandService.registerCommandContribution("pageActions","orion.globalSearch.replaceAll",6,"orion.searchActions.unlabeled");c=new a.Command({name:j["< Previous Page"],tooltip:j["Show previous page of search result"],id:"orion.search.prevPage",hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculatePrevPage(),c=h.copySearchParams(b.model._provideSearchHelper().params,!0);c.start=a.start;return h.generateSearchHref(c)},visibleWhen:function(){return b.caculatePrevPage().start!==
b.model.getPagingParams().start}});d=new a.Command({name:j["Next Page >"],tooltip:j["Show next page of search result"],id:"orion.search.nextPage",hrefCallback:function(){if(!b.model._provideSearchHelper)return null;var a=b.caculateNextPage(),c=h.copySearchParams(b.model._provideSearchHelper().params,!0);c.start=a.start;return h.generateSearchHref(c)},visibleWhen:function(){return b.caculateNextPage().start!==b.model.getPagingParams().start}});f=new a.Command({tooltip:j["Next result"],imageClass:"core-sprite-move_down",
id:"orion.search.nextResult",groupId:"orion.searchGroup",visibleWhen:function(){return!b._reporting},callback:function(){b.gotoNext(!0,!0)}});g=new a.Command({tooltip:j["Previous result"],imageClass:"core-sprite-move_up",id:"orion.search.prevResult",groupId:"orion.searchGroup",visibleWhen:function(){return!b._reporting},callback:function(){b.gotoNext(!1,!0)}});this._commandService.addCommand(c);this._commandService.addCommand(d);this._commandService.addCommand(f);this._commandService.addCommand(g);
e.createExplorerCommands(this._commandService,function(a){var c=!1;b.model._provideSearchHelper&&b.model._provideSearchHelper().params.keyword===""&&(c=!0);return!a._reporting&&!c});this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.expandAll",1);this._commandService.registerCommandContribution("pageNavigationActions","orion.explorer.collapseAll",2);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextResult",3);this._commandService.registerCommandContribution("pageNavigationActions",
"orion.search.prevResult",4);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.prevPage",5);this._commandService.registerCommandContribution("pageNavigationActions","orion.search.nextPage",6)};y.prototype._checkStale=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location),"Checing file "+a.location+" for stale").then(function(b){if(this.model.staleCheck(b))a.stale=!1}.bind(this),function(a){console.error("Error loading file contents: "+
a.message);throw a;}.bind(this))};y.prototype.staleCheck=function(){var a=[];z(this.model).forEach(function(b){a.push(this._loadFileMetaData(b))}.bind(this));return i.all(a,function(a){return{_error:a}})};y.prototype._loadFileMetaData=function(a){return this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.location,!0),"Getting file metadata "+a.location).then(function(b){a.fullPathName=h.fullPathNameByMeta(b.Parents);a.parentLocation=b.Parents[0].Location;a.stale=a.lastModified!==
b.LocalTimeStamp;a.ETag=b.ETag;return a.stale?this._checkStale(a).then(function(){this.renderer.staleFileElement(a)}.bind(this)):a}.bind(this),function(b){console.error("Error loading file metadata: status "+b.status);a.stale=!0;this.renderer.staleFileElement(a);throw b;}.bind(this))};y.prototype.setCrawling=function(a){this._crawling=a};y.prototype.preview=function(){var c=this;this._commandService.openParameterCollector("pageActions",function(a){var d=s("input",null,"globalSearchReplaceWith",a);
d.type="text";d.name="ReplaceWith:";d.placeholder="Replace With";d.onkeydown=function(a){if(a.keyCode===13)return a=b.node("globalSearchReplaceWith"),c._commandService.closeParameterCollector(),c._doPreview(a.value);if(a.keyCode===27)return c._commandService.closeParameterCollector(),!1};s("span","parameters","globalSearchReplaceCommands",a);return d});var d=document.getElementById("globalSearchReplaceWith");d.value=this.model.defaultReplaceStr;window.setTimeout(function(){d.select();d.focus()},10);
this._commandService.addCommand(new a.Command({name:"Preview Changes",image:k.toUrl("images/replaceAll.gif"),id:"orion.globalSearch.innerReplaceAll",groupId:"orion.searchGroup",callback:function(){var a=b.node("globalSearchReplaceWith");c._commandService.closeParameterCollector();return c._doPreview(a.value)}}));this._commandService.registerCommandContribution("globalSearchReplaceCommands","orion.globalSearch.innerReplaceAll",1);this._commandService.renderCommands("globalSearchReplaceCommands","globalSearchReplaceCommands",
this,this,"button")};y.prototype._fileExpanded=function(a,c){var d=z(this.model)[a];if(c===null||c===void 0)return{childrenNumber:0,childDiv:b.node(this.model.getId(d))};return d.children&&d.children.length>0?(c<0?c=d.children.length-1:c>=d.children.length&&(c=0),{childrenNumber:d.children.length,childDiv:b.node(this.model.getId(d.children[c]))}):{childrenNumber:0,childDiv:null}};y.prototype._doPreview=function(a,b){if(this.model._provideSearchHelper){this.model._storeGlobalStatus&&this.model._storeGlobalStatus(a);
var c=h.copySearchParams(this.model._provideSearchHelper().params,!0);c.replace=a;if(b)c.start=0,c.rows=this.model.getPagingParams().totalNumber;c=h.generateSearchHref(c);window.location.href=c}};y.prototype.searchAgain=function(){if(this.model._provideSearchHelper){var a=h.copySearchParams(this.model._provideSearchHelper().params,!0);a.replace=null;if(a.rows>this.defaulRows)a.rows=this.defaulRows;a=h.generateSearchHref(a);a===window.location.href?window.location.reload():window.location.href=a}};
y.prototype.replaceAll=function(){var a=[],b=this;this._reporting=!0;this.initCommands();this.reportStatus(j["Writing files..."]);this.model.writeReplacedContents(a).then(function(){t(b.getParentDivId());(new E(b.getParentDivId(),a,b.model)).report();b.reportStatus("")})};y.prototype.toggleCompare=function(a){this.replacePreview(!1,a)};y.prototype.replacePreview=function(a,b){t(this.getParentDivId());b?(this._uiFactory=new l.SearchUIFactory({parentDivID:this.getParentDivId()}),this._uiFactory.buildUI()):
(this._uiFactory&&this._uiFactory.destroy(),this._uiFactory=null);this._currentPreviewModel=this.twoWayCompareContainer=null;this.initCommands();a&&this.reportStatus(j["Preparing preview..."]);var c=this;this.createTree(this._uiFactory?this._uiFactory.getMatchDivID():this.getParentDivId(),this.model,{selectionPolicy:"cursorOnly",indent:0,onCollapse:function(a){c.onCollapse(a)}});a?(this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null),this.reportStatus(""),!this._crawling&&
this.model.staleCheck&&this.staleCheck().then(function(){c.refreshValidFiles()})):this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null)};y.prototype.getItemChecked=function(a){if(a.checked===void 0)a.checked=!0;return a.checked};y.prototype._checkedItem=function(){for(var a=z(this.model),b=0;b<a.length;b++){if(a[b].checked)return!0;if(a[b].children)for(var c=0;c<a[b].children.length;c++)if(a[b].children[c].checked)return!0}return!1};y.prototype.onRowChecked=function(a,
c,d){if(a){if((a=b.node(a))&&a._item)this.onItemChecked(a._item,c,d);a=this._checkedItem()}else a=c,this.onItemChecked(this.model.getListRoot(),c,d);if(a!==this._hasCheckedItems)this._hasCheckedItems=a,this.initCommands()};y.prototype.onNewContentChanged=function(a){a===A(this.getNavHandler().currentModel())&&this.buildPreview(!0)};y.prototype.onItemChecked=function(a,c,d){a.checked=c;if(a.type==="file"||a===this.model.getListRoot()){if(a.children)for(d=0;d<a.children.length;d++){var e=b.node(this.renderer.getCheckBoxId(this.model.getId(a.children[d])));
if(e)this.renderer.onCheck(null,e,c,!1);else a.children[d].checked=c}if(a.type==="file")this.onNewContentChanged(a)}else if(d)this.onNewContentChanged(a.parent)};y.prototype.buildPreview=function(a){if(this._uiFactory&&z(this.model).length!==0){var b=this._uiFactory,c=A(this.getNavHandler().currentModel());this._currentPreviewModel=c;var d=this;this.model.provideFileContent(c,function(c){if(d.model.onMatchNumberChanged)d.model.onMatchNumberChanged(c);d.model.getReplacedFileContent(d._currentReplacedContents,
a,c);var e=d._currentReplacedContents.contents;Array.isArray(e)&&(e=d._currentReplacedContents.contents.join(d._currentReplacedContents.lineDelim));var h=new f.ContentTypeService(d.registry),i=d.model.getFileName(c),h=h.getFilenameContentType(i),c={readonly:!0,hasConflicts:!1,newFile:{Name:c.location,Type:h,Content:d.model.getFileContents(c)},baseFile:{Name:c.location,Type:h,Content:e}};d.twoWayCompareContainer?(t(d.uiFactoryCompare.getTitleDiv()),w(document.createTextNode(g.formatMessage(j["Replaced File (${0})"],
i)),d.uiFactoryCompare.getTitleDiv(),"only"),t(d.uiFactoryCompare.getTitleDiv(!0)),w(document.createTextNode(g.formatMessage(j["Original File (${0})"],i)),d.uiFactoryCompare.getTitleDiv(!0),"only"),d.twoWayCompareContainer.setOptions(c),d.twoWayCompareContainer.setEditor()):(d.uiFactoryCompare=new n.TwoWayCompareUIFactory({parentDivID:b.getCompareDivID(),showTitle:!0,rightTitle:g.formatMessage(j["Replaced File (${0})"],i),leftTitle:g.formatMessage(j["Original File (${0})"],i),showLineStatus:!1}),
d.uiFactoryCompare.buildUI(),d.twoWayCompareContainer=new q.TwoWayCompareContainer(d.registry,b.getCompareDivID(),d.uiFactoryCompare,c),d.twoWayCompareContainer.startup(!1,function(){d._uiFactory.setCompareWidget(d.twoWayCompareContainer)}));window.setTimeout(function(){d.renderer.focus()},100)})}};y.prototype.addSavedSearch=function(a,b){this.registry.getService("orion.core.savedSearches").addSearch(a,b)};y.prototype.saveSearch=function(a){if(this.model._provideSearchHelper){var b=h.generateSearchHref(a).split("#")[1],
c=b;typeof this.model._provideSearchHelper().displayedSearchTerm==="string"&&typeof a.resource==="string"?(c="'"+this.model._provideSearchHelper().displayedSearchTerm+"' in ",a.resource.length>0?this.registry.getService("orion.page.progress").progress(this.fileClient.read(a.resource,!0),"Getting file metadata "+a.resource).then(function(a){var d=h.fullPathNameByMeta(a.Parents);this.addSavedSearch(c+(d.length===0?a.Name:d+"/"+a.Name),b)}.bind(this),function(a){console.error("Error loading file meta data: "+
a.message);this.addSavedSearch(c+"root",b)}.bind(this)):this.addSavedSearch(c+"root",b)):this.addSavedSearch(c,b)}};y.prototype.caculateNextPage=function(){var a=this.model.getPagingParams();return a.start+a.rows>=a.totalNumber?{start:a.start}:{start:a.start+a.rows}};y.prototype.caculatePrevPage=function(){var a=this.model.getPagingParams(),a=a.start-a.rows;a<0&&(a=0);return{start:a}};y.prototype.initCommands=function(){var a=this;this._commandService.destroy("pageActions");this._commandService.renderCommands("pageActions",
"pageActions",a,a,"button");this._commandService.destroy("pageNavigationActions");this._commandService.renderCommands("pageNavigationActions","pageNavigationActions",a,a,"button");if(this.model._provideSearchHelper&&this.model._provideSearchHelper().params.keyword!=="")var b=this._commandService._createDropdownMenu("pageNavigationActions",j.Options,!1,function(){a.model.replaceMode()?a._commandService._generateCheckedMenuItem(b.menu,j["Compare changes"],!0,function(c){a.toggleCompare(c.target.checked);
window.setTimeout(function(){b.dropdown.close(!0)},100)}):a._commandService._generateCheckedMenuItem(b.menu,j["Sort by Name"],a.model.sortByName,function(c){a.sortWithName(c.target.checked);window.setTimeout(function(){b.dropdown.close(!0)},100)})})};y.prototype.reportStatus=function(a){this.registry.getService("orion.page.message").setProgressMessage(a)};y.prototype.isExpanded=function(a){return this.myTree.isExpanded(this.model.getId(a))};y.prototype.popupContext=function(a){if(this.contextTip)this.contextTip.destroy(),
this.contextTip=null;var c=this.renderer.getDetailIconId(a),a=this.renderer.generateContextTip(a),c=b.node(c),d=["below","right"];if(c)for(var e=this.myTree._parent.getClientRects()[0],f=c.getClientRects(),g=0,h=f.length;g<h;g++)if(f[g].bottom+100>e.bottom){d=["above","right"];break}this.contextTip=new m.Tooltip({node:c,showDelay:0,trigger:"none",position:d});this.contextTip.contentContainer().appendChild(a);this.contextTip.show()};y.prototype.closeContextTip=function(a){if(!this.model.replaceMode()){if(this.contextTip)this.contextTip.destroy(),
this.contextTip=null;if(!a)this._popUpContext=!1;this.renderer.replaceDetailIcon(this.getNavHandler().currentModel(),"right")}};y.prototype.onCollapse=function(a){var b=this.getNavHandler().currentModel();b&&b.type==="detail"&&A(a)===a&&this.getNavHandler().cursorOn(a)};y.prototype.onExpand=function(a,b){if(a&&a.children&&a.children.length>0&&typeof b==="string"){var c=0,c=b==="first"?0:b==="last"?a.children.length-1:JSON.parse(b);if(typeof c==="string"||c<0||c>=a.children.length)c=0;this.getNavHandler().cursorOn(a.children[c])}};
y.prototype.forceExpandFunc=function(a,b,c){this.myTree.expand(a,function(){this.onExpand(a,b,c)}.bind(this));return null};y.prototype.keyEventListeningDiv=function(a){return b.node(this.getParentDivId(a))};y.prototype.onFocus=function(a){a||this.closeContextTip()};y.prototype.preventDefaultFunc=function(a,b){if(!b)return!0;if(!this.model.replaceMode()&&!a.ctrlKey&&b.type==="detail"){if(a.keyCode===37&&this._popUpContext)return this.closeContextTip(),a.preventDefault(),!0;if(a.keyCode===39&&!this._popUpContext)return this._popUpContext=
!0,this.renderer.replaceDetailIcon(b,"left"),this.popupContext(b),a.preventDefault(),!0}return!1};y.prototype.onReplaceCursorChanged=function(a,b){A(this._currentPreviewModel)===A(b)||this.buildPreview();if(b.type==="detail"){var c=this.model.getDetailInfo(b);this.twoWayCompareContainer.gotoDiff(c.lineNumber,c.matches[c.matchNumber].startIndex,!1)}};y.prototype.onCursorChanged=function(a,b){this.renderer.replaceDetailIcon(a,"none");this.model.storeLocationStatus&&this.model.storeLocationStatus(b);
var c=this;if(this.model.replaceMode()){if(this._uiFactory)if(this._timer){if(this.timerRunning)window.clearTimeOut(this._timer),this._timer=window.setTimeout(function(){c.onReplaceCursorChanged(a,b);c.timerRunning=!1;c._timer=null},500)}else this._timer=window.setTimeout(function(){c.onReplaceCursorChanged(a,b);c.timerRunning=!1;c._timer=null},500)}else b.type==="detail"?this._popUpContext?(this.popupContext(b),this.renderer.replaceDetailIcon(b,"left")):this.renderer.replaceDetailIcon(b,"right"):
this._popUpContext&&this.closeContextTip(!0)};y.prototype.startUp=function(){if(this.model.getPagingParams().numberOnPage===0){var a=j["No matches"];this.model._provideSearchHelper&&(a=g.formatMessage(j["No matches found for ${0}"],this.model._provideSearchHelper().displayedSearchTerm));this.parentNode.textContent="";var b=s("b",null,null,this.parentNode);w(document.createTextNode(a),b,"only")}else{var c=this;this.model.buildResultModel();this.model.replaceMode()?c.replacePreview(!0,!0):(this.initCommands(),
t(this.getParentDivId()),this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"cursorOnly",indent:0,onCollapse:function(a){c.onCollapse(a)}}),this.gotoCurrent(this.model.restoreLocationStatus?this.model.restoreLocationStatus():null),this.reportStatus(""),!this._crawling&&this.model.staleCheck&&this.staleCheck().then(function(){c.refreshValidFiles()}))}};y.prototype.incrementalRender=function(){var a=this;this.model.buildResultModel();this.createTree(this.getParentDivId(),this.model,{selectionPolicy:"cursorOnly",
indent:0,onCollapse:function(b){a.onCollapse(b)}})};y.prototype.refreshValidFiles=function(){for(var a=[],b=A(this.getNavHandler().currentModel()),c=z(this.model),d=0;d<c.length;d++)c[d].stale?b===c[d]&&(b=null):a.push(c[d]);this.model.setValidFileList&&this.model.setValidFileList(a);z(this.model).length===0?(this.getNavHandler().refreshModel(this.getNavDict(),this.model,z(this.model)),this.getNavHandler().cursorOn(null,!0)):b?this.getNavHandler().refreshModel(this.getNavDict(),this.model,z(this.model),
!0):(this.getNavHandler().cursorOn(null,!0),this.getNavHandler().refreshModel(this.getNavDict(),this.model,z(this.model)),this.gotoCurrent())};y.prototype.getItemCount=function(){return this.model.getListRoot().children.length};y.prototype.sortWithName=function(a){if(this.model._provideSearchHelper&&this.model.sortByName!==a){var b=h.copySearchParams(this.model._provideSearchHelper().params);b.sort=a?"NameLower asc":"Path asc";b.start=0;a=h.generateSearchHref(b);window.location.href=a}};y.prototype.getParentDivId=
function(a){return!this.model.replaceMode()||!a?this.parentNode.id:this._uiFactory?this._uiFactory.getMatchDivID():this.parentNode.id};y.prototype.gotoCurrent=function(a){var b=null,c="none";a?(b=a.file,c=a.detail):b=this.getNavHandler().currentModel();b||(b=z(this.model).length>0?z(this.model)[0]:null);this.getNavHandler().cursorOn(b,!0);b&&c&&c!=="none"&&this.myTree.expand(b,function(){this.onExpand(b,c)}.bind(this))};y.prototype.gotoNext=function(a,b){z(this.model).length!==0&&this.getNavHandler().iterate(a,
b)};y.prototype.constructor=y;return{SearchResultExplorer:y}});
define("orion/searchResults","i18n!orion/search/nls/messages,require,orion/webui/littlelib,orion/searchExplorer,orion/searchModel,orion/searchUtils,orion/crawler/searchCrawler".split(","),function(j,k,i,b,f,g,e){function d(c,a,d,e,f,g){this.registry=c;this.fileService=e;this.resultsId=a;this.commandService=d;this.searcher=f;this.crawling=g;this.explorer=new b.SearchResultExplorer(this.registry,this.commandService)}d.prototype={_renderSearchResult:function(b,a,d,e,g){var j=!1,p=[];i.empty(i.node(a));
if(e.response.numFound>0)for(var m=0;m<e.response.docs.length;m++){var t=e.response.docs[m];if(!t.Directory){j||(j=!0);var o=t.Location;p.push({linkLocation:k.toUrl("edit/edit.html")+"#"+o,location:o,path:t.Path?t.Path:o,name:t.Name,lastModified:t.LastModified})}}this.explorer.setCrawling(b);var w=this,b=new f.SearchResultModel(this.registry,this.explorer.fileClient,p,e.response.numFound,d,{onMatchNumberChanged:function(a){w.explorer.renderer.replaceFileElement(a)}});this.explorer.setResult(a,b);
g?this.explorer.incrementalRender():this.explorer.startUp()},_search:function(b,a){this.crawling=a.regEx||a.caseSensitive;var d=i.node(this.resultsId);if(this.crawling){i.empty(d);d.appendChild(document.createTextNode(""));var f=this,d=new e.SearchCrawler(this.registry,this.fileService,a,{childrenLocation:this.searcher.getChildrenLocation()});d.search(function(d,e){f._renderSearchResult(!0,b,a,d,e)})}else{i.empty(d);d.appendChild(document.createTextNode(j["Searching..."]));try{this.registry.getService("orion.page.progress").progress(this.fileService.search(a),
"Searching "+a.keyword).then(function(d){this._renderSearchResult(!1,b,a,d)}.bind(this))}catch(g){i.empty(d),d.appendChild(document.createTextNode("")),typeof g==="string"&&g.indexOf("search")>-1?(f=this,d=new e.SearchCrawler(this.registry,this.fileService,a,{childrenLocation:this.searcher.getChildrenLocation()}),d.search(function(d,e){f._renderSearchResult(!0,b,a,d,e)})):this.registry.getService("orion.page.message").setErrorMessage(g)}}},loadResults:function(b){this._search(i.node(this.resultsId),
b)}};d.prototype.constructor=d;return{SearchResultsGenerator:d}});
define("search/search","i18n!orion/search/nls/messages,require,orion/bootstrap,orion/status,orion/progress,orion/dialogs,orion/commands,orion/favorites,orion/searchOutliner,orion/searchClient,orion/fileClient,orion/operationsClient,orion/searchResults,orion/globalCommands,orion/contentTypes,orion/searchUtils,orion/PageUtil".split(","),function(j,k,i,b,f,g,e,d,c,a,h,l,n,q,p,m,t){function o(a,b,c,d,e){a=!c||c===""||c==="root"?e.getSearchRootLocation():c;d=m.copySearchParams(d);d.resource=a;b.href=m.generateSearchHref(d)}
function w(a,b,c,d,e,f,g){var h=f.resource,i=f.replace?j["Replace All Matches"]:j["Search Results"];h?h===b.fileServiceRootURL(h)?(d.setRootLocationbyURL(h),d.setLocationbyURL(h),q.setPageTarget({task:"Search",title:i,serviceRegistry:a,commandService:c,searchService:d,fileService:b,breadcrumbRootName:b.fileServiceName(h),makeBreadcrumbLink:function(a,c){o(b,a,c,f,d)}}),d.setChildrenLocationbyURL(h),e.loadResults(f)):g.progress(b.read(h,!0),"Loading file metadata "+h).then(function(g){q.setPageTarget({task:"Search",
title:i,target:g,serviceRegistry:a,fileService:b,commandService:c,searchService:d,breadcrumbRootName:"Search",makeBreadcrumbLink:function(a,c){o(b,a,c,f,d)}});e.loadResults(f)}.bind(this),function(a){window.console.error("Error loading file metadata: "+a.message)}.bind(this)):q.setPageTarget({task:"Search",title:i,serviceRegistry:a,commandService:c,searchService:d,fileService:b,breadcrumbRootName:"Search",makeBreadcrumbLink:function(a,c){o(b,a,c,f,d)}})}i.startup().then(function(i){var j=i.serviceRegistry,
i=i.preferences;new g.DialogService(j);var k=new l.OperationsClient(j);new b.StatusReportingService(j,k,"statusPane","notifications","notificationArea");var o=new f.ProgressService(j,k),z=new e.CommandService({serviceRegistry:j});new d.FavoritesService({serviceRegistry:j});new c.SavedSearches({serviceRegistry:j});var r=new h.FileClient(j);new p.ContentTypeService(j);var D=new a.Searcher({serviceRegistry:j,commandService:z,fileService:r});new c.SearchOutliner({parent:"searchProgress",serviceRegistry:j});
q.generateBanner("orion-searchResults",j,z,i,D,D,null,null);var E=new n.SearchResultsGenerator(j,"results",z,r,D,!1),y=function(){var a=t.matchResourceParameters();m.convertSearchParams(a);w(j,r,z,D,E,a,o);if(a=document.getElementById("pageActions"))z.destroy(a),z.renderCommands(a.id,a,D,D,"button")};window.addEventListener("hashchange",function(){y()},!0);y()})});