/*

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


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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation 

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

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

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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


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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:  IBM Corporation - initial API and implementation

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


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


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

 Contributors:
     IBM Corporation - initial API and implementation

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

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

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

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

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

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

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

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

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


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


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

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

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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


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


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

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

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

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

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

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: 
 IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:  IBM Corporation - initial API and implementation

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

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

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

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

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

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

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

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

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

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


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


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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

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

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

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

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

 Contributors: IBM Corporation - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation 

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - _initial API and implementation

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


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


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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors:
     IBM Corporation - initial API and implementation

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

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

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation
*/
(function(){function m(){for(var f=navigator.userAgent,l={browser:!1,version:!1},e=[{name:"Chrome/Chromium",regExp:/(?:chrome|crios|chromium)\/(\d+)/i,minVersion:24},{name:"Firefox",regExp:/firefox\/(\d+)/i,minVersion:17},{name:"Microsoft Internet Explorer",regExp:/msie\s(\d+)/i,minVersion:10},{name:"Microsoft Internet Explorer",regExp:/Trident\/(\d+)/i,minVersion:6},{name:"Safari",regExp:/version\/(\d+).*?safari/i,minVersion:6}],d=0;d<e.length;d++){var a=e[d],h=f.match(a.regExp);if(h){l.browser=
!0;l.version=h[1]>=a.minVersion;l.name=a.name;break}}return l}function n(){try{return"localStorage"in window&&null!==window.localStorage}catch(f){return!1}}function p(f){alert(f);throw Error("unsupported browser");}var k=m();if(k.browser)k.version||p("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+k.name+".\n");else if(n()&&!localStorage.skipBrowserCheck)if(confirm("Sorry, your browser is not supported. The latest version of Chrome, Firefox or Safari web browser is recommended.\nContinue anyway?"))localStorage.skipBrowserCheck=
1;else throw"unsupported browser";else n()||p("Sorry, your browser is not supported.\n\nTo use Orion, the latest version of the Chrome, Firefox, or Safari web browser is recommended.\n");return{isSupportedBrowser:m,supportsLocalStorage:n,throwBrowserAlert:p}})();define("orion/browserCompatibility",function(){});
(function(m,n){"function"===typeof define&&define.amd?define("orion/Deferred",n):"object"===typeof exports?module.exports=n():(m.orion=m.orion||{},m.orion.Deferred=n())})(this,function(){function m(){for(var d;d=f.shift();)d();l=!1}function n(d){f.push(d);l||(l=!0,e())}function p(d){return function(a){d(a)}}function k(){function d(){for(var a;a=f.shift();){var b=a.deferred,h="fulfilled"===e?"resolve":"reject";a=a[h];if("function"===typeof a)try{var d=a(g),q=d&&("object"===typeof d||"function"===typeof d)&&
d.then;if("function"===typeof q)if(d===b.promise)b.reject(new TypeError);else{var l=d.cancel;"function"===typeof l?b._parentCancel=l.bind(d):delete b._parentCancel;q.call(d,p(b.resolve),p(b.reject),p(b.progress))}else b.resolve(d)}catch(k){b.reject(k)}else b[h](g)}}function a(a){delete q._parentCancel;e="rejected";g=a;f.length&&n(d)}function h(b){function l(a){return function(b){(!e||"assumed"===e)&&a(b)}}delete q._parentCancel;try{var t=b&&("object"===typeof b||"function"===typeof b)&&b.then;if("function"===
typeof t)if(b===q)a(new TypeError);else{e="assumed";var w=b&&b.cancel;if("function"!==typeof w){var A=new k;b=A.promise;try{t(A.resolve,A.reject,A.progress)}catch(x){A.reject(x)}w=b.cancel;t=b.then}g=b;t.call(b,l(h),l(a));q._parentCancel=w.bind(b)}else e="fulfilled",g=b,f.length&&n(d)}catch(m){l(a)(m)}}function b(){var b=q._parentCancel;b?(delete q._parentCancel,b()):e||(b=Error("Cancel"),b.name="Cancel",a(b))}var g,e,f=[],q=this;this.resolve=function(a){e||h(a);return q};this.reject=function(b){e||
a(b);return q};this.progress=function(a){e||f.forEach(function(b){if(b.progress)try{b.progress(a)}catch(g){}});return q.promise};this.cancel=function(){q._parentCancel?setTimeout(b,0):b();return q};this.then=function(a,b,g){var h=new k;h._parentCancel=q.promise.cancel;f.push({resolve:a,reject:b,progress:g,deferred:h});("fulfilled"===e||"rejected"===e)&&n(d);return h.promise};this.promise={then:q.then,cancel:q.cancel}}var f=[],l=!1,e=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var d=
process.nextTick;return function(){d(m)}}if("function"===typeof MutationObserver){var a=document.createElement("div");(new MutationObserver(m)).observe(a,{attributes:!0});return function(){a.setAttribute("class","_tick")}}return function(){setTimeout(m,0)}}();k.all=function(d,a){function h(a,b){f||(e[a]=b,0===--g&&q.resolve(e))}function b(b,g){if(!f){if(a)try{h(b,a(g));return}catch(d){g=d}q.reject(g)}}var g=d.length,e=[],f=!1,q=new k;q.then(void 0,function(){f=!0;d.forEach(function(a){a.cancel&&a.cancel()})});
0===g?q.resolve(e):d.forEach(function(a,g){a.then(h.bind(void 0,g),b.bind(void 0,g))});return q.promise};k.when=function(d,a,h,b){var g;d&&"function"===typeof d.then||(g=new k,g.resolve(d),d=g.promise);return d.then(a,h,b)};return k});
define("orion/EventTarget",[],function(){function m(){this._namedListeners={}}m.prototype={dispatchEvent:function(m){if(!m.type)throw Error("unspecified type");var p=this._namedListeners[m.type];p&&p.forEach(function(k){try{"function"===typeof k?k(m):k.handleEvent(m)}catch(f){"undefined"!==typeof console&&console.log(f)}});return!m.defaultPrevented},addEventListener:function(m,p){if("function"===typeof p||p.handleEvent)this._namedListeners[m]=this._namedListeners[m]||[],this._namedListeners[m].push(p)},
removeEventListener:function(m,p){var k=this._namedListeners[m];if(k)for(var f=0;f<k.length;f++)if(k[f]===p){1===k.length?delete this._namedListeners[m]:k.splice(f,1);break}}};m.prototype.constructor=m;m.attach=function(n){var p=new m;n.dispatchEvent=p.dispatchEvent.bind(p);n.addEventListener=p.addEventListener.bind(p);n.removeEventListener=p.removeEventListener.bind(p)};return m});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(m,n){function p(d,a,h){this._properties=h||{};this._properties["service.id"]=d;this._properties.objectClass=a;this._properties["service.names"]=a}function k(d,a,h){this._serviceId=d;this._serviceReference=a;this._internalRegistry=h}function f(d,a){function h(b){return function(){var h;try{if(!a())throw Error("Service was unregistered");var e=d[b].apply(d,Array.prototype.slice.call(arguments));if(e&&"function"===typeof e.then)return e;
h=new m;h.resolve(e)}catch(q){h=new m,h.reject(q)}return h.promise}}for(var b in d)"function"===typeof d[b]&&(this[b]=h(b))}function l(d,a){this.type=d;this.serviceReference=a}function e(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new n;var d=this;this._internalRegistry={isRegistered:function(a){return d._entries[a]?!0:!1},unregisterService:function(a){var h=d._entries[a];if(!h)throw Error("Service has already been unregistered: "+a);var b=h.reference;d._serviceEventTarget.dispatchEvent(new l("unregistering",
b));d._entries[a]=null;b.getProperty("objectClass").forEach(function(a){for(var h=d._namedReferences[a],e=0;e<h.length;e++)if(h[e]===b){1===h.length?delete d._namedReferences[a]:h.splice(e,1);break}})},modifyService:function(a){var h=d._entries[a];if(!h)throw Error("Service not found while trying to send modified event: "+a);d._serviceEventTarget.dispatchEvent(new l("modified",h.reference))}}}p.prototype={getPropertyKeys:function(){var d=[],a;for(a in this._properties)this._properties.hasOwnProperty(a)&&
d.push(a);return d},getProperty:function(d){return this._properties[d]}};p.prototype.constructor=p;k.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(d){var a=this._serviceReference._properties;this._serviceReference._properties=d||{};d["service.id"]=this._serviceId;
d.objectClass=a.objectClass;d["service.names"]=a["service.names"];this._internalRegistry.modifyService(this._serviceId)}};k.prototype.constructor=k;e.prototype={getService:function(d){var a;if("string"===typeof d)(d=this._namedReferences[d])&&d.some(function(h){a=this._entries[h.getProperty("service.id")].service;return!!a},this);else if(d=this._entries[d.getProperty("service.id")])a=d.service;return a||null},getServiceReferences:function(d){if(d)return this._namedReferences[d]?this._namedReferences[d]:
[];var a=[];this._entries.forEach(function(h){h&&a.push(h.reference)});return a},registerService:function(d,a,h){if("undefined"===typeof a||null===a)throw Error("invalid service");"string"===typeof d?d=[d]:Array.isArray(d)||(d=[]);var b=this._entries.length,g=new p(b,d,h),e=this._namedReferences;d.forEach(function(a){e[a]=e[a]||[];e[a].push(g)});d=new f(a,this._internalRegistry.isRegistered.bind(null,b));this._entries.push({reference:g,service:d});d=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new l("registered",
g));return new k(b,g,d)},addEventListener:function(d,a){this._serviceEventTarget.addEventListener(d,a)},removeEventListener:function(d,a){this._serviceEventTarget.removeEventListener(d,a)}};e.prototype.constructor=e;return{ServiceRegistry:e}});
define("orion/xhr",["orion/Deferred"],function(m){function n(m,k,f,l){var e="undefined"!==typeof f.response?f.response:f.responseText,d;try{d=f.status}catch(a){d=0}m={args:k,response:e,responseText:"string"===typeof e?e:null,status:d,url:m,xhr:f};"undefined"!==typeof l&&(m.error=l);return m}return function(p,k,f){f=f||{};var l=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,e=new m,d=f.headers||{},a=f.log||!1,h;"undefined"===typeof d["X-Requested-With"]&&(d["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof f.data&&("POST"===p||"PUT"===p))h=f.data;var b=!1,g=!1;e.promise.then(void 0,function(a){b=!0;!g&&(a instanceof Error&&"Cancel"===a.name)&&l.abort()});l.onabort=function(){g=!0;if(!b){var a=Error("Cancel");a.name="Cancel";e.reject(a)}};l.onload=function(){var b=n(k,f,l);200<=l.status&&400>l.status?e.resolve(b):(e.reject(b),a&&"undefined"!==typeof console&&console.log(Error(l.statusText)))};l.onerror=function(){var b=n(k,f,l);e.reject(b);a&&"undefined"!==typeof console&&console.log(Error(l.statusText))};
l.onprogress=function(a){a.xhr=l;e.progress(a)};try{l.open(p,k,!0);"string"===typeof f.responseType&&(l.responseType=f.responseType);if("number"===typeof f.timeout)if("number"===typeof l.timeout)l.timeout=f.timeout,l.addEventListener("timeout",function(a){e.reject(n(k,f,l,"Timeout exceeded"))});else{var u=setTimeout(function(){e.reject(n(k,f,l,"Timeout exceeded"))},f.timeout);e.promise.then(clearTimeout.bind(null,u),clearTimeout.bind(null,u))}Object.keys(d).forEach(function(a){l.setRequestHeader(a,
d[a])});l.send(h||null)}catch(v){e.reject(n(k,f,l,v))}return e.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(m,n,p){function k(a,b){this._name=a;this._providers=b;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function f(a,b){return{get:function(g,d){if(0===b)return null;var e=localStorage.getItem(a+g);if(null===e)return null;e=JSON.parse(e);return d||-1===b||e._expires&&e._expires>(new Date).getTime()?(delete e._expires,e):null},set:function(g,d){if(0!==b)if(-1!==b&&(d._expires=(new Date).getTime()+
1E3*b),0===Object.keys(d).length)localStorage.removeItem(a+g);else{var e=JSON.stringify(d);localStorage.setItem(a+g,e);delete d._expires}},remove:function(b){localStorage.removeItem(a+b)}}}function l(a){this._currentPromises={};this._cache=new f("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var b=a.getServiceReferences("orion.core.preference.provider");0<b.length&&(this._service=a.getService(b[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 a(a,b){this._userProvider=new l(a);this._localProvider=new d;b=b||"defaults.pref";-1===b.indexOf("://")&&(b=m.toUrl(b));this._defaultsProvider=new e(b);this._serviceRegistration=a.registerService("orion.core.preference",this)}k.prototype={_flush:function(){for(var a=[],b=0;b<this._stores.length;++b){var g=this._stores[b];-1!==this._dirty.indexOf(g)&&
a.push(this._providers[b].put(this._name,g));if(this._pendingDeletes[b]&&0<this._pendingDeletes[b].length){for(g=0;g<this._pendingDeletes[b].length;g++)a.push(this._providers[b].remove(this._name,this._pendingDeletes[b][g]));delete this._pendingDeletes[b]}}this._dirty=[];return n.all(a)},_scheduleFlush:function(a){a&&-1===this._dirty.indexOf(a)&&this._dirty.push(a);this._flushPending||(this._flushPending=!0,window.setTimeout(function(){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 b=this._stores[a],g;for(g in b)b.hasOwnProperty(g)&&"undefined"===typeof this._cached[g]&&(this._cached[g]=b[g])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(a){return this._getCached()[a]},put:function(a,b){if(0!==this._stores.length){var g=this._stores[0];g[a]!==b&&(g[a]=b,this._cached=null,this._scheduleFlush(g))}},remove:function(a){for(var b=0;b<
this._stores.length;++b){var g=this._stores[b];if(g.hasOwnProperty(a))return delete g[a],this._pendingDeletes[b]||(this._pendingDeletes[b]=[]),this._pendingDeletes[b].push(a),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var a=0;a<this._stores.length;++a)this._stores[a]={},this._scheduleFlush(this._stores[a]);this._cached=null},sync:function(a){if(this._flushPending)return this._flushPending=!1,this._flush();for(var b=this,g=[],d=0;d<this._providers.length;++d)g.push(this._providers[d].get(this._name,
a).then(function(a){return function(g){b._stores[a]=g}}(d)));return n.all(g).then(function(){b._cached=null;b._getCached()})},flush:function(){this._flush()}};l.prototype={get:function(a,b){if(this._currentPromises[a])return this._currentPromises[a];var g=new n,d=null;b?this._cache.remove(a):d=this._cache.get(a);if(null!==d)g.resolve(d);else{this._currentPromises[a]=g;var e=this;this._service.get(a).then(function(b){e._cache.set(a,b);delete e._currentPromises[a];g.resolve(b)},function(b){404===b.status?
(b={},e._cache.set(a,b),delete e._currentPromises[a],g.resolve(b)):(delete e._currentPromises[a],g.resolve(e._cache.get(a,!0)||{}))})}return g},put:function(a,b){this._cache.set(a,b);return this._service.put(a,b)},remove:function(a,b){var g=this._cache.get(a);delete g[b];this._cache.set(a,g);return this._service.remove(a,b)}};e.prototype={get:function(a,b){if(this._currentPromise)return this._currentPromise;var g=new n,d=null;b?this._cache.remove(a):d=this._cache.get(a);if(null!==d)g.resolve(d);else{this._currentPromise=
g;var e=this;p("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){b=JSON.parse(b.response);e._cache.set(a,b[a]||{});e._currentPromise=null;g.resolve(b[a]||{})},function(b){401===b.xhr.status||404===b.xhr.status?(e._cache.set(a,{}),e._currentPromise=null,g.resolve({})):(e._currentPromise=null,b=e._cache.get(a,!0),null!==b?g.resolve(b[a]||{}):g.resolve({}))})}return g},put:function(a,b){var g=new n;g.resolve();return g},remove:function(a,b){var g=this._cache.get(a);
delete g[b];this.put(a,g)}};d.prototype={get:function(a){var b=new n;a=this._cache.get(a);null!==a?b.resolve(a):b.resolve({});return b},put:function(a,b){var g=new n;this._cache.set(a,b);g.resolve();return g},remove:function(a,b){var g=this._cache.get(a);delete g[b];this.put(a,g)}};a.DEFAULT_SCOPE=1;a.LOCAL_SCOPE=2;a.USER_SCOPE=4;a.prototype={listenForChangedSettings:function(h,b,g){if(!b||"number"!==typeof b||7<b||1>b)g=b,b=a.DEFAULT_SCOPE|a.LOCAL_SCOPE|a.USER_SCOPE;window.addEventListener("storage",
g,!1);return 0!==(a.USER_SCOPE&b)?"/orion/preferences/user"+h:0!==(a.LOCAL_SCOPE&b)?"/orion/preferences/local"+h:"/orion/preferences/default"+h},getPreferences:function(h,b){if(!b||"number"!==typeof b||7<b||1>b)b=a.DEFAULT_SCOPE|a.LOCAL_SCOPE|a.USER_SCOPE;var g=[];a.USER_SCOPE&b&&this._userProvider.available()&&g.push(this._userProvider);a.LOCAL_SCOPE&b&&g.push(this._localProvider);a.DEFAULT_SCOPE&b&&g.push(this._defaultsProvider);var d=new k(h,g);return d.sync().then(function(){return d})},getSetting:function(a,
b,g){for(var d,e=0;e<a.length;e++)if(a[e].label===b)for(var q=0;q<a[e].data.length;q++)if(a[e].data[q].label===g){d=a[e].data[q].value;break}return d}};return{PreferencesService:a}});
(function(){function m(a){if("string"!==typeof a)throw new TypeError;}function n(a){return a?a.split("\x26"):[]}function p(a){return 0===a.length?"":a.join("\x26")}function k(a){var b=/([^=]*)(?:=?)(.*)/.exec(a);a=b[1]?decodeURIComponent(b[1]):"";b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function f(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="\x3d"+encodeURIComponent(a[1]));return b}function l(a,b){var g="",s=[],h=0;return{next:function(){g!==a.query&&(g=a.query,s=n(g));if(h<s.length){var d=
k(s[h++]);switch(b){case "keys":return d[0];case "values":return d[1];case "keys+values":return[d[0],d[1]];default:throw new TypeError;}}throw D;}}}function e(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function d(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function a(a){var b=[];a.split("/").forEach(function(a){".."===a?b.pop():"."!==a&&b.push(a)});return b.join("/")}function h(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function b(b,g){if("string"!==
typeof b)throw new TypeError;b=h(b);var s=q.exec(b);if(!s)return null;var e={};e.scheme=s[1]||"";if(e.scheme&&!z.test(e.scheme))return null;var y=s[2];if(y&&(y=r.exec(y),e.userinfo=y[1],e.host=y[2],e.port=y[3],e.port&&!t.test(e.port)))return null;e.path=s[3];e.query=s[4];e.fragment=s[5];!e.scheme&&g&&(e.scheme=g.scheme,!e.host&&g.host&&(e.userinfo=g.userinfo,e.host=g.host,e.port=g.port,e.pathRelative=!0));e.pathRelative&&(e.path?"/"!==e.path[0]&&(s=/^(.*\/)[^\/]*$/.exec(g.path)[1]||"/",e.path=s+e.path):
e.path=g.path);e.scheme&&(e.scheme=e.scheme.toLowerCase());e.port&&(e.port=d(e.port));e.host&&e.path&&(e.path=a(e.path));return e}function g(a,g){var s;if(g){g=g.href||g;s=b(g);if(!s||!s.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:s})}s=b(a,s);if(!s)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:s,writable:!0});var h=new e(this);Object.defineProperty(this,"query",{get:function(){return this._url?
h:null},enumerable:!0})}try{var u;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(u=new window.URL("http://www.w3.org?q")).protocol&&u.query)return}catch(v){}var q=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,r=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,z=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,t=/^\d*$/,w=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,A=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,x=/^([^?#\s]*)$/,C=/^([^\s]*)$/,s=/^\S*$/,y=/([^:]*):?(.*)/,D="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),E={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(e.prototype,{get:{value:function(a){m(a);var b;n(this._url.query).some(function(g){g=k(g);if(g[0]===a)return b=g[1],!0});return b},enumerable:!0},set:{value:function(a,b){m(a);m(b);var g=n(this._url.query);g.some(function(s,h){var d=k(s);if(d[0]===a)return d[1]=b,g[h]=f(d),!0})||g.push(f([a,b]));this._url.query=p(g)},enumerable:!0},has:{value:function(a){m(a);
return n(this._url.query).some(function(b){if(k(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){m(a);var b=n(this._url.query),g=b.filter(function(b){return k(b)[0]!==a});return g.length!==b.length?(this._url.query=p(g),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if("function"!==typeof a)throw new TypeError;var g=l(this._url,"keys+values");try{for(;;){var s=g.next();a.call(b,s[1],s[0],this)}}catch(h){if(h!==D)throw h;
}},enumerable:!0},keys:{value:function(){return l(this._url,"keys")},enumerable:!0},values:{value:function(){return l(this._url,"values")},enumerable:!0},items:{value:function(){return l(this._url,"keys+values")}},size:{get:function(){return n(this._url.query).length},enumerable:!0},getAll:{value:function(a){m(a);var b=[];n(this._url.query).forEach(function(g){g=k(g);g[0]===a&&b.push(g[1])});return b},enumerable:!0},append:{value:function(a,b){m(a);m(b);var g=n(this._url.query);g.push(f([a,b]));this._url.query=
p(g)},enumerable:!0}});Object.defineProperties(g.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(a){m(a);this._input=a;this._url=b(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){m(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||z.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){m(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){m(a);if(this._url){var b=
y.exec(this._userinfo);a=[encodeURIComponent(a||"")];b[2]&&a.push(b[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=y.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){m(a);if(this._url){var b=[y.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){m(a);if(this._url&&(a=A.exec(a)))this._url.host=a[1],this._url.port=d(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){m(a);this._url&&w.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===E[this.protocol]&&(a="");return a},set:function(a){m(a);this._url&&t.exec(a)&&(this._url.port=d(a))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(b){m(b);
this._url&&x.exec(b)&&(this._url.host&&(b&&"/"!==b[0])&&(b="/"+b),this._url.path=b?a(b):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){m(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),C.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){m(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),s.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((u=window.URL||window.webkitURL)&&u.createObjectURL)Object.defineProperty(g,"createObjectURL",{value:u.createObjectURL.bind(u),enumerable:!1}),Object.defineProperty(g,"revokeObjectURL",{value:u.revokeObjectURL.bind(u),enumerable:!1});window.URL=g})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(m,n){function p(a,b){var h=Object.keys(a),d=Object.keys(b);if(h.length!==d.length)return!1;h.sort();d.sort();for(var e=0,f=h.length;e<f;e++){var l=h[e];if(l!==d[e])return!1;var k=a[l],l=b[l];if(k!==l&&JSON.stringify(k)!==JSON.stringify(l))return!1}return!0}function k(a){if(-1===a.indexOf("://"))try{return(new URL(a,location.href)).href}catch(b){}return a}function f(a){var b=null,h={key:function(h){return(b=
b||Object.keys(a))[h]},getItem:function(b){return a[b]},setItem:function(h,d){a[h]=d;b=null},removeItem:function(h){delete a[h];b=null},clear:function(){(b=b||Object.keys(a)).forEach(function(b){delete a[b]}.bind(this));b=null}};Object.defineProperty(h,"length",{get:function(){return(b=b||Object.keys(a)).length}});return h}function l(a,b){if(b&&b instanceof XMLHttpRequest){var h,d;try{h=b.status,d=b.statusText}catch(e){h=0,d=""}return{status:h||0,statusText:d}}return b}function e(a){var b=a?JSON.parse(JSON.stringify(a,
l)):a;a instanceof Error&&(b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name);return b}function d(a,b){this.type=a;this.plugin=b}function a(a,b){this.__objectId=a;this.__methods=b}function h(b,h,f){function q(a){O&&f.postMessage(a,O)}function r(b){if(!O)return(new m).reject(Error("plugin not connected"));b.id=String($++);var g=new m;U[b.id]=g;g.then(null,function(a){"active"===G&&(a instanceof Error&&"Cancel"===a.name)&&q({requestId:b.id,method:"cancel",params:a.message?[a.message]:
[]})});var s=Object.prototype.toString;b.params.forEach(function(h,d){if("[object Object]"===s.call(h)&&!(h instanceof a)){var e,f;for(e in h)"[object Function]"===s.call(h[e])&&(f=f||[],f.push(e));if(f){var q=T++;X[q]=h;e=function(){delete X[q]};g.then(e,e);b.params[d]=new a(q,f)}}});f.postMessage(b,O);return g.promise}function l(a,b){a||0===a?q({id:a,result:null,error:b}):console.log(b)}function k(a,b,g,s){s.forEach(function(a,b){if(a&&"undefined"!==typeof a.__objectId){var g={};a.__methods.forEach(function(b){g[b]=
function(){return r({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});s[b]=g}});var h=void 0===typeof a?null:{id:a,result:null,error:null};try{var d=g.apply(b,s);h&&(d&&"function"===typeof d.then?(S[a]=d,d.then(function(b){delete S[a];h.result=b;q(h)},function(b){S[a]&&(delete S[a],h.error=e(b),q(h))},function(){q({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(h.result=d,q(h)))}catch(f){h&&(h.error=e(f),q(h))}}function w(a){try{if(a.method){var b=
a.method,g=a.params||[];if("serviceId"in a){var s=V[a.serviceId];s||l(a.id,"service not found");b in s?k(a.id,s,s[b],g):l(a.id,"method not found")}else if("objectId"in a){var h=X[a.objectId];h||l(a.id,"object not found");b in h?k(a.id,h,h[b],g):l(a.id,"method not found")}else if("requestId"in a){var d=S[a.requestId];d&&("cancel"===b&&d.cancel)&&d.cancel.apply(d,g)}else if("responseId"in a){var e=U[a.responseId];e&&("progress"===b&&e.progress)&&e.progress.apply(e,g)}else if("plugin"===a.method){O.connected();
var q=a.params[0];W({headers:q.headers,services:q.services}).then(function(){N&&N.resolve(y)})}else if("timeout"===a.method)N&&N.reject(a.error);else throw Error("Bad method: "+a.method);}else{var D=U[String(a.id)];delete U[String(a.id)];if(a.error){var u=f.handleServiceError(y,a.error);D.reject(u)}else D.resolve(a.result)}}catch(r){console.log("Plugin._messageHandler "+r)}}function A(b){var g={};if(b.methods&&(b.methods.forEach(function(a){g[a]=function(){var g={serviceId:b.serviceId,method:a,params:Array.prototype.slice.call(arguments)};
return"active"===G?r(g):y.start({"transient":!0}).then(function(){return r(g)})}}),g.addEventListener&&g.removeEventListener)){var s=new n,h=T++;X[h]={handleEvent:s.dispatchEvent.bind(s)};var d=new a(h,["handleEvent"]),e=g.addEventListener;g.addEventListener=function(a,b){s._namedListeners[a]||e(a,d);s.addEventListener(a,b)};var f=g.removeEventListener;g.removeEventListener=function(a,b){s.removeEventListener(a,b);s._namedListeners[a]||f(a,d)}}return g}function x(a){var s=JSON.parse(JSON.stringify(a.properties));
s.__plugin__=b;a=a.names||a.type||[];Array.isArray(a)||(a=[a]);s.objectClass=a;return s}function C(a){var b=A(a),g=x(a),g=f.registerService(a.names||a.type,b,g);M[a.serviceId]={registration:g,proxy:b}}function s(){f.persist(b,{created:D,headers:E,services:B,autostart:L,lastModified:H})}var y=this;h=h||{};var D=h.created||(new Date).getTime(),E=h.headers||{},B=h.services||[],L=h.autostart,H=h.lastModified||0,G="installed",I,N,O,Q,M={},$=0,T=0,S={},U={},X={},V={},W;this._default=!1;this._persist=s;
this._resolve=function(){G="resolved";f.dispatchEvent(new d("resolved",y))};this._getAutostart=function(){return L};this._getCreated=function(){return D};this.getLocation=function(){return b};this.getHeaders=function(){return JSON.parse(JSON.stringify(E))};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 H};this.getServiceReferences=function(){var a=
[];Object.keys(M).forEach(function(b){a.push(M[b].registration.getReference())});return a};this.setParent=function(a){return Q!==a?(Q=a,y.stop({"transient":!0}).then(function(){if("started"===L)return y.start({"transient":!0});if("lazy"===L)return y.start({lazy:!0,"transient":!0})})):(new m).resolve()};this.getState=function(){return G};this.start=function(a){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));if(I)return I.promise.then(this.start.bind(this,a));if("active"===
G)return(new m).resolve();if(!a||!a.transient){var h=a&&a.lazy?"lazy":"started";h!==L&&(L=h,s())}h=f.getState();if("starting"!==h&&"active"!==h)return a.transient?(new m).reject(Error("start transient error")):(new m).resolve();if("installed"===G)try{this._resolve()}catch(e){return(new m).reject(e)}"resolved"===G&&B.forEach(function(a){C(a)});if(a&&a.lazy)return"starting"!==G&&(G="starting",f.dispatchEvent(new d("lazy activation",y))),(new m).resolve();var q=new m;I=q;G="starting";f.dispatchEvent(new d("starting",
y));N=new m;O=f.connect(b,w,Q);N.then(function(){N=null;G="active";f.dispatchEvent(new d("started",y));I=null;q.resolve()},function(){N=null;G="stopping";f.dispatchEvent(new d("stopping",y));Object.keys(M).forEach(function(a){M[a].registration.unregister();delete M[a]});f.disconnect(O);O=null;G="resolved";I=null;f.dispatchEvent(new d("stopped",y));q.reject(Error("Failed to load plugin: "+b));y._default&&(H=0,s())});return q.promise};this.stop=function(a){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));
if(I)return I.promise.then(this.stop.bind(this,a));if((!a||!a.transient)&&"stopped"!==L)L="stopped",s();if("active"!==G&&"starting"!==G)return(new m).resolve();I=a=new m;G="stopping";f.dispatchEvent(new d("stopping",y));Object.keys(M).forEach(function(a){M[a].registration.unregister();delete M[a]});O&&(f.disconnect(O),O=null);G="resolved";I=null;f.dispatchEvent(new d("stopped",y));a.resolve();return a.promise};W=function(a){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));
if(!a)return 0===H&&(H=(new Date).getTime(),s()),f.loadManifest(b).then(W,function(){y._default&&(H=0,s());console.log("Failed to load plugin: "+b)});var h=E,e=B,q=L;E=a.headers||{};B=a.services||[];L=a.autostart||L;a.lastModified?H=a.lastModified:(H=(new Date).getTime(),s());if(p(E,h)&&p(B,e)&&L===q)return(new m).resolve();if("active"===G||"starting"===G){var D=[];Object.keys(B).forEach(function(a){var b=B[a];D.push(a);var g=M[a];if(g){if(p(b.methods,Object.keys(g.proxy))){a=x(b);var s=g.registration.getReference(),
h={};s.getPropertyKeys().forEach(function(a){h[a]=s.getProperty(a)});p(a,h)||g.registration.setProperties(a);return}g.registration.unregister();delete M[a]}C(b)});Object.keys(M).forEach(function(a){-1===D.indexOf(a)&&(M[a].registration.unregister(),delete M[a])})}"active"===G&&(f.disconnect(O),N=new m,O=f.connect(b,w,Q),N.then(function(){N=null},function(){N=null;G="stopping";f.dispatchEvent(new d("stopping"),y);Object.keys(M).forEach(function(a){M[a].registration.unregister();delete M[a]});f.disconnect(O);
O=null;G="resolved";f.dispatchEvent(new d("stopped",y))}));return(new m).resolve()};this.update=function(a){return W(a).then(function(){f.dispatchEvent(new d("updated",y))})};this.uninstall=function(){if("uninstalled"===G)return(new m).reject(Error("Plugin is uninstalled"));if("active"===G||"starting"===G||"stopping"===G)return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));f.removePlugin(this);G="uninstalled";f.dispatchEvent(new d("uninstalled",y));return(new m).resolve()}}
var b=/^http[s]?/i;return{Plugin:h,PluginRegistry:function(a,e){function l(a){var b=a.source;w.some(function(g){if(b===g.target){try{var h;if("undefined"===typeof g.useStructuredClone){var d="string"!==typeof a.data;h=d?a.data:JSON.parse(a.data);g.useStructuredClone=d}else h=g.useStructuredClone?a.data:JSON.parse(a.data);g.handler(h)}catch(e){}return!0}})}e=e||{};var q=e.storage||localStorage;q.getItem||(q=f(q));var r="installed",z,t=[],w=[],A=new n,x={},p={registerService:a.registerService.bind(a),
connect:function(a,b,g,h){function d(a){a=Error(a);a.name="timeout";b({method:"timeout",error:a})}var e={handler:b,url:a},f=setTimeout(d.bind(null,"Load timeout for: "+a),h||15E3),q=document.createElement("iframe");q.name=a+"_"+(new Date).getTime();q.src=a;q.onload=function(){clearTimeout(f);f=setTimeout(d.bind(null,"Plugin handshake timeout for: "+a),5E3)};q.sandbox="allow-scripts allow-same-origin";q.style.width=q.style.height="100%";q.frameBorder=0;(g||z).appendChild(q);e.target=q.contentWindow;
e.connected=function(){clearTimeout(f)};e.close=function(){clearTimeout(f);if(q){var a=q.parentNode;a&&a.removeChild(q);q=null}};w.push(e);return e},disconnect:function(a){for(var b=0;b<w.length;b++)if(a===w[b]){w.splice(b,1);try{a.close()}catch(g){}break}},removePlugin:function(a){for(var b=0;b<t.length;b++)if(a===t[b]){t.splice(b,1);break}q.removeItem("plugin."+a.getLocation())},persist:function(a,b){q.setItem("plugin."+a,JSON.stringify(b))},postMessage:function(a,b){b.target.postMessage(b.useStructuredClone?
a:JSON.stringify(a),b.url)},dispatchEvent:function(a){try{A.dispatchEvent(a)}catch(b){console&&console.log("PluginRegistry.dispatchEvent "+b)}},loadManifest:function(a){var b=new m,g=p.connect(a,function(a){g&&a.method&&("manifest"===a.method||"plugin"===a.method?(a=a.params[0],p.disconnect(g),g=null,b.resolve(a)):"timeout"===a.method&&(p.disconnect(g),g=null,b.reject(a.error)))});return b.promise},getState:function(){return r},handleServiceError:function(a,g){if(g&&401===g.status){var h=a.getHeaders(),
d=a.getName()||a.getLocation(),e=document.createElement("span");e.appendChild(document.createTextNode("Authentication required for: "+d+"."));h.login&&(e.appendChild(document.createTextNode(" ")),d=document.createElement("a"),d.target="_blank",d.textContent="Login",d.href=h.login,b.test(d.href)?(e.appendChild(d),e.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+h.login));return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(e)}}if(g.__isError){var q=
g;g=Error(q.message);Object.keys(q).forEach(function(a){g[a]=q[a]});delete g.__isError}return g}};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=p.getState;this.init=function(){if(!("starting"===r||"active"===r||"stopping"===r)){addEventListener("message",l,!1);for(var a=[],b=0,g=q.length;b<g;b++)a.push(q.key(b));a.forEach(function(a){if(0===
a.indexOf("plugin.")){var b=a.substring(7);a=JSON.parse(q.getItem(a));a.created&&t.push(new h(b,a,p))}});t.sort(function(a,b){return a._getCreated()<b._getCreated()?-1:1});e.parent?z=e.parent:(z=document.createElement("div"),e.visible||(z.style.display="none",z.style.visibility="hidden"),document.body.appendChild(z));e.plugins&&Object.keys(e.plugins).forEach(function(a){a=k(a);var b=this.getPlugin(a);b?b._default=!0:(b=e.plugins[a],"object"!==typeof b&&(b={}),b.autostart=b.autostart||e.defaultAutostart||
"lazy",b=new h(a,b,p),b._default=!0,t.push(b))}.bind(this));r="starting"}};this.start=function(){"starting"!==r&&this.init();if("starting"!==r)return(new m).reject("Cannot start framework. Framework is already "+r+".");var a=[],b=(new Date).getTime();t.forEach(function(g){var h=g._getAutostart();0===g.getLastModified()?a.push(g.update().then(function(){if("started"===h)return g.start({"transient":!0});if("lazy"===h)return g.start({lazy:!0,"transient":!0});g._resolve()})):"started"===h?a.push(g.start({"transient":!0})):
"lazy"===h?(a.push(g.start({lazy:!0,"transient":!0})),b>g.getLastModified()+864E5&&g.update()):g._resolve()});return m.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){r="active"})};this.stop=function(){if("starting"!==r&&"active"!==r)return(new m).reject("Cannot stop registry. Registry is already "+r+".");r="stopping";var a=[];t.forEach(function(b){a.push(b.stop({"transient":!0}))});return m.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){if(!e.parent){var a=
z.parentNode;a&&a.removeChild(z)}z=null;removeEventListener("message",l);r="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new m).reject("Cannot uninstall registry")};this.installPlugin=function(a,b){a=k(a);var g=this.getPlugin(a);if(g)return(new m).resolve(g);if(x[a])return x[a];if(b)return g=new h(a,b,p),t.push(g),g._persist(),p.dispatchEvent(new d("installed",g)),(new m).resolve(g);var e=p.loadManifest(a).then(function(b){g=new h(a,
b,p);t.push(g);g._persist();delete x[a];p.dispatchEvent(new d("installed",g));return g},function(b){delete x[a];throw b;});return x[a]=e};this.getPlugins=function(){return t.slice()};this.getPlugin=function(a){var b=null;a=k(a);t.some(function(g){if(a===g.getLocation())return b=g,!0});return b};this.addEventListener=A.addEventListener.bind(A);this.removeEventListener=A.removeEventListener.bind(A);this.resolvePlugins=function(){var a=!0;t.forEach(function(b){a=a&&b._resolve()});return a}}}});
define("orion/objects",[],function(){function m(m){for(var p=Object.prototype.hasOwnProperty,k=1,f=arguments.length;k<f;k++){var l=arguments[k],e;for(e in l)p.call(l,e)&&(m[e]=l[e])}return m}return{clone:function(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var p=Object.create(Object.getPrototypeOf(n));m(p,n);return p},mixin:m,toArray:function(m){return Array.isArray(m)?m:[m]}}});
define("orion/serviceTracker",[],function(){function m(k,f){function l(b){var g=b.getProperty("service.id"),h=this.addingService(b);h&&(d[g]=b,a[g]=h)}function e(b){var g=b.getProperty("service.id"),h=a[g];delete d[g];delete a[g];this.removedService(b,h)}this.serviceRegistry=k;var d={},a={},h=n,b,g;this.close=function(){if(h!==p)throw"Already closed";h=n;k.removeEventListener("registered",b);k.removeEventListener("unregistering",g);g=b=null;var a=this;this.getServiceReferences().forEach(function(b){e.call(a,
b)});if("function"===typeof this.onClose)this.onClose()};this.getServiceReferences=function(){var a=Object.keys(d);return!a.length?null:a.map(function(a){return d[a]})};this.open=function(){if(h!==n)throw"Already open";h=p;var a=this;b=function(b){if(-1!==b.serviceReference.getProperty("objectClass").indexOf(f)&&(l.call(a,b.serviceReference),"function"===typeof a.onServiceAdded))return a.onServiceAdded(b.serviceReference,a.serviceRegistry.getService(b.serviceReference))};g=function(b){-1!==b.serviceReference.getProperty("objectClass").indexOf(f)&&
e.call(a,b.serviceReference)};k.addEventListener("registered",b);k.addEventListener("unregistering",g);k.getServiceReferences(f).forEach(function(b){l.call(a,b);if("function"===typeof a.onServiceAdded)return a.onServiceAdded(b,k.getService(b))});if("function"===typeof this.onOpen)this.onOpen()}}var n=0,p=1;m.prototype={addingService:function(k){return this.serviceRegistry.getService(k)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(k,f){}};return m});
define("orion/config",["orion/Deferred","orion/objects","orion/preferences","orion/serviceTracker"],function(m,n,p,k){var f=p.PreferencesService,l,e,d,a,h=f.DEFAULT_SCOPE,b="pid",g="/cm/configurations";l=function(a,g,h){function d(a,b,h){b.forEach(function(s,d){try{var e=a[d].getProperty("__plugin__"),f=e&&g.getPlugin(e);(!e||f&&"active"===f.getState())&&b[d].updated(h)}catch(q){"undefined"!==typeof console&&console.log(q)}})}k.call(this,a,"orion.cm.managedservice");var e={},f={},l=function(g){var d=
[];g.plugin.getServiceReferences().forEach(function(g){if(-1!==g.getProperty("objectClass").indexOf("orion.cm.managedservice")){var s=g.getProperty(b);g=a.getService(g);s&&g&&(s=(s=h._find(s))&&s.getProperties(),d.push(g.updated(s)))}});return m.all(d)};this.addingService=function(g){var h=g.getProperty(b),d=a.getService(g);if(!h||!d)return null;e[h]||(e[h]=[]);f[h]||(f[h]=[]);e[h].push(g);f[h].push(d);return d};this.onServiceAdded=function(a,g){var e=a.getProperty(b),e=h._find(e);d([a],[g],e&&e.getProperties())};
this.onOpen=function(){g.addEventListener("started",l)};this.onClose=function(){g.removeEventListener("started",l)};this.notifyUpdated=function(a){var b=a.getPid();d(e[b]||[],f[b]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();d(e[a]||[],f[a]||[],null)};this.removedService=function(a,g){var h=a.getProperty(b),s=e[h],d=f[h];1<s.length?s.splice(s.indexOf(a),1):delete e[h];1<d.length?d.splice(d.indexOf(g),1):delete f[h]}};p=function(){function a(b,g,h){this.store=new e(this,h);this.configAdmin=
new d(this,this.store);this.tracker=new l(b,g,this.store)}a.prototype={getConfigurationAdmin:function(){var a=this;return this.configAdmin._init().then(function(b){a.tracker.open();return b})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();d=function(){function a(b,g){this.factory=b;this.store=g}a.prototype={_prefName:g,_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},
getDefaultConfiguration:function(a){return this.store._find(a,h)},listConfigurations:function(){return this.store.list()}};return a}();e=function(){function d(a,b){this.factory=a;this.prefsService=b;this.pref=this.configs=this.defaultConfigs=null;var e=this;this.initPromise=m.all([this.prefsService.getPreferences(g,h),this.prefsService.getPreferences(g)]).then(function(a){var b=a[0];e.pref=a[1];e.defaultConfigs=e._toConfigs(b,!0);e.configs=e._toConfigs(e.pref,!1,b)})}d.prototype={_toConfigs:function(g,
h,d){var e=Object.create(null),f=this;g.keys().forEach(function(u){if(!e[u]){var l=g.get(u),k=d&&d.get(u);"object"===typeof l&&(null!==l&&0<Object.keys(l).length)&&(l[b]=u,e[u]=new a(f.factory,f,l,h,k))}});return e},_init:function(){return this.initPromise},_find:function(a,b){return b===f.DEFAULT_SCOPE?this.defaultConfigs[a]||null:this.configs[a]||null},get:function(b){var g=this._find(b),d=this._find(b,h);g||(g=d&&d.getProperties(!0),g=new a(this.factory,this,b,!1,g),this.configs[b]=g);return g},
list:function(){var a=this,b=[];this.pref.keys().forEach(function(g){(g=a._find(g))&&null!==g.getProperties()&&b.push(g)});return b},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,b){var g=b.getProperties(!0)||{},d=this._find(a,h);if(d){var e=d.getProperties(!0);Object.keys(e).forEach(function(a){Object.prototype.hasOwnProperty.call(g,a)&&g[a]===e[a]&&delete g[a]})}this.pref.put(a,g)}};return d}();a=function(){function a(g,h){h=n.clone(h);delete h[b];g.properties=h}
function g(h,d,e,f,l){this.factory=h;this.store=d;this.readOnly=f;if(null!==e&&"object"===typeof e)this.pid=e[b],a(this,e);else if("string"===typeof e)this.pid=e,this.properties=null;else throw Error("Invalid pid/properties "+e);if(l){var k=this;Object.keys(l).forEach(function(a){a===b||Object.prototype.hasOwnProperty.call(k.properties,a)||(k.properties[a]=l[a])})}}g.prototype={_checkReadOnly:function(){if(this.readOnly)throw Error("Configuration is read only");},_checkRemoved:function(){if(this.removed)throw Error("Configuration was removed");
},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var g=null;this.properties&&(g=n.clone(this.properties),a||(g[b]=this.pid));return g},remove:function(){this._checkReadOnly();this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this.removed=!0},update:function(b){this._checkReadOnly();this._checkRemoved();a(this,b);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+
this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return g}();return{ConfigurationAdminFactory:p}});
define("orion/bootstrap","require orion/Deferred orion/serviceregistry orion/preferences orion/pluginregistry orion/config".split(" "),function(m,n,p,k,f,l){var e;return{startup:function(){if(e)return e;e=new n;var d=new p.ServiceRegistry,a=new k.PreferencesService(d);return a.getPreferences("/plugins").then(function(h){var b={plugins:{}};h.keys().forEach(function(a){var g=m.toUrl(a);b.plugins[g]=h[a]});var g=new f.PluginRegistry(d,b);return g.start().then(function(){if(0<d.getServiceReferences("orion.core.preference.provider").length)return a.getPreferences("/plugins",
a.USER_SCOPE).then(function(a){var b=[];a.keys().forEach(function(a){a=m.toUrl(a);g.getPlugin(a)||b.push(g.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return n.all(b,function(a){console.log(a)})})}).then(function(){return(new l.ConfigurationAdminFactory(d,g,a)).getConfigurationAdmin().then(d.registerService.bind(d,"orion.cm.configadmin"))}).then(function(){var a=d.getService("orion.core.auth");if(a){var b=a.getUser().then(function(b){if(b)localStorage.setItem("lastLogin",
(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),g=localStorage.getItem("lastLogin");if(!g||g<(new Date).getTime()-9E5)return b}}).then(function(){var b={serviceRegistry:d,preferences:a,pluginRegistry:g};e.resolve(b);return b})})}}});
(function(){function m(f,l,e,d,a,h){l[f]&&(e.push(f),(!0===l[f]||1===l[f])&&d.push(a+f+"/"+h))}function n(f,l,e,d,a){l=d+l+"/"+a;require._fileExists(f.toUrl(l+".js"))&&e.push(l)}function p(f,l,e){for(var d in l)l.hasOwnProperty(d)&&(!f.hasOwnProperty(d)||e)?f[d]=l[d]:"object"===typeof l[d]&&p(f[d],l[d],e)}var k=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(f){var l=f.config?f.config():{},l=l||{};return{version:"2.0.1+",load:function(e,d,a,h){h=h||{};h.locale&&(l.locale=
h.locale);var b=k.exec(e),g=b[1],f=b[4],v=b[5],q=f.split("-"),r=[],z={},t,w="";b[5]?(g=b[1],e=g+v):(v=b[4],f=l.locale,f||(f=l.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),q=f.split("-"));if(h.isBuild){r.push(e);n(d,"root",r,g,v);for(t=0;t<q.length;t++)h=q[t],w+=(w?"-":"")+h,n(d,w,r,g,v);d(r,function(){a()})}else d([e],function(b){var h=[],e;m("root",b,h,r,g,v);for(t=0;t<q.length;t++)e=q[t],w+=(w?"-":"")+e,m(w,b,h,r,g,v);d(r,function(){var s,
e,f;for(s=h.length-1;-1<s&&h[s];s--){f=h[s];e=b[f];if(!0===e||1===e)e=d(g+f+"/"+v);p(z,e)}a(z)})})}}})})();
define("orion/i18n",[],function(){return{load:function(m,n,p,k){k=k||{};var f=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,l=f.exec(m);if(l){if(!n.defined||n.defined(m))try{p(n(m));return}catch(e){}if(k.isBuild||k.isTest)p({});else if(n.specified&&!n.specified("orion/bootstrap"))p({});else{var d=l[1],a=l[3]?l[2]:"",h=l[3]||l[2];n(["orion/bootstrap"],function(b){b.startup().then(function(b){var e=b.serviceRegistry;b=e.getServiceReferences("orion.i18n.message");if(a)b.some(function(a){return m===a.getProperty("name")?
(e.getService(a).getMessageBundle().then(function(a){p(a)},function(){p({})}),!0):!1})||p({});else{var v={},q;b.forEach(function(b){var g=b.getProperty("name");if((l=f.exec(g))&&d===l[1]&&h===(l[3]||l[2]))if(a=l[3]?l[2]:""){if((b=k.locale||("undefined"!==typeof navigator?navigator.language||navigator.userLanguage:null))&&0===b.toLowerCase().indexOf(a.toLowerCase()))v[a]=!0,(!n.specified||!n.specified(g))&&define(g,["orion/i18n!"+g],function(a){return a})}else q=b});!n.specified||!n.specified(m)?q?
e.getService(q).getMessageBundle().then(function(a){Object.keys(v).forEach(function(b){"undefined"===typeof a[b]&&(a[b]=v[b])});define(m,[],a);p(a)},function(){define(m,[],v);p(v)}):(define(m,[],v),p(v)):p(v)}})})}}else p(null)}}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/util",[],function(){var m=navigator.userAgent,n=-1!==m.indexOf("MSIE")||-1!==m.indexOf("Trident")?document.documentMode:void 0,p=parseFloat(m.split("Firefox/")[1]||m.split("Minefield/")[1])||void 0,k=-1!==m.indexOf("Opera")?parseFloat(m.split("Version/")[1]):void 0,f=parseFloat(m.split("Chrome/")[1])||void 0,l=-1!==m.indexOf("Safari")&&!f,e=parseFloat(m.split("WebKit/")[1])||void 0,d=-1!==m.indexOf("Android"),a=-1!==m.indexOf("iPad"),m=-1!==m.indexOf("iPhone"),h=a||m,b=-1!==navigator.platform.indexOf("Mac"),
g=-1!==navigator.platform.indexOf("Win"),u=-1!==navigator.platform.indexOf("Linux"),v="undefined"!==typeof document&&"ontouchstart"in document.createElement("input");return{formatMessage:function(a){var b=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,g){return b[(g<<0)+1]})},createElement:function(a,b){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",b):a.createElement(b)},isIE:n,isFirefox:p,isOpera:k,isChrome:f,isSafari:l,isWebkit:e,isAndroid:d,isIPad:a,isIPhone:m,
isIOS:h,isMac:b,isWindows:g,isLinux:u,isTouch:v,platformDelimiter:g?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(m){function n(a,h){h||(h=document);return h.querySelectorAll(a)}function p(a){var h=a.tabIndex;0===h&&m.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[a.nodeName.toLowerCase()]&&!a.attributes.tabIndex&&(h=-1);return h}function k(a){if(0<=p(a))return a;if(a.hasChildNodes())for(var h=0;h<a.childNodes.length;h++){var b=k(a.childNodes[h]);if(b)return b}return null}function f(a){if(0<=
p(a))return a;if(a.hasChildNodes())for(var h=a.childNodes.length-1;0<=h;h--){var b=f(a.childNodes[h]);if(b)return b}return null}function l(a,h){if(3===a.nodeType){var b=e.exec(a.nodeValue);b&&1<b.length&&h(a,b)}if(a.hasChildNodes())for(b=0;b<a.childNodes.length;b++)l(a.childNodes[b],h)}var e=/\$\{([^\}]+)\}/,d=null;return{$:function(a,h){h||(h=document);return h.querySelector(a)},$$:n,$$array:function(a,h){return Array.prototype.slice.call(n(a,h))},node:function(a){var h=a;"string"===typeof a&&(h=
document.getElementById(a));return h},contains:function(a,h){if(!a||!h)return!1;if(a===h)return!0;var b=a.compareDocumentPosition(h);return Boolean(b&16)},bounds:function(a){a=a.getBoundingClientRect();return{left:a.left+document.documentElement.scrollLeft,top:a.top+document.documentElement.scrollTop,width:a.width,height:a.height}},empty:function(a){for(;a.hasChildNodes();)a.removeChild(a.firstChild)},firstTabbable:k,lastTabbable:f,stop:function(a){window.document.all&&(a.keyCode=0);a.preventDefault&&
(a.preventDefault(),a.stopPropagation())},processTextNodes:function(a,h){l(a,function(a,g){a.parentNode.replaceChild(document.createTextNode(h[g[1]]||g[1]),a)})},processDOMNodes:function(a,h){l(a,function(a,g){var d=h[g[1]];if(d){var e=document.createRange(),f=g.index;e.setStart(a,f);e.setEnd(a,f+g[0].length);e.deleteContents();e.insertNode(d)}})},addAutoDismiss:function(a,h){function b(a){d.forEach(function(b){var h=!1,d=b.excludeNodes.some(function(b){return document.body.contains(b)?(h=!0,b.contains(a.target)):
!1});if(h&&!d)try{b.dismiss(a)}catch(e){"undefined"!==typeof console&&console&&console.error(e&&e.message)}});d=d.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}null===d&&(d=[],document.addEventListener("click",b,!0),m.isIOS&&document.addEventListener("touchend",function(a){function b(){a.target.removeEventListener("click",b)}0===a.touches.length&&a.target.addEventListener("click",b)},!1));d.push({excludeNodes:a,dismiss:h})},setFramesEnabled:function(a){for(var h=
document.getElementsByTagName("iframe"),b=0;b<h.length;b++)h[b].parentNode.style.pointerEvents=a?"":"none"},removeAutoDismiss:function(a){d=d.filter(function(h){return a!==h.dismiss})},KEY:{BKSPC:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(m,n,p){function k(e){p.attach(this);this._init(e)}function f(e,d){var a=document.createElement(void 0===d?"span":d);a.tabIndex=0;a.className="dropdownMenuItem";a.role="menuitem";var h=document.createElement("span");h.appendChild(document.createTextNode(e));h.classList.add("dropdownCommandName");a.appendChild(h);h=document.createElement("li");h.appendChild(a);return h}function l(){var e=document.createElement("li");
e.classList.add("dropdownSeparator");return e}k.prototype={_init:function(e){this._dropdownNode=n.node(e.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=e.populate;this._selectionClass=e.selectionClass;this._parentDropdown=e.parentDropdown;this._positioningNode=e.positioningNode;if(!this._parentDropdown)for(var d=this._dropdownNode.parentNode;d&&document!==d;){if(d.classList&&d.classList.contains("dropdownMenu")){this._parentDropdown=d.dropdown;break}d=d.parentNode}this._dropdownNode.tabIndex=
0;this._triggerNode=e.triggerNode?e.triggerNode:n.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!e.skipTriggerEventListeners){var a=this;this._triggerNode.addEventListener("click",function(h){a.toggle(h)&&n.stop(h)},!1);"span"===this._triggerNode.tagName.toLowerCase()&&this._triggerNode.addEventListener("keydown",function(h){if(h.keyCode===n.KEY.ENTER||h.keyCode===n.KEY.SPACE)a.toggle(),n.stop(h)},!1)}this._dropdownNode.addEventListener("keydown",
this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(e){var d=this;e.addEventListener("click",function(a){d.toggle(a)&&n.stop(a)},!1)},toggle:function(e){return this.isVisible()?this.close():this.open(e)},isVisible:function(){return this._isVisible},open:function(e){var d=!1;this.isVisible()||(this.dispatchEvent({type:"triggered",dropdown:this,event:e}),n.setFramesEnabled(!1),this._populate&&(this.empty(),this._populate(this._dropdownNode)),0<this.getItems().length&&(this._hookedAutoDismiss||
(this._boundAutoDismiss?n.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),d=n.$$array(".dropdownSubMenu",this._dropdownNode),n.addAutoDismiss([this._triggerNode].concat(d),this._boundAutoDismiss),this._hookedAutoDismiss=!0),this._triggerNode.classList.add("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.add(this._selectionClass),this._dropdownNode.classList.add("dropdownMenuOpen"),this._isVisible=!0,this._positionDropdown(e),this._focusDropdownNode(),
d=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)));return d},_focusDropdownNode:function(){this._dropdownNode.focus()},_autoDismiss:function(e){if(this.close(!1)&&this._dropdownNode.contains(e.target))for(e=this._parentDropdown;e;)e.close(!1),e=e._parentDropdown},_positionDropdown:function(e){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px";else{e=n.bounds(this._dropdownNode);
var d=n.bounds(document.body);if(e.left+e.width>d.left+d.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-e.width+"px";else{var a=n.bounds(this._boundingNode(this._triggerNode)),h=n.bounds(this._triggerNode);this._dropdownNode.style.left=h.left-a.left-e.width+h.width+"px"}e=e.top+e.height-(d.top+d.height);0<e&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-e)+"px")}},_boundingNode:function(e){var d=window.getComputedStyle(e,null);
return null===d||"absolute"===d.getPropertyValue("position")||!e.parentNode||e===document.body?e:this._boundingNode(e.parentNode)},close:function(e){var d=!1;this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),n.setFramesEnabled(!0),e&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),
this._selectedItem=null),d=!0);return d},getItems:function(){var e=[],d=this;n.$$array("li:not(.dropdownSeparator) \x3e .dropdownMenuItem",this._dropdownNode,!0).forEach(function(a){a.parentNode.parentNode===d._dropdownNode&&e.push(a)});e.forEach(function(a){a._hasDropdownMouseover||(a.addEventListener("mouseover",function(h){a.dropdown?a.dropdown.open(h):(d._closeSelectedSubmenu(),n.stop(h));d._selectItem(a)}),a._hasDropdownMouseover=!0)});return e},empty:function(){var e=this;n.$$array("li",this._dropdownNode).forEach(function(d){d.parentNode===
e._dropdownNode&&d.parentNode.removeChild(d)});this._hookedAutoDismiss=!1},_dropdownKeyDown:function(e){if(e.keyCode===n.KEY.UP||e.keyCode===n.KEY.DOWN||e.keyCode===n.KEY.RIGHT||e.keyCode===n.KEY.ENTER||e.keyCode===n.KEY.LEFT){var d=this.getItems();if(d.length&&0<d.length){if(this._selectedItem){var a=d.indexOf(this._selectedItem);0>a&&(a=d.indexOf(this._selectedItem.parentNode));0<=a&&(e.keyCode===n.KEY.UP&&0<a?(a--,this._selectItem(d[a])):e.keyCode===n.KEY.DOWN&&a<d.length-1?(a++,this._selectItem(d[a])):
e.keyCode===n.KEY.ENTER||e.keyCode===n.KEY.RIGHT?this._selectedItem.classList.contains("dropdownTrigger")&&this._selectedItem.dropdown?(this._selectedItem.dropdown.open(),this._selectedItem.dropdown._selectItem()):e.keyCode===n.KEY.ENTER&&this._selectedItem.click():e.keyCode===n.KEY.LEFT&&this._selectedItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&(this.close(!0),this._parentDropdown&&this._parentDropdown._dropdownNode.focus()))}else this._selectItem(d[0]);n.stop(e)}}else e.keyCode===
n.KEY.ESCAPE&&(this.close(!0),n.stop(e))},_selectItem:function(e){if(e=e||this.getItems()[0])this._selectedItem&&this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=e,this._selectedItem.classList.add("dropdownMenuItemSelected");document.activeElement!==this._dropdownNode&&this._dropdownNode.focus()},submenuOpen:function(e){e!==this._selectedSubmenu&&(this._closeSelectedSubmenu(),this._selectedSubmenu=e)},_closeSelectedSubmenu:function(){for(var e=this._selectedSubmenu;e;)e.close(),
e=e._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&n.removeAutoDismiss(this._boundAutoDismiss)},appendMenuItem:function(e,d){var a=f(e,d);this._dropdownNode.appendChild(a);return a},appendSeparator:function(){var e=l();this._dropdownNode.appendChild(e);return e}};k.prototype.constructor=k;return{Dropdown:k,appendKeyBindingString:function(e,d){var a=document.createElement("span");a.classList.add("dropdownKeyBinding");a.appendChild(document.createTextNode(d));e.appendChild(a)},
createMenuItem:f,createSeparator:l}});
define("text",["module"],function(m){var n,p,k=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],f=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,l=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,e="undefined"!==typeof location&&location.href,d=e&&location.protocol&&location.protocol.replace(/\:/,""),a=e&&location.hostname,h=e&&(location.port||void 0),b=[],g=m.config&&m.config()||{};n={version:"2.0.5",strip:function(a){if(a){a=a.replace(f,"");var b=a.match(l);b&&(a=b[1])}else a="";return a},
jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:g.createXhr||function(){var a,b,g;if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!==typeof ActiveXObject)for(b=0;3>b;b+=1){g=k[b];try{a=new ActiveXObject(g)}catch(h){}if(a){k=[g];break}}return a},parseName:function(a){var b,
g,h=!1,d=a.indexOf(".");b=0===a.indexOf("./")||0===a.indexOf("../");-1!==d&&(!b||1<d)?(b=a.substring(0,d),g=a.substring(d+1,a.length)):b=a;a=g||b;d=a.indexOf("!");-1!==d&&(h="strip"===a.substring(d+1),a=a.substring(0,d),g?g=a:b=a);return{moduleName:b,ext:g,strip:h}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,b,g,h){var d,e;d=n.xdRegExp.exec(a);if(!d)return!0;a=d[2];d=d[3];d=d.split(":");e=d[1];d=d[0];return(!a||a===b)&&(!d||d.toLowerCase()===g.toLowerCase())&&(!e&&!d||e===h)},finishLoad:function(a,
h,d,e){d=h?n.strip(d):d;g.isBuild&&(b[a]=d);e(d)},load:function(b,f,q,l){if(l.isBuild&&!l.inlineText)q();else{g.isBuild=l.isBuild;var k=n.parseName(b);l=k.moduleName+(k.ext?"."+k.ext:"");var t=f.toUrl(l),w=g.useXhr||n.useXhr;!e||w(t,d,a,h)?n.get(t,function(a){n.finishLoad(b,k.strip,a,q)},function(a){q.error&&q.error(a)}):f([l],function(a){n.finishLoad(k.moduleName+"."+k.ext,k.strip,a,q)})}},write:function(a,g,h,d){b.hasOwnProperty(g)&&(d=n.jsEscape(b[g]),h.asModule(a+"!"+g,"define(function () { return '"+
d+"';});\n"))},writeFile:function(a,b,g,h,d){b=n.parseName(b);var e=b.ext?"."+b.ext:"",f=b.moduleName+e,l=g.toUrl(b.moduleName+e)+".js";n.load(f,g,function(b){b=function(a){return h(l,a)};b.asModule=function(a,b){return h.asModule(a,l,b)};n.write(a,f,b,d)},d)}};if("node"===g.env||!g.env&&"undefined"!==typeof process&&process.versions&&process.versions.node)p=require.nodeRequire("fs"),n.get=function(a,b){var g=p.readFileSync(a,"utf8");0===g.indexOf("\ufeff")&&(g=g.substring(1));b(g)};else if("xhr"===
g.env||!g.env&&n.createXhr())n.get=function(a,b,h,d){var e=n.createXhr(),f;e.open("GET",a,!0);if(d)for(f in d)d.hasOwnProperty(f)&&e.setRequestHeader(f.toLowerCase(),d[f]);if(g.onXhr)g.onXhr(e,a);e.onreadystatechange=function(g){4===e.readyState&&(g=e.status,399<g&&600>g?(g=Error(a+" HTTP status: "+g),g.xhr=e,h(g)):b(e.responseText))};e.send(null)};else if("rhino"===g.env||!g.env&&"undefined"!==typeof Packages&&"undefined"!==typeof java)n.get=function(a,b){var g,h,d=new java.io.File(a),e=java.lang.System.getProperty("line.separator"),
d=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(d),"utf-8")),f="";try{g=new java.lang.StringBuffer;(h=d.readLine())&&(h.length()&&65279===h.charAt(0))&&(h=h.substring(1));for(null!==h&&g.append(h);null!==(h=d.readLine());)g.append(e),g.append(h);f=String(g.toString())}finally{d.close()}b(f)};return n});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger"\x3e${ButtonText}\x3c!--span class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span--\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});
define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger dropdownDefaultButton"\x3e${ButtonText}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});define("text!orion/webui/submenutriggerbutton.html",[],function(){return'\x3cli class\x3d"dropdownSubMenu"\x3e\x3cspan class\x3d"dropdownTrigger dropdownMenuItem" role\x3d"menuitem" tabindex\x3d"0"\x3e\x3cspan class\x3d"dropdownCommandName"\x3e${ButtonText}\x3c/span\x3e\x3cspan class\x3d"dropdownArrowRight core-sprite-closedarrow"\x3e\x3c/span\x3e\x3c/span\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e\x3c/li\x3e'});
define("text!orion/webui/checkedmenuitem.html",[],function(){return'\x3cli\x3e\x3clabel class\x3d"dropdownMenuItem"\x3e\x3cinput class\x3d"checkedMenuItem" role\x3d"menuitem" type\x3d"checkbox" /\x3e${ItemText}\x3c/label\x3e\x3c/li\x3e'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(m,n){function p(k){this._init(k)}p.prototype={_init:function(k){this._node=n.node(k.node);if(!this._node)throw"no dom node for tooltip found";this._position=k.position||["right","above","below","left"];this._text=k.text;this._hideDelay=void 0===k.hideDelay?200:k.hideDelay;this._tailSize=k.tailSize||10;this._trigger=k.trigger||"mouseover";this._afterShowing=k.afterShowing;this._afterHiding=k.afterHiding;var f=this;if("click"===
this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(e){e.target===f._node&&(f.show(),n.stop(e))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===k.showDelay?500:k.showDelay;k=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(e){n.contains(f._node,e.target)&&(f.show(),n.stop(e))},!1);this._leaveHandler=function(e){n.contains(f._node,e.target)&&f.hide()};for(var l=0;l<k.length;l++)this._node.addEventListener(k[l],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text){this._tipTextContent=document.createElement("div");this._tipTextContent.classList.add("textContent");this._tipInner.appendChild(this._tipTextContent);var k=document.createTextNode(this._text);this._tipTextContent.appendChild(k)}this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var f=this;n.addAutoDismiss([this._tip,this._node],function(){f.hide()});"mouseover"===this._trigger&&(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(l){f._timeout&&(window.clearTimeout(f._timeout),f._timeout=null);f._tip.addEventListener("mouseout",function(e){n.contains(f._tip,e.target)&&(f.hide(),n.stop(e))},
!1)},!1))}return this._tip},_positionTip:function(k,f){this._makeTipNode();"left"===k?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var l=this._node,e;for(e=n.bounds(l);l&&!e.width&&!e.height;l=l.parentNode)e=n.bounds(l);var l=n.bounds(this._tipInner),d;switch(k){case "above":d=e.top-l.height-this._tailSize-1;e=e.left-this._tailSize;break;case "below":d=e.top+e.height+this._tailSize+1;e=e.left-this._tailSize;break;case "left":d=e.top-this._tailSize/2;e=e.left-l.width-
this._tailSize-1;break;default:d=e.top-this._tailSize/2,e=e.left+e.width+this._tailSize+1}var a=n.bounds(document.documentElement);if(d+l.height>a.height)if(f)d=a.height-l.height-1;else return!1;if(e+l.width>a.width)if(f)e=a.width-l.width-1;else return!1;if(0>e)if(f)e=4;else return!1;if(0>d)if(f)d=4;else return!1;this._tail&&this._tail.previousPosition!==k&&(this._tip.removeChild(this._tail),this._tail=null);this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+
k),"above"===k||"left"===k?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),this._tail.previousPosition=k);this._tip.style.top=d+"px";this._tip.style.left=e+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing"))this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),this._showDelay?this._timeout=window.setTimeout(this._showImmediately.bind(this),
this._showDelay):this._showImmediately()},_showImmediately:function(){for(var k=!1,f=0;!k&&f<this._position.length;)k=this._positionTip(this._position[f]),f++;k||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(k){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);if(this._tip&&this._tip.classList.contains("tooltipShowing")){void 0===k&&(k=this._hideDelay);var f=this;this._timeout=window.setTimeout(function(){f._tip.classList.remove("tooltipShowing");
f._tip.removeAttribute("style");f._afterHiding&&f._afterHiding()},k)}},destroy:function(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);this._tip&&(document.body.removeChild(this._tip),this._tail=this._tipTextContent=this._tipInner=this._tip=null);if(this._node){this._node.removeEventListener("click",this._clickHandler,!1);this._node.removeEventListener("mouseover",this._mouseoverHandler,!1);for(var k=["mouseout","click"],f=0;f<k.length;f++)this._node.removeEventListener(k[f],
this._leaveHandler,!1)}}};p.prototype.constructor=p;return{Tooltip:p}});
define("orion/commands","orion/util orion/webui/littlelib orion/webui/dropdown text!orion/webui/dropdowntriggerbutton.html text!orion/webui/dropdowntriggerbuttonwitharrow.html text!orion/webui/submenutriggerbutton.html text!orion/webui/checkedmenuitem.html orion/webui/tooltip".split(" "),function(m,n,p,k,f,l,e,d){function a(a){var b=a.invocation;if(b){var g=a.command;if(g.hrefCallback)return a=g.hrefCallback.call(b.handler||window,b),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;if(b.commandRegistry)return b.commandRegistry._invoke(b),
!0;if(g.onClick||g.callback)return window.setTimeout(function(){(g.onClick||g.callback).call(b.handler||window,b)},0),!0}return!1}function h(b,g){for(var h in g)if(g[h]&&(g[h].keyBinding&&g[h].command)&&g[h].keyBinding.match(b)){var s=g[h],d=s.keyBinding;if((!d.domScope||n.contains(n.node(d.domScope),b.target))&&a(s)){n.stop(b);break}}}function b(){var a={};if(t){var b,g,s;g=Object.keys(w);for(b=0;b<g.length;b++)s=g[b],a[s]=w[s];var h=t();g=Object.keys(h);for(b=0;b<g.length;b++)s=g[b],a[s]=h[s]}else a=
w;return a}function g(a){h(a,b())}function u(a,b){a=a||window.event;if(function(a){if(m.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.ctrlKey)return!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return 0<a["char"].length;if(a.charCode||a.keyCode)switch(a=a.charCode||
a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return 32<=a&&112>a||123<a}return!1}(a)){if("true"===a.target.contentEditable)return;var h=a.target.nodeName.toLowerCase();if("input"===h)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("textarea"===h)return}b?b(a):g(a)}function v(){this._init()}
function q(a,b,g){b.classList.add("commandImage");var h;a.imageClass?a.addImageClassToElement?b.classList.add(a.imageClass):(h=document.createElement("span"),b.appendChild(h),h.classList.add(a.spriteClass),h.classList.add(a.imageClass)):(h=new Image,h.alt=a.name,h.name=g,h.id=g,h.src=a.image,b.appendChild(h));return h}function r(a,b,g,h,d){this.commandRegistry=d;this.handler=a;this.items=b;this.userData=g;this.command=h;h.parameters&&(this.parameters=h.parameters.makeCopy());this.id=h.id}function z(a){this._init(a)}
var t=null,w={};v.prototype={setProxy:function(a){this.proxy=a},setKeyBindings:function(a){this.bindings=a},_init:function(){var a=this;document.addEventListener("keydown",function(b){return u(b,function(b){var g=a.proxy,h=a.bindings;if(h&&g)for(var d=0;d<h.length;d++)h[d].match(b)&&(g.processKey({type:b.type,keyCode:b.keyCode,altKey:b.altKey,ctrlKey:b.ctrlKey,metaKey:b.metaKey,shiftKey:b.shiftKey}),n.stop(b))})})}};window.document.addEventListener("keydown",u,!1);r.prototype={collectsParameters:function(){return this.commandRegistry&&
this.commandRegistry.collectsParameters()},makeCopy:function(a){var b=new r(this.handler,this.items,this.userData,this.command,this.commandRegistry);b.domNode=this.domNode;b.domParent=this.domParent;a?b.parameters=a.makeCopy():this.parameters&&(b.parameters=this.parameters.makeCopy());return b}};r.prototype.constructor=r;z.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;
this.positioningNode=a.positioningNode;this.image=a.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.extraClass=a.extraClass;this.selectionClass=a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters;this.isEditor=a.isEditor},populateChoicesMenu:function(a,
b,g,h,d){g=this.getChoices(b,g,h);var e=g.some(function(a){return a.checked});g.forEach(function(g){if(g.name){var h=document.createElement("li");a.appendChild(h);var s=document.createElement("span");s.tabIndex=0;s.role="menuitem";s.classList.add("dropdownMenuItem");if(e){var f=document.createElement("span");f.classList.add("check");f.appendChild(document.createTextNode(g.checked?"\u25cf":""));s.appendChild(f)}f=document.createTextNode(g.name);s.appendChild(f);h.appendChild(s);s.choice=g;s.addEventListener("click",
function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1);s.addEventListener("keydown",function(a){(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,b)},!1)}else d._generateMenuSeparator(a)})},getChoices:function(a,b,g){return this.choiceCallback?this.choiceCallback.call(b,a,g):null},makeChoiceCallback:function(a,b){return function(g){a.callback&&a.callback.call(a,b,g)}},hasImage:function(){return this.imageClass||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"!==this.image}};z.prototype.constructor=z;return{Command:z,CommandInvocation:r,createDropdownMenu:function(a,b,g,h,d,e,u,l,r){a=n.node(a);if(!a)throw"no parent node was specified";var v=document.createRange();v.selectNode(a);v=r?v.createContextualFragment(f):v.createContextualFragment(k);n.processTextNodes(v,{ButtonText:b});a.appendChild(v);a=a.lastChild;
var z;r?(r=a.previousSibling,z=r.lastChild):r=a.previousSibling;h?r.classList.add(h):(r.classList.add("orionButton"),r.classList.add("commandButton"));d&&(e||(r.textContent="",r.setAttribute("aria-label",b)),q({spriteClass:"commandSprite",imageClass:d},r,b),r.classList.add("orionButton"));r.dropdown=new p.Dropdown({dropdown:a,populate:g,selectionClass:u,skipTriggerEventListeners:!!z,positioningNode:l});a.dropdown=r.dropdown;return{menuButton:r,menu:a,dropdown:r.dropdown,dropdownArrow:z}},createCheckedMenuItem:function(a,
b,g,h){a=n.node(a);if(!a)throw"no parent node was specified";var d=document.createRange();d.selectNode(a);d=d.createContextualFragment(e);n.processTextNodes(d,{ItemText:b});a.appendChild(d);a=n.$(".checkedMenuItem",a.lastChild);a.checked=g;a.addEventListener("change",h,!1);return a},createCommandItem:function(a,b,g,h,e,f,u){var l;f=f||!b.name&&b.hasImage();if(b.hrefCallback)l=document.createElement("a"),l.id=h,f&&b.hasImage()?q(b,l,h):(l.className="commandLink",l.appendChild(document.createTextNode(b.name))),
u=b.hrefCallback.call(g.handler,g),u.then?u.then(function(a){l.href=a}):l.href=u?u:"#";else{l=document.createElement("button");l.className="orionButton";b.extraClass&&l.classList.add(b.extraClass);f?b.hasImage()?(q(b,l,h),b.name&&l.setAttribute("aria-label",b.name)):(l.classList.add("commandButton"),l.classList.add("commandMissingImageButton"),l.appendChild(document.createTextNode(b.name))):(l.classList.add("commandButton"),h=document.createTextNode(b.name),l.appendChild(h));var r=u||b.callback;r&&
(b.onClick=r,l.addEventListener("click",function(a){r.call(g.handler,g)},!1))}"ul"===a.nodeName.toLowerCase()?(u=document.createElement("li"),a.appendChild(u),a=u):l.classList.add("commandMargins");a.appendChild(l);b.tooltip&&(l.commandTooltip=new d.Tooltip({node:l,text:b.tooltip,position:["above","below","right","left"]}));e&&(w[b.id]={keyBinding:e,command:b,invocation:g});return l},createCommandMenuItem:function(a,b,g,h,e,f){var q,u,l=a.dropdown;if(b.hrefCallback)u=p.createMenuItem(b.name,"a"),
q=u.firstElementChild,e=b.hrefCallback.call(g.handler,g),e.then?e.then(function(a){q.href=a}):q.href=e?e:"#",q.addEventListener("keydown",function(a){(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)&&q.click()},!1);else{u=p.createMenuItem(b.name);q=u.firstElementChild;var r=e||b.callback;r&&(b.onClick=r,q.addEventListener("click",function(a){l.close(!0);r.call(g.handler,g)},!1),q.addEventListener("keydown",function(a){if(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)a.preventDefault(),q.click()},
!1))}b.tooltip&&(q.commandTooltip=new d.Tooltip({node:q,text:b.tooltip,position:["above","below","right","left"]}));f&&p.appendKeyBindingString(q,f);a.appendChild(u);h&&(w[b.id]={keyBinding:h,command:b,invocation:g});return q},executeBinding:a,setKeyBindingProvider:function(a){t=a},localKeyBindings:w,CommandsProxy:v,getKeyBindings:b,processKey:g,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",
_testMethodProcessKey:h}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Editor":"Orion Markdown Editor","Orion Markdown Viewer":"Orion Markdown Viewer",
"Orion JSON Editor":"Orion JSON Editor","View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"2014-06-28_22-01-29","LOG: ":"LOG: ",View:"View","no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ","Resource is out of sync with the server. Do you want to save it anyway?":"Resource is out of sync with the server. Do you want to save it anyway?",
Operations:"Operations","Operations running":"Operations running","Some operations finished with warning":"Some operations finished with warning","Some operations finished with error":"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Recent searches":"Recent searches","Regular expression":"Regular expression",
"Search options":"Search options","Global search":"Global search","Orion Home":"Orion Home","Close notification":"Close notification","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site",
"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plugin","Generate a sample plugin for integrating with Orion.":"Generate a sample plugin for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* \x3d any string, ? \x3d any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/uiUtils",["orion/webui/littlelib"],function(m){function n(k){var f="",l=-1!==navigator.platform.indexOf("Mac");l?(k.mod4&&(f+="\u2303"),k.mod3&&(f+="\u2325"),k.mod2&&(f+="\u21e7"),k.mod1&&(f+="\u2318")):(k.mod1&&(f+="Ctrl+"),k.mod2&&(f+="Shift+"),k.mod3&&(f+="Alt+"));if(k.alphaKey)return f+k.alphaKey;if("keypress"===k.type)return f+k.keyCode;for(var e in m.KEY)if(typeof("number"===m.KEY[e])&&m.KEY[e]===k.keyCode){if(l)switch(m.KEY[e]){case m.KEY.BKSPC:e="\u232b";break;case m.KEY.TAB:e=
"\u21e5";break;case m.KEY.ENTER:e="\u23ce";break;case m.KEY.ESCAPE:e="\u238b";break;case m.KEY.SPACE:e="\u2423";break;case m.KEY.PAGEUP:e="\u21de";break;case m.KEY.PAGEDOWN:e="\u21df";break;case m.KEY.END:e="\u21f2";break;case m.KEY.HOME:e="\u21f1";break;case m.KEY.DEL:e="\u2326"}switch(m.KEY[e]){case m.KEY.DOWN:e="\u2193";break;case m.KEY.UP:e="\u2191";break;case m.KEY.RIGHT:e="\u2192";break;case m.KEY.LEFT:e="\u2190"}return f+e}var d;switch(k.keyCode){case 59:d=k.mod2?":":";";break;case 61:d=k.mod2?
"+":"\x3d";break;case 188:d=k.mod2?"\x3c":",";break;case 190:d=k.mod2?"\x3e":".";break;case 191:d=k.mod2?"?":"/";break;case 192:d=k.mod2?"~":"`";break;case 219:d=k.mod2?"{":"[";break;case 220:d=k.mod2?"|":"\\";break;case 221:d=k.mod2?"}":"]";break;case 222:d=k.mod2?'"':"'"}return d?f+d:112<=k.keyCode&&123>=k.keyCode?f+"F"+(k.keyCode-111):f+String.fromCharCode(k.keyCode)}function p(k){var f=-1!==window.navigator.platform.indexOf("Mac");return f&&k.metaKey||!f&&k.ctrlKey}return{getUserKeyString:function(k){var f=
"";k=k.getKeys();for(var l=0;l<k.length;l++)0!==l&&(f+=" "),f+=n(k[l]);return f},getUserText:function(k){var f=k.id,l=k.refNode,e=k.hideRefNode,d=k.initialText,a=k.onComplete,h=k.onEditDestroy,b=k.selectTo,g=k.isInitialValid;k=k.insertAsChild;var u=!1,v=function(b){return function(q){if(!u){var k=m.node(f),v=k.value;k&&(b&&q.keyCode===m.KEY.ESCAPE?(e&&(l.style.display="inline"),u=!0,k.parentNode.removeChild(k),h&&h()):b&&q.keyCode!==m.KEY.ENTER||(0===v.length||!g&&v===d?e&&(l.style.display="inline"):
(a(v),e&&l.parentNode&&(l.style.display="inline")),u=!0,k.parentNode&&k.parentNode.removeChild(k),h&&h()))}}},q=document.createElement("input");q.id=f;q.value=d||"";k?l.appendChild(q):l.parentNode.insertBefore(q,l.nextSibling);q.classList.add("userEditBoxPrompt");e&&(l.style.display="none");q.addEventListener("keydown",v(!0),!1);q.addEventListener("blur",v(!1),!1);window.setTimeout(function(){q.focus();if(d){var a=m.node(f),g=b?d.indexOf(b):-1;0<g?a.createTextRange?(a=a.createTextRange(),a.collapse(!0),
a.moveStart("character",0),a.moveEnd("character",g),a.select()):a.setSelectionRange?a.setSelectionRange(0,g):void 0!==a.selectionStart&&(a.selectionStart=0,a.selectionEnd=g):a.select()}},0)},openInNewWindow:p,followLink:function(k,f){f&&p(f)?window.open(k):window.location=k},createButton:function(k,f){var l=document.createElement("button");l.className="orionButton commandButton commandMargins";l.addEventListener("click",function(e){f();m.stop(e)},!1);k&&l.appendChild(document.createTextNode(k));return l},
createDropdownButton:function(k,f,l){},isFormElement:function(k){switch(k.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(m,n){function p(k,f){f||(f="orion.page.selection");this._serviceRegistry=k;m.attach(this);this._serviceRegistration=k.registerService(f,this);this._selections=null}p.prototype={getSelection:function(k){var f=this._getSingleSelection();"function"===typeof k&&k(f);return f},getSelections:function(k){var f=Array.isArray(this._selections)?this._selections.slice():[];"function"===typeof k&&k(f);return f},_getSingleSelection:function(){return this._selections&&
0<this._selections.length?this._selections[0]:null},setSelections:function(k){var f=this._selections;Array.isArray(k)?this._selections=0<k.length?k.slice():null:this._selections=k?[k]:null;f!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};p.prototype.constructor=p;return{Selection:p}});
define("orion/explorers/navigationUtils",[],function(){function m(m,k,f,l){!n&&m&&(m.push({domNode:k}),k.tabIndex=-1,k.style.outline="none")}var n=-1!==navigator.userAgent.indexOf("iPad");return{addNavGrid:function(p,k,f){p&&(p=p.getGridNavHolder(k,!0))&&m(p,f)},generateNavGrid:m,removeNavGrid:function(m,k){if(m)for(var f=0;f<m.length;f++)if(m[f].domNode===k){m.splice(f,1);break}}}});
define("orion/PageUtil",[],function(){var m=/^http[s]?/i;return{hash:function(){var m=window.location.href.split("#")[1];return m?"#"+m:""},matchResourceParameters:function(m){m=m||window.location.toString();var p={resource:""},k=m.indexOf("#");if(-1!==k&&(m=m.substring(k+1),0!==m.length)){m=m.split(",");p.resource=decodeURIComponent(m[0]);for(k=1;k<m.length;k++){var f=/([^=]*)(=?)(.*)/.exec(m[k]),l=decodeURIComponent(f[1]||""),f=decodeURIComponent(f[3]||"");""!==l&&"resource"!==l&&(p[l]=f)}}return p},
validateURLScheme:function(n,p){var k=n;if(-1===n.indexOf("://")){var f=document.createElement("a");f.href=n;k=f.href}f=!1;if(f=p?p.some(function(f){return RegExp("^"+f+":","i").test(k)}):m.test(k))return n;console.log("Illegal URL Scheme: '"+n+"'");return""}}});
define("orion/commandRegistry","orion/commands orion/explorers/navigationUtils orion/PageUtil orion/uiUtils orion/webui/littlelib orion/webui/dropdown orion/webui/tooltip text!orion/webui/checkedmenuitem.html text!orion/webui/dropdowntriggerbutton.html text!orion/webui/submenutriggerbutton.html".split(" "),function(m,n,p,k,f,l,e,d,a,h){function b(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(a);this._parameterCollector=
null}function g(a,b){this.token=a;this.parameterName=b}function u(a,b,g){this.event=a;this.handler=b;this.capture=g||!1}function v(a,b,g,h,d,e){this.name=a;this.type=b;this.label=g;this.value=h;this.lines=d||1;this.eventListeners=Array.isArray(e)?e:e?[e]:[]}function q(a,b,g){this._storeParameters(a);this._hasOptionalParameters=b&&b.hasOptionalParameters;this._options=b;this.optionsRequested=!1;this.getParameters=g;this.clientCollect=b&&b.clientCollect;this.getParameterElement=b&&b.getParameterElement;
this.getSubmitName=b&&b.getSubmitName}b.prototype={_init:function(a){this._selectionService=a.selection;var b=this;m.setKeyBindingProvider(function(){return b._activeBindings})},processURL:function(a){for(var b in this._urlBindings)if(this._urlBindings[b]&&this._urlBindings[b].urlBinding&&this._urlBindings[b].command){var g=this._urlBindings[b].urlBinding.match(a);if(g){var h=this._urlBindings[b],d=h.command,e=h.invocation;if(e&&e.parameters&&d.callback){e.parameters.setValue(g.parameterName,g.parameterValue);
var f=this;window.setTimeout(function(){f._invoke(e)},0);break}}}},findCommand:function(a){return this._commandList[a]},runCommand:function(a,b,g,h,d,e){if(b){if((a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(b):1)&&a.callback)return b=new m.CommandInvocation(g,b,d,a,this),b.domParent=e,this._invoke(b,h)}else if((e=this._urlBindings[a])&&e.command&&e.command.callback)return this._invoke(e.invocation,h)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=
a},openParameterCollector:function(a,b,g){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,b,g))},confirm:function(a,b,g,h,d,e){var f=!1;if(this._parameterCollector&&!d){var s=this;this._parameterCollector.close();if(this._parameterCollector.open(a,function(a,d){var e=document.createElement("span");e.classList.add("parameterPrompt");e.textContent=b;a.appendChild(e);e=document.createElement("button");e.addEventListener("click",function(a){f=!0;s._parameterCollector.close()},
!1);d.appendChild(e);e.appendChild(document.createTextNode(g));e.className="dismissButton";var q=document.createElement("button");q.addEventListener("click",function(a){f=!1;s._parameterCollector.close()},!1);d.appendChild(q);q.appendChild(document.createTextNode(h));q.className="dismissButton";return e},function(){e(f)}))return}f=window.confirm(b);e(f)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},
_invoke:function(a,b){return this._collectAndInvoke(a.makeCopy(b),!1)},_collectAndInvoke:function(a,b,g){if(a)if(this._parameterCollector&&a.parameters&&a.parameters.hasParameters()&&(b||a.parameters.shouldCollectParameters())){b=!1;a.parameters.updateParameters(a);if(a.parameters.shouldCollectParameters()&&(b=this._parameterCollector.collectParameters(a,g),!b)){var h=new e.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]});b=
h.contentContainer();b.classList.add("parameterPopup");var d=window.document.activeElement,f=this._parameterCollector.getFillFunction(a,function(){d&&d.focus();h.destroy()},g)(b);h.show();window.setTimeout(function(){f.focus();f.select()},0);b=!0}if(!b)return a.command.callback.call(a.handler||window,a)}else return 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,
b){this._collectAndInvoke(a,!0,b)},showKeyBindings:function(a){function b(a){return function(){m.executeBinding(a)}}var g={},h,d,e=[],f;for(f in this._activeBindings)(d=this._activeBindings[f])&&(d.keyBinding&&d.command&&(d.command.name||d.command.tooltip))&&e.push(d);e.sort(function(a,b){return(a.command.name||a.command.tooltip).localeCompare(b.command.name||b.command.tooltip)});for(f=0;f<e.length;f++)d=e[f],d.keyBinding.scopeName?(g[d.keyBinding.scopeName]||(g[d.keyBinding.scopeName]=[]),g[d.keyBinding.scopeName].push(d)):
(h=k.getUserKeyString(d.keyBinding),a.createItem(h,d.command.name||d.command.tooltip,b(d)));for(var s in g)g[s].length&&0<g[s].length&&(a.createHeader(s),g[s].forEach(function(g){h=k.getUserKeyString(g.keyBinding);a.createItem(h,g.command.name||g.command.tooltip,b(g))}))},addCommand:function(a){this._commandList[a.id]=a;var b=this._pendingBindings[a.id];if(b){var g=this;b.forEach(function(b){g._addBinding(a,b.type,b.binding,b.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,
b,g,h,d,e,f,s,q,D){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];d&&(a=this._createEntryForPath(a,d));a[b]?(h&&(a[b].title=h),g&&(a[b].position=g),f&&(a[b].imageClass=f),s&&(a[b].tooltip=s),q&&(a[b].selectionClass=q),!0===D?a[b].pretendDefaultActionId=!0:a[b].defaultActionId=D,a[b].emptyGroupMessage=e):(a[b]={title:h,position:g,emptyGroupMessage:e,imageClass:f,tooltip:s,selectionClass:q,defaultActionId:!0===D?null:D,pretendDefaultActionId:!0===
D,children:{}},a.sortedContributions=null)},_createEntryForPath:function(a,b){b&&b.split("/").forEach(function(b){1<b.length&&(a[b]||(a[b]={position:0,children:{}},a.sortedContributions=null),a=a[b].children)});return a},registerSelectionService:function(a,b){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=b},registerCommandContribution:function(a,b,g,h,d,e,f){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]=
{});a=this._contributionsByScopeId[a];h&&(a=this._createEntryForPath(a,h));a[b]={position:g};e&&((g=this._commandList[b])?this._addBinding(g,"key",e,d):this._addPendingBinding(b,"key",e,d));f&&((g=this._commandList[b])?this._addBinding(g,"url",f,d):this._addPendingBinding(b,"url",f,d));a.sortedContributions=null},unregisterCommandContribution:function(a,b,g){if(this._contributionsByScopeId[a]){delete this._commandList[b];delete this._activeBindings[b];delete this._urlBindings[b];delete this._pendingBindings[b];
var h=this._contributionsByScopeId[a];g&&g.split("/").forEach(function(a){1<a.length&&h[a]&&(h=h[a].children)});delete h[b];h.sortedContributions=null}},_addBinding:function(a,b,g,h){if(!a.id)throw Error("No command id: "+a);"key"===b?this._activeBindings[a.id]={command:a,keyBinding:g,bindingOnly:h}:"url"===b&&(this._urlBindings[a.id]={command:a,urlBinding:g,bindingOnly:h})},_addPendingBinding:function(a,b,g,h){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:b,
binding:g,bindingOnly:h})},_checkForTrailingSeparator:function(a,b,g){var h;if("tool"===b||"button"===b)if((h=0<a.childNodes.length?a.childNodes[a.childNodes.length-1]:null)&&h.classList.contains("commandSeparator"))return g?(a.removeChild(h),!1):!0;if("menu"===b&&(a=f.$$array("li \x3e *",a),0<a.length&&a[a.length-1].classList.contains("dropdownSeparator")))if(h=a[a.length-1],g)h.parentNode.parentNode.removeChild(h.parentNode);else return!0;return!1},renderCommands:function(a,b,g,h,d,e,q){if("string"!==
typeof a)throw"a scope id for rendering must be specified";b=f.node(b);if(!b)throw"no parent";var s=this._contributionsByScopeId[a];if(!g&&s){g=s.localSelectionService||this._selectionService;var y=this;g&&g.getSelections(function(g){y.renderCommands(a,b,g,h,d,e)})}else s&&(this._render(s,b,g,h,d||"button",e,q),this._checkForTrailingSeparator(b,d,!0))},destroy:function(a){a=f.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var b=a.firstChild;b.commandTooltip&&b.commandTooltip.destroy();b.emptyGroupTooltip&&
b.emptyGroupTooltip.destroy();this.destroy(b);a.removeChild(b)}},_render:function(a,b,g,h,d,f,q){var s=a.sortedContributions;if(!s){var s=[],y=!1,D;for(D in a)if(Object.prototype.hasOwnProperty.call(a,D)){var u=a[D];u&&"number"===typeof u.position&&(u.id=D,s.push(u),y=!0)}y&&(s.sort(function(a,b){return a.position-b.position}),a.sortedContributions=s)}var l=0,v=this;s.forEach(function(a){var s;a.imageClass||(a.imageClass=null);if(a.children&&0<Object.getOwnPropertyNames(a.children).length){var y=
a.children;if("tool"===d||"button"===d)if(a.title){var D;a.defaultActionId&&((y=v._commandList[a.defaultActionId])&&(y.visibleWhen?y.visibleWhen(g):1)?(D=new m.CommandInvocation(h,g,f,y,v),D.domParent=b):a.pretendDefaultActionId=!0);y=v._createDropdownMenu(b,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass,null,D,a.pretendDefaultActionId);q&&n.generateNavGrid(q,y.menuButton);y&&(v._render(a.children,y.menu,g,h,"menu",f,q),v._checkForTrailingSeparator(y.menu,"menu",!0),0===y.menu.childNodes.length?
a.emptyGroupMessage?y.menuButton.emptyGroupTooltip||(y.menuButton.emptyGroupTooltip=new e.Tooltip({node:y.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right","above","left"]})):(q&&n.removeNavGrid(q,y.menuButton),a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},a(y.menu),a(y.menuButton),a(y.destroyButton)):y.menuButton.style.visibility="visible")}else{var u;0<b.childNodes.length&&!v._checkForTrailingSeparator(b,d)&&(u=v.generateSeparatorImage(b));v._render(y,b,
g,h,d,f,q);0<b.childNodes.length&&b.childNodes[b.childNodes.length-1]!==u&&(u=v.generateSeparatorImage(b))}else if(a.title){if(a=v._createDropdownMenu(b,a.title,!0,null,null,a.imageClass))v._render(y,a.menu,g,h,"menu",f,q),v._checkForTrailingSeparator(a.menu,"menu",!0),0===a.menu.childNodes.length&&a.destroyButton&&b.removeChild(a.destroyButton)}else 0<b.childNodes.length&&v._generateMenuSeparator(b),v._render(y,b,g,h,d,f,q),v._generateMenuSeparator(b)}else{var r=v._commandList[a.id],y=r?!0:!1;D=
a=null;if(r){s=new m.CommandInvocation(h,g,f,r,v);s.domParent=b;u=!1;try{u=y&&(r.visibleWhen?r.visibleWhen(g):!0)}catch(E){throw console.log(E),E;}v._activeBindings[r.id]&&v._activeBindings[r.id].keyBinding&&(a=v._activeBindings[r.id],a.invocation=u?s:null,a.bindingOnly&&(y=!1));v._urlBindings[r.id]&&v._urlBindings[r.id].urlBinding&&(D=v._urlBindings[r.id],D.invocation=u?s:null,D.bindingOnly&&(y=!1));y=y&&u}y&&(r.choiceCallback?("tool"===d||"button"===d?(a=b,y=!1,"ul"===b.nodeName.toLowerCase()&&
(a=document.createElement("li"),b.appendChild(a))):(a=b,y=!0),v._createDropdownMenu(a,r.name,y,function(a){r.populateChoicesMenu(a,g,h,f,v)}.bind(r),r.imageClass,r.tooltip||r.title,r.selectionClass,r.positioningNode)):(s.handler=s.handler||this,s.domParent=b,y=function(a){v._invoke(s)},"menu"===d?(D=null,a&&a.keyBinding&&(D=k.getUserKeyString(a.keyBinding)),a=m.createCommandMenuItem(b,r,s,null,y,D)):(a=d+r.id+l,a=m.createCommandItem(b,r,s,a,null,"tool"===d,y)),n.generateNavGrid(q,a),s.domNode=a,l++))}})},
_createDropdownMenu:function(a,b,g,d,q,u,k,s,y,D){a=f.node(a);if(!a||!f.contains(document.body,a))return null;var v,B,p=a;if(g)u=document.createRange(),u.selectNode(a),u=u.createContextualFragment(h),f.processTextNodes(u,{ButtonText:b}),a.appendChild(u),B=a.lastChild,q=B.lastChild,b=q.previousSibling,b.dropdown=new l.Dropdown({dropdown:q,populate:d,parentDropdown:a.dropdown}),q.dropdown=b.dropdown;else{"ul"===a.nodeName.toLowerCase()&&(p=document.createElement("li"),a.appendChild(p),B=p);a=null;q&&
(a="dropdownButtonWithIcon",u=u||b);u=q?u||b:u;var n=m.createDropdownMenu(p,b,d,a,q,!1,k,s,y||D);v=n.dropdownArrow;b=n.menuButton;if(v){y&&(y.domNode=n.menuButton);var G=this;b.onclick=function(a){var b=f.bounds(v);a.clientX>=b.left&&n.dropdown?n.dropdown.toggle(a):G._invoke(y)};n.dropdown&&(b.onkeydown=function(a){f.KEY.DOWN===a.keyCode&&(n.dropdown.toggle(a),f.stop(a))})}q=n.menu;var I;(d=y&&y.command&&(y.command.tooltip||y.command.name))?I=y.command.tooltip||y.command.name:d&&(I=u);I&&(b.commandTooltip=
new e.Tooltip({node:b,text:I,position:["above","below","right","left"]}))}return{menuButton:b,menu:q,dropdown:b.dropdown,destroyButton:B,dropdownArrow:v}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,"menu")){var b=document.createElement("li");b.classList.add("dropdownSeparator");var g=document.createElement("span");g.classList.add("dropdownSeparator");b.appendChild(g);a.appendChild(b)}},generateSeparatorImage:function(a){var b;b="ul"===a.nodeName.toLowerCase()?document.createElement("li"):
document.createElement("span");a.appendChild(b);b.classList.add("core-sprite-sep");b.classList.add("imageSprite");b.classList.add("commandSeparator");return b}};b.prototype.constructor=b;g.prototype={match:function(a){a=p.matchResourceParameters(a);return"undefined"!==typeof a[this.token]?(this.parameterValue=a[this.token],this):null}};g.prototype.constructor=g;u.prototype.constructor=u;v.prototype={optionsRequested:function(){return this.optionsRequested}};v.prototype.constructor=v;q.prototype={_storeParameters:function(a){this.parameterTable=
null;if(a){var b=this.parameterTable={};a.forEach(function(a){b[a.name]=a})}},updateParameters:function(a){"function"===typeof this.getParameters&&this._storeParameters(this.getParameters(a))},hasParameters:function(){return null!==this.parameterTable},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,b){var g=this.parameterTable[a];
g&&(g.value=b)},forEach:function(a){for(var b in this.parameterTable)this.parameterTable[b].type&&this.parameterTable[b].name&&a(this.parameterTable[b])},makeCopy:function(){var a=[];this.forEach(function(b){b=new v(b.name,b.type,b.label,b.value,b.lines,b.eventListeners);a.push(b)});var b=new q(a,this._options,this.getParameters);b.clientCollect=this.clientCollect;return b},hasOptionalParameters:function(){return this._hasOptionalParameters}};q.prototype.constructor=q;return{CommandRegistry:b,URLBinding:g,
ParametersDescription:q,CommandParameter:v,CommandEventListener:u}});define("text!orion/banner/slideout.html",[],function(){return'\x3cdiv id\x3d"slideContainer" class\x3d"slideParameters slideContainer"\x3e\n\t\x3cspan id\x3d"pageCommandParameters" class\x3d"layoutLeft parameters"\x3e\x3c/span\x3e\n\t\x3cspan id\x3d"pageCommandDismiss" class\x3d"layoutRight parametersDismiss"\x3e\x3c/span\x3e\n\x3c/div\x3e'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(m,n,p){return{slideoutHTMLFragment:function(k){var f=document.createElement("div");f.innerHTML=p;var l=n.$("#slideContainer",f);l.id=k+l.id;l=n.$("#pageCommandParameters",f);l.id=k+l.id;l=n.$("#pageCommandDismiss",f);l.id=k+l.id;return f.innerHTML}}});
define("orion/section","orion/webui/littlelib orion/selection orion/commandRegistry orion/commonHTMLFragments orion/objects orion/selection".split(" "),function(m,n,p,k,f,l){function e(a,h){var b=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite";if(!h.id)throw Error("Missing required argument: id");this.id=h.id;if(!h.title)throw Error("Missing required argument: title");
var g=h.useAuxStyle?["sectionWrapper","sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");a.appendChild(this.domNode);for(var d=0;d<g.length;d++)this.domNode.classList.add(g[d]);this.domNode.id=h.id;h.canHide&&(this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitleTwistie"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),
this.domNode.tabIndex=0,this.domNode.addEventListener("click",function(a){(a.target===b.titleNode||a.target===b.twistie||a.target===b.domNode)&&b._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(a){a.keyCode===m.KEY.ENTER&&(a.target===b.domNode||a.target===b.titleNode||a.target===b.twistie)&&b._changeExpandedState()},!1));if(h.iconClass){var e=document.createElement("span");e.classList.add("sectionIcon");this.domNode.appendChild(e);g=Array.isArray(h.iconClass)?h.iconClass:
[h.iconClass];g.forEach(function(a){e.classList.add(a)})}h.headerClass&&(g=Array.isArray(h.headerClass)?h.headerClass:[h.headerClass],g.forEach(function(a){this.domNode.classList.add(a)}.bind(this)));this.titleActionsNode=document.createElement("div");this.titleActionsNode.id=h.id+"TitleActionsArea";this.titleActionsNode.classList.add("layoutLeft");this.titleActionsNode.classList.add("sectionActions");this.domNode.appendChild(this.titleActionsNode);this.titleNode=document.createElement("div");this.titleNode.id=
h.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=h.title;"function"===typeof h.getItemCount&&(g=document.createElement("div"),g.classList.add("layoutLeft"),g.classList.add("sectionItemCount"),this.domNode.appendChild(g),g.textContent=h.getItemCount(this));this._progressNode=document.createElement("div");this._progressNode.id=h.id+"Progress";
this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.display="none";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);this.titleLeftActionsNode=document.createElement("div");this.titleLeftActionsNode.id=h.id+"LeftTitleActionsArea";this.titleLeftActionsNode.classList.add("layoutLeft");this.titleLeftActionsNode.classList.add("sectionActions");this.domNode.appendChild(this.titleLeftActionsNode);
g=document.createElement("div");g.id=h.id+"FilterSearchBox";this.domNode.appendChild(g);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=h.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("ul");this.actionsNode.id=h.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("commandList");
this.actionsNode.classList.add("sectionActions");this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("ul");this.selectionNode.id=h.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);h.slideout&&(g=k.slideoutHTMLFragment(h.id),d=document.createRange(),d.selectNode(this.domNode),g=d.createContextualFragment(g),
this.domNode.appendChild(g));this._contentParent=document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);a.appendChild(this._contentParent);h.content&&this.setContent(h.content);"function"===typeof h.onExpandCollapse&&(this._onExpandCollapse=h.onExpandCollapse);this._preferenceService=h.preferenceService;this._collapse();if(this._preferenceService){var f=
this;this._preferenceService.getPreferences("/window/views").then(function(a){a=a.get(f.id);void 0===a?h.hidden||f._expand():a&&f._expand();f._updateExpandedState(!1)})}else h.hidden||this._expand(),this._updateExpandedState(!1);this._commandService=h.commandService;this._lastMonitor=0;this._loading={}}function d(a){this._section=a;this._id=++a._lastMonitor}e.prototype={setTitle:function(a){this.titleNode.textContent=a},getHeaderElement:function(a){return this.domNode},getTitleElement:function(a){return this.titleNode},
getActionElement:function(a){return this._toolActionsNode},setContent:function(a){"string"===typeof a?this._contentParent.innerHTML=a:(this._contentParent.innerHTML="",this._contentParent.appendChild(a))},getContentElement:function(){return this._contentParent},embedExplorer:function(a,h,b){this._contentParent.innerHTML="";a.parent||(a.parent=h);this._contentParent.appendChild(a.parent);a.section=this;f.mixin(a,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(a){if(!m.node(a)){var b=
document.createElement("ul");b.id=a;b.classList.add("commandList");b.classList.add("layoutRight");this.section.actionsNode.appendChild(b)}}.bind(this))},getCommandsVisible:function(){return"hidden"!==this.section.actionsNode.style.visibility},setCommandsVisible:function(a,b){this.section.actionsNode.style.visibility=a?"":"hidden";void 0===b&&(b=a?null:"cursorOnly");this.renderer.selectionPolicy=b;var h=this.getNavHandler();h&&h.setSelectionPolicy(b);a?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(a){m.node(a)&&
this.commandRegistry.destroy(a)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var a=this;this.actionsSections&&(this.actionsSections.forEach(function(b){delete a[b]}),delete this.actionsSections)},updateCommands:function(a){this.section.actionsNode&&this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,a))},loaded:function(){var a=this;!this.selection&&!b&&(this.serviceRegistry||this.registry?(this.selection=
new l.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(b){a.updateCommands(b.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry"));var h=this.registerCommands();!h||!h.then?a.updateCommands():h.then(function(){a.updateCommands()})}});a.renderer&&(a.renderer.section=this,f.mixin(a.renderer,{getCellHeaderElement:function(a){(a=Object.getPrototypeOf(this).getCellHeaderElement.call(this,
a))&&this.section.setTitle(a.innerHTML);return null}}))},createProgressMonitor:function(){return new d(this)},_setMonitorMessage:function(a,h){this._progressNode.style.display="block";this._loading[a]=h;var b="",g;for(g in this._loading)""!==b&&(b+="\n"),b+=this._loading[g];this._progressNode.title=b;this._updateExpandedState(!1)},_monitorDone:function(a){delete this._loading[a];a="";for(var h in this._loading)""!==a&&(a+="\n"),a+=this._loading[h];this._progressNode.title=a;""===a&&(this._progressNode.style.display=
"none");this._updateExpandedState(!1)},_changeExpandedState:function(){this.hidden?this._expand():this._collapse();this._updateExpandedState(!0)},_updateExpandedState:function(a){var h=!this.hidden,b=this.working,g=this.twistie,d=this.id;g&&(g.classList.remove(this._expandImageClass),g.classList.remove(this._collapseImageClass),g.classList.remove(this._progressImageClass),g.classList.add(b?this._progressImageClass:h?this._expandImageClass:this._collapseImageClass));this._preferenceService&&a&&this._preferenceService.getPreferences("/window/views").then(function(a){a.put(d,
h)});this._onExpandCollapse&&this._onExpandCollapse(h,this)},_expand:function(){this._contentParent.classList.remove("sectionClosed");this.domNode.classList.remove("sectionClosed");this.hidden=!1},_collapse:function(){this.hidden=!0;this._contentParent.classList.add("sectionClosed");this.domNode.classList.add("sectionClosed")}};e.prototype.constructor=e;d.prototype={begin:function(a){this._section.working=!0;this.status=a;this._section._setMonitorMessage(this.id,a)},worked:function(a){this.status=
a;this._section._setMonitorMessage(this.id,a)},done:function(a){this._section.working=!1;this.status=a;this._section._monitorDone(this.id)}};d.prototype.constructor=d;return{Section:e}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(m,n){function p(k){this._init(k)}p.prototype={_init:function(k){var f=k.parent,l=this,f=n.node(f);if(!f)throw m["no parent"];if(!k.model)throw m["no tree model"];if(!k.renderer)throw m["no renderer"];this._parent=f;this._treeModel=k.model;this._onComplete=k.onComplete;this._renderer=k.renderer;this._showRoot=void 0===k.showRoot?!1:k.showRoot;this._indent=void 0===k.indent?16:k.indent;this._onCollapse=k.onCollapse;
this._labelColumnIndex=void 0===k.labelColumnIndex?0:k.labelColumnIndex;this._id=void 0===k.id?"treetable":k.id;this._tableStyle=k.tableStyle;this._tableElement=k.tableElement||"table";this._tableBodyElement=k.tableBodyElement||"tbody";this._tableRowElement=k.tableRowElement||"tr";this._treeModel.getRoot(function(e){l._root=e;l._showRoot?(e._depth=0,l._generate([e],0)):l._treeModel.getChildren(e,function(d){l.destroyed||l._generate(d,0)})})},destroy:function(){this.destroyed=!0},_generate:function(k,
f){n.empty(this._parent);var l=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(l);var e=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(e);e.id=this._id;this._tableStyle&&e.classList.add(this._tableStyle);this._renderer.initTable(e,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";0===k.length?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(k,f);e.appendChild(this._bodyElement);l.appendChild(e);this._parent.appendChild(l);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(k,f,l){for(var e=0;e<k.length;e++){var d=document.createElement(this._tableRowElement);d.id=this._treeModel.getId(k[e]);d._depth=f;d._item=k[e];this._renderer.render(k[e],d);var a=this._indent*f;d.childNodes[Math.min(d.childNodes.length-
1,this._labelColumnIndex)].style.paddingLeft=a+"px";this._renderer.rowCallback&&this._renderer.rowCallback(d,k[e]);l?(this._bodyElement.insertBefore(d,l.nextSibling),l&&(l=d)):this._bodyElement.appendChild(d)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(k,f,l){var e=this._treeModel.getId(k),d;if(e===this._id)this._removeChildRows(e),this._generateChildren(f,0),this._rowsChanged();else if(e===
this._treeModel.getId(this._root)&&k.removeAll)this._removeAllRows(),this._generateChildren(f,0),this._rowsChanged();else{var a=n.node(e);a?(a._item=k,a&&(l||a._expanded)?(this._removeChildRows(e),f?(a._expanded=!0,this._renderer.updateExpandVisuals(a,!0),this._generateChildren(f,a._depth+1,a),this._rowsChanged()):(d=this,this._renderer.updateExpandVisuals(a,"progress"),f=this._treeModel.getChildren(a._item,function(h){d.destroyed||(d._renderer.updateExpandVisuals(a,!0),a._expanded||(a._expanded=
!0,d._generateChildren(h,a._depth+1,a),d._rowsChanged()))}))):this._renderer.updateExpandVisuals(a,!1)):console.log(m["could not find table row "]+e)}},getItem:function(k){var f=n.node(k);return f&&f._item?f._item:k},toggle:function(k){var f=n.node(k);f&&(f._expanded?this.collapse(k):this.expand(k))},isExpanded:function(k){k="string"===typeof k?k:this._treeModel.getId(k);return(k=n.node(k))?k._expanded:!1},expand:function(k,f,l){k="string"===typeof k?k:this._treeModel.getId(k);var e=n.node(k);if(e){var d=
this;e._expanded?f&&f.apply(d,l):(this._renderer.updateExpandVisuals(e,"progress"),this._treeModel.getChildren(e._item,function(a){d.destroyed||(d._renderer.updateExpandVisuals(e,!0),e._expanded||(e._expanded=!0,d._generateChildren(a,e._depth+1,e),d._rowsChanged()),f&&f.apply(d,l))}))}},_removeChildRows:function(k){for(var f=k===this._id,l=!1,e=-1,d=[],a=n.$$array(".treeTableRow",this._parent),h=0;h<a.length;h++){var b=a[h];if(l)break;f?b._depth>e?d.push(b):l=!0:b.id===k&&(f=!0,e=b._depth)}for(k=
0;k<d.length;k++)f=d[k],f.parentNode.removeChild(f)},_removeAllRows:function(){for(var k=n.$$array(".treeTableRow",this._parent),f=0;f<k.length;f++)k[f].parentNode.removeChild(k[f])},collapse:function(k){k="string"===typeof k?k:this._treeModel.getId(k);var f=n.node(k);if(f){if(!f._expanded)return;f._expanded=!1;this._renderer.updateExpandVisuals(f,!1);this._removeChildRows(k);this._rowsChanged()}this._onCollapse&&this._onCollapse(f._item)},getIndent:function(){return this._indent}};p.prototype.constructor=
p;return{TableTree:p}});
define("orion/treeModelIterator",[],function(){var m={};m.TreeModelIterator=function(){function m(p,k){this.firstLevelChildren=p;this.reset();this._init(k)}m.prototype={_init:function(m){m&&(this.isExpanded=m.isExpanded,this.isExpandable=m.isExpandable,this.forceExpandFunc=m.forceExpandFunc,this.getChildrenFunc=m.getChildrenFunc)},topLevel:function(m){return m.parent?m.parent===this.root:!0},_getChildren:function(m){return"function"===typeof this.getChildrenFunc?this.getChildrenFunc(m):m?m.children:
null},_expanded:function(m){if(!m)return!0;var k=this._getChildren(m),k=k&&0<k.length;this.isExpanded&&k&&(k=this.isExpanded(m));return k},_expandable:function(m){return!m?!0:this.isExpandable?this.isExpandable(m):!1},_diveIn:function(m){return this._expanded(m)?(m=this._getChildren(m),this.setCursor(m[0]),this.cursor()):null},_drillToLast:function(m){return this._expanded(m)?(m=this._getChildren(m),this._drillToLast(m[m.length-1])):m},_forward:function(m){if(!this._cursor)return null;var k=this._diveIn(this._cursor);
if(!k){if(m&&this._expandable(this._cursor)&&this.forceExpandFunc){var f=this;return this.forceExpandFunc(this._cursor,"first",function(l){l&&f.setCursor(l)})}(k=this._findSibling(this._cursor,!0))&&this.setCursor(k)}return k},_backward:function(m){if(!this._cursor)return null;var k=this._findSibling(this._cursor,!1);k&&k!==this._cursor.parent&&(k=this._drillToLast(k));if(m&&k&&this._expandable(k)&&this.forceExpandFunc&&k!==this._cursor.parent){var f=this;return this.forceExpandFunc(k,"last",function(l){l&&
f.setCursor(l)})}k&&this.setCursor(k);return k},_findSibling:function(m,k){for(var f=this.topLevel(m),l=this._getChildren(m.parent),l=f?this.firstLevelChildren:l,e=0;e<l.length;e++)if(l[e]===m)return 0===e&&!k?f?null:m.parent:e===l.length-1&&k?f?null:this._findSibling(m.parent,k):k?l[e+1]:l[e-1];return null},_inParentChain:function(m,k){for(var f=m.parent;f;){if(f===k)return!0;f=f.parent}return!1},_getTopLevelParent:function(m){if(this.topLevel(m))return m;for(m=m.parent;m;){if(this.topLevel(m))return m;
m=m.parent}return null},_onCollapse:function(m){return this._expanded(m.parent)?m:this._onCollapse(m.parent)},_scan:function(m,k,f){this.setCursor(k);var l=[];for(l.push(k);;){if(this.iterate(m))l.push(this.cursor());else break;if(f===this.cursor())return l}return null},setCursor:function(m){this._prevCursor=this._cursor;this._cursor=m},setTree:function(m){this.firstLevelChildren=m;0<this.firstLevelChildren.length&&(this.root=this.firstLevelChildren[0].parent)},scan:function(m,k){var f=this.cursor(),
l=this._scan(!0,m,k);l||(l=this._scan(!1,m,k));this.setCursor(f);return l},iterate:function(m,k){return m?this._forward(k):this._backward(k)},iterateOnTop:function(m,k){var f=this._findSibling(this._getTopLevelParent(this.cursor()),m);f?this.setCursor(f):k&&0<this.firstLevelChildren.length&&this.setCursor(m?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(m){return!this._cursor?null:this._inParentChain(this._cursor,m)?(this.setCursor(m),this._cursor):
null},reset:function(){this.root=this._prevCursor=this._cursor=null;0<this.firstLevelChildren.length&&(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 m}();return m});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(m,n,p){var k={},f=-1!==navigator.userAgent.indexOf("iPad"),l=-1!==window.navigator.platform.indexOf("Mac");k.ExplorerNavHandler=function(){function e(d,a,h){this.explorer=d;this.model=this.explorer.model;this._navDict=a;this._listeners=[];this._selections=[];this._currentColumn=0;d=this._getEventListeningDiv();d.tabIndex=0;d.classList.add("selectionModelContainer");var b=this;this._modelIterator=
new n.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:h.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(a){return b.explorer.renderer.isExpandable(a)}:function(a){return b.isExpandable(a)},forceExpandFunc:this.explorer.forceExpandFunc?function(a,h,d){return b.explorer.forceExpandFunc(a,h,d)}:void 0});this._init(h);(!h||!1!==h.setFocus)&&d.focus();h=function(a){if(p.isFormElement(a.target)||b.explorer.preventDefaultFunc&&b.explorer.preventDefaultFunc(a,
b._modelIterator.cursor()))return!0;if(a.keyCode===m.KEY.DOWN)return b.onDownArrow(a);if(a.keyCode===m.KEY.UP)return b.onUpArrow(a);if(a.keyCode===m.KEY.RIGHT)return b.onRightArrow(a);if(a.keyCode===m.KEY.LEFT)return b.onLeftArrow(a);if(a.keyCode===m.KEY.SPACE)return b.onSpace(a);if(a.keyCode===m.KEY.ENTER)return b.onEnter(a)};d.addEventListener("keydown",h,!1);this._listeners.push({type:"keydown",listener:h});h=function(a){if(b.explorer.onFocus)b.explorer.onFocus(!1);else b.toggleCursor(null,!1)};
d.addEventListener("blur",h,!1);this._listeners.push({type:"blur",listener:h});h=function(a){if(b.explorer.onFocus)b.explorer.onFocus(!0);else b.toggleCursor(null,!0)};d.addEventListener("focus",h,!1);this._listeners.push({type:"focus",listener:h});this._parentDiv=d}e.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(d){this._linearGridMove=!1;d&&(this._selectionPolicy=d.selectionPolicy,this.gridClickSelectionPolicy=d.gridClickSelectionPolicy||
"none",this.preventDefaultFunc=d.preventDefaultFunc,this.postDefaultFunc=d.postDefaultFunc)},_ctrlKeyOn:function(d){return l?d.metaKey:d.ctrlKey},removeListeners:function(){if(this._listeners)for(var d=0;d<this._listeners.length;d++)this._parentDiv.removeEventListener(this._listeners[d].type,this._listeners[d].listener,!1)},focus:function(){var d=this._getEventListeningDiv();d&&d.focus()},_getEventListeningDiv:function(d){return this.explorer.keyEventListeningDiv&&"function"===typeof this.explorer.keyEventListeningDiv?
this.explorer.keyEventListeningDiv(d):m.node(this.explorer._parentId)},isExpandable:function(d){return!d?!1:m.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(d)))?!0:!1},isExpanded:function(d){return!d?!1:this.explorer.myTree.isExpanded(this.model.getId(d))},refreshSelection:function(d,a){var h=this;this.explorer.selection&&this.explorer.selection.getSelections(function(b){h._clearSelection(a);for(var g=0;g<b.length;g++)h._selections.push(b[g]);0<h._selections.length?h.cursorOn(h._selections[0],
!0,!1,d):h.cursorOn(null,!1,!1,d);h._shiftSelectionAnchor&&0<=h._inSelection(h._shiftSelectionAnchor)||(h._shiftSelectionAnchor=null)})},refreshModel:function(d,a,h,b){this._currentColumn=0;this.topIterationNodes=[];this.model=a;this._navDict=d;this.model.getTopIterationNodes?this.topIterationNodes=this.model.getTopIterationNodes():h&&(this.topIterationNodes=h);this._modelIterator.setTree(this.topIterationNodes);!b&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(d){d=this.model.getId(d);for(var a=0;a<this._selections.length;a++)if(d===this.model.getId(this._selections[a]))return a;return-1},_clearSelection:function(d){if(d)for(d=0;d<this._selections.length;d++)this._checkRow(this._selections[d],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(d){this._selectionPolicy!==
d&&(("readonlySelection"===this._selectionPolicy||"readonlySelection"===d)&&this._toggleSelectionClass("disabledRow","readonlySelection"===d),this._selectionPolicy=d,"cursorOnly"===this._selectionPolicy&&this._clearSelection(!0))},setSelection:function(d,a,h){"readonlySelection"!==this._selectionPolicy&&("cursorOnly"===this._selectionPolicy?a&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(d,!0):this._isRowSelectable(d)&&(!a||"singleSelection"===this._selectionPolicy?(this._clearSelection(!0),
this._checkRow(d,!1),this._selections.push(d),this._lastSelection=d):(a=this._inSelection(d),0<=a?(this._checkRow(d,!0),this._selections.splice(a,1)):(this._checkRow(d,!1),this._selections.push(d),this._lastSelection=d)),h&&(this._shiftSelectionAnchor=this._lastSelection),this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))))},moveColumn:function(d,a){d||(d=this.currentModel());var h=this._getGridChildren(d);if(h&&1<h.length||
0===a&&h){0!==a&&this.toggleCursor(d,!1);var b=this._currentColumn,g=!0,b=b+a;0>b?(this._linearGridMove&&0!==a&&(this._modelIterator.iterate(!1)?d=this.currentModel():g=!1),b=g?h.length-1:this._currentColumn):b>=h.length&&(this._linearGridMove&&0!==a&&(this._modelIterator.iterate(!0)?d=this.currentModel():g=!1),b=g?0:this._currentColumn);this._currentColumn=b;0!==a&&this.toggleCursor(d,!0);return!0}return!1},_getGridChildren:function(d){return this._navDict?this._navDict.getGridNavHolder(d):null},
getCurrentGrid:function(d){d||(d=this.currentModel());return(d=this._getGridChildren(d))&&0<d.length?d[this._currentColumn]:null},getAriaContainerElement:function(d){for(var a=this._parentDiv,h;d&&d!==a&&"grid"!==(h=d.getAttribute("role"))&&"tree"!==h&&"treegrid"!==h;)d=d.parentNode;return d===a?null:d},toggleCursor:function(d,a){var h=this.getRowDiv(d),b=this.getCurrentGrid(d);b?(h&&(a?h.classList.add("treeIterationCursorRow"):h.classList.remove("treeIterationCursorRow")),b.domNode&&(h=this.getAriaContainerElement(b.domNode),
a?(b.domNode.classList.add("treeIterationCursor"),h&&h.setAttribute("aria-activedescendant",b.domNode.id)):b.domNode.classList.remove("treeIterationCursor"))):h&&(a?h.classList.add("treeIterationCursorRow_Dotted"):h.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(d,a,h,b){var g,e;if(d||a){if(e===this._modelIterator.cursor())return;g=this._modelIterator.cursor();e=d;this._modelIterator.setCursor(e)}else g=this._modelIterator.prevCursor(),
e=this._modelIterator.cursor();if(g!==e||a)if(this.toggleCursor(g,!1),!a||e){this.moveColumn(null,0);this.toggleCursor(e,!0);if((d=this.getRowDiv())&&!b){b=d.parentNode;for(a=document.documentElement;b&&b!==a;){var f=window.getComputedStyle(b,null);if(!f)break;f=f.getPropertyValue("overflow-y");if("auto"===f||"scroll"===f)break;b=b.parentNode}b&&(a=!0,d.offsetTop<=b.scrollTop?(a=!1,void 0===h&&(h=!1)):d.offsetTop+d.offsetHeight>=b.scrollTop+b.clientHeight&&(a=!1,void 0===h&&(h=!0)),a||d.scrollIntoView(!h))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(g,
e)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var d=[],a=0;a<this._selections.length;a++)d.push(this.model.getId(this._selections[a]));return d},getRowDiv:function(d){d=d?d:this._modelIterator.cursor();if(!d)return null;d=this.model.getId(d);var a=this._navDict.getValue(d);return a&&a.rowDomNode?a.rowDomNode:m.node(d)},iterate:function(d,a,h,b){var g=null;if(this.topIterationNodes&&0!==this.topIterationNodes.length)if(b){b=this.currentModel();for((g=this._modelIterator.iterate(d,
a))&&this._setCursorOnItem(d,h);g&&g.isNotSelectable;)(g=this._modelIterator.iterate(d,a))&&this._setCursorOnItem(d,h);g||(this.cursorOn(b,!0,!1,!0),this._setCursorOnItem(d,h))}else(g=this._modelIterator.iterate(d,a))&&this._setCursorOnItem(d,h)},_toggleSelectionClass:function(d,a){this._selections.forEach(function(h){(h=this.getRowDiv(h))&&(a?h.classList.add(d):h.classList.remove(d))}.bind(this))},_setCursorOnItem:function(d,a){this.cursorOn(null,!1,d);if(a){var h=this._inSelection(this._modelIterator.prevCursor()),
b=this._inSelection(this._modelIterator.cursor());0<=h&&0<=b?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(d,a){if(this.explorer.renderer._useCheckboxSelection&&"singleSelection"!==this._selectionPolicy){var h=this.getRowDiv(d);if(h){var b=m.node(this.explorer.renderer.getCheckBoxId(h.id)),g=a?!b.checked:!0;if(g!==b.checked)this.explorer.renderer.onCheck(h,b,g,!0)}}else this._select(d,a)},_select:function(d,a){d||(d=this._modelIterator.cursor());
var h=this.getRowDiv(d);h&&(0>this._inSelection(d)?h.classList.add("checkedRow"):h.classList.remove("checkedRow"))},_onModelGrid:function(d,a){var h=this._getGridChildren(d);if(h)for(var b=0;b<h.length;b++)if(a.target===h[b].domNode)return!0;return!1},onClick:function(d,a){if("readonlySelection"===this._selectionPolicy||this.isDisabled(this.getRowDiv(d)))m.stop(a);else{var h=m.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(d)));if(a.target!==h&&!("none"===this.gridClickSelectionPolicy&&
this._onModelGrid(d,a)))if(this.cursorOn(d,!0,!1,!0),f)this.setSelection(d,!0);else if(this._ctrlKeyOn(a))this.setSelection(d,!0,!0);else if(a.shiftKey&&this._shiftSelectionAnchor){if(h=this._modelIterator.scan(this._shiftSelectionAnchor,d)){this._clearSelection(!0);for(var b=0;b<h.length;b++)this.setSelection(h[b],!0)}}else this.setSelection(d,!1,!0)}},onCollapse:function(d){this._modelIterator.collapse(d)&&this.cursorOn()},onUpArrow:function(d){this.iterate(!1,!1,d.shiftKey,!0);!this._ctrlKeyOn(d)&&
!d.shiftKey&&this.setSelection(this.currentModel(),!1,!0);d.preventDefault();return!1},onDownArrow:function(d){this.iterate(!0,!1,d.shiftKey,!0);!this._ctrlKeyOn(d)&&!d.shiftKey&&this.setSelection(this.currentModel(),!1,!0);d.preventDefault();return!1},_shouldMoveColumn:function(d){var a=this.currentModel(),h=this._getGridChildren(a);return h&&1<h.length?this.isExpandable(a)?this._ctrlKeyOn(d):!0:!1},onLeftArrow:function(d){if(this._shouldMoveColumn(d))return this.moveColumn(null,-1),d.preventDefault(),
!0;var a=this._modelIterator.cursor();if(!a)return!1;if(this.isExpandable(a)&&this.isExpanded(a))return this.explorer.myTree.collapse(a),d.preventDefault(),!0;this._modelIterator.topLevel(a)?this.explorer.scopeUp&&"function"===typeof this.explorer.scopeUp&&this.explorer.scopeUp():(this.cursorOn(a.parent),this.setSelection(a.parent,!1,!0))},onRightArrow:function(d){if(this._shouldMoveColumn(d))return this.moveColumn(null,1),d.preventDefault(),!0;var a=this._modelIterator.cursor();if(!a)return!1;if(this.isExpandable(a)&&
!this.isExpanded(a))return this.explorer.myTree.expand(a),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(a)),d.preventDefault(),!1},_isRowSelectable:function(d){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(d):!0},onSpace:function(d){this.setSelection(this.currentModel(),!0,!0);d.preventDefault()},onEnter:function(d){var a=this.getCurrentGrid(this._modelIterator.cursor());if(a)if(a.widget)if("function"===typeof a.onClick)a.onClick();else"function"===
typeof a.widget.focus&&a.widget.focus();else{var h=document.createEvent("MouseEvents");h.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(d),!1,!1,!1,0,null);a.domNode.dispatchEvent(h)}else if(a=this._modelIterator.cursor())if(this.explorer.renderer.getRowActionElement&&(h=this.explorer.renderer.getRowActionElement(this.model.getId(a)),h.href&&(this._ctrlKeyOn(d)?window.open(h.href):window.location.href=h.href)),this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(d,
a),d.preventDefault(),!1},setIsNotSelectable:function(d,a){d.isNotSelectable=a},disableItem:function(d){var a=this.getRowDiv(d);this.isExpandable(d)&&this.isExpanded(d)&&(this._modelIterator.collapse(d),this.explorer.myTree.toggle(a.id));a.classList.remove("checkedRow");a.classList.add("disabledNavRow");this.setIsNotSelectable(d,!0)},isDisabled:function(d){return d.classList.contains("disabledNavRow")},enableItem:function(d){var a=this.getRowDiv(d);a&&(a.classList.remove("disabledNavRow"),this.setIsNotSelectable(d,
!1))}};return e}();k.ExplorerNavDict=function(){function e(d){this._dict={};this._model=d}e.prototype={addRow:function(d,a){var h=this._model.getId(d);this._dict[h]={model:d,rowDomNode:a}},getValue:function(d){return this._dict[d]},getGridNavHolder:function(d,a){if(!d)return null;var h=this._model.getId(d);return this._dict[h]?(!this._dict[h].gridChildren&&a&&(this._dict[h].gridChildren=[]),this._dict[h].gridChildren):null},initGridNavHolder:function(d){if(!d)return null;d=this._model.getId(d);this._dict[d]&&
(this._dict[d].gridChildren=null)}};return e}();return k});
define("orion/explorers/explorer","i18n!orion/nls/messages require orion/webui/littlelib orion/webui/treetable orion/explorers/explorerNavHandler orion/commands".split(" "),function(m,n,p,k,f,l){var e={};e.Explorer=function(){function d(a,h,b,g){this.registry=a;this.renderer=b;this.selection=h;this.commandService=g;this.renderer&&(this.renderer.explorer=this);this.myTree=null}d.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(a,h){this.myTree&&this.myTree.refresh.bind(this.myTree)(a,h,!0)},updateCommands:function(a){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(a)},makeNewItemPlaceholder:function(a,h,b){var g=null;if(a=this.getRow(a)){var g=a.parentNode,d=document.createElement("tr");d.id=h+"placeHolderRow";d.classList.add("navRow");var e=document.createElement("td");e.id=h+"placeHolderCol";e.classList.add("navColumn");d.appendChild(e);
b?g.insertBefore(d,a.nextSibling):g.insertBefore(d,a);e.style.paddingLeft=a.firstChild.style.paddingLeft;g={wrapperNode:d,refNode:e,destroyFunction:function(){try{d&&d.parentNode&&d.parentNode.removeChild(d)}catch(a){}}}}return g},getRow:function(a){if(a=this.model.getId(a))return p.node(a)},collapseAll:function(){for(var a=this._navHandler.getTopLevelNodes(),h=0;h<a.length;h++)this.myTree.collapse(a[h])},expandAll:function(a){if(a)this._expandRecursively(a);else if(this._navHandler){a=this._navHandler.getTopLevelNodes();
for(var h=0;h<a.length;h++)this._expandRecursively(a[h])}},_expandRecursively:function(a){if(this._navHandler&&this._navHandler.isExpandable(a)){var h=this;this.myTree.expand(a,function(){h.model.getChildren(a,function(a){if(!(void 0===a||null===a))for(var g=a.length,d=0;d<g;d++)h._expandRecursively(a[d])})})}},createTree:function(a,h,b){a="string"===typeof a?a:a.id||a;this.selection&&this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var g=a+"innerTree",
d=p.node(g);d&&p.empty(d);h&&(h.rootId=g);this.model=h;this._parentId=a;this._treeOptions=b;if(!b||b&&!b.noSelection)this.selectionPolicy=b?b.selectionPolicy:"",this._navDict=new f.ExplorerNavDict(this.model);this.myTree=new k.TableTree({id:g,model:h,parent:a,onComplete:b?b.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:b?!!b.showRoot:!1,indent:b?b.indent:void 0,onCollapse:b?b.onCollapse:void 0,navHandlerFactory:b?b.navHandlerFactory:void 0,
tableElement:b?b.tableElement:void 0,tableBodyElement:b?b.tableBodyElement:void 0,tableRowElement:b?b.tableRowElement:void 0});this.renderer._initializeUIState();"cursorOnly"===this.selectionPolicy&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var a=this.getNavHandler(),h=[];if(a&&this.getNavDict())for(var b=a.getSelection(),g=0;g<b.length;g++){var d=a.getRowDiv(b[g]);d&&d.parentNode&&
(d=this.getNavDict().getValue(this.model.getId(b[g])),d.model&&h.push(d.model))}this.selection.setSelections(h)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var a=this._treeOptions;if(!a||a&&!a.noSelection){this.getNavHandler()||(this._navHandler=a&&a.navHandlerFactory&&"function"===typeof a.navHandlerFactory.createNavHandler?a.navHandlerFactory.createNavHandler(this,this._navDict,a):new f.ExplorerNavHandler(this,this._navDict,
{getChildrenFunc:a?a.getChildrenFunc:null,setFocus:a&&a.setFocus,selectionPolicy:a?a.selectionPolicy:null}));var h=this;this.model.getRoot(function(b){b instanceof Array?h.getNavHandler().refreshModel(h.getNavDict(),h.model,b):b.children&&b.children instanceof Array&&h.getNavHandler().refreshModel(h.getNavDict(),h.model,b.children);a&&a.setFocus&&h.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,checkbox:!1};return d}();e.createExplorerCommands=function(d,a){function h(b){return"function"===
typeof b.getItemCount&&0<b.getItemCount()?a?a(b):!0:!1}var b=new l.Command({tooltip:m["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return h(a)},callback:function(a){a.items.expandAll()}}),g=new l.Command({tooltip:m["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return h(a)},callback:function(a){a.items.collapseAll()}});
d.addCommand(b);d.addCommand(g)};e.ExplorerModel=function(){function d(a,h,b){this.rootPath=a;this.fetchItems=h;this.idPrefix=b||""}d.prototype={destroy:function(){this.destroyed=!0},getRoot:function(a){var h=this;this.fetchItems(this.rootPath).then(function(b){h.root=b;a(b)})},getChildren:function(a,h){a.Children?h(a.Children):a.ChildrenLocation?this.fetchItems(a.ChildrenLocation).then(function(b){a.Children=b;h(b)}):h([])},getId:function(a){if(a.Location===this.root.Location)return this.rootId;
a=a.Location.replace(/[\\\/]/g,"");for(var h=this.idPrefix,b=0;b<a.length;b++)h=a[b].match(/[^\.\:\-\_0-9A-Za-z]/g)?h+a.charCodeAt(b):h+a[b];return h}};return d}();e.ExplorerFlatModel=function(){function d(a,h,b){this.rootPath=a;this.fetchItems=h;this.root=b}d.prototype=new e.ExplorerModel;d.prototype.getRoot=function(a){if(this.root)a(this.root);else{var h=this;this.fetchItems(this.rootPath).then(function(b){h.root=b;a(b)})}};d.prototype.getChildren=function(a,h){a===this.root?h(this.root):h([])};
return d}();e.ExplorerRenderer=function(){function d(a,h){this.explorer=h;this._init(a);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}d.prototype={_init:function(a){a&&(this._useCheckboxSelection=void 0===a.checkbox?!1:a.checkbox,this.selectionPolicy=a.singleSelection?"singleSelection":"",this._cachePrefix=a.cachePrefix,a.getCheckedFunc&&(this.getCheckedFunc=
a.getCheckedFunc),a.onCheckedFunc&&(this.onCheckedFunc=a.onCheckedFunc),this._noRowHighlighting=a.noRowHighlighting,this._highlightSelection=!0,this._treeTableClass=a.treeTableClass||"treetable",!1===a.highlightSelection&&(this._highlightSelection=!1),this.actionScopeId||(this.actionScopeId=a.actionScopeId),this.commandService||(this.commandService=a.commandService))},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(a,h){this.tableTree=h;this.tableNode=a;p.empty(a);
this._treeTableClass&&a.classList.add(this._treeTableClass);this.renderTableHeader(a)},getActionsColumn:function(a,h,b,g,d){b=b||"tool";var e=document.createElement("td");e.id=h.id+"actionswrapper";g&&e.classList.add(g);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,e,a,this.explorer,b,null,d&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(a,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return e},initCheckboxColumn:function(a){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(a,h){if(this._useCheckboxSelection){var b=document.createElement("td"),g=document.createElement("span");g.id=this.getCheckBoxId(h.id);g.classList.add("core-sprite-check");g.classList.add("selectionCheckmarkSprite");g.rowId=h.id;this.getCheckedFunc&&(g.checked=this.getCheckedFunc(a),g.checked?(this._highlightSelection&&h.classList.add("checkedRow"),g.classList.add("core-sprite-check_on")):
(this._highlightSelection&&h.classList.remove("checkedRow"),g.classList.remove("core-sprite-check_on")));b.appendChild(g);var d=this;g.addEventListener("click",function(b){d.onCheck(h,b.target,b.target.checked?!1:!0,!0,!1,a)},!1);return b}},getCheckBoxId:function(a){return a+"selectedState"},onCheck:function(a,h,b,g,d,e){(h.checked=b)?h.classList.add("core-sprite-check_on"):h.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(h.rowId,b,g,e);this.explorer.getNavHandler()&&
d&&this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(a.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var a=this.explorer.getNavHandler().getSelectionIds(),h=this._getUIStatePreferencePath();h&&window.sessionStorage&&(window.sessionStorage[h+"selection"]=JSON.stringify(a))}},_restoreSelections:function(a){var h=this.explorer.getNavDict(),b=this.explorer.getNavHandler();if(b&&(h&&"cursorOnly"!==b.getSelectionPolicy())&&(a=window.sessionStorage[a+
"selection"],"string"===typeof a&&(a=0<a.length?JSON.parse(a):null),a)){for(var g=[],b=0;b<a.length;b++){var d=h.getValue(a[b]);if(d&&(d.rowDomNode&&d.model)&&(g.push(d.model),this._highlightSelection&&d.rowDomNode.classList.add("checkedRow"),d=p.node(this.getCheckBoxId(d.rowDomNode.id))))d.checked=!0,d.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(g),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(a){window.sessionStorage[a+
"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(a){var h=!1,b=window.sessionStorage[a+"expanded"];"string"===typeof b&&(b=0<b.length?JSON.parse(b):null);var g;if(b)for(g=0;g<b.length;g++)if(p.node(b[g])){this._expanded.push(b[g]);var d=this;this.tableTree.expand(b[g],function(){d._restoreSelections(a)});h=!0}return!h},_getUIStatePreferencePath:function(){if(this.explorer){var a=this.explorer.getRootPath();if(this._cachePrefix&&a)return a=a.replace(/[^\.\:\-\_0-9A-Za-z]/g,""),
"/"+this._cachePrefix+"/"+a+"/uiState"}return null},expandCollapseImageId:function(a){return a+"__expand"},updateExpandVisuals:function(a,h){var b=p.node(this.expandCollapseImageId(a.id));b&&(b.classList.remove(this._expandImageClass),b.classList.remove(this._collapseImageClass),b.classList.remove(this._progressImageClass),b.classList.add("progress"===h?this._progressImageClass:h?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(a,h,b,g){var d=document.createElement("span");
d.id=this.expandCollapseImageId(a.id);h.appendChild(d);d.classList.add(this._twistieSpriteClass);d.classList.add(this._collapseImageClass);if(b){var e=document.createElement("span");h.appendChild(e);e.classList.add(g||"imageSprite");e.classList.add(b)}var f=this;d.onclick=function(b){if(!f.explorer.getNavHandler().isDisabled(a)){f.tableTree.toggle(a.id);if(f.tableTree.isExpanded(a.id))f._expanded.push(a.id),f.explorer.postUserExpand&&f.explorer.postUserExpand(a.id);else for(var g in f._expanded)if(f._expanded[g]===
a.id){f._expanded.splice(g,1);break}(b=f._getUIStatePreferencePath())&&window.sessionStorage&&f._storeExpansions(b)}};return d},render:function(a,h){h.classList.add("navRow");this.renderRow(a,h)},rowsChanged:function(){"cursorOnly"!==this.explorer.selectionPolicy&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());this._noRowHighlighting||(p.$(".sectionTreeTable",this.tableNode.parentNode)||p.$(".treetable",this.tableNode.parentNode))&&p.$$array(".treeTableRow",this.tableNode).forEach(function(a,
h){var b=!(h%2)?"lightSectionTreeTableRow":"darkSectionTreeTableRow",g="lightSectionTreeTableRow"===b?"darkSectionTreeTableRow":"lightSectionTreeTableRow";a.classList.add(b);a.classList.remove(g)})},updateCommands:function(){if(this.commandService)for(var a=p.$$array(".treeTableRow"),h=0;h<a.length;h++){var b=a[h],g=p.node(b.id+"actionswrapper");this.commandService.destroy(g);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,g,b._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=
[];var a=this._getUIStatePreferencePath();a&&window.sessionStorage&&this._restoreExpansions(a)&&this._restoreSelections(a)}};return d}();e.SelectionRenderer=function(){function d(a,h){this._init(a);this.explorer=h}d.prototype=new e.ExplorerRenderer;d.prototype.renderTableHeader=function(a){var h=document.createElement("thead"),b=document.createElement("tr");h.classList.add("navTableHeading");this._useCheckboxSelection&&b.appendChild(this.initCheckboxColumn(a));for(var g=0,d=this.getCellHeaderElement(g);d;)0<
d.innerHTML.length&&d.classList.add("navColumn"),b.appendChild(d),d=this.getCellHeaderElement(++g);h.appendChild(b);0<g&&a.appendChild(h)};d.prototype.renderRow=function(a,h){h.verticalAlign="baseline";h.classList.add("treeTableRow");if(void 0===a.selectable||a.selectable){var b=this.explorer.getNavDict();if(b){"cursorOnly"!==this.explorer.selectionPolicy&&h.classList.add("selectableNavRow");b.addRow(a,h);var g=this;h.addEventListener("click",function(b){if(g.explorer.getNavHandler())g.explorer.getNavHandler().onClick(a,
b)},!1)}if(b=this.getCheckboxColumn(a,h))b.classList.add("checkColumn"),h.appendChild(b)}for(var b=0,d=this.getCellElement(b,a,h);d;)h.appendChild(d),0===b?this.getPrimColumnStyle?d.classList.add(this.getPrimColumnStyle(a)):d.classList.add("navColumn"):this.getSecondaryColumnStyle?d.classList.add(this.getSecondaryColumnStyle()):d.classList.add("secondaryColumn"),d=this.getCellElement(++b,a,h)};d.prototype.getCellHeaderElement=function(a){};d.prototype.getCellElement=function(a,h,b){};return d}();
e.SimpleFlatModel=function(){function d(a,h,b){this.items=a;this.getKey=b;this.idPrefix=h;this.root={children:a}}d.prototype=new e.ExplorerModel;d.prototype.getRoot=function(a){a(this.root)};d.prototype.getId=function(a){a=this.getKey(a).replace(/[\\\/]/g,"");for(var h="",b=0;b<a.length;b++)h=a[b].match(/[^\.\:\-\_0-9A-Za-z]/g)?h+a.charCodeAt(b):h+a[b];return this.idPrefix+h};d.prototype.getChildren=function(a,h){a===this.root?h(this.items):h([])};return d}();return e});
define("orion/URITemplate",[],function(){function m(a){this._text=a}function n(a){return a.replace("%25","%")}function p(a,g){if("U"===g)return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===g)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(h,n);if("U+R-,"===g)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+g);}function k(a,g,h){for(var d=
[],e=0;e<a.length;e++)"undefined"!==typeof a[e]&&d.push(p(a[e],g));return d.join(h)}function f(a,g,h,d){for(var e=Object.keys(a),f=[],l=0;l<e.length;l++)"undefined"!==typeof a[e[l]]&&f.push(p(e[l],g)+h+p(a[e[l]],g));return f.join(d)}function l(b){if(0===b.length)throw Error("Invalid Expression: 0 length expression");(this._operator=d[b[0]])?b=b.substring(1):this._operator=d.NUL;for(var g=[],h=b.split(","),e=0;e<h.length;e++){var f=h[e].match(a);if(null===f)throw Error("Bad VarSpec: "+b);g.push({name:f[1],
explode:!!f[2],prefix:f[3]?parseInt(f[3],10):-1})}this._varSpecList=g}function e(a){for(var g=[],h=0,d=a.indexOf("{",h);-1!==d;){g.push(new m(a.substring(h,d)));h=a.indexOf("}",d+1);if(-1===h)throw Error("Invalid template: "+a);g.push(new l(a.substring(d+1,h)));h+=1;d=a.indexOf("{",h)}g.push(new m(a.substring(h)));this._templateComponents=g}var d={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:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"\x26":{first:"\x26",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},a=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,h=/%25[0-9A-F][0-9A-F]/g;m.prototype={expand:function(a){return encodeURI(this._text)}};
l.prototype={expand:function(a){for(var g=[],h=0;h<this._varSpecList.length;h++){var d=this._varSpecList[h],e=d.name,l=a[e],m=typeof l;if("undefined"!==m&&null!==l){var t=0===g.length?this._operator.first:this._operator.sep;if("string"===m)this._operator.named&&(t+=p(e,"U+R"),t+=0===l.length?this._operator.ifemp:"\x3d"),-1!==d.prefix&&d.prefix<l.length&&(l=l.substring(0,d.prefix)),t+=p(l,this._operator.allow);else if(Array.isArray(l)){if(0===l.length)continue;d.explode?t+=k(l,this._operator.allow,
this._operator.sep):(d=k(l,this._operator.allow,","),this._operator.named&&(t+=p(e,"U+R"),t+=0===d.length?this._operator.ifemp:"\x3d"),t+=d)}else if("object"===m){if(0===Object.keys(l).length)continue;d.explode?t+=f(l,this._operator.allow,"\x3d",this._operator.sep):(d=f(l,this._operator.allow,",",","),this._operator.named&&(t+=p(e,"U+R"),t+=0===d.length?this._operator.ifemp:"\x3d"),t+=d)}else throw Error("bad param type: "+e+" : "+m);g.push(t)}}return g.join("")}};e.prototype={expand:function(a){for(var g=
[],h=0;h<this._templateComponents.length;h++)g.push(this._templateComponents[h].expand(a));return g.join("")}};return e});
define("orion/i18nUtil",["require","orion/Deferred"],function(m,n){function p(f){if(f=localStorage.getItem("orion/messageBundle/"+f))if(f=JSON.parse(f),f._expires&&f._expires>(new Date).getTime())return delete f._expires,f;return null}var k={};return{getMessageBundle:function(f){function l(a){a?m(["i18n!"+f],function(a){if(a){var b=f;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+b,JSON.stringify(a));delete a._expires}d.resolve(a)}):e(Error(f))}function e(a){d.reject(a)}
if(k[f])return k[f];var d=new n;k[f]=d;var a=p(f);if(a)return d.resolve(a),d;try{m([f],l,e)}catch(h){m(["orion/i18n!"+f],l,e)}return d},formatMessage:function(f){var l=arguments;return f.replace(/\$\{([^\}]+)\}/g,function(e,d){return l[(d<<0)+1]})}}});
define("orion/edit/editorContext",[],function(){return{getEditorContext:function(m){var n=Object.create(null);m.getServiceReferences("orion.edit.context").forEach(function(p){var k=m.getService(p);Object.keys(k).forEach(function(f){"function"===typeof k[f]&&(n[f]=k[f].bind(k))})});return n},getOptions:function(m){var n=Object.create(null);m.getServiceReferences("orion.edit.context").forEach(function(m){m.getPropertyKeys().forEach(function(k){"service.id"!==k&&("service.names"!==k&&"objectClass"!==
k)&&(n[k]=m.getProperty(k))})});return n}}});
define("orion/keyBinding",["orion/util"],function(m){function n(k,f,l,e,d,a){this.type=a||"keydown";this.keyCode="string"===typeof k&&"keydown"===this.type?k.toUpperCase().charCodeAt(0):k;this.mod1=void 0!==f&&null!==f?f:!1;this.mod2=void 0!==l&&null!==l?l:!1;this.mod3=void 0!==e&&null!==e?e:!1;this.mod4=void 0!==d&&null!==d?d:!1}function p(k){this.keys=k}n.prototype={getKeys:function(){return[this]},match:function(k,f){if(void 0!==f){if(0!==f)return!1}else if(k instanceof Array){if(1<k.length)return!1;
k=k[0]}return k.type!==this.type?!1:this.keyCode===k.keyCode||this.keyCode===String.fromCharCode(m.isOpera?k.which:void 0!==k.charCode?k.charCode:k.keyCode)?this.mod1!==(m.isMac?k.metaKey:k.ctrlKey)||"keydown"===this.type&&this.mod2!==k.shiftKey||this.mod3!==k.altKey||m.isMac&&this.mod4!==k.ctrlKey?!1:!0:!1},equals:function(k){return!k||this.keyCode!==k.keyCode||this.mod1!==k.mod1||this.mod2!==k.mod2||this.mod3!==k.mod3||this.mod4!==k.mod4||this.type!==k.type?!1:!0}};p.prototype={getKeys:function(){return this.keys.slice(0)},
match:function(k,f){var l=this.keys;if(void 0!==f)return f>l.length?!1:l[f].match(k)?f===l.length-1?!0:f+1:!1;k instanceof Array||(k=[k]);if(k.length>l.length)return!1;var e;for(e=0;e<k.length;e++)if(!l[e].match(k[e]))return!1;return e===l.length?!0:e},equals:function(k){if(!k.keys||k.keys.length!==this.keys.length)return!1;for(var f=0;f<k.keys.length;f++)if(!k.keys[f].equals(this.keys[f]))return!1;return!0}};return{KeyBinding:n,KeyStroke:n,KeySequence:p}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(m,n,p){function k(f,l){this._activeContainer=null;this._getElementsFunction=f;this._toolbarLayoutFunction=l}k.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&p.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&p.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();this._oldFocusNode&&(this._oldFocusNode.focus(),this._oldFocusNode=null)}this._activeElements=null},open:function(f,l,e){"string"===typeof f&&(f=p.node(f));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===f)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(f))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=e;var d=l(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!d)return!1;this._activeElements.focusNode=d;f=p.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(0===f.length){l=this._activeElements.dismissArea||
this._activeElements.parameterArea;f=document.createElement("button");f.id="closebox";f.className="imageSprite core-sprite-close dismissButton";f.title=m.Close;l.appendChild(f);var a=this;f.addEventListener("click",function(h){a.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);d&&(this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){d.focus();d.select&&d.select()},0));this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(f,l){p.$$array("input",l).forEach(function(d){"checkbox"===d.type?f.parameters.setValue(d.parameterName,d.checked):"button"!==d.type&&f.parameters.setValue(d.parameterName,d.value.trim())});p.$$array("textArea",l).forEach(function(d){f.parameters.setValue(d.parameterName,d.value.trim())});var e=f.parameters.getParameterElement;e&&f.parameters.forEach(function(d){(d=e(d,l))&&("checkbox"===d.type?
f.parameters.setValue(d.parameterName,d.checked):"button"!==d.type?f.parameters.setValue(d.parameterName,d.value.trim()):"textarea"!==d.type&&f.parameters.setValue(d.parameterName,d.value.trim()))});f.command.callback&&f.command.callback.call(f.handler,f)},collectParameters:function(f,l){return f.parameters?(f.domNode&&f.domNode.classList.add("commandMarker"),this.open(f.domNode||f.domParent,this.getFillFunction(f,null,l))):!1},getFillFunction:function(f,l,e){var d=this;return function(a,h){var b=
null,g=function(){l&&l();d.close()},u=function(b){b.keyCode===p.KEY.ENTER&&(d._collectAndCall(f,a),g(),p.stop(b));b.keyCode===p.KEY.ESCAPE&&("function"===typeof e&&e(),g(),p.stop(b))},k=f.parameters;k.forEach(function(h){var d=k.getParameterElement?k.getParameterElement(h,a):null,e=null;!d&&h.label&&(e=document.createElement("label"),e.classList.add("parameterInput"),e.setAttribute("for",h.name+"parameterCollector"),e.textContent=h.label,a.appendChild(e));var q=h.name+"parameterCollector",e=e||a;
"text"===h.type&&"number"===typeof h.lines&&1<h.lines?(d||(d=document.createElement("textarea"),d.rows=h.lines,d.type="textarea",d.id=q,e.appendChild(d)),u=function(a){a.keyCode===p.KEY.ESCAPE&&(g(),p.stop(a))}):"boolean"===h.type?(d||(d=document.createElement("input"),d.type="checkbox",d.id=q,e.appendChild(d)),h.value&&(d.checked=!0)):(d||(d=document.createElement("input"),d.type=h.type,d.id=q,e.appendChild(d)),h.value&&(d.value=h.value));d.classList.add("parameterInput");d.setAttribute("speech",
"speech");d.setAttribute("x-webkit-speech","x-webkit-speech");d.parameterName=h.name;b||(b=d);0<h.eventListeners.length&&h.eventListeners.forEach(function(a){d.addEventListener(a.event,function(b){return a.handler(b,f)},a.capture)});d.addEventListener("keydown",u,!1)});var q=h;q||(q=document.createElement("span"),q.classList.add("layoutRight"),q.classList.add("parametersDismiss"),a.appendChild(q));var r=function(a,b){var g=document.createElement("button");b.appendChild(g);a&&g.appendChild(document.createTextNode(a));
g.classList.add("dismissButton");return g};f.parameters.hasOptionalParameters()&&(f.parameters.optionsRequested=!1,r(m.More,q).addEventListener("click",function(){f.parameters.optionsRequested=!0;d._collectAndCall(f,a);g()},!1));r(k.getSubmitName?k.getSubmitName(f):m.Submit,q).addEventListener("click",function(){d._collectAndCall(f,a);g()},!1);q=r(null,q);q.id="closebox";q.classList.add("imageSprite");q.classList.add("core-sprite-close");q.title=m.Close;q.addEventListener("click",function(a){g();
"function"===typeof e&&e()},!1);return b}}};k.prototype.constructor=k;return{CommandParameterCollector:k}});define("orion/regex",[],function(){return{escape:function(m){return m.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26")},parse:function(m){return(m=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(m))?{pattern:m[1],flags:m[2]}:null}}});
define("orion/contentTypes",[],function(){function m(a,b){if("string"!==typeof a)return null;for(var g=a&&a.split(".").pop(),d=null,e=0;e<b.length;e++){var f=b[e],l;a:{l=d;var k=f,m=g,w=0<=k.filename.indexOf(a),p;p=m.toLowerCase();p=-1!==k.extension.indexOf(p);if(w||p){if(!(p=!l))w&&(m=m.toLowerCase(),w=-1!==l.extension.indexOf(m)),p=w;if(p){l=k;break a}}}l===f&&(d=f)}return d}function n(a){return null===a||"undefined"===typeof a?[]:Array.isArray(a)?a:[a]}function p(a){return n(a).map(function(a){return String.prototype.toLowerCase.call(a)})}
function k(a){return{id:a.id,name:a.name,image:a.image,imageClass:a.imageClass,"extends":a["extends"],extension:p(a.extension),filename:n(a.filename)}}function f(a){var b=Object.create(null);a.map(k).forEach(function(a){Object.prototype.hasOwnProperty.call(b,a.id)||(b[a.id]=a)});return b}function l(h){if(h&&h.registerService){this.serviceRegistry=h;for(var b=h.getServiceReferences(d).concat(h.getServiceReferences(a)),g=[],l=0;l<b.length;l++)for(var k=n(b[l].getProperty("contentTypes")),q=0;q<k.length;q++)g.push(k[q]);
this.map=f(g);h.registerService(e,this)}else if(Array.isArray(h))this.serviceRegistry=null,this.map=f(h);else throw Error("Invalid parameter");}var e="orion.core.contentTypeRegistry",d="orion.core.contenttype",a="orion.file.contenttype";l.prototype={getContentTypes:function(){var a=this.getContentTypesMap(),b=[],g;for(g in a)Object.prototype.hasOwnProperty.call(a,g)&&b.push(a[g]);return b},getContentTypesMap:function(){return this.map},getFileContentType:function(a){return m(a.Name,this.getContentTypes())},
getFilenameContentType:function(a){return m(a,this.getContentTypes())},getContentType:function(a){return this.map[a]||null},isExtensionOf:function(a,b){a="string"===typeof a?this.getContentType(a):a;b="string"===typeof b?this.getContentType(b):b;if(!a||!b)return!1;if(a.id===b.id)return!0;for(var g=a,d={};g&&(g=this.getContentType(g["extends"]));){if(g.id===b.id)return!0;if(d[g.id])throw Error("Cycle: "+g.id);d[g.id]=!0}return!1},isSomeExtensionOf:function(a,b){for(var g=0;g<b.length;g++)if(this.isExtensionOf(a,
b[g]))return!0;return!1}};return{ContentTypeRegistry:l,getFilenameContentType:m}});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(m,n,p,k,f,l,e){function d(){return m.toUrl?(new URL(m.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function a(a){var b={};a.getPropertyKeys().forEach(function(g){"objectClass"!==g&&("service.names"!==g&&"service.id"!==g&&"__plugin__"!==g)&&(b[g]=a.getProperty(g))});return b}function h(a){return f.getMessageBundle(a.nls).then(function(b){a.textContent=
a.nameKey?b[a.nameKey]:a.name;return a},function(b){a.textContent=a.nameKey||a.name;return a})}function b(b,g){var e=b.getServiceReferences(g||"orion.page.link"),f=p.matchResourceParameters(window.location.href),q={OrionHome:d(),Location:f.resource},l=[];e.forEach(function(b){b=a(b);if(b.uriTemplate&&(b.nls||b.name)){var g=(new k(b.uriTemplate)).expand(q),g=p.validateURLScheme(g);b.href=g;b.nls?l.push(h(b)):(b.textContent=b.name,l.push((new n).resolve(b)))}});return n.all(l)}function g(a){var b=this.categories=
Object.create(null);a.forEach(function(a){b[a.id]=a})}function u(a){this.allPageLinks=a;this.allPageLinks.sort(v)}function v(a,b){var g=a.textContent&&a.textContent.toLowerCase(),d=b.textContent&&b.textContent.toLowerCase();return g<d?-1:g>d?1:0}var q;l.mixin(g.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});l.mixin(u.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var b=a.href;a=
a.textContent;var g=document.createElement("a");g.href=b;g.target="_self";g.classList.add("targetSelector");g.textContent=a;return g})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(b){var d;return!q?(d=[],b.getServiceReferences("orion.page.link.category").forEach(function(g){var e=a(g);if(e.id&&(e.name||e.nameKey))e.service=b.getService(g),e.nls?d.push(h(e)):(e.textContent=e.name,d.push((new n).resolve(e)))}),n.all(d).then(function(a){return q=new g(a)})):(new n).resolve(q)},
getPageLinksInfo:function(a,g){return b(a,g).then(function(a){return new u(a)})},getOrionHome:d}});
define("orion/extensionCommands","require orion/Deferred orion/commands orion/regex orion/contentTypes orion/URITemplate orion/i18nUtil orion/URL-shim orion/PageLinks i18n!orion/edit/nls/messages".split(" "),function(m,n,p,k,f,l,e,d,a,h){function b(a){var b={};a.getPropertyKeys().forEach(function(g){b[g]=a.getProperty(g)});return b}var g={},u=a.getOrionHome();g._cloneItemWithoutChildren=function z(a){if(null===a||"object"!==typeof a)return a;var b=a.constructor(),g;for(g in a)"children"!==g&&"Children"!==
g&&(b[g]=z(a[g]));return b};g._getOpenWithNavCommandExtensions=function(a,b){function g(a,b){for(var d=a.getServiceReferences("orion.navigate.openWith"),h=[],e=[],s=0;s<d.length;s++){var f=d[s];if(f.getProperty("editor")===b.id){var q=f.getProperty("contentType");q instanceof Array?h=h.concat(q):h.push(q||"*/*");f=f.getProperty("excludedContentTypes");f instanceof Array?e=e.concat(f):null!==f&&"undefined"!==typeof f&&e.push(f)}}0===h.length&&(h=null);0===e.length&&(e=null);return{contentTypes:h,excludedContentTypes:e}}
for(var d=function(){for(var b=a.getServiceReferences("orion.edit.editor"),g=[],d=0;d<b.length;d++){var h=b[d],e=h.getProperty("id");g.push({id:e,"default":h.getProperty("default")||!1,name:h.getProperty("name"),nameKey:h.getProperty("nameKey"),nls:h.getProperty("nls"),uriTemplate:h.getProperty("orionTemplate")||h.getProperty("uriTemplate"),validationProperties:h.getProperty("validationProperties")||[]})}return g}(),h=[],e,s=0;s<d.length;s++){var f=d[s],q=g(a,f),q={properties:{name:f.name||f.id,nameKey:f.nameKey,
id:"eclipse.openWithCommand."+f.id,contentType:q.contentTypes,excludedContentTypes:q.excludedContentTypes,uriTemplate:f.uriTemplate,nls:f.nls,forceSingleItem:!0,isEditor:f["default"]?"default":"editor",validationProperties:f.validationProperties},service:{}};"orion.editor"===f.id?e=q:h.push(q)}e&&h.push(e);return h};g._makeValidator=function(a,b,g,d){function h(a,b,g,d,e){var s=!1,f;if("!"===b.charAt(0))return"undefined"===typeof a[b.substring(1)];if("undefined"!==typeof a[b]){if("undefined"===typeof g)f=
a[b],s=!0;else if("string"===typeof g){if(!typeof("string"===a[b]))return!1;if(d.variableName){if(g=RegExp(g).exec(a[b]))s=g[0],f="before"===d.variableMatchPosition?a[b].substring(0,g.index):"after"===d.variableMatchPosition?a[b].substring(g.index+s.length):"only"===d.variableMatchPosition?s:a[b],s=!0}else return RegExp(g).test(a[b])}else a[b]===g&&(f=a[b],s=!0);b=d.variableName;d=d.replacements;if(s&&b&&(e[b]=f,e.itemCached=a,d)){if("string"!==typeof f)return window.console.log("Cannot replace "+
b+", value is not a string: "+f),s;for(a=0;a<d.length;a++){f=!1;if(d[a].pattern){g=d[a].pattern;var q=d[a].replacement||"";e[b]=e[b].replace(RegExp(g),q).replace(RegExp(g),q)}else f=!0;f&&window.console.log("Invalid replacements specified in validation property.  "+d[a])}}return s}return!1}function e(a,b,g,d){var s=g.match,f,q;if(0<=(f=b.indexOf("["))){if(0>(q=b.indexOf("]")))return!1;var l=b.substring(0,f),u;if(!(u=a[l])||!Array.isArray(u))return!1;f=b.substring(f+1,q);f=parseInt(f,10);if(isNaN(f))return!1;
0>f&&(f+=u.length);b=b.substring(q+1);b=l+":"+String(f)+b}return 0<=b.indexOf("|")?(f=b.substring(0,b.indexOf("|")),b=b.substring(b.indexOf("|")+1),e(a,f,g,d)?!0:e(a,b,g,d)):0<=b.indexOf(":")?(f=b.substring(0,b.indexOf(":")),b=b.substring(b.indexOf(":")+1),a[f]?e(a[f],b,g,d):!1):h(a,b,s,g,d)}function s(b,g,d){if(d.info.validationProperties)for(var h=0;h<d.info.validationProperties.length;h++){var s=d.info.validationProperties[h];if("undefined"!==typeof s.source){if(!e(b,s.source,s,d))return!1}else return window.console.log("Invalid validationProperties in "+
a.id+".  No source property specified."),!1}var h=!0,q=g?f.getFilenameContentType(b.Name,g):null,q=q||{id:"application/octet-stream"};d.info.excludedContentTypes&&g&&(h=d.info.excludedContentTypes.every(function(a){a=a.replace(/([*?])/g,".$1");return-1!==q.id.search(a)?!1:!0}));h&&(d.info.contentType&&g)&&(h=d.info.contentType.some(function(a){a=a.replace(/([*?])/g,".$1");return-1!==q.id.search(a)?!0:!1}));return h}return{info:a,validationFunction:function(a){"function"===typeof d&&(a=d.call(this,
a));if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||this.info.uriTemplate)&&1!==a.length||1>a.length)return!1}else a=[a];for(var b=0;b<a.length;b++)if(!s(a[b],g,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var b={},g;for(g in a)Object.prototype.hasOwnProperty.call(a,g)&&(b[g]=a[g]);if(this.info.validationProperties)for(g=0;g<this.info.validationProperties.length;g++){var d=this.info.validationProperties[g];
d.source&&d.variableName&&(this.itemCached===a&&this[d.variableName]||e(a,d.source,d,this),a[d.variableName]?window.console.log("Variable name "+d.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):b[d.variableName]=this[d.variableName])}b.OrionHome=u;return(new l(this.info.uriTemplate)).expand(b)}return null}}};var v=h.UnnamedCommand;g._createCommandOptions=function(a,b,d,h,f,q){function s(e,s){var y=g._makeValidator(a,d,h,q);e.visibleWhen=
y.validationFunction.bind(y);if(f)if(y.generatesURI.bind(y)())e.hrefCallback=function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return y.getURI.bind(y)(a)};else{var l=a;e.callback=function(a){var h;if(l.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,h=g._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){h=[];for(var s=0;s<a.items.length;s++)h.push(g._cloneItemWithoutChildren(a.items[s]))}else h=g._cloneItemWithoutChildren(a.items);if(d)var f=d.getService("orion.page.progress");
b.run?f?f.progress(b.run(h),"Running command: "+e.name):b.run(h):d&&(f?f.progress(d.getService(b).run(h),"Running command: "+e.name):d.getService(b).run(h))}}s.resolve(e)}var y=new n;if(a.nls){var l=function(b){var g;b?(g=a.tooltipKey&&b[a.tooltipKey],b=a.nameKey&&b[a.nameKey]||a.name||v,g=g||a.tooltip||""):(b=a.name||a.nameKey||v,g=a.tooltip||a.tooltipKey||"");s({name:b,image:a.image,id:a.id||a.name,tooltip:g,isEditor:a.isEditor,showGlobally:a.showGlobally},y)};e.getMessageBundle(a.nls).then(l,l.bind(this,
null))}else s({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},y);return y};g.getOpenWithCommand=function(a,b,d){var h;a=d||g.getOpenWithCommands(a);for(d=0;d<a.length;d++)if(a[d].visibleWhen(b)){var e="default"===a[d].isEditor;if(!h||e)if(h=a[d],e)break}return h};g.getOpenWithCommands=function(a){var b=[],g;for(g in a._commandList){var d=a._commandList[g];d.isEditor&&b.push(d)}return b};var q;g.createAndPlaceFileCommandsExtension=function(a,
b,d,e,f,q){return g.createFileCommands(a,null,q?"all":void 0,!!q,b).then(function(a){f&&0<a.length&&(b.addCommandGroup(d,"eclipse.openWith",1E3,h.OpenWith,f,null,null,null,"dropdownSelection"),b.addCommandGroup(d,"eclipse.fileCommandExtensions",1E3,h.OpenRelated,f));a.forEach(function(a){var g=null;f&&(g=a.isEditor?f+"/eclipse.openWith":f+"/eclipse.fileCommandExtensions");b.registerCommandContribution(d,a.id,e,g)});return{}})};g.createFileCommands=function(a,b,d,h,e){d=void 0===d?"global":d;h=void 0===
h?!0:h;var f=[];g._cachedFileCommands||g._createCachedFileCommands(a);("all"===d||"global"===d)&&g._cachedFileCommands.forEach(function(a){var b=a.properties;("all"===d||b.forceSingleItem&&b.showGlobally)&&f.push(a)});return n.when(function(){var g=a.getService("orion.core.contentTypeRegistry")||b;return q||n.when(g.getContentTypes(),function(a){return q=a})}(),function(){h&&(g._cachedOpenWithExtensions||(g._cachedOpenWithExtensions=g._getOpenWithNavCommandExtensions(a,q)),f=f.concat(g._cachedOpenWithExtensions),
e._addedOpenWithCommands=h);var b=f.map(function(b){var d=b.properties;b=b.service;var h=e.findCommand(d.id||d.name);return h?(new n).resolve(h):g._createCommandOptions(d,b,a,q,!0).then(function(a){a=new p.Command(a);e.addCommand(a);return a})});return n.all(b,function(a){return{_error:a}}).then(function(a){return a})})};g._createCachedFileCommands=function(a){var d=a.getServiceReferences("orion.navigate.command");g._cachedFileCommands=[];for(var h=0;h<d.length;h++)if("orion.navigateFromMetadata"!==
d[h].getProperty("id")){var e=a.getService(d[h]),f=b(d[h]);g._cachedFileCommands.push({properties:f,service:e})}};g.getFileCommandIds=function(){var a=[];if(g._cachedFileCommands)g._cachedFileCommands.length&&(a=g._cachedFileCommands.map(function(a){return a.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return a};g.createOpenWithCommands=function(a,b,d){return d&&d._addedOpenWithCommands?(new n).resolve(g.getOpenWithCommands(d)):g.createFileCommands(a,b,
"none",!0,d)};return g});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(m,n){function p(k){this._init(k)}p.prototype={_init:function(k){var f=n.node(k.container);if(!f)throw"no parent container";this._container=f;f.classList.remove("currentLocation");this._id=k.id||"eclipse.breadcrumbs";this._resource=k.resource||null;this._rootSegmentName=k.rootSegmentName;this._workspaceRootSegmentName=k.workspaceRootSegmentName;this._workspaceRootURL=k.workspaceRootURL;this._makeHref=k.makeHref;this._makeFinalHref=
k.makeFinalHref;this._maxLength=k.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var k;if(this._resource&&this._resource.Parents&&!this._resource.skip){k=document.createElement("a");var f=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(k,f):k.href=m.toUrl("edit/edit.html")+"#"+f}else k=document.createElement("span");n.empty(k);k.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return k}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(k){var f=document.createElement("a");f.classList.add("breadcrumb");f.appendChild(document.createTextNode(k));return f},addSegmentHref:function(k,f){this._makeHref?this._makeHref(k,f.Location,f):k.href=m.toUrl("edit/edit.html")+"#"+f.ChildrenLocation},buildSegments:function(k,f){if(this._resource.Parents){var l=this._resource.Parents.slice(0),e,d;l&&(l=l.slice(0),"reverse"===f&&(l=l.reverse().slice(0)),
l.forEach(function(a){a.skip||(k?(d=k,k=null):d=a.Name,e=this.buildSegment(d),this.path+=a.Name,this.addSegmentHref(e,a),e.include=!1,this.segments.push(e))}.bind(this)))}},addDivider:function(){var k=document.createElement("span");k.appendChild(document.createTextNode(" / "));this.path+="/";k.classList.add("breadcrumbSeparator");this.append(k)},refresh:function(){(this.crumbs=n.node(this._id))?n.empty(this.crumbs):(this.crumbs=document.createElement("span"),this.crumbs.id=this._id,this._container.appendChild(this.crumbs),
this.dirty=document.createElement("span"),this.dirty.id="dirty",this.dirty.className="modifiedFileMarker",this._container.appendChild(this.dirty));this.crumbs.style.width="auto";this.crumbs.style.visibility="visible";this.crumbs.parentNode.className="currentLocation";this.crumbs.parentNode.style.width="auto"},append:function(k){this.crumbs.appendChild(k)},addTitle:function(k,f){var l=f||document.title;0===this.crumbs.childNodes.length&&(k=document.createElement("span"),k.appendChild(document.createTextNode(l)),
k.classList.add("breadcrumb"),k.classList.add("currentLocation"),this.append(k))},finalSegment:function(k,f){if(!this._resource.skip){var l;l=f?f:this._resource.Name;this._makeFinalHref?(k=this.buildSegment(l),this.addSegmentHref(k,this._resource)):(k=document.createElement("span"),k.appendChild(document.createTextNode(l)));k.classList.add("currentLocation");this.path+=this._resource.Name;this.append(k)}},firstSegment:function(k){k&&(this.append(k),this._resource&&this._resource.Parents&&!this._resource.skip?
(k.classList.add("breadcrumb"),this.addDivider()):(this._resource.skip||(k.href=""),k.classList.add("currentLocation")))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(k){!0===k.include&&(this.append(k),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var k=this.segments.slice(0).reverse();k.forEach(function(f){this.append(f);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?f.include=
!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=k.reverse()}},measure:function(){var k=this._container;k.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:k.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var k=this.getNavigatorWorkspaceRootSegment(),f=this._rootSegmentName;f?this.addTitle(k,f):(this.finalSegment(k,f),this._resource&&this._resource.Parents&&(this.buildSegments(f,"reverse"),this.measureSegments(),this.firstSegment(k)),
this.crumbs.offsetWidth>=this.MAX_LENGTH&&(this.INCLUDE_FIRST_SECTION=!1))},render:function(){this.refresh();var k=this.getNavigatorWorkspaceRootSegment(),f=this._rootSegmentName;f?this.addTitle(k,f):(!0===this.INCLUDE_FIRST_SECTION&&this.firstSegment(k),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(k,f)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};p.prototype.constructor=p;return{BreadCrumbs:p}});
define("orion/webui/splitter",["orion/EventTarget","orion/util","orion/webui/littlelib"],function(m,n,p){function k(f){m.attach(this);this._init(f)}k.prototype={_init:function(f){this._tracking=null;this._animationDelay=501;this._closeReversely=f.closeReversely;this.$node=p.node(f.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=p.node(f.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=p.node(f.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=f.vertical||!1;var l=this.$node.classList;l.add("split");l.add(this._vertical?"splitVerticalLayout":"splitLayout");l=this.$sideNode.classList;l.add("hasSplit");l.add(this._vertical?"sidePanelVerticalLayout":"sidePanelLayout");l=this.$mainNode.classList;l.add("hasSplit");l.add(this._vertical?"mainPanelVerticalLayout":"mainPanelLayout");this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");f.toggle&&(this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),
this._thumb.classList.add("splitThumb"),this._thumb.classList.add(this._vertical?"splitVerticalThumbLayout":"splitThumbLayout"));this._closeByDefault="closed"===this.$node.getAttribute("data-initial-state");"undefined"!==typeof f.closeByDefault&&(this._closeByDefault=f.closeByDefault);this._initializeFromStoredSettings();this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition();this.$node.style.visibility="visible";this.$mainNode.style.display="block";this.$sideNode.style.display=
"block";n.isIOS||n.isAndroid?(this.$node.addEventListener("touchstart",this._touchStart.bind(this),!1),this._thumb&&this._thumb.addEventListener("touchstart",this._touchStart.bind(this),!1),this.$node.addEventListener("touchmove",this._touchMove.bind(this),!1),this.$node.addEventListener("touchend",this._touchEnd.bind(this),!1)):(this.$node.addEventListener("mousedown",this._mouseDown.bind(this),!1),window.addEventListener("mouseup",this._mouseUp.bind(this),!1));window.addEventListener("resize",this._resize.bind(this),
!1)},isClosed:function(){return this._closed},getOrientation:function(){return this._vertical?"vertical":"horizontal"},setOrientation:function(f){f="vertical"===f;f!==this._vertical&&(this._vertical=f,f=this.$node.classList,f.toggle("splitLayout"),f.toggle("splitVerticalLayout"),this.$node.style.left="",this.$node.style.top="",f=this.$sideNode.classList,f.toggle("sidePanelLayout"),f.toggle("sidePanelVerticalLayout"),this.$sideNode.style.left="",this.$sideNode.style.top="",this.$sideNode.style.width=
"",this.$sideNode.style.height="",f=this.$mainNode.classList,f.toggle("mainPanelLayout"),f.toggle("mainPanelVerticalLayout"),this.$mainNode.style.left="",this.$mainNode.style.top="",this.$mainNode.style.width="",this.$mainNode.style.height="",this._thumb&&(f=this._thumb.classList,f.toggle("splitThumbLayout"),f.toggle("splitVerticalThumbLayout")),this._initializeFromStoredSettings(),this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition())},toggleSidePanel:function(){this._thumbDown()},
openSidePanel:function(){this._closed||this._thumbDown()},addResizeListener:function(f){this.addEventListener("resize",function(l){f(l.node)})},_initializeFromStoredSettings:function(){var f=localStorage.getItem(this._prefix+"/toggleState");this._closed="string"===typeof f?"closed"===f:this._closeByDefault;var f=p.bounds(this.$node.parentNode),l=p.bounds(this.$node),e;this._vertical?(e=localStorage.getItem(this._prefix+"/yPosition"))?(this._splitTop=parseInt(e,10),this._splitTop>f.top+f.height-l.height&&
(this._splitTop=f.top+f.height/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitTop=0):(e=localStorage.getItem(this._prefix+"/xPosition"))?(this._splitLeft=parseInt(e,10),this._splitLeft>f.left+f.width-l.width&&(this._splitLeft=f.left+f.width/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitLeft=0)},_getSplitPosition:function(){var f=p.bounds(this.$node),l=p.bounds(this.$node.parentNode);return this.vertical?f.top-l.top:f.left-l.left},
_adjustToSplitPosition:function(f){var l=p.bounds(this.$node),e=p.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=l.height;if(f||!this._splitTop)this._splitTop=l.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);f=this._splitTop;f=this._splitTop-e.top;this.$sideNode.style.height=f+"px";this.$sideNode.style.display="block";this.$node.style.top=f+"px"}else{this._splitWidth=l.width;if(f||!this._splitLeft)this._splitLeft=l.left,localStorage.setItem(this._prefix+"/xPosition",
this._splitLeft);f=this._splitLeft;f=this._splitLeft-e.left;this.$sideNode.style.width=f+"px";this.$sideNode.style.display="block";this.$node.style.left=f+"px"}this._resize()},_resize:function(f,l,e){f=f||0;var d=p.bounds(this.$node.parentNode),a=p.bounds(this.$node);this._vertical?(void 0===e&&(e=a.top-d.top),e+=a.height,this.$mainNode.style.top=e+"px"):(void 0===l&&(l=a.left-d.left),l+=a.width,this.$mainNode.style.left=l+"px");var h=this;window.setTimeout(function(){h._notifyResizeListeners(h.$mainNode);
h._notifyResizeListeners(h.$sideNode)},f)},_notifyResizeListeners:function(f){this.dispatchEvent({type:"resize",node:f})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(f,l){f||this._addAnimation();var e=this._splitTop,d=this._splitLeft;if(this._closed)this._closed=!1,!this._splitLeft&&(!this._splitTop&&"number"===typeof this._initialSplit)&&(e=d=this._initialSplit);else if(this._closed=!0,this._closeReversely){var a=p.bounds(this.$node.parentNode),
h=p.bounds(this.$node);this._vertical?e=a.height-h.height:d=a.width-h.width}else e=d=0;this._vertical?(this.$sideNode.style.height=e+"px",this.$node.style.top=e+"px"):(this.$sideNode.style.width=d+"px",this.$node.style.left=d+"px");this._resize(this._animationDelay,d,e);f||this._removeAnimation();l||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var b=this;window.setTimeout(function(){b._notifyToggleListeners()},this._animationDelay)},_removeAnimation:function(){var f=
this;window.setTimeout(function(){f.$sideNode.classList.remove(f._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");f.$mainNode.classList.remove(f._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");f.$node.classList.remove(f._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add(this._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");this.$mainNode.classList.add(this._vertical?
"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");this.$node.classList.add(this._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},_down:function(){this.$node.classList.add("splitTracking");this.$mainNode.classList.add("panelTracking");this.$sideNode.classList.add("panelTracking")},_move:function(f,l){var e=p.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=l;this._splitTop<e.top+5?this._splitTop=e.top+5:this._splitTop>e.top+e.height-5&&(this._splitTop=e.top+
e.height-5);var d=this._splitTop,d=this._splitTop-e.top;this.$node.style.top=d+"px"}else this._splitLeft=f,this._splitLeft<e.left+5?this._splitLeft=e.left+5:this._splitLeft>e.left+e.width-5&&(this._splitLeft=e.left+e.width-5),d=this._splitLeft,d=this._splitLeft-e.left,this.$node.style.left=d+"px";this._adjustToSplitPosition(!0)},_up:function(){this.$node.classList.remove("splitTracking");this.$mainNode.classList.remove("panelTracking");this.$sideNode.classList.remove("panelTracking")},_mouseDown:function(f){if(f.target===
this._thumb)return p.stop(f),this._thumbDown();this._tracking||(this._down(f),this._tracking=this._mouseMove.bind(this),window.addEventListener("mousemove",this._tracking),p.setFramesEnabled(!1),p.stop(f))},_mouseMove:function(f){this._tracking&&this._move(f.clientX,f.clientY)},_mouseUp:function(f){this._tracking&&(p.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this._up(),p.stop(f))},_touchStart:function(f){if(1===f.touches.length){p.stop(f);if(f.target===
this._thumb)return this._thumbDown();this._down(f);this._touching=!0}},_touchMove:function(f){this._touching&&(f=f.touches,1===f.length&&(f=f[0],this._move(f.clientX,f.clientY)))},_touchEnd:function(f){0===f.touches.length&&(this._touching=!1,this._up())}};k.prototype.constructor=k;return{Splitter:k,ORIENTATION_HORIZONTAL:"horizontal",ORIENTATION_VERTICAL:"vertical"}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(m,n,p){function k(f){this.commandRegistry=f.commandRegistry;this.create();this._filterString="";this._providers=[]}k.prototype={addProvider:function(f){this._providers.push(f)},create:function(){var f=this._keyAssistDiv=document.createElement("div");f.id="keyAssist";f.style.display="none";f.classList.add("keyAssistFloat");f.setAttribute("role","menu");var l=this._keyAssistInput=document.createElement("input");
l.classList.add("keyAssistInput");l.type="text";l.placeholder=m["Filter bindings"];f.appendChild(l);var e=this._keyAssistContents=document.createElement("div");e.classList.add("keyAssistContents");if(p.isIOS||p.isAndroid)e.style.overflowY="auto";f.appendChild(e);var d=this._keyAssistTable=document.createElement("table");d.tabIndex=0;d.classList.add("keyAssistList");e.appendChild(d);document.body.appendChild(f);l.addEventListener("keydown",function(a){this._keyDown(a)}.bind(this));d.addEventListener("keydown",
function(a){this._keyDown(a)}.bind(this));l.addEventListener("input",function(a){this.filterChanged()}.bind(this));e.addEventListener(p.isFirefox?"DOMMouseScroll":"mousewheel",function(a){this._scrollWheel(a)}.bind(this));document.addEventListener("keydown",function(a){a.keyCode===n.KEY.ESCAPE&&this.hide()}.bind(this));n.addAutoDismiss([f],function(){this.hide()}.bind(this))},createContents:function(){n.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var f=this._idCount=
this._keyAssistContents.scrollTop=0;f<this._providers.length;f++)this._providers[f].showKeyBindings(this);this.createHeader(m.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(f,l,e){if(this._filterString){var d=this._filterString.toLowerCase(),a;d!==this._filterString?(d=this._filterString,a=function(a){return a}):a=function(a){return a.toLowerCase()};if(-1===a(l).indexOf(d)&&-1===a(f).indexOf(d)&&-1===a(this._lastHeader).indexOf(d))return}var h=this._keyAssistTable.insertRow(-1);
h.id="keyAssist-keyBinding-"+this._idCount++;h.setAttribute("role","menuitem");h._execute=e;h.classList.add("keyAssistItem");h.addEventListener("click",function(a){this._selectedRow=h;this.execute();a.preventDefault()}.bind(this));e=h.insertCell(-1);e.classList.add("keyAssistName");e.appendChild(document.createTextNode(l));e=h.insertCell(-1);e.classList.add("keyAssistAccel");e.appendChild(document.createTextNode(f))},createHeader:function(f){this._lastHeader=f;var l=this._keyAssistTable.insertRow(-1);
l.classList.add("keyAssistSection");var l=l.insertCell(-1),e=document.createElement("h2");e.appendChild(document.createTextNode(f));l.appendChild(e)},execute:function(){window.setTimeout(function(){this.hide();var f=this._selectedRow;this._selectedRow=null;f&&f._execute&&f._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var f=this._keyAssistInput.value;this._filterString!==f&&(this._filterString=
f,this.createContents())}.bind(this),100)},hide:function(){if(this.isVisible()){var f=document.activeElement,l=this._keyAssistDiv,f=l===f||0!==(l.compareDocumentPosition(f)&16);l.style.display="none";f&&1!==document.compareDocumentPosition(this._previousActiveElement)&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return"block"===this._keyAssistDiv.style.display},removeProvider:function(f){f=this._providers.indexOf(f);-1!==f&&this._providers.splice(f,
1)},select:function(f){var l=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(0===l.length)this._selectedIndex=-1;else{var e=this._selectedIndex,e=(e+(f?1:-1))%l.length;0>e&&(e=l.length-1);-1!==this._selectedIndex&&(f=l[this._selectedIndex],f.classList.remove("selected"),this._selectedRow=null);this._selectedIndex=e;if(-1!==this._selectedIndex){this._selectedRow=f=l[this._selectedIndex];f.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",f.id);this._keyAssistTable.focus();
var l=f.getBoundingClientRect(),d=this._keyAssistContents,a=d.getBoundingClientRect();f.offsetTop<d.scrollTop?0===e?d.scrollTop=0:f.scrollIntoView(!0):l.bottom>a.bottom&&f.scrollIntoView(!1)}}},show:function(){this.isVisible()||(this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(0.75*this._keyAssistDiv.parentNode.clientHeight)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),
this._keyAssistInput.select())},_keyDown:function(f){if(40===f.keyCode)this.select(!0);else if(38===f.keyCode)this.select(!1);else if(13===f.keyCode)this.execute();else return;f.preventDefault()},_scrollWheel:function(f){var l=0,l=p.isIE||p.isOpera?-f.wheelDelta:p.isFirefox?40*f.detail:-f.wheelDeltaY,e=this._keyAssistContents,d=e.scrollTop;e.scrollTop+=l;if(d!==e.scrollTop)return f.preventDefault&&f.preventDefault(),!1}};return{KeyAssistPanel:k}});
define("orion/widgets/themes/ThemePreferences",[],function(){function m(m,p){this._preferences=m;this._themeData=p;var k=p.getThemeStorageInfo();this._themeVersion=k.version;var f=m.listenForChangedSettings(k.storage,2,function(l){l.key===f&&this.apply()}.bind(this))}m.prototype={_initialize:function(m,p,k){var f,l;void 0===this._themeVersion||k.get("version")===this._themeVersion?(f=k.get(m.styleset),(l=k.get("selected"))&&(l=JSON.parse(l))):l=f=null;f||(f=p.getStyles(),k.put(m.styleset,JSON.stringify(f)));
if(!l||void 0===l[m.selectedKey])l=l||{},l[m.selectedKey]=m.defaultTheme,k.put("selected",JSON.stringify(l));k.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(m){var p=this._themeData,k=p.getThemeStorageInfo();this._preferences.getPreferences(k.storage,2).then(function(f){this._initialize(k,p,f);var l=JSON.parse(f.get("selected"));f=JSON.parse(f.get(k.styleset));var e;if(f)for(var d=0;d<f.length;d++)if(f[d].name===l[k.selectedKey]){e=f[d];break}m({style:e,styles:f})}.bind(this))},
setTheme:function(m,p){var k=this._themeData,f=k.getThemeStorageInfo();this._preferences.getPreferences(f.storage,2).then(function(l){this._initialize(f,k,l);var e=JSON.parse(l.get("selected"));m||(m=e[f.selectedKey]);e[f.selectedKey]=m;l.put("selected",JSON.stringify(e));p?l.put(f.styleset,JSON.stringify(p)):p=JSON.parse(l.get(f.styleset));for(var d=0;d<p.length;d++)if(p[d].name===e[f.selectedKey]){k.processSettings(p[d]);break}l.put("version",this._themeVersion)}.bind(this))},setFontSize:function(m){var p=
this._themeData,k=p.getThemeStorageInfo();this._preferences.getPreferences(k.storage,2).then(function(f){this._initialize(k,p,f);var l=JSON.parse(f.get("selected")),e=JSON.parse(f.get(k.styleset)),d;if(e)for(var a=0;a<e.length;a++)e[a].fontSize=m,e[a].name===l[k.selectedKey]&&(d=e[a]);f.put(k.styleset,JSON.stringify(e));p.processSettings(d)}.bind(this))}};return{ThemePreferences:m}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
DeleteUser:"Delete User Profile as well as workspaces and projects",DeleteUserComfirmation:"WARNING: This will permanently delete your user profile as well all your work!","Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value",
"JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item","Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",
general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",
Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",
showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",
autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair \x3cAngle\x3e Brackets",autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated",
"Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:","Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color",
"Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute","Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute",
"CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: ",splitEditors:"Split Editors",splitOrientation:"Split Orientation",horizontal:"Horizontal",vertical:"Vertical"});define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/editor/eventTarget",[],function(){function m(){}m.addMixin=function(n){var p=m.prototype,k;for(k in p)p.hasOwnProperty(k)&&(n[k]=p[k])};m.prototype={addEventListener:function(m,p,k){this._eventTypes||(this._eventTypes={});var f=this._eventTypes[m];f||(f=this._eventTypes[m]={level:0,listeners:[]});f.listeners.push({listener:p,useCapture:k})},dispatchEvent:function(m){var p=m.type;this._dispatchEvent("pre"+p,m);this._dispatchEvent(p,m);this._dispatchEvent("post"+p,m)},_dispatchEvent:function(m,
p){var k=this._eventTypes?this._eventTypes[m]:null;if(k){var f=k.listeners;try{if(k.level++,f)for(var l=0,e=f.length;l<e;l++)if(f[l]){var d=f[l].listener;"function"===typeof d?d.call(this,p):d.handleEvent&&"function"===typeof d.handleEvent&&d.handleEvent(p)}}finally{if(k.level--,k.compact&&0===k.level){for(l=f.length-1;0<=l;l--)f[l]||f.splice(l,1);0===f.length&&delete this._eventTypes[m];k.compact=!1}}}},isListening:function(m){return!this._eventTypes?!1:void 0!==this._eventTypes[m]},removeEventListener:function(m,
p,k){if(this._eventTypes){var f=this._eventTypes[m];if(f){for(var l=f.listeners,e=0,d=l.length;e<d;e++){var a=l[e];if(a&&a.listener===p&&a.useCapture===k){0!==f.level?(l[e]=null,f.compact=!0):l.splice(e,1);break}}0===l.length&&delete this._eventTypes[m]}}}};return{EventTarget:m}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(m,n,p){function k(f){f=f||{};this._document=f.document||document}var f={};k.getTheme=function(l){l=l||"default";var e=f[l];e||(e=f[l]=new k);return e};k.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(f,e){var d=this,a=d._themeClass;d._themeClass=f;this._load(f,e,function(){d.onThemeChanged({type:"ThemeChanged",oldValue:a,newValue:d.getThemeClass()})})},onThemeChanged:function(f){return this.dispatchEvent(f)},
buildStyleSheet:function(f,e){function d(d,b,g){b&&(a.push("."+f+" ."+d+" {"),a.push("\t"+(g?"background-color":"color")+": "+b+";"),a.push("}"))}var a=[];a.push("");a.push("."+f+" {");e.fontFamily&&a.push("\tfont-family: "+e.fontFamily+";");e.fontSize&&a.push("\tfont-size: "+e.fontSize+";");e.fontSize&&a.push("\tcolor: "+e.text+";");a.push("}");a.push("."+f+".textview {");e.background&&a.push("\tbackground-color: "+e.background+";");a.push("}");a.push("."+f+" .textviewLeftRuler {");e.leftRuler&&
a.push("\tborder-right: 1px solid "+e.leftRuler+";");a.push("}");a.push("."+f+" .textviewRightRuler {");e.rightRuler&&a.push("\tborder-left: 1px solid "+e.rightRuler+";");a.push("}");d("ruler.annotations",e.annotationRuler,!0);d("ruler.lines",e.annotationRuler,!0);d("ruler.folding",e.annotationRuler,!0);d("ruler.overview",e.overviewRuler,!0);d("rulerLines",e.lineNumber,!1);d("rulerLines.even",e.lineNumberEven,!1);d("rulerLines.odd",e.lineNumberOdd,!1);d("annotationLine.currentLine",e.currentLine,
!0);d("entity-name-tag",e.keyword,!1);d("entity-other-attribute-name",e.attribute,!1);d("string-quoted",e.string,!1);d("meta.annotation.currentLine",e.currentLine,!0);d("keyword",e.keyword,!1);d("string",e.string,!1);d("constant",e.constant,!1);d("comment",e.comment,!1);d("comment.block.documentation",e.comment,!1);d("keyword.other.documentation.markup",e.comment,!1);d("keyword.other.documentation.markup",e.comment,!1);return a.join("\n")},_createStyle:function(f,e,d,a){var h=this._document;f="orion-theme-"+
f;var b=h.getElementById(f);if(b){if(a||b.firstChild.data===e)return;b.removeChild(b.firstChild);b.appendChild(h.createTextNode(e))}else a?(b=p.createElement(h,"link"),b.rel="stylesheet",b.type="text/css",b.href=e,b.addEventListener("load",function(){d()})):(b=p.createElement(h,"style"),b.appendChild(h.createTextNode(e))),b.id=f,(h.getElementsByTagName("head")[0]||h.documentElement).appendChild(b);a||d()},_load:function(f,e,d){if(f)if("string"===typeof e)this._createStyle(f,e,d);else if(e=e.href,
".css"!==e.substring(e.length-4)&&(e+=".css"),/^\//.test(e)||/[a-zA-Z0-9]+:\/\//i.test(e)||!m.toUrl)this._createStyle(f,e,d,!0);else{var a=this;m(["text!"+e],function(h){a._createStyle(f,h,d,!1)})}else d()}};n.EventTarget.addMixin(k.prototype);return{TextTheme:k}});
define("orion/widgets/themes/ThemeClass",[],function(){function m(m){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=m;this.classString="."+m+"{ "}m.prototype.className=null;m.prototype.classString=void 0;m.prototype.style=void 0;m.prototype.closeString=" }\n";m.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:m}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(m){function n(){}n.prototype.navbar="white";n.prototype.button="#777777";n.prototype.location="#EFEFEF";n.prototype.selection="#cedce7";n.prototype.sidepanel="#F7F7F7";n.prototype.mainpanel="white";n.prototype.navtext="#bfbfbf";n.prototype.content="#3087B3";n.prototype.search="#444";n.prototype.toolpanel="white";n.prototype.writeNavigationStyle=function(){var p="",k=[],f=new m.ThemeClass("orionPage");
f.style.backgroundColor="#fdfdfd";f.style.width="100%";f.style.height="100%";k.push(f);f=new m.ThemeClass("topRowBanner");f.style.margin="0";f.style.border="0";f.style.backgroundColor=this.navbar;f.style.height="16px";f.style.padding="10px";f.style.paddingLeft="6px";f.style.paddingRight="2px";f.style.borderBottom="none";f.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";f.style.zIndex="100";k.push(f);f=new m.ThemeClass("a");f.style.textDecoration="none";f.style.color=
this.content;k.push(f);f=new m.ThemeClass("navlink");f.style.display="inline-block";f.style.padding="2px";f.style.color=this.content;f.style.verticalAlign="bottom";k.push(f);f=new m.ThemeClass("primaryNav");f.style.color=this.navtext;f.style.fontSize="8pt";f.style.fontWeight="normal";f.style.paddingTop="0";f.style.verticalAlign="baseline";k.push(f);f=new m.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";k.push(f);f=new m.ThemeClass("primaryNav a:hover");f.style.color="#bfbfbf";f.style.cursor="hand";f.style.color="white";f.style.fontWeight="normal";k.push(f);for(var l in k)p+=k[l].toString();return p};n.prototype.writeLocationStyle=function(){var p="",k=[],f=new m.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";k.push(f);f=new m.ThemeClass("breadcrumb");f.style.fontSize="8pt";f.style.textDecoration="none";f.style.color="#f1f1f2;";f.style.paddingTop="2px";k.push(f);f=new m.ThemeClass("a.breadcrumb:hover");f.style.textDecoration="none";f.style.borderBottom="1px dotted";f.style.color="#F58B0F";f.style.cursor="pointer";k.push(f);f=new m.ThemeClass("breadcrumbSeparator");f.style.fontSize=
"8pt";f.style.textDecoration="none";f.style.color=this.separator;f.style.fontWeight="bold";k.push(f);f=new m.ThemeClass("currentLocation");f.style.fontWeight="bold";f.style.fontSize="8pt";f.style.color=this.breadcrumb;f.style.textDecoration="none";f.style.textWrap="normal";f.style.lineHeight="10pt";k.push(f);f=new m.ThemeClass("a.currentLocation:hover");f.style.fontWeight="bold";f.style.fontSize="10pt";f.style.color="#666666";f.style.textDecoration="none";f.style.borderBottom="0";k.push(f);f=new m.ThemeClass("navlinkonpage");
f.style.color=this.content;f.style.verticalAlign="middle";k.push(f);this.bannerProgress&&(f=new m.ThemeClass("topRowBanner .progressPane_running"),f.style.borderColor=this.bannerProgress,k.push(f));for(var l in k)p+=k[l].toString();return p};n.prototype.writeButtonStyle=function(){var p="",k=[],f=new m.ThemeClass("commandButton");f.style.color="#666";f.style.border="1px solid #dedede";f.style.backgroundColor="#ddd";f.style.textAlign="center";f.style.verticalAlign="middle";f.style.cursor="pointer";
f.style.display="inline-block";f.style.padding="4px 6px";f.style.borderRadius="3px";f.style.lineHeight="12px";f.style.fontSize="9pt";f.style.userSelect="none";k.push(f);f=new m.ThemeClass("commandButton:over");f.style.backgroundColor="#e6e6e6";f.style.border="1px solid #808080";k.push(f);f=new m.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";k.push(f);f=new m.ThemeClass("commandMenuItem");f.style.border="0";f.style.padding="0";f.style.margin="0";k.push(f);for(var l in k)p+=k[l].toString();return p};n.prototype.writeMainStyle=function(){var p="",k=[],f=new m.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";k.push(f);f=new m.ThemeClass("searchbox:focus");f.style.color="white";f.style.outline=
"none";k.push(f);f=new m.ThemeClass("checkedRow");f.style.cssText="background-color:"+this.selection+" !important;";k.push(f);f=new m.ThemeClass("navbar-item-selected");f.style.background=this.selection;f.style.color=this.content;k.push(f);f=new m.ThemeClass("auxpane");f.style.border="0";f.style.background=this.sidepanel;k.push(f);f=new m.ThemeClass("mainpane");f.style.background=this.mainpanel;f.style.border=0;k.push(f);f=new m.ThemeClass("mainToolbar");f.style.background=this.toolpanel;k.push(f);
for(var l in k)p+=k[l].toString();return p};n.prototype.render=function(m){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};n.prototype.getSheet=function(m){m.navbar.value?(this.navbar=m.navbar.value,this.button=m.button.value,this.location=m.location.value,this.selection=m.selection.value,this.sidepanel=m.sidepanel.value,this.mainpanel=m.mainpanel.value,this.navtext=m.navtext.value,this.search=
m.search.value,this.content=m.content.value,this.toolpanel=m.toolpanel.value,this.bannerProgress=m.bannerProgress.value):(this.navbar=m.navbar,this.button=m.button,this.location=m.location,this.selection=m.selection,this.sidepanel=m.sidepanel,this.mainpanel=m.mainpanel,this.navtext=m.navtext,this.search=m.search,this.content=m.content,this.toolpanel=m.toolpanel,this.bannerProgress=m.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:n}});define("orion/widgets/themes/ThemeVersion",[],function(){return"6.1"});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter","orion/widgets/themes/ThemeVersion"],function(m,n,p,k){function f(){}function l(){this.styles=[];var d=new f;d.name="Orion";d.navbar="white";d.button="#EFEFEF";d.location="#efefef";d.selection="FEC";d.sidepanel="#FBFBFB";d.mainpanel="white";d.toolpanel="white";d.navtext="#bfbfbf";d.content="#3087B3";d.search="#444";d.breadcrumb="#3087B3";
d.separator="#333";d.bannerProgress="whitesmoke";this.styles.push(d);d=new f;d.name="Orion2014";d.navbar="white";d.button="#EFEFEF";d.location="#EFEFEF";d.selection="FEC";d.sidepanel="#EEEEEE";d.mainpanel="#EEEEEE";d.toolpanel="#EEEEEE";d.navtext="#BFBFBF";d.content="#333333";d.search="#444444";d.breadcrumb="#333333";d.separator="#333333";d.bannerProgress="orange";this.styles.push(d);d=new f;d.name="Green Zone";d.navbar="seagreen";d.button="lavender";d.location="darkseagreen";d.selection="moccasin";
d.sidepanel="aliceblue";d.mainpanel="white";d.toolpanel="white";d.navtext="#FBFBFB";d.content="darkgreen";d.search="darkgreen";d.breadcrumb="#3087B3";d.separator="seagreen";d.bannerProgress="#F2F2F2";this.styles.push(d);d=new f;d.name="Pretty In Pink";d.navbar="plum";d.button="lavender";d.location="pink";d.selection="lavender";d.sidepanel="seashell";d.mainpanel="white";d.toolpanel="white";d.navtext="#FBFBFB";d.content="mediumorchid";d.search="violet";d.breadcrumb="#3087B3";d.separator="plum";d.bannerProgress=
"#F2F2F2";this.styles.push(d);d=new f;d.name="Blue Monday";d.navbar="cornflowerblue";d.button="lavender";d.location="skyblue";d.selection="lavender";d.sidepanel="aliceblue";d.mainpanel="white";d.toolpanel="white";d.navtext="#FBFBFB";d.content="royalblue";d.search="royalblue";d.breadcrumb="#3087B3";d.separator="cornflowerblue";d.bannerProgress="#F2F2F2";this.styles.push(d);d=new f;d.name="Vanilla Skies";d.navbar="sandybrown";d.button="lemmonchiffon";d.location="cornsilk";d.selection="lemonchiffon";
d.sidepanel="white";d.mainpanel="white";d.toolpanel="white";d.navtext="lemonchiffon";d.content="chocolate";d.search="moccasin";d.breadcrumb="#3087B3";d.separator="sandybrown";d.bannerProgress="#F2F2F2";this.styles.push(d);d=new f;d.name="Beetlejuice";d.navbar="indigo";d.button="slateblue";d.location="darkslateblue";d.selection="silver";d.sidepanel="lavender";d.mainpanel="white";d.toolpanel="white";d.navtext="#FBFBFB";d.content="mediumslateblue";d.search="#444";d.breadcrumb="#3087B3";d.separator="indigo";
d.bannerProgress="#F2F2F2";this.styles.push(d);d=new f;d.name="Red";d.navbar="#CD2127";d.button="#777777";d.location="#D85F56";d.selection="lightcoral";d.sidepanel="#EFDAB2";d.mainpanel="#FDFADD";d.toolpanel="#FDFADD";d.navtext="#FBFBFB";d.content="darkred";d.search="#D85F56";d.breadcrumb="darkred";d.separator="#CD2127";d.bannerProgress="#F2F2F2";this.styles.push(d)}function e(){return this.styles}f.prototype.name="Orion";f.prototype.navbar="#404648";f.prototype.button="#EFEFEF";f.prototype.location=
"#333";f.prototype.breadcrumb="#3087B3";f.prototype.separator="#333";f.prototype.selection="FEC";f.prototype.sidepanel="#FBFBFB";f.prototype.mainpanel="white";f.prototype.toolpanel="white";f.prototype.navtext="#bfbfbf";f.prototype.content="#3087B3";f.prototype.search="#444";f.prototype.bannerProgress="white";l.prototype.styles=[];l.prototype.getStyles=e;l.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:k}};
l.prototype.getViewData=function(){var d={top:10,left:10,width:350,height:350};d.shapes=[{type:"RECTANGLE",name:m["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:m["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:m["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:m["Tool Panel"],x:150,y:71,width:209,height:30,
family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",name:m["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:m.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:m["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:m.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},
{type:"TEXT",name:m.Content,label:"/",x:78,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:m.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:m["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:m.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:m["Button Text"],label:"Button",x:158,y:90,
family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:m["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:m["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:m["Line Color"],x1:150,
y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:m["Line Color"],x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:m["Side Panel"],x:10,y:71,width:140,height:289,family:"sidepanel",fill:"#FBFBFB",order:12},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:m["Navigation Text"],label:"Navigator",
x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"}];for(var a=0;3>a;a++)d.shapes.push({type:"TEXT",name:m.Content,label:"org.eclipse.orion.content",x:170,y:127+20*a,fill:"#3087B3",family:"content"});for(a=0;3>a;a++)d.shapes.push({type:"TEXT",name:m.Content,label:"Item",
x:25,y:115+20*a,fill:"#3087B3",family:"content"});for(a=0;3>a;a++)d.shapes.push({type:"TRIANGLE",name:"twisty",x1:160,y1:121+20*a,x2:165,y2:124+20*a,x3:160,y3:127+20*a,family:"navbar",fill:"#333"});d.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return d};l.prototype.processSettings=function(d){var a=new p.ThemeSheetWriter;(new n.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",a.getSheet(d))};return{ThemeData:l,getStyles:e}});
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"," \x3cNo available services or timed out, check URL and try reloading\x3e":" \x3cNo available services or timed out, check URL and try reloading\x3e",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 (? \x3d any character, * \x3d any string):":"Type the name of a file to open (? \x3d any character, * \x3d any string):",Search:"Search","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","\x3c/a\x3e":"\x3c/a\x3e","\x3e":"\x3e","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links",Yes:"Yes",No:"No","Click or use delete key to delete the search term":"Click or use delete key to delete the search term"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(m){function n(p,k,f){this.elements=f;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='\x3cheader class\x3d"UAHeader"\x3eDevelop software from within the cloud\x3c/header\x3e';this.elementNode=document.createElement("div");this.switchesContainer=document.createElement("div");this.switches=document.createElement("span");this.radioButtons=[];this.elementNode.className=
"UAContainer-body";this.taskPanel.appendChild(this.elementNode);this.switchesContainer.className="UAContainer-switch-body";this.switches.className="UAContainer-switches";this.switchesContainer.innerHTML="";this.switchesContainer.appendChild(this.switches);this.taskPanel.appendChild(this.switchesContainer);!0===k?(this.container=document.createElement("div"),this.container.className="UAModal",this.container.appendChild(this.taskPanel),this.backdrop=document.createElement("div"),this.backdrop.className=
"UAModalBackground",document.body.appendChild(this.backdrop),document.body.appendChild(this.container),m.addAutoDismiss([this.container],this.destroy.bind(this))):p.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}n.prototype.elementNode=null;n.prototype.switchesContainer=null;n.prototype.switches=null;n.prototype.radioButtons=null;n.prototype.chosenSwitch=
null;n.prototype.addElement=function(m){var k=document.createElement("span");k.className="UAContainer-icon";k.innerHTML='\x3cspan class\x3d"workingSpan"\x3e\x3cimg src\x3d"'+m.image+'" id\x3d"'+m.label+'ImageNode" alt\x3d"'+m.alt+'" height\x3d"64" width\x3d"64"\x3e\x3c/span\x3e\x3cspan class\x3d"UAIcon-label"\x3e\x3cspan class\x3d"UALabel" id\x3d"'+m.label+'LabelNode" \x3e'+m.label+"\x3c/span\x3e\x3c/span\x3e";k.onmouseover=function(){document.getElementById(m.label+"ImageNode").src=m.secondaryImage;
document.getElementById(m.label+"LabelNode").className="UALabel-live";k.className="UAContainer-icon-live"};k.onmouseout=function(){document.getElementById(m.label+"ImageNode").src=m.image;document.getElementById(m.label+"LabelNode").className="UALabel";k.className="UAContainer-icon"};var f=this;k.onclick=function(){f.showMedia(m)};this.elementNode.appendChild(k)};n.prototype.clearElements=function(){this.elementNode.innerHTML=""};n.prototype.showMedia=function(m){this.clearElements();this.addElement(m);
var k=document.createElement("span");k.className="UAContainer-media";k.innerHTML='\x3cdiv\x3e\x3c/div\x3e\x3cdiv\x3e\x3c/div\x3e\x3cspan class\x3d"mediaSpan"\x3e\x3cimg src\x3d"'+m.media+'" alt\x3d"'+m.alt+'" height\x3d"300" width\x3d"400"\x3e\x3c/span\x3e';this.elementNode.appendChild(k);setTimeout(function(){k.style.opacity=1},100);m=document.getElementById(m.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=m.parentNode;m.className="chosenCircle"};n.prototype.createSwitch=
function(m){var k;k=m?m.label+"switch":"indexSwitch";var f=document.createElement("span");f.className="workingSpan";f.innerHTML='\x3cdiv class\x3d"circle" id \x3d"'+k+'"\x3e\x3c/div\x3e';var l=this;f.onclick=m?function(){l.showMedia(m)}:function(){l.initialize();l.chosenSwitch.firstChild.className="circle";l.chosenSwitch=f;l.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(f);return this.radioButtons[this.radioButtons.length]=f};n.prototype.initialize=function(){this.clearElements();
this.elements.forEach(this.addElement.bind(this))};n.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return n});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(m,n,p,k){function f(){}var l=null;f.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'\x3cdiv class\x3d"dialog" role\x3d"dialog"\x3e\x3cdiv class\x3d"dialogTitle"\x3e\x3cspan id\x3d"title" class\x3d"dialogTitleText layoutLeft"\x3e\x3c/span\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" id\x3d"closeDialog"\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv id\x3d"dialogContent" class\x3d"dialogContent layoutBlock"\x3e\x3c/div\x3e\x3cdiv id\x3d"buttons" class\x3d"dialogButtons"\x3e\x3c/div\x3e\x3c/div\x3e',_initialize:function(){var e=
document.body;this.$frameParent=e;this.$$modalExclusions=this.$$modalExclusions||[];var d=document.createRange();d.selectNode(e);d=d.createContextualFragment(this.CONTAINERTEMPLATE);e.appendChild(d);this.$frame=e.lastChild;this.title&&p.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=p.$("#closeDialog",this.$frame);var a=this;this.$close.addEventListener("click",function(d){a.hide()},!1);this.$parent=p.$(".dialogContent",this.$frame);d=document.createRange();d.selectNode(this.$parent);
e=d.createContextualFragment(this.TEMPLATE);this.messages&&p.processTextNodes(e,this.messages);this.$parent.appendChild(e);this.$buttonContainer=p.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(d){d.keyCode===p.KEY.ESCAPE?a.hide():d.keyCode===p.KEY.ENTER&&"function"===typeof a._defaultCallback&&a._defaultCallback()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_makeButtons:function(){if(this.$buttonContainer&&
Array.isArray(this.buttons)){var e=this;this.buttons.forEach(function(d){var a=k.createButton(d.text,d.callback);d.id&&(a.id=d.id,e["$"+a.id]=a);d.isDefault&&(e._defaultCallback=d.callback,e._defaultButton=a);e.$buttonContainer.appendChild(a)})}},_makeModal:function(e){var d=this;this.$frame.addEventListener("blur",function(a){d.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var b=!p.contains(d.$frame,a.target);if(b)for(var h=0;h<d.$$modalExclusions.length;h++)if(p.contains(d.$$modalExclusions[h],
a.target)){b=!1;break}b&&(window.setTimeout(function(){(d.$lastFocusedElement||d.$parent).focus()},0),p.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);e=this.$frameParent.childNodes;var a=!1;this._addedBackdrop=[];for(var h=0;h<e.length;h++){for(var b=0;b<this.$$modalExclusions.length;b++)if(p.contains(this.$$modalExclusions[b],e[h])){a=!0;break}!a&&(e[h]!==d.$frame&&e[h].classList&&!e[h].classList.contains("tooltipContainer"))&&
(b=e[h],b.classList.contains("modalBackdrop")||(b.classList.add("modalBackdrop"),this._addedBackdrop.push(b)))}(e=p.lastTabbable(this.$buttonContainer)||p.lastTabbable(this.$parent))&&e.addEventListener("keydown",function(a){if(a.keyCode===p.KEY.TAB){var b=d._getFirstFocusField();b&&b!==a.target&&b.focus();p.stop(a)}},!1)},_addChildDialog:function(e){this.$$modalExclusions.push(e.$frame||e.$parent)},_inModalExclusion:function(e){return this.$$modalExclusions.some(function(d){return e.$frame===d||
e.$parent===d})},_bindElements:function(e){for(var d=0;d<e.childNodes.length;d++){var a=e.childNodes[d];a.id&&(this["$"+a.id]=a);this._bindElements(a)}},hide:function(e){!e&&l===this&&(l=null);"function"===typeof this._beforeHiding&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0));this.$frame.classList.remove("dialogShowing");p.setFramesEnabled(!0);"function"===typeof this._afterHiding&&
this._afterHiding();var d=this;this.keepAlive||window.setTimeout(function(){d.destroy()},0)},show:function(e){if(this.modal)if(this._makeModal(),l){if(!l._inModalExclusion(this)){this.hide(!0);return}}else l=this;"function"===typeof this._beforeShowing&&this._beforeShowing();p.setFramesEnabled(!1);var d=p.bounds(this.$frame),a=p.bounds(document.documentElement),h;e?(h=p.bounds(e),e=h.top+h.height+4,h=h.left+4,e+d.height>a.height&&(e=Math.max(0,a.height-d.height-4)),h+d.width>a.width&&(h=Math.max(0,
a.width-d.width-4))):(h=Math.max(0,(a.width-d.width)/2),e=Math.max(0,(a.height-d.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=e+"px";this.$frame.style.left=h+"px";this.$frame.classList.add("dialogShowing");"function"===typeof this._afterShowing&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return p.firstTabbable(this.$parent)||this._defaultButton||p.firstTabbable(this.$buttonContainer)||this.$close},
destroy:function(){this.$frame&&(l===this&&(l=null),p.setFramesEnabled(!0),this._addedBackdrop&&0<this._addedBackdrop.length&&this._addedBackdrop.forEach(function(e){e.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("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages require orion/webui/littlelib orion/PageLinks orion/widgets/userAssistance/UATaskPanel orion/webui/dialog orion/webui/dropdown".split(" "),function(m,n,p,k,f,l,e){function d(a){this._displaySignOut=!0;this._init(a)}d.prototype={_init:function(a){this._dropdownNode=p.node(a.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=a.dropdown;this._serviceRegistry=a.serviceRegistry;this.authenticatedServices=
{};this.unauthenticatedServices={};this._noSeparator=a.noSeparator;this._dropDownItemClass=a.dropDownItemClass;this._keyAssistClass=a.keyAssistClass;void 0!==a.signOut&&(this._displaySignOut=a.signOut)},isSingleService:function(){return 1===this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},hasServices:function(){return 0<this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},length:function(a){var d=0,b;for(b in a)a.hasOwnProperty(b)&&d++;
return d},_makeMenuItem:function(a,d){var b=e.createMenuItem(a).firstElementChild;"string"===typeof this._dropDownItemClass&&""!==this._dropDownItemClass&&b.classList.add(this._dropDownItemClass);b.addEventListener("click",d,!1);b.addEventListener("keydown",function(a){(a.keyCode===p.KEY.ENTER||a.keyCode===p.KEY.SPACE)&&d()},!1);return b},_renderAuthenticatedService:function(a,d){var b=this,g=this.authenticatedServices[a].authService;if(g&&g.logout&&this._displaySignOut){var e=this._makeMenuItem(m["Sign Out"],
function(){g.logout().then(function(){b.addUserItem(a,g,b.authenticatedServices[a].label);localStorage.removeItem(a);localStorage.removeItem("lastLogin");for(var d=localStorage.length-1;0<=d;d--){var h=localStorage.key(d);h&&0===h.indexOf("/orion/preferences/user")&&localStorage.removeItem(h)}g.getAuthForm(window.location.href).then(function(a){window.location=a})})});this._dropdownNode.appendChild(e.parentNode)}},renderServices:function(){function a(a){b[a]||(b[a]=d.createDocumentFragment());return b[a]}
var d=document,b=[],g=this._serviceRegistry;k.getPageLinksInfo(g,"orion.page.link.user").then(function(f){this._dropdown?this._dropdown.empty():this._dropdownNode&&p.empty(this._dropdownNode);f.getAllLinks().forEach(function(b){var g,e;if(b.category&&(e=/user\.(\d+)/.exec(b.category)))g=parseInt(e[1],10);if("number"!==typeof g||isNaN(g))g=1;g=a(g);e=d.createElement("li");var f=d.createElement("a");f.role="menuitem";"string"===typeof this._dropDownItemClass?""!==this._dropDownItemClass&&f.classList.add(this._dropDownItemClass):
f.classList.add("dropdownMenuItem");f.href=b.href;f.textContent=b.textContent;e.appendChild(f);g.appendChild(e);f.addEventListener("keydown",function(a){(a.keyCode===p.KEY.ENTER||a.keyCode===p.KEY.SPACE)&&f.click()},!1)}.bind(this));this.keyAssistFunction&&(f=this._makeMenuItem(m["Keyboard Shortcuts"],this.keyAssistFunction),"string"===typeof this._keyAssistClass?""!==this._keyAssistClass&&f.classList.add(this._keyAssistClass):f.classList.add("key-assist-menuitem"),f=f.parentNode,a(0).appendChild(f));
if(f=g.getServiceReferences("orion.page.getstarted")[0])f=f.getProperty("data"),f=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,f)).parentNode,a(0).appendChild(f);var l=this;b.sort(function(a,b){return a-b}).forEach(function(a,g){if(g<b.length-1&&!this._noSeparator){var d=e.createSeparator();a.appendChild(d)}l._dropdownNode.appendChild(a)}.bind(this));if(this.isSingleService())for(var q in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(q)&&this._renderAuthenticatedService(q,
0)}.bind(this))},getStartedDialog:function(a){new f(null,!0,a)},setKeyAssist:function(a){this.keyAssistFunction=a;this.renderServices()},addUserItem:function(a,d,b,g){g?(this.unauthenticatedServices[a]&&delete this.unauthenticatedServices[a],this.authenticatedServices[a]={authService:d,label:b,data:g}):(this.authenticatedServices[a]&&delete this.authenticatedServices[a],this.unauthenticatedServices[a]=this.unauthenticatedServices[a]?{authService:d,label:b,pending:this.unauthenticatedServices[a].pending}:
{authService:d,label:b});this.renderServices()}};d.prototype.constructor=d;return{UserMenu:d}});
define("orion/crawler/nls/root/messages",{"Searching file:":"Searching file:","is not supported in this file system":"is not supported in this file system","${0} files found out of ${1}":"${0} files found out of ${1}","The search term on this location will not use indexed files.":"The search term on this location will not use indexed files.","It will take longer time. Do you want to proceed?":"It will take longer time. Do you want to proceed?","Search cancelled by user":"Search cancelled by user",
Cancel:"Cancel"});define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/searchUtils","i18n!orion/nls/messages require orion/regex orion/commandRegistry orion/PageUtil orion/URITemplate".split(" "),function(m,n,p,k,f,l){function e(a,d,b){var g="";b&&(g="^");if(g=p.parse("/"+g+a.searchStr+"/"))b=g.pattern,g=g.flags,-1===g.indexOf("i")&&!d.caseSensitive&&(g+="i"),a.regExp={pattern:b,flags:g},a.wildCard=!0}var d={ALL_FILE_TYPE:"*.*",doSearch:function(a,h,b,g){a?(h=b,b=!0,"*"===h&&(h=""),""===h&&(b=g&&g.type!==d.ALL_FILE_TYPE),b&&(a=a.createSearchParams(h,!1,
!1,g),a=d.generateSearchHref(a),window.location=a)):window.alert(m["Can't search: no search service is available"])},generateSearchHelper:function(a,h){var b=a.keyword,g=b,f={};a.fileType&&(a.fileType!==d.ALL_FILE_TYPE&&""===b)&&(g="*."+a.fileType);if(a.regEx)f.searchStr=b,e(f,a,h);else{var l=-1<b.indexOf("*"),q=-1<b.indexOf("?");l&&(b=b.split("*").join(".*"));q&&(b=b.split("?").join("."));!l&&!q&&!a.nameSearch?(f.searchStr=a.caseSensitive?b.split("\\").join(""):b.split("\\").join("").toLowerCase(),
f.wildCard=!1):(f.searchStr=a.caseSensitive?b:b.toLowerCase(),e(f,a,h),f.wildCard=!0)}f.searchStrLength=f.searchStr.length;return{params:a,inFileQuery:f,displayedSearchTerm:g}},convertSearchParams:function(a){void 0!==a.rows&&(a.rows=parseInt(a.rows,10));void 0!==a.start&&(a.start=parseInt(a.start,10));"string"===typeof a.regEx&&(a.regEx="true"===a.regEx.toLowerCase());"string"===typeof a.caseSensitive&&(a.caseSensitive="true"===a.caseSensitive.toLowerCase());"string"===typeof a.nameSearch&&(a.nameSearch=
"true"===a.nameSearch.toLowerCase());void 0!==a.fileNamePatterns&&(a.fileNamePatterns=d.getFileNamePatternsArray(a.fileNamePatterns))},getFileNamePatternsArray:function(a){var d=void 0;a&&(a=a.trim(),a=a.replace(/^(\s*,\s*)+/g,""),a=a.replace(/([^\\]),(\s*,\s*)*/g,"$1/"),a=a.replace(/(\s*\/\s*)/g,"/"),a=a.replace(/\/\/+/g,"/"),a=a.replace(/\/+$/g,""),d=a.split("/"));return d},copySearchParams:function(a,d){var b={},g;for(g in a)if(void 0!==a[g]&&null!==a[g]&&(d||"replace"!==g))b[g]=a[g];return b},
generateSearchHref:function(a){var h=n.toUrl("search/search.html");a=d.copySearchParams(a,!0);var b=a.resource;a.resource=void 0;return"undefined"!==typeof a.keyword?(new l(h+"#{,resource,params*}")).expand({resource:b,params:a}):(new l(h+"#{,resource}")).expand({resource:b})},generateFindURLBinding:function(a,d,b,g,e){a={find:d.searchStr,regEx:d.wildCard?!0:void 0,caseSensitive:a.caseSensitive?!0:void 0,replaceWith:"string"===typeof g?g:void 0,atLine:"number"===typeof b?b:void 0};return e?a:","+
(new l("{,params*}")).expand({params:a})},convertFindURLBinding:function(a){"string"===typeof a.regEx&&(a.regEx="true"===a.regEx.toLowerCase());"string"===typeof a.caseSensitive&&(a.caseSensitive="true"===a.caseSensitive.toLowerCase());"string"===typeof a.atLine&&(a.atLine=parseInt(a.atLine,10))},replaceRegEx:function(a,d,b){return a.replace(RegExp(d.pattern,d.flags),b)},replaceStringLiteral:function(a,h,b){h=p.parse("/"+h+"/gim");return d.replaceRegEx(a,h,b)},searchOnelineLiteral:function(a,d,b){var g;
g=0;for(var e=!1,f=[];!(g=d.indexOf(a.searchStr,g),0>g);){f.push({startIndex:g,length:a.searchStrLength});e=!0;if(b)break;g+=a.searchStrLength}return e?f:null},findRegExp:function(a,d,b,g){if(!d)return null;b=b||"";b+=(-1===b.indexOf("g")?"g":"")+(-1===b.indexOf("m")?"m":"");var e=null;return(e=RegExp(d,b).exec(a.substring(g)))&&{startIndex:e.index+g,length:e[0].length}},searchOnelineRegEx:function(a,h,b){for(var g=0,e=!1,f=[];;)if(g=d.findRegExp(h,a.regExp.pattern,a.regExp.flags,g)){f.push(g);e=
!0;if(b)break;g=g.startIndex+g.length}else break;return e?f:null},generateNewContents:function(a,h,b,g,e,f){if(g&&h){a||(b.contents=[]);for(var q=0;q<h.length;q++){for(var l=h[q],k=!1,m=!1,w=[],p,x=0,n=0;n<g.children.length;n++)if(g.children[n].lineNumber-1===q){x=n;for(k=0;k<g.children[n].matches.length;k++)!1!==g.children[n+k].checked&&w.push(k);m=0<w.length;p=g.children[n].matches;k=!0;break}if(k){if(m){w=d.replaceCheckedMatches(l,e,p,w,f);l=w.replacedStr;for(k=0;k<g.children[x].matches.length;k++)g.children[x+
k].newMatches=w.newMatches}else for(k=0;k<g.children[x].matches.length;k++)g.children[x+k].newMatches=g.children[x+k].matches;a?b.contents[q]=l:b.contents.push(l)}else a||b.contents.push(l)}}},generateMatchContext:function(a,d,b){var g=[],e=2*a+1,f;d.length<=e?(f=0,a=d.length-1):(f=b-a,0>f?(f=0,a=f+e-1):(a=b+a,a>d.length-1&&(a=d.length-1,f=a-e+1)));for(e=f;e<=a;e++)g.push({context:d[e],current:e===b});return g},splitFile:function(a){for(var d=0,b=0,g=0,e=0,f=[];;){-1!==d&&d<=g&&(d=a.indexOf("\r",
g));-1!==b&&b<=g&&(b=a.indexOf("\n",g));if(-1===b&&-1===d){f.push(a.substring(e));break}var q=1;-1!==d&&-1!==b?d+1===b?(q=2,g=b+1):g=(d<b?d:b)+1:g=-1!==d?d+1:b+1;f.push(a.substring(e,g-q));e=g}return f},searchWithinFile:function(a,h,b,g,e,f){b=d.splitFile(b);e&&(h.contents=b);if(h){h.children=[];for(var q=g=0;q<b.length;q++){var l=b[q];if(l&&0<l.length){var k=f?l:l.toLowerCase();if(k=a.wildCard?d.searchOnelineRegEx(a,k):d.searchOnelineLiteral(a,k)){var m,w=q+1;if(e)for(var p=0;p<k.length;p++)m=p+
1,m={parent:h,checked:h.checked,type:"detail",matches:k,lineNumber:w,matchNumber:m,name:l,location:h.location+"-"+w+"-"+m},h.children.push(m);else m={parent:h,context:d.generateMatchContext(2,b,q),checked:h.checked,type:"detail",matches:k,lineNumber:w,name:l,location:h.location+"-"+w},h.children.push(m);g+=k.length}}}h.totalMatches=g}},replaceCheckedMatches:function(a,d,b,g,e){for(var f=0,q="",l=[],k=0;k<b.length;k++){f!==b[k].startIndex&&(q+=a.substring(f,b[k].startIndex));b[k].length&&(e=b[k].length);
for(var f=!1,m=0;m<g.length;m++)if(g[m]===k){f=!0;break}f?(l.push({startIndex:q.length,length:d.length}),q+=d):(l.push({startIndex:q.length,length:e}),q+=a.substring(b[k].startIndex,b[k].startIndex+e));f=b[k].startIndex+e}f<a.length&&(q+=a.substring(f));return{replacedStr:q,newMatches:l}},fullPathNameByMeta:function(a){var d=a.length,b="";if(0<d)for(d-=1;-1<d;d--)b=b+(""===b?"":"/")+a[d].Name;return b},path2FolderName:function(a,d,b){return a.substring(0,a.length-d.length-(b?0:1))},getOpenSearchPref:function(a,
d){a.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");d(a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?!0:!1:!1)})},setOpenSearchPref:function(a,d){a.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",{openInNewTab:d})})}};return d});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages require orion/i18nUtil orion/searchUtils orion/contentTypes orion/Deferred".split(" "),function(m,n,p,k,f,l){function e(d,a,h,b){this.registry=d;this.fileClient=a;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=b&&b.searchOnName;this._buildSkeletonOnly=b&&b.buildSkeletonOnly;this._fetchChildrenCallBack=b&&b.fetchChildrenCallBack;this._searchParams=h;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:k.generateSearchHelper(h);this._location=b&&b.location;this._childrenLocation=b&&b.childrenLocation?b.childrenLocation:this._location;this._reportOnCancel=b&&b.reportOnCancel;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}e.prototype.search=function(d){var a=
this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=d;this._cancelled=!1;this._deferredArray=[];a.getContentTypes().then(function(a){this.contentTypesCache=a;var b=this;this._visitRecursively(this._childrenLocation).then(function(){(!b._cancelled||b._reportOnCancel)&&b._reportResult();b._cancelled&&b._HandleStatus({name:"Cancel"})}.bind(b),function(a){b._reportResult();b._HandleStatus(a)}.bind(b))}.bind(this))};e.prototype.searchName=function(d,a){d&&(this._searchParams=
d,this.searchHelper=k.generateSearchHelper(d,!0));a&&(this.onSearchNameComplete=a);var h=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(0<this.fileSkeleton.length){for(var b=0;b<this.fileSkeleton.length;b++){var g=this.fileSkeleton[b].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?k.searchOnelineRegEx(this.searchHelper.inFileQuery,g,!0):k.searchOnelineLiteral(this.searchHelper.inFileQuery,g,!0))if(h.push(this.fileSkeleton[b]),h.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:h.length,
docs:h}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};e.prototype.buildSkeleton=function(d,a){this._buildingSkeleton=!0;var h=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var b=this;d();h.getContentTypes().then(function(g){b.contentTypesCache=g;b._visitRecursively(b._childrenLocation).then(function(){b._buildingSkeleton=!1;a();b.searchHelper&&!b._buildSkeletonOnly&&b.searchName()})})};e.prototype._sort=function(d){d.sort(function(a,
d){var b,g;if("Path asc"===this._searchParams.sort){b=a.Location&&a.Location.toLowerCase();b=k.path2FolderName(b,a.Name&&a.Name.toLowerCase(),!0);g=d.Location&&d.Location.toLowerCase();g=k.path2FolderName(g,d.Name&&d.Name.toLowerCase(),!0);if(b<g)return-1;if(b>g)return 1}return this._sortOnNameSingle(a,d)}.bind(this))};e.prototype._HandleStatus=function(d){this._statusService&&"Cancel"===d.name&&(console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length),this._statusService.setProgressResult({Message:m["Search cancelled by user"],
Severity:"Warning"}))};e.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})};e.prototype._sortOnNameSingle=function(d,a){var h=d.Name&&d.Name.toLowerCase(),b=a.Name&&a.Name.toLowerCase();return h<b?-1:h>b?1:0};e.prototype._fileNameMatches=function(d){var a=!0;this.searchHelper.params.fileNamePatterns&&(a=this.searchHelper.params.fileNamePatterns.some(function(a){a="^"+a.replace(/([*?])/g,
".$1")+"$";return d.match(a)}));return a};e.prototype._visitRecursively=function(d){var a=[],e=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(d);return(e._progressService?this._progressService.progress(e.fileClient.fetchChildren(d),"Crawling search for children of "+d):e.fileClient.fetchChildren(d)).then(function(b){for(var g=0;g<b.length;g++)if(void 0!==b[g].Directory&&!1===b[g].Directory)if(e._searchOnName)a.push(e._buildSingleSkeleton(b[g]));else if(e._buildSkeletonOnly)a.push(e._buildSingleSkeleton(b[g]));
else{if(!e._cancelled){var d=f.getFilenameContentType(b[g].Name,e.contentTypesCache);if(d&&("text/plain"===d["extends"]||"text/plain"===d.id)&&e._fileNameMatches(b[g].Name))d=e._sniffSearch(b[g]),a.push(d),e._deferredArray.push(d)}}else if(b[g].Location)if(e._cancelled)break;else d=e._visitRecursively(b[g].ChildrenLocation),a.push(d),e._deferredArray.push(d);return l.all(a)})};e.prototype._hitOnceWithinFile=function(d){d=this._searchParams.caseSensitive?d:d.toLowerCase();return this.searchHelper.inFileQuery.wildCard?
k.searchOnelineRegEx(this.searchHelper.inFileQuery,d,!0):k.searchOnelineLiteral(this.searchHelper.inFileQuery,d,!0)};e.prototype._reportSingleHit=function(d){this._cancelled||(d.LastModified=d.LocalTimeStamp,this.fileLocations.push(d),this._hitCounter++,this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0))};e.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(d){d.cancel()})};
e.prototype._sniffSearch=function(d){this._totalCounter++;var a=this;if(!this._cancelled)if(""===this.searchHelper.params.keyword)this._reportSingleHit(d),this._statusService&&this._statusService.setProgressResult({Message:p.formatMessage(m["${0} files found out of ${1}"],this._hitCounter,this._totalCounter)});else return(a._progressService?a._progressService.progress(a.fileClient.read(d.Location),"Reading file "+d.Location):a.fileClient.read(d.Location)).then(function(e){a._hitOnceWithinFile(e)&&
a._reportSingleHit(d);a._statusService&&a._statusService.setProgressResult({Message:p.formatMessage(m["${0} files found out of ${1}"],a._hitCounter,a._totalCounter)},m.Cancel)},function(a){a&&(a.message&&"cancel"!==a.message.toLowerCase())&&console.error("Error loading file content: "+a.message)})};e.prototype._buildSingleSkeleton=function(d){this._totalCounter++;this.fileSkeleton.push(d);this.searchHelper&&(!this._buildSkeletonOnly&&0===this._totalCounter%100)&&this.searchName();d=new l;d.resolve(this._totalCounter);
return d};e.prototype.constructor=e;return{SearchCrawler:e}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages orion/crawler/searchCrawler orion/contentTypes require orion/webui/littlelib orion/util orion/webui/dialog".split(" "),function(m,n,p,k,f,l,e){function d(a){this._init(a)}d.prototype=new e.Dialog;d.prototype.TEMPLATE='\x3cdiv role\x3d"search"\x3e\x3cdiv\x3e\x3clabel id\x3d"fileNameMessage" for\x3d"fileName"\x3e${Type the name of a file to open (? \x3d any character, * \x3d any string):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"fileName" type\x3d"text" class\x3d"setting-control" style\x3d"width:90%;"/\x3e\x3c/div\x3e\x3cdiv id\x3d"progress" style\x3d"padding: 2px 0 0; width: 100%;"\x3e\x3cimg src\x3d"'+k.toUrl("../../../images/progress_running.gif")+
'" class\x3d"progressPane_running_dialog" id\x3d"crawlingProgress"\x3e\x3c/img\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:250px; height:auto; overflow-y:auto;" aria-live\x3d"off"\x3e\x3c/div\x3e\x3cdiv id\x3d"statusbar"\x3e\x3c/div\x3e\x3c/div\x3e';d.prototype._init=function(a){this.title=a.title||m["Find File Named"];this.modal=!0;this.messages=m;this._searcher=a.searcher;this._progress=a.progress;this._onHide=a.onHide;this._contentTypeService=new p.ContentTypeRegistry(this._searcher.registry);
if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=a.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=a.initialText;this._message=a.message;this._nameSearch=!0;void 0!==a.nameSearch&&(this._nameSearch=a.nameSearch);this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(m["Missing required argument: fileService"]);this._searchRenderer=a.searchRenderer;if(!this._searchRenderer||
"function"!==typeof this._searchRenderer.makeRenderFunction)throw Error(m["Missing required argument: searchRenderer"]);this._initialize()};d.prototype._bindToDom=function(a){var d=this;d.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",m["FileName FolderName"]):this.$fileName.setAttribute("placeholder",m.Search);this.$fileName.addEventListener("input",function(a){d._time=+new Date;d._timeoutId&&clearTimeout(d._timeoutId);d._timeoutId=setTimeout(d.checkSearch.bind(d),
0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===f.KEY.ENTER){var g=f.$("a",d.$results);g&&(f.stop(a),(l.isMac?a.metaKey:a.ctrlKey)?window.open(g.href):(window.location.href=g.href,d.hide()))}},!1);a.addEventListener("keydown",function(a){var g,e,l;if(a.keyCode===f.KEY.DOWN||a.keyCode===f.KEY.UP)g=f.$$array("a",d.$results),e=document.activeElement,l=g.indexOf(e),a.keyCode===f.KEY.DOWN?0<=l?(e.classList.remove("treeIterationCursor"),g=l<g.length-1?g[l+1]:g[0],g.focus(),
g.classList.add("treeIterationCursor")):0<g.length&&(g=g[0],g.focus(),g.classList.add("treeIterationCursor")):0<=l?(e.classList.remove("treeIterationCursor"),e=d.$fileName,g=0<l?g[l-1]:e,g.focus(),0<l&&g.classList.add("treeIterationCursor")):0<g.length&&(g[g.length-1].focus(),g[g.length-1].classList.add("treeIterationCursor")),f.stop(a)});a.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(d._forceUseCrawler||!d._fileService.getService(d._searcher.getSearchLocation()).search){var a=
d._searchOnRoot?d._searcher.getSearchRootLocation():d._searcher.getChildrenLocation(),a=new n.SearchCrawler(d._searcher.registry,d._fileService,"",{searchOnName:!0,location:a});d._searcher.setCrawler(a);a.buildSkeleton(function(){d.$crawlingProgress.style.display="inline";d.$progress.appendChild(document.createTextNode(m["Building file skeleton..."]))},function(){d.$crawlingProgress.style.display="none";d.$progress.removeChild(d.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),
this.$fileNameMessage.appendChild(document.createTextNode(this._message)));this._initialText&&(this.$fileName.value=this._initialText,this.doSearch())};d.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var a=(new Date).getTime();a-this._time>this._searchDelay?(this._time=a,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};d.prototype._detectFolderKeyword=function(a){var d,b=a,g=null;if(this._nameSearch&&(d=/(\S+)\s*(.*)/,(a=d.exec(a))&&3===a.length))a[1]&&
(b=a[1]),a[2]&&(g=a[2]);return{keyword:b,folderKeyword:g}};d.prototype.doSearch=function(){var a=this.$fileName.value;if(a){var d=this._detectFolderKeyword(a),b=this._searcher.createSearchParams(d.keyword,this._nameSearch,this._searchOnRoot),g=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=g;var e=document.createElement("div");e.appendChild(document.createTextNode(this._nameSearch?m["Searching..."]:l.formatMessage(m["Searching for occurrences of"],
a)));f.empty(this.$results);this.$results.appendChild(e);this._searcher.search(b,d.folderKeyword,function(){g===this.currentSearch&&g.apply(null,arguments)}.bind(this))}};d.prototype.decorateResult=function(a){function d(a){0===a.button&&(!a.ctrlKey&&!a.metaKey)&&b.hide()}var b=this;a=f.$$array("a",a);for(var g=0;g<a.length;g++)a[g].addEventListener("click",d,!1)};d.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};d.prototype._afterHiding=function(){this._onHide&&this._onHide()};
d.prototype.constructor=d;return{OpenResourceDialog:d}});define("text!orion/banner/banner.html",[],function(){return'\x3cheader id\x3d"banner" role\x3d"banner"\x3e\n\t\x3c!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\x3e\n\n\t\x3cdiv id\x3d"staticBanner" class\x3d"layoutBlock topRowBanner"\x3e \x3c!-- primaryNav --\x3e\n\t\t\x3cdiv id\x3d"centralNavigationArea" style\x3d"position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"\x3e\x3c/div\x3e\n\n\t\t\x3c!-- Static "Home" link. TODO delete this --\x3e\n\t\t\x3ca id\x3d"home" class\x3d"layoutLeft "\x3e\x3c/a\x3e\n\n\t\t\x3c!-- Left banner component: hamburger --\x3e\n\t\t\x3cnav id\x3d"primaryNav" class\x3d"bannerLeftArea" style\x3d"z-index:2;" role\x3d"navigation"\x3e\n\t\t\t\t\x3cbutton class\x3d"centralNavigation commandSprite core-sprite-hamburger" type\x3d"button"id\x3d"centralNavigation"\x3e\x3c/button\x3e\n\t\t\x3c/nav\x3e\n\n\t\t\x3c!-- Middle banner component: Breadcrumb bar --\x3e\n\t\t\x3cdiv class\x3d"clear navigationBreadcrumb bannerMiddleArea" \x3e\n\t\t\t\x3cdiv id\x3d"location" class\x3d"currentLocation"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\n\t\t\x3c!-- Right banner component: user identity --\x3e\n\t\t\x3cdiv class\x3d"bannerRightArea" style\x3d"z-index:2;"\x3e\n\t\t\t\x3c!-- Global commands support. --\x3e\n\t\t\t\x3cdiv id\x3d"globalActions" class\x3d"spacingLeft layoutLeft"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- Search. TODO delete this --\x3e\n\t\t\t\x3cinput type\x3d"text" id\x3d"search" autocomplete\x3d"off" class\x3d"layoutLeft spacingLeft searchbox" role\x3d"search" style\x3d"display:none;"\x3e\n\t\t\t\x3cdiv id\x3d"searchOptions" class\x3d"layoutLeft" style\x3d"padding-top:1px;display:none;"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- User identity menu and Progress --\x3e\n\t\t\t\x3cdiv id\x3d"userMenu" class\x3d"spacingRight layoutRight" style\x3d"color:#ccc;line-height:16px;"\x3e\n\t\t\t\t\x3cdiv id\x3d"progressPane" class\x3d"progressWatch" tabindex\x3d"0" role\x3d"progressbar"\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchButton" class\x3d"watchButton"\x3e\x3c/div\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchBody" class\x3d"watchBody"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longMinute"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longHour"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\n\t\t\t\t\x3cdiv style\x3d"position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"\x3e\x3c/div\x3e\n\t\t\t\t\x3cspan id\x3d"userTrigger" tabindex\x3d"0" role\x3d"button" class\x3d"dropdownTrigger" style\x3d"z-index:2;"\x3e\n\t\t\t\t\x3c/span\x3e\n\t\t\t\t\x3cul id\x3d"userDropdown" class\x3d"dropdownMenu" role\x3d"menu"\x3e\x3c/ul\x3e\n\t\t\t\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\x3c/div\x3e\n\n\t\x3c!-- IDE notification messages go in here --\x3e\n\t\x3cdiv id\x3d"notificationArea" class\x3d"notificationHide"\x3e\n\t\t\x3cdiv class\x3d"layoutLeft" id\x3d"notifications" aria-live\x3d"assertive" aria-atomic\x3d"true"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"layoutRight"\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" type\x3d"button" id\x3d"closeNotifications"\x3e\x3c/span\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/header\x3e'});
define("text!orion/banner/footer.html",[],function(){return'\x3c!--\n\x3cfooter id\x3d"footerContent" class\x3d"layoutBlock footerLayout" role\x3d"contentinfo"\x3e\n\t\x3cdiv class\x3d"logoFooter commandSprite core-sprite-orion-logo"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"footerBlock"\x3e${Orion is in Beta. Please try it out but BEWARE your data may be lost.}\x3c/div\x3e\n\t\x3cdiv class\x3d"footerRightBlock"\x3e\n\t\t\x3cul\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"https://bugs.eclipse.org/bugs/enter_bug.cgi?product\x3dOrion\x26version\x3d5.0" target\x3d"_blank"\x3e${Report a Bug}\x3c/a\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/privacy.php" target\x3d"_blank"\x3e${Privacy Policy}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/termsofuse.php" target\x3d"_blank"\x3e${Terms of Use}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/copyright.php" target\x3d"_blank"\x3e${Copyright Agent}\x3c/a\x3e\x3c/li\x3e\n\t\t\x3c/ul\x3e\n\t\x3c/div\x3e\n\x3c/footer\x3e\n--\x3e'});
define("text!orion/banner/toolbar.html",[],function(){return'\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"pageActions"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"selectionTools"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"navActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutLeft" style\x3d"padding-left:7px;padding-right:7px;margin-top:2px;" id\x3d"filterBox" style\x3d"visibility: hidden;"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"settingsActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutRight status" id\x3d"statusPane" role\x3d"status" aria-live\x3d"off"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"pageNavigationActions"\x3e\x3c/ul\x3e'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(m,n){function p(k,f,l){if(k=n.node(k))this._parent=k;else throw Error("Parent node of dropdown menu not found");this.options=l=l||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=l.selectionClass;k=document.createElement("div");k.classList.add("dropdownMenu");k.classList.add("dropdownMenuOpen");k.id=this.navDropDownId;k.style.display="none";this._parent.appendChild(k);this._dropdownMenu=
k;if(f=n.node(f))this._triggerNode=f;else throw"Trigger node of dropdown menu not found";"hidden"===this._triggerNode.style.visibility&&(this._triggerNode.style.visibility="visible");l.noClick||(this._triggerNode.onclick=this.click.bind(this));this._dropdownMenu.addEventListener("keydown",function(e){e.keyCode===n.KEY.ESCAPE&&this.clearPanel()}.bind(this))}m.mixin(p.prototype,{click:function(){"none"===this._dropdownMenu.style.display?this.updateContent(this.getContentNode(),function(){n.setFramesEnabled(!1);
this._dropdownMenu.style.display="";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=n.addAutoDismiss([this._triggerNode,this._dropdownMenu],this.clearPanel.bind(this));if(this.options.onShow)this.options.onShow()}.bind(this)):this.clearPanel()},clearPanel:function(){if(this.isVisible()&&(this._dropdownMenu.style.display="none",n.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(k){this._dropdownMenu.innerHTML=k},getContentNode:function(){return this._dropdownMenu},updateContent:function(k,f){f()},_positionDropdown:function(){this._dropdownMenu.style.right="";var k=n.bounds(this._dropdownMenu),f=n.bounds(document.body);k.left+k.width>f.left+f.width&&(k=n.bounds(this._boundingNode(this._triggerNode)),f=n.bounds(this._triggerNode),this._dropdownMenu.style.right=k.width-(f.left-k.left+f.width)+"px")},_boundingNode:function(k){var f=window.getComputedStyle(k,
null);return null===f||"absolute"===f.getPropertyValue("position")||!k.parentNode||k===document.body?k:this._boundingNode(k.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},isVisible:function(){return"none"!==this._dropdownMenu.style.display&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){this._parent&&(n.setFramesEnabled(!0),n.empty(this._parent),this._parent=this.select=null)}});return p});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"File or zip archive":"File or zip archive","Import a file or zip archive from your local file system":"Import a file or zip archive from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}",
"Pasting ${0}":"Pasting ${0}","Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root",
"Open With":"Open With","Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","Import a file from a URL and optionally unzip it":"Import 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}?","Upload progress: ":"Upload progress: ","Uploading ":"Uploading ","Cancel upload":"Cancel upload","Uploading the following file failed: ":"Uploading the following file failed: ","Enter project name:":"Enter project name:","Creating project ":"Creating project ",NoFile:"Use the ${0} menu to create new files and folders. Click a file to start coding.",
Download:"Download",Download_tooltips:"Download the file contents as the displayed name","Downloading...":"Reading file contents...","Download not supported":"Contents download is not supported in this browser."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(m,n,p){function k(e,d,a){if(!e[d])throw d+m[" is not supported in this file system"];return e[d].apply(e,a)}function f(e,d,a,h){if(!e.readBlob)throw m["source file service does not support binary read"];if(!a.writeBlob)throw m["target file service does not support binary write"];if("/"!==d[d.length-1])return k(e,"readBlob",[d]).then(function(b){return k(a,"writeBlob",[h,b])});var b=h.substring(0,
h.length-1),g=decodeURIComponent(b.substring(b.lastIndexOf("/")+1)),b=b.substring(0,b.lastIndexOf("/")+1);return k(a,"createFolder",[b,g]).then(function(){},function(){}).then(function(){return k(e,"fetchChildren",[d]).then(function(b){for(var g=[],d=0;d<b.length;++d){var l=b[d].Location,k=l;b[d].Directory&&(k=l.substring(0,l.length-1));k=decodeURIComponent(k.substring(k.lastIndexOf("/")+1));k=h+encodeURIComponent(k);b[d].Directory&&(k+="/");g[d]=f(e,l,a,k)}return n.all(g)})})}function l(e,d){function a(a){var b=
new n;b.reject(m["No Matching FileService for location:"]+a);return b}var h=e.getServiceReferences("orion.core.file"),b=h;if(d)for(var b=[],g=0;g<h.length;++g)d(h[g])&&b.push(h[g]);for(var f=[],l=[],q=[],k=[],z={fetchChildren:function(){var a=new n;a.resolve(k);return a},createWorkspace:function(){var a=new n;a.reject(m["no file service"]);return a},loadWorkspaces:function(){var a=new n;a.reject(m["no file service"]);return a},loadWorkspace:function(a){var b=new n;window.setTimeout(function(){b.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:m["File Servers"],Location:"/",Children:k,ChildrenLocation:"/"})},100);return b},search:a,createProject:a,createFolder:a,createFile:a,deleteFile:a,moveFile:a,copyFile:a,read:a,write:a},h=0;h<b.length;++h)k[h]={Directory:!0,Length:0,LocalTimeStamp:0,Location:b[h].getProperty("top"),ChildrenLocation:b[h].getProperty("top"),Name:b[h].getProperty("Name")},g=b[h].getProperty("pattern")||b[h].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"^"!==g[0]&&(g=
"^"+g),f[h]=RegExp(g),l[h]=e.getService(b[h]),q[h]=b[h].getProperty("Name"),b[h].getProperty("NameKey")&&b[h].getProperty("nls")&&p.getMessageBundle(b[h].getProperty("nls")).then(function(a,g){k[a].Name=g[b[a].getProperty("NameKey")];q[a]=g[b[a].getProperty("NameKey")]}.bind(this,h));this._getServiceIndex=function(a){if("/"===a)return-1;if(!a||a.length&&0===a.length)return l[0]?0:-1;for(var b=0;b<f.length;++b)if(f[b].test(a))return b;throw m["No Matching FileService for location:"]+a;};this._getService=
function(a){a=this._getServiceIndex(a);return-1===a?z:l[a]};this._getServiceName=function(a){a=this._getServiceIndex(a);return-1===a?z.Name:q[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return-1===a?z.Location:k[a].Location}}l.prototype={getService:function(e){return this._getService(e)},fileServiceName:function(e){return this._getServiceName(e)},fileServiceRootURL:function(e){return this._getServiceRootURL(e)},fetchChildren:function(e){return k(this._getService(e),"fetchChildren",
arguments)},createWorkspace:function(e){return k(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return k(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(e){return k(this._getService(e),"loadWorkspace",arguments)},createProject:function(e,d,a,h){return k(this._getService(e),"createProject",arguments)},createFolder:function(e,d){return k(this._getService(e),"createFolder",arguments)},createFile:function(e,d){return k(this._getService(e),"createFile",
arguments)},deleteFile:function(e){return k(this._getService(e),"deleteFile",arguments)},moveFile:function(e,d,a){var h=this._getService(e),b=this._getService(d);if(h===b)return k(h,"moveFile",arguments);var g="/"===e[e.length-1],l=d;"/"!==l[l.length-1]&&(l+="/");if(a)l+=encodeURIComponent(a);else{var v=e;g&&(v=v.substring(0,v.length-1));l+=v.substring(v.lastIndexOf("/")+1)}g&&"/"!==l[l.length-1]&&(l+="/");return f(h,e,b,l).then(function(){return k(h,"deleteFile",[e])})},copyFile:function(e,d,a){var h=
this._getService(e),b=this._getService(d);if(h===b)return k(h,"copyFile",arguments);var g="/"===e[e.length-1],l=d;"/"!==l[l.length-1]&&(l+="/");if(a)l+=encodeURIComponent(a);else{var v=e;g&&(v=v.substring(0,v.length-1));l+=v.substring(v.lastIndexOf("/")+1)}g&&"/"!==l[l.length-1]&&(l+="/");return f(h,e,b,l)},read:function(e,d){return k(this._getService(e),"read",arguments)},readBlob:function(e){return k(this._getService(e),"readBlob",arguments)},write:function(e,d,a){return k(this._getService(e),"write",
arguments)},remoteImport:function(e,d){return k(this._getService(e),"remoteImport",arguments)},remoteExport:function(e,d){return k(this._getService(e),"remoteExport",arguments)},search:function(e){return k(this._getService(e.resource),"search",arguments)}};l.prototype.constructor=l;return{FileClient:l}});
define("orion/webui/SideMenu",["orion/webui/littlelib","orion/PageUtil","orion/URL-shim"],function(m,n){function p(l,e){this._parentNode=m.node(l);if(!this._parentNode)throw Error("Missing parentNode");this._contentNode=m.node(e);this._categoryInfos=[];this._categorizedPageLinks={};this._categorizedRelatedLinks={};this._categorizedAnchors=null;this._state=localStorage.getItem(k)||f;this._currentCategory="";this._renderTimeout=this._notificationTimeout=null}var k="sideMenuNavigation",f="open";p.prototype=
{constructor:p.prototype.constructor,setCategories:function(f){this._categoryInfos=f.getCategoryIDs().map(function(e){return f.getCategory(e)}).sort(function(e,d){var a=e.order||100,h=d.order||100;return a<h?-1:h<a?1:e.textContent.localeCompare(d.textContent)})},setPageLinks:function(f){this._categorizedPageLinks={};f.getAllLinks().forEach(function(e){var d=e.category;this._categorizedPageLinks[d]=this._categorizedPageLinks[d]||[];this._categorizedPageLinks[d].push({title:e.textContent,order:e.order||
100,href:e.href})},this)},setRelatedLinks:function(f,e){this._categorizedRelatedLinks={};f.forEach(function(d){var a=d.relatedLink,h=d.command;d=d.invocation;if(!e||-1===e.indexOf(a.id)){var b=a.category;this._categorizedRelatedLinks[b]=this._categorizedRelatedLinks[b]||[];this._categorizedRelatedLinks[b].push({title:h.name,order:a.order||100,href:h.hrefCallback.call(d.handler,d)})}},this);this._updateCategoryAnchors();this._updateCategoryNotifications()},render:function(){if(null===this._categorizedAnchors){this._categorizedAnchors=
{};var f=new URL(window.location.href);this._currentCategory=f.hash="";Object.keys(this._categorizedPageLinks).some(function(d){if(this._categorizedPageLinks[d].some(function(a){var d=new URL(a.href);a.hash="";return f.href===d.href}))return this._currentCategory=d,!0},this);var e=document.createElement("ul");e.classList.add("sideMenuList");this._categoryInfos.forEach(function(d){var a=document.createElement("li");a.classList.add("sideMenuItem");a.classList.add("sideMenu-notification");this._currentCategory===
d.id&&a.classList.add("sideMenuItemActive");a.categoryId=d.id;a.categoryName=d.textContent||d.id;var h=document.createElement("a");h.classList.add("submenu-trigger");if("string"===typeof d.imageDataURI&&0===d.imageDataURI.indexOf("data:image")){var b=document.createElement("img");b.width="16";b.height="16";b.src=d.imageDataURI;h.appendChild(b)}else h.classList.add(d.imageClass||"core-sprite-blank-menu-item");a.appendChild(h);e.appendChild(a);this._categorizedAnchors[d.id]=h},this);this._updateCategoryAnchors();
this._show=function(){this._parentNode.appendChild(e);this._show=p.prototype._show};window.setTimeout(function(){this._show()}.bind(this),1E3)}"closed"===this._state?(this._contentNode.style.left="0",this._renderTimeout&&(window.clearTimeout(this._renderTimeout),this._renderTimeout=null),this._renderTimeout=window.setTimeout(function(){this._parentNode.style.display="none";this._renderTimeout=null}.bind(this),301),this._parentNode.classList.add("animating")):(this._renderTimeout&&(window.clearTimeout(this._renderTimeout),
this._renderTimeout=null),this._parentNode.classList.remove("animating"),this._parentNode.style.display="block",this._parentNode.style.width="40px",this._contentNode.style.left="40px")},hide:function(){localStorage.setItem(k,"closed");this._contentNode.style.left="0"},toggle:function(){var l=this._contentNode;l&&l.classList.add("content-fixedHeight-animation");this._state="open"===this._state?"closed":"open";this._state===f?localStorage.removeItem(k):localStorage.setItem(k,this._state);this.render()},
_updateCategoryAnchors:function(){var f=[];Object.keys(this._categorizedRelatedLinks).forEach(function(e){("git"===e||e.match(/-scm$/))&&f.push(e)});Object.keys(this._categorizedAnchors).forEach(function(e){var d=this._categorizedAnchors[e],a=[];e===this._currentCategory?(d.parentElement.style.display="",d.href="",d.onclick=function(){return!1},d.title=d.parentElement.categoryName):(this._categorizedPageLinks[e]&&a.push.apply(a,this._categorizedPageLinks[e]),this._categorizedRelatedLinks[e]&&a.push.apply(a,
this._categorizedRelatedLinks[e]),0===a.length||0!==f.length&&("git"===e||e.match(/-scm$/))&&-1===f.indexOf(e)?(d.href="",d.title=d.parentElement.categoryName,d.parentElement.style.display="none"):(d.parentElement.style.display="",a.sort(function(a,b){return a.order<b.order?-1:b.order<a.order?1:a.title.localeCompare(b.title)}),e=a.shift(),d.href=e.href,d.title=e.title))},this);this._show()},_updateCategoryNotifications:function(){clearTimeout(this._notificationTimeout);this._notificationTimeout=setTimeout(this._updateCategoryNotifications.bind(this),
3E5);var f=n.matchResourceParameters().resource,e=(new URL(f,window.location.href)).href;this._categoryInfos.forEach(function(d){if(d.service&&d.service.getNotifications){var a=this._categorizedAnchors[d.id].parentElement;d.service.getNotifications(e).then(function(d){if(f===n.matchResourceParameters().resource){var b="";d.forEach(function(a){"info"===a.level&&!b?b="info":"warn"===a.level&&(!b||"info"===b)?b="warn":"error"===a.level&&"error"!==b&&(b="error")});b?a.setAttribute("level",b):a.removeAttribute("level")}},
function(a){window.console.log(a)})}},this)},_show:function(){}};return p});
define("orion/globalCommands","i18n!orion/nls/messages require orion/commonHTMLFragments orion/keyBinding orion/EventTarget orion/commandRegistry orion/commands orion/parameterCollectors orion/extensionCommands orion/uiUtils orion/keyBinding orion/breadcrumbs orion/webui/littlelib orion/webui/splitter orion/webui/dropdown orion/webui/tooltip orion/contentTypes orion/URITemplate orion/keyAssist orion/PageUtil orion/widgets/themes/ThemePreferences orion/widgets/themes/container/ThemeData orion/Deferred orion/widgets/UserMenu orion/PageLinks orion/webui/dialogs/OpenResourceDialog text!orion/banner/banner.html text!orion/banner/footer.html text!orion/banner/toolbar.html orion/widgets/input/DropDownMenu orion/util orion/customGlobalCommands orion/fileClient orion/webui/SideMenu orion/objects".split(" "),function(m,
n,p,k,f,l,e,d,a,h,b,g,u,v,q,r,z,t,w,A,x,C,s,y,D,E,B,L,H,G,I,N,O,Q,M){function $(a,b){if(a.getLabel)return a.getLabel();var g=new s;g.resolve(b.properties.name);return g}function T(a){u.node("progressPane").setAttribute("aria-label",m["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function S(a,b){var g=a.getServiceReferences("orion.core.auth");ea=[];var d=P.createMenuGenerator.apply(this,arguments);if(d)for(var e=0;e<
g.length;e++){var h=g[e],s=a.getService(h);$(s,h).then(function(a){s.getKey().then(function(b){ea.push(b);s.getUser().then(function(g){d.addUserItem(b,s,a,g)},function(g,e){d.addUserItem(b,s,a,e)});window.addEventListener("storage",function(g){F[b]!==localStorage.getItem(b)&&(F[b]=localStorage.getItem(b),s.getUser().then(function(g){d.addUserItem(b,s,a,g)},function(g){d.addUserItem(b,s,a)}))},!1)})})}}function U(a){return a}function X(b,g,d,h,f){function q(){if(v)return v;var a=b.getService("orion.core.contentTypeRegistry");
a||(a=new z.ContentTypeRegistry(b),a=b.getService("orion.core.contentTypeRegistry"));return a.getContentTypes().then(function(a){return v=a})}function l(a){for(var b={},g=a.getPropertyKeys(),d,e=0;e<g.length;e++)d=g[e],b[d]=a.getProperty(d);return b}function y(a,b){var g=null;a.some(function(a){return b===a.getProperty("id")?!!(g=a):!1});return g}function D(a){var b=a.command;return!b.visibleWhen||b.visibleWhen(g)?(a.invocation=new e.CommandInvocation(g,g,null,b,h),(new s).resolve(a)):"function"===
typeof f?(r||(r=f()),s.when(r,function(d){if(d&&g===ba&&(!b.visibleWhen||b.visibleWhen(d)))return a.invocation=new e.CommandInvocation(d,d,null,b,h),a})):(new s).resolve()}function k(a,b,g){return g?(new s).resolve({relatedLink:a,command:g}):b.then(function(b){return{relatedLink:a,command:new e.Command(b)}})}var u=arguments,v,r,m=b&&b.getServiceReferences("orion.page.link.related");if(m&&0!==m.length){var E=this;s.when(q(),function(){if(P.beforeGenerateRelatedLinks.apply(E,u)){var g=b.getServiceReferences("orion.navigate.command"),
e=[];m.forEach(function(d){var s=l(d);if(s.id){var f;if((s.nls&&s.nameKey||s.name)&&s.uriTemplate)f=a._createCommandOptions(s,d,b,v,!0),e.push(k(s,f,null));else if(f=y(g,s.id)){var q=l(f);d={};M.mixin(d,q,s);(s=h.findCommand(s.id))?e.push(k(d,null,s)):(f=a._createCommandOptions(q,f,b,v,!0),e.push(k(d,f,null)))}}});s.all(e,U).then(function(a){a.sort(function(a,b){return a.command.name.localeCompare(b.command.name)});return s.all(a.map(D),U).then(function(b){var g=[];b=b.filter(function(b,d){if(b)return!0;
g.push(a[d]);return!1});P.addRelatedLinkCommands.call(E,h,b,g,d);P.afterGenerateRelatedLinks.apply(E,u)})})}})}}function V(a){var b=u.node("globalActions");b&&(a.destroy(b),a.renderCommands(b.id,b,{},{},"tool"))}function W(a){var b=window.getComputedStyle(a,null);return null===b||"absolute"===b.getPropertyValue("position")||!a.parentNode||a===document.body?a:W(a.parentNode)}function K(a){var b={},g=null;"string"===typeof a&&(a=u.node(a));a||(a=u.node("pageActions"));for(var d=a;d&&d.classList;){if(d.classList.contains("toolComposite")){g=
d;break}d=d.parentNode}a.classList.contains("commandMarker")&&(b.commandNode=a);g||(g=u.node("pageToolbar"));g&&(b.slideContainer=u.$(".slideParameters",g),b.parameterArea=u.$(".parameters",g),b.dismissArea=u.$(".parametersDismiss",g),b.notifications=u.$("#notificationArea",g),g.parentNode&&(b.toolbarTarget=u.$(".toolbarTarget",g.parentNode),b.toolbarTarget&&(a=u.bounds(b.toolbarTarget),d=u.bounds(W(b.toolbarTarget.parentNode)),b.toolbarTargetY=a.top-d.top,b.toolbar=g)));return b}function J(a){if(a=
a.slideContainer)if(a.style.left="",a.style.top="",a.classList.contains("slideContainerActive")){var b=u.bounds(a),g=u.bounds(a.parentNode);a.style.left=(g.width-b.width)/2+"px";a.style.top="0"}}l=function(a){var b=document.createElement("a");b.href=a;return b.href}(n.toUrl("auth/NotifyAuthentication.html"));var F={},P={createMenuGenerator:N.createMenuGenerator||function(a,b){if(u.node("userMenu")){var g=u.node("userDropdown"),d=new q.Dropdown({dropdown:g}),g=new y.UserMenu({dropdownNode:g,dropdown:d,
serviceRegistry:a}),d=u.node("userTrigger");new r.Tooltip({node:d,text:m.Options,position:["below","left"]});var d=document.getElementById("userTrigger"),e=d.className;d.className=e+" imageSprite core-sprite-silhouette";g.setKeyAssist(b);return g}},beforeGenerateRelatedLinks:N.beforeGenerateRelatedLinks||function(a,b,g,d,e){return!0},addRelatedLinkCommands:N.addRelatedLinkCommands||function(a,b,g,d){this.sideMenu&&this.sideMenu.setRelatedLinks(b,d)},afterGenerateRelatedLinks:N.afterGenerateRelatedLinks||
function(a,b,g,d,e){},afterSetPageTarget:N.afterSetPageTarget||function(a){},generateNavigationMenu:N.generateNavigationMenu||function(a,b,g,d,e,h,s){if(a=u.node("sideMenu"))b=u.node("centralNavigation"),new r.Tooltip({node:b,text:m.CentralNavTooltip,position:["right"]}),this.sideMenu=new Q(a,u.node("pageContent")),b.addEventListener("click",this.sideMenu.toggle.bind(this.sideMenu)),(a=u.node("sideMenuToggle"))&&a.addEventListener("click",this.sideMenu.toggle.bind(this.sideMenu))},afterGenerateNavigationMenu:N.afterGenerateNavigationMenu||
function(a,b,g,d,e,h,s){},afterGenerateBanner:N.afterGenerateBanner||function(a,b,g,d,e,h,s){}},ea=[],ba,Z=[],R,ca=null,fa=null,ja=new f;return{generateBanner:function(a,b,g,h,f,q,l,y){function r(a){a.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";for(var b=u.$$array(".targetSelector"),g=0;g<b.length;g++)b[g].target=a}},{pid:"nav.config"})}(new x.ThemePreferences(h,new C.ThemeData)).apply();var t=u.node(a);
if(!t)throw m["could not find banner parent, id was "]+a;var z=document.createRange();z.selectNode(t);z=z.createContextualFragment(B);u.processTextNodes(z,m);t.firstChild?t.insertBefore(z,t.firstChild):t.appendChild(z);t=u.node("home");t.href=n.toUrl("edit/edit.html");t.setAttribute("aria-label",m["Orion Home"]);u.node("progressPane").src=e.NO_IMAGE;if(t=u.node("pageToolbar"))t.classList.add("toolbarLayout"),t.innerHTML=H+p.slideoutHTMLFragment("mainToolbar");(t=u.node("closeNotifications"))&&t.setAttribute("aria-label",
m["Close notification"]);if(17>=I.isFirefox&&(t=u.node("staticBanner")))t.style.width="100%",t.style.MozBoxSizing="border-box";if(t=u.node("footer"))t.innerHTML=L,u.processTextNodes(t,m);g.setParameterCollector(new d.CommandParameterCollector(K,J));document.addEventListener("keydown",function(a){a.keyCode===u.KEY.ESCAPE&&(a=b.getService("orion.page.message"))&&a.setProgressMessage("")},!1);P.generateNavigationMenu.apply(this,arguments);P.afterGenerateNavigationMenu.apply(this,arguments);t=D.getCategoriesInfo(b);
z=D.getPageLinksInfo(b,"orion.page.link");s.all([t,z]).then(function(a){if(this.sideMenu){var b=a[1];this.sideMenu.setCategories(a[0]);this.sideMenu.setPageLinks(b);this.sideMenu.render()}}.bind(this));if(t=u.$(".split")){var z=u.$(".sidePanelLayout"),A=u.$(".mainPanelLayout");z&&A&&(ca={side:z,main:A},ca.splitter=new v.Splitter({node:t,sidePanel:z,mainPanel:A,toggle:!0,closeByDefault:y}),t=new e.Command({name:m["Toggle side panel"],tooltip:m["Open or close the side panel"],id:"orion.toggleSidePane",
callback:function(){ca.splitter.toggleSidePanel()}}),g.addCommand(t),g.registerCommandContribution("pageActions","orion.toggleSidePane",1,null,!0,new k.KeyBinding("l",I.isMac?!1:!0,!0,!1,I.isMac?!0:!1)))}var N=!1,G=function(a,b){if(!N){var g=b.getService("orion.page.progress"),d=new E.OpenResourceDialog({searcher:a,progress:g,searchRenderer:a.defaultRenderer,onHide:function(){N=!1}});window.setTimeout(function(){N=!0;d.show()},0)}},t=new e.Command({name:m["Find File Named..."],tooltip:m["Choose a file by name and open an editor on it"],
id:"orion.openResource",callback:function(a){G(f,b)}});g.addCommand(t);g.registerCommandContribution("globalActions","orion.openResource",100,null,!0,new k.KeyBinding("f",!0,!0));var O=!1,t=function(){if(O)return!1;var a=u.node("banner"),b=u.node("footer"),g=u.node("sideMenu"),d=u.$(".content-fixedHeight"),e="hidden"===a.style.visibility;e?(a.style.visibility="visible",b.style.visibility="visible",d.classList.remove("content-fixedHeight-maximized"),g&&g.classList.remove("sideMenu-maximized")):(a.style.visibility=
"hidden",b.style.visibility="hidden",d.classList.add("content-fixedHeight-maximized"),g&&g.classList.add("sideMenu-maximized"));ja.dispatchEvent({type:"toggleTrim",maximized:!e});return!0};window.orionNoTrim?(t(),O=!0,this.sideMenu.hide()):(t=new e.Command({name:m["Toggle banner and footer"],tooltip:m["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:t}),g.addCommand(t),g.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new k.KeyBinding("m",!0,!0)));
t=new e.Command({name:m["System Configuration Details"],tooltip:m["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return n.toUrl("help/about.html")}});g.addCommand(t);g.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new k.KeyBinding(112,!0,!0));t=new e.Command({name:m["Background Operations"],tooltip:m["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return n.toUrl("operations/list.html")}});g.addCommand(t);
g.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new k.KeyBinding("o",!0,!0));fa=new w.KeyAssistPanel({commandRegistry:g});t=new e.Command({name:m["Show Keys"],tooltip:m["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){fa.isVisible()?fa.hide():fa.show();return!0}});g.addCommand(t);g.registerCommandContribution("globalActions","orion.keyAssist",100,null,!0,new k.KeyBinding(191,!1,!0));V(g);S(b,t.callback);T(b);window.addEventListener("hashchange",
function(){g.processURL(window.location.href)},!1);window.setTimeout(function(){r(b)},0);P.afterGenerateBanner.apply(this,arguments)},getToolbarElements:K,getMainSplitter:function(){return ca},getKeyAssist:function(){return fa},getGlobalEventTarget:function(){return ja},layoutToolbarElements:J,setPageTarget:function(a){var b,d,e=a.breadcrumbRootName,h=a.serviceRegistry;a.target?(a.searchService&&a.searchService.setLocationByMetaData(a.target),a.fileService&&(!a.breadcrumbTarget&&!a.staticBreadcrumb)&&
(d=(e?e+" ":"")+a.fileService.fileServiceName(a.target.Location),e=null),b=a.name||a.target.Name,ba=a.target,X.call(this,h,a.target,Z,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||(e=e||a.task||a.name),b=a.name,X.call(this,h,{NoTarget:""},Z,a.commandService,a.makeAlternate));(R=a.title)||(R=b?b+" - "+a.task:a.task);window.document.title=R;P.afterSetPageTarget.apply(this,arguments);if(b=a.breadCrumbContainer?u.node(a.breadCrumbContainer):u.node("location"))if(u.empty(b),a.staticBreadcrumb)new g.BreadCrumbs({container:b,
rootSegmentName:e});else{var s=h&&new O.FileClient(h),h=a.breadcrumbTarget||a.target,s=s&&h&&h.Location?s.fileServiceRootURL(h.Location):null;new g.BreadCrumbs({container:b,resource:h,rootSegmentName:e,workspaceRootSegmentName:d,workspaceRootURL:s,makeFinalHref:a.makeBreadcrumFinalLink,makeHref:a.makeBreadcrumbLink})}},setDirtyIndicator:function(a){R&&("*"===R.charAt(0)&&!a&&(R=R.substring(1)),a&&"*"!==R.charAt(0)&&(R="*"+R),window.document.title=R);var b=u.node("dirty");b&&(b.textContent=a?"*":"")},
setPageCommandExclusions:function(a){Z=a},notifyAuthenticationSite:l}});
define("orion/outliner","i18n!orion/nls/messages orion/Deferred orion/webui/littlelib orion/uiUtils orion/section orion/explorers/explorer orion/commands orion/URITemplate orion/EventTarget orion/i18nUtil orion/edit/editorContext orion/keyBinding orion/globalCommands".split(" "),function(m,n,p,k,f,l,e,d,a,h,b,g,u){function v(a,b,g,d){this.explorer=b;this._init(a);this.title=g;this.selectionService=d}function q(a,b,g){this.registry=a;this.renderer=new v({checkbox:!1,treeTableClass:"outlineExplorer"},
this,g,b)}function r(a,b){this.items=a;this.root={children:a};this.root.outlinerId=b;this.idItemMap={}}function z(a){this._init(a)}function t(b){this._serviceRegistry=b.serviceRegistry;this._preferences=b.preferences;a.attach(this);this._serviceRegistration=this._serviceRegistry.registerService("orion.edit.outline",this);this._outlinePref=this._preferences.getPreferences("/edit/outline");this._provider=new n;this._providerResolved=!1;this.filteredProviders=[]}v.prototype=new l.SelectionRenderer;v.prototype.constructor=
v;v.prototype.getLabelColumnIndex=function(){return 0};v.prototype.getCellElement=function(a,b,g){if(b){var e=document.createElement("span"),h=document.createElement("span");a=document.createElement("span");g.appendChild(e);e.appendChild(h);e.appendChild(a);b.className&&(a.className+=b.className);b.children?this.getExpandImage(g,h):h.classList.add("outlineLeafIndent");g=document.createElement("span");if(b.labelPre||b.classNamePre)e=document.createElement("span"),g.appendChild(e),b.labelPre&&e.appendChild(document.createTextNode(b.labelPre)),
b.classNamePre&&(e.className+=b.classNamePre);b.label&&g.appendChild(document.createTextNode(b.label));if(b.labelPost||b.classNamePost)e=document.createElement("span"),g.appendChild(e),b.labelPost&&e.appendChild(document.createTextNode(b.labelPost)),b.classNamePost&&(e.className+=b.classNamePost);b.href?this._createLink(g,b.href,a):b.line||b.column||b.start?(e=(new d("#{,resource,params*}")).expand({resource:this.title,params:b}),this._createLink(g,e,a),b.outlineLink=e):a.appendChild(g)}};v.prototype._createLink=
function(a,b,g){var d=document.createElement("a");g.appendChild(d);d.classList.add("navlinkonpage");d.appendChild(a);this.selectionService?(d.style.cursor="pointer",d.addEventListener("click",function(a){this._followLink(a,b)}.bind(this),!1)):d.href=b;return d};v.prototype.performRowAction=function(a,b){this._followLink(a,b.outlineLink)};v.prototype._followLink=function(a,b){var g=this.selectionService;g&&(k.openInNewWindow(a)?k.followLink(b,a):g.setSelections(b))};q.prototype=new l.Explorer;q.prototype.constructor=
q;q.prototype.filterChanged=function(a){var b=this.getNavHandler(),g=null;if(a){var d="i",g=a.replace(/([.+^=!:${}()|\[\]\/\\])/g,"\\$1"),g=g.replace(/([*?])/g,".$1");/[A-Z]/.test(g)&&(d="");this._currentModifiedFilter=g=RegExp(g,d);this._previousUnmodifiedFilter?0!==a.indexOf(this._previousUnmodifiedFilter)&&this.expandAll():this.expandAll()}else this.expandAll(),this._currentModifiedFilter=null;b=b.getTopLevelNodes();for(d=0;d<b.length;d++)this._filterRecursively(b[d],g);this._previousUnmodifiedFilter=
a};q.prototype._filterRecursively=function(a,b){var g=this.getNavHandler(),d=this,e=g.getRowDiv(a),h=-1!==a.label.search(b);if(a.children&&g.isExpanded(a)){var f=!1;a.children.forEach(function(a){d._filterRecursively(a,b)&&(f=!0)});f||this.myTree.collapse(a)}var q=!b||f||h;b?(q?e.classList.remove("outlineRowHidden"):e.classList.add("outlineRowHidden"),h?e.classList.add("outlineRowMatchesFilter"):e.classList.remove("outlineRowMatchesFilter"),g.setIsNotSelectable(a,!h)):(e.classList.remove("outlineRowHidden"),
e.classList.remove("outlineRowMatchesFilter"),g.setIsNotSelectable(a,!1));return q};q.prototype.postUserExpand=function(a){this._currentModifiedFilter&&(a=this.getNavDict().getValue(a).model,this._expandRecursively(a),this._filterRecursively(a,this._currentModifiedFilter))};r.prototype.constructor=r;r.prototype.getRoot=function(a){a(this.root)};r.prototype.destroy=function(){};r.prototype.getId=function(a){if(a.outlinerId)return a.outlinerId;for(var b=a.label.replace(/[\\\/\.\:\-\_\s]/g,""),g=b,d=
0;this.idItemMap[g]&&this.idItemMap[g]!==a||p.node(g);)g=b+"["+d+"]",d+=1;this.idItemMap[g]=a;return a.outlinerId=g};r.prototype.getIdItemMap=function(){return this.idItemMap};r.prototype.getChildren=function(a,b){if(a.children){for(var g=0;g<a.children.length;g++)a.children[g].parent=a;b(a.children)}else b([])};r.prototype.doExpansions=function(a){for(var b=0;b<this.root.children.length;b++)this.root.children[b].children&&a.expand(this.root.children[b])};z.prototype={_init:function(a){var b=p.node(a.parent),
g=p.node(a.toolbar);if(!b)throw Error("no parent");if(!a.outlineService)throw Error("no outline service");this._parent=b;this._toolbar=g;this._serviceRegistry=a.serviceRegistry;this._contentTypeRegistry=a.contentTypeRegistry;this._outlineService=a.outlineService;this._commandService=a.commandService;this._selectionService=a.selectionService;this._inputManager=a.inputManager;this._sidebar=a.sidebar;var d=this;this._inputManager.addEventListener("InputChanged",function(a){d.setContentType(a.contentType,
a.location);d._editor!==a.editor&&(d._editor&&d._editor.removeEventListener("InputChanged",d._editorListener),d._editor=a.editor,d._editor&&d._editor.addEventListener("InputChanged",d._editorListener=d.generateOutline.bind(d)))});n.when(d._outlineService,function(a){a.addEventListener("outline",function(a){d.providerId=a.providerId;d._renderOutline(a.outline,a.title)})})},generateOutline:function(){this._isActive()&&(this._providerLookup||this._outlineService.emitOutline(this._inputManager))},setSelectedProvider:function(a){this.providerId=
a.getProperty("id");this.providerName=a.getProperty("name");this._outlineService.setProvider(a)},setOutlineProviders:function(a){var b=this.outlineProviders,g=this._isActive();this.outlineProviders=a;this._updateViewModes(b,this.outlineProviders);g&&this._selectNewProvider()},_renderOutline:function(a,b){var g=this._parent;p.empty(g);if(a=a instanceof Array?a:[a]){var d=new r(a);this.explorer=new q(this._serviceRegistry,this._selectionService,b);this.explorer.createTree(g,d,{selectionPolicy:"cursorOnly",
setFocus:!1});d.doExpansions(this.explorer.myTree)}},_selectNewProvider:function(){var a=this.outlineProviders,b=this,g=b._sidebar;a.every(function(a){return b.providerId!==a.getProperty("id")})&&((a=a[0])?g.setViewMode(this._viewModeId(a)):g.setViewMode(g.defaultViewMode))},_viewModeId:function(a){return"outline."+a.getProperty("id")},_updateViewModes:function(a,b){var d=this;a&&a.forEach(function(a){d._sidebar.removeViewMode(d._viewModeId(a))});b.forEach(function(a){d._sidebar.addViewMode(d._viewModeId(a),
{label:a.displayName||a.getProperty("name")||a.name+a.serviceId||"undefined",create:d.createViewMode.bind(d,a),destroy:d.destroyViewMode.bind(d,a)})});var h=d._sidebar;this._commandService.unregisterCommandContribution(this._toolbar.id,"orion.openOutline",null);if(b&&b[0]){var s=d._viewModeId(b[0]),f=new e.Command({name:"Open Outliner",id:"orion.openOutline",callback:function(){var a=u.getMainSplitter();a.splitter.isClosed()&&a.splitter.toggleSidePanel();h.getActiveViewModeId()!==s&&h.setViewMode(s);
d._filterInput&&(d._previousActiveElement=document.activeElement,d._filterInput.select())}});this._commandService.addCommand(f);this._commandService.registerCommandContribution(this._toolbar.id,"orion.openOutline",1,null,!0,new g.KeyBinding("o",!0));this._commandService.renderCommands(this._toolbar.id,this._toolbar,{},{},"tool")}h.renderViewModeMenu()},_isActive:function(){var a=this._sidebar.getActiveViewModeId();if(!a)return!1;var b=this;return this.outlineProviders&&this.outlineProviders.some(function(g){return a===
b._viewModeId(g)})},createViewMode:function(a){this.setSelectedProvider(a);this._createFilterInput();this.generateOutline()},destroyViewMode:function(a){this.explorer&&(this.explorer.destroy(),this.explorer=null)},_createFilterInput:function(){var a=document.createElement("input");a.classList.add("outlineFilter");a.placeholder=m.Filter;a.type="text";a.addEventListener("input",function(b){this._filterInputTimeout&&window.clearTimeout(this._filterInputTimeout);var g=this;this._filterInputTimeout=window.setTimeout(function(){g.explorer.filterChanged(a.value);
g._filterInputTimeout=null},200)}.bind(this));a.addEventListener("keydown",function(b){var g=null,d=null;b.keyCode===p.KEY.DOWN?(a.blur(),g=this.explorer.getNavHandler(),g.focus(),g.getTopLevelNodes()&&(d=g.getTopLevelNodes()[0],g.cursorOn(d,!1,!0),d.isNotSelectable&&g.iterate(!0,!1,!1,!0)),b.preventDefault&&b.preventDefault()):b.keyCode===p.KEY.ESCAPE&&this._previousActiveElement&&this._previousActiveElement.focus()}.bind(this),!1);this._toolbar.appendChild(a);this._filterInput=a},setContentType:function(a,
b){var g=this,d=this.filteredProviders=this._serviceRegistry.getServiceReferences("orion.edit.outliner").filter(function(d){var e=d.getProperty("contentType");d=d.getProperty("pattern");return e?e.some(function(b){return g._contentTypeRegistry.isExtensionOf(a,b)}):d&&RegExp(d).test(b)?!0:!1});this._providerLookup=!0;var e=d.map(function(a){if(a.getProperty("nameKey")&&a.getProperty("nls")){var b=new n;h.getMessageBundle(a.getProperty("nls")).then(function(a,b,g){a.displayName=g[a.getProperty("nameKey")];
b.resolve()}.bind(null,a,b),b.reject);return b}a.displayName=a.getProperty("name");return(new n).resolve()});n.all(e,function(a){return a}).then(function(){g._providerLookup=!1;g._outlineService.setOutlineProviders(d);g.setOutlineProviders(d);g.generateOutline()})}};z.prototype.constructor=z;t.prototype={setOutlineProviders:function(a){this.providers=a;var b=this;n.when(this._outlinePref,function(g){for(var d,e=0;e<a.length&&!(d=a[e],g.get("outlineProvider")===a[e].getProperty("id"));e++);d&&b.setProvider(d)})},
setProvider:function(a){this._providerResolved&&(this._provider=new n);this._provider.resolve(a);this._providerResolved=!0;var b=a.getProperty("id");b&&this._outlinePref.then(function(a){a.put("outlineProvider",b)})},getProvider:function(){return this._provider.promise},emitOutline:function(a){var g=this;n.when(this.getProvider(),function(d){var e=a.getEditor(),s=e.getTitle(),f=g._serviceRegistry,q=f.getService("orion.page.progress"),l=f.getService(d),k,u;if(k=l.computeOutline)e=a.getContentType(),
u=[b.getEditorContext(f),{contentType:e&&e.id}];else if(k=l.getOutline)u=[e.getText(),s];q.progress(k.apply(l,u),h.formatMessage(m.OutlineProgress,s,d.displayName)).then(function(a){a&&g.dispatchEvent({type:"outline",outline:a,title:s,providerId:d.getProperty("id")})})})}};t.prototype.constructor=t;return{Outliner:z,OutlineService:t}});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(m,n){var p;p=m.toUrl?(new URL(m.toUrl("workspace"),window.location.href)).href:(new URL("/",window.location.href)).href;return{makeRelative:function(k){if(!k)return k;var f=window.location.protocol+"//"+window.location.host;return 0===k.indexOf(f)?k.substring(f.length):k},isAtRoot:function(k){return!k?!1:"/workspace"===k?!0:0===(new URL(k,window.location.href)).href.indexOf(p)}}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages orion/Deferred orion/webui/littlelib orion/i18nUtil orion/fileUtils orion/explorers/explorer orion/EventTarget orion/objects orion/util".split(" "),function(m,n,p,k,f,l,e,d,a){function h(a,b,g,d,e,h){this.registry=a;this.root=b;this.fileClient=g;this.idPrefix=d||"";this.excludeFiles=!!e;this.excludeFolders=!!h}function b(a){e.attach(this);this.registry=a.serviceRegistry;this.treeRoot=a.treeRoot;this.selection=a.selection;this.fileClient=
a.fileClient;this.excludeFiles=a.excludeFiles;this.excludeFolders=a.excludeFolders;this.navHandlerFactory=a.navHandlerFactory;this.parentId=a.parentId;this.renderer=a.rendererFactory(this);this.dragAndDrop=a.dragAndDrop;this.setFocus=a.setFocus;this.myTree=this.model=null;this._hookedDrag=this.checkbox=!1;var b=a.modelEventDispatcher?a.modelEventDispatcher:new e;this.modelEventDispatcher=b;var g=this;this._modelListeners={};"copy copyMultiple create delete deleteMultiple import move moveMultiple".split(" ").forEach(function(a){b.addEventListener(a,
g._modelListeners[a]=g.modelHandler[a].bind(g))});this._clickListener=function(a){if("A"===a.target.tagName){for(a=a.target;a&&!a._item;)a=a.parentNode;if(a&&a._item)g.onLinkClick({type:"linkClick",item:a._item})}};(a=p.node(this.parentId))&&a.addEventListener("click",this._clickListener);var d=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";d.setTarget&&d.setTarget(a)}},
{pid:"nav.config"})}h.prototype=new l.ExplorerModel;d.mixin(h.prototype,{getRoot:function(a){a(this.root)},processParent:function(a,b){var g=a.Projects?[]:[a].concat(a.Parents||[]);if(this.excludeFiles||this.excludeFolders){var d=[],e;for(e in b)if(!(b[e].Directory?this.excludeFolders:this.excludeFiles))d.push(b[e]),b[e].parent=a,b[e].Parents||(b[e].Parents=g);b=d}else for(d in b)b[d].parent=a,b[d].Parents||(b[d].Parents=g);a.children=b;a.children.sort(this.sortChildren);return b},sortChildren:function(a,
b){var g=a.Directory;if(g!==b.Directory)return g?-1:1;var g=a.Name&&a.Name.toLowerCase(),d=b.Name&&b.Name.toLowerCase();return g<d?-1:g>d?1:0},getChildren:function(a,b){var g=this;if(a.children)b(a.children);else if(void 0!==a.Directory&&!1===a.Directory)b([]);else if(a.Children)b(g.processParent(a,a.Children));else if(a.Location){var d=null;this.registry&&(d=this.registry.getService("orion.page.progress"));(d?d.progress(this.fileClient.fetchChildren(a.ChildrenLocation),m["Fetching children of "]+
a.Name):this.fileClient.fetchChildren(a.ChildrenLocation)).then(function(d){g.destroyed||b(g.processParent(a,d))},function(){b([])})}else b([])},hasChildren:function(){var a=!1;this.root.Children&&(a=0<this.root.Children.length);return a}});h.prototype.constructor=h;var g,u;b.prototype=Object.create(l.Explorer.prototype);d.mixin(b.prototype,{destroy:function(){var a=this;Object.keys(this._modelListeners).forEach(function(b){a.modelEventDispatcher.removeEventListener(b,a._modelListeners[b])});var b=
p.node(this.parentId);b&&b.removeEventListener("click",this._clickListener);l.Explorer.prototype.destroy.call(this)},onLinkClick:function(a){this.dispatchEvent(a)},onModelCreate:function(a){return this.changedItem(a.parent,!0)},onModelCopy:function(a){var b=this,g={};(a.items||[a]).forEach(function(a){a=(a=a.parent)||b.treeRoot;g[a.Location]=a});return n.all(Object.keys(g).map(function(a){return b.changedItem(g[a],!0)}))},onModelMove:function(a){var b=this,g={};(a.items||[a]).forEach(function(a){var d=
b.treeRoot;if((d.Location||d.ContentLocation)===a.oldValue.Location){var e=b.treeRoot;a=a.newValue;a=a.ChildrenLocation?a:this.fileClient.read(a.ContentLocation,!0);return n.when(a,function(a){b.dispatchEvent({type:"rootMoved",oldValue:e,newValue:a});b.loadResourceList(a)})}d=(d=a.oldValue.parent)||b.treeRoot;g[d.Location]=d;d=(d=a.parent)||b.treeRoot;g[d.Location]=d;a.oldValue.Directory&&(a.newValue&&b.isExpanded(a.oldValue))&&(g[a.newValue.Location]=a.newValue)});return n.all(Object.keys(g).map(function(a){return b.changedItem(g[a],
!0)}))},onModelDelete:function(a){a=a.items||[a];var b=this,g=b.treeRoot,d;if(a.some(function(a){if(a.oldValue.Location===(g.Location||g.ContentLocation)){if(a.oldValue.Location!==(a.parent.Location||a.parent.ContentLocation))d=a.parent;return!0}return!1}))return this.loadResourceList(d);var e={};a.forEach(function(a){a=a.parent;e[a.Location]=a});return n.all(Object.keys(e).map(function(a){return b.changedItem(e[a],!0)}))},modelHandler:{copy:function(a){if(!a.count)return this.onModelCopy(a)},copyMultiple:function(a){return this.onModelCopy(a)},
create:function(a){return this.onModelCreate(a)},"delete":function(a){if(!a.count)return this.onModelDelete(a)},deleteMultiple:function(a){return this.onModelDelete(a)},"import":function(a){return this.changedItem(a.target,!0)},move:function(a){if(!a.count)return this.onModelMove(a)},moveMultiple:function(a){return this.onModelMove(a)}},makeNewChildItemPlaceholder:function(a,b,g){var d=new n;this.model.getChildren(a,function(e){var h=null,f=!1;if(e){e.push(b);e.sort(this.model.sortChildren);var h=
e.indexOf(b),l=h+1;e.length>l?h=e[l]:(f=h-1,h=0<=f?e[f]:a,f=!0)}else h=a;e=this.makeNewItemPlaceholder(h,g,f);d.resolve(e)}.bind(this));return d},_makeDropTarget:function(b,d,e){if(this.dragAndDrop){var h=this,l=this.dragAndDrop,w=function(a){g=a.target};e&&(this._oldDragStart&&d.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=w);d.addEventListener("dragstart",w,!1);w=function(a){g=null};e&&(this._oldDragEnd&&d.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=
w);d.addEventListener("dragend",w,!1);w=function(a){d.classList.remove("dragOver");a.preventDefault();a.stopPropagation()};e&&(this._oldDragLeave&&d.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=w);d.addEventListener("dragleave",w,!1);w=function(b){if(g)u=b.dataTransfer.dropEffect=(a.isMac?b.altKey:b.ctrlKey)?"copy":"move";else if(!a.isIE&&("all"===b.dataTransfer.effectAllowed||"uninitialized"===b.dataTransfer.effectAllowed||0<=b.dataTransfer.effectAllowed.indexOf("copy")))b.dataTransfer.dropEffect=
"copy";d.classList.add("dragOver");p.stop(b)};e&&(this._oldDragEnter&&d.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=w);d.addEventListener("dragenter",w,!1);w=function(b){if(g)u=b.dataTransfer.dropEffect=(a.isMac?b.altKey:b.ctrlKey)?"copy":"move";else if(!a.isIE&&("all"===b.dataTransfer.effectAllowed||"uninitialized"===b.dataTransfer.effectAllowed||0<=b.dataTransfer.effectAllowed.indexOf("copy")))b.dataTransfer.dropEffect="copy";p.stop(b)};e&&!this._oldDragOver&&(d.addEventListener("dragover",
w,!1),this._oldDragOver=w);var A=null,x=null;h.registry&&(A=h.registry.getService("orion.page.progress"),x=h.registry.getService("orion.page.message"));var C=function(a){if(x){var b=null,b="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;x.setProgressResult(b)}else window.console.log(a)},s=function(a,g,d,e,h,q){var l=!1,u=f.isAtRoot(g.Location);q?(l=!0,q.entryCount++):a.isDirectory&&(l=!0,q={entryCount:1,deferred:new n},d._makeUploadNode(g,a.name,!0).then(function(a){var b=
function(){a.destroyFunction();u?d.loadResourceList(d.treeRoot.Path,!0):d.changedItem(g)};q.deferred.then(b,b)}));var r=function(){q&&(q.entryCount--,0===q.entryCount&&q.deferred.resolve())},t=function(a){if(x){var b=null,b="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;x.setProgressResult(b)}else window.console.log(a);r()};!g.Location&&g.fileMetadata&&(g=g.fileMetadata);if(a.isFile)u?t(m["You cannot copy files directly into the workspace.  Create a folder first."]):
a.file(function(a){if(q){var h=a.name.indexOf(".zip")===a.name.length-4&&window.confirm(k.formatMessage(m["Unzip ${0}?"],a.name));e(g,a,d,h,!1,{error:function(b){b=m["Uploading the following file failed: "]+a.name;x?x.setProgressResult({Severity:"Error",Message:b}):window.console.log(b)},loadend:r},!0)}else d._uploadFile(b,a,!0)}.bind(this));else if(a.isDirectory){var p=a.createReader(),z=function(a){p.readEntries(function(b){for(var g=0;g<b.length;g++)s(b[g],a,d,e,h,q);r()})};u?(A?A.progress(h.createProject(g.ChildrenLocation,
a.name),k.formatMessage(m["Creating ${0}"],a.name)):h.createProject(g.ChildrenLocation,a.name)).then(function(a){(A?A.progress(h.read(a.ContentLocation,!0),m["Loading "]+a.name):h.read(a.ContentLocation,!0)).then(function(a){z(a)},t)},t):(A?A.progress(h.createFolder(g.Location,a.name),k.formatMessage(m["Creating ${0}"],a.name)):h.createFolder(g.Location,a.name)).then(function(a){var g=d.modelEventDispatcher;l||g.dispatchEvent({type:"create",parent:b,newValue:a});z(a)},t)}},w=function(a){var e;d.classList.remove("dragOver");
if(g){e=h.fileClient;for(var r=g,B;r;){if(r._item){B=r._item;break}r=r.parentNode}if(!B)return;var w="copy"===u;e=(w?e.copyFile:e.moveFile).apply(e,[B.Location,b.Location,B.Name]);A&&(r=k.formatMessage(m[w?"Copying ${0}":"Moving ${0}"],B.Location),e=A.showWhile(e,r));e.then(function(a){h.modelEventDispatcher.dispatchEvent({type:w?"copy":"move",oldValue:B,newValue:a,parent:b})},C)}else if(a.dataTransfer.items&&0<a.dataTransfer.items.length)for(e=0;e<a.dataTransfer.items.length;e++)r=null,"function"===
typeof a.dataTransfer.items[e].getAsEntry?r=a.dataTransfer.items[e].getAsEntry():"function"===typeof a.dataTransfer.items[e].webkitGetAsEntry&&(r=a.dataTransfer.items[e].webkitGetAsEntry()),r&&s(r,b,h,l,h.fileClient);else if(a.dataTransfer.files&&0<a.dataTransfer.files.length)for(e=0;e<a.dataTransfer.files.length;e++)r=a.dataTransfer.files[e],!r.size&&!r.type?C(k.formatMessage(m["Did not drop ${0}.  Folder drop is not supported in this browser."],r.name)):f.isAtRoot(b.Location)?C(m["You cannot copy files directly into the workspace.  Create a folder first."]):
h._uploadFile(b,r,!0);p.stop(a)};e&&(this._oldDrop&&d.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=w);d.addEventListener("drop",w,!1)}},_uploadFile:function(a,b,g){var d=a;!d.Location&&d.fileMetadata&&(d=d.fileMetadata);a=function(){this._makeUploadNode(d,b.name,!1).then(function(a){var g=a.refNode,e=a.progressBar,h=a.cancelButton,f=a.destroyFunction,s=this.registry.getService("orion.page.message");a={progress:function(a){var b="";if(a.lengthComputable){b=Math.floor(100*(a.loaded/a.total))+
"%";e.style.width=b;var d=Math.round(a.loaded/1024);a=Math.round(a.total/1024);e.title=m["Upload progress: "]+b+",  "+d+"/"+a+" KB";g.title=e.title}},loadend:function(a){f();this.changedItem(d)}.bind(this),error:function(a){a=m["Uploading the following file failed: "]+b.name;s?s.setProgressResult({Severity:"Error",Message:a}):window.console.log(a)}};var l=b.name.indexOf(".zip")===b.name.length-4&&window.confirm(k.formatMessage(m["Unzip ${0}?"],b.name)),D=this.dragAndDrop(d,b,this,l,!1,a,!0);h.addEventListener("click",
function(){D.abort()})}.bind(this))}.bind(this);g?this.expandItem(d,!1).then(a):a()},_makeUploadNode:function(a,b,g){var d=this.getRow(a).id;return this.makeNewChildItemPlaceholder(a,{Name:b,Directory:g},d).then(function(a){var d=null,e,h;if(a){d={};e=a.refNode;h=a.wrapperNode;e.classList.add("uploadNode");d.refNode=e;d.wrapperNode=h;h=document.createElement("span");h.classList.add("uploadNodeText");h.appendChild(document.createTextNode(b));e.appendChild(h);h=document.createElement("span");h.classList.add("progressBarWrapper");
var f=document.createElement("span");f.classList.add("progressBar");h.appendChild(f);e.appendChild(h);d.progressBar=f;g?(f.classList.add("continuous"),e.title=m["Uploading "]+b,f.title=e.title):(h=document.createElement("button"),h.classList.add("imageSprite"),h.classList.add("core-sprite-delete"),h.classList.add("uploadCancelButton"),h.title=m["Cancel upload"],e.appendChild(h),d.cancelButton=h);d.destroyFunction=a.destroyFunction}return d}.bind(this))},createModel:function(){return new h(this.registry,
this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders)},changedItem:function(a,b){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,b);var g=this,d=new n;a.children=a.Children=null;this.model.getChildren(a,function(e){g.getNavHandler();g.myTree.refresh.bind(g.myTree)(a,e,b);d.resolve(e)});return d},showItem:function(a,b){var g=new n;if(!a||!this.model||!this.myTree||!this.myTree.showRoot&&a.Location===this.treeRoot.Location)return g.reject();
var d=this.getRow(a);if(d)g.resolve(d._item||a);else return a.Parents&&0<a.Parents.length?(a.Parents[0].Parents=a.Parents.slice(1),this.expandItem(a.Parents[0],b).then(function(b){var g=this.getRow(a);return!g?this.changedItem(b,!0).then(function(){var b=this.getRow(a);return b?b._item:(new n).reject()}.bind(this)):g._item||a}.bind(this))):void 0===b||b?this.reroot(a):g.reject();return g},expandItem:function(a,b){var g=new n;this.showItem(a,b).then(function(a){this.myTree.isExpanded(a)?g.resolve(a):
this.myTree.expand(this.model.getId(a),function(){g.resolve(a)})}.bind(this),g.reject);return g},reveal:function(a,b){return this.showItem(a,b).then(function(a){var b=this.getNavHandler();b&&(b.cursorOn(a,!0),b.setSelection(a));return a}.bind(this))},reroot:function(a){return(new n).reject()},isExpanded:function(a){a=this.model.getId(a);return this.renderer.tableTree.isExpanded(a)},getNameNode:function(a){if(a=this.model.getId(a))return p.node(a+"NameLink")},scopeUp:function(){},scopeDown:function(a){},
loadResourceList:function(a,b,g){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);a=f.makeRelative(a);if(!b&&a===this._lastPath)return(new n).resolve(this.treeRoot);this._lastPath=a;var d=this;return b||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),m["Loading "]+a).then(function(b){d.treeRoot.Path=a;"function"===typeof g&&g();d.dispatchEvent({type:"rootChanged",root:d.treeRoot});return(new n).resolve(d.treeRoot)},function(a){d.treeRoot.Path=null;d.dispatchEvent({type:"rootChanged",
root:d.treeRoot});return(new n).reject(a)}):(new n).resolve(d.treeRoot)},load:function(a,b,g){var d=p.node(this.parentId),e=p.node("progress");e||(e=document.createElement("div"),e.id="progress",p.empty(d),d.appendChild(e));p.empty(e);var h=setTimeout(function(){p.empty(e);e.appendChild(document.createTextNode(b))},500),f=this;return n.when(a,function(a){clearTimeout(h);if(!f.destroyed){f.treeRoot={};for(var b in a)f.treeRoot[b]=a[b];f.model=f.createModel();f.dragAndDrop&&(f._hookedDrag?f._makeDropTarget(f.treeRoot,
d,!0):(a=(a=d&&("draggable"in d||"ondragstart"in d&&"ondrop"in d))&&!(!window.File||!window.FileList||!window.FileReader),f._hookedDrag=!0,a?f._makeDropTarget(f.treeRoot,d,!0):(f.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser."))));var e=new n;f.createTree(f.parentId,f.model,{onComplete:function(a){e.resolve(a)},navHandlerFactory:f.navHandlerFactory,setFocus:"undefined"===typeof f.setFocus?!0:f.setFocus,selectionPolicy:f.renderer.selectionPolicy,onCollapse:function(a){if(f.getNavHandler())f.getNavHandler().onCollapse(a)}});
return e.then(function(){if("function"===typeof g)try{g()}catch(a){f.registry&&f.registry.getService("orion.page.message").setErrorMessage(a)}if("function"===typeof f.onchange)f.onchange(f.treeRoot);return f.treeRoot})}},function(a){clearTimeout(h);f.registry&&f.registry.getService("orion.page.message").setProgressResult(a);return(new n).reject(a)})},onchange:function(a){}});b.prototype.constructor=b;return{FileExplorer:b,FileModel:h}});
define("orion/widgets/browse/commitInfoRenderer",["orion/objects","orion/URITemplate","orion/webui/littlelib","orion/xhr","orion/URL-shim"],function(m,n,p,k){function f(d,a,e){return 0<d?1===d?a+" ":d+" "+e+" ":""}function l(d){d=new Date(d);var a=(new Date).getTime()-d.getTime();d=Math.floor(a/1E3/60/60/24/365);var a=a-31536E6*d,e=Math.floor(a/1E3/60/60/24/30),a=a-2592E6*e,b=Math.floor(a/1E3/60/60/24),a=a-864E5*b,g=Math.floor(a/1E3/60/60),l=Math.floor((a-36E5*g)/1E3/60),a=f(d,"a year","years"),k=
f(e,"a month","months"),q=f(b,"a day","days"),r=f(g,"an hour","hours"),l=f(l,"a minute","minutes"),m="";a?m=0<d?a:a+k:k?m=0<e?k:k+q:q?m=0<b?q:q+r:r?m=0<g?r:r+l:l&&(m=l);return m?m+"ago":"Just now"}function e(d){this._parentDomNode=p.node(d.parent);this._commitInfo=d.commitInfo}m.mixin(e.prototype,{destroy:function(){},_simpleMessage:function(d){var a=this._commitInfo.Message?this._commitInfo.Message:"";if(a){var e=a.replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n");e&&0<e.length&&(a=e[0]);10<d&&a.length>
d&&(a=a.substring(0,d-3)+"...")}return a},_generateMessageNode:function(d){var a;if(this._commitInfo.URL||this._commitInfo.SHA1){a=document.createElement("a");if(this._commitInfo.SHA1){var e=(new URL("commit",window.location.href)).href,e=decodeURIComponent(e);a.href=(new n(e+"{/SHA1}")).expand(this._commitInfo)}else a.href=this._commitInfo.URL;a.classList.add("commitInfolink")}else a=document.createElement("span");a.appendChild(document.createTextNode(d));return a},_requestPhotoURL:function(d,a){var e=
this,b=new URL("/manage/service/com.ibm.team.jazzhub.common.service.IPhotoService/getContributorPhotoURI",window.location.href);b.query.set("contributorUserId",d);k("GET",b.href,{timeout:15E3}).then(function(b){b=JSON.parse(b.response);a.src=b.photoURI},function(){e._useOtherPhotoURL(a)})},_useOtherPhotoURL:function(d){d.src=this._commitInfo.AvatarURL?this._commitInfo.AvatarURL:"https://www.gravatar.com/avatar/?d\x3dmm"},renderSimple:function(d){this._parentDomNode.appendChild(this._generateMessageNode(this._simpleMessage(d)))},
render:function(d,a){var e=this._commitInfo.Author&&this._commitInfo.Author.Date?l(this._commitInfo.Author.Date):"",b=this._simpleMessage(-1),g=this._commitInfo.Author&&this._commitInfo.Author.Name?this._commitInfo.Author.Name:"",f=d;f||(f="Commit");f="Last "+f;if(a){var k=document.createElement("div"),q=new Image;this._commitInfo.Author&&this._commitInfo.Author.UserId?this._requestPhotoURL(this._commitInfo.Author.UserId,q):this._useOtherPhotoURL(q);q.classList.add("commitInfoAvatar");k.appendChild(q)}else k=
document.createElement("div"),k.classList.add("commitInfoLabelContainer"),k.appendChild(document.createTextNode(f.toUpperCase()));this._parentDomNode.appendChild(k);k=document.createElement("div");k.classList.add("commitInfoMessageContainer");q=document.createElement("div");q.classList.add("commitInfoAutorContainer");var m=document.createDocumentFragment(),z=document.createElement("span");z.appendChild(document.createTextNode(g));z.classList.add("navColumnBold");a?(g=document.createElement("span"),
g.appendChild(document.createTextNode(f)),g.classList.add("navColumnBold"),m.textContent=e?"${0} by ${1} "+e+".":"${0} by ${1}.",e=[g,z]):(m.textContent=e?"by ${0} "+e+".":"by ${0}.",e=[z]);p.processDOMNodes(m,e);q.appendChild(m);k.appendChild(q);e=document.createElement("div");e.classList.add("commitInfoMessageTextContainer");e.appendChild(this._generateMessageNode(b));k.appendChild(e);this._parentDomNode.appendChild(k)}});return{CommitInfoRenderer:e,calculateTime:l}});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages orion/Deferred orion/explorers/explorer orion/explorers/navigationUtils orion/extensionCommands orion/objects orion/URITemplate orion/widgets/browse/commitInfoRenderer orion/webui/littlelib".split(" "),function(m,n,p,k,f,l,e,d,a){function h(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function b(a,b,g,d,k,m,p,C,s){b=l.clone(b);
var y;if(b.Directory)y=document.createElement("a"),y.className="navlinkonpage",d=!a?u:new e(a+"#{,resource,params*}"),y.href=d.expand({resource:b.ChildrenLocation}),b.Name&&y.appendChild(document.createTextNode(b.Name));else{k||(k=f.getOpenWithCommands(g));y=document.createElement("a");y.className="navlink targetSelector";m&&"object"===typeof m&&Object.keys(m).forEach(function(a){y[a]=m[a]});var D=null,E=null;if(D=C?C.holderDom:y)E=document.createElement("span"),E.className="core-sprite-file modelDecorationSprite thumbnail",
D.appendChild(E);b.Name&&y.appendChild(document.createTextNode(b.Name));var B=b.Location;p&&"object"===typeof p&&(b.params={},l.mixin(b.params,p));(a=f.getOpenWithCommand(g,b,k))&&(B=a.hrefCallback({items:b}));n.when(d.getFileContentType(b),function(a){if(D){var g=D,d=E;if(a){var e,f=a.imageClass,l=a.image;f?(e=document.createElement("span"),e.className+=f,e.classList.add("thumbnail")):l&&(e=document.createElement("img"),e.src=l,e.classList.add("thumbnail"));e&&g.replaceChild(e,d)}}y.href=B;s&&"function"===
typeof s.updateFileNode&&s.updateFileNode(b,y,h(a))})}y.addEventListener("click",function(){v=b}.bind(this),!1);return y}function g(a,b,g,d){this.explorer=b;this.commandService=g;this.contentTypeService=d;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var u=new e("#{,resource,params*}"),v;g.prototype=new p.SelectionRenderer;g.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};g.prototype.tableCallback=function(a){a.setAttribute("aria-label",
m.Navigator);a.setAttribute("role","presentation")};g.prototype.rowCallback=function(a,b){a.setAttribute("role","treeitem")};g.prototype.emptyCallback=function(b){var g=document.createElement("tr"),d=document.createElement("td");d.colSpan=this.oneColumn?1:3;var e=document.createElement("div");e.classList.add("noFile");e.textContent=m.NoFile;var h=document.createElement("span");h.appendChild(document.createTextNode(m.File));a.processDOMNodes(e,[h]);d.appendChild(e);g.appendChild(d);b.appendChild(g)};
g.prototype.getDisplayTime=function(a){return(new Date(a)).toLocaleString()};g.prototype.getCommitRenderer=function(a,b){return new d.CommitInfoRenderer({parent:a,commitInfo:b})};g.prototype.getCellHeaderElement=function(a){if(this.oneColumn&&0!==a)return null;switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};g.prototype.setTarget=function(a){this.target=a};g.prototype.getFolderImage=function(a){if(!this.showFolderImage)return null;a=document.createElement("span");a.className=
"core-sprite-folder modelDecorationSprite";return a};g.prototype.createFolderNode=function(a){var g;this.showFolderLinks?(g=b(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&g.insertBefore(a,g.firstChild)):(g=document.createElement("span"),g.textContent=a.Name);return g};g.prototype.updateFileNode=function(a,b,g){};g.prototype.showFolderLinks=!0;g.prototype.getCellElement=function(a,g,d){var e=g.LastCommit?2:1,h=g.LastCommit?3:2,l=g.LastCommit?1:-1;switch(a){case 0:return a=
document.createElement("td"),e=document.createElement("span"),e.id=d.id+"MainCol",e.setAttribute("role","presentation"),a.appendChild(e),a.setAttribute("role","presentation"),e.className="mainNavColumn",g.Directory?(this.getExpandImage(d,e),h=this.createFolderNode(g),e.appendChild(h),this.explorer._makeDropTarget(g,h),this.explorer._makeDropTarget(g,d)):(this.openWithCommands||(this.openWithCommands=f.getOpenWithCommands(this.commandService)),h=b("",g,this.commandService,this.contentTypeService,this.openWithCommands,
{target:this.target},null,null,this),e.appendChild(h)),h&&(h.id=d.id+"NameLink",1===h.nodeType&&(k.addNavGrid(this.explorer.getNavDict(),g,h),h.setAttribute("role","link"),h.setAttribute("tabindex","-1"))),this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,e,g,this.explorer,"tool",null,!0),a;case e:if(this.oneColumn)return null;d=document.createElement("td");g.LocalTimeStamp&&(d.textContent=this.getDisplayTime(g.LocalTimeStamp));return d;case h:if(this.oneColumn)return null;
d=document.createElement("td");!g.Directory&&"number"===typeof g.Length&&(g=parseInt(g.Length,10)/1024,d.textContent=Math.ceil(g).toLocaleString()+" KB");d.style.textAlign="right";return d;case l:if(this.oneColumn||!g.LastCommit)return null;d=document.createElement("td");this.getCommitRenderer(d,g.LastCommit).renderSimple(60);return d}};g.prototype.constructor=g;return{NavigatorRenderer:g,isImage:h,getClickedItem:function(){return v},createLink:b}});
define("orion/fileDownloader",["i18n!orion/navigate/nls/messages","orion/i18nUtil","orion/URL-shim"],function(m,n){function p(){return"undefined"!==typeof f.download||"undefined"!==typeof window.navigator&&window.navigator.msSaveBlob}function k(f,e,d){this.fileClinet=f;this.statusService=e;this.progressService=d}var f=document.createElementNS("http://www.w3.org/1999/xhtml","a");k.prototype={_isSupported:function(f){return!f&&!p()?(this.statusService&&this.statusService.setProgressResult&&this.statusService.setProgressResult({Message:m["Download not supported"],
Severity:"Error"}),!1):!0},downloadFromLocation:function(f,e,d){if(this._isSupported(d)){var a=this.progressService,h=function(a){var g=null;this.serviceRegistry?g=this.serviceRegistry.getService("orion.page.message"):this.statusService&&(g=this.statusService);if(g){if(!a.Severity){var d=a;a={Severity:"Error",Message:m.noResponse};if(0!==d.status)if(d.responseText){d=d.responseText;try{var e=JSON.parse(d);a.Severity=e.Severity||a.Severity;a.Message=e.Message||a.Message}catch(h){a.Message=d}}else try{a.Message=
JSON.stringify(d)}catch(f){}}g.setProgressResult(a)}else window.console.log(a);this._setNoInput()}.bind(this);this.statusService&&this.statusService.setProgressResult&&this.statusService.setProgressResult({Message:m["Downloading..."]});(function(b,g,d){return!a?b:a.progress(b,n.formatMessage(g,d))})(this.fileClinet.readBlob(f.Location),m["Downloading..."],f.Location).then(function(a){this.statusService&&this.statusService.setProgressMessage&&this.statusService.setProgressMessage("");this.downloadFromBlob(a,
f.Name,e,d)}.bind(this),h)}},downloadFromBlob:function(f,e,d,a,h){if(this._isSupported(a)){var b=new Blob([f],{type:d&&d.id?d.id:"application/octet-stream"});f=h?document.createElementNS("http://www.w3.org/1999/xhtml","a"):document.createElement("a");if("undefined"!==typeof f.download){d=URL.createObjectURL(b);f.href=d;f.download=e;if(h)return f;h=document.createEvent("MouseEvents");h.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null);f.dispatchEvent(h)}else if("undefined"!==typeof window.navigator&&
window.navigator.msSaveOrOpenBlob){if(h)return f.href="javascript:void(0)",f.addEventListener("click",function(){window.navigator.msSaveBlob(b,e)}),f;window.navigator.msSaveBlob(b,e)}}}};return{FileDownloader:k,downloadSupported:p}});
define("orion/compare/compareUtils",["orion/URITemplate"],function(m){var n=n||{};n.compareUtils=n.compareUtils||{};n.compareUtils.lookUpMapper=function(m,k,f){for(var l=0,e=0;e<m.length;e++){var d=m[e][k];0===d&&(d=1);if(f>=l&&f<l+d)return{mapperIndex:e,startFrom:l};if(e===m.length-1)break;l+=m[e][k]}return{mapperIndex:m.length-1,startFrom:l}};n.compareUtils.lookUpLineIndex=function(m,k,f){if(0===f)return 0;for(var l=0,e=0;e<f;e++)l+=m[e][k];return l};n.compareUtils.updateMapper=function(m,k,f,l,
e){if(l!==e&&(0<l||0<e)){var d=n.compareUtils.lookUpMapper(m,k,f);if(!(0>d.mapperIndex)){if(0<l){var a=f-d.startFrom;for(f=d.mapperIndex;f<m.length;f++){a=m[f][k]-a;if(l<=a){m[f][k]-=l;break}m[f][k]-=a;l-=a;a=0}}0<e&&(m[d.mapperIndex][k]+=e)}}};n.compareUtils.overlapMapper=function(m,k,f,l,e){m=f+m[k]-1;m<f&&(m=f);e<l&&(e=l);return m<l||e<f?!1:!0};n.compareUtils.findFirstDiff=function(m,k,f,l){for(var e=0,d=null,a=0;a<m.length&&!(e>l)&&(!n.compareUtils.overlapMapper(m[a],k,e,f,l)||!(d={mapperIndex:a,
startFrom:e},0!==m[a][2]));a++)e+=m[a][k];return d};n.compareUtils.matchMapper=function(m,k,f,l){if(0===m.length)return f;var e=f+Math.round((l-f)/3),d=n.compareUtils.findFirstDiff(m,k,f,l),a=0===m[d.mapperIndex][k]?d.startFrom:d.startFrom+m[d.mapperIndex][k]-1,h=n.compareUtils.lookUpLineIndex(m,1-k,d.mapperIndex),b=d.startFrom-f;return 0===m[d.mapperIndex][2]?h-b:e>=d.startFrom&&e<=a?h-Math.round((l-f)/3):e<d.startFrom?h-b:(0===m[d.mapperIndex][1-k]?h:h+m[d.mapperIndex][1-k]-1)-(a-f)};n.compareUtils.getMapperLineCount=
function(m){for(var k=0,f=0;f<m.length;f++)k+=Math.max(m[f][0],m[f][1]);return k};n.compareUtils.getAnnotationIndex=function(m,k){for(var f=0;f<m.length;f++)if(m[f][0]===k)return f;return-1};n.compareUtils.getAnnotationMapperIndex=function(m,k){return m[k][1]};n.compareUtils.getAnnotationIndexByMapper=function(m,k){for(var f=0;f<m.length;f++)if(m[f][1]===k)return{current:f,prev:f-1,next:f+1};return{current:-1,prev:-1,next:-1}};n.compareUtils.isMapperConflict=function(m,k){return 0>k||!m[k][3]?!1:
1===m[k][3]};n.compareUtils.mergeDiffBlocks=function(m,k,f,l,e,d){for(var a=0;a<k.length;a++){var h=k[a][0],b=f[k[a][1]];if(0<b[0]){for(var g="",u=0;u<b[0];u++)g=g+l[b[2]-1+u].substring(e)+d;b=m.getLineCount();h>=b&&(h=m.getLineEnd(b-1),u=m.getLineEnd(b-1,!0),h===u?(m.setText(d,h,h),h=b):h=b-1);h=m.getLineStart(h);m.setText(g,h,h)}}};n.compareUtils.generateCompareHref=function(p,k){var f=require.toUrl("compare/compare.html");k.conflict||(k.conflict=void 0);k.readonly||(k.readonly=void 0);return(new m(f+
"#{,resource,params*}")).expand({resource:p,params:k})};n.compareUtils.generateCompareTreeHref=function(p,k){var f=require.toUrl("compare-tree/compare-tree.html");return(new m(f+"#{,resource,params*}")).expand({resource:p,params:k})};return n.compareUtils});
define("orion/webui/dialogs/DirectoryPrompterDialog","i18n!orion/widgets/nls/messages orion/webui/littlelib orion/webui/dialog orion/fileUtils orion/selection orion/explorers/navigationUtils orion/explorers/explorer orion/explorers/explorer-table".split(" "),function(m,n,p,k,f,l,e,d){function a(a,g){this.explorer=g;this._init(a)}function h(a){this._init(a)}a.prototype=new e.SelectionRenderer;a.prototype.constructor=a;a.prototype.getLabelColumnIndex=function(){return 0};a.prototype.getCellElement=
function(a,g,d){a=document.createElement("td");d.appendChild(a);var e=document.createElement("span");e.id=d.id+"navSpan";a.appendChild(e);e.className="mainNavColumn singleNavColumn";this.getExpandImage(d,e);e.appendChild(document.createTextNode(g.Name))};h.prototype=new p.Dialog;h.prototype.TEMPLATE='\x3cdiv id\x3d"message" style\x3d"width: 25em; padding-bottom: 5px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"directoryTree" class\x3d"explorerTreeClass" style\x3d"width:25em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"\x3e\x3c/div\x3e';
h.prototype._init=function(a){this.title=a.title||m["Choose a Folder"];this.modal=!0;this.buttons=[{text:m.OK,isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._fileClient=a.fileClient;this._serviceRegistry=a.serviceRegistry;this._message=a.message||"";this._func=a.func;this._initialize()};h.prototype._bindToDom=function(a){this.loadFolderList("/");this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";this.$directoryTree.focus()};
h.prototype.loadFolderList=function(b){b=k.makeRelative(b);this.selection=new f.Selection(this._serviceRegistry,"orion.directoryPrompter.selection");this.explorer=new d.FileExplorer({treeRoot:{children:[]},selection:this.selection,serviceRegistry:this._serviceRegistry,fileClient:this._fileClient,parentId:"directoryTree",excludeFiles:!0,rendererFactory:function(b){return new a({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"},b)}});this.explorer.loadResourceList(b,!0,null)};h.prototype.done=
function(){this.selection.getSelection(function(a){this.hide();this._func(a)}.bind(this))};h.prototype.constructor=h;return{DirectoryPrompterDialog:h}});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(m,n,p,k){function f(){}f.prototype={_initialize:function(f,e,d,a,h){this._tooltip=new k.Tooltip({node:f,hideDelay:h||0,afterShowing:this._afterShowingFunction(e).bind(this),afterHiding:d,trigger:a?a:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";f=document.createRange();f.selectNode(this.$parent);f=f.createContextualFragment(this.TEMPLATE);
this.messages&&p.processTextNodes(f,m);this.$parent.appendChild(f);var b=this._tooltip;this.$parent.addEventListener("keydown",function(a){a.keyCode===p.KEY.ESCAPE&&b.hide()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_bindElements:function(f){for(var e=0;e<f.childNodes.length;e++){var d=f.childNodes[e];d.id&&(this["$"+d.id]=d);this._bindElements(d)}},_afterShowingFunction:function(f){return function(){f&&f.bind(this)();if(!this.customFocus){var e=
p.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/webui/dialogs/SFTPConnectionDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/popupdialog","orion/webui/dialog"],function(m,n,p,k){function f(e,d){this.messages=m;this._initialize(e);this._notify=d}function l(e){this._init(e)}localStorage.getItem("orion.sftpConnections")||localStorage.setItem("orion.sftpConnections",JSON.stringify({identifier:"name",label:m.name,items:[]}));f.prototype=new p.PopupDialog;f.prototype.TEMPLATE='\x3cdiv\x3e\x3clabel for\x3d"sftpHost"\x3e${Remote host:}\x3c/label\x3e\x3cinput id\x3d"sftpHost" /\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPort"\x3e${Port:}\x3c/label\x3e\x3cinput id\x3d"sftpPort" /\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPath"\x3e${Remote path:}\x3c/label\x3e\x3cinput id\x3d"sftpPath" /\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpUser"\x3e${User name:}\x3c/label\x3e\x3cinput id\x3d"sftpUser" /\x3e\x3c/div\x3e\x3cdiv class\x3d"layoutBlock layoutRight"\x3e\x3cbutton id\x3d"addSftpConnection" class\x3d"dropdownTrigger orionButton commandButton"\x3e${Add}\x3c/button\x3e\x3c/div\x3e';
f.prototype._bindToDom=function(e){this.$addSftpConnection.addEventListener("click",function(){this._notify({name:this.$sftpUser.value+"@"+this.$sftpHost.value+":"+this.$sftpPort.value+this.$sftpPath.value});this.hide()}.bind(this),!1)};f.prototype.constructor=f;l.prototype=new k.Dialog;l.prototype.TEMPLATE='\x3cdiv\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPath"\x3e${Location:}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cselect id\x3d"sftpConnectionList" name\x3d"sftpConnectionList"\x3e\x3c/select\x3e\x3cbutton id\x3d"newSftpConnection" style\x3d"margin-left: 16px;" class\x3d"dropdownTrigger orionButton commandButton"\x3e${New}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPassword"\x3e${Password:}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"sftpPassword" type\x3d"password" /\x3e\x3c/div\x3e\x3cp\x3e${If the same file exists in both the source and destination:}\x3c/p\x3e\x3cinput type\x3d"radio" name\x3d"overwriteOption" id\x3d"overwriteCancel" checked value\x3d"overwriteCancel" /\x3e\x3clabel for\x3d"overwriteCancel"\x3e${Cancel the transfer}\x3c/label\x3e\x3cbr /\x3e\x3cinput type\x3d"radio" name\x3d"overwriteOption" id\x3d"overwriteAll" value\x3d"overwriteAll" /\x3e\x3clabel for\x3d"overwriteAll"\x3e${Always overwrite destination}\x3c/label\x3e\x3cbr /\x3e\x3cinput type\x3d"radio" name\x3d"overwriteOption" id\x3d"overwriteOlder" value\x3d"overWriteOlder" /\x3e\x3clabel for\x3d"overwriteOlder"\x3e${Overwrite if source is newer}\x3c/label\x3e\x3c/div\x3e';
l.prototype._init=function(e){this.title="SFTP Transfer";this.messages=m;this.modal=!0;this.buttons=[{text:m["Start Transfer"],callback:this.done.bind(this)}];this.sftpConnectionStoreData=JSON.parse(localStorage.getItem("orion.sftpConnections"));this._func=e.func;this._initialize()};l.prototype._bindToDom=function(e){this.$sftpConnectionList.style.minWidth="220px";this._popupDialog=new f(this.$newSftpConnection,this.onAddConnection.bind(this));this._addChildDialog(this._popupDialog);this._populateSelect()};
l.prototype._afterHiding=function(){this._popupDialog.hide()};l.prototype.done=function(){var e=this.$sftpConnectionList.value.split("@"),d,a,h;if(2===e.length)h=e[0],a=e[1];else if(3===e.length)h=e[0]+"@"+e[1],a=e[2];else{this.hide();return}var b=a.indexOf(":");0>=b&&(d=22);var g=a.indexOf("/");0>=g||(d?e=a.substring(0,g):(e=a.substring(0,b),d=a.substring(b+1,g)),a=a.substring(g),this._func(e,d,a,h,this.$sftpPassword.value,this._computeOverwriteValue()));this.hide()};l.prototype._computeOverwriteValue=
function(){return this.$overwriteCancel.checked?"no-overwrite":this.$overwriteOlder.checked?"overwrite-older":""};l.prototype._populateSelect=function(){n.empty(this.$sftpConnectionList);for(var e=0;e<this.sftpConnectionStoreData.items.length;e++){var d=this.sftpConnectionStoreData.items[e].name,a=document.createElement("option");a.appendChild(document.createTextNode(d));a.value=d;this.$sftpConnectionList.appendChild(a)}};l.prototype.onAddConnection=function(e){for(var d=!1,a=0;a<this.sftpConnectionStoreData.items.length;a++)if(this.sftpConnectionStoreData.items[a].name===
e.name){d=!0;break}d||(this.sftpConnectionStoreData.items.unshift(e),localStorage.setItem("orion.sftpConnections",JSON.stringify(this.sftpConnectionStoreData)),this._populateSelect(),this.$sftpConnectionList.value=e.name)};l.prototype.constructor=l;return{SFTPConnectionDialog:l}});
define("orion/form",[],function(){function m(m){return encodeURIComponent(m).replace(/[!'()*]/g,escape).replace("%20","+")}return{encodeFormData:function(n){n=n||{};for(var p=Object.keys(n),k=[],f=0;f<p.length;f++){var l=p[f],e=n[l];k.push(m(l)+"\x3d"+m(e))}return k.join("\x26")},encodeSlug:function(m){return m.replace(/([^\u0020-\u007e]|%)+/g,encodeURIComponent)}}});
define("orion/fileCommands","i18n!orion/navigate/nls/messages require orion/webui/littlelib orion/i18nUtil orion/uiUtils orion/fileUtils orion/commands orion/fileDownloader orion/commandRegistry orion/extensionCommands orion/contentTypes orion/compare/compareUtils orion/Deferred orion/webui/dialogs/DirectoryPrompterDialog orion/webui/dialogs/SFTPConnectionDialog orion/EventTarget orion/form".split(" "),function(m,n,p,k,f,l,e,d,a,h,b,g,u,v,q,r,z){function t(a){var b=L;b&&"function"===typeof b.dispatchEvent&&
b.dispatchEvent(a)}function w(a){D?D.setProgressResult(a):window.console.log(a)}function A(a,b,g,d,e){var h=!0,s=!1;(b=a.makeNewItemPlaceholder(b,g,!0))?(a=b.refNode,h=!1,s=!0):a=p.node(g);a?f.getUserText({id:g+"EditBox",refNode:a,hideRefNode:h,initialText:d,onComplete:function(a){a&&e(a)},onEditDestroy:b.destroyFunction,isInitialValid:!0,insertAsChild:s}):(g=window.prompt(d))&&e(g)}function x(a){if(!a)return{};Array.isArray(a)&&(a=1===a.length?a[0]:{});return a}function C(a,b,g,d,e,h){D=g;if(d){var f;
f=l.isAtRoot(a.treeRoot.ChildrenLocation)?a.treeRoot:D.progress(b.loadWorkspace(a.treeRoot.Location),"Loading workspace");u.when(f,function(a){a=b.createProject(a.ChildrenLocation,d);h&&(a=g.showWhile(a,h));a.then(function(a){g.progress(b.read(a.ContentLocation,!0),"Reading metadata of newly created project "+d).then(function(a){e&&e(a);t({type:"create",parent:f,newValue:a})},w)},w)},w)}}var s={},y=!1,D=null,E=null,B;s.setExplorer=function(a){B=a};var L;s.getModelEventDispatcher=function(){L||(L=
new r);return L};s.uploadFile=function(a,b,g,d,e,h,f){var l=new XMLHttpRequest;h&&(h.progress&&l.upload.addEventListener("progress",h.progress,!1),h.load&&l.upload.addEventListener("load",h.load,!1),h.error&&l.upload.addEventListener("error",h.error,!1),h.abort&&l.upload.addEventListener("abort",h.abort,!1),h.loadend&&l.addEventListener("loadend",h.loadend,!1));l.open("post",e?a.ImportLocation+(0<a.ImportLocation.indexOf("?")?"\x26force\x3dtrue":"?force\x3dtrue"):a.ImportLocation,!0);l.setRequestHeader("X-Requested-With",
"XMLHttpRequest");l.setRequestHeader("Slug",z.encodeSlug(b.name));d||l.setRequestHeader("X-Xfer-Options","raw");l.setRequestHeader("Content-Type","application/octet-stream");l.onreadystatechange=function(e){if(4===l.readyState){if(400===l.status){e={};try{e=JSON.parse(l.responseText)}catch(q){}if(e.JsonData&&e.JsonData.ExistingFiles&&(g&&g.serviceRegistry?g.serviceRegistry.getService("orion.page.dialog").confirm:confirm)(e.Message+"\nWould you like to retry the import with force overwriting?")){s.uploadFile(a,
b,g,d,!0,h);return}}f||t({type:"create",parent:a,newValue:null})}}.bind(this);l.send(b);return l};s.updateNavTools=function(a,b,g,d,e,h,f){function s(a,g){(Array.isArray(e)?e:[e]).forEach(function(d){var e=p.node(d);e&&(d=b._contributionsByScopeId[d],a=a||d&&d.localSelectionService||b.getSelectionService(),d&&a&&a.getSelections(function(a){b.destroy(e);a=!a||Array.isArray(a)&&!a.length;f&&a?b.renderCommands(e.id,e,g,B,"button"):b.renderCommands(e.id,e,null,B,"button")}))})}B=g;if(d){if(g=p.node(d))b.destroy(g);
else throw Error("could not find toolbar "+d);E&&h.Location!==E&&(b.closeParameterCollector(),E=h.Location);b.renderCommands(g.id,g,h,B,"button")}e&&s(null,B?B.treeRoot:null);if(!y){y=!0;var l=a.getService("orion.page.selection");l.addEventListener("selectionChanged",function(a){s(l,B?B.treeRoot:null)})}};var H=[],G=!1;s.getCutBuffer=function(){return G?H:null};s.isEqualToOrChildOf=function(a,b){return a.Location===b.Location?!0:-1!==a.Location.indexOf(b.Location)?a.parent===b.parent?!1:!0:!1};s.createFileCommands=
function(h,y,r){function E(a){a=l.makeRelative(a);a=a.split("#");a=a[a.length-1];var b=a.indexOf("/?");0<b&&(a=a.substring(0,b+1));return a}function z(a){if(!B||!B.isCommandsVisible())return!1;a=x(a);return a.Location&&l.isAtRoot(a.Location)}function n(a,b,g){a=Array.isArray(a)?a:[a];b=function(a){Array.isArray(a)||(a=[a]);var b=[],d=[],e=this;a.forEach(function(h){b.push((g?r.copyFile:r.moveFile).apply(r,[h.Location,e.path,h.Name]).then(function(b){d.push({oldValue:h,newValue:b,parent:e.item});K({type:g?
"copy":"move",oldValue:h,newValue:b,parent:e.item,count:a.length})},w))});u.all(b).then(function(){K({type:g?"copyMultiple":"moveMultiple",items:d})})};for(var d=[],e=0;e<a.length;e++)a[e].parent&&a[e].parent.Location&&(a[e].parent.stripped=a[e].parent.stripped||E(a[e].parent.Location),-1===d.indexOf(a[e].parent.stripped)&&d.push(a[e].parent.stripped)),a[e].Directory&&!g&&(a[e].stripped=a[e].stripped||E(a[e].Location),d.push(a[e].stripped));a=[];for(var f=[],s=B.treeRoot.Children||(B.treeRoot.Workspace?
B.treeRoot.Workspace.Children:{}),e=0;e<s.length;e++){var l=s[e];l.stripped=l.stripped||(l.Directory?E(l.Location):null);l.stripped&&-1===d.indexOf(l.stripped)&&f.push(l)}f.sort(function(a,b){return a.stripped<b.stripped?-1:a.stripped>b.stripped?1:0});for(e=0;e<f.length;e++){for(var d=f[e],s=d.Name,l=d.stripped.split("/").length+1,q=0;q<l-2;q++)s="  "+s;a.push({name:s,path:d.stripped,item:d,callback:b})}0<f.length&&a.push({});a.push({name:m["Choose folder..."],callback:function(a){(new v.DirectoryPrompterDialog({title:m["Choose a Folder"],
serviceRegistry:h,fileClient:r,func:function(b){if(b&&b.Location){Array.isArray(a)||(a=[a]);var d=[],e=[];a.forEach(function(h){var f=b.Location,s=h.Name||null,l=g?r.copyFile:r.moveFile,q=k.formatMessage(g?m["Copying ${0}"]:m["Moving ${0}"],h.Location);g&&(h.parent&&h.parent.Location===f)&&((s=window.prompt(k.formatMessage(m["Enter a new name for '${0}'"],h.Name),k.formatMessage(m["Copy of ${0}"],h.Name)))||(f=null));f&&(f=l.apply(r,[h.Location,b.Location,s]),d.push(D.showWhile(f,q).then(function(d){e.push({oldValue:h,
newValue:d,parent:b});K({type:g?"copy":"move",oldValue:h,newValue:d,parent:b,count:a.length})},w)))});u.all(d).then(function(){K({type:g?"copyMultiple":"moveMultiple",items:e})})}}})).show()}});return a}function L(a){return a.parent?{item:a,parent:a.parent}:a.Parents&&a.Parents[0]?{item:a,parent:a.Parents[0]}:r.loadWorkspace(r.fileServiceRootURL(a.Location)).then(function(b){return u.when(b.Children||r.fetchChildren(b)).then(function(g){b.Children=g;g=b.Children.some(function(b){return b.Location===
a.Location?(a=b,!0):!1});return{item:a,parent:g?b:null}})})}function S(a){var b;Array.isArray(a)||(a=[a]);a.some(function(a){a=a.Directory?a:a.parent;if(b){if(b.Location!==a.Location)return b=null,!0}else b=a;return!1});return b&&l.isAtRoot(b.Location)?null:b}function U(a){return!B||!B.isCommandsVisible()?!1:S(a)}function X(a,b){var g=a.Location;u.when(L(a),function(d){a=d.item;var e=d.parent;e&&e.Projects&&e.Projects.some(function(b){return b.Id===a.Id?(g=b.Location,!0):!1});d=r.moveFile(g,e.Location||
e.WorkspaceLocation,b);D.showWhile(d,k.formatMessage(m["Renaming ${0}"],g)).then(function(b){a.parent||(a.parent=e);K({type:"move",oldValue:a,newValue:b,parent:e})},w)})}function V(a,b,g){var d=function(a){var g=0,d=b;for(a=a.filter(function(a){return 0===a.Name.indexOf(b)}).map(function(a){return a.Name});-1!==a.indexOf(d);)g++,d=b.concat(" (").concat(g).concat(")");return d};a.children?(a=d(a.children),g(a)):D.progress(r.fetchChildren(a.ChildrenLocation),m["Fetching children of "]+a.Name).then(function(a){a=
d(a);g(a)},w)}function W(a,b,g){var d=function(a){if(a){var d=r[g?"createFolder":"createFile"](b.Location,a);D.showWhile(d,k.formatMessage(m["Creating ${0}"],a)).then(function(a){K({type:"create",parent:b,newValue:a})},w)}};V(b,a,function(a){A(B,b,B.getRow(b),a,function(a){d(a)})})}D=h.getService("orion.page.progress");var K=t.bind(null),J=function(a){if(!B||!B.isCommandsVisible())return!1;var b=Array.isArray(a)?a:[a];if(0===b.length)return!1;for(var g=0;g<b.length;g++)if(a=b[g],!a.Location||a.Projects)return!1;
return!0},F=new e.Command({name:m.Rename,tooltip:m["Rename the selected files or folders"],imageClass:"core-sprite-rename",id:"eclipse.renameResource",visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:Array.isArray(a)?1===a.length&&a[0].Name:a.Location&&!a.Projects},parameters:new a.ParametersDescription(null,{},function(b){b=Array.isArray(b.items)?b.items:[b.items];var g=B.treeRoot;return b.some(function(a){return a===g})?[new a.CommandParameter("name","text",m["Name:"],g.Name)]:null}),
callback:function(a){var b=x(a.items),g;if(a.parameters.hasParameters()&&null!==(g=a.parameters.valueFor("name")))X(b,g);else a:{g=B.getNameNode(b);if(!g){if(!a)break a;g=a.domParent||a.domNode}a=g.id+"EditBox";p.node(a)||f.getUserText({id:a,refNode:g,hideRefNode:!0,initialText:b.Name,onComplete:X.bind(null,b),selectTo:b.Directory?"":"."})}}});y.addCommand(F);var P=new b.ContentTypeRegistry(h),F=new e.Command({name:m["Compare with each other"],tooltip:m["Compare the selected 2 files with each other"],
id:"eclipse.compareWithEachOther",visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;if(Array.isArray(a))if(2===a.length&&!a[0].Directory&&!a[1].Directory){var b=P.getFilenameContentType(a[0].Name);a=P.getFilenameContentType(a[1].Name);if(b&&("text/plain"===b["extends"]||"text/plain"===b.id)&&a&&("text/plain"===a["extends"]||"text/plain"===a.id))return!0}else if(2===a.length&&a[0].Directory&&a[1].Directory)return!0;return!1},hrefCallback:function(a){return a.items[0].Directory&&a.items[1].Directory?
g.generateCompareTreeHref(a.items[0].Location,{compareTo:a.items[1].Location,readonly:!0}):g.generateCompareHref(a.items[0].Location,{compareTo:a.items[1].Location,readonly:!1,readonlyRight:!1})}});y.addCommand(F);F=new e.Command({name:m["Compare with..."],tooltip:m["Compare the selected folder with a specified folder"],id:"eclipse.compareWith",visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:Array.isArray(a)&&1===a.length&&a[0].Directory?!0:!1},callback:function(a){(new v.DirectoryPrompterDialog({title:m["Choose a Folder"],
serviceRegistry:h,fileClient:r,func:function(b){b&&b.Location&&(b=g.generateCompareTreeHref(a.items[0].Location,{compareTo:b.Location,readonly:!0}),window.open(b))}})).show()}});y.addCommand(F);F=new e.Command({name:m.Download,tooltip:m.Download_tooltips,id:"eclipse.downloadSingleFile",visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:Array.isArray(a)&&1===a.length&&!a[0].Directory?!0:!1},callback:function(a){var b=h.getService("orion.page.message"),b=new d.FileDownloader(r,b,D);a=Array.isArray(a.items)?
a.items:[a.items];var g=P.getFilenameContentType(a[0].Name);b.downloadFromLocation(a[0],g)}});y.addCommand(F);F=new e.Command({name:m.Delete,imageClass:"core-sprite-delete",id:"eclipse.deleteFile",visibleWhen:J,callback:function(a){var b=Array.isArray(a.items)?a.items:[a.items];a=1===b.length?k.formatMessage(m["Are you sure you want to delete '${0}'?"],b[0].Name):k.formatMessage(m["Are you sure you want to delete these ${0} items?"],b.length);h.getService("orion.page.dialog").confirm(a,function(a){if(a){var g=
[];a=b.map(function(a){var d=a.Location;return u.when(L(a),function(e){a=e.item;var h=e.parent;h&&h.Projects&&(d=null,h.Projects.some(function(b){return b.Id===a.Id?(d=b.Location,!0):!1}));"ProjectRoot"===a.type&&h.ProjectLocation&&(d=h.ProjectLocation);if(!d)return(new u).resolve();e=r.deleteFile(d);return D.showWhile(e,k.formatMessage(m["Deleting ${0}"],d)).then(function(){g.push({oldValue:a,newValue:null,parent:h});H=H.filter(function(b){return!s.isEqualToOrChildOf(b,a)});K({type:"delete",oldValue:a,
newValue:null,parent:h,count:b.length})},w)})});u.all(a).then(function(){K({type:"deleteMultiple",items:g})},w)}})}});y.addCommand(F);F=new e.Command({name:m["Export as zip"],tooltip:m["Create a zip file of the folder contents and download it"],imageClass:"core-sprite-exportzip",id:"eclipse.downloadFile",visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=x(a);return a.ExportLocation&&a.Directory},hrefCallback:function(a){return x(a.items).ExportLocation}});y.addCommand(F);var ea=function(a,
b){var g=S(a);if(!g||!g.Location)g=B.treeRoot,g.Project&&(g=g.children[0]);return g},F=new e.Command({name:m["New File"],tooltip:m["Create a new file"],imageClass:"core-sprite-new_file",id:"eclipse.newFile",callback:function(a){a=ea(a.items);W(m["New File"],a,!1)},visibleWhen:U});y.addCommand(F);var ba=new e.Command({name:m["New Folder"],tooltip:m["Create a new folder"],imageClass:"core-sprite-new_folder",id:"eclipse.newFolder",callback:function(a){a=ea(a.items);W(m["New Folder"],a,!0)},visibleWhen:function(a){return U(a)&&
!l.isAtRoot(a.Location)}});y.addCommand(ba);F=new a.ParametersDescription([new a.CommandParameter("url","url",m["File URL:"],"URL"),new a.CommandParameter("unzip","boolean",m["Unzip *.zip files:"],!0)]);F=new e.Command({name:m["Import from HTTP..."],tooltip:m["Import a file from a URL and optionally unzip it"],id:"orion.importZipURL",parameters:F,callback:function(a){var b=S(a.items),g=a.parameters&&a.parameters.valueFor("url");if(b&&g){var d=b.ImportLocation+(-1===b.ImportLocation.indexOf("?")?"?":
"\x26")+"source\x3d"+g;a=a.parameters&&a.parameters.valueFor("unzip")&&g.indexOf(".zip")===g.length-4?"":"raw";d=r.remoteImport(d,{OptionHeader:a});D.showWhile(d,k.formatMessage(m["Importing from ${0}"],g)).then(function(){K({type:"import",target:b})})}},visibleWhen:U});y.addCommand(F);F=new e.Command({name:m["New Folder"],imageClass:"core-sprite-new_folder",tooltip:m["Create an empty folder"],description:m["Create an empty folder on the Orion server.  You can import, upload, or create content in the editor."],
id:"orion.new.project",callback:function(a){var b;S(a.items)?ba.callback(a):(b=x(a.items),V(b,m["New Folder"],function(a){A(B,b,B.getRow(b),a,function(a){C(B,r,D,a)})}))},visibleWhen:z});y.addCommand(F);F=new e.Command({name:m["Link to Server"],tooltip:m["Link to existing content on the server"],description:m["Create a folder that links to an existing folder on the server."],imageClass:"core-sprite-link",id:"orion.new.linkProject",parameters:new a.ParametersDescription([new a.CommandParameter("name",
"text",m["Name:"],m["New Folder"]),new a.CommandParameter("url","url",m["Server path:"],"")]),callback:function(a){var b=function(a,b){if(a&&b){var g=r.createProject(B.treeRoot.ChildrenLocation,a,b,!0);D.showWhile(g,k.formatMessage(m["Linking to ${0}"],b)).then(function(a){t({type:"create",parent:B.treeRoot,newValue:a})},w)}};a.parameters&&a.parameters.valueFor("name")&&a.parameters.valueFor("url")?b(a.parameters.valueFor("name"),a.parameters.valueFor("url")):w(m["The name and server location were not specified."])},
visibleWhen:z});y.addCommand(F);F=new e.Command({name:m["Go Up"],tooltip:m["Move up to the parent folder"],imageClass:"core-sprite-go-up",id:"eclipse.upFolder",callback:function(a){"function"===typeof B.scopeUp&&B.scopeUp()},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=B.treeRoot;return a.Parents||"Project"===a.type}});y.addCommand(F);F=new e.Command({name:m["Go Into"],tooltip:m["Move into the selected folder"],imageClass:"core-sprite-go-down",id:"eclipse.downFolder",callback:function(a){"function"===
typeof B.scopeDown&&B.scopeDown(a.items[0])},visibleWhen:function(a){if(!B||!B.isCommandsVisible()||"function"!==typeof B.scopeDown)return!1;a=x(a);return a.Directory&&a.Location!==B.treeRoot.Location}});y.addCommand(F);F=new e.Command({name:m["File or zip archive"],tooltip:m["Import a file or zip archive from your local file system"],imageClass:"core-sprite-importzip",id:"orion.import",callback:function(a){var b=S(a.items),g=p.node("fileSelectorInput");a=g.cloneNode();var d=function(){if(g.files&&
0<g.files.length)for(var a=0;a<g.files.length;a++)B._uploadFile(b,g.files.item(a),!0);g.removeEventListener("change",d)};g.addEventListener("change",d);g.click();g.parentNode.replaceChild(a,g)},visibleWhen:U});y.addCommand(F);F=new e.Command({name:m["SFTP from..."],tooltip:m["Copy files and folders from a specified SFTP connection"],imageClass:"core-sprite-transferin",id:"orion.importSFTP",callback:function(a){var b=S(a.items);(new q.SFTPConnectionDialog({func:function(a,g,d,e,h,f){g=r.remoteImport(b.ImportLocation,
{OptionHeader:f?"sftp,"+f:"sftp",Host:a,Port:g,Path:d,UserName:e,Passphrase:h});D.showWhile(g,k.formatMessage(m["Importing from ${0}"],a)).then(function(a){K({type:"import",target:b});w(a)},w)}})).show()},visibleWhen:U});y.addCommand(F);F=new e.Command({name:m["SFTP to..."],tooltip:m["Copy files and folders to a specified SFTP location"],imageClass:"core-sprite-transferout",id:"eclipse.exportSFTPCommand",callback:function(a){var b=x(a.items);(new q.SFTPConnectionDialog({func:function(a,g,d,e,h,f){g=
r.remoteExport(b.ExportLocation,{OptionHeader:f?"sftp,"+f:"sftp",Host:a,Port:g,Path:d,UserName:e,Passphrase:h});D.showWhile(g,k.formatMessage(m.Exporting,a)).then(w,w)}})).show()},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=x(a);return a.ExportLocation&&a.Directory}});y.addCommand(F);F=new e.Command({name:m["Copy to"],tooltip:"Copy files and folders to a specified location",id:"eclipse.copyFile",choiceCallback:function(a,b){return n(a,b,!0)},visibleWhen:J});y.addCommand(F);F=
new e.Command({name:m["Move to"],tooltip:m["Move files and folders to a new location"],id:"eclipse.moveFile",choiceCallback:function(a,b){return n(a,b,!1)},visibleWhen:J});y.addCommand(F);var Z=function(a){var b=B.getNavHandler();G&&H.forEach(function(a){b.enableItem(a)});G=!1;H=a.items},F=new e.Command({name:m.Cut,id:"eclipse.cut",callback:function(a){var b=B.getNavHandler();Z(a);H.length&&(G=!0,H.forEach(function(a){b.disableItem(a)}))},visibleWhen:J});y.addCommand(F);J=new e.Command({name:m.Copy,
id:"eclipse.copySelections",callback:Z,visibleWhen:J});y.addCommand(J);J=new e.Command({name:m.Paste,id:"eclipse.pasteSelections",visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:U(a)},callback:function(a){var b=S(a.items);if(0<H.length&&b)if(l.isAtRoot(b.Location))w(m["Cannot paste into the root"]);else{var g=G?r.moveFile:r.copyFile,d=[],e=[];H.forEach(function(a){var h=a.Location,f=a.Name||null;if(h){var s=b.Location||b.ContentLocation,l=!1;if(a.parent&&a.parent.Location===s)l=!0;else{var q=
b.Children||b.children;q&&(l=q.some(function(b){return b.Name===a.Name}))}l&&((f=window.prompt(k.formatMessage(m["Enter a new name for '${0}'"],a.Name),k.formatMessage(m["Copy of ${0}"],a.Name)))||(h=null));if(h){var f=g.apply(r,[h,s,f]),y=G?"move":"copy";e.push(D.showWhile(f,k.formatMessage(m[G?"Moving ${0}":"Pasting ${0}"],h)).then(function(g){d.push({oldValue:a,newValue:g,parent:b});K({type:y,oldValue:a,newValue:g,parent:b,count:H.length})},w))}}});u.all(e).then(function(){K({type:G?"moveMultiple":
"copyMultiple",items:d});if(G){var a=B.getNavHandler();H.forEach(function(b){a.enableItem(b)});H=[];G=!1}})}}});y.addCommand(J);return(new u).resolve()};s.createNewContentCommand=function(b,g,d,h,f,s,q,y){h=d?[]:[new a.CommandParameter("folderName","text",m["Folder name:"],g),new a.CommandParameter("url","url",m["Extracted from:"],h),new a.CommandParameter("unzip","boolean",m["Unzip *.zip files:"],!0)];y=null;0<h.length&&(y=new a.ParametersDescription(h));return new e.Command({name:g,parameters:y,
id:b,callback:function(a){if(d)window.open(d);else if(a.parameters&&a.parameters.valueFor("folderName")){var b=a.parameters.valueFor("folderName");C(f,s,q,b,function(b){a.parameters.clientCollect=!0;a.commandRegistry.runCommand("orion.importZipURL",b,f,a.parameters)})}else A(f,a.items,a.domNode.id,g,function(b){C(f,s,q,b,function(b){a.commandRegistry.runCommand("orion.importZipURL",b,f,a.parameters)})})},visibleWhen:function(a){if(!f||!f.isCommandsVisible())return!1;a=x(a);return a.Location&&l.isAtRoot(a.Location)}})};
return s});define("text!orion/webui/dialogs/promptdialog.html",[],function(){return'\x3cdiv\x3e\n\t\x3cdiv class\x3d"promptDialogMessage" id\x3d"promptDialogMessage"\x3e${PromptMessage}\x3c/div\x3e\n\t\x3cinput type\x3d"text" id\x3d"promptDialogInput" class\x3d"promptDialogInput" /\x3e\n\x3c/div\x3e'});
define("orion/webui/dialogs/PromptDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/dialog","text!orion/webui/dialogs/promptdialog.html","orion/EventTarget"],function(m,n,p,k,f){function l(e){f.attach(this);this._init(e)}l.prototype=Object.create(p.Dialog.prototype);l.prototype.constructor=l;l.prototype.TEMPLATE=k;l.prototype._init=function(e){this.title=e.title;e.promptMessage&&(this.messages={PromptMessage:e.promptMessage});this.modal=!0;this._boundOkPressed=this._okPressed.bind(this);
this.buttons=[{id:"okButton",text:m.OK,callback:this._boundOkPressed},{id:"cancelButton",text:m.Cancel,callback:this._cancelPressed.bind(this)}];this._initialize();e.promptMessage||(this.$promptDialogMessage.style.display="none")};l.prototype._bindToDom=function(e){this.$promptDialogInput.addEventListener("keydown",function(d){d.keyCode===n.KEY.ENTER?(this._boundOkPressed(),n.stop(d)):d.keyCode===n.KEY.ESCAPE&&(this.$cancelButton.focus(),n.stop(d))}.bind(this),!1)};l.prototype._okPressed=function(){this.dispatchEvent({type:"ok",
value:this.$promptDialogInput.value});this.hide()};l.prototype._cancelPressed=function(){this.dispatchEvent({type:"cancel"});this.hide()};return{PromptDialog:l}});
define("orion/widgets/projects/ProjectOptionalParametersDialog",["orion/webui/littlelib","orion/webui/dialog"],function(m,n){function p(k){this._init(k)}p.prototype=new n.Dialog;p.prototype.TEMPLATE='\x3cdiv id\x3d"message" style\x3d"width: 25em; padding-bottom: 5px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"paramsArea"\x3e\x3ctable id\x3d"paramsTable"\x3e\x3c/table\x3e\x3c/div\x3e';p.prototype._init=function(k){this.title=k.title;this._data=k.data;this._idPrefix="ParamInput_";this.modal=!0;this.buttons=[{text:"OK",
isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._func=k.func;this._initialize()};p.prototype._bindToDom=function(k){this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";var f=!0;if(this._data.parameters)for(var l in this._data.parameters.parameterTable){k=this._data.parameters.parameterNamed(l);var e=document.createElement("tr"),d=document.createElement("td"),a=document.createElement("label");a["for"]=l;a.appendChild(document.createTextNode(k.label));
d.appendChild(a);e.appendChild(d);d=document.createElement("td");"textarea"===k.type?a=document.createElement("textarea"):(a=document.createElement("input"),a.type=k.type);a.value=this._data.parameters.valueFor(l);a.id=this._idPrefix+l;d.appendChild(a);e.appendChild(d);this.$paramsTable.appendChild(e);f&&(a.focus(),f=!1)}if(this._data.parameters._options.optionalParams)for(l=0;l<this._data.parameters._options.optionalParams.length;l++)k=this._data.parameters._options.optionalParams[l],e=document.createElement("tr"),
d=document.createElement("td"),a=document.createElement("label"),a["for"]=this._idPrefix+k.id,a.appendChild(document.createTextNode(k.name)),d.appendChild(a),e.appendChild(d),d=document.createElement("td"),"textarea"===k.type?a=document.createElement("textarea"):(a=document.createElement("input"),a.type=k.type),k.value&&(a.value=k.value),a.id=this._idPrefix+k.id,d.appendChild(a),e.appendChild(d),this.$paramsTable.appendChild(e)};p.prototype.done=function(){if(this._data.parameters)for(var k in this._data.parameters.parameterTable)this._data.parameters.setValue(k,
m.node(this._idPrefix+k).value);if(this._data.parameters._options.optionalParams)for(k=0;k<this._data.parameters._options.optionalParams.length;k++){var f=this._data.parameters._options.optionalParams[k];f.value=m.node(this._idPrefix+f.id).value}this.hide();m.empty(this.$paramsTable);this._func()};p.prototype.constructor=p;return{ProjectOptionalParametersDialog:p}});
define("orion/editor/i18n",{load:function(m,n,p,k){n.specified&&n.specified("orion/bootstrap")?n(["orion/i18n!"+m],function(f){p(f)}):n(["orion/editor/config"],function(f){p(f&&f.languages||{})})}});
define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",matchingSearch:"Matching Search",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up",
pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down",
selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word",
deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point",
setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",
findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All",
collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode entered",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",lineColumn:"Line ${0} : Col ${1}",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right",
viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward",
vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character",
viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",next:"Next",previous:"Previous",replace:"Replace",replaceAll:"Replace All",findWith:"Find With",replaceWith:"Replace With",caseInsensitive:"Aa",regex:"/.*/",wholeWord:"\\b",caseInsensitiveTooltip:"Toggle Case Insensitive",regexTooltip:"Toogle Regex",wholeWordTooltip:"Toggle Whole Word",closeTooltip:"Close",replacingAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",
nothingReplaced:"Nothing replaced",notFound:"Not found"});define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(m,n){var p={root:n},k;for(k in m)m.hasOwnProperty(k)&&"undefined"===typeof p[k]&&(p[k]=m[k]);return p});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(m,n){function p(){}function k(a,g,d){this.start=a;this.end=g;this._projectionModel=d;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function f(a,g){var d=a.lastIndexOf("."),d=a.substring(d+1),e={title:m[d],style:{styleClass:"annotation "+d},html:"\x3cdiv class\x3d'annotationHTML "+d+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+d}};g?e.lineStyle=
{styleClass:"annotationLine "+d}:e.rangeStyle={styleClass:"annotationRange "+d};p.registerType(a,e)}function l(){}function e(a,g,d,e,h){var f;void 0===e&&(e=-1);void 0===h&&(h=a.length);for(;1<h-e;)if(f=Math.floor((h+e)/2),g<=a[f].start)h=f;else if(d&&g<a[f].end){h=f;break}else e=f;return h}function d(a){this._annotations=[];var g=this;this._listener={onChanged:function(a){g._onChanged(a)}};this.setTextModel(a)}function a(a,g){this._view=a;this._annotationModel=g;var d=this;this._listener={onDestroy:function(a){d._onDestroy(a)},
onLineStyle:function(a){d._onLineStyle(a)},onChanged:function(a){d._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",this._listener.onLineStyle);g.addEventListener("Changed",this._listener.onChanged)}k.prototype={_expandedHTML:"\x3cdiv class\x3d'annotationHTML expanded'\x3e\x3c/div\x3e",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"\x3cdiv class\x3d'annotationHTML collapsed'\x3e\x3c/div\x3e",_collapsedStyle:{styleClass:"annotation collapsed"},
_collapse:function(){if(!this.expanded)return!1;this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_collapseImpl:function(a){if(this._collapse()){a&&this._forEachOverlaping(function(a){a.expanded||
(a._expandImpl(!1),a._recollapse=!0)});a=this._projectionModel;var g=a.getBaseModel();this._projection={annotation:this,start:g.getLineStart(g.getLineAtOffset(this.start)+1),end:g.getLineEnd(g.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},_expandImpl:function(a){this._expand()&&(this._projectionModel._removeProjection(this._projection,!this._annotationModel),a&&this._forEachOverlaping(function(a){a._recollapse&&(a._collapseImpl(!1),a._recollapse=!1)}))},_forEachOverlaping:function(a){if(this._annotationModel)for(var g=
this._annotationModel.getAnnotations(this.start,this.end);g.hasNext();){var d=g.next();d!==this&&d.type===p.ANNOTATION_FOLDING&&a.call(this,d)}},collapse:function(){this._recollapse=!1;this._collapseImpl(!0)},expand:function(){this._recollapse=!1;this._expandImpl(!0)}};p.ANNOTATION_ERROR="orion.annotation.error";p.ANNOTATION_WARNING="orion.annotation.warning";p.ANNOTATION_TASK="orion.annotation.task";p.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";p.ANNOTATION_BOOKMARK="orion.annotation.bookmark";
p.ANNOTATION_FOLDING="orion.annotation.folding";p.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";p.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";p.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";p.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";p.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";p.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";p.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";p.ANNOTATION_SELECTED_LINKED_GROUP=
"orion.annotation.selectedLinkedGroup";p.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";p.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";p.ANNOTATION_BLAME="orion.annotation.blame";p.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame";var h={};p.registerType=function(a,g){var d=g;"function"!==typeof d&&(d=function(a,b,g){this.start=a;this.end=b;void 0!==g&&(this.title=g)},d.prototype=g);d.prototype.type=a;h[a]=d;return a};p.createAnnotation=function(a,g,d,e){return new (this.getType(a))(g,
d,e)};p.getType=function(a){return h[a]};f(p.ANNOTATION_ERROR);f(p.ANNOTATION_WARNING);f(p.ANNOTATION_TASK);f(p.ANNOTATION_BREAKPOINT);f(p.ANNOTATION_BOOKMARK);f(p.ANNOTATION_CURRENT_BRACKET);f(p.ANNOTATION_MATCHING_BRACKET);f(p.ANNOTATION_CURRENT_SEARCH);f(p.ANNOTATION_MATCHING_SEARCH);f(p.ANNOTATION_READ_OCCURRENCE);f(p.ANNOTATION_WRITE_OCCURRENCE);f(p.ANNOTATION_SELECTED_LINKED_GROUP);f(p.ANNOTATION_CURRENT_LINKED_GROUP);f(p.ANNOTATION_LINKED_GROUP);f(p.ANNOTATION_CURRENT_LINE,!0);f(p.ANNOTATION_BLAME,
!0);f(p.ANNOTATION_CURRENT_BLAME,!0);p.registerType(p.ANNOTATION_FOLDING,k);l.addMixin=function(a){var g=l.prototype,d;for(d in g)g.hasOwnProperty(d)&&(a[d]=g[d])};l.prototype={addAnnotationType:function(a,g){this._annotationTypes||(this._annotationTypes=[]);var d=g-1;void 0==g||!(0<=d&&d<this._annotationTypes.length)?this._annotationTypes.push(a):this._annotationTypes.splice(d,0,a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var g=0;g<this._annotationTypes.length;g++)if(this._annotationTypes[g]===
a)return g+1;return 0},getAnnotationsByType:function(a,g,d){a=a.getAnnotations(g,d);for(d=[];a.hasNext();)g=a.next(),0!==this.getAnnotationTypePriority(g.type)&&d.push(g);var e=this;d.sort(function(a,b){return e.getAnnotationTypePriority(a.type)-e.getAnnotationTypePriority(b.type)});return d},isAnnotationTypeVisible:function(a){return 0!==this.getAnnotationTypePriority(a)},removeAnnotationType:function(a){if(this._annotationTypes)for(var g=0;g<this._annotationTypes.length;g++)if(this._annotationTypes[g]===
a){this._annotationTypes.splice(g,1);break}}};d.prototype={addAnnotation:function(a){if(a){var g=this._annotations,d=e(g,a.start);g.splice(d,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,g){var d=this._annotations,e,h=0,f;f=void 0===a&&void 0===g?function(){return h<d.length?d[h++]:null}:function(){for(;h<d.length;){var e=d[h++];if(a===e.start||(a>e.start?a<e.end:e.start<g))return e;
if(e.start>=g)break}return null};e=f();return{next:function(){var a=e;a&&(e=f());return a},hasNext:function(){return null!==e}}},modifyAnnotation:function(a){if(a&&!(0>this._getAnnotationIndex(a)))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var g=this._annotations,d,e;if(a){d=[];for(e=g.length-1;0<=e;e--){var h=g[e];h.type===a&&(g.splice(e,1),d.splice(0,0,h),h._annotationModel=null)}}else d=g;this.onChanged({type:"Changed",
removed:d,added:[],changed:[]})},removeAnnotation:function(a){if(a){var g=this._getAnnotationIndex(a);0>g||(a._annotationModel=null,a={type:"Changed",removed:this._annotations.splice(g,1),added:[],changed:[]},this.onChanged(a))}},replaceAnnotations:function(a,g){var d=this._annotations,h,f,l,k=[];if(a)for(h=a.length-1;0<=h;h--)l=a[h],f=this._getAnnotationIndex(l),0>f||(l._annotationModel=null,d.splice(f,1),k.splice(0,0,l));g||(g=[]);for(h=0;h<g.length;h++)l=g[h],f=e(d,l.start),l._annotationModel=
this,d.splice(f,0,l);this.onChanged({type:"Changed",removed:k,added:g,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_getAnnotationIndex:function(a){for(var g=this._annotations,d=e(g,a.start);d<g.length&&g[d].start===a.start;){if(g[d]===a)return d;d++}return-1},_onChanged:function(a){var g=a.start,d=a.addedCharCount,e=a.removedCharCount,h=this._annotations,
f=g+e;if(0<h.length){a={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a};d-=e;for(e=0;e<h.length;e++){var l=h[e];l.start>=f?(l._oldStart=l.start,l._oldEnd=l.end,l.start+=d,l.end+=d,a.changed.push(l)):l.end<=g||(l.start<g&&f<l.end?(l._oldStart=l.start,l._oldEnd=l.end,l.end+=d,a.changed.push(l)):(h.splice(e,1),a.removed.push(l),l._annotationModel=null,l.expand&&l.expand(),e--))}if(0<a.added.length||0<a.removed.length||0<a.changed.length)this.onChanged(a)}}};n.EventTarget.addMixin(d.prototype);
a.prototype={destroy:function(){var a=this._view;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,d){if(d){a||(a={});a.styleClass=a.styleClass&&d.styleClass&&a.styleClass!==d.styleClass?a.styleClass+(" "+d.styleClass):d.styleClass;var e;d.tagName&&!a.tagName&&(a.tagName=d.tagName);if(d.style)for(e in a.style||
(a.style={}),d.style)a.style[e]||(a.style[e]=d.style[e]);if(d.attributes)for(e in a.attributes||(a.attributes={}),d.attributes)a.attributes[e]||(a.attributes[e]=d.attributes[e])}return a},_mergeStyleRanges:function(a,d){a||(a=[]);for(var h,f=e(a,d.start,!0);f<a.length&&d;f++){var l=a[f];if(d.end<=l.start)break;if(!(d.start>=l.end)){h=this._mergeStyle({},l.style);h=this._mergeStyle(h,d.style);var k=[];k.push(f,1);d.start<l.start&&k.push({start:d.start,end:l.start,style:d.style});d.start>l.start&&k.push({start:l.start,
end:d.start,style:l.style});k.push({start:Math.max(l.start,d.start),end:Math.min(l.end,d.end),style:h});d.end<l.end&&k.push({start:d.end,end:l.end,style:l.style});d=d.end>l.end?{start:l.end,end:d.end,style:d.style}:null;Array.prototype.splice.apply(a,k)}}d&&(h=this._mergeStyle({},d.style),a.splice(f,0,{start:d.start,end:d.end,style:h}));return a},_onAnnotationModelChanged:function(a){function d(a,b){l.getBaseModel&&(a=l.mapOffset(a,!0),b=l.mapOffset(b,!0));-1!==a&&-1!==b&&h.redrawRange(a,b)}function e(a,
b){for(var h=0;h<a.length;h++)if(f.isAnnotationTypeVisible(a[h].type)){var l=a[h];d(l.start,l.end);b&&(void 0!==l._oldStart&&l._oldEnd)&&d(l._oldStart,l._oldEnd)}}var h=this._view;if(h){var f=this,l=h.getModel();e(a.added);e(a.removed);e(a.changed,!0)}},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){var d=this._annotationModel,e=a.textView.getModel(),h=d.getTextModel(),f=a.lineStart,l=a.lineStart+a.lineText.length;h!==e&&(f=e.mapOffset(f),l=e.mapOffset(l));for(d=d.getAnnotations(f,
l);d.hasNext();)if(f=d.next(),this.isAnnotationTypeVisible(f.type)){if(f.rangeStyle){var l=f.start,k=f.end;h!==e&&(l=e.mapOffset(l,!0),k=e.mapOffset(k,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:l,end:k,style:f.rangeStyle})}f.lineStyle&&(a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,f.lineStyle))}}};l.addMixin(a.prototype);return{FoldingAnnotation:k,AnnotationType:p,AnnotationTypeList:l,AnnotationModel:d,AnnotationStyler:a}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate","orion/edit/editorContext"],function(m,n,p,k){function f(f,e){for(var d=e.getFileMetadata(),a=f.getServiceReferences("orion.edit.blamer"),h=0;h<a.length;h++){var b=a[h],g={};g.validationProperties=b.getProperty("validationProperties");g.forceSingleItem=!0;g=m._makeValidator(g,f);if(g.validationFunction.bind(g)(d))return f.getService(b)}return null}return{isVisible:function(l,e){return!!f(l,e)&&!!l.getService("orion.core.blame")},
getBlame:function(l,e){var d=f(l,e);if(d){var a=function(a){for(var d=n.getOrionHome(),e=0;e<a.length;e++){var h=a[e],f=new p(h.CommitLink),k={};k.OrionHome=d;h.CommitLink=f.expand(k)}l.getService("orion.core.blame")._setAnnotations(a)};if(d.computeBlame){var h={metadata:e.getFileMetadata()};d.computeBlame(k.getEditorContext(l),h).then(a)}else d.doBlame(e.getInput()).then(a)}}}});
define("orion/editorCommands","i18n!orion/edit/nls/messages orion/i18nUtil orion/webui/littlelib orion/webui/dialogs/OpenResourceDialog orion/widgets/input/DropDownMenu orion/Deferred orion/URITemplate orion/commands orion/keyBinding orion/commandRegistry orion/extensionCommands orion/contentTypes orion/searchUtils orion/PageUtil orion/PageLinks orion/editor/annotations orion/blamer orion/regex orion/util orion/edit/editorContext".split(" "),function(m,n,p,k,f,l,e,d,a,h,b,g,u,v,q,r,z,t,w,A){function x(a){var b=
new e(a.uriTemplate),d=a.params||{};d.OrionHome=d.OrionHome||q.getOrionHome();var b=b.expand(d),g=document.createElement("div"),h=document.createElement("iframe");h.id=a.id;h.name=a.id;h.type="text/html";h.sandbox="allow-scripts allow-same-origin";h.frameborder=void 0!==a.border?a.border:1;h.src=b;h.className="delegatedUI";a.width&&(g.style.width=a.width,h.style.width=a.width);a.height&&(g.style.height=a.height,h.style.height=a.height);h.style.visibility="hidden";null!==a.parent&&(a.parent||window.document.body).appendChild(g);
g.appendChild(h);h.style.left=a.left||(window.innerWidth-parseInt(h.clientWidth,10))/2+"px";h.style.top=a.top||(window.innerHeight-parseInt(h.clientHeight,10))/2+"px";h.style.visibility="";window.addEventListener("message",function I(b){if(b.source===h.contentWindow&&"string"===typeof b.data&&(b=JSON.parse(b.data),"orion.page.delegatedUI"===b.pageService&&b.source===a.id)){if(b.cancelled)a.cancelled&&a.cancelled();else if(b.result)a.done&&a.done(b.result);else if(b.Status||b.status)a.status&&a.status(b.Status||
b.status);window.removeEventListener("message",I,!1);g.parentNode&&g.parentNode.removeChild(g)}},!1);return g}function C(a){this.serviceRegistry=a.serviceRegistry;this.commandService=a.commandRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.toolbarId=a.toolbarId;this.saveToolbarId=a.saveToolbarId;this.editToolbarId=a.editToolbarId;this.pageNavId=a.navToolbarId;this.isReadOnly=a.readonly;this._localSearcher=a.textSearcher;this._searcher=a.searcher;this.editorSettings=a.editorSettings;
this.localSettings=a.localSettings}var s={},y=null;s.createDelegatedUI=x;C.prototype={generateSimpleEditorCommands:function(a,b){this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a,b));this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a)},generateEditorCommands:function(a){this.generateBaseEditorCommands(a);this.generateExtraEditorCommands(a)},generateBaseEditorCommands:function(a){this.isReadOnly||(this._generateUndoStackCommands(a),
this._generateSaveCommand(a),this._generateEditCommands(a))},generateExtraEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a)},_generateSettingsCommand:function(b){var g=this,e=new d.Command({imageClass:"core-sprite-wrench",tooltip:m.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return b.installed},callback:function(a){var d=e.settingsDropDown;if(!d||
d.isDestroyed())d=e.settingsDropDown=new f(a.domNode.parentNode,a.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){d.focus()},onHide:function(){b.focus()}}),d.updateContent=g.localSettings.show.bind(g.localSettings),a=d.getContentNode(),a.tabIndex=a.style.marginTop=0;d.click()}});this.commandService.addCommand(e);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new a.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(b){var g=
new d.Command({name:m.Undo,id:"orion.undo",visibleWhen:function(){return b.installed},callback:function(a){b.getUndoStack().undo()}});this.commandService.addCommand(g);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.undo",400,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,new a.KeyBinding("z",!0));g=new d.Command({name:m.Redo,id:"orion.redo",visibleWhen:function(){return b.installed},callback:function(a){b.getUndoStack().redo()}});
this.commandService.addCommand(g);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.redo",401,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,w.isMac?new a.KeyBinding("z",!0,!0):new a.KeyBinding("y",!0))},_generateSearchFilesCommand:function(b){var g=this;if(g._searcher){var e=!1,h=new d.Command({name:m.searchFiles,tooltip:m.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return b.installed},callback:function(a){if(!e){a=
b.getSelection();a=b.getText(a.start,a.end);var d=g.serviceRegistry.getService("orion.page.progress"),h=new k.OpenResourceDialog({searcher:g._searcher,progress:d,searchRenderer:g._searcher.defaultRenderer,nameSearch:!1,title:m.searchFiles,message:m.searchTerm,initialText:a,onHide:function(){e=!1;b.focus()}});window.setTimeout(function(){e=!0;h.show(p.node(g.toolbarId))},0)}}});this.commandService.addCommand(h);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.searchFiles",
1,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new a.KeyBinding("h",!0))}},_generateSaveCommand:function(b,g){var e=this,h=g?g:"orion.save",f=new d.Command({name:m.Save,tooltip:m.saveFile,id:h,visibleWhen:function(){return!b.installed||e.inputManager.getReadOnly()?!1:!0},callback:function(a){e.inputManager.save();return!0}});this.commandService.addCommand(f);this.commandService.registerCommandContribution(this.saveToolbarId||this.toolbarId,h,1,this.saveToolbarId?
"orion.menuBarFileGroup/orion.saveGroup":null,!1,new a.KeyBinding("s",!0));b.getTextView&&b.getTextView()&&(b.getTextView().setKeyBinding(new a.KeyBinding("s",!0),"save"),b.getTextView().setAction("save",f.callback,f))},_generateGotoLineCommnand:function(b){var g=this,e=new h.ParametersDescription([new h.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var a=b.getModel().getLineAtOffset(b.getCaretOffset())+1;return[new h.CommandParameter("line","number","Line:",a.toString())]}),
e=new d.Command({name:m.gotoLine,tooltip:m.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return b.installed},parameters:e,callback:function(a){var d=b.getModel();a.parameters&&a.parameters.valueFor("line")?a=a.parameters.valueFor("line"):(a=d.getLineAtOffset(b.getCaretOffset()),(a=prompt(m.gotoLinePrompt,a+1))&&(a=parseInt(a,10)));if(a)b.onGotoLine(a-1,0)}});this.commandService.addCommand(e);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.gotoLine",
3,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new a.KeyBinding("l",!w.isMac,!1,!1,w.isMac),new h.URLBinding("gotoLine","line"));b.getTextView&&b.getTextView()&&b.getTextView().setAction("gotoLine",function(a){if(a)return b.onGotoLine(a.line-1,0,void 0,a.callback),!0;g.commandService.runCommand("orion.gotoLine");return!0},e)},_generateFindCommnand:function(b){var g=this,e=new h.ParametersDescription([new h.CommandParameter("find","text","Find:")],{clientCollect:!0},
function(){var a=b.getSelection(),d="";a.end>a.start&&(d=b.getModel().getText(a.start,a.end),g._localSearcher&&g._localSearcher.getOptions().regex&&(d=t.escape(d)));return[new h.CommandParameter("find","text","Find:",d)]}),e=new d.Command({name:m.Find,tooltip:m.Find,id:"orion.editor.find",visibleWhen:function(){return b.installed},parameters:e,callback:function(a){if(g._localSearcher){var d="",e=null,h=b.getSelection();h.end>h.start&&a.parameters.valueFor("useEditorSelection")?(d=b.getModel().getText(h.start,
h.end),g._localSearcher.getOptions().regex&&(d=t.escape(d))):a.parameters&&a.parameters.valueFor("find")&&(d=a.parameters.valueFor("find"),e=v.matchResourceParameters(),u.convertFindURLBinding(e));e?(g._localSearcher.setOptions({regex:e.regEx,caseInsensitive:!e.caseSensitive}),a={},e.atLine&&(a.start=b.getModel().getLineStart(e.atLine-1)),g._localSearcher.show({findString:d,replaceString:e.replaceWith}),g._localSearcher.find(!0,a)):g._localSearcher.show({findString:d});return!0}return!1}});this.commandService.addCommand(e);
this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.editor.find",0,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new a.KeyBinding("f",!0),new h.URLBinding("find","find"));b.getTextView&&b.getTextView()&&b.getTextView().setAction("find",function(a){if(a)return g._localSearcher.show(a),!0;g.commandService.runCommand("orion.editor.find",null,null,new h.ParametersDescription([new h.CommandParameter("useEditorSelection","text",
"","true")],{clientCollect:!0}));return!0},e)},_generateBlame:function(b){var g=this,e=new d.Command({name:m.Blame,tooltip:m.BlameTooltip,id:"orion.edit.blame",parameters:new h.ParametersDescription([new h.CommandParameter("blame","boolean")],{clientCollect:!0}),visibleWhen:function(){return!b.installed?!1:z.isVisible(g.serviceRegistry,g.inputManager)},callback:function(a){for(var d=!1,e=b.getAnnotationModel().getAnnotations();e.hasNext();)if(e.next().type===r.AnnotationType.ANNOTATION_BLAME){d=!0;
break}d=!d;a.parameters&&a.parameters.valueFor("blame")&&(d="true"===a.parameters.valueFor("blame"));d?z.getBlame(g.serviceRegistry,g.inputManager):b.showBlame([])}});this.commandService.addCommand(e);this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",1,"orion.menuBarToolsGroup",!1,new a.KeyBinding("b",!0,!0),new h.URLBinding("blame","blame"))},_generateEditCommands:function(e){function h(b){if(!b)return null;var d=new a.KeyBinding;a.KeyBinding.apply(d,b);return d}function f(a,
b){!b&&(a&&"undefined"!==typeof a.HTML)&&delete a.HTML;var d=s.serviceRegistry.getService("orion.page.message");d?d.setProgressResult(a):window.console.log(a)}var s=this,q=this.toolbarId,k=this.serviceRegistry,u=k.getServiceReferences("orion.edit.command"),r=this.inputManager,v=k.getService("orion.page.progress"),t=function(a,b,g){var h=g.visibleWhen;g.visibleWhen=function(a){return!e.installed||s.inputManager.getReadOnly()?!1:!h||h(a)};g.callback=function(d){e=this;var g=e.getSelection?e.getSelection():
{start:0,end:0};d=e.getModel();var h=function(a){"object"===typeof a&&a?(a.text&&e.setText(a.text),a.selection&&(e.setSelection&&e.setSelection(a.selection.start,a.selection.end,!0),e.focus())):"string"===typeof a&&(e.setText(a,g.start,g.end,!0),e.setSelection&&e.setSelection(g.start,g.start+a.length),e.focus())},s;b.execute?(d={contentType:r.getContentType(),input:r.getInput()},s=A.getEditorContext(k),s.openDelegatedUI=x,s.setStatus=f,d=b.execute(s,d),s=null):(d=b.run(d.getText(g.start,g.end),d.getText(),
g,r.getInput()),s=function(b){if(b&&b.uriTemplate){var d={};d.uriTemplate=b.uriTemplate;d.params=r.getFileMetadata();d.id=a.id;d.width=b.width;d.height=b.height;d.done=h;d.status=f;x(d)}else b&&(b.Status||b.status)?f(b.Status||b.status):h(b)});v.showWhile(d,n.formatMessage(m.running,a.name)).then(s);return!0};g.callback=g.callback.bind(e);return new d.Command(g)};l.when(function(a){if(y)return y;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new g.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));
return b.getContentTypes().then(function(a){return y=a})}(this.serviceRegistry),function(){var a=[],d=100;u.forEach(function(g){var f=g.getProperty("editor");if(!f||!(e.id&&f!==e.id)){for(var l=s.serviceRegistry.getService(g),q={},f=g.getPropertyKeys(),k=0;k<f.length;k++)q[f[k]]=g.getProperty(f[k]);q.forceSingleItem=!0;g=b._createCommandOptions(q,g,s.serviceRegistry,y,!1,function(a){return r.getFileMetadata()});a.push(g);g.then(function(a){a=t(q,l,a);s.commandService.addCommand(a);s.commandService.registerCommandContribution(s.toolbarId,
a.id,d,"orion.menuBarToolsGroup",q.bindingOnly,h(q.key))});d++}});l.all(a,function(a){return{_error:a}}).then(function(a){if(a=r.getFileMetadata()){var b=p.node(q);b&&(s.commandService.destroy(b),s.commandService.renderCommands(b.id,b,a,e,"button"));if(b=p.node("pageNavigationActions"))s.commandService.destroy(b),s.commandService.renderCommands(b.id,b,e,e,"button")}})})}};s.EditorCommandFactory=C;return s});
define("orion/projectCommands","require i18n!orion/navigate/nls/messages orion/webui/littlelib orion/commands orion/Deferred orion/webui/dialogs/DirectoryPrompterDialog orion/commandRegistry orion/i18nUtil orion/webui/dialogs/PromptDialog orion/widgets/projects/ProjectOptionalParametersDialog orion/fileCommands orion/editorCommands orion/EventTarget orion/URITemplate orion/PageLinks orion/objects orion/preferences".split(" "),function(m,n,p,k,f,l,e,d,a,h,b,g,u,v,q,r,z){function t(a){if(!a)return{};
Array.isArray(a)&&(a=1===a.length?a[0]:{});return a}function w(a,b){if(!a)return null;for(var d=[],g=0;g<a.length;g++)d.push(new e.CommandParameter(a[g].id,a[g].type,a[g].name));return new e.ParametersDescription(d,{hasOptionalParameters:!!b,optionalParams:b})}function A(a,b,d){if(b.parameters&&b.parameters.optionsRequested)(new h.ProjectOptionalParametersDialog({title:d,data:b,func:function(){b.parameters.optionsRequested=!1;a(b)}.bind(this)})).show();else{d=b.oldParams||{};if(b.parameters)for(var g in b.parameters.parameterTable)d[g]=
b.parameters.valueFor(g);if(b.parameters&&b.parameters._options.optionalParams)for(var e=0;e<b.parameters._options.optionalParams.length;e++)g=b.parameters._options.optionalParams[e],d[g.id]=g.value;return d}}function x(a,b,d){!b&&(a&&"undefined"!==typeof a.HTML)&&delete a.HTML;a.Retry&&a.Retry.parameters?(a.forceShowMessage&&B.setProgressResult(a),d.data.parameters=w(a.Retry.parameters,a.Retry.optionalParameters),d.data.oldParams=d.oldParams,d.commandService.collectParameters(d.data)):(s(d.project.Name,
d.deployService,d.launchConfiguration),B.setProgressResult(a));a.ToSave?B.showWhile(d.projectClient.saveProjectLaunchConfiguration(d.project,a.ToSave.ConfigurationName,d.deployService.id,a.ToSave.Parameters,a.ToSave.Url,a.ToSave.ManageUrl,a.ToSave.Path,a.ToSave.UrlTitle,a.ToSave.Type),"Saving configuration").then(function(b){s(d.project.Name,d.deployService,b);H&&H.dispatchEvent({type:"create",newValue:b});C(B,a,d)},d.errorHandler):C(B,a,d)}function C(a,b,d){var g=[];g.Severity="Info";b.Message?(g.HTML=
!1,g.Message=b.Message):(g.HTML=!0,g.Message='Use \x3ca href\x3d"'+m.toUrl("edit/edit.html#"+d.project.ContentLocation)+'"\x3eProject\x3c/a\x3e page to view and manage the application.');a.setProgressResult(g)}function s(a,b,d){var g;L&&(g=d?"orion.launchConfiguration.deploy."+d.ServiceId+d.Name:"orion.project.deploy."+b.id,L.put(a,g));H&&H.dispatchEvent({type:"changedDefault",newValue:g})}function y(a,b){function d(e){B.showWhile(b.deployService.deploy(b.project,a),e,!0).then(function(d){if(d)if(d.UriTemplate){var e=
{};e.uriTemplate=d.UriTemplate;e.width=d.Width;e.height=d.Height;e.id=d.UriTemplateId||b.deployService.id;b.oldParams=a.Params;e.done=function(a){x(a,null,b)};e.status=function(a){x(a,null,b)};g.createDelegatedUI(e)}else{if(b.launchConfiguration&&(d.State||d.CheckState))b.launchConfiguration.status=d,H&&H.dispatchEvent({type:"changeState",newValue:b.launchConfiguration});d.ToSave?B.showWhile(b.projectClient.saveProjectLaunchConfiguration(b.project,d.ToSave.ConfigurationName,b.deployService.id,d.ToSave.Parameters,
d.ToSave.Url,d.ToSave.ManageUrl,d.ToSave.Path,d.ToSave.UrlTitle,d.ToSave.Type),"Saving configuration").then(function(a){s(b.project.Name,b.deployService,a);H&&H.dispatchEvent({type:"create",newValue:a});C(B,d,b)},b.errorHandler):s(b.project.Name,b.deployService,b.launchConfiguration);C(B,d,b)}},function(d){d.Retry&&d.Retry.parameters?(d.forceShowMessage&&b.errorHandler(d),b.data.parameters=w(d.Retry.parameters,d.Retry.optionalParameters),b.data.oldParams=a.Params,b.commandService.collectParameters(b.data)):
(b.errorHandler(d),s(b.project.Name,b.deployService,b.launchConfiguration))})}H&&b.launchConfiguration&&(b.launchConfiguration.status={State:"PROGRESS"},H.dispatchEvent({type:"changeState",newValue:b.launchConfiguration}));b.deployService.getDeployProgressMessage?b.deployService.getDeployProgressMessage(b.project,a).then(function(a){d(a)}.bind(this),function(){d(b.deployService.name+" in progress")}.bind(this)):d(b.deployService.name+" in progress")}function D(a,b,d,g,e,h,f,s){var l;l=g.actionComment?
s?g.actionComment.replace(/\$\{([^\}]+)\}/g,function(a,b){return s[b]}):g.actionComment:"Getting content from "+g.type;B.showWhile(g.initDependency(e,s,h),l).then(function(b){a.addProjectDependency(h,b).then(function(){G&&G.dispatchEvent({type:"create",newValue:b,project:h})},d)},function(a){a.Retry&&a.Retry.addParameters&&(f.parameters=w(a.Retry.addParameters,a.Retry.optionalParameters),f.oldParams=s,b.collectParameters(f));d(a)})}var E={},B,L,H;E.getLaunchConfigurationDispatcher=function(){H||(H=
new u);return H};E.getDefaultLaunchCommand=function(a){if(L)return L.get(a)};var G;E.getDependencyDispatcher=function(){G||(G=new u);return G};E.updateProjectNavCommands=function(a,b,d,g,e){function h(a){B?B.setProgressResult(a):window.console.log(a)}for(var f=0;f<b.length;f++)(function(b){var f=new k.Command({name:"Deploy to "+b.Name,tooltip:"Deploy to "+b.Name,id:"orion.launchConfiguration.deploy."+b.ServiceId+b.Name,imageClass:"core-sprite-deploy",callback:function(f){var s=t(f.items);f.oldParams||
(f.oldParams=b.Params);var l=A(arguments.callee,f,"Deploy "+s.Name);if(l){var q=r.clone(b);q.Params=l;g.getProjectDelpoyService(b.ServiceId,b.Type).then(function(l){l&&l.deploy&&e.loadWorkspace(s.Project.ContentLocation).then(function(e){y(q,{project:a.Project,deployService:l,data:f,errorHandler:h,projectClient:g,commandService:d,launchConfiguration:b})})})}},visibleWhen:function(b){return!(void 0==f.showCommand||f.showCommand)?!1:t(b).Project===a.Project}});f.isLaunchProject=!0;d.addCommand(f)})(b[f])};
E.createDependencyCommands=function(a,b,g,e,h){function f(a){B?B.setProgressResult(a):window.console.log(a)}function l(a){var d=new k.Command({name:a?"Start":"Stop",tooltip:a?"Start application":"Stop application",id:a?"orion.launchConfiguration.startApp":"orion.launchConfiguration.stopApp",imageClass:a?"core-sprite-start":"core-sprite-stop",callback:function(d){var g=t(d.items);d.oldParams=g.Params;var h=A(arguments.callee,d,a?"Start application":"Stop application");h&&e.getProjectDelpoyService(g.ServiceId,
g.Type).then(function(l){if(l&&(a?l.start:l.stop))H&&(g.status={State:"PROGRESS"},H.dispatchEvent({type:"changeState",newValue:g})),(a?l.start:l.stop)(h).then(function(a){g.status=a;H&&H.dispatchEvent({type:"changeState",newValue:g});a.ToSave&&B.showWhile(e.saveProjectLaunchConfiguration(g.project,a.ToSave.ConfigurationName,l.id,a.ToSave.Parameters,a.ToSave.Url,a.ToSave.ManageUrl,a.ToSave.Path,a.ToSave.UrlTitle,a.ToSave.Type),"Saving configuration").then(function(a){s(g.project.Name,l,a);H&&H.dispatchEvent({type:"create",
newValue:a})},f)},function(a){a.Retry?(d.parameters=w(a.Retry.parameters,a.Retry.optionalParameters),d.oldParams=h,b.collectParameters(d)):f(a)})})},visibleWhen:function(b){b=t(b);return b.ServiceId&&b.Name&&b.status&&(a?"STOPPED"===b.status.State:"STARTED"===b.status.State)}});b.addCommand(d)}B=a.getService("orion.page.progress");a=new k.Command({name:"Connect",tooltip:"Fetch content",id:"orion.project.dependency.connect",callback:function(a){var d=t(a.items),g=A(arguments.callee,a,"Fetch content of "+
d.Dependency.Name);if(g){var h=e.getProjectHandler(d.Dependency.Type);h.then?h.then(function(h){D(e,b,f,h,d.Dependency,d.Project,a,g)}):D(e,b,f,h,d.Dependency,d.Project,a,g)}},visibleWhen:function(a){if(!a.Dependency||!a.Project||!a.disconnected)return!1;if(h)for(var b=0;b<h.length;b++)if(h[b]===a.Dependency.Type)return!0;return!1}});b.addCommand(a);a=new k.Command({name:"Disconnect from project",tooltip:"Do not treat this folder as a part of the project",imageClass:"core-sprite-delete",id:"orion.project.dependency.disconnect",
callback:function(a){var b=t(a.items);B.progress(e.removeProjectDependency(b.Project,b.Dependency),d.formatMessage("Removing ${0} from project ${1}",b.Dependency.Name,b.Project.Name)).then(function(a){G&&G.dispatchEvent({type:"delete",oldValue:b.Dependency,project:b.Project})})},visibleWhen:function(a){return!a.Dependency||!a.Project?!1:!0}});b.addCommand(a);a=new k.Command({name:"Check status",tooltip:"Check application status",id:"orion.launchConfiguration.checkStatus",callback:function(a){var d=
t(a.items);if(a.parameters){var g=A(arguments.callee,a,"Check application state");g&&e.getProjectDelpoyService(d.ServiceId,d.Type).then(function(e){H&&(d.status={State:"PROGRESS"},H.dispatchEvent({type:"changeState",newValue:d}));e&&e.getState&&e.getState(g).then(function(a){d.status=a;H&&H.dispatchEvent({type:"changeState",newValue:d});d.project&&d.project.children&&d.project.children.forEach(function(a){d.ServiceId&&(d.Name&&d.parametersRequested)&&(a.ServiceId===d.ServiceId&&a.Name!==d.Name&&H)&&
(a.status={CheckState:!0},H.dispatchEvent({type:"changeState",newValue:a}))})},function(e){e.Retry?(a.parameters=w(e.Retry.parameters,e.Retry.optionalParameters),a.oldParams=g,b.collectParameters(a)):(f(e),d.status={error:e},H&&H.dispatchEvent({type:"changeState",newValue:d}))})})}else a.parameters=w(d.parametersRequested,d.optionalParameters),a.oldParams=d.Params,b.collectParameters(a)},visibleWhen:function(a){a=t(a);return a.ServiceId&&a.Name&&a.parametersRequested}});b.addCommand(a);l(!0);l(!1);
a=new k.Command({name:"Manage",tooltip:"Manage this application on remote server",id:"orion.launchConfiguration.manage",hrefCallback:function(a){var b=t(a.items);if(b.ManageUrl)return a=new v(b.ManageUrl),b=r.clone(b.Params),b.OrionHome=q.getOrionHome(),a=a.expand(b),a.indexOf("://")||(a="http://"+a),a},visibleWhen:function(a){return t(a).ManageUrl}});b.addCommand(a);a=new k.Command({name:"Deploy",tooltip:"Deploy this application again",id:"orion.launchConfiguration.deploy",imageClass:"core-sprite-deploy",
callback:function(a){var d=t(a.items);a.oldParams||(a.oldParams=d.Params);var h=A(arguments.callee,a,"Deploy "+d.Name);if(h){var s=r.clone(d);s.Params=h;e.getProjectDelpoyService(d.ServiceId,d.Type).then(function(h){h&&h.deploy&&g.loadWorkspace(d.project.ContentLocation).then(function(g){y(s,{project:d.project,deployService:h,data:a,errorHandler:f,projectClient:e,commandService:b,launchConfiguration:d})})})}},visibleWhen:function(a){a=t(a);return a.ServiceId&&a.Name}});b.addCommand(a)};E.getAddDependencyCommands=
function(a){var b=[],d;for(d in a._commandList){var g=a._commandList[d];g.isAddDependency&&b.push(g)}return b};E.getCreateProjectCommands=function(a){var b=[],d;for(d in a._commandList){var g=a._commandList[d];g.isCreateProject&&b.push(g)}return b};E.getDeployProjectCommands=function(a){var b=[],d;for(d in a._commandList){var g=a._commandList[d];g.isDeployProject&&b.push(g)}return b};E.getLaunchProjectCommands=function(a){var b=[],d;for(d in a._commandList){var g=a._commandList[d];g.isLaunchProject&&
b.push(g)}return b};var I;E.setExplorer=function(a){I=a};E.createProjectCommands=function(g,h,s,q,u,m){function r(a){B?B.setProgressResult(a):window.console.log(a)}function v(a,d){var g=b.getModelEventDispatcher();d.ContentLocation?s.read(d.ContentLocation,!0).then(function(b){g.dispatchEvent({type:"create",parent:a,newValue:b})},function(){g.dispatchEvent({type:"create",parent:a,newValue:null})}):g.dispatchEvent({type:"create",parent:a,newValue:null})}function x(a){return q.getProjectHandler(a).then(function(b){if(b.initDependency){var d=
{name:b.addDependencyName,id:"orion.project.adddependency."+a,tooltip:b.addDependencyTooltip,callback:function(a){var d=t(a.items).Project,g=A(arguments.callee,a,b.addDependencyTooltip);if(g){var e=new f;b.paramsToDependencyDescription(g).then(function(a){a&&a.Location?s.loadWorkspace(d.WorkspaceLocation).then(function(d){for(var g=[],h=!1,s=0;s<d.Children.length&&!0!==h;s++){var l=b.getDependencyDescription(d.Children[s]);g.push(l);(function(b,d){d.then(function(b){b&&b.Location===a.Location&&(h=
!0,e.resolve(b))})})(s,l)}f.all(g).then(function(){h||e.resolve()})},e.reject):e.resolve()},r);B.showWhile(e,"Searching your workspace for matching content").then(function(e){e?q.addProjectDependency(d,e).then(function(){G&&G.dispatchEvent({type:"create",newValue:e,project:d})},r):D(q,h,r,b,{},d,a,g)})}},visibleWhen:function(a){return!I||!I.isCommandsVisible()?!1:"Project"===a.type||"Project"===I.treeRoot.type}};d.parameters=w(b.addParameters,b.optionalParameters);d=new k.Command(d);d.isAddDependency=
!0;h.addCommand(d)}})}function C(a){return q.getProjectHandler(a).then(function(b){if(b.initProject){var d={name:b.addProjectName,id:"orion.project.createproject."+a,tooltip:b.addProjectTooltip,callback:function(a){var d=arguments.callee,g=t(a.items),e=A(d,a,b.addProjectTooltip);e&&(d=b.actionComment?e?b.actionComment.replace(/\$\{([^\}]+)\}/g,function(a,b){return e[b]}):b.actionComment:"Getting content from "+b.type,B.showWhile(b.initProject(e,{WorkspaceLocation:g.Location}),d).then(function(a){v(g,
a)},function(b){b.Retry&&b.Retry.addParameters&&(a.parameters=w(b.Retry.addParameters,b.Retry.optionalParameters),a.oldParams=e,h.collectParameters(a));r(b)}))},visibleWhen:function(a){if(!I||!I.isCommandsVisible())return!1;a=t(a);return a.Location}};d.parameters=w(b.addParameters,b.optionalParameters);d=new k.Command(d);d.isCreateProject=!0;h.addCommand(d)}})}function H(a){var b,d={name:a.name,tootlip:a.tooltip,id:"orion.project.deploy."+a.id,callback:function(b){var d=I.selection.getSelections(),
g=d&&0<d.length?t(d):I.treeRoot,d=g.Project,g=g.Location?g.Location.replace(d.ContentLocation,""):"",e=A(arguments.callee,b,a.tooltip);e&&y({Params:e,Path:g},{project:d,deployService:a,data:b,errorHandler:r,projectClient:q,commandService:h})},visibleWhen:function(d){if(!(void 0==b.showCommand||b.showCommand))return!1;d=I.treeRoot;return!d.Project||!d.children||0===d.children.length?!1:q.matchesDeployService(d.children[0],a)}};d.parameters=w(a.parameters,a.optionalParameters);b=new k.Command(d);b.isDeployProject=
!0;h.addCommand(b)}L||(new z.PreferencesService(g)).getPreferences("/deploy/project").then(function(a){L=a});B=g.getService("orion.page.progress");u=u||[];var K=new k.Command({name:"Associated Folder",tooltip:"Associate a folder from the workspace with this project.",id:"orion.project.addFolder",callback:function(a){var b=t(a.items).Project;(new l.DirectoryPrompterDialog({title:n["Choose a Folder"],serviceRegistry:g,fileClient:s,func:function(a){s.read(a.Location,!0).then(function(a){function d(){var g=
"",e=a.Name;if(a.Parents&&0<a.Parents.length){for(var h=a.Parents.length-1;0<=h;h--)g+=a.Parents[h].Name,g+="/";e+=" ("+a.Parents[a.Parents.length-1].Name+")"}var g=g+a.Name,f={Name:e,Type:"file",Location:g};q.addProjectDependency(b,{Name:e,Type:"file",Location:g}).then(function(){G&&G.dispatchEvent({type:"create",newValue:f,project:b})},r)}if(!a.Parents||0===a.Parents.length){for(var g=[],e=!1,h=0;h<u.length;h++){if(e)return;var s=q.getProjectHandler(u[h]).then(function(b){return b.getDependencyDescription(a)});
g.push(s);s.then(function(a){a&&(e=!0,q.addProjectDependency(b,a).then(function(){G&&G.dispatchEvent({type:"create",newValue:a,project:b})},r))})}f.all(g).then(function(){e||d()})}else d()},r)}})).show()},visibleWhen:function(a){return!I||!I.isCommandsVisible()?!1:"Project"===a.type||"Project"===I.treeRoot.type}});K.isAddDependency=!0;h.addCommand(K);K=new k.Command({name:"Convert to project",tooltip:"Convert this folder into a project",id:"orion.project.initProject",callback:function(a){var b=t(a.items);
if(b){var d=function(){q.initProject(b.Location).then(function(a){s.read(b.Location,!0).then(function(a){I.changedItem(b,!0)},r);v(b,a)},r)};q.readProject(b).then(function(a){a?(B.setProgressResult({Message:"This folder is a project already.",Severity:"Warning"}),I.changedItem(b,!0)):d()},d)}},visibleWhen:function(a){if(!I||!I.isCommandsVisible())return!1;if((a=t(a))&&(a.parent&&a.parent.Projects||a.Parents&&0===a.Parents.length)){if(a.children)for(var b=0;b<a.children.length;b++)if(a.children[b].Name&&
!a.children[b].Directory&&"project.json"===a.children[b].Name.toLowerCase())return!1;return!0}return!1}});h.addCommand(K);for(var K=[],J=0;J<u.length;J++){var F=u[J];K.push(x(F));K.push(C(F))}J=new k.Command({name:"Readme File",tooltip:"Create a README.md file in this project",id:"orion.project.create.readme",callback:function(a){var g=t(a.items);B.progress(s.createFile(g.Project.ContentLocation,"README.md"),d.formatMessage("Creating ${0}","README.md")).then(function(a){function d(){b.getModelEventDispatcher().dispatchEvent({type:"create",
parent:g.Project.fileMetadata,newValue:a})}g.Project?B.progress(s.write(a.Location,"# "+g.Project.Name),"Writing sample readme").then(function(){d()}):d()},r)},visibleWhen:function(a){if(!I||!I.isCommandsVisible())return!1;a=t(a);return!a.Project||!a.Project.fileMetadata||!a.Project.fileMetadata.children||!a.Project.ContentLocation?!1:!a.Project.fileMetadata.children.some(function(a){return a.Name&&"readme.md"===a.Name.toLowerCase()?!0:!1})}});h.addCommand(J);J=new k.Command({name:"Basic",tooltip:"Create an empty project.",
id:"orion.project.create.basic",parameters:new e.ParametersDescription([new e.CommandParameter("name","text","Name: ")]),callback:function(a){var b=a.parameters.valueFor("name");b&&(a=t(a.items),s.loadWorkspace(s.fileServiceRootURL(a.Location)).then(function(a){B.progress(q.createProject(a.ChildrenLocation,{Name:b}),n["Creating project "]+b).then(function(b){v(a,b)})}))},visibleWhen:function(a){if(!I||!I.isCommandsVisible())return!1;a=t(a);return!!a.Location}});J.isCreateProject=!0;h.addCommand(J);
J=new k.Command({name:"Zip archive",tooltip:"Create a project from a local zip archive.",id:"orion.project.create.fromfile",callback:function(b){var d=t(b.items),g=p.node("fileSelectorInput");b=g.cloneNode();var e=new a.PromptDialog({title:n["Enter project name:"]});e.addEventListener("ok",function(a){var b=a.value;s.loadWorkspace(s.fileServiceRootURL(d.Location)).then(function(a){B.progress(q.createProject(a.ChildrenLocation,{Name:b}),n["Creating project "]+b).then(function(b){B.progress(s.read(b.ContentLocation,
!0)).then(function(b){I.changedItem(a,!0).then(function(a){var d=null;a.Children.some(function(a){return a.Location===b.Location?(d=a,!0):!1});if(d&&g.files&&0<g.files.length)for(a=0;a<g.files.length;a++)I._uploadFile(d,g.files.item(a),!0)})},r)},r)},r)});var h=function(){g.files&&0<g.files.length&&e.show();g.removeEventListener("change",h)};g.addEventListener("change",h);g.click();g.parentNode.replaceChild(b,g)},visibleWhen:function(a){if(!I||!I.isCommandsVisible())return!1;a=t(a);return!!a.Location}});
J.isCreateProject=!0;h.addCommand(J);J=new k.Command({name:"SFTP",tooltip:"Create a project from an SFTP site.",id:"orion.project.create.sftp",parameters:new e.ParametersDescription([new e.CommandParameter("name","text","Name:"),new e.CommandParameter("url","url","Url:")]),callback:function(a){var b=a.parameters.valueFor("name");if(b){var d=a.parameters.valueFor("url");d&&(a=t(a.items),s.loadWorkspace(s.fileServiceRootURL(a.Location)).then(function(a){B.progress(q.createProject(a.ChildrenLocation,
{Name:b,ContentLocation:d}),n["Creating project "]+b).then(function(b){v(a,b)})}))}},visibleWhen:function(a){if(!I||!I.isCommandsVisible())return!1;a=t(a);return!!a.Location}});J.isCreateProject=!0;h.addCommand(J);E.createDependencyCommands(g,h,s,q,u);if(m)for(J=0;J<m.length;J++){var P=m[J],F=new f;K.push(F);(function(a){q.getProjectDelpoyService(P).then(function(b){H(b);a.resolve()})})(F)}return f.all(K)};return E});
define("orion/webui/contextmenu",["orion/webui/littlelib","orion/webui/dropdown","orion/objects"],function(m,n,p){function k(l){l.skipTriggerEventListeners=!0;f.call(this,l);this._initialize()}var f=n.Dropdown;k.prototype=Object.create(f.prototype);p.mixin(k.prototype,{_initialize:function(){this._dropdownNode.dropdown||(this._dropdownNode.dropdown=this);this._boundcontextmenuEventHandler=this._contextmenuEventHandler.bind(this);this._boundContextMenuCloser=this._contextMenuCloser.bind(this);this._triggerNode.addEventListener("contextmenu",
this._boundcontextmenuEventHandler,!0);window.addEventListener("contextmenu",this._boundContextMenuCloser,!1);this._triggerNode.addEventListener("click",this._boundContextMenuCloser,!1)},_contextMenuCloser:function(f){this.close(f)},_contextmenuEventHandler:function(f){this.open(f)?m.stop(f):this.close()}});k.prototype.constructor=k;k.prototype._positionDropdown=function(l){if(l){var e=l.clientX;l=l.clientY;this._dropdownNode.style.position="fixed";this._dropdownNode.style.left=e+"px";this._dropdownNode.style.top=
l+"px";var d=m.bounds(this._dropdownNode),a=d.width,d=d.height,h=m.bounds(document.body),a=e+a-(h.left+h.width);0<a&&(this._dropdownNode.style.left=Math.floor(e-a)+"px");e=l+d-(h.top+h.height);0<e&&(this._dropdownNode.style.top=Math.floor(l-e)+"px")}else f.prototype._positionDropdown.call(this)};k.prototype.destroy=function(){this._triggerNode.removeEventListener("contextmenu",this._boundcontextmenuEventHandler,!0);this._triggerNode.removeEventListener("click",this._boundContextMenuCloser,!1);window.removeEventListener("contextmenu",
this._boundContextMenuCloser,!1);this._dropdownNode.dropdown=null;f.prototype.destroy.call(this)};return{ContextMenu:k}});
define("orion/widgets/nav/common-nav","i18n!orion/edit/nls/messages orion/objects orion/webui/littlelib orion/explorers/explorer-table orion/explorers/navigatorRenderer orion/explorers/explorerNavHandler orion/keyBinding orion/fileCommands orion/projectCommands orion/extensionCommands orion/globalCommands orion/selection orion/URITemplate orion/PageUtil orion/Deferred orion/webui/contextmenu".split(" "),function(m,n,p,k,f,l,e,d,a,h,b,g,u,v,q,r){function z(a){a.setFocus=!1;a.cachePrefix=null;a.modelEventDispatcher=
d.getModelEventDispatcher();a.dragAndDrop=d.uploadFile;w.apply(this,arguments);this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.editorInputManager=a.editorInputManager;this.progressService=a.progressService;this.sidebar=a.sidebar;var e=this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.fileActionsScope="fileActions";this.editActionsScope="editActions";this.viewActionsScope="viewActions";this.toolsActionsScope="toolsActions";this.additionalActionsScope=
"extraActions";this._parentNode=p.node(this.parentId);this._sidebarContextMenuNode=document.createElement("ul");this._sidebarContextMenuNode.className="dropdownMenu";this._sidebarContextMenuNode.setAttribute("role","menu");this._sidebarContextMenuNode.id=this.parentId+"ContextMenu";this._parentNode.parentNode.insertBefore(this._sidebarContextMenuNode,this._parentNode);this.contextMenuActionsScope=this._sidebarContextMenuNode.id+"commonNavContextMenu";this.treeRoot={};var h=this;this.editorInputListener=
function(a){h.reveal(a.metadata)};this.editorInputManager.addEventListener("InputChanged",this.editorInputListener);e&&(e.reveal=function(a){h.reveal(a)});var f=this.modelEventDispatcher,l=this._modelListener=this.onFileModelChange.bind(this);["move","delete"].forEach(function(a){f.addEventListener(a,l)});this.selection=new g.Selection(this.registry,"commonNavFileSelection");this._selectionListener=function(a){h.updateCommands(a.selections);e&&h.sidebarNavInputManager.dispatchEvent(a)};this.selection.addEventListener("selectionChanged",
this._selectionListener);b.getMainSplitter().splitter.addEventListener("toggle",this._splitterToggleListener=function(a){this.updateCommands()}.bind(this));this.commandsRegistered=this.registerCommands();this._createContextMenu()}function t(){x.apply(this,arguments)}var w=k.FileExplorer,A=e.KeyBinding,x=f.NavigatorRenderer,C=new u("#{,resource,params*}");z.prototype=Object.create(w.prototype);n.mixin(z.prototype,{onLinkClick:function(a){w.prototype.onLinkClick.call(this,a);this.sidebarNavInputManager.dispatchEvent(a);
var b=this.getNavHandler();b&&a.item.Directory&&(a=a.item,b.cursorOn(a),b.setSelection(a,!1),a=b._modelIterator.cursor(),b.isExpandable(a)&&(b.isExpanded(a)?this.myTree.collapse(a):this.myTree.expand(a)))},onModelCreate:function(a){return w.prototype.onModelCreate.call(this,a).then(function(){this.sidebarNavInputManager.dispatchEvent(a)}.bind(this))},onFileModelChange:function(a){var b=a.oldValue;a=a.newValue;var d=this.editorInputManager.getFileMetadata();if(d){var g;[d].concat(d.Parents||[]).some(function(a){return b.Location===
a.Location?(g=b,!0):!1});g&&this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:b.parent.Location,newInput:g.Location===d.Location?a&&a.ChildrenLocation||a&&a.ContentLocation||a&&a.Location||null:null})}},createActionSections:function(){var a=this;[].forEach(function(b){if(!a[b]){var d=document.createElement("ul");d.id=b;d.classList.add("commandList");d.classList.add("layoutLeft");d.classList.add("pageActions");a.toolbarNode.appendChild(d);a[b]=d}})},destroy:function(){var a=
this,d=this.modelEventDispatcher;["move","delete"].forEach(function(b){d.removeEventListener(b,a._modelListener)});w.prototype.destroy.call(this);[].forEach(function(b){delete a[b]});this.editorInputManager.removeEventListener("InputChanged",this.editorInputListener);this.selection.removeEventListener("selectionChanged",this._selectionListener);var g=b.getMainSplitter();g&&g.splitter.removeEventListener("toggle",this._splitterToggleListener);this._contextMenu&&(this._contextMenu.destroy(),this._contextMenu=
null);this._sidebarContextMenuNode&&(this._parentNode.parentNode.removeChild(this._sidebarContextMenuNode),this._sidebarContextMenuNode=null)},display:function(a,b){return this.loadRoot(a,b).then(function(){this.updateCommands();return this.reveal(this.editorInputManager.getFileMetadata())}.bind(this))},loadRoot:function(a,b){a=a&&a.ChildrenLocation||a||"";return this.commandsRegistered.then(function(){return a&&"object"===typeof a?this.load(a):this.loadResourceList(a,b)}.bind(this))},scope:function(a){a=
a&&a.ChildrenLocation||a||"";var b=v.matchResourceParameters(),d=b.resource;delete b.resource;if(a){if(b.navigate===a)return;b.navigate=a}else delete b.navigate;window.location.href=C.expand({resource:d,params:b})},scopeUp:function(){var a;a=this.treeRoot;var b=a.Parents&&a.Parents[0];a=b?b.ChildrenLocation:this.fileClient.fileServiceRootURL(a.Location);this.scope(a)},scopeDown:function(a){this.scope(a.ChildrenLocation)},expandItem:function(a,b){return k.FileExplorer.prototype.expandItem.call(this,
a,b).then(function(a){this.sidebarNavInputManager.dispatchEvent({type:"itemExpanded",item:a});return a}.bind(this))},isCommandsVisible:function(){var a=b.getMainSplitter();return a?!a.splitter.isClosed():!this.destroyed},registerCommands:function(){var b=this.commandRegistry,d=this.fileActionsScope,g=this.editActionsScope,e=this.viewActionsScope,f=this.contextMenuActionsScope,l=new A(113),q=new A(46),k=new A("x",!0),u=new A("c",!0),r=new A("v",!0),v=new A(38,!1,!1,!0),t=new A(40,!1,!1,!0);t.domScope=
v.domScope=r.domScope=u.domScope=k.domScope=q.domScope=l.domScope="sidebar";t.scopeName=v.scopeName=r.scopeName=u.scopeName=k.scopeName=q.scopeName=l.scopeName=m.Navigator;b.registerCommandContribution(d,"eclipse.newFile",1,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");b.registerCommandContribution(d,"eclipse.newFolder",2,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default",!1,null);b.registerCommandContribution(d,"orion.new.project",3,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");
b.registerCommandContribution(d,"orion.new.linkProject",4,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");b.registerCommandContribution(d,"orion.import",1,"orion.menuBarFileGroup/orion.importGroup");b.registerCommandContribution(d,"orion.importZipURL",2,"orion.menuBarFileGroup/orion.importGroup");b.registerCommandContribution(d,"orion.importSFTP",3,"orion.menuBarFileGroup/orion.importGroup");b.registerCommandContribution(d,"eclipse.downloadSingleFile",1,"orion.menuBarFileGroup/orion.exportGroup");
b.registerCommandContribution(d,"eclipse.downloadFile",2,"orion.menuBarFileGroup/orion.exportGroup");b.registerCommandContribution(d,"eclipse.exportSFTPCommand",3,"orion.menuBarFileGroup/orion.exportGroup");b.registerCommandContribution(g,"eclipse.renameResource",1,"orion.menuBarEditGroup/orion.renameGroup",!1,l);b.registerCommandContribution(g,"eclipse.cut",2,"orion.menuBarEditGroup/orion.clipboardGroup",!1,k);b.registerCommandContribution(g,"eclipse.copySelections",3,"orion.menuBarEditGroup/orion.clipboardGroup",
!1,u);b.registerCommandContribution(g,"eclipse.pasteSelections",4,"orion.menuBarEditGroup/orion.clipboardGroup",!1,r);b.registerCommandContribution(g,"eclipse.deleteFile",5,"orion.menuBarEditGroup/orion.deleteGroup",!1,q);b.registerCommandContribution(g,"eclipse.compareWith",6,"orion.menuBarEditGroup/orion.compareGroup");b.registerCommandContribution(g,"eclipse.compareWithEachOther",7,"orion.menuBarEditGroup/orion.compareGroup");b.registerCommandContribution(e,"eclipse.downFolder",1,"orion.menuBarViewGroup",
!1,t);b.registerCommandContribution(e,"eclipse.upFolder",0,"orion.menuBarViewGroup",!1,v);b.addCommandGroup(f,"orion.commonNavContextMenuEditGroup",100,null,null,null,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.New",0,m.New,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.OpenWith",1001,m.OpenWith,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.Extensions",1002,m.OpenRelated,"orion.commonNavContextMenuEditGroup",
null,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.ImportGroup",1003,m.Import,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.ExportGroup",1004,m.Export,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");b.registerCommandContribution(f,"eclipse.newFile",1,"orion.commonNavContextMenuEditGroup/orion.New");b.registerCommandContribution(f,"eclipse.newFolder",2,"orion.commonNavContextMenuEditGroup/orion.New",!1,null);
b.registerCommandContribution(f,"orion.new.project",3,"orion.commonNavContextMenuEditGroup/orion.New");b.registerCommandContribution(f,"orion.new.linkProject",4,"orion.commonNavContextMenuEditGroup/orion.New");b.registerCommandContribution(f,"eclipse.renameResource",1,"orion.commonNavContextMenuEditGroup",!1);b.registerCommandContribution(f,"eclipse.cut",2,"orion.commonNavContextMenuEditGroup",!1);b.registerCommandContribution(f,"eclipse.copySelections",3,"orion.commonNavContextMenuEditGroup",!1);
b.registerCommandContribution(f,"eclipse.pasteSelections",4,"orion.commonNavContextMenuEditGroup",!1);b.registerCommandContribution(f,"eclipse.deleteFile",5,"orion.commonNavContextMenuEditGroup",!1);b.registerCommandContribution(f,"eclipse.compareWith",6,"orion.commonNavContextMenuEditGroup");b.registerCommandContribution(f,"eclipse.compareWithEachOther",7,"orion.commonNavContextMenuEditGroup");b.registerCommandContribution(f,"orion.import",1,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");
b.registerCommandContribution(f,"orion.importZipURL",2,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");b.registerCommandContribution(f,"orion.importSFTP",3,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");b.registerCommandContribution(f,"eclipse.downloadSingleFile",1,"orion.commonNavContextMenuEditGroup/orion.ExportGroup");b.registerCommandContribution(f,"eclipse.downloadFile",2,"orion.commonNavContextMenuEditGroup/orion.ExportGroup");b.registerCommandContribution(f,"eclipse.exportSFTPCommand",
3,"orion.commonNavContextMenuEditGroup/orion.ExportGroup");b.addCommandGroup(e,"eclipse.openWith",1E3,m.OpenWith,"orion.menuBarViewGroup",null,null,null,"dropdownSelection");b.addCommandGroup(e,"eclipse.fileCommandExtensions",1E3,m.OpenRelated,"orion.menuBarViewGroup");h.getOpenWithCommands(b).forEach(function(a){b.registerCommandContribution(e,a.id,1,"orion.menuBarViewGroup/eclipse.openWith");b.registerCommandContribution(f,a.id,1,"orion.commonNavContextMenuEditGroup/orion.OpenWith")});h.getFileCommandIds().forEach(function(a){b.registerCommandContribution(e,
a,1,"orion.menuBarViewGroup/eclipse.fileCommandExtensions");b.registerCommandContribution(f,a,1,"orion.commonNavContextMenuEditGroup/orion.Extensions")});return this.preferences.getPreferences("/common-nav").then(function(e){e=e.get("showNewProjectCommands");if(void 0===e||e){b.addCommandGroup(d,"orion.projectsNewGroup",100,m.Project,"orion.menuBarFileGroup/orion.newContentGroup");b.addCommandGroup(f,"orion.projectsNewGroup",100,m.Project,"orion.commonNavContextMenuEditGroup/orion.New");var h=0;a.getCreateProjectCommands(b).forEach(function(a){b.registerCommandContribution(d,
a.id,h,"orion.menuBarFileGroup/orion.newContentGroup/orion.projectsNewGroup");b.registerCommandContribution(f,a.id,h,"orion.commonNavContextMenuEditGroup/orion.New/orion.projectsNewGroup");h++});b.registerCommandContribution(g,"orion.project.initProject",0,"orion.menuBarEditGroup")}})},updateCommands:function(a){a=this.isCommandsVisible();this.createActionSections();var b=this.commandRegistry,d=this.sidebar.menuBar;d.setActiveExplorer(this);d.updateCommands();b.registerSelectionService(this.contextMenuActionsScope,
a?this.selection:null);this._sidebarContextMenuNode&&this._populateContextMenu(this._sidebarContextMenuNode)},_populateContextMenu:function(a){var b=this.selection.getSelections(),d=null;this.commandRegistry.destroy(a);if(!b||Array.isArray(b)&&!b.length)d=this.treeRoot;this.commandRegistry.renderCommands(this.contextMenuActionsScope,a,d,this,"menu")},_createContextMenu:function(){var a=function(a){var b=this.getNavHandler(),d=this.getNavDict();a=a.event;var g=null;if(a.target){for(var e=a.target;this._parentNode.contains(e);){if("TR"===
e.nodeName){g=d.getValue(e.id);break}e=e.parentNode}if(g&&!b.isDisabled(g.rowDomNode))-1===b.getSelection().indexOf(g.model)&&(b.cursorOn(g.model,!0,!1,!0),b.setSelection(g.model,!1,!0));else if(0<(void 0===a.offsetX?a.layerX:a.offsetX))this.selection.setSelections(null),b.refreshSelection(!0,!0)}}.bind(this),b=new r.ContextMenu({dropdown:this._sidebarContextMenuNode,triggerNode:this._parentNode});b.addEventListener("triggered",a);this._contextMenu=b}});t.prototype=Object.create(x.prototype);n.mixin(t.prototype,
{showFolderLinks:!0,oneColumn:!0,createFolderNode:function(a){var b=x.prototype.createFolderNode.call(this,a);this.showFolderLinks&&"A"===b.tagName?(b.href=C.expand({resource:a.Location}),b.classList.add("commonNavFolder")):b.classList.add("nav_fakelink");return b},rowCallback:function(a,b){x.prototype.rowCallback.call(this,a,b);var g=d.getCutBuffer();g&&g.some(function(a){return d.isEqualToOrChildOf(b,a)})&&this.explorer.getNavHandler().disableItem(b)},emptyCallback:function(){}});return{CommonNavExplorer:z,
CommonNavRenderer:t}});
define("orion/widgets/filesystem/filesystemSwitcher","i18n!orion/edit/nls/messages orion/objects orion/webui/littlelib orion/i18nUtil orion/commands orion/URL-shim".split(" "),function(m,n,p,k,f,l){function e(d){this.commandRegistry=d.commandRegistry;this.rootChangeListener=d.rootChangeListener;this.filesystemChangeDispatcher=d.filesystemChangeDispatcher;this.fileClient=d.fileClient;this.node=d.node;this.serviceRegistry=d.serviceRegistry;var a=this;this.listener=function(d){a.refresh(d.root)};this.rootChangeListener&&
this.rootChangeListener.addEventListener("rootChanged",this.listener);this.render()}n.mixin(e.prototype,{destroy:function(){this.rootChangeListener&&this.rootChangeListener.removeEventListener("rootChanged",this.listener);this.commandRegistry.destroy(this.node);p.empty(this.node);this.rootChangeListener=this.filesystemChangeDispatcher=this.listener=this.node=null},registerCommands:function(){if(!this.commandsRegistered){this.commandsRegistered=!0;var d=this.commandRegistry,a=this.serviceRegistry,
e=new f.Command({name:m.ChooseFS,imageClass:"core-sprite-openarrow",selectionClass:"dropdownSelection",tooltip:m.ChooseFSTooltip,id:"orion.nav.switchfs",visibleWhen:function(b){return 1<a.getServiceReferences("orion.core.file").length},choiceCallback:this._switchFsMenuCallback.bind(this)});d.addCommand(e);d.registerCommandContribution("orion.mininav","orion.nav.switchfs",1)}},_switchFsMenuCallback:function(d){var a=this;return this.serviceRegistry.getServiceReferences("orion.core.file").map(function(d){d=
d.getProperty("top");var b=a._fileServiceLabel(d,!0);return{checked:a.fileSystem===b,name:b,callback:a.setActiveFilesystem.bind(a,d)}})},render:function(){this.fsName=document.createElement("div");this.fsName.classList.add("filesystemName");this.fsName.classList.add("layoutLeft");this.menu=document.createElement("ul");this.menu.classList.add("filesystemSwitcher");this.menu.classList.add("commandList");this.menu.classList.add("layoutRight");this.menu.classList.add("pageActions");this.node.appendChild(this.fsName);
this.node.appendChild(this.menu);this.registerCommands();this.fsName.addEventListener("click",this._openMenu.bind(this))},_openMenu:function(d){if(d=p.$(".dropdownTrigger",this.menu)){var a=document.createEvent("MouseEvents");a.initEvent("click",!0,!0);d.dispatchEvent(a)}},_fileServiceHostname:function(d){d=this.fileClient.fileServiceRootURL(d);0===d.indexOf("filesystem:")&&(d=d.substr(11));var a=d;try{a=(new URL(d,window.location.href)).hostname}catch(e){}return a},_fileServiceLabel:function(d,a){var e=
this.fileClient.fileServiceName(d),b=this._fileServiceHostname(d);if(a)return k.formatMessage(m.FSTitle,e,b);var g=document.createDocumentFragment();g.textContent=m.FSTitle;p.processDOMNodes(g,[document.createTextNode(e),document.createTextNode(b)]);return g},refresh:function(d){var a=d;d.ChildrenLocation&&(a=d.ChildrenLocation);p.empty(this.fsName);this.fileSystem=this._fileServiceLabel(a,!0);this.fsName.appendChild(this._fileServiceLabel(a));this.commandRegistry.destroy(this.menu);this.commandRegistry.renderCommands("orion.mininav",
this.menu,{},"menu")},setActiveFilesystem:function(d){var a=d;d.ChildrenLocation&&(a=d.ChildrenLocation);d=this.fileClient.fileServiceRootURL(a);this.filesystemChangeDispatcher&&this.filesystemChangeDispatcher.dispatchEvent({type:"filesystemChanged",newInput:d})}});return{FilesystemSwitcher:e}});
define("orion/widgets/nav/mini-nav","i18n!orion/edit/nls/messages orion/objects orion/webui/littlelib orion/widgets/nav/common-nav orion/fileCommands orion/PageUtil orion/Deferred orion/widgets/filesystem/filesystemSwitcher orion/URL-shim".split(" "),function(m,n,p,k,f,l,e,d,a){function h(a){u.apply(this,arguments);var b=this.sidebarNavInputManager;if(b){var d=this;this.addEventListener("rootChanged",function(a){d.sidebarNavInputManager.dispatchEvent(a);d.sidebarNavInputManager.dispatchEvent({type:"InputChanged",
input:a.root.ChildrenLocation})});b.setInput=function(a){d.treeRoot&&d.treeRoot.ChildrenLocation!==a&&d.loadRoot(a).then(function(){d.updateCommands();var a=d.editorInputManager.getFileMetadata();d.reveal(a,!1)})}}}function b(){v.apply(this,arguments)}function g(a){this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebar=a.sidebar;
this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.lastRoot=this.explorer=this.fsToolbar=null;var b=this;this.sidebarNavInputManager.addEventListener("InputChanged",function(a){b.lastRoot=a.input})}var u=k.CommonNavExplorer,v=k.CommonNavRenderer;h.prototype=Object.create(u.prototype);n.mixin(h.prototype,{reroot:function(a){this.scope("");return this.loadRoot(this.fileClient.fileServiceRootURL(a.Location)).then(function(){return this.showItem(a,
!1)}.bind(this))}});b.prototype=Object.create(v.prototype);n.mixin(g.prototype,{label:m.Navigator,create:function(){var a=this;this.explorer=new h({preferences:this.preferences,commandRegistry:this.commandRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,sidebar:this.sidebar,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,rendererFactory:function(d){return new b({checkbox:!1,treeTableClass:"miniNavTreeTable",cachePrefix:"MiniNav"},d,a.commandRegistry,
a.contentTypeRegistry)},serviceRegistry:this.serviceRegistry,toolbarNode:this.toolbarNode});this.fsSwitcher=new d.FilesystemSwitcher({commandRegistry:this.commandRegistry,rootChangeListener:this.explorer,filesystemChangeDispatcher:this.explorer.sidebarNavInputManager,fileClient:this.fileClient,node:this.toolbarNode,serviceRegistry:this.serviceRegistry});var g=l.matchResourceParameters(),e=g.resource,g=g.navigate||this.lastRoot||this.fileClient.fileServiceRootURL(e||"");this.explorer.display(g)},destroy:function(){this.explorer&&
(this.explorer.destroy(),this.explorer=null);this.fsSwitcher&&this.fsSwitcher.destroy()}});return g});
define("orion/projectClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/extensionCommands"],function(m,n,p){function k(f){try{return f?JSON.parse(f):{}}catch(e){return{__TEXT__:String(f)}}}function f(f,e){this.serviceRegistry=f;this.fileClient=e;this.allProjectHandlersReferences=f.getServiceReferences("orion.project.handler");this.allProjectDeployReferences=f.getServiceReferences("orion.project.deploy");this._serviceRegistration=f.registerService("orion.project.client",this);this._launchConfigurationsDir=
"launchConfigurations"}f.prototype={_getProjectJsonData:function(f,e,d){for(var a=new n,h=0;h<e.length;h++)if("project.json"===e[h].Name)return this.fileClient.read(e[h].Location).then(function(b){var g=k(b);g.Name=g.Name||f.Name;g.ContentLocation=f.Location;g.WorkspaceLocation=d.Location;var u;d.Children.some(function(a){return a.Location===f.Location?(u=a.Id,!0):!1});d.Projects&&d.Projects.some(function(a){return a.Id===u?(g.ProjectLocation=a.Location,!0):!1});g.ProjectJsonLocation=e[h].Location;
a.resolve(g)},function(b){a.reject(b)},function(b){a.progress(b)}),a;a.resolve(null);return a},readAllProjects:function(f){var e=new n;if(!f.Children)return e.resolve([]),e;for(var d=[],a=[],h=0;h<f.Children.length;h++){var b=new n;this.readProject(f.Children[h],f).then(b.resolve,function(a){this.resolve(null)}.bind(b));a.push(b);b.then(function(a){a&&d.push(a)})}n.all(a).then(function(){e.resolve(d)});return e},readProject:function(f,e){function d(b,d,e){if(b.Parents&&0<b.Parents.length){var h=b.Parents[b.Parents.length-
1];h.Children?a._getProjectJsonData.bind(a)(h,h.Children,d).then(e.resolve,e.reject,e.progress):h.ChildrenLocation?this.fileClient.fetchChildren(h.ChildrenLocation).then(function(b){a._getProjectJsonData.bind(a)(h,b,d).then(e.resolve,e.reject,e.progress)},e.reject,e.progress):e.resolve(null)}else b.Children?a._getProjectJsonData.bind(a)(b,b.Children,d).then(e.resolve,e.reject,e.progress):b.ChildrenLocation?this.fileClient.fetchChildren(b.ChildrenLocation).then(function(h){a._getProjectJsonData.bind(a)(b,
h,d).then(e.resolve,e.reject,e.progress)},e.reject,e.progress):e.resolve(null);return e}var a=this,h=new n;e?d.call(a,f,e,h):this.fileClient.loadWorkspace().then(function(b){d.call(a,f,b,h)});return h},initProject:function(f,e){var d=this,a=new n;this.fileClient.createFile(f,"project.json").then(function(h){e?d.fileClient.write(h.Location,JSON.stringify(e)).then(function(){a.resolve({ContentLocation:f,projectMetadata:e})},a.reject,a.progress):a.resolve({fileMetadata:h})},a.reject,a.progress);return a},
createProject:function(f,e){var d=new n;this.fileClient.createProject(f,e.Name,e.ContentLocation,!0).then(function(a){delete e.Name;d.resolve(this.initProject(a.ContentLocation,e))}.bind(this),function(a){d.reject(a)},function(a){d.progress(a)});return d},getDependencyFileMetadata:function(f,e){function d(b,g){this.fileClient.fetchChildren(b).then(function(b){for(var e=0;e<b.length;e++)if(b[e].Name===g[0]){1===g.length?a.resolve(b[e]):d.bind(h)(b[e].ChildrenLocation,g.splice(1,g.length-1));return}a.reject(f.Location+
" could not be found in your workspace")},function(b){a.reject(b)})}var a=new n,h=this;if("file"===f.Type){var b=f.Location.split("/");this.fileClient.loadWorkspace(e).then(function(g){for(var e=0;e<g.Children.length;e++)if(g.Children[e].Name===b[0]){1===b.length?a.resolve(g.Children[e]):d.bind(h)(g.Children[e].ChildrenLocation,b.splice(1,b.length-1));return}a.reject(f.Location+" could not be found in your workspace")},function(b){a.reject(b)})}else{var g=this.getProjectHandler(f.Type);if(null===
g)return a.reject(f.Type+" is not supported."),a;var k;g.validationProperties&&(k=p._makeValidator(g,this.serviceRegistry,[]));this.fileClient.loadWorkspace(e).then(function(b){for(var d=[],e=!1,h=0;h<b.Children.length&&!0!==e;h++)if(k&&k.validationFunction(b.Children[h])){var m=g.getDependencyDescription(b.Children[h]);d.push(m);(function(d,g){g.then(function(g){g&&g.Location===f.Location&&(e=!0,a.resolve(b.Children[d]))})})(h,m)}n.all(d).then(function(){e||a.reject(f.Name+" could not be found in your workspace")})},
a.reject)}return a},addProjectDependency:function(f,e){var d=new n;this.fileClient.fetchChildren(f.ContentLocation).then(function(a){for(var h=0;h<a.length;h++)if("project.json"===a[h].Name){this.fileClient.read(a[h].Location).then(function(b){try{var g=k(b);g.Dependencies||(g.Dependencies=[]);for(b=0;b<g.Dependencies.length;b++)if(g.Dependencies[b].Location===e.Location){d.resolve(g);return}g.Dependencies.push(e);this.fileClient.write(a[h].Location,JSON.stringify(g)).then(function(){g.ContentLocation=
f.ContentLocation;g.Name=f.Name;d.resolve(g)},d.reject);d.resolve(g)}catch(m){d.reject(m)}}.bind(this),d.reject,d.progress);break}}.bind(this),d.reject);return d},removeProjectDependency:function(f,e){var d=new n;this.fileClient.fetchChildren(f.ContentLocation).then(function(a){for(var h=0;h<a.length;h++)if("project.json"===a[h].Name){this.fileClient.read(a[h].Location).then(function(b){try{var g=k(b);g.Dependencies||(g.Dependencies=[]);for(var m=g.Dependencies.length-1;0<=m;m--)g.Dependencies[m].Location===
e.Location&&g.Dependencies[m].Type===e.Type&&g.Dependencies.splice(m,1);this.fileClient.write(a[h].Location,JSON.stringify(g)).then(function(){g.ContentLocation=f.ContentLocation;g.Name=f.Name;d.resolve(g)},d.reject)}catch(v){d.reject(v)}}.bind(this),d.reject,d.progress);break}}.bind(this),d.reject);return d},changeProjectProperties:function(f,e){function d(d){this.fileClient.read(d).then(function(b){try{var g=k(b),m;for(m in e)g[m]=e[m];this.fileClient.write(d,JSON.stringify(g)).then(function(){g.ContentLocation=
f.ContentLocation;g.ProjectJsonLocation=d;g.Name=f.Name;a.resolve(g)},a.reject)}catch(v){a.reject(v)}}.bind(this),a.reject)}if(e){var a=new n;f.ProjectJsonLocation&&d.bind(this)(f.ProjectJsonLocation);return a}},getProjectHandlerTypes:function(){for(var f=[],e=0;e<this.allProjectHandlersReferences.length;e++)f.push(this.allProjectHandlersReferences[e].getProperty("type"));return f},_getProjectDeployService:function(f){var e=this.serviceRegistry.getService(f);e.id=f.getProperty("id");e.name=f.getProperty("name");
e.tooltip=f.getProperty("tooltip");e.parameters=f.getProperty("parameters");e.optionalParameters=f.getProperty("optionalParameters");e.validationProperties=f.getProperty("validationProperties");e.logLocationTemplate=f.getProperty("logLocationTemplate");return e},matchesDeployService:function(f,e){return p._makeValidator(e,this.serviceRegistry,[]).validationFunction(f)},getProjectDeployTypes:function(){for(var f=this.allProjectDeployReferences.sort(function(a,d){var b=a.getProperty("priorityForDefault")||
0,g=d.getProperty("priorityForDefault")||0;return b>g?-1:b<g?1:0}),e=[],d=0;d<f.length;d++)e.push(f[d].getProperty("id"));return e},getProjectDelpoyService:function(f,e){for(var d=0;d<this.allProjectDeployReferences.length;d++)if(this.allProjectDeployReferences[d].getProperty("id")===f)return this._getProjectDeployService(this.allProjectDeployReferences[d]);if(e)for(d=0;d<this.allProjectDeployReferences.length;d++){var a=this.allProjectDeployReferences[d].getProperty("deployTypes");if(a&&a.some(function(a){return e===
a}))return this._getProjectDeployService(this.allProjectDeployReferences[d])}},_getProjectHandlerService:function(f){var e=this.serviceRegistry.getService(f);e.id=f.getProperty("id");e.addParameters=f.getProperty("addParameters")||f.getProperty("addParamethers");e.optionalParameters=f.getProperty("optionalParameters")||f.getProperty("optionalParamethers");e.addDependencyName=f.getProperty("addDependencyName");e.addDependencyTooltip=f.getProperty("addDependencyTooltip");e.type=f.getProperty("type");
e.actionComment=f.getProperty("actionComment");e.addProjectName=f.getProperty("addProjectName");e.addProjectTooltip=f.getProperty("addProjectTooltip");e.validationProperties=f.getProperty("validationProperties");return e},getProjectHandler:function(f){for(var e=0;e<this.allProjectHandlersReferences.length;e++)if(this.allProjectHandlersReferences[e].getProperty("type")===f)return this._getProjectHandlerService(this.allProjectHandlersReferences[e])},getMatchingProjectHandlers:function(f){for(var e=
[],d=0;d<this.allProjectHandlersReferences.length;d++)p._makeValidator(this.allProjectHandlersReferences[d]._properties,this.serviceRegistry,[]).validationFunction(f)&&e.push(this._getProjectHandlerService(this.allProjectHandlersReferences[d]));return e},_getLaunchConfigurationsDir:function(f,e){var d=new n;f.ContentLocation?this.fileClient.fetchChildren(f.ContentLocation).then(function(a){for(var h=0;h<a.length;h++)if(a[h].Name&&a[h].Name===this._launchConfigurationsDir)return d.resolve(a[h]),d;
e?this.fileClient.createFolder(f.ContentLocation,this._launchConfigurationsDir).then(d.resolve,d.reject):d.resolve(null)}.bind(this),d.reject):d.reject();return d},getProjectLaunchConfigurations:function(f){var e=new n;this._getLaunchConfigurationsDir(f).then(function(d){if(!d)return e.resolve([]),e;if(d.Children){for(var a=[],h=0;h<d.Children.length;h++){var b=new n;a.push(b);(function(a){this.fileClient.read(d.Children[h].Location).then(function(b){try{b=JSON.parse(b),b.Name=b.Name||d.Name.replace(".launch",
""),b.project=f,a.resolve(b)}catch(g){console.error(g),a.resolve()}}.bind(this),function(b){console.error(b);a.resolve()})}).call(this,b)}n.all(a).then(function(a){if(!a||!a.length)e.resolve([]);else{for(var b=a.length-1;0<=b;b--)a[b]||a.splice(b,1);e.resolve(a)}},e.reject)}else{var g=arguments.callee.bind(this);this.fileClient.fetchChildren(d.ChildrenLocation).then(function(a){d.Children=a;g(d)}.bind(this),e.reject)}}.bind(this),e.reject);return e},saveProjectLaunchConfiguration:function(f,e,d,a,
h,b,g,k,m){var q=new n,r=e,r=r.replace(/\ /g," "),r=r.replace(/[^\w\d\s]/g,"");0>r.indexOf(".launch")&&(r+=".launch");var p={Name:e,ServiceId:d,Params:a,Url:h,ManageUrl:b,Path:g};k&&(p.UrlTitle=k);m&&(p.Type=m);this._getLaunchConfigurationsDir(f,!0).then(function(a){if(a.Children){for(var b=0;b<a.Children.length;b++)if(a.Children[b].Name===r){this.fileClient.write(a.Children[b].Location,JSON.stringify(p)).then(function(){q.resolve(p)},q.reject);return}this.fileClient.createFile(a.Location,r).then(function(a){this.fileClient.write(a.Location,
JSON.stringify(p)).then(function(){q.resolve(p)},q.reject)}.bind(this),q.reject)}else{var d=arguments.callee.bind(this);this.fileClient.fetchChildren(a.ChildrenLocation).then(function(b){a.Children=b;d(a)}.bind(this),q.reject)}}.bind(this));return q}};f.prototype.constructor=f;return{ProjectClient:f}});
define("orion/widgets/nav/project-nav","i18n!orion/edit/nls/messages orion/commands orion/objects orion/webui/littlelib orion/explorers/explorer-table orion/widgets/nav/common-nav orion/projectCommands orion/PageUtil orion/URITemplate orion/Deferred orion/projectClient".split(" "),function(m,n,p,k,f,l,e,d,a,h,b){function g(a,b,d,g,e,h,f,l){this.projectClient=f;this.project=b;this.fileMetadata=l;t.apply(this,arguments)}function u(a){this.projectClient=a.projectClient;r.apply(this,arguments);var b=
this;this.dependenciesDisplatcher=e.getDependencyDispatcher();this.dependneciesListener=function(a){b.changedItem.call(b)};this._dependenciesEventTypes=["create","delete"];this._dependenciesEventTypes.forEach(function(a){b.dependenciesDisplatcher.addEventListener(a,b.dependneciesListener)})}function v(){z.apply(this,arguments)}function q(a){function b(a){d.lastCheckedLocation!==a.Location&&(d.lastCheckedLocation=a.Location,a&&(a.Directory&&(a.parent&&a.parent.Projects||a.Parents&&0===a.Parents.length))&&
d.getProjectJson(a).then(function(b){b&&(d.showViewMode(!0),g.getActiveViewModeId()===d.id?d.explorer.display(a):(d.project=a,g.setViewMode(d.id)))}))}this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.projectClient=
this.serviceRegistry.getService("orion.project.client");this.sidebar=a.sidebar;this.explorer=null;var d=this,g=this.sidebar;this.editorInputManager.addEventListener("InputChanged",function(a){b(a.metadata)});this.sidebarNavInputManager.addEventListener("linkClick",function(a){b(a.item)});this.sidebarNavInputManager.addEventListener("itemExpanded",function(a){b(a.item)});this.sidebarNavInputManager.addEventListener("selectionChanged",function(a){if(g.getActiveViewModeId()!==d.id){d.project=null;var b=
a.selections&&0<a.selections.length?a.selections[0]:null;if(b){for(;b.parent&&b.parent.parent;)b=b.parent;d.getProjectJson(b).then(function(a){d.project=b;d.showViewMode(!!a)})}else d.showViewMode(!1)}})}var r=l.CommonNavExplorer,z=l.CommonNavRenderer,t=f.FileModel,w=new a("#{,resource,params*}");g.prototype=Object.create(t.prototype);p.mixin(g.prototype,{processParent:function(a,b){var d=t.prototype.processParent.call(this,a,b);a.Project||(a.Project=this.project);for(var g=0;g<b.length;g++)b[g].Project=
this.project;return d},getChildren:function(a,b){if(a.children)b(this.processParent(a,a.children));else if("Project"===a.type){var d=[];this.fileMetadata.type="ProjectRoot";d.push(this.fileMetadata);h.all((a.Dependencies||[]).map(function(b){var g={Dependency:b,Project:a};d.push(g);return this.projectClient.getDependencyFileMetadata(b,a.WorkspaceLocation).then(function(a){p.mixin(g,a)},function(a){g.Directory=g.disconnected=!0})}.bind(this))).then(function(){this.processParent(a,d);d.splice(d.indexOf(this.fileMetadata),
1);d.splice(0,0,this.fileMetadata);b(d)}.bind(this))}else return t.prototype.getChildren.call(this,a,b)},getId:function(a){"Project"===a.type?a={Location:a.ContentLocation}:a.Dependency&&a.disconnected&&(a=a.Dependency);return t.prototype.getId.call(this,a)},hasChildren:function(){return!0}});u.prototype=Object.create(r.prototype);p.mixin(u.prototype,{onFileModelChange:function(a){var b=a.newValue;a.oldValue.ChildrenLocation===this.treeRoot.ContentLocation?this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",
parent:b?b.ChildrenLocation||b.ContentLocation:null,newInput:b?b.ChildrenLocation||b.ContentLocation:null}):r.prototype.onFileModelChange.call(this,a)},display:function(a,b){if(a){this.fileMetadata=a;var d;a&&a.Parents&&0===a.Parents.length?d=a:a&&a.Parents&&(d=a.Parents[a.Parents.length-1]);if(b||!(d&&d.Location===this.projectLocation))return this.projectClient.readProject(a).then(function(g){this.projectLocation=d?d.Location:null;g.type="Project";g.Directory=!0;g.fileMetadata=a;return r.prototype.display.call(this,
g,b).then(function(){return this.expandItem(a)}.bind(this))}.bind(this))}},loadResourceList:function(a,b,d){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);this.treeRoot&&a===this.treeRoot.ContentLocation?this.display(this.fileMetadata,!0):this.scopeUp()},createModel:function(){return new g(this.registry,this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders,this.projectClient,this.fileMetadata)},reroot:function(a){this.scopeUp(a.Location);return(new h).reject()},
createDefaultDeployCommand:function(){var a=this;this.deployCommand=new n.Command({name:m.Deploy,tooltip:a.defaultDeployCommand?a.defaultDeployCommand.tooltip?a.defaultDeployCommand.tooltip:a.defaultDeployCommand.name:m.Deploy,id:"orion.project.deploy.default",visibleWhen:function(){return a.defaultDeployCommand&&a.defaultDeployCommand.visibleWhen.apply(a.defaultDeployCommand,arguments)},callback:function(b){return a.defaultDeployCommand.callback(b)}});var b=this.commandRegistry;b.addCommand(this.deployCommand);
b.registerCommandContribution(this.additionalActionsScope,this.deployCommand.id,0)},registerCommands:function(){return r.prototype.registerCommands.call(this).then(function(){var a=this.commandRegistry,b=this.fileActionsScope,d=this.additionalActionsScope;a.registerCommandContribution("dependencyCommands","orion.project.dependency.connect",1);a.registerCommandContribution("dependencyCommands","orion.project.dependency.disconnect",2);a.registerCommandContribution(b,"orion.project.create.readme",5,
"orion.menuBarFileGroup/orion.newContentGroup");var g=0;a.addCommandGroup(b,"orion.newDependency",6,m.Dependency,"orion.menuBarFileGroup/orion.newContentGroup");e.getAddDependencyCommands(a).forEach(function(d){a.registerCommandContribution(b,d.id,g++,"orion.menuBarFileGroup/orion.newContentGroup/orion.newDependency")});a.addCommandGroup(d,"orion.deployNavGroup",1E3,m["Deploy As"],null,null,null,m["Deploy As"],"dropdownSelection");if((this.deployCommands=e.getDeployProjectCommands(a))&&0<this.deployCommands.length)this.defaultDeployCommand=
this.deployCommands[0],g=0,this.deployCommands.forEach(function(b){a.registerCommandContribution(d,b.id,g++,"orion.deployNavGroup")});this.createDefaultDeployCommand()}.bind(this))},updateCommands:function(a){if(this.treeRoot&&this.treeRoot.Project&&"undefined"===typeof this.treeRoot.Project.launchConfigurations){this.treeRoot.Project.launchConfigurations=[];var b=function(a,b){var d;if(this.launchCommands)for(d=0;d<this.launchCommands.length;d++)this.commandRegistry.unregisterCommandContribution(this.additionalActionsScope,
this.launchCommands[d]);this.treeRoot.Project.launchConfigurations=a;this.launchCommands=[];e.updateProjectNavCommands(this.treeRoot,a,this.commandRegistry,this.projectClient,this.fileClient);var g;for(d=0;d<a.length;d++)g="orion.launchConfiguration.deploy."+a[d].ServiceId+a[d].Name,this.launchCommands.push(g),this.commandRegistry.registerCommandContribution(this.additionalActionsScope,g,d+1,"orion.deployNavGroup/orion.deployLaunchConfigurationGroup");if(d=e.getDefaultLaunchCommand(this.treeRoot.Project.Name))this.defaultDeployCommand=
this.commandRegistry.findCommand(d)||this.deployCommands[0],this.deployCommand.tooltip=this.defaultDeployCommand.tooltip?this.defaultDeployCommand.tooltip:this.defaultDeployCommand.name;r.prototype.updateCommands.apply(this,b)};this.projectClient.getProjectLaunchConfigurations(this.treeRoot.Project).then(function(d){b.apply(this,[d,a]);if(!this.launchConfigurationListener){var g=this;this.launchConfigurationDispatcher=e.getLaunchConfigurationDispatcher();this.launchConfigurationListener=function(d){if("changedDefault"===
d.type){var h=e.getDefaultLaunchCommand(g.treeRoot.Project.Name);h&&(g.defaultDeployCommand=g.commandRegistry.findCommand(h),g.deployCommand.tooltip=g.defaultDeployCommand.tooltip?g.defaultDeployCommand.tooltip:g.defaultDeployCommand.name,r.prototype.updateCommands.apply(g,a))}else g.selection.getSelections(function(a){if(d.oldValue)for(var e=0;e<g.treeRoot.Project.launchConfigurations.length;e++){var h=g.treeRoot.Project.launchConfigurations[e];if(h.Name===d.oldValue.Name&&h.ServiceId===d.oldValue.ServiceId){if(d.newValue){g.treeRoot.Project.launchConfigurations[e]=
d.newValue;b.apply(g,[g.treeRoot.Project.launchConfigurations,a]);return}g.treeRoot.Project.launchConfigurations[e].splice(e,1);break}}d.newValue&&g.treeRoot.Project.launchConfigurations.push(d.newValue);b.apply(g,[g.treeRoot.Project.launchConfigurations])})};this._launchConfigurationEventTypes=["create","delete","changedDefault"];this._launchConfigurationEventTypes.forEach(function(a){g.launchConfigurationDispatcher.addEventListener(a,g.launchConfigurationListener)})}}.bind(this),function(b){console.error(b);
r.prototype.updateCommands.apply(this,a)}.bind(this))}else r.prototype.updateCommands.apply(this,a)},scopeDown:!1,scopeUp:function(){var a=d.matchResourceParameters(),b=a.resource;delete a.navigate;delete a.resource;window.location.href=w.expand({resource:b,params:a});this.sidebar.setViewMode("nav")},changedItem:function(a,b){return!a||!this.model?this.display(this.fileMetadata,!0):a.Projects?(new h).resolve():r.prototype.changedItem.call(this,a,b)},destroy:function(){if(this.launchCommands)for(var a=
0;a<this.launchCommands.length;a++)this.commandRegistry.unregisterCommandContribution(this.additionalActionsScope,this.launchCommands[a],"orion.deployNavGroup/orion.deployLaunchConfigurationGroup");var b=this;this._dependenciesEventTypes.forEach(function(a){b.dependenciesDisplatcher.removeEventListener(a,b.dependneciesListener)});b.launchConfigurationListener&&this._launchConfigurationEventTypes.forEach(function(a){b.launchConfigurationDispatcher.removeEventListener(a,b.launchConfigurationListener)});
r.prototype.destroy.call(this)}});v.prototype=Object.create(z.prototype);p.mixin(v.prototype,{getCellElement:function(a,b,d){d=z.prototype.getCellElement.call(this,a,b,d);if((b.Dependency||"ProjectRoot"===b.type)&&0===a){d.className="ProjectRoot"===b.type?"projectNavColumn projectPrimaryNavColumn":"projectNavColumn";k.$(".mainNavColumn",d).classList.add("projectInformationNode");a=b.Dependency?b.Dependency.Name:b.Project?b.Project.Name:b.Name;var g=k.$("a",d);b.disconnected&&(a+=" "+m.disconnected,
g.removeAttribute("href"));k.empty(g);g.appendChild(document.createTextNode(a));b.Dependency&&(a=document.createElement("span"),a.className="mainNavColumn",a.style.cssFloat="right",this.explorer.commandRegistry.renderCommands("dependencyCommands",a,b,this,"tool"),d.appendChild(a))}return d}});p.mixin(q.prototype,{label:m.Project,id:"project",create:function(){var a=this;this.explorer=new u({preferences:this.preferences,commandRegistry:this.commandRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,
sidebar:this.sidebar,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,projectClient:this.projectClient,rendererFactory:function(b){return new v({checkbox:!1,treeTableClass:"miniNavTreeTable",cachePrefix:"ProjectNav"},b,a.commandRegistry,a.contentTypeRegistry)},serviceRegistry:this.serviceRegistry,toolbarNode:this.toolbarNode});this.explorer.display(this.project);this.sidebar.hideToolbar()},destroy:function(){this.explorer&&this.explorer.destroy();this.explorer=null;this.sidebar.showToolbar()},
getProjectJson:function(a){function b(a){for(var d=0;d<a.length;d++)if(!a[d].Directory&&"project.json"===a[d].Name)return a[d];return null}var d=new h;a.Children||a.children?d.resolve(b(a.Children||a.children)):a.ChildrenLocation&&this.fileClient.fetchChildren(a.ChildrenLocation).then(function(g){a.Children=g;d.resolve(b(g))});return d},showViewMode:function(a){var b=this.sidebar;!!b.getViewMode(this.id)!==a&&(a?b.addViewMode(this.id,this):b.removeViewMode(this.id),b.renderViewModeMenu())}});return q});
define("orion/sidebar","orion/Deferred orion/objects orion/commands orion/outliner orion/webui/littlelib orion/PageUtil orion/widgets/nav/mini-nav orion/widgets/nav/project-nav orion/globalCommands i18n!orion/edit/nls/messages".split(" "),function(m,n,p,k,f,l,e,d,a,h){function b(a){this.params=a;this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.outlineService=
a.outlineService;this.parentNode=f.node(a.parent);this.toolbarNode=f.node(a.toolbar);this.selection=a.selection;this.serviceRegistry=a.serviceRegistry;this.sidebarNavInputManager=a.sidebarNavInputManager;this.menuBar=a.menuBar;this.viewModes={};this.activeViewMode=null;this.switcherScope=a.switcherScope;this.switcherNode=null}n.mixin(b.prototype,{defaultViewMode:"nav",show:function(){if(!this.created){this.created=!0;var b=this.commandRegistry,l=this.contentTypeRegistry,m=this.fileClient,q=this.editorInputManager,
r=this.outlineService,n=this.parentNode,t=this.progressService,w=this.selection,A=this.serviceRegistry,x=this.toolbarNode,C=this.switcherNode=f.node(this.switcherScope),s=new p.Command({name:h.SidePanel,imageClass:"core-sprite-outline",selectionClass:"dropdownSelection",tooltip:h.SidePanelTooltip,id:"orion.sidebar.viewmode",visibleWhen:function(b){return(b=a.getMainSplitter())?!b.splitter.isClosed():!0},choiceCallback:this.viewModeMenuCallback.bind(this)});b.addCommand(s);b.registerCommandContribution(C.id,
"orion.sidebar.viewmode",2,"orion.menuBarViewGroup");this.addViewMode("nav",new e({commandRegistry:b,contentTypeRegistry:l,preferences:this.preferences,fileClient:m,editorInputManager:q,parentNode:n,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:A,toolbarNode:x,sidebar:this}));this.projectViewMode=new d({commandRegistry:b,contentTypeRegistry:l,preferences:this.preferences,fileClient:m,editorInputManager:q,parentNode:n,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:A,
toolbarNode:x,sidebar:this});this.outliner=new k.Outliner({parent:n,toolbar:x,serviceRegistry:A,contentTypeRegistry:l,preferences:this.preferences,outlineService:r,commandService:b,selectionService:w,inputManager:q,progressService:t,sidebar:this});this.setViewMode(this.defaultViewMode)}},showToolbar:function(){this.toolbarNode.style.display="block";this.parentNode.classList.remove("toolbarTarget-toolbarHidden")},hideToolbar:function(){this.toolbarNode.style.display="none";this.parentNode.classList.add("toolbarTarget-toolbarHidden")},
viewModeMenuCallback:function(){var a=this,b=this.getActiveViewModeId();return Object.keys(this.viewModes).map(function(d){var e=a.getViewMode(d);return{checked:d===b,name:e.label||d,callback:a.setViewMode.bind(a,d)}})},getActiveViewModeId:function(){return this.activeViewModeId},addViewMode:function(a,b){if(!a)throw Error("Invalid id: "+a);if(!b||"object"!==typeof b)throw Error("Invalid mode: "+b);Object.prototype.hasOwnProperty.call(this.viewModes,a)||(this.viewModes[a]=b)},removeViewMode:function(a){var b=
this.getViewMode(a);b&&"function"===typeof b.destroy&&b.destroy();delete this.viewModes[a]},getViewMode:function(a){return Object.prototype.hasOwnProperty.call(this.viewModes,a)?this.viewModes[a]:null},setViewMode:function(a){var b=this.activeViewMode;b&&"function"===typeof b.destroy&&b.destroy();this.toolbarNode&&this.commandRegistry.destroy(this.toolbarNode);f.empty(this.parentNode);this.activeViewModeId=(b=this.activeViewMode=this.getViewMode(a))?a:null;b&&"function"===typeof b.create&&b.create()},
renderViewModeMenu:function(){var a=this.switcherNode;this.commandRegistry.destroy(a);this.commandRegistry.renderCommands(a.id,a,null,this,"button")}});return b});
define("orion/inputManager","i18n!orion/edit/nls/messages orion/explorers/navigatorRenderer orion/i18nUtil orion/Deferred orion/EventTarget orion/objects orion/PageUtil".split(" "),function(m,n,p,k,f,l,e){function d(a){this._document=a.document||document;this._timeout=a.timeout;a=["keypress","keydown","keyup"];for(var d=function(a){this._resetTimer()}.bind(this),e=0;e<a.length;e++)this._document.addEventListener(a[e],d,!0);f.attach(this)}function a(a,d){if(a){if(!d.Severity){var e=d,h={Severity:"Error",
Message:m.noResponse};if("Cancel"===e.name)d={Severity:"Warning",Message:e.name,Cancel:!0};else{if(0===e.status)h.Cancel=!0;else if(e.responseText){e=e.responseText;try{var f=JSON.parse(e);h.Severity=f.Severity||h.Severity;h.Message=f.Message||h.Message}catch(l){h.Message=e}}else try{h.Message=JSON.stringify(e)}catch(k){}d=h}}a.setProgressResult(d)}else window.console.log(d)}function h(a){f.attach(this);this.serviceRegistry=a.serviceRegistry;this.statusService=a.statusService;this.fileClient=a.fileClient;
this.progressService=a.progressService;this.contentTypeRegistry=a.contentTypeRegistry;this.selection=a.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}d.prototype={_resetTimer:function(){var a=this._document.defaultView||this._document.parentWindow;this._timer&&(a.clearTimeout(this._timer),this._timer=null);-1!==this._timeout&&(this._timer=a.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout))},onIdle:function(a){return this.dispatchEvent(a)},
setTimeout:function(a){this._timeout=a;this._resetTimer()}};l.mixin(h.prototype,{_maybeLoadWorkspace:function(a){var d=this.fileClient;return a===d.fileServiceRootURL(a)?d.loadWorkspace(a).then(function(a){return a.Location}):(new k).resolve(a)},_read:function(a){var d=this.cachedMetadata||n.getClickedItem();if(d&&d.Location===a&&d.Parents&&d.Attributes&&d.ETag)return(new k).resolve(d);var e=this.fileClient,h=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(a).then(function(a){return e.read.apply(e,
[a].concat(h))})},load:function(){var b=this.getInput();if(b){var d=this.fileClient,e=this._parsedLocation.resource,h=this.progressService,f=function(a,b,d){return!h?a:h.progress(a,p.formatMessage(b,d))},l=this.getEditor();if(this._fileMetadata)!this._saving&&(!this._fileMetadata.Directory&&!this._readonly)&&f(d.read(e,!0),m.ReadingMetadata,b).then(function(a){this._fileMetadata&&(this._fileMetadata.Location===a.Location&&this._fileMetadata.ETag!==a.ETag)&&(this._fileMetadata=a,(!l.isDirty()||window.confirm(m.loadOutOfSync))&&
f(d.read(e),m.Reading,b).then(function(a){l.setInput(b,null,a);this._unsavedChanges=[]}.bind(this)))}.bind(this));else{var n=e;if(0===n.indexOf("/gitapi/commit/")){var t=n.indexOf("/file"),w=n.indexOf("?",t);-1===w&&(w=n.length);n=n.substring(t,w);this._readonly=!0}var A=window.setTimeout(function(){A=null;this.reportStatus(p.formatMessage(m.Fetching,b))}.bind(this),800),x=function(){this.reportStatus("");A&&window.clearTimeout(A)}.bind(this),C=function(b){x();var d=null;this.serviceRegistry?d=this.serviceRegistry.getService("orion.page.message"):
this.statusService&&(d=this.statusService);a(d,b);this._setNoInput()}.bind(this);this._acceptPatch=null;f(this._read(n,!0),m.ReadingMetadata,n).then(function(a){a?a.Directory?k.when(a.Children||f(d.fetchChildren(a.ChildrenLocation),m.Reading,b),function(d){x();a.Children=d;this._setInputContents(this._parsedLocation,b,d,a)}.bind(this),C):this._isText(a)?f(d.read(e,!1,!0),m.Reading,b).then(function(d){x();"string"!==typeof d&&(this._acceptPatch=d.acceptPatch,d=d.result);this._setInputContents(this._parsedLocation,
b,d,a)}.bind(this),C):f(d._getService(e).readBlob(e),m.Reading,b).then(function(d){x();this._setInputContents(this._parsedLocation,b,d,a)}.bind(this),C):C({responseText:p.formatMessage(m.ReadingMetadataError,n)})}.bind(this),C)}}},processParameters:function(a){var d=this.getEditor();d&&d.processParameters&&d.processParameters(a)},getAutoLoadEnabled:function(){return this._autoLoadEnabled},getAutoSaveEnabled:function(){return this._autoSaveEnabled},getEditor:function(){return this.editor},getInput:function(){return this._input},
getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var a=this._fileMetadata;return this._readonly||!a||a.Attributes&&a.Attributes.ReadOnly},getContentType:function(){return this._contentType},onFocus:function(a){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()},onChanging:function(a){if(this._getSaveDiffsEnabled()){var d=this._unsavedChanges.length,e=a.removedCharCount,h=a.start,f=a.start+e,l=
0;0===a.addedCharCount?l=-1:0===e&&(l=1);if(0<d&&l===this.previousChangeType){d=this._unsavedChanges[d-1];if(0===e&&h===d.end+d.text.length){d.text+=a.text;return}if(0===a.addedCharCount&&f===d.start){d.start=h;return}}this.previousChangeType=l;this._unsavedChanges.push({start:h,end:f,text:a.text})}},reportStatus:function(a){this.statusReporter?this.statusReporter(a):this.editor&&this.editor.reportStatus(a)},save:function(){function b(a){f===y.getInput()&&(y.getFileMetadata().ETag=a.ETag,e.setInput(f,
null,l,!0));y.reportStatus("");h&&s&&s.setProgressResult({Message:m.Saved,Severity:"Normal"});y.afterSave&&y.afterSave();y._saving=!1}function d(b){y.reportStatus("");a(s,b);y._saving=!1;y._errorSaving=!0}if(!this._saving){var e=this.getEditor();if(e&&e.isDirty()&&!this.getReadOnly()){var h=this._errorSaving;this._saving=!0;var f=this.getInput();this.reportStatus(m["Saving..."]);this.dispatchEvent({type:"Saving",inputManager:this});e.markClean();var l=e.getText(),k=l;if(this._getSaveDiffsEnabled()&&
!this._errorSaving){for(var t=this._unsavedChanges,n=0,A=0;A<t.length;A++)n+=t[A].text.length;l.length>n&&(k={diff:t})}this._unsavedChanges=[];this._errorSaving=!1;var t={ETag:this.getFileMetadata().ETag},x=this._parsedLocation.resource,k=this.fileClient.write(x,k,t),C=this.progressService,s=null;this.serviceRegistry&&(s=this.serviceRegistry.getService("orion.page.message"));C&&(k=C.progress(k,p.formatMessage(m.savingFile,f)));var y=this;k.then(b,function(a){412===a.status?window.confirm(m.saveOutOfSync)?
(a=y.fileClient.write(x,l),C&&(a=C.progress(a,p.formatMessage(m.savingFile,f))),a.then(b,d)):y._saving=!1:d(a)})}}},setAutoLoadEnabled:function(a){this._autoLoadEnabled=a},setAutoSaveTimeout:function(a){this._autoSaveEnabled=-1!==a;this._idle?this._idle.setTimeout(a):(this._idle=new d({document:document,timeout:a}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(a){this._contentType=a},setInput:function(a){if(!this._ignoreInput&&
(a||(a=e.hash()),"string"===typeof a)){var d=this.getEditor();a&&"#"!==a[0]&&(a="#"+a);var h=e.matchResourceParameters(a),f=this._parsedLocation||{};if(d&&d.isDirty()){var l=this._location;if(f.resource!==h.resource)if(this._autoSaveEnabled)this.save();else if(!window.confirm(m.confirmUnsavedChanges)){window.location.hash=l;return}}d=d&&f.editor!==h.editor;this._location=a;this._parsedLocation=h;this._ignoreInput=!0;this.selection&&this.selection.setSelections(a);this._ignoreInput=!1;(a=h.resource)?
a===this._input?d?(this.reportStatus(""),this._setInputContents(h,a,null,this._fileMetadata,this._isText(this._fileMetadata))):this.processParameters(h):(this._input=a,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(a){var d=a.lastIndexOf("/");-1!==d&&(a=a.substring(d+1));this._title=a},setSaveDiffsEnabled:function(a){this._saveDiffsEnabled=a},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&null!==this._acceptPatch&&-1!==this._acceptPatch.indexOf("application/json-patch")},
_unknownContentTypeAsText:function(){return!0},_isText:function(a){a=this.contentTypeRegistry.getFileContentType(a);if(!a)return this._unknownContentTypeAsText();var d=this.contentTypeRegistry.getContentType("text/plain");return this.contentTypeRegistry.isExtensionOf(a,d)},_setNoInput:function(a){a?this.fileClient.loadWorkspace("").then(function(a){this._input=a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=this._fileMetadata=null,this.setContentType(null),
this.dispatchEvent({type:"InputChanged",input:null}))},_setInputContents:function(a,d,e,h,f){var l,k=!1;h?(this._fileMetadata=h,this.setTitle(h.Location||String(h)),this.setContentType(this.contentTypeRegistry.getFileContentType(h)),l=h.Name,k=h.Directory):(this._fileMetadata=null,this.setTitle(d),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),l=this.getTitle());var m=this.getEditor();this._focusListener&&(m&&(m.getTextView&&m.getTextView())&&m.getTextView().removeEventListener("Focus",
this._focusListener),this._focusListener=null);this._changingListener&&(m&&(m.getModel&&m.getModel())&&m.getModel().removeEventListener("Changing",this._changingListener),this._changingListener=null);h={type:"InputChanged",input:a,name:l,title:d,contentType:this.getContentType(),metadata:h,location:window.location,contents:e};this.dispatchEvent(h);this.editor=m=h.editor;k||(m&&(m.getModel&&m.getModel())&&m.getModel().addEventListener("Changing",this._changingListener=this.onChanging.bind(this)),f||
m.setInput(d,null,e),m&&(m.getTextView&&m.getTextView())&&m.getTextView().addEventListener("Focus",this._focusListener=this.onFocus.bind(this)),this._unsavedChanges=[],this.processParameters(a))}});return{handleError:a,InputManager:h}});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(m,n,p){function k(f,l){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(f);this.setLineDelimiter(l)}k.prototype={destroy:function(){},find:function(f){1<this._text.length&&(this._text=[this._text.join("")]);var l=f.string,e=f.regex,d=l,a="",h=f.caseInsensitive;if(d)if(e){if(l=n.parse(d))d=l.pattern,a=l.flags}else d=l.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26"),h&&(d=d.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var b=null,g;if(d){var l=f.reverse,k=f.wrap,e=f.wholeWord,m=f.start||0;f=f.end;var q=null!==f&&void 0!==f;-1===a.indexOf("g")&&(a+="g");-1===a.indexOf("m")&&(a+="m");h&&-1===a.indexOf("i")&&(a+="i");e&&(d="\\b"+d+"\\b");var r=this._text[0],p,t,w=0;q&&(h=m<f?m:f,r=r.substring(h,m<f?f:m),w=h);var A=RegExp(d,a);l?g=function(){var a=null;for(A.lastIndex=0;;){t=A.lastIndex;p=A.exec(r);if(t===A.lastIndex)return null;if(p){if(!(p.index+w<m)){if(!k||a)break;m=r.length+w}a={start:p.index+
w,end:A.lastIndex+w}}else break}a&&(m=a.start);return a}:(q||(A.lastIndex=m),g=function(){for(;;){t=A.lastIndex;p=A.exec(r);if(t===A.lastIndex)break;if(p)return{start:p.index+w,end:A.lastIndex+w};if(!(0!==t&&k))break}return null});b=g()}return{next:function(){var a=b;a&&(b=g());return a},hasNext:function(){return null!==b}}},getCharCount:function(){for(var f=0,l=0;l<this._text.length;l++)f+=this._text[l].length;return f},getLine:function(f,l){var e=this.getLineCount();if(!(0<=f&&f<e))return null;
var d=this._lineOffsets[f];if(f+1<e){e=this.getText(d,this._lineOffsets[f+1]);if(l)return e;for(var d=e.length,a;10===(a=e.charCodeAt(d-1))||13===a;)d--;return e.substring(0,d)}return this.getText(d)},getLineAtOffset:function(f){var l=this.getCharCount();if(!(0<=f&&f<=l))return-1;var e=this.getLineCount();if(f===l)return e-1;var d,a,h=this._lastLineIndex;if(0<=h&&h<e&&(d=this._lineOffsets[h],a=h+1<e?this._lineOffsets[h+1]:l,d<=f&&f<a))return h;for(var b=e,g=-1;1<b-g;)if(h=Math.floor((b+g)/2),d=this._lineOffsets[h],
a=h+1<e?this._lineOffsets[h+1]:l,f<=d)b=h;else if(f<a){b=h;break}else g=h;return this._lastLineIndex=b},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(f,l){var e=this.getLineCount();if(!(0<=f&&f<e))return-1;if(f+1<e){e=this._lineOffsets[f+1];if(l)return e;for(var d=this.getText(Math.max(this._lineOffsets[f],e-2),e),a=d.length,h;10===(h=d.charCodeAt(a-1))||13===h;)a--;return e-(d.length-a)}return this.getCharCount()},
getLineStart:function(f){return!(0<=f&&f<this.getLineCount())?-1:this._lineOffsets[f]},getText:function(f,l){void 0===f&&(f=0);void 0===l&&(l=this.getCharCount());if(f===l)return"";for(var e=0,d=0,a;d<this._text.length;){a=this._text[d].length;if(f<=e+a)break;e+=a;d++}for(var h=e,b=d;d<this._text.length;){a=this._text[d].length;if(l<=e+a)break;e+=a;d++}if(b===d)return this._text[b].substring(f-h,l-e);h=this._text[b].substring(f-h);e=this._text[d].substring(0,l-e);return h+this._text.slice(b+1,d).join("")+
e},onChanging:function(f){return this.dispatchEvent(f)},onChanged:function(f){return this.dispatchEvent(f)},setLineDelimiter:function(f,l){"auto"===f&&(f=void 0,1<this.getLineCount()&&(f=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=f?f:p.platformDelimiter;if(l){var e=this.getLineCount();if(1<e){for(var d=Array(e),a=0;a<e;a++)d[a]=this.getLine(a);this.setText(d.join(this._lineDelimiter))}}},setText:function(f,l,e){void 0===f&&(f="");void 0===l&&(l=0);void 0===e&&(e=
this.getCharCount());if(!(l===e&&""===f)){for(var d=this.getLineAtOffset(l),a=this.getLineAtOffset(e),h=l,b=e-l,g=a-d,k=f.length,m=0,q=this.getLineCount(),r=0,p=0,t=0,n=[];;){-1!==r&&r<=t&&(r=f.indexOf("\r",t));-1!==p&&p<=t&&(p=f.indexOf("\n",t));if(-1===p&&-1===r)break;t=-1!==r&&-1!==p?r+1===p?p+1:(r<p?r:p)+1:-1!==r?r+1:p+1;n.push(l+t);m++}this.onChanging({type:"Changing",text:f,start:h,removedCharCount:b,addedCharCount:k,removedLineCount:g,addedLineCount:m});0===n.length&&(t=this.getLineStart(d),
a=a+1<q?this.getLineStart(a+1):this.getCharCount(),l!==t&&(f=this.getText(t,l)+f,l=t),e!==a&&(f+=this.getText(e,a),e=a));t=k-b;for(a=d+g+1;a<q;a++)this._lineOffsets[a]+=t;if(5E4>n.length)d=[d+1,g].concat(n),Array.prototype.splice.apply(this._lineOffsets,d);else{t=d+1;this._lineOffsets.splice(t,g);for(q=0;q<n.length;q+=5E4)d=[t,0].concat(n.slice(q,Math.min(n.length,q+5E4))),Array.prototype.splice.apply(this._lineOffsets,d),t+=5E4}for(t=q=0;t<this._text.length;){a=this._text[t].length;if(l<=q+a)break;
q+=a;t++}d=q;for(n=t;t<this._text.length;){a=this._text[t].length;if(e<=q+a)break;q+=a;t++}a=this._text[t];l=this._text[n].substring(0,l-d);e=a.substring(e-q);n=[n,t-n+1];l&&n.push(l);f&&n.push(f);e&&n.push(e);Array.prototype.splice.apply(this._text,n);0===this._text.length&&(this._text=[""]);this.onChanged({type:"Changed",start:h,removedCharCount:b,addedCharCount:k,removedLineCount:g,addedLineCount:m})}}};m.EventTarget.addMixin(k.prototype);return{TextModel:k}});
define("orion/editor/undoStack",[],function(){function m(k,f,l,e,d){this.model=k;this.offset=f;this.text=l;this.previousText=e;this.type=d}function n(k){this.owner=k;this.changes=[]}function p(k,f){this.size=void 0!==f?f:100;this.reset();var l=this;this._listener={onChanging:function(d){l._onChanging(d)},onDestroy:function(d){l._onDestroy(d)}};if(k.getModel){var e=k.getModel();e.getBaseModel&&(e=e.getBaseModel());this.model=e;this.setView(k)}else this.shared=!0,this.model=k;this.model.addEventListener("Changing",
this._listener.onChanging)}m.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(k,f){this._doUndoRedo(this.offset,this.previousText,this.text,k,f);return!0},redo:function(k,f){this._doUndoRedo(this.offset,this.text,this.previousText,k,f);return!0},merge:function(k,f,l,e,d){if(e===this.type){if(1===e&&k===
this.offset+this.text.length)return this.text+=f,!0;if(-1===e&&d===this.offset)return this.offset=k,this.previousText=l+this.previousText,!0;if(-1===e&&k===this.offset)return this.previousText+=l,!0}return!1},_doUndoRedo:function(k,f,l,e,d){this.model.setText(f,k,k+l.length);d&&e&&(l=e.getModel(),l!==this.model&&(k=l.mapOffset(k,!0)),e.setSelection(k,k+f.length))}};n.prototype={getRedoChanges:function(){for(var k=[],f=0;f<this.changes.length;f++)k=k.concat(this.changes[f].getRedoChanges());return k},
getUndoChanges:function(){for(var k=[],f=this.changes.length-1;0<=f;f--)k=k.concat(this.changes[f].getUndoChanges());return k},add:function(k){this.changes.push(k)},end:function(k){k&&(this.endSelection=k.getSelection(),this.endCaret=k.getCaretOffset());(k=this.owner)&&k.end&&k.end()},undo:function(k,f){1<this.changes.length&&k&&k.setRedraw(!1);for(var l=this.changes.length-1;0<=l;l--)this.changes[l].undo(k,!1);1<this.changes.length&&k&&k.setRedraw(!0);if(f&&k){var l=this.startSelection.start,e=this.startSelection.end;
k.setSelection(this.startCaret?l:e,this.startCaret?e:l)}(l=this.owner)&&l.undo&&l.undo();return 0<this.changes.length},redo:function(k,f){1<this.changes.length&&k&&k.setRedraw(!1);for(var l=0;l<this.changes.length;l++)this.changes[l].redo(k,!1);(1<this.changes.length,k)&&k.setRedraw(!0);if(f&&k){var l=this.endSelection.start,e=this.endSelection.end;k.setSelection(this.endCaret?l:e,this.endCaret?e:l)}(l=this.owner)&&l.redo&&l.redo();return 0<this.changes.length},merge:function(k,f,l,e,d){var a=this.changes.length;
return 0<a?this.changes[a-1].merge(k,f,l,e,d):!1},start:function(k){k&&(this.startSelection=k.getSelection(),this.startCaret=k.getCaretOffset());(k=this.owner)&&k.start&&k.start()}};p.prototype={destroy:function(){this._onDestroy()},add:function(k){this.compoundChange?this.compoundChange.add(k):(this.stack.splice(this.index,this.stack.length-this.index,k),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--))},markClean:function(){this._commitUndo();if(this.cleanChange=this.stack[this.index-
1])this.cleanChange.type=2},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return 0<this.index},canRedo:function(){return 0<this.stack.length-this.index},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var k=[],f=this.index;f<this.stack.length;f++)k=k.concat(this.stack[f].getRedoChanges());
return k},getUndoChanges:function(){this._commitUndo();for(var k=[],f=this.index;0<=f;f--)k=k.concat(this.stack[f].getUndoChanges());return k},undo:function(){this._commitUndo();var k;k=!1;this._ignoreUndo=!0;do{if(0>=this.index)break;k=this.stack[--this.index]}while(!(k=k.undo(this.view,!0)));this._ignoreUndo=!1;return k},redo:function(){this._commitUndo();var k;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;k=this.stack[this.index++]}while(!k.redo(this.view,!0));this._ignoreUndo=
!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(k){this.view!==k&&(this.view&&k.removeEventListener("Destroy",this._listener.onDestroy),(this.view=k)&&k.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(k){this._commitUndo();k=new n(k);this.add(k);this.compoundChange=k;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(k){(!k||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(k){if(!this._ignoreUndo){var f=k.text,l=k.start,e=k.addedCharCount,d=k.removedCharCount;k=l+d;var a=0;0===e&&1===d?a=-1:1===e&&0===d&&(a=1);e=this.stack.length;d=this.model.getText(l,k);(!(0<e&&this.index===e)||!this.stack[e-1].merge(l,f,d,a,k))&&this.add(new m(this.model,
l,f,d,a))}}};return{UndoStack:p}});
(function(){function m(b){this.tokens=[];this.tokens.links={};this.options=b||a.defaults;this.rules=h.normal;this.options.gfm&&(this.rules=this.options.tables?h.tables:h.gfm)}function n(d,e){this.options=e||a.defaults;this.links=d;this.rules=b.normal;if(!this.links)throw Error("Tokens array requires a `links` property.");this.options.gfm?this.rules=this.options.breaks?b.breaks:b.gfm:this.options.pedantic&&(this.rules=b.pedantic)}function p(a){try{var b=a.replace(/&([#\w]+);/g,function(a,b){b=b.toLowerCase();
if("colon"===b)return":";if("#"===b.charAt(0)){var d="x"===b.charAt(1)?parseInt(b.substring(2),16):parseInt(b.substring(1),10);return String.fromCharCode(d)}return""});if(0===decodeURIComponent(b).replace(/[^\w:]/g,"").toLowerCase().indexOf("javascript:"))return""}catch(d){return""}return a}function k(b){this.tokens=[];this.token=null;this.options=b||a.defaults}function f(a,b){return a.replace(!b?/&(?!#?\w+;)/g:/&/g,"\x26amp;").replace(/</g,"\x26lt;").replace(/>/g,"\x26gt;").replace(/"/g,"\x26quot;").replace(/'/g,
"\x26#39;")}function l(a,b){a=a.source;b=b||"";return function q(d,e){if(!d)return RegExp(a,b);e=e.source||e;e=e.replace(/(^|[^\[])\^/g,"$1");a=a.replace(d,e);return q}}function e(){}function d(a){for(var b=1,d,e;b<arguments.length;b++)for(e in d=arguments[b],d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e]);return a}function a(b,e,h){if(h||"function"===typeof e){h||(h=e,e=null);e&&(e=d({},a.defaults,e));var l=e.highlight,r,p,t=0;try{r=m.lex(b,e)}catch(n){return h(n)}p=r.length;var A=function(a){var b,
d;!0!==a&&delete e.highlight;try{b=k.parse(r,e)}catch(g){d=g}e.highlight=l;return d?h(d):h(null,b)};if(!l||3>l.length)return A(!0);if(!p)return A();for(;t<r.length;t++)(function(a){return"code"!==a.type?--p||A():l(a.text,a.lang,function(b,d){if(null==d||d===a.text)return--p||A();a.text=d;a.escaped=!0;--p||A()})})(r[t])}else try{return e&&(e=d({},a.defaults,e)),k.parse(m.lex(b,e),e)}catch(x){x.message+="\nPlease report this to https://github.com/chjj/marked.";if((e||a.defaults).silent)return"\x3cp\x3eAn error occured:\x3c/p\x3e\x3cpre\x3e"+
f(x.message+"",!0)+"\x3c/pre\x3e";throw x;}}var h={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:e,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:e,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:e,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};h.item=l(h.item,"gm")(/bull/g,h.bullet)();h.list=l(h.list)(/bull/g,h.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();h._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b";h.html=l(h.html)("comment",/\x3c!--[\s\S]*?--\x3e/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,
h._tag)();h.paragraph=l(h.paragraph)("hr",h.hr)("heading",h.heading)("lheading",h.lheading)("blockquote",h.blockquote)("tag","\x3c"+h._tag)("def",h.def)();h.normal=d({},h);h.gfm=d({},h.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});h.gfm.paragraph=l(h.paragraph)("(?!","(?!"+h.gfm.fences.source.replace("\\1","\\2")+"|")();h.tables=d({},h.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});
m.rules=h;m.lex=function(a,b){return(new m(b)).lex(a)};m.prototype.lex=function(a){a=a.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(a,!0)};m.prototype.token=function(a,b){a=a.replace(/^ +$/gm,"");for(var d,e,f,l,k,m,p;a;){if(f=this.rules.newline.exec(a))a=a.substring(f[0].length),1<f[0].length&&this.tokens.push({type:"space"});if(f=this.rules.code.exec(a))a=a.substring(f[0].length),f=f[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",
text:!this.options.pedantic?f.replace(/\n+$/,""):f});else if(f=this.rules.fences.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"code",lang:f[2],text:f[3]});else if(f=this.rules.heading.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"heading",depth:f[1].length,text:f[2],style:"atx"});else if(b&&(f=this.rules.nptable.exec(a))){a=a.substring(f[0].length);k={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/\n$/,
"").split("\n")};for(m=0;m<k.align.length;m++)/^ *-+: *$/.test(k.align[m])?k.align[m]="right":/^ *:-+: *$/.test(k.align[m])?k.align[m]="center":/^ *:-+ *$/.test(k.align[m])?k.align[m]="left":k.align[m]=null;for(m=0;m<k.cells.length;m++)k.cells[m]=k.cells[m].split(/ *\| */);this.tokens.push(k)}else if(f=this.rules.lheading.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"heading",depth:"\x3d"===f[2]?1:2,text:f[1],style:"setext"});else if(f=this.rules.hr.exec(a))a=a.substring(f[0].length),
this.tokens.push({type:"hr"});else if(f=this.rules.blockquote.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"blockquote_start"}),f=f[0].replace(/^ *> ?/gm,""),this.token(f,b),this.tokens.push({type:"blockquote_end"});else if(f=this.rules.list.exec(a)){a=a.substring(f[0].length);l=f[2];this.tokens.push({type:"list_start",ordered:1<l.length});f=f[0].match(this.rules.item);d=!1;p=f.length;for(m=0;m<p;m++)k=f[m],e=k.length,k=k.replace(/^ *([*+-]|\d+\.) +/,""),~k.indexOf("\n ")&&(e-=k.length,
k=!this.options.pedantic?k.replace(RegExp("^ {1,"+e+"}","gm"),""):k.replace(/^ {1,4}/gm,"")),this.options.smartLists&&m!==p-1&&(e=h.bullet.exec(f[m+1])[0],l!==e&&!(1<l.length&&1<e.length)&&(a=f.slice(m+1).join("\n")+a,m=p-1)),e=d||/\n\n(?!\s*$)/.test(k),m!==p-1&&(d="\n"===k[k.length-1],e||(e=d)),this.tokens.push({type:e?"loose_item_start":"list_item_start"}),this.token(k,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(f=this.rules.html.exec(a))a=a.substring(f[0].length),
this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:"pre"===f[1]||"script"===f[1],text:f[0]});else if(b&&(f=this.rules.def.exec(a)))a=a.substring(f[0].length),this.tokens.links[f[1].toLowerCase()]={href:f[2],title:f[3]};else if(b&&(f=this.rules.table.exec(a))){a=a.substring(f[0].length);k={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(m=0;m<k.align.length;m++)/^ *-+: *$/.test(k.align[m])?
k.align[m]="right":/^ *:-+: *$/.test(k.align[m])?k.align[m]="center":/^ *:-+ *$/.test(k.align[m])?k.align[m]="left":k.align[m]=null;for(m=0;m<k.cells.length;m++)k.cells[m]=k.cells[m].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(k)}else if(b&&(f=this.rules.paragraph.exec(a)))a=a.substring(f[0].length),this.tokens.push({type:"paragraph",text:"\n"===f[1][f[1].length-1]?f[1].slice(0,-1):f[1]});else if(f=this.rules.text.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"text",
text:f[0]});else if(a)throw Error("Infinite loop on byte: "+a.charCodeAt(0));}return this.tokens};var b={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:e,tag:/^\x3c!--[\s\S]*?--\x3e|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
br:/^ {2,}\n(?!\s*$)/,del:e,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};b.link=l(b.link)("inside",b._inside)("href",b._href)();b.reflink=l(b.reflink)("inside",b._inside)();b.normal=d({},b);b.pedantic=d({},b.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});b.gfm=d({},b.normal,{escape:l(b.escape)("])","~|])")(),
url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:l(b.text)("]|","~]|")("|","|https?://|")()});b.breaks=d({},b.gfm,{br:l(b.br)("{2,}","*")(),text:l(b.gfm.text)("{2,}","*")()});n.rules=b;n.output=function(a,b,d){return(new n(b,d)).output(a)};n.prototype.output=function(a){for(var b="",d,e;a;)if(e=this.rules.escape.exec(a))a=a.substring(e[0].length),b+=e[1];else if(e=this.rules.autolink.exec(a))a=a.substring(e[0].length),"@"===e[2]?(d=":"===e[1][6]?this.mangle(e[1].substring(7)):
this.mangle(e[1]),e=this.mangle("mailto:")+d):e=d=f(e[1]),b+='\x3ca href\x3d"'+e+'"\x3e'+d+"\x3c/a\x3e";else if(e=this.rules.url.exec(a))a=a.substring(e[0].length),e=d=f(e[1]),b+='\x3ca href\x3d"'+this.options.sanitize?p(e):e+'"\x3e'+d+"\x3c/a\x3e";else if(e=this.rules.tag.exec(a))a=a.substring(e[0].length),b+=this.options.sanitize?f(e[0]):e[0];else if(e=this.rules.link.exec(a))a=a.substring(e[0].length),b+=this.outputLink(e,{href:this.options.sanitize?p(e[2]):e[2],title:e[3]});else if((e=this.rules.reflink.exec(a))||
(e=this.rules.nolink.exec(a)))a=a.substring(e[0].length),d=(e[2]||e[1]).replace(/\s+/g," "),d=this.links[d.toLowerCase()],!d||!d.href?(b+=e[0][0],a=e[0].substring(1)+a):(this.options.sanitize&&(d.href=p(d.href)),b+=this.outputLink(e,d));else if(e=this.rules.strong.exec(a))a=a.substring(e[0].length),b+="\x3cstrong\x3e"+this.output(e[2]||e[1])+"\x3c/strong\x3e";else if(e=this.rules.em.exec(a))a=a.substring(e[0].length),b+="\x3cem\x3e"+this.output(e[2]||e[1])+"\x3c/em\x3e";else if(e=this.rules.code.exec(a))a=
a.substring(e[0].length),b+="\x3ccode\x3e"+f(e[2],!0)+"\x3c/code\x3e";else if(e=this.rules.br.exec(a))a=a.substring(e[0].length),b+="\x3cbr\x3e";else if(e=this.rules.del.exec(a))a=a.substring(e[0].length),b+="\x3cdel\x3e"+this.output(e[1])+"\x3c/del\x3e";else if(e=this.rules.text.exec(a))a=a.substring(e[0].length),b+=f(this.smartypants(e[0]));else if(a)throw Error("Infinite loop on byte: "+a.charCodeAt(0));return b};n.prototype.outputLink=function(a,b){return"!"!==a[0][0]?'\x3ca href\x3d"'+f(b.href)+
'"'+(b.title?' title\x3d"'+f(b.title)+'"':"")+"\x3e"+this.output(a[1])+"\x3c/a\x3e":'\x3cimg src\x3d"'+f(b.href)+'" alt\x3d"'+f(a[1])+'"'+(b.title?' title\x3d"'+f(b.title)+'"':"")+"\x3e"};n.prototype.smartypants=function(a){return!this.options.smartypants?a:a.replace(/--/g,"\u2014").replace(/'([^']*)'/g,"\u2018$1\u2019").replace(/"([^"]*)"/g,"\u201c$1\u201d").replace(/\.{3}/g,"\u2026")};n.prototype.mangle=function(a){for(var b="",d=a.length,e=0,f;e<d;e++)f=a.charCodeAt(e),0.5<Math.random()&&(f="x"+
f.toString(16)),b+="\x26#"+f+";";return b};k.parse=function(a,b){return(new k(b)).parse(a)};k.prototype.parse=function(a){this.inline=new n(a.links,this.options);this.tokens=a.reverse();for(a="";this.next();)a+=this.tok();return a};k.prototype.next=function(){return this.token=this.tokens.pop()};k.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};k.prototype.parseText=function(){for(var a=this.token.text;"text"===this.peek().type;)a+="\n"+this.next().text;return this.inline.output(a)};
k.prototype.tok=function(){switch(this.token.type){case "space":return"";case "hr":return"\x3chr\x3e\n";case "heading":return"\x3ch"+this.token.depth+"\x3e"+this.inline.output(this.token.text)+"\x3c/h"+this.token.depth+"\x3e\n";case "code":if(this.options.highlight){var a=this.options.highlight(this.token.text,this.token.lang);null!=a&&a!==this.token.text&&(this.token.escaped=!0,this.token.text=a)}this.token.escaped||(this.token.text=f(this.token.text,!0));return"\x3cpre\x3e\x3ccode"+(this.token.lang?
' class\x3d"'+this.options.langPrefix+f(this.token.lang)+'"':"")+"\x3e"+this.token.text+"\x3c/code\x3e\x3c/pre\x3e\n";case "table":var b,d,e,h,a="\x3cthead\x3e\n\x3ctr\x3e\n";for(d=0;d<this.token.header.length;d++)b=this.inline.output(this.token.header[d]),a+=this.token.align[d]?'\x3cth align\x3d"'+this.token.align[d]+'"\x3e'+b+"\x3c/th\x3e\n":"\x3cth\x3e"+b+"\x3c/th\x3e\n";a+="\x3c/tr\x3e\n\x3c/thead\x3e\n\x3ctbody\x3e\n";for(d=0;d<this.token.cells.length;d++){b=this.token.cells[d];a+="\x3ctr\x3e\n";
for(h=0;h<b.length;h++)e=this.inline.output(b[h]),a+=this.token.align[h]?'\x3ctd align\x3d"'+this.token.align[h]+'"\x3e'+e+"\x3c/td\x3e\n":"\x3ctd\x3e"+e+"\x3c/td\x3e\n";a+="\x3c/tr\x3e\n"}a+="\x3c/tbody\x3e\n";return"\x3ctable\x3e\n"+a+"\x3c/table\x3e\n";case "blockquote_start":for(a="";"blockquote_end"!==this.next().type;)a+=this.tok();return"\x3cblockquote\x3e\n"+a+"\x3c/blockquote\x3e\n";case "list_start":d=this.token.ordered?"ol":"ul";for(a="";"list_end"!==this.next().type;)a+=this.tok();return"\x3c"+
d+"\x3e\n"+a+"\x3c/"+d+"\x3e\n";case "list_item_start":for(a="";"list_item_end"!==this.next().type;)a+="text"===this.token.type?this.parseText():this.tok();return"\x3cli\x3e"+a+"\x3c/li\x3e\n";case "loose_item_start":for(a="";"list_item_end"!==this.next().type;)a+=this.tok();return"\x3cli\x3e"+a+"\x3c/li\x3e\n";case "html":return!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case "paragraph":return"\x3cp\x3e"+this.inline.output(this.token.text)+"\x3c/p\x3e\n";
case "text":return"\x3cp\x3e"+this.parseText()+"\x3c/p\x3e\n"}};e.exec=e;a.options=a.setOptions=function(b){d(a.defaults,b);return a};a.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1};a.Parser=k;a.parser=k.parse;a.Lexer=m;a.lexer=m.lex;a.InlineLexer=n;a.inlineLexer=n.output;a.parse=a;"object"===typeof exports?module.exports=a:"function"===typeof define&&define.amd?define("marked/marked",[],function(){return a}):
this.marked=a}).call(function(){return this||("undefined"!==typeof window?window:global)}());
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(m,n){function p(f){f&&(this._view=f,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function k(f){p.call(this,f)}p.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(f){for(var l=[],e=this._keyBindings,d=0;d<e.length;d++)e[d].actionID===f&&l.push(e[d].keyBinding);return l},getView:function(){return this._view},isActive:function(){return-1!==this._view.getKeyModes().indexOf(this)},match:function(f){if("keydown"===
f.type)switch(f.keyCode){case 16:case 17:case 18:case 91:return}for(var l=this._keyBindingIndex,e=this._matchingKeyBindings||this._keyBindings,d=[],a=0;a<e.length;a++){var h=e[a],b=h.keyBinding.match(f,l);if(!0===b)return this._keyBindingIndex=0,this._matchingKeyBindings=null,h.actionID;"number"===typeof b&&d.push(h)}if(0===d.length)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=d,"noop"},setKeyBinding:function(f,l){for(var e=this._keyBindings,
d=0;d<e.length;d++){var a=e[d];if(a.keyBinding.equals(f)){l?a.actionID=l:a.predefined?a.actionID="noop":e.splice(d,1);return}}l&&e.push({keyBinding:f,actionID:l})},setView:function(f){this._view=f}};k.prototype=new p;k.prototype.createKeyBindings=function(){var f=m.KeyBinding,l=[];l.push({actionID:"lineUp",keyBinding:new f(38),predefined:!0});l.push({actionID:"lineDown",keyBinding:new f(40),predefined:!0});l.push({actionID:"charPrevious",keyBinding:new f(37),predefined:!0});l.push({actionID:"charNext",
keyBinding:new f(39),predefined:!0});n.isMac?(l.push({actionID:"scrollPageUp",keyBinding:new f(33),predefined:!0}),l.push({actionID:"scrollPageDown",keyBinding:new f(34),predefined:!0}),l.push({actionID:"pageUp",keyBinding:new f(33,null,null,!0),predefined:!0}),l.push({actionID:"pageDown",keyBinding:new f(34,null,null,!0),predefined:!0}),l.push({actionID:"lineStart",keyBinding:new f(37,!0),predefined:!0}),l.push({actionID:"lineEnd",keyBinding:new f(39,!0),predefined:!0}),l.push({actionID:"wordPrevious",
keyBinding:new f(37,null,null,!0),predefined:!0}),l.push({actionID:"wordNext",keyBinding:new f(39,null,null,!0),predefined:!0}),l.push({actionID:"scrollTextStart",keyBinding:new f(36),predefined:!0}),l.push({actionID:"scrollTextEnd",keyBinding:new f(35),predefined:!0}),l.push({actionID:"textStart",keyBinding:new f(38,!0),predefined:!0}),l.push({actionID:"textEnd",keyBinding:new f(40,!0),predefined:!0}),l.push({actionID:"scrollPageUp",keyBinding:new f(38,null,null,null,!0),predefined:!0}),l.push({actionID:"scrollPageDown",
keyBinding:new f(40,null,null,null,!0),predefined:!0}),l.push({actionID:"lineStart",keyBinding:new f(37,null,null,null,!0),predefined:!0}),l.push({actionID:"lineEnd",keyBinding:new f(39,null,null,null,!0),predefined:!0}),l.push({actionID:"lineStart",keyBinding:new f(38,null,null,!0),predefined:!0}),l.push({actionID:"lineEnd",keyBinding:new f(40,null,null,!0),predefined:!0})):(l.push({actionID:"pageUp",keyBinding:new f(33),predefined:!0}),l.push({actionID:"pageDown",keyBinding:new f(34),predefined:!0}),
l.push({actionID:"lineStart",keyBinding:new f(36),predefined:!0}),l.push({actionID:"lineEnd",keyBinding:new f(35),predefined:!0}),l.push({actionID:"wordPrevious",keyBinding:new f(37,!0),predefined:!0}),l.push({actionID:"wordNext",keyBinding:new f(39,!0),predefined:!0}),l.push({actionID:"textStart",keyBinding:new f(36,!0),predefined:!0}),l.push({actionID:"textEnd",keyBinding:new f(35,!0),predefined:!0}));n.isFirefox&&n.isLinux&&(l.push({actionID:"lineUp",keyBinding:new f(38,!0),predefined:!0}),l.push({actionID:"lineDown",
keyBinding:new f(40,!0),predefined:!0}));n.isWindows&&(l.push({actionID:"scrollLineUp",keyBinding:new f(38,!0),predefined:!0}),l.push({actionID:"scrollLineDown",keyBinding:new f(40,!0),predefined:!0}));l.push({actionID:"selectLineUp",keyBinding:new f(38,null,!0),predefined:!0});l.push({actionID:"selectLineDown",keyBinding:new f(40,null,!0),predefined:!0});l.push({actionID:"selectCharPrevious",keyBinding:new f(37,null,!0),predefined:!0});l.push({actionID:"selectCharNext",keyBinding:new f(39,null,!0),
predefined:!0});l.push({actionID:"selectPageUp",keyBinding:new f(33,null,!0),predefined:!0});l.push({actionID:"selectPageDown",keyBinding:new f(34,null,!0),predefined:!0});n.isMac?(l.push({actionID:"selectLineStart",keyBinding:new f(37,!0,!0),predefined:!0}),l.push({actionID:"selectLineEnd",keyBinding:new f(39,!0,!0),predefined:!0}),l.push({actionID:"selectWordPrevious",keyBinding:new f(37,null,!0,!0),predefined:!0}),l.push({actionID:"selectWordNext",keyBinding:new f(39,null,!0,!0),predefined:!0}),
l.push({actionID:"selectTextStart",keyBinding:new f(36,null,!0),predefined:!0}),l.push({actionID:"selectTextEnd",keyBinding:new f(35,null,!0),predefined:!0}),l.push({actionID:"selectTextStart",keyBinding:new f(38,!0,!0),predefined:!0}),l.push({actionID:"selectTextEnd",keyBinding:new f(40,!0,!0),predefined:!0}),l.push({actionID:"selectLineStart",keyBinding:new f(37,null,!0,null,!0),predefined:!0}),l.push({actionID:"selectLineEnd",keyBinding:new f(39,null,!0,null,!0),predefined:!0}),l.push({actionID:"selectLineStart",
keyBinding:new f(38,null,!0,!0),predefined:!0}),l.push({actionID:"selectLineEnd",keyBinding:new f(40,null,!0,!0),predefined:!0})):(n.isLinux&&(l.push({actionID:"selectWholeLineUp",keyBinding:new f(38,!0,!0),predefined:!0}),l.push({actionID:"selectWholeLineDown",keyBinding:new f(40,!0,!0),predefined:!0})),l.push({actionID:"selectLineStart",keyBinding:new f(36,null,!0),predefined:!0}),l.push({actionID:"selectLineEnd",keyBinding:new f(35,null,!0),predefined:!0}),l.push({actionID:"selectWordPrevious",
keyBinding:new f(37,!0,!0),predefined:!0}),l.push({actionID:"selectWordNext",keyBinding:new f(39,!0,!0),predefined:!0}),l.push({actionID:"selectTextStart",keyBinding:new f(36,!0,!0),predefined:!0}),l.push({actionID:"selectTextEnd",keyBinding:new f(35,!0,!0),predefined:!0}));l.push({actionID:"undo",keyBinding:new m.KeyBinding("z",!0),predefined:!0});n.isMac?l.push({actionID:"redo",keyBinding:new m.KeyBinding("z",!0,!0),predefined:!0}):l.push({actionID:"redo",keyBinding:new m.KeyBinding("y",!0),predefined:!0});
l.push({actionID:"deletePrevious",keyBinding:new f(8),predefined:!0});l.push({actionID:"deletePrevious",keyBinding:new f(8,null,!0),predefined:!0});l.push({actionID:"deleteNext",keyBinding:new f(46),predefined:!0});l.push({actionID:"deleteWordPrevious",keyBinding:new f(8,!0),predefined:!0});l.push({actionID:"deleteWordPrevious",keyBinding:new f(8,!0,!0),predefined:!0});l.push({actionID:"deleteWordNext",keyBinding:new f(46,!0),predefined:!0});l.push({actionID:"tab",keyBinding:new f(9),predefined:!0});
l.push({actionID:"shiftTab",keyBinding:new f(9,null,!0),predefined:!0});l.push({actionID:"enter",keyBinding:new f(13),predefined:!0});l.push({actionID:"enter",keyBinding:new f(13,null,!0),predefined:!0});l.push({actionID:"selectAll",keyBinding:new f("a",!0),predefined:!0});l.push({actionID:"toggleTabMode",keyBinding:new f("m",!0),predefined:!0});n.isMac&&(l.push({actionID:"deleteNext",keyBinding:new f(46,null,!0),predefined:!0}),l.push({actionID:"deleteWordPrevious",keyBinding:new f(8,null,null,!0),
predefined:!0}),l.push({actionID:"deleteWordNext",keyBinding:new f(46,null,null,!0),predefined:!0}));l.push({actionID:"toggleWrapMode",keyBinding:new m.KeyBinding("w",!0,!1,!0)});l.push({actionID:"toggleOverwriteMode",keyBinding:new m.KeyBinding(45)});if(!n.isFirefox){var e=n.isMac&&n.isChrome;l.push({actionID:"noop",keyBinding:new f("u",!e,!1,!1,e),predefined:!0});l.push({actionID:"noop",keyBinding:new f("i",!e,!1,!1,e),predefined:!0});l.push({actionID:"noop",keyBinding:new f("b",!e,!1,!1,e),predefined:!0})}n.isFirefox&&
(l.push({actionID:"copy",keyBinding:new f(45,!0),predefined:!0}),l.push({actionID:"paste",keyBinding:new f(45,null,!0),predefined:!0}),l.push({actionID:"cut",keyBinding:new f(46,null,!0),predefined:!0}));n.isMac&&(l.push({actionID:"lineStart",keyBinding:new f("a",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"lineEnd",keyBinding:new f("e",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"lineUp",keyBinding:new f("p",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"lineDown",keyBinding:new f("n",!1,!1,
!1,!0),predefined:!0}),l.push({actionID:"charPrevious",keyBinding:new f("b",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"charNext",keyBinding:new f("f",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"deletePrevious",keyBinding:new f("h",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"deleteNext",keyBinding:new f("d",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"deleteLineEnd",keyBinding:new f("k",!1,!1,!1,!0),predefined:!0}),n.isFirefox?(l.push({actionID:"scrollPageDown",keyBinding:new f("v",!1,
!1,!1,!0),predefined:!0}),l.push({actionID:"deleteLineStart",keyBinding:new f("u",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"deleteWordPrevious",keyBinding:new f("w",!1,!1,!1,!0),predefined:!0})):(l.push({actionID:"pageDown",keyBinding:new f("v",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"centerLine",keyBinding:new f("l",!1,!1,!1,!0),predefined:!0}),l.push({actionID:"enterNoCursor",keyBinding:new f("o",!1,!1,!1,!0),predefined:!0})));return l};return{KeyMode:p,DefaultKeyMode:k}});
define("orion/editor/util",[],function(){return{contains:function(m,n){if(!n)return!1;if(!m.compareDocumentPosition){for(var p=n;p;){if(m===p)return!0;p=p.parentNode}return!1}return m===n||0!==(m.compareDocumentPosition(n)&16)},addEventListener:function(m,n,p,k){"function"===typeof m.addEventListener?m.addEventListener(n,p,!0===k):m.attachEvent("on"+n,p)},removeEventListener:function(m,n,p,k){"function"===typeof m.removeEventListener?m.removeEventListener(n,p,!0===k):m.detachEvent("on"+n,p)},Animation:function(){function m(m){this.options=
m}m.prototype.play=function(){var m="number"===typeof this.options.duration?this.options.duration:350,p=this.options.easing||this.defaultEasing,k=this.options.onAnimate||function(){},f=this.options.curve[0],l=this.options.curve[1],e=l-f,d=-1,a,h=this;this.interval=this.options.window.setInterval(function(){d=-1===d?(new Date).getTime():d;var b=((new Date).getTime()-d)/m;1>b?(b=p(b),a=f+b*e,k(a)):(k(l),h.stop())},"number"===typeof this.options.rate?this.options.rate:20)};m.prototype.stop=function(){this.options.window.clearInterval(this.interval);
(this.options.onEnd||function(){})()};m.prototype.defaultEasing=function(m){return Math.sin(m*(Math.PI/2))};return m}()}});
define("orion/editor/textView","i18n!orion/editor/nls/messages orion/editor/textModel orion/editor/keyModes orion/editor/eventTarget orion/editor/textTheme orion/editor/util orion/util".split(" "),function(m,n,p,k,f,l,e){function d(a,b,d){if(d){b.className="";d=b.attributes;for(var g=d.length;0<g--;)(!e.isIE||9<=e.isIE||9>e.isIE&&d[g].specified)&&b.removeAttribute(d[g].name)}if(a){a.styleClass&&(b.className=a.styleClass);if(d=a.style)for(var f in d)d.hasOwnProperty(f)&&(b.style[f]=d[f]);if(a=a.attributes)for(var h in a)a.hasOwnProperty(h)&&
b.setAttribute(h,a[h])}}function a(a){return a instanceof Array?a.slice(0):a}function h(a,b){if(!a)return b;if(!b)return a;for(var d in b)b.hasOwnProperty(d)&&(a.hasOwnProperty(d)||(a[d]=b[d]));return a}function b(a,d){if(a===d)return!0;if(a&&!d||!a&&d||a&&a.constructor===String||d&&d.constructor===String)return!1;if(a instanceof Array||d instanceof Array){if(!(a instanceof Array&&d instanceof Array)||a.length!==d.length)return!1;for(var e=0;e<a.length;e++)if(!b(a[e],d[e]))return!1;return!0}if(!(a instanceof
Object)||!(d instanceof Object))return!1;for(e in a)if(a.hasOwnProperty(e)&&(!d.hasOwnProperty(e)||!b(a[e],d[e])))return!1;for(e in d)if(!a.hasOwnProperty(e))return!1;return!0}function g(a,b,d){for(var e=0,g=0,f=0,h=a.length;f<h;){-1!==e&&e<=f&&(e=a.indexOf("\r",f));-1!==g&&g<=f&&(g=a.indexOf("\n",f));var l=f,k;if(-1===g&&-1===e){b(a.substring(f));break}-1!==e&&-1!==g?e+1===g?(k=e,f=g+1):(k=e<g?e:g,f=(e<g?e:g)+1):-1!==e?(k=e,f=e+1):(k=g,f=g+1);b(a.substring(l,k));d()}}function u(a){var b,d,e,g,f=
a.ownerDocument.defaultView||a.ownerDocument.parentWindow;f.getComputedStyle?(a=f.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),d=a.getPropertyValue("padding-top"),e=a.getPropertyValue("padding-right"),g=a.getPropertyValue("padding-bottom")):a.currentStyle&&(b=a.currentStyle.paddingLeft,d=a.currentStyle.paddingTop,e=a.currentStyle.paddingRight,g=a.currentStyle.paddingBottom);return{left:parseInt(b,10)||0,top:parseInt(d,10)||0,right:parseInt(e,10)||0,bottom:parseInt(g,10)||0}}function v(a){var b,
d,e,g,f=a._trim;if(!f){var f=u(a),h=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;h.getComputedStyle?(g=h.getComputedStyle(a,null),b=g.getPropertyValue("border-left-width"),d=g.getPropertyValue("border-top-width"),e=g.getPropertyValue("border-right-width"),g=g.getPropertyValue("border-bottom-width")):a.currentStyle&&(b=a.currentStyle.borderLeftWidth,d=a.currentStyle.borderTopWidth,e=a.currentStyle.borderRightWidth,g=a.currentStyle.borderBottomWidth);b=parseInt(b,10)||0;d=parseInt(d,10)||
0;e=parseInt(e,10)||0;g=parseInt(g,10)||0;f.left+=b;f.top+=d;f.right+=e;f.bottom+=g;a._trim=f}return f}function q(a,b,d,e){function g(b){if(b.animationName===h){var d=b.target;"function"===typeof d.__DOMReady&&(a.defaultView||a.parentWindow).setTimeout(function(){d.__DOMReady()},0)}}function f(a,b){for(var d=["","-webkit-","-moz-","-ms-","-o-"],e="",g="body ."+a+" {\n",h=0;h<d.length;h++)e+="@"+d[h]+"keyframes "+b+" {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n",g+=d[h]+"animation-duration: 0.001s;\n"+
d[h]+"animation-name: "+b+";\n";return e+(g+"}")}d="_"+d+"DOMReady";b.className=b.className?b.className+" "+d:d;b.__DOMReady=e;e=d+"Style";if(!a.getElementById(e)){var h=d+"Animation";A(a,"animationstart",g,!1);A(a,"MSAnimationStart",g,!1);A(a,"webkitAnimationStart",g,!1);b=a.createElement("style");b.id=e;e=a.getElementsByTagName("head")[0]||a.documentElement;b.appendChild(a.createTextNode(f(d,h)));e.insertBefore(b,e.firstChild)}}function r(a,b,d){this.start=a;this.end=b;this.caret=d}function z(a){this.left=
a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function t(a,b,d){this.view=a;this.lineIndex=b;this._lineDiv=d}function w(a){this._init(a||{})}var A=l.addEventListener,x=l.removeEventListener,C=l.Animation;r.prototype={clone:function(){return new r(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;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\x3d"+this.start+" end\x3d"+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}};z.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}};
t.prototype={create:function(a,b){if(!this._lineDiv){var d=this._lineDiv=this._createLine(a,b,this.lineIndex);d._line=this;return d}},_createLine:function(a,g,f){var h=this.view,l=h._model,k=l.getLine(f),q=l.getLineStart(f),m={type:"LineStyle",textView:h,lineIndex:f,lineText:k,lineStart:q};h.onLineStyle(m);var u=a.ownerDocument,l=g||e.createElement(u,"div");if(!g||!b(g.viewStyle,m.style))d(m.style,l,g),g&&(g._trim=null),l.viewStyle=m.style,l.setAttribute("role","presentation");l.lineIndex=f;if(g&&
l.viewLineText===k&&b(m.ranges,l.viewRanges))return l;l.viewRanges=m.ranges;l.viewLineText=k;f=[];this._createRanges(m.ranges,k,0,k.length,q,{tabOffset:0,ranges:f});m=" ";!h._fullSelection&&9>e.isIE&&(m="\ufeff");h={text:m,style:h._metrics.largestFontStyle,ignoreChars:1};0===f.length||!f[f.length-1].style||"div"!==f[f.length-1].style.tagName?f.push(h):f.splice(f.length-1,0,h);var r,v,p,t=m=0;if(e.isFirefox&&2E3<k.length){g&&(l.innerHTML="",g.lineWidth=void 0);g=u.createDocumentFragment();for(k=0;k<
f.length;k++)h=f[k],q=h.text,r=h.style,r=this._createSpan(l,q,r,h.ignoreChars),g.appendChild(r);l.appendChild(g)}else{var n,w;if(g){if(v=g.modelChangedEvent)0===v.removedLineCount&&0===v.addedLineCount?(w=v.start-q,n=v.addedCharCount-v.removedCharCount):w=-1,g.modelChangedEvent=void 0;v=g.firstChild}for(k=0;k<f.length;k++){h=f[k];q=h.text;m+=q.length;r=h.style;if(v)if(p=v.firstChild.data,u=v.viewStyle,p===q&&b(r,u)){t+=p.length;v._rectsCache=void 0;r=v=v.nextSibling;continue}else for(;v;){if(-1!==
w){u=m;u>=w&&(u-=n);p=(p=v.firstChild.data)?p.length:0;if(t+p>u)break;t+=p}u=v.nextSibling;l.removeChild(v);v=u}r=this._createSpan(l,q,r,h.ignoreChars);v?l.insertBefore(r,v):l.appendChild(r);g&&(g.lineWidth=void 0)}if(g)for(n=r?r.nextSibling:null;n;)u=n.nextSibling,g.removeChild(n),n=u}l.parentNode||a.appendChild(l);return l},_createRanges:function(a,d,e,g,f,h){if(!(e>g)){if(a)for(var l=0;l<a.length;l++){var k=a[l];if(!(k.end<f+e)){var q=Math.max(f+e,k.start)-f;if(q>g)break;var m=Math.min(f+g,k.end)-
f;if(q<=m){q=Math.max(e,q);m=Math.min(g,m);e<q&&this._createRange(d,e,q,null,h);if(!k.style||!k.style.unmergeable)for(;l+1<a.length&&a[l+1].start-f===m&&b(k.style,a[l+1].style);)k=a[l+1],m=Math.min(f+g,k.end)-f,l++;this._createRange(d,q,m,k.style,h);e=m}}}e<g&&this._createRange(d,e,g,null,h)}},_createRange:function(a,b,d,e,g){if(!(b>d)){var f=this.view._customTabSize;if(f&&8!==f)for(var h=a.indexOf("\t",b);-1!==h&&h<d;){b<h&&(b={text:a.substring(b,h),style:e},g.ranges.push(b),g.tabOffset+=b.text.length);
b=f-g.tabOffset%f;if(0<b){for(var l="\u00a0",k=1;k<b;k++)l+=" ";b={text:l,style:e,ignoreChars:b-1};g.ranges.push(b);g.tabOffset+=b.text.length}b=h+1;if(b===d)return;h=a.indexOf("\t",b)}b<=d&&(b={text:a.substring(b,d),style:e},g.ranges.push(b),g.tabOffset+=b.text.length)}},_createSpan:function(a,b,g,f){var h=this.view,l="span";g&&g.tagName&&(l=g.tagName.toLowerCase());var k="a"===l;k&&(this.hasLink=!0);k&&!h._linksVisible&&(l="span");k=a.ownerDocument;a=e.createElement(a.ownerDocument,l);a.appendChild(k.createTextNode(g&&
g.text?g.text:b));g&&g.html?(a.innerHTML=g.html,a.ignore=!0):g&&g.node&&(a.appendChild(g.node),a.ignore=!0);d(g,a);if("a"===l){var q=h._getWindow();A(a,"click",function(a){return h._handleLinkClick(a?a:q.event)},!1)}a.viewStyle=g;f&&(a.ignoreChars=f);return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,b){var d=this._ensureCreated(),g=this.view;if(void 0===a)return this._getLineBoundingClientRect(d,
!0);var f=g._model,h=d.ownerDocument,l=this.lineIndex,k=null;if(a<f.getLineEnd(l)){var q=f.getLineStart(l);this.forEach(function(b){var f=b.firstChild,l=this._nodeLength(b);if(q+l>a){var m=a-q;if(1===f.length)k=new z(b.getBoundingClientRect());else if(g._isRangeRects)l=h.createRange(),l.setStart(f,m),l.setEnd(f,m+1),k=new z(l.getBoundingClientRect());else if(e.isIE)l=h.body.createTextRange(),l.moveToElementText(b),l.collapse(),(f=0===m&&8===e.isIE)&&(m=1),l.moveEnd("character",m+1),l.moveStart("character",
m),k=new z(l.getBoundingClientRect()),f&&(k.left=b.getClientRects()[0].left);else{var y=f.data;b.removeChild(f);b.appendChild(h.createTextNode(y.substring(0,m)));var u=e.createElement(h,"span");u.appendChild(h.createTextNode(y.substring(m,m+1)));b.appendChild(u);b.appendChild(h.createTextNode(y.substring(m+1)));k=new z(u.getBoundingClientRect());b.innerHTML="";b.appendChild(f);this._createdDiv||(b=g._getSelection(),(q<=b.start&&b.start<q+l||q<=b.end&&b.end<q+l)&&g._updateDOMSelection())}e.isIE&&(m=
d.ownerDocument.defaultView||d.ownerDocument.parentWindow,b=m.screen.logicalXDPI/m.screen.deviceXDPI,m=m.screen.logicalYDPI/m.screen.deviceYDPI,k.left*=b,k.right*=b,k.top*=m,k.bottom*=m);return!1}q+=l;return!0})}f=this.getBoundingClientRect();k||(g._wrapMode?(l=this.getClientRects(),k=l[l.length-1],k.left=k.right,k.left+=f.left,k.top+=f.top,k.right+=f.left,k.bottom+=f.top):(k=new z(f),k.left=k.right));if(b||void 0===b)k.left-=f.left,k.top-=f.top,k.right-=f.left,k.bottom-=f.top;return k},forEach:function(a){for(var b=
this._ensureCreated().firstChild;b;){var d=b.nextSibling;if(!b.ignore&&!a.call(this,b))break;b=d}},_getClientRects:function(a,b){var d,e,g,f;if(!a._rectsCache){d=a.getClientRects();e=Array(d.length);for(f=0;f<d.length;f++)g=e[f]=new z(d[f]),g.left-=b.left,g.top-=b.top,g.right-=b.left,g.bottom-=b.top;a._rectsCache=e}d=a._rectsCache;e=[d.length];for(f=0;f<d.length;f++)e[f]=new z(d[f]);return e},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];var b=[],d=this._ensureCreated().getBoundingClientRect();
this.forEach(function(a){a=this._getClientRects(a,d);for(var e=0;e<a.length;e++){var g=a[e],f,h;if(g.top!==g.bottom){var s=g.top+(g.bottom-g.top)/2;for(f=0;f<b.length&&!(h=b[f],h.top<=s&&s<h.bottom);f++);f===b.length?b.push(g):(g.left<h.left&&(h.left=g.left),g.top<h.top&&(h.top=g.top),g.right>h.right&&(h.right=g.right),g.bottom>h.bottom&&(h.bottom=g.bottom))}}return!0});return void 0!==a?b[a]:b},_getLineBoundingClientRect:function(a,b){var d=new z(a.getBoundingClientRect());if(!this.view._wrapMode){d.right=
d.left;for(var e=a.lastChild;e&&e.ignoreChars===e.firstChild.length;)e=e.previousSibling;e&&(e=e.getBoundingClientRect(),d.right=e.right+v(a).right)}b&&(e=v(a),d.left+=e.left,d.right-=e.right);return d},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;var b=this.getClientRects();a=this.getBoundingClientRect(a);a=a.top+(a.bottom-a.top)/2;for(var d=0;d<b.length;d++)if(b[d].top<=a&&a<b[d].bottom)return d;return b.length-
1},getLineStart:function(a){if(!this.view._wrapMode||0===a)return this.view._model.getLineStart(this.lineIndex);var b=this.getClientRects();return this.getOffset(b[a].left+1,b[a].top+1)},_nodeLength:function(a){if(!a||a.ignore)return 0;var b=a.firstChild.length;a.ignoreChars&&(b-=a.ignoreChars);return b},getModelOffset:function(a,b){if(!a)return 0;var d=0;this.forEach(function(e){var g=e.firstChild;if(g===a)return e.ignoreChars&&(d-=e.ignoreChars),d+=b,!1;e.ignoreChars&&(d-=e.ignoreChars);d+=g.data.length;
return!0});return Math.max(0,d)+this.view._model.getLineStart(this.lineIndex)},getNodeOffset:function(a){var b=0,d,e,g=this.view._model,f=g.getLineStart(this.lineIndex),h=a-f,l=g.getLineEnd(this.lineIndex)-f;this.forEach(function(a){var g=a.firstChild,f=this._nodeLength(a);if(f+b>h||b+f>=l)return d=g,e=h-b,a.ignoreChars&&(0<f&&e===f)&&(e+=a.ignoreChars),!1;b+=f;return!0});return{node:d,offset:e}},getText:function(a){var b="",d=0;this.forEach(function(e){var g;if(e.ignoreChars){g=e.lastChild;for(var f=
0,h=[],l=-1;g;){var k=g.data;if(k)for(var q=k.length-1;0<=q;q--){var m=k.substring(q,q+1);f<e.ignoreChars&&(" "===m||"\ufeff"===m)?f++:h.push("\u00a0"===m?"\t":m)}a===g&&(l=h.length);g=g.previousSibling}h=h.reverse().join("");-1!==l&&(d=b.length+h.length-l);b+=h}else for(g=e.firstChild;g;)a===g&&(d=b.length),b+=g.data,g=g.nextSibling;return!0});return{text:b,offset:d}},getOffset:function(a,b){function d(g,q,D){var v=g.firstChild,p=r._nodeLength(g),t=m.ownerDocument,E=t.defaultView||t.parentWindow,
n=e.isIE?E.screen.logicalXDPI/E.screen.deviceXDPI:1,w=e.isIE?E.screen.logicalYDPI/E.screen.deviceYDPI:1,x,z,A,E=D.left+u.left,C,I;if(e.isIE||f._isRangeRects){for(var t=f._isRangeRects?t.createRange():t.body.createTextRange(),$=p,M=-1;1<$-M;){var T=Math.floor(($+M)/2);D=M+1;x=T===p-1&&g.ignoreChars?v.length:T+1;C=0===D&&8===e.isIE;f._isRangeRects?(t.setStart(v,D),t.setEnd(v,x)):(C&&(D=1),t.moveToElementText(g),t.move("character",D),t.moveEnd("character",x-D));I=t.getClientRects();for(var V=!1,S=0;S<
I.length;S++)if(D=I[S],x=(C?E:D.left)*n-u.left,A=D.right*n-u.left,z=D.top*w-u.top,D=D.bottom*w-u.top,x<=a&&a<A&&(!f._wrapMode||z<=b&&b<D)){V=!0;break}V?$=T:M=T}q+=$;D=$;x=$===p-1&&g.ignoreChars?v.length:Math.min($+1,v.length);f._isRangeRects?(t.setStart(v,D),t.setEnd(v,x)):(t.moveToElementText(g),t.move("character",D),t.moveEnd("character",x-D));I=t.getClientRects();p=!1;0<I.length&&(D=I[0],x=(C?E:D.left)*n-u.left,A=D.right*n-u.left,p=a>x+(A-x)/2);g=q-k;v=h.getLine(l);n=v.charCodeAt(g);55296<=n&&
56319>=n&&p?g<v.length&&(n=v.charCodeAt(g+1),56320<=n&&57343>=n&&(q+=1)):56320<=n&&(57343>=n&&!p)&&0<g&&(n=v.charCodeAt(g-1),55296<=n&&56319>=n&&(q-=1));p&&q++}else{n=[];for(C=0;C<p;C++)n.push("\x3cspan\x3e"),C===p-1?n.push(v.data.substring(C)):n.push(v.data.substring(C,C+1)),n.push("\x3c/span\x3e");g.innerHTML=n.join("");for(n=g.firstChild;n;){D=n.getBoundingClientRect();x=D.left-u.left;A=D.right-u.left;if(x<=a&&a<A){a>x+(A-x)/2&&q++;break}q++;n=n.nextSibling}r._createdDiv||(g.innerHTML="",g.appendChild(v),
g=f._getSelection(),(q<=g.start&&g.start<q+p||q<=g.end&&g.end<q+p)&&f._updateDOMSelection())}return q}function g(d){if(d.ignore)return null;d=r._getClientRects(d,u);for(var e=0;e<d.length;e++){var h=d[e];if(h.left<=a&&a<h.right&&(!f._wrapMode||h.top<=b&&b<h.bottom))return h}return null}var f=this.view,h=f._model,l=this.lineIndex,k=h.getLineStart(l),q=h.getLineEnd(l);if(k===q)return k;var m=this._ensureCreated(),u=this.getBoundingClientRect(),r=this,v,p;if(f._wrapMode){v=this.getClientRects();b<v[0].top&&
(b=v[0].top);for(var t=0;t<v.length&&!(p=v[t],p.top<=b&&b<p.bottom);t++);a<p.left&&(a=p.left);a>p.right&&(a=p.right-1)}else 0>a&&(a=0),a>u.right-u.left&&(a=u.right-u.left);var n,w;if(this._lastHitChild&&this._lastHitChild.parentNode){if(n=this._lastHitOffset,w=this._lastHitChild,p=g(w),!p){v=n;for(var t=n+this._nodeLength(w),x=w.previousSibling,z=w.nextSibling;x||z;){if(x){v-=this._nodeLength(x);if(p=g(x)){w=x;n=v;break}x=x.previousSibling}if(z){if(p=g(z)){w=z;n=t;break}t+=this._nodeLength(z);z=z.nextSibling}}}}else n=
k,this.forEach(function(a){w=a;if(p=g(w))return!1;n+=this._nodeLength(w);return!0});w&&p&&(this._lastHitChild=w,this._lastHitOffset=n,n=d(w,n,p));return Math.min(q,Math.max(k,n))},getNextOffset:function(a,b){if("line"===b.unit){var d=this.view._model,g=d.getLineAtOffset(a);if(0<b.count)return b.count--,d.getLineEnd(g);b.count++;return d.getLineStart(g)}return"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit?this._getNextOffset_W3C(a,b):e.isIE?this._getNextOffset_IE(a,b):this._getNextOffset_W3C(a,
b)},_getNextOffset_W3C:function(a,b){function d(a){return 33<=a&&47>=a||58<=a&&64>=a||91<=a&&94>=a||96===a||123<=a&&126>=a}function g(a){return 32===a||9===a}var e=this.view._model,f=e.getLineAtOffset(a),h=e.getLine(f),l=e.getLineStart(f),e=e.getLineEnd(f),f=h.length,k=a-l,q,m=0>b.count?-1:1;if("word"===b.unit||"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit)for(var u,r,v;0!==b.count;){if(0<b.count){if(k===f)return e;q=h.charCodeAt(k);u=d(q);r=!u&&!g(q);for(k++;k<f;){q=h.charCodeAt(k);
if("wordWS"!==b.unit&&"wordendWS"!==b.unit){v=d(q);if("wordend"===b.unit){if(!v&&u)break}else if(v&&!u)break;q=!v&&!g(q)}else q=!g(q);if("wordend"===b.unit||"wordendWS"===b.unit){if(!q&&r)break}else if(q&&!r)break;r=q;u=v;k++}}else{if(0===k)return l;k--;q=h.charCodeAt(k);u=d(q);for(r=!u&&!g(q);0<k;){q=h.charCodeAt(k-1);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){v=d(q);if("wordend"===b.unit){if(v&&!u)break}else if(!v&&u)break;q=!v&&!g(q)}else q=!g(q);if("wordend"===b.unit||"wordendWS"===b.unit){if(q&&
!r)break}else if(!q&&r)break;r=q;u=v;k--}}b.count-=m}else for(;0!==b.count&&0<=k+m&&k+m<=f;)k+=m,q=h.charCodeAt(k),56320<=q&&57343>=q&&0<k&&(q=h.charCodeAt(k-1),55296<=q&&56319>=q&&(k+=m)),b.count-=m;return l+k},_getNextOffset_IE:function(a,b){var d=this._ensureCreated(),g=this.view._model,e=this.lineIndex,f=0,h;h=g.getLineStart(e);var l=g.getLine(e),k=g.getLineStart(e),q=d.ownerDocument,m=0>b.count?-1:1;if(a===g.getLineEnd(e)){for(d=d.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;
if(!d)return h;f=q.body.createTextRange();f.moveToElementText(d);h=f.text.length;f.moveEnd(b.unit,m);f=a+f.text.length-h}else if(a===h&&0>b.count)f=h;else for(d=d.firstChild;d;){g=this._nodeLength(d);if(h+g>a){f=q.body.createTextRange();if(a===h&&0>b.count){for(h=d.previousSibling;h&&(!h.firstChild||!h.firstChild.length);)h=h.previousSibling;f.moveToElementText(h?h:d.previousSibling)}else f.moveToElementText(d),f.collapse(),f.moveEnd("character",a-h);h=f.text.length;f.moveEnd(b.unit,m);f=a+f.text.length-
h;break}h=g+h;d=d.nextSibling}h=f-k;c=l.charCodeAt(h);56320<=c&&57343>=c&&0<h&&(c=l.charCodeAt(h-1),55296<=c&&56319>=c&&(h+=m));b.count-=m;return h+k},updateLinks:function(){var a=this._ensureCreated();if(this.hasLink){var b=this;this.forEach(function(d){var g=d.viewStyle;g&&(g.tagName&&"a"===g.tagName.toLowerCase())&&a.replaceChild(b._createSpan(a,d.firstChild.data,g),d);return!0})}},destroy:function(){var a=this._createdDiv;a&&(a.parentNode.removeChild(a),this._createdDiv=null)}};w.prototype={addKeyMode:function(a,
b){var d=this._keyModes;void 0!==b?d.splice(b,0,a):d.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var d=this._rulers;if(void 0!==b){var g,e;for(e=g=0;g<d.length&&e<b;g++)a.getLocation()===d[g].getLocation()&&e++;d.splice(e,0,a);b=e}else d.push(a);this._createRuler(a,b);this._update()},computeSize:function(){var a=0,b=0,d=this._model,g=this._clientDiv;if(!g)return{width:a,height:b};var f=g.style.width;e.isWebkit&&(g.style.width="0x7fffffffpx");for(var d=d.getLineCount(),
h=0;h<d;h++){var l=this._getLine(h),k=l.getBoundingClientRect(),a=Math.max(a,k.right-k.left),b=b+(k.bottom-k.top);l.destroy()}e.isWebkit&&(g.style.width=f);g=this._getViewPadding();a+=g.right+g.left+this._metrics.scrollWidth;b+=g.bottom+g.top+this._metrics.scrollWidth;return{width:a,height:b}},convert:function(a,b,d){if(this._clientDiv){var g=this._getScroll(),e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();"document"===b&&(void 0!==a.x&&(a.x+=-g.x+f.left+e.left),void 0!==a.y&&(a.y+=
-g.y+f.top+e.top));"document"===d&&(void 0!==a.x&&(a.x+=g.x-f.left-e.left),void 0!==a.y&&(a.y+=g.y-f.top-e.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),
this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var b=[],d=this._actions,g;for(g in d)d.hasOwnProperty(g)&&(a||!d[g].defaultHandler)&&b.push(g);return b},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()},getCaretOffset:function(){return this._getSelection().getCaret()},
getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(a){for(var b=[],d=this._keyModes,g=0;g<d.length;g++)b=b.concat(d[g].getKeyBindings(a));return b},getKeyModes:function(){return this._keyModes.slice(0)},getLineHeight:function(a){return!this._clientDiv?0:this._getLineHeight(a)},
getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var b=this._model;a=Math.min(Math.max(0,a),b.getCharCount());var b=b.getLineAtOffset(a),d=this._getLine(b);a=d.getBoundingClientRect(a);d.destroy();d=a.left;b=this._getLinePixel(b)+a.top;return{x:d,y:b}},getNextOffset:function(a,b){var d=new r(a,a,!1);this._doMove(b,d);return d.getCaret()},
getOptions:function(){var b;if(0===arguments.length)b=this._defaultOptions();else if(1===arguments.length){if(b=arguments[0],"string"===typeof b)return a(this["_"+b])}else{b={};for(var d in arguments)arguments.hasOwnProperty(d)&&(b[arguments[d]]=void 0)}for(var g in b)b.hasOwnProperty(g)&&(b[g]=a(this["_"+g]));return b},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var d=this._getLineIndex(b),g=this._getLine(d),d=g.getOffset(a,b-this._getLinePixel(d));
g.destroy();return d},getLineAtOffset:function(a){return this.getModel().getLineAtOffset(a)},getLineStart:function(a){this.getModel().getLineStart(a)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var a=this._getSelection();return{start:a.start,end:a.end}},getText:function(a,b){return this._model.getText(a,b)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,
b,d){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(d))return!0;if(a.defaultHandler)return"boolean"===typeof a.defaultHandler(d)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},onDragOver:function(a){return this.dispatchEvent(a)},
onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onKeyDown:function(a){return this.dispatchEvent(a)},onKeyPress:function(a){return this.dispatchEvent(a)},onKeyUp:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},onModelChanging:function(a){return this.dispatchEvent(a)},onModify:function(a){return this.dispatchEvent(a)},
onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},onFocus:function(a){return this.dispatchEvent(a)},onBlur:function(a){return this.dispatchEvent(a)},
redraw:function(){if(!(0<this._redrawCount)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,b){if(!(0<this._redrawCount))for(var d=this.getRulers(),g=0;g<d.length;g++)this.redrawLines(a,b,d[g])},redrawLines:function(a,b,d){if(!(0<this._redrawCount)&&(void 0===a&&(a=0),void 0===b&&(b=this._model.getLineCount()),a!==b)){var g=this._clientDiv;if(g){if(d)for(g=this._getRulerParent(d).firstChild;g&&g._ruler!==d;)g=g.nextSibling;d?g.rulerChanged=
!0:this._lineHeight&&this._resetLineHeight(a,b);if(!d||"page"===d.getOverview())for(g=g.firstChild;g;){var e=g.lineIndex;a<=e&&e<b&&(g.lineChanged=!0);g=g.nextSibling}!d&&(!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<b)&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._queueUpdate()}}},redrawRange:function(a,b){if(!(0<this._redrawCount)){var d=this._model;void 0===a&&(a=0);void 0===b&&(b=d.getCharCount());var g=d.getLineAtOffset(a),d=d.getLineAtOffset(Math.max(a,
b-1))+1;this.redrawLines(g,d)}},removeKeyMode:function(a){for(var b=this._keyModes,d=0;d<b.length;d++)if(b[d]===a){b.splice(d,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,d=0;d<b.length;d++)if(b[d]===a){b.splice(d,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,d){if(a){var g=this._actions,e=g[a];e||(e=g[a]={});e.handler=b;void 0!==d&&(e.actionDescription=
d)}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,d){var g=this._model.getCharCount();a=Math.max(0,Math.min(a,g));a=new r(a,a,!1);this._setSelection(a,void 0===b||b,!0,d)},setHorizontalPixel:function(a){this._clientDiv&&(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?0===--this._redrawCount&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==this._model){this._model.removeEventListener("preChanging",
this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var b=this._model.getLineCount(),d=this._model.getCharCount(),g=a.getLineCount(),e=a.getCharCount(),f={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:d,addedCharCount:e,removedLineCount:b,addedLineCount:g};this.onModelChanging(f);this._model=a;f={type:"ModelChanged",start:0,removedCharCount:d,addedCharCount:e,removedLineCount:b,addedLineCount:g};this.onModelChanged(f);this._model.addEventListener("preChanging",
this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(d){var g=this._defaultOptions(),e;for(e in d)if(d.hasOwnProperty(e)){var f=d[e];if(!b(this["_"+e],f)){var h=g[e]?g[e].update:null;h?h.call(this,f):this["_"+e]=a(f)}}},setSelection:function(a,b,d,g){var e=a>b;if(e){var f=a;a=b;b=f}f=this._model.getCharCount();a=Math.max(0,Math.min(a,f));b=Math.max(0,Math.min(b,f));a=new r(a,b,e);this._setSelection(a,
void 0===d||d,!0,g)},setText:function(a,b,d){var g=void 0===b&&void 0===d;void 0===b&&(b=0);void 0===d&&(d=this._model.getCharCount());g&&(this._variableLineHeight=!1);this._modifyContent({text:a,start:b,end:d,_code:!0},!g);g&&(this._columnX=-1,this._setSelection(new r(0,0,!1),!0),13>e.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(a,b){return this._showCaret(a?!1:!0,b,a)},update:function(a,b){this._clientDiv&&((a||this._metrics.invalid)&&this._updateStyle(),void 0===b||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)){13>e.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var b=this._overlayDiv||this._clientDiv;9>e.isIE&&(b=
this._viewDiv);for(var d=a.target?a.target:a.srcElement;d;){if(b===d||d.className&&-1!==d.className.indexOf("textViewFind"))return;d=d.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var g=this;this._getWindow().setTimeout(function(){g._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){!this._ignoreEvent(a)&&(13>e.isFirefox&&1===a.which)&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),
this._ignoreBlur=!1)},_handleBlur:function(a){this._cancelCheckSelection();if(!this._ignoreBlur){this._commitIME();this._hasFocus=!1;if(9>e.isIE&&!this._getSelection().isEmpty()){a=this._rootDiv;var b=e.createElement(a.ownerDocument,"div");a.appendChild(b);a.removeChild(b)}this._cursorDiv&&(this._cursorDiv.style.display="none");if(this._selDiv1)if(this._selDiv1.style.background="lightgray",this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",a=this._getWindow(),b=
this._selDiv1.ownerDocument,a.getSelection){b=a.getSelection();for(a=b.anchorNode;a;){if(a===this._clientDiv){0<b.rangeCount&&b.removeAllRanges();break}a=a.parentNode}}else if(b.selection){this._ignoreSelect=!1;for(a=b.selection.createRange().parentElement();a;){if(a===this._clientDiv){b.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleCompositionStart:function(a){this._ignoreEvent(a)||(this._startIME(),this._mutationObserver&&
(this._mutationObserver.disconnect(),this._mutationObserver=null))},_handleCompositionEnd:function(a){this._ignoreEvent(a)||this._commitIME(a.data)},_handleContextMenu:function(a){if(!this._ignoreEvent(a)){e.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var b=!1;this.isListening("ContextMenu")?(b=this._createMouseEvent("ContextMenu",a),b.screenX=a.screenX,b.screenY=a.screenY,this.onContextMenu(b),b=b.defaultPrevented):e.isMac&&(e.isFirefox&&0===a.button)&&(b=!0);if(b)return a.preventDefault&&
a.preventDefault(),!1;this._contextMenuOpen=!0;e.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))}},_handleCopy:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){this._ignoreEvent(a)||
(this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime(),2!==this._clickCount&&(this._clickCount=2,this._handleMouse(a)))},_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(13>e.isFirefox){var b=this;this._getWindow().setTimeout(function(){b._clientDiv.contentEditable=!0;b._clientDiv.draggable=!1;b._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&-1!==this._dragOffset)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&
a.preventDefault(),!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",a))},_handleDragEnd:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",a));13>e.isFirefox&&(this._fixCaret(),"none"===a.dataTransfer.dropEffect&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var b=
!0;this._dropTarget=!0;this.isListening("DragEnter")&&(b=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(e.isWebkit||b)return a.preventDefault&&a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var b=!0;this.isListening("DragOver")&&(b=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(e.isWebkit||b)return b&&(a.dataTransfer.dropEffect="none"),a.preventDefault&&a.preventDefault(),!1}},_handleDragLeave:function(a){if(!this._ignoreEvent(a)&&(this._dropTarget=
!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",a))},_handleDrop:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1}},_handleFocus:function(a){this._hasFocus=!0;e.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();this._cursorDiv&&(this._cursorDiv.style.display=
"block");this._selDiv1&&(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){this._cancelCheckSelection();if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var b=this._createKeyEvent("KeyDown",a);this.onKeyDown(b);if(b.defaultPrevented){e.isFirefox&&(this._keyDownPrevented=!0);a.preventDefault();return}}b=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:b=
!0;break;default:this._setLinksVisible(!1)}if(229===a.keyCode){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;b=!0;e.isSafari&&e.isMac&&a.ctrlKey&&(b=!1,a.keyCode=129);b&&this._startIME()}else b||this._commitIME();if((e.isMac||e.isLinux)&&4>e.isFirefox||12.16>e.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(!this._ignoreEvent(a))if(this._keyDownPrevented)a.preventDefault&&
(a.preventDefault(),a.stopPropagation()),this._keyDownPrevented=void 0;else{if(e.isMac&&e.isWebkit&&(63232<=a.keyCode&&63487>=a.keyCode||13===a.keyCode||8===a.keyCode)||((e.isMac||e.isLinux)&&4>e.isFirefox||12.16>e.isOpera)&&this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var b=e.isMac?a.metaKey:a.ctrlKey;if(void 0!==a.charCode&&b)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(b=this._createKeyEvent("KeyPress",a),this.onKeyPress(b),
b.defaultPrevented)){a.preventDefault();return}if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1;b=!1;if(e.isMac){if(a.ctrlKey||a.metaKey)b=!0}else if(e.isFirefox){if(a.ctrlKey||a.altKey)b=!0}else a.ctrlKey^a.altKey&&(b=!0);if(!b&&(b=e.isOpera?a.which:void 0!==a.charCode?a.charCode:a.keyCode,31<b))return this._doContent(String.fromCharCode(b)),a.preventDefault&&a.preventDefault(),!1}},_handleDocKeyUp:function(a){(e.isMac?
a.metaKey:a.ctrlKey)||this._setLinksVisible(!1)},_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var b=this._createKeyEvent("KeyUp",a);this.onKeyUp(b);if(b.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);13===a.keyCode&&this._commitIME()}},_handleLinkClick:function(a){if(!(e.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var b=this._getWindow(),d=!0,g=b;if(e.isIE||e.isFirefox&&!this._overlayDiv)g=
this._clientDiv;if(this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var f=this;b.setTimeout(function(){f.focus();f._ignoreFocus=!1},0)}1===this._clickCount?(d=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,(!e.isOpera||12.16<=e.isOpera)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(g):(this._isW3CEvents&&this._setGrab(g),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return d},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if("A"!==
(a.target||a.srcElement).tagName)this._setLinksVisible(!1);else return;this._commitIME();var b=a.which;b||(4===a.button&&(b=2),2===a.button&&(b=3),1===a.button&&(b=1));var d=2!==b&&a.timeStamp?a.timeStamp:(new Date).getTime(),g=d-this._lastMouseTime,f=Math.abs(this._lastMouseX-a.clientX),h=Math.abs(this._lastMouseY-a.clientY),l=this._lastMouseButton===b;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=d;this._lastMouseButton=b;1===b&&(this._isMouseDown=!0,l&&g<=this._clickTime&&
f<=this._clickDist&&h<=this._clickDist?this._clickCount++:this._clickCount=1);if(this.isListening("MouseDown")&&(d=this._createMouseEvent("MouseDown",a),this.onMouseDown(d),d.defaultPrevented)){a.preventDefault();return}if(1===b&&this._handleMouse(a)&&(9<=e.isIE||e.isOpera||e.isChrome||e.isSafari||e.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();e.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}},_handleMouseOver:function(a){if(!this._ignoreEvent(a)&&
!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",a))},_handleMouseOut:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){if(!this._animation){var b=this._isClientDiv(a);if(this.isListening("MouseMove")&&b)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&&(e.isMac?a.metaKey:a.ctrlKey));this._checkOverlayScroll();if(!this._isW3CEvents){if(0===a.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===a.button&&0!==(this._clickCount&1)&&b)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){b=a.clientX;a=a.clientY;var g=this._getViewPadding(),
f=this._viewDiv.getBoundingClientRect(),h=this._getClientWidth(),l=this._getClientHeight(),d=f.left+g.left,k=f.top+g.top,h=f.left+g.left+h,g=f.top+g.top+l;a<k?this._doAutoScroll("up",b,a-k):a>g?this._doAutoScroll("down",b,a-g):b<d&&!this._wrapMode?this._doAutoScroll("left",b-d,a):b>h&&!this._wrapMode?this._doAutoScroll("right",b-h,a):(this._endAutoScroll(),this._setSelectionTo(b,a,!0))}}}},_isClientDiv:function(a){var b=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(b===
a)return!0;a=a.parentNode}return!1},_createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(a,b){var d=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:d.x,y:d.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var b=a.which?0===a.button:1===a.button;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||b&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",
a));if(!this._linksVisible){if(b&&this._isMouseDown){if(-1!==this._dragOffset){var d=this._getSelection();d.extend(this._dragOffset);d.collapse();this._setSelection(d,!0,!0);this._dragOffset=-1}this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null)}b&&e.isFirefox&&(this._updateDOMSelection(),a.preventDefault())}},_handleMouseWheel:function(a){var b=this._getLineHeight(),d=0,g=0;e.isIE||e.isOpera?g=-a.wheelDelta/40*b:e.isFirefox?"wheel"===a.type?a.deltaMode?(d=Math.max(-256,
Math.min(256,a.deltaX))*b,g=Math.max(-256,Math.min(256,a.deltaY))*b):(d=a.deltaX,g=a.deltaY):(b=e.isMac?3*a.detail:Math.max(-256,Math.min(256,a.detail))*b,a.axis===a.HORIZONTAL_AXIS?d=b:g=b):e.isMac?(g=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,d=0!==a.wheelDeltaX%120?1:40>g?40/(40-g):40,g=0!==a.wheelDeltaY%120?1:40>g?40/(40-g):40,d=Math.ceil(-a.wheelDeltaX/d),-1<d&&0>d&&(d=-1),0<d&&1>d&&(d=1),g=Math.ceil(-a.wheelDeltaY/g),-1<g&&0>g&&(g=-1),0<g&&1>g&&(g=1)):(d=-a.wheelDeltaX,
g=8*(-a.wheelDeltaY/120)*b);if(e.isSafari||e.isChrome&&e.isMac){for(b=a.target;b&&void 0===b.lineIndex;)b=b.parentNode;this._mouseWheelLine=b}b=this._getScroll();this._scrollView(d,g);d=this._getScroll();if(b.x!==d.x||b.y!==d.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(e.isIE){var b=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){b._updateDOMSelection();
b._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(a){a=this._rootDiv.clientWidth;var d=this._rootDiv.clientHeight;if(this._rootWidth!==a||this._rootHeight!==d)this._rootWidth!==a&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=a,this._rootHeight=d,a=9>e.isIE,d=this._calculateMetrics(),b(d,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=d,a=!0),a?this._queueUpdate():this._update()},_handleRulerEvent:function(a){for(var b=
a.target?a.target:a.srcElement,d=b.lineIndex;b&&!b._ruler;)void 0===d&&void 0!==b.lineIndex&&(d=b.lineIndex),b=b.parentNode;var g=b?b._ruler:null;if(void 0===d&&g&&"document"===g.getOverview()){var d=this._getClientHeight(),e=this._model.getLineCount(),f=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect(),d=Math.floor((a.clientY-h.top-this._metrics.scrollWidth)*e/(d+f.top+f.bottom-2*this._metrics.scrollWidth));0<=d&&d<e||(d=void 0)}if(g)switch(a.type){case "click":if(g.onClick)g.onClick(d,
a);break;case "dblclick":if(g.onDblClick)g.onDblClick(d,a);break;case "mousemove":if(g.onMouseMove)g.onMouseMove(d,a);break;case "mouseover":if(g.onMouseOver)g.onMouseOver(d,a);break;case "mouseout":if(g.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===b)return;e=e.parentNode}g.onMouseOut(d,a)}}},_handleScroll:function(){this._lastScrollTime=(new Date).getTime();var a=this._getScroll(!1),b=this._hScroll,d=this._vScroll;if(b!==a.x||d!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),
this._update(d===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:d},newValue:a})},_handleSelectStart:function(a){var b=this._contextMenuOpen;this._contextMenuOpen=!1;if(b)this._checkSelectionChange=!0;else if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var d;d="DIV"===a.tagName?a:a.parentNode.parentNode;return!d._line?0:d._line.getModelOffset(a,b)}},_updateSelectionFromDOM:function(){if(!e.isIOS&&!e.isAndroid&&!this._checkSelectionChange)return!1;
var a=this._getWindow().getSelection(),b=this._getModelOffset(a.anchorNode,a.anchorOffset),d=this._getModelOffset(a.focusNode,a.focusOffset),g=this._getSelection();if(void 0===b||void 0===d||g.start===b&&g.end===d)return!1;if(this._checkSelectionChange){var g=this._getLineNext(),f=this._getLinePrevious();if(a.anchorNode===g.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===f.firstChild.firstChild&&0===a.focusOffset)return!1;if(a.anchorNode===g.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===
f.lastChild.firstChild||a.anchorNode===this._clientDiv&&a.focusNode===this._clientDiv)b=0,d=this.getModel().getCharCount()}this._setSelection(new r(b,d),!1,!1);this._checkSelectionChange=!1;return!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){this._selPollTimer&&(this._getWindow().clearTimeout(this._selPollTimer),this._selPollTimer=null)},_pollSelectionChange:function(a){var b=
this,d=this._getWindow();this._cancelPollSelectionChange();this._selPollTimer=d.setTimeout(function(){b._selPollTimer=null;b._clientDiv&&!b._updateSelectionFromDOM()&&a&&b._pollSelectionChange(a)},100)},_handleSelectionChange:function(a){-1===this._imeOffset&&(e.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var b=this._getWindow().getSelection();if(b.anchorNode!==this._anchorNode||b.focusNode!==this._focusNode||
b.anchorOffset!==this._anchorOffset||b.focusOffset!==this._focusOffset){for(var d=b.anchorNode;d&&void 0===d.lineIndex;)d=d.parentNode;if(d){var g=this._model,f=d.lineIndex,h=g.getLine(f),l=h,k=0,g=g.getLineStart(f);0<b.rangeCount&&(b.getRangeAt(0).deleteContents(),f=d.ownerDocument.createTextNode(a.data),b.getRangeAt(0).insertNode(f),k=this._getDOMText(d,f),l=k.text,k=k.offset,f.parentNode.removeChild(f));d.lineRemoved=!0;for(d=0;h.charCodeAt(d)===l.charCodeAt(d)&&d<k;)d++;b=h.length-1;for(f=l.length-
h.length;h.charCodeAt(b)===l.charCodeAt(b+f)&&b+f>=k+a.data.length;)b--;b++;h=l.substring(d,b+f);this._ignoreQueueUpdate=e.isSafari;this._modifyContent({text:h,start:d+g,end:b+g,_ignoreDOMSelection:!0,_ignoreDOMSelection1:e.isChrome},!0);this._ignoreQueueUpdate=!1}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var b=this._getWindow();this._touchScrollTimer&&(this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",b.clearInterval(this._touchScrollTimer),
this._touchScrollTimer=null);var d=a.touches;if(1===d.length){var d=d[0],g=d.clientX,f=d.clientY;this._touchStartX=g;this._touchStartY=f;if(e.isAndroid&&(f<d.pageY-b.pageYOffset||g<d.pageX-b.pageXOffset))g=d.pageX-b.pageXOffset,f=d.pageY-b.pageYOffset;b=this.convert({x:g,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(b.x,b.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=a.touches;if(1===b.length){b=b[0];this._touchCurrentX=b.clientX;
this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&200>a.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var d=this,g=this._getWindow();this._touchScrollTimer=g.setInterval(function(){var a=0,b=0;if(d._touching)a=d._touchStartX-d._touchCurrentX,b=d._touchStartY-d._touchCurrentY,d._touchSpeedX=a/10,d._touchSpeedY=b/10,d._touchStartX=d._touchCurrentX,d._touchStartY=d._touchCurrentY;else{if(0.1>Math.abs(d._touchSpeedX)&&
0.1>Math.abs(d._touchSpeedY)){d._vScrollDiv.style.display="none";d._hScrollDiv.style.display="none";g.clearInterval(d._touchScrollTimer);d._touchScrollTimer=null;return}a=10*d._touchSpeedX;b=10*d._touchSpeedY;d._touchSpeedX*=0.95;d._touchSpeedY*=0.95}d._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var b,d,g=this._keyModes;for(d=g.length-1;0<=d;d--)if(b=g[d],"function"===typeof b.match&&
(b=b.match(a),void 0!==b))return this.invokeAction(b);return!1},_doMove:function(a,b){var d=this._model,g=b.getCaret(),e=d.getLineAtOffset(g);a.count||(a.count=1);for(;0!==a.count;){var f=d.getLineStart(e);if(0>a.count&&g===f)if(0<e)"character"===a.unit&&a.count++,e--,b.extend(d.getLineEnd(e));else break;else if(0<a.count&&g===d.getLineEnd(e))if(e+1<d.getLineCount())"character"===a.unit&&a.count--,e++,b.extend(d.getLineStart(e));else break;else{var h=!1;a.expandTab&&("character"===a.unit&&0===(g-
f)%this._tabSize)&&(f=d.getText(f,g),h=!/[^ ]/.test(f));h?(b.extend(g-this._tabSize),a.count+=0>a.count?1:-1):(f=this._getLine(e),b.extend(f.getNextOffset(g,a)),f.destroy())}g=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();b.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,b));this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var d=this.getText(b.start,
b.end);this._setSelection(b,!0);switch(a.type){case "lower":d=d.toLowerCase();break;case "capitalize":d=d.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<d.length;b++){var g=d[b],e=g.toLowerCase(),g=e!==g?e:g.toUpperCase();a+=g}d=a;break;default:d=d.toUpperCase()}this._doContent(d);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var d=this._model,g=d.getLineAtOffset(b.end);b.end<d.getLineEnd(g)&&(d=this._getLine(g),
b.extend(d.getNextOffset(b.getCaret(),{unit:"character",count:1})),d.destroy())}return this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,b.end),this._setClipboardText(b,a)):!0},_doCursorNext:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.start=b.end:this._doMove(a,b);a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){var b=
this._getSelection();!b.isEmpty()&&!a.select?b.end=b.start:(a.count||(a.count=1),a.count*=-1,this._doMove(a,b));a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,b.end),this._doContent(""),this._setClipboardText(b,a)):!0},_doDelete:function(a){var b=this._getSelection();b.isEmpty()&&this._doMove(a,b);this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doEnd:function(a){var b=this._getSelection(),
d=this._model,g;if(a.ctrl)b.extend(d.getCharCount()),g=function(){};else{var e=b.getCaret(),f=d.getLineAtOffset(e);if(this._wrapMode){var h=this._getLine(f),e=h.getLineIndex(e),e=e===h.getLineCount()-1?d.getLineEnd(f):h.getLineStart(e+1)-1;h.destroy()}else a.count&&0<a.count&&(f=Math.min(f+a.count-1,d.getLineCount()-1)),e=d.getLineEnd(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,g);return!0},_doEnter:function(a){var b=this._model,d=this._getSelection();this._doContent(b.getLineDelimiter());
a&&a.noCursor&&(d.end=d.start,this._setSelection(d,!0));return!0},_doHome:function(a){var b=this._getSelection(),d=this._model,g;if(a.ctrl)b.extend(0),g=function(){};else{var e=b.getCaret(),f=d.getLineAtOffset(e);this._wrapMode?(d=this._getLine(f),e=d.getLineIndex(e),e=d.getLineStart(e),d.destroy()):e=d.getLineStart(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,g);return!0},_doLineDown:function(a){var b=this._model,d=this._getSelection(),g=d.getCaret(),f=b.getLineAtOffset(g),h=
this._getLine(f),l=this._columnX,k=1,q=!1;if(-1===l||a.wholeLine||a.select&&e.isIE)l=a.wholeLine?b.getLineEnd(f+1):g,l=h.getBoundingClientRect(l).left;(g=h.getLineIndex(g))<h.getLineCount()-1?k=h.getClientRects(g+1).top+1:(g=b.getLineCount()-1,q=f===g,a.count&&0<a.count?f=Math.min(f+a.count,g):f++);g=!1;if(q){if(a.select||e.isMac||e.isLinux)d.extend(b.getCharCount()),g=!0}else h.lineIndex!==f&&(h.destroy(),h=this._getLine(f)),d.extend(h.getOffset(l,k)),g=!0;g&&(a.select||d.collapse(),this._setSelection(d,
!0,!0));this._columnX=l;h.destroy();return!0},_doLineUp:function(a){var b=this._model,d=this._getSelection(),g=d.getCaret(),f=b.getLineAtOffset(g),h=this._getLine(f),l=this._columnX,k=!1,q;if(-1===l||a.wholeLine||a.select&&e.isIE)l=a.wholeLine?b.getLineStart(f-1):g,l=h.getBoundingClientRect(l).left;0<(g=h.getLineIndex(g))?q=h.getClientRects(g-1).top+1:(k=0===f,k||(a.count&&0<a.count?f=Math.max(f-a.count,0):f--,q=this._getLineHeight(f)-1));g=!1;if(k){if(a.select||e.isMac||e.isLinux)d.extend(0),g=!0}else h.lineIndex!==
f&&(h.destroy(),h=this._getLine(f)),d.extend(h.getOffset(l,q)),g=!0;g&&(a.select||d.collapse(),this._setSelection(d,!0,!0));this._columnX=l;h.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var b=this,d=this._model,g=this._getSelection(),f=g.getCaret(),h=d.getLineAtOffset(f),l=d.getLineCount(),k=this._getScroll(),d=this._getClientHeight(),q,m;if(this._lineHeight){q=this._columnX;k=this._getBoundsAtOffset(f);if(-1===q||a.select&&e.isIE)q=k.left;f=this._getLineIndex(k.top+d);
m=this._getLine(f);h=this._getLinePixel(f);f=m.getOffset(q,k.top+d-h);d=m.getBoundingClientRect(f);m.destroy();g.extend(f);a.select||g.collapse();this._setSelection(g,!0,!0,function(){b._columnX=q},d.top+h-k.top);return!0}if(h<l-1){var u=this._getLineHeight(),r=Math.min(l-h-1,Math.floor(d/u)),r=Math.max(1,r);q=this._columnX;if(-1===q||a.select&&e.isIE)m=this._getLine(h),q=m.getBoundingClientRect(f).left,m.destroy();m=this._getLine(h+r);g.extend(m.getOffset(q,0));m.destroy();a.select||g.collapse();
a=l*u;f=k.y+r*u;f+d>a&&(f=a-d);this._setSelection(g,!0,!0,function(){b._columnX=q},f-k.y)}return!0},_doPageUp:function(a){var b=this,d=this._model,g=this._getSelection(),f=g.getCaret(),h=d.getLineAtOffset(f),l=this._getScroll(),k=this._getClientHeight(),q;if(this._lineHeight){q=this._columnX;l=this._getBoundsAtOffset(f);if(-1===q||a.select&&e.isIE)q=l.left;f=this._getLineIndex(l.bottom-k);d=this._getLine(f);h=this._getLinePixel(f);f=d.getOffset(q,l.bottom-k-h);k=d.getBoundingClientRect(f);d.destroy();
g.extend(f);a.select||g.collapse();this._setSelection(g,!0,!0,function(){b._columnX=q},k.top+h-l.top);return!0}if(0<h){var m=this._getLineHeight(),k=Math.max(1,Math.min(h,Math.floor(k/m)));q=this._columnX;if(-1===q||a.select&&e.isIE)d=this._getLine(h),q=d.getBoundingClientRect(f).left,d.destroy();d=this._getLine(h-k);g.extend(d.getOffset(q,this._getLineHeight(h-k)-1));d.destroy();a.select||g.collapse();a=Math.max(0,l.y-k*m);this._setSelection(g,!0,!0,function(){b._columnX=q},a-l.y)}return!0},_doPaste:function(a){var b=
this;return null!==this._getClipboardText(a,function(a){a&&(e.isLinux&&2===b._lastMouseButton&&(new Date).getTime()-b._lastMouseTime<=b._clickTime&&b._setSelectionTo(b._lastMouseX,b._lastMouseY),b._doContent(a))})},_doScroll:function(a){var b=a.type,d=this._model,g=d.getLineCount();a=this._getClientHeight();var e=this._getLineHeight(),g=g*e,f=this._getScroll().y,h;switch(b){case "textStart":h=0;break;case "textEnd":h=g-a;break;case "pageDown":h=f+a;break;case "pageUp":h=f-a;break;case "lineDown":h=
f+e;break;case "lineUp":h=f-e;break;case "centerLine":b=this._getSelection(),h=d.getLineAtOffset(b.start),d=(d.getLineAtOffset(b.end)-h+1)*e,h=h*e-a/2+d/2}void 0!==h&&(h=Math.min(Math.max(0,h),g-a),this._scrollViewAnimated(0,h-f,function(){}));return!0},_doSelectAll:function(a){a=this._model;var b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(a){if(this._tabMode&&!this._readonly){a="\t";if(this._expandTab){var b=this._model;a=this._getSelection().getCaret();
var d=b.getLineAtOffset(a),b=b.getLineStart(d);a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ")}this._doContent(a);return!0}},_doShiftTab:function(a){if(this._tabMode&&!this._readonly)return!0},_doOverwriteMode:function(a){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0},_doTabMode:function(a){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(a){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=
this._model,b=this._getSelection(),d=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),g=b.getCaret(),f=a.getLineCount(),h=a.getLineAtOffset(g),l;if("up"===this._autoScrollDir||"down"===this._autoScrollDir)g=this._autoScrollY/this._getLineHeight(),g=0>g?Math.floor(g):Math.ceil(g),l=Math.max(0,Math.min(f-1,h+g));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)l=this._getLineIndex(d.y),h=this._getLine(h),d.x+=h.getBoundingClientRect(g,!1).left,h.destroy();
0===l&&(e.isMac||e.isLinux)?b.extend(0):l===f-1&&(e.isMac||e.isLinux)?b.extend(a.getCharCount()):(h=this._getLine(l),b.extend(h.getOffset(d.x,d.y-this._getLinePixel(l))),h.destroy());this._setSelection(b,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var b=this._model.getLineCount(),d=0;if(a){a=
0;for(var g=(new Date).getTime(),e=0;d<b&&!(this._lineHeight[d]||(a++,e||(e=d),this._lineHeight[d]=this._calculateLineHeight(d)),d++,100<(new Date).getTime()-g););this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(d!==b){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},0)}else this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(a){a=this._getLine(a);
var b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,b=a.ownerDocument,g=e.createElement(b,"div");g.style.lineHeight="normal";var f={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(f);d(f.style,g);g.style.position="fixed";g.style.left="-1000px";var h=e.createElement(b,"span");h.appendChild(b.createTextNode(" "));g.appendChild(h);var l=e.createElement(b,"span");l.style.fontStyle=
"italic";l.appendChild(b.createTextNode(" "));g.appendChild(l);var k=e.createElement(b,"span");k.style.fontWeight="bold";k.appendChild(b.createTextNode(" "));g.appendChild(k);f=e.createElement(b,"span");f.style.fontWeight="bold";f.style.fontStyle="italic";f.appendChild(b.createTextNode(" "));g.appendChild(f);a.appendChild(g);var q=g.getBoundingClientRect(),h=h.getBoundingClientRect(),l=l.getBoundingClientRect(),k=k.getBoundingClientRect(),f=f.getBoundingClientRect(),h=h.bottom-h.top,l=l.bottom-l.top,
k=k.bottom-k.top,m=f.bottom-f.top,r=0,f=0>=q.bottom-q.top,q=Math.max(1,q.bottom-q.top);l>h&&(r=1);k>l&&(r=2);m>k&&(r=3);var p;0!==r&&(p={style:{}},0!==(r&1)&&(p.style.fontStyle="italic"),0!==(r&2)&&(p.style.fontWeight="bold"));h=v(g);a.removeChild(g);m=u(this._viewDiv);g=e.createElement(b,"div");g.style.position="fixed";g.style.left="-1000px";g.style.paddingLeft=m.left+"px";g.style.paddingTop=m.top+"px";g.style.paddingRight=m.right+"px";g.style.paddingBottom=m.bottom+"px";g.style.width="100px";g.style.height=
"100px";m=e.createElement(b,"div");m.style.width="100%";m.style.height="100%";g.appendChild(m);a.appendChild(g);r=g.getBoundingClientRect();l=m.getBoundingClientRect();k=0;this._singleMode||(g.style.overflow="hidden",m.style.height="200px",k=g.clientWidth,g.style.overflow="scroll",k-=g.clientWidth);a.removeChild(g);m={left:l.left-r.left,top:l.top-r.top,right:r.right-l.right,bottom:r.bottom-l.bottom};l=r=0;if(!f&&(this._wrapOffset||this._marginOffset))g=e.createElement(b,"div"),g.style.position="fixed",
g.style.left="-1000px",g.innerHTML=Array(this._wrapOffset+1+(e.isWebkit?0:1)).join(" "),a.appendChild(g),r=g.getBoundingClientRect(),r=Math.ceil(r.right-r.left),g.innerHTML=Array(this._marginOffset+1).join(" "),l=g.getBoundingClientRect(),l=Math.ceil(l.right-l.left),a.removeChild(g);return{lineHeight:q,largestFontStyle:p,lineTrim:h,viewPadding:m,scrollWidth:k,wrapWidth:r,marginWidth:l,invalid:f}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var b=
this._getSelection();if(b.isEmpty())return!1;"next"===a?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(a){if(-1!==this._imeOffset){var b=this._model,d=b.getLineAtOffset(this._imeOffset),g=b.getLineStart(d),f=this._getLineNode(d);if(!a){this._scrollDiv.focus();this._clientDiv.focus();var h=this._getDOMText(f).text,b=b.getLine(d),g=this._imeOffset-g,b=g+h.length-b.length;g!==b&&(a=h.substring(g,b))}a&&(!this._doContent(a)&&!e.isWebkit)&&(f.lineRemoved=!0,this._queueUpdate());
this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new p.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(h(b,{select:!1}))},actionDescription:{name:m.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(h(b,{select:!1}))},actionDescription:{name:m.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(h(b,{select:!1,ctrl:!1}))},actionDescription:{name:m.lineStart}},
lineEnd:{defaultHandler:function(b){return a._doEnd(h(b,{select:!1,ctrl:!1}))},actionDescription:{name:m.lineEnd}},charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(h(b,{select:!1,unit:"character"}))},actionDescription:{name:m.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(h(b,{select:!1,unit:"character"}))},actionDescription:{name:m.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(h(b,{select:!1}))},actionDescription:{name:m.pageUp}},
pageDown:{defaultHandler:function(b){return a._doPageDown(h(b,{select:!1}))},actionDescription:{name:m.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(h(b,{type:"pageUp"}))},actionDescription:{name:m.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(h(b,{type:"pageDown"}))},actionDescription:{name:m.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(h(b,{type:"lineUp"}))},actionDescription:{name:m.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(h(b,
{type:"lineDown"}))},actionDescription:{name:m.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(h(b,{select:!1,unit:"word"}))},actionDescription:{name:m.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(h(b,{select:!1,unit:"word"}))},actionDescription:{name:m.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(h(b,{select:!1,ctrl:!0}))},actionDescription:{name:m.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(h(b,
{select:!1,ctrl:!0}))},actionDescription:{name:m.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(h(b,{type:"textStart"}))},actionDescription:{name:m.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(h(b,{type:"textEnd"}))},actionDescription:{name:m.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(h(b,{type:"centerLine"}))},actionDescription:{name:m.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(h(b,
{select:!0}))},actionDescription:{name:m.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(h(b,{select:!0}))},actionDescription:{name:m.selectLineDown}},selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(h(b,{select:!0,wholeLine:!0}))},actionDescription:{name:m.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(h(b,{select:!0,wholeLine:!0}))},actionDescription:{name:m.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(h(b,
{select:!0,ctrl:!1}))},actionDescription:{name:m.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(h(b,{select:!0,ctrl:!1}))},actionDescription:{name:m.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(h(b,{select:!0,unit:"character"}))},actionDescription:{name:m.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(h(b,{select:!0,unit:"character"}))},actionDescription:{name:m.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(h(b,
{select:!0}))},actionDescription:{name:m.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(h(b,{select:!0}))},actionDescription:{name:m.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(h(b,{select:!0,unit:"word"}))},actionDescription:{name:m.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(h(b,{select:!0,unit:"word"}))},actionDescription:{name:m.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(h(b,
{select:!0,ctrl:!0}))},actionDescription:{name:m.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(h(b,{select:!0,ctrl:!0}))},actionDescription:{name:m.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(h(b,{unit:"character"}))},actionDescription:{name:m.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(h(b,{unit:"character"}))},actionDescription:{name:m.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(h(b,
{unit:"word"}))},actionDescription:{name:m.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(h(b,{unit:"word"}))},actionDescription:{name:m.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(h(b,{unit:"line"}))},actionDescription:{name:m.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(h(b,{unit:"line"}))},actionDescription:{name:m.deleteLineEnd}},tab:{defaultHandler:function(b){return a._doTab()},actionDescription:{name:m.tab}},
shiftTab:{defaultHandler:function(b){return a._doShiftTab()},actionDescription:{name:m.shiftTab}},enter:{defaultHandler:function(b){return a._doEnter()},actionDescription:{name:m.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(h(b,{noCursor:!0}))},actionDescription:{name:m.enterNoCursor}},selectAll:{defaultHandler:function(b){return a._doSelectAll()},actionDescription:{name:m.selectAll}},copy:{defaultHandler:function(b){return a._doCopy()},actionDescription:{name:m.copy}},cut:{defaultHandler:function(b){return a._doCut()},
actionDescription:{name:m.cut}},paste:{defaultHandler:function(b){return a._doPaste()},actionDescription:{name:m.paste}},uppercase:{defaultHandler:function(b){return a._doCase(h(b,{type:"upper"}))},actionDescription:{name:m.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(h(b,{type:"lower"}))},actionDescription:{name:m.lowercase}},capitalize:{defaultHandler:function(b){return a._doCase(h(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:m.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(h(b,
{type:"reverse"}))},actionDescription:{name:m.reversecase}},toggleOverwriteMode:{defaultHandler:function(b){return a._doOverwriteMode()},actionDescription:{name:m.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(b){return a._doTabMode()},actionDescription:{name:m.toggleTabMode}},toggleWrapMode:{defaultHandler:function(b){return a._doWrapMode()},actionDescription:{name:m.toggleWrapMode}}}},_createRulerParent:function(a,b){var d=e.createElement(a,"div");d.className=b;d.tabIndex=-1;d.style.overflow=
"hidden";d.style.MozUserSelect="none";d.style.WebkitUserSelect="none";d.style.position="absolute";d.style.top="0px";d.style.bottom="0px";d.style.cursor="default";d.style.display="none";d.setAttribute("aria-hidden","true");this._rootDiv.appendChild(d);return d},_createRuler:function(a,b){if(this._clientDiv){var d=this._getRulerParent(a);if(d){if(d!==this._marginDiv||this._marginOffset)d.style.display="block";var g=e.createElement(d.ownerDocument,"div");g._ruler=a;g.rulerChanged=!0;g.style.position=
"relative";g.style.cssFloat="left";g.style.styleFloat="left";g.style.outline="none";if(void 0===b||0>b||b>=d.children.length)d.appendChild(g);else{for(var f=d.firstChild;f&&0<b--;)f=f.nextSibling;d.insertBefore(g,f)}}}},_createView:function(){function a(){h._rootDiv&&(h.update(!0),h._metrics.invalid&&h._getWindow().setTimeout(function(){a()},100))}if(!this._clientDiv){for(var b=this._parent;b.hasChildNodes();)b.removeChild(b.lastChild);var d=b.ownerDocument,g=e.createElement(d,"div");this._rootDiv=
g;g.tabIndex=-1;g.style.position="relative";g.style.overflow="hidden";g.style.width="100%";g.style.height="100%";g.style.overflow="hidden";g.style.WebkitTextSizeAdjust="100%";g.setAttribute("role","application");b.appendChild(g);this._leftDiv=this._createRulerParent(d,"textviewLeftRuler");b=e.createElement(d,"div");b.className="textviewScroll";this._viewDiv=b;b.tabIndex=-1;b.style.position="absolute";b.style.top="0px";b.style.bottom="0px";b.style.borderWidth="0px";b.style.margin="0px";b.style.outline=
"none";b.style.background="transparent";g.appendChild(b);var f=this._createRulerParent(d,"textviewRightRuler");this._rightDiv=f;f.style.right="0px";this._scrollDiv=f=e.createElement(d,"div");f.style.margin="0px";f.style.borderWidth="0px";f.style.padding="0px";b.appendChild(f);(this._marginDiv=this._createRulerParent(d,"textviewMarginRuler")).style.zIndex="4";!e.isIE&&!e.isIOS&&(this._clipDiv=b=e.createElement(d,"div"),b.style.position="absolute",b.style.overflow="hidden",b.style.margin="0px",b.style.borderWidth=
"0px",b.style.padding="0px",b.style.background="transparent",g.appendChild(b),this._clipScrollDiv=f=e.createElement(d,"div"),f.style.position="absolute",f.style.height="1px",f.style.top="-1000px",f.style.background="transparent",b.appendChild(f));this._setFullSelection(this._fullSelection,!0);b=e.createElement(d,"div");b.className="textviewContent";this._clientDiv=b;b.tabIndex=0;b.style.position="absolute";b.style.borderWidth="0px";b.style.margin="0px";b.style.padding="0px";b.style.outline="none";
b.style.zIndex="1";b.style.WebkitUserSelect="text";b.setAttribute("spellcheck","false");if(e.isIOS||e.isAndroid)b.style.WebkitTapHighlightColor="transparent";(this._clipDiv||g).appendChild(b);if(e.isIOS||e.isAndroid)this._vScrollDiv=f=e.createElement(d,"div"),f.style.position="absolute",f.style.borderWidth="1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline=
"none",f.style.zIndex="3",f.style.width="8px",f.style.display="none",g.appendChild(f),this._hScrollDiv=f=e.createElement(d,"div"),f.style.position="absolute",f.style.borderWidth="1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.height="8px",f.style.display="none",g.appendChild(f);e.isFirefox&&!b.setCapture&&(this._overlayDiv=
f=e.createElement(d,"div"),f.style.position=b.style.position,f.style.borderWidth=b.style.borderWidth,f.style.margin=b.style.margin,f.style.padding=b.style.padding,f.style.cursor="text",f.style.zIndex="2",(this._clipDiv||g).appendChild(f));b.contentEditable="true";b.setAttribute("role","textbox");b.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,
!0);this._hookEvents();b=this._rulers;for(f=0;f<b.length;f++)this._createRuler(b[f]);this._update();var h=this;q(d,g,"textview",a)}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},scrollAnimation:{value:0,update:null},readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,update:this._setFullSelection},tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},singleMode:{value:!1,
update:this._setSingleMode},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},marginOffset:{value:0,update:this._setMarginOffset},wrapOffset:{value:0,update:this._setWrapOffset},wrapMode:{value:!1,update:this._setWrapMode},wrappable:{value:!1,update:null},theme:{value:f.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var d=
b.firstChild;d;){if(d._ruler===a){d._ruler=void 0;b.removeChild(d);if(0===b.children.length&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}d=d.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();this._autoScrollTimerID&&(a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null);this._updateTimer&&(a.clearTimeout(this._updateTimer),this._updateTimer=null);a=this._rootDiv;a.parentNode.removeChild(a);
this._hScrollDiv=this._vScrollDiv=this._cursorDiv=this._marginDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,b,d){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=d;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);
this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var b=this._hasFocus;this._ignoreFocus=!0;b&&a.blur();a.contentEditable=!1;a.contentEditable=!0;b&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,b){var d=this._model;d.getBaseModel&&(a=d.mapOffset(a),b=d.mapOffset(b),d=d.getBaseModel());return d.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();
var d=this._clientDiv.getBoundingClientRect();a.bottom>d.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a));a=b.getBoundingClientRect(a);var d=this._getLinePixel(b.lineIndex);a.top+=d;a.bottom+=d;b.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,
this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,b){var d=this._model.getLineDelimiter(),f,h,l=this._getWindow(),k=l.clipboardData;!k&&a&&(k=a.clipboardData);if(k)return f=[],h=k.getData(e.isIE?"Text":"text/plain"),g(h,function(a){f.push(a)},function(){f.push(d)}),h=f.join(""),b&&b(h),h;if(e.isFirefox){this._ignoreFocus=!0;var q=this._clipboardDiv,k=this._rootDiv.ownerDocument;q||(this._clipboardDiv=q=e.createElement(k,"div"),q.style.position="fixed",q.style.whiteSpace="pre",
q.style.left="-1000px",this._rootDiv.appendChild(q));q.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";q.firstChild.focus();var m=this,u=function(){var a=m._getTextFromElement(q);q.innerHTML="";f=[];g(a,function(a){f.push(a)},function(){f.push(d)});return f.join("")},r=!1;this._ignorePaste=!0;if(!e.isLinux||2!==this._lastMouseButton)try{r=k.execCommand("paste",!1,null)}catch(v){r=1<q.childNodes.length||q.firstChild&&0<q.firstChild.childNodes.length}this._ignorePaste=!1;if(!r){if(a)return l.setTimeout(function(){m.focus();
(h=u())&&b&&b(h);m._ignoreFocus=!1},0),null;this.focus();this._ignoreFocus=!1;return""}this.focus();this._ignoreFocus=!1;(h=u())&&b&&b(h);return h}return""},_getDOMText:function(a,b){return a._line.getText(b)},_getTextFromElement:function(a){var b=a.ownerDocument,d=b.defaultView;if(!d.getSelection)return a.innerText||a.textContent;b=b.createRange();b.selectNode(a);a=d.getSelection();var d=[],g;for(g=0;g<a.rangeCount;g++)d.push(a.getRangeAt(g));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);
b=a.toString();a.removeAllRanges();for(g=0;g<d.length;g++)a.addRange(d[g]);this._ignoreSelect=!1;return b},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var b=this._getLineNode(a);return b&&!b.lineChanged&&!b.lineRemoved?b._line:new t(this,a)},_getLineHeight:function(a,b){if(void 0!==a&&this._lineHeight){var d=this._lineHeight[a];if(d)return d;if(b||void 0===b)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var b=
this._clientDiv.firstChild;b;){if(a===b.lineIndex)return b;b=b.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&(-1===a.lineIndex||!a._line);)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:this._clientDiv.lastChild;a&&(-1===a.lineIndex||!a._line);)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var b=this._getTopIndex(),d=-this._topIndexY+this._getScroll().y;
if(a>b)for(;b<a;b++)d+=this._getLineHeight(b);else for(b-=1;b>=a;b--)d-=this._getLineHeight(b);return d}return this._getLineHeight()*a},_getLineIndex:function(a){var b,d=0,g=this._model.getLineCount();if(this._lineHeight){var d=this._getTopIndex(),e=-this._topIndexY+this._getScroll().y;if(a!==e)if(a<e)for(;a<e&&0<d;)a+=this._getLineHeight(--d);else for(b=this._getLineHeight(d);a-b>=e&&d<g-1;)a-=b,b=this._getLineHeight(++d)}else b=this._getLineHeight(),d=Math.floor(a/b);return Math.max(0,Math.min(g-
1,d))},_getRulerParent:function(a){switch(a.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(a){(void 0===a||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var b=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var d=this._getViewPadding(),
g=this._viewDiv.getBoundingClientRect();a.top<g.top+d.top&&(b=this._getLineNext(b)||b)}return b.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(b){a._onModelChanging(b)},onChanged:function(b){a._onModelChanged(b)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._themeListener={onChanged:function(b){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",
this._themeListener.onChanged);var b=this._handlers=[],d=this._clientDiv,g=this._viewDiv,f=this._rootDiv,h=this._overlayDiv||d,l=d.ownerDocument,k=this._getWindow(),q=e.isIE?l:k;b.push({target:k,type:"resize",handler:function(b){return a._handleResize(b?b:k.event)}});b.push({target:d,type:"blur",handler:function(b){return a._handleBlur(b?b:k.event)}});b.push({target:d,type:"focus",handler:function(b){return a._handleFocus(b?b:k.event)}});b.push({target:g,type:"focus",handler:function(a){d.focus()}});
b.push({target:g,type:"scroll",handler:function(b){return a._handleScroll(b?b:k.event)}});b.push({target:d,type:"textInput",handler:function(b){return a._handleTextInput(b?b:k.event)}});b.push({target:d,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:k.event)}});b.push({target:d,type:"keypress",handler:function(b){return a._handleKeyPress(b?b:k.event)}});b.push({target:d,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:k.event)}});e.isIE&&b.push({target:l,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?
b:k.event)}});b.push({target:d,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:k.event)}});b.push({target:d,type:"copy",handler:function(b){return a._handleCopy(b?b:k.event)}});b.push({target:d,type:"cut",handler:function(b){return a._handleCut(b?b:k.event)}});b.push({target:d,type:"paste",handler:function(b){return a._handlePaste(b?b:k.event)}});b.push({target:l,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:k.event)}});if(e.isIOS||e.isAndroid)b.push({target:d,
type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:k.event)}}),b.push({target:d,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:k.event)}}),b.push({target:d,type:"touchend",handler:function(b){return a._handleTouchEnd(b?b:k.event)}});else{b.push({target:d,type:"selectstart",handler:function(b){return a._handleSelectStart(b?b:k.event)}});b.push({target:d,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:k.event)}});b.push({target:d,type:"mouseover",
handler:function(b){return a._handleMouseOver(b?b:k.event)}});b.push({target:d,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:k.event)}});b.push({target:q,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:k.event)}});b.push({target:q,type:"mousemove",handler:function(b){return a._handleMouseMove(b?b:k.event)}});b.push({target:f,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:k.event)}});b.push({target:f,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?
b:k.event)}});b.push({target:h,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:k.event)}});b.push({target:h,type:"drag",handler:function(b){return a._handleDrag(b?b:k.event)}});b.push({target:h,type:"dragend",handler:function(b){return a._handleDragEnd(b?b:k.event)}});b.push({target:h,type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:k.event)}});b.push({target:h,type:"dragover",handler:function(b){return a._handleDragOver(b?b:k.event)}});b.push({target:h,type:"dragleave",
handler:function(b){return a._handleDragLeave(b?b:k.event)}});b.push({target:h,type:"drop",handler:function(b){return a._handleDrop(b?b:k.event)}});b.push({target:this._clientDiv,type:26<e.isFirefox?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:k.event)}});this._clipDiv&&b.push({target:this._clipDiv,type:26<e.isFirefox?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:k.event)}});if(e.isFirefox&&
(!e.isWindows||15<=e.isFirefox))(g=k.MutationObserver||k.MozMutationObserver)?(this._mutationObserver=new g(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(d,{subtree:!0,characterData:!0})):b.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?b:k.event)}});if(e.isFirefox&&(!e.isWindows||15<=e.isFirefox)||e.isIE)b.push({target:this._clientDiv,type:"compositionstart",handler:function(b){return a._handleCompositionStart(b?
b:k.event)}}),b.push({target:this._clientDiv,type:"compositionend",handler:function(b){return a._handleCompositionEnd(b?b:k.event)}});this._overlayDiv&&(b.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:k.event)}}),b.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:k.event)}}),b.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:k.event)}}),b.push({target:this._overlayDiv,
type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:k.event)}}));this._isW3CEvents||b.push({target:this._clientDiv,type:"dblclick",handler:function(b){return a._handleDblclick(b?b:k.event)}})}this._hookRulerEvents(this._leftDiv,b);this._hookRulerEvents(this._rightDiv,b);this._hookRulerEvents(this._marginDiv,b);for(g=0;g<b.length;g++)f=b[g],A(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(a,b){if(a){var d=this,g=this._getWindow();e.isIE&&b.push({target:a,type:"selectstart",
handler:function(){return!1}});b.push({target:a,type:26<e.isFirefox?"wheel":e.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return d._handleMouseWheel(a?a:g.event)}});b.push({target:a,type:"click",handler:function(a){d._handleRulerEvent(a?a:g.event)}});b.push({target:a,type:"dblclick",handler:function(a){d._handleRulerEvent(a?a:g.event)}});b.push({target:a,type:"mousemove",handler:function(a){d._handleRulerEvent(a?a:g.event)}});b.push({target:a,type:"mouseover",handler:function(a){d._handleRulerEvent(a?
a:g.event)}});b.push({target:a,type:"mouseout",handler:function(a){d._handleRulerEvent(a?a:g.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var b=a.parent;"string"===typeof b&&(b=(a.document||document).getElementById(b));if(!b)throw"no parent";a.parent=b;a.model=a.model||new n.TextModel;var d=this._defaultOptions(),
g;for(g in d)d.hasOwnProperty(g)&&(this["_"+g]=void 0!==a[g]?a[g]:d[g].value);this._keyModes=[];this._rulers=[];this._selection=new r(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=(!e.isIE||9<=e.isIE)&&"function"===typeof b.ownerDocument.createRange().getBoundingClientRect;this._isW3CEvents=b.addEventListener;this._autoScrollTimerID=this._autoScrollY=
this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions();this._createView()},_checkOverlayScroll:function(){if(e.isMac&&e.isWebkit&&!this._metrics.invalid&&0===this._metrics.scrollWidth){var a=this._viewDiv,b=
this._isOverOverlayScroll();a.style.pointerEvents=b.vertical||b.horizontal?"":"none"}},_isOverOverlayScroll:function(){if(!(200>(new Date).getTime()-this._lastScrollTime))return{};var a=this._viewDiv.getBoundingClientRect(),b=this._lastMouseMoveX,d=this._lastMouseMoveY;return{vertical:a.top<=d&&d<a.bottom&&a.right-15<=b&&b<a.right,horizontal:a.bottom-15<=d&&d<a.bottom&&a.left<=b&&b<a.right}},_modifyContent:function(a,b){if(this._readonly&&!a._code)return!1;a.type="Verify";this.onVerify(a);if(null===
a.text||void 0===a.text)return!1;var d=this._model;try{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!0),d.setText(a.text,a.start,a.end)}finally{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}if(b){d=this._getSelection();d.setCaret(a.start+a.text.length);try{a._ignoreDOMSelection1&&(this._ignoreDOMSelection=!0),this._setSelection(d,!0)}finally{a._ignoreDOMSelection1&&(this._ignoreDOMSelection=!1)}}this.onModify({type:"Modify"});return!0},_onModelChanged:function(a){a.type="ModelChanged";
this.onModelChanged(a);a.type="Changed";var b=a.start,d=a.addedCharCount,g=a.removedCharCount,e=a.addedLineCount,f=a.removedLineCount,h=this._getSelection();h.end>b&&(h.end>b&&h.start<b+g?h.setCaret(b+d):(h.start+=d-g,h.end+=d-g),this._setSelection(h,!1,!1));b=this._model.getLineAtOffset(b);for(d=this._getLineNext();d;)g=d.lineIndex,b<=g&&g<=b+f&&(b===g&&!d.modelChangedEvent&&!d.lineRemoved?(d.modelChangedEvent=a,d.lineChanged=!0):(d.lineRemoved=!0,d.lineChanged=!1,d.modelChangedEvent=null)),g>b+
f&&(d.lineIndex=g+e-f,d._line.lineIndex=d.lineIndex),d=this._getLineNext(d);this._lineHeight&&(a=[b,f].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&(b<=this._maxLineIndex&&this._maxLineIndex<=b+f)&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._update()},_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=
this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==b)for(var d=a;d<b;d++)this._lineHeight[d]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=
-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new r(0,0,!1),!1,!1);this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var a=this._clientDiv;if(a){for(a=a.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;13>e.isFirefox&&this._fixCaret()}},_scrollViewAnimated:function(a,b,d){var g=this._getWindow();if(d&&this._scrollAnimation){var e=this;this._animation=new C({window:g,
duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);e._scrollView(0,a);b-=a},onEnd:function(){e._animation=null;e._scrollView(a,b);d&&g.setTimeout(d,0)}});this._animation.play()}else this._scrollView(a,b),d&&g.setTimeout(d,0)},_scrollView:function(a,b){this._ensureCaretVisible=!1;var d=this._viewDiv;a&&(d.scrollLeft+=a);b&&(d.scrollTop+=b)},_setClipboardText:function(a,b){var d,f=this._getWindow(),h=f.clipboardData;!h&&b&&(h=b.clipboardData);if(h&&(d=[],g(a,function(a){d.push(a)},
function(){d.push(e.platformDelimiter)}),h.setData(e.isIE?"Text":"text/plain",d.join(""))||21<e.isFirefox))return!0;var l=this._parent.ownerDocument,k=e.createElement(l,"pre");k.style.position="fixed";k.style.left="-1000px";g(a,function(a){k.appendChild(l.createTextNode(a))},function(){k.appendChild(e.createElement(l,"br"))});k.appendChild(l.createTextNode(" "));this._clientDiv.appendChild(k);h=l.createRange();h.setStart(k.firstChild,0);h.setEndBefore(k.lastChild);var q=f.getSelection();0<q.rangeCount&&
q.removeAllRanges();q.addRange(h);var m=this,h=function(){k&&k.parentNode===m._clientDiv&&m._clientDiv.removeChild(k);m._updateDOMSelection()},q=!1;this._ignoreCopy=!0;try{q=l.execCommand("copy",!1,null)}catch(u){}this._ignoreCopy=!1;if(!q&&b)return f.setTimeout(h,0),!1;h();return!0},_setDOMSelection:function(a,b,d,g,f){this._setDOMFullSelection(a,b,d,g);a=a._line.getNodeOffset(b);d=d._line.getNodeOffset(g);g=this._getWindow();b=this._parent.ownerDocument;if(g.getSelection){var h=g.getSelection();
g=b.createRange();g.setStart(a.node,a.offset);g.setEnd(d.node,d.offset);if(this._hasFocus&&(h.anchorNode!==a.node||h.anchorOffset!==a.offset||h.focusNode!==d.node||h.focusOffset!==d.offset||h.anchorNode!==d.node||h.anchorOffset!==d.offset||h.focusNode!==a.node||h.focusOffset!==a.offset))this._anchorNode=a.node,this._anchorOffset=a.offset,this._focusNode=d.node,this._focusOffset=d.offset,this._ignoreSelect=!1,0<h.rangeCount&&h.removeAllRanges(),h.addRange(g),this._ignoreSelect=!0;this._cursorDiv&&
(g=b.createRange(),f?(g.setStart(a.node,a.offset),g.setEnd(a.node,a.offset)):(g.setStart(d.node,d.offset),g.setEnd(d.node,d.offset)),f=g.getClientRects()[0],a=this._cursorDiv.parentNode,d=a.getBoundingClientRect(),f&&d&&(this._cursorDiv.style.top=f.top-d.top+a.scrollTop+"px",this._cursorDiv.style.left=f.left-d.left+a.scrollLeft+"px"))}else b.selection&&this._hasFocus&&(f=b.body,g=e.createElement(b,"div"),f.appendChild(g),f.removeChild(g),g=f.createTextRange(),g.moveToElementText(a.node.parentNode),
g.moveStart("character",a.offset),f=f.createTextRange(),f.moveToElementText(d.node.parentNode),f.moveStart("character",d.offset),g.setEndPoint("EndToStart",f),this._ignoreSelect=!1,g.select(),this._ignoreSelect=!0)},_setDOMFullSelection:function(a,b,d,g){if(this._selDiv1){var e=this._selDiv1;e.style.width="0px";e.style.height="0px";e=this._selDiv2;e.style.width="0px";e.style.height="0px";e=this._selDiv3;e.style.width="0px";e.style.height="0px";if(!(a===d&&b===g)){var f=this._getViewPadding(),h=this._clientDiv.getBoundingClientRect(),
l=this._viewDiv.getBoundingClientRect(),e=l.left+f.left,k=h.right,f=l.top+f.top,q=h.bottom,l=h=0;this._clipDiv?(l=this._clipDiv.getBoundingClientRect(),h=l.left-this._clipDiv.scrollLeft):(l=this._rootDiv.getBoundingClientRect(),h=l.left);l=l.top;this._ignoreDOMSelection=!0;var m=(new t(this,a.lineIndex,a)).getBoundingClientRect(b,!1),u=m.left;b=(new t(this,d.lineIndex,d)).getBoundingClientRect(g,!1);var r=b.left;this._ignoreDOMSelection=!1;var v=this._selDiv1,u=Math.min(k,Math.max(e,u)),p=Math.min(q,
Math.max(f,m.top)),n=k;g=Math.min(q,Math.max(f,m.bottom));v.style.left=u-h+"px";v.style.top=p-l+"px";v.style.width=Math.max(0,n-u)+"px";v.style.height=Math.max(0,g-p)+"px";a.lineIndex===d.lineIndex?(n=Math.min(r,k),v.style.width=Math.max(0,n-u)+"px"):(m=Math.min(q,Math.max(f,b.top)),r=Math.min(k,Math.max(e,r)),f=Math.min(q,Math.max(f,b.bottom)),q=this._selDiv3,q.style.left=e-h+"px",q.style.top=m-l+"px",q.style.width=Math.max(0,r-e)+"px",q.style.height=Math.max(0,f-m)+"px",1<Math.abs(a.lineIndex-d.lineIndex)&&
(a=this._selDiv2,a.style.left=e-h+"px",a.style.top=g-l+"px",a.style.width=Math.max(0,k-e)+"px",a.style.height=Math.max(0,m-g)+"px"))}}},_setGrab:function(a){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;e.isIE&&a&&(this._hadFocus=this._hasFocus);var b=this._clientDiv;b.contentEditable=!a;this._hadFocus&&
!a&&b.focus();this._overlayDiv&&(this._overlayDiv.style.zIndex=a?"-1":"1");for(a=this._getLineNext();a;)a._line.updateLinks(),a=this._getLineNext(a);this._updateDOMSelection()}},_setSelection:function(a,b,d,g,e){if(a){this._columnX=-1;void 0===d&&(d=!0);var f=this._selection;this._selection=a;!1!==b&&this._showCaret(!1,g,b,e);d&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,
b,d,g){var e=this._model,f=this._getSelection();b=this.convert({x:a,y:b},"page","document");a=this._getLineIndex(b.y);if(1===this._clickCount){e=this._getLine(a);a=e.getOffset(b.x,b.y-this._getLinePixel(a));e.destroy();if(g&&!d&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);d||f.collapse()}else 0===(this._clickCount&1)?(e=this._getLine(a),a=e.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(d=this._doubleClickSelection.start,g=
e.getNextOffset(a,{unit:"wordend",count:1})):(d=e.getNextOffset(a,{unit:"word",count:-1}),g=this._doubleClickSelection.end):(d=e.getNextOffset(a,{unit:"word",count:-1}),g=e.getNextOffset(d,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?(g=e.getLineAtOffset(this._doubleClickSelection.start),a>=g?(d=e.getLineStart(g),g=e.getLineEnd(a)):(d=e.getLineStart(a),g=e.getLineEnd(g))):(d=e.getLineStart(a),g=e.getLineEnd(a)),f.setCaret(d),f.extend(g);this._setSelection(f,!0,!0);return!0},
_setFullSelection:function(a,b){this._fullSelection=a;e.isWebkit&&(this._fullSelection=!0);var d=this._clipDiv||this._rootDiv;if(d)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!e.isIOS){var g=d.ownerDocument;this._highlightRGB=e.isWebkit?"transparent":"Highlight";var f=e.createElement(g,"div");this._selDiv1=f;f.style.position="absolute";f.style.borderWidth="0px";f.style.margin="0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width=
"0px";f.style.height="0px";f.style.zIndex="0";d.appendChild(f);var h=e.createElement(g,"div");this._selDiv2=h;h.style.position="absolute";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.background=this._highlightRGB;h.style.width="0px";h.style.height="0px";h.style.zIndex="0";d.appendChild(h);this._selDiv3=g=e.createElement(g,"div");g.style.position="absolute";g.style.borderWidth="0px";g.style.margin="0px";g.style.padding="0px";g.style.outline="none";
g.style.background=this._highlightRGB;g.style.width="0px";g.style.height="0px";g.style.zIndex="0";d.appendChild(g);if(e.isFirefox&&e.isMac){d=this._getWindow().getComputedStyle(g,null).getPropertyValue("background-color");switch(d){case "rgb(119, 141, 168)":d="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":d="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":d="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":d="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":d="rgb(255, 209, 129)";break;
case "rgb(102, 197, 71)":d="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":d="rgb(232, 184, 255)";break;default:d="rgb(180, 213, 255)"}this._highlightRGB=d;f.style.background=d;h.style.background=d;g.style.background=d}b||this._updateDOMSelection()}}else this._selDiv1&&(d.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&(d.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(d.removeChild(this._selDiv3),this._selDiv3=null)},_setBlockCursor:function(a){this._blockCursorVisible=
a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=this._viewDiv,b=e.createElement(a.ownerDocument,"div");b.className="textviewBlockCursor";this._cursorDiv=b;b.tabIndex=-1;b.style.zIndex="2";b.style.color="transparent";b.style.position="absolute";b.style.pointerEvents="none";b.innerHTML="\x26nbsp;";a.appendChild(b);
this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(a,b){this._wrapOffset=a;b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":
"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,b){this._tabSize=a;this._customTabSize=void 0;var d=this._clientDiv;e.isOpera?d&&(d.style.OTabSize=this._tabSize+""):537.1<=e.isWebkit?d&&(d.style.tabSize=this._tabSize+""):4<=e.isFirefox?d&&(d.style.MozTabSize=this._tabSize+""):8!==this._tabSize&&(this._customTabSize=this._tabSize);b||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",
this._themeListener.onChanged);(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a,b){this._themeClass=a;var d="textview",g=this._theme.getThemeClass();g&&(d+=" "+g);this._themeClass&&g!==this._themeClass&&(d+=" "+this._themeClass);this._rootDiv.className=d;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var d=this._clientDiv;this._wrapMode?(d.style.whiteSpace=
"pre-wrap",d.style.wordWrap="break-word"):(d.style.whiteSpace="pre",d.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,d,g){if(this._clientDiv&&!(0<this._redrawCount)&&!this._ignoreDOMSelection){var e=this._model,f=this._getSelection(),h=this._getScroll(),l=f.getCaret(),k=f.start,q=f.end,m=e.getLineAtOffset(k),u=e.getLineAtOffset(q),r=Math.max(Math.max(k,e.getLineStart(u)),q-1),e=this._getClientWidth(),v=this._getClientHeight(),
p=e/4,t=this._getBoundsAtOffset(l===k?k:r),n=t.left,w=t.right,x=t.top,z=t.bottom,C=0,A="object"===typeof d;if((a||A)&&!f.isEmpty())t=this._getBoundsAtOffset(l===q?k:r),C=(t.bottom>z?t.bottom:z)-(t.top<x?t.top:x),a&&(t.top===x?l===k?w=n+Math.min(t.right-n,e):n=w-Math.min(w-t.left,e):l===k?z=x+Math.min(t.bottom-x,v):x=z-Math.min(z-t.top,v));a=0;n<h.x&&(a=Math.min(n-h.x,-p));w>h.x+e&&(a=Math.max(w-h.x-e,p));f=0;x<h.y?f=x-h.y:z>h.y+v&&(f=z-h.y-v);g&&(0<g?0<f&&(f=Math.max(f,g)):0>f&&(f=Math.min(f,g)));
g=A&&"always"===d.scrollPolicy;if(0!==a||0!==f||g)return A?(g=0<f,0===f&&(f=x-h.y),h=d.viewAnchor,x=d.selectionAnchor,d=Math.min(Math.max(0,d.viewAnchorOffset||0)),f="top"===h?f+Math.floor(g?(1-d)*v:-d*v):"bottom"===h?f+Math.floor(g?d*v:-(1-d)*v):"center"===h?f+Math.floor(g?v/2+d*v:v/2-(1-d)*v):f+Math.floor(g?d*v:-d*v),m!==u&&("top"===x&&l!==k?f+=Math.floor(-C):"bottom"===x&&l!==q?f+=Math.floor(C):"center"===x&&(f+=Math.floor(C/2)))):0!==f&&"number"===typeof d&&(0>d&&(d=0),1<d&&(d=1),f+=Math.floor(0<
f?d*v:-d*v)),this._scrollViewAnimated(a,f,b),v!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;b&&b();return!1}},_startIME:function(){if(-1===this._imeOffset){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);
this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var b=this._handlers[a];x(b.target,b.type,b.handler)}this._handlers=null;this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},_updateDOMSelection:function(){if(!(0<this._redrawCount)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,d=b.getLineAtOffset(a.start),g=b.getLineAtOffset(a.end),
e=this._getLineNext();if(e){var f=this._getLinePrevious(),h;d<e.lineIndex?(d=e,h=b.getLineStart(e.lineIndex)):d>f.lineIndex?(d=f,h=b.getLineStart(f.lineIndex)):(d=this._getLineNode(d),h=a.start);g<e.lineIndex?(g=e,b=b.getLineStart(e.lineIndex)):g>f.lineIndex?(g=f,b=b.getLineStart(f.lineIndex)):(g=this._getLineNode(g),b=a.end);this._setDOMSelection(d,h,g,b,a.caret)}}},_update:function(a){if(!(0<this._redrawCount)){this._updateTimer&&(this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=
null,a=!1);var b=this._clientDiv,d=this._viewDiv;if(b){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var g=this._model,f=this._getScroll(!1),h=this._getViewPadding(),l=g.getLineCount(),k=this._getLineHeight(),q=!1,m=!1,u=!1,r=this._metrics.scrollWidth;this._wrapMode&&(b.style.width=(this._metrics.wrapWidth||this._getClientWidth())+"px");var v,p,n,w,x=0,z=0,C;if(this._lineHeight){for(;z<l;){C=this._getLineHeight(z);if(x+C>f.y)break;x+=C;z++}v=z;
p=Math.max(0,v-1);n=g=f.y-x;0<v&&(g+=this._getLineHeight(v-1))}else w=Math.max(0,f.y)/k,v=Math.floor(w),p=Math.max(0,v-1),g=Math.round((w-p)*k),n=Math.round((w-v)*k);this._topIndexY=n;w=this._rootDiv;var A=w.clientWidth,K=w.clientHeight;if(a){k=0;this._leftDiv&&(v=this._leftDiv.getBoundingClientRect(),k=v.right-v.left);v=this._getClientWidth();w=this._getClientHeight();m=v;this._wrapMode?this._metrics.wrapWidth&&(m=this._metrics.wrapWidth):m=Math.max(this._maxLineWidth,m);for(;z<l;)C=this._getLineHeight(z,
!1),x+=C,z++;l=x}else{w=this._getClientHeight();n=Math.min(v+Math.floor((w+n)/k),l-1);var f=Math.min(n+1,l-1),J;for(C=b.firstChild;C;){J=C.lineIndex;var F=C.nextSibling;if(!(p<=J&&J<=f)||C.lineRemoved||-1===C.lineIndex)this._mouseWheelLine===C?(C.style.display="none",C.lineIndex=-1):b.removeChild(C);C=F}C=this._getLineNext();var F=d.ownerDocument,P=F.createDocumentFragment();for(J=p;J<=f;J++)!C||C.lineIndex>J?(new t(this,J)).create(P,null):(P.firstChild&&(b.insertBefore(P,C),P=F.createDocumentFragment()),
C&&C.lineChanged&&(C=(new t(this,J)).create(P,C),C.lineChanged=!1),C=this._getLineNext(C));P.firstChild&&b.insertBefore(P,C);e.isWebkit&&!this._wrapMode&&(b.style.width="0x7fffffffpx");C=this._getLineNext();J=w+g;for(P=!1;C;)p=C.lineWidth,void 0===p&&(F=C._line.getBoundingClientRect(),p=C.lineWidth=Math.ceil(F.right-F.left),F=F.bottom-F.top,this._lineHeight?this._lineHeight[C.lineIndex]=F:0!==k&&(0!==F&&Math.ceil(k)!==Math.ceil(F))&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[C.lineIndex]=
F)),this._lineHeight&&!P&&(J-=this._lineHeight[C.lineIndex],0>J&&(n=C.lineIndex,P=!0)),this._wrapMode||(p>=this._maxLineWidth&&(this._maxLineWidth=p,this._maxLineIndex=C.lineIndex),this._checkMaxLineIndex===C.lineIndex&&(this._checkMaxLineIndex=-1)),C.lineIndex===v&&(this._topChild=C),C.lineIndex===n&&(this._bottomChild=C),C=this._getLineNext(C);-1!==this._checkMaxLineIndex&&(J=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=J&&J<l&&(k=new t(this,J),F=k.getBoundingClientRect(),p=F.right-F.left,
p>=this._maxLineWidth&&(this._maxLineWidth=p,this._maxLineIndex=J),k.destroy()));for(;z<l;)C=this._getLineHeight(z,z<=n),x+=C,z++;l=x;this._updateRuler(this._leftDiv,v,f,K);this._updateRuler(this._rightDiv,v,f,K);this._updateRuler(this._marginDiv,v,f,K);k=0;this._leftDiv&&(v=this._leftDiv.getBoundingClientRect(),k=v.right-v.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),f=f.right-f.left);d.style.left=k+"px";d.style.right=f+"px";f=this._scrollDiv;f.style.height=l+"px";v=this._getClientWidth();
!this._singleMode&&!this._wrapMode&&(x=q=w,(z="scroll"===d.style.overflowX)?q+=r:x-=r,C=n=v,(p="scroll"===d.style.overflowY)?n+=r:C-=r,w=q,v=n,l>w&&(u=!0,v=C),this._maxLineWidth>v&&(m=!0,w=x,l>w&&(u=!0,v=C)),z!==m&&(d.style.overflowX=m?"scroll":"hidden"),p!==u&&(d.style.overflowY=u?"scroll":"hidden"),q=z!==m||p!==u);u=v;this._wrapMode?this._metrics.wrapWidth&&(u=this._metrics.wrapWidth):u=Math.max(this._maxLineWidth,u);m=u;if((!e.isIE||9<=e.isIE)&&this._maxLineWidth>v)u+=h.right+h.left;f.style.width=
u+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=u+"px");f=this._getScroll(!1)}this._vScrollDiv&&(u=w-8,x=Math.max(15,Math.ceil(Math.min(1,u/(l+h.top+h.bottom))*u)),this._vScrollDiv.style.left=k+v-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*u/l))+"px",this._vScrollDiv.style.height=x+"px");!this._wrapMode&&this._hScrollDiv&&(u=v-8,x=Math.max(15,Math.ceil(Math.min(1,u/(this._maxLineWidth+h.left+h.right))*u)),this._hScrollDiv.style.left=k+Math.floor(Math.max(0,Math.floor(f.x*
u/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=w-9+"px",this._hScrollDiv.style.width=x+"px");z=f.x;x=this._clipDiv;u=this._overlayDiv;if(n=this._marginDiv)n.style.left=-z+k+this._metrics.marginWidth+h.left+"px",n.style.bottom=("scroll"===d.style.overflowX?r:0)+"px";x?(x.scrollLeft=z,x.scrollTop=0,d=k+h.left,r=h.top,a=v,k=w,z=0,n=-g,0===f.x&&(d-=h.left,a+=h.left,z=h.left),f.x+v===m&&(a+=h.right),0===f.y&&(r-=h.top,k+=h.top,n+=h.top),f.y+w===l&&(k+=h.bottom),x.style.left=d+"px",x.style.top=
r+"px",x.style.right=A-a-d+"px",x.style.bottom=K-k-r+"px",b.style.left=z+"px",b.style.top=n+"px",b.style.width=m+"px",b.style.height=w+g+"px",u&&(u.style.left=b.style.left,u.style.top=b.style.top,u.style.width=b.style.width,u.style.height=b.style.height)):(d=z,r=g,A=z+v,K=g+w,0===d&&(d-=h.left),0===r&&(r-=h.top),A===m&&(A+=h.right),f.y+w===l&&(K+=h.bottom),b.style.clip="rect("+r+"px,"+A+"px,"+K+"px,"+d+"px)",b.style.left=-z+k+h.left+"px",b.style.width=(this._wrapMode||e.isWebkit?m:v+z)+"px",a||(b.style.top=
-g+h.top+"px",b.style.height=w+g+"px"),u&&(u.style.clip=b.style.clip,u.style.left=b.style.left,u.style.width=b.style.width,a||(u.style.top=b.style.top,u.style.height=b.style.height)));this._updateDOMSelection();q&&(b=this._ensureCaretVisible,this._ensureCaretVisible=!1,b&&this._showCaret(),this._queueUpdate())}}},_updateOverflow:function(){var a=this._viewDiv;this._wrapMode?(a.style.overflowX="hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,b,g,f){if(a){var h=
this._parent.ownerDocument,l=this._getLineHeight(),k=this._getViewPadding();for(a=a.firstChild;a;){var q=a._ruler,m=l,u=q.getOverview();"page"===u&&(m+=this._topIndexY);a.style.top=-m+"px";a.style.height=f+m+"px";a.rulerChanged&&d(q.getRulerStyle(),a);var r,v=a.firstChild;v?(r=v,v=v.nextSibling):(r=e.createElement(h,"div"),r.style.visibility="hidden",a.appendChild(r));var p;if(a.rulerChanged&&r){m=-1;if(p=q.getWidestAnnotation())d(p.style,r),p.html&&(r.innerHTML=p.html);r.lineIndex=m;r.style.height=
l+k.top+"px"}var t;if("page"===u){for(q=q.getAnnotations(b,g+1);v;)m=v.lineIndex,p=v.nextSibling,(!(b<=m&&m<=g)||v.lineChanged)&&a.removeChild(v),v=p;v=a.firstChild.nextSibling;t=h.createDocumentFragment();for(m=b;m<=g;m++)if(!v||v.lineIndex>m){r=e.createElement(h,"div");if(p=q[m])d(p.style,r),p.html&&(r.innerHTML=p.html),r.annotation=p;r.lineIndex=m;r.style.height=this._getLineHeight(m)+"px";t.appendChild(r)}else t.firstChild&&(a.insertBefore(t,v),t=h.createDocumentFragment()),v&&(v=v.nextSibling);
t.firstChild&&a.insertBefore(t,v)}else{p=this._getClientHeight();m=this._model.getLineCount();v=p+k.top+k.bottom-2*this._metrics.scrollWidth;u=l*m<v?l:v/m;if(a.rulerChanged){for(p=a.childNodes.length;1<p;)a.removeChild(a.lastChild),p--;q=q.getAnnotations(0,m);t=h.createDocumentFragment();for(var n in q)m=n>>>0,0>m||(r=e.createElement(h,"div"),p=q[n],d(p.style,r),r.style.position="absolute",r.style.top=this._metrics.scrollWidth+l+Math.floor(m*u)+"px",p.html&&(r.innerHTML=p.html),r.annotation=p,r.lineIndex=
m,t.appendChild(r));a.appendChild(t)}else if(a._oldTrackHeight!==v)for(r=a.firstChild?a.firstChild.nextSibling:null;r;)r.style.top=this._metrics.scrollWidth+l+Math.floor(r.lineIndex*u)+"px",r=r.nextSibling;a._oldTrackHeight=v}a.rulerChanged=!1;a=a.nextSibling}}},_updateStyleSheet:function(){var a="";e.isWebkit&&0<this._metrics.scrollWidth&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");e.isFirefox&&(e.isMac&&this._highlightRGB&&"Highlight"!==this._highlightRGB)&&(a+="\n.textview ::-moz-selection {background: "+
this._highlightRGB+";}");if(a){var b=this._clientDiv.ownerDocument,d=b.getElementById("_textviewStyle");if(d)d.removeChild(d.firstChild),d.appendChild(b.createTextNode(a));else{d=e.createElement(b,"style");d.id="_textviewStyle";var g=b.getElementsByTagName("head")[0]||b.documentElement;d.appendChild(b.createTextNode(a));g.insertBefore(d,g.firstChild)}}},_updateStyle:function(a){!a&&e.isIE&&(this._rootDiv.style.lineHeight="normal");var b=this._metrics=this._calculateMetrics();this._variableLineHeight&&
(this._variableLineHeight=!1,this._resetLineHeight());this._rootDiv.style.lineHeight=e.isIE?b.lineHeight-(b.lineTrim.top+b.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();if(e.isMac&&e.isWebkit){var d=this._viewDiv;!b.invalid&&0===b.scrollWidth?(d.style.pointerEvents="none",d.style.zIndex="2"):(d.style.pointerEvents="",d.style.zIndex="")}a||(this.redraw(),this._resetLineWidth())}};k.EventTarget.addMixin(w.prototype);return{TextView:w}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(m,n){function p(k){this._model=k;this._projections=[];var f=this;this._listener={onChanged:function(l){f._onChanged(l)},onChanging:function(l){f._onChanging(l)}};k.addEventListener("postChanged",this._listener.onChanged);k.addEventListener("preChanging",this._listener.onChanging)}p.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(k){if(k){var f=this._model,l=this._projections;k._lineIndex=f.getLineAtOffset(k.start);k._lineCount=f.getLineAtOffset(k.end)-k._lineIndex;var e=k.text;e||(e="");k._model="string"===typeof e?new m.TextModel(e,f.getLineDelimiter()):e;var f=this.mapOffset(k.start,!0),e=k.end-k.start,d=k._lineCount,a=k._model.getCharCount(),h=k._model.getLineCount()-1,b={type:"Changing",text:k._model.getText(),
start:f,removedCharCount:e,addedCharCount:a,removedLineCount:d,addedLineCount:h};this.onChanging(b);b=this._binarySearch(l,k.start);l.splice(b,0,k);this.onChanged({type:"Changed",start:f,removedCharCount:e,addedCharCount:a,removedLineCount:d,addedLineCount:h})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(k,f){var l=this._projections,e=0,d,a;if(f){for(d=0;d<l.length;d++){a=l[d];if(a.start>k)break;if(a.end>k)return-1;e+=
a._model.getCharCount()-(a.end-a.start)}return k+e}for(d=0;d<l.length;d++){a=l[d];if(a.start>k-e)break;var h=a._model.getCharCount();if(a.start+h>k-e)return-1;e+=h-(a.end-a.start)}return k-e},removeProjection:function(k){this._removeProjection(k)},_removeProjection:function(k,f){var l,e=0;for(l=0;l<this._projections.length;l++){var d=this._projections[l];if(d===k){k=d;break}e+=d._model.getCharCount()-(d.end-d.start)}if(l<this._projections.length){var d=this._model,e=k.start+e,a=k.end-k.start,h=k._lineCount,
b=k._model.getCharCount(),g=k._model.getLineCount()-1;f||(d={type:"Changing",text:d.getText(k.start,k.end),start:e,removedCharCount:b,addedCharCount:a,removedLineCount:g,addedLineCount:h},this.onChanging(d));this._projections.splice(l,1);if(!f)this.onChanged({type:"Changed",start:e,removedCharCount:b,addedCharCount:a,removedLineCount:g,addedLineCount:h})}},_binarySearch:function(k,f){for(var l=k.length,e=-1,d;1<l-e;)d=Math.floor((l+e)/2),f<=k[d].start?l=d:e=d;return l},getCharCount:function(){for(var k=
this._model.getCharCount(),f=this._projections,l=0;l<f.length;l++)var e=f[l],k=k+(e._model.getCharCount()-(e.end-e.start));return k},getLine:function(k,f){if(0>k)return null;var l=this._model,e=this._projections,d=0,a=[],h=0,b,g,m;for(b=0;b<e.length;b++){m=e[b];if(m._lineIndex>=k-d)break;g=m._model.getLineCount()-1;if(m._lineIndex+g>=k-d){h=k-(m._lineIndex+d);if(h<g)return m._model.getLine(h,f);a.push(m._model.getLine(g))}h=m.end;d+=g-m._lineCount}for(h=Math.max(h,l.getLineStart(k-d));b<e.length;b++){m=
e[b];if(m._lineIndex>k-d)break;a.push(l.getText(h,m.start));g=m._model.getLineCount()-1;if(m._lineIndex+g>k-d)return a.push(m._model.getLine(0,f)),a.join("");a.push(m._model.getText());h=m.end;d+=g-m._lineCount}e=l.getLineEnd(k-d,f);h<e&&a.push(l.getText(h,e));return a.join("")},getLineAtOffset:function(k){for(var f=this._model,l=this._projections,e=0,d=0,a=0;a<l.length;a++){var h=l[a];if(h.start>k-e)break;var b=h._model.getCharCount();if(h.start+b>k-e){l=k-(h.start+e);d+=h._model.getLineAtOffset(l);
e+=l;break}d+=h._model.getLineCount()-1-h._lineCount;e+=b-(h.end-h.start)}return f.getLineAtOffset(k-e)+d},getLineCount:function(){for(var k=this._projections,f=this._model.getLineCount(),l=0;l<k.length;l++)var e=k[l],f=f+(e._model.getLineCount()-1-e._lineCount);return f},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(k,f){if(0>k)return-1;for(var l=this._model,e=this._projections,d=0,a=0,h=0;h<e.length;h++){var b=e[h];if(b._lineIndex>k-d)break;var g=b._model.getLineCount()-
1;if(b._lineIndex+g>k-d)return b._model.getLineEnd(k-(b._lineIndex+d),f)+b.start+a;a+=b._model.getCharCount()-(b.end-b.start);d+=g-b._lineCount}return l.getLineEnd(k-d,f)+a},getLineStart:function(k){if(0>k)return-1;for(var f=this._model,l=this._projections,e=0,d=0,a=0;a<l.length;a++){var h=l[a];if(h._lineIndex>=k-e)break;var b=h._model.getLineCount()-1;if(h._lineIndex+b>=k-e)return h._model.getLineStart(k-(h._lineIndex+e))+h.start+d;d+=h._model.getCharCount()-(h.end-h.start);e+=b-h._lineCount}return f.getLineStart(k-
e)+d},getText:function(k,f){void 0===k&&(k=0);var l=this._model,e=this._projections,d=0,a=[],h,b,g;for(h=0;h<e.length;h++){b=e[h];if(b.start>k-d)break;g=b._model.getCharCount();if(b.start+g>k-d){if(void 0!==f&&b.start+g>f-d)return b._model.getText(k-(b.start+d),f-(b.start+d));a.push(b._model.getText(k-(b.start+d)));k=b.end+d+g-(b.end-b.start)}d+=g-(b.end-b.start)}var m=k-d;if(void 0!==f){for(;h<e.length;h++){b=e[h];if(b.start>f-d)break;a.push(l.getText(m,b.start));g=b._model.getCharCount();if(b.start+
g>f-d)return a.push(b._model.getText(0,f-(b.start+d))),a.join("");a.push(b._model.getText());m=b.end;d+=g-(b.end-b.start)}a.push(l.getText(m,f-d))}else{for(;h<e.length;h++)b=e[h],a.push(l.getText(m,b.start)),a.push(b._model.getText()),m=b.end;a.push(l.getText(m))}return a.join("")},_onChanged:function(k){k=this._change;var f=k.baseStart,l=k.baseEnd,e,d,a=this._projections;for(e=0;e<a.length&&!(d=a[e],d.end>f);e++);var h=e;for(e=0;e<a.length&&!(d=a[e],d.start>=l);e++);var b=e,g=this._model,f=k.baseText.length-
(l-f);for(e=b;e<a.length;e++)d=a[e],d.start+=f,d.end+=f,d._lineIndex=g.getLineAtOffset(d.start);d=a.splice(h,b-h);for(e=0;e<d.length;e++)d[e].annotation&&d[e].annotation._expand();this.onChanged({type:"Changed",start:k.start,removedCharCount:k.removedCharCount,addedCharCount:k.addedCharCount,removedLineCount:k.removedLineCount,addedLineCount:k.addedLineCount});this._change=void 0},_onChanging:function(k){var f=!!this._change,l=this._change||{},e=k.start,d=e+k.removedCharCount;l.baseStart=e;l.baseEnd=
d;l.baseText=k.text;l.addedLineCount=k.addedLineCount;if(!f){this._change=l;l.text=k.text;var a=this._projections,h,b,g;k=function(d){for(h=b=0;b<a.length;b++){g=a[b];if(g.start>d)break;if(g.end>d)return-1;h+=g._model.getCharCount()-(g.end-g.start)}return d+h};l.start=k(e);-1===l.start&&(l.text=this._model.getText(g.start,e)+l.text,l.addedLineCount+=this._model.getLineAtOffset(e)-this._model.getLineAtOffset(g.start),l.start=g.start+h);l.end=k(d);-1===l.end&&(l.text+=this._model.getText(d,g.end),l.addedLineCount+=
this._model.getLineAtOffset(g.end)-this._model.getLineAtOffset(d),l.end=g.start+h)}l.addedCharCount=l.text.length;l.removedCharCount=l.end-l.start;l.removedLineCount=this.getLineAtOffset(l.end)-this.getLineAtOffset(l.start);this.onChanging({type:"Changing",text:l.text,start:l.start,removedCharCount:l.removedCharCount,addedCharCount:l.addedCharCount,removedLineCount:l.removedLineCount,addedLineCount:l.addedLineCount})},onChanging:function(k){return this.dispatchEvent(k)},onChanged:function(k){return this.dispatchEvent(k)},
setLineDelimiter:function(k){this._model.setLineDelimiter(k)},setText:function(k,f,l){function e(g){for(a=h=0;h<d.length;h++){b=d[h];if(b.start>g-a)break;var e=b._model.getCharCount();if(b.start+e>g-a)return-1;a+=e-(b.end-b.start)}return g-a}this._change={text:k||"",start:f||0,end:void 0===l?this.getCharCount():l};var d=this._projections,a,h,b,g,m;k=e(this._change.start);-1===k&&(g={projection:b,start:this._change.start-(b.start+a)},k=b.end);f=e(this._change.end);-1===f&&(m={projection:b,end:this._change.end-
(b.start+a)},f=b.start);g&&m&&g.projection===m.projection?b._model.setText(this._change.text,g.start,m.end):(this._model.setText(this._change.text,k,f),g&&(b=g.projection,b._model.setText("",g.start)),m&&(b=m.projection,b._model.setText("",0,m.end),b.start=b.end,b._lineCount=0));this._change=void 0}};n.EventTarget.addMixin(p.prototype);return{ProjectionTextModel:p}});
define("orion/editor/tooltip","i18n!orion/editor/nls/messages orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/util orion/util".split(" "),function(m,n,p,k,f,l){function e(d){this._view=d;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(d.getOptions("parent").ownerDocument)}e.getTooltip=function(d){d._tooltip||(d._tooltip=new e(d));return d._tooltip};e.prototype={_create:function(d){if(!this._tooltipDiv){var a=
this._tooltipDiv=l.createElement(d,"div");a.tabIndex=0;a.className="textviewTooltip";a.setAttribute("aria-live","assertive");a.setAttribute("aria-atomic","true");var e=this._tooltipContents=l.createElement(d,"div");a.appendChild(e);d.body.appendChild(a);var b=this;f.addEventListener(a,"mouseover",function(a){b._hideDelay&&(a=b._getWindow(),b._delayedHideTimeout&&(a.clearTimeout(b._delayedHideTimeout),b._delayedHideTimeout=null),b._hideTimeout&&(a.clearTimeout(b._hideTimeout),b._hideTimeout=null),
b._nextTarget=null)},!1);f.addEventListener(a,"mouseout",function(d){d=d.relatedTarget||d.toElement;!(d===a||b._hasFocus())&&(!d||!f.contains(a,d))&&b._hide()},!1);f.addEventListener(a,"keydown",function(a){27===a.keyCode&&b._hide()},!1);f.addEventListener(d,"mousedown",this._mouseDownHandler=function(d){b.isVisible()&&(f.contains(a,d.target||d.srcElement)||b._hide())},!0);this._view.addEventListener("Destroy",function(){b.destroy()});this._hide()}},_getWindow:function(){var d=this._tooltipDiv.ownerDocument;
return d.defaultView||d.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var d=this._tooltipDiv.parentNode;d&&d.removeChild(this._tooltipDiv);f.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var d=this._tooltipDiv;return!d?!1:f.contains(d,d.ownerDocument.activeElement)},hide:function(d){void 0===d&&(d=this._hideDelay);var a=this._getWindow();this._delayedHideTimeout&&(a.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null);var e=this;d?e._delayedHideTimeout=a.setTimeout(function(){e._delayedHideTimeout=null;e._hide();e.setTarget(e._nextTarget,0)},d):(e._hide(),e.setTarget(e._nextTarget,0))},_hide:function(){var d=this._tooltipDiv;d&&(this._hasFocus()&&this._view.focus(),this._contentsView&&(this._contentsView.destroy(),this._contentsView=null),this._tooltipContents&&(this._tooltipContents.innerHTML=""),d.style.visibility="hidden",d=this._getWindow(),this._showTimeout&&(d.clearTimeout(this._showTimeout),
this._showTimeout=null),this._delayedHideTimeout&&(d.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null),this._hideTimeout&&(d.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._fadeTimeout&&(d.clearInterval(this._fadeTimeout),this._fadeTimeout=null))},isVisible:function(){return this._tooltipDiv&&"visible"===this._tooltipDiv.style.visibility},setTarget:function(d,a,e){if(this.isVisible())this._hasFocus()||(this._nextTarget=d,this.hide(e));else if(this._target=d){var b=
this;d=b._getWindow();b._showTimeout&&(d.clearTimeout(b._showTimeout),b._showTimeout=null);0===a?b.show(!0):b._showTimeout=d.setTimeout(function(){b._showTimeout=null;b.show(!0)},a?a:b._showDelay)}},show:function(d){if(this._target){var a=this._target.getTooltipInfo();if(a){var e=this._tooltipDiv,b=this._tooltipContents;e.style.left=e.style.right=e.style.width=e.style.height=b.style.width=b.style.height="auto";var g=a.contents;g instanceof Array&&(g=this._getAnnotationContents(g));if("string"===typeof g)b.innerHTML=
g;else if(this._isNode(g))b.appendChild(g);else if(g instanceof k.ProjectionTextModel){var f=this._view,l=f.getOptions();l.wrapMode=!1;l.parent=b;var q=l.themeClass;q?((q=q.replace("tooltipTheme",""))&&(q=" "+q),q="tooltipTheme"+q):q="tooltipTheme";l.themeClass=q;l=this._contentsView=new n.TextView(l);l.addEventListener("LineStyle",function(a){f.onLineStyle(a)});l.setModel(g);g=l.computeSize();b.style.width=g.width+"px";b.style.height=g.height+"px";l.resize()}else return;b=e.ownerDocument.documentElement;
"right"===a.anchor?(g=b.clientWidth-a.x,e.style.right=g+"px"):(g=parseInt(this._getNodeStyle(e,"padding-left","0"),10),g+=parseInt(this._getNodeStyle(e,"border-left-width","0"),10),g=a.x-g,e.style.left=g+"px");e.style.maxWidth=b.clientWidth-g-10+"px";g=parseInt(this._getNodeStyle(e,"padding-top","0"),10);g+=parseInt(this._getNodeStyle(e,"border-top-width","0"),10);g=a.y-g;e.style.top=g+"px";e.style.maxHeight=b.clientHeight-g-10+"px";e.style.opacity="1";e.style.visibility="visible";if(d){var m=this,
p=this._getWindow();m._hideTimeout=p.setTimeout(function(){m._hideTimeout=null;var a=parseFloat(m._getNodeStyle(e,"opacity","1"));m._fadeTimeout=p.setInterval(function(){"visible"===e.style.visibility&&0<a?(a-=0.1,e.style.opacity=a):m._hide()},m._fadeDelay/10)},m._autoHideDelay)}}}},_getAnnotationContents:function(d){function a(a,b){var d=t.getLineStart(t.getLineAtOffset(a)),g=t.getLineEnd(t.getLineAtOffset(b),!0);return t.getText(d,g)}function e(b){var d=b.title,g=l.createElement(q,"div");g.className=
"tooltipRow";b.html&&(g.innerHTML=b.html,g.lastChild&&f.addEventListener(g.lastChild,"click",function(a){a=b.start;var d=b.end;p.getBaseModel&&(a=p.mapOffset(a,!0),d=p.mapOffset(d,!0));r.setSelection(a,d,1/3,function(){v._hide()})},!1),g.appendChild(q.createTextNode("\u00a0")));d||(d=a(b.start,b.end));"function"===typeof d&&(d=b.title());if("string"===typeof d){var h=l.createElement(q,"span");h.appendChild(q.createTextNode(d));d=h}g.appendChild(d);return g}for(var b,g=[],u=0;u<d.length;u++)b=d[u],
""!==b.title&&!b.groupAnnotation&&g.push(b);d=g;if(0===d.length)return null;var v=this,q=this._tooltipDiv.ownerDocument,r=this._view,p=r.getModel(),t=p.getBaseModel?p.getBaseModel():p;if(1===d.length){b=d[0];if(void 0!==b.title)return b=e(b),b.firstChild&&((d=b.firstChild.className)&&(d+=" "),b.firstChild.className=d+"single"),b;d=new k.ProjectionTextModel(t);g=t.getLineStart(t.getLineAtOffset(b.start));u=t.getCharCount();b.end!==u&&d.addProjection({start:b.end,end:u});0<g&&d.addProjection({start:0,
end:g});return d}g=l.createElement(q,"div");b=l.createElement(q,"em");b.appendChild(q.createTextNode(m.multipleAnnotations));g.appendChild(b);for(u=0;u<d.length;u++)b=d[u],(b=e(b))&&g.appendChild(b);return g},_getNodeStyle:function(d,a,e){var b;if(d&&(b=d.style[a],!b))if(d.currentStyle){for(b=0;-1!==(b=a.indexOf("-",b));)a=a.substring(0,b)+a.substring(b+1,b+2).toUpperCase()+a.substring(b+2);b=d.currentStyle[a]}else b=(d=d.ownerDocument.defaultView.getComputedStyle(d,null))?d.getPropertyValue(a):null;
return b||e},_isNode:function(d){return"object"===typeof Node?d instanceof Node:d&&"object"===typeof d&&"number"===typeof d.nodeType&&"string"===typeof d.nodeName}};return{Tooltip:e}});
define("orion/editor/editor","i18n!orion/editor/nls/messages orion/editor/eventTarget orion/editor/tooltip orion/editor/annotations orion/objects orion/util".split(" "),function(m,n,p,k,f,l){function e(a){a=a||{};this._domNode=a.domNode;this._model=a.model;this._undoStack=a.undoStack;this._statusReporter=a.statusReporter;this._title=null;var b=this;this._listener={onChanged:function(a){b.onChanged(a)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function d(a){a=a||{};e.call(this,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._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var a=k.AnnotationType;e.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null;this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(a,b){return this.getModel().getText(a,b)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},
install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(a){return this.dispatchEvent(a)},onInputChanged:function(a){return this.dispatchEvent(a)},onChanged:function(a){this.checkDirty()},reportStatus:function(a,b,d){this._statusReporter&&this._statusReporter(a,b,d)},resize:function(){},setDirty:function(a){this._dirty!==a&&(this._dirty=a,this.onDirtyChanged({type:"DirtyChanged"}))},
_setModelText:function(a){this._model&&this._model.setText(a)},setInput:function(a,b,d,e){this._title=a;e||(b?this.reportStatus(b,"error"):null!==d&&(void 0!==d&&"string"===typeof d)&&this._setModelText(d),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:a,message:b,contents:d,contentsSaved:e})},setText:function(a,b,d){this.getModel().setText(a,b,d)},uninstall:function(){this.installed=!1}};n.EventTarget.addMixin(e.prototype);d.prototype=new e;
f.mixin(d.prototype,{destroy:function(){e.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},
getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){if(!this._textView)return null;var a=this._textView.getModel();a.getBaseModel&&(a=a.getBaseModel());return a},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},
getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(a,b){if(this._annotationRulerVisible!==a||b)if(this._annotationRulerVisible=a,this._annotationRuler){var d=this._textView;a?d.addRuler(this._annotationRuler,0):d.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(a,b){if(this._foldingRulerVisible!==a||b)if(this._foldingRulerVisible=
a,this._foldingRuler){var d=this._textView;d.getModel().getBaseModel&&(a?d.addRuler(this._foldingRuler):d.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(a,b){if(this._lineNumberRulerVisible!==a||b)if(this._lineNumberRulerVisible=a,this._lineNumberRuler){var d=this._textView;a?d.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):d.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(a,b){if(this._overviewRulerVisible!==a||b)if(this._overviewRulerVisible=
a,this._overviewRuler){var d=this._textView;a?d.addRuler(this._overviewRuler):d.removeRuler(this._overviewRuler)}},mapOffset:function(a,b){var d=this._textView.getModel();d.getBaseModel&&(a=d.mapOffset(a,b));return a},getLineAtOffset:function(a){return this.getModel().getLineAtOffset(this.mapOffset(a))},getLineStart:function(a){return this.getModel().getLineStart(a)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var a=this._textView,b=a.getSelection(),
a=a.getModel();a.getBaseModel&&(b.start=a.mapOffset(b.start),b.end=a.mapOffset(b.end));return b},_expandOffset:function(d){var b=this._textView.getModel(),g=this._annotationModel;if(g&&b.getBaseModel)for(d=g.getAnnotations(d,d+1);d.hasNext();)b=d.next(),b.type===a.ANNOTATION_FOLDING&&b.expand&&b.expand()},setCaretOffset:function(a,b,d){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(a),a=f.mapOffset(a,!0));e.setCaretOffset(a,b,d)},setText:function(a,b,d){var e=this._textView,
f=e.getModel();f.getBaseModel&&(void 0!==b&&(this._expandOffset(b),b=f.mapOffset(b,!0)),void 0!==d&&(this._expandOffset(d),d=f.mapOffset(d,!0)));e.setText(a,b,d)},setSelection:function(a,b,d,e){var f=this._textView,l=f.getModel();l.getBaseModel&&(this._expandOffset(a),this._expandOffset(b),a=l.mapOffset(a,!0),b=l.mapOffset(b,!0));f.setSelection(a,b,d,e)},moveSelection:function(a,b,d,e){var f=this._textView;this.setSelection(a,b||a,1/3,function(){(void 0===e||e)&&f.focus();d&&d()})},_getTooltipInfo:function(a,
b){var d=this._textView,e=this.getAnnotationModel();if(!e)return null;var f=this._annotationStyler;if(!f)return null;var l=d.getOffsetAtLocation(a,b);if(-1===l)return null;l=this.mapOffset(l);f=f.getAnnotationsByType(e,l,l+1);e=[];for(l=0;l<f.length;l++)f[l].rangeStyle&&e.push(f[l]);if(0===e.length)return null;d=d.convert({x:a,y:b},"document","page");return{contents:e,anchor:"left",x:d.x+10,y:d.y+20}},_highlightCurrentLine:function(d,b){var g=this._annotationModel;if(g){var e=this._textView;if(!e.getOptions("singleMode")){var f=
e.getModel(),l=b?f.getLineAtOffset(b.start):-1,k=f.getLineAtOffset(d.start),e=d.start===d.end,m=!b||b.start===b.end,p=f.getLineStart(k),n=f.getLineEnd(k);f.getBaseModel&&(p=f.mapOffset(p),n=f.mapOffset(n));f=this._currentLineAnnotation;if(!(l===k&&m&&e&&f&&f.start===p&&f.end===n)){var l=f?[f]:null,A;e&&(f=a.createAnnotation(a.ANNOTATION_CURRENT_LINE,p,n),A=[f]);this._currentLineAnnotation=f;g.replaceAnnotations(l,A)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty());this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack));this._contentAssistFactory&&(this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist());var d=this,b=this._textView,g=this;this._listener={onModelChanged:function(a){g.checkDirty()},onMouseOver:function(a){g._listener.onMouseMove(a)},onMouseMove:function(a){var d=
p.Tooltip.getTooltip(b);d&&!(g._listener.lastMouseX===a.event.clientX&&g._listener.lastMouseY===a.event.clientY)&&(g._listener.lastMouseX=a.event.clientX,g._listener.lastMouseY=a.event.clientY,d.setTarget({x:a.x,y:a.y,getTooltipInfo:function(){return g._getTooltipInfo(this.x,this.y)}}))},onMouseOut:function(a){var d=p.Tooltip.getTooltip(b);d&&!(g._listener.lastMouseX===a.event.clientX&&g._listener.lastMouseY===a.event.clientY)&&(g._listener.lastMouseX=a.event.clientX,g._listener.lastMouseY=a.event.clientY,
d.setTarget(null))},onScroll:function(a){(a=p.Tooltip.getTooltip(b))&&a.setTarget(null,0,0)},onSelection:function(a){g._updateCursorStatus();g._highlightCurrentLine(a.newValue,a.oldValue)}};b.addEventListener("ModelChanged",this._listener.onModelChanged);b.addEventListener("Selection",this._listener.onSelection);b.addEventListener("MouseOver",this._listener.onMouseOver);b.addEventListener("MouseOut",this._listener.onMouseOut);b.addEventListener("MouseMove",this._listener.onMouseMove);b.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var f;if(f="function"===typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(d,this._undoStack,this._contentAssist))this._textActions=f.textActions,this._linkedMode=f.linkedMode,this._sourceCodeActions=f.sourceCodeActions}f=function(b,g){if(void 0!==b&&-1!==b){for(var e=this.getView().getModel(),f=this.getAnnotationModel(),l=d.mapOffset(e.getLineStart(b)),
e=d.mapOffset(e.getLineEnd(b)),k=f.getAnnotations(l,e),q=null;k.hasNext();){var m=k.next();if(m.type===a.ANNOTATION_BOOKMARK){q=m;break}}q?f.removeAnnotation(q):(q=a.createAnnotation(a.ANNOTATION_BOOKMARK,l,e),q.title=void 0,f.addAnnotation(q))}};if(this._annotationFactory){var l=b.getModel();l.getBaseModel&&(l=l.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(l))if(l=this._annotationStyler=this._annotationFactory.createAnnotationStyler(b,this._annotationModel))l.addAnnotationType(a.ANNOTATION_CURRENT_SEARCH),
l.addAnnotationType(a.ANNOTATION_MATCHING_SEARCH),l.addAnnotationType(a.ANNOTATION_ERROR),l.addAnnotationType(a.ANNOTATION_WARNING),l.addAnnotationType(a.ANNOTATION_MATCHING_BRACKET),l.addAnnotationType(a.ANNOTATION_CURRENT_BRACKET),l.addAnnotationType(a.ANNOTATION_CURRENT_LINE),l.addAnnotationType(a.ANNOTATION_READ_OCCURRENCE),l.addAnnotationType(a.ANNOTATION_WRITE_OCCURRENCE),l.addAnnotationType(a.ANNOTATION_SELECTED_LINKED_GROUP),l.addAnnotationType(a.ANNOTATION_CURRENT_LINKED_GROUP),l.addAnnotationType(a.ANNOTATION_LINKED_GROUP),
l.addAnnotationType("orion.annotation.highlightError");var l=this._annotationFactory.createAnnotationRulers(this._annotationModel),k=this._annotationRuler=l.annotationRuler;k&&(k.onDblClick=f,k.setMultiAnnotationOverlay({html:"\x3cdiv class\x3d'annotationHTML overlay'\x3e\x3c/div\x3e"}),k.addAnnotationType(a.ANNOTATION_ERROR),k.addAnnotationType(a.ANNOTATION_WARNING),k.addAnnotationType(a.ANNOTATION_TASK),k.addAnnotationType(a.ANNOTATION_BOOKMARK));this.setAnnotationRulerVisible(this._annotationRulerVisible||
void 0===this._annotationRulerVisible,!0);if(k=this._overviewRuler=l.overviewRuler)k.addAnnotationType(a.ANNOTATION_CURRENT_SEARCH),k.addAnnotationType(a.ANNOTATION_MATCHING_SEARCH),k.addAnnotationType(a.ANNOTATION_READ_OCCURRENCE),k.addAnnotationType(a.ANNOTATION_WRITE_OCCURRENCE),k.addAnnotationType(a.ANNOTATION_CURRENT_BLAME),k.addAnnotationType(a.ANNOTATION_ERROR),k.addAnnotationType(a.ANNOTATION_WARNING),k.addAnnotationType(a.ANNOTATION_TASK),k.addAnnotationType(a.ANNOTATION_BOOKMARK),k.addAnnotationType(a.ANNOTATION_MATCHING_BRACKET),
k.addAnnotationType(a.ANNOTATION_CURRENT_BRACKET),k.addAnnotationType(a.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(a.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(a.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=f,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
void 0===this._lineNumberRulerVisible,!0));this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(a.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));this.dispatchEvent({type:"TextViewInstalled",textView:b});e.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var a=this._textView;a&&(a.destroy(),
this._annotationModel&&this._annotationModel.setTextModel(null),this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0,this.dispatchEvent({type:"TextViewUninstalled",textView:a}),
e.prototype.uninstall.call(this))},_updateCursorStatus:function(){for(var a=this.getModel(),b=this.getCaretOffset(),d=a.getLineAtOffset(b),a=a.getLineStart(d),b=b-a,a=this.getKeyModes(),e=0;e<a.length;e++){var f=a[e];if(f.isActive()&&f.isStatusActive&&f.isStatusActive())return}this.reportStatus(l.formatMessage(m.lineColumn,d+1,b+1))},showAnnotations:function(d,b,g,e){var f=this._annotationModel;if(f){for(var l=[],k=[],m=f.getTextModel(),p=f.getAnnotations(),n;p.hasNext();)n=p.next(),-1!==b.indexOf(n.type)&&
n.creatorID===this&&l.push(n);if(d)for(b=0;b<d.length;b++)if(n=d[b]){if(g)n=g(n);else{var A;"number"===typeof n.line?(A=m.getLineStart(n.line-1),p=A+n.start-1,A=A+n.end-1):(p=n.start,A=n.end);var x=e(n);if(!x)continue;n=a.createAnnotation(x,p,A,n.description)}n.creatorID=this;k.push(n)}f.replaceAnnotations(l,k)}},showProblems:function(d){this.showAnnotations(d,[a.ANNOTATION_ERROR,a.ANNOTATION_WARNING,a.ANNOTATION_TASK],null,function(b){switch(b.severity){case "error":return a.ANNOTATION_ERROR;case "warning":return a.ANNOTATION_WARNING;
case "task":return a.ANNOTATION_TASK}return null})},showOccurrences:function(d){this.showAnnotations(d,[a.ANNOTATION_READ_OCCURRENCE,a.ANNOTATION_WRITE_OCCURRENCE],null,function(b){return b.readAccess?a.ANNOTATION_READ_OCCURRENCE:a.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(d){var b=this._blameRGB,g=this.getTextView().getOptions("parent").ownerDocument;if(!b){var e=l.createElement(g,"div");e.className="annotation blame";g.body.appendChild(e);var p=(g.defaultView||g.parentWindow).getComputedStyle(e).getPropertyValue("background-color");
e.parentNode.removeChild(e);var e=p.indexOf("("),q=p.indexOf(")"),p=p.substring(e+1,q);this._blameRGB=b=p.split(",").slice(0,3)}var r=function(){var a=k.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=f.mixin({},a.style);a.style.style=f.mixin({},a.style.style);a.style.style.backgroundColor="";this.groupAnnotation=a;a.blame=this.blame;a.html=this.html;a.creatorID=this.creatorID;return a},n=function(){var a=l.createElement(g,"div");a.className="tooltipTitle";var b=
this.blame.Message.indexOf("\n");-1===b&&(b=this.blame.Message.length);var d=l.createElement(g,"a");d.href=this.blame.CommitLink;d.appendChild(g.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(d);a.appendChild(l.createElement(g,"br"));a.appendChild(g.createTextNode(l.formatMessage(m.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},t=this.getModel();this.showAnnotations(d,[a.ANNOTATION_BLAME,a.ANNOTATION_CURRENT_BLAME],function(d){var g=t.getLineStart(d.Start-1),
e=t.getLineEnd(d.End-1,!0),g=k.AnnotationType.createAnnotation(a.ANNOTATION_BLAME,g,e,n),e=b.slice(0);e.push(d.Shade);g.style=f.mixin({},g.style);g.style.style=f.mixin({},g.style.style);g.style.style.backgroundColor="rgba("+e.join()+")";g.groupId=d.Name;g.groupType=a.ANNOTATION_CURRENT_BLAME;g.createGroupAnnotation=r;g.html='\x3cimg class\x3d"annotationHTML blame" src\x3d"'+d.AuthorImage+'"/\x3e';g.blame=d;return g})},showSelection:function(a,b,d,e,f){"number"===typeof a?("number"!==typeof b&&(b=
a),this.moveSelection(a,b)):"number"===typeof d&&(a=this.getModel().getLineStart(d-1),"number"===typeof e&&(a+=e),"number"!==typeof f&&(f=0),this.moveSelection(a,a+f))},_setModelText:function(a){this._textView&&(this._textView.setText(a),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(a,b,d,f,l){e.prototype.setInput.call(this,a,b,d,f);this._textView&&(!f&&!l)&&this._textView.focus()},onGotoLine:function(a,b,d,e){if(this._textView){var f=
this.getModel();a=Math.max(0,Math.min(a,f.getLineCount()-1));var l=f.getLineStart(a),k=0;void 0===d&&(d=0);"string"===typeof b?(a=f.getLine(a).indexOf(b),-1!==a&&(k=a,d=k+b.length)):(k=b,b=f.getLineEnd(a)-l,k=Math.min(k,b),d=Math.min(d,b));this.moveSelection(l+k,l+d,e)}}});return{BaseEditor:e,Editor:d}});
define("orion/markdownView","marked/marked orion/editor/editor orion/objects orion/webui/littlelib orion/URITemplate orion/section orion/URL-shim".split(" "),function(m,n,p,k,f,l){function e(a,b,d,e){return function(f,h){if(-1===h.href.indexOf(":"))try{var l;"filesystem:"===b.protocol?l={href:"filesystem:"+(new URL(h.href,b.pathname)).href}:(l=new URL(h.href,b),e&&(l.protocol="",l.host=""));if("!"!==f[0][0])h.href=g.expand({resource:l.href});else{if(d.readBlob){var k="_md_img_"+v++;d.readBlob(l.href).then(function(a){var b=
l.href.match(u);a=URL.createObjectURL(new Blob([a],{type:b?"image/"+b[1]:"image/png"}));document.getElementById(k).src=a;URL.revokeObjectURL(a)});return"\x3cimg id\x3d'"+k+"' src\x3d''\x3e"}h.href=l.href}}catch(q){console.log(q)}return a.call(this,f,h)}}function d(a,b,d){var g=m.InlineLexer.prototype.outputLink,f=new URL(b,window.location.href);m.InlineLexer.prototype.outputLink=e(g,f,d,-1===b.indexOf(":"));a=m(a,{sanitize:!0});m.InlineLexer.prototype.outputLink=g;return a}function a(a){this.fileClient=
a.fileClient;this.progress=a.progress;this.canHide=a.canHide;this._node=null}function h(a){this.id="orion.viewer.markdown";this.fileClient=a.fileClient;this.metadata=a.metadata;q.apply(this,arguments)}function b(a){this._parent=a.parent;this.fileClient=a.fileService;this.metadata=a.metadata;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progressService;this.model=a.model;this.undoStack=a.undoStack}var g=
new f("#{,resource,params*}"),u=/\.([0-9a-z]+)(?:[\?#]|$)/i,v=0;a.prototype={display:function(a,b,g,e){a.classList.add("orionMarkdown");a.innerHTML=d(b,g,e)},displayContents:function(a,b){var d=b.Location||b;k.empty(a);var g=document.createElement("div");(this.progress?this.progress.progress(this.fileClient.read(d),"Reading file "+(b.Name||d)):this.fileClient.read(d)).then(function(a){this.display.bind(this)(g,a,d,this.fileClient)}.bind(this));a.appendChild(g)},displayInFrame:function(a,b,d,g,e){a=
new l.Section(a,{id:"markdownSection",title:b.Name||e||"readme",headerClass:d,canHide:this.canHide});g&&(d=a.getTitleElement())&&d.classList.add(g);this.displayContents.call(this,a.getContentElement(),b)}};var q=n.BaseEditor;h.prototype=Object.create(q.prototype);p.mixin(h.prototype,{createMarked:function(a){return d(a,this.metadata.Location,this.fileClient)},install:function(){var a=this._rootDiv=document.createElement("div");a.style.width="100%";a.style.height="100%";var b=this._contentDiv=document.createElement("div");
b.classList.add("orionMarkdown");a.appendChild(b);k.node(this._domNode).appendChild(a);this._contentDiv.innerHTML=this.createMarked(this.getModel().getText());q.prototype.install.call(this)},setInput:function(a,b,d,g){q.prototype.setInput.call(this,a,b,d,g);!b&&!g&&(this._contentDiv.innerHTML=this.createMarked(d))},uninstall:function(){k.empty(this._domNode);q.prototype.uninstall.call(this)}});b.prototype={create:function(){this.editor=new h({domNode:this._parent,fileClient:this.fileClient,metadata:this.metadata,
model:this.model,undoStack:this.undoStack});this.editor.install()},destroy:function(){this.editor&&this.editor.destroy();this.editor=null}};return{MarkdownEditorView:b,MarkdownView:a}});
define("orion/projects/projectEditor","orion/URITemplate orion/webui/littlelib orion/Deferred orion/objects orion/projectCommands orion/commandRegistry orion/PageLinks orion/explorers/explorer orion/section".split(" "),function(m,n,p,k,f,l,e,d,a){function h(a){this.root=a}function b(a,b,d){this._init(a);this.projectEditor=b;this.explorer=d}function g(a){this.root=a}function u(a,b,d){this._init(a);this.projectEditor=b;this.explorer=d}function v(a,b){this.root=a;this.projectClient=b}function q(a,b,
d){this._init(a);this.projectEditor=b;this.explorer=d;this.commandService=a.commandRegistry;this.actionScopeId=a.actionScopeId}function r(a,b,d){this.root=a;this.launchConfigurations=b;this.projectClient=d}function z(a,b,d){this._init(a);this.projectEditor=b;this.explorer=d;this.commandService=a.commandRegistry;this.actionScopeId=a.actionScopeId;this.projectClient=a.projectClient}function t(a,b,g,e,f){d.Explorer.apply(this,arguments);this.actionScopeId=f;this.selectionActions="LaunchConfigurationExplorerSelectionActions";
this.actionsSections=[this.selectionActions]}function w(a){this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.progress=a.progress;this.preferences=a.preferences;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.commandRegistry=a.commandRegistry;this._node=null;this.dependencyActions="dependencyActions";this.launchConfigurationActions="launchConfigurationsActions";this.createCommands()}var A=new m("./edit.html#{,resource,params*}");h.prototype=new d.ExplorerModel;
h.prototype.constructor=h;h.prototype.getRoot=function(a){return a(this.root)};h.prototype.getChildren=function(a,b){a===this.root?b([{id:"Name",displayName:"Name",value:a.Name,no:1},{id:"Description",displayName:"Description",value:a.Description,no:2},{id:"Url",displayName:"Site",value:a.Url,href:a.Url,no:3}]):b([])};h.prototype.getId=function(a){return"ProjectInfo"+a.id};b.prototype=new d.SelectionRenderer;b.prototype.constructor=b;b.prototype.getCellHeaderElement=function(a){};b.prototype.getCellElement=
function(a,b,d){if(0===a)return a=document.createElement("td"),d=document.createElement("span"),d.className="discreetInputLabel",d.appendChild(document.createTextNode(b.displayName)),a.classList.add("discreetInputLabel"),a.appendChild(d),a.width="20%",a;if(1===a){if(b.href){a=document.createElement("td");a.style.verticalAlign="top";var g=document.createElement("input");g.style.visibility="hidden";var e=document.createElement("div");e.style.marginTop="-15px";e.title="Click to edit";e.className="discreetInput";
e.tabIndex=b.no;var f=document.createElement("a");f.href=b.value||"";f.appendChild(document.createTextNode(b.value||""));f.tabIndex=b.no+1;e.appendChild(f);e.title="Click to edit";e.onclick=function(a){e.style.visibility="hidden";f.style.visibility="hidden";g.style.visibility="";g.focus()}.bind(this.projectEditor);e.onfocus=e.onclick;e.onkeyup=function(a){if(a.keyCode===n.KEY.ENTER)e.onclick(a)}.bind(this.projectEditor);f.urlSelector=e;this.projectEditor._renderEditableFields(g,b.id,b.no,f);a.appendChild(g);
a.appendChild(e);return a}a=document.createElement("td");a.style.verticalAlign="top";d="Description"===b.id?document.createElement("textArea"):document.createElement("input");this.projectEditor._renderEditableFields(d,b.id,b.no,null);a.appendChild(d);return a}};g.prototype=new d.ExplorerModel;g.prototype.constructor=g;g.prototype.getRoot=function(a){return a(this.root)};g.prototype.getChildren=function(a,b){if(a===this.root){for(var d=0;d<a.Children.length;d++)a.Children[d].parent=a;b(a.Children)}else b([])};
g.prototype.getId=function(a){return"AdditionalInfo"+d.ExplorerModel.prototype.getId.call(this,{Location:a.parent.Name+a.Name})};u.prototype=new d.SelectionRenderer;u.prototype.constructor=u;u.prototype.getCellHeaderElement=function(a){if(0===a)return a=document.createElement("td"),a.colSpan=2,a.appendChild(document.createTextNode(this.explorer.model.root.Name)),a};u.prototype.getCellElement=function(a,b,d){if(0===a)return a=document.createElement("td"),d=document.createElement("span"),d.className=
"discreetInputLabel",d.appendChild(document.createTextNode(b.Name)),a.classList.add("discreetInputLabel"),a.appendChild(d),a.width="20%",a;if(1===a){a=document.createElement("td");if(b.Href){d=document.createElement("a");var g=new m(b.Href);d.href=g.expand({OrionHome:e.getOrionHome()});d.appendChild(document.createTextNode(b.Value||" "));a.appendChild(d)}else a.appendChild(document.createTextNode(b.Value||" "));return a}};v.prototype=new d.ExplorerModel;v.prototype.constructor=v;v.prototype.getRoot=
function(a){return a(this.root)};v.prototype.getChildren=function(a,b){if(a===this.root){var d=[];p.all((a.Dependencies||[]).map(function(b){var g={Dependency:b,Project:a};d.push(g);return this.projectClient.getDependencyFileMetadata(b,a.WorkspaceLocation).then(function(a){k.mixin(g,a)},function(a){g.Directory=g.disconnected=!0})}.bind(this))).then(function(){b(d)}.bind(this))}else b([])};v.prototype.getId=function(a){return d.ExplorerModel.prototype.getId.call(this,a.Dependency)};q.prototype=new d.SelectionRenderer;
q.prototype.constructor=q;q.prototype.getCellHeaderElement=function(a){};q.prototype.getCellElement=function(a,b,d){if(0===a)return a=document.createElement("td"),b.Location?(a.className="navColumnNoIcon",d=document.createElement("a"),d.href=A.expand({resource:b.Location}),d.appendChild(document.createTextNode(b.Dependency.Name)),a.appendChild(d)):(d=b.Dependency.Name,b.disconnected&&(d+=" (disconnected)"),a.appendChild(document.createTextNode(d))),a;if(1===a)return b=this.getActionsColumn(b,d,null,
null,!0),b.style.textAlign="right",b};r.prototype=new d.ExplorerModel;r.prototype.constructor=r;r.prototype.getRoot=function(a){return a(this.root)};r.prototype.getChildren=function(a,b){if(a===this.root)if(this.launchConfigurations){for(var d=0;d<this.launchConfigurations.length;d++)this.launchConfigurations[d].project=a;this.root.children=this.launchConfigurations;b(this.launchConfigurations)}else this.projectClient.getProjectLaunchConfigurations(a).then(function(d){for(var g=0;g<d.length;g++)d[g].project=
a;a.children=d;b(d)});else b([])};r.prototype.getId=function(a){return"LaunchConfiguration"+d.ExplorerModel.prototype.getId.call(this,{Location:a.Name})};z.prototype=new d.SelectionRenderer;z.prototype.constructor=z;z.prototype.getCellHeaderElement=function(a){};z.prototype.getCellElement=function(a,b,d){if(0===a){var g=document.createElement("td");b.Name&&(g.className="secondaryColumnLeft",g.appendChild(document.createTextNode(b.Name)));return g}if(1===a){g=document.createElement("td");if(b.Url){var f=
document.createElement("a");f.target="_new";f.href=0>b.Url.indexOf("://")?"http://"+b.Url:b.Url;f.title=b.Url;f.appendChild(document.createTextNode(b.UrlTitle||b.Params.Name||"View App"));g.appendChild(f)}return g}if(2===a)return g=document.createElement("td"),b.ServiceId&&this.projectClient.getProjectDelpoyService(b.ServiceId,b.Type).then(function(a){if(a)if(a.getLogLocationTemplate)a.getLogLocationTemplate(b).then(function(a){if(a){var d=document.createElement("a");d.target="_new";a=new m(a);var f=
k.clone(b.Params);k.mixin(f,{OrionHome:e.getOrionHome()});d.href=a.expand(f);d.appendChild(document.createTextNode("Logs"));g.appendChild(d)}});else if(a.logLocationTemplate){var d=document.createElement("a");d.target="_new";a=new m(a.logLocationTemplate);var f=k.clone(b.Params);k.mixin(f,{OrionHome:e.getOrionHome()});d.href=a.expand(f);d.appendChild(document.createTextNode("Logs"));g.appendChild(d)}}),g;if(3===a){g=document.createElement("td");g.classList.add("secondaryColumnRight");if(b.status&&
!0===b.status.CheckState)delete b.status;else if(b.status){if(b.status.error&&b.status.error.Retry)return b.parametersRequested=b.status.error.Retry.parameters,b.optionalParameters=b.status.error.Retry.optionalParameters,this.getActionsColumn(b,d,null,"secondaryColumnRight",!0);b.status.error?(f=document.createElement("span"),f.appendChild(document.createTextNode("Error")),f.title=b.status.error.Message):"STARTED"===b.status.State?(f=document.createElement("span"),f.className="imageSprite core-sprite-applicationrunning",
f.title=b.status.Message||"Started"):"STOPPED"===b.status.State?(f=document.createElement("span"),f.className="imageSprite core-sprite-applicationstopped",f.title=b.status.Message||"Stopped"):"NOT_DEPLOYED"===b.status.State?(f=document.createElement("span"),f.className="imageSprite core-sprite-applicationnotdeployed",f.title=b.status.Message||"Not deployed"):"PROGRESS"===b.status.State?(f=document.createElement("span"),f.className="imageSprite core-sprite-progress",f.title="Checking application state"):
(f=document.createElement("span"),f.appendChild(document.createTextNode("State unknown")),f.title=b.status.Message);g.appendChild(f);return g}b.ServiceId&&this.projectClient.getProjectDelpoyService(b.ServiceId,b.Type).then(function(e){e&&e.getState?(b.status={State:"PROGRESS"},g.innerHTML=this.getCellElement(a,b,d).innerHTML,e.getState(b.Params).then(function(e){b.status=e;var f=this.getCellElement(a,b,d);for(e=0;e<g.classList.length;e++)f.classList.toggle(g.classList[e],!0);var h=g.previousSibling;
d.replaceChild(f,g);f=this.getCellElement(a-1,b,d);for(e=0;e<h.classList.length;e++)f.classList.toggle(h.classList[e],!0);d.replaceChild(f,h)}.bind(this),function(e){b.status={error:e};var f=this.getCellElement(a,b,d);for(e=0;e<g.classList.length;e++)f.classList.toggle(g.classList[e],!0);var h=g.previousSibling;d.replaceChild(f,g);f=this.getCellElement(a-1,b,d);for(e=0;e<h.classList.length;e++)f.classList.toggle(h.classList[e],!0);d.replaceChild(f,h)}.bind(this))):g.appendChild(document.createTextNode("State unknown"))}.bind(this));
return g}};t.prototype=Object.create(d.Explorer.prototype);k.mixin(t.prototype,{registerCommands:function(){this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.manage",1);this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.deploy",2);this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.startApp",3);this.commandService.registerCommandContribution(this.selectionActions,
"orion.launchConfiguration.stopApp",4)},updateCommands:function(a){this.selectionActionsNode=n.node(this.selectionActions);n.empty(this.selectionActionsNode);this.commandService.renderCommands(this.selectionActions,this.selectionActionsNode,a,this,"tool");n.$$array(".commandLink",this.selectionActionsNode).forEach(function(a,b){a.target="_new"})},load:function(a,b,d,g){this.createTree(a,new r(b,d,g),{indent:"8px"});this.loaded()},constructor:t});w.prototype={createCommands:function(){this.launchConfigurationDispatcher=
f.getLaunchConfigurationDispatcher();this.dependenciesDisplatcher=f.getDependencyDispatcher();var a=this;this.launchConfigurationListener=function(b){a.launchConfigurationChanged.call(a,b)};this._launchConfigurationEventTypes=["create","delete","changeState"];this._launchConfigurationEventTypes.forEach(function(b){a.launchConfigurationDispatcher.addEventListener(b,a.launchConfigurationListener)});this.dependneciesListener=function(b){a.dependenciesChanged.call(a,b)};this._dependenciesEventTypes=["create",
"delete"];this._dependenciesEventTypes.forEach(function(b){a.dependenciesDisplatcher.addEventListener(b,a.dependneciesListener)});this.commandRegistry.registerCommandContribution(this.dependencyActions,"orion.project.dependency.connect",1);this.commandRegistry.registerCommandContribution(this.dependencyActions,"orion.project.dependency.disconnect",2);this.commandRegistry.registerCommandContribution(this.launchConfigurationActions,"orion.launchConfiguration.checkStatus",1)},changedItem:function(a){this.fileClient.read(this.parentFolder.Location,
!0).then(function(a){n.empty(this.node);this.displayContents(this.node,a)}.bind(this))},display:function(a,b){function d(a,b){b=b||{};a.forEach(function(a){var d;switch(a){case "projectInfo":d=document.createElement("span");this.node.appendChild(d);this.renderProjectInfo(d,b[a]);break;case "additionalInfo":d=document.createElement("span");this.node.appendChild(d);this.renderAdditionalProjectProperties(d);break;case "deployment":d=document.createElement("span");this.node.appendChild(d);this.renderLaunchConfigurations(d,
null,b[a]);break;case "dependencies":d=document.createElement("span"),d.id="projectDependenciesNode",this.node.appendChild(d),this.renderDependencies(d,b[a])}}.bind(this))}this.node=a;this.node.className="orionProject";this.projectData=b;var g=["projectInfo","additionalInfo","deployment","dependencies"];this.preferences.getPreferences("/sectionsOrder").then(function(a){g=a.get("projectView")||g;a=a.get("projectViewNames")||[];d.apply(this,[g,a])}.bind(this),function(a){d.apply(this,[g,{}]);window.console.error(a)}.bind(this))},
displayContents:function(a,b){this.parentFolder=b;this.projectClient.readProject(b).then(function(b){this.display.bind(this)(a,b)}.bind(this))},dependenciesChanged:function(a){var b=n.node("projectDependenciesNode");if(b){if(a.project.ContentLocation===this.projectData.ContentLocation)if("delete"===a.type){if(this.projectData.Dependencies&&a.oldValue)for(var d=0;d<this.projectData.Dependencies.length;d++)this.projectData.Dependencies[d].Location===a.oldValue.Location&&this.projectData.Dependencies.splice(d,
1)}else"create"===a.type&&this.projectData.Dependencies&&a.newValue&&this.projectData.Dependencies.push(a.newValue);n.empty(b);this.renderDependencies(b,this.dependenciesSectionName)}},_renderEditableFields:function(a,b,d,g){var e=function(d){var e={};e[b]=d.target.value;this.progress.progress(this.projectClient.changeProjectProperties(this.projectData,e),"Saving project "+this.projectData.Name).then(function(b){b&&(this.projectData=b,a.value=d.target.value,g&&(n.empty(g),g.appendChild(document.createTextNode(d.target.value)||
""),g.href=d.target.value,g.style.visibility="",g.urlSelector&&(g.urlSelector.style.visibility=""),a.style.visibility="hidden"))}.bind(this))}.bind(this);a.value=this.projectData[b]||"";a.title="Click to edit";a.className="discreetInput";a.tabIndex=String(d);a.onkeyup=function(d){d.keyCode===n.KEY.ENTER?"TEXTAREA"!==a.tagName.toUpperCase()&&a.blur():d.keyCode===n.KEY.ESCAPE&&(a.value=this.projectData[b]||"",a.blur())}.bind(this);a.onblur=function(a){e(a)}},renderProjectInfo:function(g,e){var f=new a.Section(g,
{id:"projectInfoSection",headerClass:["sectionTreeTableHeader"],title:e||"Project Information",canHide:!0}),l=document.createElement("div");l.id="projectInformationNode";var k=new b({checkbox:!1,treeTableClass:"sectionTreeTable",cachePrefix:"ProjectInfoExplorer"},this),k=new d.Explorer(this.serviceRegistry,null,k,this.commandRegistry);f.embedExplorer(k,l);k.createTree(l,new h(this.projectData),{noSelection:!0})},renderAdditionalProjectProperties:function(b){this.projectClient.getMatchingProjectHandlers(this.parentFolder).then(function(e){for(var f=
0;f<e.length;f++){var h=e[f];h&&h.getAdditionalProjectProperties&&this.progress.progress(h.getAdditionalProjectProperties(this.parentFolder,this.projectData),"Getting additional project information").then(function(e){if(e&&e.length&&0!==e.length)for(var f=0;f<e.length;f++){var h=e[f];if(h.Name){var l=new a.Section(b,{id:h.Name+"Section",headerClass:["sectionTreeTableHeader"],title:h.Name,canHide:!0}),k=document.createElement("div"),q=new u({treeTableClass:"sectionTreeTable",checkbox:!1},this),q=new d.Explorer(this.serviceRegistry,
null,q,this.commandRegistry);l.embedExplorer(q,k);q.createTree(k,new g(h),{noSelection:!0})}}}.bind(this))}}.bind(this))},renderDependencies:function(b,g){if(this.projectData.Dependencies&&0!==this.projectData.Dependencies.length){this.dependenciesSectionName=g||"Associated Content";var e=new a.Section(b,{id:"projectDependenciesSection",headerClass:["sectionTreeTableHeader"],title:this.dependenciesSectionName,canHide:!0}),f=document.createElement("div");f.id="dependenciesNode";var h=new q({checkbox:!1,
treeTableClass:"sectionTreeTable",commandRegistry:this.commandRegistry,actionScopeId:this.dependencyActions},this),h=new d.Explorer(this.serviceRegistry,null,h,this.commandRegistry);h.actionScopeId=this.dependencyActions;e.embedExplorer(h,f);h.createTree(f,new v(this.projectData,this.projectClient),{indent:"8px",noSelection:!0})}},renderLaunchConfigurations:function(b,d,g){this.configurationsParent=b;if(d){n.empty(this.configurationsParent);this.launchCofunctionSectionsTitle=g||"Deployment Information";
var e=new a.Section(b,{id:"projectLaunchConfigurationSection",headerClass:["sectionTreeTableHeader"],title:this.launchCofunctionSectionsTitle,canHide:!0}),f=document.createElement("div");f.id="launchConfigurationsNode";var h=new z({checkbox:!1,treeTableClass:"sectionTreeTable",commandRegistry:this.commandRegistry,actionScopeId:this.launchConfigurationActions,projectClient:this.projectClient},this),h=new t(this.serviceRegistry,null,h,this.commandRegistry,this.launchConfigurationActions);e.embedExplorer(h,
f);h.load(f,this.projectData,d,this.projectClient)}else this.projectClient.getProjectLaunchConfigurations(this.projectData).then(function(a){(this.configurations=a)&&0!==a.length&&this.renderLaunchConfigurations(b,a,g)}.bind(this))},launchConfigurationChanged:function(a){if(this.configurations&&("create"===a.type||"changeState"===a.type)&&a.newValue){for(var b=0;b<this.configurations.length;b++){var d=this.configurations[b];if(d.Name===a.newValue.Name&&d.ServiceId===a.newValue.ServiceId){this.configurations[b]=
a.newValue;this.renderLaunchConfigurations(this.configurationsParent,this.configurations,this.launchCofunctionSectionsTitle);return}}"create"===a.type&&(this.configurations.push(a.newValue),this.renderLaunchConfigurations(this.configurationsParent,this.configurations,this.launchCofunctionSectionsTitle))}},destroy:function(){var a=this;this._launchConfigurationEventTypes.forEach(function(b){a.launchConfigurationDispatcher.removeEventListener(b,a.launchConfigurationListener)});this._dependenciesEventTypes.forEach(function(b){a.dependenciesDisplatcher.removeEventListener(b,
a.dependneciesListener)})}};return{ProjectEditor:w}});
define("orion/projects/projectExplorer","i18n!orion/edit/nls/messages orion/Deferred orion/URITemplate orion/webui/littlelib orion/explorers/explorer orion/section".split(" "),function(m,n,p,k,f,l){function e(a){this._init(a)}function d(a,d,f,l){this.registry=d;this.selection=f;this.commandRegistry=l;this.parentId=a;this.renderer=new e({});this.renderer.explorer=this;this.myTree=null;this.newActionsScope=h;this.actionsSections=[this.newActionsScope];this._init()}var a=new p("../edit/edit.html#{,resource,params*}"),
h="newProjectActions";e.prototype=new f.SelectionRenderer;e.prototype.getCellHeaderElement=function(){return null};e.prototype.emptyCallback=function(a){var d=document.createElement("tr"),e=document.createElement("td");e.colSpan=this.oneColumn?1:3;var f=document.createElement("div");f.classList.add("noFile");f.textContent=m.NoProjects;var h=document.createElement("span");h.appendChild(document.createTextNode(m.File));k.processDOMNodes(f,[h]);e.appendChild(f);d.appendChild(e);a.appendChild(d)};e.prototype.getCellElement=
function(b,d,e){e=document.createElement("td");switch(b){case 0:return e.className="navColumnNoIcon",b=document.createElement("a"),b.appendChild(document.createTextNode(d.Name)),b.href=a.expand({resource:d.ContentLocation}),e.appendChild(b),e;case 1:return e.appendChild(document.createTextNode(!d.Description?" ":200<d.Description.length?d.Description.substring(0,180)+"...":d.Description)),e;case 2:return d.Url?(b=document.createElement("a"),b.appendChild(document.createTextNode(d.Url)),b.href=d.Url,
e.appendChild(b)):e.appendChild(document.createTextNode(" ")),e}return null};d.prototype=Object.create(f.Explorer.prototype);d.prototype._init=function(){var a=new l.Section(k.node(this.parentId),{id:"projectsSection",title:"Projects",canHide:!0}),d=document.createElement("div");d.id="projectsExplorer";a.embedExplorer(this,d)};d.prototype.loadProjects=function(a){this.model=new f.SimpleFlatModel(a,"orion.project.",function(a){if(a.ContentLocation)return a.ContentLocation.replace(/[\\\/]/g,"")});this.myTree=
this.createTree(this.parent,this.model,{indent:"8px",selectionPolicy:this.renderer.selectionPolicy});this.updateCommands()};return{ProjectExplorer:d,newActionsScope:h}});
define("orion/projects/projectView",["orion/projects/projectExplorer","orion/selection","orion/URITemplate","orion/webui/littlelib","orion/fileCommands"],function(m,n,p,k,f){function l(d){this.progress=d.progress;this.fileClient=d.fileClient;this.serviceRegistry=d.serviceRegistry;this.commandRegistry=d.commandRegistry;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.modelEventDispatcher=f.getModelEventDispatcher();var a=this;this.modelListener=function(d){a.changedItemEvent.call(a,
d)};this._eventTypes=["copy","create","delete","import","move"];this._eventTypes.forEach(function(d){a.modelEventDispatcher.addEventListener(d,a.modelListener)})}var e=new p("#{,resource,params*}");l.prototype={display:function(d,a){a.classList.add("orionProject");this.projectExplorer=new m.ProjectExplorer(a,this.serviceRegistry,new n.Selection(this.serviceRegistry),this.commandRegistry);this.changedItem(d)},setCommandsVisible:function(d){this.projectExplorer&&this.projectExplorer.setCommandsVisible.call(this.projectExplorer,
d)},changedItemEvent:function(d){d.parent&&(this.workspace&&d.parent.Location===this.workspace.Location&&this.projects)&&this._handleChangedEvent(d.oldValue,d.newValue)},_handleChangedEvent:function(d,a){var e=this;if(d&&d.ContentLocation&&!d.Children&&!d.ChildrenLocation)this.fileClient.loadWorkspace(d.ContentLocation).then(function(b){e._handleChangedEvent(b,a)});else if(a&&a.ContentLocation&&!a.Children&&!a.ChildrenLocation)this.fileClient.loadWorkspace(a.ContentLocation).then(function(a){e._handleChangedEvent(d,
a)});else if(a)this.projectClient.readProject(a,this.workspace).then(function(a){if(d)for(var b=0;b<e.projects.length;b++){if(d.Location===e.projects[b].ContentLocation){a?e.projects[b]=a:e.projects.splice(b,1);e.projectExplorer.loadProjects(e.projects);break}}else a&&(e.projects.push(a),e.projectExplorer.loadProjects(e.projects))});else if(d)for(var b=0;b<e.projects.length;b++)if(d.Location===e.projects[b].ContentLocation){e.projects.splice(b,1);e.projectExplorer.loadProjects(e.projects);break}},
changedItem:function(d,a,f){var b=this;"created"===f&&d.ContentLocation?window.location=e.expand({resource:d.ContentLocation}):d?b.progress.progress(b.projectClient.readAllProjects(d),"Listing projects").then(function(a){b.workspace=d;b.projects=a;b.projectExplorer.loadProjects(a)}):b.progress.progress(b.fileClient.loadWorkspace(),"Getting workspace information").then(function(a){b.progress.progress(b.projectClient.readAllProjects(d),"Listing projects").then(function(d){b.workspace=a;b.projects=d;
b.projectExplorer.loadProjects(d)})})},destroy:function(){var d=this;this._eventTypes.forEach(function(a){d.modelEventDispatcher.removeEventListener(a,d.modelListener)})}};return{ProjectView:l}});
define("orion/folderView","i18n!orion/edit/nls/messages orion/globalCommands orion/explorers/explorer-table orion/explorers/navigatorRenderer orion/selection orion/fileCommands orion/markdownView orion/projects/projectEditor orion/PageUtil orion/URITemplate orion/webui/littlelib orion/objects orion/Deferred orion/projects/projectView orion/section".split(" "),function(m,n,p,k,f,l,e,d,a,h,b,g,u,v,q){function r(){A.apply(this,arguments)}function z(a){a.setFocus=!1;a.cachePrefix=null;a.dragAndDrop=l.uploadFile;
a.modelEventDispatcher=l.getModelEventDispatcher();a.rendererFactory=function(b){return new r({checkbox:!1,treeTableClass:"sectionTreeTable",cachePrefix:"FolderNavigator"},b,a.commandRegistry,a.contentTypeRegistry)};w.apply(this,arguments);this.menuBar=a.menuBar;this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.editorInputManager=a.editorInputManager;this.readonly=a.readonly;this.breadCrumbMaker=
a.breadCrumbMaker;this.clickHandler=a.clickHandler;this.treeRoot={};this.parent=b.node(a.parentId)}function t(a){this._parent=a.parent;this._metadata=a.metadata;this.menuBar=a.menuBar;this.fileClient=a.fileService;this.progress=a.progressService;this.serviceRegistry=a.serviceRegistry;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.editorInputManager=a.inputManager;this.preferences=a.preferences;this.readonly=void 0===a.readonly?!1:a.readonly;this.showProjectView=
void 0===a.showProjectView?!0:a.showProjectView;this.showFolderNav=!0;this.editorView=a.editorView;this._maxEditorHeight=a.maxEditorHeight;this.imageView=a.imageView;this.breadCrumbMaker=a.breadCrumbMaker;this.clickHandler=a.clickHandler;this._init()}var w=p.FileExplorer,A=k.NavigatorRenderer,x=new h("#{,resource,params*}");r.prototype=Object.create(A.prototype);g.mixin(r.prototype,{showFolderImage:!0,createFolderNode:function(a){var b=k.NavigatorRenderer.prototype.createFolderNode.call(this,a);this.showFolderLinks&&
"A"===b.tagName&&(b.href=x.expand({resource:a.Location}));b.classList.add("folderNavFolder");b.classList.add("navlink");b.classList.add("targetSelector");b.classList.remove("navlinkonpage");this.explorer.readonly&&this.explorer.clickHandler&&(b.href="javascript:void(0)",b.addEventListener("click",function(){this.explorer.clickHandler(a.Location)}.bind(this),!1));return b},updateFileNode:function(a,b,d){k.NavigatorRenderer.prototype.updateFileNode.call(this,a,b,d);this.explorer.readonly&&"A"===b.tagName&&
(this.explorer.clickHandler?(b.href="javascript:void(0)",b.addEventListener("click",function(){this.explorer.clickHandler(a.Location)}.bind(this),!1)):b.href=x.expand({resource:a.Location}))},getCellHeaderElement:function(a){if(this.explorer.breadCrumbMaker)return null;if(0===a){a=document.createElement("th");a.colSpan=1;var b=this.explorer.treeRoot;a.appendChild(document.createTextNode(b.Parents?b.Name:this.explorer.fileClient.fileServiceName(b.Location)));return a}return null},emptyCallback:function(a){this.explorer.readonly||
k.NavigatorRenderer.prototype.emptyCallback.call(this,a)},getExpandImage:function(){return null}});z.prototype=Object.create(w.prototype);g.mixin(z.prototype,{loadRoot:function(b){b?this.load(b,"Loading "+b.Name).then(this.loaded.bind(this)):this.loadResourceList(a.matchResourceParameters().resource+"?depth\x3d1",!1).then(this.loaded.bind(this))},isCommandsVisible:function(){if(!this.selection)return!1;var a=n.getMainSplitter();return a?a.splitter.isClosed():!this.readonly},scope:function(a){window.location.href=
x.expand({resource:a})},scopeUp:function(){var a;a=this.treeRoot;var b=a.Parents&&a.Parents[0];a=b?b.ChildrenLocation:this.fileClient.fileServiceRootURL(a.Location);this.scope(a)},scopeDown:function(a){this.scope(a.ChildrenLocation)},registerCommands:function(){return(new u).resolve()},updateCommands:function(a){this.menuBar&&(this.menuBar.setActiveExplorer(this),this.menuBar.updateCommands())}});t.prototype={_init:function(){this.markdownView=new e.MarkdownView({fileClient:this.fileClient,canHide:!this.readonly,
progress:this.progress});this.showProjectView&&(this.projectEditor=new d.ProjectEditor({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry,preferences:this.preferences}),this.projectView=new v.ProjectView({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry}));n.getMainSplitter()&&n.getMainSplitter().splitter.addEventListener("toggle",this._splitterToggleListener=
function(a){[this.markdownView,this.projectEditor,this.projectView,this.folderNavExplorer].forEach(function(b){b&&b.setCommandsVisible&&b.setCommandsVisible(a.closed)})}.bind(this))},_isCommandsVisible:function(){var a=n.getMainSplitter();return a?a.splitter.isClosed():!this.readonly},displayWorkspaceView:function(){this._node||(this._node=document.createElement("div"));this._parent.appendChild(this._node);if(this.showProjectView){var a=document.createElement("div");this._node.appendChild(a);this.projectView.display(this._metadata,
a);this.projectView.setCommandsVisible(this._isCommandsVisible())}},displayFolderView:function(a){function d(a,f){a.forEach(function(a){if("project"===a)g&&this.showProjectView&&(l=document.createElement("div"),this.projectEditor.displayContents(l,this._metadata),this._node.appendChild(l));else if("folderNav"===a){if(this.showFolderNav){var d=document.createElement("div");d.id="folderNavNode";a=new q.Section(this._node,{id:"folderNavSection",headerClass:["sectionTreeTableHeader"],title:f[a]||"Files",
canHide:!this.readonly});if(this.editorView){a.setContent(this.editorView.getParent());this.editorView.create();var h=this.editorView.editor.getTextView();h.getModel().addEventListener("Changed",this._editorViewModelChangedListener=function(a){a=h.getLineHeight()*h.getModel().getLineCount()+20;this._maxEditorHeight&&(0<this._maxEditorHeight&&a>this._maxEditorHeight)&&(a=this._maxEditorHeight);this.editorView.getParent().style.height=a+"px"}.bind(this));this.editor=this.editorView.editor}else this.imageView?
a.setContent(this.imageView.image):(this.folderNavExplorer=new z({parentId:d,view:this,readonly:this.readonly,menuBar:this.menuBar,breadCrumbMaker:this.breadCrumbMaker,clickHandler:this.clickHandler,serviceRegistry:this.serviceRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,commandRegistry:this.commandRegistry,contentTypeRegistry:this.contentTypeRegistry}),a.embedExplorer(this.folderNavExplorer),this.folderNavExplorer.setCommandsVisible(this._isCommandsVisible()),this.folderNavExplorer.loadRoot(this._metadata));
if(this.breadCrumbMaker&&(d=a.getTitleElement())){b.empty(d);var k=document.createElement("div");d.appendChild(k);this.breadCrumbMaker(k,a.getHeaderElement().offsetWidth-24)}}}else"readme"===a&&e&&(l=document.createElement("div"),this.markdownView.displayInFrame(l,e,["sectionTreeTableHeader"],null,f[a]),this._node.appendChild(l))}.bind(this))}a=a.Children;var g,e;if(a)for(var f=0;f<a.length;f++){var h=a[f];!h.Directory&&"project.json"===h.Name&&(g=h);!h.Directory&&(h.Name&&"readme.md"===h.Name.toLowerCase())&&
(e=h)}var l;this._node||(this._node=document.createElement("div"));this._parent.appendChild(this._node);var k=["project","folderNav","readme"],m={};this.editorView?d.apply(this,[k,m]):this.preferences?this.preferences.getPreferences("/sectionsOrder").then(function(a){m=a.get("folderViewNames")||m;k=a.get("folderView")||k;d.apply(this,[k,m])}.bind(this),function(a){d.apply(this,[k,m]);window.console.error(a)}.bind(this)):d.apply(this,[k,m])},create:function(){this._metadata.Projects&&this.displayWorkspaceView();
this.editorView||this.imageView?this.displayFolderView(this._metadata):this._metadata.Children?this.displayFolderView(this._metadata):this._metadata.ChildrenLocation&&this.progress.progress(this.fileClient.fetchChildren(this._metadata.ChildrenLocation),"Fetching children of "+this._metadata.Name).then(function(a){this._metadata.Children=a;this.displayFolderView(this._metadata)}.bind(this))},destroy:function(){this.editorView&&(this.editorView.editor.getTextView().getModel().removeEventListener("Changed",
this._editorViewModelChangedListener),this.editorView.destroy(),this.editor=null);var a=n.getMainSplitter();a&&a.splitter.removeEventListener("toggle",this._splitterToggleListener);this.folderNavExplorer&&this.folderNavExplorer.destroy();this.folderNavExplorer=null;this._node&&this._node.parentNode&&this._node.parentNode.removeChild(this._node);this.projectView&&this.projectView.destroy();this.projectEditor&&this.projectEditor.destroy();this._node=null}};return{FolderView:t}});
define("orion/editor/find","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/regex orion/objects orion/util".split(" "),function(m,n,p,k,f,l,e){function d(a){var d=a.getTextView();p.KeyMode.call(this,d);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";d.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));d.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var e=this;this._listener={onVerify:function(a){var b=e.editor,d=b.getModel(),g=b.mapOffset(a.start),b=b.mapOffset(a.end),d=d.getText(g,b);if((d=e._prefix.match(RegExp("^"+f.escape(d),"i")))&&0<d.length)e._prefix+=a.text,e._success=!0,e._status(),e.find(e._forward,!0),a.text=null},onSelection:function(){e._ignoreSelection||e.setActive(!1)}}}function a(a,d,e){if(a){this._editor=a;this._undoStack=d;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental=
!0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var f=this;this._listeners={onEditorFocus:function(a){f._removeCurrentAnnotation(a)}};this.setOptions(e)}}var h={};d.prototype=new p.KeyMode;l.mixin(d.prototype,{createKeyBindings:function(){var a=n.KeyBinding,d=[];d.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});d.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});d.push({actionID:"incrementalFindCancel",
keyBinding:new a(27)});d.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});d.push({actionID:"incrementalFind",keyBinding:new a(40)});d.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});d.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return d},find:function(a,d){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var e=this._prefix;if(0===e.length)return!1;var f=this.editor,h=f.getModel(),h=a?this._success?d?this._start:f.getCaretOffset()+
1:0:this._success?d?this._start:f.getCaretOffset():h.getCharCount()-1;(e=f.getModel().find({string:e,start:h,reverse:!a,caseInsensitive:e.toLowerCase()===e}).next())?(d||(this._start=h),this._ignoreSelection=this._success=!0,f.moveSelection(a?e.start:e.end,a?e.end:e.start),this._ignoreSelection=!1):this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){this._active!==a&&(this._active=a,this._prefix=
"",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status())},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0,
a.length-1);return 0===a.length?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?m.incrementalFindStr:m.incrementalFindStrNotFound:this._success?m.incrementalFindReverseStr:m.incrementalFindReverseStrNotFound;a=e.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
h.IncrementalFind=d;a.prototype={find:function(a,d,e){this.setOptions({reverse:!a});var f=this.getFindString(),h;d&&(f=d.findString||f,h=d.count);a=this.getOptions();this.setOptions(d);d=e?this._startOffset:this.getStartOffset();if((h=this._doFind(f,d,h))&&!e)this._startOffset=h.start;this.setOptions(a);this._hideAfterFind&&this.hide();return h},getStartOffset:function(){return void 0!==this._start?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var a=
this._editor.getSelection(),a=this._editor.getText(a.start,a.end);this._regex&&(a=f.escape(a));return a||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},
hide:function(){this._visible=!1;this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(this._savedOptions=null));this._removeAllAnnotations();var a=this._editor.getTextView();a&&(a.removeEventListener("Focus",this._listeners.onEditorFocus),a.focus())},_processReplaceString:function(a){var d=a;if(this._regex){for(var d="",e=!1,f=this._editor.getModel().getLineDelimiter(),h=0;h<a.length;h++){var l=a.substring(h,h+1);if(e){switch(l){case "R":d+=f;break;case "r":d+=
"\r";break;case "n":d+="\n";break;case "t":d+="\t";break;case "\\":d+="\\";break;default:d+="\\"+l}e=!1}else"\\"===l?e=!0:d+=l}e&&(d+="\\")}return d},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var d=this._editor,e=this._processReplaceString(this.getReplaceString()),f=d.getSelection().start;if(d=d.getModel().find({string:a,start:f,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(d.start,d.end,a,e),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var d=this._editor,f=d.getTextView();d.reportStatus(m.replacingAll);var h=this._processReplaceString(this.getReplaceString()),l=this;window.setTimeout(function(){for(var k=0,p=0;;){var n=l._doFind(a,k,null,!0);if(!n)break;p++;1===p&&(f.setRedraw(!1),l.startUndo());l._doReplace(n.start,n.end,a,h);k=l.getStartOffset()}0<
p&&(l.endUndo(),f.setRedraw(!0));0<k?d.reportStatus(e.formatMessage(m.replacedMatches,p)):d.reportStatus(m.nothingReplaced,"error");l._replacingAll=!1},100)}},setOptions:function(a){if(a){if((!0===a.showAll||!1===a.showAll)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var d=this._editor.getAnnotationModel();d&&d.removeAnnotations(k.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(!0===a.caseInsensitive||!1===a.caseInsensitive)this._caseInsensitive=
a.caseInsensitive;if(!0===a.wrap||!1===a.wrap)this._wrap=a.wrap;if(!0===a.wholeWord||!1===a.wholeWord)this._wholeWord=a.wholeWord;if(!0===a.incremental||!1===a.incremental)this._incremental=a.incremental;if(!0===a.regex||!1===a.regex)this._regex=a.regex;if(!0===a.findAfterReplace||!1===a.findAfterReplace)this._findAfterReplace=a.findAfterReplace;if(!0===a.hideAfterFind||!1===a.hideAfterFind)this._hideAfterFind=a.hideAfterFind;if(!0===a.reverse||!1===a.reverse)this._reverse=a.reverse;a.hasOwnProperty("findCallback")&&
(this._findCallback=a.findCallback);a.hasOwnProperty("start")&&(this._start=a.start);a.hasOwnProperty("end")&&(this._end=a.end)}},show:function(a){this._visible=!0;a&&(this._savedOptions||(this._savedOptions=[]),this._savedOptions.push(this.getOptions()),this.setOptions(a));this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var d=this;window.setTimeout(function(){d._incremental&&d.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(a,d,e){return this._editor.getModel().find({string:a,start:d,end:this._end,reverse:this._reverse,wrap:e?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,d,e,f){e=e||1;var h=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var l,p;if(this._regex)try{p=this._find(a,d,f)}catch(n){h.reportStatus(n.message,
"error");return}else p=this._find(a,d,f);for(a=0;a<e&&p.hasNext();a++)l=p.next();if(!this._replacingAll){l?this._editor.reportStatus(""):this._editor.reportStatus(m.notFound,"error");if(this.isVisible()){e=k.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(p=h.getAnnotationModel())p.removeAnnotations(e),l&&p.addAnnotation(k.AnnotationType.createAnnotation(e,l.start,l.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var w=this;this._timer=window.setTimeout(function(){w._markAllOccurrences();
w._timer=null},500)}}this._findCallback?this._findCallback(l):l&&h.moveSelection(l.start,l.end,null,!1)}return l},_doReplace:function(a,d,e,f){var h=this._editor;this._regex&&(f=h.getText(a,d).replace(RegExp(e,this._caseInsensitive?"i":""),f));h.setText(f,a,d);h.setSelection(a,a+f.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var d=k.AnnotationType.ANNOTATION_MATCHING_SEARCH,e=a.getAnnotations(),f=[],h;e.hasNext();){var l=e.next();l.type===d&&f.push(l)}if(this.isVisible()){e=
this.getFindString();e=this._editor.getModel().find({string:e,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(h=[];e.hasNext();)l=e.next(),h.push(k.AnnotationType.createAnnotation(d,l.start,l.end))}a.replaceAnnotations(f,h)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(k.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(k.AnnotationType.ANNOTATION_MATCHING_SEARCH))},_removeCurrentAnnotation:function(a){(a=
this._editor.getAnnotationModel())&&a.removeAnnotations(k.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};h.Find=a;return h});
define("orion/editor/findUI",["i18n!orion/editor/nls/messages","orion/editor/find","orion/objects","orion/editor/util","orion/util"],function(m,n,p,k,f){function l(e,d,a){n.Find.call(this,e,d,a)}l.prototype=new n.Find;p.mixin(l.prototype,{getFindString:function(){var e=this._findInput;return!e?n.Find.prototype.getFindString.call(this):e.value},getReplaceString:function(){var e=this._replaceInput;return!e?n.Find.prototype.getReplaceString(this):e.value},hide:function(){var e=this.isVisible();n.Find.prototype.hide.call(this);
e&&(this._rootDiv.className="textViewFind")},show:function(e){n.Find.prototype.show.call(this,e);var d=e.findString;e=e.replaceString;var a=this._findInput;a||(this._create(),a=this._findInput);d&&(a.value=d);e&&(this._replaceInput.value=e);var f=this;window.setTimeout(function(){f._rootDiv.className="textViewFind show";a.select();a.focus()},0)},_create:function(){var e=this,d=this._editor.getTextView(),a=d.getOptions("parent").ownerDocument,h=f.createElement(a,"div");h.className="textViewFind";k.addEventListener(h,
"keydown",function(a){e._handleKeyDown(a)});this._rootDiv=h;this._createContents(a,h);d._rootDiv.insertBefore(h,d._rootDiv.firstChild)},_createContents:function(e,d){var a=this,h=f.createElement(e,"input");h.className="textViewFindInput";this._findInput=h;h.type="text";h.placeholder=m.findWith;k.addEventListener(h,"input",function(b){return a._handleInput(b)});d.appendChild(h);h=f.createElement(e,"span");a._createButton(e,h,m.next,function(){a.find(!0)});a._createButton(e,h,m.previous,function(){a.find(!1)});
d.appendChild(h);a._editor.getTextView().getOptions("readonly")||(h=f.createElement(e,"input"),h.className="textViewReplaceInput",this._replaceInput=h,h.type="text",h.placeholder=m.replaceWith,d.appendChild(h),h=f.createElement(e,"span"),a._createButton(e,h,m.replace,function(){a.replace()}),a._createButton(e,h,m.replaceAll,function(){a.replaceAll()}),d.appendChild(h));h=f.createElement(e,"span");a._createButton(e,h,m.regex,function(b){a._toggle("regex",b.target)},this._regex,m.regexTooltip);a._createButton(e,
h,m.caseInsensitive,function(b){a._toggle("caseInsensitive",b.target)},this._caseInsensitive,m.caseInsensitiveTooltip);a._createButton(e,h,m.wholeWord,function(b){a._toggle("wholeWord",b.target)},this._wholeWord,m.wholeWordTooltip);d.appendChild(h);h=a._createButton(e,d,"",function(){a.hide()});h.className="textViewFindCloseButton";h.title=m.closeTooltip},_createButton:function(e,d,a,f,b,g){var l=e.createElement("button");this._checked(b,l);g&&(l.title=g);k.addEventListener(l,"click",function(a){f.call(this,
a)},!1);a&&l.appendChild(e.createTextNode(a));d.appendChild(l);return l},_toggle:function(e,d){var a={};a[e]=!this["_"+e];this.setOptions(a);this._checked(a[e],d)},_checked:function(e,d){d.className="textViewFindButton";e&&(d.className+=" checked")},_handleInput:function(){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(e){var d,a=(f.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&!e.shiftKey;a&&70===e.keyCode&&(d=!0);if((f.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&75===e.keyCode||
13===e.keyCode)13===e.keyCode?this.find(this._reverse?e.shiftKey:!e.shiftKey):this.find(!e.shiftKey),d=!0;a&&82===e.keyCode&&(this.replace(),d=!0);27===e.keyCode&&(this.hide(),d=!0);return d?(e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,!1):!0}});return{FindUI:l}});
define("orion/editor/actions","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/annotations orion/editor/tooltip orion/editor/find orion/editor/findUI orion/util".split(" "),function(m,n,p,k,f,l,e){function d(a,b,d){this.editor=a;this.undoStack=b;this._incrementalFind=new f.IncrementalFind(a);this._find=d?d:new l.FindUI(a,b);this._lastEditLocation=null;this.init()}function a(a,b,d,e){this.editor=a;this.undoStack=b;this.contentAssist=d;this.linkedMode=e;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var h=p.AnnotationType,b={};d.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){this.editor.isDirty()&&(this._lastEditLocation=a.start+a.addedCharCount)}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(a){if(this.undoStack){var b=1;a&&a.count&&(b=a.count);for(;0<b;)this.undoStack.undo(),--b;return!0}return!1}.bind(this),
{name:m.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;a&&a.count&&(b=a.count);for(;0<b;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:m.redo});a.setKeyBinding(new n.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();this._find.show({findString:this.editor.getText(a.start,a.end)});return!0}return!1}.bind(this),{name:m.find});a.setKeyBinding(new n.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?
(this._find.find(!0,a),!0):!1}.bind(this),{name:m.findNext});a.setKeyBinding(new n.KeyBinding("k",!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:m.findPrevious});a.setKeyBinding(new n.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:m.incrementalFind});a.setKeyBinding(new n.KeyBinding("j",!0,!0),"incrementalFindReverse");
a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:m.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:m.unindentLines});a.setKeyBinding(new n.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:m.moveLinesUp});a.setKeyBinding(new n.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:m.moveLinesDown});a.setKeyBinding(new n.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:m.copyLinesUp});a.setKeyBinding(new n.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:m.copyLinesDown});a.setKeyBinding(new n.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:m.deleteLines});a.setKeyBinding(new n.KeyBinding("l",!e.isMac,!1,!1,e.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:m.gotoLine});a.setKeyBinding(new n.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:m.nextAnnotation});a.setKeyBinding(new n.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:m.prevAnnotation});a.setKeyBinding(new n.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:m.expand});a.setKeyBinding(new n.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:m.collapse});a.setKeyBinding(new n.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:m.expandAll});a.setKeyBinding(new n.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:m.collapseAll});a.setKeyBinding(new n.KeyBinding("q",!e.isMac,!1,!1,e.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:m.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineStart(e),e=b.getLineEnd(d,!0),h=b.getLineCount(),l="",f=b.getText(f,e);d===h-1&&(f=(l=b.getLineDelimiter())+f);a.setText(f,e,e);a.setSelection(e+l.length,e+f.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-
1:d.end),e=b.getLineStart(e),f=b.getLineEnd(d,!0),h=b.getLineCount(),l="",f=b.getText(e,f);d===h-1&&(f+=l=b.getLineDelimiter());a.setText(f,e,e);a.setSelection(e,e+f.length-l.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=1;a&&a.count&&(d=a.count);var e=b.getSelection(),f=b.getModel(),h=f.getLineAtOffset(e.start);a=f.getLineStart(h);d=e.start!==e.end||1===d?f.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(h+d-1,f.getLineCount()-
1);d=f.getLineEnd(d,!0);b.setText("",a,d);return!0},expandAnnotation:function(a){var b=this.editor,d=b.getAnnotationModel();if(!d)return!0;var e=b.getModel(),f=b.getCaretOffset(),h=e.getLineAtOffset(f),f=e.getLineStart(h),h=e.getLineEnd(h,!0);e.getBaseModel&&(f=e.mapOffset(f),h=e.mapOffset(h),e.getBaseModel());for(var l,d=d.getAnnotations(f,h);!l&&d.hasNext();)e=d.next(),e.type===p.AnnotationType.ANNOTATION_FOLDING&&(l=e);l&&a!==l.expanded&&(a?l.expand():(b.setCaretOffset(l.start),l.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,d=b.getTextView(),b=b.getAnnotationModel();if(!b)return!0;var e=b.getAnnotations();for(d.setRedraw(!1);e.hasNext();)b=e.next(),b.type===p.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());d.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),h=d.getLineAtOffset(e.end>
e.start?e.end-1:e.end);if(f!==h){var l=[];l.push("");for(var k=f;k<=h;k++)l.push(d.getLine(k,!0));k=d.getLineStart(f);d=d.getLineEnd(h,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(l.join(b),k,d);a.setSelection(k===e.start?e.start:e.start+b.length,e.end+(h-f+1)*b.length);return!0}return!1}},gotoLastEdit:function(){"number"===typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor,
b=a.getModel().getLineAtOffset(a.getCaretOffset());if(b=prompt(m.gotoLinePrompty,b+1))b=parseInt(b,10),a.onGotoLine(b-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start),f=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=b.getLineCount();if(f===h-1)return!0;var e=b.getLineStart(e),d=b.getLineEnd(f,!0),l=b.getLineEnd(f+1,!0)-(d-e),k=0;f!==h-2?b=b.getText(e,d):(f=b.getLineEnd(f),
b=b.getText(f,d)+b.getText(e,f),k+=d-f);this.startUndo();a.setText("",e,d);a.setText(b,l,l);a.setSelection(l+k,l+k+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getLineAtOffset(d.start);if(0===e)return!0;var f=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=b.getLineCount(),d=b.getLineStart(e-1),l=b.getLineStart(e),k=b.getLineEnd(f,!0),m=b.getText(l,k),p=0;f===h-1&&(f=b.getLineEnd(e-
1),e=b.getLineEnd(e-1,!0),m+=b.getText(f,e),l=f,p=e-f);this.startUndo();a.setText("",l,k);a.setText(m,d,d);a.setSelection(d,d+m.length-p);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===h.ANNOTATION_MATCHING_BRACKET||a.type===h.ANNOTATION_CURRENT_BRACKET||!f.isAnnotationTypeVisible(a.type)}var d=this.editor,e=d.getAnnotationModel();if(!e)return!0;var f=d.getOverviewRuler()||d.getAnnotationStyler();if(!f)return!0;for(var l=d.getModel(),m=d.getCaretOffset(),
p=e.getAnnotations(a?m:0,a?l.getCharCount():m),n=null;p.hasNext();){var x=p.next();if(a){if(x.start<=m)continue}else if(x.start>=m)continue;if(!b(x)&&(n=x,a))break}if(n){for(var C=[n],p=e.getAnnotations(n.start,n.start);p.hasNext();)x=p.next(),x!==n&&!b(x)&&C.push(x);var s=d.getTextView(),y=l.getLineAtOffset(n.start),D=k.Tooltip.getTooltip(s);if(!D)return d.moveSelection(n.start),!0;d.moveSelection(n.start,n.start,function(){D.setTarget({getTooltipInfo:function(){var a=s.convert({x:s.getLocationAtOffset(n.start).x,
y:s.getLocationAtOffset(l.getLineStart(y)).y},"document","page");return{contents:C,x:a.x,y:a.y+Math.floor(1.33*s.getLineHeight(y))}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),h=d.getLineAtOffset(e.end>e.start?e.end-1:e.end),l=b.getOptions("tabSize"),k=Array(l+1).join(" "),m=[],p=b=0,n=f;n<=h;n++){var s=d.getLine(n,!0);if(d.getLineStart(n)!==
d.getLineEnd(n))if(0===s.indexOf("\t"))s=s.substring(1),b++;else if(0===s.indexOf(k))s=s.substring(l),b+=l;else return!0;n===f&&(p=b);m.push(s)}f=d.getLineStart(f);l=d.getLineEnd(h,!0);d=d.getLineStart(h);a.setText(m.join(""),f,l);h=f===e.start?e.start:e.start-p;e=Math.max(h,e.end-b+(e.end===d+1&&e.start!==e.end?1:0));a.setSelection(h,e);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};b.TextActions=
d;a.prototype={init:function(){var a=this.editor.getTextView();a.setAction("lineStart",function(){return this.lineStart()}.bind(this));a.setAction("enter",function(){return this.autoIndent()}.bind(this));a.setKeyBinding(new n.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:m.trimTrailingWhitespaces});a.setKeyBinding(new n.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:m.toggleLineComment});a.setKeyBinding(new n.KeyBinding(191,!0,!e.isMac,!1,e.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:m.addBlockComment});a.setKeyBinding(new n.KeyBinding(220,!0,!e.isMac,!1,e.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:m.removeBlockComment});a.setKeyBinding(new n.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new n.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new n.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c",
"\x3e")}.bind(this));a.setKeyBinding(new n.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new n.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new n.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",
function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new n.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new n.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new n.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",
function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new n.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation");a.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this));a.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;var d=a.getSelection();if(d.start===d.end){for(var e=a.getModel(),f=e.getLineAtOffset(d.start),
h=e.getLine(f,!1),l=e.getLineStart(f),k=0,m=d.start-l,p;k<m&&(32===(p=h.charCodeAt(k))||9===p);)k++;var l=h.substring(0,k),b=b.getOptions("tabSize","expandTab"),n=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=e.getLineDelimiter(),s=/^[\s]*\/\*[\*]*[\s]*$/,y=/^[\s]*\*/,D=/\*\/[\s]*$/,E=h.substring(0,m),B=h.substring(m),L;if(this.smartIndentation&&123===h.charCodeAt(L=E.trimRight().length-1))return e=m-L-1,B=B.length-B.trimLeft().length,h=125===h.charCodeAt(m+B)?b+l+n+b+l:b+l+n,a.setText(h,d.start-
e,d.end+B),a.setCaretOffset(d.start+b.length+l.length+n.length-e),!0;if(this.autoCompleteComments&&!D.test(E)&&(s.test(E)||y.test(E))){if(k=s.exec(E)){h=b+l+" * ";h=D.test(B)?h+B.substring(0,B.length-2).trim():h+B.trim();if(e.getLineCount()===f+1||!y.test(e.getLine(f+1)))h+=b+l+" */";a.setText(h,d.start,d.end+B.length);a.setCaretOffset(d.start+b.length+l.length+3);return!0}if(k=y.exec(E))for(f-=1;0<=f;f--){k=e.getLine(f,!1);if(s.test(k))return D.test(B)||47===h.charCodeAt(m)?(h=b+l+"*"+B,l=d.start+
b.length+l.length+1):(h=b+l+"* "+B,l=d.start+b.length+l.length+2),a.setText(h,d.start,d.end+B.length),a.setCaretOffset(l),!0;if(!y.test(k))break}}else{if(D.test(E)&&32===l.charCodeAt(l.length-1))return h=b+l.substring(0,l.length-1),a.setText(h,d.start,d.end),a.setCaretOffset(d.start+h.length),!0;if(0<k){for(k=m;k<h.length&&(32===(p=h.charCodeAt(k++))||9===p);)d.end++;a.setText(e.getLineDelimiter()+l,d.start,d.end);return!0}}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),e=this._findEnclosingComment(b,d.start,d.end);if(void 0!==e.commentStart&&void 0!==e.commentEnd)return!0;b=b.getText(d.start,d.end);if(0===b.length)return!0;var e=b.length,b=b.replace(/\/\*|\*\//g,""),f=b.length;a.setText("/*"+b+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(f-e));return!0},autoPairBrackets:function(a,b){if("["===a&&!this.autoPairSquareBrackets||"{"===a&&!this.autoPairBraces||"("===a&&!this.autoPairParentheses||"\x3c"===a&&!this.autoPairAngleBrackets)return!1;
var d=this.editor;if(d.getTextView().getOptions("readonly"))return!1;var e=d.getSelection(),f=d.getModel(),h=d.getCaretOffset()===f.getCharCount()?"":f.getText(e.start,e.start+1).trim(),l=/^$|[)}\]>]/;return e.start===e.end&&l.test(h)?(d.setText(a+b,e.start,e.start),d.setCaretOffset(e.start+1),!0):e.start!==e.end?(f=f.getText(e.start,e.end),d.setText(a+f+b,e.start,e.end),d.setSelection(e.start+1,e.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;
if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),e=b.getModel(),f=b.getCaretOffset(),h=0===f?"":e.getText(d.start-1,d.start).trim(),l=f===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),f=/^"$|^'$/,k=/\w/,m=/^$|[)}\]>]/;if(d.start!==d.end){e=e.getText(d.start,d.end);if(f.test(e))return!1;b.setText(a+e+a,d.start,d.end);b.setSelection(d.start+1,d.end+1)}else{if(l!==a){if(h===a||f.test(l)||k.test(h)||!m.test(l))return!1;b.setText(a+a,d.start,d.start)}b.setCaretOffset(d.start+
1)}return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&0<a.positions.length&&this.linkedMode){for(var b=[],d=0;d<a.positions.length;++d)b[d]={positions:[{offset:a.positions[d].offset,length:a.positions[d].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&0<a.groups.length&&this.linkedMode?this.linkedMode.enterLinkedMode({groups:a.groups,escapePosition:a.escapePosition}):a.escapePosition&&this.editor.getTextView().setCaretOffset(a.escapePosition);
return!0},deletePrevious:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getSelection();if(b.start!==b.end)return!1;var d=a.getModel(),e=a.getCaretOffset(),f=0===e?"":d.getText(b.start-1,b.start),d=e===d.getCharCount()?"":d.getText(b.start,b.start+1);("("===f&&")"===d||"["===f&&"]"===d||"{"===f&&"}"===d||"\x3c"===f&&"\x3e"===d||'"'===f&&'"'===d||"'"===f&&"'"===d)&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,d){var e=a.getLineAtOffset(b),
f=a.getLineAtOffset(d),h,l,k,m,p,n;for(h=e;0<=h&&!(l=a.getLine(h),k=h===e?b-a.getLineStart(e):l.length,m=l.lastIndexOf("/*",k),l=l.lastIndexOf("*/",k),l>m);h--)if(-1!==m){p=a.getLineStart(h)+m;break}for(h=f;h<a.getLineCount()&&!(l=a.getLine(h),k=h===f?d-a.getLineStart(f):0,m=l.indexOf("/*",k),l=l.indexOf("*/",k),-1!==m&&m<l);h++)if(-1!==l){n=a.getLineStart(h)+l;break}return{commentStart:p,commentEnd:n}},lineStart:function(){for(var a=this.editor,b=a.getModel(),d=a.getCaretOffset(),e=b.getLineAtOffset(d),
f=b.getLineStart(e),b=b.getLine(e),e=0;e<b.length;e++){var h=b.charCodeAt(e);if(!(32===h||9===h))break}e+=f;return d!==e?(a.setSelection(e,e),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),e=b.getText(d.start,d.end),f,h,l;for(l=0;l<e.length;l++)if("/*"===e.substring(l,l+2)){f=d.start+l;break}for(;l<e.length;l++)if("*/"===e.substring(l,l+2)){h=d.start+l;break}if(void 0!==f&&void 0!==h)a.setText(b.getText(f+
2,h),f,h+2),a.setSelection(f,h);else{e=this._findEnclosingComment(b,d.start,d.end);if(void 0===e.commentStart||void 0===e.commentEnd)return!0;b=b.getText(e.commentStart+2,e.commentEnd);a.setText(b,e.commentStart,e.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0},toggleLineComment:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;for(var d=this.lineComment||"//",e=a.getModel(),f=a.getSelection(),h=e.getLineAtOffset(f.start),l=e.getLineAtOffset(f.end>f.start?
f.end-1:f.end),k=!0,m=[],p,n=h;n<=l;n++){var s=e.getLine(n,!0);p=s.indexOf(d);m.push(p);if(!k||-1===p)k=!1;else if(0!==p){for(k=0;k<p;k++){var y=s.charCodeAt(k);if(!(32===y||9===y))break}k=k===p}}n=d.length;s=e.getLineStart(h);b.setRedraw(!1);this.startUndo();if(k){for(k=m.length-1;0<=k;k--)p=m[k]+e.getLineStart(h+k),a.setText("",p,p+n);e=e.getLineStart(l);d=s===f.start?f.start:f.start-n;f=f.end-n*(l-h+1)+(f.end===e+1?n:0)}else{for(k=m.length-1;0<=k;k--)p=e.getLineStart(h+k),a.setText(d,p,p);d=s===
f.start?f.start:f.start+n;f=f.end+n*(l-h+1)}this.endUndo();b.setRedraw(!0);a.setSelection(d,f);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),d=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var e=/(\s+$)/,f=b.getLineCount(),h=0;h<f;h++){var l=b.getLine(h),k=e.exec(l);if(k){var m=b.getLineStart(h),l=k[0].length,k=m+k.index;b.setText("",k,k+l);d.start>k&&(d.start=Math.max(k,d.start-l));d.start!==d.end&&d.end>k&&(d.end=Math.max(k,
d.end-l))}}a.getUndoStack().endCompoundChange();a.getTextView().setRedraw(!0);a.setSelection(d.start,d.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),e=b.getModel();return(b.getCaretOffset()===e.getCharCount()?"":e.getText(d.start,d.start+1))===a?(b.setCaretOffset(d.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},
setAutoPairParentheses:function(a){this.autoPairParentheses=a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setLineComment:function(a){this.lineComment=a},setSmartIndentation:function(a){this.smartIndentation=a}};b.SourceCodeActions=
a;String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,"")});String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")});return b});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(m,n,p,k){function f(a,b,d,e){this._location=b||"left";this._overview=d||"page";this._rulerStyle=e;this._view=null;var f=this;this._listener={onTextModelChanged:function(a){f._onTextModelChanged(a)},onAnnotationModelChanged:function(a){f._onAnnotationModelChanged(a)}};this.setAnnotationModel(a)}function l(a,b,d,e,l){f.call(this,a,b,"page",d);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=l||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function e(a,b,d){f.call(this,a,b,"page",d)}function d(a,b,d){f.call(this,a,b,"document",d)}function a(a,b,d){e.call(this,a,b,d)}f.prototype={getAnnotations:function(a,b){var d=this._annotationModel;if(!d)return[];var e=this._view.getModel(),f=e.getLineStart(a),l=e.getLineEnd(b-1),k=e;e.getBaseModel&&(k=e.getBaseModel(),f=e.mapOffset(f),l=e.mapOffset(l));for(var m=[],d=this.getAnnotationsByType(d,f,l),f=0;f<
d.length;f++)for(var l=d[f],p=k.getLineAtOffset(l.start),n=k.getLineAtOffset(Math.max(l.start,l.end-1)),A=p;A<=n;A++){var x=A;if(e!==k){x=k.getLineStart(A);x=e.mapOffset(x,!0);if(-1===x)continue;x=e.getLineAtOffset(x)}if(a<=x&&x<b){var C=this._mergeAnnotation(m[x],l,A-p,n-p+1);C&&(m[x]=C)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var s in m)m[s]._multiple&&(m[s].html+=this._multiAnnotationOverlay.html);return m},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location},
getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(a){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=a)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(a){this._multiAnnotation=a},setMultiAnnotationOverlay:function(a){this._multiAnnotationOverlay=
a},setView:function(a){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=a;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(a,b){if(void 0!==a){var d=this._view,e=d.getModel(),f=e,l=e.getLineStart(a),k=l,m=l,n=this._annotationModel;if(n){d=d.getSelection();m=e.getLineEnd(a,!0);l<=d.start&&d.start<m&&(l=d.start);e.getBaseModel&&(l=e.mapOffset(l),
m=e.mapOffset(m),f=e.getBaseModel());for(var w,m=n.getAnnotations(l,m),n=null;!w&&m.hasNext();)d=m.next(),this.isAnnotationTypeVisible(d.type)&&(n=d,d.start<=l||(w=d));n&&void 0!==n.groupId&&(this._currentClickGroup=this._currentClickGroup===n.groupId?null:n.groupId,this._setCurrentGroup(a));w&&f.getLineAtOffset(w.start)===f.getLineAtOffset(l)?(l=w.start,m=w.end):m=l=k;e.getBaseModel&&(l=e.mapOffset(l,!0),m=e.mapOffset(m,!0))}(e=p.Tooltip.getTooltip(this._view))&&e.setTarget(null);this._view.setSelection(m,
l,1/3,function(){})}},onDblClick:function(a,b){},onMouseMove:function(a,b){var d=p.Tooltip.getTooltip(this._view);if(d&&!(d.isVisible()&&this._tooltipLineIndex===a)){this._tooltipLineIndex=a;var e=this;d.setTarget({y:b.clientY,getTooltipInfo:function(){return e._getTooltipInfo(e._tooltipLineIndex,this.y)}})}},onMouseOver:function(a,b){this.onMouseMove(a,b);this._currentClickGroup||this._setCurrentGroup(a)},onMouseOut:function(a,b){this._currentClickGroup||this._setCurrentGroup(-1);var d=p.Tooltip.getTooltip(this._view);
d&&d.setTarget(null)},_getTooltipInfo:function(a,b){if(void 0!==a){var d=this._view,e=d.getModel(),f=this._annotationModel,l=[];if(f){var l=e.getLineStart(a),k=e.getLineEnd(a);e.getBaseModel&&(l=e.mapOffset(l),k=e.mapOffset(k));l=this.getAnnotationsByType(f,l,k)}f=this._getTooltipContents(a,l);if(!f)return null;f={contents:f,anchor:this.getLocation()};l=d.getClientArea();"document"===this.getOverview()?l.y=d.convert({y:b},"view","document").y:l.y=d.getLocationAtOffset(e.getLineStart(a)).y;d.convert(l,
"document","page");f.x=l.x;f.y=l.y;"right"===f.anchor&&(f.x+=l.width);return f}},_getTooltipContents:function(a,b){return b},_onAnnotationModelChanged:function(a){function b(a){for(var b=0;b<a.length;b++)if(f.isAnnotationTypeVisible(a[b].type)){var h=a[b].start,l=a[b].end;e.getBaseModel&&(h=e.mapOffset(h,!0),l=e.mapOffset(l,!0));-1!==h&&-1!==l&&d.redrawLines(e.getLineAtOffset(h),e.getLineAtOffset(Math.max(h,l-1))+1,f)}}var d=this._view;if(d){var e=d.getModel(),f=this,l=e.getLineCount();a.textModelChangedEvent?
(a=a.textModelChangedEvent.start,e.getBaseModel&&(a=e.mapOffset(a,!0)),a=e.getLineAtOffset(a),d.redrawLines(a,l,f)):(b(a.added),b(a.removed),b(a.changed))}},_mergeAnnotation:function(a,b,d,e){a||(a={});0===d&&(a.html&&b.html?(b.html!==a.html&&(!a._multiple&&this._multiAnnotation)&&(a.html=this._multiAnnotation.html),a._multiple=!0):a.html=b.html);a.style=this._mergeStyle(a.style,b.style);return a},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass=a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?
a.styleClass+(" "+b.styleClass):b.styleClass;var d;if(b.style)for(d in a.style||(a.style={}),b.style)void 0===a.style[d]&&(a.style[d]=b.style[d]);if(b.attributes)for(d in a.attributes||(a.attributes={}),b.attributes)void 0===a.attributes[d]&&(a.attributes[d]=b.attributes[d])}return a},_setCurrentGroup:function(a){var b=this._annotationModel,d=null,e=b.getTextModel(),f,l=this._currentGroupAnnotation;if(-1!==a){var k=e.getLineStart(a),m=e.getLineEnd(a);e.getBaseModel&&(k=e.mapOffset(k),m=e.mapOffset(m));
for(f=b.getAnnotations(k,m);f.hasNext();)if(e=f.next(),this.isAnnotationTypeVisible(e.type)&&e.start<=k&&e.end>=m&&void 0!==e.groupId){d=e;break}if(l&&d&&l.groupId===d.groupId)return}this._currentGroupAnnotation=null;l&&b.removeAnnotations(l.groupType);if(d&&-1!==a){this._currentGroupAnnotation=d;f=b.getAnnotations();for(a=[];f.hasNext();)e=f.next(),delete e.groupAnnotation,e.groupId===d.groupId&&(e=e.createGroupAnnotation(),a.push(e));b.replaceAnnotations(null,a)}}};n.AnnotationTypeList.addMixin(f.prototype);
l.prototype=new f;l.prototype.getAnnotations=function(a,b){for(var d=f.prototype.getAnnotations.call(this,a,b),e=this._view.getModel(),l=a;l<b;l++){var k=l&1?this._oddStyle:this._evenStyle,m=l;e.getBaseModel&&(m=e.getLineStart(m),m=e.getBaseModel().getLineAtOffset(e.mapOffset(m)));d[l]||(d[l]={});d[l].html=this._firstLine+m+"";d[l].style||(d[l].style=k)}return d};l.prototype.getWidestAnnotation=function(){var a=this._view.getModel().getLineCount();return this.getAnnotations(a-1,a)[a-1]};l.prototype.setFirstLine=
function(a){this._firstLine=void 0!==a?a:1};l.prototype._onTextModelChanged=function(a){var b=a.start;a=this._view.getModel();var d=a.getBaseModel?a.getBaseModel().getLineCount():a.getLineCount(),d=(this._firstLine+d-1+"").length;this._numOfDigits!==d&&(this._numOfDigits=d,b=a.getLineAtOffset(b),this._view.redrawLines(b,a.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._getTooltipContents=function(a,b){if(0===b.length){var d=this._view.getModel(),e=a;d.getBaseModel&&(e=d.getLineStart(e),e=d.getBaseModel().getLineAtOffset(d.mapOffset(e)));return k.formatMessage(m.line,e+1)}return f.prototype._getTooltipContents.call(this,a,b)};d.prototype._mergeAnnotation=function(a,b,d,e){if(0===d)return a||(a={html:"\x26nbsp;",style:{style:{height:3*e+"px"}}},a.style=this._mergeStyle(a.style,b.overviewStyle)),a};a.prototype=new e;a.prototype.onClick=function(a,b){if(void 0!==
a){var d=this._annotationModel;if(d){var e=this._view.getModel(),f=e.getLineStart(a),l=e.getLineEnd(a,!0);e.getBaseModel&&(f=e.mapOffset(f),l=e.mapOffset(l),e=e.getBaseModel());for(var k,d=d.getAnnotations(f,l);!k&&d.hasNext();)l=d.next(),this.isAnnotationTypeVisible(l.type)&&e.getLineAtOffset(l.start)===e.getLineAtOffset(f)&&(k=l);k&&((e=p.Tooltip.getTooltip(this._view))&&e.setTarget(null),k.expanded?k.collapse():k.expand())}}};a.prototype._getTooltipContents=function(a,b){if(0<b.length){var d=this._view.getModel(),
f=d.getLineStart(a);d.getBaseModel&&(f=d.mapOffset(f),d=d.getBaseModel());for(var f=d.getLineAtOffset(f),l=0;l<b.length;l++){var k=b[l];if(this.isAnnotationTypeVisible(k.type)&&d.getLineAtOffset(k.start)===f){if(b[l].expanded)break;return e.prototype._getTooltipContents.call(this,a,[k])}}}return null};a.prototype._onAnnotationModelChanged=function(a){function b(a){for(k=0;k<a.length;k++)if(l.isAnnotationTypeVisible(a[k].type)){var b=a[k].start;f.getBaseModel&&(b=f.mapOffset(b,!0));-1!==b&&(p=Math.min(p,
f.getLineAtOffset(b)))}}if(a.textModelChangedEvent)e.prototype._onAnnotationModelChanged.call(this,a);else{var d=this._view;if(d){var f=d.getModel(),l=this,k,m=f.getLineCount(),p=m;b(a.added);b(a.removed);b(a.changed);a=d.getRulers();for(k=0;k<a.length;k++)d.redrawLines(p,m,a[k])}}};return{Ruler:f,AnnotationRuler:e,LineNumberRuler:l,OverviewRuler:d,FoldingRuler:a}});
define("orion/editor/textDND",["orion/util"],function(m){function n(m,k){this._view=m;this._undoStack=k;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var f=this;this._listener={onDragStart:function(l){f._onDragStart(l)},onDragEnd:function(l){f._onDragEnd(l)},onDragEnter:function(l){f._onDragEnter(l)},onDragOver:function(l){f._onDragOver(l)},onDrop:function(l){f._onDrop(l)},onDestroy:function(l){f._onDestroy(l)}};m.addEventListener("DragStart",this._listener.onDragStart);m.addEventListener("DragEnd",
this._listener.onDragEnd);m.addEventListener("DragEnter",this._listener.onDragEnter);m.addEventListener("DragOver",this._listener.onDragOver);m.addEventListener("Drop",this._listener.onDrop);m.addEventListener("Destroy",this._listener.onDestroy)}n.prototype={destroy:function(){var m=this._view;m&&(m.removeEventListener("DragStart",this._listener.onDragStart),m.removeEventListener("DragEnd",this._listener.onDragEnd),m.removeEventListener("DragEnter",this._listener.onDragEnter),m.removeEventListener("DragOver",
this._listener.onDragOver),m.removeEventListener("Drop",this._listener.onDrop),m.removeEventListener("Destroy",this._listener.onDestroy),this._view=null)},_onDestroy:function(m){this.destroy()},_onDragStart:function(m){var k=this._view,f=k.getSelection(),k=k.getModel();k.getBaseModel&&(f.start=k.mapOffset(f.start),f.end=k.mapOffset(f.end),k=k.getBaseModel());if(k=k.getText(f.start,f.end))this._dragSelection=f,m.event.dataTransfer.effectAllowed="copyMove",m.event.dataTransfer.setData("Text",k)},_onDragEnd:function(p){if(this._dragSelection){var k=
this._view,f=p.event.dataTransfer.dropEffect;if(!m.isFirefox&&("none"!==f||this._dropText))f=p.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(p="move"===f)&&k.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var f=this._dropText,l=this._dropOffset;p&&(l>=this._dragSelection.end?l-=this._dragSelection.end-this._dragSelection.start:l>=this._dragSelection.start&&(l=this._dragSelection.start));k.setText(f,l,l);k.setSelection(l,
l+f.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(m){this._onDragOver(m)},_onDragOver:function(p){var k=p.event.dataTransfer.types,f=!this._view.getOptions("readonly");f&&k&&(f=k.contains?k.contains("text/plain")||k.contains("Text"):-1!==k.indexOf("text/plain")||-1!==k.indexOf("Text"));f?m.isFirefox||(this._dropEffect=p.event.dataTransfer.dropEffect=(m.isMac?p.event.altKey:p.event.ctrlKey)?"copy":
"move"):p.event.dataTransfer.dropEffect="none"},_onDrop:function(p){var k=this._view,f=p.event.dataTransfer.getData("Text");f&&(m.isFirefox||(p.event.dataTransfer.dropEffect=this._dropEffect),p=k.getOffsetAtLocation(p.x,p.y),this._dragSelection?(this._dropOffset=p,this._dropText=f):(k.setText(f,p,p),k.setSelection(p,p+f.length)))}};return{TextDND:n}});
define("orion/editor/templates",[],function(){function m(m,k,f,l){this.prefix=m;this.description=k;this.template=f;this.name=l;this._parse()}function n(m,k){this._keywords=m||[];this._templates=[];this.addTemplates(k||[])}m.prototype={getProposal:function(m,k,f){m=k-m.length;k={};var l,e=void 0!==f.delimiter?f.delimiter:"\n";f.indentation&&(e+=f.indentation);var d=void 0!==f.tab?f.tab:"\t",a=0,h=this.variables,b=this.segments;f=[];for(var g=0;g<b.length;g++){var n=b[g],v=h[n];if(void 0!==v)switch(n){case "${tab}":n=
d;break;case "${delimiter}":n=e;break;case "${cursor}":n="";l=a;break;default:var q=k[n];q||(q=k[n]={data:v.data,positions:[]});n=v.substitution;q.data&&q.data.values&&(n=q.data.values[0]);q.positions.push({offset:m+a,length:n.length})}f.push(n);a+=n.length}var e=[],r;for(r in k)k.hasOwnProperty(r)&&e.push(k[r]);f=f.join("");void 0===l&&(l=f.length);return{proposal:f,name:this.name,description:this.description,groups:e,escapePosition:m+l,style:"noemphasis"}},match:function(m){return 0===this.prefix.indexOf(m)},
_parse:function(){var m=this.template,k=[],f={},l,e=0,m=m.replace(/\n/g,"${delimiter}"),m=m.replace(/\t/g,"${tab}");m.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(d,a,h){var b=d.substring(2,d.length-1);a=d;var g=b,n=null,v=g.indexOf(":");-1!==v&&(g=g.substring(0,v),a="${"+g+"}",n=JSON.parse(b.substring(v+1).replace("\\}","}").trim()));(b=f[a])||(b=f[a]={});b.substitution=g;n&&(b.data=n);(l=m.substring(e,h))&&k.push(l);k.push(a);e=h+d.length;return g});(l=m.substring(e,m.length))&&k.push(l);this.segments=
k;this.variables=f}};n.prototype={addTemplates:function(p){for(var k=this.getTemplates(),f=0;f<p.length;f++)k.push(new m(p[f].prefix,p[f].description,p[f].template,p[f].name))},initialize:function(){},computeProposals:function(m,k,f){var l=this.getPrefix(m,k,f),e=[];this.isValid(l,m,k,f)&&(e=e.concat(this.getTemplateProposals(l,k,f)),e=e.concat(this.getKeywordProposals(l)));return e},getKeywords:function(){return this._keywords},getKeywordProposals:function(m){var k=[],f=this.getKeywords();if(f){for(var l=
0;l<f.length;l++)0===f[l].indexOf(m)&&k.push({proposal:f[l].substring(m.length),description:f[l],style:"noemphasis_keyword"});0<k.length&&k.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return k},getPrefix:function(m,k,f){return f.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(m,k,f){for(var l=[],e=this.getTemplates(),d=0;d<e.length;d++){var a=e[d];a.match(m)&&(a=a.getProposal(m,k,f),this.removePrefix(m,a),
l.push(a))}0<l.length&&(l.sort(function(a,b){return a.name<b.name?-1:a.name>b.name?1:0}),l.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return l},removePrefix:function(m,k){if(!(k.overwrite=k.proposal.substring(0,m.length)!==m))k.proposal=k.proposal.substring(m.length)},isValid:function(m,k,f,l){return!0}};return{Template:m,TemplateContentAssist:n}});
define("orion/editor/linkedMode","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/editor/templates orion/objects orion/util".split(" "),function(m,n,p,k,f,l){function e(a,d,b){var e=a.getTextView();p.KeyMode.call(this,e);this.editor=a;this.undoStack=d;this.contentAssist=b;this.linkedModeModel=null;e.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));e.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));e.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));e.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(0<a.selectedGroupIndex?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(a){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),
this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.editor.mapOffset(a.start),d=this.linkedModeModel,e,f;d;)if(e=this._getPositionChanged(d,b,b+a.removedCharCount),f=e.position,void 0===f||f.model!==d)this.exitLinkedMode(!1),d=this.linkedModeModel;else break;if(d){d=0;a=a.addedCharCount-a.removedCharCount;e=e.positions;for(var g,h=0;h<e.length;++h){g=e[h];f=g.position;var l=f.offset<=b&&b<=f.offset+f.length;l&&!g.ansestor?(f.offset+=d,
f.length+=a,d+=a):(f.offset+=d,g.ansestor&&l&&(f.length+=a));g.escape&&(g.model.escapePosition=f.offset)}this._updateAnnotations(e)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,d=b.mapOffset(a.start),e=this.editor.mapOffset(a.end),f=this.linkedModeModel,g,h;f;)if(g=this._getPositionChanged(f,d,e),h=g.position,void 0===h||h.model!==f)this.exitLinkedMode(!1),f=this.linkedModeModel;else break;if(f){var l=this._compoundChange;l?l.owner.model===f&&l.owner.group===h.group||
(this.endUndo(),this.startUndo()):this.startUndo();f.selectedGroupIndex=h.group;var l=0,k=a.text.length-(e-d);g=g.positions;for(var m,d=d-h.position.offset,p=e-h.position.offset,n=0;n<g.length;++n)m=g[n],e=m.position,m.oldOffset=e.offset,m.model===f&&m.group===h.group?(e.offset+=l,e.length+=k,l+=k):(e.offset+=l,m.ansestor&&(e.length+=h.count*k)),m.escape&&(m.model.escapePosition=e.offset);this.ignoreVerify=!0;for(n=g.length-1;0<=n;n--)m=g[n],m.model===f&&m.group===h.group&&b.setText(a.text,m.oldOffset+
d,m.oldOffset+p);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(g)}}}.bind(this)}}var d={};e.prototype=new p.KeyMode;l.mixin(e.prototype,{createKeyBindings:function(){var a=n.KeyBinding,d=[];d.push({actionID:"linkedModeEnter",keyBinding:new a(13)});d.push({actionID:"linkedModeCancel",keyBinding:new a(27)});d.push({actionID:"linkedModeNextGroup",keyBinding:new a(9)});d.push({actionID:"linkedModePreviousGroup",keyBinding:new a(9,!1,!0)});return d},enterLinkedMode:function(a){if(!this.linkedModeModel){var d=
this.editor.getTextView();d.addKeyMode(this);d.addEventListener("Verify",this.linkedModeListener.onVerify);d.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(m.linkedModeEntered,null,!0)}this._sortedPositions=null;this.linkedModeModel&&(a.previousModel=this.linkedModeModel,a.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=a);this.linkedModeModel=
a;this.selectLinkedGroup(0)},exitLinkedMode:function(a){if(this.isActive()){this._compoundChange&&(this.endUndo(),this._compoundChange=null);this._sortedPositions=null;var d=this.linkedModeModel;this.linkedModeModel=d.previousModel;d.parentGroup=d.previousModel=void 0;this.linkedModeModel&&(this.linkedModeModel.nextModel=void 0);if(!this.linkedModeModel){var b=this.editor,e=b.getTextView();e.removeKeyMode(this);e.removeEventListener("Verify",this.linkedModeListener.onVerify);e.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);e=this.contentAssist;e.removeEventListener("Activating",this.linkedModeListener.onActivating);e.offset=void 0;this.editor.reportStatus(m.linkedModeExited,null,!0);a&&b.setCaretOffset(d.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var a=this,d=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:d,group:d.selectedGroupIndex,end:function(){a._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(a){var d=this.linkedModeModel;if(d){d.selectedGroupIndex=a;a=d.groups[a];var b=a.positions[0],e=this.editor;e.setSelection(b.offset,b.offset+b.length);if(d=this.contentAssist)d.offset=void 0,a.data&&"link"===a.data.type&&a.data.values?((this._groupContentAssistProvider=new f.TemplateContentAssist(a.data.values)).getPrefix=function(){var a=
e.getSelection();return a.start===a.end&&(a=e.getCaretOffset(),b.offset<=a&&a<=b.offset+b.length)?e.getText(b.offset,a):""},d.offset=b.offset,d.deactivate(),d.activate()):this._groupContentAssistProvider&&(this._groupContentAssistProvider=null,d.deactivate())}this._updateAnnotations()},_getModelPositions:function(a,d,b){for(var e=d.groups,f=0;f<e.length;f++)for(var l=e[f].positions,k=0;k<l.length;k++){var m=l[k];b&&(m={offset:m.offset+b,length:m.length});m={index:k,group:f,count:l.length,model:d,
position:m};a.push(m);d.nextModel&&d.nextModel.parentGroup===f&&(m.ansestor=!0,this._getModelPositions(a,d.nextModel,(b||0)+l[k].offset-l[0].offset))}},_getSortedPositions:function(a){var d=this._sortedPositions;if(!d){for(d=[];a.previousModel;)a=a.previousModel;for(this._getModelPositions(d,a);a;)void 0!==a.escapePosition&&d.push({escape:!0,model:a,position:{offset:a.escapePosition,length:0}}),a=a.nextModel;d.sort(function(a,d){return a.position.offset-d.position.offset});this._sortedPositions=d}return d},
_getPositionChanged:function(a,d,b){var e;a=this._getSortedPositions(a);for(var f=a.length-1;0<=f;f--){var l=a[f].position;if(l.offset<=d&&b<=l.offset+l.length){e=a[f];break}}return{position:e,positions:a}},_updateAnnotations:function(a){var d=this.editor.getAnnotationModel();if(d){for(var b=[],e=[],f=d.getAnnotations(),l;f.hasNext();)switch(l=f.next(),l.type){case k.AnnotationType.ANNOTATION_LINKED_GROUP:case k.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case k.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:b.push(l)}if(f=
this.linkedModeModel){a=a||this._getSortedPositions(f);for(var m=0;m<a.length;m++)if(l=a[m],l.model===f){var p=k.AnnotationType.ANNOTATION_LINKED_GROUP;l.group===f.selectedGroupIndex&&(p=0===l.index?k.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:k.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);l=l.position;l=k.AnnotationType.createAnnotation(p,l.offset,l.offset+l.length,"");e.push(l)}}d.replaceAnnotations(b,e)}}});d.LinkedMode=e;return d});
define("orion/editor/factories","orion/editor/actions orion/editor/undoStack orion/editor/rulers orion/editor/annotations orion/editor/textDND orion/editor/linkedMode".split(" "),function(m,n,p,k,f,l){function e(){}function d(){}function a(){}function h(){}function b(){}function g(){}var u={};e.prototype={createKeyBindings:function(a,b,d,e){e=new m.TextActions(a,b,e);var f=new l.LinkedMode(a,b,d);a=new m.SourceCodeActions(a,b,d,f);return{textActions:e,linkedMode:f,sourceCodeActions:a}}};u.KeyBindingsFactory=
e;d.prototype={createUndoStack:function(a){a=a.getTextView();return new n.UndoStack(a,200)}};u.UndoFactory=d;a.prototype={createLineNumberRuler:function(a){return new p.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};u.LineNumberRulerFactory=a;h.prototype={createFoldingRuler:function(a){return new p.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};u.FoldingRulerFactory=h;b.prototype={createAnnotationModel:function(a){return new k.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new k.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new p.AnnotationRuler(a,"left",{styleClass:"ruler annotations"});a=new p.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};u.AnnotationFactory=b;g.prototype={createTextDND:function(a,b){return new f.TextDND(a.getTextView(),b)}};u.TextDNDFactory=g;return u});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(m,n,p,k){return k.mixin({},m,n,p)});
define("orion/editor/contentAssist","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/eventTarget orion/Deferred orion/objects orion/editor/util orion/util orion/webui/littlelib".split(" "),function(m,n,p,k,f,l,e,d,a){function h(a){this.textView=a;this.state=u.INACTIVE;this.clearProviders();var b=this;this._textViewListeners={onModelChanging:function(a){(this._latestModelChangingEvent=a)&&this._updateFilterText(a)}.bind(this),onSelection:function(a){this.isDeactivatingChange(this._latestModelChangingEvent,
a)?this.setState(u.INACTIVE):this.isActive()&&(this.state===u.ACTIVE&&this.setState(u.FILTERING),this.filterProposals());this._latestModelChangingEvent=null}.bind(this),onScroll:function(a){this.setState(u.INACTIVE)}.bind(this)};a.setKeyBinding(d.isMac?new n.KeyBinding(" ",!1,!1,!1,!0):new n.KeyBinding(" ",!0),"contentAssist");a.setKeyBinding(d.isMac?new n.KeyBinding(" ",!1,!1,!0,!0):new n.KeyBinding(" ",!0,!1,!0),"contentAssist");a.setAction("contentAssist",function(){a.getOptions("readonly")||b.activate();
return!0},{name:m.contentAssist})}function b(a,b){var d=a.textView;p.KeyMode.call(this,d);this.contentAssist=a;this.widget=b;this.proposals=[];var e=this;this.contentAssist.addEventListener("ProposalsComputed",function(a){e.proposals=a.data.proposals;if(0===e.proposals.length)e.selectedIndex=-1,e.cancel();else{for(e.selectedIndex=0;e.proposals[e.selectedIndex]&&e.proposals[e.selectedIndex].unselectable;)e.selectedIndex++;if(e.proposals[e.selectedIndex]){if(e.widget){var b=!0;if(a.autoApply){for(a=
e.selectedIndex+1;e.proposals[a]&&e.proposals[a].unselectable;)a++;e.proposals[a]||(b=!1,e.contentAssist.apply(e.proposals[e.selectedIndex]))}b&&(e.widget.show(),e.widget.selectNode(e.selectedIndex))}}else e.selectedIndex=-1,e.cancel()}});d.setAction("contentAssistApply",function(){return this.enter()}.bind(this));d.setAction("contentAssistCancel",function(){return this.cancel()}.bind(this));d.setAction("contentAssistNextProposal",function(){return this.lineDown()}.bind(this));d.setAction("contentAssistPreviousProposal",
function(){return this.lineUp()}.bind(this));d.setAction("contentAssistNextPage",function(){return this.pageDown()}.bind(this));d.setAction("contentAssistPreviousPage",function(){return this.pageUp()}.bind(this));d.setAction("contentAssistHome",function(){this.widget&&this.widget.scrollIndex(0,!0);return this.lineDown(0)}.bind(this));d.setAction("contentAssistEnd",function(){return this.lineUp(this.proposals.length-1)}.bind(this));d.setAction("contentAssistTab",function(){return this.tab()}.bind(this));
this.widget&&(this.widget.setContentAssistMode(this),this.widget.createAccessible())}function g(a,b){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=this.textViewListenerAdded=!1;var f=this.textView.getOptions("parent").ownerDocument;this.parentNode="string"===typeof b?f.getElementById(b):b;if(!this.parentNode){this.parentNode=d.createElement(f,"div");this.parentNode.className="contentassist";var g=f.getElementsByTagName("body")[0];if(g)g.appendChild(this.parentNode);
else throw Error("parentNode is required");}e.addEventListener(this.parentNode,"scroll",this.onScroll.bind(this));var h=this;this.textViewListener={onMouseDown:function(a){(a.event.target||a.event.srcElement).parentElement!==h.parentNode&&h.contentAssist.deactivate()}};this.contentAssist.addEventListener("Deactivating",function(a){h.hide()});this.scrollListener=function(a){h.isShowing&&h.position()};e.addEventListener(f,"scroll",this.scrollListener)}var u={INACTIVE:1,ACTIVE:2,FILTERING:3},v={selected:"selected",
hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",noemphasis_keyword:"proposal-noemphasis-keyword",noemphasis_title:"proposal-noemphasis-title",noemphasis_title_keywords:"proposal-noemphasis-title-keywords",dfault:"proposal-default"};h.prototype={apply:function(a){if(!a)return!1;var b=this.textView,d=b.getSelection(),e=this._initialCaretOffset,f=e,g=d=Math.max(d.start,d.end),h=b.getModel();h.getBaseModel&&(f=h.mapOffset(f),g=h.mapOffset(g),h=h.getBaseModel());a.overwrite&&
(e=this.getPrefixStart(h,f));f={proposal:a,start:f,end:g};this.setState(u.INACTIVE);b.setText("string"===typeof a?a:a.proposal,e,d);this.dispatchEvent({type:"ProposalApplied",data:f});return!0},activate:function(a,b){this.state===u.INACTIVE&&(this._autoTriggered=b?!0:!1,this.setState(u.ACTIVE,a))},deactivate:function(){this.setState(u.INACTIVE)},getTextView:function(){return this.textView},isActive:function(){return this.state===u.ACTIVE||this.state===u.FILTERING},isDeactivatingChange:function(a,
b){var d=!1;b.newValue.start<this._initialCaretOffset||!a?d=!0:a&&(d=0<a.removedLineCount||0<a.addedLineCount);return d},setState:function(a,b){var d;a===u.ACTIVE?(d="Activating",this._mode&&this._mode.setActive(!0)):a===u.INACTIVE&&(d="Deactivating",this._mode&&this._mode.setActive(!1));d&&this.dispatchEvent({type:d,providers:b});this.state=a;this.onStateChange(a)},setMode:function(a){this._mode=a},onStateChange:function(a){a===u.INACTIVE?(this._removeTextViewListeners(),this._filterText="",this._initialCaretOffset=
-1,this._computedProposals=null):a===u.ACTIVE&&(this._filterText="",this._addTextViewListeners(),this.computeProposals())},computeProposals:function(){var a=this.textView.getCaretOffset(),b=this.textView.getSelection(),b=Math.min(b.start,b.end);this._initialCaretOffset=Math.min(a,b);this._computedProposals=null;this._computeProposals(this._initialCaretOffset).then(function(a){if(this.isActive()){var b=this._flatten(a);b&&(Array.isArray(b)&&0<b.length)&&(this._computedProposals=a);this.dispatchEvent({type:"ProposalsComputed",
data:{proposals:b},autoApply:!this._autoTriggered});this._computedProposals&&this._filterText&&this.filterProposals(!0)}}.bind(this))},getPrefixStart:function(a,b){for(var d=b;0<d&&/[A-Za-z0-9_]/.test(a.getText(d-1,d));)d--;return d},handleError:function(a){"undefined"!==typeof console&&(console.log("Error retrieving content assist proposals"),console.log(a&&a.stack))},initialize:function(){this._providers.forEach(function(a){a=a.provider;"function"===typeof a.initialize&&a.initialize()})},_computeProposals:function(a){var b=
this._providers,d=this.textView,e=d.getSelection(),g=d.getModel(),h=a;g.getBaseModel&&(h=g.mapOffset(h),e.start=g.mapOffset(e.start),e.end=g.mapOffset(e.end),g=g.getBaseModel());a=g.getLine(g.getLineAtOffset(h));for(var k=0;k<a.length&&/\s/.test(a.charAt(k));)k++;var k=a.substring(0,k),d=d.getOptions("tabSize","expandTab"),d=d.expandTab?Array(d.tabSize+1).join(" "):"\t",m={line:a,offset:h,prefix:g.getText(this.getPrefixStart(g,h),h),selection:e,delimiter:g.getLineDelimiter(),tab:d,indentation:k},
p=this,b=b.map(function(a){a=a.provider;var b;try{var d,e;if(d=a.computeContentAssist){var k=p.editorContextProvider,q=k.getEditorContext();m=l.mixin(m,k.getOptions());e=d.apply(a,[q,m])}else if(d=a.getProposals||a.computeProposals)e=d.apply(a,[g.getText(),h,m]);b=p.progress?p.progress.progress(e,"Generating content assist proposal"):e}catch(n){return(new f).reject(n)}return f.when(b)});return f.all(b,this.handleError)},filterProposals:function(a){if(this._computedProposals&&(this._latestModelChangingEvent||
a)){a=this.textView.getModel();a.getBaseModel&&(a=a.getBaseModel());a=this.getPrefixStart(a,this._initialCaretOffset);var b=this.textView.getText(a,this._initialCaretOffset),d=[];this._computedProposals.forEach(function(a){a&&Array.isArray(a)&&(a=a.filter(function(a){if(!a)return!1;if(v[a.style]===v.hr||v[a.style]===v.noemphasis_title)return!0;var d="";if(a.overwrite){if(a.name)d=a.name;else if(a.proposal)d=a.proposal;else return!1;return 0===d.indexOf(b+this._filterText)}return a.name||a.proposal?
(d=!1,a.name&&(d=0===a.name.indexOf(b+this._filterText)),!d&&a.proposal&&(d=0===a.proposal.indexOf(this._filterText)),d):"string"===typeof a?0===a.indexOf(this._filterText):!1},this),0<a.length&&d.push(a))},this);a=[];d&&(d=this._removeExtraUnselectableElements(d),a=this._flatten(d));this.dispatchEvent({type:"ProposalsComputed",data:{proposals:a},autoApply:!1})}},_removeExtraUnselectableElements:function(a){return a.map(function(a){return a.filter(function(b,d){var e=!0;if(v[b.style]===v.hr)0===d||
a.length-1===d?e=!1:v.hr===v[a[d-1].style]&&(e=!1);else if(v[b.style]===v.noemphasis_title){var f=a[d+1];f?v[f.style]===v.noemphasis_title&&(e=!1):e=!1}return e})})},setEditorContextProvider:function(a){this.editorContextProvider=a},_generateProviderId:function(){this._idcount?this._idcount++:this._idcount=0;return"ContentAssistGeneratedID_"+this._idcount},setAutoTriggerEnabled:function(a){this._autoTriggerEnabled=a;this._updateAutoTriggerListenerState()},setProviders:function(a){var b=this;this.setProviderInfoArray(a.map(function(a){return a.id?
a:{provider:a,id:b._generateProviderId()}}))},setProviderInfoArray:function(a){this.clearProviders();this._providers=a;this._charTriggersInstalled=a.some(function(a){return a.charTriggers});this._updateAutoTriggerListenerState()},getProviders:function(){return this._providers.slice()},clearProviders:function(){this._providers=[];this._charTriggersInstalled=!1;this._updateAutoTriggerListenerState()},setProgress:function(a){this.progress=a},setStyleAccessor:function(a){this._styleAccessor=a},_flatten:function(a){return a.reduce(function(a,
b){var d=a,e=null;b&&Array.isArray(b)&&(e=b.filter(function(a){return a}));if(e&&Array.isArray(e)&&0<e.length){var d=e,f=a,g=e[0].style;g&&0===v[g].indexOf(v.noemphasis)&&(d=a,f=e);0<d.length&&(e=d[d.length-1].style)&&v.hr!==v[e]&&(d=d.concat({proposal:"",name:"",description:"---------------------------------",style:"hr",unselectable:!0}));d=d.concat(f)}return d},[])},_triggerListener:function(){var a=this.textView.getCaretOffset(),b=null,d=[];if(this._charTriggersInstalled){var e=this.textView.getText(a-
1,a);this._providers.forEach(function(f){var g=f.charTriggers;if(g&&g.test(e)){var g=!1,h=f.excludedStyles;this._styleAccessor&&h&&(b||(b=this._styleAccessor.getStyles(a-1)),g=b.some(function(a){return h.test(a.style)}));g||d.push(f)}},this);0<d.length&&this.activate(d,!0)}},_updateAutoTriggerListenerState:function(){this._boundTriggerListener||(this._boundTriggerListener=this._triggerListener.bind(this));if(this._triggerListenerInstalled){if(!this._autoTriggerEnabled||!this._charTriggersInstalled)this.textView.removeEventListener("Modify",
this._boundTriggerListener),this._triggerListenerInstalled=!1}else this._autoTriggerEnabled&&this._charTriggersInstalled&&(this.textView.addEventListener("Modify",this._boundTriggerListener),this._triggerListenerInstalled=!0)},_addTextViewListeners:function(){this._textViewListenersAdded||(this.textView.addEventListener("ModelChanging",this._textViewListeners.onModelChanging),this.textView.addEventListener("Scroll",this._textViewListeners.onScroll),this.textView.addEventListener("Selection",this._textViewListeners.onSelection),
this._textViewListenersAdded=!0)},_removeTextViewListeners:function(){this._textViewListenersAdded&&(this._latestModelChangingEvent=null,this.textView.removeEventListener("ModelChanging",this._textViewListeners.onModelChanging),this.textView.removeEventListener("Scroll",this._textViewListeners.onScroll),this.textView.removeEventListener("Selection",this._textViewListeners.onSelection),this._textViewListenersAdded=!1)},_updateFilterText:function(a){var b=a.removedCharCount;b&&(this._filterText=this._filterText.substring(0,
this._filterText.length-b));if(a=a.text)this._filterText=this._filterText.concat(a)}};k.EventTarget.addMixin(h.prototype);b.prototype=new p.KeyMode;l.mixin(b.prototype,{createKeyBindings:function(){var b=n.KeyBinding,d=[];d.push({actionID:"contentAssistApply",keyBinding:new b(13)});d.push({actionID:"contentAssistCancel",keyBinding:new b(27)});d.push({actionID:"contentAssistNextProposal",keyBinding:new b(40)});d.push({actionID:"contentAssistPreviousProposal",keyBinding:new b(38)});d.push({actionID:"contentAssistNextPage",
keyBinding:new b(34)});d.push({actionID:"contentAssistPreviousPage",keyBinding:new b(33)});d.push({actionID:"contentAssistHome",keyBinding:new b(a.KEY.HOME)});d.push({actionID:"contentAssistEnd",keyBinding:new b(a.KEY.END)});d.push({actionID:"contentAssistTab",keyBinding:new b(9)});return d},cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},getProposals:function(){return this.proposals},isActive:function(){return this.getContentAssist().isActive()},
setActive:function(a){a?this.contentAssist.textView.addKeyMode(this):this.contentAssist.textView.removeKeyMode(this)},lineUp:function(a,b){return this.selectNew(a,b,!1)},lineDown:function(a,b){return this.selectNew(a,b,!0)},selectNew:function(a,b,d){if(d){if(void 0===a&&(a=this.selectedIndex+1),a>=this.proposals.length){if(b)return!0;a=0}}else if(void 0===a&&(a=this.selectedIndex-1),0>a){if(b)return!0;a=this.proposals.length-1}for(var e=a;this.proposals[a]&&this.proposals[a].unselectable;){if(d){if(a++,
a>=this.proposals.length){if(b)return!0;a=0}}else if(a--,0>a){if(b)return!0;a=this.proposals.length-1}if(a===e){a=-1;break}}this.selectedIndex=a;this.widget&&this.widget.selectNode(a);return!0},pageUp:function(){if(this.widget){var a=this.widget.getTopIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!1),a=this.widget.getTopIndex());return 0===a?this.lineDown(a,!0):this.lineUp(a,!0)}return this.lineUp()},pageDown:function(){if(this.widget){var a=this.widget.getBottomIndex();a===this.selectedIndex&&
(this.widget.scrollIndex(a,!0),a=this.widget.getBottomIndex());return this.lineDown(a,!0)}return this.lineDown()},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},tab:function(){return this.widget?(this.widget.parentNode.focus(),!0):!1}});g.prototype={onClick:function(a){a||(a=window.event);this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},onScroll:function(a){this.previousCloneNode&&!this.preserveCloneThroughScroll&&
(this._removeCloneNode(),this.previousSelectedNode.classList.add(v.selected));this.preserveCloneThroughScroll=!1},createDiv:function(a,b,e){var f=b.ownerDocument,g=d.createElement(f,"div");g.id="contentoption"+e;g.setAttribute("role","option");g.className=v[a.style]?v[a.style]:v.dfault;"hr"===a.style?a=d.createElement(f,"hr"):(a=this._createDisplayNode(g,a,e),g.contentAssistProposalIndex=e);g.appendChild(a);b.appendChild(g)},createAccessible:function(){var b=this._contentAssistMode,d=this;e.addEventListener(this.parentNode,
"keydown",function(e){e||(e=window.event);e.preventDefault&&e.preventDefault();return e.keyCode===a.KEY.ESCAPE?b.cancel():e.keyCode===a.KEY.UP?b.lineUp():e.keyCode===a.KEY.DOWN?b.lineDown():e.keyCode===a.KEY.ENTER?b.enter():e.keyCode===a.KEY.PAGEDOWN?b.pageDown():e.keyCode===a.KEY.PAGEUP?b.pageUp():e.keyCode===a.KEY.HOME?(d.scrollIndex(0,!0),b.lineDown(0)):e.keyCode===a.KEY.END?b.lineUp(b.getProposals().length-1):!1})},_createDisplayNode:function(a,b,d){var e=null,f=null;if("string"===typeof b)f=
b;else if(b.description&&"string"===typeof b.description)if(b.name&&"string"===typeof b.name){var g=this._createNameNode(b.name);g.contentAssistProposalIndex=d;e=document.createElement("span");e.appendChild(g);g=document.createTextNode(b.description);e.appendChild(g);a.setAttribute("title",b.name+b.description)}else f=b.description;else f=b.proposal;f&&(e=this._createNameNode(f),a.setAttribute("title",f));e.contentAssistProposalIndex=d;return e},_createNameNode:function(a){var b=document.createElement("span");
b.classList.add("proposal-name");b.appendChild(document.createTextNode(a));return b},getProposal:function(a){var b=null;a=a.contentAssistProposalIndex;void 0!==a&&(b=this._contentAssistMode.getProposals()[a]||null);return b},getTopIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++)if(a[b].offsetTop>=this.parentNode.scrollTop)return b;return 0},getBottomIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++){var d=a[b];if(d.offsetTop+d.offsetHeight>this.parentNode.scrollTop+
this.parentNode.clientHeight)return Math.max(0,b-1)}return a.length-1},scrollIndex:function(a,b){this.parentNode.childNodes[a].scrollIntoView(b);this.preserveCloneThroughScroll=!0},selectNode:function(b){var d=null;this.previousSelectedNode&&(this.previousSelectedNode.classList.remove(v.selected),this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode());if(-1!==b){d=this.parentNode.childNodes[b];d.classList.add(v.selected);this.parentNode.setAttribute("aria-activedescendant",
d.id);d.focus();d.offsetTop<this.parentNode.scrollTop?(d.scrollIntoView(!0),this.preserveCloneThroughScroll=!0):d.offsetTop+d.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight&&(d.scrollIntoView(!1),this.preserveCloneThroughScroll=!0);var e=a.bounds(d.firstChild||d),f=a.bounds(this.parentNode);b=window.getComputedStyle(this.parentNode);var g=window.getComputedStyle(d),g=parseInt(b.paddingLeft)+parseInt(b.paddingRight)+parseInt(g.paddingLeft)+parseInt(g.paddingRight);if(e.width>=
f.width-g){g=parseInt(b.top);f=d.cloneNode(!0);f.classList.add("cloneProposal");f.style.top=g+d.offsetTop-this.parentNode.scrollTop+"px";f.style.left=b.left;f.setAttribute("id",f.id+"_clone");e=e.left+e.width-parseInt(document.documentElement.clientWidth);0<e&&(b=parseInt(b.left)-e,0>b&&(b=0),f.style.left=b+"px");b=document.createElement("div");b.id="clone_contentassist";b.classList.add("contentassist");b.classList.add("cloneWrapper");b.appendChild(f);b.onclick=this.parentNode.onclick;this.parentNode.parentNode.insertBefore(b,
this.parentNode);var h=function(a){a.contentAssistProposalIndex=d.contentAssistProposalIndex;if(a.hasChildNodes())for(var b=0;b<a.childNodes.length;b++)h(a.childNodes[b])};h(b);d.classList.remove(v.selected);this.previousCloneNode=b}}this.previousSelectedNode=d},setContentAssistMode:function(a){this._contentAssistMode=a},show:function(){var a=this._contentAssistMode.getProposals();if(0===a.length)this.hide();else{this.parentNode.innerHTML="";for(var b=0;b<a.length;b++)this.createDiv(a[b],this.parentNode,
b);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0;this.textViewListenerAdded||(this.textView.addEventListener("MouseDown",this.textViewListener.onMouseDown),this.textViewListenerAdded=!0)}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1;this.textViewListenerAdded&&(this.textView.removeEventListener("MouseDown",this.textViewListener.onMouseDown),
this.textViewListenerAdded=!1);this.previousSelectedNode&&(this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode())},position:function(){var a=this.contentAssist,b=this.textView;if(void 0!==a.offset){var a=a.offset,d=b.getModel();d.getBaseModel&&(a=d.mapOffset(a,!0))}else a=this.textView.getCaretOffset();a=b.getLocationAtOffset(a);a.y+=b.getLineHeight();this.textView.convert(a,"document","page");this.parentNode.style.position="fixed";this.parentNode.style.left=a.x+"px";this.parentNode.style.top=
a.y+"px";this.parentNode.style.display="block";this.parentNode.scrollTop=0;b=this.parentNode.ownerDocument;d=b.documentElement.clientWidth;a.y+this.parentNode.offsetHeight>b.documentElement.clientHeight&&(this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px");a.x+this.parentNode.offsetWidth>d&&(this.parentNode.style.left=d-this.parentNode.offsetWidth+"px")},_removeCloneNode:function(){this.parentNode.parentNode.contains(this.previousCloneNode)&&this.parentNode.parentNode.removeChild(this.previousCloneNode);
this.previousCloneNode=null}};return{ContentAssist:h,ContentAssistMode:b,ContentAssistWidget:g}});
define("orion/editor/emacs",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(m,n,p,k){function f(f){n.KeyMode.call(this,f)}f.prototype=new n.KeyMode;f.prototype.createKeyBindings=function(){var f=[];f.push({actionID:"emacs-beginning-of-line",keyBinding:this._createStroke("a",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-end-of-line",keyBinding:this._createStroke("e",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-forward-char",keyBinding:this._createStroke("f",
!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-backward-char",keyBinding:this._createStroke("b",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-forward-word",keyBinding:this._createStroke("f",!1,!1,!0)});f.push({actionID:"emacs-backward-word",keyBinding:this._createStroke("b",!1,!1,!0)});f.push({actionID:"emacs-next-line",keyBinding:this._createStroke("n",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-previous-line",keyBinding:this._createStroke("p",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-beginning-of-buffer",
keyBinding:this._createStroke(188,!1,!0,!0)});f.push({actionID:"emacs-end-of-buffer",keyBinding:this._createStroke(190,!1,!0,!0)});f.push({actionID:"emacs-delete-backward-char",keyBinding:this._createStroke(46,!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-delete-char",keyBinding:this._createStroke("d",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-kill-line",keyBinding:this._createStroke("k",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-kill-word",keyBinding:this._createStroke("d",!1,!1,
!0)});f.push({actionID:"emacs-backward-kill-word",keyBinding:this._createStroke(46,!1,!1,!0)});f.push({actionID:"undo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("u")])});f.push({actionID:"redo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("r")])});f.push({actionID:"emacs-scroll-up",keyBinding:this._createStroke("v",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-scroll-down",keyBinding:this._createStroke("v",!1,!1,!0)});f.push({actionID:"emacs-set-mark-command",
keyBinding:this._createStroke(" ",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-reset-mark-command",keyBinding:this._createStroke("g",!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-exchange-point-and-mark",keyBinding:this._createSequence([this._createStroke("x",!k.isMac,!1,!1,k.isMac),this._createStroke("x",!k.isMac,!1,!1,k.isMac)])});for(var e=0;9>=e;e++)f.push({actionID:"emacs-digit-argument-"+e,keyBinding:this._createStroke(48+e,!k.isMac,!1,!1,k.isMac)}),f.push({actionID:"emacs-digit-argument-"+
e,keyBinding:this._createStroke(48+e,!1,!1,!0)}),f.push({actionID:"emacs-digit-argument-"+e,keyBinding:this._createStroke(48+e,!k.isMac,!1,!0,k.isMac)});f.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!k.isMac,!1,!1,k.isMac)});f.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!1,!1,!0)});f.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!k.isMac,!1,!0,k.isMac)});f.push({actionID:"emacs-uppercase",keyBinding:this._createStroke("u",
!1,!1,!0)});f.push({actionID:"emacs-lowercase",keyBinding:this._createStroke("l",!1,!1,!0)});f.push({actionID:"emacs-capitalize",keyBinding:this._createStroke("c",!1,!1,!0)});f.push({actionID:"contentAssist",keyBinding:this._createStroke(191,!1,!1,!0)});f.push({actionID:"find",keyBinding:this._createStroke("r",!1,!1,!0)});f.push({actionID:"incrementalFind",keyBinding:this._createStroke("s",!0)});f.push({actionID:"incrementalFindReverse",keyBinding:this._createStroke("r",!0)});f.push({actionID:"save",
keyBinding:this._createSequence([this._createStroke("x",!k.isMac,!1,!1,k.isMac),this._createStroke("s",!k.isMac,!1,!1,k.isMac)])});this._createActions(this.getView());return f};f.prototype._createStroke=function(f,e,d,a,h){f=new p.KeyStroke(f,e,d,a,h);f.scopeName=m.emacs;return f};f.prototype._createSequence=function(f){f=new p.KeySequence(f);f.scopeName=m.emacs;return f};f.prototype._getData=function(){var f={count:(this._argument||1)*(this._sign||1)};this._argument=0;this._sign=1;return f};f.prototype._moveCursor=
function(f){var e=this._getData();this._marker&&(e.select=!0);return this.getView().invokeAction(f,!1,e)};f.prototype._digitArgument=function(f){this._argument=10*(this._argument||0)+f;return!0};f.prototype._negativeArgument=function(){this._sign=-1*(this._sign||1);return!0};f.prototype._createActions=function(f){var e=this;f.setAction("emacs-beginning-of-line",function(){return e._moveCursor("lineStart")},{name:m.lineStart});f.setAction("emacs-end-of-line",function(){return e._moveCursor("lineEnd")},
{name:m.lineEnd});f.setAction("emacs-forward-char",function(){return e._moveCursor("charNext")},{name:m.charNext});f.setAction("emacs-backward-char",function(){return e._moveCursor("charPrevious")},{name:m.charPrevious});f.setAction("emacs-forward-word",function(){return e._moveCursor("wordNext")},{name:m.wordNext});f.setAction("emacs-backward-word",function(){return e._moveCursor("wordPrevious")},{name:m.wordPrevious});f.setAction("emacs-next-line",function(){return e._moveCursor("lineDown")},{name:m.lineDown});
f.setAction("emacs-previous-line",function(){return e._moveCursor("lineUp")},{name:m.lineUp});f.setAction("emacs-beginning-of-buffer",function(){return e._moveCursor("textStart")},{name:m.textStart});f.setAction("emacs-end-of-buffer",function(){return e._moveCursor("textEnd")},{name:m.textEnd});f.setAction("emacs-delete-backward-char",function(){return f.invokeAction("deletePrevious")},{name:m.deletePrevious});f.setAction("emacs-delete-char",function(){return f.invokeAction("deletePrevious")},{name:m.deletePrevious});
f.setAction("emacs-kill-line",function(){return f.invokeAction("deleteLineEnd")},{name:m.deleteLineEnd});f.setAction("emacs-kill-word",function(){return f.invokeAction("deleteWordNext")},{name:m.deleteWordNext});f.setAction("emacs-backward-kill-word",function(){return f.invokeAction("deleteWordPrevious")},{name:m.deleteWordPrevious});f.setAction("emacs-scroll-up",function(){return e._moveCursor("pageDown")},{name:m.pageDown});f.setAction("emacs-scroll-down",function(){return e._moveCursor("pageUp")},
{name:m.pageUp});f.setAction("emacs-set-mark-command",function(){var d=f.getCaretOffset();f.setCaretOffset(d);e._marker=d;return!0},{name:m.setMarkCommand});f.setAction("emacs-exchange-point-and-mark",function(){if(void 0!==e._marker){var d=f.getCaretOffset(),a=f.getSelection();if(a.end===d){var h=a.start;a.start=a.end;a.end=h}e._marker=d;f.setSelection(a.start,a.end)}return!0},{name:m.exchangeMarkPoint});f.setAction("emacs-reset-mark-command",function(){var d=f.getCaretOffset();f.setCaretOffset(d);
e._marker=void 0;return!0},{name:m.clearMark});f.setAction("emacs-digit-argument-0",function(){return e._digitArgument(0)},{name:k.formatMessage(m.digitArgument,"0")});f.setAction("emacs-digit-argument-1",function(){return e._digitArgument(1)},{name:k.formatMessage(m.digitArgument,"1")});f.setAction("emacs-digit-argument-2",function(){return e._digitArgument(2)},{name:k.formatMessage(m.digitArgument,"2")});f.setAction("emacs-digit-argument-3",function(){return e._digitArgument(3)},{name:k.formatMessage(m.digitArgument,
"3")});f.setAction("emacs-digit-argument-4",function(){return e._digitArgument(4)},{name:k.formatMessage(m.digitArgument,"4")});f.setAction("emacs-digit-argument-5",function(){return e._digitArgument(5)},{name:k.formatMessage(m.digitArgument,"5")});f.setAction("emacs-digit-argument-6",function(){return e._digitArgument(6)},{name:k.formatMessage(m.digitArgument,"6")});f.setAction("emacs-digit-argument-7",function(){return e._digitArgument(7)},{name:k.formatMessage(m.digitArgument,"7")});f.setAction("emacs-digit-argument-8",
function(){return e._digitArgument(8)},{name:k.formatMessage(m.digitArgument,"8")});f.setAction("emacs-digit-argument-9",function(){return e._digitArgument(9)},{name:k.formatMessage(m.digitArgument,"9")});f.setAction("emacs-negative-argument",function(){return e._negativeArgument()},{name:m.negativeArgument});f.setAction("emacs-uppercase",function(){var d=e._getData();d.unit="word";return f.invokeAction("uppercase",!1,d)},{name:m.uppercase});f.setAction("emacs-lowercase",function(){var d=e._getData();
d.unit="word";return f.invokeAction("lowercase",!1,d)},{name:m.lowercase});f.setAction("emacs-capitalize",function(){var d=e._getData();d.unit="word";return f.invokeAction("capitalize",!1,d)},{name:m.capitalize})};return{EmacsMode:f}});
define("orion/editor/vi",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(m,n,p,k){function f(a,b){for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d])}function l(a,b,d,e,f,g,h){a=new p.KeyStroke(a,b,d,e,f,g);a.scopeName=h||m.vi;return a}function e(a,b){var d=new p.KeySequence(a);d.scopeName=b||m.vi;return d}function d(a,b,d){this.key=b;this.msg=d;this.number="";n.KeyMode.call(this,a);a&&this._createActions(a)}function a(a){var b=a.getView();this.viMode=
a;n.KeyMode.call(this,b);this._createActions(b)}function h(a,b,e,f){this.viMode=a;this.nextMode=b;d.call(this,a.getView(),e,f)}function b(a){var b=a.getView();n.KeyMode.call(this,b);this.viMode=a;this._createActions(b)}function g(a,e){d.call(this,a,"",m.vimove);this.insertMode=new b(this);this.changeMode=new h(this,this.insertMode,"c",m.vichange);this.deleteMode=new h(this,this,"d",m.videlete);this.yankMode=new h(this,this,"y",m.viyank);this.statusReporter=e}var u,v;d.prototype=new n.KeyMode;f(d.prototype,
{_msg:function(a){return{name:k.formatMessage(m[a],this.msg)}},createKeyBindings:function(){for(var a=[],b=this.key,b=b?"-"+b+"-":"-",d=0;9>=d;d++)a.push({actionID:"vi"+b+d,keyBinding:l(d+"",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi"+b+"Left",keyBinding:l("h",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Left",keyBinding:l("h",!0,!1,!1,!1)});a.push({actionID:"vi"+b+"Left",keyBinding:l(8)});a.push({actionID:"vi"+b+"Left",keyBinding:l(37)});a.push({actionID:"vi"+b+"Down",keyBinding:l("j",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Down",keyBinding:l(40)});a.push({actionID:"vi"+b+"Up",keyBinding:l("k",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Up",keyBinding:l(38)});a.push({actionID:"vi"+b+"Right",keyBinding:l("l",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Right",keyBinding:l(39)});a.push({actionID:"vi"+b+"Right",keyBinding:l(32)});a.push({actionID:"vi"+b+"w",keyBinding:l("w",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"b",keyBinding:l("b",!1,!1,!1,!1,
"keypress")});a.push({actionID:"vi"+b+"W",keyBinding:l("W",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"B",keyBinding:l("B",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"e",keyBinding:l("e",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"E",keyBinding:l("E",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"$",keyBinding:l("$",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:l("^",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:l("_",!1,!1,!1,!1,"keypress")});
a.push({actionID:"vi"+b+"+",keyBinding:l("+",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"+",keyBinding:l(13)});a.push({actionID:"vi"+b+"-",keyBinding:l("-",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"|",keyBinding:l("|",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"H",keyBinding:l("H",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"M",keyBinding:l("M",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"L",keyBinding:l("L",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"/",
keyBinding:l("/",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"?",keyBinding:l("?",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"n",keyBinding:l("n",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"N",keyBinding:l("N",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"f",keyBinding:l("f",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"F",keyBinding:l("F",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"t",keyBinding:l("t",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"T",keyBinding:l("T",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+",",keyBinding:l(",",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+";",keyBinding:l(";",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"G",keyBinding:l("G",!1,!1,!1,!1,"keypress")});return a},_createActions:function(a){function b(d){d=a.getModel().getLine(d);for(var e=0,f=d.charCodeAt(e);32===f||9===f;)e++,f=d.charCodeAt(e);return e}function d(a,b){a&&f.getView().setCaretOffset(a.start);b.editDone&&b.editDone()}var e=this.key,e=e?"-"+e+"-":
"-",f=this;a.setAction("vi"+e+"0",function(){return f._storeNumber(0)});a.setAction("vi"+e+"1",function(){return f._storeNumber(1)});a.setAction("vi"+e+"2",function(){return f._storeNumber(2)});a.setAction("vi"+e+"3",function(){return f._storeNumber(3)});a.setAction("vi"+e+"4",function(){return f._storeNumber(4)});a.setAction("vi"+e+"5",function(){return f._storeNumber(5)});a.setAction("vi"+e+"6",function(){return f._storeNumber(6)});a.setAction("vi"+e+"7",function(){return f._storeNumber(7)});a.setAction("vi"+
e+"8",function(){return f._storeNumber(8)});a.setAction("vi"+e+"9",function(){return f._storeNumber(9)});a.setAction("vi"+e+"Left",function(){return f._invoke("charPrevious",{unit:"character"})},this._msg("viLeft"));a.setAction("vi"+e+"Right",function(){return f._invoke("charNext",{unit:"character"})},this._msg("viRight"));a.setAction("vi"+e+"Up",function(){return f._invoke("lineUp",{editLine:!0})},this._msg("viUp"));a.setAction("vi"+e+"Down",function(){return f._invoke("lineDown",{editLine:!0})},
this._msg("viDown"));a.setAction("vi"+e+"w",function(){return f._invoke("wordNext",{unit:"word"})},this._msg("viw"));a.setAction("vi"+e+"b",function(){return f._invoke("wordPrevious",{unit:"word"})},this._msg("vib"));a.setAction("vi"+e+"W",function(){return f._invoke("wordNext",{unit:"wordWS"})},this._msg("viW"));a.setAction("vi"+e+"B",function(){return f._invoke("wordPrevious",{unit:"wordWS"})},this._msg("viB"));a.setAction("vi"+e+"e",function(){f._invoke("charNext",{unit:"character"});f._invoke("wordNext",
{unit:"wordend"});f._invoke("charPrevious",{unit:"character"});return!0},this._msg("vie"));a.setAction("vi"+e+"E",function(){return f._invoke("wordNext",{unit:"wordendWS"})},this._msg("viE"));a.setAction("vi"+e+"$",function(){return f._invoke("lineEnd")},this._msg("vi$"));a.setAction("vi"+e+"^_",function(){return f._invoke(function(){var d=a.getModel(),e=a.getCaretOffset(),e=d.getLineAtOffset(e);a.setCaretOffset(d.getLineStart(e)+b(e))})},this._msg("vi^_"));a.setAction("vi"+e+"+",function(){return f._invoke(function(d){var e=
a.getModel(),f=a.getCaretOffset(),g=e.getLineCount()-1;d=Math.min(e.getLineAtOffset(f)+d.count,g);a.setCaretOffset(e.getLineStart(d)+b(d))},{editLine:!0})},this._msg("vi+"));a.setAction("vi"+e+"-",function(){return f._invoke(function(d){var e=a.getModel(),f=a.getCaretOffset();d=Math.max(e.getLineAtOffset(f)-d.count,0);a.setCaretOffset(e.getLineStart(d)+b(d))},{editLine:!0})},this._msg("vi-"));a.setAction("vi"+e+"|",function(){return f._invoke(function(b){var d=a.getModel(),e=a.getCaretOffset(),e=
d.getLineAtOffset(e);a.setCaretOffset(Math.min(d.getLineStart(e)+b.count-1,d.getLineEnd(e)))})},this._msg("vi|"));a.setAction("vi"+e+"H",function(){return f._invoke(function(b){b=a.getModel().getLineStart(a.getTopIndex(!0)+(b.count-1));a.setCaretOffset(b)},{editLine:!0})},this._msg("viH"));a.setAction("vi"+e+"M",function(){return f._invoke(function(b){b=Math.ceil((a.getBottomIndex(!0)-a.getTopIndex(!0))/2)+a.getTopIndex(!0);a.setCaretOffset(a.getModel().getLineStart(b))},{editLine:!0})},this._msg("viM"));
a.setAction("vi"+e+"L",function(){return f._invoke(function(b){a.setCaretOffset(a.getModel().getLineStart(a.getBottomIndex(!0)-(b.count-1)))},{editLine:!0})},this._msg("viL"));a.setAction("vi"+e+"/",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!1,findCallback:function(b){f._searchFwd=!0;d(b,a)}};return f._invoke("find",a)},this._msg("vi/"));a.setAction("vi"+e+"?",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!0,findCallback:function(b){f._searchFwd=!1;d(b,a)}};return f._invoke("find",
a)},this._msg("vi?"));a.setAction("vi"+e+"n",function(){var b,e=a.getCaretOffset();f._searchFwd?(b="findNext",e++):b="findPrevious";var g={start:e,findCallback:function(a){d(a,g)}};return f._invoke(b,g)},this._msg("vin"));a.setAction("vi"+e+"N",function(){var b,e=a.getCaretOffset();f._searchFwd?b="findPrevious":(b="findNext",e++);var g={start:e,findCallback:function(a){d(a,g)}};return f._invoke(b,g)},this._msg("viN"));a.setAction("vi"+e+"f",function(){var b=a.getModel(),d=a.getCaretOffset();return f._findChar(d,
b.getLineEnd(b.getLineAtOffset(d)),!1,0)},this._msg("vif"));a.setAction("vi"+e+"F",function(){var b=a.getModel(),d=a.getCaretOffset();return f._findChar(b.getLineStart(b.getLineAtOffset(d)),d,!0,0)},this._msg("viF"));a.setAction("vi"+e+"t",function(){var b=a.getModel(),d=a.getCaretOffset();return f._findChar(d,b.getLineEnd(b.getLineAtOffset(d)),!1,-1)},this._msg("vit"));a.setAction("vi"+e+"T",function(){var b=a.getModel(),d=a.getCaretOffset();return f._findChar(b.getLineStart(b.getLineAtOffset(d)),
d,!0,1)},this._msg("viT"));a.setAction("vi"+e+",",function(){return f._findNextChar(f._charTempOptions.reverse)},this._msg("vi,"));a.setAction("vi"+e+";",function(){return f._findNextChar(!f._charTempOptions.reverse)},this._msg("vi;"));a.setAction("vi"+e+"G",function(){if(""===f.number){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());f.number=b.getLineCount()}return f._invoke(function(b){b=b||{};b.line=b.count;b.editLine=!0;b.callback=function(){b.editDone&&b.editDone()};a.invokeAction("gotoLine",
!1,b)})},this._msg("viG"))},_invoke:function(a,b){var d=this.getView();b=b||{};b.count=this._getCount();"function"===typeof a?a(b):d.invokeAction(a,!1,b);return!0},_getCount:function(){var a=1;""!==this.number&&(a=this.number>>0);this.number="";return a},_findChar:function(a,b,d,e){this._charTempOptions={};this._charTempOptions.start=a;this._charTempOptions.end=b;this._charTempOptions.hideAfterFind=!0;this._charTempOptions.incremental=!1;this._charTempOptions.reverse=d;this._charTempOptions.offset=
e;var f=this._charTempOptions,g=this;this._charTempOptions.findCallback=function(a){a&&g.getView().setCaretOffset(a.start+e);f.editDone&&f.editDone()};return this._invoke("find",this._charTempOptions)},_findNextChar:function(a){if(this._charTempOptions){var b=this.getView(),d={};d.hideAfterFind=this._charTempOptions.hideAfterFind;d.incremental=this._charTempOptions.incremental;d.reverse=this._charTempOptions.reverse;d.wrap=!1;var e=this;d.findCallback=function(a){a&&e.getView().setCaretOffset(a.start+
e._charTempOptions.offset);d.editDone&&d.editDone()};var f=b.getModel();if(a)return d.start=b.getCaretOffset()+1-this._charTempOptions.offset,d.end=f.getLineEnd(f.getLineAtOffset(d.start)),d.reverse=!1,this._invoke("findNext",d);d.start=b.getCaretOffset()-this._charTempOptions.offset;d.end=f.getLineStart(f.getLineAtOffset(d.start));d.reverse=!0;return this._invoke("findPrevious",d)}return!0},_storeNumber:function(a){var b=this;if(0===a&&!this.number)return this._invoke(function(){b.getView().invokeAction("lineStart",
!0)});this.number+=a;return!0}});a.prototype=new n.KeyMode;f(a.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-:-ESC",keyBinding:l(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-:-ESC",function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=n.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){this.number=a}});h.prototype=new d;f(h.prototype,
{createKeyBindings:function(){var a=d.prototype.createKeyBindings.call(this);a.push({actionID:"vi-"+this.key+"ESC",keyBinding:l(27),predefined:!0});a.push({actionID:"vi-"+this.key+"-"+this.key,keyBinding:l(this.key,!1,!1,!1,!1,"keypress")});return a},_invoke:function(a,b){b=b||{};var e=this.getView(),f=e.getCaretOffset(),g=f,h=e.getModel(),l=this;b.editDone=function(){var a=e.getCaretOffset();if(g>a){var d=g;g=a;a=d}b.editLine&&(g=h.getLineStart(h.getLineAtOffset(g)),a=h.getLineEnd(h.getLineAtOffset(a),
"c"===l.key?!1:!0));"y"===l.key?(u=e.getText(g,a),v=b.editLine,e.setCaretOffset(f)):e.setText("",g,a);e.removeKeyMode(l);e.addKeyMode(l.nextMode)};d.prototype._invoke.call(this,a,b);b.editDone();return!0},_getCount:function(){var a=1;""!==this.firstNumber&&(a=this.firstNumber>>0);var b=1;""!==this.number&&(b=this.number>>0);this.number=this.firstNumber="";return a*b},_createActions:function(a){d.prototype._createActions.call(this,a);var b=this;a.setAction("vi-"+b.key+"ESC",function(){a.removeKeyMode(b);
a.addKeyMode(b.viMode);return!0});a.setAction("vi-"+b.key+"-"+b.key,function(){return b._invoke("lineEnd",{editLine:!0})},this._msg("viycd"))},storeNumber:function(a){this.firstNumber=a},_modeAdded:function(){this.secondNumber=""},_modeRemoved:function(){this.number=this.firstNumber=this.command=""}});b.prototype=new n.KeyMode;f(b.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-insert-ESC",keyBinding:l(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-insert-ESC",
function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=n.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){}});g.prototype=new d;f(g.prototype,{createKeyBindings:function(){var a=d.prototype.createKeyBindings.call(this);a.push({actionID:"vi-ctrl-f",keyBinding:l("f",!0)});a.push({actionID:"vi-ctrl-b",keyBinding:l("b",!0)});a.push({actionID:"vi-ctrl-e",keyBinding:l("e",!0)});a.push({actionID:"vi-ctrl-y",
keyBinding:l("y",!0)});a.push({actionID:"statusLineMode",keyBinding:l(":",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi-a",keyBinding:l("a",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-A",keyBinding:l("A",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-i",keyBinding:l("i",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-I",keyBinding:l("I",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-o",keyBinding:l("o",!1,!1,!1,!1,"keypress"),predefined:!0});
a.push({actionID:"vi-O",keyBinding:l("O",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-R",keyBinding:l("R",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-s",keyBinding:l("s",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-S",keyBinding:l("S",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-p",keyBinding:l("p",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-P",keyBinding:l("P",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-u",
keyBinding:l("u",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-c",keyBinding:l("c",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-d",keyBinding:l("d",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-y",keyBinding:l("y",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-~",keyBinding:l("~",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-x",keyBinding:l("x",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-X",keyBinding:l("X",
!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-C",keyBinding:l("C",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-D",keyBinding:l("D",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-*",keyBinding:l("*",!1,!1,!1,!1,"keypress"),predefined:!0});return a},getKeyBindings:function(a){var b=n.KeyMode.prototype.getKeyBindings.call(this,a),b=b||[],d=this.changeMode.getKeyBindings(a),f;if(!this.changeMode.isActive())for(f=0;f<d.length;f++)d[f]=e([l("c",!1,!1,!1,!1,"keypress"),
d[f]]);b=b.concat(d);d=this.deleteMode.getKeyBindings(a);if(!this.deleteMode.isActive())for(f=0;f<d.length;f++)d[f]=e([l("d",!1,!1,!1,!1,"keypress"),d[f]]);b=b.concat(d);d=this.yankMode.getKeyBindings(a);if(!this.yankMode.isActive())for(f=0;f<d.length;f++)d[f]=e([l("y",!1,!1,!1,!1,"keypress"),d[f]]);return b=b.concat(d)},match:function(a){var b=n.KeyMode.prototype.match.call(this,a);!b&&"keypress"===a.type&&(b="noop");return b},_createActions:function(a){d.prototype._createActions.call(this,a);var b=
this;a.setAction("vi-ctrl-f",function(){return b._invoke("pageDown")},{name:m.pageDown});a.setAction("vi-ctrl-b",function(){return b._invoke("pageUp")},{name:m.pageUp});a.setAction("vi-ctrl-e",function(){return b._invoke("scrollLineDown")},{name:m.scrollLineDown});a.setAction("vi-ctrl-y",function(){return b._invoke("scrollLineUp")},{name:m.scrollLineUp});a.setAction("vi-a",function(){return b._toInsertMode("charNext")},{name:m.via});a.setAction("vi-A",function(){return b._toInsertMode("lineEnd")},
{name:m.viA});a.setAction("vi-i",function(){return b._toInsertMode("noop")},{name:m.vii});a.setAction("vi-I",function(){return b._toInsertMode("lineStart")},{name:m.viI});a.setAction("vi-O",function(){b._invoke("lineUp");b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:m.viO});a.setAction("vi-o",function(){b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:m.vio});a.setAction("vi-R",function(){return b._toInsertMode("toggleOverwriteMode")},{name:m.viR});a.setAction("vi-s",
function(){return b._toInsertMode("deleteNext",{unit:"char"})},{name:m.vis});a.setAction("vi-S",function(){return b._toInsertMode("deleteLines",{unit:"line"})},{name:m.viS});a.setAction("vi-p",function(){return b._invoke(function(){var a=b.getView(),d=a.getSelection();if(d.start===d.end){var e=a.getModel(),f=a.getCaretOffset();v?d.start=d.end=e.getLineEnd(e.getLineAtOffset(f),!0):(d.start++,d.end++)}a.setText(u,d.start,d.end)})},{name:m.vip});a.setAction("vi-P",function(){return b._invoke(function(){var a=
b.getView(),d=a.getSelection();if(d.start===d.end){var e=a.getModel(),f=a.getCaretOffset();v&&(d.start=d.end=e.getLineStart(e.getLineAtOffset(f)))}a.setText(u,d.start,d.end)})},{name:m.viP});a.setAction("vi-u",function(){return b._invoke("undo")},{name:m.Undo});a.setAction("vi-c",function(){a.removeKeyMode(b);a.addKeyMode(b.changeMode);b.changeMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-d",function(){a.removeKeyMode(b);a.addKeyMode(b.deleteMode);b.deleteMode.storeNumber(b.number);
b.number="";return!0});a.setAction("vi-y",function(){a.removeKeyMode(b);a.addKeyMode(b.yankMode);b.yankMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-~",function(){return b._invoke("reversecase")},{name:m.reversecase});a.setAction("vi-x",function(){return b._invoke("deleteNext")},{name:m.deleteNext});a.setAction("vi-X",function(){return b._invoke("deletePrevious")},{name:m.deletePrevious});a.setAction("vi-C",function(){return b._toInsertMode("deleteLineEnd")},{name:m.viC});a.setAction("vi-D",
function(){return b._invoke("deleteLineEnd")},{name:m.deleteLineEnd});a.setAction("vi-*",function(){var a=b.getView(),d=a.getCaretOffset(),d=a.getNextOffset(d+1,{count:-1,unit:"word"}),e=a.getNextOffset(d,{count:1,unit:"wordend"}),a=a.getText(d,e);b._searchFwd=!0;return b._invoke("find",{hideAfterFind:!0,incremental:!1,reverse:!1,findString:a})},{name:m.viStar})},_reportStatus:function(a){this.statusReporter&&this.statusReporter(a)},_toInsertMode:function(a,b){b=b||{};var d=1;""!==this.number&&(d=
this.number>>0);b.count=d;d=this.getView();this.insertMode.storeNumber(this.number);d.invokeAction(a,!1,b);d.removeKeyMode(this);d.addKeyMode(this.insertMode);this.number="";return!0},_modeAdded:function(){this.getView().setOptions({blockCursorVisible:!0})},_modeRemoved:function(){var a=this.getView();a.setOptions({blockCursorVisible:!1});a.removeKeyMode(this.insertMode);a.removeKeyMode(this.changeMode);a.removeKeyMode(this.deleteMode)}});return{VIMode:g}});
define("orion/editorPreferences",[],function(){function m(k,f){this._preferences=k;if(this._callback=f)var l=k.listenForChangedSettings(n,function(e){e.key===l&&f()}.bind(this))}var n="/editor/settings",p={autoSave:!1,autoSaveVisible:!0,autoSaveLocalVisible:!0,autoSaveTimeout:250,autoSaveTimeoutVisible:!0,themeVisible:!0,themeLocalVisible:!0,fontSizeVisible:!0,fontSizeLocalVisible:!0,autoLoad:!0,autoLoadVisible:!0,saveDiffs:!0,saveDiffsVisible:!0,contentAssistAutoTrigger:!0,contentAssistAutoTriggerVisible:!0,
showOccurrences:!1,showOccurrencesVisible:!0,autoPairParentheses:!0,autoPairParenthesesVisible:!0,autoPairBraces:!0,autoPairBracesVisible:!0,autoPairSquareBrackets:!0,autoPairSquareBracketsVisible:!0,autoPairAngleBrackets:!1,autoPairAngleBracketsVisible:!0,autoPairQuotations:!0,autoPairQuotationsVisible:!0,autoCompleteComments:!0,autoCompleteCommentsVisible:!0,smartIndentation:!0,smartIndentationVisible:!0,trimTrailingWhiteSpace:!1,trimTrailingWhiteSpaceVisible:!0,tabSize:4,tabSizeVisible:!0,expandTab:!1,
expandTabVisible:!0,scrollAnimation:!0,scrollAnimationVisible:!0,scrollAnimationTimeout:300,scrollAnimationTimeoutVisible:!0,annotationRuler:!0,annotationRulerVisible:!0,lineNumberRuler:!0,lineNumberRulerVisible:!0,foldingRuler:!0,foldingRulerVisible:!0,overviewRuler:!0,overviewRulerVisible:!0,showTabs:!1,showTabsVisible:!0,showSpaces:!1,showSpacesVisible:!0,wordWrap:!1,wordWrapVisible:!0,showMargin:!1,showMarginVisible:!0,marginOffset:80,marginOffsetVisible:!0,keyBindings:"Default",keyBindingsVisible:!0,
keyBindingsLocalVisible:!0,splitOrientation:"horizontal",splitOrientationVisible:!0,splitOrientationLocalVisible:!0};m.prototype={_initialize:function(k){k=k.get("editorSettings")||{};for(var f in p)k.hasOwnProperty(f)||(k[f]=p[f]);return k},getPrefs:function(k){this._preferences.getPreferences(n).then(function(f){f=this._initialize(f);"string"===typeof f&&(f=JSON.parse(f));k(f)}.bind(this))},setPrefs:function(k,f){this._preferences.getPreferences(n).then(function(l){l.put("editorSettings",k);k=this._initialize(l);
f&&f(k);this._callback&&this._callback(k)}.bind(this))}};return{EditorPreferences:m}});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/ThemeVersion"],function(m,n,p){function k(){}function f(){this.styles=[];var a=new k;a.name="Eclipse";a.annotationRuler="white";a.background="white";a.comment="green";a.keyword="#7f0055";a.text="darkSlateGray";a.string="blue";a.overviewRuler="white";a.lineNumberOdd="#444";a.lineNumberEven="#444";a.lineNumber="#444";a.currentLine="#EAF2FE";a.constant="blue";a.tag="darkorange";
a.attribute="cadetBlue";a.fontFamily=e;a.fontSize=d;a.rightRuler="#DDDDDD";a.leftRuler="#DDDDDD";this.styles.push(a);a=new k;a.name="Prospecto";a.annotationRuler="white";a.background="white";a.comment="#3C802C";a.keyword="#CC4C07";a.text="#333";a.string="#446FBD";a.overviewRuler="white";a.lineNumberOdd="#CCCCCC";a.lineNumberEven="#CCCCCC";a.lineNumber="#CCCCCC";a.currentLine="#EAF2FE";a.tag="#CC4C07";a.attribute="cadetBlue";a.fontFamily=e;a.fontSize=d;a.rightRuler="#EEEEEE";a.leftRuler="#EEEEEE";
a.constant="darkOrchid";this.styles.push(a);a=new k;a.name="Blue";a.annotationRuler="lavender";a.background="aliceBlue";a.comment="indigo";a.keyword="cornFlowerBlue";a.text="navy";a.string="cornFlowerBlue";a.overviewRuler="lavender";a.lineNumberOdd="darkSlateGray";a.lineNumberEven="darkSlateGray";a.lineNumber="darkSlateGray";a.currentLine="white";a.tag="cornFlowerBlue";a.attribute="cadetBlue";a.rightRuler="white";a.leftRuler="white";a.fontFamily=e;a.fontSize=d;a.constant="blue";this.styles.push(a);
a=new k;a.name="Ambience";a.annotationRuler="#3D3D3D";a.background="darkgrey";a.comment="mediumslateblue";a.keyword="cornFlowerBlue";a.text="darkseagreen";a.string="lightcoral";a.overviewRuler="white";a.lineNumberOdd="black";a.lineNumberEven="black";a.lineNumber="black";a.currentLine="lightcyan";a.tag="cornFlowerBlue";a.attribute="cadetBlue";a.rightRuler="#baa289";a.leftRuler="#baa289";a.fontFamily=e;a.fontSize=d;a.constant="blue";this.styles.push(a);a=new k;a.name="Tierra";a.annotationRuler="moccasin";
a.background="lemonchiffon";a.comment="darkseagreen";a.keyword="darkred";a.text="#555555";a.string="orangered";a.overviewRuler="moccasin";a.lineNumberOdd="chocolate";a.lineNumberEven="chocolate";a.lineNumber="chocolate";a.currentLine="#baa289";a.tag="darkred";a.attribute="cadetBlue";a.rightRuler="#baa289";a.leftRuler="#baa289";a.fontFamily=e;a.fontSize=d;a.constant="blue";this.styles.push(a);a=new k;a.name="Nimbus";a.annotationRuler="#232323";a.background="#333333";a.comment="darkseagreen";a.keyword=
"darkorange";a.text="#DDDDDD";a.string="cornflowerblue";a.overviewRuler="#232323";a.lineNumberOdd="#555555";a.lineNumberEven="#555555";a.lineNumber="#555555";a.currentLine="dimgrey";a.tag="darkorange";a.attribute="cadetBlue";a.rightRuler="#3a3a3a";a.leftRuler="#3a3a3a";a.fontFamily=e;a.fontSize=d;a.constant="#01B199";this.styles.push(a);a=new k;a.name="Adelante";a.annotationRuler="#E2D2B2";a.background="#F1E7C8";a.comment="#5D774E";a.keyword="#AF473B";a.text="dimgray";a.string="#DE5D3B";a.overviewRuler=
"#E2D2B2";a.lineNumberOdd="#AF473B";a.lineNumberEven="#AF473B";a.lineNumber="#AF473B";a.currentLine="#9e937b";a.tag="#AF473B";a.attribute="cadetBlue";a.rightRuler="#9e937b";a.leftRuler="#9e937b";a.fontFamily=e;a.fontSize=d;a.constant="blue";this.styles.push(a);a=new k;a.name="Raspberry Pi";a.annotationRuler="seashell";a.background="seashell";a.comment="#66B32F";a.keyword="#E73E36";a.text="dimgray";a.string="darkorange";a.overviewRuler="seashell";a.lineNumberOdd="#f6b8b6";a.lineNumberEven="#f6b8b6";
a.lineNumber="#E73E36";a.currentLine="#F5B1AE";a.tag="#E73E36";a.attribute="cadetBlue";a.rightRuler="#fbdfde";a.leftRuler="#fbdfde";a.fontFamily=e;a.fontSize=d;a.constant="blue";this.styles.push(a)}function l(){return this.styles}var e='"Consolas", "Monaco", "Vera Mono", monospace',d="10pt";f.prototype.styles=[];f.prototype.getStyles=l;f.prototype.fontSettable=!0;f.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected",
version:p}};f.prototype.parseToXML=function(a){try{var d=null;if(window.DOMParser){var d=(new DOMParser).parseFromString(a,"text/xml"),b=d.getElementsByTagName("parsererror");return!b||!b.length||!b[0].childNodes.length?d:null}d=new ActiveXObject("Microsoft.XMLDOM");d.async=!1;d.loadXML(a);return d}catch(e){}};f.prototype.selectFontSize=function(a){console.log("fontsize: "+a)};f.prototype.importTheme=function(a){console.log("import theme");console.log(a);var d=a.parameters.valueFor("name"),d=this.parseToXML(d),
b=new k;b.name=d.getElementsByTagName("colorTheme")[0].attributes[1].value;b.annotationRuler=d.getElementsByTagName("background")[0].attributes[0].value;b.background=d.getElementsByTagName("background")[0].attributes[0].value;b.comment=d.getElementsByTagName("singleLineComment")[0].attributes[0].value;b.keyword=d.getElementsByTagName("keyword")[0].attributes[0].value;b.text=d.getElementsByTagName("foreground")[0].attributes[0].value;b.string=d.getElementsByTagName("string")[0].attributes[0].value;
b.overviewRuler=d.getElementsByTagName("background")[0].attributes[0].value;b.lineNumberOdd=d.getElementsByTagName("lineNumber")[0].attributes[0].value;b.lineNumberEven=d.getElementsByTagName("lineNumber")[0].attributes[0].value;b.lineNumber=d.getElementsByTagName("lineNumber")[0].attributes[0].value;b.currentLine=d.getElementsByTagName("selectionBackground")[0].attributes[0].value;a.items.addTheme(b)};f.prototype.processSettings=function(a,d){var b=n.TextTheme.getTheme();b.setThemeClass("editorTheme",
b.buildStyleSheet("editorTheme",a))};f.prototype.getViewData=function(){var a={top:10,left:10,width:400,height:350},d=a.left,b=a.top;a.shapes=[{type:"TEXT",name:m["Line Numbers"],label:"1",x:d+20,y:b+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:m.Background,x:d+46,y:b,width:290,height:a.height,family:"background",fill:"white"},{type:"TEXT",name:m.Strings,label:"'text/javascript'",x:d+134,y:b+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",
name:m.Foreground,label:"\x3d",x:d+124,y:b+20,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"RECTANGLE",name:m["Current Line"],x:d+46,y:b+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:m["HTML Attribute"],label:"type",x:d+98,y:b+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:m["Overview Ruler"],x:d+336,y:b,width:14,height:a.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:m.Comments,label:"/* comment */",
x:d+75,y:b+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},{type:"TEXT",name:m["HTML Tag"],label:"\x3cscript",x:d+55,y:b+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m["HTML Tag"],label:"\x3e",x:d+213,y:b+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m.Strings,label:"'Result'",x:d+164,y:b+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:m.Foreground,label:"multiply(a,b){",x:d+120,y:b+
60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m.Keywords,label:"function",x:d+75,y:b+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m.Keywords,label:"var",x:d+95,y:b+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m.Foreground,label:"output \x3d ",x:d+115,y:b+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m.Foreground,label:";",x:d+205,y:b+80,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"TEXT",name:m.Keywords,label:"var",x:d+95,y:b+100,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m.Foreground,label:"result \x3d a*b;",x:d+115,y:b+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m.Keywords,label:"return",x:d+95,y:b+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m.Foreground,label:"output + result;",x:d+135,y:b+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:m.Foreground,label:"}",x:d+75,y:b+140,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m["HTML Tag"],label:"\x3c/script\x3e",x:d+55,y:b+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m["HTML Tag"],label:"\x3cstyle",x:d+55,y:b+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m["HTML Attribute"],label:"type",x:d+95,y:b+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",
name:m.Foreground,label:"\x3d",x:d+121,y:b+200,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m.Strings,label:"'text/css'",x:d+131,y:b+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:m["HTML Tag"],label:"\x3e",x:d+180,y:b+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m["CSS Class Name"],label:".some-class",x:d+75,y:b+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:m["CSS Class Name"],
label:"{",x:d+145,y:b+220,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m["CSS Attribute"],label:"color:",x:d+95,y:b+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m["CSS Value"],label:"#123456",x:d+130,y:b+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:m["CSS Text"],label:";",x:d+180,y:b+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m["CSS Class Name"],label:"}",x:d+
75,y:b+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:m["HTML Tag"],label:"\x3c/style\x3e",x:d+55,y:b+280,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:m["Annotation Ruler"],x:d,y:b,width:46,height:a.height,family:"annotationRuler",fill:"white"}];for(var e=0;16>e;e++)a.shapes.push({type:"TEXT",name:m["Line Numbers"],label:e+1,x:d+20,y:b+20*e+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return a};return{ThemeData:f,
getStyles:l}});
define("orion/widgets/input/TextField",["orion/objects","orion/webui/littlelib"],function(m,n){function p(k,f){m.mixin(this,k);this.node=f||document.createElement("div");this.node.innerHTML=this.templateString;this.textfield=n.$(".setting-control",this.node)}m.mixin(p.prototype,{templateString:'\x3cinput type\x3d"text" class\x3d"setting-control" name\x3d"myname"/\x3e',category:null,item:null,element:null,ui:null,show:function(){this.textfield.addEventListener("change",this.change.bind(this));this.postCreate()},
destroy:function(){this.node&&(n.empty(this.node),this.textfield=this.node=null)},setStorageItem:function(){},width:function(k){this.textfield.style.width=k},getValue:function(){return"integer"===this.inputType?parseInt(this.textfield.value,10):this.textfield.value},setValue:function(k){this.textfield.value=k},getSelection:function(){return this.getValue()},setSelection:function(k){this.setValue(k)},postCreate:function(){this.inputType&&"password"===this.inputType&&(this.textfield.type="password");
this.editmode&&"readonly"===this.editmode&&this.textfield.setAttribute("readonly","true")},change:function(){var k;this.selection&&this.selection.value&&(k=this.selection.value);this.setStorageItem(this.category,this.item,this.element,k,this.ui)}});return p});
define("orion/widgets/input/LabeledTextfield",["orion/objects","orion/webui/littlelib","orion/widgets/input/TextField"],function(m,n,p){function k(f,l){p.apply(this,arguments);this.mylabel=n.$(".setting-label",this.node)}m.mixin(k.prototype,p.prototype,{templateString:'\x3cdiv class\x3d"setting-property"\x3e\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cinput class\x3d"setting-control" type\x3d"text" /\x3e\x3c/label\x3e\x3c/div\x3e',destroy:function(){p.prototype.destroy.call(this);
this.mylabel&&(this.mylabel=null)},postCreate:function(){p.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"}});return k});
define("orion/widgets/input/Checkbox",["orion/objects","orion/webui/littlelib"],function(m,n){function p(k,f){m.mixin(this,k);this.node=f||document.createElement("div");this.node.innerHTML=this.templateString;this.checkbox=n.$(".setting-control",this.node)}m.mixin(p.prototype,{templateString:'\x3clabel\x3e\x3cinput class\x3d"setting-control settingsCheckbox" type\x3d"checkbox"/\x3e\x3c/label\x3e',show:function(){this.checkbox.addEventListener("change",this.change.bind(this));this.postCreate()},destroy:function(){this.node&&
(n.empty(this.node),this.checkbox=this.node=null)},setStorageItem:function(){},isChecked:function(){return this.checkbox.checked},setChecked:function(k){this.checkbox.checked=k},getSelection:function(){return this.isChecked()},setSelection:function(k){this.setChecked(k)},change:function(){this.setStorageItem(this.checkbox.value)},postCreate:function(){this.checkbox.style.width="20px";this.editmode&&"readonly"===this.editmode&&this.checkbox.setAttribute("disabled","disabled")}});return p});
define("orion/widgets/input/LabeledCheckbox",["orion/objects","orion/webui/littlelib","orion/widgets/input/Checkbox"],function(m,n,p){function k(f,l){p.apply(this,arguments);this.mylabel=n.$(".setting-label",this.node)}m.mixin(k.prototype,p.prototype,{templateString:'\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cinput class\x3d"setting-control settingsCheckbox" type\x3d"checkbox"/\x3e\x3c/label\x3e',postCreate:function(){p.prototype.postCreate.call(this);this.mylabel.textContent=
this.fieldlabel+":"},destroy:function(){p.prototype.destroy.call(this);this.mylabel&&(this.mylabel=null)}});return k});
define("orion/widgets/input/Select",["orion/objects","orion/webui/littlelib"],function(m,n){function p(k,f){m.mixin(this,k);this.node=f||document.createElement("div");this.node.innerHTML=this.templateString;this.select=n.$(".setting-control",this.node)}m.mixin(p.prototype,{templateString:'\x3cselect class\x3d"setting-control" id\x3d"selection"\x3e\x3c/select\x3e',addOptions:function(k,f,l){f=document.createElement("option");f.value=k.value;f.appendChild(document.createTextNode("string"===typeof k.label?
k.label:k.value));k.selected&&(f.selected="selected");this.select.appendChild(f)},show:function(){this.postCreate()},postCreate:function(){this.options.forEach(this.addOptions.bind(this));this.select.addEventListener("change",this.change.bind(this))},destroy:function(){this.node&&(n.empty(this.node),this.node=this.select=null)},setStorageItem:function(){},getSelected:function(){return this.select.value},getSelectedIndex:function(){return this.select.selectedIndex},setSelectedIndex:function(k){this.select.selectedIndex=
k},getSelection:function(){return this.getSelected()},setSelection:function(k){for(var f=0;f<this.options.length;f++)if(this.options[f].value===k){this.setSelectedIndex(f);return}this.setSelectedIndex(0)},change:function(){var k=this.select.value;this.category?this.setStorageItem(this.category,this.item,this.element,k,this.ui):this.setStorageItem(k)}});return p});
define("orion/widgets/input/LabeledSelect",["orion/objects","orion/webui/littlelib","orion/widgets/input/Select"],function(m,n,p){function k(f,l){p.apply(this,arguments);this.mylabel=n.$(".setting-label",this.node)}m.mixin(k.prototype,p.prototype,{templateString:'\x3cdiv class\x3d"setting-property"\x3e\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cselect class\x3d"setting-control"\x3e\x3c/select\x3e\x3c/label\x3e\x3c/div\x3e',postCreate:function(){p.prototype.postCreate.call(this);
this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){p.prototype.destroy.call(this);this.mylabel&&(this.mylabel=null)}});return k});
define("orion/widgets/settings/Subsection",[],function(){function m(m){var p=m.sectionName;this.parentNode=m.parentNode;this.children=m.children;m=document.createElement("section");m.classList.add("setting-row");m.setAttribute("role","region");m.setAttribute("aria-labelledby","Navigation-header");var k=document.createElement("h3");k.classList.add("setting-header");k.textContent=p;p=document.createElement("div");p.classList.add("setting-content");m.appendChild(k);m.appendChild(p);this.node=m;this.subsectionContent=
p}m.prototype.show=function(){this.parentNode&&this.parentNode.appendChild(this.node);if(this.children){var m=this;this.children.forEach(function(p){m.subsectionContent.appendChild(p.node);p.show()})}};return m});
define("orion/widgets/settings/EditorSettings","i18n!orion/settings/nls/messages orion/widgets/input/LabeledTextfield orion/widgets/input/LabeledCheckbox orion/widgets/input/LabeledSelect orion/section orion/widgets/settings/Subsection orion/commands orion/objects orion/webui/littlelib".split(" "),function(m,n,p,k,f,l,e,d,a){function h(b,d,e,f,g){if(!f.local){var h=document.createElement("span");h.classList.add(r);h.classList.add(g[d+"LocalVisible"]?z:t);h.title=m.localSettingsTooltip;h.addEventListener("click",
function(a){h.classList.contains(t)?(h.classList.add(z),h.classList.remove(t)):(h.classList.add(t),h.classList.remove(z))});d=a.$("label",b.node);d.parentNode.insertBefore(h,d)}return b}function b(a,b,d){return h(new p(b),a,this,b,d)}function g(a,b,d){b.inputType="integer";return h(new n(b),a,this,b,d)}function u(a,b,d){var e=this.values;b.options=[];for(var f=0;f<e.length;f++){var g=e[f],l={value:g.value,label:g.label};g.value===d[a]&&(l.selected=!0);b.options.push(l)}return h(new k(b),a,this,b,
d)}function v(a,b){return!(this.min<=b[a]&&b[a]<=this.max)?m[a+"Invalid"]:""}function q(a,b){d.mixin(this,a);this.node=b}var r="setting-local-indicator",z="on",t="off",w={editorSettings:{keys:{keyBindings:{values:[{value:"",label:m.Default},{value:"Emacs",label:"Emacs"},{value:"vi",label:"vi"}],create:u}},splitEditors:{splitOrientation:{values:[{value:"vertical",label:m.vertical},{value:"horizontal",label:m.horizontal}],create:u}},fileManagement:{autoSave:{create:b},autoSaveTimeout:{min:50,max:1E4,
create:g,validate:v},autoLoad:{create:b},saveDiffs:{create:b},trimTrailingWhiteSpace:{create:b}},typing:{autoPairQuotations:{create:b},autoPairParentheses:{create:b},autoPairBraces:{create:b},autoPairSquareBrackets:{create:b},autoPairAngleBrackets:{create:b},autoCompleteComments:{create:b},smartIndentation:{create:b}},tabs:{tabSize:{min:1,max:16,create:g,validate:v},expandTab:{create:b}},whitespaces:{showTabs:{create:b},showSpaces:{create:b}},wrapping:{wordWrap:{create:b},showMargin:{create:b},marginOffset:{min:10,
max:200,create:g,validate:v}},smoothScrolling:{scrollAnimation:{create:b},scrollAnimationTimeout:{min:50,max:1E3,create:g,validate:v}},rulers:{annotationRuler:{create:b},lineNumberRuler:{create:b},foldingRuler:{create:b},overviewRuler:{create:b}},languageTools:{showOccurrences:{create:b},contentAssistAutoTrigger:{create:b}}}};d.mixin(q.prototype,{templateString:'\x3cdiv class\x3d"sections"\x3e\x3c/div\x3e',commandTemplate:'\x3cdiv id\x3d"commandButtons"\x3e\x3cdiv id\x3d"editorCommands" class\x3d"layoutRight sectionActions"\x3e\x3c/div\x3e\x3c/div\x3e',
createElements:function(){this.node.innerHTML=this.templateString;this.sections=a.$(".sections",this.node);this.createSections();this.local?this.sections.classList.add("local"):(document.getElementById("pageActions").innerHTML=this.commandTemplate,this.createToolbar())},createSections:function(){var b=this.oldPrefs,d=[],e,g,h=this.themePreferences;if(!this.local&&this.editorThemeWidget)this.editorThemeSection=new f.Section(this.sections,{id:"editorThemeSettings",title:m.EditorThemes,canHide:!0,slideout:!0}),
this.editorThemeWidget.renderData(this.editorThemeSection.getContentElement(),"INITIALIZE");else{var p=this.oldThemeStyles;if(b.themeVisible&&(!this.local||b.themeLocalVisible)){var n=p.styles;e=[];for(var q=0;q<n.length;q++)g={value:n[q].name,label:n[q].name},n[q].name===p.style.name&&(g.selected=!0),e.push(g);d.push(e=this.themeSelect=new k({fieldlabel:m.Theme,options:e}));e.setStorageItem=function(a){h.setTheme(a)}}if(b.fontSizeVisible&&(!this.local||b.fontSizeLocalVisible)){p=p.style.fontSize;
e=[];for(n=8;19>n;n++)g={value:n+"pt",label:n+"pt"},g.label===p&&(g.selected=!0),e.push(g);d.push(e=this.sizeSelect=new k({fieldlabel:m["Font Size"],options:e}));e.setStorageItem=function(a){h.setFontSize(a)}}!this.local&&0<d.length&&(d=new l({sectionName:m.Theme,parentNode:this.editorThemeSection.getContentElement(),children:d}),d.show(),d=[])}var u,v;for(v in w)if(w.hasOwnProperty(v)){this.local||(u=new f.Section(this.sections,{id:v,title:m[v],canHide:!0,slideout:!0}),e=document.createElement("div"),
e.classList.add("setting-info"),e.textContent=m.editorSettingsInfo,g=document.createElement("span"),g.classList.add(r),g.classList.add(z),p=document.createElement("span"),p.classList.add(r),p.classList.add(t),n=document.createElement("span"),n.classList.add("core-sprite-wrench"),n.classList.add("icon-inline"),n.classList.add("imageSprite"),a.processDOMNodes(e,[g,p,n]),u.getContentElement().appendChild(e));for(var G in w[v])if(w[v].hasOwnProperty(G)){for(var I in w[v][G])if(b[I+"Visible"]&&(!this.local||
b[I+"LocalVisible"]))g=w[v][G][I],e={},e.local=this.local,e.fieldlabel=m[I],d.push(g.widget=g.create(I,e,b));!this.local&&0<d.length&&(d=new l({sectionName:m[G],parentNode:u.getContentElement(),children:d}),d.show(),d=[])}}this.local&&d.forEach(function(a){this.sections.appendChild(a.node);a.hasOwnProperty("setStorageItem")||(a.setStorageItem=this.update.bind(this));a.show()}.bind(this))},createToolbar:function(){var b=a.node("editorSettingsToolActionsArea"),d=new e.Command({name:m.Restore,tooltip:m["Restore default Editor Settings"],
id:"orion.restoreeditorsettings",callback:function(a){this.restore(a.items)}.bind(this)});this.commandService.addCommand(d);this.commandService.registerCommandContribution("restoreEditorSettingCommand","orion.restoreeditorsettings",2);this.commandService.renderCommands("restoreEditorSettingCommand",b,this,this,"button");d=new e.Command({name:m.Update,tooltip:m["Update Editor Settings"],id:"orion.updateeditorsettings",callback:function(a){this.update(a.items)}.bind(this)});this.commandService.addCommand(d);
this.commandService.registerCommandContribution("editorSettingCommand","orion.updateeditorsettings",1);this.commandService.renderCommands("editorSettingCommand",b,this,this,"button")},valueChanged:function(){var a={},b;for(b in this.oldPrefs)this.oldPrefs.hasOwnProperty(b)&&(a[b]=this.oldPrefs[b]);this.getValues(a);for(var d in a)if(a.hasOwnProperty(d)&&a[d]!==this.oldPrefs[d])return a},validate:function(a){var b="";this._forEach(function(d,e){return e.validate&&(b=e.validate(d,a))?!1:!0});return b},
_progress:function(a,b){this.registry&&this.registry.getService("orion.page.message").setProgressResult({Message:a,Severity:b})},update:function(){var a=this.valueChanged();if(a){var b=this.validate(a);if(b){this._progress(b,"Error");return}this.preferences.setPrefs(a,function(){this.setValues(this.oldPrefs=a);this._progress(m["Editor preferences updated"],"Normal")}.bind(this))}else this.setValues(this.oldPrefs);this.editor&&this.editor.focus()},restore:function(){this.preferences.setPrefs({},function(a){this._show(a);
this._progress(m["Editor defaults restored"],"Normal")}.bind(this))},show:function(a,b){a&&(this.node=a);this.themePreferences.getTheme(function(a){this.preferences.getPrefs(function(d){this._show(d,a);b&&b()}.bind(this))}.bind(this))},_show:function(a,b){b&&(this.oldThemeStyles=b);this.oldPrefs=a;this.createElements();this.setValues(a)},_forEach:function(a){for(var b in w)if(w.hasOwnProperty(b))for(var d in w[b])if(w[b].hasOwnProperty(d))for(var e in w[b][d])if(w[b][d].hasOwnProperty(e)){var f=w[b][d][e];
if(f.widget&&!a(e,f))return}},getValues:function(b){this._forEach(function(d,e){b[d]=e.widget.getSelection();if(!this.local){var f=a.$("."+r,e.widget.node);b[d+"LocalVisible"]=f&&f.classList.contains(z)}return!0}.bind(this))},setValues:function(b){this._forEach(function(d,e){e.widget.setSelection(b[d]);if(!this.local){var f=a.$("."+r,e.widget.node);f&&(b[d+"LocalVisible"]?(f.classList.add(z),f.classList.remove(t)):(f.classList.add(t),f.classList.remove(z)))}return!0}.bind(this))},destroy:function(){this.node&&
(this.node=null);this.editorThemeWidget&&(this.editorThemeWidget.destroy(),this.editorThemeWidget=null)}});return q});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace...":"Replace...",
"Replace All":"Replace All","Show Replace":"Show Replace","Hide Replace":"Hide Replace","Search ${0}":"Search ${0}","Type a keyword or wild card to search in ":"Type a keyword or wild card to search in ","Search failed.":"Search failed.","No matches found for ${0}":"No matches found for ${0}","Searching...":"Searching...","Resource has been changed by others.":"Resource has been changed by others.","Failed to write file.":"Failed to write file.",Results:"Results","Files ${0} of ${1} matching ${2}":"Files ${0} of ${1} matching ${2}",
"Replace ${0} with ${1} for files ${2} of ${3}":"Replace ${0} with ${1} for files ${2} of ${3}",Location:"Location","Click to compare":"Click to compare",'Search again in this folder with "${0}"':'Search again in this folder with "${0}"',"Files replaced":"Files replaced",Status:"Status","${0} out of ${1}  matches replaced.":"${0} out of ${1}  matches replaced.","Replace all matches with...":"Replace all matches with...","Apply Changes":"Apply Changes","Replace all selected matches":"Replace all selected matches",
"Hide Compare":"Hide Compare","Hide compare view of changes":"Hide compare view of changes","Show Compare":"Show Compare","Show compare view of changes":"Show compare view of changes","Show All":"Show All","Show all the results in one page":"Show all the results in one page","\x3c Previous Page":"\x3c Previous Page","Show previous page of search result":"Show previous page of search result","Next Page \x3e":"Next Page \x3e","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","Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.",
Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","File name":"File name","Path name":"Path name",Save:"Save","Type filter text":"Type filter text","Scope Search":"Scoped Search","Open in Search page for this directory":"Open the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.",
"Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",
"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",Scope:"Scope","Show previous search terms":"Show previous search terms","Show previous replace terms":"Show previous replace terms","Show replacement preview":"Show replacement preview",
"File name patterns (comma-separated)":"File name patterns (comma-separated)","(* \x3d any string, ? \x3d any character)":"(* \x3d any string, ? \x3d any character)","Choose a Folder":"Choose a Folder"});define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(m){function n(p,k,f){m.attach(this);this._binderFunc=k;this.setInputField(p);(p=f?f.group:null)||(p=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=p+"__completion__";this._proposeFromStart=f?f.proposeFromStart:!1;this._extendedProvider=f?f.extendedProvider:null;this._serviceRegistry=f?f.serviceRegistry:null;this._onDelete=f?f.onDelete:null;this._deleteToolTips=
f?f.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];f=function(f){this._binderFunc&&this._binderFunc(function(e){this._bind(e);f.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",f);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:f});f=function(f){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",f);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:f});f=function(f){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",f);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:f})}n.prototype._removeListeners=function(m){m&&m.forEach(function(k){k.evtTarget.removeEventListener(k.type,k.handler,!1)})};n.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};n.prototype.hasValueOf=function(m){return this._dataList.some(function(k){return k.value===m})};n.prototype.setInputField=function(m){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=m;"string"===typeof this._inputField&&(this._inputField=document.getElementById(this._inputField));m=function(k){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):document.activeElement!==this._inputField&&this._dismiss()}.bind(this);this._inputField.addEventListener("blur",m);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:m});m=function(k){this.onKeyDown(k)}.bind(this);this._inputField.addEventListener("keydown",m);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:m});m=function(k){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",m);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:m});m=function(k){this._dismissed&&this._binderFunc&&(this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(f){this._bind(f)}.bind(this)))}.bind(this);this._inputField.addEventListener("focus",m);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:m})};n.prototype.onKeyDown=function(m){if(this._dismissed)return!0;var k=m.charCode||m.keyCode;if(13===k){if(this._proposalList&&0<this._proposalList.length&&0<=this._proposalIndex&&
this._proposalIndex<this._proposalList.length)return m.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,m.ctrlKey),m.stopPropagation(),!1}else{if((40===k||38===k)&&this._proposalList&&0<this._proposalList.length)return m.preventDefault(),this._walk(40===k),m.stopPropagation(),!1;if(27===k)return m.preventDefault(),this._dismiss(),!1;if(46===k&&-1<this._proposalIndex&&this._onDelete)return m.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),m.stopPropagation(),!1}return!0};n.prototype._resetIndexAfterDeletion=function(){1>=this._proposalList.length?this._proposalIndex=-1:this._proposalIndex===this._proposalList.length-1&&(this._proposalIndex=this._proposalList.length-2)};n.prototype._bind=function(m){this._dataList=m};n.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};n.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
n.prototype._initUI=function(){this._completionUIContainer=document.getElementById(this._getUIContainerID());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());this._completionUL||(this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL");this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};n.prototype._createProposalLink=function(m,k,f,l){var e=
document.createElement("a");e.href=require.toUrl(k);e.appendChild(this._createBoldText(m,f,l));return e};n.prototype._createBoldText=function(m,k,f,l){if(0>k)return document.createTextNode(m);l=l?l:document.createElement("span");var e;0!==k&&(e=document.createTextNode(m.substring(0,k)),l.appendChild(e));var d=document.createElement("b");l.appendChild(d);e=document.createTextNode(m.substring(k,k+f));d.appendChild(e);k+f<m.length&&(e=document.createTextNode(m.substring(k+f)),l.appendChild(e));return l};
n.prototype._proposeOnCategory=function(m,k){if(0!==k.length){var f;if(m){f=document.createElement("li");f.className="inputCompletionLICategory";var l=document.createTextNode(m);f.appendChild(l);this._completionUL.appendChild(f)}k.forEach(function(e){f=document.createElement("li");f.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);f.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);f.className="inputCompletionLINormal";f.completionItem=e.item;
var d;if("string"===typeof e.item.value){var a=document.createElement("table");a.style.width="100%";a.style.tableLayout="fixed";a.style.borderSpacing="0";var h=document.createElement("tr");h.style.width=this._inputField.offsetWidth+"px";a.appendChild(h);var b=document.createElement("td");b.classList.add("inputCompletionLILeftTD");var g=this._createBoldText(e.item.value,e.boldIndex,e.boldLength);b.appendChild(g);b.style.overflow="hidden";h.appendChild(b);this._onDelete&&(d=document.createElement("button"),
d.classList.add("inputCompletionDismissButton"),d.classList.add("layoutRight"),d.classList.add("core-sprite-close"),d.classList.add("imageSprite"),d.style.display="none",d.style.margin="0 0 0",d.title=this._deleteToolTips,d.onclick=function(a){a.stopPropagation();this._onDelete(e.item.value,this);this._resetIndexAfterDeletion()}.bind(this),b=document.createElement("td"),b.classList.add("inputCompletionLIRightTD"),b.appendChild(d),h.appendChild(b));f.appendChild(a)}else e.item.value.name&&"link"===
e.item.value.type&&f.appendChild(this._createProposalLink(e.item.value.name,e.item.value.value,e.boldIndex,e.boldLength));this._completionUL.appendChild(f);this._proposalList.push({item:e.item,domNode:f,deleteBtn:d})}.bind(this))}};n.prototype._domNode2Index=function(m){if(this._proposalList)for(var k=0;k<this._proposalList.length;k++)if(this._proposalList[k].domNode===m)return k;return-1};n.prototype._highlight=function(m,k){var f=m,l,e=!1;isNaN(f)||(e=!0,this._proposalList&&0<=m&&m<this._proposalList.length?
(f=this._proposalList[m].domNode,l=this._proposalList[m].deleteBtn):f=null);f&&(f.className=k?"inputCompletionLISelected":"inputCompletionLINormal",l&&(l.style.display=k?"":"none"),k&&e&&(f.offsetTop<this._completionUIContainer.scrollTop?f.scrollIntoView(!0):f.offsetTop+f.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&f.scrollIntoView(!1)))};n.prototype._selectProposal=function(m,k){var f=m;isNaN(f)&&(f=this._domNode2Index(m));if(f!==this._proposalIndex||
k)this._highlight(this._proposalIndex,!1),this._proposalIndex=f,this._highlight(this._proposalIndex,!0)};n.prototype._dismiss=function(m,k){this._mouseDown||(this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,"string"===typeof m?(this._inputField.value=m,this._dismissing=!0,this._inputField.focus()):m&&(m.name&&"link"===m.type)&&(k?window.open(m.value):window.location.href=m.value),this._completionUIContainer.style.display="none")};n.prototype._show=function(){if(this._proposalList&&
0<this._proposalList.length){for(var m=0,k=0,f=this._inputField;f;)m+=f.offsetLeft,k+=f.offsetTop,f=f.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=k+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=m+"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"};n.prototype._walk=function(m){m=this._proposalIndex+(m?1:-1);-1>m?m=this._proposalList.length-1:m>=this._proposalList.length&&(m=-1);this._selectProposal(m)};n.prototype._proposeOnList=function(m,k,f){var l="",e=[],d=k?k.length:0;m.forEach(function(a){if("category"===a.type)this._proposeOnCategory(l,e),l=a.label,e=[];else{var h=!0,b=-1;if(k&&f){var g;"string"===typeof a.value?g=a.value.toLowerCase():a.value.name&&(g=a.value.name.toLowerCase());b=g.indexOf(k);0>b?h=!1:this._proposeFromStart&&
(h=0===b)}h&&e.push({item:a,boldIndex:b,boldLength:d})}}.bind(this));this._proposeOnCategory(l,e)};n.prototype._proposeOn=function(m){this._completionUL.textContent="";var k=m?m.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,k,!0);this._extendedProvider&&k?this._extendedProvider(m,function(f){f&&f.forEach(function(f){this._proposeOnList(f.proposals,f.filterForMe?k:m,f.filterForMe)}.bind(this));this._show()}.bind(this),[]):this._show()};n.prototype.constructor=n;return{InputCompletion:n}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages orion/editor/find orion/commands orion/objects orion/searchUtils orion/inputCompletion/inputCompletion orion/webui/littlelib".split(" "),function(m,n,p,k,f,l,e){function d(a,d,b,e,f){n.Find.call(this,a,e,f);this._serviceRegistry=d;this._commandService=b}d.prototype=new n.Find;k.mixin(d.prototype,{getFindString:function(){var a=document.getElementById("localSearchFindWith");return!a?n.Find.prototype.getFindString.call(this):
a.value},getReplaceString:function(){var a=document.getElementById("localSearchReplaceWith");return!a?n.Find.prototype.getReplaceString(this):a.value},hide:function(){var a=this.isVisible();n.Find.prototype.hide.call(this);a&&this._commandService.closeParameterCollector()},show:function(a){n.Find.prototype.show.call(this,a);var d=a.findString;this._addRecentfind(d);a=a.replaceString;var b=document.getElementById("localSearchFindWith");b||(this._createActionTable(),b=document.getElementById("localSearchFindWith"));
d&&(b.value=d);a&&(document.getElementById("localSearchReplaceWith").value=a);window.setTimeout(function(){b.select();b.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw\x3d\x3d",this._replaceInfo.title=m["Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]):
(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAEAAACH5BAEAABIALAAAAAAHAAgAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAgsAPcpQzMJjbJ9xNAQQ6hwUqaHDws+3PeQoMN9DiUuzFRQ2ZiDyyYdHFhwYUAAOw\x3d\x3d",
this._replaceInfo.title=m["Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]);this._replaceInfo.style.display=""},_createActionTable:function(){var a=this;this._commandService.openParameterCollector("pageNavigationActions",function(d){var b=document.createElement("input");b.type="text";b.name=m["Find:"];b.className="parameterInput";b.id="localSearchFindWith";
b.placeholder=m["Find With"];b.oninput=function(b){return a._handleInput(b)};b.onkeydown=function(b){return a._handleKeyDown(b)};d.appendChild(b);a._initCompletion(b);a._createButton(m.Next,d,function(){a._addRecentfind(a.getFindString());a.find(!0)});a._createButton(m.Previous,d,function(){a._addRecentfind(a.getFindString());a.find(!1)});var e=a._editor.getTextView().getOptions("readonly");if(!e){var f=document.createElement("input");f.type="text";f.name=m["ReplaceWith:"];f.className="parameterInput";
f.id="localSearchReplaceWith";f.placeholder=m["Replace With"];f.onkeydown=function(b){return a._handleKeyDown(b)};d.appendChild(f);a._replaceInfo=a._createInfoImage(null,d,null);a._showReplaceInfo();a._createButton(m.Replace,d,function(){a.replace()});a._createButton(m["Replace All"],d,function(){a.replaceAll()})}f=document.createElement("div");d.appendChild(f);f.classList.add("findOptionsDiv");var l=p.createDropdownMenu(f,m.Options,null,"dismissButton",null,!0);l.menuButton.classList.add("parameterInlineButton");
p.createCheckedMenuItem(l.menu,m["Show all"],a._showAll,function(b){a.setOptions({showAll:b.target.checked});l.dropdown.close(!0)});p.createCheckedMenuItem(l.menu,m["Case sensitive"],!a._caseInsensitive,function(b){a.setOptions({caseInsensitive:!b.target.checked});l.dropdown.close(!0);a.find(!0)});p.createCheckedMenuItem(l.menu,m["Wrap search"],a._wrap,function(b){a.setOptions({wrap:b.target.checked});l.dropdown.close(!0)});p.createCheckedMenuItem(l.menu,m["Incremental search"],a._incremental,function(b){a.setOptions({incremental:b.target.checked});
l.dropdown.close(!0)});p.createCheckedMenuItem(l.menu,m["Whole Word"],a._wholeWord,function(b){a.setOptions({wholeWord:b.target.checked});l.dropdown.close(!0);a.find(!0)});a._regExBox=p.createCheckedMenuItem(l.menu,m["Regular expression"],a._regex,function(b){a.setOptions({regex:b.target.checked});l.dropdown.close(!0);a.find(!0);a._showReplaceInfo()});e||p.createCheckedMenuItem(l.menu,m["Find after replace"],a._findAfterReplace,function(b){a.setOptions({findAfterReplace:b.target.checked});l.dropdown.close(!0)});
return b},function(){a.hide()})},_storeRecentFind:function(a,d,b){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){e.put("recentFind",a);d&&window.setTimeout(function(){d.dispatchEvent({type:"inputDataListChanged",deleting:b})}.bind(this),20)})},_addRecentfind:function(a){"string"===typeof a&&a&&(!this._completion||!this._completion.hasValueOf(a))&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var b;
d=d.get("recentFind");"string"===typeof d&&(d=JSON.parse(d));if(d){for(b in d)if(d[b].name===a)return;30<=d.length&&d.splice(29,d.length-30+1)}else d=[];d.splice(0,0,{name:a});this._storeRecentFind(d,this._completion)}.bind(this))},_removeRecentSearch:function(a,d){"string"===typeof a&&a&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){var e;b=b.get("recentFind");"string"===typeof b&&(b=JSON.parse(b));if(b)for(e in b)if(b[e].name===a){b.splice(e,
1);this._storeRecentFind(b,d,!0);break}}.bind(this))},_initCompletion:function(a){if(this._completion)this._completion.setInputField(a);else{var d=function(a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){d=d.get("recentFind");"string"===typeof d&&(d=JSON.parse(d));if(d){var e=[];d.forEach(function(a){e.push({type:"proposal",label:a.name,value:a.name})});a(e)}})}.bind(this);this._completion=new l.InputCompletion(a,d,{serviceRegistry:this._serviceRegistry,
group:"localSearch",onDelete:function(a,d){this._removeRecentSearch(a,d)}.bind(this),deleteToolTips:m["Click or use delete key to delete the search term"]})}},_createButton:function(a,d,b){var f=document.createElement("button");f.addEventListener("click",b.bind(this),!1);var l=this;f.addEventListener("keydown",function(a){a.keyCode===e.KEY.ESCAPE&&l.hide()});f.appendChild(document.createTextNode(a));f.className="dismissButton parameterInlineButton";d.appendChild(f)},_createInfoImage:function(a,d,
b){a=document.createElement("img");a.classList.add("replaceInfo");a.addEventListener("click",function(a){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);this._showReplaceInfo()}.bind(this));d.appendChild(a);return a},_handleInput:function(a){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(a){var d=(this.isMac?a.metaKey:a.ctrlKey)&&!a.altKey&&!a.shiftKey;return d&&70===a.keyCode?(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=
!0,!1):(this.isMac?a.metaKey:a.ctrlKey)&&!a.altKey&&75===a.keyCode||13===a.keyCode?(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,this._addRecentfind(this.getFindString()),13===a.keyCode?this.find(this._reverse?a.shiftKey:!a.shiftKey):this.find(!a.shiftKey),!1):d&&82===a.keyCode?(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,this.replace(),!1):27===a.keyCode?(this.hide(),!1):!0}});return{TextSearcher:d}});
define("orion/edit/dispatcher",["orion/edit/dispatcher"],function(){function m(m,p,k){this.serviceRegistry=m;this.editor=p;this.inputManager=k;this.contentTypeService=m.getService("orion.core.contentTypeRegistry");if(!this.contentTypeService)throw Error("Missing required service");this.serviceReferences={};var f=this;this.listener={onServiceAdded:function(l){f._onServiceAdded(l.serviceReference)},onServiceRemoved:function(l){f._onServiceRemoved(l.serviceReference)}};this.serviceRegistry.addEventListener("registered",
this.listener.onServiceAdded);this.serviceRegistry.addEventListener("unregistering",this.listener.onServiceRemoved);this._init()}m.prototype={_init:function(){var m=this;this.editor.getTextView()?this._wire(this.serviceRegistry):this.editor.addEventListener("TextViewInstalled",function(){m._wire(m.serviceRegistry)})},_wire:function(m){m=m.getServiceReferences("orion.edit.model");for(var p=0;p<m.length;p++)this._wireServiceReference(m[p])},_wireServiceReference:function(m){var p=m.getProperty("contentType");
if(void 0!==typeof p&&null!==p){var k=this;this.contentTypeService.isSomeExtensionOf(this.inputManager.getContentType(),p).then(function(f){f&&k._wireService(m,k.serviceRegistry.getService(m))})}},_wireService:function(m,p){for(var k=Object.keys(p),f=this.editor.getTextView(),l=0;l<k.length;l++){var e=k[l],d=p[e];"on"!==e.substr(0,2)||"function"!==typeof d||(e=e.substr(2),this._wireServiceMethod(m,p,d,f,e))}this._initService(p,f)},_wireServiceMethod:function(m,p,k,f,l){p=function(e){k(e).then()};
m=m.getProperty("service.id");this.serviceReferences[m]=this.serviceReferences[m]||[];this.serviceReferences[m].push([f,l,p]);f.addEventListener(l,p)},_onServiceRemoved:function(m){m=m.getProperty("service.id");var p=this.serviceReferences[m];if(p){for(var k=0;k<p.length;k++){var f=p[k];f[0].removeEventListener(f[1],f[2])}delete this.serviceReferences[m]}},_onServiceAdded:function(m){-1!==m.getProperty("objectClass").indexOf("orion.edit.model")&&this._wireServiceReference(m)},_initService:function(m,
p){var k=m.onModelChanging;if("function"===typeof k){var f=p.getModel(),l=f.getText(),f={type:"Changing",text:l,start:0,removedCharCount:0,addedCharCount:l.length,removedLineCount:0,addedLineCount:f.getLineCount()};k.call(m,f)}}};return{Dispatcher:m}});
define("orion/edit/typedefs",["orion/objects","orion/serviceTracker"],function(m,n){function p(k){this.props=Object.create(null);this.defs=Object.create(null);this.registration=null;var f=new n(k,"orion.core.typedef"),l=this;f.onServiceAdded=function(e){var d=e.getProperty("id"),a=e.getProperty("defs");if(!d||!a)throw Error("TypeDef registration missing required 'id' or 'defs' [service id: "+e.getProperty("service.id")+"]");var f={};e.getPropertyKeys().forEach(function(a){"defs"!==a&&("service.id"!==
a&&"service.names"!==a&&"objectClass"!==a)&&(f[a]=e.getProperty(a))});l.props[d]=f;l.defs[d]=a;l._updateRegistration()};f.removedService=function(e){e=e.getProperty("id");delete l.props[e];delete l.defs[e];l._updateRegistration()};f.open();this.registration=k.registerService("orion.edit.context",{getTypeDef:this.getTypeDef.bind(this)},null);this._updateRegistration()}m.mixin(p.prototype,{_updateRegistration:function(){this.registration&&this.registration.setProperties({typeDefs:this.getAllProperties()})},
getTypeDef:function(k){return this.defs[k]||null},getProperties:function(k){return this.props[k]||null},getAllProperties:function(){return this.props}});return p});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},
doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\\x3c\\S*\\\x3e",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},
number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(m){var n="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(" ");m=m.grammars;m.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",
end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},
{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+n.join("|")+")\\b",name:"keyword.control.js"}]});return{id:m[m.length-1].id,grammars:m,keywords:n}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(m){var n="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(" ");m=m.grammars;m.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+
n.join("|")+")\\b",name:"keyword.control.java"}]});return{id:m[m.length-1].id,grammars:m,keywords:n}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(m){var n="alignment-adjust alignment-baseline animation-delay animation-direction animation-duration animation-iteration-count animation-name animation-play-state animation-timing-function animation appearance azimuth backface-visibility background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size background baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-bottom border-collapse border-color border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-image border-left-color border-left-style border-left-width border-left border-radius border-right-color border-right-style border-right-width border-right border-spacing border-style border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-top border-width border bottom box-align box-decoration-break box-direction box-flex-group box-flex box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before break-inside caption-side clear clip color-profile color column-count column-fill column-gap column-rule-color column-rule-style column-rule-width column-rule column-span column-width columns content counter-increment counter-reset crop cue-after cue-before cue cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit-position fit flex-align flex-flow flex-inline-pack flex-order flex-pack float-offset float font-family font-size font-size-adjust font-stretch font-style font-variant font-weight font grid-columns grid-rows hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-lines hyphenate-resource hyphens icon image-orientation image-rendering image-resolution inline-box-align left letter-spacing line-height line-stacking-ruby line-stacking-shift line-stacking-strategy line-stacking list-style-image list-style-position list-style-type list-style margin-bottom margin-left margin-right margin-top margin mark-after mark-before mark marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up opacity orphans outline-color outline-offset outline-style outline-width outline overflow-style overflow-x overflow-y overflow padding-bottom padding-left padding-right padding-top padding page-break-after page-break-before page-break-inside page-policy page pause-after pause-before pause perspective-origin perspective phonemes pitch-range pitch play-during position presentation-level punctuation-trim quotes rendering-intent resize rest-after rest-before rest richness right rotation-point rotation ruby-align ruby-overhang ruby-position ruby-span size speak-header speak-numeral speak-punctuation speak speech-rate stress string-set table-layout target-name target-new target-position target text-align-last text-align text-decoration text-emphasis text-height text-indent text-justify text-outline text-shadow text-transform text-wrap top transform-origin transform-style transform transition-delay transition-duration transition-property transition-timing-function transition unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch-range voice-pitch voice-rate voice-stress voice-volume volume white-space-collapse white-space widows width word-break word-spacing word-wrap z-index".split(" ");m=
m.grammars;m.push({id:"orion.css",contentTypes:["text/css"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},
{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{match:"(?:-webkit-|-moz-|-ms-|-o-|\\b)(?:"+n.join("|")+")\\b",name:"keyword.control.css"}],repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});
return{id:m[m.length-1].id,grammars:m,keywords:n}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(m,n,p,k){function f(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function l(){f.call(this,null,!0)}function e(a){f.call(this,null,a)}function d(){f.call(this,null,!1)}function a(a,k,m){this.commentStart="/*";this.commentEnd="*/";var p=[];switch(k){case "java":p=b;break;
case "js":p=h;break;case "css":p=g}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new f(p,this.whitespacesVisible);this._firstScanner=new d;this._commentScanner=new e(this.whitespacesVisible);this._whitespaceScanner=new l;"css"===k&&(this._scanner.isCSS=!0,this._firstScanner.isCSS=!0);this.view=a;this.annotationModel=m;this._bracketAnnotations=void 0;var n=this;this._listener=
{onChanged:function(a){n._onModelChanged(a)},onDestroy:function(a){n._onDestroy(a)},onLineStyle:function(a){n._onLineStyle(a)},onMouseDown:function(a){n._onMouseDown(a)},onSelection:function(a){n._onSelection(a)}};k=a.getModel();k.getBaseModel&&(k=k.getBaseModel());k.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 h=n.keywords,b=p.keywords,g=k.keywords,u={styleClass:"comment"},v={styleClass:"comment"},q={styleClass:"comment block documentation"},r={styleClass:"keyword other documentation markup"},z={styleClass:"keyword other documentation task"},t={styleClass:"keyword other documentation tag"},w={styleClass:"string"},A={styleClass:"constant numeric"},x={styleClass:"keyword"},C={styleClass:"punctuation separator space",
unmergeable:!0},s={styleClass:"punctuation separator tab",unmergeable:!0},y={styleClass:"meta annotation currentLine"};f.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 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);
return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var b=this.isCSS,d=this.offset-1;if(!b&&48<=a&&57>=a){var e=b=!1,f=!1,g=a;do if(a=this._read(),46===a&&!b)b=!0;else if(101===a&&!e)b=e=!0,a=this._read(),45!==a&&this._unread(a);else if(120===a&&48===g&&2===this.offset-d)b=e=f=!0;else if(!(48<=a&&57>=a||f&&(65<=a&&70>=a||97<=a&&102>=a)))break;while(1);this._unread(a);return 3}if(97<=a&&122>=a||65<=a&&90>=a||95===a||45===a&&b){do a=this._read();while(97<=a&&
122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a||45===a&&b);this._unread(a);a=this.keywords;if(0<a.length){d=this.text.substring(d,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===d)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){-1!==a&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),b;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&47===a)for(;;)if(a=
this._read(),-1===a||10===a||13===a)return this._unread(a),6;if(42===a){a=this._read();b=7;for(42===a&&(b=8);;){for(;42===a;)if(a=this._read(),47===a)return b;if(-1===a)return this._unread(a),b;a=this._read()}}this._unread(a);return 1;case 39:for(b=4;;)switch(a=this._read(),a){case 39:return b;case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;case 34:for(b=4;;)switch(a=this._read(),a){case 34:return b;
case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};l.prototype=new f(null);l.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(!(32===a||9===a||-1===a));this._unread(a);
return 1}}};e.prototype=new f(null);e.prototype.setType=function(a){this._type=a};e.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 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);return 9;case 60:if(8===this._type){do a=this._read();while(!(62===a||-1===a));if(62===a)return 12}return 1;case 64:if(8===this._type){do a=this._read();while(97<=a&&122>=a||65<=a&&90>=
a||95===a||48<=a&&57>=a);this._unread(a);return 13}return 1;case 84:if(79===(a=this._read()))if(68===(a=this._read()))if(79===(a=this._read()))if(a=this._read(),!(97<=a&&122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(32===a||9===a||-1===a||60===a||64===a||84===a));this._unread(a);return 1}}};d.prototype=new f(null);d.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};a.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,
b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){this.detectHyperlinks=
a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,d,e,f){var g;void 0===e&&(e=-1);void 0===f&&(f=a.length);for(;1<f-e;)if(g=Math.floor((f+e)/2),b<=a[g].start)f=g;else if(d&&b<a[g].end){f=g;break}else e=g;return f},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();
if(a.getBaseModel){var b=this.annotationModel;if(b){b.removeAnnotations(m.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=a.getBaseModel(),f=this.comments,g=0;g<f.length;g++){var h=f[g];(h=this._createFoldingAnnotation(a,e,h.start,h.end))&&d.push(h)}b.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,d,e){var f=b.getLineAtOffset(d);b=b.getLineAtOffset(e);return f===b?null:new (m.AnnotationType.getType(m.AnnotationType.ANNOTATION_FOLDING))(d,e,a)},_computeTasks:function(a,b,d){if(this.detectTasks){var e=
this.annotationModel;if(e){var f=this.view.getModel(),g=f;f.getBaseModel&&(g=f.getBaseModel());for(var h=e.getAnnotations(b,d),f=[],l=m.AnnotationType.ANNOTATION_TASK;h.hasNext();){var k=h.next();k.type===l&&f.push(k)}h=[];k=this._commentScanner;k.setText(g.getText(b,d));for(var n;n=k.nextToken();){var p=k.getStartOffset()+b;14===n&&(n=g.getLineEnd(g.getLineAtOffset(p)),6!==a&&(n=Math.min(n,d-this.commentEnd.length)),h.push(m.AnnotationType.createAnnotation(l,p,n,g.getText(p,n))))}e.replaceAnnotations(f,
h)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,d=b.getModel(),b=b.getSelection();if(b.start===b.end&&d.getLineAtOffset(b.start)===a)return y}return null},_getStyles:function(a,b,d){a.getBaseModel&&(d=a.mapOffset(d));for(var e=d+b.length,f=[],g=d,h=this.comments,l=this._binarySearch(h,d,!0);l<h.length&&!(h[l].start>=e);l++){var k=h[l].start,m=h[l].end;g<k&&this._parse(b.substring(g-d,k-d),g,f);var n=h[l].type,p;switch(n){case 8:p=q;break;case 7:p=v;break;case 5:p=w}g=Math.max(g,
k);k=Math.min(e,m);(8===n||7===n)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(g-d,k-d),g,f,p,n):5===n&&this.whitespacesVisible?this._parseString(b.substring(g-d,k-d),g,f,w):f.push({start:g,end:k,style:p});g=m}g<e&&this._parse(b.substring(g-d,e-d),g,f);if(a.getBaseModel)for(b=0;b<f.length;b++)d=f[b].end-f[b].start,f[b].start=a.mapOffset(f[b].start,!0),f[b].end=f[b].start+d;return f},_parse:function(a,b,d){var e=this._scanner;for(e.setText(a);a=e.nextToken();){var f=
e.getStartOffset()+b,g=null;switch(a){case 2:g=x;break;case 3:g=A;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(e.getData(),f,d,w);continue}else g=w;break;case 8:this._parseComment(e.getData(),f,d,q,a);continue;case 6:this._parseComment(e.getData(),f,d,u,a);continue;case 7:this._parseComment(e.getData(),f,d,v,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(g=s);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=C)}d.push({start:f,end:e.getOffset()+b,
style:g})}},_parseComment:function(a,b,d,e,f){var g=this._commentScanner;g.setText(a);for(g.setType(f);a=g.nextToken();){f=g.getStartOffset()+b;var h=e;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(h=s);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=C);break;case 12:h=r;break;case 13:h=t;break;case 14:h=z;break;default:this.detectHyperlinks&&(h=this._detectHyperlinks(g.getData(),f,d,h))}h&&d.push({start:f,end:g.getOffset()+b,style:h})}},_parseString:function(a,b,d,e){var f=
this._whitespaceScanner;for(f.setText(a);a=f.nextToken();){var g=f.getStartOffset()+b,h=e;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(h=s);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(h=C)}h&&d.push({start:g,end:f.getOffset()+b,style:h})}},_detectHyperlinks:function(a,b,d,e){var f=null,g;if(0<(g=a.indexOf("://"))){for(var f=a,h=g;0<h;){g=f.charCodeAt(h-1);if(!(97<=g&&122>=g||65<=g&&90>=g||45===g||48<=g&&57>=g))break;h--}if(0<h&&(g="\"\"''(){}[]\x3c\x3e".indexOf(f.substring(h-
1,h)),-1!==g&&0===(g&1)&&-1!==(g=f.lastIndexOf("\"\"''(){}[]\x3c\x3e".substring(g+1,g+2))))){var l=g;g=this._clone(e);g.tagName="a";g.attributes={href:f.substring(h,l)};d.push({start:b,end:b+h,style:e});d.push({start:b+h,end:b+l,style:g});d.push({start:b+l,end:b+a.length,style:e});return null}}else 0===a.toLowerCase().indexOf("bug#")&&(f="https://bugs.eclipse.org/bugs/show_bug.cgi?id\x3d"+parseInt(a.substring(4),10));return f?(g=this._clone(e),g.tagName="a",g.attributes={href:f},g):e},_clone:function(a){if(!a)return a;
var b={},d;for(d in a)a.hasOwnProperty(d)&&(b[d]=a[d]);return b},_findComments:function(a,b){b=b||0;var d=this._firstScanner,e;d.setText(a);for(var f=[];e=d.nextToken();)(7===e||8===e||5===e)&&f.push({start:d.getStartOffset()+b,end:d.getOffset()+b,type:e}),(6===e||7===e||8===e)&&this._computeTasks(e,d.getStartOffset()+b,d.getOffset()+b);return f},_findMatchingBracket:function(a,b){var d="{}()[]\x3c\x3e",e=a.getText(b,b+1),f=d.indexOf(e,0);if(-1===f)return-1;var g;g=f&1?d.substring(f-1,f):d.substring(f+
1,f+2);for(var h=a.getLineAtOffset(b),d=a.getLine(h),l=a.getLineStart(h),k=a.getLineEnd(h),d=this._findBrackets(e,g,d,l,l,k),k=0;k<d.length;k++)if(l=0<=d[k]?1:-1,d[k]*l-1===b){var m=1;if(f&1){for(k--;0<=k;k--)if(l=0<=d[k]?1:-1,m+=l,0===m)return d[k]*l-1;for(h-=1;0<=h;){d=a.getLine(h);l=a.getLineStart(h);k=a.getLineEnd(h);d=this._findBrackets(e,g,d,l,l,k);for(f=d.length-1;0<=f;f--)if(l=0<=d[f]?1:-1,m+=l,0===m)return d[f]*l-1;h--}}else{for(k++;k<d.length;k++)if(l=0<=d[k]?1:-1,m+=l,0===m)return d[k]*
l-1;h+=1;for(f=a.getLineCount();h<f;){d=a.getLine(h);l=a.getLineStart(h);k=a.getLineEnd(h);d=this._findBrackets(e,g,d,l,l,k);for(k=0;k<d.length;k++)if(l=0<=d[k]?1:-1,m+=l,0===m)return d[k]*l-1;h++}}break}return-1},_findBrackets:function(a,b,d,e,f,g){var h=[];a=a.charCodeAt(0);b=b.charCodeAt(0);for(var l=f,k=this._scanner,m,n=this.comments,p=this._binarySearch(n,f,!0);p<n.length&&!(n[p].start>=g);p++){m=n[p].start;var q=n[p].end;if(l<m)for(k.setText(d.substring(l-f,m-f));m=k.nextToken();)m===a?h.push(k.getStartOffset()+
l-f+e+1):m===b&&h.push(-(k.getStartOffset()+l-f+e+1));l=q}if(l<g)for(k.setText(d.substring(l-f,g-f));m=k.nextToken();)m===a?h.push(k.getStartOffset()+l-f+e+1):m===b&&h.push(-(k.getStartOffset()+l-f+e+1));return h},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){a.textView===this.view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var b=a.oldValue,d=a.newValue,e=this.view;a=e.getModel();var f;
if(this.highlightCaretLine){var g=a.getLineAtOffset(b.start);f=a.getLineAtOffset(d.start);var h=d.start===d.end,b=b.start===b.end;g===f&&b&&h||(b&&e.redrawLines(g,g+1),(g!==f||!b)&&h&&e.redrawLines(f,f+1))}if(this.annotationModel){var b=this._bracketAnnotations,l,k;if(d.start===d.end&&0<(k=e.getCaretOffset()))k-=1,a.getBaseModel&&(k=a.mapOffset(k),a=a.getBaseModel()),a=this._findMatchingBracket(a,k),-1!==a&&(l=[m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),
m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_CURRENT_BRACKET,k,k+1)]);this._bracketAnnotations=l;this.annotationModel.replaceAnnotations(b,l)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,d=b.getModel(),e=b.getOffsetAtLocation(a.x,a.y);if(0<e){var f=e-1,g=d;d.getBaseModel&&(f=d.mapOffset(f),g=d.getBaseModel());f=this._findMatchingBracket(g,f);-1!==f&&(a.preventDefault(),a=f,d.getBaseModel&&(a=d.mapOffset(a,!0)),e>a&&(e--,a++),b.setSelection(a,e))}}},_onModelChanged:function(a){var b=
a.start,d=a.removedCharCount,e=a.addedCharCount-d,f=this.view;a=f.getModel();var g=a.getBaseModel?a.getBaseModel():a,d=b+d,h=g.getCharCount(),l=this.comments.length,k=g.getLineStart(g.getLineAtOffset(b)),n=this._binarySearch(this.comments,k,!0),p=this._binarySearch(this.comments,d,!1,n-1,l);n<l&&this.comments[n].start<=k&&k<this.comments[n].end?(k=this.comments[n].start,k>b&&(k+=e)):k=n===l&&0<l&&h-e===this.comments[l-1].end?this.comments[l-1].start:k;var q;p<l?(q=this.comments[p].end,q>b&&(q+=e),
p+=1):(p=l,q=h);for(var h=g.getText(k,q),u,h=this._findComments(h,k),l=n;l<this.comments.length;l++)u=this.comments[l],u.start>b&&(u.start+=e),u.start>b&&(u.end+=e);var v=p-n!==h.length;if(!v)for(l=0;l<h.length;l++){u=this.comments[n+l];var r=h[l];if(u.start!==r.start||u.end!==r.end||u.type!==r.type){v=!0;break}}l=[n,p-n].concat(h);Array.prototype.splice.apply(this.comments,l);v&&(l=k,u=q,a!==g&&(l=a.mapOffset(l,!0),u=a.mapOffset(u,!0)),f.redrawRange(l,u));if(this.foldingEnabled&&g!==a&&this.annotationModel){f=
this.annotationModel;n=f.getAnnotations(k,q);k=[];for(q=[];n.hasNext();)if(u=n.next(),u.type===m.AnnotationType.ANNOTATION_FOLDING){q.push(u);for(l=0;l<h.length&&!(u.start===h[l].start&&u.end===h[l].end);l++);l===h.length?(k.push(u),u.expand()):(l=u.start,p=u.end,l>b&&(l-=e),p>b&&(p-=e),l<=b&&(b<p&&l<=d&&d<p)&&(l=g.getLineAtOffset(u.start),p=g.getLineAtOffset(u.end),l!==p?u.expanded||u.expand():f.removeAnnotation(u)))}b=[];for(l=0;l<h.length;l++){u=h[l];for(e=0;e<q.length&&!(q[e].start===u.start&&
q[e].end===u.end);e++);e===q.length&&(u=this._createFoldingAnnotation(a,g,u.start,u.end))&&b.push(u)}f.replaceAnnotations(k,b)}}};return{TextStyler:a}});
define("orion/editor/textStyler",["orion/editor/annotations","orion/editor/eventTarget"],function(m,n){function p(a,d){this._patternManager=new k(a,d)}function k(a,d){this._unnamedCounter=0;this._patterns=[];this._rootId=d;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function f(a,d,b,e,f,l,k){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.name=d;this.typeId=b;this.styler=
e;this.parent=l;k&&k(this);this._subBlocks=e.computeBlocks(f,f.getText(this.start,this.end),this,this.start,null,null,null)}function l(a){this._styler=a}function e(a,d,b){this._highlightCaretLine=this._whitespacesVisible=this._spacesVisible=this._tabsVisible=!1;this._detectTasks=this._foldingEnabled=!0;this._view=a;this._annotationModel=d;this._stylerAdapter=b;this._stylerAdapter.setStyler(this);this._accessor=new l(this);this._bracketAnnotations;var e=this;this._listener={onChanged:function(a){e._onModelChanged(a)},
onDestroy:function(a){e._onDestroy(a)},onLineStyle:function(a){e._onLineStyle(a)},onMouseDown:function(a){e._onMouseDown(a)},onSelection:function(a){e._onSelection(a)}};b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.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);
var f=b.getCharCount();this._rootBlock=this._stylerAdapter.createBlock({start:0,contentStart:0,end:f,contentEnd:f},this,b,null);d&&(f=[],d.removeAnnotations(m.AnnotationType.ANNOTATION_FOLDING),this._computeFolding(this._rootBlock.getBlocks(),a.getModel(),f),this._detectTasks&&(d.removeAnnotations(m.AnnotationType.ANNOTATION_TASK),this._computeTasks(this._rootBlock,b,f)),d.replaceAnnotations([],f));a.redrawLines()}var d=function(a,d,b,e,f){var l;void 0===e&&(e=-1);void 0===f&&(f=a.length);for(;1<
f-e;)if(l=Math.floor((f+e)/2),d<=a[l].start)f=l;else if(b&&d<a[l].end){f=l;break}else e=l;return f};p.prototype={blockSpansBeyondEnd:function(a){return a.pattern.regexEnd===this._eolRegex},computeBlocks:function(a,d,b,e,f,l,k){if(!d)return[];var m=[],n=[];f=f||0;l=l||Infinity;k=k||Infinity;b.blockPatterns.forEach(function(a){var b=this._findMatch(a.regexBegin||a.regex,d,f);b&&n.push({result:b,pattern:a})}.bind(this));if(!n.length)return m;n.sort(function(a,b){return a.result.index<b.result.index?
-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var p=0;0<n.length;){var w=n[0];n.splice(0,1);if(l<w.result.index)break;if(!(w.result.index<p)){var p=e+w.result.index,A=w.result.index,x=null,C=w.pattern.regexEnd;if(C){var A=A+w.result[0].length,s=w.pattern,y=this._substituteCaptureValues(C,w.result);y!==C&&(s={pattern:s.pattern,regexBegin:s.regexBegin,regexEnd:y},C=y);for(y=A;!x;){y=this._findMatch(C,d,y);y||(this._eolRegex.lastIndex=0,y=this._eolRegex.exec(d),
s={pattern:s.pattern,regexBegin:s.regexBegin,regexEnd:this._eolRegex});var D=this.createBlock({start:p,end:e+y.index+y[0].length,contentStart:e+A,contentEnd:e+y.index},b.styler,a,b,s),E=D.getBlocks();if(!E.length||E[E.length-1].end<=y.index+e)x=D;y=y.index+y[0].length}}else x=this.createBlock({start:p,end:p+w.result[0].length,contentStart:p,contentEnd:p+w.result[0].length},b.styler,a,b,w.pattern);m.push(x);if(m.length===k||l<=x.end)break;p=x.end-e}this._updateMatch(w,d,n,p,l)}return m},computeStyle:function(a,
e,b){if(!a.pattern)return null;var f={start:a.start,end:a.end,style:a.pattern.pattern.name};if(a.contentStart<=b&&b<a.contentEnd)return a.pattern.pattern.contentName?{start:a.contentStart,end:a.contentEnd,style:a.pattern.pattern.contentName}:f;var l,k;if(b<a.contentStart){k=a.pattern.pattern.beginCaptures||a.pattern.pattern.captures;if(!k)return f;l=a.pattern.regexBegin;e=e.getText(a.start,a.contentStart);a=a.start}else{k=a.pattern.pattern.endCaptures||a.pattern.pattern.captures;if(!k)return f;l=
a.pattern.regexEnd;e=e.getText(a.contentEnd,a.end);a=a.contentEnd}l.lastIndex=0;if(l=l.exec(e))if(e=[],this._getCaptureStyles(l,k,a,e),(k=e[d(e,b,!0)])&&k.start<=b&&b<k.end)return k;return f},createBlock:function(a,d,b,e,l){return new f(a,l?l.pattern.name:null,l?l.pattern.id:null,d,b,e,function(a){a.pattern=l;a.linePatterns=[];a.blockPatterns=[];a.enclosurePatterns={};this._initPatterns(this._patternManager,a)}.bind(this))},getBlockContentStyleName:function(a){return a.pattern.pattern.contentName||
a.pattern.pattern.name},getBlockEndStyle:function(a,d,b,e){var f;if(a.pattern.regexEnd&&(f=this._findMatch(a.pattern.regexEnd,d,0)))(d=a.pattern.pattern.endCaptures||a.pattern.pattern.captures)?this._getCaptureStyles(f,d,b-f[0].length,e):a.pattern.pattern.name&&e.push({start:b-f[0].length,end:b,style:a.pattern.pattern.name});return f?f[0]:null},getBlockStartStyle:function(a,d,b,e){var f;if(a.pattern.regexBegin&&(f=this._findMatch(a.pattern.regexBegin,d,0)))(d=a.pattern.pattern.beginCaptures||a.pattern.pattern.captures)?
this._getCaptureStyles(f,d,b,e):e.push({start:b,end:b+f[0].length,style:a.pattern.pattern.name});return f?f[0]:null},getBracketMatch:function(a,d){for(var b,e=Object.keys(a.enclosurePatterns),f=0;f<e.length;f++){var l=a.enclosurePatterns[e[f]],k=this._findMatch(l.regex,d,0);if(k&&0===k.index){b=l;break}}if(!b)return null;f=!1;-1!==b.pattern.name.indexOf(this._PUNCTUATION_SECTION_BEGIN)?(f=!0,e=b.pattern.name.replace(this._PUNCTUATION_SECTION_BEGIN,this._PUNCTUATION_SECTION_END)):e=b.pattern.name.replace(this._PUNCTUATION_SECTION_END,
this._PUNCTUATION_SECTION_BEGIN);return!a.enclosurePatterns[e]?null:{beginName:b.pattern.name,endName:e,atStart:f}},parse:function(a,d,b,e,f){if(a&&(b=b.linePatterns)){var l=[];b.forEach(function(b){var d=b.regex||b.regexBegin;d.oldLastIndex=d.lastIndex;(d=this._findMatch(d,a,0))&&l.push({result:d,pattern:b})}.bind(this));l.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var k=0;0<l.length;){var m=
l[0];l.splice(0,1);if(!(m.result.index<k)){var n=m.result.index,p,w=[];if(m.pattern.regex){k=m.result;p=n+k[0].length;p={start:d+n,end:d+p,style:m.pattern.pattern.name};if(!f){m.pattern.pattern.captures&&this._getCaptureStyles(k,m.pattern.pattern.captures,d+n,w);w.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(n=0;n<w.length-1;n++)if(w[n+1].start<w[n].end){var A={start:w[n+1].end,end:w[n].end,style:w[n].style};w[n].end=w[n+1].start;w.splice(n+2,0,A)}}this._mergeStyles(p,w,
e)}else k=m.pattern.regexEnd,k=this._substituteCaptureValues(k,m.result),k=this._findMatch(k,a,m.result.index+m.result[0].length),k||(this._eolRegex.lastIndex=0,k=this._eolRegex.exec(a)),p=k.index+k[0].length,e.push({start:d+n,end:d+p,style:m.pattern.pattern.name});k=k.index+k[0].length}this._updateMatch(m,a,l,k)}b.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},setStyler:function(){},verifyBlock:function(a,d,b,e){var f=null,l=[];b.parent.blockPatterns.forEach(function(a){var b=
this._findMatch(a.regexBegin||a.regex,d,0);b&&l.push({result:b,pattern:a})}.bind(this));l.sort(function(a,b){return!a.result.index&&b.result.index?-1:a.result.index&&!b.result.index?1:!a.result.index&&!b.result.index?a.pattern.pattern.index<b.pattern.pattern.index?-1:1:0});if(!l.length||0!==l[0].result.index||l[0].pattern.pattern.id!==b.pattern.pattern.id)f=!1;else{var k=l[0],m=k.pattern.regexEnd;if(m){for(var m=this._substituteCaptureValues(m,k.result),k=k.result[0].length,n=this._findMatch(m,d,
k);null===f&&n&&b.start+n.index!==b.contentEnd+e;){var p=this.computeBlocks(a,d,b,b.start,k,n.index+1,null);!p.length||p[p.length-1].end<=b.start+n.index?f=!1:p.length?(k=p[p.length-1].end-b.start,n=this._findMatch(m,d,k)):n=null}n||(this._eolRegex.lastIndex=0,n=this._eolRegex.exec(d),f=b.start+n.index===b.end+e)}else f=b.start+k.result[0].length===b.end+e}return null!==f?f:!0},_findMatch:function(a,d,b,e){var f=b,l=a.lastIndex;this._linebreakRegex.lastIndex=b;b=this._linebreakRegex.exec(d);var k,
m;a.lastIndex=0;if(b){for(m=b.index;0<=--m&&!(k=d.charAt(m),k===this._NEWLINE||k===this._CR););k=d.substring(m+1,b.index+b[1].length);a.lastIndex=m=b.index-m-1}for(;b&&b.index<d.length;){var n;if(e){var p=a.lastIndex;a.test(k)&&(a.lastIndex=p,n=a.exec(k))}else n=a.exec(k);if(n)return n.index+=f,n.index-=m,a.lastIndex=l,n;m=0;f+=b[0].length;if(b=this._linebreakRegex.exec(d))k=b[1],a.lastIndex=0}a.lastIndex=l;return null},_getCaptureStyles:function(a,d,b,e){if(d[0])e.push({start:b,end:b+a[0].length,
style:d[0].name});else for(var f=0,l=1;l<a.length;l++)if(a[l]){var k=d[l];if(k){var m=b+f;e.push({start:m,end:m+a[l].length,style:k.name})}f+=a[l].length}},_initPatterns:function(a,d){if(d.pattern&&d.pattern.pattern.linePatterns)d.linePatterns=d.pattern.pattern.linePatterns,d.blockPatterns=d.pattern.pattern.blockPatterns,d.enclosurePatterns=d.pattern.pattern.enclosurePatterns;else{var b=a.getPatterns(d.pattern?d.pattern.pattern:null),e=function(a){a="string"===typeof a?a:a.match;var b=this._ignoreCaseRegex.exec(a),
d=this._FLAGS;b&&(a=a.substring(b[0].length),d+="i");return RegExp(a,d)}.bind(this),f=-1,l=0;b.forEach(function(a){var b;if(a.match&&!a.begin&&!a.end){if(b={regex:e(a.match),pattern:a},d.linePatterns.push(b),a.name&&0===a.name.indexOf("punctuation.section")&&(-1!==a.name.indexOf(this._PUNCTUATION_SECTION_BEGIN)||-1!==a.name.indexOf(this._PUNCTUATION_SECTION_END)))d.enclosurePatterns[a.name]=b}else!a.match&&(a.begin&&a.end)&&(f=l,b={regexBegin:e(a.begin),regexEnd:e(a.end),pattern:a},d.linePatterns.push(b));
l++}.bind(this));d.blockPatterns=d.linePatterns.slice(0,f+1);d.pattern&&(d.pattern.pattern.enclosurePatterns=d.enclosurePatterns,d.pattern.pattern.linePatterns=d.linePatterns,d.pattern.pattern.blockPatterns=d.blockPatterns)}},_mergeStyles:function(a,d,b){var e=a.start;d.forEach(function(d){e<=d.start&&b.push({start:e,end:d.start,style:a.style});b.push(d);e=d.end});e<a.end&&b.push({start:e,end:a.end,style:a.style})},_substituteCaptureValues:function(a,d){var b=a.toString();this._captureReferenceRegex.lastIndex=
0;if(!this._captureReferenceRegex.test(b))return a;this._captureReferenceRegex.lastIndex=0;for(var e=this._captureReferenceRegex.exec(b);e;)b=b.replace(e[0],d[e[1]]||""),this._captureReferenceRegex.lastIndex=0,e=this._captureReferenceRegex.exec(b);return RegExp(b.substring(1,b.length-1-this._FLAGS.length),this._FLAGS)},_updateMatch:function(a,d,b,e,f){var l=a.pattern.regex?a.pattern.regex:a.pattern.regexBegin;f=f||Infinity;if((d=this._findMatch(l,d,e,!0))&&d.index<f){a.result=d;for(f=0;f<b.length;f++)if(d.index<
b[f].result.index||d.index===b[f].result.index&&a.pattern.pattern.index<b[f].pattern.pattern.index){b.splice(f,0,a);return}b.push(a)}},_captureReferenceRegex:/\\(\d)/g,_eolRegex:/$/,_ignoreCaseRegex:/^\(\?i\)\s*/,_linebreakRegex:/(.*)(?:[\r\n]|$)/g,_CR:"\r",_FLAGS:"g",_NEWLINE:"\n",_PUNCTUATION_SECTION_BEGIN:".begin",_PUNCTUATION_SECTION_END:".end"};k.prototype={getPatterns:function(a){a?(a="string"===typeof a?a:a.qualifiedId,a+="#"):a=this._rootId+"#"+this._NO_ID;var d=[0],b={},e=RegExp("^"+a+"[^#]+$");
this._patterns.forEach(function(a){e.test(a.qualifiedId)&&(a.include?this._processInclude(a,d,b):(a.index=d[0]++,b[a.id]=a))}.bind(this));var f=[];Object.keys(b).forEach(function(a){f.push(b[a])});return f},_addPattern:function(a,d,b){a.parentId=b;a.id=d;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_addPatterns:function(a,d){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,d)}.bind(this))},
_addRepositoryPatterns:function(a,d){Object.keys(a).forEach(function(b){this._addPattern(a[b],b,d)}.bind(this))},_processInclude:function(a,d,b){var e,f=a.include.indexOf("#");e=0===f?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):-1===f?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");this._patterns.forEach(function(a){e.test(a.qualifiedId)&&(a.include?this._processInclude(a,d,b):b[a.id]||(a.index=d[0]++,b[a.id]=a))}.bind(this))},_NO_ID:"NoID"};
f.prototype={adjustBounds:function(a,d){a<this.start&&(this.start+=d);a<this.contentStart&&(this.contentStart+=d);a<=this.end&&(this.end+=d);a<=this.contentEnd&&(this.contentEnd+=d);this._subBlocks.forEach(function(b){a<=b.end&&b.adjustBounds(a,d)})},getBlocks:function(){return this._subBlocks},getBlockAtIndex:function(a){return d(this.getBlocks(),a,!0)},isRenderingWhitespace:function(){return this.styler._isRenderingWhitespace()}};l.prototype={getStyles:function(a){return this._styler.getStyles(a)}};
e.prototype={computeBlocks:function(a,d,b,e,f,l,k){return this._stylerAdapter.computeBlocks(a,d,b,e,f,l,k)},destroy:function(){if(this._view){var a=this._view.getModel();a.getBaseModel&&(a=a.getBaseModel());a.removeEventListener("Changed",this._listener.onChanged);this._view.removeEventListener("MouseDown",this._listener.onMouseDown);this._view.removeEventListener("Selection",this._listener.onSelection);this._view.removeEventListener("Destroy",this._listener.onDestroy);this._view.removeEventListener("LineStyle",
this._listener.onLineStyle);this._view=null}},getBlockAtIndex:function(a){return this._findBlock(this._rootBlock,a)},getRootBlock:function(){return this._rootBlock},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var e=[],b=this._view.getModel();b.getBaseModel&&(b=b.getBaseModel());var f=this._findBlock(this._rootBlock,a),l=b.getLineAtOffset(a),k=b.getLine(l),m=[];this._stylerAdapter.parse(k,b.getLineStart(l),f,m);for((l=m[d(m,a,!0)])&&(l.start<=a&&a<l.end)&&e.push(l);f;)(l=
this._stylerAdapter.computeStyle(f,b,a))&&e.splice(0,0,l),f=f.parent;return e},setDetectHyperlinks:function(){},setDetectTasks:function(a){this._detectTasks=a},setFoldingEnabled:function(a){this._foldingEnabled=a},setHighlightCaretLine:function(a){this._highlightCaretLine=a},setSpacesVisible:function(a){this._spacesVisible!==a&&(this._spacesVisible=a,this.setWhitespacesVisible(this._tabsVisible||this._spacesVisible,!1),this._view.redraw())},setTabsVisible:function(a){this._tabsVisible!==a&&(this._tabsVisible=
a,this.setWhitespacesVisible(this._tabsVisible||this._spacesVisible,!1),this._view.redraw())},setWhitespacesVisible:function(a,d){this._whitespacesVisible!==a&&(this._whitespacesVisible=a,d&&this._view.redraw())},_computeFolding:function(a,d,b){if(d.getBaseModel){var e=d.getBaseModel();a.forEach(function(a){var f=this._createFoldingAnnotation(d,e,a.start,a.end);f&&b.push(f);this._computeFolding(a.getBlocks(),d,b)}.bind(this))}},_computeTasks:function(a,d,b,e,f){e=e||a.start;f=f||a.end;if(a.start<=
f&&e<=a.end&&this._annotationModel){var l=m.AnnotationType.ANNOTATION_TASK;if(a.name&&0===a.name.indexOf("comment")){var k=[];this._stylerAdapter.parse(d.getText(a.contentStart,a.end),a.contentStart,a,k,!0);for(var n=0;n<k.length;n++)"meta.annotation.task.todo"===k[n].style&&(e<=k[n].start&&k[n].end<=f)&&b.push(m.AnnotationType.createAnnotation(l,k[n].start,k[n].end,d.getText(k[n].start,k[n].end)))}a.getBlocks().forEach(function(a){this._computeTasks(a,d,b,e,f)}.bind(this))}},_createFoldingAnnotation:function(a,
d,b,e){var f=d.getLineAtOffset(b),l=d.getLineAtOffset(e);return f===l||f+1===l&&d.getLineStart(l)===d.getLineEnd(l)?null:new (m.AnnotationType.getType(m.AnnotationType.ANNOTATION_FOLDING))(b,e,a)},_findBlock:function(a,e){var b=a.getBlocks();if(!b.length)return a;var f=d(b,e,!0);return f<b.length&&b[f].start<=e&&e<b[f].end?this._findBlock(b[f],e):a},_findBrackets:function(a,e,b,f,l){for(var k=[],m=[],n=f,p=e.getBlocks(),t=d(p,f,!0);t<p.length&&!(p[t].start>=l);t++){var w=p[t].start,A=p[t].end;n<w&&
(this._stylerAdapter.parse(b.substring(n-f,w-f),n,e,m),m.forEach(function(b){0===b.style.indexOf(a.beginName)?k.push(b.start+1):0===b.style.indexOf(a.endName)&&k.push(-(b.start+1))}),m=[]);n=A}n<l&&(this._stylerAdapter.parse(b.substring(n-f,l-f),n,e,m),m.forEach(function(b){b.style&&(0===b.style.indexOf(a.beginName)?k.push(b.start+1):0===b.style.indexOf(a.endName)&&k.push(-(b.start+1)))}));return k},_findMatchingBracket:function(a,d,b){var e=a.getLineAtOffset(b),f=a.getLineEnd(e),l=a.getText(b,f),
l=this._stylerAdapter.getBracketMatch(d,l);if(!l)return-1;for(var k=a.getLine(e),m=a.getLineStart(e),f=this._findBrackets(l,d,k,m,f),n=0;n<f.length;n++)if(k=0<=f[n]?1:-1,f[n]*k-1===b){b=1;if(l.atStart){for(n++;n<f.length;n++)if(k=0<=f[n]?1:-1,b+=k,0===b)return f[n]*k-1;e+=1;for(n=a.getLineCount();e<n;){k=a.getLine(e);m=a.getLineStart(e);f=a.getLineEnd(e);f=this._findBrackets(l,d,k,m,f);for(m=0;m<f.length;m++)if(k=0<=f[m]?1:-1,b+=k,0===b)return f[m]*k-1;e++}}else{for(n--;0<=n;n--)if(k=0<=f[n]?1:-1,
b+=k,0===b)return f[n]*k-1;for(e-=1;0<=e;){k=a.getLine(e);m=a.getLineStart(e);f=a.getLineEnd(e);f=this._findBrackets(l,d,k,m,f);for(n=f.length-1;0<=n;n--)if(k=0<=f[n]?1:-1,b+=k,0===b)return f[n]*k-1;e--}}break}return-1},_getLineStyle:function(a){if(this._highlightCaretLine){var d=this._view.getModel(),b=this._view.getSelection();if(b.start===b.end&&d.getLineAtOffset(b.start)===a)return this._caretLineStyle}return null},_getStyles:function(a,e,b,f){e.getBaseModel&&(f=e.mapOffset(f));for(var l=f+b.length,
k=[],m=f,n=a.getBlocks(),p=d(n,f,!0);p<n.length&&!(n[p].start>=l);p++){var t=n[p].start,w=n[p].end;m<t&&this._stylerAdapter.parse(b.substring(m-f,t-f),m,a,k);var A=Math.max(m,t);A===t&&(t=this._stylerAdapter.getBlockStartStyle(n[p],b.substring(A-f),A,k))&&(A+=t.length);var t=Math.min(l,w),x=[];t===w&&(m=b.substring(t-m-(n[p].end-n[p].contentEnd)),(m=this._stylerAdapter.getBlockEndStyle(n[p],m,t,x))&&(t-=m.length));var m=this._getStyles(n[p],e,b.substring(A-f,t-f),A),C=this._stylerAdapter.getBlockContentStyleName(n[p]);
if(C){var s=A;m.forEach(function(a){a.start-s&&k.push({start:s,end:a.start,style:C});a.mergeable&&(a.style+=","+C);k.push(a);s=a.end});t-s&&k.push({start:s,end:t,style:C})}else k=k.concat(m);k=k.concat(x);m=w}m<l&&this._stylerAdapter.parse(b.substring(m-f,l-f),m,a,k);if(e.getBaseModel)for(a=0;a<k.length;a++)b=k[a].end-k[a].start,k[a].start=e.mapOffset(k[a].start,!0),k[a].end=k[a].start+b;return k},_isRenderingWhitespace:function(){return this._whitespacesVisible&&(this._tabsVisible||this._spacesVisible)},
_onDestroy:function(){this.destroy()},_onLineStyle:function(a){a.textView===this._view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(this._rootBlock,a.textView.getModel(),a.lineText,a.lineStart);a.ranges.forEach(function(a){a.style&&(a.style={styleClass:a.style.replace(/\./g," ")})});this._isRenderingWhitespace()&&(this._spacesVisible&&this._spliceStyles(this._spacePattern,a.ranges,a.lineText,a.lineStart),this._tabsVisible&&this._spliceStyles(this._tabPattern,a.ranges,a.lineText,
a.lineStart))},_onModelChanged:function(a){var e=a.start,b=a.removedCharCount;a=a.addedCharCount-b;var f=this._view.getModel(),l=f.getBaseModel?f.getBaseModel():f,b=e+b,k=l.getCharCount(),n=l.getLineStart(l.getLineAtOffset(e)),p=this._findBlock(this._rootBlock,e),z,t,w,A,x,C,s;do{w=p.parent;if(!z&&w&&(x=l.getText(p.start,Math.min(k,p.end+a+1)),!this._stylerAdapter.verifyBlock(l,x,p,a))){p=w;continue}t=p.getBlocks();var y=t.length,D=d(t,n,!0),E=d(t,b,!1,D-1,y);z=!1;if(D&&t.length&&t[D-1].end===e){x=
l.getText(t[D-1].start,Math.min(k,e+1));var B=this.computeBlocks(l,x,p,t[D-1].start,null,null,null);B.length&&B[0].end!==t[D-1].end&&(D--,z=!0)}D<y&&t[D].start<=n&&(n<t[D].end||z)?(s=t[D].start,s>e&&(s+=a)):D===y&&0<y&&p.end-a===t[y-1].end?(s=t[--D].start,s>e&&(s+=a)):s=Math.max(n,p.contentStart);C=E<y?t[E].end:p.contentEnd;e<=C&&(C+=a);C=Math.min(C,k-1);x=l.getText(s,C+1);B=this.computeBlocks(l,x,p,s,null,null,null);if(E<y){if(B.length&&B[B.length-1].end===C&&B[B.length-1].typeId===t[E].typeId)break;
if(B.length&&this._stylerAdapter.blockSpansBeyondEnd(B[B.length-1])){E++;for(var L=B[B.length-1].getBlocks(),L=(L.length?L[L.length-1]:B[B.length-1]).typeId;E<y;){if(t[E].typeId===L){var H=t[E].end+a,H=Math.min(H,k-1);x=l.getText(s,H+1);x=this.computeBlocks(l,x,p,s,null,null,null);if(x.length&&x[x.length-1].end===H){C=H;B=x;break}}E++}if(E<y)break}}else if(!B.length||B[B.length-1].end<=p.contentEnd+a)break;if(!w){C=k;E=y;x=l.getText(s,C);B=this.computeBlocks(l,x,p,s,null,null,null);break}p=w;A=!0}while(1);
this._rootBlock.adjustBounds(e,a);E=Math.min(E+1,y);A||(A=E-D!==B.length);if(!A)for(y=0;y<B.length;y++)if(z=t[D+y],k=B[y],z.start!==k.start||z.end!==k.end||z.typeId!==k.typeId){A=!0;break}!t.length&&!B.length?this.dispatchEvent({type:"BlocksChanged",old:[p],"new":[p]}):this.dispatchEvent({type:"BlocksChanged",old:t.slice(D,E),"new":B});D=[D,E-D].concat(B);Array.prototype.splice.apply(t,D);A&&(t=s,A=C,f!==l&&(t=f.mapOffset(t,!0),A=f.mapOffset(A,!0)),this._view.redrawRange(t,A));if(this._annotationModel){t=
[];var G=[],I=[];A=this._annotationModel.getAnnotations(s,C);D=this._foldingEnabled&&l!==f;for(E=p.parent||p;A.hasNext();)B=A.next(),D&&B.type===m.AnnotationType.ANNOTATION_FOLDING?(I.push(B),z=this._findBlock(E,B.start),!z||!(B.start===z.start&&B.end===z.end)?(t.push(B),B.expand()):(z=B.start,y=B.end,z>e&&(z-=a),y>e&&(y-=a),z<=e&&(e<y&&z<=b&&b<y)&&(z=l.getLineAtOffset(B.start),y=l.getLineAtOffset(B.end),z!==y?B.expanded||B.expand():t.push(B)))):B.type===m.AnnotationType.ANNOTATION_TASK&&p.start<=
B.start&&B.end<=p.end&&t.push(B);D&&E.getBlocks().forEach(function(a){this._updateFolding(a,l,f,I,G,s,C)}.bind(this));this._detectTasks&&this._computeTasks(p,l,G,s,C);this._annotationModel.replaceAnnotations(t,G)}},_onMouseDown:function(a){if(2===a.clickCount){var d=this._view.getModel(),b=this._view.getOffsetAtLocation(a.x,a.y);if(0<b){var e=b-1,f=d;d.getBaseModel&&(e=d.mapOffset(e),f=d.getBaseModel());var l=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,l,e);-1!==e&&(a.preventDefault(),
a=e,d.getBaseModel&&(a=d.mapOffset(a,!0)),b>a&&(b--,a++),this._view.setSelection(a,b))}}},_onSelection:function(a){var d=a.oldValue,b=a.newValue;a=this._view.getModel();var e;if(this._highlightCaretLine){var f=a.getLineAtOffset(d.start);e=a.getLineAtOffset(b.start);var l=b.start===b.end,d=d.start===d.end;f===e&&d&&l||(d&&this._view.redrawLines(f,f+1),(f!==e||!d)&&l&&this._view.redrawLines(e,e+1))}if(this._annotationModel){var d=this._bracketAnnotations,k,n;if(b.start===b.end&&0<(n=this._view.getCaretOffset()))n-=
1,a.getBaseModel&&(n=a.mapOffset(n),a=a.getBaseModel()),b=this._findBlock(this._rootBlock,n),a=this._findMatchingBracket(a,b,n),-1!==a&&(k=[m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),m.AnnotationType.createAnnotation(m.AnnotationType.ANNOTATION_CURRENT_BRACKET,n,n+1)]);this._bracketAnnotations=k;this._annotationModel.replaceAnnotations(d,k)}},_spliceStyles:function(a,d,b,e){for(var f=a.regex,l=f.lastIndex=0,k=f.exec(b);k;){for(k=e+k.index;l<d.length&&!(k<
d[l].end);)l++;var m={start:k,end:k+1,style:a.style};if(l<d.length&&d[l].start<=k){var n={start:k+1,end:d[l].end,style:d[l].style};d[l].end=k;d.splice(l+1,0,n);d.splice(l+1,0,m);l+=2}else d.splice(l,0,m),l++;k=f.exec(b)}},_updateFolding:function(a,e,b,f,l,k,m){k=k||a.start;m=m||a.end;if(!a.doNotFold&&a.start<=m&&k<=a.end){var n=d(f,a.start,!0);n<f.length&&f[n].start===a.start&&f[n].end===a.end||(n=this._createFoldingAnnotation(b,e,a.start,a.end))&&l.push(n);a.getBlocks().forEach(function(a){this._updateFolding(a,
e,b,f,l,k,m)}.bind(this))}},_caretLineStyle:{styleClass:"meta annotation currentLine"},_spacePattern:{regex:/[ ]/g,style:{styleClass:"punctuation separator space",unmergeable:!0}},_tabPattern:{regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}}};n.EventTarget.addMixin(e.prototype);return{TextStyler:e,Block:f,createPatternBasedAdapter:function(a,d){return new p(a,d)}}});
define("orion/editor/textMateStyler",["orion/regex"],function(m){function n(f){var l;if(f instanceof Array){l=Array(f.length);for(var e=0;e<f.length;e++)l[e]=n(f[e])}else for(e in l={},f)if(Object.prototype.hasOwnProperty.call(f,e)){var d=f[e];l[e]="object"===typeof d&&null!==d?n(d):d}return l}function p(f,l,e){this.initialize(f);this.grammar=n(l);this.externalGrammars=e?n(e):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var k={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(f){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(f){return"\x3d"===f[1]?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(f){return"atomic group"}}],toRegExp:function(f){function l(a,b){throw Error('Unsupported regex feature "'+a+'": "'+b[0]+'" at index: '+b.index+" in "+b.input);}var e="",d;f=k.processGlobalFlag("x",f,function(a){for(var b="",d=!1,e=a.length,f=0;f<e;){var l=a.charAt(f);if(!d&&"#"===l)for(;f<e&&"\r"!==l&&"\n"!==l;)l=a.charAt(++f);
else if(!d&&/\s/.test(l))for(;f<e&&/\s/.test(l);)l=a.charAt(++f);else"\\"===l?(b+=l,/\s/.test(a.charAt(f+1))||(b+=a.charAt(f+1),f+=1)):("["===l?d=!0:"]"===l&&(d=!1),b+=l),f+=1}return b});f=k.processGlobalFlag("i",f,function(a){e+="i";return a});for(d=0;d<this.unsupported.length;d++){var a;(a=this.unsupported[d].regex.exec(f))&&l(this.unsupported[d].func(a),a)}return RegExp(f,e)},processGlobalFlag:function(f,l,e){var d="(?"+f+")";f="(?"+f+":";if(l.substring(0,d.length)===d)return e(l.substring(d.length));
if(l.substring(0,f.length)===f){for(var d=0,a=l.length,h=-1,b=0;b<a&&-1===h;b++)switch(l.charAt(b)){case "\\":b++;break;case "(":d++;break;case ")":d--,0===d&&(h=b)}d=h;if(d<l.length-1)throw Error("Only a "+f+") group that encloses the entire regex is supported in: "+l);return e(l.substring(f.length,d))}return l},hasBackReference:function(f){return/\\\d+/.test(f.source)},getSubstitutedRegex:function(f,l,e){e="undefined"===typeof e?!0:!1;f=f.source.split(/(\\\d+)/g);for(var d=[],a=0;a<f.length;a++){var h=
f[a],b=/\\(\d+)/.exec(h);b?(h=l[b[1]]||"",d.push(e?m.escape(h):h)):d.push(h)}return RegExp(d.join(""))},groupify:function(f,l){for(var e=f.source,d=e.length,a=[],h=0,b=[],g=1,k=1,m=[],n={},p={},z=0;z<d;z++){var t=a[a.length-1],w=e.charAt(z);switch(w){case "(":4===t&&(a.pop(),m.push(")"),b[b.length-1].end=z);var A=z+2<d?e.charAt(z+1)+""+e.charAt(z+2):null;if("?:"===A||"?\x3d"===A||"?!"===A){var x;"?:"===A?x=1:(x=3,h++);a.push(x);b.push({start:z,end:-1,type:x});m.push(w);m.push(A);z+=A.length}else a.push(2),
b.push({start:z,end:-1,type:2,oldNum:g,num:k}),m.push(w),0===h&&(p[k]=null),n[g]=k,g++,k++;break;case ")":t=a.pop();3===t&&h--;b[b.length-1].end=z;m.push(w);break;case "*":case "+":case "?":case "}":var C=w,s=e.charAt(z-1),A=z-1;if("}"===w){for(x=z-1;"{"!==e.charAt(x)&&0<=x;x--);s=e.charAt(x-1);A=x-1;C=e.substring(x,z+1)}x=b[b.length-1];if(")"===s&&(2===x.type||4===x.type)){m.splice(x.start,0,"(");m.push(C);m.push(")");w={start:x.start,end:m.length-1,type:4,num:x.num};for(s=0;s<b.length;s++)if(t=
b[s],(2===t.type||4===t.type)&&t.start>=x.start&&t.end<=A)t.start+=1,t.end+=1,t.num+=1,2===t.type&&(n[t.oldNum]=t.num);b.push(w);k++;break}default:"|"!==w&&(2!==t&&4!==t)&&0===h&&(a.push(4),b.push({start:z,end:-1,type:4,num:k}),m.push("("),p[k]=null,k++),m.push(w),"\\"===w&&(w=e.charAt(z+1),m.push(w),z+=1)}}for(;a.length;)a.pop(),m.push(")");e=RegExp(m.join(""));d={};l=l||n;for(var y in l)l.hasOwnProperty(y)&&(d[y]="\\"+l[y]);e=this.getSubstitutedRegex(e,d,!1);return[e,n,p]},complexCaptures:function(f){if(!f)return!1;
for(var l in f)if(f.hasOwnProperty(l)&&"0"!==l)return!0;return!1}};p.prototype={initialize:function(f){this.textView=f;this.textView.stylerOptions=this;var l=this;this._listener={onModelChanged:function(e){l.onModelChanged(e)},onDestroy:function(e){l.onDestroy(e)},onLineStyle:function(e){l.onLineStyle(e)},onStorage:function(e){l.onStorage(e)}};f.addEventListener("ModelChanged",this._listener.onModelChanged);f.addEventListener("Destroy",this._listener.onDestroy);f.addEventListener("LineStyle",this._listener.onLineStyle);
f.redrawLines()},onDestroy:function(f){this.destroy()},destroy:function(){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(f){for(f=[f];0!==f.length;){var l=f.pop();if(!l._resolvedRule||!l._typedRule)if(l._resolvedRule=
this._resolve(l),l._typedRule=this._createTypedRule(l),this.addStyles(l.name),this.addStyles(l.contentName),this.addStylesForCaptures(l.captures),this.addStylesForCaptures(l.beginCaptures),this.addStylesForCaptures(l.endCaptures),l._resolvedRule!==l&&f.push(l._resolvedRule),l.patterns)for(var e=0;e<l.patterns.length;e++)f.push(l.patterns[e])}},addStyles:function(f){if(f&&!this._styles[f]){this._styles[f]=[];for(var l=f.split("."),e=0;e<l.length;e++)this._styles[f].push(l.slice(0,e+1).join("-"))}},
addStylesForCaptures:function(f){for(var l in f)f.hasOwnProperty(l)&&this.addStyles(f[l].name)},ContainerRule:function(){function f(f){this.rule=f;this.subrules=f.patterns}f.prototype.valueOf=function(){return"aa"};return f}(),BeginEndRule:function(){function f(f){this.rule=f;this.beginRegex=k.toRegExp(f.begin);this.endRegex=k.toRegExp(f.end);this.subrules=f.patterns||[];this.endRegexHasBackRef=k.hasBackReference(this.endRegex);var e=k.complexCaptures(f.captures);f=k.complexCaptures(f.beginCaptures)||
k.complexCaptures(f.endCaptures);if(this.isComplex=e||f)e=k.groupify(this.beginRegex),this.beginRegex=e[0],this.beginOld2New=e[1],this.beginConsuming=e[2],e=k.groupify(this.endRegex,this.beginOld2New),this.endRegex=e[0],this.endOld2New=e[1],this.endConsuming=e[2]}f.prototype.valueOf=function(){return this.beginRegex};return f}(),MatchRule:function(){function f(f){this.rule=f;this.matchRegex=k.toRegExp(f.match);if(this.isComplex=k.complexCaptures(f.captures))f=k.groupify(this.matchRegex),this.matchRegex=
f[0],this.matchOld2New=f[1],this.matchConsuming=f[2]}f.prototype.valueOf=function(){return this.matchRegex};return f}(),_createTypedRule:function(f){return f.match?new this.MatchRule(f):f.begin?new this.BeginEndRule(f):new this.ContainerRule(f)},_resolve:function(f){var l=f;if(f.include){if(f.begin||f.end||f.match)throw Error('Unexpected regex pattern in "include" rule '+f.include);f=f.include;if("#"===f.charAt(0)){if(l=this.grammar.repository&&this.grammar.repository[f.substring(1)],!l)throw Error("Couldn't find included rule "+
f+" in grammar repository");}else if("$self"===f)l=this.grammar;else{if("$base"===f)throw Error('Include "$base" is not supported');l=this._allGrammars[f];if(!l)for(var e=0;e<this.externalGrammars.length;e++){var d=this.externalGrammars[e];if(d.scopeName===f){this.preprocess(d);l=this._allGrammars[f]=d;break}}}}return l},ContainerNode:function(){function f(f,e){this.parent=f;this.rule=e;this.children=[];this.end=this.start=null}f.prototype.addChild=function(f){this.children.push(f)};f.prototype.valueOf=
function(){var f=this.rule;return"ContainerNode { "+(f.include||"")+" "+(f.name||"")+(f.comment||"")+"}"};return f}(),BeginEndNode:function(){function f(f,e,d){this.parent=f;this.rule=e;this.children=[];this.setStart(d);this.endMatch=this.end=null;this.endRegexSubstituted=e.endRegexHasBackRef?k.getSubstitutedRegex(e.endRegex,d):null}f.prototype.addChild=function(f){this.children.push(f)};f.prototype.getIndexInParent=function(f){return this.parent?this.parent.children.indexOf(this):-1};f.prototype.setStart=
function(f){this.start=f.index;this.beginMatch=f};f.prototype.setEnd=function(f){f&&"object"===typeof f?(this.endMatch=f,this.end=f.index+f[0].length):(this.endMatch=null,this.end=f)};f.prototype.shiftStart=function(f){this.start+=f;this.beginMatch.index+=f};f.prototype.shiftEnd=function(f){this.end+=f;this.endMatch&&(this.endMatch.index+=f)};f.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range\x3d"+this.start+".."+this.end+"}"};return f}(),push:function(f,l){if(l)for(var e=l.length;0<
e;)f.push(l[--e])},exec:function(f,l,e){if(l=f.exec(l))l.index+=e;f.lastIndex=0;return l},afterMatch:function(f){return f.index+f[0].length},getEndMatch:function(f,l,e){if(f instanceof this.BeginEndNode){var d=f.rule;f=f.endRegexSubstituted||d.endRegex;return!f?null:this.exec(f,l,e)}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(f){var l=f.addedCharCount,
e=f.removedCharCount;f=f.start;if(this._tree){var d=this.textView.getModel(),a=d.getCharCount(),d=d.getLineEnd(d.getLineAtOffset(f)-1),h=this.getFirstDamaged(d,d),d=-1===d?0:d,l=h?this.parse(h,!0,d,f,l,e):a;this.textView.redrawRange(d,l)}else this.initialParse()},getFirstDamaged:function(f,l){if(0>f)return this._tree;for(var e=[this._tree],d=null;e.length;){var a=e.pop();if(!a.parent||this.isDamaged(a,f,l)){a instanceof this.BeginEndNode&&(d=a);for(var h=0;h<a.children.length;h++)e.push(a.children[h])}}return d||
this._tree},isDamaged:function(f,l,e){return f.start<=e&&f.end>l},parse:function(f,l,e,d,a,h){var b=this.textView.getModel(),g=b.getLineStart(b.getLineCount()-1),k=b.getCharCount(),m=this.getInitialExpected(f,e),n=-1;l&&(f.repaired=!0,f.endNeedsUpdate=!0,n=(n=f.children[f.children.length-1])?b.getLineEnd(b.getLineAtOffset(n.end+(a-h))):-1,d=b.getLineEnd(b.getLineAtOffset(d+h)),n=Math.max(n,d));n=-1===n?k:n;d=m;for(var p=f,z=!1,t=e,w=-1;p&&(!l||t<n);){var A=this.getNextMatch(b,p,t);A||(t=t>=g?k:b.getLineStart(b.getLineAtOffset(t)+
1));var x=A&&A.match,C=A&&A.rule,s=A&&A.isEnd;if(A&&A.isSub)t=this.afterMatch(x),C instanceof this.BeginEndRule&&(z=!0,l&&C===d.rule&&p===d.parent?(p=d,p.setStart(x),p.repaired=!0,p.endNeedsUpdate=!0,d=this.getNextExpected(d,"begin")):(l&&(this.prune(p,d),l=!1),x=new this.BeginEndNode(p,C,x),p.addChild(x),p=x));else if(s||t===k)p instanceof this.BeginEndNode&&(x?(z=!0,w=Math.max(w,p.end),p.setEnd(x),t=this.afterMatch(x),l&&p===d&&p.parent===d.parent?(p.repaired=!0,delete p.endNeedsUpdate,d=this.getNextExpected(d,
"end")):l&&(this.prune(p,d),l=!1)):(p.setEnd(k),delete p.endNeedsUpdate)),p=p.parent;l&&(t>=n&&!z)&&(this.prune(f,m),l=!1)}this.removeUnrepairedChildren(f,l,e);this.cleanup(l,f,e,n,k,a,h);return l?Math.max(w,t):t},removeUnrepairedChildren:function(f,l,e){if(l){l=f.children;for(var d=-1,a=0;a<l.length;a++){var h=l[a];if(!h.repaired&&this.isDamaged(h,e,Number.MAX_VALUE)){d=a;break}}-1!==d&&(f.children.length=d)}},cleanup:function(f,l,e,d,a,h,b){if(f){f=h-b;a=this.getIntersecting(d-f+1,a);l=this.getIntersecting(e,
d);for(e=0;e<a.length;e++)d=a[e],!d.repaired&&d instanceof this.BeginEndNode&&(d.shiftEnd(f),d.shiftStart(f));for(e=0;e<l.length;e++)d=l[e],d.repaired&&d.endNeedsUpdate&&d.shiftEnd(f),delete d.endNeedsUpdate,delete d.repaired}else{l=this.getIntersecting(e,d);for(e=0;e<l.length;e++)delete l[e].repaired}},getNextMatch:function(f,l,e,d){var a=f.getLineAtOffset(e),a=f.getLineEnd(a),h=f.getText(e,a),b=[],g=[];f=[];a=[];for(this.push(b,l.rule.subrules);b.length;){var k=b.length?b.pop():null,k=k&&k._resolvedRule._typedRule;
if(k instanceof this.ContainerRule&&-1===g.indexOf(k))g.push(k),this.push(b,k.subrules);else if(!k||!d||k.matchRegex){var m=k&&this.exec(k.matchRegex||k.beginRegex,h,e);m&&(f.push(m),a.push(k))}}b=Number.MAX_VALUE;g=-1;for(k=0;k<f.length;k++)m=f[k],m.index<b&&(b=m.index,g=k);if(!d&&(e=this.getEndMatch(l,h,e)))if(d=l.rule.applyEndPatternLast,-1===g||e.index<b||!d&&e.index===b)return{isEnd:!0,rule:l.rule,match:e};return-1===g?null:{isSub:!0,rule:a[g],match:f[g]}},getInitialExpected:function(f,l){var e,
d;if(f===this._tree)for(e=0;e<f.children.length;e++){if(d=f.children[e],d.start>=l)return d}else if(f instanceof this.BeginEndNode&&f.endMatch){var a=f.endMatch.index;for(e=0;e<f.children.length&&!(d=f.children[e],d.start>=l);e++);if(d&&d.start<a)return d}return f},getNextExpected:function(f,l){if("begin"===l){var e=f.children[0];return e?e:f}if("end"===l&&(e=f.parent)){var d=e.children[e.children.indexOf(f)+1];return d?d:e}return null},prune:function(f,l){l.parent===f?f.children.length=l.getIndexInParent():
f instanceof this.BeginEndNode&&(f.endMatch=null,f.end=null);f.parent&&(f.parent.children.length=f.getIndexInParent()+1)},onLineStyle:function(f){this._tree||this.initialParse();var l=f.lineStart,e=this.textView.getModel(),d=e.getLineEnd(f.lineIndex),a=e.getLineEnd(e.getLineAtOffset(l)-1),a=this.getFirstDamaged(a,a),l=this.getLineScope(e,a,l,d);f.ranges=this.toStyleRanges(l);f.ranges.sort(function(a,b){return a.start-b.start})},getLineScope:function(f,l,e,d){for(var a=e,h=this.getInitialExpected(l,
e),b=[],g=[];l&&a<d;){var k=this.getNextMatch(f,l,a);if(!k)break;var m=k&&k.match,n=k&&k.rule,p=k&&k.isSub,k=k&&k.isEnd;m.index!==a&&g.push({start:a,end:m.index,node:l});p?(a=this.afterMatch(m),n instanceof this.BeginEndRule?(this.addBeginScope(b,m,n),l=h,h=this.getNextExpected(h,"begin")):this.addMatchScope(b,m,n)):k&&(a=this.afterMatch(m),this.addEndScope(b,m,n),h=this.getNextExpected(h,"end"),l=l.parent)}a<d&&g.push({start:a,end:d,node:l});f=this.getInheritedLineScope(g,e,d);return b.concat(f)},
getInheritedLineScope:function(f,l,e){l=[];for(e=0;e<f.length;e++)for(var d=f[e],a=d.node;a;){var h=a.rule.rule,b=h.name;if(h=h.contentName||b){this.addScopeRange(l,d.start,d.end,h);break}a=a.parent}return l},addBeginScope:function(f,l,e){var d=e.rule;this.addCapturesScope(f,l,d.beginCaptures||d.captures,e.isComplex,e.beginOld2New,e.beginConsuming)},addEndScope:function(f,l,e){var d=e.rule;this.addCapturesScope(f,l,d.endCaptures||d.captures,e.isComplex,e.endOld2New,e.endConsuming)},addMatchScope:function(f,
l,e){var d=e.rule,a=d.name;(d=d.captures)?this.addCapturesScope(f,l,d,e.isComplex,e.matchOld2New,e.matchConsuming):this.addScope(f,l,a)},addScope:function(f,l,e){e&&f.push({start:l.index,end:this.afterMatch(l),scope:e})},addScopeRange:function(f,l,e,d){d&&f.push({start:l,end:e,scope:d})},addCapturesScope:function(f,l,e,d,a,h){if(e)if(d){d={1:0};for(var b=0,g=1;void 0!==l[g];g++)void 0!==h[g]&&(b+=l[g].length),void 0!==l[g+1]&&(d[g+1]=b);h=l.index;for(b=1;e[b];b++){var g=e[b].name,k=a[b],m=h+d[k];
"undefined"!==typeof l[k]&&this.addScopeRange(f,m,m+l[k].length,g)}}else this.addScope(f,l,e[0]&&e[0].name)},getIntersecting:function(f,l){for(var e=[],d=this._tree?[this._tree]:[];d.length;){var a=d.pop(),h=!1;a instanceof this.ContainerNode?h=!0:this.isDamaged(a,f,l)&&(h=!0,e.push(a));if(h)for(var h=a.children.length,b=0;b<h;b++)d.push(a.children[b])}return e.reverse()},toStyleRanges:function(f){for(var l=[],e=0;e<f.length;e++){var d=f[e],a=this._styles[d.scope];if(!a)throw Error("styles not found for "+
d.scope);a=a.join(" ");l.push({start:d.start,end:d.end,style:{styleClass:a}})}return l}};return{RegexUtil:k,TextMateStyler:p}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(m,n){function p(e){return-1!==e.getProperty("objectClass").indexOf(f)&&"highlighter"===e.getProperty("type")}function k(e,d,a){this.initialize(e,d,a);this.lineStyles=[]}var f="orion.edit.highlighter",l=f+" service must be an event emitter";n.AnnotationType.registerType("orion.annotation.highlightError",{title:m.syntaxError,html:"\x3cdiv class\x3d'annotationHTML error'\x3e\x3c/div\x3e",rangeStyle:{styleClass:"annotationRange error"}});
k.prototype={initialize:function(e,d,a){this.textView=e;this.serviceRegistry=d;this.annotationModel=a;this.services=[];var h=this;this.listener={onModelChanging:function(a){h.onModelChanging(a)},onModelChanged:function(a){h.onModelChanged(a)},onDestroy:function(a){h.onDestroy(a)},onLineStyle:function(a){h.onLineStyle(a)},onStyleReady:function(a){h.onStyleReady(a)},onServiceAdded:function(a){h.onServiceAdded(a.serviceReference,h.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){h.onServiceRemoved(a.serviceReference,
h.serviceRegistry.getService(a.serviceReference))}};e.addEventListener("ModelChanging",this.listener.onModelChanging);e.addEventListener("ModelChanged",this.listener.onModelChanged);e.addEventListener("Destroy",this.listener.onDestroy);e.addEventListener("LineStyle",this.listener.onLineStyle);d.addEventListener("registered",this.listener.onServiceAdded);d.addEventListener("unregistering",this.listener.onServiceRemoved);e=d.getServiceReferences(f);for(a=0;a<e.length;a++){var b=e[a];p(b)&&this.addServiceListener(d.getService(b))}},
onDestroy:function(e){this.destroy()},destroy:function(){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 e=0;e<this.services.length;e++)this.removeServiceListener(this.services[e]);this.services=
null}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(e){this.startLine=this.textView.getModel().getLineAtOffset(e.start)},onModelChanged:function(e){var d=this.startLine;(e.addedLineCount||e.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[d,e.removedLineCount].concat(this._getEmptyStyle(e.addedLineCount)))},
onStyleReady:function(e){var d=e.lineStyles||e.style;e=Number.MAX_VALUE;var a=-1,f=this.textView.getModel(),b;for(b in d)Object.prototype.hasOwnProperty.call(d,b)&&(this.lineStyles[b]=d[b],e=Math.min(e,b),a=Math.max(a,b));e=Math.max(e,0);a=Math.min(a,f.getLineCount());if(d=this.annotationModel){for(var g=d.getAnnotations(f.getLineStart(e),f.getLineEnd(a)),l=[];g.hasNext();){var k=g.next();"orion.annotation.highlightError"===k.type&&l.push(k)}g=[];for(k=e;k<=a;k++){b=k;var m=this.lineStyles[b],m=m&&
m.errors;b=f.getLineStart(b);if(m)for(var p=0;p<m.length;p++){var z=m[p];g.push(n.AnnotationType.createAnnotation("orion.annotation.highlightError",z.start+b,z.end+b))}}d.replaceAnnotations(l,g)}this.textView.redrawLines(e,a+1)},onLineStyle:function(e){var d=this.lineStyles[e.lineIndex];if(d)if(d.ranges){for(var d=d.ranges,a=e.lineStart,f=d.length,b=[],g=0;g<f;g++){var k=d[g];b.push({start:k.start+a,end:k.end+a,style:k.style})}e.ranges=b}else d.style&&(e.style=d.style)},_getEmptyStyle:function(e){for(var d=
[],a=0;a<e;a++)d.push(null);return d},setContentType:function(e){this.contentType=e;if(this.services)for(e=0;e<this.services.length;e++){var d=this.services[e];if(d.setContentType){var a=this.serviceRegistry.getService("orion.page.progress");a?a.progress(d.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):d.setContentType(this.contentType)}}},onServiceAdded:function(e,d){p(e)&&this.addServiceListener(d)},onServiceRemoved:function(e,
d){-1!==this.services.indexOf(d)&&this.removeServiceListener(d)},addServiceListener:function(e){if("function"===typeof e.addEventListener){if(e.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(e),e.setContentType&&this.contentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(e.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):e.setContentType(this.contentType)}}else"undefined"!==
typeof console&&console.log(Error(l))},removeServiceListener:function(e){"function"===typeof e.removeEventListener?(e.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),e=this.services.indexOf(e),-1!==e&&this.services.splice(e,1)):"undefined"!==typeof console&&console.log(Error(l))}};return k});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(m,n,p,k,f){function l(a,e,b,g,l,v,q){function r(a,d){var g=a.getProperty("contentType")||a.getProperty("contentTypes"),l=a.getProperty("fileTypes");return g?f.when(e.isSomeExtensionOf(b,g)).then(function(b){return b?a:null}):d&&l&&-1!==l.indexOf(d)?(g=new f,g.resolve(a),g):null}function z(a){var b=null;switch(a&&a.id){case "application/javascript":case "application/json":b=
new m.TextStyler(g,"js",l);break;case "text/x-java-source":b=new m.TextStyler(g,"java",l);break;case "text/css":b=new m.TextStyler(g,"css",l)}return b}if(!d){var t=z(b);if(t)return v=new f,v.resolve(t),v}d&&!this.orionGrammars&&(this.orionGrammars={});t=v&&v.split(".").pop().toLowerCase();v=a.getServiceReferences("orion.edit.highlighter");for(var w=[],A=[],x=0;x<v.length;x++){var C=v[x],s=C.getProperty("type");"grammar"===s||!d&&"undefined"===typeof s?w.push(C.getProperty("grammar")):"highlighter"!==
s&&(s=C.getProperty("id"))&&!this.orionGrammars[s]&&(this.orionGrammars[s]={id:s,contentTypes:C.getProperty("contentTypes"),patterns:C.getProperty("patterns"),repository:C.getProperty("repository")});(C=r(C,t))&&A.push(C)}return f.all(A,function(a){return{_error:a}}).then(function(e){for(var f,h=e.length-1;0<=h;h--){var m=e[h];if(m&&!m._error&&(q||"highlighter"!==m.getProperty("type"))){f=m;break}}var t;if(f)if(e=f.getProperty("type"),"highlighter"===e)t=new k(g,a,l),t.setContentType(b);else if("grammar"===
e||!d&&"undefined"===typeof e)f=f.getProperty("grammar"),t=new p.TextMateStyler(g,f,w);else if(d){t=[];for(var s in this.orionGrammars)t.push(this.orionGrammars[s]);f=new n.createPatternBasedAdapter(t,f.getProperty("id"));t=new n.TextStyler(g,l,f)}return t})}function e(a,d){this.serviceRegistry=a;this.contentTypeService=d;this.styler=null}var d=1;e.prototype={setup:function(a,d,b,e,f){f="undefined"===typeof f?!0:f;this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null);var k=this;
return l(this.serviceRegistry,this.contentTypeService?this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),a,d,b,e,f).then(function(a){return k.styler=a})},getStyler:function(){return this.styler}};return{createStyler:l,SyntaxHighlighter:e}});
define("orion/markOccurrences",["orion/edit/editorContext","orion/Deferred"],function(m,n){function p(k,f,l){this.registry=k;this.inputManager=f;this.editor=l}p.prototype={setOccurrencesVisible:function(k){this.occurrencesVisible!==k&&((this.occurrencesVisible=k)||this.editor.showOccurrences([]))},findOccurrences:function(){function k(a,d,b){function e(a,b,d){a=b.getProperty("contentType");return f.isSomeExtensionOf(d,a).then(function(a){return a?b:null})}for(var f=a.getService("orion.core.contentTypeRegistry"),
l=a.getServiceReferences("orion.edit.occurrences"),k=[],m=0;m<l.length;m++){var p=l[m],t=p.getProperty("pattern");p.getProperty("contentType")?k.push(e(a,p,d)):t&&RegExp(t).test(b)&&(t=new n,t.resolve(p),k.push(t))}return n.all(k,function(a){return{_error:a}}).then(function(a){for(var b=[],d=0;d<a.length;d++){var e=a[d];e&&!e._error&&b.push(e)}return b})}var f,l=this,e=l.registry.getService("orion.edit.occurrences"),d=function(a){f&&window.clearTimeout(f);l.occurrencesVisible&&(f=window.setTimeout(function(){f=
null;var a={selection:l.editor.getSelection(),contentType:l.inputManager.getContentType().id};e.computeOccurrences(m.getEditorContext(l.registry),a).then(function(a){l.editor.showOccurrences(a)})},500))};l.inputManager.addEventListener("InputChanged",function(a){var e=l.editor.getTextView();e&&(e.removeEventListener("Selection",d),k(l.registry,a.contentType,a.title).then(function(a){!a||0===a.length?f&&window.clearTimeout(f):e.addEventListener("Selection",d)}))})}};return{MarkOccurrences:p}});
define("orion/syntaxchecker",["orion/Deferred","orion/edit/editorContext"],function(m,n){return{SyntaxChecker:function(){function p(f,l){this.registry=f;this.editor=l}function k(f,l,e){f=Math.max(f,l);return f=Math.min(f,e)}p.prototype={checkSyntax:function(f,l,e,d){function a(a,b){function d(a,b,f){a=b.getProperty("contentType");return e.isSomeExtensionOf(f,a).then(function(a){return a?b:null})}for(var e=a.getService("orion.core.contentTypeRegistry"),f=a.getServiceReferences("orion.edit.validator"),
h=[],k=0;k<f.length;k++){var n=f[k],p=n.getProperty("pattern");n.getProperty("contentType")?h.push(d(a,n,b)):p&&RegExp(p).test(l)&&(p=new m,p.resolve(n),h.push(p))}return m.all(h,function(a){return{_error:a}}).then(function(a){for(var b=[],d=0;d<a.length;d++){var e=a[d];e&&!e._error&&b.push(e)}return b})}if(f&&!e){var h=this,b=this.registry;a(b,f).then(function(a){var e=function(a){a=a||{};a=a.problems||a.errors||a;return Array.isArray(a)?a:[]},k=b.getService("orion.page.progress");a=a.map(function(a){a=
b.getService(a);var g;a.computeProblems?(g={contentType:f.id,title:l},g=a.computeProblems(n.getEditorContext(b),g)):a.checkSyntax&&(g=a.checkSyntax(l,d));return k.progress(g,"Validating "+l).then(e)});m.all(a,function(a){return{_error:a}}).then(function(a){for(var d=[],e=0;e<a.length;e++){var f=a[e];f._error||(h._fixup(f),d=d.concat(f))}b.getService("orion.core.marker")._setProblems(d)})})}},_fixup:function(f){for(var l=this.editor.getModel(),e=0;e<f.length;e++){var d=f[e];d.description=d.description||
d.reason;d.severity=d.severity||"error";d.start="number"===typeof d.start?d.start:d.character;if("number"===typeof d.line){var a=l.getLine(d.line-1,!1).length;d.start=k(d.start,1,a-1);d.end="number"===typeof d.end?d.end:-1;d.end=k(d.end,d.start+1,a)}else if(a=l.getCharCount(),d.start=k(d.start,0,a),d.end="number"===typeof d.end?d.end:-1,d.end=k(d.end,d.start,a),d.end===a&&1<l.getLineCount()&&a===l.getLineStart(l.getLineCount()-1)){var h=l.getLineCount()-2,a=l.getLineStart(h),h=l.getLineEnd(h);a===
h?d.start=d.end=h:(d.start=h-1,d.end=h)}}}};return p}()}});
define("orion/editorView","i18n!orion/edit/nls/messages orion/editor/editor orion/editor/eventTarget orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/editorFeatures orion/editor/contentAssist orion/editor/emacs orion/editor/vi orion/editorPreferences orion/widgets/themes/ThemePreferences orion/widgets/themes/editor/ThemeData orion/widgets/settings/EditorSettings orion/searchAndReplace/textSearcher orion/editorCommands orion/globalCommands orion/edit/dispatcher orion/edit/editorContext orion/edit/typedefs orion/highlight orion/markOccurrences orion/syntaxchecker orion/keyBinding orion/uiUtils orion/util orion/objects".split(" "),function(m,
n,p,k,f,l,e,d,a,h,b,g,u,v,q,r,z,t,w,A,x,C,s,y,D,E,B){function L(a){this._parent=a.parent;this.renderToolbars=a.renderToolbars;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progress;this.statusService=a.statusService;this.fileClient=a.fileService;this.inputManager=a.inputManager;this.preferences=a.preferences;this.readonly=a.readonly;this.searcher=a.searcher;this.statusReporter=a.statusReporter;this.model=
a.model;this.undoStack=a.undoStack;this.syntaxHighlighter=new x.SyntaxHighlighter(this.serviceRegistry);this.typeDefRegistry=new A(this.serviceRegistry);(a=z.getKeyAssist())&&a.addProvider(this);var b=z.getMainSplitter();b&&b.splitter.addEventListener("resize",function(a){this.editor&&a.node===b.main&&this.editor.resize()}.bind(this));z.getGlobalEventTarget().addEventListener("toggleTrim",function(a){this.editor&&this.editor.resize()}.bind(this));this.settings={};this._init()}L.prototype={updateKeyMode:function(b,
d){this.emacs&&d.removeKeyMode(this.emacs);this.vi&&d.removeKeyMode(this.vi);"Emacs"===b.keyBindings?(this.emacs||(this.emacs=new a.EmacsMode(d)),d.addKeyMode(this.emacs)):"vi"===b.keyBindings&&(this.vi||(this.vi=new h.VIMode(d,this.statusReporter)),d.addKeyMode(this.vi))},getParent:function(){return this._parent},getSettings:function(){return this.settings},setParent:function(a){this._parent=a},updateSourceCodeActions:function(a,b){b&&(b.setAutoPairParentheses(a.autoPairParentheses),b.setAutoPairBraces(a.autoPairBraces),
b.setAutoPairSquareBrackets(a.autoPairSquareBrackets),b.setAutoPairAngleBrackets(a.autoPairAngleBrackets),b.setAutoPairQuotations(a.autoPairQuotations),b.setAutoCompleteComments(a.autoCompleteComments),b.setSmartIndentation(a.smartIndentation))},updateViewOptions:function(a){var b=0;a.showMargin&&(b=a.marginOffset,"number"!==typeof b&&(b=a.marginOffset=parseInt(b,10)));var d=0;a.wordWrap&&(d=b);return{readonly:this.readonly||this.inputManager.getReadOnly(),tabSize:a.tabSize||4,expandTab:a.expandTab,
wrapMode:a.wordWrap,wrapOffset:d,marginOffset:b,scrollAnimation:a.scrollAnimation?a.scrollAnimationTimeout:0}},updateSettings:function(a){this.settings=a;var b=this.editor,d=this.inputManager;d.setAutoLoadEnabled(a.autoLoad);d.setAutoSaveTimeout(a.autoSave?a.autoSaveTimeout:-1);d.setSaveDiffsEnabled(a.saveDiffs);this.updateStyler(a);var e=b.getTextView();e&&(this.updateKeyMode(a,e),e.setOptions(this.updateViewOptions(a)));this.updateSourceCodeActions(a,b.getSourceCodeActions());b.setAnnotationRulerVisible(a.annotationRuler);
b.setLineNumberRulerVisible(a.lineNumberRuler);b.setFoldingRulerVisible(a.foldingRuler);b.setOverviewRulerVisible(a.overviewRuler);this.renderToolbars&&this.renderToolbars(d.getFileMetadata());this.markOccurrences.setOccurrencesVisible(a.showOccurrences);b.getContentAssist()&&b.getContentAssist().setAutoTriggerEnabled(a.contentAssistAutoTrigger);this.dispatchEvent({type:"Settings",newSettings:this.settings})},updateStyler:function(a){var b=this.syntaxHighlighter.getStyler();b&&(b.setTabsVisible&&
b.setTabsVisible(a.showTabs),b.setSpacesVisible&&b.setSpacesVisible(a.showSpaces))},showKeyBindings:function(a){var b=this.editor;if(b&&b.getTextView&&b.getTextView()){var d=b.getTextView(),e=d.getActions(!0).filter(function(a){return(a=d.getActionDescription(a))&&a.name});e.sort(function(a,b){return d.getActionDescription(a).name.localeCompare(d.getActionDescription(b).name)});a.createHeader(m.Editor);for(var f=function(a){return function(){d.focus();return d.invokeAction(a)}},b={},g,h=0;h<e.length;h++)for(var k=
e[h],l=d.getActionDescription(k),n=d.getKeyBindings(k),p=0;p<n.length;p++){g=n[p];var q=D.getUserKeyString(g);g.scopeName?(b[g.scopeName]||(b[g.scopeName]=[]),b[g.scopeName].push({bindingString:q,name:l.name,execute:f(k)})):a.createItem(q,l.name,f(k))}for(var t in b)if(b[t].length){a.createHeader(t);for(e=0;e<b[t].length;e++)g=b[t][e],a.createItem(g.bindingString,g.name,g.execute)}}},_init:function(){var a=null;this.preferences&&(a=this.editorPreferences=new b.EditorPreferences(this.preferences,function(b){b?
this.updateSettings(b):a.getPrefs(this.updateSettings.bind(this))}.bind(this)));var h=null;this.preferences&&(h=new g.ThemePreferences(this.preferences,new u.ThemeData),h.apply());var p,x=this,A=this.readonly,z=this.commandRegistry,D=this.serviceRegistry,L=this.fileClient,T=this.inputManager,S=this.searcher,U=this.progress,X=this.contentTypeRegistry,V=function(a,b,d){var e=T.getContentType(),f=a.getTitle();a=D.getServiceReferences("orion.edit.contentAssist").concat(D.getServiceReferences("orion.edit.contentassist"));
(d=d&&d.providers)||(d=a.map(function(a){var b=a.getProperty("contentType"),d=a.getProperty("pattern");if(b&&X.isSomeExtensionOf(e,b)||d&&RegExp(d).test(f)){var b=D.getService(a),d=a.getProperty("service.id").toString(),g=a.getProperty("charTriggers");a=a.getProperty("excludedStyles");g&&(g=RegExp(g));a&&(a=RegExp(a));return{provider:b,id:d,charTriggers:g,excludedStyles:a}}return null}).filter(function(a){return!!a}));var g={};Object.keys(w).forEach(function(a){"function"===typeof w[a]&&(g[a]=w[a].bind(null,
D))});b.setEditorContextProvider(g);b.setProviders(d);b.setAutoTriggerEnabled(x.settings.contentAssistAutoTrigger);b.setProgress(U);b.setStyleAccessor(x.getStyleAccessor())},W=A?null:{createContentAssistMode:function(a){var b=new d.ContentAssist(a.getTextView());b.addEventListener("Activating",V.bind(null,a,b));var e=new d.ContentAssistWidget(b,"contentassist"),e=new d.ContentAssistMode(b,e);b.setMode(e);V(a,b);b.initialize();return e}},K=this.editor=new n.Editor({textViewFactory:function(){var a=
x.updateViewOptions(x.settings);B.mixin(a,{parent:x._parent,model:new l.ProjectionTextModel(x.model||new f.TextModel),wrappable:!0});return new k.TextView(a)},undoStackFactory:x.undoStack?{createUndoStack:function(a){x.undoStack.setView(a.getTextView());return x.undoStack}}:new e.UndoFactory,textDNDFactory:new e.TextDNDFactory,annotationFactory:new e.AnnotationFactory,foldingRulerFactory:new e.FoldingRulerFactory,lineNumberRulerFactory:new e.LineNumberRulerFactory,contentAssistFactory:W,keyBindingFactory:function(b,
d,f,g){d=new q.TextSearcher(b,D,z,f);f=(new e.KeyBindingsFactory).createKeyBindings(b,f,g,d);x.updateSourceCodeActions(x.settings,f.sourceCodeActions);(new r.EditorCommandFactory({serviceRegistry:D,commandRegistry:z,fileClient:L,inputManager:T,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",readonly:A,navToolbarId:"pageNavigationActions",textSearcher:d,searcher:S,editorSettings:function(){return x.settings},localSettings:p})).generateEditorCommands(b);var h=b.getTextView();
if(b=z.findCommand("orion.keyAssist"))h.setKeyBinding(new y.KeyStroke(191,!1,!0,!E.isMac,E.isMac),b.id),h.setAction(b.id,b.callback,b);h.setAction("toggleWrapMode",function(){h.invokeAction("toggleWrapMode",!0);var b=h.getOptions("wrapMode");x.settings.wordWrap=b;a&&a.setPrefs(x.settings);return!0});x.vi=x.emacs=null;x.updateKeyMode(x.settings,h);return f},statusReporter:this.statusReporter,domNode:this._parent});K.id="orion.editor";K.processParameters=function(a){for(var b=["start","end","line",
"offset","length"],d=0;d<b.length;d++){var e=b[d];a[e]&&(a[e]=parseInt(a[e],10))}this.showSelection(a.start,a.end,a.line,a.offset,a.length)};this.dispatcher=new t.Dispatcher(this.serviceRegistry,K,T);h&&a&&(p=new v({local:!0,editor:K,themePreferences:h,preferences:a}));T.addEventListener("InputChanged",function(a){var b=K.getTextView();b&&(b.setOptions(this.updateViewOptions(this.settings)),this.syntaxHighlighter.setup(a.contentType,K.getTextView(),K.getAnnotationModel(),a.title,!0).then(function(){this.updateStyler(this.settings);
K.getContentAssist()&&V(K,K.getContentAssist())}.bind(this)))}.bind(this));T.addEventListener("Saving",function(a){x.settings.trimTrailingWhiteSpace&&K.getTextView().invokeAction("trimTrailingWhitespaces")});(h=D.getService("orion.core.marker"))&&h.addEventListener("problemsChanged",function(a){K.showProblems(a.problems)});(h=D.getService("orion.core.blame"))&&h.addEventListener("blameChanged",function(a){K.showBlame(a.blameInfo)});h=this.markOccurrences=new C.MarkOccurrences(D,T,K);h.setOccurrencesVisible(this.settings.occurrencesVisible);
h.findOccurrences();var J=new s.SyntaxChecker(D,K);K.addEventListener("InputChanged",function(a){J.checkSyntax(T.getContentType(),a.title,a.message,a.contents);T.getReadOnly()&&K.reportStatus(m.readonly,"error")});var F={};"getCaretOffset setCaretOffset getSelection setSelection getText setText getLineAtOffset getLineStart".split(" ").forEach(function(a){F[a]=K[a].bind(K)});D.registerService("orion.edit.context",F,null);this.editorPreferences&&this.editorPreferences.getPrefs(this.updateSettings.bind(this))},
create:function(){this.editor.install()},destroy:function(){this.editor.uninstall()},getStyleAccessor:function(){var a=null,b=this.syntaxHighlighter.getStyler();b&&b.getStyleAccessor&&(a=b.getStyleAccessor());return a}};p.EventTarget.addMixin(L.prototype);return{EditorView:L}});
define("orion/editorPluginView","orion/editor/editor orion/commands orion/editorCommands orion/objects orion/webui/littlelib orion/PageLinks orion/URITemplate".split(" "),function(m,n,p,k,f,l,e){function d(a){h.apply(this,arguments);this.editorService=a.editorService;this.id=this.editorService.getProperty("id");this.metadata=a.metadata;this.serviceRegistry=a.serviceRegistry;this.pluginRegistry=a.pluginRegistry;this.statusService=a.statusService;this.inputManager=a.inputManager}function a(a){this._parent=
a.parent;this.serviceRegistry=a.serviceRegistry;this.pluginRegistry=a.pluginRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.statusService=a.statusService;this.progressService=a.progressService;this.editorService=a.editorService;this.metadata=a.metadata;this.inputManager=a.inputManager;this.readonly=a.readonly;this.model=a.model;this.undoStack=a.undoStack}var h=m.BaseEditor;d.prototype=Object.create(h.prototype);k.mixin(d.prototype,{_getPlugin:function(){return this.pluginRegistry.getPlugin(this.editorService._properties.__plugin__)},
_load:function(){for(var a=this.serviceRegistry,d=a.getServiceReferences("orion.edit.editor"),e=0;e<d.length;e++)d[e].getProperty("id")===this.id&&(this.editorService=d[e]);d=a.getService(this.editorService);d.setBlob&&d.setBlob(new Blob([this._contents],{type:this.inputManager.getContentType().id}));d.setTextModel&&(a=a.getService(a.getServiceReferences("orion.edit.model.context")[0]),a.processKey=function(a){n.processKey(a)},d.setTextModel(a));if(d.registerKeys){var f=n.getKeyBindings(),h=[];Object.keys(f).forEach(function(a){a=
f[a].keyBinding;h.push({keyCode:a.keyCode,mod1:a.mod1,mod2:a.mod2,mod3:a.mod3,mod4:a.mod4})});d.registerKeys(h)}},install:function(){var a=f.node(this._domNode),d=this._rootDiv=document.createElement("div");d.style.width="100%";d.style.height="100%";d.style.overflow="hidden";var e=this;this._getPlugin().setParent(d).then(function(){e._load()},function(a){var b=e.statusService;if(b){var d=a.responseText;if(d)try{a=JSON.parse(d)}catch(f){a={Severity:"Error",Message:d}}b.setProgressResult(a)}else window.console.log(a)});
a.appendChild(d);h.prototype.install.call(this)},onChanged:function(a){h.prototype.onChanged.call(this,a);var d=this.serviceRegistry.getService(this.editorService);if(d&&d.onChanged)d.onChanged(a)},setInput:function(a,d,e,f){"string"!==typeof e&&(this._contents=e);h.prototype.setInput.call(this,a,d,e,f)},uninstall:function(){this._getPlugin().setParent(null);f.empty(this._domNode);h.prototype.uninstall.call(this)}});a.prototype={create:function(){this.editor=new d({domNode:this._parent,model:this.model,
undoStack:this.undoStack,serviceRegistry:this.serviceRegistry,pluginRegistry:this.pluginRegistry,editorService:this.editorService,statusService:this.statusService,inputManager:this.inputManager,metadata:this.metadata});this.editor.install();(new p.EditorCommandFactory({serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry,inputManager:this.inputManager,readonly:this.readonly,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",navToolbarId:"pageNavigationActions"})).generateBaseEditorCommands(this.editor)},
destroy:function(){this.editor&&this.editor.destroy();this.editor=null}};return{PluginEditorView:a,PluginEditor:d}});
define("orion/markdownEditor","marked/marked orion/editor/editor orion/editor/textStyler orion/editor/util orion/objects orion/webui/littlelib orion/URITemplate orion/webui/splitter orion/URL-shim".split(" "),function(m,n,p,k,f,l,e,d){function a(a,b,d,e){return function(f,h){if(-1===h.href.indexOf(":"))try{var k;"filesystem:"===b.protocol?k={href:"filesystem:"+(new URL(h.href,b.pathname)).href}:(k=new URL(h.href,b),e&&(k.protocol="",k.host=""));if("!"!==f[0][0])k.hash="",h.href=g.expand({resource:k.href,
params:"editor\x3dorion.editor.markdown"});else{var l=r[k.href];if(l)return"\x3cimg id\x3d'"+l.id+"' src\x3d'"+(l.src?l.src:"")+"'\x3e";if(d.readBlob){var m="_md_img_"+v++;(function(a,b){d.readBlob(b).then(function(d){var e=b.match(u);d=URL.createObjectURL(new Blob([d],{type:e?"image/"+e[1]:"image/png"}));(e=document.getElementById(a))?(e.src=d,r[b]={id:a,src:d}):URL.revokeObjectURL(d)}.bind(this),function(){var b=document.getElementById(a);b&&(b.src="missing")}.bind(this))}).call(this,m,k.href);
return"\x3cimg id\x3d'"+m+"' src\x3d''\x3e"}h.href=k.href}}catch(n){console.log(n)}return a.call(this,f,h)}}function h(a){this.id="orion.editor.markdown";this._fileService=a.fileService;this._metadata=a.metadata;this._parent=a.parent;this._model=a.model;this._editorView=a.editorView;this._previewClickListener=function(a){var b=this._findNearestBlockElement(a.target);if(b){for(var e=b.getBoundingClientRect(),e=(a.clientY-e.top)/(e.bottom-e.top),f=this._editorView.editor.getTextView(),g=this._stylerAdapter.getBlockWithId(b.id),
h=f.getModel(),b=h.mapOffset(g.start,!0);-1===b;)g=g.parent,b=h.mapOffset(g.start,!0);var b=f.getLocationAtOffset(b),k=h.mapOffset(g.end,!0);if(-1===k)for(g=this._styler.getBlockAtIndex(g.end-1);-1===k;)g=g.parent,k=h.mapOffset(g.start,!0);h=f.getLocationAtOffset(k);k=f.getLineAtOffset(k);h.y+=f.getLineHeight(k);e=b.y+(h.y-b.y)*e;f=this._editorDiv.getBoundingClientRect();a=this._splitter.getOrientation()===d.ORIENTATION_VERTICAL?f.height/2:a.clientY-f.top;this._scrollSourceEditor(e-a)}}.bind(this);
this._settingsListener=function(a){this._splitter.setOrientation(a.newSettings.splitOrientation);this._rootDiv.style.visibility="visible";this._splitterDiv.style.visibility="visible";this._styler.setTabsVisible(a.newSettings.showTabs);this._styler.setSpacesVisible(a.newSettings.showSpaces)}.bind(this);this._sourceScrollListener=function(a){if(this._ignoreEditorScrollsCounter)this._ignoreEditorScrollsCounter--;else if(a.newValue.y){var b=this._editorView.editor.getTextView(),d=b.getBottomIndex();if(d===
b.getModel().getLineCount()-1)this._scrollPreviewDiv(this._previewWrapperDiv.scrollHeight);else{var e=b.getTopIndex(),f=b.getCaretOffset(),g=b.getLineAtOffset(f);a=e<=g&&g<=d?f:b.getOffsetAtLocation(0,Math.floor(a.newValue.y+this._previewWrapperDiv.clientHeight/2));a=b.getModel().mapOffset(a);b=this._styler.getBlockAtIndex(a);for(d=document.getElementById(b.elementId);!d&&b.parent;)b=b.parent,d=document.getElementById(b.elementId);this._alignPreviewOnSourceBlock(b,a)}}else this._scrollPreviewDiv(0)}.bind(this);
this._sourceSelectionListener=function(a){for(var b=this._editorView.editor.getTextView().getModel().mapOffset(a.newValue.start),d=this._styler.getBlockAtIndex(b),e=document.getElementById(d.elementId);!e&&d.parent;)d=d.parent,e=document.getElementById(d.elementId);this._selectedElement&&this._selectedElement!==e&&this._selectedElement.classList.remove(this._markdownSelected);this._selectedElement=e;this._selectedBlock=d;this._selectedElement&&this._selectedElement.classList.add(this._markdownSelected);
e=this._editorView.editor.getTextView();a=e.getLineAtOffset(a.newValue.start);var f=e.getTopIndex(!0),e=e.getBottomIndex(!0);f<=a&&a<=e&&this._alignPreviewOnSourceBlock(d,b)}.bind(this);this._splitterResizeListener=function(){this._editorView.editor.resize()}.bind(this);z.apply(this,arguments)}function b(a){this._options=a}var g=new e("#{,resource,params*}"),u=/\.([0-9a-z]+)(?:[\?#]|$)/i,v=0,q=function(b,d,e){this.model=b;b=m.InlineLexer.prototype.outputLink;var f=new URL(d,window.location.href);
m.InlineLexer.prototype.outputLink=a(b,f,e,-1===d.indexOf(":"));this._markedOptions=m.parse.defaults;this._markedOptions.sanitize=!0;this._markedOptions.tables=!0;this._inlinePatterns=[];var g=0;Object.keys(m.InlineLexer.rules.gfm).forEach(function(a){if(0!==a.indexOf("_")){var b=m.InlineLexer.rules.gfm[a];b.source&&(b=b.source.substring(1).replace(/\|\^/g,"|"),b=b.replace(/[ ]\{2,\}/g,"(\\t| {2,})"),this._inlinePatterns.push({regex:RegExp(b,"g"),name:a,index:g++}))}}.bind(this))};q.prototype={blockSpansBeyondEnd:function(){return!1},
computeBlocks:function(a,b,d,e){var f=[],g;if(d.typeId){if("markup.quote.markdown"!==d.typeId&&"markup.list.markdown"!==d.typeId&&"markup.list.item.markdown"!==d.typeId)return f;g=d.seedTokens;d.seedTokens=null}var h=0;g=g||m.lexer(b,this._markedOptions);for(var k=0;k<g.length;k++){var l=null,n=null,p=null,q=n=null,u=null,r=null,v=null,z=null,n=null;this._whitespaceRegex.lastIndex=h;var Q=this._whitespaceRegex.exec(b);Q&&Q.index===h&&(h+=Q[0].length);if("heading"===g[k].type){n="setext"===g[k].style;
Q=this._getLineEnd(b,h,a);p=n?this._getLineEnd(b,h,a,1):Q;if(n){var M=b.substring(Q,p);this._setextUnderlineRegex.lastIndex=0;l=this._setextUnderlineRegex.exec(M);l[0].length<M.length&&(p-=M.length-l[0].length)}l={start:h,contentStart:h+(n?0:g[k].depth+1),contentEnd:Q,end:p};n="markup.heading.markdown";u=g[k];h=p}else if("paragraph"===g[k].type||"text"===g[k].type){n=0;if(void 0!==g[k].pre)for(l=0;;)if(this._htmlNewlineRegex.lastIndex=l,l=this._htmlNewlineRegex.exec(g[k].text))n++,l=l.index+1;else break;
else if(l=g[k].text.match(this._newlineRegex))n=l.length;p=this._getLineEnd(b,h,a,n);this._isTop(d)?u=g[k]:(g[k].type="text",r=[g[k]]);l={start:h,contentStart:h,contentEnd:p,end:p};n="markup.other.paragraph.markdown";h=p}else if("blockquote_start"===g[k].type||"list_start"===g[k].type){"blockquote_start"===g[k].type?(v="blockquote_end",M=this._blockquoteStartRegex,n="markup.quote.markdown"):(v="list_end",M=null,n="markup.list.markdown");Q=h;p=k;for(l=0;;){if(g[p].type===g[k].type)l++;else if(g[p].type===
v){if(!--l)break}else h=this._advanceIndex(b,g[p],h);p++}this._newlineRegex.lastIndex=h;(l=this._newlineRegex.exec(b))&&(h=l.index+l[0].length);M?(M.lastIndex=Q,l=M.exec(b),l=Q+l[0].length):l=Q;h=Math.max(h,l);l={start:Q,contentStart:l,contentEnd:h,end:h};q=g[k];v=g[p];z=g.slice(k+1,p);k=p}else if(-1!==g[k].type.indexOf("_item_start")){Q=h;p=k;for(l=0;;){if("list_item_start"===g[p].type||"loose_item_start"===g[p].type)l++;else if("list_item_end"===g[p].type){if(!--l)break}else h=this._advanceIndex(b,
g[p],h);p++}this._newlineRegex.lastIndex=h;(l=this._newlineRegex.exec(b))&&(h=l.index+l[0].length);n=b.substring(Q);l=m.Lexer.rules.normal.bullet.exec(n);l=Q+l.index+l[0].length;h=Math.max(h,l);l={start:Q,contentStart:l,contentEnd:h,end:h};n="markup.list.item.markdown";q=g[k];v=g[p];z=g.slice(k+1,p);k=p}else"code"===g[k].type?(g[k].hasOwnProperty("lang")?(Q=h,n=g[k].text.match(this._newlineRegex),p=this._getLineEnd(b,h,a,2+(n?n.length:0)),n="markup.raw.code.fenced.gfm"):(Q=this._getLineStart(b,h),
n=g[k].text.match(this._newlineRegex),p=this._getLineEnd(b,h,a,n?n.length:0),n="markup.raw.code.markdown"),l={start:Q,contentStart:h,contentEnd:p,end:p},u=g[k],h=p):"hr"===g[k].type?(p=this._getLineEnd(b,h,a),l={start:h,contentStart:h,contentEnd:p,end:p},n="markup.other.separator.markdown",u=g[k],h=p):"table"===g[k].type?(p=this._getLineEnd(b,h,a,g[k].cells.length+1),l={start:h,contentStart:h,contentEnd:p,end:p},this._isTop(d)?(n="markup.other.table.gfm",u=g[k]):(n="markup.other.paragraph.markdown",
r=[{type:"text",text:b.substring(h,p)}]),h=p):"space"===g[k].type&&(l={start:h,contentStart:h,contentEnd:h,end:h},n="markup.other.paragraph.markdown",r=[g[k]]);n&&(l.start+=e,l.contentStart+=e,l.contentEnd+=e,l.end+=e,n=this.createBlock(l,this._styler,a,d,n,function(a){d.name&&(a.name=d.name);a.startToken=q;u&&(a.tokens=[u]);a.endToken=v;a.seedTokens=z;r&&(a.parentTokens=r,a.doNotFold=!0)}),f.push(n))}g.links&&Object.keys(g.links).length&&(d.links=g.links);return f},computeStyle:function(){return null},
createBlock:function(a,b,d,e,f,g){a=new p.Block(a,f,f,b,d,e,g);a.elementId="_orionMDBlock"+this._elementCounter++;return this._blocksCache[a.elementId]=a},getBlockContentStyleName:function(a){return a.name},getBlockEndStyle:function(){return null},getBlockStartStyle:function(){return null},getBlockWithId:function(a){return this._blocksCache[a]},getBracketMatch:function(){return null},initialPopulatePreview:function(){var a=this._styler.getRootBlock();this._onBlocksChanged({old:[],"new":a.getBlocks()})},
parse:function(a,b,d,e){if(d.typeId){var f=[];this._inlinePatterns.forEach(function(b){b.regex.lastIndex=0;var d=b.regex.exec(a);d&&f.push({result:d,pattern:b})}.bind(this));f.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.index<b.pattern.index?-1:1});for(d=0;0<f.length;){var g=f[0];f.splice(0,1);if(!(g.result.index<d)){var h=g.result.index;d=h+g.result[0].length;var k=null;-1!==g.pattern.name.indexOf("link")?k="markup.underline.link.markdown":
"strong"===g.pattern.name?k="markup.bold.markdown":"em"===g.pattern.name?k="markup.italic.markdown":"code"===g.pattern.name?k="markup.raw.code.markdown":"br"===g.pattern.name?k="markup.other.br.markdown":"del"===g.pattern.name&&(k="markup.other.strikethrough.gfm");k&&e.push({start:b+h,end:b+d,style:k,mergeable:!0})}this._updateMatch(g,a,f,d)}}},setStyler:function(a){this._styler&&this._styler.removeEventListener("BlocksChanged",this._onBlocksChanged);this._styler=a;a.addEventListener("BlocksChanged",
this._onBlocksChanged.bind(this))},setView:function(a){this._view=a},verifyBlock:function(a,b,d,e){for(var f=d.parent;f;){if("markup.list.markdown"===f.typeId||"markup.quote.markdown"===f.typeId)return!1;f=f.parent}a=this.computeBlocks(a,b,d.parent,d.start);return a.length&&a[0].start===d.start&&a[0].end===d.end+e&&a[0].typeId===d.typeId&&a[0].getBlocks().length===d.getBlocks().length},_adoptTokens:function(a,b){a.tokens=b.tokens;for(var d=a.getBlocks(),e=b.getBlocks(),f=0;f<Math.min(d.length,e.length);f++)this._adoptTokens(d[f],
e[f])},_advanceIndex:function(a,b,d){if(b.text){this._whitespaceRegex.lastIndex=0;var e=b.text.split(this._whitespaceRegex);e.forEach(function(b){b.length&&(d=a.indexOf(b,d)+b.length)})}else"blockquote_start"===b.type?(this._blockquoteStartRegex.lastIndex=d,b=this._blockquoteStartRegex.exec(a),d=b.index+b[0].length):"hr"===b.type?(this._hrRegex.lastIndex=d,b=this._hrRegex.exec(a),d=b.index+b[0].length):"space"!==b.type&&("table"===b.type?(e=b.header.slice(),b.cells.forEach(function(a){e=e.concat(a)}),
e.forEach(function(b){b.length&&(d=a.indexOf(b,d)+b.length)})):-1!==b.type.indexOf("_item_start")&&(a=a.substring(d),b=m.Lexer.rules.normal.bullet.exec(a),d+=b.index+b[0].length));return d},_generateHTML:function(a,b){if(b.startToken||b.tokens){for(var d={},e=b;e;){if(e.links){d=e.links;break}e=e.parent}if(b.tokens){var f=b.tokens.slice();f.links=d;a.innerHTML=m.Parser.parse(f,this._markedOptions)}else if(b.startToken){f=[b.startToken,b.endToken];f.links=d;a.innerHTML=m.Parser.parse(f,this._markedOptions);
var g=function(e){f=[b.startToken].concat(e).concat(b.endToken);f.links=d;e=document.createElement("div");e.innerHTML=m.Parser.parse(f,this._markedOptions);for(e=e.children[0].childNodes;e.length;)a.children[0].appendChild(e[0])}.bind(this),h=[];b.getBlocks().forEach(function(b){if(b.parentTokens)h=h.concat(b.parentTokens);else{h.length&&(g(h),h=[]);var d=document.createElement("div");this._generateHTML(d,b);d.id=b.elementId;a.children[0].appendChild(d)}}.bind(this));h.length&&g(h)}}},_getLineStart:function(a,
b){for(;0<=--b;){var d=a.charAt(b);if(d===this._NEWLINE||d===this._CR)return b+1}return 0},_getLineEnd:function(a,b,d,e){for(e=e||0;;){this._newlineRegex.lastIndex=b;b=this._newlineRegex.exec(a);if(!b)return a.length;b=b.index+b[0].length;if(!e--)return b}},_isTop:function(a){return!a.typeId?!0:"markup.quote.markdown"===a.typeId?this._isTop(a.parent):!1},_onBlocksChanged:function(a){if(1===a.old.length&&1===a.new.length&&a.old[0].elementId===a.new[0].elementId){if(!a.new[0].parent)return;var b=this.computeBlocks(this.model,
this.model.getText(a.old[0].start,a.old[0].end),a.old[0].parent,a.old[0].start);this._adoptTokens(a.new[0],b[0])}var d=0,e,f,g,h=[];if(a.old.length){var k=document.getElementById(a.old[0].elementId);e=k.parentElement}else a.new.length&&(e=document.getElementById(a.new[0].parent.elementId)),e||(e=document.getElementById("_previewDiv"));for(f=0;f<e.children.length;f++)if(!k||e.children[f].id===k.id){for(g=f;g<f+a.old.length;g++)h.push(e.children[g]);break}a.new.forEach(function(b){var k=null;for(f=
d;f<a.old.length;f++)if(a.old[f].elementId===b.elementId){k=h[f];for(g=f-1;d<=g;g--)e.removeChild(h[g]);d=f+1;break}k||(k=document.createElement("div"),k.id=b.elementId,h.length?e.insertBefore(k,h[d]):e.appendChild(k));var l=document.createElement("div");this._generateHTML(l,b);this._updateNode(k,l)}.bind(this));for(f=a.old.length-1;d<=f;f--)e.removeChild(h[f])},_updateMatch:function(a,b,d,e){a.pattern.regex.lastIndex=e;if(b=a.pattern.regex.exec(b)){a.result=b;for(e=0;e<d.length;e++)if(b.index<d[e].result.index||
b.index===d[e].result.index&&a.pattern.index<d[e].pattern.index){d.splice(e,0,a);return}d.push(a)}},_updateNode:function(a,b){if("#text"===b.nodeName)a.textContent=b.textContent;else if("IMG"===b.nodeName&&a.src!==b.src)a.parentElement.replaceChild(b,a);else{for(var d=0,e=[],f=[],g=a.childNodes,h=0;h<g.length;h++)e.push(g[h]);g=b.childNodes;for(h=0;h<g.length;h++)f.push(g[h]);f.forEach(function(b){var f=null;for(h=d;h<e.length;h++)if(e[h].nodeName===b.nodeName){for(var f=e[h],g=h-1;d<=g;g--)a.removeChild(e[g]);
d=h+1;break}f?this._updateNode(f,b):e.length?a.insertBefore(b,e[d]):a.appendChild(b)}.bind(this));for(h=e.length-1;d<=h;h--)a.removeChild(e[h])}},_CR:"\r",_NEWLINE:"\n",_blockquoteRemoveMarkersRegex:/^[ \t]*>[ \t]?/gm,_blockquoteStartRegex:/[ \t]*>[ \t]?/g,_blocksCache:{},_elementCounter:0,_hrRegex:/([ \t]*[-*_]){3,}/g,_htmlNewlineRegex:/\n\s*\S[\s\S]*$/g,_newlineRegex:/\n/g,_orderedListRegex:/\d+\.[ \t]/g,_setextUnderlineRegex:/^[ \t]*[-=]+[ \t]*\r?\n?/g,_whitespaceRegex:/\s+/g};var r={},z=n.BaseEditor;
h.prototype=Object.create(z.prototype);f.mixin(h.prototype,{initSourceEditor:function(){var a=this._editorView.editor,b=a.getTextView(),a=a.getAnnotationModel();this._stylerAdapter=new q(this._model,this._metadata.Location,this._fileService);this._styler=new p.TextStyler(b,a,this._stylerAdapter);this._editorView.editor.getTextView().addEventListener("Scroll",this._sourceScrollListener);this._editorView.editor.getTextView().addEventListener("Selection",this._sourceSelectionListener);this._splitter.addEventListener("resize",
this._splitterResizeListener);this._previewDiv.addEventListener("click",this._previewClickListener);this._model.getCharCount()&&this._stylerAdapter.initialPopulatePreview();b=this._editorView.getSettings();this._styler.setTabsVisible(b.showTabs);this._styler.setSpacesVisible(b.showSpaces)},install:function(){this._rootDiv=document.createElement("div");this._rootDiv.style.position="absolute";this._rootDiv.style.width="100%";this._rootDiv.style.height="100%";this._parent.appendChild(this._rootDiv);
this._editorDiv=document.createElement("div");this._rootDiv.appendChild(this._editorDiv);this._editorView.setParent(this._editorDiv);this._splitterDiv=document.createElement("div");this._splitterDiv.id="orion.markdown.editor.splitter";this._rootDiv.appendChild(this._splitterDiv);this._previewWrapperDiv=document.createElement("div");this._previewWrapperDiv.style.overflowX="hidden";this._previewWrapperDiv.style.overflowY="auto";this._rootDiv.appendChild(this._previewWrapperDiv);this._previewDiv=document.createElement("div");
this._previewDiv.id="_previewDiv";this._previewDiv.classList.add("orionMarkdown");this._previewWrapperDiv.appendChild(this._previewDiv);this._editorView.addEventListener("Settings",this._settingsListener);var a=this._editorView.getSettings();this._splitter=new d.Splitter({node:this._splitterDiv,sidePanel:this._editorDiv,mainPanel:this._previewWrapperDiv,vertical:a&&a.splitOrientation===d.ORIENTATION_VERTICAL});a||(this._rootDiv.style.visibility="hidden",this._splitterDiv.style.visibility="hidden");
z.prototype.install.call(this)},uninstall:function(){this._styler.destroy();this._editorView.removeEventListener("Settings",this._settingsListener);var a=this._editorView.editor.getTextView();a.removeEventListener("Scroll",this._sourceScrollListener);a.removeEventListener("Selection",this._sourceSelectionListener);this._splitter.removeEventListener("resize",this._splitterResizeListener);this._previewDiv.removeEventListener("click",this._previewClickListener);l.empty(this._parent);z.prototype.uninstall.call(this)},
_alignPreviewOnSourceBlock:function(a,b){var e=this._editorView.editor.getTextView(),f=e.getModel(),g=document.getElementById(a.elementId);if(g){var h=f.mapOffset(a.start,!0),k=f.mapOffset(a.end,!0);if(-1===k)for(var l=this._styler.getBlockAtIndex(a.end-1);-1===k;)l=l.parent,k=f.mapOffset(l.start,!0);h=e.getLocationAtOffset(h)}else var m=a.getBlockAtIndex(b),n=a.getBlocks(),h=m?n[m-1].end:0,l=m<n.length?n[m].start:this._model.getCharCount(),h=e.getLocationAtOffset(f.mapOffset(h,!0)),k=f.mapOffset(l,
!0);l=e.getLocationAtOffset(k);k=e.getLineAtOffset(k);k=e.getLineHeight(k);l.y+=k;var p=l.y-h.y,f=e.getLocationAtOffset(f.mapOffset(b,!0));f.y=l.y-h.y===k?f.y+e.getLineHeight()/2:f.y+e.getLineHeight();h=(f.y-h.y)/p;l=this._previewWrapperDiv.getBoundingClientRect();e=this._splitter.getOrientation()===d.ORIENTATION_VERTICAL?(l.bottom-l.top)/2:f.y-e.getTopPixel();g?m=g.getBoundingClientRect().top-l.top+this._previewWrapperDiv.scrollTop+g.offsetHeight*h:(g=m<n.length?document.getElementById(n[m].elementId).getBoundingClientRect().top:
l.bottom,m=m?document.getElementById(n[m-1].elementId).getBoundingClientRect().bottom:0,m=m-l.top+this._previewWrapperDiv.scrollTop+(g-m)*h);this._scrollPreviewDiv(m-e)},_findNearestBlockElement:function(a){if("_previewDiv"===a.id)return null;for(var b=a,d=a,e=!0;e;){e=!1;if(b){if(!b.id.indexOf("_orionMDBlock"))return b;b=b.nextElementSibling;e=!0}if(d){if(!d.id.indexOf("_orionMDBlock"))return d;d=d.previousElementSibling;e=!0}}return this._findNearestBlockElement(a.parentElement)},_scrollPreviewDiv:function(a){this._scrollPreviewAnimation&&
(this._scrollPreviewAnimation.stop(),this._scrollPreviewAnimation=null);var b=a-this._previewWrapperDiv.scrollTop;b&&(a=this._editorView.getSettings(),this._scrollPreviewAnimation=new k.Animation({window:window,curve:[b,0],duration:a.scrollAnimation?a.scrollAnimationTimeout:0,onAnimate:function(a){a=b-Math.floor(a);this._previewWrapperDiv.scrollTop+=a;b-=a}.bind(this),onEnd:function(){this._scrollPreviewAnimation=null;this._previewWrapperDiv.scrollTop+=b}.bind(this)}),this._scrollPreviewAnimation.play())},
_scrollSourceEditor:function(a){this._scrollSourceAnimation&&(this._scrollSourceAnimation.stop(),this._scrollSourceAnimation=null);var b=this._editorView.editor.getTextView(),d=a-b.getTopPixel();d&&(a=this._editorView.getSettings(),this._scrollSourceAnimation=new k.Animation({window:window,curve:[d,0],duration:a.scrollAnimation?a.scrollAnimationTimeout:0,onAnimate:function(a){a=d-Math.floor(a);b.setTopPixel(b.getTopPixel()+a);d-=a}.bind(this),onEnd:function(){this._scrollSourceAnimation=null;var a=
Math.floor(b.getTopPixel()+d);this._ignoreEditorScrollsCounter=1;b.setTopPixel(a)}.bind(this)}),this._ignoreEditorScrollsCounter=Infinity,this._scrollSourceAnimation.play())},_markdownSelected:"markdownSelected",_selectedBlock:null});b.prototype={create:function(){this.editor=new h(this._options);this.editor.install();this._options.editorView.create();this.editor.initSourceEditor()},destroy:function(){this.editor.destroy();this.editor=null;this._options.editorView.destroy();this._options.editorView=
null;Object.keys(r).forEach(function(a){URL.revokeObjectURL(r[a].src)});r={}}};return{MarkdownEditorView:b}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(m){return{detectValidURL:function(n){for(var p=/\[([^\]]*)\]\(([^\)]+)\)/g,k=p.exec(n),f=[],l=0;k;){if(3===k.length&&0<k[2].length){var e=new URL(k[2]);":"!==e.protocol&&m.validateURLScheme(e.href)&&(k.index>l&&f.push({segmentStr:n.substring(l,k.index)}),f.push({segmentStr:0<k[1].length?k[1]:k[2],urlStr:k[2]}),l=k.index+k[0].length)}k=p.exec(n)}if(0===l)return null;l<n.length&&f.push({segmentStr:n.substring(l)});return f},processURLSegments:function(m,
p){p.forEach(function(k){if(k.urlStr){var f=document.createElement("a");f.href=k.urlStr;f.appendChild(document.createTextNode(k.segmentStr))}else f=document.createElement("span"),f.textContent=k.segmentStr;m.appendChild(f)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(m,n,p,k){function f(e,d,a,f,b){this._serviceRegistry=e;this._serviceRegistration=e.registerService("orion.page.message",this);this._operationsClient=d;this.notificationContainerDomId=b;this.domId=a;this.progressDomId=f||a;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var l;f.prototype={_init:function(){var e=n.node("closeNotifications");if(e&&
!this._hookedClose){e.style.cursor="pointer";this._hookedClose=!0;var d=n.node(this.notificationContainerDomId);n.addAutoDismiss([d],function(){this._clickToDisMiss&&this.close()}.bind(this));e.addEventListener("click",function(){this.close()}.bind(this));d.addEventListener("click",function(a){a&&a.target&&"a"===a.target.nodeName.toLowerCase()&&(a=n.$$("a",d))&&(a.length&&1===a.length)&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var e=n.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&e?(e.innerHTML="",e.classList.remove("cancelButton"),e.classList.add("dismissButton"),e.classList.add("core-sprite-close"),e.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){this._notifierElements||(this._notifierElements=p.getToolbarElements(this.notificationContainerDomId));return this._notifierElements},setMessage:function(e,d,a){this._init();this.currentMessage=e;var f=n.node(this.domId);
if("boolean"===typeof a){var b=f.getAttribute("aria-live");f.setAttribute("aria-live",a?"polite":"off");window.setTimeout(function(){e===this.currentMessage&&(n.empty(f),f.appendChild(document.createTextNode(e)),window.setTimeout(function(){f.setAttribute("aria-live",b)},100))}.bind(this),100)}else n.empty(f),f.appendChild(document.createTextNode(e));"number"===typeof d&&window.setTimeout(function(){e===this.currentMessage&&(n.empty(f),f.appendChild(document.createTextNode("")))}.bind(this),d)},setErrorMessage:function(e){this._clickToDisMiss=
!0;this.currentMessage=e;this._init();var d=e.responseText||e.message||e;if("string"===typeof d)try{d=JSON.parse(d)}catch(a){}e=d.Message||d;var f="red";if(d.Severity)switch(d.Severity){case "Warning":f="#FFCC00";break;case "Error":f="red";break;case "Info":case "Ok":f="green"}d=document.createElement("span");d.style.color=f;d.appendChild(document.createTextNode(e));e=n.node(this.domId);n.empty(e);e.appendChild(d)},setProgressMessage:function(e){this._clickToDisMiss=!1;this._init();this.currentMessage=
e;var d=document.createElement("span");d.classList.add("progressIcon");var a=n.node(this.progressDomId);n.empty(a);a.appendChild(d);a.appendChild(document.createTextNode(e));d=n.node(this.notificationContainerDomId);d.classList.remove("notificationHide");if(e&&0<e.length)d.classList.add("progressNormal"),d.classList.add("notificationShow");else{if(this._progressMonitors&&0<this._progressMonitors.length)return this._renderOngoingMonitors();d.classList.remove("notificationShow");d.classList.add("notificationHide")}},
setCancelFunction:function(e){this._cancelFunc=e},setProgressResult:function(e,d){this._clickToDisMiss=!1;this._cancelMsg=d;this.currentMessage=e;var a=e.responseText||e;if("string"===typeof a)try{a=JSON.parse(a)}catch(f){}this._init();var b=a.Message||a.toString(),g=m.UnknownError,l="core-sprite-information",p="progressNormal",q=document.createElement("span");q.classList.add("imageSprite");q.classList.add("progressIcon");var r=[];if(a.Severity)switch(a.Severity){case "Warning":g=m.UnknownWarning;
l="core-sprite-warning";p="progressWarning";r.push("progressInfo");r.push("progressError");r.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":l="core-sprite-error";p="progressError";r.push("progressWarning");r.push("progressInfo");r.push("progressNormal");this._clickToDisMiss=!0;break;default:p="progressNormal",r.push("progressWarning"),r.push("progressError"),r.push("progressNormal")}r.push("notificationHide");q.classList.add(l);var z=n.node(this.progressDomId),l=n.node(this.notificationContainerDomId);
n.empty(z);z.appendChild(q);b===Object.prototype.toString()&&(b=g);a.HTML?(a=document.createElement("span"),a.innerHTML=b,z.appendChild(a)):((g=k.detectValidURL(b))?(b=document.createDocumentFragment(),k.processURLSegments(b,g),Array.prototype.forEach.call(n.$$("a",b),function(a){a.target="_blank"})):("Warning"!==a.Severity&&("Error"!==a.Severity&&!d)&&(this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3)),
b=document.createTextNode(b)),z.appendChild(b));if(p&&this.progressDomId!==this.domId){l.classList.add(p);for(p=0;p<r.length;p++)l.classList.remove(r[p])}l.classList.add("notificationShow");if(r=n.node("closeNotifications"))this._cancelMsg?(r.classList.add("cancelButton"),r.classList.remove("dismissButton"),r.classList.remove("core-sprite-close"),r.classList.remove("imageSprite"),r.innerHTML=this._cancelMsg):(r.innerHTML="",r.classList.remove("cancelButton"),r.classList.add("dismissButton"),r.classList.add("core-sprite-close"),
r.classList.add("imageSprite"))},showWhile:function(e,d){var a=this;if(d){a.setProgressMessage(d);var f=function(){d===a.currentMessage&&a.setProgressMessage("")};e.then(f,f)}return e},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(e,d){return new l(this,++this._lastProgressId,e,d)},_renderOngoingMonitors:function(){if(0<this._progressMonitors.length){var e="",d=!0,a;for(a in this._progressMonitors)this._progressMonitors[a].status&&(d||(e+=", "),e+=this._progressMonitors[a].status,
d=!1);this.setProgressMessage(e)}else this.setProgressMessage("")},_beginProgressMonitor:function(e){this._progressMonitors[e.progressId]=e;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(e){this._progressMonitors[e.progressId]=e;this._renderOngoingMonitors()},_doneProgressMonitor:function(e){delete this._progressMonitors[e.progressId];this._progressMonitors.length--;e.status?this.setProgressResult(e.status):this._renderOngoingMonitors()}};f.prototype.constructor=
f;l=function(e,d,a,f){this.statusService=e;this.progressId=d;if(a){this.deferred=a;this.begin(f);var b=this;a.then(function(a,d){b.done.bind(b)()},function(a,d){b.done.bind(b)()})}};l.prototype.begin=function(e){this.status=e;this.statusService._beginProgressMonitor(this)};l.prototype.done=function(e){this.status=e;this.statusService._doneProgressMonitor(this)};l.prototype.worked=function(e){this.status=e;this.statusService._workedProgressMonitor(this)};l.prototype.constructor=l;return{StatusReportingService:f,
ProgressMonitor:l}});
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(m,n){var p={root:n};Object.keys(m).forEach(function(k){"undefined"===typeof p[k]&&(p[k]=m[k])});return p});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(m,n,p,k){var f={};(function(){var l=!1;f.updateNavTools=function(e,d,a,f,b,g){var k=p.node(f);if(k)d.destroy(k);else throw m["could not find toolbar "]+f;d.renderCommands(f,k,g,a,"button");if(b&&(f=p.node(b)))d.destroy(f),d.renderCommands(b,f,null,a,"button");l||(l=!0,e.getService("orion.page.selection").addEventListener("selectionChanged",function(e){var f=p.node(b);
f&&(d.destroy(f),d.renderCommands(b,f,e.selections,a,"button"))}))};f.createOperationsCommands=function(e,d,a){function f(a){return!a.operation||!a.operation.type?!1:"loadstart"===a.operation.type||"progress"===a.operation.type}var b=new k.Command({name:m["Remove Completed"],tooltip:m["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(b){a.removeCompletedOperations().then(function(a){d.loadOperations.bind(d)()})},visibleWhen:function(a){return!0}});e.addCommand(b);
b=new k.Command({name:m.Remove,tooltip:m["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(b){b=Array.isArray(b.items)?b.items:[b.items];for(var e=0;e<b.length;e++){var f=b[e];a.removeOperation.bind(a)(f.Location).then(function(){d.loadOperations.bind(d)()},function(){d.loadOperations.bind(d)()})}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return!f(a);for(var b in a)if(f(a[b]))return!1;return!0}});e.addCommand(b);
b=new k.Command({name:m.Cancel,tooltip:m["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var b=0;b<a.length;b++){var d=a[b];d.deferred&&d.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return f(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var b in a)if(!f(a[b])||!a[b].operation||!a[b].operation.cancelable)return!1;return!0}});e.addCommand(b)}})();
return f});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(m,n,p,k,f){function l(e){this._options=e}l.prototype=new k.PopupDialog;l.prototype.TEMPLATE='\x3ctable style\x3d"width: 360px;"\x3e\x3ctr\x3e\x3ctd\x3e\x3ch2\x3eRecent operations\x3c/h2\x3e\x3c/td\x3e\x3ctd style\x3d"text-align: right;"\x3e\x3ca id\x3d"allOperationsLink" class\x3d"navlinkonpage"\x3eAll Operations\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cdiv id\x3d"operationsExist"\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"myOperationsListEmpty"\x3eNo operations running on this page.\x3c/div\x3e\x3ctable id\x3d"myOperationsList" style\x3d"display: none;"\x3e\x3c/table\x3e\x3c/div\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"operationsDontExist"\x3eNo operations running.\x3c/div\x3e';l.prototype._init=
function(e){this._myOperations=[];this._operationsDeferreds=[];this._commandService=e.commandRegistry;f.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(e.triggerNode)};l.prototype._bindToDom=function(e){this.$allOperationsLink.href=n.toUrl("operations/list.html");this._setOperationsVisibility()};l.prototype.setOperations=function(e,d){this._myOperations||this._init(this._options);
this._myOperations=[];this._operationsDeferreds=[];if(e)for(var a in e)this._myOperations.push(e[a]),this._operationsDeferreds.push(d[a]);this._renderOperations()};l.prototype.parseProgressResult=function(e){if(!e)return{};e=e.responseText||e;try{e=JSON.parse(e)}catch(d){}var a={Message:e.Message||e,Severity:e.Severity};e.DetailedMessage&&e.DetailedMessage!==a.Message&&(a.DetailedMessage=e.DetailedMessage);return a};l.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};l.prototype._renderOperationsTable=function(e,d,a){p.empty(e);for(var f=0;f<d.length;f++){var b=d[f],g=document.createElement("tr"),k=document.createElement("td");k.style.paddingLeft="5px";k.style.paddingRight="5px";k.textContent=b.Name;g.appendChild(k);var l=document.createElement("div");k.appendChild(l);k=document.createElement("span");k.style.paddingRight="5px";k.classList.add("imageSprite");switch(b.type){case "Warning":k.classList.add("core-sprite-warning");
k.setAttribute("aria-label",m["Operation resulted in a warning."]);break;case "error":k.classList.add("core-sprite-error");k.setAttribute("aria-label",m["Operation resulted in an error."]);break;case "loadstart":case "progress":k.classList.add("core-sprite-start");k.setAttribute("aria-label",m["Operation is running."]);break;case "abort":k.classList.add("core-sprite-stop");k.setAttribute("aria-label",m["Operation is canceled."]);break;case "load":case "loadend":k.classList.add("core-sprite-ok"),k.setAttribute("aria-label",
"Operation ok.")}l.appendChild(k);k=document.createElement("span");k.classList.add("operationStatus");k.textContent=b.Name;l.appendChild(k);if(b.error){var n=b.error.Message||b.error;b.error.DetailedMessage&&""!==b.error.DetailedMessage&&(n+=": "+b.error.DetailedMessage);k.textContent=n;k.classList.remove("operationStatus");k.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",l,{operation:b,deferred:a[f]},this,"tool");e.appendChild(g)}this._setOperationsVisibility()};
l.prototype._setOperationsVisibility=function(){this.$myOperationsList.style.display=0<this._myOperations.length?"":"none";this.$myOperationsListEmpty.style.display=0<this._myOperations.length?"none":"";this.$operationsDontExist.style.display=0<this._myOperations.length?"none":"";this.$operationsExist.style.display=0<this._myOperations.length?"":"none"};l.prototype.constructor=l;return{OperationsDialog:l}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(m,n,p,k,f){function l(d,a){if(!this._progressPane){this._progressPane=k.node(d);this._operationsDialog=new f.OperationsDialog({triggerNode:this._progressPane,commandRegistry:a});var e=this;this._progressPane.addEventListener("keydown",function(a){(" "===a.charOrCode||a.keyCode===k.KEY.ENTER)&&e._operationsDialog.show()});this._progressPane.addEventListener("click",
function(a){e._operationsDialog.show()});this._operationsDialog.setOperations(null,null)}}function e(d,a,e,b){this._serviceRegistry=d;this._serviceRegistration=d.registerService("orion.page.progress",this);this._commandRegistry=e;this._operationsClient=a;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=b}l.prototype={_switchIconTo:function(d){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);
this._lastIconClass=d;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(d,a){var e={},b;for(b in d)d[b].progressMonitor||(e[b]=d[b]);if(this._isEmpty(e))this._switchIconTo("progressPane_empty"),this._progressPane.title=m.Operations,this._progressPane.alt=m.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var f="";for(b in e){var k=e[b];if(k.type&&("loadstart"===k.type||"progress"===k.type)){f=
"running";break}}""===f&&null!=this._lastOperation&&this._lastOperation.type&&"error"===this._lastOperation.type&&"error"==f;switch(f){case "running":this._progressPane.title=m["Operations running"];this._progressPane.alt=m["Operations running"];this._progressPane.setAttribute("aria-valuetext",m["Operations running"]);this._switchIconTo("running");break;case "warning":this._progressPane.title=m["Some operations finished with warning"];this._progressPane.alt=m["Some operations finished with warning"];
this._progressPane.setAttribute("aria-valuetext",m["Some operations finished with warning"]);this._switchIconTo("warning");break;case "error":this._progressPane.title=m["Some operations finished with error"];this._progressPane.alt=m["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",m["Some operations finished with error"]);this._switchIconTo("error");break;default:this._progressPane.title=m.Operations,this._progressPane.alt=m.Operations,this._progressPane.hasAttribute("aria-valuetext")&&
this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_empty")}}this._operationsDialog.setOperations(e,a)},_isEmpty:function(d){for(var a in d)return!1;return!0}};l.prototype.constructor=l;e.prototype={init:function(d){this._progressMonitorClass||(this._progressMonitorTool=new l(d,this._commandRegistry))},progress:function(d,a,e){var b=this,f=this._operationsIndex++;!e&&this._progressMonitorClass&&(e=new this._progressMonitorClass,e.begin(a));d.then(function(k){b._operations[f]&&
(k=b._operations[f],a&&(k.Name=a),b._lastOperation=k,k.type="loadend",e&&(k.progressMonitor=e),b.writeOperation.bind(b)(f,k,d),k.Location||b._removeOperationFromTheList.bind(b)(f))},function(k){if(b._operations[f]){var l=b._operations[f];a&&(l.Name=a);e&&(l.progressMonitor=e);b._lastOperation=l;l.type=k.canceled?"abort":"error";l.error=k;b.writeOperation.bind(b)(f,l,d);l.Location||b._removeOperationFromTheList.bind(b)(f)}},function(k){a&&(k.Name=a);e&&(k.progressMonitor=e);b.writeOperation.bind(b)(f,
k,d)});return d},removeOperation:function(d){for(var a in this._operations)if(this._operations[a].Location&&this._operations[a].Location===d){this._removeOperationFromTheList(a);break}this._operationsClient.removeOperation.bind(this._operationsClient)(d)},_removeOperationFromTheList:function(d){var a=this._operations[d].progressMonitor;delete this._operations[d];delete this._operationDeferrds[d];a?a.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},
removeCompletedOperations:function(){for(var d in this._operations){var a=this._operations[d];a.type&&("loadstart"!==a.type&&"progress"!==a.type)&&((a=this._operations[d].progressMonitor)&&a.done(),delete this._operations[d],delete this._operationDeferrds[d])}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(d){this._serviceRegistry.getService("orion.page.message").setProgressResult(d)},showWhile:function(d,a,e){a&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(a);
var b=this;d.then(function(a){b._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){e?b._serviceRegistry.getService("orion.page.message").setProgressMessage(""):b.setProgressResult.bind(b)(a);return a});return this.progress(d,a)},writeOperation:function(d,a,e){this._operations[d]=a;this._operationDeferrds[d]=e;a.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(b){b.put(a.Location,{Name:a.Name,expires:a.expires})});
a.progressMonitor?a.progressMonitor.progress(a.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};e.prototype.constructor=e;return{ProgressService:e}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(m,n){function p(e,d,a){return e[d].apply(e,a)}function k(e){this._location=e}function f(){var e=new n;e.reject(m["No Matching OperationService for location:"]+this._location);return e}function l(e){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=e.getService("orion.core.preference");for(var d=e.getServiceReferences("orion.core.operation"),
a=0;a<d.length;a++){var f=e.getService(d[a]);this._services[a]=f;f=d[a].getProperty("pattern")||".*";"^"!==f[0]&&(f="^"+f);this._patterns[a]=RegExp(f)}this._getService=function(a){if(!a)return this._services[0];for(var d=0;d<this._patterns.length;++d)if(this._patterns[d].test(a))return this._services[d];this._operations.remove(a);return new k(a)}}k.prototype={getOperation:f,getOperations:f,removeCompletedOperations:f,removeOperation:f,cancelOperation:f};k.prototype.constructor=k;l.prototype={getOperations:function(){var e=
new n;if(this._operations)return e.resolve(this._operations),e;var d=this;this._preferenceService.getPreferences("/operations").then(function(a){d._operations=a;e.resolve(d._operations)});return e},getOperation:function(e){return p(this._getService(e),"getOperation",arguments)},removeCompletedOperations:function(){for(var e=[],d=this,a=0;a<this._services.length;a++){var f=this._patterns[a],b=new n;e[a]=b.promise;p(this._services[a],"removeCompletedOperations").then(function(a){return function(b){Array.isArray(b)&&
d.getOperations.bind(d)().then(function(d){for(var e=d.keys(),k=0;k<e.length;k++){var l=e[k];f.test(l)&&0>b.indexOf(l)&&d.remove(l)}a.resolve()})}}(b),function(a){return function(b){a.reject(b)}}(b))}return n.all(e)},removeOperation:function(e){var d=this;return p(this._getService(e),"removeOperation",arguments).then(function(a){d.getOperations.bind(d)().then(function(a){a.remove(e)})},function(a){return a},function(a){return a})}};l.prototype.constructor=l;return{OperationsClient:l}});
define("orion/dialogs",[],function(){function m(m){this._serviceRegistry=m;this._serviceRegistration=m.registerService("orion.page.dialog",this)}m.prototype={confirm:function(m,p){p(window.confirm(m))},openFiles:function(m){}};m.prototype.constructor=m;return{DialogService:m}});
define("orion/searchClient","i18n!orion/search/nls/messages require orion/webui/littlelib orion/i18nUtil orion/searchUtils orion/crawler/searchCrawler orion/explorers/navigatorRenderer orion/extensionCommands orion/Deferred".split(" "),function(m,n,p,k,f,l,e,d,a){function h(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function b(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new h(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}h.prototype.makeRenderFunction=function(b,h,l,q,r){var z=this.serviceRegistry,t=this.commandRegistry;this.openWithCommands=this.openWithCommands||d.createOpenWithCommands(z,b,t);var w=this;return function(d,x,z,s){a.when(w.openWithCommands,function(a){if(z)p.empty(h),a=document.createElement("div"),a.appendChild(document.createTextNode(m["Search failed."])),h.appendChild(a),"function"===typeof q&&q(h);else{var w=
function(){function a(b,d){var e=d.folderName?d.folderName:d.path,f=document.createElement("span");f.id=e.replace(/[^a-zA-Z0-9_\.:\-]/g,"");f.appendChild(document.createTextNode(" - "+e+" "));b.appendChild(f)}var b={};return function(d,e){var f=e.name;if(b.hasOwnProperty(f)){a(d,e);var g=b[f];"function"===typeof g&&(b[f]=null,g())}else b[f]=function(){a(d,e)}}}(),E=!1;p.empty(h);if(d&&0<d.length){var B=document.createElement("table");B.setAttribute("role","presentation");for(var L=0;L<d.length;L++){var H=
d[L],G;E||(E=!0,l&&(G=B.insertRow(0).insertCell(0),G.textContent=l));G=B.insertRow(-1).insertCell(0);G.colspan=2;r&&r(G);var I={Name:H.name,Directory:H.directory,Location:H.path||H.location},N=null;"number"===typeof H.LineNumber&&(N={},N.line=H.LineNumber);if(s&&s.keyword&&!s.nameSearch){var O=f.generateSearchHelper(s),N=N||{};N.find=O.inFileQuery.searchStr;N.regEx=O.inFileQuery.wildCard?!0:void 0}I=e.createLink(n.toUrl("edit/edit.html"),I,t,b,a,{"aria-describedby":(H.folderName?H.folderName:H.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},N);H.LineNumber&&I.appendChild(document.createTextNode(" (Line "+H.LineNumber+")"));G.appendChild(I);w(G,H)}h.appendChild(B);"function"===typeof q&&q(h)}!E&&x&&(a=k.formatMessage(m["No matches found for ${0}"],x),p.empty(h),h.appendChild(document.createTextNode(a)),"function"===typeof q&&q(h))}})}};b.prototype={search:function(a,b,d){var e=function(a){for(var d=[],e=0;e<a.response.docs.length;e++){var g=a.response.docs[e],h=g.Location,k=f.path2FolderName(g.Path?
g.Path:g.Location,g.Name),l=k?k:h;(b?0<=l.indexOf(b):1)&&d.push({name:g.Name,path:h,folderName:k,directory:g.Directory,lineNumber:g.LineNumber})}return d};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){d(e(b),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(b){var f=a.keyword,f=f.substring(f.indexOf("}")+1),f=f.substring(f.indexOf(":")+1);d(e(b),f,null,a)},function(a){d(null,
null,a,null)})}catch(h){"string"===typeof h&&-1<h.indexOf("search")&&this._crawler?this._crawler.searchName(a,function(b){d(e(b),null,null,a)}):"string"===typeof h&&-1<h.indexOf("search")&&!a.nameSearch?(new l.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){d(e(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(h)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,b){console.error(a);p.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var d="",e=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&0<a.Parents.length?e="last"===b.index?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&(a.Directory&&a.Location&&a.Parents)&&(e=a);e?(this.setLocationbyURL(e.Location),d=e.Name,this._childrenLocation=e.ChildrenLocation):a&&(this.setLocationbyURL(this._searchRootLocation),
d=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation);e=p.node("search");d||(d="");if(e&&e.placeholder){e.value="";var f=k.formatMessage(m["Search ${0}"],d);e.placeholder=30<f.length?f.substring(0,27)+"...":k.formatMessage(m["Search ${0}"],d)}e&&e.title&&(e.title=m["Type a keyword or wild card to search in "]+d)},setLocationbyURL:function(a){this._searchLocation=a},setRootLocationbyURL:function(a){this._searchRootLocation=a},setChildrenLocationbyURL:function(a){this._childrenLocation=
a},getSearchLocation:function(){return this._searchLocation?this._searchLocation:this._fileService.fileServiceRootURL()},getSearchRootLocation:function(){return this._searchRootLocation?this._searchRootLocation:this._fileService.fileServiceRootURL()},getChildrenLocation:function(){return this._childrenLocation?this._childrenLocation:this._fileService.fileServiceRootURL()},createSearchParams:function(a,b,d,e){d=d?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:d,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:d,sort:e&&e.sort?e.sort:"Path asc",rows:e&&e.rows?e.rows:40,start:0,caseSensitive:e?e.caseSensitive:void 0,regEx:e?e.regEx:void 0,fileType:e?e.fileType:void 0,fileNamePatterns:e&&e.fileNamePatterns?e.fileNamePatterns:void 0,keyword:a,replace:e?e.replace:void 0}}};b.prototype.constructor=b;return{Searcher:b}});
define("orion/problems",["orion/EventTarget"],function(m){function n(n){this._serviceRegistry=n;m.attach(this);this._serviceRegistration=n.registerService("orion.core.marker",this)}n.prototype={_setProblems:function(m){this.problems=m;this.dispatchEvent({type:"problemsChanged",problems:m})}};n.prototype.constructor=n;return{ProblemService:n}});
define("orion/blameAnnotations",["orion/EventTarget"],function(m){function n(n){this._serviceRegistry=n;m.attach(this);this._serviceRegistration=n.registerService("orion.core.blame",this)}n.prototype={_setAnnotations:function(m){this.blameInfo=m;this.dispatchEvent({type:"blameChanged",blameInfo:m})}};n.prototype.constructor=n;return{BlameService:n}});
define("edit/setup","i18n!orion/edit/nls/messages orion/sidebar orion/inputManager orion/globalCommands orion/editor/textModel orion/editor/undoStack orion/folderView orion/editorView orion/editorPluginView orion/markdownView orion/markdownEditor orion/commandRegistry orion/contentTypes orion/fileClient orion/fileCommands orion/selection orion/status orion/progress orion/operationsClient orion/outliner orion/dialogs orion/extensionCommands orion/projectCommands orion/searchClient orion/problems orion/blameAnnotations orion/Deferred orion/EventTarget orion/URITemplate orion/i18nUtil orion/PageUtil orion/objects orion/webui/littlelib orion/projectClient".split(" "),function(m,
n,p,k,f,l,e,d,a,h,b,g,u,v,q,r,z,t,w,A,x,C,s,y,D,E,B,L,H,G,I,N,O,Q){function M(a){this.parentNode=a.parentNode;this.commandRegistry=a.commandRegistry;this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.parentNode=a.parentNode;this.fileActionsScope="fileActions";this.editActionsScope="editActions";this.viewActionsScope="viewActions";this.toolsActionsScope="toolsActions";this.additionalActionsScope="extraActions";this.createActionSections()}B={};
M.prototype={};N.mixin(M.prototype,{createActionSections:function(){var a=this;[this.fileActionsScope,this.editActionsScope,this.viewActionsScope,this.toolsActionsScope,this.additionalActionsScope].reverse().forEach(function(b){if(!a[b]){var d=document.createElement("ul");d.id=b;d.classList.add("commandList");d.classList.add("layoutLeft");d.classList.add("pageActions");b===a.additionalActionsScope&&d.classList.add("extraActions");a.parentNode.insertBefore(d,a.parentNode.firstChild);a[b]=d}});var b=
this.commandRegistry,d=this.fileActionsScope,e=this.editActionsScope,f=this.viewActionsScope,g=this.toolsActionsScope;b.addCommandGroup(d,"orion.menuBarFileGroup",1E3,m.File,null,m.noActions,null,null,"dropdownSelection");b.addCommandGroup(e,"orion.menuBarEditGroup",100,m.Edit,null,m.noActions,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.menuBarViewGroup",100,m.View,null,m.noActions,null,null,"dropdownSelection");b.addCommandGroup(g,"orion.menuBarToolsGroup",100,m.Tools,null,null,null,
null,"dropdownSelection");b.addCommandGroup(d,"orion.newContentGroup",0,m.New,"orion.menuBarFileGroup",null,null,null,"dropdownSelection");b.addCommandGroup(d,"orion.importGroup",100,m.Import,"orion.menuBarFileGroup",null,null,null,"dropdownSelection");b.addCommandGroup(d,"orion.exportGroup",1001,m.Export,"orion.menuBarFileGroup",null,null,null,"dropdownSelection")},createCommands:function(){var a=this.serviceRegistry,b=this.commandRegistry,d=this.fileClient;return q.createFileCommands(a,b,d).then(function(){return C.createFileCommands(a,
null,"all",!0,b).then(function(){var e=a.getService("orion.project.client");return e.getProjectHandlerTypes().then(function(f){return e.getProjectDeployTypes().then(function(g){return s.createProjectCommands(a,b,d,e,f,g)},function(g){return s.createProjectCommands(a,b,d,e,f)})})})})},setActiveExplorer:function(a){this.explorer=a},updateCommands:function(){var a=this.explorer,b,d,e;a&&(b=a.isCommandsVisible(),d=a.selection,e=a.treeRoot);var f=this.inputManager.getFileMetadata(),g=this.commandRegistry,
h=this.serviceRegistry;g.registerSelectionService(this.fileActionsScope,b?d:null);g.registerSelectionService(this.editActionsScope,b?d:null);g.registerSelectionService(this.viewActionsScope,b?d:null);q.setExplorer(a);s.setExplorer(a);q.updateNavTools(h,g,a,null,[this.fileActionsScope,this.editActionsScope,this.viewActionsScope],e,!0);g.destroy(this.toolsActionsScope);g.renderCommands(this.toolsActionsScope,this.toolsActionsScope,f,a,"tool");g.destroy(this.additionalActionsScope);g.renderCommands(this.additionalActionsScope,
this.additionalActionsScope,e,a,"button")}});B.setUpEditor=function(q,s,B,C){function X(a){Y!==a&&(Y&&Y.removeEventListener("DirtyChanged",qa),(Y=a)&&Y.addEventListener("DirtyChanged",qa=function(a){k.setDirtyIndicator(Y.isDirty())}))}function V(a){ha.updateCommands();var b=O.node("pageActions");b&&(F.destroy(b),a&&F.renderCommands(b.id,b,a,Y,"button"));if(b=O.node("pageNavigationActions"))F.destroy(b),a&&F.renderCommands(b.id,b,a,Y,"button");if(b=O.node("settingsActions"))F.destroy(b),a&&F.renderCommands(b.id,
b,a,Y,"button")}function W(a,b,d){"progress"===b?P.setProgressMessage(a):"error"===b?P.setErrorMessage(a):P.setMessage(a,null,d)}function K(d,f){var g=null;if(f&&d){var k=N.mixin({input:d,metadata:f},oa);if(f.Directory)g=new e.FolderView(k);else{var l=d.editor;ka.setParent(pa);if(!l||"orion.editor"===l)g=ka;else if("orion.viewer.markdown"===l)g=new h.MarkdownEditorView(k);else if("orion.editor.markdown"===l)k.editorView=ka,g=new b.MarkdownEditorView(k);else for(var m=q.getServiceReferences("orion.edit.editor"),
n=0;n<m.length;n++)if(m[n].getProperty("id")===l){k.editorService=m[n];g=new a.PluginEditorView(k);break}}}ga!==g&&(F.closeParameterCollector(),ga&&ga.destroy(),na&&na.Location!==f.Location&&ia.setText(""),(ga=g)&&ga.create());na=f;return ga}var J,F,P,ea,ba,Z,R,ca;(function(){J=new r.Selection(q);var a=new w.OperationsClient(q);P=new z.StatusReportingService(q,a,"statusPane","notifications","notificationArea");new x.DialogService(q);F=new g.CommandRegistry({selection:J});Z=new t.ProgressService(q,
a,F);new D.ProblemService(q);ea=new A.OutlineService({serviceRegistry:q,preferences:B});ba=new u.ContentTypeRegistry(q);R=new v.FileClient(q);new Q.ProjectClient(q,R);ca=new y.Searcher({serviceRegistry:q,commandService:F,fileService:R});new E.BlameService(q)})();var fa=O.node("sidebar"),ja=O.node("sidebarToolbar"),sa=O.node("pageToolbar"),pa=O.node("editor");k.generateBanner("orion-editor",q,F,B,ca,null,null,!1);var Y,qa,aa,da,ka,la,ha,ma=new H("#{,resource,params*}"),ta=function(a,b,d){b=d?d.Location:
R.fileServiceRootURL(b);a.href=ma.expand({resource:b});d&&(b=aa.getFileMetadata())&&b.Location===d.Location&&a.addEventListener("click",function(){da.reveal(d)})},ga,oa,ia=new f.TextModel,ua=new l.UndoStack(ia,500),na,ra={};["getText","setText"].forEach(function(a){ra[a]=ia[a].bind(ia)});q.registerService("orion.edit.model.context",ra,null);aa=new p.InputManager({serviceRegistry:q,fileClient:R,progressService:Z,statusReporter:W,selection:J,contentTypeRegistry:ba});aa.addEventListener("InputChanged",
function(a){var b=a.metadata,d=K(a.input,b);X(d?d.editor:null);a.editor=Y;V(b);var d=a.name,e=b;if(null===a.input||void 0===a.input)d=la?la.Name:"",e=la;k.setPageCommandExclusions(["orion.editFromMetadata"]);k.setPageTarget({task:"Editor",name:d,target:e,makeAlternate:function(){if(b&&b.parent)return b.parent;if(b&&b.Parents&&0<b.Parents.length)return Z.progress(R.read(b.Parents[0].Location,!0),G.formatMessage(m.ReadingMetadata,b.Parents[0].Location))},makeBreadcrumbLink:ta,makeBreadcrumFinalLink:!0,
serviceRegistry:q,commandService:F,searchService:ca,fileService:R});Y&&k.setDirtyIndicator(Y.isDirty());F.processURL(window.location.href)});ha=new M({parentNode:sa,fileClient:R,inputManager:aa,commandRegistry:F,serviceRegistry:q});ha.createCommands().then(function(){function a(){L.attach(this)}oa={parent:pa,model:ia,menuBar:ha,undoStack:ua,serviceRegistry:q,pluginRegistry:s,commandRegistry:F,contentTypeRegistry:ba,renderToolbars:V,inputManager:aa,readonly:C,preferences:B,searcher:ca,selection:J,
fileService:R,statusReporter:W,statusService:P,progressService:Z};ka=new d.EditorView(oa);da=new a;var b=new n({commandRegistry:F,contentTypeRegistry:ba,editorInputManager:aa,preferences:B,fileClient:R,outlineService:ea,parent:fa,progressService:Z,selection:J,serviceRegistry:q,sidebarNavInputManager:da,switcherScope:"viewActions",menuBar:ha,toolbar:ja});a.prototype.processHash=function(){var a=I.matchResourceParameters().navigate;"string"===typeof a&&(this.setInput&&"nav"===b.getActiveViewModeId())&&
this.setInput(a)};b.show();da.addEventListener("rootChanged",function(a){la=a.root});var e=function(a){window.location=ma.expand({resource:a.newInput||a.parent||""})};da.addEventListener("filesystemChanged",e);da.addEventListener("editorInputMoved",e);da.addEventListener("create",function(a){a.newValue&&(window.location=ma.expand({resource:a.newValue.Location}))});J.addEventListener("selectionChanged",function(a){aa.setInput(a.selection)});window.addEventListener("hashchange",function(){aa.setInput(I.hash());
da.processHash(I.hash())});aa.setInput(I.hash());da.processHash(I.hash())});window.onbeforeunload=function(){if(Y&&Y.isDirty())return aa.getAutoSaveEnabled()?(aa.save(),m.unsavedAutoSaveChanges):m.unsavedChanges}};return B});define("edit/edit",["orion/browserCompatibility","orion/bootstrap","edit/setup"],function(m,n,p){n.startup().then(function(k){p.setUpEditor(k.serviceRegistry,k.pluginRegistry,k.preferences,!1)})});
//@ sourceMappingURL=edit.js.map