[
  {
    "path": ".gitignore",
    "content": "### Node ###\n# Logs\nlogs\n*.log\nnpm-debug.log*\n\n# Dependency directories\nnode_modules\njspm_packages\n\n# Optional npm cache directory\n.npm\n\n### OSX ###\n.DS_Store\n\n### Jekyll ###\n_site/\n.sass-cache/\n.jekyll-metadata\n\n### Sublime ###\n*.sublime-*\n\n### WebStorm ###\n.idea\n"
  },
  {
    "path": "Gemfile",
    "content": "source 'https://rubygems.org'\ngem 'github-pages', group: :jekyll_plugins\ngem 'wdm', '>= 0.1.0' if Gem.win_platform?"
  },
  {
    "path": "README.md",
    "content": "\n# Shoutem\n\nShoutem is a platform for building beautiful React Native mobile apps. The easiest way to understand what Shoutem is to think of it as the WordPress for mobile apps. Apps are divided into smaller modules, called `extensions`. On WordPress you build a website out of plugins; on Shoutem you build a mobile app out of extensions. This architecture helps us achieve big development efficiency.\n\n## Community\n\nJoin [our community](https://www.facebook.com/groups/shoutem.community/) on Facebook. Also, feel free to ask a question on Stack Overflow using [\"shoutem\" tag](http://stackoverflow.com/tags/shoutem).\n\n## Feature requests\n\nWe would like to know what you want to do with Shoutem extensions. Feel free to raise issues with `feature requests` and upvote the ones labeled as a `feature request`, so we can know what you need the most. We're going to put label `in progress` for the features that we decide to implement.\n\n## React Native\n\nShoutem app is a React Native app. We designed extensions’ architecture with the goal not to add overhead over pure React Native. If you know React Native, you will know how to write Shoutem extensions. If you're just starting with React Native, check out our [React Native School](https://school.shoutem.com/).\n\n## Marketplace\n\nShoutem prepared and open sourced a lot of extensions that you can use in your apps. Don’t reinvent the wheel: reuse extensions which are suitable for you, customize them or create new ones. You can find the full list of extensions [here](https://github.com/shoutem/extensions).\n\n## Customization\n\nAll our extensions are open sourced, so you can modify anything you want by simply forking them. You can also write your own ones from scratch.\n\n## Tools and docs\n\nWe've prepared tools to speed up your extension development like [Shoutem CLI](https://shoutem.github.io/docs/extensions/reference/cli), [Shoutem UI toolkit](https://shoutem.github.io/ui/) for faster component development and documented all the concepts on this [developer's portal](http://shoutem.github.io/).\n\nIf you find some bug or have a suggestion on how to improve anything, feel free to contribute or raise an issue!\n\n## Start creating your apps!\n\nIf you’re not already using Shoutem, you can create your account [here](https://new.shoutem.com), and start developing beautiful mobile apps.\n"
  },
  {
    "path": "_config.yml",
    "content": "title: Shoutem Developers\ndescription: Supercharge your React Native development with Shoutem\ntracking_id: UA-807293-5\nrepository: shoutem/shoutem.github.io\n\nsass:\n  style: compressed\n\n# Build settings\nmarkdown: kramdown\n\nkramdown:\n  syntax_highlighter_opts:\n    disable : true\n\nurl: \"https://shoutem.github.io\"\n\n# Variables\nshoutem:\n  builderURL: \"https://builder.shoutem.com\"\n  previewAppiOS: \"https://itunes.apple.com/us/app/shoutem-preview/id1211732978\"\n  previewAppAndroid: \"https://play.google.com/store/apps/details?id=com.shoutem.extensions.preview\"\n  cli: \"https://www.npmjs.com/package/@shoutem/cli\"\n  school: \"http://school.shoutem.com/\"\n  pricing: \"https://new.shoutem.com/pricing/\"\n  support: \"https://new.shoutem.com/support/\"\n\nexternal:\n  appleAppStore: \"https://itunes.apple.com/ca/genre/ios/id36?mt=8\"\n  appleDeveloperAccount: \"https://developer.apple.com/programs/enroll/\"\n  googlePlayStore: \"https://play.google.com/store\"\n  googlePlayDeveloperAccount: \"https://play.google.com/apps/publish/signup/\"\n  xcode: \"https://developer.apple.com/xcode/\"\n  androidStudio: \"https://developer.android.com/studio/index.html\"\n\n\n\n# Examples\nexample:\n  devName: tom\n  devEmail: tom@shoutem.com\n  extensionName: restaurants\n  appId: 8074\n  qrCodeLink: http://shoutem.app.link/?host=df4d8960.ngrok.io&port=80&dev=false\n"
  },
  {
    "path": "_includes/cards.html",
    "content": "\t\t\t\t\t<div class=\"section-content\">\n\t\t\t\t\t\t<div class=\"container screen-type-cards\">\n\t\t\t\t\t\t\t<h4 class=\"subtitle\">40+ full-featured extensions</h4>\n\t\t\t\t\t\t\t<div id=\"screen-type-cards\" class=\"dragdealer\">\n\t\t\t\t\t\t\t\t<div class=\"handle\" style=\"width: 4042px;\">\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-main-navigation-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Main navigation</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>App-level navigation</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-news-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">News</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show news articles</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-events-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Events</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show items with location and time</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-products-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Products</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show products with purchase link</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-photos-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Photos</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show a photo gallery</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-videos-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Videos</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show a video gallery</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-about-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">About</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show info about your app or your business</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-places-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Places</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show items with location</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-menu-items-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Restaurant menu</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show a restaurant menu</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-books-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Books</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show books and authors</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-news-rss-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">RSS News</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show news articles from RSS feed</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-people-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">People</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show people and contact details</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-web-page-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Web view</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show a web page in-app or in a browser</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-favorites-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Favorites</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Extensions that are using Shoutem Favorites extensions are able to store and retrieve items that that app user has bookmarked in local app storage. </p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-folder-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Navigation</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Shows sub-navigation for the nested screen</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-radio-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Radio</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Stream a radio station</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-videos-rss-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">RSS Videos</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show a video gallery from RSS feed</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-videos-vimeo-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Vimeo videos</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show Vimeo video gallery</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/extensions/add-videos-youtube-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">YouTube videos</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show YouTube video gallery</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div class=\"container layout-cards\">\n\t\t\t\t\t\t\t<h4 class=\"subtitle\">Mobile backend services</h4>\n\t\t\t\t\t\t\t<div id=\"layout-cards\" class=\"dragdealer\">\n\t\t\t\t\t\t\t\t<div class=\"handle\" style=\"width: 2330px;\">\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-analytics-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Analytics</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Track Shoutem events</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-authentication-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">User authentication</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Show user profile, sign out user</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-cms-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">CMS</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Shoutem CMS extension</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-code-push-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Code push</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Provides CodePush support for over the air code updates</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-firebase-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Firebase</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Firebase integration for sending push notifications, storage&hellip;</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-google-analytics-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Google Analytics</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Enables Google Analytics</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-layouts-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Layouts</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Shoutem Layout extension</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-push-notifications-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Push notifications</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Base extension for push notifications</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-rss-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">RSS feeds</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Shoutem RSS extension</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-shopify-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Shopify</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Shopify integration</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/services/add-theme-image.svg\" alt=\"\">\n\t\t\t\t\t\t\t\t\t\t\t<h5 class=\"card-title\">Themes</h5>\n\t\t\t\t\t\t\t\t\t\t\t<p>Resolve and store theme related configuration</p>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div class=\"container visual-style-cards\">\n\t\t\t\t\t\t\t<h4 class=\"subtitle\">Carefully crafted themes for you to use and customize</h4>\n\t\t\t\t\t\t\t<div id=\"visual-style-cards\" class=\"dragdealer\">\n\t\t\t\t\t\t\t\t<div class=\"handle\"  style=\"width: 1270px;\">\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/themes/theme-1.jpg\" \n\t\t\t\t\t\t\t\t\t\t\t\t srcset=\"img/cards/themes/theme-1.jpg 1x,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t img/cards/themes/theme-1@2x.jpg 2x\" alt=\"\" />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/themes/theme-2.jpg\" \n\t\t\t\t\t\t\t\t\t\t\t\t srcset=\"img/cards/themes/theme-2.jpg 1x,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t img/cards/themes/theme-2@2x.jpg 2x\" alt=\"\" />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/themes/theme-3.jpg\" \n\t\t\t\t\t\t\t\t\t\t\t\t srcset=\"img/cards/themes/theme-3.jpg 1x,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t img/cards/themes/theme-3@2x.jpg 2x\" alt=\"\" />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/themes/theme-4.jpg\" \n\t\t\t\t\t\t\t\t\t\t\t\t srcset=\"img/cards/themes/theme-4.jpg 1x,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t img/cards/themes/theme-4@2x.jpg 2x\" alt=\"\" />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/themes/theme-5.jpg\" \n\t\t\t\t\t\t\t\t\t\t\t\t srcset=\"img/cards/themes/theme-5.jpg 1x,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t img/cards/themes/theme-5@2x.jpg 2x\" alt=\"\" />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/themes/theme-6.jpg\" \n\t\t\t\t\t\t\t\t\t\t\t\t srcset=\"img/cards/themes/theme-6.jpg 1x,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t img/cards/themes/theme-6@2x.jpg 2x\" alt=\"\" />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"card\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"inner\">\n\t\t\t\t\t\t\t\t\t\t\t<img src=\"img/cards/themes/theme-7.jpg\" \n\t\t\t\t\t\t\t\t\t\t\t\t srcset=\"img/cards/themes/theme-7.jpg 1x,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t img/cards/themes/theme-7@2x.jpg 2x\" alt=\"\" />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n"
  },
  {
    "path": "_includes/footer.html",
    "content": "<footer class=\"footer\">\n  <div id=\"signup\" class=\"signup\">\n    <div class=\"signup-title\">Stay informed</div>\n    <div class=\"signup-description\">Subscribe to our newsletter if you'd like to stay informed about Shoutem Extensions and Shoutem UI Toolkit.</div>\n    <!-- Begin MailChimp Signup Form -->\n      <div id=\"mc_embed_signup\">\n        <form action=\"//shoutem.us1.list-manage.com/subscribe/post?u=2465033d224d289aca631307f&amp;id=8c16387120\" method=\"post\" id=\"mc-embedded-subscribe-form\" name=\"mc-embedded-subscribe-form\" class=\"validate\" target=\"_blank\" novalidate>\n            <div id=\"mc_embed_signup_scroll\">\n              <div>\n                <input type=\"email\" spellcheck=\"false\" value=\"\" name=\"EMAIL\" class=\"signup-email required email\" placeholder=\"Enter your email\" id=\"mce-EMAIL\">\n                <input type=\"submit\" value=\"Sign up\" name=\"subscribe\" id=\"mc-embedded-subscribe\" class=\"signup-button\">\n              </div>\n              \n              <div id=\"mce-responses\" class=\"clear\">\n                <div class=\"response\" id=\"mce-error-response\" style=\"display:none\"></div>\n                <div class=\"response\" id=\"mce-success-response\" style=\"display:none\"></div>\n              </div>\n              <div style=\"position: absolute; left: -5000px;\" aria-hidden=\"true\"><input type=\"text\" name=\"b_2465033d224d289aca631307f_8c16387120\" tabindex=\"-1\" value=\"\"></div>\n              <div class=\"clear\"></div>\n            </div>\n        </form>\n      </div>\n    <!--End mc_embed_signup-->\n  </div>  \n  \n  <div class=\"bottom-footer\">\n    <div class=\"container-fluid\">\n      <a href=\"https://www.shoutem.com\" class=\"footer-logo\"></a>\n      <ul class=\"footer-menu\">\n        <li><a href=\"https://www.shoutem.com/about\">About</a></li>\n        <li><a href=\"https://www.shoutem.com/terms-of-service\">Terms of service</a></li>\n        <li><a href=\"https://www.shoutem.com/about/contact-us\">Contact us</a></li>\n        <li class=\"icon-github\"><a href=\"https://github.com/shoutem/shoutem.github.io\">Github</a></li>\n        <li class=\"icon-twitter\"><a href=\"https://twitter.com/shoutem\">Twitter</a></li>\n      </ul>\n    </div>\n  </div>\n</footer>\n"
  },
  {
    "path": "_includes/ga.html",
    "content": "<script>\n  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n  ga('create', '{{ site.tracking_id }}', 'auto');\n  ga('send', 'pageview');\n</script>"
  },
  {
    "path": "_includes/head.html",
    "content": "<head>\n  <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">\n\n  <title>\n    {% if page.title %}\n      {{ page.title }}\n      {% if page.section %} - {{ page.section }}{% endif %}\n       - \n    {% endif %}\n    {{ site.title }}\n  </title>\n  <meta name=\"description\" content=\"{{ site.description }}\">\n\n  <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.baseurl }}/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.baseurl }}/css/style.css\">\n\n  <link rel=\"icon\" href=\"/favicon.ico\" type=\"image/x-icon\">\n\n  <link rel=\"apple-touch-icon\" href=\"{{ site.url }}/img/apple-touch-icon.png\">\n  <link rel=\"apple-touch-icon\" sizes=\"76x76\" href=\"{{ site.url }}/img/apple-touch-icon-ipad.png\">\n  <link rel=\"apple-touch-icon\" sizes=\"120x120\" href=\"{{ site.url }}/img/apple-touch-icon@2x.png\">\n  <link rel=\"apple-touch-icon\" sizes=\"152x152\" href=\"{{ site.url }}/img/apple-touch-icon-ipad@2x.png\">\n  <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"{{ site.url }}/img/apple-touch-icon@3x.png\">\n  <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css\" />\n  \n  <meta property=\"og:title\" content=\"{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}\" /> \n  <meta property=\"og:image\" content=\"{{ site.url }}/img/og-image.jpg\" />\n  <meta property=\"og:description\" content=\"{{ site.description }}\" /> \n  <meta property=\"og:url\" content=\"{% if page.url %}{{ page.url }}{% else %}{{ site.url }}{% endif %}\">\n  \n  <meta name=\"twitter:card\" content=\"summary\" />\n  <meta name=\"twitter:description\" content=\"{{ site.description }}\" />\n  <meta name=\"twitter:title\" content=\"{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}\" />\n  <meta name=\"twitter:site\" content=\"@shoutem\" />\n  <meta name=\"twitter:image\" content=\"{{ site.url }}/img/twitter-card-image.png\" />\n\n  <!-- Hotjar Tracking Code for http://shoutem.com -->\n  <script>\n    (function(h,o,t,j,a,r){\n       h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n       h._hjSettings={hjid:211696,hjsv:5};\n       a=o.getElementsByTagName('head')[0];\n       r=o.createElement('script');r.async=1;\n       r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n       a.appendChild(r);\n   })(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');\n  </script>\n\n  <script src=\"https://cdn.optimizely.com/js/8386530091.js\"></script>\n  "
  },
  {
    "path": "_includes/home-header-video.html",
    "content": "<video autoplay loop class=\"video-screen\">\n\t<source src=\"/video/header.webm\" type=\"video/webm\" />\n\t<source src=\"/video/header.mp4\" type=\"video/mp4\" />\n</video>\n<script>\n\tvar vc = document.querySelector(\".video-screen\");\n\tvar vcParent = vc.parentElement;\n\tvar temp;\n\n\tif( window.matchMedia )\n\t{\n\t\tvar mq = window.matchMedia(\"only screen and (-webkit-min-device-pixel-ratio: 2),only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( o-min-device-pixel-ratio: 2/1), only screen and ( min-device-pixel-ratio: 2), only screen and ( min-resolution: 192dpi), only screen and ( min-resolution: 2dppx)\");\n\n\t\tif( mq && mq.matches )\n\t\t{\n\t\t\tvc.pause();\n\t\t\tvcParent.removeChild(vc);\n\n\t\t\tvc = document.createElement(\"video\");\n\t\t\tvc.className = \"video-screen\";\n\t\t\tvc.setAttribute(\"autoplay\", true);\n\t\t\tvc.setAttribute(\"loop\", true);\n\t\t\tvcParent.appendChild(vc);\n\n\t\t\ttemp = document.createElement(\"source\");\n\t\t\ttemp.setAttribute(\"src\", \"/video/header@2x.webm\");\n\t\t\ttemp.setAttribute(\"type\", \"video/webm\");\n\t\t\tvc.appendChild(temp);\n\n\t\t\ttemp = document.createElement(\"source\");\n\t\t\ttemp.setAttribute(\"src\", \"/video/header@2x.mp4\");\n\t\t\ttemp.setAttribute(\"type\", \"video/mp4\");\n\t\t\tvc.appendChild(temp);\n\n\t\t\tvc.play();\n\t\t}\n\t}\n</script>\n"
  },
  {
    "path": "_includes/navbar.html",
    "content": "<nav class=\"navbar navbar-default navbar-fixed-top headroom\">\n\t<div class=\"container-fluid\">\n\n\t\t<div class=\"navbar-header\">\n\t\t\t<button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#bs-example-navbar-collapse-1\" aria-expanded=\"false\">\n\t\t\t\t<span class=\"sr-only\">Toggle navigation</span>\n\t\t\t\t<span class=\"icon-bar\"></span>\n\t\t\t\t<span class=\"icon-bar\"></span>\n\t\t\t\t<span class=\"icon-bar\"></span>\n\t\t\t</button>\n\n\t\t\t\n\t\t\t\t{% if .page.title %}\n\t\t\t\t\t<a class=\"navbar-brand\" href=\"{{ site.baseurl }}/\">\n\t\t\t\t\t\t<svg width=\"18px\" height=\"18px\" viewBox=\"0 0 18 18\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n\t\t\t\t\t\t    <g id=\"documentation-logo\" transform=\"translate(-31.000000, -31.000000)\" fill=\"#00AADF\">\n\t\t\t\t\t\t        <path d=\"M32.7621883,49 C32.1600337,49 31.5861304,48.6779372 31.2640665,48.1589238 C30.9484601,47.6520179 30.9145586,47.0296861 31.1688196,46.4864574 L37.2323381,32.0380269 C37.2404099,32.0186547 37.2492888,31.9992825 37.2581678,31.9807175 C37.5576307,31.3753363 38.1646283,31 38.840236,31 C39.3100134,31 39.7523467,31.1832287 40.0857111,31.5165919 L48.4835874,39.9144395 C48.8839475,40.3156054 49.0687912,40.8878924 48.9767729,41.4472646 C48.8839475,42.0066368 48.5255606,42.4901345 48.0178459,42.7411659 C47.9992808,42.7500448 47.9799085,42.7589238 47.9613434,42.7669955 L33.5136706,48.8304933 C33.2739389,48.9426906 33.0212923,49 32.7621883,49 L32.7621883,49 Z M38.9274112,33.2124664 L33.2448805,46.7544395 L46.7868999,41.0711211 L38.9274112,33.2124664 L38.9274112,33.2124664 Z\" id=\"ic-shoutem-mark\"></path>\n\t\t\t\t\t\t    </g>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</a>\n\t\t\t\t{% else %}\n\t\t\t\t\t<a class=\"navbar-brand\" href=\"http://new.shoutem.com\">\n\t\t\t\t\t\t<span class=\"navbar-brand--logo\">Shoutem</span>\n\t\t\t\t\t</a>\n\t\t\t\t{% endif %}\n\t\t\t</a>\n\n\t\t\t{% if .page.title %}\n\t\t\t<ol class=\"breadcrumb navbar-left\">\n\t\t\t\t<li class=\"page-section\">{{ page.section }}</li>\n\t\t\t\t<li class=\"page-title\">{{ page.title }}</li>\n\t\t\t</ol>\n\t\t\t{% endif %}\n\t\t</div>\n\n\t\t<div class=\"collapse navbar-collapse\" id=\"bs-example-navbar-collapse-1\">\n\t\t\t<ul class=\"nav navbar-nav navbar-right\">\n\t\t\t\t{% if .page.title %}\n\t\t\t\t<li>\n\t\t\t\t\t<form class=\"navbar-search-form navbar-form navbar-right navbar-form-border\" role=\"search\">\n\t\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t\t<img class=\"search-icon\" src=\"{{ site.baseurl }}/img/ui-toolkit/icons/search.png\" />\n\t\t\t\t\t\t\t<input id=\"navbar-search-input\" placeholder=\"Search...\" type=\"text\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"edit-link\"><a href=\"https://github.com/shoutem/shoutem.github.io/blob/master/{{ page.path }}\">Edit this page</li>\n\t\t\t\t{% endif %}\n\t\t\t\t<li id=\"documentationTab\"><a class=\"navbar-nav--a--link\" href=\"{{ site.baseurl }}/docs/extensions/tutorials/getting-started\">Documentation</a></li>\n\t\t\t\t<li id=\"signup-button\"><a href=\"#signup\" class=\"btn btn-primary\">Stay informed</a></li>\n\t\t\t</ul>\n\t\t</div>\n\n\t</div>\n</nav>\n"
  },
  {
    "path": "_includes/overview-content.html",
    "content": "\t<h1>Develop native apps with Shoutem and React Native</h1>\n\n\t<div class=\"section section-intro\">\n\n\t\t<div class=\"intro-text\">\n\n\t\t\t<div class=\"intro-title\">\n\t\t\t\tBuild apps with Shoutem extensions\n\t\t\t</div>\n\n\t\t\t<div class=\"intro-content\">\n\n\t\t\t\t<p>Shoutem apps are made of extensions. We’ve prepared 40+ extensions \n\t\t\t\tthat cover most of the things you’ll need in any app. Customize them, \n\t\t\t\tor create literally anything by writing a new extension.</p>\n\n\t\t\t\t<img src=\"{{ site.baseurl }}/img/overview/js-rn-logos@2x.png\" alt=\"Javascript + React Native\" width=\"189\" height=\"32\" />\n\n\t\t\t\t<p><small>P.S. CLI, app publishing, cloud storage and more, included.</small></p>\n\n\t\t\t</div>\n\n\t\t</div>\n\n\t</div>\n\n\t<div class=\"section section-tutorials\">\n\n\t\t<h2>Get started with tutorials</h2>\n\n\t\t<div class=\"list-cards\">\n\n\t\t\t<a class=\"card rounded shadowed\" href=\"{{ site.baseurl }}/docs/extensions/getting-started/introduction\">\n\t\t\t\t<div class=\"card-image\">\n\t\t\t\t\t<img src=\"{{ site.baseurl }}/img/overview/icon-tutorial-getting-started.svg\" alt=\"\">\n\t\t\t\t</div>\n\t\t\t\t<div class=\"card-content\">\n\t\t\t\t\t<div class=\"card-category\">Tutorial</div>\n\t\t\t\t\t<div class=\"card-title\">Get started</div>\n\t\t\t\t\t<p>Create your first Shoutem extension</p>\n\t\t\t\t\t<div class=\"card-time\">\n\t\t\t\t\t\t<span class=\"icon-time\"></span> 45 min\n\t\t\t\t\t\t<span class=\"difficulty\">simple</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\n\t\t\t<a class=\"card rounded shadowed\" href=\"{{ site.baseurl }}/docs/extensions/tutorials/modifying-extensions\">\n\t\t\t\t<div class=\"card-image extensions\">\n\t\t\t\t\t<img src=\"{{ site.baseurl }}/img/overview/puzzle-wrench.svg\" alt=\"\">\n\t\t\t\t</div>\n\t\t\t\t<div class=\"card-content\">\n\t\t\t\t\t<div class=\"card-category\">Tutorial</div>\n\t\t\t\t\t<div class=\"card-title\">Modifying extensions</div>\n\t\t\t\t\t<p>Learn how to customize Shoutem extensions</p>\n\t\t\t\t\t<div class=\"card-time\">\n\t\t\t\t\t\t<span class=\"icon-time\"></span> 30 min\n\t\t\t\t\t\t<span class=\"difficulty\">simple</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\n\t\t\t<a class=\"card rounded shadowed\" href=\"{{ site.baseurl }}/docs/extensions/tutorials/writing-a-theme\">\n\t\t\t\t<div class=\"card-image themes\">\n\t\t\t\t\t<img src=\"{{ site.baseurl }}/img/overview/paintbrush.svg\" alt=\"\">\n\t\t\t\t</div>\n\t\t\t\t<div class=\"card-content\">\n\t\t\t\t\t<div class=\"card-category\">Tutorial</div>\n\t\t\t\t\t<div class=\"card-title\">Creating themes</div>\n\t\t\t\t\t<p>Learn how to style your app using themes</p>\n\t\t\t\t\t<div class=\"card-time\">\n\t\t\t\t\t\t<span class=\"icon-time\"></span> 30 min\n\t\t\t\t\t\t<span class=\"difficulty\">simple</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\n\t\t</div>\n\n\t\t<div class=\"list-cards row-2\">\n\n\t\t\t<a class=\"card rounded shadowed\" href=\"{{ site.baseurl }}/docs/extensions/tutorials/using-native-api\">\n\t\t\t\t<div class=\"card-content\">\n\t\t\t\t\t<div class=\"card-category\">Tutorial</div>\n\t\t\t\t\t<div class=\"card-title\">Using native code, native SKDs and JS libraries</div>\n\t\t\t\t\t<div class=\"card-time\">\n\t\t\t\t\t\t<span class=\"icon-time\"></span> 20 min\n\t\t\t\t\t\t<span class=\"difficulty\">simple</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\n\t\t\t<a class=\"card rounded shadowed\" href=\"{{ site.baseurl }}/docs/extensions/tutorials/using-native-api\">\n\t\t\t\t<div class=\"card-content\">\n\t\t\t\t\t<div class=\"card-category\">Tutorial</div>\n\t\t\t\t\t<div class=\"card-title\">Creating an integation with a third-party service</div>\n\t\t\t\t\t<div class=\"card-time\">\n\t\t\t\t\t\t<span class=\"icon-time\"></span> 20 min\n\t\t\t\t\t\t<span class=\"difficulty\">simple</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\n\t\t\t<a class=\"card rounded shadowed\" href=\"{{ site.baseurl }}/docs/extensions/getting-started/publish\">\n\t\t\t\t<div class=\"card-content\">\n\t\t\t\t\t<div class=\"card-category\">Tutorial</div>\n\t\t\t\t\t<div class=\"card-title\">Shoutem automated and manual app publishing</div>\n\t\t\t\t\t<div class=\"card-time\">\n\t\t\t\t\t\t<span class=\"icon-time\"></span> 10 min\n\t\t\t\t\t\t<span class=\"difficulty\">simple</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\n\t\t</div>\n\n\t</div>\n\n\t<div class=\"section section-devstack\">\n\n\t\t<h2>Development stack</h2>\n\n\t\t<h3>JavaScript and React Native only</h3>\n\n\t\t<p>Extensions are written in modern JavaScript and React Native.\n\t\t\tUse an editor of your choice and start coding!<br />\n\t\t\tNot a JavaScript and React Native developer?\n\t\t\tGet a quick-start with our <a href=\"{{ site.baseurl }}/docs/extensions/getting-started/introduction\">tutorial</a>.</p>\n\n\t\t<ul class=\"logotypes\">\n\t\t\t<li class=\"javascript\">Javascript</li>\n\t\t\t<li class=\"react-native\">React Native</li>\n\t\t\t<li class=\"shoutem-ui-toolkit\">Shoutem UI Toolkit</li>\n\t\t\t<li class=\"code-editor\">Any code editor</li>\n\t\t</ul>\n\t\t\n\t</div>\n\n\t<div class=\"section section-faq\">\n\n\t\t<h2>FAQ</h2>\n\n\t\t<dl>\n\t\t\t<dt>What do I need on my system?</dt>\n\t\t\t<dd>Just a text editor and terminal (Windows, macOS or Linux). You \n\t\t\t\tdon’t need XCode or Android Studio, and you don’t need a Mac to \n\t\t\t\tbuild iOS apps.</dd>\n\n\t\t\t<dt>How much advanced JavaScript knowledge is required?</dt>\n\t\t\t<dd>Just a text editor and terminal (Windows, macOS or Linux). You \n\t\t\t\tdon’t need XCode or Android Studio, and you don’t need a Mac to \n\t\t\t\tbuild iOS apps.</dd>\n\n\t\t\t<dt>Does Shoutem build and publish my apps?</dt>\n\t\t\t<dd>Just a text editor and terminal (Windows, macOS or Linux). You \n\t\t\t\tdon’t need XCode or Android Studio, and you don’t need a Mac to \n\t\t\t\tbuild iOS apps.</dd>\n\n\t\t\t<dt>Do I need to pay for this?</dt>\n\t\t\t<dd>Just a text editor and terminal (Windows, macOS or Linux). You \n\t\t\t\tdon’t need XCode or Android Studio, and you don’t need a Mac to \n\t\t\t\tbuild iOS apps.</dd>\n\t\t</dl>\n\n\t</div>"
  },
  {
    "path": "_includes/sidebar-nav.html",
    "content": "<ul class=\"sidebar-nav navigation level-1\" id=\"menu\">\n\n\t<li class=\"hidden-md hidden-lg home-link\"><a href=\"/\">Shoutem Developers</a></li>\n\n\t<!-- Getting started -->\n\t<li>\n\t\t<a class=\"menu-group-title\" href=\"{{ site.baseurl }}/docs/extensions/tutorials/getting-started\">Getting started</a>\n\t</li>\n\n\t<!-- My first extension -->\n\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/introduction\">My first extension</a></li>\n\t<ul id=\"extensions\" class=\"menu-group-wrapper level-2\">\n\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/introduction\">Introduction</a></li>\n\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/initializing-extension\">Creating an extension</a>\n\t\t</li>\n\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/shortcut-and-screen\">Creating screens and\n\t\t\t\tshortcuts</a></li>\n\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/using-ui-toolkit\">Using UI Toolkit</a></li>\n\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/using-cloud-storage\">Using Cloud Storage</a></li>\n\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/working-with-data\">Working with data</a></li>\n\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/my-first-extension/publish\">Publishing</a></li>\n\t</ul>\n\t</li>\n\n\t<!-- Guides -->\n\t<li><a class=\"menu-group-title\"\n\t\t\thref=\"{{ site.baseurl }}/docs/extensions/tutorials/setting-local-environment\">Guides</a>\n\t\t<ul id=\"extensions-tutorials\" class=\"menu-group-wrapper level-2\">\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/setting-local-environment\">Local environment setup</a>\n\t\t\t</li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/publish-your-app\">Publish your app</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/connecting-to-api\">Connecting to 3rd party API</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/installing-3rd-party-packages\">Installing 3rd party\n\t\t\t\t\tpackages</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/using-patch-package\">Using patch-package</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/modifying-native-project\">Modifying native project</a>\n\t\t\t</li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/writing-a-theme\">Writing a theme</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/screen-layouts\">Screen layouts</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/using-localization\">Localization</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/setting-up-instagram\">Setting up Instagram</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/modifying-extensions\">Modifying extensions</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/using-native-api\">Using native API</a></li>\n\t\t\t<li>\n\t\t\t\t<a class=\"menu-group-title\"\n\t\t\t\t\thref=\"{{ site.baseurl }}/docs/extensions/tutorials/settings-pages-introduction\">Settings pages</a>\n\t\t\t\t<ul id=\"ui-toolkit-components\" class=\"menu-group-wrapper level-3\">\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/settings-pages-introduction\">Introduction</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/writing-react-settings-page\">Writing React settings\n\t\t\t\t\t\t\tpages</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/writing-html-settings-page\">Writing HTML settings\n\t\t\t\t\t\t\tpages</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/debug-settings-pages\">Local development</a></li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<a class=\"menu-group-title\"\n\t\t\t\t\thref=\"{{ site.baseurl }}/docs/extensions/tutorials/navigation-introduction\">Navigation guides</a>\n\t\t\t\t<ul id=\"ui-toolkit-components\" class=\"menu-group-wrapper level-3\">\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/navigation-introduction\">Introduction</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/navigation-breaking-changes\">Breaking changes</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/navigation-stacks\">Navigation stacks</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/tutorials/navigation-screen-decorators\">Screen decorators</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\t</li>\n\n\t<!-- Reference -->\n\t<li>\n\t\t<a class=\"menu-group-title\" href=\"{{ site.baseurl }}/docs/extensions/reference/overview\">Reference</a>\n\t\t<ul id=\"extensions-tutorials\" class=\"menu-group-wrapper level-2\">\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/reference/overview\">Technical Overview</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/reference/extension\">Extension file format</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/reference/platform\">Platform</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/reference/extension-exports\">Extension exports</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/reference/settings-types\">Settings types</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/reference/theme-variables\">Theme variables</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/extensions/reference/cli\">CLI</a></li>\n\t\t</ul>\n\t</li>\n\n\t<!-- UI toolkit -->\n\t<li>\n\t\t<a class=\"menu-group-title\" href=\"{{ site.baseurl }}/docs/ui-toolkit/introduction\">Shoutem UI toolkit</a>\n\t\t<ul id=\"ui-toolkit\" class=\"menu-group-wrapper level-2\">\n\t\t\t<!-- Introduction -->\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/introduction\">Introduction</a></li>\n\t\t\t<!-- Components -->\n\t\t\t<li>\n\t\t\t\t<a class=\"menu-group-title\" href=\"{{ site.baseurl }}/docs/ui-toolkit/components/typography\">Components</a>\n\t\t\t\t<ul id=\"ui-toolkit-components\" class=\"menu-group-wrapper level-3\">\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/typography\">Typography</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/navigation-bar\">NavigationBar</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/dropdown-menu\">DropDownMenu</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/list-view\">ListView</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/grid-view\">GridView</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/cards\">Cards</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/dividers\">Dividers</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/rows\">Rows</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/tiles\">Tiles</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/spinner\">Spinner</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/buttons\">Buttons</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/switch\">Switch</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/image\">Image</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/image-background\">ImageBackground</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/image-preview\">ImagePreview</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/inline-gallery\">InlineGallery</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/image-gallery\">ImageGallery</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/icons\">Icons</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/view\">View</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/screen\">Screen</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/touchable-opacity\">TouchableOpacity</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/touchable\">Touchable</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/headers\">Headers</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/overlay\">Overlay</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/text-input\">TextInput</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/video\">Video</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/lightbox\">Lightbox</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/html\">HTML</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/components/simplehtml\">SimpleHtml</a></li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t\t<!-- Theme -->\n\t\t\t<li>\n\t\t\t\t<a href=\"{{ site.baseurl }}/docs/ui-toolkit/theme/introduction\">Theme</a>\n\t\t\t</li>\n\t\t\t<!-- Animation -->\n\t\t\t<li>\n\t\t\t\t<a class=\"menu-group-title\" href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/introduction\">Animation</a>\n\t\t\t\t<ul id=\"ui-toolkit-animation\" class=\"menu-group-wrapper level-3\">\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/introduction\">Introduction</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/driver\">Driver</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/fade-in\">FadeIn</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/fade-out\">FadeOut</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/zoom-in\">ZoomIn</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/zoom-out\">ZoomOut</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/parallax\">Parallax</a></li>\n\t\t\t\t\t<li><a href=\"{{ site.baseurl }}/docs/ui-toolkit/animation/combining-animations\">Combining Animations</a></li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\t</li>\n\n\t<!-- Shoutem Cloud -->\n\t<li>\n\t\t<a class=\"menu-group-title\" href=\"{{ site.baseurl }}/docs/cloud/introduction\">Shoutem Cloud</a>\n\t\t<ul id=\"ui-toolkit\" class=\"menu-group-wrapper level-2\">\n\t\t\t<!-- Introduction -->\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/cloud/introduction\">Introduction</a></li>\n\t\t\t<li><a href=\"{{ site.baseurl }}/docs/cloud/data-schemas\">Data Schemas Reference</a></li>\n\t\t</ul>\n\t</li>\n\n\t<!-- FAQ -->\n\t<li><a class=\"menu-group-title\" href=\"{{ site.baseurl }}/docs/extensions/tutorials/faq\">FAQ</a></li>\n\n\t<li id=\"signup-button-menu\" class=\"menu-button-signup hidden-md hidden-lg\"><a href=\"#signup\"\n\t\t\tclass=\"button-signup\">Stay informed</a></li>\n\t<li class=\"sidelink hidden-md hidden-lg\"><a href=\"http://new.shoutem.com\">Shoutem home</a></li>\n\t<li class=\"sidelink hidden-md hidden-lg\"><a href=\"http://new.shoutem.com/about\">About</a></li>\n\t<li class=\"sidelink hidden-md hidden-lg\"><a href=\"http://new.shoutem.com/terms-of-service\">Terms of service</a></li>\n\t<li class=\"sidelink hidden-md hidden-lg\"><a href=\"http://new.shoutem.com/about/contact-us\">Contact us</a></li>\n</ul>\n"
  },
  {
    "path": "_includes/signup-modal.html",
    "content": "<div id=\"signup-modal\" role=\"dialog\" aria-labelledby=\"dialog-title\" aria-describedby=\"dialog-description\">\n  <div class=\"content\">\n    <div class=\"signup-title\" id=\"dialog-title\">Stay informed</div>\n    <div class=\"signup-description\" id=\"dialog-description\">Subscribe to our newsletter if you'd like to stay informed about Shoutem Extensions and Shoutem UI Toolkit.</div>\n    <!-- Begin MailChimp Signup Form -->\n    <div id=\"mc_embed_signup\">\n      <form action=\"//shoutem.us1.list-manage.com/subscribe/post?u=2465033d224d289aca631307f&amp;id=8c16387120\" method=\"post\" id=\"mc-embedded-subscribe-form\" name=\"mc-embedded-subscribe-form\" class=\"validate\" target=\"_blank\" novalidate>\n        <div id=\"mc_embed_signup_scroll\">\n            <label for=\"mce-EMAIL\">Enter your email*</label>\n            <input type=\"email\" spellcheck=\"false\" value=\"\" name=\"EMAIL\" class=\"signup-email required email form-control\" placeholder=\"Enter your email\" id=\"mce-EMAIL\">\n          <div class=\"control-buttons\">\n            <input type=\"button\" value=\"Cancel\" name=\"cancel\" id=\"mc-embedded-cancel\" class=\"cancel-button\"><input type=\"submit\" value=\"Sign up\" name=\"subscribe\" id=\"mc-embedded-subscribe\" class=\"signup-button\">\n          </div>\n\n          <div id=\"mce-responses\" class=\"clear\">\n            <div class=\"response\" id=\"mce-error-response\" style=\"display:none\"></div>\n            <div class=\"response\" id=\"mce-success-response\" style=\"display:none\"></div>\n          </div>\n          <div style=\"position: absolute; left: -5000px;\" aria-hidden=\"true\"><input type=\"text\" name=\"b_2465033d224d289aca631307f_8c16387120\" tabindex=\"-1\" value=\"\"></div>\n          <div class=\"clear\"></div>\n        </div>\n      </form>\n    </div>\n    <!--End mc_embed_signup-->\n  </div> \n</div>"
  },
  {
    "path": "_layouts/doc.html",
    "content": "<!DOCTYPE html>\n<html>\n\n{% include head.html %}\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.url }}/css/prism.css\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.url }}/css/documentation.css\">\n<!-- <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.url }}/lib/codemirror/codemirror.css\"> -->\n</head>\n\n<body class=\"documentation\">\n\t{% include navbar.html %}\n\n\t<div id=\"sidebar-wrapper\">\n\t\t{% include sidebar-nav.html %}\n\t</div>\n\n\t<div id=\"wrapper\">\n\n\t\t<div class=\"documentation-wrapper\">\n\t\t\t<div id=\"documentation\">\n\t\t\t\t<!-- It will work both on page and github markdown -->\n\t\t\t\t{{ content }}\n\t\t\t</div>\n\t\t</div>\n\n\t\t<nav id=\"pager-wrapper\">\n\t\t\t<ul class=\"pager\">\n\t\t\t\t<li class=\"previous inactive\"><a href=\"#\"><span>Previous</span></a></li>\n\t\t\t\t<li class=\"next inactive\"><a href=\"#\"><span>Next</span></a></li>\n\t\t\t</ul>\n\t\t</nav>\n\n\t</div>\n\n\t<div class=\"mobile-menu-overlay\">\n\t\t<div class=\"close-menu-overlay\">\n\t\t</div>\n\t</div>\n\n\t{% include signup-modal.html %}\n\n  <!-- <script src=\"{{ site.url }}/lib/codemirror/codemirror.js\"></script>\n  <script src=\"{{ site.url }}/lib/codemirror/mode/javascript/javascript.js\"></script>\n  <script src=\"{{ site.url }}/lib/codemirror/mode/jsx/jsx.js\"></script> -->\n\n  <script src=\"https://code.jquery.com/jquery-2.2.3.min.js\"   integrity=\"sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=\"   crossorigin=\"anonymous\"></script>\n  <script type=\"text/javascript\" src=\"{{ site.url }}/js/headroom.min.js\"></script>\n  <script src=\"{{ site.url }}/js/flourish-0.3.2.min.js\"></script>\n  <script src=\"{{ site.url }}/js/main.js\"></script>\n  <script src=\"{{ site.url }}/js/docs.js\"></script>\n  <script src=\"{{ site.url }}/js/prism.js\" data-manual></script>\n  {% include ga.html %}\n\t<script type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js\"></script>\n\t<script type=\"text/javascript\"> docsearch({\n    apiKey: '6b283baa7ff0e8454787d13149aa3a77',\n    indexName: 'shoutem',\n    inputSelector: '#navbar-search-input',\n    debug: false\n\t});\n\t</script>\n</body>\n\n</html>\n\n"
  },
  {
    "path": "_layouts/home.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en-us\">\n\n{% include head.html %}\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.url }}/css/home.css\">\n</head>\n\n<body class=\"home\">\n\t{% include navbar.html %}\n\n\t<div id=\"wrapper\" class=\"home\">      \n\n\t\t<div class=\"container-fluid\">\n\t\t\t<div class=\"header row\">\n\t\t\t\t<div class=\"main col-xs-12\">\n\t\t\t\t\t<div class=\"shoutem-ani\"></div> \n\t\t\t\t\t<div class=\"header-wrapper\">\n\n\t\t\t\t\t\t<div class=\"header-text\">\n\t\t\t\t\t\t\t<h1 class=\"main-heading\">A platform to build, publish, and manage native apps with ease</h1>\n\t\t\t\t\t\t\t<h2 class=\"sub-heading\">Build beautiful native apps with <strong>Shoutem</strong> and <strong>React Native</strong> in no time</h2>\n\t\t\t\t\t\t\t<div class=\"os-icons\">\n\t\t\t\t\t\t\t\t<img src=\"img/ic_apple.svg\" alt=\"\" class=\"icon-apple\" />\n\t\t\t\t\t\t\t\t<img src=\"img/ic_android.svg\" alt=\"\" class=\"icon-android\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"row blue-background section-step0 with-arrow\">\n\t\t\t\t<div class=\"section narrow\">\n\t\t\t\t\t<h2 class=\"section-header section-header--big\">How does it work?</h2>\n\t\t\t\t\t<ol class=\"flex-container steps\">\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<div class=\"step-title\">1. Get a head start</div>\n\t\t\t\t\t\t\t<div class=\"step-button arrow-box\"><span class=\"center-v\">Backend, 40+ extensions, push, analytics</span></div>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<div class=\"step-title\">2. Customize</div>\n\t\t\t\t\t\t\t<div class=\"step-button arrow-box\"><span class=\"center-v\">No limits, powered by React Native</span></div>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<div class=\"step-title\">3. Automate maintenance</div>\n\t\t\t\t\t\t\t<div class=\"step-button publish-button\"><span class=\"center-v\">Automated publishing and updates</span></div>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ol>\n\t\t\t\t\t<div class=\"section-footer\">When was the last time you’ve heard that someone built eCommerce website from scratch? Hm…, like never. So why would you build an app from scratch?</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"row section-customization\">\n\t\t\t\t<div class=\"section wider\">\n\t\t\t\t\t<h2 class=\"section-header\">\n\t\t\t\t\t\tGet a head start with Shoutem extensions\n\t\t\t\t\t</h2>\n\t\t\t\t\t{% include cards.html %}\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"row blue-background section-step2\">\n\t\t\t\t<div class=\"section wider\">\n\t\t\t\t\t<h2 class=\"section-header\">\n\t\t\t\t\t\tCustomize without limits, it’s open source\n\t\t\t\t\t</h2>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<div class=\"col-sm-7 col-sm-offset-1 image-rn-code\">\n\t\t\t\t\t\t\t<img src=\"img/image-rn-code-combined@2x.png\" alt=\"\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<ul class=\"col-md-4 bullet-points\">\n\t\t\t\t\t\t\t<li><span class=\"bullet-icon a\"></span><span class=\"bullet-text\">Customize our extensions or create your own</span></li>\n\t\t\t\t\t\t\t<li><span class=\"bullet-icon b\"></span><span class=\"bullet-text\">Code, test and debug locally</span></li>\n\t\t\t\t\t\t\t<li><span class=\"bullet-icon a\"></span><span class=\"bullet-text react-native\">100% JavaScript and <a href=\"https://facebook.github.io/react-native/\" target=\"_blank\">React Native <span class=\"bullet-icon react\"></span></a></span></li>\n\t\t\t\t\t\t\t<li><span class=\"bullet-icon a\"></span><span class=\"bullet-text\">Extensive documentation and developer tools</span></li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"row section-step3\">\n\t\t\t\t<div class=\"section narrow\">\n\n\t\t\t\t\t<h2 class=\"section-header\">Publish and update regularly with ease</h2>\n\t\t\t\t\t<h3 class=\"section-sub-header\">A CMS backend anyone can use</h3>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"section fullwidth\">\n\n\t\t\t\t\t<div class=\"col col-md-5 text\">\n\t\t\t\t\t\t<div class=\"bullets-wrapper\">\n\t\t\t\t\t\t\t<div class=\"bullet-points\">\n\t\t\t\t\t\t\t\t<div class=\"bullet bullet-publish\">\n\t\t\t\t\t\t\t\t\t<h4>Publish to stores</h4>\n\t\t\t\t\t\t\t\t\t<p>Publish automatically to App Store and Google Play</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"bullet bullet-manage\">\n\t\t\t\t\t\t\t\t\t<h4>Manage content</h4>\n\t\t\t\t\t\t\t\t\t<p>Grant moderator access to content managers</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"bullet bullet-analyse\">\n\t\t\t\t\t\t\t\t\t<h4>Analyse and engage</h4>\n\t\t\t\t\t\t\t\t\t<p>Analyze usage. Send push notifications</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"col col-md-7 carousel\">\n\t\t\t\t\t\t<div class=\"images\">\n\t\t\t\t\t\t\t<img src=\"img/builder-shots/builder-shot-1.jpg\"\n\t\t\t\t\t\t\t\tsrcset=\"img/builder-shots/builder-shot-1.jpg 1x,\n\t\t\t\t\t\t\t\t\t\timg/builder-shots/builder-shot-1@2x.jpg 2x\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"row section-step4\">\n\t\t\t\t<div class=\"section section-featured\">\n\t\t\t\t\t<h2 class=\"section-header section-header--big\">Featured Shoutem apps</h2>\n\n\t\t\t\t\t<p>Shoutem apps are slick and fast. Best if experienced first-hand!</p>\n\n\t\t\t\t\t<div class=\"featured-apps\">\n\n\t\t\t\t\t\t<a href=\"https://itunes.apple.com/us/app/brides-wedding-genius-5-1/id426415850\" target=\"_blank\">\n\t\t\t\t\t\t\t<img src=\"img/featured/brides.png\" alt=\"\" />\n\t\t\t\t\t\t\t<p>Brides Wedding Genius</p>\n\t\t\t\t\t\t</a>\n\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t</div>\n\t</div>\n\t\n\t<div id=\"mobile-menu-overlay\" class=\"mobile-menu-overlay\">\n\t\t<div class=\"close-menu-overlay\"></div>\n\t\t<ul class=\"navigation\">\n\t\t\t<li class=\"primary active\"><a href=\"/\">Home</a></li>\n\t\t\t<li class=\"primary\"><a href=\"{{ site.url }}/docs/extensions/tutorials/getting-started\">Getting started</a></li>\n\t\t\t<li class=\"primary\"><a href=\"{{ site.url }}/docs/extensions/my-first-extension/introduction\">My first extension</a></li>\n\t\t\t<li class=\"primary\"><a href=\"{{ site.url }}/docs/extensions/tutorials/setting-local-environment\">Basics</a></li>\n\t\t\t<li class=\"primary\"><a href=\"{{ site.url }}/docs/extensions/tutorials/writing-settings-page\">Advanced</a></li>\n\t\t\t<li class=\"primary\"><a href=\"{{ site.url }}/docs/extensions/reference/overview\">Reference</a></li>\n\t\t\t<li class=\"primary\"><a href=\"{{ site.url }}/docs/ui-toolkit/introduction\">Shoutem UI toolkit</a></li>\n\t\t\t<li class=\"primary\"><a href=\"{{ site.url }}/docs/cloud/introduction\">Shoutem Cloud</a></li>\n\t\t\t<li id=\"signup-button-menu\" class=\"menu-button-signup\"><a href=\"#signup\" class=\"button-signup\">Stay informed</a></li>\n\t\t\t<li><a href=\"https://www.shoutem.com\">Shoutem home</a></li>\n\t\t\t<li><a href=\"https://www.shoutem.com/about\">About</a></li>\n\t\t\t<li><a href=\"https://www.shoutem.com/terms-of-service\">Terms of service</a></li>\n\t\t\t<li><a href=\"https://www.shoutem.com/about/contact-us\">Contact us</a></li>\n\t\t</ul>\n\t\t<span class=\"pager\"></span>\n\t</div>\n\n\t{% include footer.html %}\n\t<script src=\"https://code.jquery.com/jquery-3.2.0.min.js\" integrity=\"sha256-JAW99MJVpJBGcbzEuXk4Az05s/XyDdBomFqNlM3ic+I=\" crossorigin=\"anonymous\"></script>\n\t<script src=\"{{ site.url }}/js/animation.js\"></script>\n\t<script src=\"{{ site.url }}/js/headroom.min.js\"></script>\n\t<script src=\"{{ site.url }}/js/dragdealer.min.js\"></script>\n\t<script src=\"{{ site.url }}/js/main.js\"></script>\n\t{% include ga.html %}\n</body>\n</html>\n"
  },
  {
    "path": "_layouts/overview.html",
    "content": "<!DOCTYPE html>\n<html>\n\n{% include head.html %}\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.url }}/css/prism.css\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.url }}/css/documentation.css\">\n<!-- <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ site.url }}/lib/codemirror/codemirror.css\"> -->\n</head>\n\n<body class=\"documentation overview\">\n\t{% include navbar.html %}\n\n\t<div id=\"sidebar-wrapper\">\n\t\t{% include sidebar-nav.html %}\n\t</div>\n\n\t<div id=\"wrapper\">\n\n\t\t<div class=\"documentation-wrapper\">\n\t\t\t<div id=\"documentation\">\n\t\t\t\t<!-- It will work both on page and github markdown -->\n\t\t\t\t{% include overview-content.html %}\n\t\t\t</div>\n\t\t</div>\n\n\t\t<nav id=\"pager-wrapper\">\n\t\t\t<ul class=\"pager\">\n\t\t\t\t<li class=\"previous inactive\"><a href=\"#\"><span>Previous</span></a></li>\n\t\t\t\t<li class=\"next inactive\"><a href=\"#\"><span>Next</span></a></li>\n\t\t\t</ul>\n\t\t</nav>\n\n\t</div>\n\n\t<div class=\"mobile-menu-overlay\">\n\t\t<div class=\"close-menu-overlay\">\n\t\t</div>\n\t</div>\n\n\t{% include signup-modal.html %}\n\n  <!-- <script src=\"{{ site.url }}/lib/codemirror/codemirror.js\"></script>\n  <script src=\"{{ site.url }}/lib/codemirror/mode/javascript/javascript.js\"></script>\n  <script src=\"{{ site.url }}/lib/codemirror/mode/jsx/jsx.js\"></script> -->\n\n  <script src=\"https://code.jquery.com/jquery-2.2.3.min.js\"   integrity=\"sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=\"   crossorigin=\"anonymous\"></script>\n  <script type=\"text/javascript\" src=\"{{ site.url }}/js/headroom.min.js\"></script>\n  <script src=\"{{ site.url }}/js/flourish.js\"></script>\n  <script src=\"{{ site.url }}/js/main.js\"></script>\n  <script src=\"{{ site.url }}/js/docs.js\"></script>\n  <script src=\"{{ site.url }}/js/prism.js\" data-manual></script>\n  {% include ga.html %}\n</body>\n\n</html>\n\n"
  },
  {
    "path": "_sass/animation.scss",
    "content": "$imagesPath: '../img/';\n\n/* animation container */\n.shoutem-ani { \n    position: absolute; \n    z-index: 1; \n    left: 0; \n    top: 0; \n    width: 100%; \n    height: 100%; \n    overflow: hidden;\n    pointer-events: none;\n\n    .particle { \n        position: absolute; \n        pointer-events: none; \n        user-select: none; \n        -webkit-touch-callout: none; \n        touch-callout: none; \n    }\n    .particle-1 { \n        @include size(14px, 14px);\n        @include background-png-3x(particle-1); \n    }\n    .particle-2 {\n        @include size(24px, 24px);\n        @include background-png-3x(particle-2);\n    }\n    .particle-3 { \n        @include size(15px, 15px);\n        @include background-png-3x(particle-3);\n        /*@include rotating();*/\n    }\n    .particle-4 { \n        @include size(15px, 15px);\n        @include background-png-3x(particle-4);\n        /*@include rotating();*/\n    }\n    .particle-5 {\n        @include size(75px, 95px);\n        @include background-png-3x(particle-5);\n\n        .thrust-line { \n            position: absolute; \n            top: 77px;\n            @include size(3px, 15px);\n            @include border-radius(2px);\n            background: white;\n            animation: ani-thrust-line 1.1s linear infinite;\n        }\n        .thrust-line-1 { \n            left: 19px; \n        }\n        .thrust-line-2 { \n            left: 24px; \n            animation-delay: 0.25s;\n        }\n        .thrust-line-3 { \n            left: 29px; \n            animation-delay: 0.65s;\n        }\n        .thrust-line-4 { \n            left: 43px; \n            animation-delay: 0.35s;\n        }\n        .thrust-line-5 { \n            left: 48px; \n            animation-delay: 0.85s;\n        }\n        .thrust-line-6 { \n            left: 53px; \n            animation-delay: 0.55s;\n        }    \n    }\n}\n"
  },
  {
    "path": "_sass/base.scss",
    "content": "/* Bootstrap overrides */\nbody {\n    color: $primary;\n    line-height: 30px;\n}\nblockquote {\n    border-width: 1px;\n    font-size: 17px;\n    padding: 1px 22px;\n}\nblockquote p {\n    color: $primary\n}\n\nblockquote .small, \nblockquote footer, \nblockquote small {\n    display: block;\n    font-size: 16px;\n    font-weight: normal;\n}\n\n/*Remove line from blockqute*/\nblockquote .small:before, \nblockquote footer:before, \nblockquote small:before {\n    content: \"\";\n}\n\npre {\n    border-color: $code;\n    margin-bottom: 24px;\n}\n\nhr {\n    display: none;\n}\n\nhr.menu-hr {\n    display: block;\n    border-top: 1px solid #ccc;\n    margin-top: 15px;\n    margin-bottom: 12px;\n}\n\np {\n    margin-bottom: 20px;\n    color: $text;\n}\nh1 {\n    @include headline(48px, 48px);\n}\n\nh2 {\n    @include headline(24px, 32px);\n}\n\nh4 {\n    font-weight: bold;\n    margin-bottom: 25px;\n}\n\nh5 {\n    @include headline(20px, 32px);\n    font-weight: normal;\n}\n\na:focus,\na:hover {\n    color: $accent;\n    text-decoration: underline;\n    outline: none;\n}\n\n.row {\n    position: relative;\n}\n\n::-moz-selection {\n    color: white;\n    background: #00aadf;\n    text-shadow: none;\n}\n\n::selection {\n    color: white;\n    background: #00aadf;\n    text-shadow: none;\n}\n\ninput[type=text], input[type=tel], input[type=email], input[type=submit], textarea {\n    -webkit-font-smoothing: antialiased; \n    -moz-osx-font-smoothing: grayscale; \n    -webkit-appearance: none;\n    appearance: none; \n    resize: none; \n    outline: none;\n}"
  },
  {
    "path": "_sass/cards.scss",
    "content": ".list-cards {\n    display: flex;\n    justify-content: space-between;\n    margin-top: 40px;\n\n    @include medium {\n        flex-direction: column;\n\n        .card {\n            margin-left: auto;\n            margin-right: auto;\n            margin-top: 48px;\n        }\n    }\n}\n\n.card {\n    display: inline-block;\n\n    &.rounded {\n        border-radius: 4px;\n\n        .card-image {\n            border-top-left-radius: 4px;\n            border-top-right-radius: 4px;\n        }\n    }\n\n    &.shadowed {\n        box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1),\n                    0 0 2px 0 rgba(0, 0, 0, 0.1);\n        transition: box-shadow ease-out 0.2s;\n\n        &:hover,\n        &:active {\n            box-shadow: 0 19px 38px 0 rgba(0, 0, 0, 0.3),\n                        0 15px 12px 0 rgba(0, 0, 0, 0.2);\n        }\n    }\n\n    img {\n        max-width: 100%;\n    }\n\n    .card-content {\n        .card-title {\n            margin-top: 16px;\n            font-size: 15px;\n            font-weight: normal;\n            line-height: 24px;\n            text-transform: none;\n            color: #444f6c;\n\n            @include medium {\n                margin-top: 0;\n                line-height: normal;\n            }\n        }\n        \n        p {\n            color: #888fa1;\n            font-size: 14px;\n            line-height: 24px;\n\n            @include medium {\n                margin-top: 4px;\n            }\n        }\n    }\n}"
  },
  {
    "path": "_sass/colors.scss",
    "content": "/*Documentation*/\n$accent: #00aadf;\n$primary: #444f6c;\n$primaryhover: #4a5b85;\n$secondary: rgba(68, 79, 108, 0.2);\n$secondaryhover: rgba(68, 79, 108, 0.3);\n$text: #888fa1;\n$code: #f3f3f3;\n$lightaccent: rgba(0, 170, 223, 0.08);\n$lightaccent-2: rgba(0, 170, 223, 0.16);\n\n/*Landing page*/\n$hometext: #697289;\n$homeheading: #222b35;\n$lightbackground: #efefef;\n$footercolor: #7b7f8c;\n$footerbackground: #232b40;\n$muted: #858585;\n$green: #6db81d;\n$graybackground: #ebebeb;\n$bluebackground: #e5f7fc;\n$darkbluebackground: #2e3854;\n$chapterfooter: #969cac;\n"
  },
  {
    "path": "_sass/documentation-layout.scss",
    "content": ".container-fluid,\n.navbar .container-fluid\n{\n  max-width: 1920px;\n}\n\n#wrapper {\n    width: 100%;\n    background: #FFFFFF;\n}\n\n.documentation-wrapper {\n    max-width: 1920px;\n    padding-left: 280px;\n    margin: 0 auto;\n\n    @media screen and (max-width: 991px) {\n        padding-left: 0;\n    }\n}\n\n#documentation {\n  max-width: 870px;\n  width: 75%;\n  margin: 0 auto;\n\n  @include mobile {\n      width: auto;\n      margin: 0 20px;\n  }\n}\n\n.image {\n    margin-top: 20px;\n    margin-bottom: 40px;\n\n    img {\n      margin: 0 auto;\n      display: block;\n      width: 100%;\n      border: 1px solid #bdc0cb;\n      border: none;\n   }\n}\n\n.navbar {\n  margin-bottom: 0;\n}"
  },
  {
    "path": "_sass/footer.scss",
    "content": ".footer {\n\n    position: fixed; \n    bottom: 0; \n    width: 100%; \n    z-index: -1;\n\n    @include small {\n        position: static;\n    }\n\n    .signup {\n        text-align: center;\n        background-color: #00AADF;\n\n        padding: 0 24px;\n\n        .signup-title {\n            @include headline(45px, 60px, #fff);\n            font-weight: 100;\n            text-align: center;\n            padding-top: 80px;\n            margin-bottom: 15px;\n\n            @include mobile {\n                font-size: 36px;\n                line-height: 46px;\n                max-width: 240px;\n                margin: 0 auto 15px;\n                padding-top: 60px;\n            }\n        }\n\n        .signup-description {\n            color: rgba(#ffffff, 0.8);\n            line-height: 30px;\n            max-width: 570px;\n            margin: 0 auto 32px;\n\n            @include mobile {\n                width: 100%;\n                margin-bottom: 30px;\n            }\n        }\n\n        .signup-email {\n            width: 370px;\n            height: 56px;\n            border-radius: 0;\n            background-color: transparent;\n            padding: 1px 0 0;\n            margin-bottom: 80px;\n            margin-right: 8px;\n            border: none;\n            border-bottom: 1px solid rgba(#ffffff, 0.7);\n            color: #FFF;\n\n            &::-webkit-input-placeholder {\n                color: rgba(#ffffff, 0.7);\n            }\n            &::-moz-placeholder { /* Firefox 19+ */\n                color: rgba(#ffffff, 0.7);\n                opacity: 1;\n            }\n            &:-ms-input-placeholder {\n                color: rgba(#ffffff, 0.7);\n            }\n            &:-moz-placeholder {\n                color: rgba(#ffffff, 0.7);\n                opacity: 1;\n            }\n\n            @include easeLinear;\n            \n            &:focus {\n                color: #ffffff;\n                border-color: #ffffff;\n                background: none;\n            }\n            \n            @include small {\n                margin-bottom: 12px;\n                margin-left: auto;\n                margin-right: auto;\n                width: 100%;\n                max-width: 280px;\n                display: block;\n            }\n        }\n\n        .signup-button {\n            width: 188px;\n            height: 56px;\n            border: 1px solid #fff;\n            border-radius: 4px;\n            background-color: #fff;\n            text-transform: uppercase;\n            margin-bottom: 40px;\n            font-weight: bold;\n            font-size: 14px;\n            letter-spacing: 1px;\n            padding: 0;\n\n            @include easeLinear;\n            \n            &:hover,\n            &:focus,\n            &:active {\n                background-color: #f4f4f4;\n                border-color: #f4f4f4;\n            }\n\n            @include small {\n                width: 100%;\n                max-width: 280px;\n                margin-bottom: 60px;\n            }           \n        }\n        \n    }\n\n    .bottom-footer {\n\n        background-color: $footerbackground;\n        height: 90px;\n        color: $footercolor;\n        padding-top: 22px;\n    \n        @include small {\n            height: 326px;\n        }\n\n        .container-fluid {\n            max-width: 1210px;\n        }\n\n        .footer-logo {        \n            @include logoimage('../img/shoutem_logo_footer.png', 85px, 30px);\n            opacity: 0.4;\n            float: left;\n            margin-top: 9px;\n            @include easeLinear;\n\n            @include small {\n                float: none;\n                display: block;\n                margin-bottom: 24px;\n            }\n\n            @include small {\n                margin: 8px 0 12px;\n            }\n            \n            &:hover,\n            &:active {\n                opacity: 1;\n            }\n        }\n\n        .footer-menu {\n            float: right;\n            opacity: 1;\n            color: $footercolor;\n            list-style: none;\n            margin-top: 10px;\n            margin-left: 0;\n            padding-left: 0;\n\n            @include small {\n                float: none;\n                padding: 0;\n            }\n\n            @include small {\n                margin-top: 0;\n            }\n\n            li {\n                float: left;\n\n                @include small {\n                    float: none;\n                    display: block;\n                }\n\n                &.icon-twitter a,\n                &.icon-github a {\n                    background-image: url(/img/icon-twitter.svg);\n                    background-repeat: no-repeat;\n                    background-size: 22px;\n                    background-position: center;\n                    text-indent: -100px;\n                    width: 24px;\n                    height: 24px;\n                    overflow: hidden;\n                    display: inline-block;\n                    margin-left: 48px;\n                    margin-top: 3px;\n                    opacity: 0.4;\n\n                    &:hover,\n                    &:active {\n                        opacity: 1;\n                    }\n\n                    @include small {\n                        margin-top: 0;\n                    }\n                }\n\n                &.icon-twitter a {\n                    @include small {\n                        margin-left: 24px;\n                    }\n                }\n\n                &.icon-github {\n\n                    @include small {\n                        &:before {\n                            content: \"Follow\";\n                            text-transform: uppercase;\n                            font-size: 13px;\n                            letter-spacing: 1px;\n                            display: block;\n                            color: $text;\n                            opacity: 0.5;\n                            margin: 23px 0 17px;\n                        }\n                    }\n\n                    a {\n                        background-image: url(/img/icon-github.svg);\n                        background-size: 20px;\n                        margin-left: 37px;\n\n                        @include small {\n                            margin-left: 0;\n                            float: left;\n                        }\n                    }\n                }\n            }\n\n            a {\n                color: $text;\n                @include easeLinear;\n                font-size: 14px;\n                padding: 10px 11px;\n                margin-left: 22px;\n\n                &:hover,\n                &:active {\n                    color:  white;\n                    text-decoration: none;\n                }\n\n                @include small {\n                    margin-left: 0;\n                    display: block;\n                    padding: 5px 0;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "_sass/github.scss",
    "content": "/*\n   Copyright 2014 GitHub Inc.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n*/\n\n.pl-c /* comment */ {\n  color: #969896;\n}\n\n.pl-c1      /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */,\n.pl-s .pl-v /* string variable */ {\n  color: #0086b3;\n}\n\n.pl-e  /* entity */,\n.pl-en /* entity.name */ {\n  color: #795da3;\n}\n\n.pl-s .pl-s1 /* string source */,\n.pl-smi      /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ {\n  color: #333;\n}\n\n.pl-ent /* entity.name.tag */ {\n  color: #63a35c;\n}\n\n.pl-k /* keyword, storage, storage.type */ {\n  color: #a71d5d;\n}\n\n.pl-pds              /* punctuation.definition.string, string.regexp.character-class */,\n.pl-s                /* string */,\n.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */,\n.pl-sr               /* string.regexp */,\n.pl-sr .pl-cce       /* string.regexp constant.character.escape */,\n.pl-sr .pl-sra       /* string.regexp string.regexp.arbitrary-repitition */,\n.pl-sr .pl-sre       /* string.regexp source.ruby.embedded */ {\n  color: #183691;\n}\n\n.pl-v /* variable */ {\n  color: #ed6a43;\n}\n\n.pl-id /* invalid.deprecated */ {\n  color: #b52a1d;\n}\n\n.pl-ii /* invalid.illegal */ {\n  background-color: #b52a1d;\n  color: #f8f8f8;\n}\n\n.pl-sr .pl-cce /* string.regexp constant.character.escape */ {\n  color: #63a35c;\n  font-weight: bold;\n}\n\n.pl-ml /* markup.list */ {\n  color: #693a17;\n}\n\n.pl-mh        /* markup.heading */,\n.pl-mh .pl-en /* markup.heading entity.name */,\n.pl-ms        /* meta.separator */ {\n  color: #1d3e81;\n  font-weight: bold;\n}\n\n.pl-mq /* markup.quote */ {\n  color: #008080;\n}\n\n.pl-mi /* markup.italic */ {\n  color: #333;\n  font-style: italic;\n}\n\n.pl-mb /* markup.bold */ {\n  color: #333;\n  font-weight: bold;\n}\n\n.pl-md /* markup.deleted, meta.diff.header.from-file */ {\n  background-color: #ffecec;\n  color: #bd2c00;\n}\n\n.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ {\n  background-color: #eaffea;\n  color: #55a532;\n}\n\n.pl-mdr /* meta.diff.range */ {\n  color: #795da3;\n  font-weight: bold;\n}\n\n.pl-mo /* meta.output */ {\n  color: #1d3e81;\n}\n\n"
  },
  {
    "path": "_sass/helpers.scss",
    "content": ".center-v {\n    position: relative;\n    top: 50%;\n    transform: translateY(-45%);\n}"
  },
  {
    "path": "_sass/menu-overlay.scss",
    "content": "@import \"variables\";\n@import \"mixins\";\n\n.mobile-menu-overlay {\n    position: fixed;\n    visibility: hidden;\n    top: 0;\n    right: 0;\n    width: 100%;\n    height: 100%;\n    z-index: 1060;\n    transition: visibility 0.5s;\n    \n    @include medium-2 {\n        &.open {\n            visibility: visible;\n\n            .navigation {\n                transform: translate(0, 0);\n                transform: translate3d(0, 0, 0);\n            }\n\n            .close-menu-overlay {\n                opacity: 1;\n            }\n        }\n    }\n\n    .navigation {\n        position: absolute;\n        right: 0;\n        padding-top: 24px;\n        width: 286px;\n        height: 100%;\n        overflow: auto;\n        background: #FFF;\n        transform: translate(100%, 0);\n        transform: translate3d(100%, 0, 0);\n        transition: transform .5s;\n\n        ul li a {\n            padding-left: 40px;\n        }\n\n        @include tiny {\n            width: 256px;\n        }\n    }\n    \n    .close-menu-overlay {\n        position: absolute;\n        height: 100%;\n        width: 100%;\n        top: 0;\n        left: 0;\n        background: rgba(68, 79, 108, 0.5);\n        opacity: 0;\n        transition: opacity 0.5s\n    }\n}"
  },
  {
    "path": "_sass/mixins.scss",
    "content": "@mixin headline ($size, $lineheight, $color: $primary) {\n  font-size: $size;\n  line-height: $lineheight;\n  color: $color;\n}\n\n@mixin logoimage ($imageurl, $width, $height) {\n  background-image: url($imageurl);\n  width: $width;\n  height: $height;\n  background-size: 100%;\n  background-repeat: no-repeat;\n}\n\n@mixin flexcontainer () {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n}\n\n/// Mixin to manage responsive breakpoints\n/// @author Hugo Giraudel\n/// @param {String} $breakpoint - Breakpoint name\n/// @require $breakpoints\n@mixin respond-to($breakpoint) {\n  // If the key exists in the map\n  @if map-has-key($breakpoints, $breakpoint) {\n    // Prints a media query based on the value\n    @media (min-width: map-get($breakpoints, $breakpoint)) {\n      @content;\n    }\n  }\n \n  // If the key doesn't exist in the map\n  @else {\n    @warn \"Unfortunately, no value could be retrieved from `#{$breakpoint}`. \"\n        + \"Available breakpoints are: #{map-keys($breakpoints)}.\";\n  }\n}\n\n@mixin tiny {\n  @media only screen and (max-width: 359px) {\n    @content;\n  }\n}\n\n@mixin mobile {\n  @media only screen and (max-width: 480px) {\n    @content;\n  }\n}\n\n@mixin small {\n  @media only screen and (max-width: 640px) {\n    @content;\n  }\n}\n\n@mixin medium {\n  @media only screen and (max-width: 768px) {\n    @content;\n  }\n}\n\n@mixin medium-2 {\n  @media only screen and (max-width: 992px) {\n    @content;\n  }\n}\n\n@mixin large {\n  @media only screen and (max-width: 1280px) {\n    @content;\n  }\n}\n\n@mixin large-2 {\n  @media only screen and (max-width: 1440px) {\n    @content;\n  }\n}\n\n@mixin background-png-3x ($image) {\n    background-repeat: no-repeat;\n    background-image: url(\"#{$imagesPath}#{$image}.png\");\n\n    @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {\n        background-image: url(\"#{$imagesPath}#{$image}@2x.png\");\n        background-size: 100%;\n    }\n    @media (-webkit-min-device-pixel-ratio: 2.5), (min-resolution: 216dpi) {\n        background-image: url(\"#{$imagesPath}#{$image}@3x.png\");\n        background-size: 100%;\n    }  \n}\n\n@mixin size ($w, $h) {\n    width: $w; \n    height: $h;\n}\n\n@mixin border-radius ($r) {\n    -webkit-border-radius: $r; \n    -moz-border-radius: $r;\n    -o-border-radius: $r; \n    -ms-border-radius: $r; \n    border-radius: $r;\n}\n\n@mixin easeLinear ($time: 0.2s, $easing: linear, $props: all) {\n    transition: $props $time $easing 0s;    \n}\n\n@mixin rotating ($time: 9s) {\n    animation-name: ani-rotate; \n    animation-duration: $time; \n    animation-iteration-count: infinite;\n    animation-timing-function: linear;\n}\n\n@keyframes ani-rotate {\n    from { transform: rotate(0deg); }\n    to { transform: rotate(360deg); }\n}\n\n@keyframes ani-thrust-line {\n    0% { height: 3px; }\n    20% { height: 15px; }\n    100% { height: 3px; }\n}"
  },
  {
    "path": "_sass/navbar.scss",
    "content": ".headroom {\n    will-change: transform;\n    transition: transform 200ms linear;\n}\n.headroom--pinned {\n    transform: translateY(0%);\n}\n.headroom--unpinned {\n    transform: translateY(-100%);\n}\n\n.navbar-right { \n    margin-right: 0;\n}\n\n.navbar-default .navbar-nav {\n    font-size: 15px;\n\n    .btn {\n        font-size: 15px;\n    }\n\n    .active {\n        .navbar-nav--a--link {\n\n            color: $accent;\n            background: none;\n            transition: none;\n            \n            &:hover,\n            &:focus {\n                background: none;\n                color: $accent;\n            }\n\n            &::after,\n            &::before {\n                -webkit-transform: scale3d(1, 1, 1);\n                transform: scale3d(1, 1, 1);\n            }\n\n            &::before {\n                -webkit-transition-delay: 0s;\n                transition-delay: 0s;\n            }            \n        }\n    } \n    .navbar-nav--a--link {\n    \tposition: relative;\n        color: $hometext;\n        @include easeLinear(0.4s, linear, color);\n\n        &:hover, &:focus {\n            color: $accent;\n        }\n\n        &:hover::before,\n        &:focus::before {\n            -webkit-transform: scale3d(1, 1, 1);\n            transform: scale3d(1, 1, 1);\n            -webkit-transition-delay: 0s;\n            transition-delay: 0s;\n        }\n\n\n        &::before, &::after {\n            content: '';\n            position: absolute;\n            bottom: -1px;\n            left: 0;\n            width: 100%;\n            height: 4px;\n            -webkit-transform: scale3d(0, 1, 1);\n            transform: scale3d(0, 1, 1);\n            -webkit-transform-origin: center left;\n            transform-origin: center left;\n        }        \n        \n        &::after {\n            background: $accent;\n        }\n        &::before {\n            -webkit-transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);\n            transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);\n            background: #00BEF7;\n        }\n    }\n    \n    \n    .active>.navbar-nav--a--link,\n    .navbar-nav--a--link:focus,\n    .navbar-nav--a--link:hover {\n    }\n    .btn-primary {\n        margin-top: 18px;\n        border-radius: 4px;\n        height: 48px;\n        padding-top: 12px;\n        color: #fff;\n        font-weight: bold;\n        background: $accent;\n        @include easeLinear();\n        &:focus,\n        &:hover {\n            color: #fff;\n            background-color: #00BEF7;\n            border: 1px solid #00BEF7;\n        }\n    }\n}\n\n.navbar .container-fluid {\n    max-width: 1210px;\n}\n.navbar .navbar-brand {\n    padding: 0;\n    height: auto;\n    margin-top: 20px;\n    margin-left: 0;\n    margin-right: 0;\n}\n.navbar .navbar-brand--logo {\n  background-image: url('../img/logo-shoutem-for-developers.svg');\n  background-position: left center;\n  background-repeat: no-repeat;\n  background-size: 100%;\n  width: 215px;\n  height: 34px;\n  text-indent: -1000%;\n  overflow: hidden;\n  display: block;\n}\n\n.home .navbar-brand--logo {\n    @media (min-width: 768px) {\n        margin-left: 14px;\n    }\n}\n\n.documentation .navbar-brand {\n    @include easeLinear();\n\n    &:hover {\n        background: #00AADF;\n    }\n\n    svg {\n        display: block;\n    }\n\n    #documentation-logo {\n        @include easeLinear();\n    }\n\n    &:hover #documentation-logo {\n        fill: #FFF;\n    }\n}\n\n#wrapper {\n  padding-top: 80px;\n\n  @include small {\n    margin-bottom: 0 !important;\n  }\n}\n\n@media (min-width: 768px) {\n  .navbar-nav>li>a {\n      padding: 30px 0 28px; \n      margin-right: 48px; \n  }\n  .navbar-nav>li>a.btn-primary {\n      padding: 12px 16px 0;\n      margin-right: 0px; \n  }\n}\n\n\n.navbar-default .navbar-toggle {\n    border: none;\n    padding: 18px 15px;\n    margin: 16px 0 0;\n\n    &:hover {\n        background: none;\n\n        .icon-bar {\n            background-color: #00AADF;\n        }\n    }\n}\n\n.navbar-toggle .icon-bar {\n    width: 17px;\n    height: 1px;\n}\n\n.home .breadcrumb {\n    display: none;\n}\n\n.breadcrumb {\n    margin-top: 19px;\n    margin-bottom: 0;\n    margin-left: 24px;\n    background: none;\n    color: $primary;\n    float: left;\n\n    li:first-child {\n        opacity: 0.7;\n    }\n\n    li + li {\n      &:before {\n        content: \"\";\n        display: inline-block;\n        background: url(/img/icon-descriptive-next.svg) center center no-repeat;\n        width: 24px;\n        height: 12px;\n        margin: 0 17px 0 13px;\n      }\n\n      @include small {\n        display: none;\n      }\n    }\n\n    @include small {\n        margin-top: 14px;\n    }\n}"
  },
  {
    "path": "_sass/pager.scss",
    "content": "#pager-wrapper\n{\n    max-width: 1440px;\n    margin: 80px auto 0;\n\n    .pager {\n        background: #FFFFFF;\n        margin: 0 0 0 280px;\n\n        @include medium-2 {\n            margin-left: 0;\n        }\n\n        a {\n            width: 50%;\n            border: none;\n            border-radius: 0;\n            height: 88px;\n            padding-top: 31px;\n\n            @include small {\n                height: 72px;\n                padding-top: 28px;\n                line-height: normal;\n            }\n        }\n\n        .previous a {\n            background-color: $lightaccent;\n            color: $accent;\n            transition: background 0.2s linear;\n            \n            &:hover {\n                background-color: rgba(0,170,223,0.14);\n            }\n\n            &::before {\n                content: \" \";\n                display: inline-block;\n                width: 13px;\n                height: 13px;\n                margin-right: 24px;\n                background: url(/img/icon-arrow-left.svg) center center no-repeat;\n                vertical-align: middle;\n                margin-bottom: 1px;\n            }\n\n            @include small {\n                color: transparent;\n                width: 72px !important;\n                overflow: hidden;\n            }\n        }\n\n        .next a {\n            background-color: $accent;\n            color: #fff;\n            transition: background 0.2s linear;\n            \n            &:hover {\n                background-color: #00bef7;\n            }\n\n            &::after {\n                content: \" \";\n                display: inline-block;\n                background: url(/img/icon-arrow-right.svg) center center no-repeat;\n                width: 15px;\n                height: 13px;\n                vertical-align: middle;\n\n                @include small {\n                    height: 72px;\n                    line-height: 72px;\n                    background-size: 15px 13px;\n                    vertical-align: middle;\n                    margin-left: -24px;\n                }\n            }\n\n            span {\n                display: inline-block;\n                vertical-align: middle;\n                margin-right: 24px;\n\n                @include small {\n                    margin-right: 36px;\n                }\n            }\n\n            @include small {\n                width: calc(100% - 72px);\n                padding: 0 10px 0 0;\n            }\n        }\n\n        .previous {\n            @include small {\n                overflow: hidden;\n                width: 72px !important;\n            }\n        }\n        \n        img {\n            position: relative;\n            width: 13px;\n            height: 13px;\n            bottom: 1px;\n        }\n        \n        .docs-pager-icon-left {\n            right: 24px;\n        }\n        \n        .docs-pager-icon-right {\n            left: 24px;\n        }\n\n        .inactive\n        {\n            background-color: $lightaccent;\n            float: left;\n            width: 50%;\n            height: 88px;\n            padding-top: 32px;\n\n            &.next {\n                background-color: $accent;\n\n                @include small {\n                    width: calc(100% - 72px);\n                }\n            }\n\n            a {\n                display: none;\n            }\n\n            @include small {\n                height: 72px;\n            }\n        }\n    }\n}"
  },
  {
    "path": "_sass/sidebar.scss",
    "content": ".navigation {\n    list-style: none;\n    margin: 0;\n    padding: 0;\n    background: #FFF;\n\n    ul {\n        list-style: none;\n        padding: 0;\n        margin: 0;\n        position: relative;\n\n        li a {\n            padding-left: 40px;\n        }\n\n        &.level-2 {\n            .menu-group-title {\n                font-size: 14px;\n                font-weight: 700;\n            }\n        }\n\n        &.level-3 {\n            &::before {\n                content: \"\";\n                width: 1px;\n                position: absolute;\n                background-color: #000;\n                opacity: 0.08;\n                left: 58px;\n                top: 11px;\n                bottom: 11px;\n                height: initial;\n            }\n        }\n    }\n\n    li {\n        font-size: 14px;\n\n        &.primary > a {\n            height: 48px;\n            line-height: 48px;\n            font-size: 15px;\n            font-weight: 700;\n        }\n\n        .active {\n            color: $accent;\n\n            &:not(.menu-group-title) {\n                background-color: $lightaccent;\n            }\n        }\n        \n        a {\n            height: 40px;\n            width: 100%;\n            display: inline-block;\n            line-height: 40px;\n            vertical-align: middle;\n            color: $primary;\n            text-decoration: none;\n            padding-left: 24px;\n            font-size: 14px;\n            @include easeLinear();\n\n            &:hover,\n            &:active,\n            &:focus {\n                background-color: $lightaccent-2;\n            }\n        }\n    }\n\n    &.level-1 {\n        > li > a {\n            font-size: 15px;\n            font-weight: 700;\n            height: 48px;\n            line-height: 48px;\n        }\n    }\n\n    .sidelink a {\n        font-weight: 500 !important;\n        font-size: 14px !important;\n        height: 40px !important;\n        line-height: 40px !important;\n    }\n\n    .button-signup {\n        color: #00aadf;\n        font-weight: 700;\n        font-size: 15px;\n    }\n\n    .menu-button-signup {\n        padding: 15px 0;\n        border-top: 1px solid #DDD;\n        border-bottom: 1px solid #DDD;\n        margin: 15px 0 !important;\n    }\n}\n"
  },
  {
    "path": "_sass/typography.scss",
    "content": "@font-face {\n    font-family: 'SourceCode';\n    src: url('../fonts/sourcecodepro-medium-webfont.eot');\n    src: url('../fonts/sourcecodepro-medium-webfont.eot?#iefix') format('embedded-opentype'),\n         url('../fonts/sourcecodepro-medium-webfont.woff2') format('woff2'),\n         url('../fonts/sourcecodepro-medium-webfont.woff') format('woff'),\n         url('../fonts/sourcecodepro-medium-webfont.ttf') format('truetype');\n    font-weight: normal;\n    font-style: normal;\n}\n\n@font-face {\n    font-family: 'MuseoSans';\n    src: url('../fonts/museosans-100-webfont.eot');\n    src: url('../fonts/museosans-100-webfont.eot?#iefix') format('embedded-opentype'),\n         url('../fonts/museosans-100-webfont.woff2') format('woff2'),\n         url('../fonts/museosans-100-webfont.woff') format('woff'),\n         url('../fonts/museosans-100-webfont.ttf') format('truetype');\n    font-weight: 100;\n    font-style: normal;\n\n}\n\n@font-face {\n   font-family: 'MuseoSans';\n   src: url('../fonts/museosans-300-webfont.eot');\n   src: url('../fonts/museosans-300-webfont.eot?#iefix') format('embedded-opentype'),\n        url('../fonts/museosans-300-webfont.woff2') format('woff2'),\n        url('../fonts/museosans-300-webfont.woff') format('woff'),\n        url('../fonts/museosans-300-webfont.ttf') format('truetype');\n   font-weight: 300;\n   font-style: normal;\n}\n\n@font-face {\n    font-family: 'MuseoSans';\n    src: url('../fonts/museosans_500-webfont.eot');\n    src: url('../fonts/museosans_500-webfont.eot?#iefix') format('embedded-opentype'),\n         url('../fonts/museosans_500-webfont.woff2') format('woff2'),\n         url('../fonts/museosans_500-webfont.woff') format('woff'),\n         url('../fonts/museosans_500-webfont.ttf') format('truetype');\n    font-weight: normal;\n    font-style: normal;\n\n}\n\n@font-face {\n    font-family: 'MuseoSans';\n    src: url('../fonts/museosans_700-webfont.eot');\n    src: url('../fonts/museosans_700-webfont.eot?#iefix') format('embedded-opentype'),\n         url('../fonts/museosans_700-webfont.woff2') format('woff2'),\n         url('../fonts/museosans_700-webfont.woff') format('woff'),\n         url('../fonts/museosans_700-webfont.ttf') format('truetype');\n    font-weight: bold;\n    font-style: normal;\n\n}\n\nbody {\n  /* makes font rendering the same on Windows/OSX/iOS/Android */\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n"
  },
  {
    "path": "_sass/variables.scss",
    "content": "$breakpoints: (\n  'small':  768px,\n  'medium': 992px,\n  'large':  1200px\n) !default;"
  },
  {
    "path": "css/documentation.scss",
    "content": "---\n---\n@import \"colors\";\n@import \"mixins\";\n@import \"documentation-layout\";\n@import \"sidebar\";\n@import \"pager\";\n@import \"variables\";\n@import \"footer\";\n@import \"menu-overlay\";\n@import \"cards\";\n\nh1{\n    margin-top: 70px;\n    margin-bottom: 33px;\n\n    @include mobile {\n        font-size: 36px;\n        margin-top: 34px;\n    }\n}\n\nh2 {\n    font-weight: 300;\n    margin-top: 64px;\n    margin-bottom: 16px;\n\n    @include mobile {\n        font-size: 18px;\n        line-height: 32px;\n        margin-top: 48px;\n        font-weight: 500;\n    }\n}\n\nh2[id^=api], h2[id^=example], h2[id^=examples] {\n    margin-top: 8px;\n}\n\nh3 {\n    @include mobile {\n        font-size: 16px;\n        line-height: 30px;\n        font-weight: 500;\n    }\n}\n\nh4 {\n    font-size: 15px;\n}\n\ncode  {\n    border-radius: 2px;\n}\n\nh3 code, h4 code {\n    background: inherit;\n    font-weight: inherit;\n    color: inherit;\n    font-size: inherit;\n}\n\n.docs-component-image {\n    max-width: 100%;\n    margin-bottom: 24px;\n}\n\n.docs-codeblock-path {\n    color: #888fa1;\n    font-size: 15px;\n}\n\npre code.language-shellsession {\n    color: #697289 !important;\n    display: block;\n}\n\npre code.language-shellsession::first-line {\n    color: #343D59;\n}\n\npre code.language-shellsession .dollar-sign {\n    color: #697289;\n}\n\n\nh4[id^=jsx-declaration] {\n    margin-top: -28px;\n}\n\nh4[id^=jsx-declaration], h4[id^=style] {\n    margin-bottom: 16px;\n}\n\nh4[id^=jsx-declaration] + pre,  h4[id^=style] + pre{\n    margin-bottom: 44px;\n}\n\nh4[id^=props] + ul,  h4[id^=style] + ul{\n    margin-bottom: 44px;\n}\n\ncode[class*=\"language-\"], pre[class*=\"language-\"] { \n    font-family: SourceCodePro-Medium, Menlo, Monaco, Consolas,\"Courier New\", monospace;\n    text-shadow: none;\n    color: #444f6c;\n    line-height: 24px;\n}\n\n:not(pre) > code[class*=\"language-\"], pre[class*=\"language-\"] {\n    background-color: #f3f3f3;\n}\n\npre code {\n    color: #444f6c;\n}\n\npre {\n    font-size: 14px; \n    border: none;\n}\n\npre, pre[class*=\"language-\"] {\n    margin-bottom: 40px;\n}\n\nblockquote p {\n    color: #444f6c;\n    font-size: 16px;\n    line-height: 28px;\n}\n\nblockquote h4 + p {\n    margin-top: -16px;\n}\n\nblockquote ol:last-child, blockquote p:last-child, blockquote ul:last-child {\n    margin-bottom: 9px;\n}\n\nblockquote {\n    border-left: 1px solid #C4C7D0;\n}\n\nblockquote h4  {\n    margin-top: 20px;\n}\n\nblockquote p {\n    margin-top: 13px;\n}\n\nblockquote {\n    font-size: 18px;\n    padding: 1px 38px;\n}\n\np > a {\n    border-bottom: 1px solid rgba(0, 170, 223, 0);\n    transition: border-bottom-color 0.2s linear;\n}\n\np > a:hover {\n    text-decoration: none;\n    border-bottom-color: rgba(0, 170, 223, 1);\n}\n\npre[data-line] {\n    padding-left: 1em;\n}\n\n.line-highlight {\n    background: #00aadf;\n    opacity: 0.2;\n    \n    &:before, &[data-end]:after {\n        content: \"\";\n    }\n}\n\n#documentation\n{\n    opacity: 1;\n    transition: opacity 0.2s;\n}\n\n.loading #documentation\n{\n    opacity: 0;\n}\n\n/* Navbar */\n\n.navbar {\n    border-bottom: 1px solid #ececec;\n\n    @include small {\n        min-height: 0;\n        height: 72px;\n    }\n\n    .navbar-header {\n        @media (min-width: 768px) and (max-width: 991px) {\n            width: 100%;\n        }\n    }\n\n    &.navbar-default .navbar-toggle {\n        margin-right: 20px;\n\n        @media (min-width: 768px) {\n            margin-right: 5px;\n        }\n    }\n\n    .navbar-brand {\n        padding: 31px;\n        margin-top: 0;\n        border-right: 1px solid #ececec;\n\n        @include small {\n            padding: 27px;\n        }\n    }\n\n    .navbar-brand--logo {\n        background-image: url('../img/icon-shoutem-mark.svg');\n        width: 18px;\n        height: 18px;\n    }\n\n    .navbar-toggle {\n        @media (min-width: 768px) {\n            display: block;\n        }\n\n        @media (min-width: 992px) {\n            display: none;\n        }\n\n        @include small {\n            margin-top: 12px;\n        }\n    }\n\n    .navbar-search-form.navbar-form.navbar-form-border {\n        margin: 0;\n        margin-right: 24px;\n        border-left: 1px solid #ececec;\n        border-right: 1px solid #ececec;\n        padding: 24px 16px;\n\n        .search-icon {\n            right: 8px;\n            width: 24px;\n            height: 24px;\n            opacity: 0.5;\n            vertical-align: middle;\n        }\n    }\n    \n    #navbar-search-input { \n        background-color:transparent !important;\n        border:none !important;\n        box-shadow: none !important;\n        transition: all .5s;\n        width: 70px;\n    }\n\n    #navbar-search-input:focus {\n        width: 165px;\n    }\n\n    /* Highlighted search terms */\n    .algolia-docsearch-suggestion--highlight {\n        color: #00aadf;\n    }\n    /* Highligted search terms in the main category headers */\n    .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--highlight  {\n        background-color: #00aadf;\n    }\n    /* Currently selected suggestion */\n    .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content {\n        background-color: rgba(0,170,223,0.16) !important;\n    }\n}\n\n.navbar-collapse {\n    &.collapse {\n        @media (min-width: 768px) {\n            display: none !important;\n        }\n        @media (min-width: 992px) {\n            display: block !important;\n        }\n    }\n}\n\n\n\n#documentationTab {\n    display: none;\n}\n\n/* Navigation */\n\n#sidebar-wrapper\n{\n    position: fixed;\n    left: 0;\n    bottom: 0;\n    height: calc(100% - 81px);\n    width: 280px;\n    border-right: 1px solid #ececec;\n    overflow: auto;\n    padding: 28px 0;\n    background: #FFF;\n    z-index: 1070;\n\n    @media screen and (min-width: 1921px) {\n        left: calc(50% - 950px);\n    }\n\n    @media screen and (max-width: 991px) {\n        left: auto !important;\n        right: 0;\n        transform: translate(100%, 0);\n        transform: translate3d(100%, 0, 0);\n        transition: transform 0.5s, visibility 0.5s;\n        height: 100%;\n        visibility: hidden;\n        padding: 0;\n\n        &.open {\n            transform: translate(0, 0);\n            transform: translate3d(0, 0, 0);\n            visibility: visible;\n        }\n\n        \n    }\n\n    .home-link {\n        padding: 16px 0;\n        border-bottom: 1px solid #DDD;\n        margin: 0 0 15px;\n\n        @include small {\n            padding: 11px 0 12px;\n        }\n    }\n\n    a {\n        padding-left: 48px;\n    }\n\n    ul ul a {\n        padding-left: 56px;\n    }\n\n    ul ul ul a {\n        padding-left: 74px;\n    }\n\n    .btn-primary {\n        display: none;\n    }\n}\n\n.menu-group-wrapper\n{\n    display: none;\n\n    &.open {\n        display: block;\n    }\n}\n\n/* Signup: modal version */\n\n#signup {\n    display: none;\n}\n\n#signup-modal\n{\n    position: fixed;\n    width: 100%;\n    height: 100%;\n    top: 0;\n    left: 0;\n    opacity: 0;\n    visibility: hidden;\n    background-color: rgba(68,79,108,0.5);\n    z-index: 1080;\n    transition: opacity 0.35s, visibility 0.35s;\n\n    &.open {\n        opacity: 1;\n        visibility: visible;\n    }\n\n    .content {\n        position: absolute;\n        top: 50%;\n        left: 50%;\n        width: 648px;\n        height: auto;\n        max-width: calc(100% - 48px);\n        max-height: calc(100% - 48px);\n        padding: 55px 48px 0;\n        background-color: #FFF;\n        overflow: hidden;\n        box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.2);\n        border-radius: 2px;\n        transform: scale3d(0.95, 0.95, 0.95) translate3d(-50%, -50%, 0);\n        transform-origin: left;\n        transition: transform 0.35s;\n\n        @include mobile {\n            max-width: calc(100% - 40px);\n            max-height: calc(100% - 40px);\n            padding: 35px 20px 0;\n        }\n    }\n\n    &.open .content {\n        transform: scale3d(1, 1, 1) translate3d(-50%, -50%, 0);\n    }\n\n    .signup-title {\n        font-size: 24px;\n        font-weight: 300;\n    }\n\n    .signup-description {\n        font-weight: 500;\n        font-size: 14px;\n        line-height: 24px;\n        color: #7b8397;\n        margin: 20px 0 0 0;\n    }\n\n    .signup-email {\n        height: 48px;\n        background-color: rgba(228, 230, 233, 0.4);\n        \n        box-shadow: inset 0 -1px 0 0 rgba(68, 79, 108, 0.3);\n        border: none;\n        border-radius: 0;\n        color: $primary;\n        font-weight: 500;\n\n        &:focus {\n            box-shadow: inset 0 -2px 0 0 #00aadf;\n        }\n\n        &::-webkit-input-placeholder {\n            color: #444f6c;\n        }\n        &::-moz-placeholder { /* Firefox 19+ */\n            color: #444f6c;\n            opacity: 1;\n        }\n        &:-ms-input-placeholder {\n            color: #444f6c;\n        }\n        &:-moz-placeholder {\n            color: #444f6c;\n            opacity: 1;\n        }\n    }\n\n    label {\n        font-size: 13px;\n        color: $text;\n        font-weight: 500;\n        line-height: 1;\n        margin: 25px 0 0;\n    }\n\n    .control-buttons {\n        padding: 16px 48px;\n        margin: 56px -48px 0;\n        background-color: #f6f7f8;\n        text-align: right;\n\n        @include mobile {\n            margin-top: 32px;\n        }\n    }\n\n    .signup-button, .cancel-button {\n        width: 120px;\n        height: 40px;\n        line-height: 38px;\n        border: 1px solid #fff;\n        border-radius: 4px;\n        color: #FFF;\n        background-color: $primary;\n        text-transform: uppercase;\n        font-weight: 700;\n        font-size: 13px;\n        letter-spacing: 1px;\n        padding: 1px 0 0;\n\n        @include easeLinear;\n\n        @include mobile {\n            width: auto;\n            padding: 1px 16px 0;\n        }\n    }\n\n    .signup-button {\n        &:hover, &:focus,\n        &:active {\n            background-color: $primaryhover;\n        }\n    }\n\n    .cancel-button {\n        color: $primary;\n        background-color: $secondary;\n        margin-right: 10px;\n\n        &:hover, &:focus,\n        &:active {\n            background-color: $secondaryhover;\n            outline: none;\n        }\n    }\n}\n\n.video-screen {\n    width: 100%;\n    background-color: #EEE;\n    padding: 40px;\n    border-radius: 4px;\n    margin-bottom: 40px;\n\n    video {\n        display: block;\n        width: 280px;\n        margin: 0 auto;\n    }\n}\n\n.edit-link {\n    padding: 30px 0 28px;\n\n    a {\n        font-size: 15px;\n        font-weight: 500;\n        padding: 0 0 0 32px !important;\n        display: inline-block;\n        color: #444f6c;\n        background: url(../img/icon-github-dark.svg) left center no-repeat;\n        transition: opacity 0.25s;\n\n        &:hover {\n            opacity: 0.65;\n        }\n    }\n}\n\n\n.overview {\n\n    h1 {\n        /*margin-top: 96px;*/\n        margin-bottom: 0;\n        line-height: 65px;\n    }\n\n    .section {\n        width: 100%;\n        max-width: 870px;\n\n        &.section-intro {\n            margin-top: 48px;\n        }\n\n        &::after {\n            content: \"\";\n            display: table;\n            clear: both;\n        }\n\n    }\n\n    h2 {\n        font-size: 13px;\n        font-weight: bold;\n        line-height: 32px;\n        letter-spacing: 1px;\n        color: rgba(#444f6c, 0.7);\n        text-transform: uppercase;\n        padding: 27px 0 32px;\n        border-bottom: 1px solid rgba(#ededed, 0.7);\n    }\n\n    h3 {\n        line-height: 32px;\n        font-weight: 300;\n        margin-top: 48px;\n    }\n\n    p {\n        font-size: 15px;\n        font-weight: normal;\n        line-height: 25px;\n        color: #888fa1;\n    }\n\n    .intro-video {\n        float: left;\n        width: 50%; /* 432/870 = 49.65% */\n        height: 270px;\n        background: url(../img/overview/video-bg@2x.jpg) center center no-repeat;\n        background-size: cover;\n        position: relative;\n\n        &::after {\n            content: \"\";\n            width: 100%;\n            height: 100%;\n            position: absolute;\n            top: 0;\n            left: 0;\n            background: url(../img/overview/icon-play.svg) center center no-repeat;\n        }\n\n        p {\n            color: #ffffff;\n            font-size: 14px;\n            line-height: 20px;\n            font-weight: bold;\n            position: absolute;\n            bottom: 0;\n            left: 0;\n            width: 100%;\n            padding: 0 139px 0 24px;\n\n            .time {\n                position: absolute;\n                right: 24px;\n                top: 8px;\n                text-align: right;\n                font-weight: normal;\n                width: 70px;\n                line-height: 24px;\n                background: url(../img/overview/icon-time-white.svg) 0 center no-repeat;\n            }\n        }\n    }\n\n    .intro-text {\n        float: right;\n        /*width: 45%;*/ /* 390/870 = 44.82 */\n        width: 100%;\n\n        /*margin-left: 5%;*/\n        margin-left: 0;\n    }\n\n    .intro-title {\n        font-size: 16px;\n        line-height: 32px;\n        font-weight: bold;\n        color: #444f6c;\n    }\n\n    .intro-content {\n        p {\n            &:first-child {\n                margin-top: 16px;\n            }\n\n            small {\n                font-size: 13px;\n            }\n        }\n\n        img {\n            display: block;\n            margin: 32px 0 16px;\n        }\n    }\n\n    .card {\n        text-decoration: none;\n        max-width: 260px;\n        \n        .card-title {\n            margin-top: 12px;\n        }\n\n        .card-image {\n            min-height: 148px;\n            background: #444f6c;\n            text-align: center;\n\n            img {\n                margin-top: 24px;\n            }\n\n            &.extensions img {\n                margin-top: 32px;\n                margin-left: 18px;\n            }\n\n            &.themes img {\n                margin-top: 36px;\n            }\n        }\n\n        .card-content {\n            padding: 24px;\n\n            p:last-child {\n                margin-bottom: 0;\n            }\n        }\n\n        .card-category {\n            font-size: 12px;\n            font-weight: bold;\n            color: #888fa1;\n            text-transform: uppercase;\n            letter-spacing: 1px;\n            line-height: initial;\n        }\n\n        .card-time {\n            @include headline(14px, 24px, $chapterfooter);\n            @include flexcontainer();\n            justify-content: initial;\n\n            color: #969CAC;\n            font-size: 14px;\n            font-weight: normal;\n\n            .icon-time {\n                display: inline-block;\n                @include logoimage('../img/icon-time.svg', 19px, 19px);\n                margin-right: 8px;\n                position: relative;\n                top: -2px;\n            }\n\n            .difficulty {\n                padding-left: 19px;\n                position: relative;\n\n                &::before {\n                    content: \"\";\n                    position: absolute;\n                    width: 4px;\n                    height: 4px;\n                    left: 8px;\n                    top: calc(50% - 3px);\n                    background: #969CAC;\n                    border-radius: 50%;\n                }\n            }\n        }\n    }\n\n    .list-cards.row-2 {\n        .card {\n            .card-title {\n                font-size: 15px;\n            }\n\n            .card-time {\n                margin-top: 48px;\n            }\n        }\n    }\n\n    .logotypes {\n        margin: 44px 0 0;\n        padding: 0;\n        list-style: none;\n\n        li {\n            margin: 0;\n            padding: 88px 0 0;\n            width: 25%;\n            float: left;\n            font-size: 14px;\n            font-weight: normal;\n            line-height: 22px;\n            background: url(../img/overview/logo-js.svg) 0 0 no-repeat;\n\n            &.react-native {\n                background-image: url(../img/overview/icon-react-native.svg);\n            }\n\n            &.shoutem-ui-toolkit {\n                background-image: url(../img/overview/icon-ui-toolkit.svg);\n            }\n\n            &.code-editor {\n                background-image: url(../img/overview/icon-code-editor.svg);\n            }\n        }\n    }\n\n    .section-faq {\n        padding-bottom: 120px;\n\n        dt,\n        dd {\n            font-size: 15px;\n            line-height: 32px;\n            font-weight: 500;\n            color: #444f6c;\n        }\n\n        dd {\n            color: #888fa1;\n        }\n    }\n}\n"
  },
  {
    "path": "css/home.scss",
    "content": "---\n---\n\n@import \"colors\";\n@import \"variables\";\n@import \"mixins\";\n@import \"footer\";\n@import \"animation\";\n@import \"helpers\";\n@import \"sidebar\";\n@import \"menu-overlay\";\n\n.container, .container-fluid\n{\n    padding-left: 20px;\n    padding-right: 20px;\n}\n\n.row {\n    margin-left: -20px;\n    margin-right: -20px;\n}\n\n.container-fluid>.navbar-collapse, \n.container-fluid>.navbar-header, \n.container>.navbar-collapse, \n.container>.navbar-header {\n    margin-left: 0;\n    margin-right: 0;\n}\n\np {\n    color: $hometext;\n}\n\n.group {\n    display: inline-block;\n}\n\n.section-header {\n    @include headline(32px, 32px, $homeheading);\n\n    font-weight: 300;\n    text-align: center;\n    padding-top: 80px;\n    margin-bottom: 26px;\n    color: #444f6c;\n    letter-spacing: -0.5px;\n\n    @include mobile {\n        font-size: 28px;\n        line-height: 1.45;\n        padding: 60px 25px 0;\n        margin-bottom: 24px;\n    }\n}\n\n.section-header--big {\n    font-weight: 100;\n    margin-bottom: 60px;\n    font-size: 48px;\n    letter-spacing: normal;\n\n    @include mobile {\n        font-size: 36px;\n        line-height: 46px;\n        margin-left: auto;\n        margin-right: auto;\n        margin-bottom: 0;\n        padding: 0;\n    }\n}\n\n.section-sub-header {\n    width: 55%;\n    margin: 0 auto 32px;\n    text-align: center;\n    font-size: 16px;\n    font-weight: 500;\n\tline-height: 30px;\n\tcolor: #888fa1;\n\n    @include mobile {\n        width: 100%;\n        max-width: 280px !important;\n    }\n}\n\n.section-footer {\n    @include headline(15px, 26px);\n    color: rgba(#444f6c, 0.7);\n\n    text-align: center;\n    margin-bottom: 30px;\n}\n\n.sub-text {\n    @include headline(14px, 26px);\n}\n\n.section {\n    width: 100%;\n    max-width: 1170px;\n    margin: 0 auto;\n    padding-left: 20px;\n    padding-right: 20px;\n\n    .row {\n        @include small {\n            flex-direction: column;\n        }\n    }\n\n    .bullet-points {\n\n        img {\n            max-width: 100%;\n            margin: 0 auto;\n            display: block;\n        }\n\n        @include small {\n            width: 100%;\n            margin-top: 33px;\n            margin-bottom: 54px;\n        }\n    }\n}\n\n.section.narrow {\n    max-width: 1024px;\n    position: relative;\n\n    @include small {\n        padding: 0 15px;\n    }\n}\n\n.section.wider {\n    max-width: 1172px;\n\n    .section-content {\n        overflow: hidden;\n    }\n}\n\n.flex-container {\n    max-width: 1000px;\n    margin: 0 auto 80px;\n    display: flex;\n    flex-direction: row;\n    justify-content: space-between;\n    align-items: center;\n    flex-wrap: wrap;\n\n    @include medium {\n        flex-direction: column;\n    }\n}\n\n.section-get-started  {\n    .flex-container {\n        max-width: 1030px;\n        margin-bottom: 60px;\n\n        @include mobile {\n            margin-bottom: 15px;\n        }\n    }\n\n    .section-header {\n        padding-top: 90px;\n        margin-bottom: 70px;\n\n        @include mobile {\n            padding-top: 0;\n            margin-top: 60px;\n            margin-bottom: 30px;\n        }\n    }\n}\n\n.gray-background {\n    background-color: $graybackground;\n}\n\n.blue-background {\n    background-color: $bluebackground;\n}\n\n.dark-blue-background {\n    background-color: $darkbluebackground;\n}\n\n.left-align {\n    text-align: left;\n}\n\n.header {\n    height: 600px;\n    background-image: url(\"../img/shoutem-developers-header.jpg\");\n    background-repeat: no-repeat;\n    background-position: center;\n    background-size: cover;\n\n    @include mobile {\n        height: 475px;\n    }\n}\n\n.header-wrapper {\n    max-width: 1440px;\n    width: 100%;\n    margin: 0 auto;\n    display: flex;\n    align-items: center;\n    z-index: 2;\n    height: 100%;\n}\n\n.video-screen {\n    width: 279px;\n    height: calc(279px * (650 / 368));\n    right: 269px;\n    top: 142px;\n    z-index: 100;\n    transform: perspective(1983px) rotateY(-35.5deg) rotateX(11.9deg) rotateZ(16.15deg) scaleY(1.00075);\n    position: absolute;\n    backface-visibility: hidden;\n    transform-style: preserve-3d;\n\n    @include large-2 {\n        right: 98px;\n        top: 182.5px;\n    }\n\n    @include medium-2 {\n        display: none;\n    }\n}\n\n.main {\n    color: #fff; // test!\n    height: 100%;\n\n    &.with-arrow:after {\n        @media screen and (min-width: 480px) {\n            bottom: 20px;\n        }\n    }\n    \n    .header-text {\n        margin: 44px auto 0;\n\n        @include medium {\n            padding: 0;\n        }\n\n        @include mobile {\n            max-width: 280px;\n\n            br {\n                display: none;\n            }\n        }\n    }\n    \n    .with-image .header-text {\n        text-align: left;\n        margin-left: 5%;\n\n        @media (min-width: 1440px) {\n            margin-left: 235px;\n        }\n\n        @include large-2 {\n            margin-left: 110px;\n            max-width: 55%;\n        }\n\n        @include medium-2 {\n            margin: 20px auto 0;\n            max-width: 600px;\n        }\n\n        @include mobile {\n            margin: -22px auto 0;\n            max-width: 280px;\n        }\n    }\n\n    .main-heading {\n        color: #FFFFFF;\n        font-size: 54px;\n        line-height: 61px;\n        font-weight: 100;\n        margin-top: 0;\n        margin-bottom: 0;\n        text-align: center;\n        max-width: 800px;\n\n        @include medium-2 {\n            font-size: 48px;\n        }\n\n        @include small {\n            font-size: 36px;\n            font-weight: 300;\n        }\n\n        @include mobile {\n            font-size: 24px;\n            font-weight: 500;\n            line-height: 38px;\n        }\n    }\n    \n    .with-image .main-heading {\n        text-align: left;\n\n        @include medium-2 {\n            text-align: center;\n        }\n    }\n\n    .p, .sub-heading {\n        color: #EFEFF2;\n        font-size: 16px;\n        font-weight: normal;\n        line-height: 26px;\n        margin-bottom: 0;\n        margin-left: auto;\n        margin-right: auto;\n        text-align: center;\n        max-width: 550px;\n        margin-top: 27px;\n    }\n    \n    .with-image .sub-heading {\n        margin-top: 23px;\n        text-align: left;\n        font-size: 16px;\n        font-weight: 500;\n        max-width: 380px;\n\n        @include large-2 {\n\n            br {\n                display: none;\n            }\n        }\n\n        @include medium-2 {\n            text-align: center;\n            max-width: 360px;\n            margin-left: auto;\n            margin-right: auto;\n        }\n\n        @include mobile {\n            text-align: center;\n            font-weight: 500;\n            margin-top: 12px;\n        }\n    }\n\n    .os-icons {\n        text-align: center;\n        margin-top: 27px;\n        font-size: 0;\n\n        img:not(:last-child) {\n            margin-right: 32px;\n        }\n\n        .icon-android {\n            position: relative;\n            margin-top: 3px;\n        }\n    }\n}\n\n.with-arrow:after {\n    content: \"\";\n    position: absolute;\n    bottom: 50px;\n    left: 50%;\n    transform: translateX(-50%);\n    background: url(\"../img/icon-scroll-down.png\") no-repeat center / 100%;\n    display: block;\n    height: 78px;\n    width: 33px;\n}\n\n.separator {\n    width: 100%;\n    height: 1px;\n    background: rgba(49, 60, 89, 0.1);\n    margin: 0 auto 21px;\n}\n\n.step-label {\n    display: block;\n    margin-bottom: 19px;\n\n    strong {\n        font-size: 14px;\n        border: rgba(49, 60, 89, 0.2) solid 1px;\n        border-radius: 4px;\n        padding: 7px 14px 5px;\n        color: #313c59;\n        line-height: 1.4;\n        letter-spacing: 1.2px;\n        color: #444f6c;\n        font-weight: 700;\n        text-transform: uppercase;\n        position: relative;\n        top: -6px;\n        text-align: center;\n    }\n\n    @include medium-2 {\n        margin: 5px auto 20px;\n    }\n}\n\n.steps {\n    padding-left: 0;\n    list-style: none;\n}\n\n.steps li {\n    text-align: center;\n    min-height: 130px;\n\n    .step-title {\n        font-weight: bold;\n        text-transform: uppercase;\n        margin-bottom: 16px;\n        font-size: 13px; \n        line-height: 20 px;\n        letter-spacing: 1.08333px;\n        color: #444F6C;\n\n        @include medium-2 {\n            margin: 20px 0;\n        }\n\n        @include medium-2 {\n            margin: 20px 0 15px;\n        }\n    }\n\n    .step-button {\n        text-transform: uppercase;\n        color: #fff;\n        font-weight: bold;\n        font-size: 13px;\n        padding: 0 24px;\n        height: 90px;\n        width: 260px;\n        border-top-left-radius: 4px;\n        border-bottom-left-radius: 4px;\n        box-shadow: none;\n        letter-spacing: 1px;\n        line-height: 24px;\n\n        &.publish-button {\n            background-color: $green;\n            border: 1px solid $green;\n            border-radius: 4px;\n            position: relative;\n\n            @include medium-2 {\n                height: 70px;\n            }\n        }\n        \n        span {\n            display: block;\n        }\n\n        @include medium-2 {\n            margin-right: 0;\n            left: 0;\n            border-radius: 4px;\n            width: 280px;\n            height: 75px;\n        }\n    }\n\n    .arrow-box {\n        position: relative;\n        background: $accent;\n        border: 1px solid $accent;\n        padding: 0 16px 0 24px;\n\n        &:after,\n        &:before {\n            left: 100%;\n            top: 50%;\n            border: solid transparent;\n            content: \" \";\n            height: 0;\n            width: 0;\n            position: absolute;\n            pointer-events: none;\n\n            @include medium-2 {\n                border-top-color: #00aadf;\n                border-left-color: transparent !important;\n                border-width: 138px !important;\n                border-radius: 4px;\n                transform: scaleY(0.1);\n                left: 0;\n                bottom: -153px;\n                top: auto;\n                margin-top: 0 !important;\n            }\n        }\n\n        &:after {            \n            border-left-color: $accent;\n            border-width: 44px;\n            margin-top: -44px;\n        }\n\n        &:before {\n            border-left-color: $accent;\n            border-width: 45px;\n            margin-top: -45px;\n            margin-left: 1px;\n\n            @include medium-2 {\n                left: 1px;\n                bottom: -152px;\n            }\n        }\n\n        @include medium-2 {\n            margin-bottom: 20px;\n        }\n    }\n}\n\n.section-step0 {\n    padding-bottom: 100px;\n\n    .section-header {\n        padding-top: 90px;\n\n        @include small {\n            padding-top: 40px;\n        }\n    }\n    \n    .section-footer {\n        width: 60%;\n        margin: 0 auto;\n        font-weight: normal;\n\n        @include small {\n            max-width: 280px;\n            width: 100%;\n            line-height: 26px;\n        }\n    }\n\n    .flex-container {\n        background: linear-gradient(to bottom, transparent 45px, rgba(0, 170, 223, 0.1) 45px);\n        max-width: 970px;\n        margin-bottom: 48px;\n\n        @include medium-2 {\n            flex-direction: column;\n            overflow: hidden;\n            background: none;\n        }\n\n        @include small {\n            margin-bottom: 42px;\n            background: none;\n        }\n    }\n    \n    &.with-arrow:after {\n        height: 88px;\n        background-image: url(\"../img/image-arrow-blue.svg\");\n        background-size: contain;\n        bottom: -32px;\n        z-index: 3;\n\n        @include small {\n            bottom: -44px;\n        }\n    }\n\n    @include small {\n        padding-bottom: 48px;\n    }\n}\n\n.section-customization {\n    background-color: white;\n    padding-bottom: 100px;\n\n    .section-header {\n        padding-top: 82px;\n\n        @include mobile {\n            font-size: 24px;\n        }\n    }\n    \n    .separator {\n        margin-bottom: 8px;\n        width: 299px;\n\n        @include medium {\n            max-width: 100%;\n        }\n    }\n    \n    .builder-image {\n        align-self: flex-end;\n        margin-right: 0;\n        \n        img {\n            max-width: 100%;\n\n            @include small {\n                width: 100%;\n            }\n\n            @include mobile {\n                max-width: 335px;\n            }\n        }\n\n        @include medium-2 {\n            width: calc(100% - 360px);\n        }\n\n        @include small {\n            width: 100%;\n            padding: 0;\n            text-align: center;\n            position: relative;\n\n            &:before {\n                content: \" \";\n                height: 1px;\n                width: calc(100% - 40px);\n                max-width: 335px;\n                background: #000;\n                opacity: 0.1;\n                position: absolute;\n                bottom: 0;\n                z-index: 1050;\n            }\n        }\n    }\n    \n    .row {\n        display: flex;\n        align-items: center;\n        margin-left: -65px;\n        margin-bottom: -30px;\n\n        @include small {\n            margin: 0;\n        }\n    }\n    \n    .bullet-points {\n        padding: 0;\n        margin: -30px 0 0 8.3333333333%;\n\n        img {\n            max-width: 100%;\n            margin: 0 auto;\n            display: block;\n        }\n\n        .integrations {\n            padding-top: 5px;\n\n            @include medium-2 {\n                img {\n                    margin: 0;\n                }\n            }\n        }\n\n        li:not(.integrations) {\n            margin-right: 0;\n        }\n\n        @include large {\n            margin-left: 45px;\n        }\n\n        @media (max-width: 1120px) {\n            margin-left: 15px;\n        }\n\n        @include large {\n            width: 420px;\n            margin-top: 0;\n        }\n\n        @include small {\n            width: 100%;\n            margin-top: 33px;\n            margin-bottom: 54px;\n            margin-left: 0;\n        }\n    }\n\n    &.with-arrow:after {\n        height: 88px;\n        background-image: url(\"../img/image-arrow-blue.svg\");\n        background-size: contain;\n        bottom: -5px;\n        margin-left: -225px;\n        z-index: 3;\n\n        @include small {\n            bottom: -44px;\n            margin-left: 0;\n        }\n    }\n\n    .dragdealer {\n        .handle {\n            cursor: move;\n            cursor: -webkit-grab;\n            cursor: grab;\n            transition: transform 0.5s ease-out;\n        }\n\n        &.active .handle {\n            cursor: move;\n            cursor: -webkit-grabbing;\n            cursor: grabbing;\n        }\n    }\n\n    .screen-type-cards,\n    .visual-style-cards,\n    .layout-cards {\n        display: block;\n        position: relative;\n        max-width: 1170px;\n        padding-bottom: 3px;\n        padding-left: 0;\n        padding-right: 0;\n        overflow: hidden;\n        border-radius: 4px;\n        margin-top: 60px;\n\n        .subtitle {\n            font-size: 18px;\n            font-weight: normal;\n            line-height: 26px;\n            text-align: center;\n            margin: 0 0 32px;\n        }\n\n        &::after {\n            content: \"\";\n            position: absolute;\n            top: 0;\n            right: 0;\n            width: 13px;\n            height: 100%;\n            background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.05));\n            pointer-events: none;\n        }\n\n        .card {\n            float: left;\n            margin: 0 0 20px;\n            width: 190px;\n            text-align: left;\n\n            .inner {\n                margin: 0;\n                width: 190px;\n                height: 214px;\n                border-radius: 4px;\n                overflow: hidden;\n                box-shadow: 0 0 2px 0 rgba(0,0,0,0.03),\n                            0 2px 2px 0 rgba(0,0,0,0.06);\n            }\n\n            &:not(:last-child) {\n                width: 214px;\n\n                .inner {\n                    margin-right: 24px;\n                }\n            }\n\n            img {\n                display: block;\n                max-width: 100%;\n            }\n\n            .card-title {\n                margin: 16px 0 0;\n                padding: 0 16px;\n                font-size: 16px;\n                line-height: 20px;\n                font-weight: normal;\n                text-transform: none;\n                color: $primary;\n                letter-spacing: 0;\n            }\n\n            p {\n                font-size: 14px;\n                margin: 3px 0 0;\n                padding: 0 16px;\n                line-height: 22px\n                ;\n                height: 3em;\n                overflow: hidden;\n            }\n        }\n    }\n\n    .visual-style-cards {\n        margin-top: 60px;\n\n        .card {\n            width: 154px;\n\n            .inner {\n                width: auto;\n                height: auto;\n                padding: 0;\n                background-color: transparent;\n                margin: 0;\n                border-radius: 2px;\n                box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.12);\n            }        \n\n            &:not(:last-child) {\n                width: 186px;\n\n                .inner {\n                    margin-right: 32px;\n                }\n            }\n        }\n    }\n}\n\n.section-step2 {\n    .row {\n        display: flex;\n        align-items: center;\n\n        @include small {\n            margin: 0;\n        }\n    }\n    \n    .section-header {\n        padding-top: 89px;\n        margin-bottom: 107px;\n\n        @include medium-2 {\n            margin-bottom: 48px;\n            padding-top: 48px;\n        }\n    }\n\n    .wider {\n        max-width: 1184px;\n    }\n    \n    .image-rn-code {\n        max-width: 642px;\n        margin-left: 10px;\n        margin-bottom: 100px;\n        padding: 0;\n        \n        &.with-arrow:after {\n            height: 88px;\n            background-image: url(\"../img/image-arrow-blue.svg\");\n            background-size: contain;\n            bottom: -83px;\n            z-index: 3;\n\n            @include small {\n                bottom: -335px;\n            }\n        }\n        \n        img {\n            max-width: 100%;\n        }\n\n        @include medium-2 {\n            width: calc(100% - 420px);\n            margin-bottom: 48px;\n        }\n\n        @include small {\n            order: -1;\n            margin-left: -20px;\n            margin-right: -20px;\n            width: 100%;\n        }\n    }\n\n    .builder-screenshot {\n        @include logoimage('../img/image-builder-screenshot@2x.png', 669px, 372px);\n\n        @include medium {\n            display: none;\n        }\n    }\n    \n    .bullet-points {\n        margin: -106px 0 0 78px;\n\n        .bullet-icon {\n            margin-right: 20px;\n        }\n\n        @include medium-2 {\n            width: 360px;\n            margin-top: 0;\n        }\n\n        @include small {\n            width: 100%;\n            margin: 0 0 50px;\n        }\n    }\n}\n\n.section-step3 {\n    background-color: #313C59;\n    min-height: 636px;\n    color: #ffffff;\n\n    .col-md-6 {\n        @include small {\n            width: 100%;\n            margin-left: 0;\n        }\n    }\n\n    @include small {\n        min-height: 1165px;\n        text-align: center;\n    }\n    \n    .step-label {\n        strong {\n           color: #7ed321;\n            border: solid 1px #7ed321;\n        }\n\n        @include small {\n            margin: 10px auto 15px;\n        }\n    }\n    \n    .bullets-wrapper {\n        display: block;\n        text-align: left;\n\n        .bullet-points {\n            margin-left: auto;\n            margin-right: -3px;\n            max-width: 380px;\n            width: 100%;\n\n            .bullet {\n\n                h4 {\n                    color: #ffffff;\n                    font-size: 22px;\n                    line-height: 26px;\n                    font-weight: normal;\n                    margin: 0;\n                }\n\n                p {\n                    margin: 8px 0 0;\n                    max-width: 260px;\n                    font-size: 15px;\n                    line-height: 24px;\n                    color: rgba(#BDC0CB, 0.7);\n                }\n\n                &:not(:first-child) {\n                    h4 {\n                        margin-top: 40px;\n                    }\n                }\n\n                @include medium-2 {\n                    padding-left: 106px;\n                }\n\n                @include mobile {\n                    padding-left: 72px;\n                }\n\n                &.bullet-publish {\n                    background: url(../img/publish.svg) 100% 6px no-repeat;\n\n                    @include medium-2 {\n                        background-position: 0% 6px;\n                    }\n\n                    @include mobile {\n                        background-size: 45px;\n                    }\n                }\n\n                &.bullet-manage {\n                    background: url(../img/manage.svg) calc(100% - 19px) 12px no-repeat;\n\n                    @include medium-2 {\n                        background-position: 0% 6px;\n                    }\n\n                    @include mobile {\n                        background-size: 45px;\n                    }\n                }\n\n                &.bullet-analyse {\n                    background: url(../img/analyse.svg) calc(100% - 14px) 25px no-repeat;\n\n                    @include medium-2 {\n                        background-position: 0% 25px;\n                    }\n\n                    @include mobile {\n                        background-size: 45px;\n                    }\n                }\n            }\n\n            @include medium-2 {\n                margin: auto;\n            }\n        }\n    }\n        \n    .section-header {\n        padding-top: 75px;\n        text-align: center;\n        margin-bottom: 0;\n        color: #F2F2F5;\n\n        @include small {\n            padding-top: 40px;\n            margin-bottom: 20px;\n            text-align: center;\n        }\n    }\n\n    .section-sub-header {\n        width: 100%;\n        margin-top: 20px;\n        margin-bottom: 0;\n        text-align: center;\n\n        @include small {\n            text-align: center;\n            margin: 0 auto 30px;\n            max-width: 450px;\n        }\n    }\n\n    .col {\n        margin-top: 52px;\n\n        &.text {\n            margin-top: 147px;\n            margin-bottom: 191px;\n\n            @include medium-2 {\n                margin-bottom: 64px;\n                margin-top: 48px;\n            }\n        }\n\n        &.carousel {\n            background: url(../img/mbp-bezel.svg) left top no-repeat;\n            height: 580px;\n            overflow: hidden;\n\n            @include medium-2 {\n                background-position: calc(50% + 3px) 0;\n                padding: 0;\n                margin-top: 0;\n            }\n\n            @include small {\n                background-position: calc(50% + 2px) 0;\n                background-size: 641px auto;\n            }\n\n            .images {\n                position: relative;\n                top: 57px;\n                left: 66px;\n\n                @include medium-2 {\n                    text-align: center;\n                    left: 0;\n                    margin-left: auto;\n                    margin-right: auto;\n                }\n\n                @include small {\n                    width: 521px;\n                    top: 40px;\n\n                    img {\n                        max-width: 100%;\n                    }\n                }\n            }\n        }\n    }    \n    \n    p {\n        font-size: 18px;\n    }\n\n    .group {\n        @include small {\n            display: block;\n            margin-left: 30px;\n            margin-top: 10px;\n        }\n    }\n\n    .section.fullwidth {\n        max-width: 100%;\n        padding: 0 0 0 46px;\n\n        @include medium-2 {\n            padding: 0;\n        }\n    }\n}\n\n.bullet-points {\n    margin: 0;\n    padding: 0;\n    list-style: none;\n}\n\n.bullet-points li {\n    line-height: 1.5;\n    margin-bottom: 23px;\n    padding: 0;\n}\n\n.bullet-icon {\n    display: inline-block;\n    margin-right: 20px;\n    vertical-align: middle;\n    width: 24px;\n    height: 24px;\n    padding: 4px;\n    background-position: 0 0;\n    @include logoimage('../img/icon-bullet-circle.svg', 24px, 24px);\n    \n    &.react {\n        @include logoimage('../img/icon-react-logo.svg', 30px, 30px);\n        background-position: center;\n        margin: -2px 0 0 8px !important;\n    }\n}\n\n.bullet-text {\n    vertical-align: top;\n    font-size: 15px;\n    line-height: 24px;\n    width: calc(100% - 44px);\n    max-width: 245px;\n    display: inline-block;\n\n    &.react-native {\n        max-width: 295px;\n\n        a {\n            display: inline-block;\n        }\n    }\n\n    @include mobile {\n        font-size: 15px;\n        line-height: 24px;\n    }\n}\n\n.arrow {\n    @include logoimage('../img/image-arrow-blue.svg', 28px, 88px);\n\n    position: absolute;\n    bottom: -40px;\n    z-index: 1;\n\n    &.first,\n    &.second {\n        left: 50%;\n    }\n    &.third {\n        left: 20%;\n    }\n}\n\n.app-store-logo {\n    position: relative;\n    bottom: 2px;\n    padding: 0 12px;\n}\n\n.section-step4 {\n    background: #ffffff;\n    padding-bottom: 100px;\n\n    .section-header {\n        padding-top: 90px;\n        margin-bottom: 23px;\n        font-size: 45px;\n\n        @include medium-2 {\n            font-size: 36px;\n            padding-top: 48px;\n        }\n    }\n}\n\n.section-featured\n{\n    .featured-apps {\n        text-align: center;\n        margin-top: 64px;\n\n        a {\n            width: 145px;\n            height: auto;\n            display: inline-block;\n            vertical-align: top;\n\n            &:not(:last-child) {\n                margin-right: 48px;\n            }\n\n            img {\n                width: 100%;\n                max-width: 85px;\n            }\n\n            p {\n                font-size: 14px;\n                font-weight: normal;\n                line-height: 20px;\n                color: #222B35;\n                margin-top: 26px;\n            }\n        }\n    }\n\n    p {\n        text-align: center;\n        font-size: 15px;\n        font-weight: normal;\n        color: #888fa1;\n        line-height: 25px;\n        max-width: 380px;\n        margin: 0 auto;\n    }\n}\n\n\n.chapter {\n    width: 310px;\n    min-height: 400px;\n    background-color: #fff;\n    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 0 2px 0 rgba(0, 0, 0, 0.1);\n    transition: box-shadow ease-out 0.2s;\n    cursor: pointer;\n    margin-bottom: 20px;\n    overflow: hidden;\n    \n    @include border-radius(4px);\n\n    @include medium-2 {\n        width: 270px;\n    }\n\n    /* just until Elvis figures something better :) */\n    @media only screen and (max-width: 882px) {\n        width: 240px;\n    }\n\n    @include medium {\n        width: 100%;\n        max-width: 480px;\n    }\n\n    @include mobile {\n        width: calc(100% - 18px);\n        max-width: 280px;\n        margin-bottom: 40px;\n    }\n\n    &:hover,\n    &:active {\n        box-shadow: 0 19px 38px 0 rgba(0, 0, 0, 0.3), 0 15px 12px 0 rgba(0, 0, 0, 0.2);\n        text-decoration: none;\n    }\n    \n    &:last-child .chapter-content {\n        padding-right: 15px;\n    }\n\n    .chapter-content {\n        padding: 24px;\n\n        .chapter-title {\n            line-height: 140%; \n            margin-bottom: 10px;\n        }\n        \n        .chapter-description {\n            font-size: 15px;\n            line-height: 24px;\n        }\n        \n        .chapter-time {\n            @include headline(14px, 24px, $chapterfooter);\n            @include flexcontainer();\n            justify-content: initial;\n\n            .time-icon {\n                display: inline-block;\n                @include logoimage('../img/icon-time.svg', 19px, 19px);\n                margin-right: 8px;\n            }\n        }\n    }\n\n    .chapter-image {\n        width: 100%;\n        height: 180px;\n        @include flexcontainer();\n\n        &.blue {\n            background-color: #58c6fb;\n        }\n        &.orange {\n            background-color: #fe9827;\n        }\n        &.purple {\n            background-color: #bd10e0;\n        }\n        &.darkblue {\n            background-color: #0f75fb;\n        }\n        &.greyblue {\n            background-color: #444f6c;\n        }\n\n        .getting-started-icon {\n            @include logoimage('../img/icon-tutorial-getting-started.svg', 75px, 93px);\n        }\n        .restaurant-app-icon {\n            @include logoimage('../img/icon-tutorial-restaurant-app.svg', 80px, 82px);\n        }\n        .shopping-app-icon {\n            @include logoimage('../img/icon-tutorial-shopping-app.svg', 104px, 58px);\n            margin-left: -50px;\n        }\n        .loyalty-app-icon {\n            @include logoimage('../img/icon-tutorial-loyalty-app.svg', 104px, 51px);\n            margin-left: -30px;\n        }\n        .ui-toolkit-icon {\n            @include logoimage('../img/icon-tutorial-ui-toolkit.svg', 47px, 77px);\n        }\n        .shoutem-icon {\n            @include logoimage('../img/icon-tutorial-shoutem.svg', 113px, 35px);\n        }\n    }\n}\n\n.documentation-category,\n.chapter-category {\n    font-size: 12px;\n    font-weight: bold;\n    color: $muted;\n    letter-spacing: 1px;\n    text-transform: uppercase;\n    line-height: 1;\n    margin-top: 0;\n}\n\n.documentation-group {\n    width: 270px;\n    margin-bottom: 80px;\n\n    @include medium {\n       margin: 0 auto 30px;\n    }\n\n    .documentation-link {\n        position: relative;\n        padding-left: 40px;\n        color: $homeheading;\n        line-height: 30px;\n        display: block;\n        padding-top: 20px;\n        cursor: hover;\n\n        &:hover {\n            color: $homeheading;\n            text-decoration: none;\n        }\n\n        .link-icon {\n            @include logoimage('../img/icon-reference.svg', 24px, 30px);\n            position: absolute;\n            left: 0;\n            opacity: 0.6;\n        }\n    }\n}\n\n.feature {\n    width: 270px;\n    min-height: 230px;\n\n    @include medium {\n        margin: 0 auto 30px;\n    }\n\n    .feature-title {\n        font-size: 17px;\n        opacity: 0.8;\n        margin-bottom: 10px;\n    }\n\n    .feature-icon {\n        margin-bottom: 30px;\n\n        &.extensions {\n            @include logoimage('../img/icon-features-extensions.svg', 24px, 24px);\n        }\n        &.styling {\n            @include logoimage('../img/icon-features-styling.svg', 24px, 24px);\n        }\n        &.command-line {\n            @include logoimage('../img/icon-features-command-line.svg', 9px, 16px);\n        }\n        &.analytics {\n            @include logoimage('../img/icon-features-analytics.svg', 24px, 24px);\n        }\n        &.push-notifications {\n            @include logoimage('../img/icon-features-push-notifications.svg', 24px, 24px);\n        }\n        &.monetization {\n            @include logoimage('../img/icon-features-monetization.svg', 14px, 24px);\n        }\n        &.extendable {\n            @include logoimage('../img/icon-features-extendable.svg', 24px, 24px);\n        }\n        &.app-configuration {\n            @include logoimage('../img/icon-features-app-configuration.svg', 16px, 24px);\n        }\n        &.auto-updated {\n            @include logoimage('../img/icon-features-auto-updated.svg', 24px, 24px);\n        }\n        &.scalable {\n            @include logoimage('../img/icon-features-scalable.svg', 24px, 24px);\n        }\n        &.cloud-storage {\n            @include logoimage('../img/icon-features-cloud-storage.svg', 28px, 20px);\n        }\n        &.rest-json-api {\n            @include logoimage('../img/icon-features-rest-json-api.svg', 24px, 24px);\n        }\n    }    \n}\n\n.app {\n    width: 170px;\n    min-height: 120px;\n    text-align: center;\n\n    .app-icon {\n        height: 85px;\n        width: 85px;\n        background-repeat: no-repeat;\n        background-size: 100%;\n        margin: 0 auto 25px;\n\n        &.leadership {\n            background-image: url('../img/image-app-leadership-conference.png');\n        }\n        &.jax-xplrr {\n            background-image: url('../img/image-app-jax-xplrr.svg');\n        }\n        &.melbourne-central {\n            background-image: url('../img/image-app-melbourne-central.png');\n        }\n        &.firmsconsulting {\n            background-image: url('../img/image-app-firmsconsulting.svg');\n        }\n        &.seln {\n            background-image: url('../img/image-app-seln-social-network.svg');\n        }\n        &.laughing-place {\n            background-image: url('../img/image-app-laughing-place.png');\n        }\n    }\n}\n\n.company {\n    width: 170px;\n    height: 80px;\n    @include flexcontainer();\n\n    .company-logo {\n        &.usa-today {\n            @include logoimage('../img/logo-usa-today.svg', 100px, 53px);\n        }\n        &.t-mobile {\n            @include logoimage('../img/logo-t-mobile.svg', 129px, 23px);\n        }\n        &.tnw {\n            @include logoimage('../img/logo-tnw.svg', 68px, 31px);\n        }\n        &.techcrunch {\n            @include logoimage('../img/logo-techcrunch.svg', 154px, 23px);\n        }\n        &.mashable {\n            @include logoimage('../img/logo-mashable.svg', 126px, 23px);\n        }\n        &.entrepreneur {\n            @include logoimage('../img/logo-entrepreneur.svg', 144px, 29px);\n        }\n    }\n}\n\n"
  },
  {
    "path": "css/prism.css",
    "content": "/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+json+jsx&plugins=line-highlight */\n/**\n * prism.js default theme for JavaScript, CSS and HTML\n * Based on dabblet (http://dabblet.com)\n * @author Lea Verou\n */\n\ncode[class*=\"language-\"],\npre[class*=\"language-\"] {\n\tcolor: black;\n\tbackground: none;\n\ttext-shadow: 0 1px white;\n\tfont-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n\ttext-align: left;\n\twhite-space: pre;\n\tword-spacing: normal;\n\tword-break: normal;\n\tword-wrap: normal;\n\tline-height: 1.5;\n\n\t-moz-tab-size: 4;\n\t-o-tab-size: 4;\n\ttab-size: 4;\n\n\t-webkit-hyphens: none;\n\t-moz-hyphens: none;\n\t-ms-hyphens: none;\n\thyphens: none;\n}\n\npre[class*=\"language-\"]::-moz-selection, pre[class*=\"language-\"] ::-moz-selection,\ncode[class*=\"language-\"]::-moz-selection, code[class*=\"language-\"] ::-moz-selection {\n\ttext-shadow: none;\n\tbackground: #b3d4fc;\n}\n\npre[class*=\"language-\"]::selection, pre[class*=\"language-\"] ::selection,\ncode[class*=\"language-\"]::selection, code[class*=\"language-\"] ::selection {\n\ttext-shadow: none;\n\tbackground: #b3d4fc;\n}\n\n@media print {\n\tcode[class*=\"language-\"],\n\tpre[class*=\"language-\"] {\n\t\ttext-shadow: none;\n\t}\n}\n\n/* Code blocks */\npre[class*=\"language-\"] {\n\tpadding: 1em;\n\tmargin: .5em 0;\n\toverflow: auto;\n}\n\n:not(pre) > code[class*=\"language-\"],\npre[class*=\"language-\"] {\n\tbackground: #f5f2f0;\n}\n\n/* Inline code */\n:not(pre) > code[class*=\"language-\"] {\n\tpadding: .1em;\n\tborder-radius: .3em;\n\twhite-space: normal;\n}\n\n.token.comment,\n.token.prolog,\n.token.doctype,\n.token.cdata {\n\tcolor: slategray;\n}\n\n.token.punctuation {\n\tcolor: #999;\n}\n\n.namespace {\n\topacity: .7;\n}\n\n.token.property,\n.token.tag,\n.token.boolean,\n.token.number,\n.token.constant,\n.token.symbol,\n.token.deleted {\n\tcolor: #905;\n}\n\n.token.selector,\n.token.attr-name,\n.token.string,\n.token.char,\n.token.builtin,\n.token.inserted {\n\tcolor: #690;\n}\n\n.token.operator,\n.token.entity,\n.token.url,\n.language-css .token.string,\n.style .token.string {\n\tcolor: #a67f59;\n\tbackground: hsla(0, 0%, 100%, .5);\n}\n\n.token.atrule,\n.token.attr-value,\n.token.keyword {\n\tcolor: #07a;\n}\n\n.token.function {\n\tcolor: #DD4A68;\n}\n\n.token.regex,\n.token.important,\n.token.variable {\n\tcolor: #e90;\n}\n\n.token.important,\n.token.bold {\n\tfont-weight: bold;\n}\n.token.italic {\n\tfont-style: italic;\n}\n\n.token.entity {\n\tcursor: help;\n}\n\npre[data-line] {\n\tposition: relative;\n\tpadding: 1em 0 1em 3em;\n}\n\n.line-highlight {\n\tposition: absolute;\n\tleft: 0;\n\tright: 0;\n\tpadding: inherit 0;\n\tmargin-top: 1em; /* Same as .prism’s padding-top */\n\n\tbackground: hsla(24, 20%, 50%,.08);\n\tbackground: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));\n\n\tpointer-events: none;\n\n\tline-height: inherit;\n\twhite-space: pre;\n}\n\n\t.line-highlight:before,\n\t.line-highlight[data-end]:after {\n\t\tcontent: attr(data-start);\n\t\tposition: absolute;\n\t\ttop: .4em;\n\t\tleft: .6em;\n\t\tmin-width: 1em;\n\t\tpadding: 0 .5em;\n\t\tbackground-color: hsla(24, 20%, 50%,.4);\n\t\tcolor: hsl(24, 20%, 95%);\n\t\tfont: bold 65%/1.5 sans-serif;\n\t\ttext-align: center;\n\t\tvertical-align: .3em;\n\t\tborder-radius: 999px;\n\t\ttext-shadow: none;\n\t\tbox-shadow: 0 1px white;\n\t}\n\n\t.line-highlight[data-end]:after {\n\t\tcontent: attr(data-end);\n\t\ttop: auto;\n\t\tbottom: .4em;\n\t}\n\n"
  },
  {
    "path": "css/style.scss",
    "content": "---\n---\n@import \"colors\";\n@import \"mixins\";\n@import \"base\";\n@import \"navbar\";\n@import \"typography\";\n@import \"github\";\n"
  },
  {
    "path": "csv/restaurants.csv",
    "content": "Name,Address,Description,Website,Image,E-mail\n\"Gaspar Brasserie\",\"185 Sutter St, San Francisco, CA 94109\",\"Expect an intimate venue with the ambience of a private club. The mood is casual, the guests sublime.\",\"gasparbrasserie.com\",\"http://shoutem.github.io/static/getting-started/restaurant-1.jpg\",\"info@gasparbrasserie.com\"\n\"Chalk Point Kitchen\",\"527 Broome St, New York, NY 10013\",\"Stylish restaurant serving market-to-table American fare in modern farmhouse digs with cellar bar.\",\"http://www.chalkpointkitchen.com/\",\"http://shoutem.github.io/static/getting-started/restaurant-2.jpg\",\"feedme@chalkpointkitchen.com\"\n\"Kyoto Amber Upper East\",\"225 Mulberry St, New York, NY 10012\",\"Amber Upper East is located on the corner of 80th and 3rd Avenue. We serve Japanese and Asian cuisines.\",\"https://www.opentable.com/amber-upper-east\",\"http://shoutem.github.io/static/getting-started/restaurant-3.jpg\",\"-\"\n\"Sushi Academy\",\"1900 Warner Ave. Unit A Santa Ana, CA\",\"The educational philosophy of the California Sushi Academy crosses borders, race and gender to bring greater Japanese cultural understanding and appreciation through the culinary experience.\",\"http://www.sushi-academy.com/\",\"http://shoutem.github.io/static/getting-started/restaurant-4.jpg\",\"email@sushi-academy.com\"\n\"Sushibo\",\"35 Sipes Key, New York, NY 10012\",\"We are a catalan family company. From the beginning, on September 2010, Sushibo has been the operating brand of Harakirifish SL in Barcelona.  Our passion for authentic, fresh Japanese cooking has brought us to connect with an extensive base of clients, as well as hotels and several businesses all around the city.\",\"http://www.sushibo.cat/en/\",\"http://shoutem.github.io/static/getting-started/restaurant-5.jpg\",\"info@sushibo.cat\"\n\"Mastergrill\",\"550 Upton Rue, San Francisco, CA 94109\",\"Master Grill by Marko is a longtime brand owned by Mark Stojkanovic, a grill specialist trained in Leskovac, on a notable international school of top grill.\",\"http://www.master-grill.com/master-grill.html\",\"http://shoutem.github.io/static/getting-started/restaurant-6.jpg\",\"-\"\n"
  },
  {
    "path": "docs/cloud/_posts/1970-01-01-ShoutemCloud.md",
    "content": "---\nlayout: doc\npermalink: /docs/cloud/introduction\ntitle: Introduction\nsection: Shoutem Cloud\n---\n\n# Shoutem Cloud\n\nShoutem Extensions can be used with any server. For easier integration with backend, we've prepared a library called [@shoutem/redux-io](https://github.com/shoutem/redux-io), a layer on top of [redux](http://redux.js.org/docs/introduction/) which makes it easy to manage data fetching lifecycle.\n\nIf you don't have a server to connect with, you can use Shoutem Cloud. Shoutem Cloud is one of the main components of the Shoutem platform. Using Shoutem Cloud, you don't need to worry about developing your own backend with all the problems that come along: optimisations for typical CRUD operations, scaling and security.\n\n[//]: # (Add picture of Shoutem Cloud)\n\nTo use Shoutem Cloud with extensions, we need to create [data schemas]({{ site.url }}/docs/extensions/my-first-extension/using-cloud-storage) which describe structure of the data that should be stored on Shoutem Cloud. When used in extensions, the `@shoutem/redux-io` library is by default configured to Shoutem Cloud, but it can be configured for use with any API.\n\nWe've also prepared a [data schema reference]({{ site.url }}/docs/cloud/data-schemas). You can see an implementation of how a custom extension uses Shoutem Cloud storage in our [My First Extension]({{ site.url }}/docs/extensions/my-first-extension/introduction) tutorial in the Using Cloud Storage and Working with Data sections. However, we recommend going through the entire tutorial as a whole.\n"
  },
  {
    "path": "docs/cloud/_posts/1970-01-02-DataSchemas.md",
    "content": "---\nlayout: doc\npermalink: /docs/cloud/data-schemas\ntitle: Introduction\nsection: Data Schemas\n---\n\n# Data Schemas\n\nData Schema describes what the data will look like. Schemas are a `type` of data. The format of the data schema is nothing more than a Shoutem flavored [JSON schema](https://spacetelescope.github.io/understanding-json-schema/UnderstandingJSONSchema.pdf).\n\n## Usage in extensions\n\nCreate a data schema with:\n\n```ShellSession\n$ shoutem schema add <schema-name>\n```\n\nwhere you should replace `<schema-name>` with the name of your Data Schema name. Example:\n\n```ShellSession\n$ shoutem schema add Restaurants\nSchema `Restaurants` is created in file `server/schemas/Restaurants.json`!\nFile `extension.json` was modified.\n```\n\nData schema is created in the `server/data-schemas` folder. Its default content is:\n\n```JSON\n{\n  \"title\": \"Restaurants\",\n  \"properties\": {\n    \"name\": {\n      \"format\": \"single-line\",\n      \"title\": \"Name\",\n      \"type\": \"string\",\n      \"displayPriority\": 1\n    }\n  },\n  \"titleProperty\": \"name\",\n  \"type\": \"object\"\n}\n```\n\nRoot JSON fields that are immediately included are:\n\n- `title`: Title of the schema shown on the CMS page\n- `properties`: Properties of each object created from that data schema\n- `titleProperty`: Property used as title of object in the list\n- `type`: Type of data in JavaScript. It can only be `object`\n\nField `properties` is an object containing _keys_ as names of object properties and _values_ as descriptors of property's value. Shoutem flavored `properties` can't have children. Below is the reference for value descriptor.\n\n## Value descriptor reference\n\nWith the value descriptor Shoutem builder knows which input fields to render on the CMS page. These input fields along with the `title` property explain to the application owner which kind of data they expect.\n\n### Value types\n\nEach value type has a combination of `type`, `format` and sometimes additional properties in the value descriptor which define type of the value. We call them _value signatures_. Referencing other data schemas is enabled by using `referencedSchema` field. Below are the signatures and examples for each value type that can be created with data schemas.\n\n> #### Note\n> JSON schema defines the types that can be used. It also provides some built-in formats. However, Shoutem uses its own flavored formats.\n\n#### Single-line string\n\nSignature:\n\n```JSON\n\"type\": \"string\",\n\"format\": \"single-line\"\n```\n\nExample:\n\n```JSON\n\"name\": {\n  \"type\": \"string\",\n  \"format\": \"single-line\",\n  \"title\": \"Name\",\n  \"required\": true\n}\n```\n\n#### Multi-line string\n\nSignature:\n\n```JSON\n\"type\": \"string\",\n\"format\": \"multi-line\"\n```\n\nExample:\n\n```JSON\n\"description\": {\n  \"type\": \"string\",\n  \"format\": \"multi-line\",\n  \"title\": \"Description\",\n  \"minLength\": 10,\n  \"maxLength\": 1000\n},\n```\n\n#### Integer\n\nSignature:\n\n```JSON\n\"type\": \"integer\",\n\"format\": \"integer\"\n```\n\nExample:\n\n```JSON\n\"rating\": {\n  \"type\": \"number\",\n  \"format\": \"number\",\n  \"title\": \"Rating\",\n  \"minimum\": 0,\n  \"maximum\": 10\n}\n```\n\n#### Boolean\n\nSignature:\n\n```JSON\n\"type\": \"boolean\",\n\"format\": \"boolean\"\n```\n\nExample:\n\n```JSON\n\"offersWifi\": {\n  \"type\": \"boolean\",\n  \"format\": \"boolean\",\n  \"title\": \"Offers WIFI\"\n}\n```\n\n#### Array\n\nSignature:\n\n```JSON\n\"type\": \"array\",\n\"format\": \"array\"\n```\n\nExample:\n\n```JSON\n\"genericArray\": {  \n  \"type\": \"array\",\n  \"format\": \"array\",\n  \"title\": \"Generic JS Array\"\n},\n```\n\n#### Generic object\n\nSignature:\n\n```JSON\n\"type\": \"object\",\n\"format\": \"object\"\n```\n\nExample:\n\n```JSON\n\"genericObject\": {  \n  \"type\": \"object\",\n  \"format\": \"object\",\n  \"title\": \"Generic JS Object\"\n}\n```\n\n#### Date time\n\nSignature:\n\n```JSON\n\"type\": \"object\",\n\"format\": \"date-time\"\n```\n\nExample:\n\n```JSON\n\"openedSince\": {\n  \"type\": \"object\",\n  \"format\": \"date-time\",\n  \"title\": \"Opened Since\"\n}\n```\n\n#### Location\n\nSignature:\n\n```JSON\n\"type\": \"object\",\n\"format\": \"geolocation\"\n```\n\nExample:\n\n```JSON\n\"placeOfBirth\": {\n  \"type\": \"object\",\n  \"format\": \"geolocation\",\n  \"title\": \"Place of birth\"\n}\n```\n\n#### Image\n\nSignature:\n\n```JSON\n\"type\": \"object\",\n\"format\": \"attachment\",\n\"referencedSchema\": \"shoutem.core.image-attachments\"\n```\n\nExample:\n\n```JSON\n\"image\": {\n  \"type\": \"object\",\n  \"format\": \"attachment\",\n  \"title\": \"Restaurant's image\",\n  \"referencedSchema\": \"shoutem.core.image-attachments\"\n}\n```\n\n#### Rich media\n\nSignature:\n\n```JSON\n\"type\": \"string\",\n\"format\": \"html\"  \n```\n\nExample:\n\n```\n\"info\": {\n  \"type\": \"string\",\n  \"format\": \"html\",\n  \"title\": \"Info\",\n  \"maxLength\": 10000\n}\n```\n\n#### Custom referenced schema - single object\n\nSignature:\n\n```JSON\n\"type\": \"object\",\n\"format\": \"entity-reference\",\n\"referencedSchema\": \"<<absolute-data-schema-name>>\"\n```\n\nExample:\n\n```JSON\n\"Restaurant\": {\n  \"type\": \"object\",\n  \"format\": \"entity-reference\",\n  \"title\": \"Best restaurant\",\n  \"referencedSchema\": \"shoutem.restaurants.Restaurants\"\n}\n```\n\n> #### Note\n> The absolute data schema reference is formated following structure {developerName}.{extensionName}.{extensionPartName} as explained in [Creating shortcut and screen]({{ site.url }}/docs/extensions/my-first-extension/shortcut-and-screen) tutorial\n\n#### Custom referenced schema - array\n\nSignature:\n\n```JSON\n\"type\": \"object\",\n\"format\": \"entity-reference-array\",\n\"referencedSchema\": \"<<absolute-data-schema-name>>\"\n```\n\nExample:\n\n```JSON\n\"News\": {\n  \"type\": \"object\",\n  \"format\": \"entity-reference-array\",\n  \"title\": \"News\",\n  \"referencedSchema\": \"shoutem.news.News\"\n}\n```\n\n\n### Property order\n\nAs `properties` are a dictionary and dictionaries are by nature unordered, we added a `displayPriority` property in the value descriptor which you can use to define the order in which properties are shown on the Shoutem CMS interface. A valid value of `displayPriority` property is an integer - the lower the integer, the higher the property will be shown in the interface.\n\nDisplay priority is an optional property. Properties which omit it will be rendered in an arbitrary order after all the properties with `displayPriority` defined.\n\n\n### Additional descriptor properties\n\nThe value descriptor along with _value type_ can also describe additional information for a particular value. These fields are inherited from the JSON Schema specification:\n\n- `properties.pattern` - regex pattern constraint, applicable only to `string` primitive type\n- `properties.required` - required constraint\n- `properties.minLength` and `properties.maxLength` - `string` length constraints, applicable only to `string` primitive type\n- `properties.maximum` and `properties.minimum` - value range constraints, applicable only to number and integer primitive types\n\n\nThese additional descriptor properties allow us to create arbitrary types, such as generally used e-mail:\n\n```JSON\n\"email\": {\n  \"type\": \"string\",\n  \"format\": \"single-line\",\n  \"title\": \"Email\",\n  \"minLength\": 3,\n  \"maxLength\": 100,\n  \"pattern\": \"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\"\n},\n```"
  },
  {
    "path": "docs/extensions/my-first-extension/_posts/1970-01-01-Introduction.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/my-first-extension/introduction\ntitle: Introduction\nsection: My First Extension\n---\n\n# My First Extension\n<hr />\n\nThis tutorial will show you how to write custom **Shoutem extensions** on the Shoutem platform. It introduces the most important concepts. After completing it, you will have a running **mobile app** that uses the your brand new **custom extension** with components from the [Shoutem UI Toolkit]({{ site.url }}/docs/ui-toolkit/introduction) and retrieves content from the [Shoutem Cloud]({{ site.url }}/docs/cloud/introduction). The final result of this tutorial-made extension is [open sourced](https://github.com/shoutem/extension-examples/tree/master/restaurants-getting-started).\n\nBefore you start the My First Extension tutorial series, you should go through [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started), because this tutorial series builds on top of the simple extension you created there.\n\nHere's a preview of what the completed app will look like.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/extension-preview.jpg'/>\n</p>\n\n## What are Extensions?\n\nExtensions represent features in the app. The app owner picks extensions that he wants to use in his app through the Shoutem Builder. Shoutem prepared a bunch of [open sourced](https://github.com/shoutem/extensions) extensions which you can easily customize to fit your needs.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/shoutem-extensions.png'/>\n</p>\n\nYou can develop extensions both within apps made by `shoutem clone` and as stand-alone extensions that you plan on using within multiple apps. In this tutorial, we'll be working on the Restaurants extension we made in Getting Started, so it'll be treated as one within a _cloned_ app.\n\n## About the Technology\n\n<hr />\n\nShoutem uses [React](https://facebook.github.io/react/) and [React Native](https://facebook.github.io/react-native/) as frameworks for building cross-platform apps. React is an open source JavaScript library that provides a way to build user interfaces (UIs), while React Native exposes iOS and Android **native** components so they can be used in React environment. If you haven't used these technologies before, our [React Native school](http://school.shoutem.com/) can help you get started!\n\nWe use [JSX](https://facebook.github.io/react/docs/introducing-jsx.html) as a simple way to write UI components with tags. Building an app screen with JSX is as easy as:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/jsx-component-example.png'/>\n</p>\n\nOn top of React and React Native, we're using [Redux](http://redux.js.org/), a library which simplifies state management.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/redux.png'/>\n</p>\n\nEven though _we_ use Redux, _you_ can use any other state management library (like [MobX](https://github.com/mobxjs/mobx), or just don't use any at all! Again, we don't want to restrict you on how you use React Native.\n\n## Create an Extension\nThe best way to understand the power of extensions is to get your hands dirty. Let's write some code!\n"
  },
  {
    "path": "docs/extensions/my-first-extension/_posts/1970-01-03-InitializingExtension.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/my-first-extension/initializing-extension\ntitle: Creating an Extension\nsection: My first extension\n---\n\n# Creating an Extension\n\nHere's the mockup of the Restaurants extension that we saw in the [Introduction]({{ site.url }}/docs/extensions/my-first-extension/introduction). Through the course of this tutorial, we'll turn the **Restaurants** extension from [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started) into this list of restaurants.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/extension-preview.jpg'/>\n</p>\n\nThe left app screen lists the restaurants and the right one shows the details of each specific restaurant when you tap on it.\n\n## Initialization\n\nLet's revise what we did in [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started) (which you should go through before starting this tutorial series). We cloned the app we made on the Builder and initialized a new extension in the app with basic information using `shoutem init`, which created a folder and bootstrapped it with extension files.\n\n```ShellSession\n$ shoutem init restaurants\nEnter information about your extension. Press `return` to accept (default) values.\nTitle: Restaurants\nVersion: 0.0.1\nDescription: A restaurants extension.\n```\n\nThis information is stored in the `extension.json` file.\n\n> #### Note\n> In case you can't remember the structure of some command, type `shoutem -h` or `shoutem <command> -h` where you should replace `<command>` with one of the [CLI commands]({{ site.url }}/docs/extensions/reference/cli).\n\n## Folder Structure\n\nThe initialization process will generate the skeleton with folders and files. Our new extension's structure looks like this:\n\n```\nrestaurants/\n  ├ app/\n  |  ├ node_modules/\n  |  ├ extension.js\n  |  ├ index.js\n  |  └ package.json\n  ├ server/\n  |  ├ node_modules/\n  |  └ package.json\n  └ extension.json\n```\n\nLet's explain the structure:\n\n- `app/`: Folder where you keep your mobile app side code (this will be bundled into the app)\n- `server/`: Folder where you keep your server side code and assets\n- `extension.json`: File that describes your extension\n\nSpecific parts will be explained soon.\n\nIn `extension.json` you can see:\n\n```JSON\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"title\": \"Restaurants\",\n  \"description\": \"A restaurants extension.\",\n  \"platform\": \"1.0.*\"\n}\n```\n\nBrief property explanations:\n\n- `name` uniquely identifies the extension when combined with your developer name (e.g. `{{ site.example.devName }}.restaurants`)\n- `version` is the extension version\n- `platform` indicates the version of the [plaform]({{ site.url }}/docs/extensions/reference/platform) (versions of React, React Native and other packages available to all extensions by default)\n- `title` and `description` are extension descriptors\n\nWe also uploaded our extension to Shoutem:\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nAnd installed it into our app:\n\n```ShellSession\n$ shoutem install\n\nExtension installed.\nSee it in the builder: {{ site.shoutem.builderURL }}/app/{{ site.example.appId }}\n```\n\nUploading the extension is self-explanatory, but let's elaborate on installing and uninstalling extensions. In the Builder, you can go to the `Extensions` tab to see which extensions are installed in your app. If you successfully installed your Restaurants extension from [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started), you should see it there under the `Custom` category.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/extension-tab-extension.png'/>\n</p>\n\nExtensions are installed into specific apps, not all apps on your account.\n\nNow let's elaborate on [screens and shortcuts]({{ site.url }}/docs/extensions/my-first-extension/shortcut-and-screen).\n"
  },
  {
    "path": "docs/extensions/my-first-extension/_posts/1970-01-04-CreatingShortcutAndScreen.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/my-first-extension/shortcut-and-screen\ntitle: Creating a Screen and Shortcut\nsection: My first extension\n---\n\n# Creating a Screen and Shortcut\n\nExtensions can have multiple screens in the app. Screens are [React components](https://facebook.github.io/react/docs/react-component.html) that represent a mobile screen. We want our Restaurants extension to have 2 screens; one for the list of the restaurants (which we already made in [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started)) and another for the details of each particular restaurant the user taps.\n\nSince the app needs to know which screen to open first for some extension, we need to create a ***shortcut*** when creating that screen. A shortcut is a link to the starting screen of an extension. It's the item in the Main Navigation which opens the starting screen when a user taps on it.\n\nWe created the List screen with a shortcut in [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started) using:\n\n```ShellSession\n$ shoutem screen add List\n? Screen name: List\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: {{ site.example.extensionName }}\n? Shortcut title: Restaurants\n? Shortcut description: A shortcut for List\n...\nSuccess\n```\n\nThe CLI modified the `extension.json` to include the screen and it's shortcut:\n\n```json{7-14}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"platform\": \"1.0.*\",\n  \"title\": \"Restaurants\",\n  \"description\": \"List of restaurants\",\n  \"screens\": [{\n    \"name\": \"List\"\n  }],\n  \"shortcuts\": [{\n    \"name\": \"Restaurants\",\n    \"title\": \"Restaurants\"\n    \"screen\": \"@.List\"\n  }]\n}\n```\n\nThey were added inside arrays. The `name` property uniquely identifies these extension parts. A shortcut's `title` is what will be shown in the Main Navigation (in the Builder and in the app). The `screen` property inside `shortcuts` references the screen that will open when a user taps on that shortcut in navigation.\n\nWhen referencing any extension part, we need to say which extension it came from. The full name of extension part follows this structure: `<developer-name>.<extension-name>.<extension-part-name>` (e.g. `{{ site.example.devName }}.restaurants.List)`. For extension parts within the same extension, you can just use `@.<extension-part-name>` (e.g. `@.List`). `@.` stands for `<developer-name>.<extension-name>.` of the current extension.\n\nThe Shoutem CLI also created `app/screens/` folder with a `List.js` file, which you edited in [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started).\n\n## How do Extensions fit into an App?\n\nThe `app` folder from your extension will be bundled (along with the rest of the extensions your app uses) into the full React Native app. For your extension to use an `npm` package, just install it inside the `app` folder.\n\nBelow is an example of installing [React Native swiper](https://github.com/leecade/react-native-swiper) (just an example, no need to execute following 2 commands).\n\nLocate to the `app` folder and install the package with saving the dependency in the `package.json`:\n\n```ShellSession\n$ cd app/\n$ npm install --save react-native-swiper\n```\n\nThis package would be installed when bundling your extension into the app. You would be able to access it in any file in the `app` folder.\n\n## Exporting Extension Parts\n\nThe app expects extensions to export their parts (e.g. screens) in `app/index.js` (that's standard JS practice). Extensions are like libraries and other extensions can reuse what they export from `app/index.js`. The convention is that `app/index.js` is the public API of an extension and shouldn't be changed often.\n\nThe current `index.js` looks like this:\n\n```JSX\n#file: app/index.js\n// Reference for app/index.js can be found here:\n// http://shoutem.github.io/docs/extensions/reference/extension-exports\n\nimport * as extension from './extension.js';\n\nexport const screens = extension.screens;\n\nexport const themes = extension.themes;\n```\n\nOn the other hand, `app/extension.js` is managed by the CLI and you should not change it. When creating screens, the CLI writes their location in `app/extension.js` which are exported in `app/index.js`.\n\n## Previewing Extension Code Changes\n\nWe already did this in [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started), but let's elaborate on it. Since the app is managed through the Builder, we needed to `push` the extension to Shoutem and `install` it into our app so we can use and preview it in the Builder.\n\nWe then opened the app in the Builder and added the extension's screen to Main navigation. Installing new extensions and adding their shortcuts to the app requires you to reconfigure your local clone, which we also did using `shoutem configure`.\n\nLet's preview your app again. We can preview it in the Builder, but it might take some time while the Builder bundles the entire app again. Every time you change an extension, you'd have to _push_ it again and then the Builder would need to re-bundle the whole app to add the changes. It's much faster to [set up your local environment]({{ site.url }}/docs/extensions/tutorials/setting-local-environment) and simply use `react-native run-ios` or `react-native run-android`.\n\nLet's preview the app and see where we stopped in [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started).\n\n```ShellSession\n$ react-native run-ios\nScanning folders for symlinks in /path/to/Restaurants/node_modules\n...\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/getting-started/03-lets-eat.png'/>\n</p>\n\n> #### Note\n> In the documentation the preview you see is from the Builder, instead of a screenshot from the Shoutem Preview app or a local emulator. This way you'll see the state of the web interface as well.\n\nNow let's make a quick change to the app code so you can see it change in real time on the emulator. Open your `restaurants` extension's `List.js` screen file and add another line of text:\n\n```JavaScript{6}\n#file: app/screens/List.js\nexport default class List extends Component {\n  render() {\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Let's eat!</Text>\n        <Text style={styles.text}>Can't do anything on an empty stomach!</Text>\n      </View>\n    );\n  }\n}\n```\n\nAfter reloading the emulator, your new line of text should be visible immediately:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/real-time-preview.png'/>\n</p>\n\nYour extension only has a simple screen right now, let's add some [UI components]({{ site.url }}/docs/extensions/my-first-extension/using-ui-toolkit).\n"
  },
  {
    "path": "docs/extensions/my-first-extension/_posts/1970-01-05-UsingUIToolkit.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/my-first-extension/using-ui-toolkit\ntitle: Using UI toolkit\nsection: My first extension\n---\n\n# Using the UI Toolkit\n\nReact Native exposes plain iOS and Android native components that you can use, but there's usually a lot of work left to do just to make them look beautiful. Instead, you can use [@shoutem/ui](https://github.com/shoutem/ui), a set of customizable UI components. There are [plenty of components]({{ site.url }}/docs/ui-toolkit/components/typography) that you can use out of the box.\n\n## Creating a Restaurants List\n\nLet's create a list of restaurants. Start by importing UI components from the toolkit.\n\n```javascript{9-17,19}\n#file: app/screens/List.js\nimport React, { PureComponent } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport { NavigationBar } from 'shoutem.navigation';\n\nimport {\n  ImageBackground,\n  ListView,\n  Tile,\n  Title,\n  Subtitle,\n  Overlay,\n  Screen\n} from '@shoutem/ui';\n\n```\n\nNotice that you didn't need to install the `@shoutem/ui` package into the `app` folder of your extension. That's because this package will be installed in the extension by the app into which your extension is bundled. All packages installed by the app by default can be found in `peerDependencies` of `app/package.json`. Also, we removed `View` and `Text` from the `react-native` import.\n\nWe prepared some mockup restaurants data for you. Download [this compressed file](/static/getting-started/restaurants.zip), extract it and copy the extracted `assets` folder into your `app` folder. The `assets` folder contains static restaurants data in `restaurants.json`.\n\nDefine a method in your `List` class that returns an array of restaurants.\n\n```javascript{3-5}\n#file: app/screens/List.js\nexport default class List extends PureComponent {\n\n  getRestaurants() {\n    return require('../assets/restaurants.json');\n  }\n```\n\nImplement a `render` method that will use a `ListView` component. [ListView]({{ site.url }}/docs/ui-toolkit/components/list-view) accepts `data` in the form of an `array` to be shown in the list and `renderRow` is a callback function that defines how each row in the list should look.\n\nAdd the `renderRow` method and change the implementation of the `render` method:\n\n```JSX{3-14,17-25}\n#file: app/screens/List.js\n  getRestaurants() {...}\n\n  // defines the UI of each row in the list\n  renderRow(restaurant) {\n    return (\n      <ImageBackground styleName=\"large-banner\" source={% raw %}{{ uri: restaurant.image &&\n        restaurant.image.url ? restaurant.image.url : undefined  }}{% endraw %}>\n        <Tile>\n          <Title>{restaurant.name}</Title>\n          <Subtitle>{restaurant.address}</Subtitle>\n        </Tile>\n      </ImageBackground>\n    );\n  }\n\n  render() {\n    return (\n      <Screen>\n        <NavigationBar title=\"RESTAURANTS\" />\n        <ListView\n          data={this.getRestaurants()}\n          renderRow={restaurant => this.renderRow(restaurant)}\n        />\n      </Screen>\n    );\n  }\n```\n\nSince we've only changed the app code now, we don't need to upload the extension. However, in case you're checking the changes in the Builder, do:\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nThe app preview will be shown after Shoutem bundles the new app. `List` is now showing the list of restaurants.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/extension-rich-list.png'/>\n</p>\n\nThis looks exactly how we wanted.\n\nTry clicking on a one of the restaurants. Nothing happens! We want to open up the screen with a restaurant's details when the user touches a row in the list.\n\n## Creating a Details Screen\n\nWhen a restaurant in the list is touched, we will open the details screen for that restaurant. To make components respond to touches, use the [TouchableOpacity](https://facebook.github.io/react-native/docs/touchableopacity.html) component from React Native. We'll also import Shoutem's `navigateTo` action creator to navigate to another screen and the `ext` function for the name of screen we're navigating to.\n\nLet's import these things (find the complete code below):\n\n```javascript{1-5}\n#file: app/screens/List.js\nimport { TouchableOpacity } from 'react-native';\n\nimport { navigateTo } from 'shoutem.navigation';\n\nimport { ext } from '../const';\n```\n\n[Connect](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options) `navigateTo` action creator to redux store.\n\n```javascript{1,3-9,14-18}\n#file: app/screens/List.js\nimport { connect } from 'react-redux';\n\nexport class List extends PureComponent {\n  constructor(props) {\n    super(props);\n\n    // bind renderRow function to get the correct props\n    this.renderRow = this.renderRow.bind(this);\n  }\n\n  getRestaurants() {...}\n}\n\n// connect screen to redux store\nexport default connect(\n  undefined,\n  { navigateTo }\n)(List);\n```\n\n> #### Note\n> Make sure that you remove the `default` from `export default class List extends PureComponent` because there can only be one default export and we want `export default connect` to be it.\n\nNow create the Details screen:\n\n```ShellSession\n$ shoutem screen add Details\n? Screen name: Details\n? Create a shortcut (so that screen can be added through the Builder)? No\nSuccess\n```\n\nWe didn't create a `shortcut` since this screen isn't the starting screen your extension.\n\nOpen the restaurants details screen in the `renderRow` function. The `navigateTo` action creator accepts Shoutem `route object` as the only argument with `screen` (full name of screen to navigate to) and `props` (passed to screen) properties. To get the full name of the screen, we'll use the `ext` function, which returns the full name of the extension part passed as its first argument (e.g. returns `tom.restaurants.Details` for `Details`) or the full extension name (e.g. `tom.restaurants`) if no argument is passed.\n\n```JSX{2,5-8,16}\n#file: app/screens/List.js\n  renderRow(restaurant) {\n    const { navigateTo } = this.props;\n\n    return (\n      <TouchableOpacity onPress={() => navigateTo({\n        screen: ext('Details'),\n        props: { restaurant }\n      })}>\n        <ImageBackground styleName=\"large-banner\" source={% raw %}{{ uri: restaurant.image &&\n        restaurant.image.url ? restaurant.image.url : undefined }}{% endraw %}>\n          <Tile>\n            <Title>{restaurant.name}</Title>\n            <Subtitle>{restaurant.address}</Subtitle>\n          </Tile>\n        </ImageBackground>\n      </TouchableOpacity>\n    );\n  }\n```\n\nThis is what you should end up with in `app/screens/List.js`:\n\n```JSX\n#file: app/screens/List.js\nimport React, { PureComponent } from 'react';\nimport { TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\n\nimport { navigateTo, NavigationBar } from 'shoutem.navigation';\n\nimport {\n  ImageBackground,\n  ListView,\n  Tile,\n  Title,\n  Subtitle,\n  Overlay,\n  Screen\n} from '@shoutem/ui';\n\nimport { ext } from '../const';\n\nexport class List extends PureComponent {\n  constructor(props) {\n    super(props);\n\n    // bind renderRow function to get the correct props\n    this.renderRow = this.renderRow.bind(this);\n  }\n\n  getRestaurants() {\n    return require('../assets/restaurants.json');\n  }\n\n  // defines the UI of each row in the list\n  renderRow(restaurant) {\n    const { navigateTo } = this.props;\n\n    return (\n      <TouchableOpacity onPress={() => navigateTo({\n        screen: ext('Details'),\n        props: { restaurant }\n      })}>\n        <ImageBackground styleName=\"large-banner\" source={% raw %}{{ uri: restaurant.image &&\n        restaurant.image.url ? restaurant.image.url : undefined }}{% endraw %}>\n          <Tile>\n            <Title>{restaurant.name}</Title>\n            <Subtitle>{restaurant.address}</Subtitle>\n          </Tile>\n        </ImageBackground>\n      </TouchableOpacity>\n    );\n  }\n\n  render() {\n    return (\n      <Screen>\n        <NavigationBar title=\"RESTAURANTS\" />\n        <ListView\n          data={this.getRestaurants()}\n          renderRow={restaurant => this.renderRow(restaurant)}\n        />\n      </Screen>\n    );\n  }\n}\n\n// connect screen to redux store\nexport default connect(\n  undefined,\n  { navigateTo }\n)(List);\n```\n\nFor the `Details` screen just copy the following code. We're not introducing any new concept here, just using some additional components.\n\n```JSX\n#file: app/screens/Details.js\nimport React, { PureComponent } from 'react';\nimport { ScrollView } from 'react-native';\n\nimport {\n  Icon,\n  Row,\n  Subtitle,\n  Text,\n  Title,\n  View,\n  ImageBackground,\n  Divider,\n  Tile,\n} from '@shoutem/ui';\n\nexport default class Details extends PureComponent {\n  render() {\n    const { restaurant } = this.props;\n\n    return (\n      <ScrollView style = {% raw %}{{marginTop:-70}}{% endraw %}>\n        <ImageBackground styleName=\"large-portrait\" source={% raw %}{{ uri: restaurant.image &&\n        restaurant.image.url ? restaurant.image.url : undefined }}{% endraw %}>\n          <Tile>\n            <Title>{restaurant.name}</Title>\n            <Subtitle>{restaurant.address}</Subtitle>\n          </Tile>\n        </ImageBackground>\n\n        <Row>\n          <Text>{restaurant.description}</Text>\n        </Row>\n\n        <Divider styleName=\"line\" />\n\n        <Row>\n          <Icon name=\"laptop\" />\n          <View styleName=\"vertical\">\n            <Subtitle>Visit webpage</Subtitle>\n            <Text>{restaurant.url}</Text>\n          </View>\n          <Icon name=\"right-arrow\" />\n        </Row>\n\n        <Divider styleName=\"line\" />\n\n        <Row>\n          <Icon name=\"pin\" />\n          <View styleName=\"vertical\">\n            <Subtitle>Address</Subtitle>\n            <Text>{restaurant.address}</Text>\n          </View>\n          <Icon name=\"right-arrow\" />\n        </Row>\n\n        <Divider styleName=\"line\" />\n\n        <Row>\n          <Icon name=\"email\" />\n          <View styleName=\"vertical\">\n            <Subtitle>Email</Subtitle>\n            <Text>{restaurant.mail}</Text>\n          </View>\n        </Row>\n\n        <Divider styleName=\"line\" />\n      </ScrollView>\n    );\n  }\n}\n```\n\nNow when you reload the app and tap on a restaurant in the list, this is what you get:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/extension-rich-details.png'/>\n</p>\n\nIf you aren't previewing with an [emulator on your local machine]({{ site.url }}/docs/extensions/tutorials/setting-local-environment), you will have to _push_ the extension:\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nLooking at the preview, that's exactly what we wanted. However, your app is using static data. Let's connect it to the **Shoutem Cloud**.\n"
  },
  {
    "path": "docs/extensions/my-first-extension/_posts/1970-01-06-UsingCloudStorage.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/my-first-extension/using-cloud-storage\ntitle: Using Cloud Storage\nsection: My first extension\n---\n\n# Using Cloud Storage\n\nShoutem Cloud Storage is a CMS solution for mobile apps. We made the [@shoutem/redux-io](https://github.com/shoutem/redux-io) package to simplify the communication with Shoutem CMS. Define a `data schema` to describe your data model, do this in your Restaurant extension directory:\n\n```ShellSession\n$ shoutem schema add Restaurants\nSchema `Restaurants` is created in file `server/data-schemas/Restaurants.json`!\nFile `extension.json` was modified.\n```\n\nThe CLI just created a `data-schemas` folder inside the `server` folder and put `Restaurants.json` in it, which contains the following:\n\n```JSON\n#file: server/data-schemas/Restaurants.json\n{\n  \"title\": \"Restaurants\",\n  \"properties\": {\n    \"name\": {\n      \"format\": \"single-line\",\n      \"title\": \"Name\",\n      \"type\": \"string\",\n      \"displayPriority\": 1\n    },\n  },\n  \"titleProperty\": \"name\",\n  \"type\": \"object\"\n}\n```\n\nWe're using the `server` folder because data schemas are not part of the app code, but rather the server side of an extension. Data schemas are nothing more than Shoutem-flavored [JSON Schemas](http://json-schema.org/). They describe the data being stored on Shoutem Cloud Storage.\n\nAll fields are explained in the [data schema reference]({{ site.url }}/docs/cloud/data-schemas). This schema is exported in `extension.json`:\n\n```JSON{18-21}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"platform\": \"1.0.*\",\n  \"title\": \"Restaurants\",\n  \"description\": \"A restaurants extension.\",\n  \"screens\": [{\n    \"name\": \"List\"\n  }, {\n    \"name\": \"Details\"\n  }],\n  \"shortcuts\": [{\n    \"name\": \"Restaurants\",\n    \"title\": \"Restaurants\",\n    \"description\": \"Allow users to browse through list of restaurants\"\n    \"screen\": \"@.List\",\n  }],\n  \"dataSchemas\": [{\n    \"name\": \"Restaurants\",\n    \"path\": \"server/data-schemas/Restaurants.json\"\n  }]\n}\n```\n\nCurrently, your schema only has the `name` property, which we'll use for each restaurants name. Let's add additional properties which we want to have for each restaurant, such as: `address`, `description`, website `url`, `image` and `mail`.\n\n```JSON{4-40}\n#file: server/data-schemas/Restaurants.json\n{\n  \"title\": \"Restaurant\",\n  \"properties\": {\n    \"name\": {\n      \"format\": \"single-line\",\n      \"title\": \"Restaurant's name\",\n      \"type\": \"string\",\n      \"displayPriority\": 1\n    },\n    \"address\": {\n      \"format\": \"single-line\",\n      \"title\": \"Address\",\n      \"type\": \"string\",\n      \"displayPriority\": 2\n    },\n    \"description\": {\n      \"format\": \"multi-line\",\n      \"title\": \"Description\",\n      \"type\": \"string\",\n      \"displayPriority\": 3\n    },\n    \"url\": {\n      \"format\": \"uri\",\n      \"title\": \"Website\",\n      \"type\": \"string\",\n      \"displayPriority\": 4\n    },\n    \"image\": {\n      \"format\": \"attachment\",\n      \"title\": \"Image\",\n      \"type\": \"object\",\n      \"referencedSchema\": \"shoutem.core.image-attachments\",\n      \"displayPriority\": 5\n    },\n    \"mail\": {\n      \"format\": \"single-line\",\n      \"title\": \"E-mail\",\n      \"type\": \"string\",\n      \"displayPriority\": 6\n    }\n  },\n  \"titleProperty\": \"name\",\n  \"type\": \"object\"\n}\n```\n\nTo enter data for your schema, you need to use settings page. Basically, the [settings pages]({{ site.url }}/docs/extensions/tutorials/settings-pages-introduction) are web pages on the Builder. Extension developers write them to enable app owners to manage their extensions.\n\nShoutem prepared a CMS settings page inside the [shoutem.cms](https://github.com/shoutem/extensions/tree/master/shoutem-cms) extension that you can use to manage data for your `schema` on the Shoutem Cloud. Reference that settings page in the `Restaurants` shortcut and pass it the `Restaurants` schema. The page will appear when an app owner selects the `Restaurants` shortcut on the Builder:\n\n```JSON{17-23}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"platform\": \"1.0.*\",\n  \"title\": \"Restaurants\",\n  \"description\": \"List of restaurants\",\n  \"screens\": [{\n    \"name\": \"List\"\n  }, {\n    \"name\": \"Details\"\n  }],\n  \"shortcuts\": [{\n    \"name\": \"Restaurants\",\n    \"title\": \"Restaurants\",\n    \"description\": \"Allow users to browse through list of restaurants\",\n    \"screen\": \"@.List\",\n    \"adminPages\": [{\n      \"page\": \"shoutem.cms.CmsPage\",\n      \"title\": \"Content\",\n      \"parameters\": {\n        \"schema\": \"@.Restaurants\"\n      }\n    }]\n  }],\n  \"dataSchemas\": [{\n    \"name\": \"Restaurants\",\n    \"path\": \"server/data-schemas/Restaurants.json\"\n  }]\n}\n```\n\nLet's upload the extension now, since we want to customize the web interface and the extension server side:\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nGo to the [Builder]({{ shoutem.builderURL }}), open your app and select `Restaurants` under `Main navigation` to see the Shoutem CMS page.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/empty-cms-page.png'/>\n</p>\n\nClick on `Create Items` to start adding content. This will open a modal that contains the `CMS` interface, where you can manage the content for your extension. Apps that get content from the Shoutem CMS will immediately show new content once you edit or add it.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/empty-cms.png'/>\n</p>\n\nClick on `Add item`. This will open a modal for inserting data for the `Restaurants` model, which you defined with your data schema.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/cms-modal.png'/>\n</p>\n\nAdd at least one restaurant. Now you can see the data in the CMS settings page of your Restaurants extension:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/full-cms.png'/>\n</p>\n\nAlthough you've added some restaurants in the Builder, your extension is still coded to use static data from the `assets` folder you set up earlier in the tutorial series. Let's change that and start fetching the data from Shoutem Cloud Storage using the `@shoutem/redux-io` package.\n"
  },
  {
    "path": "docs/extensions/my-first-extension/_posts/1970-01-07-WorkingWithData.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/my-first-extension/working-with-data\ntitle: Working with Data\nsection: My first extension\n---\n\n# Working with Data\n\nLet's fetch data from the Shoutem Cloud storage to the extension. First, remove the `app/assets` folder, we don't need it anymore. Also remove the `getRestaurants()` function from `List.js`.\n\n```JavaScript{2-4}\n//remove this:\ngetRestaurants() {\n  return require('../assets/restaurants.json');\n}\n```\n\nNow create a `reducer.js` file in the `app` folder.\n\n```ShellSession\n$ cd app\n$ touch reducer.js\n```\n\nThis file will contain a `reducer` defining the initial app state and how the state changes.\n\nOur [@shoutem/redux-io](https://github.com/shoutem/redux-io) package has `reducers` and `actions` that communicate with the Shoutem CMS. The `storage` reducer retrieves data (eg. restaurants) into a dictionary, while `collection` stores data ID's in an array to persist its order.\n\n```javascript{1-9}\n#file: app/reducer.js\nimport { storage, collection } from '@shoutem/redux-io';\nimport { combineReducers } from 'redux';\nimport { ext } from './const';\n\n// combine reducers into one root reducer\nexport default combineReducers({\n  restaurants: storage(ext('Restaurants')),\n  allRestaurants: collection(ext('Restaurants'), 'all')\n});\n```\n\nWe've used the `ext` function to get the full schema name (`{{ site.example.devName }}.restaurants.Restaurants`). The root reducer needs to be exported from `app/index.js` as `reducer`, so your app can find it:\n\n```javascript{4,11}\n#file: app/index.js\n// Reference for app/index.js can be found here:\n// http://shoutem.github.io/docs/extensions/reference/extension-exports\n\nimport reducer from './reducer';\nimport * as extension from './extension.js';\n\nexport const screens = extension.screens;\n\nexport const themes = extension.themes;\n\nexport { reducer };\n```\n\nFind more information about extension parts [here]({{ site.url }}/docs/extensions/reference/extension-exports).\n\nWe will fetch restaurants from **Shoutem Cloud Storage** in the `List` screen with the `find` action creator. Also, we'll use three helper functions from our `@shoutem/redux-io` package:\n\n```javascript{1-6}\n#file: app/screens/List.js\nimport {\n  find,\n  isBusy,\n  shouldRefresh,\n  getCollection\n} from '@shoutem/redux-io';\n```\n\n - `isBusy` - data is being fetched,\n - `shouldRefresh` - should data be (re)fetched,\n - `getCollection` - merges `storage` dictionary and `collection` ID array into an `array` of objects.\n\nThe complete code is for `app/screens/List.js` is available below.\n\nFetch data in the `componentDidMount` lifecycle method.\n\n```javascript{2-10}\n#file: app/screens/List.js\nexport class List extends PureComponent {\n  componentDidMount() {\n    const { find, restaurants } = this.props;\n\n    if (shouldRefresh(restaurants)) {\n      find(ext('Restaurants'), 'all', {\n          include: 'image',\n      })\n    }\n  }\n  ...\n}\n```\n\nImplement rendering with fetched data.\n\n```JSX{2,8-9}\n#file: app/screens/List.js\nrender() {\n  const { restaurants } = this.props;\n\n  return (\n    <Screen>\n      <NavigationBar title=\"RESTAURANTS\" />\n      <ListView\n        data={restaurants}\n        loading={isBusy(restaurants)}\n        renderRow={restaurant => this.renderRow(restaurant)}\n      />\n    </Screen>\n  );\n}\n```\n\nOnce fetched, restaurants will go into the app state. Convert them to an array with `getCollection` and then connect `find` to redux store.\n\n```javascript{2-6}\n#file: app/screens/List.js\nexport default connect(\n  (state) => ({\n    // get an array of restaurants from allRestaurants collection\n    restaurants: getCollection(state[ext()].allRestaurants, state)\n  }),\n  { navigateTo, find }\n)(List);\n```\n\nThis is the final result of `List` screen:\n\n```JSX\n#file: app/screens/List.js\nimport React, { PureComponent } from 'react';\nimport { TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\n\nimport { navigateTo, NavigationBar } from 'shoutem.navigation';\n\nimport {\n  find,\n  isBusy,\n  shouldRefresh,\n  getCollection\n} from '@shoutem/redux-io';\nimport {\n  ImageBackground,\n  ListView,\n  Tile,\n  Title,\n  Subtitle,\n  Overlay,\n  Screen\n} from '@shoutem/ui';\n\nimport { ext } from '../const';\n\nexport class List extends PureComponent {\n  constructor(props) {\n    super(props);\n\n    // bind renderRow function to get the correct props\n    this.renderRow = this.renderRow.bind(this);\n  }\n\n  componentDidMount() {\n    const { find, restaurants } = this.props;\n\n    if (shouldRefresh(restaurants)) {\n      find(ext('Restaurants'), 'all', {\n          include: 'image',\n      })\n    }\n  }\n\n  // defines the UI of each row in the list\n  renderRow(restaurant) {\n    const { navigateTo } = this.props;\n\n    return (\n      <TouchableOpacity onPress={() => navigateTo({\n        screen: ext('Details'),\n        props: { restaurant }\n      })}>\n        <ImageBackground styleName=\"large-banner\" source={% raw %}{{ uri: restaurant.image &&\n        restaurant.image.url ? restaurant.image.url : undefined }}{% endraw %}>\n          <Tile>\n            <Title>{restaurant.name}</Title>\n            <Subtitle>{restaurant.address}</Subtitle>\n          </Tile>\n        </ImageBackground>\n      </TouchableOpacity>\n    );\n  }\n\n  render() {\n    const { restaurants } = this.props;\n\n    return (\n      <Screen>\n        <NavigationBar title=\"RESTAURANTS\" />\n        <ListView\n          data={restaurants}\n          loading={isBusy(restaurants)}\n          renderRow={restaurant => this.renderRow(restaurant)}\n        />\n      </Screen>\n    );\n  }\n}\n\n// connect screen to redux store\nexport default connect(\n  (state) => ({\n    // get an array of restaurants from allRestaurants collection\n    restaurants: getCollection(state[ext()].allRestaurants, state)\n  }),\n  { navigateTo, find }\n)(List);\n```\n\n>#### Note\n>Make sure you remove the `default` from `export default class List extends Component` and only have `default` in `export default connect`, because there can only be one default export.\n\nLet's check how it works:\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/working-with-data.png'/>\n</p>\n\nWorks like a charm! You just made your first extension using the **Shoutem UI Toolkit** and **Shoutem Cloud Storage**. Great job!\n"
  },
  {
    "path": "docs/extensions/my-first-extension/_posts/1970-01-08-Publish.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/my-first-extension/publish\ntitle: Publish your extension and app\nsection: My first extension\n---\n\n# Publish Your Extension and App!\n\nOnce you're satisfied with your extension, you can publish it. Publishing an extension freezes that version, so no changes can be made to that version, only to the new versions. At the moment, every extension that you publish to the market is only visible to you.\n\nTo publish an app to Google Play and App Store, every extension in the app needs to be published. So, let's publish our extension!\n\n```ShellSession\n$ shoutem publish\nPublishing `Restaurants` extension to Shoutem...\nVersion `0.0.1` of `Restaurants` extensions was published!\n```\n\nPublish your app now to the stores. You can let Shoutem publish it for you to both stores (premium feature) or publish it manually following [our tutorial]({{ site.url }}/docs/extensions/tutorials/publish-your-app). Shoutem has developed an easy and intuitive process of app publishing. Simply insert information at one place and Shoutem will take care of the rest.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/setting-local-environment/settings.png'/>\n</p>\n\n## Using the app dashboard!\n\nOnce the app hits the stores, the dashboard really starts to shine. You can manage your mobile app and resubmit the changes over the wire. You can even grant your clients access to the dashboard, so they can manage the app for themselves.\n\nTo send push notifications, navigate to the _Push_ tab in the Builder and customize the push notification you want to send.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/push-notification.png'/>\n</p>\n\nTracking what users are doing within your app is also in the palm of your hand with our _Stats_ tab.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/my-first-extension/analytics.png'/>\n</p>\n\n## What's next?\n\nGet to work making gorgeous native apps!\n\nCheck out these resources:\n- Read the [technical overview]({{ site.url }}/docs/extensions/tutorials/architecture-and-best-practises) for Shoutem extensions\n- Build beautiful apps with the Shoutem [UI toolkit]({{ site.url }}/docs/ui-toolkit/introduction)!\n- Use our [React Native school]({{ site.shoutem.school }}) to learn more, it has lectures for everyone!\n\nHappy coding!\n"
  },
  {
    "path": "docs/extensions/reference/_posts/1970-01-01-ExtensionFile.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/reference/extension\ntitle: Extension file format\nsection: Reference\n---\n\n# Extension file format\n\nThe main file that describes every extension is `extension.json`, which is located in the root folder of the extension.\n\n## Structure of extension.json\n\nFollowing structure shows only `root` fields of the extension.json. Detailed description about each of those fields is below.\n\n```json\n{\n  // required\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"platform\": \"1.0.*\",\n\n  // recommended\n  \"title\": \"Restaurants\",\n  \"description\": \"List restaurants in your app\",\n  \"website\": \"https://www.shoutem.com/restaurants\",\n  \"icon\": \"server/assets/extension/icon.png\",\n\n  // optional\n  \"settingsPages\": [{...}],\n  \"settings\": {...},\n\n  // optional exports (extension parts)\n  \"shortcuts\": [{...}],\n  \"screens\": [{...}],\n  \"dataSchemas\": [{...}],\n  \"pages\": [{...}],\n  \"themes\": [{...}],\n  \"themeVariables\": [{...}]\n}\n```\n\n## Defining and referencing extension parts\n\nAs you see in _Structure of extension.json_ chapter, extension exports multiple extension parts (shortcuts, screens, dataSchemas, pages, themes, themeVariables). In order to be able to use these extension parts, we need to define them, so we can later reference them in other parts. Defining is done in `name` field which value needs to be unique for that extension part (name `List` can be only used for 1 shortcut, but also for 1 screen, etc.).\n\nOn the other hand, when referencing extension parts, fully qualified name needs to be used. Fully qualified name of **extension** is done by prefixing `<developer-name>.` to `name` field (for `restaurants` extension developed by `shoutem`, extension would have unique identifier `shoutem.restaurants`). Fully qualified name of **extension parts** is done by suffixing `<developer-name>.<extension-name>.` with the unique identifier for that extension part, e.g. `shoutem.restaurants.List` for shortcut. If you're referencing the extension part from within the same extension, use `@.` instead of `<developer-name>.<extension-name>.` (e.g. `@.List`).\n\n\n## Fields\n\nHere you can find field explanations in the same order fields appeared in the upper example:\n\n#### name\n\nRequired field. Defines extension's identity. Must be unique among your extensions and not longer than 32 characters.\n\n#### version\n\nRequired field. Version of your extension.\n\n#### platform\n\nRequired field. Version of [Shoutem platform]({{ site.url }}/docs/extensions/reference/platform), which defines versions of React, React Native, Redux and some other packages.\n\n#### title\n\nTitle of your extension.\n\n#### description\n\nDescription of your extension.\n\n#### website\n\nWebsite that promotes your extension.\n\n#### icon\n\nPath to extension's icon that will be present in Shoutem Extension Market. Store the icon in `server` asset's folder, as it will be used on Shoutem's server side.\n\n#### settingsPages\n\nArray of [extension settings pages]({{ site.url }}/docs/extensions/reference/settings-types) used to manage the global settings of the extension.\n\n```json\n[{\n  // required\n  \"page\": \"@.Settings\",\n\n  // recommended\n  \"title\": \"Settings\",\n\n  // optional\n  \"parameters\": {\n    \"any-parameter\": \"any-value\"  \n  }\n}]\n```\n\nEach object in settings pages array, settings page object, consist of these fields:\n\n- `page`: Required field, references the extension page\n- `title`: Title of extension page\n- `parameters`: Dictionary of arbitrary key/value pairs that will be passed to extension settings page\n\n#### settings\n\nDictionary of arbitrary key/value pairs that represent **default** extensions's settings passed to settings pages objects.\n\n```json\n{\n  \"any-parameter\": \"any-value\"  \n}\n```\n\n#### shortcuts\n\n[Shortcuts]({{ site.url }}/docs/extensions/my-first-extension/shortcut-and-screen) are links to the starting screen of your extension. Format:\n\n```json\n[{\n  // required\n  \"name\": \"List\",\n\n  // required (pick one)\n  \"screen\": \"@.List\",\n  \"action\": \"@.visitRestaurants\"\n\n  // recommended\n  \"title\": \"Restaurants\",\n  \"description\": \"Allow users...\",\n  \"icon\": \"server/assets/shortcuts/restaurants-list.png\",\n\n  // optional\n  \"type\": \"navigation\",\n  \"adminPages\": [{\n    // required\n    \"page\": \"@.CmsPage\",\n\n    // recommended\n    \"title\": \"Content\",\n\n    // optional\n    \"parameters\": {\n      \"schema\": \"@.Restaurants\"\n    },\n  }],\n  \"settings\": {\n    \"any-parameter\": \"any-value\"\n  }\n}]\n```\n\nEach object in shortcuts array, shortcut object, consists of these fields:\n\n- `name`: Required field, defines shortcut's identity\n- `screen/action`: Shortcut can either open a `Screen` or call an `Action` (see example in [Shoutem Auth](https://github.com/shoutem/extensions/blob/master/shoutem-auth/extension.json) extension)\n- `title`: Shortcut's title\n- `description`: Shortcut's description\n- `icon`: Path to shortcut's icon that will be shown in builder. Store in `server` asset's folder\n- `type`: Indicates the type of shortcut. It can be `navigation` or `undefined`. If `navigation`, it will be possible to nest other shortcuts below the current\n- `adminPages`: Array of shortcut's admin pages. Admin page object inside of array consists of:\n  - `page`: Required field, references a [settings page]({{ site.url }}/docs/extensions/tutorials/settings-pages-introduction)\n  - `title`: Title of admin page\n  - `parameters` Dictionary of arbitrary key/value pairs that will be passed to admin page instance\n- `settings`: Dictionary of arbitrary key/value pairs that represent default Shortcut's settings passed to admin pages\n\n\n#### screens\n\nScreens are nothing more than React components which represent full mobile screen. Format:\n\n```json\n[{\n  // required\n  \"name\": \"List\",\n\n  // recommended\n  \"title\": \"List\",\n  \"image\": \"server/assets/screens/restaurants-list.png\",\n\n  // optional\n  \"navigatesTo\": [{\n    \"details\": \"@.Details\"\n  }],\n  \"settingsPage\": {\n    // required\n    \"page\": \"@.List\",\n\n    // optional\n    \"parameters\": {\n      \"any-parameter\": \"any-value\"  \n    }\n  },\n  \"settings\": {\n    \"any-parameter\": \"any-value\"\n  }\n}, {\n  \"name\": \"Grid\",\n  \"title\": \"Grid\",\n  \"image\": \"server/assets/screens/restaurants-grid.png\",\n  \"extends\": \"@.List\",\n  \"settingsPage\": {\n    \"page\": \"@.List\",\n    \"parameters\": {\n      \"any-parameter\": \"any-value\"  \n    }\n  },\n}]\n```\n\nEach object in screens array, screen object, consists of these fields:\n\n- `name`: Required field, defines screen's identity\n- `title`: Screen's title that will be shown in [layout selector]({{ site.url }}/docs/extensions/tutorials/screen-layouts)\n- `image`: Path to screen's image that shows it's layout\n- `navigatesTo`: Array of key/value pairs that indicates to which screens the current one can navigate to\n- `settingsPage`: Screen's settings page. Object consists of:\n  - `page`: Required field, references an [settings page]({{ site.url }}/docs/extensions/tutorials/settings-pages-introduction)\n  - `parameters`: Dictionary of arbitrary key/value pairs that will be passed to settings page instance\n- `settings`: Dictionary of arbitrary key/value pairs that represent default Shortcut's settings passed to admin pages\n- `extends`: References screen that the current one is extending\n\nIn the example above, we included 2 screen objects inside of the `screens` array. We wanted to show you the usage of `extends` field. Extending makes it possible to [switch between multiple screen layouts]({{ site.url }}/docs/extensions/tutorials/screen-layouts).\n\n\n#### dataSchemas\n\n[Data Schemas]({{ site.url }}/docs/extensions/my-first-extension/using-cloud-storage) are Shoutem-flavored [JSON Schemas](http://json-schema.org/) which describe data stored on Shoutem's CMS.\n\n```json\n[{\n  // required\n  \"name\": \"Restaurants\",\n  \"path\": \"server/data-schemas/restaurants.json\"\n}]\n```\n\nEach object in data schemas array, data schema object, consists of these fields:\n\n- `name`: Required field, defines data schema's identity\n- `path`: Required field, path to actual schema implementation. Should be stored in `server` folder\n\n\n#### pages\n\n[Settings pages]({{ site.url }}/docs/extensions/reference/settings-types) are web pages written by extension developers. They can be used to manage 3 different types of settings:\n\n- global settings of the extensions (referenced from `settingsPages` in the root of extension.json)\n- settings of the shortcut instance (referenced from `adminPages` in the shortcut object)\n- settings of the screen (referenced from `settingsPage` in the screen object)\n\n```json\n[{\n  // required\n  \"name\": \"List\",\n  \"type\": \"html\",\n  \"path\": \"server/assets/pages/tab-bar/index.html\"\n}],\n```\n\nEach object in pages array, extensions page object, consists of these fields:\n\n- `name`: Required field, defines extension page's identity\n- `type`: Required field, defines type of an extension. Only `html` available for now\n- `path`: Required field, path to actual extension page implementation. Should be stored in `server` folder\n\n\n#### themes\n\n[Themes]({{ site.url }}/docs/extensions/tutorials/writing-a-theme) represent files where you can provide set of styles for your UI components.\n\n```json\n[{\n  // required\n  \"name\": \"Rubicon\",\n\n  // recommended\n  \"title\": \"Rubicon\",\n  \"description\": \"Rubicon is a beautiful template built...\",\n  \"showcase\": [\"server/assets/theme/rubicon.mp4\",\"server/assets/theme/rubicon1.jpg\", \"server/assets/theme/rubicon2.jpg\", \"server/assets/theme/rubicon3.jpg\"],\n\n  // optional\n  \"icons\": \"app/themes/Rubicon/assets/icons/\",\n  \"themeVariables\": \"@.Rubicon\"\n}]\n```\n\nEach object in themes array, theme object, consists of these fields:\n\n- `name`: Required field, defines theme's identity\n- `title`: Theme's title\n- `description:` Theme's description\n- `showcase`: Array of strings which represent paths to multimedia files in `server` folder, such as videos and images, which present your theme. Dimensions for @2x quality resolution are 750 × 1334.\n- `icons`: Path to icons of theme, should be stored in `app` asset's folder\n- `variables`: Reference to variables used by theme\n\n#### themeVariables\n\nTheme variables are used to define the structure of the variables used by theme. These variables can be used to customize the theme.\n\n```json\n[{\n  // required\n  \"name\": \"Rubicon\",\n  \"path\": \"server/themes/rubiconVariables.json\"\n}]\n```\n\nEach object in theme variables array, theme variables object, consists of these fields:\n\n- `name`: Required field, defines theme variables name\n- `path`: Required field, path to actual theme variables implementation. Should be stored in `server` folder\n\n\n## Full example of extension.json\n\nFinally, here's the full example of extension.json:\n\n```json\n{\n  \"shoutem\": \"1.0\",\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n\n  \"title\": \"Restaurants\",\n  \"website\": \"https://extensions.shoutem.com/shoutem.navigation\",\n  \"description\": \"Make your users rate products.\",\n  \"icon\": \"server/assets/extension/icon.png\",\n  \"defaultLocale\": \"en\",\n  \"settingsPages\": [{\n    \"page\": \"@.settings\",\n    \"title\": \"Settings\",\n  }],\n  \"settings\": {\n    \"any-parameter\": \"any-value\"\n  },\n\n  \"shortcuts\": [{\n    \"name\": \"List\",\n    \"title\": \"Restaurants\",\n    \"description\": \"Allow users...\",\n    \"screen\": \"@.list\",\n    \"icon\": \"theme://events.png\",\n    \"adminPages\": [{\n      \"page\": \"@.CmsPage\",\n      \"title\": \"Content\",\n      \"parameters\": {\n        \"schema\": \"@.Restaurants\"\n      },\n    }],\n    \"settings\": {\n      \"any-parameter\": \"any-value\"\n    }\n  }],\n\n  \"screens\": [{\n    \"name\": \"List\",\n    \"title\": \"List\",\n    \"image\": \"server/assets/screens/restaurants-list.png\",\n    \"navigatesTo\": [{\n      \"details\": \"@.Details\"\n    }]\n  }, {\n    \"name\": \"Grid\",\n    \"title\": \"Grid\",\n    \"image\": \"server/assets/screens/restaurants-grid.png\",\n    \"extends\": \"@.List\",\n  }, {\n    \"name\": \"Details\",\n    \"title\": \"Details\",\n  }],\n\n  \"pages\": [{\n    \"name\": \"settings\",\n    \"path\": \"server/assets/settings/settings/index.html\",\n  }],\n\n  \"dataSchemas\": [{\n    \"name\": \"Restaurants\",\n    \"path\": \"server/data-schemas/restaurants.json\"\n  }],\n\n  \"themes\": [{\n    \"name\": \"Rubicon\",\n    \"title\": \"Rubicon\",\n    \"variables\": \"@.Rubicon\",\n    \"description\": \"Rubicon is a beautiful template built...\",\n    \"showcase\": [\"server/assets/theme/rubicon.mp4\",\"server/assets/theme/rubicon1.jpg\", \"server/assets/theme/rubicon2.jpg\", \"server/assets/theme/rubicon3.jpg\"],\n    \"icons\": \"app/themes/Rubicon/assets/icons/\"\n  }, {\n    \"name\": \"Arno\",\n    \"title\": \"Arno\",\n    \"variables\": \"@.Rubicon\",\n    \"description\": \"Arno is a beautiful template built...\",\n    \"showcase\": [\"server/assets/theme/arno1.jpg\", \"server/assets/theme/arno2.jpg\"],\n    \"icons\": \"app/themes/Arno/assets/icons/\"\n  }],\n\n  \"themeVariables\": [{\n    \"name\": \"Rubicon\",\n    \"path\": \"server/themes/rubiconVariables.json\"\n  }]\n}\n```\n"
  },
  {
    "path": "docs/extensions/reference/_posts/1970-01-01-Overview.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/reference/overview\ntitle: Technical overview\nsection: Extensions\n---\n\n# Technical overview of Shoutem Extensions\n\nThis document explains the overall architecture of Shoutem extensions in more details.\n\n## What is an extension?\n\nEach Shoutem extension represents a complete, self-contained functionality, e.g. an integration with a third party e-commerce provider. This extension would define multiple screens that will be available in the mobile app, any custom logic for purchasing products, and web pages that allow app owners to configure this integration through the Shoutem Builder.\n\n## Extension segments\n\nTo accomplish that, we divided extension into two main segments: `app`, and `server`. The `app` segment contains everything that will be bundled within the RN mobile app: this can be anything from simple RN screens to complete native modules implemented [using platform specific native technologies]({{ site.url }}/docs/extensions/tutorials/using-native-api). The `server` segment contains web pages that will be hosted within the Shoutem builder, and allow users to configure and manage extensions while creating their apps.\n\nBesides those two segments, extensions also have an `extension.json`, file that contains extension metadata. It is used by our server to discover the functionalities that will become available to users in the Shoutem builder after the extension is installed.\n\n## Naming\n\nEach extension has a canonical name (full name) that consists of two sections separated by a single dot. The first section represents a developer name, and the second one represents the name of the extension itself. For example `shoutem.news`. This allows us to avoid collisions between the components provided by different extensions. Each component exported from the extension has a canonical name as well. The canonical name of a component always has an extension canonical name as a prefix, e.g., `shoutem.news.ArticleDetailsScreen`.\n\n## Mobile app segment\n\nThe `app` segment of the extension is an **npm package** that will be hosted within the Shoutem mobile app. Our mobile app represents an environment in which all extensions are executed, and it provides certain dependencies out of the box. The extension environment is called the [platform]({{ site.url }}/docs/extensions/reference/platform) (`@shoutem/platform`), and each extension must define a range of platform versions in its `extension.json` that it's compatible with. The platform defines certain global dependencies like the version of React, React Native, Redux, Shoutem UI, etc. More information about dependencies provided by the platform can be found in `package.json` in the [platform repository](https://github.com/shoutem/platform).\n\nOur app architecture is completely modular. At the center of everything is only a simple **extension loader** that discovers, loads, and initializes all extensions installed in the app. Everything else is implemented through extensions. Even the core Shoutem functionalities (e.g. navigation, push notifications, analytics, ...) are implemented as regular extensions no different from any other third party extension.\n\nSome of our extensions are `system` ones. They're hidden from our non technical app owners (who don't have a developer account registered). Only `shoutem` developer can create `system` extensions.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/references/platform/system-extensions.png'/>\n</p>\n\n##### Extension lifecycle\n\nWhen the app is started, we simply load all extensions and run their lifecycle. At that point, [shoutem.application](https://github.com/shoutem/extensions/tree/master/shoutem-application) system extension navigates to the initial screen of the app, and all other user interaction starts from there.\n\nThe primary interface between extension and the rest of the app, **extension's public API**, is defined by exports in its `app/index.js`.\n\n<br />\n<b>Predefined extension exports</b>\n\nThere are several predefined exports that are used by other parts of the system:\n\n- **lifecycle methods** - methods that extensions can implement to be notified when the entire app is mounted or unmounted. This can be useful to initialize the extension or clean up when the app is closing. Each of those methods receives an `app` parameter that represents the current **app instance**. Each of those methods may also return a promise. If a promise is returned, the next lifecycle method of any extension will not be called until that (any every other) promise is resolved. This is the list of lifecycle methods in order of their invocation:\n    - **appWillMount** - invoked immediately before the mounting of the root app component occurs.\n    - **appDidMount** - invoked after the root app component is mounted and after all promises from a previous lifecycle method are resolved.\n    - **appDidFinishLaunching** - invoked after the app is mounted and after all promises from `appDidMount` have finished. This is the place to perform any final work before the first screen is rendered.\n    - **appWillUnmount** - invoked immediately before the root app component is unmounted and destroyed. Perform any necessary cleanup in this method.\n- **screens** - the screens that will be available for navigation. Must have the same name as in `extension.json`\n- **actions** - actions that can be attached to shortcuts (see [shoutem.auth](https://github.com/shoutem/extensions/tree/master/shoutem-auth) extension). Must have the same name as in `extension.json`\n- **reducer** - the extension reducer that will be mounted under the extension namespace in the state\n- **middleware** - Redux `middleware` to register in the Redux `store`\n- **enhancers** - Redux `enhancers` to register in the Redux `store`\n\n<br />\n<b>Other exports</b>\n\nBesides the exports mentioned above, in `app/index.js` you may also export anything else you want to expose to other extensions. All extensions are installed as node modules, so importing from other extensions is done by simply importing from a package with the canonical name of the extension. For example, you can import the `getExtensionSettings` selector from the [shoutem.application](https://github.com/shoutem/extensions/tree/master/shoutem-application) extension like this:\n```\nimport { getExtensionSettings } from 'shoutem.application';\n```\n\n##### Communication between extensions\n\nThe app initializes the Redux `store` before loading the extensions. Redux is used for state management, and to facilitate easier **communication** between the extensions. Communication between extensions can be accomplished in a few ways:\n\n- reading from the state of other extensions\n- dispatching `actions` from other extensions\n- intercepting actions by using redux `middleware`\n- directly importing public classes, functions, etc. from other extensions\n\nThe preferred way to read the data from the state is to export redux `selectors`, so that extensions don't directly depend on the internal state organization of other extensions.\n\n<br />\n<b>App state</b>\n\nTo simplify state management, the entire state of the app is divided into extension `namespaces`:\n\n```\n{\n    'shoutem.application': {\n        // state of the \"application\" extension made by shoutem\n    },\n    '{{ site.example.devName }}.restaurants': {\n        // state of the restaurants extension made by a third party developer {{ site.example.devName }}\n    },\n    ...\n}\n```\n\nEach extension namespace is completely managed by the extension through the (root) reducer exported from its `app/index.js`.\n\n##### Modifying extensions\n\nAll our extensions are [open sourced](https://github.com/shoutem/extensions), so you can modify anything you want by simply forking them. Although this is probably the easiest way to modify extensions, it may not always be the best way to do it. If you fork an extension, you have to make sure to maintain it yourself. In other words, you lose automatic updates and bugfixes implemented by the extension owner.\n\nA better approach may be to perform minimal changes to the extension by creating a new extension. This can be accomplished in several ways:\n\n- modifying styling by [creating a new theme]({{ site.url }}/docs/extensions/tutorials/writing-a-theme)\n- creating completely new [screen layouts]({{ site.url }}/docs/extensions/tutorials/screen-layouts)\n- creating new screen layouts by [extending existing screens and overriding certain methods]({{ site.url }}/docs/extensions/tutorials/modifying-extensions)\n- reading data from the state of other extensions\n- intercepting actions from other extensions by registering a redux `middleware`. With this approach you can modify, suppress, or just examine any action dispatched in the app.\n\nRead more in [Modifying extensions]({{ site.url }}/docs/extensions/tutorials/modifying-extensions) tutorial.\n\n<br />\n\n## Server segment\n\nServer segment is used for customizing 3 server sides of extensions:\n\n- Settings pages\n- Data schemas\n- Theme variables\n\n**Settings pages** that are used to configure the extension through the Shoutem builder. Those pages can be implemented in several ways. They can be a standalone web site implemented using a web framework of your choice. With this approach you have complete freedom to do whatever you want. Pages like that are always be hosted within an iframe in the Shoutem builder. Another way to implement those pages is to use React components. This approach to settings pages is still in development, but it will become a preferred way to implement settings pages. Learn more on how to create [settings pages]({{ site.url }}/docs/extensions/tutorials/settings-pages-introduction).\n\n**Data schemas** allow you to define a data type to be stored on the Shoutem backend using a standard JSON Schema format. When a app owner installs your extension in the Shoutem builder, all schemas defined within it and connected with **content settings page**. become available through web interface. The app owner is able to manually enter data in the Shoutem builder, or import data to the cloud storage from various supported sources. The web interface for data management is created automatically based on the JSON Schema from your extensions. Learn more on how to use [Shoutem Cloud]({{ site.url }}/docs/cloud/introduction)\n\n**Theme variables** schema is used for themes. It also uses the JSON Schema standard to define the theme variables that can be customized by app owners through the Shoutem builder. Using those variables, owners are able to customize themes by changing colors, fonts, sizes, etc. Web interface for customizing theme variables is automatically created in the Shoutem builder based on the theme variables schema when theme from your extension is activated in the app. Learn more about creating [theme variables]({{ site.url }}/docs/extensions/reference/theme-variables).\n"
  },
  {
    "path": "docs/extensions/reference/_posts/1970-01-02-Platform.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/reference/platform\ntitle: Platform\nsection: Reference\n---\n\n# Platform\n<hr />\n\nShoutem platform defines an environment in which extensions are executed. This environment defines versions of React, React Native and other packages available to your extension by default.\n\nUpon initializing your extension with `shoutem init` command, CLI defines those packages as peer dependencies in your `app/package.json` file. They are available to all extensions without needing to install them, but their version is managed by the platform. That's why all the packages have `*` as the version.\n\nHere's an example of what `app/package.json` might look like after initialization:\n\n```JSON\n#file: app/package.json\n{\n  \"name\": \"{{ site.example.devName }}.restaurants\",\n  \"version\": \"0.0.1\",\n  \"description\": \"List of restaurants!\",\n  \"peerDependencies\": {\n    \"@shoutem/animation\": \"*\",\n    \"@shoutem/core\": \"*\",\n    \"@shoutem/redux-composers\": \"*\",\n    \"@shoutem/redux-io\": \"*\",\n    \"@shoutem/theme\": \"*\",\n    \"@shoutem/ui\": \"*\",\n    \"@shoutem/ui-addons\": \"*\",\n    \"lodash\": \"*\",\n    \"moment\": \"*\",\n    \"whatwg-fetch\": \"*\",\n    \"react\": \"*\",\n    \"react-native\": \"*\",\n    \"react-native-browser-polyfill\": \"*\",\n    \"react-redux\": \"*\",\n    \"redux\": \"*\",\n    \"redux-action-buffer\": \"*\",\n    \"redux-persist\": \"*\",\n    \"redux-api-middleware\": \"*\",\n    \"redux-logger\": \"*\",\n    \"redux-thunk\": \"*\"\n  }\n}\n```\n\n> #### Note\n> File package.json always includes developer name alongside with the extension name, while the `name` in extension.json doesn't include the developer name.\n\nThe specific versions of current platform can be found in the `package.json` file in [platform repository]({{ site.url }}/docs/extensions/reference/platform). Versions included in previous platforms can be browsed in the `git` history."
  },
  {
    "path": "docs/extensions/reference/_posts/1970-01-03-ExtensionExports.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/reference/extension-exports\ntitle: Extension exports\nsection: Reference\n---\n\n# Extension exports\n\nEach extension can export multiple values in:\n\n- app/index.js - used by an app and other extensions\n- server/index.js - used by Shoutem Builder\n\n## _app/index.js_\n\nThe `app` folder is npm package that represents segment of extension bundled in the app. The `app/index.js` file is what is accessible from the current extension to the app and other extensions. Since `app` expects some exported parts (e.g.) there are some predefined extension exports. Here only those will be listed, but you can read more about the whole architecture in [Technical overview]({{ site.url }}/docs/extensions/reference/overview).\n\nThese are the predefined extension exports:\n\n- **lifecycle methods** - methods that extensions can implement to be notified when the entire app is mounted or unmounted. This can be useful to initialize the extension or clean up when the app is closing. Each of those methods receives an `app` parameter that represents the current **app instance**. Each of those methods may also return a promise. If a promise is returned, the next lifecycle method of any extension will not be called until that (any every other) promise is resolved. This is the list of lifecycle methods in order of their invocation:\n    - **appWillMount** - invoked immediately before the mounting of the root app component occurs.\n    - **appDidMount** - invoked after the root app component is mounted and after all promises from a previous lifecycle method are resolved.\n    - **appDidFinishLaunching** - invoked after the app is mounted and after all promises from `appDidMount` have finished. This is the place to perform any final work before the first screen is rendered.\n    - **appWillUnmount** - invoked immediately before the root app component is unmounted and destroyed. Perform any necessary cleanup in this method.\n- **screens** - the screens that will be available for navigation. Must have the same name as in `extension.json`\n- **themes** - themes available for app customization. Must have the same name as in `extension.json`\n- **actions** - actions that can be attached to shortcuts (see [shoutem.auth](https://github.com/shoutem/extensions/tree/master/shoutem-auth) extension). Must have the same name as in `extension.json`\n- **reducer** - the extension reducer that will be mounted under the extension namespace in the state\n- **middleware** - Redux `middleware` to register in the Redux `store`\n- **enhancers** - Redux `enhancers` to register in the Redux `store`\n\n<br />\n\n## _server/index.js_\n\nSame as for `app` the `server` folder is npm package that represents segment of extension in Shoutem Builder. The `server/index.js` file is what is accessible from the current extension to the Shoutem Builder.\n\nThese are the predefined extension exports:\n\n- **lifecycle methods** - methods that extensions can implement to be notified when the entire extension is mounted in Shoutem Builder. This can be useful to initialize the extension. Each of those methods receives an `page` parameter that represents the current **page instance**. Page instance contains methods `getPageContext` and `getPageParameters`. This is the list of lifecycle methods in order of their invocation (we plan to support more methods):\n    - **pageWillMount** - invoked immediately before the mounting of the root page component occurs.   \n- **pages** - the settings pages that will be available for Shoutem Builder. Must have the same name as in `extension.json`\n- **reducer** - the extension reducer that will be mounted under the extension namespace in the state\n"
  },
  {
    "path": "docs/extensions/reference/_posts/1970-01-04-SettingsTypesInExtension.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/reference/settings-types\ntitle: Settings types in extension\nsection: Reference\n---\n\n# Settings types in extension\n\nEach extension has 3 different types of settings. App owners manage these settings in _Settings pages_ to customize the functionality of the behaviour of an extension in the app.\n\n##### Extension concepts\n\nBefore we dive into settings types, let’s refresh our memory on extension concepts:\n\n- Each extension can have multiple versions, but only one can be installed at a time - that's what we refer to as an `extension installation`.\n- An extension can expose multiple shortcuts, and each of them can be added more than once to the app, called `shortcut instances`.\n- Each shortcut instance opens a starting screen, which can then open the next screen, and so on.\n- Each screen can have multiple representations, called `screen layouts`.\n\n##### Settings pages\n\nSettings pages are web pages written by extension developers, and they appear in Shoutem builder. Their purpose is to enable app owners extension customizations through settings. Check the [tutorial on how to create a settings page]({{ site.url }}/docs/extensions/tutorials/settings-pages-introduction) for more info. Settings pages are exported via the `pages` field in `extension.json` and can be used on 3 different places which determine settings type.\n\n##### Settings types\n\n- `Extension settings` - Single global settings for the extension installation, placed in `settingsPages` in the root of `extension.json`\n- `Shortcut settings` - Shortcut instance settings, placed in `adminPages` in the shortcut object\n- `Screen settings` - Settings of the layout presented by the screen, placed in `settingsPage` in the screen object.\n\n##### Default settings\n\nEach settings can have its default value. The default value is defined in `settings` field, which is adjacent to `settingsPage(s)` or `adminPages` fields, for every settings type.\n\nApplying default settings is determined by settings type:\n- default `extension settings` are applied when installing extension into the app\n- default `shortcut settings` are defined when adding a shortcut (screen) into the app structure\n- default `screen settings` are defined when adding a shortcut (screen) into the app structure\n\nUpdating the default settings in `extension.json` **will not** update the default settings in that extension part if those were aready applied. For instance, if you already added shortcut instance (created from some shortcut), default settings of that shortcut won't be updated if you update them in `extension.json` and push the new version to Shoutem. However, if you add another shortcut instance, that instance will have the latest default settings from `extension.json`.\n\n##### Manipulation of settings\n\nSettings can be manipulated using the [@shoutem/api-sdk]({{ site.url }}/docs/coming-soon) package. See [Writting settings pages]({{ site.url }}/docs/extensions/tutorials/settings-pages-introduction) tutorial on how to do that.\n\n> #### Note\n> The below documentation is outdated and will be updated once `api-sdk` tool is finished. This is in progress.\n\n## Extension settings\n\nExtension settings are global settings shared throughout all extension parts within an extension installation.\n\n##### Place\n\n```JSON{6-21}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"title\": \"Restaurants\",\n  \"description\": \"List of restaurants\",\n  \"platform\": \"1.0.*\",\n  \"settingsPages\": [{\n    \"page\": \"@.General\",\n    \"title\": \"General settings\",\n  }, {\n    \"page\": \"@.Sounds\",\n    \"title\": \"Sounds\"\n  }],\n  \"settings\": {\n    \"website\": \"www.example.com\",\n    \"onRowTapSound\": false\n  },\n  \"pages\": [{\n    \"name\": \"General\"\n  }, {\n    \"name\": \"Sounds\"\n  }]\n}\n```\n\nSettings pages meant for manipulating extension settings can be found in the `Extensions` tab for that extension. We call them `extension settings pages`.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/extension-tab-extension-restaurants-settings.png'/>\n</p>\n\n##### Server side\n\nProperties received to the root extension settings page component are:\n\n- `extension`: Extension object with fields:\n  - `name`: Extension name\n  - `version`: Extension version\n  - `title`: Extension title\n  - `settings`: Extension global settings\n\nTo set extension settings, use `setExtensionSettings` from `@shoutem/builder-sdk`. Although extension settings can be manipulated from any settings page, for maximum user experience, do it only in extension settings pages.\n\n##### Client side\n\nEach screen that is connected to the state can access extension settings. They can be found in `props`, specifically in `props.extension.settings`.\n\n## Shortcut settings\n\nShortcut settings are settings shared throughout all the screens that were navigated to from the starting screen of the shortcut instance.\n\n##### Place\n\n```JSON{10-22,28-30}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"title\": \"Restaurants\",\n  \"description\": \"List of restaurants\",\n  \"platform\": \"1.0.*\",\n  \"shortcuts\": [{\n    \"name\": \"List\",\n    \"title\": \"Restaurants\",\n    \"screen\": \"@.list\",\n    \"adminPages\": [{\n      \"page\": \"shoutem.cms.CmsPage\",\n      \"title\": \"Content\",\n      \"parameters\": {\n        \"schema\": \"@.Restaurants\"\n      },\n    }, {\n      \"page\": \"@.RestaurantsPage\",\n      \"title\": \"Settings\"\n    }],\n    \"settings\": {\n      \"headerTitle\": \"RESTAURANTS\"\n    }\n  }],\n  \"dataSchemas\": [{\n    \"name\": \"Restaurants\",\n    \"path\": \"server/schemas/Restaurants.json\"\n  }],\n  \"pages\": [{\n    \"name\": \"RestaurantsPage\"\n  }],\n}\n```\n\nSettings pages meant for manipulating shortcut settings can be found next to app structure in the `Screens` tab.  We call them `shortcut settings pages`. Namely, for this example, there should be `Content` and `Settings`.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/screens-tab-extension-restaurants-settings.png'/>\n</p>\n\n##### Server side\n\nProperties received to root shortcut settings page component are:\n\n- `extension`: Extension object with fields:\n  - `name`: Extension name\n  - `version`: Extension version\n  - `title`: Extension title\n  - `settings`: Extension global settings\n- `shortcut`: Shortcut instance object with fields:\n  - `name`: A shortcut's name\n  - `title`: A shortcut's title\n  - `settings`: A shortcut instance settings\n  - `screens`: Array of screen objects, each containing:\n    - `type`: Type of screen that has layouts (that's original screen's name)\n    - `name`: Name of the layout that will be shown\n    - `settings`: Screen settings (shared among all layouts)\n\nTo set extension settings, use `setShortcutSettings` from `@shoutem/builder-sdk`. Although shortcut settings can be manipulated from both the shortcut and the screen settings page, for maximum user experience, do it only from the shortcut settings pages.\n\n##### Client side\n\nEach screen that is connected to the state can access shortcut settings. They can be found in `props`, specifically in `props.shortcut.settings`.\n\n\n## Screen settings\n\nScreen settings are layouts settings that hold information specific for that layout. Check the [tutorial for screen layouts]({{ site.url }}/docs/extensions/tutorials/screen-layouts) to get a better understanding on difference between screen and layouts.\n\n##### Place\n\n```JSON{14-20,25-31,33-37}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"title\": \"Restaurants\",\n  \"description\": \"List of restaurants\",\n  \"platform\": \"1.0.*\",\n  \"shortcuts\": [{\n    \"name\": \"List\",\n    \"title\": \"Restaurants\",\n    \"screen\": \"@.list\"\n  }],\n  \"screens\": [{\n    \"name\": \"list\",\n    \"title\": \"List of restaurants\",\n    \"settingsPage\": {\n      \"title\": \"Settings\",\n      \"page\": \"@.ListSettings\"\n    },\n    \"settings\": {\n      \"groupByStartingLetter\": false\n    }\n  }, {\n    \"name\": \"grid\",\n    \"extends\": \"@.list\",\n    \"title\": \"Grid of restaurants\",\n    \"settingsPage\": {\n      \"title\": \"Settings\",\n      \"page\": \"@.GridSettings\"\n    },\n    \"settings\": {\n      \"gridCellsOfSameHeight\": true\n    }\n  }]\n  \"pages\": [{\n    \"name\": \"ListSettings\"\n  }, {\n    \"name\": \"GridSettings\"\n  }],\n}\n```\n\nThere's only 1 settings page per screen for manipulating screen settings. It's located in the `Layout` shortcut settings page, under the layout selector, when that screen is selected as the desired layout.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/screens-tab-extension-restaurants-layout-settings.png'/>\n</p>\n\n##### Server side\n\nProperties received to root shortcut settings page component are:\n\n- `extension`: Extension object with fields:\n  - `name`: Extension name\n  - `version`: Extension version\n  - `title`: Extension title\n  - `settings`: Extension global settings\n- `shortcut`: Shortcut instance object with fields:\n  - `name`: A shortcut's name\n  - `title`: A shortcut's title\n  - `settings`: Shortcut instance settings\n  - `screens`: Array of screen objects, each containing:\n    - `type`: Type of screen that has layouts (that's original screen's name)\n    - `name`: Name of the layout that will be shown\n    - `settings`: Screen settings (shared among all layouts)\n- `screen`: Screen object with fields:\n  - `name`: Screen's name (which is also currently active layout screen)\n  - `title`: Screen's title\n  - `settings`: Screen settings (shared among all layouts)\n\nTo set screen settings in settings page, use `setScreenSettings` from `@shoutem/builder-sdk`. Screen settings can only be manipulated in screen settings page and using these functions elsewhere will fail. Notice that `settings` inside of `screen` are in shared namespace, which means that multiple screens which act as different layouts share these settings. If keeping separate namespace per screen is important for you, you can save the settings under key of screen `name`.\n\n##### Client side\n\nEach screen connected to the state can access shortcut layouts settings. They can be found in `props`, specifically in `props.screen.settings`.\n"
  },
  {
    "path": "docs/extensions/reference/_posts/1970-01-05-ThemeVariables.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/reference/theme-variables\ntitle: Theme variables\nsection: Reference\n---\n\n# Theme variables schema reference\n\nAdjustment of theme is done through theme variables. These variables can be set through Shoutem builder, which interprets the variables schema.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/style-tab-themes-customise_theme-no_picker.png'/>\n</p>\n\n## Structure of variables schema file\n\nVariables schema file is nothing else than Shoutem flavored [JSON Schema](https://spacetelescope.github.io/understanding-json-schema/UnderstandingJSONSchema.pdf).\n\nExample:\n\n```JSON\n{\n  \"formats\": {\n    \"font\": {\n      \"title\": \"Font\",\n      \"default\": {\n        \"fontFamily\": \"Rubicon\",\n        \"fontStyle\": \"normal\",\n        \"fontWeight\": \"normal\",\n        \"fontSize\": 20,\n        \"color\": \"rgba(255,255,255,1)\"\n      },\n      \"constraints\": {\n        \"fontFamily\": {\n          \"enum\": [ \"normal\", \"Rubicon\"]\n        },\n        \"fontStyle\": {\n          \"enum\": [\"normal\", \"italic\"]\n        },\n        \"fontWeight\": {\n          \"enum\": [\"normal\", \"bold\", \"100\", \"200\", \"300\", \"400\", \"500\", \"600\", \"700\", \"800\", \"900\"]\n        },\n        \"fontSize\": {\n          \"minimum\": 12,\n          \"maximum\": 42\n        }\n      }\n    }\n  },\n  \"properties\": {\n    \"primaryColor\": {\n      \"type\": \"string\",\n      \"format\": \"color\",\n      \"title\": \"Primary color\",\n      \"default\": \"rgba(12, 111, 34, 0.5)\"\n    },\n    \"textFont\": {\n      \"type\": \"object\",\n      \"format\": \"font\",\n      \"title\": \"Text font\",\n      \"default\": {\n        \"fontFamily\": \"Rubicon\",\n        \"fontStyle\": \"normal\",\n        \"fontWeight\": \"regular\",\n        \"fontSize\": 15,\n        \"color\": \"rgba(255,255,255,1)\"\n      }\n    }\n  },\n  \"layout\": {\n    \"sections\": [{\n      \"title\": \"Colors\",\n      \"properties\": [\"primaryColor\"]\n    }, {\n      \"title\": \"Text\",\n      \"properties\": [\"textFont\"]\n    }]\n  }\n}\n```\n\nIt's `properties` are the variable descriptors - they describe the variable to the Shoutem builder. For now, there are only 2 types of variables:\n\n- Color - `\"type\": \"string\", \"format\": \"color\"`\n- Font - `\"type\": \"object\", \"format\": \"font\"`\n\nBased on what the type is, descriptor has different fields. However, some fields are shared:\n\n- **title**: Title of the variable on builder interface.\n- **default**: Default value of the interface control. Value depends on the type.\n- **disabled**: Whether admin can set the variable or not. Defaults to `false`.\n\nThere is also field `formats`. It is used to describe default values and constraints of specific format. \nEach variable of the same format thus _inherits_ values defined in `formats`, but can also override each field with its own value.\n\n#### Color\n\nVariable of type color will result in color picker in interface for customizing theme.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/style-tab-themes-customize_theme-color.png'/>\n</p>\n\n###### Default value\n\nString. One of the React Native supported [Color formats](https://facebook.github.io/react-native/docs/colors.html).\n\n\n###### Fields \n\nCurrently, there are no additional properties variable descriptor supports.\n\n#### Font\n\nVariable of type font will result in complex control in interface for customizing theme.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/style-tab-themes-customize_theme-font.png'/>\n</p>\n\n\n###### Default value\n\nObject with following fields:\n\n```JSON\n{\n  \"fontFamily\": \"Rubicon\",\n  \"fontStyle\": \"normal\",\n  \"fontWeight\": \"normal\",\n  \"fontSize\": 20,\n  \"color\": \"rgba(255,255,255,1)\"\n}\n```\n\n- **fontFamily** - String. One of the font families listed in `constraints.fontFamily` field. Defaults to \"Rubicon\".\n- **fontStyle** - String. One of the font styles listed in `constraints.fontSize` field. Defaults to \"normal\".\n- **fontWeight** - String. One of the font weights listed in `constraints.fontWeight` field. Defaults to \"normal\".\n- **fontSize** - Number. Defaults to 12\n- **color** - String. One of the React Native supported [Color formats](https://facebook.github.io/react-native/docs/colors.html). Defaults to `\"rgba(0,0,0,1)\"`\n\n###### Fields \n\nFont variable descriptor defines additional property `constraints`, which describes values that are available for each field: \n\n- **fontFamily**: enum of Strings. All available font families should  be listed here. Default values: `\"normal\", \"Rubicon\"`.\n- **fontStyle**: enum of Strings. All available font styles should be listed here. Default values: `\"normal\", \"italic\"`.\n- **fontWeight**: enum of Strings. All available font weights should be listed here. Default values: `\"normal\", \"bold\", \"100\", \"200\", \"300\", \"400\", \"500\", \"600\", \"700\", \"800\", \"900\"`.\n- **fontSize**: object that defines minimal and maximal font size. It has two fields of type Number: `\"minimum\"` - defaults to 12 and `\"maximum\"` - defaults to 42.\n"
  },
  {
    "path": "docs/extensions/reference/_posts/1970-01-06-CLI.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/reference/cli\ntitle: Shoutem CLI\nsection: Extensions\n---\n\n# Shoutem CLI\nShoutem Command Line Interface (CLI) is a tool that helps you build extensions. Using it, you can create extensions, generate code snippets, upload extensions to your Shoutem account and install them on your apps.\n\n## Installation\nDownload and install Shoutem CLI through `npm`, the package manager for `Node.js`.\n\n```ShellSession\n$ npm install -g @shoutem/cli\n```\n\nIf the previous command fails because of permission issues, you need to run it with `sudo` permission: `sudo npm install -g @shoutem/cli`.\n\n<br />\nIn case you don't have `npm` installed, the best way to install it is with [installing](https://nodejs.org/en/download/) `Node.js`, which includes `npm`.\n\n## Commands\n\nHere is the list of available commands with their arguments and flags. Some of the arguments and flags are not documented, which we only found useful for the Shoutem team internally (they can still be seen when using `help` commands). <br />\n\n- ##### shoutem\n\nLists all the commands.\n\n```ShellSession\n$ shoutem\nUsage: shoutem [command] [-h]\n\nCommands:\n...\n```\n\n- ##### shoutem [\\--version|-v]\n\nPrints out the CLI version.\n\n```ShellSession\n$ shoutem -v\n1.0.0\n```\n\n- ##### shoutem \\<cmd> [\\--help|-h]\n\nEvery command's description and arguments list can be invoked using -h flag.\nSo for example, the command `shoutem init -h` prints usage info for the init command and `shoutem screen add -h` prints usage info for the `shoutem screen add` command:\n\n```ShellSession\n$ shoutem init -h\n\nUsage: shoutem init <extension-name>\n\nCreate a scaffold of all files and folders required to build an extension.\n```\n\n\n- ##### shoutem login\n\nAuthenticates you as a developer. Enter your Shoutem credentials. If you're not a Shoutem user yet, sign up [here]({{ site.shoutem.builderURL }}).\n\n```ShellSession\n$ shoutem login\nEnter your Shoutem credentials (obtained at {{ site.shoutem.builderURL }}):\nE-mail: {{ site.example.devEmail }}\nPassword: ********\n```\n\nEach Shoutem user can become a Shoutem developer. If you're not a developer yet, you'll be prompted to create a developer name after entering your credentials.\n\n```ShellSession\nEnter new developer name:\nName: {{ site.example.devName }}\nYou are registered as `{{ site.example.devName }}`!\n```\n\n- ##### shoutem logout\n\nLogs you out from the CLI.\n\n```ShellSession\n$ shoutem logout\nSuccessfully logged out.\n```\n\n- ##### shoutem init \\<extension-name>\n\nInitializes an extension project.\n\n```ShellSession\n$ shoutem init {{ site.example.extensionName }}\nEnter information about your extension. Press `return` to accept (default) values.\n\nTitle: Restaurants\nVersion: 0.0.1\nDescription: List of {{ site.example.extensionName }}\n...\nExtension initialized!\n```\n\nAfter initialization, your extension folder structure will look as follows:\n\n```\n{{ site.example.devName }}.{{ site.example.extensionName }}/\n  ├ app/\n  |  ├ node_modules/\n  |  ├ extension.js\n  |  ├ index.js\n  |  └ package.json\n  ├ server/\n  |  ├ node_modules/\n  |  └ package.json\n  └ extension.json\n```\n\n> #### Note\n> `{{ site.example.devName }}` and `{{ site.example.extensionName }}` are just used as an example.\n\nRun this command from the extension folder.\n\n- ##### shoutem push\n\nPushes extension to Shoutem server.\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nAs long as extension is not published, every `push` will overwrite current development version of extension. Once you `publish` extension, that version of extension will be unchangeable and you will be able to `push` only higher version numbers.\n\nRun this command from the extension folder.\n\n- ##### shoutem publish\n\nPublishes extension to Shoutem server. If the extension folder is inside of a cloned app folder, it will also offer you to install the extension into that cloned app. Furthermore, if the extension is already published, it lets you choose it's new version. If the extension is both published and installed, it will ask you whether or not you want to update the extension that's installed in the app to the newly published version.\n\n```ShellSession\n$ shoutem publish\nWARNING: shoutem publish command is deprecated. Use shoutem extension publish instead\nChecking the extension code for syntax errors... [OK]\n? Version 0.0.2 is already published. Specify another version: 0.0.2\nBuilding the server part... [OK]\nBuilding the app part... [OK]\nPacking extension... [OK]\nProcessing upload... [OK]\nUploading Restaurants extension to Shoutem... [OK]\nPublishing {{ site.example.extensionName }} version 0.0.2... [OK]\n? Update the version used in the current app ({{ site.example.devName }}.{{ site.example.extensionName }}@0.0.1 => @0.0.2)? Yes\nSuccess\n```\n\nRun this command from the extension folder.\n\n- #### shoutem extension publish \\<extension-name>\n\nPublishes the named extension. It also offers you the choice whether or not you want to install the extension into the cloned app. Furthermore, if the extension is already published, it lets you choose it's new version. If the extension is both published and installed, it will ask you whether or not you want to update the extension that's installed in the app to the newly published version.\n\n```ShellSession\n$ shoutem extension publish {{ site.example.extensionName }}\nChecking the extension code for syntax errors... [OK]\nBuilding the server part... [OK]\nBuilding the app part... [OK]\nPacking extension... [OK]\nProcessing upload... [OK]\nUploading Restaurants extension to Shoutem... [OK]\nPublishing {{ site.example.extensionName }} version 0.0.1... [OK]\n? Do you want to install {{ site.example.devName }}.{{ site.example.extensionName }} extension to the app {{ site.example.appId }}? Yes\nSuccess\n```\n\nRun this command from any directory inside your cloned app.\n\n- ##### shoutem install [\\--new [\\<restaurant-name>]] [\\--app \\<app-id>]\n\nInstalls extension to the app. If no flags or arguments are passed, the CLI will offer an interactive menu.\n\n```ShellSession\n$ shoutem install\nSelect app to install your extension:\n> RestaurantsApp\n  --------------\n  Create a new app\n```\n\nPass a flag `--new` to install it on a new app.\n\n```ShellSession\n$ shoutem install --new Restaurants\nInstalling `Restaurants` extension to the new app...\nExtension successfully installed to the new app. Check it here:\n{{ site.shoutem.builderURL }}/app/{{ site.example.appId }}\n```\n\nAlso, you can install it on specific a app by providing an app ID. To find out ID of the app, go to **Settings** and scroll down to **Advanced information** section of the **App info**.\n\n```ShellSession\n$ shoutem install --app {{ site.example.appId }}\nInstalling `Restaurants` extension to `Restaurants` app...\nExtension successfully installed to the app. Check it here:\n{{ site.shoutem.builderURL }}/app/{{ site.example.appId }}\n```\n\nInstallation can be done through Builder as well by going to the Extensions tab in the sidebar, clicking on the `+` button next to `Extensions` to open the Extension Marketplace and then selecting the `My extensions` tab.\n\n- #### shoutem platform create [--url <platform-archive-url>]\n\nWhen run from app folder, publishes a custom platform with all your non-extension (i.e. native) changes.\nPreviously to the existence of this command, developers needed to use file anchors, but with this you can make any and all\nchanges to everything in your app, including our core code.\n\nIt also offers you the choice whether or not you want to publish the platform and install the platform into the cloned app.\nYou can also run it by giving it an --url parameter to an archived platform. For example, you can link to a tag archive in your github repository (needs to be public).\n\n- #### shoutem platform publish [--platform <platform-id>]\n\nPublishes the selected platform, making it visible to you in the Shoutem builder.\nOptions can also be left out and an interactive dialogue offers you a list of platforms.\n\n- #### shoutem platform install [--app <app-id> --platform <platform-id>]\n\nInstalls selected platform to selected app.\nOptions can also be left out and an interactive dialogue offers you a list of apps and platforms.\n\n- ##### shoutem screen add \\<screen-name>\n\nAdds a [screen]({{ site.url }}/docs/extensions/my-first-extension/shortcut-and-screen) to the extension. Furthermore, it lets you choose whether or not the screen should also have a shortcut added to it, allowing it to be added to the app via the Builder as a screen via the Add Screen modal.\n\n```ShellSession\n$ shoutem screen add List\n? Screen name: List\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: {{ site.example.extensionName }}\n? Shortcut title: Restaurants\n? Shortcut description: A shortcut for List\n...\nSuccess\n```\n\nRun this command from the extension folder.\n\n- ##### shoutem shortcut add \\<shortcut-name>\n\nAdds a [shortcut]({{ site.url }}/docs/extensions/my-first-extension/shortcut-and-screen) to the extension, either to a specific screen or a standalone shortcut that you can later connect a screen to.\n\n```ShellSession\n$ shoutem shortcut add\n? Shortcut name: MyShortcut\n? Shortcut title: My Shortcut\n? Shortcut description: A shortcut for WithoutShortcut\n? Which screen would you like to connect with this shortcut? WithoutShortcut\n...\nSuccess!\n```\n\nIn the example above, `WithoutShortcut` is a screen added with `shoutem screen add` that had no shortcut automatically made for it.\n\nRun this command from the extension folder.\n\n- ##### shoutem schema add \\<schema-name>\n\nAdds a [data-schema]({{ site.url }}/docs/extensions/my-first-extension/using-cloud-storage) to the extension.\n\n```ShellSession\n$ shoutem schema add Restaurants\nSchema `Restaurants` is created in file `server/data-schemas/Restaurants.json`!\nFile `extension.json` was modified.\n```\n\nRun this command from the extension folder.\n\n- ##### shoutem page add \\<page-name>\n\nAdds a settings [page]({{ site.url }}/docs/extensions/tutorials/settings-pages-introduction) to the extension. You can choose whether you want to create a React or HTML settings page and whether that page is a shortcut or extension settings page. It will even allow you to add a new screen and shortcut that the settings page is meant for.\n\n```ShellSession\n$ shoutem page add\n? Settings page type: react\n? Settings page name: MyPage\n? Settings page title: My Page\n? This settings page controls settings for: an existing screen\n? Select existing screen: List\n...\nSuccess\n```\n\nRun this command from the extension folder.\n\n- ##### shoutem theme add \\<theme-name>\n\nAdds a [theme]({{ site.url }}/docs/extensions/tutorials/writing-a-theme) to the extension.\n\n```ShellSession\n$ shoutem theme add Argo\nTheme `Argo` is created in file `app/themes/Argo.js`.\nVariables for the theme are created in file `server/themes/ArgoVariables.json`\nFile `extension.json` was modified.\n```\n\n- ##### shoutem show\n\nShows the currently logged in user and their Shoutem home directory.\n\n```ShellSession\n$ shoutem show\nRegistered as `{{ site.example.devName }}`.\nHome directory: `/path/to/.shoutem` (customizable through SHOUTEM_CLI_HOME env variable)\n```\n\n- ##### shoutem clone [\\<app-id>]\n\nClones a complete app project which includes the [Shoutem platform](https://github.com/shoutem/platform) and all extensions installed in the app (you can see them in `Extensions` tab in the Builder). Useful for running and figuring out the details of how a complete Shoutem app works, and to help you understand how extension code integrates with the app itself. The command will create a directory with the same name as the app being pulled, with spaces being replaced with underscores. The directory will have an `extensions` directory containing the source code of all extensions installed in the given app.\n\n```ShellSession\n$ shoutem clone\nSelect your app: Restaurants ({{ site.example.appId }})\nPulling the app `Restaurants`...\nCloning `Restaurants` to `Restaurants`\nDone.\n\nTo run your app on iOS:\n    cd path\\to\\Restaurants\n    react-native run-ios\nTo run your app on Android:\n    cd path\\to\\Restaurants\n    Have an Android simulator running or a device connected\n    react-native run-android\n```\n\n- ##### shoutem extension add \\<extension-name>\n\nInitializes, publishes and installs the app into the cloned app that you're located in.\n\n```ShellSession\n$ shoutem extension add {{ site.example.extensionName }}\nEnter information about your extension. Press `return` to accept (default) values.\n\nTitle: Restaurants\nVersion: 0.0.1\nDescription: List of {{ site.example.extensionName }}\n\nChecking the extension code for syntax errors... [OK]\nBuilding the server part... [OK]\nBuilding the app part... [OK]\nPacking extension... [OK]\nProcessing upload... [OK]\nUploading Restaurants extension to Shoutem... [OK]\nPublishing {{ site.example.extensionName }} version 0.0.1... [OK]\nInstalling it in your app... [OK]\n\nCongratulations, your new extension is ready!\nYou might try doing cd relative/path/to/vladimir-vdovic.for-reference where you can:\n\n  shoutem screen add\n    add a new screen\n\n  shoutem schema add <schemaName>\n    add a new data schema\n\n  shoutem theme add <themeName>\n    add a new theme\n\n  shoutem page add\n    add a new settings page\n\nSuccess!\nHappy coding!\n```\n\nRun from any directory inside cloned app directory.\n\n- ##### shoutem pack\n\nPacks the extension. This command is used by `shoutem push` and with it, you can check how your extensions looks like when it's pushed to Shoutem servers.\n\n```ShellSession\n$ shoutem pack\nExtension is packed at: ~/{{ site.example.extensionName }}.tgz\n```\n\nFind the extension packed in the root of the extension folder.\n\nBy default, `shoutem pack` command will do `npm run build` in both `app` and `server` folder, which is performed also on `shoutem push`. If you don't want to get the pack without building it, use `shoutem pack --nobuild` (not documented flag).\n\n\nRun this command from the extension folder.\n\n- ##### shoutem configure [--release] [--production]\n\nRuns the platform's configure script to sync the local app with native changes to local extensions.\nThe flag `--release` bundles the downloaded configuration, so that the app doesn't download it on every start.\nThe flag `--production` is used to configure the app's bundle ID for iOS and Android to match the one provided in the Builder. It also activates the code push feature, analytics and push notifications. The `--production` configuration automatically sets the `release` flag in `config.json`.\n\nFurthermore, you can customize the bundle ID for your app via the `iosBundleId` and `androidApplicationId` properties in the `config.json` file in the cloned app's root directory. These settings override the Builder defined values.\n\n\nThe command should be called when:\n- new extension is created, installed to the current app & pushed\n- changing native code of any of the extensions from the extensions/ directory\n- changing cocoapods or gradle dependencies of any of the extensions from the extensions/ directory\n- switching between published (`shoutem configure --release`) and development (`shoutem configure`) configuration\n- preparing app for manual building and publishing (`shoutem configure --production`)\n\n```ShellSession\n$ shoutem configure\nStarting build for app {{ site.example.appId }}\n```\n\nRun this command from the application folder.\n\n- ##### shoutem whoami\n\nDisplays the username of current developer.\n\n```ShellSession\n$ shoutem whoami\n{{ site.example.devName }}\n```\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-01-ConnectToApi.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/connecting-to-api\ntitle: Connecting to 3rd Party API\nsection: Tutorials\n---\n\n# Connecting to 3rd Party API\n\nSince Shoutem apps are plain React Native apps, you can connect to any API. It's very simple to do [networking in React Native](https://facebook.github.io/react-native/docs/network.html). Basically, React Native enables you to use [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) out of the box, a simple interface for communicating with API endpoints. If, however, you need something more sophisticated, you can use [Async Actions](https://github.com/reactjs/redux/blob/master/docs/advanced/AsyncActions.md) in Redux.\n\nIn this tutorial we'll explain how to build a simple React Native app fetching the photo of the day from [NASA's APOD API](https://api.nasa.gov/index.html). We'll also use the [Shoutem UI toolkit]({{ site.url }}/docs/ui-toolkit/introduction). Here's how the completed app should look:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/connecting-to-api/final.png'/>\n</p>\n\nThe complete code for this extension is available in our [GitHub repository](https://github.com/shoutem/extension-examples/tree/master/connecting-to-3rd-party-api).\n\n## Initialize the Extension\n\nShoutem apps are made of extensions, so let's start by creating a new extension.\n\n```ShellSession\n$ shoutem init nasa\nEnter information about your extension. Press `return` to accept (default) values.\n\nTitle: NASA\nVersion: 0.0.1\nDescription: Photo of the day from Nasa\n...\nExtension initialized!\n```\n\nSwitch over to the extension's folder:\n\n```ShellSession\n$ cd {{ site.example.devName }}.nasa\n```\n\nCreate a new starting screen and shortcut:\n\n```ShellSession\n$ shoutem screen add PhotoDay\n? Screen name: PhotoDay\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: Photo\n? Shortcut title: Photo\n? Shortcut description: A shortcut for PhotoDay\n...\nSuccess\n```\n\nPush the extension to Shoutem:\n\n```ShellSession\n$ shoutem push\nUploading `NASA` extension to Shoutem...\nSuccess!\n```\n\nInstall that extension to a new app. You can create a new app on the Builder and then install the extension into that app, or directly create a new app through the CLI:\n\n```ShellSession\n$ shoutem install --new NasaApp\nInstalling `NASA` extension to the new app...\nExtension successfully installed to the new app. Check it here:\n{{ site.shoutem.builderURL }}/app/{{ site.example.appId }}\n```\n\nOnce this is done, go to the [Builder]({{ site.shoutem.builderURL }}) and add the screen inside the app. Now you can preview the app:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/connecting-to-api/hello-world.png'/>\n</p>\n\n## Fetch the Photo\n\nNow let's fetch the photo into the screen. We'll use the Fetch API from JavaScript. This is the complete code from `app/screens/PhotoDay.js`.\n\n```JavaScript\n#file: app/screens/PhotoDay.js\nimport React, {\n  Component\n} from 'react';\n\nimport {\n  Screen,\n  View,\n  ImageBackground,\n  Spinner,\n  Tile,\n  Title,\n  Subtitle\n} from '@shoutem/ui';\n\n// public API, you can get yours on: https://api.nasa.gov\nconst apiKey = 'NNKOjkoul8n1CH18TWA9gwngW1s1SmjESPjNoUFo';\n\n// NASA photo API url\nvar photoUrl = \"https://api.nasa.gov/planetary/apod\";\n\n\nexport default class PhotoDay extends Component {\n  state = {\n    photo: null\n  }\n\n  componentDidMount() {\n    fetch(photoUrl + '?api_key=' + apiKey, {\n      method: 'GET',\n      headers: {\n        'Accept': 'application/json',\n        'Content-Type': 'application/json',\n      }\n    })\n      .then((response) => response.json())\n      .then((photo => {\n        this.setState({ photo });\n      }));\n  }\n\n  render() {\n    const { photo } = this.state;\n    // render Spinner is photo is not fetched\n    const content = photo ?\n    (\n      <ImageBackground\n        styleName=\"large-portrait\"\n        source={% raw %}{{{% endraw %} uri: photo.url }}\n      >\n        <Tile>\n          <Title>{photo.title}</Title>\n          <Subtitle>{photo.copyright}</Subtitle>\n        </Tile>\n      </ImageBackground>\n    ) : <Spinner />;\n\n    return (\n      <Screen>\n        <View styleName=\"flexible vertical v-center\">\n          {content}\n        </View>\n      </Screen>\n    );\n  }\n}\n```\n\nPush the changes you made to Shoutem:\n\n```ShellSession\n$ shoutem push\nUploading `NASA` extension to Shoutem...\nSuccess!\n```\n\nPreview it to see the changes. This is the final result:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/connecting-to-api/final-builder.png'/>\n</p>\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-01-GettingStarted.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/getting-started\ntitle: Getting Started\nsection: Tutorials\n---\n\n# Getting Started\n\nShoutem is a platform that enables you to build, publish and manage high-quality native iOS and Android apps. It's built on top of React Native and open sourced for developers. The philosophy behind Shoutem is to let you build apps efficiently without restricting you on how to use React Native.\n\n## Apps and Extensions\n\nThe efficiency of building apps is achieved with a simple architecture: apps are built using smaller modules called `extensions`. An extension is a self-contained and complete functionality that can be reused. Everything in the app is an extension: navigation, places (list and details), push notifications, analytics, ads, etc...\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/getting-started/apps-are-made-of-extensions.png'/>\n</p>\n\nShoutem prepared and [open sourced](https://github.com/shoutem/extensions) a lot of extensions that you can use in your apps. **Don't reinvent the wheel**: reuse extensions which are suitable for your app, customize them or create new ones. It's the world-first WordPress-like solution for mobile apps.\n\n## The Builder\n\nShoutem apps are managed on a beautiful web interface called the **Builder**. It allows you to host your project online and make it customizable for non-technical people, which is perfect for a developer's clients. It also allows developers to save time setting up a part of their app so they can focus on their own unique features.\n\n## Your First App\n\n#### Prerequisites\n\nBefore going through this tutorial, make sure you've installed the following:\n\n- [Node.js and npm](https://www.npmjs.com/) (installing `Node.js` also installs `npm`)\n- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n- react-native-cli - `$ npm install -g react-native-cli`\n- shoutem-cli - `$ npm install -g @shoutem/cli`\n- yarn - `$ npm install -g yarn`\n- [python 3.8.0+](https://www.python.org/downloads/release/python-380/)\n- fonttools - `pip3 install fonttools` (after installing Python)\n- OSX - > Coacoapods - `$ gem install cocoapods`\n\n> #### Note\n> If the above commands fail because of _permission_ issues, you need to run them with `sudo`, e.g.`sudo npm install -g <package-name>`.\n\nIf you haven't already, go to the [Builder]({{ site.shoutem.builderURL }}) and create an account. Once signed in, create a new `Blank app`. For this quick tutorial, we'll make a Restaurants and Food app, let's call it `Restaurants`. To rename your app, click on the `Blank app` text, delete it and type in `Restaurants`.\n\nLet's say we want to add an RSS feed screen to our app. To do that, click on the + button next to Screens and select the News RSS extension. Since the app is about Restaurants, to stick to the Food theme, let's use a food related News RSS feed:\nhttp://foodengineeringmag.com/rss/topic/2639-top-100-food-beverage-companies\n\nAfter you add this screen, it should look something like this:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/getting-started/01-builder-before-clone.png'/>\n</p>\n\n## Creating a New Extension\n\nAs a developer, you use the Shoutem CLI to handle the lifecycle of extensions.\n\nStart by using the `shoutem login` command with your Shoutem credentials (\"{{ site.example.devName }}\" is used as a developer name in this example).\n\n```ShellSession\n$ shoutem login\nEnter your Shoutem credentials (obtained at {{ site.shoutem.builderURL }}):\nEmail: {{ site.example.devEmail }}\nPassword:\n\nLogged in as {{ site.example.devEmail }}.\nEnter developer name.\nDeveloper name: {{ site.example.devName }}\n\nRegistered as `{{ site.example.devName }}`.\n```\n\nClone the app you made in the Builder to your machine by using `shoutem clone` and selecting your app from the list:\n\n```ShellSession\n$ shoutem clone\nSelect your app: Restaurants ({{ site.example.appId }})\nCloning `Restaurants` to `Restaurants`\n...\n```\n\n`shoutem clone` turns your app you see on the Builder into a Shoutem flavored React Native app locally. Once the cloning process is done, locate to `Restaurants/extensions` (where you can find all the extensions installed into your app) and create your new extension using `shoutem init`:\n\n```ShellSession\n$ cd Restaurants/extensions\n$ shoutem init restaurants\nEnter information about your extension. Press `return` to accept (default) values.\nTitle: Restaurants\nVersion: 0.0.1\nDescription: A restaurants extension.\n\nInitializing extension:\n...\n\nExtension initialized!\n```\n\nThe `shoutem init` command bootstrapped the `{{ site.example.devName }}.restaurants` folder with extension files. Let's add a screen that we'll use as a list of restaurants in the My first extension tutorial series, so we'll name it `List` and give it a shortcut `Restaurants`.\n\nA shortcut is the pointer to the starting screen of an extension. When you add screens to your app on the Builder, you're actually adding the shortcut to that screen.\n\n```ShellSession\n$ cd {{ site.example.devName }}.restaurants\n\n$ shoutem screen add List\n? Screen name: List\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: Restaurants\n? Shortcut title: Restaurants\n? Shortcut description: A shortcut for List\n...\nSuccess\n```\n\nThe previous command created a `List` screen in `app/screens/List.js` file. Any time you make a new screen it'll be a simple _Hello World_ screen. To fit the app, let's change the screen so it says `Let's eat!` instead of `Hello World!`:\n\n```JavaScript{5}\n#file: app/screens/List.js\nexport default class List extends Component {\n  render() {\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Let's eat!</Text>\n      </View>\n    );\n  }\n}\n```\n\nNow push what we've built to Shoutem with `shoutem push`:\n\n```ShellSession\n$ shoutem push\nChecking the extension code for syntax errors...\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nAnd install the extension into the Restaurants app using `shoutem install`:\n\n```ShellSession\n$ shoutem install\nSelect your app: Restaurants ({{ site.example.appId }})\n\nExtension installed.\nSee it in the builder: {{ site.shoutem.builderURL }}/app/{{ site.example.appId }}\n```\n\n> #### Note\n> You should run `shoutem configure` after installing new extensions into your app, so your local clone is synced with the Builder app!\n\nNow we need to add the screen to the app. Open the app in the Builder. Click on the `+` next to **Screens** and select the `Custom` category. You can see your `Restaurants` extension there. Click on it to add it's screen to Main navigation, just like you did with the News RSS.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/getting-started/02-builder-custom-extension-screen.png'/>\n</p>\n\nGreat! Let's make our newly created extension's screen the Starting Screen for the app. Just drag it to the top of Main navigation and you're done. Now when you preview the app, this is what you'll see:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/getting-started/03-lets-eat.png'/>\n</p>\n\n**Well done!** You just built your first app using your own custom built extension!\n\n## What's next?\n\nTo leverage the full power of Shoutem, we'd suggest you go through the [My first extension]({{ site.url }}/docs/extensions/my-first-extension/introduction) tutorial, which explains the underlying concepts in more detail.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-01-PublishYourApp.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/publish-your-app\ntitle: Publish your app\nsection: Tutorials\n---\n\n# Publish, Republish, Maintain\n\nYou're satisfied with how your app looks and you want to **publish** it to the store. This tutorial shows you how to publish your app to both the [App Store]({{ site.external.appleAppStore }}) and [Google Play]({{ site.external.googlePlayStore }}). We'll also describe what it means to republish and how to maintain the data in your app.\n\nThere are 2 ways you can publish your app:\n- using the Shoutem automated app publishing tool\n- manually, as you would with any other React Native app\n\nOnce your app is published, for any changes you do in the Builder (except for changes in data on Shoutem Cloud Storage) and want to get onto the live app, you will need to **republish** the app. Shoutem does the republishing automatically for you and most of the changes will be available seconds after you click the `Republish` button.\n\nAs the data used in app might change over the time, we made it easy for you **maintain** it using the Shoutem CMS.\n\n# Using Shoutem Automated App Publishing Tool\n\nThe Shoutem platform's goal is to cover the complete process of app developing: from prototyping, developing, designing, to publishing and maintaining. That's why we developed a tool for automated app publishing, which is integrated into the Shoutem Builder.\n\n#### Prerequisites\n\nThe only prerequisite to publish an app using Shoutem is to have your developer accounts ready. If you don't have them, creating them is easy:\n- to publish apps to the App Store (for iOS devices), create an Apple [iOS Developer Account]({{ site.external.appleDeveloperAccount }})\n- to publish apps to Google Play (for Android devices), create a [Google Play Developer account]({{ site.external.googlePlayDeveloperAccount }})\n\n#### Publishing\n\nThere are three simple steps to publish your app:\n\n1. Grant Shoutem permission to publish apps using your developer accounts\n2. Fill in the app details (description, screenshots, ...) inside the Builder\n3. Click the `Publish` button\n\nThe first two steps are only done once.\n\n##### Granting Shoutem Permission\n\nYou need to grant Shoutem permission to stores where you want to publish your app.\n\n**App Store**\n\nGo to `Settings` -> `Store metadata` and the `iOS` tab should be selected. Find the _iOS Developer Account_ field and enter your credentials there. Don't worry - our tool will only handle new apps and won't do anything that you don't want it to do. If, however, you don't want to share your credentials with us, there's a slightly more complex way to grant us permission to the Apple Developer portal and iTunes Connect separately. For that, you should contact [our support]({{ site.shoutem.support }}).\n\n**Google Play Store**\n\nGo to `Settings` -> `Store metadata` and select the `Android` tab. Find the _Google Play Android Developer Account_ field. You will find these steps to invite a new user:\n\n```\nYou need to invite shoutem@shoutem.com to use your Android dev account as an administrator.\nLog in to your Android developer account\nClick 'Manage user accounts...' link\nClick 'Invite a new user button'\nEnter 'shoutem@shoutem.com' and send invitation\n```\n\nOnce you do that, write your Android developer account owner and console account name.\n\n##### Fill in the App Details\n\nInstead of going to each store to fill in app information, we've put everything in one place. Go to `Settings` and fill out information under `App info` and `Store metadata`.\n\n##### Click the `Publish` Button\n\nAfter you finish the first two steps, click the `Publish` button. Your app will go into the review process in both stores and we'll be notifying you of the process.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/publish-app.png'/>\n</p>\n\nOnce your app is published, the `Publish` button will become `Republish`.\n\n### Automatic Republishing\n\nUsing Shoutem, in most cases the republishing of your app lasts a few seconds. Changes that you made in the app's colors, settings, RSS feeds, order or number of extensions being used in the app structure, all of that will be visible immediately once you click the `Republish` button. Even installing new extensions, updating existing extensions or uninstalling extensions will be visible automatically.\n\nThe only two changes that will require an app to go over the reviewing process in the stores are:\n- updating the [Shoutem platform]({{ site.url }}/docs/extensions/reference/platform) being used in the app\n- installing, updating or uninstalling extensions which contain **native code**\n\nIn those cases, you still just have to click the `Republish` button and we'll take care of the rest and will notify you of the process.\n\n### Maintaining the App Data\n\nOnce your app is live, you might want to change some data that's being used in the app. The data shown in Shoutem CMS (used in Shoutem Cloud Storage) is live and changes to it will be immediately visible in the apps using Shoutem Cloud Storage. This is also the case for manually published apps using Shoutem Cloud.\n\n# Manual Publishing and Republishing\n\nIf you want to have a complete overview of what publishing of your app looks like, you might want to publish your app manually. The process is longer, but is functionally identical to publishing a regular React Native app. Here we describe the required steps for both stores.\n\nAlso, it's not possible to manually publish to the App Store if you don't have an Apple Device (MacBook, Mac-Mini, MacPro).\n\n## App Store\n\nThis is the manual process for publishing an iOS app to the App Store.\n\n### Prerequisites\n\n- **Apple Device:** In order to create your iOS app, an Apple computer (MacBook, Mac-Mini, MacPro) device is required since Xcode is not available on any other platforms\n- **[Xcode]({{ site.external.xcode }}):** Apple's program for development and distribution of iPhone apps\n- **Active [iOS Developer Account]({{ site.external.appleDeveloperAccount }}):** a paid iOS developer account for submitting your app onto the App Store\n\n### Building your App\n\nTo prepare your app for release, you will have to use `shoutem configure --production` in the cloned app's directory. This will bundle the assets of the app as well as configure all relevant files to utilize Builder defined values (e.g. bundle ID, Push Notifications, Analytics, etc.).\n\nFurthermore, you can customize the bundle ID for your app via the `iosBundleId` and `androidApplicationId` properties in the `config.json` file in the cloned app's root directory. These settings override the Builder defined values.\n\nAfter doing this short step, the build process is functionally identical to a [normal React Native app](https://medium.com/react-native-development/deploying-a-react-native-app-for-ios-pt-1-a79dfd15acb8).\n\n### Preparing for the Store\n\nOnce you have the build ready, you can start preparing your app for the store.\n\n#### Creating Certificates\n\nYou will need to make an iOS distribution certificate and matching distribution provisioning profile for your app. Here's a short video tutorial on how to do it:\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Xh2nnjttOwo\" frameborder=\"0\" allowfullscreen></iframe>\n\nYou can also use [Apple's guide](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html#//apple_ref/doc/uid/TP40012582-CH31-SW1) where each step is explained in more detail.\n\n#### Resigning App\n\nOnce you have an unsigned build (.ipa), you will need to resign it. You can do it quickly with the Terminal by using Fastlane's [sigh](https://github.com/fastlane/fastlane/tree/master/sigh) tool.\n\nOnce sigh is installed, use:\n\n```ShellSession\n$ fastlane sigh resign\n...\nSuccessfully signed ShoutemApp.ipa!\n```\n\n> #### Note\n> Before you start this command, make sure you've added your [desired certificate into your keychain](https://superuser.com/questions/936840/add-to-my-certificates-in-keychain-access-mac-os-10-10).\n\n> #### Note\n> `sigh` will find the build file and the provisioning profile for you if they are located in the current folder. If they're not in the current folder, provide more information to `sigh`: `fastlane sigh resign ./path/app.ipa --signing_identity \"iPhone Distribution: Dummy user\" -p \"my.mobileprovision\"`\n\n#### Creating an app on iTunes Connect\n\n[iTunes Connect](https://itunesconnect.apple.com) is Apple’s service for uploading your app and its metadata. From there, the app will eventually become available in the App Store. Let's create an app there.\n\nLogin to iTunes Connect with your iOS Developer account, click on `My Apps`, then click on the `+` in the top left corner. You should get this menu:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/itunes-connect-menu.png'/>\n</p>\n\nFill your app details. Once you are done with that, click on `Create`. Your app is now created on iTunes Connect and you are few steps away from publishing it. Fill the details of your app's privacy policy link, category and license agreement.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/itunes-app-info.png'/>\n</p>\n\nIn `Pricing and Availability`, choose to make your app free or paid and in which countries you want to make it available.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/itunes-pricing-and-availability.png'/>\n</p>\n\nUpload app's metadata. Click on iOS app which is currently in “Prepare for Submission” state. On this screen, you will upload your app’s screenshots, add it’s description, keywords, support URL, content rating, app store artwork and review contact information.\n\nAfter doing so, upload your build file (.ipa). To upload it, you use tool called Application Loader, which is one of the tools that comes along with Xcode. Find it in Xcode: Select Xcode in the menu -> Open Developer Tools -> Application Loader. This is what you should get:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/xcode-application-loader.png'/>\n</p>\n\nLogin with your iOS Developer account, choose the “Deliver your app” option and upload your .ipa file to iTunes Connect.\n\nAfter uploading it, the app will go trough processing time in iTunes Connect. Processing time can vary from few minutes to few hours (even days) and it depends on the stability of the Apple’s services. If you click on the `Activity tab` in iTunes Connect, you will see this while your app is in processing time:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/itunes-processing-time.png'/>\n</p>\n\nOnce the processing of your app is done, go back to your iOS app and scroll down to the `Build section`. You'll notice that a little `+` sign has appeared next to `Build`.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/itunes-build.png'/>\n</p>\n\nClick on it and the build of your app is processed and ready for preview. After adding a build, click on the `Submit for Review` button in the top right corner.\n\nFinally, you need to declare your app's export compliance, content rights and advertising info:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/itunes-compilance.png'/>\n</p>\n\nAnswer those questions and click the `Submit` button. Your app status will change to \"Waiting for review\" state which means that your app has been sent to Apple's review team.\n\n### Review\n\nApple usually takes 2-3 days to review apps. Once they approve (or reject) the app, you should get the confirmation e-mail to your owner's e-mail regarding the review.\n\n### Manual Republish\n\nIf you make some changes in the app (colors, titles, change which extensions you use or their order), you will need to republish your app. Manual republishing of the app requires you to go through all the steps described here except creating new developer account and certificates.\n\n### Maintaining the App Data\n\nOnce your app is live, you might want to change data used in the app. The data shown in Shoutem CMS (used in Shoutem Cloud Storage) is live and changes to it will be immediately visible in the apps using Shoutem Cloud Storage.\n\n## Google Play Store\n\nThis is a manual process of publishing an android app in the Google Play Store.\n\n### Prerequisites\n\n- **[Android Studio]({{ site.external.androidStudio }}):** Tool for developing Android apps and is also used for app signing\n- Android SDK tools: can be installed within Android Studio\n- **[Google Play Developer account]({{ site.external.googlePlayDeveloperAccount }})**\n\n### Building your app\n\nTo prepare your app for release, you will have to use `shoutem configure --production` in the cloned app's directory. This will bundle the assets of the app as well as configure all relevant files to utilize Builder defined values (e.g. bundle ID, Push Notifications, Analytics, etc.).\n\nFurthermore, you can customize the bundle ID for your app via the `iosBundleId` and `androidApplicationId` properties in the `config.json` file in the cloned app's root directory. These settings override the Builder defined values.\n\nAfter doing this short step, the build process is functionally identical to a [normal React Native app](https://facebook.github.io/react-native/docs/signed-apk-android.html).\n\n### Preparing for Store\n\nOnce you have the build ready, you can start preparing your app for store.\n\n#### App Signing and Zipalign\n\nOnce you have an unsigned build (.apk) you need to sign it with your own keystore. Here's the [official documentation](https://developer.android.com/studio/publish/app-signing.html) on how to do that.\n\nBasically, these are the steps you will need to do:\n\n##### App Signing\n\n1. Navigate to directory with the unsigned .apk file\n2. Sign your app:\n\n```ShellSession\n$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mykey.keystore myfile.apk alias_name\n```\n\n- mykey.keystore contains the path to your keystore file\n- myfile.apk is name of your .apk file\n- alias_name is the name of the key that you are using during signing process\n\nAfter your .apk file is signed, it's ready for the zipalign process.\n\n##### Zipalign\n\n1. Put your unaligned .apk file in the desired directory\n2. Navigate to android sdk build-tools directory and choose your desired sdk tools (for example 22.0.1):\n\n```ShellSession\n$ cd /path/to/your/android-sdk/build-tools/22.0.1/\n```\n\n3. Now, zipalign it:\n\n```ShellSession\n$ ./zipalign -v 4 /path/to/unaligned.apk /path/for/release-aligned.apk\n```\n\n4. The zipalign tool will start compressing your .apk file and once it's done it will print out “Verification succesful” in your terminal. Now if you look into the directory that you set for the aligned .apk file, you will find a new, aligned .apk file ready for upload to the Google Play Store.\n\n#### Prepare App for Publishing\n\nCreate your app in the Google Play Developer Console. Log in with your Android Developer account credentials and select `Add New Application` in the [Google Play Developer Console panel](https://play.google.com/apps/publish/):\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-create-app.png'/>\n</p>\n\nOnce you’ve entered that information, you'll be taken to the `Store Listing` screen, where you need to update your app's short description, description, screenshots, featured graphics, category and application type and add link to your privacy policy:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-store-listing.png'/>\n</p>\n\n#### Upload your App to Production\n\nUnder the `App Releases` tab, choose how you want to publish your Android app - is it for production, beta or alpha:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-app-releases.png'/>\n</p>\n\nThe process is pretty much the same for each release, so we will cover production release. Click on `Manage production` and then on `Create New`. This will take you to:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-new-release-to-production.png'/>\n</p>\n\nHere you can upload your .apk file, choose the release name and \"What's Next\" text. Once you're done, click on `Review`.\n\n#### Content Rating of your App\n\nAnswer Google's content rating questionnaire and choose your app’s content category. Add your email address and choose from one of six available categories.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-content-rating.png'/>\n</p>\n\nEach category contains slightly different questions which need to be answered mostly as Yes/No questions. Click `Save questionnaire`, then `Calculate rating`. You will see the ratings for the various locales where your app may be on sale. Scroll to the bottom of the list and click `Apply rating`. The `Content Rating` check mark is now green.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-rating-details.png'/>\n</p>\n\n#### Pricing and Distribution\n\nSelect the `Pricing & Distribution` check mark for the final step: setting the price of your app and in which countries it will be available.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-pricing-and-distrution.png'/>\n</p>\n\nBelow this, there are a few checkbox questions regarding your app distribution. Check the boxes by Content guidelines and US export laws to indicate your app’s compliance with relevant rules, then scroll to the top of the page and click `Save draft`.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-content-guidelines.png'/>\n</p>\n\n### Release the App\n\nSelect your `App Release` tab again and select `Edit release` under `Manage Production`:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/publish-your-app/android-app-release.png'/>\n</p>\n\nScroll down, click on the `Review` button. Check your app details and if you are satisfied, click on the `Start rollout to production` button to publish your app in the `Google Play Store`. Clicking on the confirm button, you will publish your app in the Store!\n\n### Manual Republish\n\nIf you make some changes in the app (colors, titles, change which extensions you use or their order), you will need to republish your app. Manual republishing of the app requires you to go through all the steps described here except creating new developer account and certificates.\n\n### Maintaining the app data\n\nOnce your app is live, you might want to change the data used in the app. The data shown in Shoutem CMS (used in Shoutem Cloud Storage) is live and changes to it will be immediately visible in the apps using Shoutem Cloud Storage.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-01-SettingLocalEnvironment.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/setting-local-environment\ntitle: Setting up your Local Environment\nsection: Tutorials\n---\n\n# Setting up your Local Environment\n\nIn this tutorial we will explain how to set up a local environment that allows you to preview changes to your app in real time. In other words, once you're set up, you won't have to _push_ your extension to Shoutem every time you want to see the changes you made to it. You can do this using your own physical device or an emulator.\n\nTo be able to follow this tutorial, you should go through our [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started) tutorial so you have a custom extension as well as a cloned app to easily test your local environment with.\n\n## Local Development\n\nThere are limitations to what the Builder can preview. Namely, it can only preview apps that have no native code linked into them. This is because it has it's own binary, so it can only preview changes made to the JavaScript bundle of the app.\n\nTo work on apps with native code changes, you can use `react-native run-ios` and `react-native run-android` inside your cloned app's directory, the same way you'd use them with any other React Native app! You can find out how to set up your local environment for React Native development using [Facebook's official documentation](https://facebook.github.io/react-native/docs/getting-started.html). Make sure you strictly pass through all the steps described there.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/setting-local-environment/rn-getting-started.png'/>\n</p>\n\nOnce you have that set up, you can continue your work like it was a regular React Native app.\n\n```ShellSession\n$ react-native run-ios\nScanning 706 folders for symlinks in /path/to/Restaurants/node_modules (18ms)\n...\n```\n\n## Real Time Code Changes\n\nWe will now explain how to preview code changes in your extensions in real-time, in other words, to be able to see changes in your extension as you make them **without** having to push your extension to Shoutem every time you make a change.\n\nIn [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started), we already cloned the app we made, so you can just navigate to it's directory and run it locally:\n\n```ShellSession\n$ cd Restaurants\n$ react-native run-ios\n\nScanning 706 folders for symlinks in /path/to/Restaurants/node_modules (5ms)\n...\n```\n\nChanges made to JavaScript code can be seen instantly now, all you have to do is reload the app:\n\n#### iOS\n- ⌘R\n- ⌘D -> Click on `Reload`\n\n#### Android\n- press R twice\n- Ctrl+M -> Click on `Reload`\n\nNow you can develop your extension much faster because you can see the changes you make to your extension in real time, exactly like a regular React Native app. Let's see how this works. Change something inside your extension from [Getting Started]({{ site.url }}/docs/extensions/tutorials/getting-started), for example you could add another line of `<Text>` to the `List` screen:\n\n```javascript{5}\n#file: Restaurants/extensions/{{ site.example.devName }}.restaurants/app/screens/List.js\n  render() {\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Let's eat!</Text>\n        <Text style={styles.text}>This is my first extension!</Text>\n      </View>\n    );\n  }\n```\n\nSave the changes, reload the device as previously described and you should see your new line of text right there.\n\n### Managing your app's Configuration\n\nThis section will cover the uses of the configuration script and associated commands.\n\n#### shoutem configure\n\n```ShellSession\n$ shoutem configure\n\n> @shoutem/mobile-app@1.1.2 configure /path/to/Restaurants\n> node scripts/configure\n...\n```\n\nThe command should be called when:\n - an extension is installed, updated or uninstalled\n - changing native code of any of the extensions from the `extensions` directory\n - changing cocoapods or gradle dependencies of any of the extensions from the `extensions` directory\n - switching between published (`shoutem configure --release`) and development (`shoutem configure`) configuration\n\n<br/>\n#### shoutem configure --release\n\n```ShellSession\n$ shoutem configure --release\n\n> @shoutem/mobile-app@1.1.2 configure /path/to/Restaurants\n> node scripts/configure \"--release\"\n...\n```\n\nThis command should be called when:\n- bundling assets into the app\n\n<br/>\n#### shoutem configure --production\n\n```ShellSession\n$ shoutem configure --production\n\n> @shoutem/mobile-app@1.1.2 configure /path/to/Restaurants\n> node scripts/configure \"--production\"\n...\n```\n\nThis command should be called when:\n- switching between development (`shoutem configure`) and last published (`shoutem configure --production`) configuration\n- bundling assets into the app\n- preparing app for [Apple App Store and Google Play Store Submission]({{ site.url }}/docs/extensions/tutorials/publish-your-app)\n- activating Shoutem features like CodePush, Push Notifications and Analytics\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-02-WritingATheme.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/writing-a-theme\ntitle: Writing a Theme\nsection: Tutorials\n---\n\n# Writing a Theme\n\nShoutem comes with a dozen of available themes, but if you want a custom one, you can write your own. To start, it's important that you understand two concepts (extension parts):\n\n- Theme: file containing all the style for your app\n- Theme variables: schema for the Builder that describes what app owners can customize in your theme through the Builder itself\n\n> #### Note\n> This tutorial continues on [My First Extension]({{ site.url }}/docs/extensions/my-first-extension/introduction). If you don't have an app which is the result from the My First Extension section, you can find the `Restaurants` extension on [Github](https://github.com/shoutem/extension-examples/tree/master/tom.restaurants-getting-started), install it onto a new app and fill it with some restaurants.\n\n## Creating a Theme\n\nTo create a theme within the existing Restaurants extension, switch over to the `Restaurants` extension folder:\n\n```ShellSession\n$ cd {{ site.example.devName }}.restaurants\n```\n\nCreate a theme and fill it with basic data:\n\n```ShellSession\n$ shoutem theme add restaurant\nEnter information about your theme. Press `return` to accept (default) values.\nTitle: (Restaurants)\nDescription: Awesome restaurant theme!\n\nFile `app/themes/restaurant.js` is created.\nFile `server/themes/restaurantVariables.json` is created.\n```\n\nThe `extension.json` file was modified to include the newly created theme:\n\n```JSON{9-19}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"title\": \"Restaurants\",\n  \"description\": \"List of restaurants\",\n  \"shortcuts\": [{ ... }],\n  \"screens\": [{ ... }],\n  \"dataSchemas\": [{ ... }],\n  \"themes\": [{\n    \"name\": \"restaurant\",\n    \"title\": \"Restaurant\",\n    \"variables\": \"@.restaurant\"\n    \"description\": \"Awesome restaurant theme!\",\n    \"showcase\": \"\"\n  }],\n  \"themeVariables\": [{\n    \"name\": \"restaurantVariables\",\n    \"path\": \"server/themes/restaurantVariables.json\"\n  }]\n}\n```\n\nThe `showcase` property, which is empty, is an array of images and videos that will show off your theme. Download this prepared [showcase]({{ site.url }}/img/tutorials/settings-theme/assets.zip) and copy it to the `server/assets` folder. Change the `showcase` property to:\n\n```JavaScript\n#file: extension.json\n\"showcase\": [\n  \"server/assets/list.png\",\n  \"server/assets/details.png\"\n],\n```\n\nAs stated above, you can add videos as well to show off your theme.\n\nThe CLI also made sure that `app/extension.js` handles the newly created theme:\n\n```JavaScript{9-10,17-19}\n#file: app/extension.js\n// This file is managed by Shoutem CLI\n// You should not change it\nimport pack from './package.json';\n\n// screens imports\nimport List from './screens/List';\nimport Details from './screens/Details';\n\n// themes imports\nimport restaurant from './themes/restaurant';\n\nexport const screens = {\n  List,\n  Details\n};\n\nexport const themes = {\n  restaurant\n};\n\nexport function ext(resourceName) {\n  return resourceName ? `${pack.name}.${resourceName}` : pack.name;\n}\n```\n\nAnd that our public API, `app/index.js`, exports the newly created theme:\n\n```JavaScript{8}\n#file: app/index.js\n// Reference for app/index.js can be found here:\n// http://shoutem.github.io/docs/extensions/reference/extension-exports\n\nimport reducer from './reducer';\nimport * as extension from './extension.js';\n\nexport const screens = extension.screens;\nexport const themes = extension.themes;\n\nexport { reducer };\n\n}\n```\n\nCheck `app/themes/restaurant.js` file. It's a copy of Shoutem's default theme - Rubicon.\n\nPush this theme to the Shoutem server. This might take a while, since you need to upload the `showcase` files too:\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nSince the Restaurants extension is already installed, so is your theme. However, it's not applied yet. Navigate to the `Styles` tab. Currently, the selected theme is `Rubicon`, clearly no match for your gorgeous new theme, so let's fix that. Click on the `Change theme` button. Here you can find every installed theme. Yours is also there! Select it and you'll see the showcase you set up for it earlier.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/style-tab-themes-theme-change_theme-theme_showcase.png'/>\n</p>\n\nSelect `Apply theme`.\n\nNow check the `Customize theme` tab.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/style-tab-themes-customise_theme-no_picker.png'/>\n</p>\n\nHere the app owner can customize your theme through theme variables. These variables can be found in `server/themes/restaurantVariables.json` and they're a copy of the [Rubicon theme variables](https://github.com/shoutem/extensions/blob/master/shoutem-rubicon-theme/server/primeThemeVariables.json).\n\n## How Themes Work\n\nA theme is a set of styling rules that customize components in the app connected to the theme, called `customizable components`. All the components in [@shoutem/ui](https://github.com/shoutem/ui) package are connected to the theme so they all share the same style.\n\nThe theme file, `app/theme/restaurant.js` exports the **theme function** that resolves theme variables and returns **theme objects**. Theme objects consist of [styling rules]({{ site.url }}/docs/ui-toolkit/theme/introduction#theme-style-rules) defined by the [@shoutem/theme](https://github.com/shoutem/theme) package. Each component is connected to the theme by the `name`, by which it can be targeted in theme.\n\nOpen `app/theme/restaurant.js` and check the styling rules used in `Rubicon` theme. Let's create a customizable component now.\n\n## Customizable Components\n\nSuppose we want to create a theme which will make the title in restaurant rows bigger and change the background color of subtitles to white, while changing the text color to black. Since restaurant rows are defined in `app/screens/List.js` we can make that component customizable or encapsulate a separate restaurant row component. Let's go with the first, simpler solution.\n\nFrom the docs on how to use `@shoutem/theme`, in order to support the theme, we need to:\n\n- Replace the occurrences of styles with this.props.style\n- Connect the component to the theme\n\nWe didn't use `style`, but now we're going to use it from `this.props.style` in the `renderRow` method. Also, import `connectStyle` from `@shoutem/theme` to connect the component to the theme and assign a `name` to it.\n\n```JavaScript{20,53,63-64,92-94}\n#file: app/screens/List.js\nimport React, { PureComponent } from 'react';\nimport { TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\n\nimport { navigateTo, NavigationBar } from 'shoutem.navigation';\n\nimport {\n  find,\n  isBusy,\n  shouldRefresh,\n  getCollection\n} from '@shoutem/redux-io';\nimport { connectStyle } from '@shoutem/theme';\nimport {\n  ImageBackground,\n  ListView,\n  Tile,\n  Title,\n  Subtitle,\n  Overlay,\n  Divider,\n  Screen\n} from '@shoutem/ui';\n\nimport { ext } from '../const';\n\nclass List extends PureComponent {\n  constructor(props) {\n    super(props);\n\n    // bind renderRow function to get the correct props\n    this.renderRow = this.renderRow.bind(this);\n  }\n\n  componentDidMount() {\n    const { find, restaurants } = this.props;\n\n    if (shouldRefresh(restaurants)) {\n      find(ext('Restaurants'), 'all', {\n          include: 'image',\n      });\n    }\n  }\n\n  renderRow(restaurant) {\n    const { navigateTo, style } = this.props;\n\n    return (\n      <TouchableOpacity onPress={() => navigateTo({\n        screen: ext('Details'),\n        props: { restaurant }\n      })}>\n        <ImageBackground styleName=\"large-banner\" source={% raw %}{{ uri: restaurant.image &&\n        restaurant.image.url ? restaurant.image.url : undefined }}{% endraw %}>          \n          <Tile>\n            <Title style={style.title}>{restaurant.name}</Title>\n            <Subtitle style={style.subtitle}>{restaurant.address}</Subtitle>\n          </Tile>\n        </ImageBackground>\n      </TouchableOpacity>\n    );\n  }\n\n  render() {\n    const { restaurants } = this.props;\n\n    return (\n      <Screen>\n        <NavigationBar title=\"RESTAURANTS\" />\n        <ListView\n          data={restaurants}\n          loading={isBusy(restaurants)}\n          renderRow={restaurant => this.renderRow(restaurant)}\n        />\n      </Screen>\n    );\n  }\n}\n\nexport default connect(\n  (state) => ({\n    restaurants: getCollection(state[ext()].allRestaurants, state)\n  }),\n  { navigateTo, find }\n)(\n  connectStyle(ext('List'))(List)\n);\n```\n\nAs you can see, `connectStyle` takes the same format as the `connect` method from Redux. Notice that we added the extension prefix to the component name. While not necessary, it's a good practice to prevent namespace collisions.\n\nOk, we've added style from theme to the component, but we haven't implemented those styling rules in the theme, so lets modify our theme.\n\n## Modifying Themes\n\nWe created a theme file (`app/themes/restaurant.js`) with a Rubicon template. Since a Shoutem app can only have 1 theme applied at a time, it's a good practice to include styling rules for the components usually used in Shoutem extensions, such as the ones from `@shoutem/ui`.\n\nThe theme file is **huge** and it won't be pasted into the code snippet here fully. Just search for the `export default` statement which exports theme functions. In `return`, add the agreed styling rules:\n  - make titles bigger in restaurant rows\n  - change the background color of subtitles to white\n  - change the subtitle color to black\n\nImport the `ext` function and add the following styling rules to the beginning of the exported object:\n\n```JavaScript{3,14-22}\n#file: app/themes/restaurant.js\n// other imports ...\n\nimport { ext } from '../const';\n\n// exports and constants ...\n\nexport default (customVariables = {}) => {\n  const variables = {\n    ...defaultThemeVariables,\n    ...customVariables,\n  };\n\n  return _.merge({}, getTheme(variables), {\n    [ext('List')]: {\n      title: {\n        fontSize: 25,\n      },\n      subtitle: {\n        color: 'black',\n        backgroundColor: 'white'\n      }\n    },\n    // the rest of the styling rules...\n})\n```\n\nStyling props for `Text` components are documented in [React Native documentation](https://facebook.github.io/react-native/docs/text.html).\n\nGreat! Push the extension now.\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nNow open the app in the Builder preview.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/style-tab-themes-customize_theme-font.png'/>\n</p>\n\nThis is good, but what if we got a request from people using our theme that they want to be able to modify subtitle text color? We can do that with variables, so they don't have to even leave the Builder.\n\n## Customizing Themes with Variables\n\nExposes variables and defines UI editor types to edit these variables.\n\nTo enable customization of themes, we use the theme variables schema. The schema was already created when we added the theme to the project. It's the `server/themes/restaurantVariables.json` file. We use it to define the UI editor for adjusting theme variables used in styling rules, which gives Shoutem the information about which variables and their formats are being used for the theme. The full schema reference can be found [here]({{ site.url }}/docs/extensions/reference/theme-variables).\n\nOpen the `Style` tab and choose `Customize theme`. You can see that theme variables are grouped into sections. Under `properties`, add a new variable with a `color` format, where `black` is the default value. Afterwards, reference that variable in `layout.sections` so it's included in the interface. We'll create a new section for that.\n\n```JSON{3-7,13-15}\n#file: server/themes/restaurantVariables.json\n{\n  \"properties\": {\n    \"subtitleColor\": {\n      \"type\": \"string\",\n      \"format\": \"color\",\n      \"title\": \"Subtitle color\",\n      \"default\": \"black\"\n    },\n    // other variables\n  },\n  \"layout\": {\n    \"sections\": [{\n      \"title\": \"Restaurants\",\n      \"properties\": [\"subtitleColor\"]\n    }, {\n      // other sections\n    }]\n  }\n}\n```\n\nThe only thing left to do is to use this variable in the theme file. Again, search for the `export default` statement:\n\n```JavaScript{13}\n#file: app/themes/restaurant.js\nexport default (customVariables = {}) => {\n  const variables = {\n    ...defaultThemeVariables,\n    ...customVariables,\n  };\n\n  return _.merge({}, getTheme(variables), {\n    [ext('List')]: {\n      title: {\n        fontSize: 25,\n      },\n      subtitle: {\n        color: 'black',\n        backgroundColor: 'white'\n      }\n    },\n    // the rest of the styling rules...\n})\n```\n\nYou're done! Push the extension that contains your theme to Shoutem.\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\nCheck `Customize theme` under the `Style` tab. You can see the `Restaurants` section with a color picker for subtitle text color. Well done!\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/style-tab-themes-customise_theme-color_picker_preview.png'/>\n</p>\n\n## Adding a Custom Font\n\nIn order to add a custom font to a theme, you'll have to add a `fonts` folder to your extension's `app` folder and add your custom fonts to it in `.TTF` format. You can see this structure in our [Rubicon theme](https://github.com/shoutem/extensions/tree/master/shoutem-rubicon-theme/app/fonts) extension. For the purpose of this tutorial you can use the [Roboto font](https://www.fontsquirrel.com/fonts/roboto).\n\nThese fonts also have to be linked into the app's binary as [assets](https://github.com/rnpm/rnpm#advanced-usage) using [`rnmp`](https://github.com/rnpm/rnpm). You do this by adding the following to your extension's `app/package.json` file:\n\n```JSON{5-9}\n#file: app/package.json\n{\n  \"name\": \"{{site.example.devName}}.restaurants\",\n  \"version\": \"0.0.1\",\n  \"description\": \"My first extension.\",\n  \"rnpm\": {\n    \"assets\": [\n      \"fonts\"\n    ]\n  }\n}\n```\n\n> #### Note\n> In the above code snippet, `fonts` is the name of the folder: `app/fonts`.\n\nIn order to be able to choose the font you've added through the Builder, it has to also be added to your theme's variables in the `server/themes/restaurantVariables.json` file. The custom font we've provided you with is called `Roboto` and we'll be using the `Roboto-Regular` version if it.\n\n```JSON{7}\n#file: server/themes/restaurantVariables.json\n\"fontFamily\": {\n  \"enum\": [\n    \"Rubik-Regular\",\n    \"NotoSans\",\n    \"NotoSerif\",\n    \"MuktaVaani-Regular\",\n    \"Roboto-Regular\"\n  ]\n},\n```\n\nAfter that, you can _push_ your extension to update the changes you've made on the Builder. After choosing your newly created theme you will be able to use the custom font you added:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/custom-font.png'/>\n</p>\n\nHowever, you won't be able to preview these changes in the Builder. This is because fonts are linked into the binary of the app, while the Builder previews as a predefined binary and only previews JavaScript bundle changes. So to be able to preview this you'll have to set up your local development environment so the custom font is linked into the local binary. You can find out how to do that [here]({{ site.url }}/docs/extensions/tutorials/setting-local-environment).\n\n> #### Note\n> If your theme extension is already inside a _cloned_ app for local development, you will have to re-clone the app. Make sure you push all your local changes before cloning again!\n\nHere you can see the difference between `Noto Serif` (left), a font included in our default theme, and our example custom font `Roboto Regular` (right):\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/custom-font-difference.png'/>\n</p>\n\n## Adding a Custom Icon to the Builder\n\nIcons in the Builder are used to customize your app's icons in the Main navigation's different layouts:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/main-navigation-icons.png'/>\n</p>\n\nWhen creating an app, you may want to use your own custom icon for the Main navigation, for instance you want to add a restaurant related icon for your Restaurants extension's screen.\n\nThere's two ways you can do this:\n- uploading your own icon to that app through the Builder\n  - makes the icon available to only that app\n- adding that icon to your own custom theme\n  - makes the icon available to any app with the theme extension installed and activated\n\n### 1) Uploading an icon to the Builder\n\nTo do this, simply click on the icon you want to change to open the modal window in which you can choose the icon you want to use. You'll notice there's two categories: `Theme icons` and `My icons`.\n\nAfter selecting `My icons` you can see the list of icons you uploaded for that specific app. The disadvantage of using this method is that the icon will only exist for that app, while your extension might be installed in multiple apps.\n\nThe `Theme icons` category refers to the icons from different themes. You can find out which icons are offered in our Rubicon theme [here](https://github.com/shoutem/extensions/tree/master/shoutem-rubicon-theme/server/assets/icons).\n\n### 2) Adding an icon to your custom theme\n\nIn order to add a custom icon to a theme, you'll have to create a `server/assets/icons` directory inside your extension's directory:\n\n```ShellSession\n$ cd server\n$ mkdir assets/icons\n```\n\nAnd then add your custom icon to it. The reason we use the server folder is because this is utilized by the server side, i.e. the Builder. You can see this structure in our [Rubicon theme](https://github.com/shoutem/extensions/tree/master/shoutem-rubicon-theme/server/assets/icons).\n\nThe icon you add should be a `.png` and `48x48` resolution. In this example tutorial we'll use the previously mentioned restaurant related icon, a plate and utensils.\n\nAfter creating the directory and adding your custom icon to it you have to modify the `extension.json` file to include icons:\n\n```JSON{6}\n#file: extension.json\n\"themes\": [{\n  \"name\": \"restaurant\",\n  \"title\": \"Restaurant\",\n  \"variables\": \"@.restaurant\"\n  \"description\": \"Awesome restaurant theme!\",\n  \"icons\": \"server/assets/icons/\",\n  \"showcase\": [\n    \"server/assets/list.png\",\n    \"server/assets/details.png\"\n  ]\n}],\n```\n\nYou can see this in our [Rubicon theme](https://github.com/shoutem/extensions/blob/master/shoutem-rubicon-theme/extension.json).\n\nNow you can simply _push_ to update your extension on Shoutem and once you open your Restaurants app in the Builder and check the Main navigation icons you can see your new icon under the `Theme icons` category.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/settings-theme/custom-icon.png'/>\n</p>\n\nThe other icons you see are a copy of the icons provided by the [Rubicon theme](https://github.com/shoutem/extensions/tree/master/shoutem-rubicon-theme/server/assets/icons), because, like we said, when you create a custom theme you're making a copy of Rubicon.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-03-ScreenLayouts.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/screen-layouts\ntitle: Screen Layouts\nsection: Tutorials\n---\n\n# Screen Layouts\n<hr />\n\nEach screen can have multiple layouts. App owners can choose which screen layout they want to use in their app (e.g. for news from politics they might want to use a layout with smaller images, and for fashion they might want large images). As screen layouts are just plain screens, they can contain different logic than the screen they are altering and can be easily used for A/B testing.\n\nWe’ll create a different layout in the **Restaurants** extension from the [My First Extension]({{ site.url }}/docs/extensions/my-first-extension/introduction) tutorial, which you can [get here](https://github.com/shoutem/extension-examples/tree/master/tom.restaurants-getting-started). The Restaurants extension has a `List` screen (for listing all the restaurants) and a `Details` screen (for details of one particular restaurant).\n\nLet’s add one additional screen that will represent an alternative layout for the `List` screen where we'll use smaller images as shown here:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/screen-layouts/list-small.png'/>\n</p>\n\nSwitch over to the extension folder:\n\n```ShellSession\n$ cd {{ site.example.devName }}.{{ site.example.extensionName }}\n```\n\nCreate an additional screen:\n\n```ShellSession\n$ shoutem screen add SmallList\n? Screen name: SmallList\n? Create a shortcut (so that screen can be added through the Builder)? No\nSuccess\n```\n\nAgain, notice how we didn't create a Shortcut. That's because SmallList isn't the starting screen of the extension, `List` is. Now extend the `List` screen and override its `renderRow` method. We're going to use the `Row` component from [UI toolkit]({{ site.url }}/docs/ui-toolkit/components/rows). This is the complete code for `SmallList.js` file with the main parts being highlighted.\n\n```javascript{15-17,27-50}\n#file: app/screens/SmallList.js\nimport React from 'react';\nimport { TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\n\nimport { navigateTo } from 'shoutem.navigation';\n\nimport {\n  find,\n  getCollection\n} from '@shoutem/redux-io';\nimport {\n  Image,\n  Row,\n  View,\n  Subtitle,\n  Caption,\n  Divider,\n  Icon\n} from '@shoutem/ui';\n\nimport { List } from './List';\nimport { ext } from '../extension';\n\nexport class SmallList extends List {\n\n  // overriding the renderRow function\n  renderRow(restaurant) {\n    const { navigateTo } = this.props;\n\n    return (\n      <TouchableOpacity onPress={() => navigateTo({\n          screen: ext('Details'),\n          props: { restaurant }\n        })}>\n        <Row>\n          <Image style={% raw %}{{{% endraw %}width:90, height:70}} source={% raw %}{{{% endraw %} uri: restaurant.image && restaurant.image.url }} />\n          <View styleName=\"vertical\">\n            <Subtitle>{restaurant.name}</Subtitle>\n            <Caption>{restaurant.address}</Caption>\n          </View>\n          <Icon name=\"right-arrow\" styleName=\"disclosure\"/>\n        </Row>\n        <Divider styleName=\"line\" />\n      </TouchableOpacity>\n    );\n  }\n}\n\nexport default connect(\n    (state) => ({\n    restaurants: getCollection(state[ext()].allRestaurants, state)\n  }),\n  { navigateTo, find }\n)(SmallList);\n```\n\nThe Restaurants extension uses `CMS settings page`, so app owners can manage data in the app. We need to give them option to chose which layout they want to use. To do that, we're going to use the `layout settings page` from the [shoutem-layouts](https://github.com/shoutem/extensions/tree/master/shoutem-layouts) extension.\n\nThe layout settings page resolves which screens have multiple layouts and shows the `layout selectors` for them. Example of two layout selectors for Shoutem's News RSS extension is shown below.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/screen-layouts/news-rss-layouts.png'/>\n</p>\n\nFor the layout settings page to be able to resolve which screens should show layout selectors, we need to add the `extends` property to screens which act as additional layouts, referencing the \"default\" layout. Screen layouts inherit all the properties from extending screens and can override them.\n\nReference the layout settings page in the `adminPages` shortcut and extend the screens in `extension.json`.\n\n```JSON{9-10,15-17,30-33}\n#file: extension.json\n{\n  \"name\": \"restaurants\",\n  \"version\": \"0.0.1\",\n  \"platform\": \"1.0.*\",\n  \"title\": \"Restaurants\",\n  \"description\": \"List of restaurants\",\n  \"screens\": [{\n    \"name\": \"List\",\n    \"title\": \"List with large images\",\n    \"image\": \"./server/assets/large-image-list.png\"\n  }, {\n    \"name\": \"Details\"\n  }, {\n    \"name\": \"SmallList\",\n    \"title\": \"List with small images\",\n    \"image\": \"./server/assets/small-image-list.png\",\n    \"extends\": \"@.List\"\n  }],\n  \"shortcuts\": [{\n    \"name\": \"Restaurants\",\n    \"title\": \"Restaurants\",\n    \"description\": \"Allow users to browse through list of restaurants\",\n    \"screen\": \"@.List\",\n    \"adminPages\": [{\n      \"page\": \"shoutem.cms.CmsPage\",\n      \"title\": \"Content\",\n      \"parameters\": {\n        \"schema\": \"@.Restaurants\"\n      }\n    }, {\n      \"page\": \"shoutem.layouts.LayoutPage\",\n      \"title\": \"Layout\"\n    }]\n  }],\n  \"dataSchemas\": [{\n    \"name\": \"Restaurants\",\n    \"path\": \"server/data-schemas/Restaurants.json\"\n  }]\n}\n```\n\nWe also included additional properties like `title` and `image` to screens which will be shown in the layout selector, so they look nicer. [Download this file]({{ site.url }}/static/screen-layouts/assets.zip). It includes screen images that we can use as a preview of the layout in the layout selector. Extract the folder and place it in the `server` folder of the extension. Here you can find the [list]({{ site.url }}/docs/extensions/reference/extension) of all available properties in `extension.json`.\n\nIf we wanted to show a layout selector for `Details` screen, we would need to add a `navigatesTo` property to the `List` screen. That way, the layout settings page could calculate the screen hierarchy starting from the screen referenced in the shortcut. An example of this can be found in the [extension.json](https://github.com/shoutem/extensions/blob/master/shoutem-rss-news/extension.json) file of Shoutem's News RSS extension.\n\nOk, now you're done! Let's push the extension.\n\n```ShellSession\n$ shoutem push\nUploading `Restaurants` extension to Shoutem...\nSuccess!\n```\n\n> #### Note\n> If you don't have this extension installed on any app, you can install with `shoutem install`. Add the screen through the builder, add a few CMS items (Restaurants), as described in [Using cloud storage]({{ site.url }}/docs/extensions/my-first-extension/using-cloud-storage), and run the preview. If you don't have any restaurants added, you won't see anything in the preview.\n\nBy default, the layout will be the `List` screen. Switch to `Layout` and select **List with small images**. This is the result you should get:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/screen-layouts/restaurants-small-list.png'/>\n</p>\n\nGreat job! Now you know how to create additional layouts for your extension.\n\nSince we built this extension, we can add additional layouts to it directly. However, sometimes we want to add additional layouts for extensions from another developer - essentially we want to modify the extensions. You can find out how to do this in the [Modifying Extensions]({{ site.url }}/docs/extensions/tutorials/modifying-extensions) tutorial.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-04-WritingReactSettingsPage.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/writing-react-settings-page\ntitle: Writing React settings pages\nsection: Tutorials\n---\n\n# Writing a React settings page\n\nIn this tutorial, we'll show you how to create React Settings pages for both shortcut settings and extension settings pages.\n\n## Shortcut settings pages\n\nFirst, let's make an extension to work with. We'll make a simple `Hello World!` example so we can easily cover the basic concepts.\n\n```ShellSession\n$ shoutem init react-hello-world\nEnter information about your extension. Press `return` to accept (default) values.\n? Title React Hello World\n? Version 0.0.1\n? Description Learning React settings pages.\n...\nExtension initialized.\n```\n\nWe need to add a screen with a shortcut, so we have a shortcut to add settings pages to. Locate to the extension folder:\n\n```ShellSession\ncd {{ site.example.devName }}.html-hello-world\n```\n\nAnd add the screen:\n\n```ShellSession\n$ shoutem screen add Hello\n? Screen name: Hello\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: Hello\n? Shortcut title: Hello\n? Shortcut description: A shortcut for Hello\n...\nSuccess\n```\n\nNow let's create the actual settings page:\n\n```ShellSession\n$ shoutem page add HelloWorldShortcutPage\n? Page type: react\n? Page name: HelloWorldShortcutPage\n? Page title: Hello World Shortcut Page\n? This settings page controls settings for: an existing screen\n? Select existing screen: Hello\n...\nReact settings page added to pages/hello-world-shortcut-page\n```\n\n`HelloWorldShortcutPage` was also added to `extension.json` as an `adminPage` of the `Hello` shortcut and as one of the `pages` of the extension:\n\n```JSON\n#file: extension.json\n\"shortcuts\": [\n  {\n    \"name\": \"Hello\",\n    \"title\": \"Hello\",\n    \"description\": \"A shortcut for Hello\",\n    \"screen\": \"@.Hello\",\n    \"adminPages\": [\n      {\n        \"page\": \"@.HelloWorldShortcutPage\",\n        \"title\": \"Hello World Shortcut Page\"\n      }\n    ]\n  }\n],\n\"pages\": [\n  {\n    \"name\": \"HelloWorldShortcutPage\",\n    \"type\": \"react-page\"\n  }\n]\n```\n\nThis is the `server` folder structure:\n\n```\nserver/\n| bin/\n├ node_modules/\n├ src\n|   ├ pages/\n|   |  └ hello-world-shortcut-page\n|   |    ├ index.js\n|   |    ├ HelloWorldShortcutPage.jsx\n|   |    └ style.css\n|   ├ const.js\n|   ├ extension.js\n|   └ index.js\n└ package.json\n```\n\nIt contains `bin` and `src` folders. The `bin` folder holds core react settings pages code and the webpack config, there shouldn't be any need to modify it. The `src` folder contains your extension's settings pages code divided into separate folders inside the `pages` folder. It also contains the `index.js` file where you export extension functionalities, and the `extension.js` file which is managed by the Shoutem CLI.\n\nAs you can see, `HelloWorldShortcutPage` is added under `src/pages/hello-world-shortcut-page` folder. Inside is a React component `HelloWorldShortcutPage.jsx` that implements a shortcut settings page. It's a starting template that shows you how to manage shortcut settings with a simple input field.\n\nThe template contains ordinary React lib with an addition of Shoutem libraries.\n\n```JS\n#file: server/src/pages/hello-world-shortcut-page/HelloWorldShortcutPage.jsx\nimport React, { Component, PropTypes } from 'react';\nimport {\n  Button,\n  ButtonToolbar,\n  ControlLabel,\n  FormControl,\n  FormGroup,\n  HelpBlock,\n} from 'react-bootstrap';\nimport { LoaderContainer } from '@shoutem/react-web-ui';\nimport {\n  fetchShortcut,\n  updateShortcutSettings,\n  getShortcut,\n} from '@shoutem/redux-api-sdk';\nimport { shouldRefresh } from '@shoutem/redux-io';\nimport { connect } from 'react-redux';\nimport './style.scss';\n```\n\nIt uses:\n- @shoutem/react-web-ui - customized Bootstrap to Shoutem theme and contains useful React components\n- @shoutem/redux-api-sdk - official Shoutem API SDK that exports Redux actions, selectors and reducers which enable managing of Shoutem resources with React and Redux\n    - `fetchShortcut(shortcutId)` - action for fetching shortcut resource\n    - `updateShortcutSettings(shortcut, settingsPatch)` - action for updating shortcut settings resource\n    - `getShortcut(state, shortcutId)` - selector for selecting shortcut from state     \n- @shoutem/redux-io - library for data management of network data in redux and ease of data use in react\n- ./style.scss - style file used for custom styling of the settings page\n\nBefore diving into an explanation of the `HelloWorldShortcutPage` React component, let's see what it receives in props. It receives `props` passed from the parent core component and from `connect` that binds React component to the Redux store.\n\n```JavaScript\n#file: server/pages/hello-world-shortcut-page/HelloWorldShortcutPage.jsx\nfunction mapStateToProps(state, ownProps) {\n  const { shortcutId } = ownProps;\n\n  return {\n    shortcut: getShortcut(state, shortcutId),\n  };\n}\n\nfunction mapDispatchToProps(dispatch, ownProps) {\n  const { shortcutId } = ownProps;\n\n  return {\n    fetchShortcut: () => dispatch(fetchShortcut(shortcutId)),\n    updateShortcutSettings: (shortcut, settings) => (\n      dispatch(updateShortcutSettings(shortcut, settings))\n    ),\n  };\n}\n\nexport default connect(mapStateToProps, mapDispatchToProps)(HelloWorldShortcutPage);\n```\n\nThe parent component passes a scope of information to the settings page depending on the context in which the settings page is rendered. Basically, it passes `extensionName, shortcutId, screenId` and `parameters` from extension definition. In `mapStateToProps` and `mapDispatchToProps` we prepare props for managing `shortcut` resources and you are open to add your props as you would in typical React development.\n\nNow we can focus on the `HelloWorldShortcutPage` React component that contains the same concepts as any other React component. Particularly, the component renders an input field and a Save button for managing a greeting in shortcut settings.\n\n```JavaScript\n#file: server/pages/hello-world-shortcut-page/HelloWorldShortcutPage.jsx\nclass HelloWorldShortcutPage extends Component {\n  static propTypes = {\n    shortcut: PropTypes.object,\n    fetchShortcut: PropTypes.func,\n    updateShortcutSettings: PropTypes.func,\n  };\n\n  constructor(props) {\n    super(props);\n\n    this.handleTextChange = this.handleTextChange.bind(this);\n    this.handleSave = this.handleSave.bind(this);\n    this.handleSubmit = this.handleSubmit.bind(this);\n\n    props.fetchShortcut();\n\n    this.state = {\n      error: null,\n      greeting: _.get(props.shortcut, 'settings.greeting'),\n      // flag indicating if value in input field is changed\n      hasChanges: false,\n    };\n  }\n\n  componentWillReceiveProps(nextProps) {\n    const { shortcut } = this.props;\n    const { shortcut: nextShortcut } = nextProps;\n    const { greeting } = this.state;\n\n    if (_.isEmpty(greeting)) {\n      this.setState({\n        greeting: _.get(nextShortcut, 'settings.greeting'),\n      });\n    }\n\n    if (shortcut !== nextShortcut && shouldRefresh(nextShortcut)) {\n      this.props.fetchShortcut();\n    }\n  }\n\n  handleTextChange(event) {\n    this.setState({\n      greeting: event.target.value,\n      hasChanges: true,\n    });\n  }\n\n  handleSubmit(event) {\n    event.preventDefault();\n    this.handleSave();\n  }\n\n  handleSave() {\n    const { shortcut } = this.props;\n    const { greeting } = this.state;\n\n    this.setState({ error: '', inProgress: true });\n    this.props.updateShortcutSettings(shortcut, { greeting })\n      .then(() => (\n        this.setState({ hasChanges: false, inProgress: false })\n      )).catch((err) => {\n        this.setState({ error: err, inProgress: false });\n      });\n  }\n\n  render() {\n    const { error, hasChanges, inProgress, greeting } = this.state;\n\n    return (\n      <div className=\"hello-page settings-page\">\n        <form onSubmit={this.handleSubmit}>\n          <FormGroup>\n            <h3>Choose your greeting</h3>\n            <ControlLabel>Name:</ControlLabel>\n            <FormControl\n              type=\"text\"\n              className=\"form-control\"\n              value={greeting}\n              onChange={this.handleTextChange}\n            />\n          </FormGroup>\n          {error &&\n            <HelpBlock className=\"text-error\">{error}</HelpBlock>\n          }\n        </form>\n        <ButtonToolbar>\n          <Button\n            bsStyle=\"primary\"\n            disabled={!hasChanges}\n            onClick={this.handleSave}\n          >\n            <LoaderContainer isLoading={inProgress}>\n              Save\n            </LoaderContainer>\n          </Button>\n        </ButtonToolbar>\n      </div>\n    );\n  }\n}\n```\n\nYou will notice how we trigger shortcut loading, reading the greeting value and updating it on Shoutem API once the user clicks the Save button. You are free to customize it in any way you need, implementing new React components and importing them into this file.\n\nThis page is now created and referenced in the `Hello` shortcut in `extension.json`. Let's add our `greeting` setting to it and give it a default value:\n\n```json{12-14}\n#file: extension.json\n\"shortcuts\": [\n  {\n    \"name\": \"Hello\",\n    \"title\": \"Hello\",\n    \"description\": \"A shortcut for Hello\",\n    \"screen\": \"@.Hello\",\n    \"adminPages\": [\n      {\n        \"page\": \"@.HelloWorldShortcutPage\",\n        \"title\": \"Hello World Shortcut Page\"\n      }\n    ],\n    \"settings\": {\n      \"greeting\": \"Tom\"\n    }\n  }\n]\n```\n\n### Accessing the shortcut settings in the application\n\nThe Shoutem CLI implemented the shortcut settings page into our pre-existing shortcut, all that is left to do is to access the settings in the `Hello` screen. Update the screen file:\n\n```JS{3-4,8}\n#file: app/screens/Hello.js\nexport default class Hello extends Component {\n  render() {\n    const { shortcut } = this.props;\n    const { greeting } = shortcut.settings;\n\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Hello {greeting}!</Text>\n      </View>\n    );\n  }\n}\n```\n\nNow let's publish and install the extension.\n\n```ShellSession\n$ shoutem push\nUploading React Hello World extension to Shoutem...\nSuccess!\n```\n```ShellSession\n$ shoutem install --new \"React Hello World\"\nExtension installed\nSee it in browser: {{ site.shoutem.builderURL }}/{{ site.example.appId }}\n```\n\nOur default setting applies and the app owner has an input form to change the `greeting` value.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/writting-settings-page/hello-tom.png'/>\n</p>\n\n## Extension settings pages\n\nExtension settings pages provide you with settings that you can pass to every part of the extension, so in our simple use case, we'll suppose the extension settings page lets the app owner determine which company the person being greeted is working for, as you can see from the input form.\n\nThe key difference between extension and shortcut settings pages is where they're defined in the `extension.json`. They're defined on the same level as `shortcuts` and `pages`. Let's create an extension settings page.\n\n```ShellSession\n$ shoutem page add\n? Page type: react\n? Page name: HelloWorldExtensionPage\n? Page title: Hello World Extension Page\n? This settings page controls setting sfor: the 'react-hello-world' extension\n...\nReact settings page added to pages/hello-world-extension-page\n```\n\nThe CLI added `HelloWorldExtensionPage` to the root level of `extension.json`, but let's add a default value.\n\n```json\n#file: extension.json\n\"settingsPages\": [\n  {\n    \"page\": \"@.HelloWorldExtensionPage\",\n    \"title\": \"Hello World Extension Page\"\n  }\n],\n\"settings\": {\n  \"company\": \"Shoutem\"\n}\n```\n\nThe template page generated is pretty much identical to the one generated for `HelloWorldShortcutPage`, referencing `extension` instead of `shortcut` throughout it and using `company` instead of `greeting`.\n\n```JavaScript\n#file: server/src/pages/hello-world-extension-page.jsx\nimport {\n  fetchExtension,\n  updateExtensionSettings,\n  getExtension,\n} from '@shoutem/redux-api-sdk';\n```\n\n```JavaScript{2-3,7}\n#file: server/src/pages/hello-world-extension-page.jsx\n<FormGroup>\n  <h3>Enter company name</h3>\n  <ControlLabel>Company:</ControlLabel>\n  <FormControl\n    type=\"text\"\n    className=\"form-control\"\n    value={company}\n    onChange={this.handleTextChange}\n  />\n</FormGroup>\n```\n\nIn order to access the extension settings from the actual app, we have to `connect` to the redux state, which means we have to add certain imports as well as use `mapStateToProps`. This is also included in the boilerplate.\n\n```JavaScript\nfunction mapStateToProps(state, ownProps) {\n  const { extensionName } = ownProps;\n\n  return {\n    extension: getExtension(state, extensionName),\n  };\n}\n\nfunction mapDispatchToProps(dispatch, ownProps) {\n  const { extensionName } = ownProps;\n\n  return {\n    fetchExtension: () => dispatch(fetchExtension(extensionName)),\n    updateExtensionSettings: (extension, settings) => (\n      dispatch(updateExtensionSettings(extension, settings))\n    ),\n  };\n}\n\nexport default connect(mapStateToProps, mapDispatchToProps)(HelloWorldExtensionPage);\n```\n\nLet's retrieve that `company` value from the redux store and use it in our `Hello` screen.\n\n```JavaScript{11-15,19,25,42-53}\n#file: app/screens/Hello.js\nimport React, {\n  Component\n} from 'react';\n\nimport {\n  StyleSheet,\n  Text,\n  View\n} from 'react-native';\n\nimport { connect } from 'react-redux';\nimport { connectStyle } from '@shoutem/theme';\nimport _ from 'lodash';\nimport { getExtensionSettings } from 'shoutem.application';\nimport { ext } from '../const';\n\nexport class Greeting extends Component {\n  render() {\n    const { shortcut, company } = this.props;\n    const { greeting } = shortcut.settings;\n\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Hello {greeting}!</Text>\n        <Text style={styles.text}>You work for {company}.</Text>\n      </View>\n    );\n  }\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n  },\n  text: {\n    fontSize: 20,\n  },\n});\n\nexport const mapStateToProps = (state) => {\n  const extensionSettings = getExtensionSettings(state, ext());\n  const company = _.get(extensionSettings, 'company');\n\n  return {\n    company\n  };\n};\n\nexport default connect(mapStateToProps, undefined)(\n  connectStyle(ext('Greeting'))(Greeting),\n);\n```\n\nFinally, let's push the new version of our `react-hello-world` extension that we've made to Shoutem and see our extension settings page in action.\n\n```ShellSession\n$ shoutem push\nUploading React Hello World extension to Shoutem...\nSuccess!\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/writting-settings-page/hello-tom-shoutem.png'/>\n</p>\n\nSo what's the purpose of extension settings pages as opposed to shortcut? Well, in our simple example, we made an extension where the app owner can define which company he's addressing and then make each Screen he adds on the Builder greet a unique employee. Each screen added will address the company defined in the Extension settings pages, while the app owner can choose which employee each screen greets.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-05-Installing3rdPartyPackages.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/installing-3rd-party-packages\ntitle: Installing 3rd Party Packages\nsection: Tutorials\n---\n\n# Installing 3rd Party Packages\n<hr />\n\nSince Shoutem is an architecture built on top of React Native and we made sure not to restrict developers on how to use React Native, it's of course possible to utilize any and all 3rd party packages that you would be able to use with your regular React Native projects.\n\nThis tutorial will show you how to install a 3rd party package into an extension and through that into the entire app. For an example we're going to use [react-native-swiper](https://github.com/leecade/react-native-swiper) as a non-native package and [react-native-camera](https://github.com/lwansbrough/react-native-camera) as a native package.\n\n## 1) Installing a non-native Package\n\nA non-native package doesn't utilize native capabilities of the underlying device. Simply put, the package doesn't handle anything differently regardless of the fact it's being run on iOS or Android. When you finish this tutorial you'll have a functioning `swiper-extension`.\n\n### Making an Extension\n\nTo begin, we'll need an extension, so let's just make one. If this is something you don't know how to do yet, you should really go through [My First Extension]({{ site.url }}/docs/extensions/my-first-extension/introduction) to make sure you understand the fundamentals.\n\nWe begin by initializing an extension and writing in the basic information about it.\n\n```ShellSession\n$ shoutem init swiper-extension\nEnter information about your extension. Press `return` to accept (default) values.\nTitle: Swiper Extension\nVersion: 0.0.1\nDescription: Extension that uses react-native-swiper.\n\nInitializing extension:\n...\n\nExtension initialized!\n```\n\nLet's switch over to the extension directory and add a screen with a shortcut that will show the Swiper.\n\n```ShellSession\n$ shoutem screen add SwiperScreen\n? Screen name: SwiperScreen\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: Swiper\n? Shortcut title: Swiper\n? Shortcut description: A shortcut for SwiperScreen\n...\nSuccess\n```\n\n### Installing the Package\n\nAll we have to do is install the package into the extension using `npm install react-native-swiper --save` in the `app` directory:\n\n```ShellSession\n$ cd app\n$ npm install react-native-swiper --save\n{{ site.example.devName }}.swiper-extension@0.0.1 /absolute/path/swiper-extension/app\n└── react-native-swiper@1.5.4\n```\n\n> #### Note\n> The reason we have to install it into the `app` directory is because the the `app` directory is bundled into the full app along with all the other extensions the app uses.\n\nDoing this will automatically add `react-native-swiper` as a dependency in our `app/package.json` file:\n\n```json{5-7}\n#file: app/package.json\n{\n  \"name\": \"{{ site.example.devName }}.not-swiper\",\n  \"version\": \"0.0.1\",\n  \"description\": \"Extension that uses react-native-swiper.\",\n  \"dependencies\": {\n    \"react-native-swiper\": \"^1.5.4\"\n  }\n}\n```\n\nYou can ignore the `node_modules` folder that you can now see in your extension's directory, because it'll be ignored since extensions are packed with `npm pack` before being installed into an app.\n\n### Using the Package\n\nOur extension now has full access to everything `react-native-swiper` has to offer and we can use it just like we would in a normal React Native app, so let's make use of it's simplest example to show how it works. We'll have to edit our `app/screens/SwiperScreen.js` file to use the Swiper by importing the Swiper component, changing the `render();` method to use the Swiper component and making some changes to the `styles` constant so our Swiper component can function properly.\n\n```javascript{11,16-26,32-54}\n#file: app/screens/SwiperScreen.js\nimport React, {\n  Component\n} from 'react';\n\nimport {\n  StyleSheet,\n  Text,\n  View\n} from 'react-native';\n\nimport Swiper from 'react-native-swiper';\n\nexport default class SwiperScreen extends Component {\n  render() {\n    return (\n      <Swiper showsButtons>\n        <View style={styles.slide1}>\n          <Text style={styles.text}>Hello Swiper</Text>\n        </View>\n        <View style={styles.slide2}>\n          <Text style={styles.text}>Beautiful</Text>\n        </View>\n        <View style={styles.slide3}>\n          <Text style={styles.text}>And simple</Text>\n        </View>\n      </Swiper>\n    );\n  }\n}\n\nconst styles = StyleSheet.create({\n  text: {\n    color: '#FFFFFF',\n    fontSize: 30,\n    fontWeight: 'bold',\n  },\n  slide1: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#9DD6EB',\n  },\n  slide2: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#97CAE5',\n  },\n  slide3: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#92BBD9',\n  }\n});\n```\n\nAnd there we go, we implemented `react-native-swiper` into our extension. Now we need to push our extension to the Shoutem server and install it onto an app so we can actually test it out:\n\n```ShellSession\n$ shoutem push\nUploading `Swiper Extension` extension to Shoutem...\nSuccess!\n$ shoutem install --new SwiperApp\nExtension installed\nSee it in browser: `{{ site.shoutem.builderURL }}/app/{{ site.example.appId }}`\n```\n\nOpening the SwiperApp in the Builder will show us an app with no Screens, but since we just installed our Swiper Extension onto the app, we can just add the Swiper screen to it by clicking on the + button next to Screens, going to the Custom category and selecting the Swiper Extension. As soon as it's loaded into the Main Navigation we can preview the app:\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/installing-3rd-party-and-native-packages/swiper-in-preview.png'/>\n</p>\n\n## 2) Installing a Native Package\n\nA native package utilizes native capabilities of the underlying device. When installing such a package we have to make sure we link the native dependencies it has.\n\n## Shoutem Platform with React Native >=0.60 (2.2.0 and higher)\n\nWith the introduction of autolinking, it is now surprisingly easy to add native packages to your app if they support it. Simply add the name of the package into your extension's `app/package.json` under a `nativePackages` property.\n\n```json{8-10}\n#file: app/package.json\n{\n  \"name\": \"{{ site.example.devName }}.qr-reader-extension\",\n  \"version\": \"0.0.1\",\n  \"description\": \"An extension that scans QR codes and displays the encoded information to the user.\",\n  \"dependencies\": {\n    \"react-native-camera\": \"~3.11.0\"\n  },\n  \"nativeDependencies\": [\n    \"react-native-camera\"\n  ]\n}\n```\n\nIf your dependency doesn't support autolinking or you want to manually link it, you can use a `react-native.config.js` file inside of your extension's `app` segment to run a `prelink` or `postlink` hook, as well as disable autolinking for it.\n\n#### NOTE: We strongly recommend upgrading to packages that support autolinking as it will reduce maintenance and the number of bugs or other issues with building your app via Shoutem.\n\nSince extensions are effectively used as npm packages, the `react-native.config.js` file [should reflect this](https://github.com/react-native-community/cli/blob/master/docs/configuration.md#libraries).\n\n```javascript\n#file: app/react-native.config.js\nmodule.exports = {\n  dependency: {\n    platforms: {\n      android: null,\n      ios: null,\n    },\n    hooks: {\n      postlink: 'node ./node_modules/tom.qr-reader-extension/scripts/run.js',\n    },\n  },\n};\n```\n\nWe use a postlink hook because our configuration script will run `react-native link` on any extension with `ios` or `android` directories, as well as if it has any `nativeDependencies` set in it's `package.json` file.\n\nIf you're confused by what the `run.js` script is, please read the section after this one, where it's explained.\n\n## Shoutem platform with React Native <0.60 (2.1.1 and lower)\n\nThis is done using [postinstall scripts](https://docs.npmjs.com/misc/scripts). As an example, we'll be making a QR Code reader that's going to display what the scanned QR code says. To scan a QR code we'll need to use the devices camera, which we'll get access to using `react-native-camera`, a 3rd party package for utilizing device cameras.\n\nWhen you finish this tutorial you'll have a functioning `qr-reader-extension`, like the one from our [extension examples](https://github.com/shoutem/extension-examples).\n\n### Making an Extension\n\nTo begin, we'll need an extension, so let's just make one. If this is something you don't know how to do yet, you should really go through [My First Extension]({{ site.url }}/docs/extensions/my-first-extension/introduction) to make sure you understand the fundamentals.\n\nWe begin by initializing an extension and writing in the basic information about it.\n\n```ShellSession\n$ shoutem init qr-reader-extension\nEnter information about your extension. Press `return` to accept (default) values.\nTitle: QR Reader\nVersion: 0.0.1\nDescription: An extension that scans QR codes and displays the encoded information to the user.\nInitializing extension:\nInstalling packages for server...\n...\n\nExtension initialized.\n```\n\nLet's switch over to the extension directory and add a screen with a shortcut that will be the user interface for our QR Reader.\n\n```ShellSession\n$ shoutem screen add QRReaderScreen\n? Screen name: QRReaderScreen\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: QRReader\n? Shortcut title: QRReader\n? Shortcut description: A shortcut for QRReaderScreen\n...\nSuccess\n```\n\n### Installing the Package\n\nTo make sure the native dependencies are linked, we'll have to make sure our custom postlink script is run by putting it in our `app/package.json` file. `rnpm`'s `postlink` command runs our `app/scripts/run.js` script that we'll explain afterwards.\n\n```json{8-12}\n#file: app/package.json\n{\n  \"name\": \"{{ site.example.devName }}.qr-reader-extension\",\n  \"version\": \"0.0.1\",\n  \"description\": \"An extension that scans QR codes and displays the encoded information to the user.\",\n  \"dependencies\": {\n    \"react-native-camera\": \"1.1.4\"\n  },\n  \"rnpm\": {\n    \"commands\": {\n      \"postlink\": \"node node_modules/{{ site.example.devName }}.qr-reader-extension/scripts/run.js\"\n    }\n  }\n}\n```\n\n> #### Note\n> `rnpm` refers to [React Native Package Manager](https://www.npmjs.com/package/rnpm), used for linking native dependancies in React Native apps. The reason we run it from `node_modules` is because extensions are bundled inside `node_modules` and since our postlink script is inside the extension, it should be run from within `node_modules`.\n\nCreate a `scripts` directory and make the postlink script in it: `app/scripts/run.js`\n\n```ShellSession\n$ touch app/scripts/run.js\n```\n\nUsing the `react-native-link` helper method from the Shoutem platform's `@shoutem/build-tools`, we can easily link the package.\n\n```javascript{1-21}\n#file: app/scripts/run.js\nconst { reactNativeLink } = require('@shoutem/build-tools');\n\nreactNativeLink('react-native-camera');\n```\n\n### Using the Package\n\nOur extension will now have access to everything `react-native-camera` has to offer. For this example we'll edit `app/screens/QRReaderScreen.js` so that it displays an [Alert](https://facebook.github.io/react-native/docs/alert.html) when the camera reads a QR code and the alert message will contain the QR code data.\n\n```javascript{2-4,6-10,12-21,25-28}\n#file: app/screens/QRReaderScreen.js\nimport React, { Component } from 'react';\nimport { Alert } from 'react-native';\nimport Camera from 'react-native-camera';\nimport _ from 'lodash';\n\nexport default class QRReaderScreen extends Component {\n  constructor(props) {\n    super(props);\n    this.onBarCodeRead = this.onBarCodeRead.bind(this);\n  }\n\n  // when camera recognizes a QR code, it will store it's content in 'code'\n  // and then display an alert with the 'code' contents,\n  onBarCodeRead(code) {\n    Alert.alert(\n      'QR Code Detected',\n      code.data,\n      [\n        { text: 'OK, read it.', onPress: () => console.log('User saw QR Code contents.') },\n      ],\n      { cancelable: false },\n    );\n  }\n\n  render() {\n    return (\n      <Camera\n        onBarCodeRead={_.debounce(this.onBarCodeRead, 1000, { leading: true, trailing: false })}\n        style={% raw %}{{{% endraw %} flex: 1 }}\n      />\n    );\n  }\n}\n```\n\nAfter making these changes, we can push the extension to Shoutem and install it in a new app:\n\n```ShellSession\n$ shoutem push\nUploading `QR Reader` extension to Shoutem...\nSuccess!\n$ shoutem install --new QRReader\nExtension installed\nSee it in browser: `{{ site.shoutem.builderURL }}/app/{{ site.example.appId }}`\n```\n\nOpening the QRReader app in the Builder will show us an app with no Screens, but since we just installed our QR Reader Extension onto the app, we can just add the QRReader screen to it by clicking on the + button next to Screens, going to the Custom category and selecting the QR Reader Extension.\n\nThis specific native dependency that we're using (`react-native-camera`) is already linked in the Builder preview binary, so we will be able to preview the there. Once it finishes building and loading our QRReader app, scan a QR code, like [this one](https://upload.wikimedia.org/wikipedia/commons/d/d0/QR_code_for_mobile_English_Wikipedia.svg), which should display the URL to WikiPedia's English mobile main page.\n\nWith any other native dependency, previewing the app through the Builder won't be possible, because of its predefined binary, so instead we have to [preview it locally](http://shoutem.github.io/docs/extensions/tutorials/setting-local-environment) using `react-native run-ios` or `react-native run-android`.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-06-UsingNativeModules.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/using-native-api\ntitle: Using native API\nsection: Tutorials\n---\n\n# Using native API\n\nThis tutorial shows how to easily gain access to native (iOS and Android) APIs in your Shoutem extension. Most of the time when creating extensions, you'll only use React Native writing in JavaScript. However, you can access any API of the underlying platform or a 3rd party native module.\n\nAs an example, we'll show you how we've built a Shopify extension using their [Mobile Buy SDK](https://help.shopify.com/api/sdks/mobile-buy-sdk) for iOS and Android. Although this is an advanced use case, as you follow the tutorial, you'll notice just how easy it was.\n\n> #### Note\n> Before we start, you might want to read the excellent official guides on how to write native modules for [iOS](https://facebook.github.io/react-native/docs/native-modules-ios.html) and [Android](https://facebook.github.io/react-native/docs/native-modules-android.html), since this tutorial relies on these concepts. Make sure you've read [Getting started]({{ site.url }}/docs/extensions/tutorials/getting-started) with Shoutem extensions too.\n\nThere are 3 cases for accessing native APIs from your extension:\n\n1. **Exposing native methods to JavaScript**: This is the simplest case for which you just need to follow the React Native's official guides mentioned above.\n\n2. **Using a 3rd party SDK (e.g. for Shopify or Firebase)**: This is the case we'll describe in more detail.\n  To use the SDK, you'll need to find an existing React Native bridge that already exposes its methods to JavaScript, or create one on your own. The same principles apply when it comes to integrating the bridge with Shoutem.\n\n3. **Requiring mobile permissions (e.g. push notifications, location, etc.)**: You'll need to write a script that modifies the Shoutem application's project files. We're working on a guide on how to do this meanwhile improving the process.\n\n## Creating a Shopify extension\n\n[Shopify](https://www.shopify.com/) lets you create and manage an online store. Merchants all over the world use it to grow their business, and many of them want to have their stores accessible from mobile apps. [Shopify's Mobile Buy SDK](https://help.shopify.com/api/sdks/mobile-buy-sdk) for iOS and Android helps developers integrate a store into an app.\n\nShoutem's Shopify extension lets customers browse and buy products through a mobile app built with Shoutem. All that a store owner needs to do is enter his API key in [extension settings]({{ site.url }}/docs/extensions/reference/settings-types).\n\nThe result of this tutorial is a Shopify store within an app built with Shoutem:\n\n![Shopify extension]({{ site.url }}/img/tutorials/native-modules/shop-in-app.png \"Shopify extension\"){:.docs-component-image}\n\nWe won't go into the detail of managing the store's logic.\n\n## Creating a React Native bridge for Shopify's SDK\n\nTo use Shopify's **_Mobile Buy SDK_** in our JavaScript code, we need to create a React Native bridge. There wasn't one available so we built and open sourced [our own](https://github.com/shoutem/react-native-shopify). When needing to create React Native bridge, you have two options:\n\n1. Embedding the bridge in your extension\n2. Creating the bridge as a separate module and referring to it as a dependency from the extension\n\nLatter is recommended as it keeps your extension focused on consuming the SDK's API, separates responsibilities and lets other developers use your bridge in their projects.\n\n> #### Note\n> Creating a bridge is time-consuming and error-prone process, but there is a great [tool](https://github.com/frostney/react-native-create-library) that helps you use JavaScript with native code.\n\n[Use CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html) the dependency management system for iOS, to install ***Mobile Buy SDK*** for iOS. iOS application will install the native dependency **_Pod_** in their `ios/Pods` folder. To have your bridge see this native code, set its **_Header Search Paths_** in **_Build Settings_** of your bridge's `.xcodeproj`. To reference the application's `Pods` folder from the bridge's `ios` folder, reference the current directory with the `$SRCROOT` variable in XCode, and then refer to the application's `Pods` folder. The result should look like this:\n\n```\n$(SRCROOT)/../../../ios/Pods\n```\n\nSet this path for both the **_Debug_** and **_Release_** builds, and mark it as recursive. The following picture shows how this setting looks like for the Shopify bridge when viewed in XCode:\n\n![Xcode and Header Search Paths]({{ site.url }}/img/tutorials/native-modules/header-search-paths.png \"Xcode and Header search paths\"){:.docs-component-image}\n\n## Including the bridge in our Shopify extension\n\nThere are 3 steps you need to take before using the bridge in your extension.\n\nFirst, add it as a dependency to your extension's `package.json`, in the `app` folder.\n\nThen, [link all the bridge's native code](https://facebook.github.io/react-native/docs/linking-libraries-ios.html) to the end `package.json`. With Shoutem, you do this by using an `rnpm postlink` command in `package.json`. Invoke the `react-native link` command for every native dependency. Shoutem's build process will execute it after it installs all dependencies for all extensions.\n\nThis is how our Shopify extension's `package.json` looks like after these two steps:\n\n```JSON{5-12}\n#file: app/package.json\n{\n  \"name\": \"shoutem.shopify\",\n  \"version\": \"0.0.1\",\n  \"description\": \"Shopify extension\",\n  \"dependencies\": {\n    \"react-native-shopify\": \"0.0.1-alpha.0\"\n  },\n  \"rnpm\": {\n    \"commands\": {\n      \"postlink\": \"react-native link react-native-shopify\"\n    }\n  }\n}\n```\n\nYou can only execute a single command with `rnpm postlink`. For linking more than one native library, use an execution script, as shown below:\n\n```JSON\n#file: app/package.json\n\"postlink\": \"node node_modules/shoutem.shopify/scripts/run.js\"\n```\n\n> #### Note\n> Shoutem installs extensions as node modules. This is why you need to prepend `node_modules/{extension name}` to the script path.\n\nThe Shopify extension uses a React Native library `react-native-search-bar` that wraps the iOS native search bar. Since there are two libraries we need to link, we wrote the following `run` script, which you can change and reuse in your extension:\n\n```JavaScript\nconst exec = require('child_process').execSync;\n\nconst dependenciesToLink = ['react-native-shopify', 'react-native-search-bar'];\n\nconst command = 'react-native link';\n\ndependenciesToLink.forEach((dependency) => {\n  exec(`${command} ${dependency}`);\n});\n```\n> #### Note\n> We used Node's synchronous API because the asynchronous version causes the build to hang forever in some situations.\n\nThe last step is to include the SDKs from Shopify, which do the heavy lifting on the native side.\n\n## Referencing a 3rd party SDK\n\nThe best practice when creating wrappers around native libraries is to let the application itself manage the dependencies. Shoutem extension is a module within a larger Shoutem application which is responsible for dependency management.\n\nOn Android, things are straightforward because you specify native dependencies in `build.gradle` and install them as part of the build process. Native modules for iOS need an extra step but Shoutem makes this easy.\n\nShoutem treats an extension's iOS aspect as a **_Pod_** and lets it specify a `.podspec` file where it can declare its dependencies. At a build time, Shoutem application dynamically includes all native iOS dependencies declared by its extensions in one `Podfile`.\n\nThe example below shows how the Shopify extension declares its **_Mobile Buy SDK_** dependency:\n\n```JSON\n#file: ShoutemShopify.podspec\nPod::Spec.new do |s|\n\n  s.name         = \"ShoutemShopify\"\n  s.version      = \"1.0\"\n  s.summary      = \"A Shopify extension for Shoutem.\"\n\n  s.description  = \"The Shopify extension enables store owners to make money by selling\n                    products in Shoutem applications.\"\n\n  s.homepage     = \"http://www.shoutem.com\"\n  s.platform     = :ios\n\n  s.license      = { :type => \"MIT\" }\n\n  s.author       = \"Shoutem\"\n\n  s.source       = { :path => \"\" }\n\n  s.exclude_files = \"Classes/Exclude\"\n\n  # s.public_header_files = \"Classes/**/*.h\"\n\n  s.dependency  'Mobile-Buy-SDK', '2.2.0'\n\nend\n```\n\nThis is how will the Shoutem application `Podfile` look like after the build process:\n\n```JSON\n#file: Podfile\ntarget 'ShoutemApp' do\n  # Uncomment this line if you're using Swift or would like to use dynamic frameworks\n  use_frameworks!\n\n  pod 'ShoutemShopify', :path => '../node_modules/shoutem.shopify/ShoutemShopify.podspec'\n\n  target 'ShoutemAppTests' do\n    inherit! :search_paths\n    # Pods for testing\n  end\n\nend\n```\n\nAfter you build the application, a native dependency will be available to any bridge that wraps it and thus to JavaScript code.\n\n## Calling the SDK's methods from JavaScript\n\nOnce you have your bridge and its native dependencies installed, you can use it as any other JavaScript module. Let's use Shopify's SDK to fetch shop information and use it in our extension:\n\n```JavaScript\nimport { getExtensionSettings } from 'shoutem.application';\nimport Shopify from 'react-native-shopify';\n\nimport {\n  shopLoaded,\n  shopErrorLoading,\n} from './redux/actionCreators';\n\nimport { ext } from './const';\n\nexport function appDidMount(app) {\n  const store = app.getStore();\n  const { dispatch } = store;\n  const state = store.getState();\n\n  const { store: shopifyStore, apiKey } = getExtensionSettings(state, ext());\n\n  Shopify.initialize(shopifyStore, apiKey);\n\n  return Shopify.getShop()\n  .then(shop) => {\n    dispatch(shopLoaded(collections, shop, tags));\n  })\n  .catch((error) => {\n    console.log(error);\n    dispatch(shopErrorLoading());\n  });\n}\n```\n\n## Requiring user permissions and other advanced use cases\n\nAs mentioned in the introduction, sometimes you'll need to support advanced use cases and change core project files. This can mean changing the application's `xcode.project` or `build.gradle` files, `AndroidManifest.xml`,  or even `AppDelegate` and `MainActivity`. With the help of Node's filesystem modules and 3rd party libraries such as [xcode](https://www.npmjs.com/package/xcode), you can do just about anything.\n\nWe're working on a more developer friendly system for common use cases, which we'll describe in detail. For now, with some Node scripting, you can meet any goal in your custom extension, although with some extra effort.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-07-ModifyingNativeProject.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/modifying-native-project\ntitle: Modifying Root App\nsection: Tutorials\n---\n\n# Modifying Native Project\n\nWhen making an extension with native dependencies, it's often necessary to change properties outside of the extension. One way we address this need using file anchors, which can be used to inject code into files which often need to be modified in order to set up a native dependency.\n\nYou can also affect the native project by creating an `android` and `ios` directory in the extension's app segment, you can read more about that in the [**App segment**]({{ site.url }}/docs/extensions/tutorials/modifying-native-project#app-segment) section.\n\n## Injecting\n\nThis section will elaborate on how to inject code into the native parts of the root app without leaving the extension.\n\n#### Available anchors\n\nThe list of available anchors can be seen in the [platform's helper scripts](https://github.com/shoutem/platform/blob/master/scripts/helpers/const.js).\n\nThe `ANCHORS` object is structured as follows:\n\n```JavaScript\n#file: AppName/scripts/helpers/const.js\nconst ANCHORS = {\n  IOS: {\n    PODFILE: {\n      EXTENSION_DEPENDENCIES: '## <Extension dependencies>',\n      EXTENSION_POSTINSTALL_TARGETS: '## <Extension postinstall targets>',\n    },\n    ...\n  },\n  ANDROID: {\n    MAIN_ACTIVITY: {\n      IMPORT: '//NativeModuleInjectionMark-mainActivity-import',\n      ON_CREATE: '//NativeModuleInjectionMark-mainActivity-onCreate',\n      ON_ACTIVITY_RESULT: '//NativeModuleInjectionMark-mainActivity-onActivityResult',\n      ON_ACTIVITY_RESULT_END: '//NativeModuleInjectionMark-mainActivity-onActivityResult-end',\n    },\n    ...\n  },\n};\n\nmodule.exports = {\n  ANCHORS,\n};\n```\n\n#### 'build' directory structuring\n\n```\nbuild/\n  ├ const.js\n  ├ inject{ExtensionName}{MobileOSName}.js\n  └ index.js\n```\n\nWe can look at the `shoutem.code-push` [extension](https://github.com/shoutem/extensions/tree/master/shoutem.code-push/app/build) as an example.\n\n`const.js` should contain all the plaintext modifications you need to inject, in separate variables, exported as a single object named after your extension, with a structure resembling that of the `ANCHORS` object from `@shoutem/build-tools` seen above in the **Available anchors** section and the platform's `scripts/helpers/const.js` [file](https://github.com/shoutem/platform/blob/master/scripts/helpers/const.js).\n\n```JavaScript\n#file: shoutem.code-push/app/build/const.js\nconst codepush = {\n  ios: {\n    appDelegate: {\n      import: '#import <CodePush/CodePush.h>',\n      oldBundle: appDelegateOldBundle,\n      newBundle: appDelegateNewBundle,\n    },\n    ...\n  },\n  android: {\n    app: {\n      import: 'import com.microsoft.codepush.react.CodePush;',\n      ...\n    },\n  },\n};\n```\n\n`inject{ExtensionName}` should contain the functions which inject the code, one for Android and one for iOS, named `injectCodePushAndroid` and `injectCodePushIos`, respectively.\n\n```JavaScript\n#file: shoutem.code-push/app/build/injectCodePush.js\nconst {\n  ANCHORS,\n  ...\n} = require('@shoutem/build-tools');\nconst { codepush } = require('./const');\n\nfunction injectCodePushAndroid() {\n  // app/build.gradle mods\n  const gradleAppPath = getAppGradlePath({ cwd: projectPath });\n  inject(\n    gradleAppPath,\n    ANCHORS.ANDROID.GRADLE.APP.REACT_GRADLE,\n    codepush.android.app.gradle.codepushGradle,\n  );\n  ...\n}\n\nfunction injectCodePushIos() {\n  const appDelegate = getAppDelegatePath({ cwd: projectPath });\n  inject(appDelegate, ANCHORS.IOS.APP_DELEGATE.IMPORT, codepush.ios.appDelegate.import);\n  replace(appDelegate, codepush.ios.appDelegate.oldBundle, codepush.ios.appDelegate.newBundle);\n  ...\n}\n\nmodule.exports = {\n  injectCodePushAndroid,\n  injectCodePushIos,\n};\n```\n\n`index.js` should contain a single export, a `preBuild` function which will be called in the preBuild step of the `shoutem configure` lifecycle. The preBuild function itself should simply call the functions imported from the `inject{ExtensionName}.js` file.\n\n```JavaScript\n#file: shoutem.code-push/app/build/index.js\nconst { injectCodePushAndroid, injectCodePushIos } = require('./injectCodePush');\n\nexports.preBuild = function preBuild() {\n  injectCodePushAndroid();\n  injectCodePushIos();\n}\n```\n\n#### inject{ExtensionName}{MobileOSName} convention\n\n- name your functions `inject{ExtensionName}{MobileOSName}`\n- start a new block by adding a comment declaring which file is going to be modified\n- assign that file's path to a new const\n- use inject() and/or replace() to apply modifications\n- create another block if more changes are needed\n\nThe following example follows all of the above convention rules.\n\n```JavScript\n// app/settings.properties mods\nconst gradlePropertiesPath = getGradlePropertiesPath({ cwd: projectPath });\ninject(\n  gradlePropertiesPath,\n  ANCHORS.ANDROID.GRADLE.PROPERTIES,\n  codepush.android.app.gradle.codepushKey,\n);\n\n// MainApplication.java mods\nconst mainApplicationPath = getMainApplicationPath({ cwd: projectPath });\ninject(\n  mainApplicationPath,\n  ANCHORS.ANDROID.MAIN_APPLICATION.IMPORT,\n  codepush.android.app.import,\n);\ninject(\n  mainApplicationPath,\n  ANCHORS.ANDROID.MAIN_APPLICATION.RN_HOST_BODY,\n  codepush.android.app.rnHost,\n);\ninject(\n  mainApplicationPath,\n  ANCHORS.ANDROID.MAIN_APPLICATION.GET_PACKAGES,\n  codepush.android.app.getPackages,\n);\n```\n\n#### inject() and replace()\n\nThe `inject()` and `replace()` functions can be used to either inject code at an anchor, or replace content in a specific file. Both functions will check if the code is already injected/replaced before doing so.\n\n**inject()** accepts the following arguments:\n\n- `filePath:` the path to the file that you need to modify\n- `anchor:` position in the file specified in the `ANCHORS` object\n- `contents`: the source code that needs to be injected at anchor position\n\n**replace()** accepts the following arguments:\n\n- `filePath:` the path to the file that you need to modify\n- `oldContent:` the source code to search for in the file\n- `newContent`: the source code that should replace `oldContent` in the file\n\n\n## App segment\n\nAs mentioned in the introduction, another tool provided for modifying the root app with an extension is to define new Android modules using an `android` directory in the app segment of your extension.\n\nFor example, instead of directly modifying the root Android `build.gradle`, you can simply create a `build.gradle` in  the `{{ site.example.devName }}.extension-name/app/android` directory which defines a new Android module for the app. You can see an example in `shoutem.places`, [here](https://github.com/shoutem/extensions/tree/master/shoutem.places/app/android).\n\nFurthermore, unique parts of the Android module are merged from the extension into the app, such as the `AndroidManifest.xml`, also visible in the above `shoutem.places` example. You can read more about manifest merging [here](https://developer.android.com/studio/build/manifest-merge).\n\n```XML\n#file: shoutem.places/app/android/src/main/AndroidManifest.xml\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.shoutem.places\">\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n    <uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>\n</manifest>\n```\n\nThere is no similar method for iOS, however, we've included `Info.plist` merging, so you can create an `{{ site.example.devName }}.extension-name/app/ios` directory and an `Info.plist` file inside of it, which will get merged into the root `Info.plist` by the platform's `merge-info-plists.js` [script](https://github.com/shoutem/platform/blob/master/scripts/merge-info-plists.js) during the app's configuration. An example of this can be seen in the `shoutem.camera` [extension](https://github.com/shoutem/extensions/blob/master/shoutem.camera/app/ios/Info.plist), which adds permissions to the root `Info.plist`.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-08-ModifiyingExtensions.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/modifying-extensions\ntitle: Modifying Extensions\nsection: Tutorials\n---\n\n# Modifying Extensions\n\nShoutem's mission is simple - **do not solve problems that have already been solved**. Quite often apps that we build need common features you've seen numerous times: push notifications, analytics, ads, authentication, RSS readers, eCommerce integrations and so on. This is what extensions are for - just reuse pre-built features.\n\nHowever, for the app to succeed, it needs to be **unique**. Recreating an RSS reader just to make it unique is redundant work. Sometimes, it's enough to customize your app in the dashboard, customize the theme, or [write a new theme]({{ site.url }}/docs/extensions/tutorials/writing-a-theme), but sometimes we need to modify the currently available extensions.\n\nThere are two ways to achieve this:\n\n- 1) Directly modify the extension code - the resulting new extension will **not** get future updates that the original extension gets\n- 2) Extend the extension - new extension will get future updates from the original extension\n\nBoth methods result in a brand new extension. (Yes, even when you _extend_ an extension)\n\n## 1) Directly Modify the Extension Code\n\nSince all Shoutem extensions are [open sourced](https://github.com/shoutem/extensions), you can directly take the code of an extension, modify it and _push_ it as your own extension to Shoutem.\n\nFor the purpose of this demo, create a new blank app and add a **News RSS** screen inside of the navigation. In the **Content** section, enter a link to an RSS feed (e.g. https://www.nasa.gov/rss/dyn/breaking_news.rss). In the **Layout** section, select `List` as the default layout.\n\nThis is what it should look like (images and text vary with RSS feed):\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/modifying-extensions/provided-layouts.png'/>\n</p>\n\nYou do want list layout, but with large images in `Tiles`, such as the ones provided in the [UI toolkit]({{ site.url }}/docs/ui-toolkit/components/tiles). So let's modify News RSS extension directly to get those large images.\n\nDownload the [News RSS extension](https://github.com/shoutem/extensions/tree/master/shoutem-rss-news) from the repository and navigate to the extension's folder:\n\n```ShellSession\n$ cd shoutem.rss-news\n```\n\nCheck the `renderRow` method in `app/screens/ArticlesListScreen.js`:\n\n```javascript\n#file: app/screens/ArticlesListScreen.js\n  renderRow(article) {\n    return (\n      <ListArticleView\n        key={article.id}\n        articleId={article.id}\n        title={article.title}\n        imageUrl={getLeadImageUrl(article)}\n        date={article.timeUpdated}\n        onPress={this.openArticleWithId}\n      />\n    );\n  }\n```\n\nIt uses the `ListArticleView` component. Customize the `render` method in that component to use `Tiles` and don't forget to import additional components from the `@shoutem/ui`. This is the complete code you should end up with:\n\n```JSX{7-8,24,27-30}\n#file: app/components/ListArticleView.js\nimport React from 'react';\nimport moment from 'moment';\n\nimport {\n  TouchableOpacity,\n  Caption,\n  ImageBackground,\n  Tile,\n  Title\n} from '@shoutem/ui';\n\nimport { ListArticleView } from 'shoutem.news/components/ListArticleView';\nimport { getLeadImageUrl } from 'shoutem.rss';\n\nexport class ListArticleView extends ArticleView {\n  render() {\n    const { article } = this.props;\n    const dateFormat = moment(article.timeUpdated).isBefore(0) ?\n    null : (<Caption>{moment(article.timeUpdated).fromNow()}</Caption>);\n\n    return (\n      <TouchableOpacity key={article.id} onPress={this.onPress}>\n        <ImageBackground\n          styleName=\"featured\"\n          source={% raw %}{{{% endraw %} uri: getLeadImageUrl(article) }}\n        >\n          <Tile>\n            <Title styleName=\"md-gutter-bottom\">{article.title}</Title>\n            {dateFormat}\n          </Tile>\n        </ImageBackground>\n      </TouchableOpacity>\n    );\n  }\n}\n```\n\nAnd that's it! Save it and push it to Shoutem:\n\n```ShellSession\n$ shoutem push\nUploading `News RSS` extension to Shoutem...\nSuccess!\n```\n\nInstall it on your app either through the [Builder]({{ site.shoutem.builderURL }})  or with:\n\n```ShellSession\n$ shoutem install\nSelect app to install extension: News App\nSuccess!\n```\n\nDelete the old News RSS screen from the navigation (click on the `...` in the top right corner and select **Delete**), insert the new `News RSS` screen from the `Custom` category, set up your RSS feed in the **Content** tab and select the `List` layout from the **Layout** tab.\n\nThis is what you should get (images and text vary with RSS feed):\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/modifying-extensions/customized-list-layout.png'/>\n</p>\n\nThis is what we wanted! It was quite easy and straightforward. However, doing this means creating a completely separate extension which won't get any updates done by Shoutem on Shoutem's **News RSS** extension.\n\nTo get those updates from Shoutem, we want to extend the extension instead of changing its code directly.\n\n### Debugging directly edited extensions\n\nWhen directly editing Shoutem extensions you will have to either re-clone the app after uploading and installing the extension into your app or re-naming the extension's directory name locally, otherwise you might experience issues on the Builder.\n\n> #### Note\n> When forking (directly editing) Shoutem's extensions, you should re-clone the app after uploading and installing the extension to keep everything in sync.\n\nFor example, you decide to modify the News extension and install it to your app, then uninstall `shoutem.news` so you only have your News extension installed, `{{ site.example.devName }}.news`. This will cause issues with `shoutem.rss-news` because it imports components from `shoutem.news` in multiple places:\n\n```javascript\n#file: shoutem.rss-news/app/ArticlesGridScreen.js\nimport { FeaturedArticleView, GridArticleView } from 'shoutem.news';\n```\n\nIn the described situation, the Builder preview will fail, but locally your app will function as intended. This is because your local extension directory for `{{ site.example.devName }}.news` is still called `shoutem.news`, while the Builder only has `{{ site.example.devName }}.news`. In order to catch these sorts of issues locally, you will have to either rename the extension directory or re-clone the app.\n\n```ShellSession\n$ shoutem clone --dir \"Fresh Clone\"\n```\n\n## 2) Extend the extension\n\nExtending an extension is the preferred way of modifying extensions.\n\n##### When to do it?\n\nFor bigger modifications, such as changing the data schema being used, it's not possible to modify functionality without directly modifying the extension. Extending extensions is usually done for writing screen layouts, extending components (overwriting contents) and such.\n\n##### How to do it?\n\n[Here](https://github.com/shoutem/extension-examples/tree/master/tom.extending-extension) is the open sourced extension as the final result of this chapter. Let's create a new extension:\n\n```ShellSession\n$ shoutem init news-rss\n...\nExtension initialized!\n```\n\nSwitch over to the newly made directory:\n\n```ShellSession\n$ cd {{ site.example.devName }}.news-rss\n```\n\nCreate a new screen which will extend the List screen from the original Shoutem **News RSS** extension:\n\n```ShellSession\n$ shoutem screen add ListWithBigPictures\n? Screen name: ListWithBigPictures\n? Create a shortcut (so that screen can be added through the Builder)? No\nSuccess\n```\n\nNow we need to say which screen our `ListWithBigPictures` screen extends. Do this in `extension.json` in the `extends` field:\n\n```JSON{9-11}\n#file: extension.json\n{\n  \"name\": \"news-rss\",\n  \"title\": \"My news RSS\",\n  \"version\": \"0.0.1\",\n  \"description\": \"\",\n  \"platform\": \"1.*.*\",\n  \"screens\": [{\n    \"name\": \"ListWithBigPictures\",\n    \"title\": \"List with big pictures\",\n    \"image\": \"./server/assets/large-news-list.png\",\n    \"extends\": \"shoutem.rss-news.ArticlesGridScreen\"\n  }]\n}\n```\n\nWe extended `ArticlesGridScreen` from Shoutem's **News RSS** extension, since it's the [original screen](https://github.com/shoutem/extensions/blob/master/shoutem-rss-news/extension.json#L29). We've also added a `title` and `image` which will both be shown in the layout selector. Download the image [here]({{ site.url }}/static/modifying-extension/assets.zip), extract it and paste the `assets` folder into the extension's `server` folder.\n\n> #### Note\n> If you can't remember the fields in `extension.json`, all of them are documented in the [reference]({{ site.url }}/docs/extensions/reference/extension).\n\nLet's implement our `ListWithBigPictures` screen. In `extension.json`, we are extending `ArticlesGridScreen`, but that's only for the layout selector. In the implementation, we actually want to extend the `ArticlesListScreen`. Why? Because  `ArticlesListScreen` renders the `ListArticleView` component from Shoutem **News**.\n\nWhen overriding that method, we could immediately implement the `ListArticleView` functionality inside. However, since we want to get Shoutem's updates for the `ListArticleView` component too, we'll create a new component extending that one and use it in the overridden `renderRow` function.\n\nCreate the `components` folder and a component file inside:\n\n```ShellSession\n$ mkdir app/components\n$ touch app/components/BigPictureView.js\n```\n\nImplement the `BigPictureView` component:\n\n```javascript\n#file: app/components/BigPictureView.js\nimport React from 'react';\nimport moment from 'moment';\n\nimport {\n  TouchableOpacity,\n  Caption,\n  ImageBackground,\n  Tile,\n  Title,\n} from '@shoutem/ui';\n\nimport { ListArticleView } from 'shoutem.news/components/ListArticleView';\nimport { getLeadImageUrl } from 'shoutem.rss';\n\nconst resolveDateCaption = (article) => (\n  moment(article.timeUpdated).isBefore(0) ? null :\n  <Caption>{moment(article.timeUpdated).fromNow()}</Caption>\n);\n\nexport class BigPictureView extends ListArticleView {\n  render() {\n    const { article } = this.props;\n    const dateFormat = resolveDateCaption(article);\n\n    return (\n      <TouchableOpacity key={article.id} onPress={this.onPress}>\n        <ImageBackground\n          styleName=\"featured\"\n          source={% raw %}{{{% endraw %} uri: getLeadImageUrl(article) }}\n        >\n          <Tile>\n            <Title styleName=\"md-gutter-bottom\">{article.title}</Title>\n            {dateFormat}\n          </Tile>\n        </ImageBackground>\n      </TouchableOpacity>\n    );\n  }\n}\n```\n\nWe're importing `ListArticleView` from the `shoutem.news` extension, since the `app` folder is bundled into the overall app.\n\nWe've implemented the new `render` function and deleted everything we didn't need to override from the `ListArticleView` component.\n\nNow, let's override the `renderRow` method in the `ListWithBigPictures` screen:\n\n```javascript\n#file: app/screens/ListWithBigPictures.js\nimport React from 'react';\nimport { connect } from 'react-redux';\nimport { connectStyle } from '@shoutem/theme';\n\nimport {\n  ArticlesListScreen,\n  mapStateToProps,\n  mapDispatchToProps,\n} from 'shoutem.rss-news/screens/ArticlesListScreen';\n\nimport { BigPictureView } from '../components/BigPictureView';\nimport { ext } from '../const';\n\nexport class ListWithBigPictures extends ArticlesListScreen {\n  renderRow(article) {\n    return (\n      <BigPictureView\n        article={article}\n        onPress={this.openArticleWithId}\n        articleId={article.id}\n      />\n    );\n  }\n}\n\n// since the original screen is connected to redux state,\n// we have to reconnect it in our screen too\nexport default connect(mapStateToProps, mapDispatchToProps)(\n  connectStyle(ext('ListWithBigPictures'))(ListWithBigPictures),\n);\n```\n\nAnd we're done! Push the extension to Shoutem.\n\n```ShellSession\n$ shoutem push\nUploading `My news RSS` extension to Shoutem...\nSuccess!\n```\n\nInstall it to a new blank app:\n\n```ShellSession\nshoutem install --new \"News App\"\n...\n```\n\nOpen your new app in the Builder. Now, add a screen from the **Shoutem** News RSS extension. Why that one? Because in our new extension, we only extended a screen and didn't create a new shortcut, so we couldn't add it's screen even if we wanted to! However, since both **News RSS** and **My news RSS** are installed in the app, the layout selector will recognize the new `List with big pictures` layout from **My news RSS** and show it in the layout list of Shoutem's **News RSS**.\n\nAdd an RSS feed in the **Content** tab, select the new layout in the **Layout** tab and run the app. This is what you should get (images and text vary with RSS feed):\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/modifying-extensions/new-layout.png'/>\n</p>\n\nThis way, we only extended Shoutem's **News RSS** extension and our extension will automatically get the all updates from Shoutem.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-09-FAQ.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/faq\ntitle: FAQ\nsection: Frequently Asked Questions\n---\n\n# Frequently Asked Questions\n\nThis document lists frequently asked questions when developing Shoutem extensions. If you don't find an answer here, try to find it on [Stackoverflow](http://stackoverflow.com/questions/tagged/shoutem?sort=newest) or feel free to ask it there using `shoutem` tag.\n\n**Questions:**\n\n- [What's the difference between React Native and Shoutem?](#whats-the-difference-between-react-native-and-shoutem)\n- [Is Shoutem free?](#is-shoutem-free)\n- [How can I get the complete app code?](#how-can-i-get-the-complete-app-code)\n- [How can I make my existing React Native app work with Shoutem?](#how-can-i-make-my-existing-react-native-app-work-with-shoutem)\n- [Can I publish app without using Shoutem?](#can-i-publish-app-without-using-shoutem)\n- [Which editor should I use?](#which-editor-should-i-use)\n- [Can I use native modules in apps?](#can-i-use-native-modules-in-apps)\n- [What do I need to run the app locally?](#what-do-i-need-to-run-the-app-locally)\n\n## What's the difference between React Native and Shoutem?\n\nShoutem is a simple modular architecture for building React Native apps. It allows you to use everything from React Native, including native packages, without any special setup. The modular architecture allows developers to create reusable packages, called `extensions`, which can be easily installed into multiple apps.\n\nThere are a number of benefits of using Shoutem on top of React Native:\n\n- Shoutem [open sourced a lot of extensions](https://github.com/shoutem/extensions) which you can use, modify and install into your apps\n- Update apps instantly without resubmitting them to the stores\n- Shoutem provides a customizable web interface which your clients can use to manage the app\n- A lot of non-technical users are using Shoutem Builder, to whom you can sell your extensions\n- Shoutem takes care of all the breaking changes in React Native\n\n## Is Shoutem free?\n\nYes! Shoutem is completely free and [open sourced](https://github.com/shoutem) for developers. Use unlimited number of extensions in your app. There are some premium features like automated publishing to both stores. See the pricing details [here]({{ site.shoutem.pricing }}).\n\n## How can I get the complete app code?\n\nThere's no lock-in. Use `shoutem clone` command to download all the code locally, or feel free to fork extension source code from the [GitHub repository](https://github.com/shoutem/extensions). The `shoutem clone` command will download the code for all the extensions installed into your app.\n\n## How can I make my existing React Native app work with Shoutem?\n\nShoutem app is a plain React Native app. We firmly believe that architecture that Shoutem introduces is the right way to do React Native apps. You should think of your app as a collection of multiple functionalities. Divide those functionalities into smaller modules, which will eventually become reusable extensions.\n\nYou can start by wrapping your entire app into one large extension. Using Shoutem, there's no restriction in how you can use React Native. As the time goes by, self-contained functionalities will become apparent. At that point, you should start dividing them into multiple extensions.\n\n## Can I publish app without using Shoutem?\n\nOf course you can! With `shoutem clone` you are getting the whole React Native project, the whole app which you can build and publish manually.\n\n## Which editor should I use?\n\nYou can use editor of your choice. We recommend [Visual Studio Code](https://code.visualstudio.com/).\n\n## Can I use native modules in apps?\n\nYes, you can use them the [same](https://facebook.github.io/react-native/docs/native-modules-ios.html) [way](https://facebook.github.io/react-native/docs/native-modules-android.html) you've used them in React Native.\n\n## What do I need to run the app locally?\n\nSince Shoutem apps are React Native apps, you need to [set up your local environment]({{ site.url }}/docs/extensions/tutorials/setting-local-environment) the same way you'd do it for a React Native app. After that, use the Shoutem CLI tool to get a local copy of your app using the `shoutem clone` command.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-10-DebugSettingsPages.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/debug-settings-pages\ntitle: Debugging and local development of settings pages\nsection: Tutorials\n---\n\n# Debugging and Local Development\n<hr />\n\nThis short tutorial covers how to improve your settings page development flow by utilizing the `Debug` feature in the Builder. It'll explain how to see code changes without having to `push` every code change and how to use dev tools to debug the settings pages through the Builder.\n\n> #### Note\n> HTML settings pages currently cannot use the `Debug` feature in the Builder.\n\n## Local development\n\nWhen you start developing settings pages, you'll quickly realize that it's inpractical to shoutem publish every change to Shoutem just to see the updated settings page. To avoid this and enjoy a much more efficient development flow, you can simply do the following:\n\n1. Push, and install your extension in Shoutem Builder application (Only once)\n2. Locate to the `extName/server` directory and execute `npm run dev` to run the webpack dev server (Until you kill server there is no need to run it again)\n3. In your browser go to Shoutem Builder and open settings page you are developing\n4. Click on the `Debug` button\n\nOnce you click Debug, the settings page will reload from `https://localhost:4790` and there is possibility that your browser will define `localhost` as insecure. We've prepared quick and simple tutorials on how to allow your browser to load the settings page from `localhost`.\n\n**Chrome**<br/>\nChrome will show an error in the actual settings page iframe, stating that the website is moved to a new address or removed. Open that link in a new tab. Chrome will warn you that it is not a secure site, click on `Advanced` and choose to navigate to the site. After that, you can close the tab and your settings page will now work in the Builder.\n\n**Safari**<br/>\nSafari will prompt you with an alert that Safari can't verify the identity of the website \"localhost\". Simply click `Continue` and Safari will then take you to the localhost site. After that, navigate back to the Builder using the back button and again click on the `Debug` button your settings page will be started and you can reload it after making changes to your local files.\n\n**Firefox**<br/>\nFirefox will show an error in the settings page iframe, stating that the connection isn't secure. To resolve this, you'll have to pen this URL: chrome://pippki/content/exceptionDialog.xul.\n\nIn the `Location` field enter `localhost:4790`, check the `Permanently store this exception` checkbox and then click the `Confirm Security Exception` button. You can now successfully debug the settings page.\n\nSince we use React and Webpack dev server we have the hot module reload feature enabled, meaning that every time you save changes to your code in your editor, the server will re-bundle it and reload it in the browser, so basically you have a live preview while you develop your settings page. There are some exceptions when it cannot work, like adding new npm module or file, but in that case just re-run dev server with and reload the Builder in your browser.\n\n## Debugging settings pages\n\nDebugging of settings pages should be done using the Debug feature explained in the section above. Once you enter debug mode, open the developer console (in Chrome keyboard shortcut is F12) and use Console, Sources, Elements and Network tab to debug your code. You can put breakpoint on code lines of your `/src` folder files by opening the `Source` tab and use the `Ctrl + P` keyboard shortcut to open the search bar.\n\n|                |   |   | Normal |   |   | Debug |\n|----------------|:-:|:-:|:------:|:-:|:-:|:-----:|\n| Transpiled ES5 |   |   |   Yes  |   |   |  No   |\n| Bundled        |   |   |   Yes  |   |   |  No   |\n| Breakpoints    |   |   |   No   |   |   |  Yes  |\n| Stack Trace    |   |   |   No   |   |   |  Yes  |\n\n<br/>\n\nSettings page debugging outside of debug mode is problematic, because the code is bundled in `extension.{hash}.js` and it's dependencies are in `vendor.{hash}.js` which the iframe loads. Webpack2 bundles and transpiles your code and we don't have to pass source maps. You can't easily put breakpoints or investigate the stack trace in such code.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-11-WritingHTMLSettingsPages.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/writing-html-settings-page\ntitle: Writing HTML settings pages\nsection: Tutorials\n---\n\n# Writing an HTML settings page\n\nIn this tutorial, we'll show you how to create HTML Settings pages for both shortcut settings and extension settings pages. HTML settings pages are useful to developers who have an existing dashboard they want to implement into the Builder without having to re-write it into React. For example if they have an existing AngularJS based dashboard.\n\n## Shortcut settings pages\n\nFirst, let's make an extension to work with. We'll make a simple `Hello World!` example so we can easily cover the basic concepts.\n\n```ShellSession\n$ shoutem init html-hello-world\nEnter information about your extension. Press `return` to accept (default) values.\n? Title HTML Hello World\n? Version 0.0.1\n? Description Learning HTML settings pages.\n...\nExtension initialized.\n```\n\nWe need to add a screen with a shortcut, so we have a shortcut to add settings pages to. Locate to the extension folder:\n\n```ShellSession\ncd {{ site.example.devName }}.html-hello-world\n```\n\nAnd add the screen:\n\n```ShellSession\n$ shoutem screen add Hello\n? Screen name: Hello\n? Create a shortcut (so that screen can be added through the Builder)? Yes\n? Shortcut name: Hello\n? Shortcut title: Hello\n? Shortcut description: A shortcut for Hello\n...\nSuccess\n```\n\nNow let's create the actual settings page:\n\n```ShellSession\n$ shoutem page add HelloWorldShortcutPage\n? Page type: react\n? Page name: HelloWorldShortcutPage\n? Page title: Hello World Shortcut Page\n? This settings page controls settings for: an existing screen\n? Select existing screen: Hello\n...\nReact settings page added to pages/hello-world-shortcut-page\n```\n\n`HelloWorldShortcutPage` was also added to `extension.json` as an `adminPage` of the `Hello` shortcut and as one of the `pages` of the extension:\n\n```JSON\n#file: extension.json\n\"shortcuts\": [\n  {\n    \"name\": \"Hello\",\n    \"title\": \"Hello\",\n    \"description\": \"A shortcut for Hello\",\n    \"screen\": \"@.Hello\",\n    \"adminPages\": [\n      {\n        \"page\": \"@.HelloWorldShortcutPage\",\n        \"title\": \"Hello World Shortcut Page\"\n      }\n    ]\n  }\n],\n\"pages\": [\n  {\n    \"name\": \"HelloWorldShortcutPage\",\n    \"path\": \"server/pages/hello-world-shortcut-page/index.html\",\n    \"type\": \"html\"\n  }\n]\n```\n\nThis is the new structure of `server` folder:\n\n```\nserver/\n├ pages/\n|  └ hello-world-shortcut-page\n|    ├ index.html\n|    ├ index.js\n|    └ style.css\n├ src/\n└ package.json\n```\n\nIt contains `src` and `pages` folders. The `src` is added by default when you initialize an extension, it doesn't affect HTML settings pages. The `pages` folder hosts all your HTML settings pages. Since we made a `shortcut` settings page, it includes a simple example settings pages that allows the app owner to enter the name of an person to be greeted in the app in the `index.html` file.\n\n```HTML\n#file: server/pages/hello-world-shortcut-page/index.html\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Title</title>\n    <link rel=\"stylesheet\" href=\"https://static.shoutem.com/libs/web-ui/0.1.17/web-ui.css\">\n    <link rel=\"stylesheet\" href=\"style.css\">\n</head>\n<body>\n\n  <form id=\"hello-form\" action=\"#\">\n    <h3>Enter company name</h3>\n    <div class=\"form-group\">\n      <label class=\"control-label\" for=\"companyName\">Company:</label>\n      <input id=\"companyName\" name=\"companyName\" type=\"text\" class=\"form-control required\">\n    </div>\n    <div class=\"footer\">\n      <button class=\"btn btn-primary\" type=\"submit\">Save</button>\n    </div>\n  </form>\n\n</body>\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js\"></script>\n<script src=\"https://static.shoutem.com/libs/web-ui/0.1.17/bootstrap.min.js\"></script>\n<script src=\"https://static.shoutem.com/libs/iframe-resizer/3.5.8/iframeResizer.contentWindow.min.js\"></script>\n<script src=\"https://static.shoutem.com/libs/api-sdk/1.1.2/api-sdk.min.js\"></script>\n<script src=\"https://static.shoutem.com/libs/extension-sandbox/0.1.4/extension-sandbox.min.js\"></script>\n<script src=\"index.js\"></script>\n</html>\n```\n\nIt uses:\n\n- CSS\n  - Web UI - Shoutem style defined on top of [Bootstrap v3](http://getbootstrap.com/)\n  - **style.css** - a place where you write your own CSS\n- JavaScript\n  - [jQuery](https://jquery.com/)\n  - [Bootstrap v3](http://getbootstrap.com/)\n  - iframeResizer - for managing the size of the iFrame in which settings page is set\n  - api-sdk - exposing `shoutem` variable globally for easier access of Shoutem API\n  - extension-sandbox - enabling the communication between your page and the builder\n  - **index.js** - a place where you write your own JS code with lifecycle methods prepared\n\n`index.js` comes with pre-made lifecycle methods for your settings page:\n\n```JS\n#file: server/pages/hello-world-shortcut-page/index.js\n// listen for Shoutem initialization complete\ndocument.addEventListener('shoutemready', onShoutemReady, false);\n\n// handler for Shoutem initialization finished\nfunction onShoutemReady(event) {\n  // config object containing builder extension configuration, can be accessed via event\n  // or by shoutem.sandbox.config\n  const config = event.detail.config;\n\n  // Waiting for DOM to be ready to initialize shoutem.api and call app start function\n  $(document).ready(function() {\n    shoutem.api.init(config.context);\n    onPageReady(config);\n  });\n};\n\n// Put your settings page logic here, executes when sandbox and DOM are initalized\nfunction onPageReady(config) {\n  function errorHandler(err) {\n    console.log('Something went wrong:', err);\n  }\n\n  function handleSubmit(e) {\n    // prevent default action and bubbling\n    e.preventDefault();\n    e.stopPropagation();\n\n    const greeting = $('#greetingName').val();\n\n    // updates current shortcut settings by patching with current settings\n    shoutem.api.shortcuts.updateSettings({ greeting })\n      .catch(errorHandler);\n\n    return false;\n  }\n\n  function initForm(settings) {\n    if(!settings) {\n      return;\n    }\n\n    $('#greetingName').val(settings.greeting);\n  }\n\n  $('button[type=\"submit\"]').click(handleSubmit);\n\n  // shoutem.api knows current shortcut and returns promise with fetched settings\n  shoutem.api.shortcuts.getSettings()\n    .then(initForm, errorHandler);\n}\n```\n\nSandbox is a container where your settings page is loaded. Once it's ready, `onShoutemReady` is triggered. By default, logic for extracting the configuration for your extension and initializing jQuery is inside that function. Write your own code after `onShoutemReady`.\n\nFinally, we have a simple CSS file `style.css` where you can store your custom CSS:\n\n```CSS\n#file: server/pages/hello-world-shortcut-page/style.css\n.footer {\n  margin-top: 15px;\n}\n```\n\nThis page is now created and referenced in the `Hello` shortcut in `extension.json`. Let's add our `greeting` setting to it and give it a default value:\n\n```json{12-14}\n#file: extension.json\n\"shortcuts\": [\n  {\n    \"name\": \"Hello\",\n    \"title\": \"Hello\",\n    \"description\": \"A shortcut for Hello\",\n    \"screen\": \"@.Hello\",\n    \"adminPages\": [\n      {\n        \"page\": \"@.HelloWorldShortcutPage\",\n        \"title\": \"Hello World Shortcut Page\"\n      }\n    ],\n    \"settings\": {\n      \"greeting\": \"Tom\"\n    }\n  }\n]\n```\n\nWhen the app owner clicks `Save`, we want to save the settings entered into the `<input>` field. This is doneusing the two functions in `server/index.js`: `handleSubmit` and `initForm`. For simplified communication with the Shoutem API, such as updating and getting shortcut settings, use `api-sdk`. It puts the `shoutem` object into the global environment.\n\nBoth these functions (and an `errorHandler`) are added into the `onPageReady` function when you generate a shortcut settings page.\n\n```JS\n#file: server/pages/hello-world-shortcut-page/index.js\nfunction onPageReady(config) {\n  function errorHandler(err) {\n    console.log('Something went wrong:', err);\n  }\n\n  function handleSubmit(e) {\n    // prevent default action and bubbling\n    e.preventDefault();\n    e.stopPropagation();\n\n    const greeting = $('#greetingName').val();\n\n    // updates current shortcut settings by patching with current settings\n    shoutem.api.shortcuts.updateSettings({ greeting })\n      .catch(errorHandler);\n\n    return false;\n  }\n\n  function initForm(settings) {\n    if(!settings) {\n      return;\n    }\n\n    $('#greetingName').val(settings.greeting);\n  }\n\n  $('button[type=\"submit\"]').click(handleSubmit);\n\n  // shoutem.api knows current shortcut and returns promise with fetched settings\n  shoutem.api.shortcuts.getSettings()\n    .then(initForm, errorHandler);\n}\n```\n\n### Accessing the shortcut settings in the application\n\nThe Shoutem CLI implemented the shortcut settings page into our pre-existing shortcut, all that is left to do is to access the settings in the `Hello` screen. Update the screen file:\n\n```JS\n#file: app/screens/Hello.js\nexport default class Hello extends Component {\n  render() {\n    const { shortcut } = this.props;\n    const { greeting } = shortcut.settings;\n\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Hello {greeting}!</Text>\n      </View>\n    );\n  }\n}\n```\n\nNow let's publish and install the extension.\n\n```ShellSession\n$ shoutem push\nUploading HTML Hello World extension to Shoutem...\nSuccess!\n```\n\n```ShellSession\n$ shoutem install --new \"HTML Hello World\"\nExtension installed\nSee it in browser: {{ site.shoutem.builderURL }}/{{ site.example.appId }}\n```\n\nOur default setting applies and the app owner has an input form to change the `greeting` value.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/writting-settings-page/hello-tom-html.png'/>\n</p>\n\n## Extension settings pages\n\nExtension settings pages provide you with settings that you can pass to every part of the extension, so in our simple use case, we'll suppose the extension settings page lets the app owner determine which company the person being greeted is working for, as you can see from the input form.\n\nThe key difference between extension and shortcut settings pages is where they're defined in the `extension.json`. They're defined on the same level as `shortcuts` and `pages`. Let's create an extension settings page.\n\n```ShellSession\n$ shoutem page add\n? Page type: html\n? Page name: HelloWorldExtensionPage\n? Page title: Hello World Extension Page\n? This settings page controls setting sfor: the 'html-hello-world' extension\n...\nReact settings page added to pages/hello-world-extension-page\n```\n\nThe CLI added `HelloWorldExtensionPage` to the root level of `extension.json`, but let's add a default value.\n\n```json\n#file: extension.json\n\"settingsPages\": [\n  {\n    \"page\": \"@.HelloWorldExtensionPage\",\n    \"title\": \"Hello World Extension Page\"\n  }\n],\n\"settings\": {\n  \"company\": \"Shoutem\"\n}\n```\n\nThe template page generated is pretty much identical to the one generated for `HelloWorldShortcutPage`, except the `shoutem.api` references `extensions` instead of `shortcuts`, and `company` instead of `greeting`.\n\n```JavaScript{6,9,18}\n#file: server/pages/hello-world-extension-page/index.js\nfunction handleSubmit(e) {\n  // prevent default action and bubbling\n  e.preventDefault();\n  e.stopPropagation();\n\n  const company = $('#companyName').val();\n\n  // updates extension settings by patching with current settings\n  shoutem.api.extensions.updateSettings({ company })\n    .catch(errorHandler);\n\n  return false;\n}\n\n...\n\n// shoutem.api returns promise with fetched settings\nshoutem.api.extensions.getSettings()\n  .then(initForm, errorHandler);\n```\n```HTML{2,4-5}\n#file: server/pages/hello-world-extension-page/index.html\n<form id=\"hello-form\" action=\"#\">\n  <h3>Enter company name</h3>\n  <div class=\"form-group\">\n    <label class=\"control-label\" for=\"companyName\">Company:</label>\n    <input id=\"companyName\" name=\"companyName\" type=\"text\" class=\"form-control required\">\n  </div>\n  <div class=\"footer\">\n    <button class=\"btn btn-primary\" type=\"submit\">Save</button>\n  </div>\n</form>\n```\n\nLet's retrieve that `company` value from the redux store and use it in our `Hello` screen.\n\n```JavaScript{11-15,19,25,42-53}\n#file: app/screens/Hello.js\nimport React, {\n  Component\n} from 'react';\n\nimport {\n  StyleSheet,\n  Text,\n  View\n} from 'react-native';\n\nimport { connect } from 'react-redux';\nimport { connectStyle } from '@shoutem/theme';\nimport _ from 'lodash';\nimport { getExtensionSettings } from 'shoutem.application';\nimport { ext } from '../const';\n\nexport class Greeting extends Component {\n  render() {\n    const { shortcut, company } = this.props;\n    const { greeting } = shortcut.settings;\n\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Hello {greeting}!</Text>\n        <Text style={styles.text}>You work for {company}.</Text>\n      </View>\n    );\n  }\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n  },\n  text: {\n    fontSize: 20,\n  },\n});\n\nexport const mapStateToProps = (state) => {\n  const extensionSettings = getExtensionSettings(state, ext());\n  const company = _.get(extensionSettings, 'company');\n\n  return {\n    company\n  };\n};\n\nexport default connect(mapStateToProps, undefined)(\n  connectStyle(ext('Greeting'))(Greeting),\n);\n```\n\nFinally, let's push the new version of our `html-hello-world` extension that we've made to Shoutem and see our extension settings page in action.\n\n```ShellSession\n$ shoutem push\nUploading HTML Hello World extension to Shoutem...\nSuccess!\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/writting-settings-page/hello-tom-shoutem-html.png'/>\n</p>\n\nSo what's the purpose of extension settings pages as opposed to shortcut? Well, in our simple example, we made an extension where the app owner can define which company he's addressing and then make each Screen he adds on the Builder greet a unique employee. Each screen added will address the company defined in the Extension settings pages, while the app owner can choose which employee each screen greets.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-12-SettingsPageIntro.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/settings-pages-introduction\ntitle: Settings Pages\nsection: Tutorials\n---\n\n# Settings pages\n\nSettings pages are used to allow the app owner to control the behavior of an extension.\n\nYou define all of your settings pages in the `pages` root field in `extension.json`. However, it's important to differentiate different types of settings pages. You can define three different types of settings pages.\n<br/>\n\n### Extension settings pages\n\nThey're defined as `settingsPages` in the root of the `extension.json` file and are defined as an array of pages used for adjusting settings on the level of the entire extension, meaning they're accessible throughout the entire extension.\n\nAn example of this type of settings page was mentioned above, the User Authentication extension:\n\n```JSON\n#file: shoutem.auth/extension.json\n\"settingsPages\": [{\n  \"page\": \"@.SettingsPage\",\n  \"title\": \"Settings\"\n}, {\n  \"page\": \"@.ProvidersPage\",\n  \"title\": \"Authentication providers\"\n}],\n\"pages\": [{\n  \"name\": \"SettingsPage\",\n  \"type\": \"native-component\",\n  \"path\": \"dummy.js\"\n}, {\n  \"name\": \"ProvidersPage\",\n  \"type\": \"native-component\",\n  \"path\": \"dummy.js\"\n}],\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/writting-settings-page/extension-settings-page.png'/>\n</p>\n\n### Shortcut settings pages\n\nThey're defined as `adminPages` in the `shortcuts` field of the `extension.json` file as an array of pages used for adjusting settings on the level of a specific shortcut, meaning they're accessible only to those shortcuts and not on the level of an entire extension.\n\nAn example of this type of settings page can be found in the News RSS extension:\n\n```JSON{6-11}\n#file: shoutem.rss-news/extension.json\n\"shortcuts\": [{\n  \"name\": \"news-shortcut\",\n  \"title\": \"News RSS\",\n  \"icon\": \"theme://news.png\",\n  \"screen\": \"@.ArticlesGridScreen\",\n  \"adminPages\": [{\n    \"page\": \"shoutem.rss.RssPage\",\n    \"title\": \"Content\",\n    \"parameters\": {\n      \"schema\": \"shoutem.proxy.news\"\n    }\n  }, {\n    \"page\":\"shoutem.layouts.LayoutPage\",\n    \"title\": \"Layout\"\n  }]\n}],\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/writting-settings-page/shortcut-settings-page.png'/>\n</p>\n\n### Screen settings page\n\nIt's defined as `settingsPage` in the `screens`field as a single page for adjusting a specific layout's settings. This is what you see in the `shoutem.navigation` (Main Navigation) extension.\n\n```JSON{}\n#file: shoutem.navigation/\n{\n  \"name\": \"Drawer\",\n  \"title\": \"Drawer\",\n  \"image\": \"./server/assets/screens/drawer.png\",\n  \"extends\": \"@.TabBar\",\n  \"settingsPage\": {\n    \"page\": \"@.Drawer\"\n  },\n  \"settings\": {\n    \"startingScreen\": null,\n    \"showIcon\": true,\n    \"showText\": true\n  }\n}\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/writting-settings-page/screen-settings-page.png'/>\n</p>\n\nNow that we understand the differences between settings pages, let's see [how to make them]({{ site.url }}/docs/extensions/tutorials/writing-react-settings-page).\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-13-UsingLocalization.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/using-localization\ntitle: Localization\nsection: Tutorials\n---\n\n# Localization\n\ni18n stands for internationalization (i, 18 letters, n). Shoutem's localization is based on [i18n-js by fnando](https://github.com/fnando/i18n-js). Each extension has it's own set of translations located in the `app` segment in the `translations` directory. These extension-level translations are fallbacks for when a new extension is made and an existing language file doesn't have it's strings.\n\nLanguage files are uploaded by the app owner using the `shoutem.i18n` settings page.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/localization/i18n-settings-page.png'/>\n</p>\n\n## Translating your App\n\nTo use your translation, you can download and unzip [this file]({{ site.url }}/static/localization/en.json.zip) and replace all the English strings with anything you like. Either a different language or alternative English strings.\n\nOnce you've extracted the `en.json` file, rename it to the language you want to translate your app to, e.g. `de.json`, for German.\n\nThen translate all strings from English to German. For example:\n\n```JSON\n#file: en.json\n\"navBarMapViewButton\": \"Map\"\n```\n\nIs translated to German:\n\n```JSON\n#file: de.json\n\"navBarMapViewButton\": \"Karte\"\n```\n\nWe have short examples of how to translate more complex strings with [pluralization]({{ site.url }}/docs/extensions/tutorials/using-localization#pluralized-strings) and [variables]({{ site.url }}//docs/extensions/tutorials/using-localization#variables-in-strings).\n\nAfter translating the strings to your chosen language, you can validate the JSON for any syntax errors using a free and easy to use tool like [JSONLint](https://jsonlint.com/).\n\n## Implementing i18n in your Custom Extension\n\nThink back to [Getting Started]({{ site.}}/docs/extensions/tutorials/getting-started). We made a simple extension with a line of text in one screen:\n\n```JavaScript{5}\n#file: tom.restaurants/app/screens/List.js\nexport default class List extends Component {\n  render() {\n    return (\n      <View style={styles.container}>\n        <Text style={styles.text}>Let's eat!</Text>\n      </View>\n    );\n  }\n}\n```\n\nTo implement translations to that we'd have to import `I18n`:\n\n```JavaScript{11}\n#file: tom.restaurants/app/screens/List.js\nimport React, {\n  Component\n} from 'react';\n\nimport {\n  StyleSheet,\n  Text,\n  View\n} from 'react-native';\n\nimport { I18n } from 'shoutem.i18n';\n```\n\nThen use the imported `I18n`:\n\n```JavaScript{2}\n#file: tom.restaurants/app/screens/List.js\n<View style={styles.container}>\n  <Text style={styles.text}>I18n.t(ext('letsEatMessage'))</Text>\n</View>\n```\n\nNow we need to implement the fallback by creating a `translations` directory in the `app` segment:\n\n```ShellSession\n$ mkdir app/translations && touch app/translations/en.json\n```\n\nAnd adding our extension's string to it:\n\n```JavaScript\n#file: tom.restaurants/app/translations/en.json\n{\n  \"shoutem\": {\n    \"restaurants\": {\n      \"letsEatMessage\": \"Let's eat!\"\n    }\n  }\n}\n```\n\nThis string has to be exported in `app/index.js`:\n\n```JavaScript{1,10-16}\n#file: tom.restaurants/app/index.js\nimport enTranslations from './translations/en.json';\n\n// Constants `screens` (from extension.js) and `reducer` (from index.js)\n// are exported via named export\n// It is important to use those exact names\n\n// export everything from extension.js\nexport * from './extension';\n\nexport const shoutem = {\n  i18n: {\n    translations: {\n      en: enTranslations,\n    },\n  },\n};\n```\n\nAnd that's it!\n\n#### Pluralized Strings\n\nWhen editing strings that contain pluralization (e.g. `1 point` vs. `2 points`) we utilize the following format for the language file:\n\n```JSON{4-7}\n#file: en.json\n{\n  \"shoutem\": {\n    \"loyalty\": {\n      \"pointsInStore\": {\n        \"one\": \"{% raw %}{{{% endraw %}count}} point collected.\",\n        \"other\": \"{% raw %}{{{% endraw %}count}} points collected.\",\n        \"zero\": \"No points collected.\"\n      }\n    }\n  }\n}\n```\n\nAnd the following method inside the actual React Native component:\n\n```JavaScript{5}\n#file: shoutem.loyalty/app/components/PlaceIconView.js\nconst { place, points, onPress } = this.props;\n\nreturn (\n  <Caption>\n    {I18n.t(ext('pointsInStore'), { count: points })}\n  </Caption>\n);\n```\n\nIt's important to use the `count` variable name specifically as described in `i18n-js` [docs](https://github.com/fnando/i18n-js#readme).\n\n#### Variables in Strings\n\nWhen editing strings that contain variables we utilize the following format for the language file:\n\n```JSON{3-4}\n#file: en.json\n{\n  \"shoutem\": {\n    \"auth\": {\n      \"loggedInUserInfo\": \"Username: {% raw %}{{{% endraw %}username}}\"\n    }\n  }\n}\n```\n\nAnd the following method inside the actual React Native component:\n\n```JavaScript{6}\n#file: shoutem.auth/app/screens/EditProfileScreen.js\nconst { user } = this.props;\nconst { name, profile_image_url: image } = user;\n\nreturn (\n  <Caption>\n    {I18n.t(ext('loggedInUserInfo'), { username: name })}\n  </Caption>\n);\n```\n\n## Implementing Fallback Strings in Custom Extensions\n\nFallback strings are made to make sure that each string has a translation if the language file (e.g. `en.json`) is missing a translation. They are implemented in each extension which has strings specific to itself. One such example is the `BUY THIS BOOK` string, which is specific to the `shoutem.books` extension. The fallback for this translation looks like this:\n\n```JSON\n#file: shoutem.books/app/translations/en.json\n{\n  \"shoutem\": {\n    \"books\": {\n      \"buyButtonText\": \"BUY THIS BOOK\"\n    }\n  }\n}\n```\n\nAs you can see, it's identical to the full language file, however, it only contains the strings for that specific extension.\n\nYou'll also have to export these translations from `app/index.js`.\n\n```JavaScript\n#file: shoutem.books/app/index.js\nimport enTranslations from './translations/en.json';\n\nexport const shoutem = {\n  i18n: {\n    translations: {\n      en: enTranslations,\n    },\n  },\n};\n```\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-14-SettingUpInstagram.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/setting-up-instagram\ntitle: Setting up Instagram\nsection: Tutorials\n---\n\n# Setting up Instagram\n\nShoutem's Photos RSS can utilize an Instagram feed, however, since Instagram has now closed their API, you will have to be the owner of the feed in order to generate a URL.\n\nIn order to show an Instagram feed in a Shoutem app using the Photos RSS, you will have to set up a redirect URL. The first step is to go to the Instagram developer [site](https://www.instagram.com/developer/) and create a [new client](https://www.instagram.com/developer/clients/register/) if you don't already have one. Take note of the Client ID and Client Secret, you will be needing these to get your access token. Here are the steps:\n\n#### 1) Manage your client, go to the Security tab and set two redirection URIs:\n\n`https://new.shoutem.com` and `http://new.shoutem.com`\n\n#### 2) Un-check the `Disable implicit 0Auth` setting.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/instagram/instagram-client.png'/>\n</p>\n\n#### 3) Update the client.\n\n#### 4) Navigate to:\n\n```\nhttps://api.instagram.com/oauth/authorize/?client_id=<client_id>&redirect_uri=https://new.shoutem.com&response_type=token&scope=public_content\n```\n\n> #### Note\n> Replace any placeholder values with the ones from your client. For example, `client_id=<client_id>` should be `client_id=1oct365163444080a0cd6c3451486736`.\n\nAt this point your browser may warn you that it requires you to authorize access to this if the client is in sandbox mode. Authorize it in order to proceed and get the access token.\n\n#### 5) You can find the token after the # symbol in the address bar of your browser.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/tutorials/instagram/access-token.png'/>\n</p>\n\n## How to generate a content URL for Shoutem\n\nIn order to fetch content via Photos RSS you will need to fetch it from an Instagram endpoint using your access token. You can find out which endpoints are available in the Instagram [documentation](https://www.instagram.com/developer/endpoints/), of which you'll most likely be interested in the [media](https://www.instagram.com/developer/endpoints/media/) ones.\n\nHere are some example links you can use with Shoutem's Photos RSS in order to fetch Instagram images.\n\n#### Recent images of all users\n\nThis can be used to retrieve all recent images, it's the most commonly used link.\n\n```\nhttps://api.instagram.com/v1/users/self/media/recent?access_token=<access_token>\n```\n\n> #### Note\n> Replace any placeholder values with the ones from your client. For example, `client_id=<client_id>` should be `client_id=1oct365163444080a0cd6c3451486736`.\n\n#### Search within a location\n\nThis can be used to retrieve images from a specific location defined by latitude and longitude.\n\n```\nhttps://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&access_token=<access_token>\n```\n\n> #### Note\n> Replace any placeholder values with the ones from your client. For example, `client_id=<client_id>` should be `client_id=1oct365163444080a0cd6c3451486736`.\n\n\n## API alternative\n\nYou can also generate an access token using the following API call with `curl`:\n\n```ShellSession\ncurl -X POST \\\n  https://api.instagram.com/oauth/access_token \\\n  -H 'cache-control: no-cache' \\\n  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \\\n  -H 'postman-token: 76328f00-0a28-153d-1e8e-14bab1433aef' \\\n  -F client_id=<client_id> \\\n  -F client_secret=<client_secret> \\\n  -F grant_type=authorization_code \\\n  -F redirect_uri=https://new.shoutem.com \\\n  -F code=2f012e51d8cd4e649d6971b9b11841a1\n```\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-15-UsingPatchPackage.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/using-patch-package\ntitle: Using patch-package with extensions\nsection: Tutorials\n---\n\n# Using patch-package with extensions\n\nAs of platform 2.2.2, Shoutem apps support [patch-package](https://www.npmjs.com/package/patch-package) changes being made to dependencies by extensions during the Shoutem app configuration process. Read on to find out how you can utilize this feature.\n\n## When to use patch-package\n\nWhen working with third party packages, you'll run into the issue of maintenance, bugs on their end and missing features. Sometimes the answer is to fork, sometimes it's better to just patch it.\n\n## How to make a patch\n\nThe following steps are how we created our own `patch-package` changes, for example, in [shoutem.audio](https://github.com/shoutem/extensions/tree/master/shoutem.audio/app/patch). It uses the instructions provided by the `patch-package` package.\n\n#### 1. Add the dependency\n\nTo make a patch, you will have to have the dependency you want to edit already installed as you would when running `shoutem configure`. You can [add your dependency]({{ site.url }}/docs/extensions/tutorials/installing-3rd-party-packages) via your extension's `app/package.json` and it will be installed when `shoutem configure` is run.\n\n#### 2. Make the changes in node_modules\n\nAfter running `shoutem configure`, you will have to make the edits you need in `App-Name/node_modules/your-dependency`, this will allow `patch-package` to generate a _diff_ and you'll be set.\n\n#### 3. Creating the patch file\n\nFollowing the changes made in step 2, create a `patch` directory in your extension's app segment.\n\nFrom the `App-Name/` directory, you run the following:\n\n```ShellSession\n$ npx patch-package your-dependency@version --patch-dir extensions/your-dev-name.your-ext-name/app/patch\n```\n\nThis will generate a patch-file and place it into your extension's `app/patch` directory that you just created.\n\n#### 4. Let Shoutem do it's magic\n\nKick back, relax, Shoutem takes care of it from here. If you wanna know how, read the next section.\n\n## How it works \"Under the hood\"\n\nShoutem's platform has a `postinstall` script which will apply all patches provided in every installed extension's `app/patch` directory right after the `shoutem configure` script does it's dependency installation step (since it's the postinstall script being run).\n\nIn short, patches will be applied every time the app's dependencies are installed, either manually, or with the `shoutem configure` command.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-16-NavigationIntroduction.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/navigation-introduction\ntitle: Navigation\nsection: Tutorials\n---\n\n# Navigation\n\nWith the platform update 3.0.0, we’ve made some significant changes to the navigation extension. Main motivation behind this extension overhaul was mostly performance related, but it is also supposed to allow for easier extension development for both Shoutem in-house team, and the 3rd party developers, going forward.\n\nDue to the scope of the changes we needed to implement, there are some breaking changes that 3rd party developers will need to take into account when upgrading their extensions to support the new platform.\n\nYou can continue reading about changes and improvements in the [following pages]({{ site.url }}/docs/extensions/tutorials/navigation-breaking-changes), where we will dive deeper into main differences between the old platform and suggest best practices with updating your current custom extension versions.\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-17-NavigationBreakingChanges.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/navigation-breaking-changes\ntitle: Breaking changes\nsection: Tutorials\n---\n\n# Breaking changes\n\nIn this section, we'll cover most fundamental changes implemented with the rework of our navigation flows. Consequently, most of these changes are in fact breaking changes as they modify how things work under the hood\n\n## React navigation as the underlying architecture\n\nWe wanted to design our navigation mechanisms to closely follow the [most commonly used navigation library](https://reactnavigation.org/docs/5.x/getting-started/) across react native apps. So if you’re familiar with creating apps for react native, this interface should be familiar, and allow for easier transition.\n\nEvery screen in Shoutem apps will pass down the standard react navigation props, such as [route](https://reactnavigation.org/docs/5.x/route-prop/), or [navigation](https://reactnavigation.org/docs/5.x/navigation-prop/). So from this point of view, nothing really changes in comparison to standard react navigation apps. In addition to that, you will receive the shortcut route props, that were previously passed directly to the shoutem screen. So where you were reading the shortcut prop inside the screen directly, you will now need to destructure it first, from the shortcut route prop.\n\nThis by itself, makes it possible to use the react-navigation library just like you would outside Shoutem apps. We’ve also created a few helper methods for extracting the Shoutem relevant props, from the navigation route object. For full reference, you can check out the shoutem.navigation extension in our [public extensions repository](https://github.com/shoutem/extensions).\n\n## Removing redux based navigation\n\nPrior to the new platform update, our navigation implementation relied heavily on redux actions / redux middleware. While this allowed us more control over navigation in the past, it also introduced a significant drawback in terms of performance and overall resource usage. This was the main motivation behind walking away from this approach in place of more performant architecture. As mentioned earlier, we now make use of react-navigation “native” actions which are wrapped under shoutem.navigation methods.\n\nThis interface went through minimal changes, looking at it from the top level. This means that most of the actions are still named the same, and are imported from the same extension / path. However, under the hood, they now use more performant mechanisms. This is another `breaking change` you will need to consider.\n\nThe change however, is minimal. You will simply need to remove the dispatch layer around the navigation actions (seeing as they are no longer run through redux mechanisms).\n\nFor example, if you used the `navigateTo` action from shoutem.navigation, you will simply remove it from `mapDispatchToProps`, or just stop dispatching the action if you’re not mapping it through redux `connect`. Similar goes for `openInModal`, or any other navigation action you used before.\n\nIn the snippet below, you have a standard way of navigating in previous platforms.\n\n```JavaScript\nimport { navigateTo } from 'shoutem.navigation';\n\n...\nnavigateToScreen() {\n const { navigateTo } = this.props;\n\n navigateTo('ScreenName');\n}\n\n...\nconst mapDispatchToProps = { ...otherMappedActions, navigateTo };\n```\n\nTo make this code compatible with the new platform, you would simply use the navigateTo action directly, without having to map it to dispatcher.\n\n```JavaScript\nimport { navigateTo } from 'shoutem.navigation';\n\n...\nnavigateToScreen() {\n navigateTo('ScreenName');\n}\n\n...\nconst mapDispatchToProps = { ...otherMappedActions };\n```\n\nYou can apply this for every other navigational action, using the same formula. In case you have more complex behaviours and need some advice, feel free to check how other [shoutem extensions](https://github.com/shoutem/extensions) are handling their navigation flows, or contact us directly.\n\n## Removing NavigationBar component from screens\n\nPreviously, this component was something you would need to implement in every screen you create. The main purpose of this was to provide you with ways of styling the navbar, specifically to this one screen. You would do this through the `styleName` prop, very similar to any other component styled with the Shoutem theme. \n\nWhile this worked well, the implementation was very abstract and customizing certain behaviours was complex and difficult to understand. React-navigation allows us to do this in an easier way, without introducing an abstracted component in your JSX code. Additionally, it will provide us with ways to change the navbar styling dynamically, and overall, provide more control over how the navbar is drawn.\n\nStyling your navbar now is done the same way you would do it outside Shoutem apps, if you’re using react-navigation library. Navigation prop that is passed to the screen will allow you to call it’s [setOptions](https://reactnavigation.org/docs/5.x/navigation-prop/#setoptions) method, which amongst other things, allows you to set specific navbar / header styling. So now, you can style your navbar code outside the render method.\n\nTo allow for easier transition, we’ve introduced a helper method that will apply the same navbar styling you would achieve by setting the `styleName` prop on the old `NavigationBar` component. Please find the example below.\n\nPreviously, you would add the NavigationBar component to your render method like this : \n\n```JavaScript\nrender() {\n return (\n   <Screen>\n     <NavigationBar styleName=\"clear fade\" />\n     {this.renderData()}\n   </Screen>\n );\n}\n```\n\nThis code/logic is now moved outside the render method, resulting in cleaner JSX syntax, as well as options of changing the styling dynamically in any lifecycle method, or other cases you may require.\n\n```JavaScript\nimport { composeNavigationStyles } from 'shoutem.navigation';\n\ncomponentDidMount() {\n const { navigation } = this.props;\n\n navigation.setOptions({\n   ...composeNavigationStyles(['clear', 'fade']),\n   ...otherOptions,\n });\n}\n\nrender() {\n return (\n   <Screen>\n     {this.renderData()}\n   </Screen>\n );\n}\n```\n\nWe make use of the `composeNavigationStyles` helper here, to apply the same styling you would receive through the `styleName` props on `NavigationBar`. Simply pass on the `styleName`'s used before, into this method, and you will receive the same styling you’ve had before.\n\nAlongside other benefits, you can now apply your own custom navbar styling in a more transparent and easier way if necessary. This is also true for general navbar behaviour, such as hiding the navbar in specific cases or similar. For the list of options on specific navigators, please check the [react-navigation documentation.](https://reactnavigation.org/docs/5.x/screen-options/)\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-18-NavigationStacks.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/navigation-stacks\ntitle: Navigation stacks\nsection: Tutorials\n---\n\n# Navigation stacks\n\nAnother convenient improvement made possible by integrating react-navigation was the ability to define your own custom navigation flows, or navigation stacks as they are referred to in react-navigation. \n\nPreviously, the navigational structure of Shoutem apps heavily depended on the shortcut tree you have defined inside the app builder. With the introduction of custom navigation stacks, you can now define your own navigation flow that can go outside the bounds of screen structure defined in the app builder.\n\nThat means you can design multiple screens and define their navigational behaviour, without having to compose any kind of screen structure inside the app builder. This comes in very handy when you need to implement a set of 3rd party authentication screens, or if you want to create some kind of onboarding set of screens, or any similar scenario that would require the user to step out of the standard screen structure, to complete some kind of app segment.\n\nThe interface needed to create something like this is conveniently simple, and it relies mostly on registering the screens that are a part of the new navigation flow.\n\n```JavaScript\nimport { NavigationStacks } from 'shoutem.navigation';\n\nNavigationStacks.registerNavigationStack(config);\n```\n\nWhere the config object has the following properties ->\n\n- **name** -> name of the custom stack. You can use the extension canonical name here, or anything else that fits your case. You will use this name to initialize the custom stack flow, and open it’s first screen\n\n- **navigationStack** -> If needed, you can pass on the complete navigation stack that you created previously. By default, we will create a new [Stack type navigator](https://reactnavigation.org/docs/5.x/stack-navigator/), and add the registered screen as it’s children\n\n- **screens** -> array of objects containing `{ name, component }` properties. These are the screens that will be added to your custom navigation stack. \n\n- **screenOptions** -> Set of global screen options that will be applied to your custom navigator. Check the full reference [here](https://reactnavigation.org/docs/5.x/screen-options/#screenoptions-prop-on-the-navigator).\n\n- **navigatorOptions** -> Any other props you wish to pass on to your custom navigator. Options here depend mostly on the type of navigation stack from react-navigation that you’re using here.\n\nOnce you have registered your custom stack, you can navigate to it by simply calling the `openStack` method.\n\n```JavaScript\nimport { NavigationStacks } from 'shoutem.navigation';\n\nNavigationStacks.openStack(stackName, params = {}, initialRoute = null);\n```\n\nWhere the `stackName` is the name of the stack you registered beforehand, `params` are the optional set of route params you want to pass to the first route of the stack, and the `initialRoute` as the name of the screen in the stack you want to open first. By default, `initialRoute` will be the first registered screen for the custom stack.\n\nOnce you’re done, you can simply call the `closeStack` method and return to the point in the app where you were prior to opening the stack.\n\n```JavaScript\nNavigationStacks.closeStack(stackName);\n```\n\nA good example of how you can use this new interface is our [shoutem.auth](https://github.com/shoutem/extensions/blob/master/shoutem.auth/app/navigation.js#L11) extension that implements a custom stack for it’s authentication flows.\n\n## Modal stack navigation\n\nAnother example of navigation that uses the new navigation stack interface is the modal stack. By default, every shortcut screen from any of the extensions installed in your app, will be added to the modal stack, so it can be opened from any point in your application. If you need to add other screens, you can do so by calling ModalStack `registerModalScreens` method.\n\nIf you’re registering a screen that is exported from one of the extensions, you can use the short syntax, for example:\n\n```JavaScript\nModalScreens.registerModalScreens(['shoutem.news.NewsListScreen']);\n```\n\nOr, you can use the longer syntax if necessary:\n\n```JavaScript\nModalScreens.registerModalScreens([{\n name: 'shoutem.news.NewsListScreen',\n component: ScreenComponent,\n options: reactNavigationScreenOptions\n}]);\n```\n\nWhere the component represents the Screen component, and the options are the optional screen options object conforming to the react-navigation syntax.\n\nOnce you have this setup in place, navigating to a screen inside the modal stack is as easy as calling the `openInModal` from shoutem.navigation. Remember, these actions do not need to be dispatched through redux anymore.\n\n```JavaScript\nimport { openInModal } from 'shoutem.navigation';\n\nopenInModal('shoutem.auth.EditProfileScreen');\n```\n\nWhen you want to close the modal stack, just call closeModal from shoutem.navigation, and you will be returned to the point in app prior to opening the modal stack.\n\n```JavaScript\nimport { closeModal } from 'shoutem.navigation';\n\ncloseModal();\n```\n"
  },
  {
    "path": "docs/extensions/tutorials/_posts/1970-01-19-NavigationScreenDecorators.md",
    "content": "---\nlayout: doc\npermalink: /docs/extensions/tutorials/navigation-screen-decorators\ntitle: Screen decorators\nsection: Tutorials\n---\n\n# Screen decorators\n\nAnother powerful tool at your disposal with the new platform is the ability to decorate all registered screens with some custom behaviour. Internally, this is most commonly used to replace any custom logic that depended on navigation actions middleware, but you can use it to deliver any kind of code that needs to affect screens globally.\n\nA screen decorator in its nature is just a simple [HoC](https://reactjs.org/docs/higher-order-components.html) that wraps your screen with additional code. Good example of this can be seen in [shoutem.advertising](https://github.com/shoutem/extensions/blob/master/shoutem.advertising/app/services/withAdBanner.js) extension where we implement a screen decorator that renders ad banners on top of the screen, based on various parameters.\n\nOnce you write your decorator, you will need to register it, in order to be applied globally through the app. This is done in following way:\n\n\n```JavaScript\nimport { Decorators } from 'shoutem.navigation';\nimport { withAdBanner } from './services';\n\nDecorators.registerDecorator(withAdBanner);\n```\n\nThis concludes the most notable or breaking changes that were introduced with the new platform. We encourage all developers to take a look at our [extensions repository](https://github.com/shoutem/extensions) that contains all of our extensions, rewritten to be compliant with the new navigation. It should be a great example on how to make use of the new functionalities, or just how to solve some familiar problems when it comes to creating good and meaningful navigation flows in your apps.\n\nLastly, we are thankful for any feedback or suggestions you may have in regards to the new additions. Feel free to contact us via our usual [channels](https://shoutem.com/about/contact-us/support/).\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-02-Driver.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/driver\ntitle: Driver\nsection: Animation\n---\n\n# Driver\n\nAn animation is driven by the `driver`. It encapsulates the creation of animation [input events](https://facebook.github.io/react-native/docs/animations.html#input-events), making React Native animations even more declarative. Drivers are attached to animation components which are set to listen to specific driver inputs.\n\nCurrently, two drivers are supported:\n\n- `ScrollDriver`, that binds scrolling of React Native's [ScrollView](https://facebook.github.io/react-native/docs/scrollview.html) to the animation components and\n- `TimingDriver`, that creates animated values that change with time\n\n\n## ScrollDriver\n\nBinding is done by passing properties to `ScrollView`:\n\n```javascript\nimport React from 'react';\nimport { ScrollView } from 'react-native';\nimport { ScrollDriver } from '@shoutem/animation';\n\n\nclass Screen extends React.Component {\n  render() {\n    const driver = new ScrollDriver();\n\n    return (\n      <ScrollView {...driver.scrollViewProps}>\n        {/* Pass driver to animation components */}\n      </ScrollView>\n    );\n  }\n}\n```\n\n## TimingDriver\n\nAnimated value is changing with time:\n\n```javascript\nimport React from 'react';\nimport { View, Easing } from 'react-native';\nimport { TimingDriver, FadeIn } from '@shoutem/animation';\n\nclass Screen extends React.Component {\n  render() {\n    driver = new TimingDriver({\n      duration: 400 // 250 by default,\n      easing: Easing.inOut // Easing.cubic is passed by default\n      delay: 200 // 0 by default\n    });\n\n    return (\n      <View>\n        <FadeIn driver={driver}>\n          {/* Some components to fade in with time passing */}\n        </FadeIn>\n      </View>\n    )\n  }\n}\n```\n\nTo trigger the start of the timer, call `runTimer` method on `TimingDriver` instance. The signature of `runTimer` method is as follows:\n\n#### `runTimer(endValue, onFinish)`:\n\n- `endValue`: Number, when the timer reaches this value the animations will end\n- `onFinish` Function, callback that will be called upon reaching `endValue`\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-03-Animations.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/introduction\ntitle: Introduction\nsection: Animation\n---\n\n# Animation\n<hr />\n\nWhen building an app, there's always a need to create animations to enrich the user experience. Although React Native [provides a way](https://facebook.github.io/react-native/docs/animations.html) to implement arbitrary animations, it is not an easy task to do, even for simple animations. That's where `@shoutem/animation` package comes in. The package contains **animation [components](#components)** that should be wrapped around components that you want to animate, and [**drivers**](#driver) that _drive_ the animation components.\n\n## Installation\n\nSimply install it with:\n\n```ShellSession\n$ npm install @shoutem/animation\n```\n\n## New animations - coming soon\n\nWe're working hard to open source more `animation components` and `drivers`, which are already helping us in many [Shoutem extensions]({{ site.url }}/docs/extensions/tutorials/getting-started). Some of them are:\n\n**Drivers:**\n\n- `ComputionalDriver`\n- `TouchDriver`\n\n<br />\n**Animation components:**\n\n- `Slide`\n- several `Transitions`\n\n<br />\n\nStay tuned!\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-03-FadeIn.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/fade-in\ntitle: FadeIn\nsection: Animation\n---\n\n# FadeIn\n\nFades in components wrapped by it.\n\n<div class=\"video-screen\">\n  <video width=\"280\" loop autoplay>\n    <source src=\"/video/examples/03 fade in and out.mp4\" type=\"video/mp4\">\n    <source src=\"/video/examples/03 fade in and out.webm\" type=\"video/webm\">\n  </video>\n</div>\n\n## API\n\n#### Props\n\n- `driver`: Driver that is running the animation\n- `children`: Components that will be affected by the animation\n- `inputRange`: Array `[from, to]` including a `'from' animated value` and `'to' animated value`\n\n## Example\n<br />  \n  \n#### JSX declaration\n```javascript\nconst driver = new ScrollDriver();\n\nreturn (\n  <ScrollView\n    {...driver.scrollViewProps}\n  >\n    <FadeIn\n      driver={driver}\n      inputRange={[100,150]}\n    >\n      <Image />\n    </FadeIn>\n  </ScrollView>\n);\n```\n\nThe above code will create a scroll dependent fade in animation over `Image` component from scroll position 100 to scroll position 150 where `Image` is fully transparent at scroll position 100 and opaque at scroll position 150.\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-04-FadeOut.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/fade-out\ntitle: FadeOut\nsection: Animation\n---\n\n# FadeOut\n\nFades out components wrapped by it.\n\n<div class=\"video-screen\">\n  <video width=\"280\" loop autoplay>\n    <source src=\"/video/examples/03 fade in and out.mp4\" type=\"video/mp4\">\n    <source src=\"/video/examples/03 fade in and out.webm\" type=\"video/webm\">\n  </video>\n</div>\n\n## API\n\n#### Props\n\n- `driver`: Driver that is running the animation\n- `children`: Components that will be affected by the animation\n- `inputRange`: Array `[from, to]` including a `'from' animated value` and `'to' animated value`\n\n## Example\n<br />  \n  \n#### JSX declaration\n```javascript\nconst driver = new ScrollDriver();\n\nreturn (\n  <ScrollView\n    {...driver.scrollViewProps}\n  >\n    <FadeOut\n      driver={driver}\n      inputRange={[100,150]}\n    >\n      <Image />\n    </FadeOut>\n  </ScrollView>\n);\n```\n\nThe above code will create a scroll dependent fade out animation over `Image` component from scroll 100 to scroll 150 where `Image` is opaque at scroll 100, and fully transparent at scroll 150.\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-05-ZoomIn.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/zoom-in\ntitle: ZoomIn\nsection: Animation\n---\n\n# ZoomIn\n\nZooms in components wrapped by it.\n\n<div class=\"video-screen\">\n  <video width=\"280\" loop autoplay>\n    <source src=\"/video/examples/04 zoom in and out.mp4\" type=\"video/mp4\">\n    <source src=\"/video/examples/04 zoom in and out.webm\" type=\"video/webm\">\n  </video>\n</div>\n\n## API\n\n#### Props\n\n- `driver`: Driver that is running the animation\n- `children`: Components that will be affected by the animation\n- `inputRange`: Array `[from, to]` including a `'from' animated value` and `'to' animated value`\n- `maxFactor`: Number, factor to which `children` components will be zoomed in\n\n## Example\n<br />  \n\n#### JSX declaration\n```javascript\nconst driver = new ScrollDriver();\n\nreturn (\n  <ScrollView\n    {...driver.scrollViewProps}\n  >\n    <ZoomIn\n      driver={driver}\n      inputRange={[100,150]}\n      maxFactor={1.5}\n    >\n      <Image />\n    </ZoomIn>\n  </ScrollView>\n);\n```\n\nThe above code will create a scroll dependent zoom in animation over `Image` component from scroll 100 to scroll 150 where `Image` has its original size at scroll 100, and is scaled by maxFactor at scroll 150.\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-06-ZoomOut.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/zoom-out\ntitle: ZoomOut\nsection: Animation\n---\n\n# ZoomOut\n\nZooms out components wrapped by it.\n\n<div class=\"video-screen\">\n  <video width=\"280\" loop autoplay>\n    <source src=\"/video/examples/04 zoom in and out.mp4\" type=\"video/mp4\">\n    <source src=\"/video/examples/04 zoom in and out.webm\" type=\"video/webm\">\n  </video>\n</div>\n\n## API\n\n#### Props\n\n- `driver`: Driver that is running the animation\n- `children`: Components that will be affected by the animation\n- `inputRange`: Array `[from, to]` including a `'from' animated value` and `'to' animated value`\n- `maxFactor`: Number, factor to which `children` components will be zoomed out\n\n## Example\n<br />  \n  \n#### JSX declaration\n```javascript\nconst driver = new ScrollDriver();\n\nreturn (\n  <ScrollView\n    {...driver.scrollViewProps}\n  >\n    <ZoomOut\n      driver={driver}\n      inputRange={[100,150]}\n      maxFactor={1.5}\n    >\n      <Image />\n    </ZoomOut>\n  </ScrollView>\n);\n```\n\nThe above code will create a scroll dependent zoom out animation over `Image` component from scroll 100 to scroll 150 where `Image` is scaled by maxFactor at scroll 100 and has its original size at scroll 150.\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-07-Parallax.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/parallax\ntitle: Parallax\nsection: Animation\n---\n\n# Parallax\n\nAdds parallax effect to its children components. The children are translated depending on the scroll speed by default, but you can pass extrapolation options to limit the translation.\n\n<div class=\"video-screen\">\n  <video width=\"280\" loop autoplay>\n    <source src=\"/video/examples/01 parallax.mp4\" type=\"video/mp4\">\n    <source src=\"/video/examples/01 parallax.webm\" type=\"video/webm\">\n  </video>\n</div>\n\n## API\n\n#### Props\n\n- `driver`: Driver that is running the animation\n- `children`: Components that will be affected by the animation\n- `extrapolation`: Object, [extrapolation options](https://facebook.github.io/react-native/docs/animations.html#composing-animations) for parallax translation. By default, children will be translated by `scrollVector * (scrollSpeed - 1) * driver.value` where `scrollVector` is defined by scrolling direction\n- `scrollSpeed`: Number, how fast will the children be translated\n- `insideScroll` Bool, defines if the parallax placed is inside or outside of the `ScrollView`\n\n\n## Example\n<br />  \n  \n#### JSX declaration\n```javascript\nconst driver = new ScrollDriver();\n\nreturn (\n  <ScrollView\n    {...driver.scrollViewProps}\n  >\n    <Parallax\n      driver={driver}\n      scrollSpeed={2}\n    >\n      <Image />\n    </Parallax>\n    <Title>Title</Title>\n  </ScrollView>\n);\n```\n\nThe above code will create a scroll dependent parallax animation over `Image` component where `Image` will be scrolled 2 times faster than `Title`.\n"
  },
  {
    "path": "docs/ui-toolkit/animation/_posts/1970-01-08-CombiningAnimations.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/animation/combining-animations\ntitle: Combining animations\nsection: Animation\n---\n\n# Combining animations\n\nAnimations can be combined simply by wrapping each other.\n\n```javascript\nimport React, { Component } from 'react';\nimport { ScrollView } from 'react-native';\n\nimport {\n  Parallax,\n  HeroHeader,\n  FadeOut,\n  FadeIn,\n  ScrollDriver,\n} from '@shoutem/animation';\n\nimport {\n  Image,\n  Tile,\n  Title,\n  Text,\n  Subtitle,\n  View,\n} from '@shoutem/ui';\n\nexport default class MyAnimatedScreen extends Component {\n  getRestaurant() {\n    return {\n      name: \"Gaspar Brasserie\",\n      address: \"185 Sutter St, San Francisco, CA 94109\",\n      url: \"gasparbrasserie.com\",\n      image: { \"url\": \"https://shoutem.github.io/restaurants/restaurant-1.jpg\"},\n      mail: \"info@gasparbrasserie.com\"\n    };\n  }\n\n  render() {\n    const restaurant = this.getRestaurant();\n    const driver = new ScrollDriver();\n    return (\n      <ScrollView {...driver.scrollViewProps}>\n        <HeroHeader driver={driver}>\n          <Image\n            styleName=\"large-banner\"\n            source={% raw %}{{{% endraw %} uri: restaurant.image.url }}\n            key={restaurant.name}\n          >\n            <Tile>\n              <Parallax driver={driver} scrollSpeed={1.2} header>\n                <FadeIn inputRange={[-20, 0]} driver={driver}>\n                  <FadeOut inputRange={[100, 150]} driver={driver}>\n                    <Title>{restaurant.name}</Title>\n                    <Subtitle>{restaurant.address}</Subtitle>\n                  </FadeOut>\n                </FadeIn>\n              </Parallax>\n            </Tile>\n          </Image>\n        </HeroHeader>\n        <View\n          styleName=\"content\"\n          style={% raw %}{{{% endraw %}\n            backgroundColor: 'white',\n            height: 700,\n            padding: 15,\n          }}\n        >\n          <Text>\n            Gaspar is a delightful French restaurant in\n            San Francisco\\’s Financial District that is inspired by the romantic,\n            bustling Paris of old. Located near famed Union Square, our richly-designed\n            interiors make you feel as if you are truly in Paris and provide the perfect\n            setting for enjoying our exquisite classic and modern French fare such as Duck\n            Leg Confit and always popular Steak Frites. Gaspar offers two stories of dining\n            in addition to full bars both upstairs and downstairs and an exclusive room\n            reserved to hold the largest selection of Cognac in San Francisco.\n            In addition to our all day menu, we offer live jazz music on Saturdays.\n          </Text>\n        </View>\n      </ScrollView>\n    );\n  }\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-01-Introduction.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/introduction\ntitle: Introduction\nsection: UI toolkit\n---\n\n# Introduction\n\n![UI toolkit]({{ site.url }}/img/ui-toolkit/introduction@2x.jpg \"UI toolkit\"){:.docs-component-image}\n\nShoutem UI toolkit enables you to build professionally looking React Native apps with ease.  \n\nIt consists of three libraries: \n\n- [@shoutem/ui](https://github.com/shoutem/ui): beautiful and customizable UI [components]({{ site.url }}/docs/ui-toolkit/components/typography)\n- [@shoutem/theme](https://github.com/shoutem/theme): “CSS-way” of styling the entire app with [themes]({{ site.url }}/docs/ui-toolkit/theme/introduction)\n- [@shoutem/animation](https://github.com/shoutem/animation): declarative way of applying ready-made [animations]({{ site.url }}/docs/ui-toolkit/animation/introduction) \n\n\n## Prerequisites\nBefore starting make sure you have:\n\n- Installed [npm](https://www.npmjs.com/) (installed with [Node.js](https://nodejs.org/en/))\n- Installed [React Native](https://facebook.github.io/react-native/docs/getting-started.html)\n\n## Installation\n\nCreate new React Native project:\n\n```bash\n$ react-native init HelloWorld\n$ cd HelloWorld\n```\n\nInstall and link `@shoutem/ui` in your project:\n\n```bash\n$ npm install @shoutem/ui --save\n$ react-native link\n```\n\nTo check components in UI toolkit, simply copy the following to your `index.ios.js` file of React Native project:\n\n```JavaScript\n#file: index.ios.js\nimport React, { Component } from 'react';\nimport { Examples } from '@shoutem/ui';\n\nexport default class App extends Component<{}> {\n  render() {\n    return (\n      <Examples />\n    );\n  }\n}\n```\n\nFinally, run the app!\n\n```bash\n$ react-native run-ios\n```\n\nTo see other components, import them from `@shoutem/ui` and render them.\n\nYou can also use standard React Native components in your layouts anywhere you want, but they will not inherit either the theme or the parent styles, so you will need to style them manually.\n\n## Styling components\n\nAll components have default style defined by theme in [theme.js](https://github.com/shoutem/ui/blob/develop/theme.js) file in the root of `@shoutem/ui` package. Theme uses [styling rules]({{ site.url }}/docs/ui-toolkit/theme/introduction) interpreted by [@shoutem/theme](https://github.com/shoutem/theme) package.\n\nEach component can be customized with React Native inline styles or by using `styleName` properties. Style name is similar to CSS class - it contains a set of styles that is applied to a component, defined in theme\n\nListed below are common style names that can be used in several UI toolkit components and their variations.\n\n### Gutters\n\nA gutter is an empty space between a component's boundaries and the component's content.\n\nSet the same gutter for each side:\n\n* **sm-gutter**: small size, defaults to 5px\n* **md-gutter**: medium size, defaults to 15px\n* **lg-gutter**: large size, defaults to 30px\n* **xl-gutter**: extra large size, defaults to 45px\n  \n> On `View`, `Tile` and `Overlay` components, gutter is applied as padding, while on `Text` (Typography) and `Button` components gutter is applied as margin.    \n    \nSet the gutter for specific side:\n \n* **_size_-gutter-left**: applied to the left side of component\n* **_size_-gutter-right**: applied to the right side of component\n* **_size_-gutter-top**: applied to the top side of component\n* **_size_-gutter-bottom**: applied to the bottom side of component\n* **_size_-gutter-horizontal**: applied to horizontal sides (left and right) of component\n* **_size_-gutter-vertical**: applied only to vertical sides (top and bottom) of component\n\n### Other common style names\n\n* **rounded-corners**: applies border radius (defaults to 2 px) to component\n* **flexible**: applies `flexbox` to component so it fills parent container component\n* **inflexible**: component is sized according to its width/height properties but completely inflexible\n* **collapsible**: causes the component to shrink if it overflows parent container\n* **stretch**: causes the component to fully fill parent container\n\n\n### Example\n  \nBelow is one example where and how common style names can be used:  \n<br />  \n\n#### JSX Declaration\n```JSX\n<Overlay>\n  <Overlay styleName=\"collapsed\"><Heading>-20%</Heading></Overlay>\n  <Title styleName=\"md-gutter-top\">COOL BLACK AND WHITE STYLISH WATCHES</Title>\n  <Subtitle styleName=\"line-through sm-gutter-top\">$280.00</Subtitle>\n  <Heading>$250.00</Heading>\n  <Button styleName=\"md-gutter-top\"><Icon name=\"cart\" /><Text>ADD TO BASKET</Text></Button>\n</Overlay>\n```\n\nCheck [Shoutem Theme]({{ site.url }}/docs/ui-toolkit/theme/introduction \"Shoutem Theme\") to learn more about styling rules, style names and how to define your own style name.\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-02-Typography.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/typography\ntitle: Typography\nsection: UI toolkit\n---\n\n# Typography\n\nTypography components consist of several flavors of `Text` components with predefined styles. Available components are:\n\n```JSX\n<Heading>...</Heading>\n<Title>...</Title>\n<Subtitle>...</Subtitle>\n<Text>...</Text>\n<Caption>...</Caption>\n```\n\n![Title example]({{ site.url }}/img/ui-toolkit/typography/title@2x.png \"Title\"){:.docs-component-image}\n\n## API\n\n#### Props\n* Every component in this section supports every `prop` that the standard React Native `Text` component supports (eg. `numberOfLines`). You can see the full list of available props on React Native [Text component documentation](https://facebook.github.io/react-native/docs/text.html \"React Native Text component documentation\").\n\n#### Style names\n\n* **bold**: Sets text to be bold\n* **h-center**: Centers the text horizontally\n* **line-through**: Defines a line through the text\n* **multiline**: Increases line-height to allow text to wrap\n* **v-center**: Works only in combination with `multiline` styleName. Applies additional top and bottom margins to compensate the unsupported `textAlignVertical` prop on iOS\n* **secondary**: Applies secondary styles as defined in [theme](https://github.com/shoutem/ui/blob/develop/theme.js#L1011)\n\n## Examples\n\n### Heading\n![Heading example]({{ site.url }}/img/ui-toolkit/typography/heading@2x.png \"Heading\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Heading>Mobile App Creator</Heading>\n```\n\n### Title\n![Title example]({{ site.url }}/img/ui-toolkit/typography/title@2x.png \"Title\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Title>MOBILE APP CREATOR</Title>\n```\n\n### Subtitle\n![Subtitle example]({{ site.url }}/img/ui-toolkit/typography/subtitle@2x.png \"Subtitle\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Subtitle>Mobile App Creator</Subtitle>\n```\n\n### Text\n![Text example]({{ site.url }}/img/ui-toolkit/typography/text@2x.png \"Text\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Text>Mobile App Creator</Text>\n```\n\n### Caption\n![Caption example]({{ site.url }}/img/ui-toolkit/typography/caption@2x.png \"Caption\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Caption>Mobile App Creator</Caption>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-03-NavigationBar.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/navigation-bar\ntitle: NavigationBar\nsection: UI toolkit\n---\n\n# NavigationBar\n\nShoutem UI toolkit contains two different `NavigationBar` components:\n\n1) Simple 3-column `NavigationBar` that can be used on any screen or `Modal` window\n\n![Navbar / Solid example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-title-only@2x.png \"Navbar / Solid\"){:.docs-component-image}\n\n2) `Redux` and stack-based `NavigationBar` enables any view to act as a navigation view using reducers to manipulate state at a top-level object. Can be used only on components that are within the stack (i.e. it cannot be used on `Modal` window). Internally, it relies on [`NavigationExperimental`](https://github.com/shoutem/react-native-navigation-experimental-compat) from `react-native-navigation-experimental-compat`.\n\n# Simple NavigationBar\n\n## Import\n\n```JSX\nimport { NavigationBar } from '@shoutem/ui'\n```\n\n`NavigationBar` is `node` for [Navigator](https://facebook.github.io/react-native/docs/navigator.html#navigationbar) React Native component. It provides a simpler way to use 3-column navigation bar.\n\n## API\n\n#### Props\n\n* **title**: string\n  - Sets the `centerComponent` prop to a `Title` component with the provided string as the title text\n\n* **centerComponent**: object  \n  - Represents the center component in `NavigationBar` (e.g. screen title)\n\n* **leftComponent**: object  \n  - Represents the left component in `NavigationBar` (e.g. back button)\n\n* **rightComponent**: object\n  - Represents the right component in `NavigationBar` (e.g. drop-down menu button)\n\n* **hasHistory**: bool\n  - If set to `true`, the `leftComponent` will become a back arrow which triggers `navigateBack` on tap\n\n* **navigateBack**: function\n  - Callback triggered after tapping the `Back` button if `hasHistory` is set to `true`  \n\n#### Style names\n\n* **clear**: sets the `Text` color to white and background colors to transparent\n* **inline**: forces relative positioning of `NavigationBar` component, allowing component to be used inline with other components, i.e. `ListView`, without its content overlapping `NavigationBar`\n* **no-border**: removes the bottom border\n\n#### Style\n\n* **centerComponent**\n  - Style applied to center navigation component\n\n* **container**\n  - Style for `View` that holds all components within `NavigationBar`\n\n* **componentsContainer**\n  - Style for `View` container that holds `leftComponent`, `centerComponent` and `rightComponent` objects\n\n* **leftComponent**\n  - Style applied to left navigation component\n\n* **rightComponent**\n  - Style applied to right navigation component\n\n\n## Examples\n\n### Solid\n![Solid example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-title-only@2x.png \"Solid\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  centerComponent={<Title>TITLE</Title>}\n/>\n```\n\n### Showing Background Image\n![Clear (Image) example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-imageoverlay-image@2x.png \"Clear (Image)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  source={% raw %}{{{% endraw %}uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n  style={% raw %}{{{% endraw %} width: 375, height: 70 }}\n>\n  <NavigationBar\n    styleName=\"clear\"\n    centerComponent={<Title>TITLE</Title>}\n  />\n</ImageBackground>\n```\n\n### Navbar + Drawer\n![Navbar + Drawer example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-drawernav@2x.png \"Navbar + Drawer\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  leftComponent={<Icon name=\"sidebar\" />}\n  centerComponent={<Title>TITLE</Title>}\n/>\n```\n\n### Navbar + Picker\n![Navbar + Picker example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-picker@2x.png \"Navbar + Picker\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\nconstructor(props){\n  super(props);\n  this.state = {\n    filters: [\n      { name: 'Filter', value: 'Filter' },\n      { name: 'Sport', value: 'Sport' },\n      { name: 'Food', value: 'Food' },\n    ],\n  }\n}\n\nrender() {\n  return (\n    <NavigationBar\n      styleName=\"inline\"\n\n      leftComponent={\n        <Button>\n          <Icon name=\"sidebar\" />\n        </Button>\n      }\n      centerComponent={\n        <Title>\n          {this.state.selectedFilter\n            ? this.state.selectedFilter.value\n            : this.state.filters[0].value}\n        </Title>\n      }\n      rightComponent={\n        <DropDownMenu\n          options={this.state.filters}\n          selectedOption={this.state.selectedFilter ? this.state.selectedFilter : this.state.filters[0]}\n          onOptionSelected={(filter) => this.setState({ selectedFilter: filter })}\n          titleProperty=\"name\"\n          valueProperty=\"value\"\n        />\n      }\n    />\n  );\n}\n```\n\n### Navbar + Action\n![Navbar + Action example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-action@2x.png \"Navbar + Action\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  leftComponent={<Icon name=\"sidebar\" />}\n  centerComponent={<Title>TITLE</Title>}\n  rightComponent={(\n  <Button styleName=\"clear\">\n    <Text>List</Text>\n  </Button>\n)}\n/>\n```\n\n### Navbar + Icon Button\n![Navbar + Icon example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-icon@2x.png \"Navbar + Icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  leftComponent={<Icon name=\"sidebar\" />}\n  centerComponent={<Title>TITLE</Title>}\n  rightComponent={(\n    <Button>\n      <Icon name=\"cart\" />\n    </Button>\n  )}\n/>\n```\n\n### Navbar (Sublevel) + Icon\n![Navbar (Sublevel) + Icon example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-sublevel-icon@2x.png \"Navbar + (Sublevel) + icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  hasHistory\n  centerComponent={<Title>TITLE</Title>}\n  share={% raw %}{{{% endraw %}\n    link: 'http://shoutem.github.io',\n    text: 'This is the best',\n    title: 'Super cool UI Toolkit',\n  }}\n/>\n```\n\n### Navbar (Sublevel) + Action (no border)\n![Navbar (Sublevel) + Action (no border) example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-sublevel-action-no-border@2x.png \"Navbar (Sublevel) + Action (no border)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  styleName=\"no-border\"\n  hasHistory\n  centerComponent={<Title>TITLE</Title>}\n  share={% raw %}{{{% endraw %}\n    link: 'http://shoutem.github.io',\n    text: 'This is the best',\n    title: 'Super cool UI Toolkit',\n  }}\n/>\n```\n\n### Navbar (Sublevel) + Action\n![Navbar (Sublevel) + Action example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-sublevel-action@2x.png \"NavigationBar (Sublevel) + Action\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  hasHistory\n  centerComponent={<Title>TITLE</Title>}\n  rightComponent={(\n    <Button styleName=\"clear\">\n      <Text>Report</Text>\n    </Button>\n  )}\n/>\n```\n\n### Navbar (Modal) + Share Button\n![Navbar (Modal) + Share Button]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-modal-icon@2x.png \"Navbar (Modal) + Icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  leftComponent={(\n    <Button>\n      <Icon name=\"close\" />\n    </Button>\n  )}\n  centerComponent={<Title>TITLE</Title>}\n  share={% raw %}{{{% endraw %}\n    link: 'http://shoutem.github.io',\n    text: 'This is the best',\n    title: 'Super cool UI Toolkit',\n  }}\n/>\n```\n\n### Navbar (Modal) + Action\n![Navbar (Modal) + Action example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-modal-action@2x.png \"Navbar (Modal) + Action\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  leftComponent={(\n    <Button>\n      <Icon name=\"close\" />\n    </Button>\n  )}\n  centerComponent={<Title>TITLE</Title>}\n  rightComponent={(\n    <Button styleName=\"clear\">\n      <Text>Post</Text>\n    </Button>\n  )}\n/>\n```\n\n## Navbar (Modal) + Action 2\n![Navbar (Modal) + Action 2 example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-modal-action-2@2x.png \"Navbar (Modal) + Action\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  leftComponent={(\n    <Button>\n      <Text>Cancel</Text>\n    </Button>\n  )}\n  centerComponent={<Title>TITLE</Title>}\n  rightComponent={(\n    <Button>\n      <Text>Done</Text>\n    </Button>\n  )}\n/>\n```\n\n### Navbar (Modal) + Action 2 (disabled)\n![Navbar (Modal) + Action 2 (disabled) example]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-modal-action-2-disabled@2x.png \"Navbar (Modal) + Action (disabled)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  leftComponent={(\n    <Button>\n      <Text>Cancel</Text>\n    </Button>\n  )}\n  centerComponent={<Title>TITLE</Title>}\n  rightComponent={(\n    <Button styleName=\"muted\">\n      <Text>Done</Text>\n    </Button>\n  )}\n/>\n```\n\n### Navbar (Sublevel) + Share + Showing Background Color\n![Navbar (Sublevel) + Share + Showing Background Color]({{ site.url }}/img/ui-toolkit/navigationbar/navbar-sublevel-action-no-border-copy@2x.png \"Navbar / On primary color / back + share\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<NavigationBar\n  styleName=\"clear\"\n  hasHistory\n  centerComponent={<Title>TITLE</Title>}\n  share={% raw %}{{{% endraw %}\n    link: 'http://shoutem.github.io',\n    text: 'This is the best',\n    title: 'Super cool UI Toolkit',\n  }}\n/>\n```\n\n# Redux and stack-based NavigationBar with CardStack\n\n## Import\n\n```JSX\nimport { NavigationBar } from '@shoutem/ui/navigation'\n```\n\nThis `NavigationBar` and `CardStack` components provide simpler API for navigation between `Screens` (scenes) with respect to its underlying [Redux](https://github.com/reactjs/redux)-based `NavigationExperimental` React Native component.\n\n## NavigationBar\n\n## API\n\n#### Props\n\n* **renderLeftComponent**: function  \n  - Function that should return components representing left component in `NavigationBar` (example: back button)\n  - Note that outermost component returned by this function should be `View` that has `container` styleName and `virtual` prop\n\n* **renderRightComponent**: function\n  - Function that should return components representing right component in `NavigationBar` (example: drop-down menu button)\n  - Note that outermost component returned by this function should be `View` that has `container` styleName and `virtual` prop\n\n* **onNavigateBack**: function\n  - This callback is triggered after tapping the Back button if `hasHistory` Prop is set to `true`  \n\n* **renderTitleComponent**: function  \n  - Function that should return components representing center/title component, allowing you to override the default `title` component/prop in `NavigationBar`\n  - Note that outermost component returned by this function should be `View` that has `container` styleName and `virtual` prop\n\n* **title**: string\n  - Prop that defines screen title\n\n#### Style names\n\n* **clear**: sets the `Text` color to white and background colors to transparent\n* **fade**: sets the `Text` color to white and applies linear gradient to background\n* **no-border**: removes the bottom border\n\n#### Style\n\n* **centerComponent**\n  - Style applied to center Navigation component\n\n* **container**\n  - Style prop for `View` that holds all components within `NavigationBar`\n\n* **componentsContainer**\n  - Style prop for `View` container that holds `leftComponent`, `centerComponent` and `rightComponent` objects\n\n* **leftComponent**\n  - Style applied to left Navigation component\n\n* **rightComponent**\n  - Style applied to right Navigation component\n\n## CardStack\n\n## API\n\n#### Props\n\n* **navigationState**: object  \n  - Object containing current navigation state (stack)\n\n* **onNavigateBack**: function\n  - This callback is triggered after tapping the Back button (usually in `leftComponent`)\n\n* **renderNavBar**: function\n  - Function that should return components representing actual `NavigationBar` `View` (container)\n\n* **renderScene**: function  \n  - Function that should return/render Screen (scene) depending on stack content (current topmost route)\n\n#### Style names\n\n* None\n\n#### Style\n\n* None\n\n## Example\n\nIn order to use this `NavigationBar` component, you will need to initialize `CardStack` as root component of your application and define base `NavigationBar.View` which will hold actual `NavigationBar` according to provided props.  \n<br />  \n\n#### JSX Declaration\n```JSX\nclass App extends Component {\n  static propTypes = {\n    onNavigateBack: React.PropTypes.func.isRequired,\n    navigationState: React.PropTypes.object,\n    scene: React.PropTypes.object,\n  };\n\n  constructor(props) {\n    super(props);\n\n    this.renderNavBar = this.renderNavBar.bind(this);\n    this.renderScene = this.renderScene.bind(this);\n  }\n\n  renderScene(props) {\n    const { route } = props.scene;\n\n    let Screen = route.key === 'RestaurantDetails' ? RestaurantDetails : RestaurantsList;\n    return (<Screen {...route.props} />);\n  }\n\n  renderNavBar(props) {\n    const { onNavigateBack } = this.props;\n\n    return (\n      <NavigationBar.View\n        {...props}\n        onNavigateBack={onNavigateBack}\n      />\n    );\n  }\n\n  render() {\n    const { navigationState, onNavigateBack } = this.props;\n\n    return (\n      <CardStack\n        navigationState={navigationState}\n        onNavigateBack={onNavigateBack}\n        renderNavBar={this.renderNavBar}\n        renderScene={this.renderScene}\n      />\n    );\n  }\n}\n```\n\nAlso, on each screen where you want to have NavigationBar, you'll need to define it as every other component.  \n\n```JSX\n<NavigationBar\n  title=\"title goes here\"\n  styleName=\"clear\"\n/>\n```\n\nNote that example above is just a part of required code. For a full example, refer to RestaurantApp [example](https://github.com/shoutem/ui/blob/develop/examples/RestaurantsApp/app/), where `App` is root application component holding code above.\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-04-DropDownMenu.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/dropdown-menu\ntitle: DropDownMenu\nsection: UI toolkit\n---\n\n# DropDownMenu\n\nDropDownMenu is a full-screen contextual menu for displaying lists of items.\n\n![DropDownMenu example]({{ site.url }}/img/ui-toolkit/dropdownmenu/drop_down_menu@2x.png \"DropDownMenu\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n* **onOptionSelected(option: object)**: function  \n  - Called after tapping an option from menu, with all Props from that option passed to the function\n\n* **options**: array  \n  - Array of options that are rendered as `Button`s within `ListView`\n\n* **selectedOption**: any\n  - Sets which `option` from the `options` array is selected by default\n\n* **titleProperty**: string\n  - Attribute that defines what `key` from `options` Prop will be used to render option Titles in Dropdown menu\n\n* **valueProperty**: string\n  - Attribute that defines what `key` from `options` Prop will be used to link an option from `options` with `id` in Dropdown menu\n\n* **visibleOptions**: number\n  - Sets a number of options shown without scroll in Dropdown menu. Can also be set through style, note that defining through Props overrides definition in Style\n\n#### Style names\n\n* **horizontal**: renders a full-width selected option button with background color (defaults to gray), as defined in Theme\n\n#### Style\n\n* **modal**\n  - Style prop for the outermost `View` within `Modal` component\n\n* **modalItem**\n  - Style prop that holds single item (row) in `ListView`\n\n* **selectedOption**\n  - Style prop for a dropdown `Button` that opens a full-screen contextual menu and represents currently selected option\n\n* **visibleOptions**\n  - Sets a number of options shown without scroll in Dropdown menu. Can also be set through Props, note that defining through Props overrides definition in Style\n\n## Examples\n\n```JSX\nconstructor(props){\n  super(props);\n  this.state = {\n    cars: [\n      {\n        brand: \"Audi\",\n        models:\n          {\n            model: \"Audi R8\",\n            image: {\n              url: \"https://shoutem.github.io/img/ui-toolkit/dropdownmenu/Audi-R8.jpg\"\n            },\n            description: \"Exclusively designed by Audi AG's \"\n            + \"private subsidiary company, Audi Sport GmbH.\"\n          }\n      },\n      {\n        brand: \"Bugatti\",\n        models: {\n          model: \"Chiron\",\n          image: {\n            url: \"https://shoutem.github.io/img/ui-toolkit/dropdownmenu/Chiron.jpg\"\n          },\n          description: \"Bugatti premiered the Bugatti \"\n            + \"Chiron as a successor to the Veyron.\"\n        }\n      },\n      {\n        brand: \"Chrysler\",\n        models: {\n          model: \"Dodge Viper\",\n          image: {\n            url: \"https://shoutem.github.io/img/ui-toolkit/dropdownmenu/Dodge-Viper.jpg\"\n          },\n          description: \"The Dodge Viper is a super car \"\n            + \"manufactured by Dodge (SRT for 2013 and 2014).\"\n        }\n      },\n    ],\n  }\n}\n\nrender() {\n  const selectedCar = this.state.selectedCar || this.state.cars[0];\n\n  return (\n    <Screen>\n      <NavigationBar\n        title=\"Cars\"\n        styleName=\"inline\"\n      />\n      <DropDownMenu\n        styleName=\"horizontal\"\n        options={this.state.cars}\n        selectedOption={selectedCar ? selectedCar : this.state.cars[0]}\n        onOptionSelected={(car) => this.setState({ selectedCar: car })}\n        titleProperty=\"brand\"\n        valueProperty=\"cars.model\"\n      />\n      <Title styleName=\"h-center\">\n        {selectedCar ?\n          selectedCar.models.model :\n          this.state.cars[0].models.model}\n      </Title>\n      <Image\n        styleName=\"large\"\n        source={{\n          uri: selectedCar ?\n            selectedCar.models.image.url :\n            this.state.cars[0].models.image.url\n        }}\n      />\n      <Text styleName=\"md-gutter-horizontal\">\n        {selectedCar ?\n          selectedCar.models.description :\n          this.state.cars[0].models.description}\n      </Text>\n    </Screen>\n  );\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-05-ListView.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/list-view\ntitle: ListView\nsection: UI toolkit\n---\n\n# ListView\n\nListView component is a base component used to render Lists of items, as well as a featured first item with a unique layout. This component is also used by GridView to create Grid-like menu structures. Under the hood, it uses React Native's `FlatList` and `SectionList`.\n\n![ListView example]({{ site.url }}/img/ui-toolkit/listview/list_view@2x.png \"ListView\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n* **autoHideHeader**: bool\n  - Prop defining if ListView header should automatically hide\n\n* **data**: array  \n  - Prop containing items that will be rendered by the ListView component\n\n* **loading**: bool  \n  - Prop that defines whether the ListView should render loading spinner (to indicate it's still loading data) or actual items (when the data is successfully loaded)\n\n* **onLoadMore()**: function  \n  - Called when the ListView is scrolled all the way to the bottom of the first page.\n  - In this function you should update `data` array (state) with additional items\n\n* **onRefresh()**: function  \n  - Called when the ListView is pulled down, triggering the refresh action.\n  - In this function you should update `data` array (state) with new items\n  - If this function is declared, the Component will be considered refreshable\n\n* **getSectionId()**: function\n  - Function that returns the section ID, this ID is used to group the items into a section\n\n* **sections**: array\n  - Prop containing an array of individual sections to be rendered, as defined [here](https://facebook.github.io/react-native/docs/sectionlist#sections)\n\n* **renderRow(item: Object)**: function  \n  - Function that renders each item (row) from `data`\n\n* **renderHeader()**: function  \n  - Function that renders the Header content\n\n* **renderFooter()**: function  \n  - Function that renders the Footer content\n\n* **renderSectionHeader()**: function  \n  - Function that renders the Section Header content\n\n* **hasFeaturedItem**: bool\n  - Prop that defines whether or not the ListView being rendered has a featured item\n\n* **renderFeaturedItem()**: function\n  - Function that renders\n  - _Note:_ If passing a `sections` prop, `renderFeaturedItem` will be ignored, since you can simply create a `section` containing the featured item along with it's render function.\n\n#### Style\n\n* **list**\n  - These Props are passed to Style Prop of underlying React-Native `ListView` component  \n\n* **listContent**\n  - These Props are passed to `contentContainerStyle` Prop of underlying React-Native `ListView` component  \n\n* **loadMoreSpinner**\n  - These Props are passed to Style Prop of the `Spinner` component that appears during initial content loading  \n\n* **refreshControl**\n  - These Props are passed to Style Prop of the `RefreshControl` component.  \n  - You can also define `refreshControl.tintColor` prop in this Style, which is passed to the `tintColor` prop of the `RefreshControl` component.\n\n## Examples\n![ListView example]({{ site.url }}/img/ui-toolkit/listview/listview-example.png \"ListView\"){:.docs-component-image}\n\n### Simple list example\n<br/>\n#### JSX declaration\n```JSX\nconstructor(props) {\n  super(props\n\n  this.renderRow = this.renderRow.bind(this);\n\n  this.state = {\n    restaurants: [\n      {\n        \"name\": \"Gaspar Brasserie\",\n        \"address\": \"185 Sutter St, San Francisco, CA 94109\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" },\n      },\n      {\n        \"name\": \"Chalk Point Kitchen\",\n        \"address\": \"527 Broome St, New York, NY 10013\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-2.jpg\" },\n      },\n      {\n        \"name\": \"Kyoto Amber Upper East\",\n        \"address\": \"225 Mulberry St, New York, NY 10012\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-3.jpg\" },\n      },\n      {\n        \"name\": \"Sushi Academy\",\n        \"address\": \"1900 Warner Ave. Unit A Santa Ana, CA\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-4.jpg\" },\n      },\n      {\n        \"name\": \"Sushibo\",\n        \"address\": \"35 Sipes Key, New York, NY 10012\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-5.jpg\" },\n      },\n      {\n        \"name\": \"Mastergrill\",\n        \"address\": \"550 Upton Rue, San Francisco, CA 94109\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-6.jpg\" },\n      }\n    ],\n  }\n}\n\nrenderRow(restaurant) {\n  if (!restaurant) {\n    return null;\n  }\n\n  return (\n    <View>\n      <ImageBackground\n        styleName=\"large-banner\"\n        source={% raw %}{{{% endraw %} uri: restaurant.image.url }}\n      >\n        <Tile>\n          <Title styleName=\"md-gutter-bottom\">{restaurant.name}</Title>\n          <Subtitle styleName=\"sm-gutter-horizontal\">{restaurant.address}</Subtitle>\n        </Tile>\n      </ImageBackground>\n      <Divider styleName=\"line\" />\n    </View>\n  );\n}\n\nrender() {\n  const { restaurants } = this.state;\n\n  return (\n    <Screen>\n      <NavigationBar\n        title=\"Restaurants\"\n        styleName=\"inline\"\n      />\n      <ListView\n        data={restaurants}\n        renderRow={this.renderRow}\n      />\n    </Screen>\n  );\n}\n```\n\n### Rendering a featured item\n<br/>\n#### JSX declaration\n```JSX\nconstructor(props) {\n  super(props\n\n  this.renderRow = this.renderRow.bind(this);\n  this.renderFeaturedItem = this.renderFeaturedItem.bind(this);\n\n  this.state = {\n    restaurants: [\n      {\n        \"name\": \"Gaspar Brasserie\",\n        \"address\": \"185 Sutter St, San Francisco, CA 94109\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" },\n      },\n      {\n        \"name\": \"Chalk Point Kitchen\",\n        \"address\": \"527 Broome St, New York, NY 10013\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-2.jpg\" },\n      },\n      {\n        \"name\": \"Kyoto Amber Upper East\",\n        \"address\": \"225 Mulberry St, New York, NY 10012\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-3.jpg\" },\n      },\n      {\n        \"name\": \"Sushi Academy\",\n        \"address\": \"1900 Warner Ave. Unit A Santa Ana, CA\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-4.jpg\" },\n      },\n      {\n        \"name\": \"Sushibo\",\n        \"address\": \"35 Sipes Key, New York, NY 10012\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-5.jpg\" },\n      },\n      {\n        \"name\": \"Mastergrill\",\n        \"address\": \"550 Upton Rue, San Francisco, CA 94109\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-6.jpg\" },\n      }\n    ],\n  }\n}\n\nrenderFeaturedItem(restaurant) {\n  if (!restaurant) {\n    return null;\n  }\n\n  return (\n    <View styleName=\"sm-gutter featured\">\n      <ImageBackground\n        styleName=\"featured placeholder\"\n        source={% raw %}{{{% endraw %} uri: restaurant.image.url }}\n      >\n        <Tile>\n          <Title>{(restaurant.name || '').toUpperCase()}</Title>\n          <View styleName=\"horizontal md-gutter-top\" virtual>\n            <Caption\n              styleName=\"collapsible\"\n              numberOfLines={1}>\n              {restaurant.address}\n            </Caption>\n          </View>\n        </Tile>\n      </ImageBackground>\n    </View>\n  );\n}\n\nrenderRow(restaurant) {\n  if (!restaurant) {\n    return null;\n  }\n\n  return (\n    <View>\n      <ImageBackground\n        styleName=\"large-banner\"\n        source={% raw %}{{{% endraw %} uri: restaurant.image.url }}\n      >\n        <Tile>\n          <Title styleName=\"md-gutter-bottom\">{restaurant.name}</Title>\n          <Subtitle styleName=\"sm-gutter-horizontal\">{restaurant.address}</Subtitle>\n        </Tile>\n      </ImageBackground>\n      <Divider styleName=\"line\" />\n    </View>\n  );\n}\n\nrender() {\n  const { restaurants } = this.state;\n\n  return (\n    <Screen>\n      <NavigationBar\n        title=\"Restaurants\"\n        styleName=\"inline\"\n      />\n      <ListView\n        data={restaurants}\n        renderFeaturedItem={this.renderFeaturedItem}\n        renderRow={this.renderRow}\n      />\n    </Screen>\n  );\n}\n```\n\n### Rendering sections example\n<br/>\n#### JSX declaration\n```JSX\nconstructor(props) {\n  super(props\n\n  this.renderRow = this.renderRow.bind(this);\n\n  this.state = {\n    restaurants: [\n      {\n        \"name\": \"Gaspar Brasserie\",\n        \"address\": \"185 Sutter St, San Francisco, CA 94109\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" },\n      },\n      {\n        \"name\": \"Chalk Point Kitchen\",\n        \"address\": \"527 Broome St, New York, NY 10013\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-2.jpg\" },\n      },\n      {\n        \"name\": \"Kyoto Amber Upper East\",\n        \"address\": \"225 Mulberry St, New York, NY 10012\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-3.jpg\" },\n      },\n      {\n        \"name\": \"Sushi Academy\",\n        \"address\": \"1900 Warner Ave. Unit A Santa Ana, CA\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-4.jpg\" },\n      },\n      {\n        \"name\": \"Sushibo\",\n        \"address\": \"35 Sipes Key, New York, NY 10012\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-5.jpg\" },\n      },\n      {\n        \"name\": \"Mastergrill\",\n        \"address\": \"550 Upton Rue, San Francisco, CA 94109\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-6.jpg\" },\n      }\n    ],\n  }\n}\n\nrenderRow(restaurant) {\n  if (!restaurant) {\n    return null;\n  }\n\n  return (\n    <View>\n      <ImageBackground\n        styleName=\"large-banner\"\n        source={% raw %}{{{% endraw %} uri: restaurant.image.url }}\n      >\n        <Tile>\n          <Title styleName=\"md-gutter-bottom\">{restaurant.name}</Title>\n          <Subtitle styleName=\"sm-gutter-horizontal\">{restaurant.address}</Subtitle>\n        </Tile>\n      </ImageBackground>\n      <Divider styleName=\"line\" />\n    </View>\n  );\n}\n\nrender() {\n  const { restaurants } = this.state;\n\n  const sections = {[\n    { title: 'New York', data: { restaurants[1], restaurants[2], restaurants[4] }},\n    { title: 'San Francisco', data: { restaurants[0], restaurants[5] }},\n    { title: 'Santa Ana', data: { restaurants[3] }},\n  ]};\n\n  return (\n    <Screen>\n      <NavigationBar\n        title=\"Restaurants\"\n        styleName=\"inline\"\n      />\n      <ListView\n        sections={sections}\n        renderRow={this.renderRow}\n      />\n    </Screen>\n  );\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-06-GridView.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/grid-view\ntitle: GridView\nsection: UI toolkit\n---\n\n# GridView\n\nSimilar to [ListView]({{ site.url }}/docs/ui-toolkit/components/list-view), `GridView` is used to render Grid of items.  \n\n![GridView (GridRow) example]({{ site.url }}/img/ui-toolkit/gridview/grid_view@2x.png \"Grid View\"){:.docs-component-image}\n\nInstead of having a separate `GridView` component, you should use `GridRow` component to encapsulate a single row of items (cells), and then pass the `GridRow` as a normal row to a `ListView` component which does the actual content rendering.  \n\nThe main idea behind this approach is to allow developers to have a variable number of columns in each row, for example, the first row can have only 1 column, followed by a number of rows with 2 columns.  \n\n## API\n\n#### Props\n\n* **columns**: number  \n  - Number of columns in the GridRow\n\n#### Style names\n\n`GridView` has no specific style names.\n\n#### Methods\n\n* **groupByRows(data: *array*, columns: *number*, getColumnSpan: *function*)**\n  - **data**: *array* containing all items.\n  - **columns**: *number* defining number of columns in grid.\n  - **getColumnSpan**: *function* (optional) returns the column span of a single element. Each element has a span of 1 by default.\n  - returns an array of rows, where each row is an array of data elements.\n\n## Example\n\n![GridView (GridRow) example]({{ site.url }}/img/ui-toolkit/gridview/gridview-example.png \"Grid View\"){:.docs-component-image}\n\n\n#### JSX declaration\n```JSX\nconstructor(props) {\n  super(props);\n  this.renderRow = this.renderRow.bind(this);\n  this.state = {\n    restaurants: [\n      {\n        \"name\": \"Gaspar Brasserie\",\n        \"address\": \"185 Sutter St, San Francisco, CA 94109\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" },\n      },\n      {\n        \"name\": \"Chalk Point Kitchen\",\n        \"address\": \"527 Broome St, New York, NY 10013\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-2.jpg\" },\n      },\n      {\n        \"name\": \"Kyoto Amber Upper East\",\n        \"address\": \"225 Mulberry St, New York, NY 10012\",\n        \"image\": { \"url\": \"https://shoutem.github.io/static/getting-started/restaurant-3.jpg\" },\n      }\n    ],\n  }\n}\n\nrenderRow(rowData, sectionId, index) {\n  // rowData contains grouped data for one row,\n  // so we need to remap it into cells and pass to GridRow\n  if (index === '0') {\n    return (\n      <TouchableOpacity key={index}>\n        <ImageBackground\n          styleName=\"large\"\n          source={% raw %}{{{% endraw %} uri: rowData[0].image.url }}\n        >\n          <Tile>\n            <Title styleName=\"md-gutter-bottom\">{rowData[0].name}</Title>\n            <Subtitle styleName=\"sm-gutter-horizontal\">{rowData[0].address}</Subtitle>\n          </Tile>\n        </ImageBackground>\n        <Divider styleName=\"line\" />\n      </TouchableOpacity>\n    );\n  }\n\n  const cellViews = rowData.map((restaurant, id) => {\n    return (\n      <TouchableOpacity key={id} styleName=\"flexible\">\n        <Card styleName=\"flexible\">\n          <Image\n            styleName=\"medium-wide\"\n            source={% raw %}{{{% endraw %} uri: restaurant.image.url  }}\n          />\n          <View styleName=\"content\">\n            <Subtitle numberOfLines={3}>{restaurant.name}</Subtitle>\n            <View styleName=\"horizontal\">\n              <Caption styleName=\"collapsible\" numberOfLines={2}>{restaurant.address}</Caption>\n            </View>\n          </View>\n        </Card>\n      </TouchableOpacity>\n    );\n  });\n\n  return (\n    <GridRow columns={2}>\n      {cellViews}\n    </GridRow>\n  );\n}\n\nrender() {\n  const restaurants = this.state.restaurants;\n  // Group the restaurants into rows with 2 columns, except for the\n  // first restaurant. The first restaurant is treated as a featured restaurant\n  let isFirstArticle = true;\n  const groupedData = GridRow.groupByRows(restaurants, 2, () => {\n    if (isFirstArticle) {\n      isFirstArticle = false;\n      return 2;\n    }\n    return 1;\n  });\n\n  return (\n    <Screen>\n      <NavigationBar\n        title=\"Restaurants\"\n        styleName=\"inline\"\n      />\n      <ListView\n        data={groupedData}\n        renderRow={this.renderRow}\n      />\n    </Screen>\n  );\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-07-Cards.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/cards\ntitle: Cards\nsection: UI toolkit\n---\n\n# Cards\n\nCards have become very popular in recent years. They are useful when displaying interactive content composed of different elements.\n\n![Card grid item example]({{ site.url }}/img/ui-toolkit/cards/card@2x.png \"Card grid item\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n* `Card` has no specific (custom) Props, however, it supports every prop that the standard React Native `View` component supports. For full list of available props, visit\n[React Native View component documentation](https://facebook.github.io/react-native/docs/view.html \"React Native View component documentation\").\n\n#### Style names\n\n`Card` has no specific style names, however the `View` component nested under `Card` can use the following Style name:\n  * **content**: adds standard card margins to any child component\n\n## Examples\n\n#### Card grid item\n![Card grid item example]({{ site.url }}/img/ui-toolkit/cards/card@2x.png \"Card grid item\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Card>\n  <Image\n    styleName=\"medium-wide\"\n      source={% raw %}{{{% endraw %}uri: '{{site.url}}/img/ui-toolkit/examples/image-10.png'}}\n  />\n  <View styleName=\"content\">\n    <Subtitle>Choosing The Right Boutique Hotel For You</Subtitle>\n    <Caption>21 hours ago</Caption>\n  </View>\n</Card>\n```\n\n## Card + Icon\n![Card grid item + Icon example]({{ site.url }}/img/ui-toolkit/cards/card-icon@2x.png \"Card grid item + Icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Card>\n  <Image\n    styleName=\"medium-wide\"\n    source={% raw %}{{{% endraw %}uri: '{{site.url}}/img/ui-toolkit/examples/image-12.png'}}\n  />\n  <View styleName=\"content\">\n    <Subtitle>Choosing The Right Boutique Hotel For You</Subtitle>\n    <View styleName=\"horizontal v-center space-between\">\n      <Caption>21 hours ago</Caption>\n      <Button styleName=\"tight clear\"><Icon name=\"add-event\" /></Button>\n    </View>\n  </View>\n</Card>\n```\n\n## Card + Icon (Shop)\n![Card grid item + Icon (Shop) example]({{ site.url }}/img/ui-toolkit/cards/card-icon-shop@2x.png \"Card grid item + Icon (Shop)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Card>\n  <Image\n    styleName=\"medium-wide\"\n    source={% raw %}{{{% endraw %}uri: '{{site.url}}/img/ui-toolkit/examples/image-11.png'}}\n  />\n  <View styleName=\"content\">\n    <Subtitle>Choosing The Right Boutique Hotel For You</Subtitle>\n    <View styleName=\"horizontal v-center space-between\">\n      <View styleName=\"horizontal\">\n        <Subtitle styleName=\"md-gutter-right\">$99.99</Subtitle>\n        <Caption styleName=\"line-through\">$120.00</Caption>\n      </View>\n      <Button styleName=\"tight clear\"><Icon name=\"cart\" /></Button>\n    </View>\n  </View>\n</Card>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-08-Dividers.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/dividers\ntitle: Dividers\nsection: UI toolkit\n---\n\n# Dividers\n\nDividers are components used to add space or any other separator between other components.\n\n![Divider example]({{ site.url }}/img/ui-toolkit/dividers/divider@2x.png \"Divider\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n`Divider` has no specific (custom) Props, however, it supports every prop that the standard React Native `View` component supports. For full list of available props, visit\n[React Native View component documentation](https://facebook.github.io/react-native/docs/view.html \"React Native View component documentation\").\n\n#### Style names\n\n* **line**: defines a line `Divider` (thin line), instead of standard (rectangle) `Divider`\n  * **small**: can be used only with `line` style name, and sets the width to 55 px\n  * **center**: can be used only with `line` style name, and centers the line within parent container\n* **section-header**: applies different styling with additional vertical border (as defined in Theme)\n\n## Examples\n\n### Divider\n![Divider example]({{ site.url }}/img/ui-toolkit/dividers/divider@2x.png \"Divider\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Divider />\n```\n\n### Line divider\n![Line divider example]({{ site.url }}/img/ui-toolkit/dividers/line-divider@2x.png \"Line divider\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Divider styleName=\"line\" />\n```\n\n### Section divider  \nSection dividers are usually used in lists to separate groups of similar list items, for example to group contacts by the first letter of their name. ListView will automatically style all dividers added to it.\n\n![Section divider example]({{ site.url }}/img/ui-toolkit/dividers/section-divider@2x.png \"Section divider\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Divider styleName=\"section-header\" />\n```\n\n### Section divider + Label\n![Section divider + Label example]({{ site.url }}/img/ui-toolkit/dividers/section-divider-label@2x.png \"Section divider + Label\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Divider styleName=\"section-header\">\n  <Caption>INFORMATION</Caption>\n</Divider>\n```\n\n### Section divider + Label + Caption\n![Section divider + Label + Caption example]({{ site.url }}/img/ui-toolkit/dividers/section-divider-lavel-caption@2x.png \"Section divider + Label + Caption\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Divider styleName=\"section-header\">\n  <Caption>PRODUCT NAME</Caption>\n  <Caption>PRICE</Caption>\n</Divider>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-09-Rows.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/rows\ntitle: Rows\nsection: UI toolkit\n---\n\n# Rows\n\n`Row` is a container that renders its children horizontally.\n\n![Small list item + Icon + Description Row example]({{ site.url }}/img/ui-toolkit/rows/small-list-item-icon-description@2x.png \"Small list item + Icon + Description\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n`Row` has no specific (custom) Props, however, it supports every prop that the standard React Native `View` component supports. For full list of available props, visit\n[React Native View component documentation](https://facebook.github.io/react-native/docs/view.html \"React Native View component documentation\").\n\n#### Style names  \n\n* **small**: sets the fixed height of Row to 65px  \n* Nested components can also use these Style names:  \n  * **disclosure**: applicable only for `Icon` components within `Row`. Pulls the icon to the right, and sets opacity to 50%  \n  * **notification-dot**: applicable only for `View` components within  `Row`. Pulls the notification dot to the left of the content  \n  * **right-icon**: applicable only for `Button` components within `Row`\n  * **top**: applicable to any component nested within `Row`. Positions the component with `top` style to the beginning of `Row` component\n  * **vertical**: applicable only for `View` components within `Row`. Adds a bottom margin below each `View` in `Row`\n\n## Examples\n\n### Small list item\n![Small list item Row example]({{ site.url }}/img/ui-toolkit/rows/small-list-item@2x.png \"Small list item\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <Text numberOfLines={1}>Portland ugh fashion axe Helvetica, YOLO Echo Party</Text>\n</Row>\n```\n\n### Small list item + Avatar thumbnail\n![Small list item + Avatar thumbnail Row example]({{ site.url }}/img/ui-toolkit/rows/small-list-item-avatar@2x.png \"Small list item + Avatar thumbnail\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row styleName=\"small\">\n  <Image\n    styleName=\"small-avatar\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-9.png' }}\n  />\n  <Text>Add comment</Text>\n</Row>\n```\n\n### Small list item + Icon\n![Small list item + Icon Row example]({{ site.url }}/img/ui-toolkit/rows/small-list-item-icon@2x.png \"Small list item + Icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row styleName=\"small\">\n  <Icon name=\"add-to-favorites-off\" />\n  <Text>Add to favorites</Text>\n</Row>\n```\n\n### Small list item + Icon + Right Arrow\n![Small list item + Icon + Right Arrow Row example]({{ site.url }}/img/ui-toolkit/rows/small-list-item-icon-right-arrow@2x.png \"Small list item + Icon + Right Arrow\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row styleName=\"small\">\n    <Icon name=\"web\" />\n    <Text>About</Text>\n    <Icon styleName=\"disclosure\" name=\"right-arrow\" />\n</Row>\n```\n\n### Small list item + Icon + Description\n![Small list item + Icon + Description Row example]({{ site.url }}/img/ui-toolkit/rows/small-list-item-icon-description@2x.png \"Small list item + Icon + Description\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row styleName=\"small\">\n  <Icon name=\"share\" />\n  <View styleName=\"vertical\">\n    <Subtitle>Bridges Rock Gym</Subtitle>\n    <Text numberOfLines={1}>www.example.com/deal/link/that-is-really-long</Text>\n  </View>\n  <Icon styleName=\"disclosure\" name=\"right-arrow\" />\n</Row>\n```\n\n### Small list item + Avatar + Description + Caption\n![Small list item + Avatar + Description + Caption Row example]({{ site.url }}/img/ui-toolkit/rows/small-list-item-icon-description-caption@2x.png \"Small list item + Avatar + Description + Caption\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <Image\n    styleName=\"small-avatar top\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-11.png' }}\n  />\n  <View styleName=\"vertical\">\n    <View styleName=\"horizontal space-between\">\n      <Subtitle>Dustin Malone</Subtitle>\n      <Caption>20 minutes ago</Caption>\n    </View>\n    <Text styleName=\"multiline\">Banjo tote bag bicycle rights, High Life sartorial cray craft beer whatever street art fap. Hashtag typewriter banh mi, squid keffiyeh High.</Text>\n  </View>\n</Row>\n```\n\n### Medium list item\n![Medium list item Row example]({{ site.url }}/img/ui-toolkit/rows/medium-list-item@2x.png \"Medium list item\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <Image\n    styleName=\"small rounded-corners\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-10.png' }}\n  />\n  <Subtitle styleName=\"top\">Portland ugh fashion axe Helvetica, YOLO Echo Park Austin gastropub roof party.</Subtitle>\n</Row>\n```\n\n### Medium list item + Description\n![Medium list item + Description Row example]({{ site.url }}/img/ui-toolkit/rows/medium-list-item-description@2x.png \"Medium list item + Description\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <Image\n    styleName=\"small rounded-corners\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-6.png' }}\n  />\n  <View styleName=\"vertical stretch space-between\">\n    <Subtitle>Fact Check: Wisconsin Music, Film & Photography Debate</Subtitle>\n    <Caption>20 hours ago</Caption>\n  </View>\n</Row>\n```\n\n### Medium list item + Description + Icon\n![Medium list item + Description + Icon Row example]({{ site.url }}/img/ui-toolkit/rows/medium-list-item-description-icon@2x.png \"Medium list item + Description + Icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <Image\n    styleName=\"small rounded-corners\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png' }}\n  />\n  <View styleName=\"vertical stretch space-between\">\n    <Subtitle>Wilco Cover David Bowie&#39;s \"Space Oddity\"</Subtitle>\n    <Caption>June 21  ·  20:00</Caption>\n  </View>\n  <Button styleName=\"right-icon\"><Icon name=\"add-event\" /></Button>\n</Row>\n```\n\n### Medium list item + Description + Icon + Label\n![Medium list item + Description + Icon + Label Row example]({{ site.url }}/img/ui-toolkit/rows/medium-list-item-description-icon-label@2x.png \"Medium list item + Description + Icon + Label\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <Image\n    styleName=\"small rounded-corners\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-11.png' }}\n  />\n  <View styleName=\"vertical stretch space-between\">\n    <Subtitle>Family Safari Vacation To The Home Of The Gods</Subtitle>\n    <View styleName=\"horizontal\">\n      <Subtitle styleName=\"md-gutter-right\">$120.00</Subtitle>\n      <Caption styleName=\"line-through\">$150.00</Caption>\n    </View>\n  </View>\n  <Button styleName=\"right-icon\"><Icon name=\"add-to-cart\" /></Button>\n</Row>\n```\n\n### Medium list item + Notification dot\n![Medium list item + Notification dot Row example]({{ site.url }}/img/ui-toolkit/rows/medium-list-item-notification-icon@2x.png \"Medium list item + Notification dot\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <View styleName=\"notification-dot\" />\n  <Image\n    styleName=\"small rounded-corners\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-2.png' }}\n  />\n  <View styleName=\"vertical stretch space-between\">\n    <Subtitle>Fact Check: Wisconsin Music, Film & Photography Debate</Subtitle>\n    <Caption>20 hours ago</Caption>\n  </View>\n</Row>\n```\n\n### Medium list item + Description + Label\n![Medium list item + Description + Label Row example]({{ site.url }}/img/ui-toolkit/rows/medium-list-item-description-label@2x.png \"Medium list item + Description + Label\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Row>\n  <Image\n    styleName=\"medium rounded-corners\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-1.png' }}\n  />\n  <View styleName=\"vertical stretch space-between\">\n    <Subtitle>Take A Romantic Break In A Boutique Hotel</Subtitle>\n    <View styleName=\"horizontal space-between\">\n      <Caption>3 days ago</Caption>\n      <Caption>12:16</Caption>\n    </View>\n  </View>\n</Row>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-10-Tiles.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/tiles\ntitle: Tiles\nsection: UI toolkit\n---\n\n# Tiles\n\nTiles are a convenient way to display homogeneous content. They are often used in grid views. Children are rendered vertically, one below the other.\n\n![Tile example]({{ site.url }}/img/ui-toolkit/tiles/tile@2x.png \"Tile\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n`Tile` has no specific (custom) Props, however, it supports every prop that the standard React Native `View` component supports. For full list of available props, visit\n[React Native View component documentation](https://facebook.github.io/react-native/docs/view.html \"React Native View component documentation\").\n\n#### Style names\n\n* **clear**: sets the `clear` background color, as defined in Theme (usually transparent)\n* **small**: sets the fixed width to 145px and reduces margins and paddings\n* **text-centric**: centers content within container and applies standard margins\n* Nested `View` component can use the following Style name:\n  * **content**: applies the standard margins around the content in `View`\n\n## Examples\n\n### Tile\n![Tile example]({{ site.url }}/img/ui-toolkit/tiles/tile@2x.png \"Tile\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile styleName=\"small clear\">\n  <Image\n    styleName=\"medium-square\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-12.png' }}\n  />\n  <View styleName=\"content\">\n    <Subtitle numberOfLines={2}>When The Morning Dawns - DJ Silver Sample Album</Subtitle>\n    <Caption>20 hours ago</Caption>\n  </View>\n</Tile>\n```\n\n### Tile + Play Icon\n![Tile + Icon example]({{ site.url }}/img/ui-toolkit/tiles/tile-icon@2x.png \"Tile + Icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile styleName=\"small clear\">\n  <Image\n    styleName=\"medium-square\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-2.png' }}\n  >\n    <Overlay styleName=\"rounded-small\">\n      <Icon name=\"play\" />\n    </Overlay>\n  </Image>\n  <View styleName=\"content\">\n    <Subtitle numberOfLines={2}>When The Morning Dawns - DJ Silver Sample Album</Subtitle>\n    <Caption>20 hours ago</Caption>\n  </View>\n</Tile>\n```\n\n### Large (featured) Tile\n![Large (featured) Tile example]({{ site.url }}/img/ui-toolkit/tiles/large-tile@2x.png \"Large Tile\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"featured\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-4.png' }}\n>\n  <Tile>\n    <Title styleName=\"md-gutter-bottom\">MIKE PATTON TEAMING WITH JOHN KAADA FOR COLLAB ALBUM BACTERIA CULT</Title>\n    <Caption>Sophia Jackson        21 hours ago</Caption>\n  </Tile>\n</Image>\n```\n\n### Large (featured) tile + Button + Sale tag\n![Large (featured) tile + Button + Sale tag Tile example]({{ site.url }}/img/ui-toolkit/tiles/large-tile-button-sale-tag@2x.png \"Large Tile + Button + Sale tag\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"featured\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-11.png' }}\n>\n  <Tile>\n    <Overlay><Heading>-20%</Heading></Overlay>\n    <Title styleName=\"md-gutter-top\">COOL BLACK AND WHITE STYLISH WATCHES</Title>\n    <Subtitle styleName=\"line-through sm-gutter-top\">$280.00</Subtitle>\n    <Heading>$250.00</Heading>\n    <Button styleName=\"md-gutter-top\"><Icon name=\"cart\" /><Text>ADD TO BASKET</Text></Button>\n  </Tile>\n</Image>\n```\n\n### Large (featured) tile + Button\n![Large (featured) tile + Button Tile example]({{ site.url }}/img/ui-toolkit/tiles/large-tile-button@2x.png \"Large Tile + Button\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"featured\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-9.png' }}\n>\n  <Tile>\n    <Title>MIKE PATTON TEAMING WITH JOHN KAADA</Title>\n    <Subtitle styleName=\"line-through sm-gutter-top\">150.00</Subtitle>\n    <Heading>99.99</Heading>\n    <Button styleName=\"md-gutter-top\"><Text>CLAIM COUPON</Text></Button>\n  </Tile>\n</Image>\n```\n\n### Large list item\n![Large list item Tile example]({{ site.url }}/img/ui-toolkit/tiles/large-list-item@2x.png \"Large list item\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile>\n  <Image\n    styleName=\"large-banner\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-5.png' }}\n  />\n  <View styleName=\"content\">\n    <Title>MAUI BY AIR THE BEST WAY AROUND THE ISLAND</Title>\n    <View styleName=\"horizontal space-between\">\n      <Caption>1 hour ago</Caption>\n      <Caption>15:34</Caption>\n    </View>\n  </View>\n</Tile>\n```\n\n### Large list item + Icon + Timestamp\n![Large list item + Icon + Timestamp Tile example]({{ site.url }}/img/ui-toolkit/tiles/large-list-item-icon-timestamp@2x.png \"Large list item + icon + timestamp\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile>\n  <ImageBackground\n    styleName=\"large-banner\"\n    source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-7.png' }}\n  >\n    <Overlay styleName=\"rounded-small\">\n      <Icon name=\"play\" />\n    </Overlay>\n  </ImageBackground>\n  <View styleName=\"content\">\n    <Title>MAUI BY AIR THE BEST WAY AROUND THE ISLAND</Title>\n    <View styleName=\"horizontal space-between\">\n      <Caption>1 hour ago</Caption>\n      <Caption>15:34</Caption>\n    </View>\n  </View>\n</Tile>\n```\n\n### Large list item + Price tag\n![Large list item + Price tag Tile example]({{ site.url }}/img/ui-toolkit/tiles/large-list-item-price-tag@2x.png \"Large list item + Price tag\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-banner\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png' }}\n>\n  <Tile>\n    <Title styleName=\"md-gutter-bottom\">SMOKED SALMON, CLASSIC CONDIMENTS, BRIOCHE</Title>\n    <Overlay styleName=\"solid-bright\">\n      <Subtitle styleName=\"sm-gutter-horizontal\">$18.30</Subtitle>\n    </Overlay>\n  </Tile>\n</ImageBackground>\n```\n\n### Large list item + Action icon\n![Large list item + Action icon Tile example]({{ site.url }}/img/ui-toolkit/tiles/large-list-item-action-icon@2x.png \"Large list item + Action icon\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-banner\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png' }}\n>\n  <Tile>\n    <View styleName=\"actions\">\n      <Button styleName=\"tight clear\"><Icon name=\"add-to-favorites\" /></Button>\n    </View>\n    <Title>HOW TO MAINTAIN YOUR MENTAL HEALTH IN 2016</Title>\n    <Caption>6557 Americo Hills Apt. 118</Caption>\n  </Tile>\n</ImageBackground>\n```\n\n### Detail square + Price tag\n![Detail square + Price tag Tile example]({{ site.url }}/img/ui-toolkit/tiles/detail-square-price-tag@2x.png \"Detail square + Price tag\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-square\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png' }}\n>\n  <Tile>\n    <Title styleName=\"md-gutter-bottom\">SMOKED SALMON, CLASSIC CONDIMENTS, BRIOCHE</Title>\n    <Overlay styleName=\"solid-bright\">\n      <Subtitle styleName=\"sm-gutter-horizontal\">$18.30</Subtitle>\n    </Overlay>\n  </Tile>\n</ImageBackground>\n```\n\n### Detail square + Button\n![Detail square + Button Tile example]({{ site.url }}/img/ui-toolkit/tiles/detail-square-button@2x.png \"Detail square + Button\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-square\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-9.png' }}\n>\n  <Tile>\n    <Title>MIKE PATTON TEAMING WITH JOHN KAADA</Title>\n    <Subtitle styleName=\"line-through sm-gutter-top\">150.00</Subtitle>\n    <Heading>99.99</Heading>\n    <Button styleName=\"md-gutter-top\"><Text>CLAIM COUPON</Text></Button>\n  </Tile>\n</ImageBackground>\n```\n\n### Detail square + Button + Sale tag\n![Detail square + Button + Sale tag Tile example]({{ site.url }}/img/ui-toolkit/tiles/detail-square-button-sale-tag@2x.png \"Detail square + Button + Sale tag\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-square\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-11.png' }}\n>\n  <Tile>\n    <Overlay><Heading>-20%</Heading></Overlay>\n    <Title styleName=\"md-gutter-top\">COOL BLACK AND WHITE STYLISH WATCHES</Title>\n    <Subtitle styleName=\"line-through sm-gutter-top\">$280.00</Subtitle>\n    <Heading>$250.00</Heading>\n    <Button styleName=\"md-gutter-top\"><Icon name=\"cart\" /><Text>ADD TO BASKET</Text></Button>\n  </Tile>\n</ImageBackground>\n```\n\n### Detail large + Price tag\n![Detail large + Price tag Tile example]({{ site.url }}/img/ui-toolkit/tiles/detail-large-price-tag@2x.png \"Detail large + Price tag\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-portrait\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png' }}\n>\n  <Tile>\n    <Title styleName=\"md-gutter-bottom\">SMOKED SALMON, CLASSIC CONDIMENTS, BRIOCHE</Title>\n    <Overlay styleName=\"solid-bright\">\n      <Subtitle styleName=\"sm-gutter-horizontal\">$18.30</Subtitle>\n    </Overlay>\n  </Tile>\n</ImageBackground>\n```\n\n### Detail large + Button\n![Detail large + Button Tile example]({{ site.url }}/img/ui-toolkit/tiles/detail-large-button@2x.png \"Detail large + Button\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-portrait\"\n  source={% raw %}{{{% endraw %} uri: 'http://shoutem.github.io/img/ui-toolkit/examples/image-9.png' }}\n>\n  <Tile>\n    <Title>MIKE PATTON TEAMING WITH JOHN KAADA</Title>\n    <Subtitle styleName=\"line-through sm-gutter-top\">150.00</Subtitle>\n    <Heading>99.99</Heading>\n    <Button styleName=\"md-gutter-top\"><Text>CLAIM COUPON</Text></Button>\n  </Tile>\n</ImageBackground>\n```\n\n### Detail large + Button + Sale tag\n![Detail large + Button + Sale tag Tile example]({{ site.url }}/img/ui-toolkit/tiles/detail-large-button-sale-tag@2x.png \"Detail large + Button + Sale tag\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<ImageBackground\n  styleName=\"large-portrait\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-11.png' }}\n>\n  <Tile>\n    <Overlay><Heading>-20%</Heading></Overlay>\n    <Title styleName=\"md-gutter-top\">COOL BLACK AND WHITE STYLISH WATCHES</Title>\n    <Subtitle styleName=\"line-through sm-gutter-top\">$280.00</Subtitle>\n    <Heading>$250.00</Heading>\n    <Button styleName=\"md-gutter-top\"><Icon name=\"cart\" /><Text>ADD TO BASKET</Text></Button>\n  </Tile>\n</ImageBackground>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-11-Spinner.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/spinner\ntitle: Spinner\nsection: UI toolkit\n---\n\n# Spinner\n`Spinner` is a styled wrapper for `ActivityIndicator` React Native component.  \n\n![Spinner example]({{ site.url }}/img/ui-toolkit/spinner/spinner@2x.png \"Spinner\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n`Spinner` has no specific (custom) Props.\n\n#### Style names\n\n`Spinner` has no specific style names.\n\n#### Style\n\n* **color**: color:\n  - defines foreground color of the spinner, defaults to `#cccccc`\n* **size**: string, `small` or `large`\n  - defines the size of the indicator, defaults to `small`\n* Also, supports every `Style` prop that the standard React Native `View` component supports\n\n\n## Example\n\n![Spinner example]({{ site.url }}/img/ui-toolkit/spinner/spinner@2x.png \"Spinner\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Spinner />\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-12-Buttons.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/buttons\ntitle: Buttons\nsection: UI toolkit\n---\n\n# Buttons\n\nButtons are additionally styled [TouchableOpacity]({{ site.url }}/docs/ui-toolkit/components/touchable-opacity) components.\n\n## API\n\n#### Props\n\n`Button` has no specific (custom) Props, however, it supports every prop that the standard React Native `TouchableOpacity` component supports. For full list of available props, visit\n[React Native TouchableOpacity component documentation](https://facebook.github.io/react-native/docs/touchableopacity.html \"React Native TouchableOpacity component documentation\").\n\n#### Style names\n\n* **action**: increases `fontSize` for `Text` component within `Button`\n* **border**: applies `Border` color as defined in Theme\n* **clear**: removes the border around `Button` and sets `backgroundColor` to `Clear` color as defined in Theme\n* **confirmation**: sets the border around `Button` and applies a medium margin around  \n* **secondary**: sets the text color to `Light` as defined in Theme, and background color to `Darker` as defined in Theme\n* **full-width**: `Button` stretches to full width of the container\n* **muted**: sets the opacity of the `Icon` and `Text` components within `Button`to 50%\n* **stacked**: vertically stacks `Icon` and `Text` within `Button`\n* **tight**: removes the right margin from `Icon` and `Text` within `Button`\n\n#### Style\n\n* **underlayColor**: the color that will show through when the `Button` is pressed\n* Also, supports every `Style` prop that the standard React Native `View` component supports\n\n## Examples\n\n###  Button / Text only / Light\n![Button / Text only / Light example]({{ site.url }}/img/ui-toolkit/buttons/button-text-only-light@2x.png \"Button / Text only / Light\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Button>\n  <Text>CHECK IN HERE</Text>\n</Button>\n```  \n\n###  Button / Text only / Dark\n![Button / Text only / Dark example]({{ site.url }}/img/ui-toolkit/buttons/button-text-only-dark@2x.png \"Button / Text only / Dark\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Button styleName=\"secondary\">\n  <Text>CHECK IN HERE</Text>\n</Button>\n```  \n\n###  Button / Icon + Text / Light\n![Button / Icon + Text / Light example]({{ site.url }}/img/ui-toolkit/buttons/button-icon-text-light@2x.png \"Button / Icon + Text / Light\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Button>\n  <Icon name=\"add-event\" />\n  <Text>ADD TO CALENDAR</Text>\n</Button>\n```  \n\n###  Button / Icon + Text / Dark\n![Button / Icon + Text / Dark example]({{ site.url }}/img/ui-toolkit/buttons/button-icon-text-dark@2x.png \"Button / Icon + Text / Dark\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Button styleName=\"secondary\">\n  <Icon name=\"add-event\" />\n  <Text>ADD TO CALENDAR</Text>\n</Button>\n```  \n\n###  Button / Fixed size\n![Button / Fixed size example]({{ site.url }}/img/ui-toolkit/buttons/button-fixed-size@2x.png \"Button / Fixed size\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<View styleName=\"horizontal\">\n  <Button styleName=\"confirmation\">\n    <Text>REMOVE</Text>\n  </Button>\n\n  <Button styleName=\"confirmation secondary\">\n    <Text>UPDATE</Text>\n  </Button>\n</View>\n```  \n\n###  Button / Full width\n![Button / Full width example]({{ site.url }}/img/ui-toolkit/buttons/button-full-width@2x.png \"Button / Full width\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Button styleName=\"full-width\">\n  <Text>SEE ALL COMMENTS</Text>\n</Button>\n```  \n\n### Icon Button\n![Button / Navbar example]({{ site.url }}/img/ui-toolkit/buttons/button-navbar@2x.png \"Button / Navbar\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Button styleName=\"clear\">\n  <Icon name=\"add-to-favorites-full\" />\n</Button>\n```  \n\n### Button / Vertical / Icon + Text\n![Button / Vertical / Icon + Text example]({{ site.url }}/img/ui-toolkit/buttons/button-vertical-icon-text@2x.png \"Button / Vertical / Icon + Text\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Button styleName=\"stacked clear\">\n  <Icon name=\"tweet\" />\n  <Text>Text description</Text>\n</Button>\n```  \n\n### Button / Full width - Muted\n![Button / Full width - Normal example]({{ site.url }}/img/ui-toolkit/buttons/button-full-width-normal@2x.png \"Button / Full width - Normal\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<View styleName=\"horizontal flexible\">\n  <Button styleName=\"full-width muted\">\n    <Icon name=\"like\" />\n    <Text>LIKE</Text>\n  </Button>\n  <Button styleName=\"full-width muted\">\n    <Icon name=\"comment-full\" />\n    <Text>COMMENT</Text>\n  </Button>\n</View>\n```  \n\n### Button / Full width - Active\n![Button / Full width - Active example]({{ site.url }}/img/ui-toolkit/buttons/button-full-width-active@2x.png \"Button / Full width - Active (Feed)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<View styleName=\"horizontal flexible\">\n  <Button styleName=\"full-width\">\n    <Icon name=\"like\" />\n    <Text>LIKE</Text>\n  </Button>\n  <Button styleName=\"full-width\">\n    <Icon name=\"comment-full\" />\n    <Text>COMMENT</Text>\n  </Button>\n</View>\n```  \n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-13-Image.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/image\ntitle: Image\nsection: UI toolkit\n---\n\n# Image\n\nThis document covers `Image` component and Image size style names available in Shoutem UI toolkit.\n\n![List large thumbnail (375x200) example]({{ site.url }}/img/ui-toolkit/image-sizes/list-large-thumbnail-375-x-200@2x.png \"List large thumbnail (375x200)\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n`Image` has no specific (custom) Props, however, it supports every prop that the standard React Native `Image` component supports. For full list of available props, visit\n[React Native Image component documentation](https://facebook.github.io/react-native/docs/image.html \"React Native Image component documentation\").\n\n\n#### Style names\n\nFor most of available `Image` style names, Image dimensions are scaled depending on screen dimensions. As example, `Image` with `featured` style name applied will have dimensions of `365x345px (width, height respectively)` on device with screen width of `375px`. If device's screen width is larger, then the image dimensions will be larger than 365x345px and similar, if device screen width is smaller than 375px, actual image will be smaller than 365x345px.\n\n* **featured**: width: `(365 / 375) * window.width` height: `(345 / 375) * window.width`\n* **large**: width: `window.width` height: `(280 / 375) * window.width`\n* **large-portrait**: width: `window.width` height: `(280 / 375) * window.width`\n* **large-banner**: width: `window.width` height: `(200 / 375) * window.width`\n* **large-square**: width: `window.width` height: `window.width`\n* **large-wide**: width: `window.width` height: `(238 / 375) * window.width`\n* **large-ultra-wide**: width: `window.width` height: `(130 / 375) * window.width`\n* **medium-avatar**: rounded image, 72.5px radius\n* **medium**: width: `145px` x height: `92px`\n* **medium-wide**: width: `(180/375) * window.width` height: `85px`\n* **medium-square**: width: `145px` height: `145px`\n* **medium-portrait**: width: `(209/375)` height: `139px`\n* **rounded-corners**: defines rounded corners, as defined in Theme\n* **small-avatar**: rounded image, 25px radius\n* **small**: width: `65px` height: `65px`\n\n#### Style\n\n* Supports every `Style` prop that the standard React Native `Image` component supports\n\n## Examples\n\n### List image thumbnail (65x65)\n![List image thumbnail (65x65) example]({{ site.url }}/img/ui-toolkit/image-sizes/list-image-thumbnail-65-x-65@2x.png \"List image thumbnail (65x65)\"){:.docs-component-image}  \n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"small\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n\n### List video thumbnail (145x92)\n![List video thumbnail (145x92) example]({{ site.url }}/img/ui-toolkit/image-sizes/list-video-thumbnail-145-x-92@2x.png \"List video thumbnail (145x92)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"medium\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n\n### Card image thumbnail (180x85)\n![Card image thumbnail (180x85) example]({{ site.url }}/img/ui-toolkit/image-sizes/card-image-thumbnail-180-85@2x.png \"Card image thumbnail (180x85)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"medium-wide\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```    \n\n### Avatar thumbnail (25x25)\n![Avatar thumbnail (25x25) example]({{ site.url }}/img/ui-toolkit/image-sizes/avatar-thumbnail-25-x-25@2x.png \"Avatar thumbnail (25x25)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"small-avatar\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```      \n\n### Avatar image (145x145)\n![Avatar image (145x145) example]({{ site.url }}/img/ui-toolkit/image-sizes/avatar-image-145-x-145@2x.png \"Avatar image (145x145)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"medium-avatar\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n\n### List medium image (145x145)\n![List medium image (145x145) example]({{ site.url }}/img/ui-toolkit/image-sizes/list-medium-image-145-x-145@2x.png \"List medium image (145x145)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"medium-square\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n\n### List large thumbnail (375x200)\n![List large thumbnail (375x200) example]({{ site.url }}/img/ui-toolkit/image-sizes/list-large-thumbnail-375-x-200@2x.png \"List large thumbnail (375x200)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"large-banner\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n\n### Featured image (365x345)\n![Featured image (365x345) example]({{ site.url }}/img/ui-toolkit/image-sizes/featured-image-365-345@2x.png \"Featured image (365x345)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"featured\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n\n### Detail large photo (375x518)\n![Detail large photo (375x518) example]({{ site.url }}/img/ui-toolkit/image-sizes/detail-large-photo-375-581@2x.png \"Detail large photo (375x518)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"large-portrait\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```   \n\n### Detail medium photo (375x280)\n![Detail medium photo (375x280) example]({{ site.url }}/img/ui-toolkit/image-sizes/detail-medium-photo-375-280@2x.png \"Detail medium photo (375x280)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"large\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n\n### Detail wide photo (375x238)\n![Detail wide photo (375x238) example]({{ site.url }}/img/ui-toolkit/image-sizes/detail-wide-photo-375-238@2x.png \"Detail wide photo (375x238)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"large-wide\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```   \n\n### Detail square photo (375x375)\n![Detail square photo (375x375) example]({{ site.url }}/img/ui-toolkit/image-sizes/detail-square-photo-375-375@2x.png \"Detail square photo (375x375)\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Image\n  styleName=\"large-square\"\n  source={% raw %}{{{% endraw %} uri: '{{site.url}}/img/ui-toolkit/examples/image-3.png'}}\n/>\n```  \n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-14-Icons.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/icons\ntitle: Icons\nsection: UI toolkit\n---\n\n# Icons\n\nThis document covers available icons in the UI toolkit. You can see their implementation in the UI toolkit [here](https://github.com/shoutem/ui/blob/develop/components/Icon/config.json).\n\n### API\n\n#### Props\n\n`Icon` has no specific (custom) Props.\n\n### Style names\n\nThe `styleName`s for icons are the `name`s used in the examples below.\n\n### Examples\n\n#### Sidebar\n![Sidebar icon example]({{ site.url }}/img/ui-toolkit/icons/sidebar.png \"Sidebar\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"sidebar\" />\n```\n\n#### Back\n![Back icon example]({{ site.url }}/img/ui-toolkit/icons/back.png \"Back\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"back\" />\n```\n\n#### Close\n![Close icon example]({{ site.url }}/img/ui-toolkit/icons/close.png \"Close\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"close\" />\n```\n\n#### Left-arrow\n![Left-arrow icon example]({{ site.url }}/img/ui-toolkit/icons/left-arrow.png \"Left-arrow\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"left-arrow\" />\n```\n\n#### Right-arrow\n![Right-arrow icon example]({{ site.url }}/img/ui-toolkit/icons/right-arrow.png \"Right-arrow\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"right-arrow\" />\n```\n\n#### Up-arrow\n![Up-arrow icon example]({{ site.url }}/img/ui-toolkit/icons/up-arrow.png \"Up-arrow\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"up-arrow\" />\n```\n\n#### Down-arrow\n![Down-arrow icon example]({{ site.url }}/img/ui-toolkit/icons/down-arrow.png \"Down-arrow\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"down-arrow\" />\n```\n\n#### Drop-down\n![Drop-down icon example]({{ site.url }}/img/ui-toolkit/icons/drop-down.png \"Drop-down\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"drop-down\" />\n```\n\n#### Share\n![Share icon example]({{ site.url }}/img/ui-toolkit/icons/share.png \"Share\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"share\" />\n```\n\n#### Share-android\n![Share-android icon example]({{ site.url }}/img/ui-toolkit/icons/share-android.png \"Share-android\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"share-android\" />\n```\n\n#### Add-to-favorites-off\n![Add-to-favorites-off icon example]({{ site.url }}/img/ui-toolkit/icons/add-to-favorites-off.png \"Add-to-favorites-off\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"add-to-favorites-off\" />\n```\n\n#### Add-to-favorites-on\n![Add-to-favorites-on icon example]({{ site.url }}/img/ui-toolkit/icons/add-to-favorites-on.png \"Add-to-favorites-on\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"add-to-favorites-on\" />\n```\n\n#### Play\n![Play icon example]({{ site.url }}/img/ui-toolkit/icons/play.png \"Play\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"play\" />\n```\n\n#### Pause\n![Pause icon example]({{ site.url }}/img/ui-toolkit/icons/pause.png \"Pause\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"pause\" />\n```\n\n#### Edit\n![Edit icon example]({{ site.url }}/img/ui-toolkit/icons/edit.png \"Edit\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"edit\" />\n```\n\n#### Refresh\n![Refresh icon example]({{ site.url }}/img/ui-toolkit/icons/refresh.png \"Refresh\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"refresh\" />\n```\n\n#### Web\n![Web icon example]({{ site.url }}/img/ui-toolkit/icons/web.png \"Web\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"web\" />\n```\n\n#### Email\n![Email icon example]({{ site.url }}/img/ui-toolkit/icons/email.png \"Email\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"email\" />\n```\n\n#### Pin\n![Pin icon example]({{ site.url }}/img/ui-toolkit/icons/pin.png \"Pin\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"pin\" />\n```\n\n#### Address\n![Address icon example]({{ site.url }}/img/ui-toolkit/icons/address.png \"Address\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"address\" />\n```\n\n#### Facebook\n![Facebook icon example]({{ site.url }}/img/ui-toolkit/icons/facebook.png \"Facebook\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"facebook\" />\n```\n\n#### Linkedin\n![Linkedin icon example]({{ site.url }}/img/ui-toolkit/icons/linkedin.png \"Linkedin\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"linkedin\" />\n```\n\n#### Tweet\n![Tweet icon example]({{ site.url }}/img/ui-toolkit/icons/tweet.png \"Tweet\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"tweet\" />\n```\n\n#### Cart\n![Cart icon example]({{ site.url }}/img/ui-toolkit/icons/cart.png \"Cart\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"cart\" />\n```\n\n#### Add-to-cart\n![Add-to-cart icon example]({{ site.url }}/img/ui-toolkit/icons/add-to-cart.png \"Add-to-cart\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"add-to-cart\" />\n```\n\n#### Add-event\n![Add-event icon example]({{ site.url }}/img/ui-toolkit/icons/add-event.png \"Add-event\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"add-event\" />\n```\n\n#### Comment\n![Comment icon example]({{ site.url }}/img/ui-toolkit/icons/comment.png \"Comment\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"comment\" />\n```\n\n#### Call\n![Call icon example]({{ site.url }}/img/ui-toolkit/icons/call.png \"Call\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"call\" />\n```\n\n#### Activity\n![Activity icon example]({{ site.url }}/img/ui-toolkit/icons/activity.png \"Activity\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"activity\" />\n```\n\n#### Friends\n![Friends icon example]({{ site.url }}/img/ui-toolkit/icons/friends.png \"Friends\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"friends\" />\n```\n\n#### Add-friend\n![Add-friend icon example]({{ site.url }}/img/ui-toolkit/icons/add-friend.png \"Add-friend\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"add-friend\" />\n```\n\n#### Unfriend\n![Unfriend icon example]({{ site.url }}/img/ui-toolkit/icons/unfriend.png \"Unfriend\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"unfriend\" />\n```\n\n#### Settings\n![Settings icon example]({{ site.url }}/img/ui-toolkit/icons/settings.png \"Settings\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"settings\" />\n```\n\n#### Take-a-photo\n![Take-a-photo icon example]({{ site.url }}/img/ui-toolkit/icons/take-a-photo.png \"Take-a-photo\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"take-a-photo\" />\n```\n\n#### Error\n![Error icon example]({{ site.url }}/img/ui-toolkit/icons/error.png \"Error\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"error\" />\n```\n\n#### News\n![News icon example]({{ site.url }}/img/ui-toolkit/icons/news.png \"News\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"news\" />\n```\n\n#### Like\n![Like icon example]({{ site.url }}/img/ui-toolkit/icons/like.png \"Like\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"like\" />\n```\n\n#### Search\n![Search icon example]({{ site.url }}/img/ui-toolkit/icons/search.png \"Search\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"search\" />\n```\n\n#### Users\n![Users icon example]({{ site.url }}/img/ui-toolkit/icons/users.png \"Users\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"users\" />\n```\n\n#### User-profile\n![User-profile icon example]({{ site.url }}/img/ui-toolkit/icons/user-profile.png \"User-profile\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"user-profile\" />\n```\n\n#### Social-wall\n![Social-wall icon example]({{ site.url }}/img/ui-toolkit/icons/social-wall.png \"Social-wall\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"social-wall\" />\n```\n\n#### Books\n![Books icon example]({{ site.url }}/img/ui-toolkit/icons/books.png \"Books\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"books\" />\n```\n\n#### Folder\n![Folder icon example]({{ site.url }}/img/ui-toolkit/icons/folder.png \"Folder\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"folder\" />\n```\n\n#### Events\n![Events icon example]({{ site.url }}/img/ui-toolkit/icons/events.png \"Events\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"events\" />\n```\n\n#### Photo\n![Photo icon example]({{ site.url }}/img/ui-toolkit/icons/photo.png \"Photo\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"photo\" />\n```\n\n#### Music-video\n![Music-video icon example]({{ site.url }}/img/ui-toolkit/icons/music-video.png \"Music-video\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"music-video\" />\n```\n\n#### Radio\n![Radio icon example]({{ site.url }}/img/ui-toolkit/icons/radio.png \"Radio\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"radio\" />\n```\n\n#### Podcasts\n![Podcasts icon example]({{ site.url }}/img/ui-toolkit/icons/podcasts.png \"Podcasts\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"podcasts\" />\n```\n\n#### About\n![About icon example]({{ site.url }}/img/ui-toolkit/icons/about.png \"About\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"about\" />\n```\n\n#### Notifications\n![Notifications icon example]({{ site.url }}/img/ui-toolkit/icons/notifications.png \"Notifications\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"notifications\" />\n```\n\n#### Exit-to-app\n![Exit-to-app icon example]({{ site.url }}/img/ui-toolkit/icons/exit-to-app.png \"Exit-to-app\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"exit-to-app\" />\n```\n\n#### Restaurant-menu\n![Restaurant-menu icon example]({{ site.url }}/img/ui-toolkit/icons/restaurant-menu.png \"Restaurant-menu\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"restaurant-menu\" />\n```\n\n#### Products\n![Products icon example]({{ site.url }}/img/ui-toolkit/icons/products.png \"Products\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"products\" />\n```\n\n#### Deals\n![Deals icon example]({{ site.url }}/img/ui-toolkit/icons/deals.png \"Deals\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"deals\" />\n```\n\n#### Restaurant\n![Restaurant icon example]({{ site.url }}/img/ui-toolkit/icons/restaurant.png \"Restaurant\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"restaurant\" />\n```\n\n#### More-horizontal\n![More-horizontal icon example]({{ site.url }}/img/ui-toolkit/icons/more-horizontal.png \"More-horizontal\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"more-horizontal\" />\n```\n\n#### Rss-feed\n![Rss-feed icon example]({{ site.url }}/img/ui-toolkit/icons/rss-feed.png \"Rss-feed\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"rss-feed\" />\n```\n\n#### Missing\n![Missing icon example]({{ site.url }}/img/ui-toolkit/icons/missing.png \"Missing\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"missing\" />\n```\n\n#### Home\n![Home icon example]({{ site.url }}/img/ui-toolkit/icons/home.png \"Home\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"home\" />\n```\n\n#### Checkbox-on\n![Checkbox-on icon example]({{ site.url }}/img/ui-toolkit/icons/checkbox-on.png \"Checkbox-on\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"checkbox-on\" />\n```\n\n#### Checkbox-off\n![Checkbox-off icon example]({{ site.url }}/img/ui-toolkit/icons/checkbox-off.png \"Checkbox-off\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"checkbox-off\" />\n```\n\n#### Radiobutton-on\n![Radiobutton-on icon example]({{ site.url }}/img/ui-toolkit/icons/radiobutton-on.png \"Radiobutton-on\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"radiobutton-on\" />\n```\n\n#### Radiobutton-off\n![Radiobutton-off icon example]({{ site.url }}/img/ui-toolkit/icons/radiobutton-off.png \"Radiobutton-off\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"radiobutton-off\" />\n```\n\n#### Minus-button\n![Minus-button icon example]({{ site.url }}/img/ui-toolkit/icons/minus-button.png \"Minus-button\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"minus-button\" />\n```\n\n#### Plus-button\n![Plus-button icon example]({{ site.url }}/img/ui-toolkit/icons/plus-button.png \"Plus-button\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"plus-button\" />\n```\n\n#### Clear-text\n![Clear-text icon example]({{ site.url }}/img/ui-toolkit/icons/clear-text.png \"Clear-text\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"clear-text\" />\n```\n\n#### Receipt\n![Receipt icon example]({{ site.url }}/img/ui-toolkit/icons/receipt.png \"Receipt\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"receipt\" />\n```\n\n#### History\n![History icon example]({{ site.url }}/img/ui-toolkit/icons/history.png \"History\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"history\" />\n```\n\n#### Gift\n![Gift icon example]({{ site.url }}/img/ui-toolkit/icons/gift.png \"Gift\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"gift\" />\n```\n\n#### Loyalty-card\n![Loyalty-card icon example]({{ site.url }}/img/ui-toolkit/icons/loyalty-card.png \"Loyalty-card\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"loyalty-card\" />\n```\n\n#### Trophy\n![Trophy icon example]({{ site.url }}/img/ui-toolkit/icons/trophy.png \"Trophy\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"trophy\" />\n```\n\n#### Lock\n![Lock icon example]({{ site.url }}/img/ui-toolkit/icons/lock.png \"Lock\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"lock\" />\n```\n\n#### Stamp\n![Stamp icon example]({{ site.url }}/img/ui-toolkit/icons/stamp.png \"Stamp\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"stamp\" />\n```\n\n#### Turn-off\n![Turn-off icon example]({{ site.url }}/img/ui-toolkit/icons/turn-off.png \"Turn-off\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"turn-off\" />\n```\n\n#### Stop\n![Stop icon example]({{ site.url }}/img/ui-toolkit/icons/stop.png \"Stop\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"stop\" />\n```\n\n#### Equalizer\n![Equalizer icon example]({{ site.url }}/img/ui-toolkit/icons/equalizer.png \"Equalizer\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"equalizer\" />\n```\n\n#### Page\n![Page icon example]({{ site.url }}/img/ui-toolkit/icons/page.png \"Page\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"page\" />\n```\n\n#### Rsvp\n![Rsvp icon example]({{ site.url }}/img/ui-toolkit/icons/rsvp.png \"Rsvp\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"rsvp\" />\n```\n\n#### Github\n![Github icon example]({{ site.url }}/img/ui-toolkit/icons/github.png \"Github\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"github\" />\n```\n\n#### Link\n![Link icon example]({{ site.url }}/img/ui-toolkit/icons/link.png \"Link\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"link\" />\n```\n\n#### My-location\n![My-location icon example]({{ site.url }}/img/ui-toolkit/icons/my-location.png \"My-location\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"my-location\" />\n```\n\n#### Laptop\n![Laptop icon example]({{ site.url }}/img/ui-toolkit/icons/laptop.png \"Laptop\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"laptop\" />\n```\n\n#### Directions\n![Directions icon example]({{ site.url }}/img/ui-toolkit/icons/directions.png \"Directions\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"directions\" />\n```\n\n#### Maps\n![Maps icon example]({{ site.url }}/img/ui-toolkit/icons/maps.png \"Maps\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"maps\" />\n```\n\n#### Uber\n![Uber icon example]({{ site.url }}/img/ui-toolkit/icons/uber.png \"Uber\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"uber\" />\n```\n\n#### Instagram\n![Instagram icon example]({{ site.url }}/img/ui-toolkit/icons/instagram.png \"Instagram\"){:.docs-component-image}  \n\n\n#### JSX Declaration\n```JSX\n<Icon name=\"instagram\" />\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-15-View.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/view\ntitle: View\nsection: UI toolkit\n---\n\n# View\n\nView is a React Native's `View` with additional (flexbox) styling styleNames available.\n\n## API\n\n#### Props\n\n`View` has no specific (custom) Props, however, it supports every prop that the standard React Native `View` component supports. For full list of available props, visit\n[React Native View component documentation](https://facebook.github.io/react-native/docs/view.html \"React Native View component documentation\").\n\n#### Style names\n\n* **fill-parent**: `View` becomes absolutely positioned and takes all available space of its parent container\n* **horizontal**: Places all items in a row\n  * **h-center**: Centers item in a row horizontally\n  * **h-start**: Places item to the horizontal start of row\n  * **h-end**: Places item to the horizontal end of row\n  * **v-center**: Centers all items in a row vertically\n  * **v-start**: Places item to the vertical start of row\n  * **v-end**: Places item to the vertical end of row\n* **overlay**: Applies `Overlay` background color (as defined in Theme) to `View`\n* **space-between**: Places all flex items equally along the main axis\n* **vertical**: Places all items in a column\n  * **h-center**: Centers all items in a column horizontally\n  * **h-start**: Places item to the horizontal start of column\n  * **h-end**: Places item to the horizontal end of column\n  * **v-center**: Centers all items in a column vertically\n  * **v-start**: Places item to the vertical start of column\n  * **v-end**: Places item to the vertical end of column\n* **wrap**: Defines whether the flexible items should wrap\n\n#### Style\n\n* Supports every `Style` prop that the standard React Native `View` component supports\n\n## Examples\n\n### View\n<br />\n\n#### JSX Declaration\n```JSX\n<View styleName=\"...\">\n    {...}\n</View>\n```  \n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-16-Screen.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/screen\ntitle: Screen\nsection: UI toolkit\n---\n\n# Screen\n\nScreen is a React Native's `View` with additional background color defined in Theme (defaults to gray).\n\n## API\n\n#### Props\n\n`Screen` has no specific (custom) Props, however, it supports every prop that the standard React Native `View` component supports. For full list of available props, visit\n[React Native View component documentation](https://facebook.github.io/react-native/docs/view.html \"React Native View component documentation\").\n\n#### Style names\n\n* **full-screen**: Applies negative top margin, so that the content within `Screen` covers the navigation bar (usually 70 pixels)\n* **paper**: Applies a `Light` color, as defined in Theme\n\n#### Style\n\n* Supports every `Style` prop that the standard React Native `View` component supports\n\n## Examples\n\n## Screen\n<br />\n\n#### JSX Declaration\n```JSX\n<Screen styleName=\"...\">\n    {...}\n</Screen>\n```  \n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-17-TouchableOpacity.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/touchable-opacity\ntitle: Touchable Opacity\nsection: UI toolkit\n---\n\n# TouchableOpacity\n\nTouchableOpacity is a React Native's `TouchableOpacity` with additional styling applied through Theme.  \nBasically, `TouchableOpacity` is React-Native's [component](https://facebook.github.io/react-native/docs/touchableopacity.html \"React Native TouchableOpacity component documentation\") that responds to touches. Once the component is pressed, the opacity of the component within `TouchableOpacity` is decreased, dimming it.\n\n## API\n\n#### Props\n\n* Supports every `Style` prop that the standard React Native `TouchableOpacity` component supports\n\n### Style names\n\n`TouchableOpacity` has no specific style names.\n\n#### Style\n\n* `TouchableOpacity` has the same Style props like React Native's `TouchableOpacity` component has (`activeOpacity`)\n* _Note that `activeOpacity` can also be set through Theme, and it defaults to 0.8._\n\n## Examples\n\n### TouchableOpacity\n<br />\n\n#### JSX Declaration\n```JSX\n<TouchableOpacity style=\"...\">\n    {...}\n</TouchableOpacity>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-18-Headers.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/headers\ntitle: Headers\nsection: UI toolkit\n---\n\n# Headers\n\nHeaders are Tile variations - Headers do not have an `Image` as the parent component of the `Tile` component.\n\n## API\n\nSee [Tiles]({{ site.url }}/docs/ui-toolkit/components/tiles) for API reference.\n\n## Examples\n\n### Header / Article\n![Header / Article example]({{ site.url }}/img/ui-toolkit/headers/header-article@2x.png \"Header / article\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile styleName=\"text-centric\">\n  <Title styleName=\"sm-gutter-bottom\">MIKE PATTON TEAMING WITH JOHN KAADA FOR COLLAB ALBUM BACTERIA CULT</Title>\n  <Caption>Sophia Jackson        2 hours ago</Caption>\n</Tile>\n```\n\n### Header / Shop item\n![Header / Shop item example]({{ site.url }}/img/ui-toolkit/headers/header-shop-item@2x.png \"Header / shop item\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile styleName=\"text-centric\">\n  <Overlay><Heading>-20%</Heading></Overlay>\n  <Title styleName=\"md-gutter-top\">COOL BLACK AND WHITE STYLISH WATCHES</Title>\n  <Subtitle styleName=\"line-through sm-gutter-top\">$280.00</Subtitle>\n  <Heading>$250.00</Heading>\n  <Button styleName=\"dark md-gutter-top\"><Icon name=\"cart\" /><Text>ADD TO BASKET</Text></Button>\n</Tile>\n```\n\n### Header / Deals item\n![Header / Deals item example]({{ site.url }}/img/ui-toolkit/headers/header-deals-item@2x.png \"Large Tile + Button\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile styleName=\"text-centric\">\n  <Title>MIKE PATTON TEAMING WITH JOHN KAADA</Title>\n  <Subtitle styleName=\"line-through sm-gutter-top\">$150.00</Subtitle>\n  <Heading>$99.99</Heading>\n  <Button styleName=\"dark md-gutter-top\"><Text>CLAIM COUPON</Text></Button>\n</Tile>\n```\n\n### Header / Products item\n![Header / Products item example]({{ site.url }}/img/ui-toolkit/headers/header-products-item@2x.png \"Header / products item\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Tile styleName=\"text-centric\">\n  <Title styleName=\"md-gutter-bottom\">SMOKED SALMON, CLASSIC CONDIMENTS, BRIOCHE</Title>\n  <Overlay styleName=\"solid-dark\">\n    <Subtitle styleName=\"sm-gutter-horizontal\">$18.30</Subtitle>\n  </Overlay>\n</Tile>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-19-Overlay.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/overlay\ntitle: Overlay\nsection: UI toolkit\n---\n\n# Overlay\n\n`Overlay` provides a convenient way to place content over `Image`, through semi-transparent background.\n\n![Solid (bright) overlay example]({{ site.url }}/img/ui-toolkit/tiles/large-list-item-price-tag@2x.png \"Solid (bright) overlay example\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n`Overlay` has no specific (custom) Props, however, it supports every prop that the standard React Native `View` component supports. For full list of available props, visit\n[React Native View component documentation](https://facebook.github.io/react-native/docs/view.html \"React Native View component documentation\").\n\n#### Style names\n\n* if style name isn't given, then the background color (as defined in Theme) is applied below nested content\n* **fill-parent**: sets the Overlay to fully fill the parent container (without any margins, padding etc.)\n* **rounded-small**: sets the Overlay to be rounded, with fixed width and height of 38x38 px\n\n#### Style\n\n* Supports every `Style` prop that the standard React Native `View` component supports\n\n## Example\n\n### Simple overlay\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/overlay/simple-overlay.png'/>\n</p>\n\n#### JSX Declaration\n\n```JSX\n<Screen>\n  <NavigationBar\n    styleName=\"inline\"\n    title=\"Restaurants\"\n  />\n  <ImageBackground\n    styleName=\"large-banner\"\n    source={{ uri : \"https://shoutem.github.io/static/getting-started/restaurant-4.jpg\" }}\n  >\n    <Tile>\n      <Overlay styleName=\"image-overlay\">\n        <Title styleName=\"sm-gutter-horizontal\">SUSHI ACADEMY</Title>\n        <Subtitle>1900 Warner Ave. Unit A Santa Ana, CA</Subtitle>\n      </Overlay>\n    </Tile>\n  </ImageBackground>\n</Screen>\n```\n\n### Fill-parent image overlay\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/overlay/fill-parent-overlay.png'/>\n</p>\n\n#### JSX Declaration\n\n```JSX\n<Screen>\n  <NavigationBar\n    styleName=\"inline\"\n    title=\"Restaurants\"\n  />\n  <ImageBackground\n    styleName=\"large-banner\"\n    source={{ uri : \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" }}\n  >\n    <Tile>\n      <Overlay styleName=\"fill-parent image-overlay\">\n        <Subtitle styleName=\"sm-gutter-horizontal\">GASPAR BRASSERIE</Subtitle>\n      </Overlay>\n    </Tile>\n  </ImageBackground>\n</Screen>\n```\n\n### Rounded-small overlay\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/overlay/rounded-small-overlay.png'/>\n</p>\n\n#### JSX Declaration\n\n```JSX\nconstructor(props) {\n  super(props);\n\n  this.state = {\n    photos:\n    [\n      { \"source\": { \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" } },\n      { \"source\": { \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-2.jpg\" } },\n      { \"source\": { \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-3.jpg\" } }\n    ]\n  }\n}\n\nrender() {\n  return (\n    <Screen>\n      <ImageBackground\n        source={{ uri: 'https://shoutem.github.io/img/ui-toolkit/examples/image-3.png' }}\n        style={{ width: 375, height: 70 }}\n      >\n        <NavigationBar\n          styleName=\"inline clear\"\n          title=\"EXPLORE\"\n          rightComponent={\n            <Button>\n              <Overlay styleName=\"rounded-small image-overlay\">\n                <Subtitle styleName=\"top\">Map</Subtitle>\n              </Overlay>\n            </Button>\n          }\n        />\n      </ImageBackground>\n      <View\n        styleName=\"lg-gutter-top\"\n      >\n        <Tile>\n          <Image\n            styleName=\"large-wide\"\n            source={{ uri: 'https://shoutem.github.io/img/ui-toolkit/examples/image-5.png' }}\n          />\n          <View styleName=\"content\">\n            <Title>MAUI BY AIR THE BEST WAY AROUND THE ISLAND</Title>\n            <View styleName=\"horizontal space-between\">\n              <Caption>1 hour ago</Caption>\n              <Caption>15:34</Caption>\n            </View>\n          </View>\n        </Tile>\n      </View>\n    </Screen>\n  );\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-20-Video.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/video\ntitle: Video\nsection: UI toolkit\n---\n\n# Video\n\n`Video` component can be used to render all types of video items. It renders a Video based on the source type. If the source is `URL` to a web player, the video is displayed in a `WebView`. If the source is a video stream URL, a `video` `HTML` element is displayed in the `WebView`. The component does not support playback of local video files.\n\n![Video example]({{ site.url }}/img/ui-toolkit/video/video_player@2x.png \"Video\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n* **source**: string\n  - Prop that defines the source of the video that will be rendered\n\n* **poster**: string\n  - Prop that defines the source of the poster image\n\n* **height**: number\n  - Prop that sets the height of the container where the video preview thumbnail will be rendered\n\n* **width**: number\n  - Prop that sets the width of the container where the video preview thumbnail will be rendered\n\n#### Style names\n\n`Video` has no specific style names.\n\n#### Style\n\n* **container**\n  - Style prop for container `View` that holds the `Video` component\n\n\n## Example\n\n![Video example]({{ site.url }}/img/ui-toolkit/video/video_player@2x.png \"Video\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Video\n    source={% raw %}{{{% endraw %} uri: 'https://www.youtube.com/watch?v=1tavDv5hXpo' }}\n    poster={'https://i.ytimg.com/vi/1tavDv5hXpo/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLB5H6NLcL2tWeeTPC8snOAqHZGgVw'}\n    height={200}\n    width={300}\n/>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-21-Lightbox.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/lightbox\ntitle: Lightbox\nsection: UI toolkit\n---\n\n# Lightbox\n\nAll content within `Lightbox` is transformable, meaning it can be pinched to zoom, panned (translated), etc.\n\n![Lightbox example](https://cloud.githubusercontent.com/assets/378279/9074360/16eac5d6-3b09-11e5-90af-a69980e9f4be.gif \"Lightbox\"){:.docs-component-image}\n\n## API\n\n#### Props\n\n* **activeProps**: object  \n  - An optional set of props applied to the content component when in lightbox (open) mode. Use for applying custom styles or higher resolution image source\n* **renderHeader(close)**: function\n  - A function that should return custom header instead of default with X button in the upper left corner\n* **renderContent**: function\n  - A function that should return custom `Lightbox` content instead of default child content\n* **onClose**: function\n  - Triggered when `Lightbox` is closed\n* **onOpen**: function\n  - Triggered when `Lightbox` is opened\n* **underlayColor**: string\n  - Defines color of touchable background, defaults to `black`\n* **backgroundColor**: string\n  - Defines color of `Lightbox` background, defaults to `black`\n* **swipeToDismiss**: bool\n  - Enables gestures to dismiss the fullscreen mode by swiping up or down, defaults to `true`\n* **pinchToZoom**: bool\n  - Enables pinch to zoom functionality on the fullscreen content, defaults to `true`\n* **springConfig**: object\n  - [`Animated.spring`](https://facebook.github.io/react-native/docs/animations.html) configuration, defaults to `{ tension: 30, friction: 7 }`  \n\n#### Style names\n\n`Lightbox` has no specific style names.\n\n#### Style\n\n* Supports every `Style` prop that the standard React Native `View` component supports. `style` is applied to outermost `View` container component\n\n## Example\n<br />\n\n#### JSX Declaration\n```JSX\n<Lightbox>\n  <Image\n    style={% raw %}{{ height: 300 }}{% endraw %}\n    source={% raw %}{{ uri: 'https://shoutem.github.io/static/getting-started/restaurant-1.jpg' }}{% endraw %}\n  />\n</Lightbox>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-22-RichMedia.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/html\ntitle: HTML\nsection: UI toolkit\n---\n\n# Html\n\nThe `Html` component parses HTML content and renders it using corresponding React Native and Shoutem UI toolkit components.\n\n## API\n\n#### Props\n\n* **body**: string  \n  - Body of the HTML content that will be transformed by this component and rendered using React Native and Shoutem UI toolkit components\n* **onError**: function\n  - Triggered if Html component fails to parse given HTML (from `body` prop)\n* **openURL(url)**: function\n  - Triggered when user taps on HTML link. It can be used to override default action (defaults to opening url in external browser)\n* **renderElement(node)**: function\n  - Function that can be used to define (return) custom Element transformer (`Image` and `Video` elements), which have priority in respect to default element transformers\n* **renderText(node)**: function\n  - Function that can be used to define (return) custom Text transformer (`p`, `pre`, `li`, `br`, `h1`, `h2`, `h3`, `h4`, `h5` HTML elements), which have priority in respect to default Text transformers\n\n#### Style names\n\n`Html` has no specific style names.\n\n#### Style\n\n* **container**\n  - Style prop applied to `View` component surrounding transformed content\n\n* **img**\n  - Style prop for Image transformer.\n  - Height defaults to 200 px.\n\n* **video**\n  - Style prop for Video transformer.\n  - Height defaults to 200 px.\n\n## Example\n<br />\n\n#### JSX Declaration\n```JSX\n<Html\n    body={...}\n    onError={...}\n    openUrl={...}\n    renderElement={...}\n    renderText={...}\n    style={...}\n/>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-22-SimpleHtml.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/simplehtml\ntitle: Simple HTML\nsection: UI toolkit\n---\n\n# SimpleHtml\n\nThe `SimpleHtml` component is based on the [react-native-render-html](https://github.com/archriss/react-native-render-html). It parses HTML content and renders it using basic `react-native` components. Since it's based on `react-native-render-html`, it supports all HTML tags supported by it.\n\n## API\n\n#### Props\n\n* **body**: string  \n  - Body of the HTML content that will be transformed by this component and rendered using React Native components\n\n* **customHandleLinkPress**: func\n  - A function that would determine what happens when a link is pressed. By default, it will open the link in the device's browser outside of the app\n\n#### Style names\n\n`SimpleHtml` has no specific style names.\n\n#### Style\n\nUsing the style prop, you can overwrite the styling for 4 different HTML tags:\n\n* **a**\n\n* **ul**\n\n* **ol**\n\n* **img**\n\nConsidering this is based on `react-native-render-html`, we suggest checking their [documentation on styling](https://github.com/archriss/react-native-render-html#styling).\n\n## Examples\n<br />\n\n### Images\n<br />\n\n#### JSX Declaration\n```JSX\nconst imageExample = `\n<p>The images are centered using inline styling</p>\n<p>'align-self:center;'</p>\n\n<p>Simple image:</p>\n<img style=\"align-self:center;\" src=\"https://shoutem.github.io/img/ui-toolkit/simplehtml/se-logo.png\" />\n\n<p>Image with link to <strong>shoutem.github.io</strong>:</p>\n<a href=\"https://shoutem.github.io\">\n  <img style=\"align-self:center;\" src=\"https://shoutem.github.io/img/ui-toolkit/simplehtml/se-logo.png\" />\n</a>\n`;\n\nreturn(\n  <SimpleHtml\n    body={imageExample}\n  />\n);\n```\n\nTapping the image with a link will open it in the device's browser.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/simplehtml/simplehtml-images.png'/>\n</p>\n\n### Lists\n<br />\n\n#### JSX Declaration\n\n```JSX\nconst listExample = `\n<p>Unordered lists:</p>\n<ul>\n  <li>First item</li>\n  <li>Second item</li>\n  <li>Third item</li>\n</ul>\n\n<p>Ordered lists:</p>\n<ol>\n  <li>First item</li>\n  <li>Second item</li>\n  <li>Third item</li>\n</ol>\n`\n\nreturn(\n  <SimpleHtml\n    body={listExample}\n  />\n);\n```\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/simplehtml/simplehtml-lists.png'/>\n</p>\n\n\n### Text\n<br />\n\n#### JSX Declaration\n\n```JSX\nconst textExample = `\n<h1>Header 1</h1>\n<h2>Header 2</h2>\n<h3>Header 3</h3>\n<h4>Header 4</h4>\n<h5>Header 5</h5>\n\n<p>Paragraph with <strong>bolded</strong> and <em>emphasized</em> text.</p>\n\n<p style=\"background-color:powderblue;color:red;font-size:22px;\">\nParagraph with simple inline HTML styling with 'powderblue' background color, 'red' text color and font size 22px.\n</p>\n\n<p>Paragraph with a <a href=\"https://shoutem.github.io\">link</a>.</p>\n`\n\nreturn(\n  <SimpleHtml\n    body={textExample}\n  />\n);\n```\n\nTapping the link will open it in the device's browser.\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/simplehtml/simplehtml-text.png'/>\n</p>\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-23-TextInput.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/text-input\ntitle: TextInput\nsection: UI toolkit\n---\n\n# TextInput\n\n`TextInput` component is used for inputting text into the application using keyboard.\n\n## API\n\n#### Props\n\n`TextInput` has no specific (custom) Props, however, it supports every prop that the standard React Native `TextInput` component supports. For full list of available props, visit\n[React Native TextInput component documentation](https://facebook.github.io/react-native/docs/textinput.html \"React Native TextInput component documentation\").\n\n#### Style names\n\n`TextInput` has no specific style names.\n\n#### Style\n\n* **placeholderTextColor**:  \n  - Defines the placeholder text color\n* **selectionColor**:  \n  - The highlight color of the text input (and the cursor color on iOS)\n* Also, supports every `Style` prop that the standard React Native `TextInput` component supports\n\n## Examples\n\n### Input / Placeholder text\n![Input / Placeholder text  example]({{ site.url }}/img/ui-toolkit/inputs/input-placeholder@2x.png \"Input / Placeholder text\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<TextInput\n  placeholder={'Username or email'}\n  onChangeText={...}\n/>\n```\n\n### Input / With text\n![Input / With text  example]({{ site.url }}/img/ui-toolkit/inputs/input-with-value@2x.png \"Input / With text\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<TextInput\n  defaultValue={'Username or email'}\n  onChangeText={...}\n/>\n```\n\n### Input / With password  \n![Input / With password  example]({{ site.url }}/img/ui-toolkit/inputs/input-with-password@2x.png \"Input / With password \"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<TextInput\n  placeholder={'Password'}\n  secureTextEntry\n/>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-24-ImagePreview.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/image-preview\ntitle: ImagePreview\nsection: UI toolkit\n---\n\n# ImagePreview\n\nYou can use `ImagePreview` to open a full screen modal with a zoomable image.\n\n## API\n\n#### Props\n\n* **source**: string: Defines source image URL\n* **width**: number: Defines image width\n* **height**: number: Defines image height\n\n> #### Note\n> Width and Height must be defined, otherwise `ImagePreview` will not render.\n\n#### Style names\n\n`ImagePreview` has no specific style names.\n\n## Examples\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/image-preview/image_preview@2x.png'/>\n</p>\n\n#### JSX declaration\n```JSX\n<Screen>\n  <NavigationBar\n    title=\"Preview\"\n    styleName=\"inline\"\n  />\n  <ImagePreview\n    source={% raw %}{{{% endraw %} uri: 'https://shoutem.github.io/static/getting-started/restaurant-1.jpg' }}\n    width={375}\n    height={375}\n  />\n</Screen>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-25-ImageGallery.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/image-gallery\ntitle: ImageGallery\nsection: UI toolkit\n---\n\n# ImageGallery\n\n`ImageGallery` displays a set of zoomable, transformable images, as well as their titles and descriptions in horizontal pager.\n\n## API\n\n#### Props\n\n* **data**: array\n  - Array containing source URLs of the images that will be rendered by the component\n* **selectedIndex**: number\n  - Defines which index the horizontal pager starts at\n* **renderImageOverlay**: function\n  - Prop that renders the image overlay\n* **onIndexSelected**: function\n  - Callback function triggered when user swipes between images, returns index of newly selected image\n* **renderPlaceholder**: function\n  - Callback function that can be used to define a placeholder image\n\n#### Style names\n\n`ImageGallery` has no specific style names.\n\n## Examples\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/image-gallery/image_gallery@2x.png' />\n</p>\n\n#### JSX declaration\n\n```JSX\nconstructor(props) {\n  super(props);\n\n  this.state = {\n    photos:\n    [\n      {\n        \"source\": {\n          \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\"\n        },\n        \"title\": \"Gaspar Brasserie\",\n        \"description\": \"Expect an intimate venue with the ambience of a private \"\n                       + \"club. The mood is casual, the guests sublime.\"\n      },\n      {\n        \"source\": {\n          \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-2.jpg\"\n        },\n        \"title\": \"Chalk Point Kitchen\",\n        \"description\": \"Stylish restaurant serving market-to-table American fare \"\n                       + \"in modern farmhouse digs with cellar bar.\"\n      },\n      {\n        \"source\": {\n          \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-3.jpg\"\n        },\n        \"title\": \"Kyoto Amber Upper East\",\n        \"description\": \"Amber Upper East is located on the corner of 80th and 3rd \"\n                       + \"Avenue. We serve Japanese and Asian cuisines.\"\n      }\n    ]\n  }\n}\n\nrenderImageOverlay(photos) {\n\n  return (\n    <ImageGalleryOverlay\n      styleName=\"full-screen\"\n      title={photos.title}\n      description={photos.description}\n    />\n  );\n}\n\nrender() {\n  return (\n    <Screen>\n      <NavigationBar\n        title=\"Image Gallery\"\n        styleName=\"inline\"\n      />\n      <ImageGallery\n        data={this.state.photos}\n        selectedIndex={1}\n        renderImageOverlay={this.renderImageOverlay}\n      />\n    </Screen>\n  );\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-26-InlineGallery.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/inline-gallery\ntitle: InlineGallery\nsection: UI toolkit\n---\n\n# InlineGallery\n\nRenders a stylized horizontal pager.\n\n## API\n\n#### Props\n\n* **data**: array  \n  - Prop containing items that will be rendered by the InlineGallery component\n* **onPress**: function\n  - Callback function called when user swipes between images\n* **onIndexSelected**: function\n  - Currently selected image is passed to this callback\n* **selectedIndex**: number\n  - Sets the initially selected image in the gallery\n\n#### Style names\n\n* **large-banner**: width: `window.width` height: `(200 / 375) * window.width`\n* **large-square**: width: `window.width` height: `window.width`\n* **large-wide**: width: `window.width` height: `(238 / 375) * window.width`\n* **large-ultra-wide**: width: `window.width` height: `(130 / 375) * window.width`\n\n## Examples\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/inline-gallery/inline-gallery.png'/>\n</p>\n\n#### JSX declaration\n\n```JSX\nconstructor(props) {\n  super(props);\n\n  this.state = {\n    photos:\n    [\n      { \"source\": { \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" } },\n      { \"source\": { \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-2.jpg\" } },\n      { \"source\": { \"uri\": \"https://shoutem.github.io/static/getting-started/restaurant-3.jpg\" } }\n    ]\n  }\n}\n\nrender() {\n  return (\n    <InlineGallery\n      styleName=\"large-wide\"\n      data={this.state.photos}\n    />\n  );\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-27-Switch.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/switch\ntitle: Switch\nsection: UI toolkit\n---\n\n# Switch\n\nThe `Switch` component can be used to add a simple toggle button.\n\n## API\n\n#### Props\n\n* **value**: bool\n  - True when on (right), false when off (left)\n* **onValueChange**: functional\n  - Callback function triggered by the user toggling the switch button\n\n#### Style names\n\n`Switch` has no specific style names.\n\n## Examples\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/switch/switch.png'/>\n</p>\n\n#### JSX declaration\n\n```JSX\nconstructor() {\n  super();\n  this.state = {\n    switchOn: false,\n  };\n}\n\nrender() {\n  const { switchOn } = this.state;\n\n  return (\n    <Screen>\n      <NavigationBar\n        styleName=\"inline\"\n        title=\"Restaurants\"\n      />\n      <ImageBackground\n        styleName=\"large-banner\"\n        source={% raw %}{{{% endraw %} uri : \"https://shoutem.github.io/static/getting-started/restaurant-1.jpg\" }}\n      >\n        <Tile>\n          <Overlay styleName=\"fill-parent image-overlay\">\n            {switchOn ?\n              <Title styleName=\"sm-gutter-horizontal\">GASPAR BRASSERIE</Title>\n              :\n              <Title></Title>\n            }\n          </Overlay>\n        </Tile>\n      </ImageBackground>\n      <View styleName=\"content md-gutter-top md-gutter-left\">\n        <Title>Show name</Title>\n        <Switch\n          onValueChange={value => this.setState({ switchOn: value})}\n          value={switchOn}\n        />\n      </View>\n    </Screen>\n  );\n}\n```\n"
  },
  {
    "path": "docs/ui-toolkit/components/_posts/1970-01-29-ImageBackground.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/components/image-background\ntitle: ImageBackground\nsection: UI toolkit\n---\n\n# ImageBackground\n\nThis component is used when you need to nest other components within an `Image`.\n\n## API\n\n#### Props\n\n`ImageBackground` has no specific (custom) Props, however, it supports every prop that the standard React Native `ImageBackground` component supports.\n\n#### Style names\n\nFor all intents and purposes, the `ImageBackground` component behaves identically to the `Image` component as far as styling goes, with the exception of it not providing a way to set a `borderRadius` style prop, meaning that the `avatar` `styleName`s have no affect on it.\n\nFor most of the available `ImageBackground` style names, image dimensions are scaled depending on screen dimensions. For example, an `Image` with the `featured` style name applied will have dimensions of `365x345px (width, height respectively)` on a device with a screen width of `375px`. If the device's screen width is larger, then the image dimensions will be larger than 365x345px. The same rule applies with smaller screen widths.\n\n* **featured**: width: `(365 / 375) * window.width` height: `(345 / 375) * window.width`\n* **large**: width: `window.width` height: `(280 / 375) * window.width`\n* **large-portrait**: width: `window.width` height: `(280 / 375) * window.width`\n* **large-banner**: width: `window.width` height: `(200 / 375) * window.width`\n* **large-square**: width: `window.width` height: `window.width`\n* **large-wide**: width: `window.width` height: `(238 / 375) * window.width`\n* **large-ultra-wide**: width: `window.width` height: `(130 / 375) * window.width`\n* **medium**: width: `145px` x height: `92px`\n* **medium-wide**: width: `(180/375)` height: `85px`\n* **medium-square**: width: `145px` height: `145px`\n* **medium-portrait**: width: `(209/375)` height: `139px`\n* **small**: width: `65px` height: `65px`\n\n## Examples\n\n<p class=\"image\">\n<img src='{{ site.url }}/img/ui-toolkit/image-background/image-background.png'>\n</p>\n\n#### JSX declaration\n\n```JSX\n<Screen>\n  <NavigationBar\n    title=\"Restaurants\"\n    styleName=\"inline\"\n  />\n  <ScrollView>\n    <ImageBackground\n      styleName=\"large\"\n      source={% raw %}{{{% endraw %} uri: 'https://shoutem.github.io/static/getting-started/restaurant-1.jpg' }}\n    >\n      <Tile>\n        <Overlay>\n          <Title styleName=\"md-gutter-bottom\">Gaspar Brasserie</Title>\n          <Caption>185 Sutter St, San Francisco, CA 94109</Caption>\n        </Overlay>\n      </Tile>\n    </ImageBackground>\n    <ImageBackground\n      styleName=\"large\"\n      source={% raw %}{{{% endraw %} uri: 'https://shoutem.github.io/static/getting-started/restaurant-2.jpg' }}\n    >\n      <Tile>\n        <Overlay>\n          <Title styleName=\"md-gutter-bottom\">Chalk Point Kitchen</Title>\n          <Caption>527 Broome St, New York, NY 10013</Caption>\n        </Overlay>\n      </Tile>\n    </ImageBackground>\n    <ImageBackground\n      styleName=\"large\"\n      source={% raw %}{{{% endraw %} uri: 'https://shoutem.github.io/static/getting-started/restaurant-3.jpg' }}\n    >\n      <Tile>\n        <Overlay>\n          <Title styleName=\"md-gutter-bottom\">Kyoto Amber Upper East</Title>\n          <Caption>225 Mulberry St, New York, NY 10012</Caption>\n        </Overlay>\n      </Tile>\n    </ImageBackground>\n  </ScrollView>\n</Screen>\n```\n"
  },
  {
    "path": "docs/ui-toolkit/theme/1970-01-01-Theme.md",
    "content": "---\nlayout: doc\npermalink: /docs/ui-toolkit/theme/introduction\ntitle: Introduction\nsection: UI toolkit Theme\n---\n\n# Theme\n\nThe React Native components style is usually defined as a static variable along with the component itself. This makes it easy to build self-contained components that always look and behave the same way. On the other hand, it complicates building customizable (or skinnable) components that could have multiple styles which could be customized without touching the component's source code.\n\n![Theme]({{ site.url }}/img/ui-toolkit/theme.jpg \"Theme\"){:.docs-component-image}\n\nOne of our main goals was to add support for themes to components with as little changes as possible to the components themselves. To add support for themes to your component you only need to make two minor changes to it.\n\n## Installation\n\n`@shoutem/theme` is available on npm:\n\n```bash\n$ npm install --save @shoutem/theme\n```\n\n## Building customizable components\nThe main thing you need to change is to start using the style rules from the `props.style` property, instead of using the static variable defined alongside the component. You can define the default style of the component statically (the same way as before) but you shouldn't use that property to get the actual style in runtime. This allows us to merge the default style with any theme style that may be active in the app, and provide the final style to components.\n\nWe will now demonstrate how simple it is to make an existing component customizable for an example. Let's start by implementing a simple component that has a static style:\n\n```JavaScript\nimport React, { Component } from 'react';\nimport { StyleSheet, Text, View, Image } from 'react-native';\n\nexport default class AvatarItem extends Component {\n  render() {\n    return (\n        <View style={styles.container}>\n            <Image style={styles.avatarImage} source={% raw %}{{{% endraw %} uri: 'https://shoutem.github.io/img/ui-toolkit/examples/image-9.png' }} />\n            <Text style={styles.title}>John Doe</Text>\n        </View>\n    );\n  }\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    height: 50,\n    flexDirection: 'row',\n    justifyContent: 'center',\n  },\n  avatarImage: {\n    width: 36,\n    height: 36,\n    borderRadius: 18,\n  },\n  title: {\n    flex: 1,\n    fontSize: 19,\n    fontWeight: 'bold',\n  },\n});\n```\n\nIn order to support themes, we need to:\n\n1. Replace the occurrences of `styles` with `this.props.style`\n2. Connect the component to the theme\n\n```JavaScript{2,6-10,15,34-35}\nimport React, { Component } from 'react';\nimport { Text, View, Image } from 'react-native';\nimport { connectStyle } from '@shoutem/theme';\n\nclass AvatarItem extends Component {\n  // connect styles to props.style defined by the theme\n  const styles = this.props.style;\n  render() {\n    return (\n        <View style={styles.container}>\n            <Image style={styles.avatarImage} source={% raw %}{{{% endraw %} uri: 'https://shoutem.github.io/img/ui-toolkit/examples/image-9.png' }} />\n            <Text style={styles.title}>John Doe</Text>\n        </View>\n    );\n  }\n}\n\nconst styles = {\n  container: {\n    flex: 1,\n    height: 50,\n    flexDirection: 'row',\n    justifyContent: 'center',\n  },\n  avatarImage: {\n    width: 36,\n    height: 36,\n    borderRadius: 18,\n  },\n  title: {\n    flex: 1,\n    fontSize: 19,\n    fontWeight: 'bold',\n  },\n};\n\n// connect the component to the theme\nexport default connectStyle('com.example.AvatarItem', styles)(AvatarItem);\n```\n\nThe `connectStyle` function receives two arguments. The first one represents the fully qualified name that component will be referenced by in the theme, and the second one is the default component style. Fully qualified name of the component needs to have `namespace` prefix, separated with `.` from the component name.\n\nAny styles defined in the theme will be merged with the default style, and theme rules will override the rules from the default style. The style that is sent to `connectStyle` shouldn't be created using the `StyleSheet.create`. Style sheet will be created by the `connectStyle` function at at appropriate time.\n\n## Initialize the style provider \nWith those simple changes, we have a component that can receive styles from the outside. The only thing left to do is to initialize the style provider within the app, so that theme styles are correctly distributed to components. To do this, we need to initialize the `StyleProvider` component, and render any customizable components within it:\n\n```JavaScript\nimport React, { Component } from 'react';\nimport { StyleProvider } from '@shoutem/theme';\n\nclass App extends Component {\n  render() {\n    return (\n        <StyleProvider style={theme}>\n        // any app components\n        </StyleProvider>\n    );\n  }\n}\n\n// Define a theme\nconst theme = {\n  'com.example.AvatarItem': {\n    // overrides AvatarItem component style...\n  },\n};\n```\n\n\n## Theme style rules \nAll styles defined as a part of the theme may be regular React Native styles, but there are several new types of style rules that are supported in themes as well. We will explain all those rules on the `Card` component from the UI toolkit:\n\n![Card grid item example]({{ site.url }}/img/ui-toolkit/cards/card@2x.png \"Card grid item\"){:.docs-component-image}\n\n#### JSX Declaration\n```JSX\n<Card>\n  <Image styleName=\"banner\" source={% raw %}{{{% endraw %} uri: 'https://shoutem.github.io/img/ui-toolkit/examples/image-10.png' }} />\n  <View styleName=\"card-content\">\n    <Subtitle numberOfLines={4}>Choosing The Right Boutique Hotel For You</Subtitle>\n    <Divider styleName=\"empty\" />\n    <Caption>21 hours ago</Caption>\n  </View>\n</Card>\n```\n\n#### Define a theme for Card component\n```JavaScript\nconst theme = {\n  'shoutem.ui.Card': {\n    // card component variants\n    '.dark': {\n      backgroundColor: '#000'\n    },\n\n    '.light': {\n      backgroundColor: '#fff'\n    },\n\n    // style variant available to child components of any type\n    '*.card-content': {\n      padding: 15\n    },\n\n    // style that will be applied to all child image components\n    'shoutem.ui.Image': {\n      flex: 1,\n      resizeMode: 'cover',\n    },\n\n    // style variant available to child image comoponents\n    'shoutem.ui.Image.banner': {\n      height: 85\n    },\n\n    // default card style, we usually place these rules at the bottom\n    backgroundColor: '#fff',\n    borderRadius: 2,\n\n    // card shadow style\n    shadowColor: 'black',\n    shadowRadius: 9,\n    shadowOpacity: 0.3,\n    shadowOffset: { width: 5, height: 7 }\n  }\n}\n```\n\n## Default component style \nThe default component style is at the bottom of the style object. This style will always be applied as a base style to all cards. After that, any theme style will be merged with that style, i.e., the theme style rules will override the base component rules. In the end, any style specified through the `style` prop directly on the component will be merged on top of the styles mentioned above to get the final component style.\n\nRules above the default component style are the new rule types that are specific to theme styles.\n\n## Component variants \nThe `.dark`, and `.light` rules are card variants that can be activated by using the `styleName` prop on the card component. For example, a card with a dark variant would look like this:\n\n```JSX\n<Card styleName=\"dark\">\n   ...\n</Card>\n```\n\n## Style exposed to children \nThe rest of the rules in the style object are rules that will be applied to child components of a card. Each of those rules has two components, the component type, and the optional style name. The rule `*.card-content` will be available to child components of a card of any type. This rule can be applied to a child component by using the `styleName` prop, for example:\n\n```JSX\n<Card>\n  <View styleName=\"card-content\">\n    ...\n  </View>\n</Card>\n```\n\nThe remaining two rules will be applied only to images. `shoutem.ui.Image` will be applied to all `Image` components added to a card, and the rule `shoutem.ui.Image.banner` will be applied to all images with a `styleName=\"banner\"` prop.\n"
  },
  {
    "path": "index.html",
    "content": "---\nlayout: home\n---"
  },
  {
    "path": "jekyll-static.sh",
    "content": "jekyll serve --watch --incremental --limit_posts 1"
  },
  {
    "path": "js/animation.js",
    "content": "// shoutem animation\nfunction ShoutemAnimation(p_container_selector) {\n\n\tthis.$container = $(p_container_selector);\n\tthis.particles = [];\n\tthis.maxParticles = 10;\n\tthis.paused = false;\n\tthis.time = null;\n\t\n\tthis.getTranslateY = function(p_$el) {\n\t\treturn parseFloat(p_$el.css('transform').split(/[()]/)[1].split(',')[5].split(\" \").join(\"\"));\n\t}\n\t\t\n\tthis.removeAllParticles = function() {\n\t\twhile (this.particles.length) {\n\t\t\tvar p = this.particles.pop();\n\t\t\tp.$e.remove();\n\t\t}\n\t}\n\n\tthis.manageParticles = function() {\n\t\t\n\t\t// calculate number for particles\n\t\tthis.maxParticles = Math.max(5, Math.round(this.$container.width() * this.$container.height() / 90000));\n\t\t\t\n\t\t// delete superfluous particles\n\t\twhile (this.particles.length > this.maxParticles) {\n\t\t\tvar p = this.particles.pop();\n\t\t\tp.$e.remove();\n\t\t}\n\t\t\n\t\t// reset off-screen particles \n\t\tfor (var i = 0; i < this.particles.length; i++) {\n\t\t\tvar p = this.particles[i];\n//\t\t\t\tif (parseInt(p.$e.css(\"top\").split(\"px\")[0]) < - (parseInt(p.$e.css(\"height\").split(\"px\")[0])) - 40 ) {\n\t\t\tif (this.getTranslateY(p.$e) < - (parseInt(p.$e.css(\"height\").split(\"px\")[0])) - 40 ) {\n\t\t\t\tif (p.type != 5) {\n\t\t\t\t\tp.$e.removeClass(\"particle-\" + p.type);\n\t\t\t\t\tp.type = Math.ceil(Math.random() * 4);\n\t\t\t\t\tp.$e.addClass(\"particle-\" + p.type);\n\t\t\t\t}\n\t\t\t\tp.rotation = 0;\n//\t\t\t\t\tp.$e.css({ top: (this.$container.height() + parseInt(p.$e.css(\"height\").split(\"px\")[0])) + \"px\", left: ((this.$container.width() - 75) * Math.random())  +\"px\" });\n\t\t\t\tp.$e.css({ transform: \"translateY(\" + Math.round(this.$container.height() + parseInt(p.$e.css(\"height\").split(\"px\")[0])) + \"px)\", left: ((this.$container.width() - 75) * Math.random())  +\"px\" });\n\t\t\t\tp.velocity = 1 + Math.random() * 2;\n\t\t\t\tif (p.type == 1 || p.type == 4) p.velocity *= 0.50; // slow down small particles\n\t\t\t}  \n\t\t}\n\t\t\n\t\t// create missing particles\n\t\twhile (this.particles.length < this.maxParticles) {\n\t\t\t\n\t\t\tvar p = {};\n\t\t\tthis.particles.push(p);\n\n\t\t\t// shuttle\n\t\t\tif (this.particles.length == 1) {\n\t\t\t\tp.type = 5;\n\t\t\t\tp.$e = $('<div class=\"particle particle-' + p.type + '\"><div class=\"thrust-line thrust-line-1\"></div><div class=\"thrust-line thrust-line-2\"></div><div class=\"thrust-line thrust-line-3\"></div><div class=\"thrust-line thrust-line-4\"></div><div class=\"thrust-line thrust-line-5\"></div><div class=\"thrust-line thrust-line-6\"></div></div>');\n\t\t\t}\n\t\t\t// other particles\n\t\t\telse {\n\t\t\t\tp.type = Math.ceil(Math.random() * 4);\n\t\t\t\tp.$e = $('<div class=\"particle particle-' + p.type + '\"></div>');\n\t\t\t}\n\t\t\tp.rotation = 0;\n\t\t\t\t\t\n//\t\t\t\tp.$e.css({ left: ((this.$container.width() - 75) * Math.random())  +\"px\", top: (this.$container.height() * Math.random() + this.$container.height()) + \"px\" });\n\t\t\tp.$e.css({ left: ((this.$container.width() - 75) * Math.random())  +\"px\", transform: \"translateY(\" + Math.round(this.$container.height() * Math.random() + this.$container.height()) + \"px)\" });\n\t\t\tp.velocity = 1 + Math.random();\n\t\t\tif (p.type == 1 || p.type == 4) p.velocity *= 0.5; // slow down small particles\n\t\t\tthis.$container.append(p.$e);\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\tthis.animate = function() {\n\t\t\n\t\tvar _this = this;\n\t    requestAnimationFrame(function() { _this.animate(); });\n\t    \n\t    if (this.paused) return;\n\t    \n\t    var now = new Date().getTime(),\n\t        dt = now - (this.time || now);\n\t        \n\t    // too long timeout, probably browser tab switch\n\t    if (dt > 1000) { dt = 0; }\n\t \n\t    this.time = now;\n\n\t\t// animate particles forward\n\t\tfor (var i = 0; i < this.particles.length; i++) {\n\t\t\tvar $e = this.particles[i].$e;\n//\t\t\t\t$e.css({ top: ($e.css(\"top\").split(\"px\")[0] - dt * (this.particles[i].velocity) / 20) + \"px\" });\n\t\t\tif (this.particles[i].type == 3 || this.particles[i].type == 4) {\n\t\t\t\tthis.particles[i].rotation += dt/20;\n\t\t\t\tif (this.particles[i].rotation > 360) {\n\t\t\t\t\tthis.particles[i].rotation -= 360;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$e.css({ transform: \"translateY(\" + (Math.round((this.getTranslateY($e) - dt * (this.particles[i].velocity) / 20) * 50 ))/50 + \"px) rotate(\"+ this.particles[i].rotation + \"deg)\" });\n\t\t\t\n\t\t}\n\t\t\n\t\tthis.manageParticles();\n\t    \n\t}\n\t\n\t\n\tthis.animate();\n\t\n}\n"
  },
  {
    "path": "js/docs.js",
    "content": "$(function() {\n  var currentLocation = getLocation();\n  var $window = jQuery(window);\n  var $document = jQuery(document);\n  var $body = jQuery(\"body\");\n\n  showMenuItems();\n  showNavButtons();\n  prepareCodeblocks();\n  Prism.highlightAll();\n  setShell$Color();\n  setupVideos();\n\n\n\n  /* Ajax loading */\n\n  $window.on(\"popstate\", ajaxLoadLink);\n  $body.on(\"click\", \"a:not(#signup-modal)\", ajaxLoadLink);\n\n  var animationTime = 200;\n  var hostname = window.location.host;\n  var docsLinkRx = new RegExp(hostname + \"/docs/\", \"i\");\n  var flourish = new Flourish({\n    extractSelector: \"#documentation\",\n    replaceSelector: \"#documentation\",\n    bodyTransitionClass: \" loading \",\n    replaceDelay: animationTime\n  });\n\n  addTargetBlankToLinks();\n\n  flourish.off(\"post_fetch\").on(\"post_fetch\", function( options, output )\n  {\n    var title = output.title.split(/\\s*-\\s*/);\n    flourish.page_title = title[0];\n    flourish.page_section = title[1];\n    flourish.edit_link = output.el.querySelector(\".edit-link a\").href;\n\n    setTimeout(function () {\n      $body.removeClass(\"loading\");\n    }, animationTime * 1.5);\n  });\n\n  flourish.off(\"post_replace\").on(\"post_replace\", function ()\n  {\n    var loc = currentLocation = getLocation();\n\n    $(\".page-title\").text(flourish.page_title);\n    $(\".page-section\").text(flourish.page_section);\n    $(\".edit-link a\")[0].href = flourish.edit_link;\n\n    $(\"html, body\").animate({ scrollTop: 0 });\n   \n    addTargetBlankToLinks();\n    showMenuItems();\n    showNavButtons();\n    prepareCodeblocks();\n    Prism.highlightAll();\n    setShell$Color();\n    setupVideos();\n\n    $(\".mobile-menu-overlay, #sidebar-wrapper\").removeClass(\"open\");\n    \n    // remove focus from the active menu link\n    document.activeElement.blur();\n  });\n\n\n\n  /* Signup modal */\n\n  var $signupModal = $(\"#signup-modal\");\n\n  $(\"#signup-button, #signup-button-menu\").on(\"click\", function(e) {\n    $(\".mobile-menu-overlay, #sidebar-wrapper\").removeClass(\"open\");\n    $signupModal.focusedElBeforeOpen = document.activeElement;\n    $signupModal.addClass(\"open\");\n    setTimeout(function(){\n      $(\".signup-email\").focus();\n    }, 200);\n    e.preventDefault();\n  });\n\n  $signupModal.on(\"click\", function(e) {\n    if( (e.target || e.srcElement).id === $signupModal[0].id ) {\n      closeSignupModal();\n      e.preventDefault();\n    }\n  });\n\n  $(\"#mc-embedded-cancel\").on(\"click\", function(e) {\n      closeSignupModal();\n  });\n\n  function addTargetBlankToLinks() {\n    $(\"a\").each(function(){\n      if( ! this.href.match(docsLinkRx) ) {\n        this.setAttribute(\"target\", \"_blank\");\n      }\n    });\n  }\n\n  function closeSignupModal(e)\n  {\n    $signupModal.removeClass(\"open\");\n    $signupModal.focusedElBeforeOpen.focus();\n  }\n\n  // https://bitsofco.de/accessible-modal-dialog/\n  $signupModal.on(\"keydown\", function(e)\n  {\n    var emailInput = document.querySelector(\"#mce-EMAIL\");\n    var submitButton = document.querySelector(\"#mc-embedded-subscribe\");\n    var KEY_TAB = 9;\n\n    function handleBackwardTab() {\n      if ( document.activeElement === emailInput ) {\n          e.preventDefault();\n          submitButton.focus();\n      }\n    }\n    function handleForwardTab() {\n      if ( document.activeElement === submitButton ) {\n          e.preventDefault();\n          emailInput.focus();\n      }\n    }\n\n    if( e.keyCode === KEY_TAB )\n    {\n      if ( e.shiftKey ) {\n        handleBackwardTab();\n      } else {\n        handleForwardTab();\n      }\n    }\n  });\n\n  // prevent document scrolling upon reaching sidebar menu scroll end\n  // http://jsfiddle.net/troyalford/4wrxq/4/\n  $(\"#sidebar-wrapper\").on(\"wheel mousewheel DOMMouseScroll\", function(ev)\n  {\n    var $this = $(this),\n      scrollTop = this.scrollTop,\n      scrollHeight = this.scrollHeight,\n      height = $this.height(),\n      delta = (ev.type == \"DOMMouseScroll\" ?\n        ev.originalEvent.detail * -40 :\n        ev.originalEvent.wheelDelta),\n      up = delta > 0;\n\n    if( ! up && -delta > scrollHeight - height - scrollTop ) {\n      // Scrolling down, but this will take us past the bottom.\n      $this.scrollTop(scrollHeight);\n      ev.stopPropagation();\n      ev.preventDefault();\n      ev.returnValue = false;\n      return false;\n    } else if( up && delta > scrollTop ) {\n      // Scrolling up, but this will take us past the top.\n      $this.scrollTop(0);\n      ev.stopPropagation();\n      ev.preventDefault();\n      ev.returnValue = false;\n      return false;\n    }\n  });\n\n  function getLocation( location ) {\n    location = (location || window.location.href).split(\"?\").shift();\n    var startingIndexSection = location.indexOf('/docs/') + 6;\n    var endIndexSection = location.slice(startingIndexSection).indexOf('/') + startingIndexSection;\n    var section = location.slice(startingIndexSection, endIndexSection);\n    var path = location.slice(location.indexOf('/docs/'));\n\n    return {section: section, path: path};\n  }\n\n  function showMenuItems() {\n    var loc = currentLocation;\n\n    $('.sidebar-nav .active').removeClass(\"active\");\n    $('.sidebar-nav .open').removeClass(\"open\");\n\n    // Show active menu item\n    $activeLinks = $('a[href$=\"' + loc.path + '\"]');\n    $activeLinks.addClass(\"active\");\n    $activeLinks.parents(\"ul\").addClass('open');\n\n    // Select documentation tab\n    $('#documentationTab').addClass('active');\n  };\n\n  function showNavButtons() {\n      var $activeLink = $('.sidebar-nav .active:not(.menu-group-title)').parent();\n\n      var $prev = $('>a', $activeLink.prev());\n      var $next = $('>a', $activeLink.next());\n      var prevUrl = $prev.attr('href');\n      var nextUrl = $next.attr('href');\n      var $prevLink = $('#pager-wrapper .previous a');\n      var $nextLink = $('#pager-wrapper .next a');\n      var $prevPar = $prevLink.parent();\n      var $nextPar = $nextLink.parent();\n      var $prevText = $prev.text();\n      var $nextText = $next.text();\n      \n      $prevLink.attr('href', prevUrl);\n      $prevLink.html(\"<span>\" + $prevText + \"</span>\");\n      $prevLink.attr(\"title\", $prevText);\n      \n      $nextLink.attr('href', nextUrl);\n      $nextLink.html(\"<span>\" + $nextText + \"</span>\");\n      $nextLink.attr(\"title\", $nextText);\n\n      if( prevUrl ) {\n        $prevPar.removeClass('inactive');\n      } else {\n        $prevPar.addClass('inactive');\n      }\n\n      if( nextUrl ) {\n        $nextPar.removeClass('inactive');\n      } else {\n        $nextPar.addClass('inactive');\n      }\n\n      if( ! prevUrl && ! nextUrl ) {\n        $('#pager-wrapper').addClass(\"hidden\");\n      } else {\n        $('#pager-wrapper').removeClass(\"hidden\");\n      }\n  }\n\n  function prepareCodeblocks() {\n      $('pre').each(function() {\n          var $pre = $(this);\n          var codeClass = $pre.find('code').attr('class');\n          var code = $pre.html();\n          var fileMatch = code.match(/#file:.+$/m);\n          var lineMatch = codeClass && codeClass.match(/\\{(.+)\\}/);\n          var fileTag;\n          \n          if (fileMatch) {\n              fileTag = fileMatch[0];\n              code = code.replace(fileTag + '\\n', '');\n              $pre.html(code);\n              $pre.before('<div class=\"docs-codeblock-path\">' + fileTag.substring(7) + '</div>');\n          }\n          \n          if (lineMatch) {\n              $pre.attr('data-line', lineMatch[1]);\n          }\n      });\n  }\n\n  function ajaxLoadLink (e) {\n    if( e.ctrlKey || e.shiftKey || e.metaKey ) {\n      return;\n    }\n\n    var url = false;\n\n    if( e.type === \"popstate\" )\n    {\n      var state = e.originalEvent ? e.originalEvent.state : e.state;\n\n      if( state && state.url ) {\n        url = state.url\n      }\n    }\n    else\n    {\n      if( this.href.indexOf(\"#\") === -1 ) {\n        url = this.href;\n      }\n    }\n\n    if( url && url.match(docsLinkRx) )\n    {\n      e.preventDefault();\n\n      var curLoc = currentLocation;\n      var newLoc = getLocation(url);\n\n      if( curLoc.section === newLoc.section && curLoc.path === newLoc.path ) {\n        document.activeElement.blur();\n        return;\n      }\n\n      flourish.fetch({\n        url: url,\n        eventType: e.type,\n        onerror: function( request, options, self ) {\n          $body.removeClass(\"loading\");\n        }\n      });\n    }\n  }\n\n  function setShell$Color()\n  {\n    var elements = jQuery(\"code.language-shellsession\");\n\n    elements.each(function(){\n      this.innerHTML = this.innerHTML.replace(/^\\s*\\$/, \"<span class='dollar-sign'>$</span>\");\n    });\n  }\n\n\n  /* Videos */\n  function setupVideos()\n  {\n    var videos = Array.prototype.slice.call(document.querySelectorAll(\".video-screen\"));\n\n    videos.forEach(function(video)\n    {\n      video.querySelector(\"video\").play();\n    });\n  }\n});"
  },
  {
    "path": "js/flourish.js",
    "content": "function Flourish ( options )\n{\n\tvar defaults = {\n\t\tsaveHistoryEntry: true,\n\t\treplaceContents: true,\n\t\treplaceBodyClasses: true,\n\t\treplaceDelay: false,\n\t\treplaceIgnoreClasses: [],\n\t\tbodyTransitionClass: \"flourish-loading\",\n\t\tchildrenTransitionClass: \"flourish-removing\",\n\t\tfileExt: [\"jpg\", \"jpeg\", \"bmp\", \"gif\", \"png\", \"webp\"]\n\t};\n\n\tthis.options = this.extend(defaults, options || {});\n\n\tthis.fileRx = new RegExp(\"\\.(\" + this.options.fileExt.join(\"|\") + \")$\", \"i\");\n\n\tif( typeof history.replaceState === \"function\" ) {\n\t\thistory.replaceState({url: location.href}, \"\", location.href);\n\t}\n}\n\nFlourish.prototype = {\n\n\tpushStateOK: typeof history.pushState === \"function\",\n\n\tevents: {\n\t\tpre_fetch: [],\n\t\tpost_fetch: [],\n\t\tpost_replace: []\n\t},\n\n\ton: function( name, callback )\n\t{\n\t\tif( typeof callback === \"function\" )\n\t\t{\n\t\t\tif( this.events[name] === void 0 ) {\n\t\t\t\tthis.events[name] = [];\n\t\t\t}\n\n\t\t\tthis.events[name].push(callback);\n\t\t}\n\t},\n\n\toff: function( name, callback )\n\t{\n\t\tvar e = this.events[name];\n\t\tvar i;\n\n\t\tif( e && e.length )\n\t\t{\n\t\t\tif( typeof callback === \"function\" )\n\t\t\t{\n\t\t\t\ti = e.indexOf(callback);\n\n\t\t\t\tif( i > -1 ) {\n\t\t\t\t\te.splice(i, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\te.length = 0;\n\t\t\t}\n\t\t}\n\t},\n\n\tfire: function( name )\n\t{\n\t\tvar e = this.events[name];\n\n\t\tif( e && e.length )\n\t\t{\n\t\t\tvar args = Array.prototype.slice.apply(arguments).slice(1);\n\n\t\t\te.forEach(function(f)\n\t\t\t{\n\t\t\t\tif( typeof f === \"function\" ) {\n\t\t\t\t\tf.apply(f, args);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t},\n\n\tgetDocumentElement: function( text )\n\t{\n\t\tvar div = document.createElement(\"div\");\n\t\tdiv.innerHTML = text;\n\t\treturn div;\n\t},\n\n\tgetDocumentTitle: function( text )\n\t{\n\t\tvar title = text.match(/<title>([^\\<]*?)<\\/title>/i);\n\n\t\tif( title && title[1] ) {\n\t\t\treturn title[1].trim();\n\t\t}\n\n\t\treturn \"\";\n\t},\n\n\tgetDocumentClasses: function( text )\n\t{\n\t\tvar htmlTag = text.match(/<html[^>]*>/i)[0];\n\t\tvar bodyTag = text.match(/<body[^>]*>/i)[0];\n\n\t\tvar htmlClasses = htmlTag.match(/class=['|\"](.*?)['|\"]/i);\n\n\t\tif( htmlClasses && htmlClasses[1] ) {\n\t\t\thtmlClasses = htmlClasses[1].trim();\n\t\t}\n\n\t\tvar bodyClasses = bodyTag.match(/class=['|\"](.*?)['|\"]/i);\n\n\t\tif( bodyClasses && bodyClasses[1] ) {\n\t\t\tbodyClasses = bodyClasses[1].trim();\n\t\t}\n\n\t\treturn {\n\t\t\thtml: htmlClasses || \"\",\n\t\t\tbody: bodyClasses || \"\"\n\t\t}\n\t},\n\n\textend: function( base, extra )\n\t{\n\t\tfor( var i in extra )\n\t\t{\n\t\t\tif( extra.hasOwnProperty(i) ) {\n\t\t\t\tbase[i] = extra[i];\n\t\t\t}\n\t\t}\n\n\t\treturn base;\n\t},\n\n\tfetch: function( options )\n\t{\n\t\tvar self = this;\n\n\t\toptions = options || {};\n\n\t\tif( typeof options === \"string\" ) {\n\t\t\toptions = {url: options};\n\t\t}\n\n\t\tthis.fire(\"pre_fetch\", options);\n\n\t\tvar onsuccess = typeof options.onsuccess === \"function\" ? \n\t\t\toptions.onsuccess : this.onsuccess.bind(this);\n\t\tvar onerror = typeof options.onerror === \"function\" ? \n\t\t\toptions.onerror : this.onerror.bind(this);\n\n\t\tif( ! options || ! options.url || this.fileRx.test(options.url) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar request = new XMLHttpRequest();\n\t\t\n\t\trequest.open(\"GET\", options.url, true);\n\n\t\trequest.onload = function( progress )\n\t\t{\n\t\t\tif( request.status >= 200 && request.status < 400 ) {\n\t\t\t\tonsuccess(request, options, self);\n\t\t\t} else {\n\t\t\t\tonerror(request, options, self);\n\t\t\t}\n\t\t};\n\n\t\trequest.onerror = onerror;\n\t\trequest.send();\n\n\t\treturn this;\n\t},\n\n\tonsuccess: function( request, options, self )\n\t{\n\t\tvar text = request.responseText;\n\t\tvar output = {\n\t\t\ttitle: this.getDocumentTitle(text),\n\t\t\tdocumentClasses: this.getDocumentClasses(text),\n\t\t\tel: this.getDocumentElement(text)\n\t\t};\n\n\t\toptions = this.extend(this.extend({}, this.options), options);\n\n\t\tthis.fire(\"post_fetch\", options, output, self);\n\n\t\tif( options.extractSelector )\n\t\t{\n\t\t\toutput.el = output.el.querySelector(options.extractSelector);\n\n\t\t\tif( ! output.el ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif( options.saveHistoryEntry && options.eventType !== \"popstate\" ) {\n\t\t\tthis.addHistoryEntry({url: options.url});\n\t\t}\n\n\t\tif( options.replaceContents ) {\n\t\t\tthis.replaceContents(options, output);\n\t\t}\n\n\t\treturn output;\n\t},\n\n\tonerror: function( request, options, self )\n\t{\n\t\tconsole.error(request.status);\n\t},\n\n\treplaceContents: function( options, output, extendOptions )\n\t{\n\t\tif( extendOptions ) {\n\t\t\toptions = this.extend(this.extend({}, this.options), options);\n\t\t}\n\n\t\tvar container = document.querySelector(options.replaceSelector);\n\n\t\tif( container )\n\t\t{\n\t\t\tvar documentTitle = document.getElementsByTagName(\"title\")[0];\n\t\t\tvar bodyEl = document.getElementsByTagName(\"body\")[0];\n\t\t\tvar len = 0;\n\t\t\tvar i = 0;\n\n\t\t\tif( options.replaceBodyClasses )\n\t\t\t{\n\t\t\t\tbodyEl.className = output.documentClasses.body;\n\n\t\t\t\tif( options.bodyTransitionClass ) {\n\t\t\t\t\tbodyEl.className += options.bodyTransitionClass;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdocumentTitle.innerHTML = output.title;\n\n\t\t\tif( Number(options.replaceDelay) ) {\n\t\t\t\tthis.replaceContentsWithDelay(options, container, output.el.children);\n\t\t\t} else {\n\t\t\t\tthis.replaceContentsNow(options, container, output.el.children);\n\t\t\t}\n\t\t}\n\t},\n\n\treplaceContentsNow: function ( options, container, newNodes )\n\t{\n\t\tvar ignoredClasses = options.replaceIgnoreClasses;\n\t\tvar oldNodes = container.children;\n\t\tvar matchedClasses = [];\n\t\tvar hasClasses = [];\n\t\tvar child;\n\t\tvar i = 0;\n\n\t\tif( ignoredClasses.length )\n\t\t{\n\t\t\tlen = oldNodes.length;\n\n\t\t\twhile( len > 0 )\n\t\t\t{\n\t\t\t\tchild = oldNodes[len-1];\n\n\t\t\t\tif( child )\n\t\t\t\t{\n\t\t\t\t\thasClasses = this.hasAnyClasses(child, ignoredClasses);\n\n\t\t\t\t\tif( hasClasses.length === 0 ) {\n\t\t\t\t\t\tcontainer.removeChild(child);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmatchedClasses = matchedClasses.concat(hasClasses);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlen--;\n\t\t\t}\n\n\t\t\tlen = newNodes.length;\n\t\t\ti = 0;\n\n\t\t\twhile( len > 0 )\n\t\t\t{\n\t\t\t\tchild = newNodes[i];\n\n\t\t\t\tif( child )\n\t\t\t\t{\n\t\t\t\t\thasClasses = this.hasAnyClasses(child, matchedClasses);\n\n\t\t\t\t\tif( hasClasses.length === 0 ) {\n\t\t\t\t\t\tcontainer.appendChild(child);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchild.parentNode.removeChild(child);\n\t\t\t\t\t\ti++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlen--;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile( oldNodes.length > 0 )\n\t\t\t{\n\t\t\t\tcontainer.removeChild(oldNodes[i]);\n\t\t\t}\n\n\t\t\twhile( newNodes.length > 0 )\n\t\t\t{\n\t\t\t\tcontainer.appendChild(newNodes[i]);\n\t\t\t}\n\t\t}\n\n\t\tthis.fire(\"post_replace\");\n\t},\n\n\treplaceContentsWithDelay: function ( options, container, newNodes )\n\t{\n\t\tvar self = this;\n\t\tvar ignoredClasses = options.replaceIgnoreClasses;\n\t\tvar oldNodes = container.children;\n\t\tvar len = oldNodes.length;\n\t\tvar matchedClasses = [];\n\t\tvar hasClasses = [];\n\t\tvar child;\n\t\tvar i = 0;\n\n\t\tif( options.childrenTransitionClass )\n\t\t{\n\t\t\twhile( len > 0 )\n\t\t\t{\n\t\t\t\tchild = oldNodes[len-1];\n\n\t\t\t\tif( child )\n\t\t\t\t{\n\t\t\t\t\t// give the transition class only to nodes about to be removed\n\t\t\t\t\tif( this.hasAnyClasses(child, ignoredClasses).length === 0 ) {\n\t\t\t\t\t\tchild.className += \" \" + options.childrenTransitionClass;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlen--;\n\t\t\t}\n\t\t}\n\n\t\tsetTimeout(function()\n\t\t{\n\t\t\tif( ignoredClasses.length )\n\t\t\t{\n\t\t\t\tlen = oldNodes.length;\n\n\t\t\t\twhile( len > 0 )\n\t\t\t\t{\n\t\t\t\t\tchild = oldNodes[len-1];\n\n\t\t\t\t\tif( child )\n\t\t\t\t\t{\n\t\t\t\t\t\thasClasses = self.hasAnyClasses(child, ignoredClasses);\n\n\t\t\t\t\t\tif( hasClasses.length === 0 ) {\n\t\t\t\t\t\t\tcontainer.removeChild(child);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmatchedClasses = matchedClasses.concat(hasClasses);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tlen--;\n\t\t\t\t}\n\n\t\t\t\twhile( newNodes.length > 0 )\n\t\t\t\t{\n\t\t\t\t\tchild = newNodes[0];\n\n\t\t\t\t\tif( child )\n\t\t\t\t\t{\n\t\t\t\t\t\thasClasses = self.hasAnyClasses(child, matchedClasses);\n\n\t\t\t\t\t\tif( hasClasses.length === 0 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif( options.childrenTransitionClass ) {\n\t\t\t\t\t\t\t\tchild.className += \" \" + options.childrenTransitionClass;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontainer.appendChild(child);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tchild.parentNode.removeChild(child);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile( container.children.length > 0 )\n\t\t\t\t{\n\t\t\t\t\tcontainer.removeChild(container.children[0]);\n\t\t\t\t}\n\n\t\t\t\twhile( newNodes.length > 0 )\n\t\t\t\t{\n\t\t\t\t\tif( options.childrenTransitionClass ) {\n\t\t\t\t\t\tnewNodes[0].className += \" \" + options.childrenTransitionClass;\n\t\t\t\t\t}\n\n\t\t\t\t\tcontainer.appendChild(newNodes[0]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif( options.childrenTransitionClass )\n\t\t\t{\n\t\t\t\tsetTimeout(function()\n\t\t\t\t{\n\t\t\t\t\tc = container.children;\n\t\t\t\t\tlen = c.length;\n\n\t\t\t\t\tfor(i = 0; i < len; i++ )\n\t\t\t\t\t{\n\t\t\t\t\t\tself.removeClass(c[i], options.childrenTransitionClass);\n\t\t\t\t\t}\n\t\t\t\t}, 25);\n\t\t\t}\n\n\t\t\tself.fire(\"post_replace\");\n\n\t\t}, options.replaceDelay);\n\t},\n\n\tunique: function (val, i, arr)\n\t{\n\t\treturn arr.lastIndexOf(val) === i;\n\t},\n\n\thasAnyClasses: function ( el, classList )\n\t{\n\t\tvar elClasses = el.className.split(/\\s+/);\n\n\t\treturn elClasses.reduce(function(arr, c){\n\t\t\tif( classList.indexOf(c) > -1 ) {\n\t\t\t\tarr.push(c);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}, []).filter(this.unique);\n\t},\n\n\tremoveClass: function(el, name)\n\t{\n\t\tif( el && el.className && typeof el.className === \"string\" )\n\t\t{\n\t\t\tel.className = el.className.split(\" \").reduce(function( arr, c ) {\n\t\t\t\tc = c.trim();\n\t\t\t\tif( c.length && c !== name ) { arr.push(c); }\n\t\t\t\treturn arr;\n\t\t\t}, []).join(\" \");\n\t\t}\n\t},\n\n\taddHistoryEntry: function ( data )\n\t{\n\t\tif( this.pushStateOK ) {\n\t\t\thistory.pushState(data, null, data.url);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "js/main.js",
    "content": "// requestAnimFrame  pseudo-polyfill\nwindow.requestAnimFrame = (function(){\nreturn window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60); };\n})();\n\nvar isHome = $(\"body\").hasClass(\"home\");\nvar isTouchDevice = \"ontouchstart\" in document.documentElement;\n\nif( isHome )\n{\n\tvar shoutemAni = new ShoutemAnimation(\".shoutem-ani\");\n\tvar headroom = new Headroom($(\"nav.headroom\").get(0), {\n\t\toffset: 81,\n\t\ttolerance: {\n\t\t\tdown : 10,\n\t\t\tup : 20\n\t\t}\n\t});\n\n\theadroom.init();\n\n\t$('a[href=\"#signup\"]').on(\"click\", function(e) {\n\t\te.preventDefault();\n\n\t\t$(\"html, body\").animate({\n\t\t\tscrollTop: $(document).height()\n\t\t}, \"slow\");\t\n\t});\n\n\t$(window).on(\"resize\", onFooterResize);\n\n\tonFooterResize();\n}\n\n$(\".close-menu-overlay\").on(\"click\", function () {\n\t$(\".mobile-menu-overlay, #sidebar-wrapper\").removeClass(\"open\");\n});\n\n$(\".navbar-toggle\").on(\"click\", function () {\n\t$(\".mobile-menu-overlay, #sidebar-wrapper\").addClass(\"open\");\n});\n\n// http://stackoverflow.com/a/3369743\njQuery(document).on(\"keydown\", function(evt)\n{\n\tevt = evt || window.event;\n\n\tvar isEscape = false;\n\n\tif (\"key\" in evt) {\n\t\tisEscape = evt.key == \"Escape\";\n\t} else {\n\t\tisEscape = evt.keyCode == 27;\n\t}\n\n\tif (isEscape) {\n\t\t$(\".mobile-menu-overlay, #sidebar-wrapper, #signup-modal\").removeClass(\"open\");\n\t}\n});\n\nif( typeof Dragdealer !== \"undefined\" )\n{\n\tvar ddOptions = {\n\t\tspeed: 0.2,\n\t\tloose: true,\n\t \trequestAnimationFrame: true\n\t};\n\tvar dragDealers = {\n\t\tscreens: new Dragdealer('screen-type-cards', ddOptions),\n\t\tlayouts: new Dragdealer('layout-cards', ddOptions),\n\t\tstyles: new Dragdealer('visual-style-cards', ddOptions)\n\t};\n\n\tif( ! isTouchDevice ) {\n\t\tanimateDragdealerOnHover(dragDealers.screens);\n\t\tanimateDragdealerOnHover(dragDealers.layouts);\n\t\tanimateDragdealerOnHover(dragDealers.styles);\n\t}\n}\n\nfunction animateDragdealerOnHover( dealer ) {\n\tvar wrapper = dealer.wrapper;\n\tvar handle = dealer.handle;\n\n\tif( ! wrapper || ! handle ) {\n\t\treturn false;\n\t}\n\n\tvar wrapperDims = wrapper.getBoundingClientRect();\n\tvar handleDims = handle.getBoundingClientRect();\n\tvar hw = handleDims.width;\n\tvar ww = wrapperDims.width;\n\tvar center = hw/2 - ww/2;\n\tvar lastMove = Date.now();\n\tvar animationTriggerTime = 100; //ms\n\n\thandle.style.transform = \"translateX(-\" + center + \"px)\";\n\n\tfunction mouseMove () {\n\n\t\tif( Date.now() - lastMove < animationTriggerTime ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar x = this.pageX - wrapperDims.left;\n\t\tvar perc = x / ww;\n\t\tvar left = perc < 0.5;\n\n\t\tif( left ) {\n\t\t\tperc = 0.5 - perc;\n\t\t} else {\n\t\t\tperc = perc - 0.5;\n\t\t}\n\n\t\tperc = perc*2;\n\t\t\n\t\tvar pixDiff = center * Math.min(1.0, Math.asin(perc));\n\n\t\tif( left ) {\n\t\t\toffset = center - pixDiff;\n\t\t} else {\n\t\t\toffset = center + pixDiff;\n\t\t}\n\n\t\toffset = parseInt(offset, 10);\n\t\thandle.style.transform = \"translateX(-\" + offset + \"px)\";\n\n\t\tlastMove = Date.now();\n\t}\n\n\tfunction windowResize () {\n\t\twrapperDims = wrapper.getBoundingClientRect();\n\t\thandleDims = handle.getBoundingClientRect();\n\t\thw = handleDims.width;\n\t\tww = wrapperDims.width;\n\t\tcenter = hw/2 - ww/2;\n\t\thandle.style.transform = \"translateX(-\" + center + \"px)\";\n\t}\n\n\twindow.addEventListener(\"resize\", function(event) {\n\t\trequestAnimationFrame(windowResize);\n\t});\n\n\twrapper.addEventListener(\"mousemove\", function(event) {\n\t\trequestAnimationFrame(mouseMove.bind(event));\n\t});\n}\n\nfunction onFooterResize() {\n\n\tif( window.outerWidth <= 640 ) {\n\t\treturn;\n\t}\n\n\t// throttle\n\tsetTimeout(function() {\n\t\t$(\"#wrapper\").css({ marginBottom: ($(\".footer\").height() + $(\".pager\").outerHeight()) + \"px\" });\n\t}, 300);\n}\n"
  },
  {
    "path": "js/prism.js",
    "content": "/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+json+jsx&plugins=line-highlight */\nvar _self = (typeof window !== 'undefined')\n\t? window   // if in browser\n\t: (\n\t\t(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)\n\t\t? self // if in worker\n\t\t: {}   // if in node js\n\t);\n\n/**\n * Prism: Lightweight, robust, elegant syntax highlighting\n * MIT license http://www.opensource.org/licenses/mit-license.php/\n * @author Lea Verou http://lea.verou.me\n */\n\nvar Prism = (function(){\n\n// Private helper vars\nvar lang = /\\blang(?:uage)?-(\\w+)\\b/i;\nvar uniqueId = 0;\n\nvar _ = _self.Prism = {\n\tutil: {\n\t\tencode: function (tokens) {\n\t\t\tif (tokens instanceof Token) {\n\t\t\t\treturn new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);\n\t\t\t} else if (_.util.type(tokens) === 'Array') {\n\t\t\t\treturn tokens.map(_.util.encode);\n\t\t\t} else {\n\t\t\t\treturn tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\\u00a0/g, ' ');\n\t\t\t}\n\t\t},\n\n\t\ttype: function (o) {\n\t\t\treturn Object.prototype.toString.call(o).match(/\\[object (\\w+)\\]/)[1];\n\t\t},\n\n\t\tobjId: function (obj) {\n\t\t\tif (!obj['__id']) {\n\t\t\t\tObject.defineProperty(obj, '__id', { value: ++uniqueId });\n\t\t\t}\n\t\t\treturn obj['__id'];\n\t\t},\n\n\t\t// Deep clone a language definition (e.g. to extend it)\n\t\tclone: function (o) {\n\t\t\tvar type = _.util.type(o);\n\n\t\t\tswitch (type) {\n\t\t\t\tcase 'Object':\n\t\t\t\t\tvar clone = {};\n\n\t\t\t\t\tfor (var key in o) {\n\t\t\t\t\t\tif (o.hasOwnProperty(key)) {\n\t\t\t\t\t\t\tclone[key] = _.util.clone(o[key]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn clone;\n\n\t\t\t\tcase 'Array':\n\t\t\t\t\t// Check for existence for IE8\n\t\t\t\t\treturn o.map && o.map(function(v) { return _.util.clone(v); });\n\t\t\t}\n\n\t\t\treturn o;\n\t\t}\n\t},\n\n\tlanguages: {\n\t\textend: function (id, redef) {\n\t\t\tvar lang = _.util.clone(_.languages[id]);\n\n\t\t\tfor (var key in redef) {\n\t\t\t\tlang[key] = redef[key];\n\t\t\t}\n\n\t\t\treturn lang;\n\t\t},\n\n\t\t/**\n\t\t * Insert a token before another token in a language literal\n\t\t * As this needs to recreate the object (we cannot actually insert before keys in object literals),\n\t\t * we cannot just provide an object, we need anobject and a key.\n\t\t * @param inside The key (or language id) of the parent\n\t\t * @param before The key to insert before. If not provided, the function appends instead.\n\t\t * @param insert Object with the key/value pairs to insert\n\t\t * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.\n\t\t */\n\t\tinsertBefore: function (inside, before, insert, root) {\n\t\t\troot = root || _.languages;\n\t\t\tvar grammar = root[inside];\n\n\t\t\tif (arguments.length == 2) {\n\t\t\t\tinsert = arguments[1];\n\n\t\t\t\tfor (var newToken in insert) {\n\t\t\t\t\tif (insert.hasOwnProperty(newToken)) {\n\t\t\t\t\t\tgrammar[newToken] = insert[newToken];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn grammar;\n\t\t\t}\n\n\t\t\tvar ret = {};\n\n\t\t\tfor (var token in grammar) {\n\n\t\t\t\tif (grammar.hasOwnProperty(token)) {\n\n\t\t\t\t\tif (token == before) {\n\n\t\t\t\t\t\tfor (var newToken in insert) {\n\n\t\t\t\t\t\t\tif (insert.hasOwnProperty(newToken)) {\n\t\t\t\t\t\t\t\tret[newToken] = insert[newToken];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tret[token] = grammar[token];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update references in other language definitions\n\t\t\t_.languages.DFS(_.languages, function(key, value) {\n\t\t\t\tif (value === root[inside] && key != inside) {\n\t\t\t\t\tthis[key] = ret;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn root[inside] = ret;\n\t\t},\n\n\t\t// Traverse a language definition with Depth First Search\n\t\tDFS: function(o, callback, type, visited) {\n\t\t\tvisited = visited || {};\n\t\t\tfor (var i in o) {\n\t\t\t\tif (o.hasOwnProperty(i)) {\n\t\t\t\t\tcallback.call(o, i, o[i], type || i);\n\n\t\t\t\t\tif (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {\n\t\t\t\t\t\tvisited[_.util.objId(o[i])] = true;\n\t\t\t\t\t\t_.languages.DFS(o[i], callback, null, visited);\n\t\t\t\t\t}\n\t\t\t\t\telse if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {\n\t\t\t\t\t\tvisited[_.util.objId(o[i])] = true;\n\t\t\t\t\t\t_.languages.DFS(o[i], callback, i, visited);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tplugins: {},\n\n\thighlightAll: function(async, callback) {\n\t\tvar env = {\n\t\t\tcallback: callback,\n\t\t\tselector: 'code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code'\n\t\t};\n\n\t\t_.hooks.run(\"before-highlightall\", env);\n\n\t\tvar elements = env.elements || document.querySelectorAll(env.selector);\n\n\t\tfor (var i=0, element; element = elements[i++];) {\n\t\t\t_.highlightElement(element, async === true, env.callback);\n\t\t}\n\t},\n\n\thighlightElement: function(element, async, callback) {\n\t\t// Find language\n\t\tvar language, grammar, parent = element;\n\n\t\twhile (parent && !lang.test(parent.className)) {\n\t\t\tparent = parent.parentNode;\n\t\t}\n\n\t\tif (parent) {\n\t\t\tlanguage = (parent.className.match(lang) || [,''])[1].toLowerCase();\n\t\t\tgrammar = _.languages[language];\n\t\t}\n\n\t\t// Set language on the element, if not present\n\t\telement.className = element.className.replace(lang, '').replace(/\\s+/g, ' ') + ' language-' + language;\n\n\t\t// Set language on the parent, for styling\n\t\tparent = element.parentNode;\n\n\t\tif (/pre/i.test(parent.nodeName)) {\n\t\t\tparent.className = parent.className.replace(lang, '').replace(/\\s+/g, ' ') + ' language-' + language;\n\t\t}\n\n\t\tvar code = element.textContent;\n\n\t\tvar env = {\n\t\t\telement: element,\n\t\t\tlanguage: language,\n\t\t\tgrammar: grammar,\n\t\t\tcode: code\n\t\t};\n\n\t\t_.hooks.run('before-sanity-check', env);\n\n\t\tif (!env.code || !env.grammar) {\n\t\t\t_.hooks.run('complete', env);\n\t\t\treturn;\n\t\t}\n\n\t\t_.hooks.run('before-highlight', env);\n\n\t\tif (async && _self.Worker) {\n\t\t\tvar worker = new Worker(_.filename);\n\n\t\t\tworker.onmessage = function(evt) {\n\t\t\t\tenv.highlightedCode = evt.data;\n\n\t\t\t\t_.hooks.run('before-insert', env);\n\n\t\t\t\tenv.element.innerHTML = env.highlightedCode;\n\n\t\t\t\tcallback && callback.call(env.element);\n\t\t\t\t_.hooks.run('after-highlight', env);\n\t\t\t\t_.hooks.run('complete', env);\n\t\t\t};\n\n\t\t\tworker.postMessage(JSON.stringify({\n\t\t\t\tlanguage: env.language,\n\t\t\t\tcode: env.code,\n\t\t\t\timmediateClose: true\n\t\t\t}));\n\t\t}\n\t\telse {\n\t\t\tenv.highlightedCode = _.highlight(env.code, env.grammar, env.language);\n\n\t\t\t_.hooks.run('before-insert', env);\n\n\t\t\tenv.element.innerHTML = env.highlightedCode;\n\n\t\t\tcallback && callback.call(element);\n\n\t\t\t_.hooks.run('after-highlight', env);\n\t\t\t_.hooks.run('complete', env);\n\t\t}\n\t},\n\n\thighlight: function (text, grammar, language) {\n\t\tvar tokens = _.tokenize(text, grammar);\n\t\treturn Token.stringify(_.util.encode(tokens), language);\n\t},\n\n\ttokenize: function(text, grammar, language) {\n\t\tvar Token = _.Token;\n\n\t\tvar strarr = [text];\n\n\t\tvar rest = grammar.rest;\n\n\t\tif (rest) {\n\t\t\tfor (var token in rest) {\n\t\t\t\tgrammar[token] = rest[token];\n\t\t\t}\n\n\t\t\tdelete grammar.rest;\n\t\t}\n\n\t\ttokenloop: for (var token in grammar) {\n\t\t\tif(!grammar.hasOwnProperty(token) || !grammar[token]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar patterns = grammar[token];\n\t\t\tpatterns = (_.util.type(patterns) === \"Array\") ? patterns : [patterns];\n\n\t\t\tfor (var j = 0; j < patterns.length; ++j) {\n\t\t\t\tvar pattern = patterns[j],\n\t\t\t\t\tinside = pattern.inside,\n\t\t\t\t\tlookbehind = !!pattern.lookbehind,\n\t\t\t\t\tgreedy = !!pattern.greedy,\n\t\t\t\t\tlookbehindLength = 0,\n\t\t\t\t\talias = pattern.alias;\n\n\t\t\t\tif (greedy && !pattern.pattern.global) {\n\t\t\t\t\t// Without the global flag, lastIndex won't work\n\t\t\t\t\tvar flags = pattern.pattern.toString().match(/[imuy]*$/)[0];\n\t\t\t\t\tpattern.pattern = RegExp(pattern.pattern.source, flags + \"g\");\n\t\t\t\t}\n\n\t\t\t\tpattern = pattern.pattern || pattern;\n\n\t\t\t\t// Don’t cache length as it changes during the loop\n\t\t\t\tfor (var i=0, pos = 0; i<strarr.length; pos += (strarr[i].matchedStr || strarr[i]).length, ++i) {\n\n\t\t\t\t\tvar str = strarr[i];\n\n\t\t\t\t\tif (strarr.length > text.length) {\n\t\t\t\t\t\t// Something went terribly wrong, ABORT, ABORT!\n\t\t\t\t\t\tbreak tokenloop;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (str instanceof Token) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tpattern.lastIndex = 0;\n\n\t\t\t\t\tvar match = pattern.exec(str),\n\t\t\t\t\t    delNum = 1;\n\n\t\t\t\t\t// Greedy patterns can override/remove up to two previously matched tokens\n\t\t\t\t\tif (!match && greedy && i != strarr.length - 1) {\n\t\t\t\t\t\tpattern.lastIndex = pos;\n\t\t\t\t\t\tmatch = pattern.exec(text);\n\t\t\t\t\t\tif (!match) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar from = match.index + (lookbehind ? match[1].length : 0),\n\t\t\t\t\t\t    to = match.index + match[0].length,\n\t\t\t\t\t\t    k = i,\n\t\t\t\t\t\t    p = pos;\n\n\t\t\t\t\t\tfor (var len = strarr.length; k < len && p < to; ++k) {\n\t\t\t\t\t\t\tp += (strarr[k].matchedStr || strarr[k]).length;\n\t\t\t\t\t\t\t// Move the index i to the element in strarr that is closest to from\n\t\t\t\t\t\t\tif (from >= p) {\n\t\t\t\t\t\t\t\t++i;\n\t\t\t\t\t\t\t\tpos = p;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * If strarr[i] is a Token, then the match starts inside another Token, which is invalid\n\t\t\t\t\t\t * If strarr[k - 1] is greedy we are in conflict with another greedy pattern\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (strarr[i] instanceof Token || strarr[k - 1].greedy) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Number of tokens to delete and replace with the new match\n\t\t\t\t\t\tdelNum = k - i;\n\t\t\t\t\t\tstr = text.slice(pos, p);\n\t\t\t\t\t\tmatch.index -= pos;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!match) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(lookbehind) {\n\t\t\t\t\t\tlookbehindLength = match[1].length;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar from = match.index + lookbehindLength,\n\t\t\t\t\t    match = match[0].slice(lookbehindLength),\n\t\t\t\t\t    to = from + match.length,\n\t\t\t\t\t    before = str.slice(0, from),\n\t\t\t\t\t    after = str.slice(to);\n\n\t\t\t\t\tvar args = [i, delNum];\n\n\t\t\t\t\tif (before) {\n\t\t\t\t\t\targs.push(before);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);\n\n\t\t\t\t\targs.push(wrapped);\n\n\t\t\t\t\tif (after) {\n\t\t\t\t\t\targs.push(after);\n\t\t\t\t\t}\n\n\t\t\t\t\tArray.prototype.splice.apply(strarr, args);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn strarr;\n\t},\n\n\thooks: {\n\t\tall: {},\n\n\t\tadd: function (name, callback) {\n\t\t\tvar hooks = _.hooks.all;\n\n\t\t\thooks[name] = hooks[name] || [];\n\n\t\t\thooks[name].push(callback);\n\t\t},\n\n\t\trun: function (name, env) {\n\t\t\tvar callbacks = _.hooks.all[name];\n\n\t\t\tif (!callbacks || !callbacks.length) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (var i=0, callback; callback = callbacks[i++];) {\n\t\t\t\tcallback(env);\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar Token = _.Token = function(type, content, alias, matchedStr, greedy) {\n\tthis.type = type;\n\tthis.content = content;\n\tthis.alias = alias;\n\t// Copy of the full string this token was created from\n\tthis.matchedStr = matchedStr || null;\n\tthis.greedy = !!greedy;\n};\n\nToken.stringify = function(o, language, parent) {\n\tif (typeof o == 'string') {\n\t\treturn o;\n\t}\n\n\tif (_.util.type(o) === 'Array') {\n\t\treturn o.map(function(element) {\n\t\t\treturn Token.stringify(element, language, o);\n\t\t}).join('');\n\t}\n\n\tvar env = {\n\t\ttype: o.type,\n\t\tcontent: Token.stringify(o.content, language, parent),\n\t\ttag: 'span',\n\t\tclasses: ['token', o.type],\n\t\tattributes: {},\n\t\tlanguage: language,\n\t\tparent: parent\n\t};\n\n\tif (env.type == 'comment') {\n\t\tenv.attributes['spellcheck'] = 'true';\n\t}\n\n\tif (o.alias) {\n\t\tvar aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];\n\t\tArray.prototype.push.apply(env.classes, aliases);\n\t}\n\n\t_.hooks.run('wrap', env);\n\n\tvar attributes = '';\n\n\tfor (var name in env.attributes) {\n\t\tattributes += (attributes ? ' ' : '') + name + '=\"' + (env.attributes[name] || '') + '\"';\n\t}\n\n\treturn '<' + env.tag + ' class=\"' + env.classes.join(' ') + '\"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';\n\n};\n\nif (!_self.document) {\n\tif (!_self.addEventListener) {\n\t\t// in Node.js\n\t\treturn _self.Prism;\n\t}\n \t// In worker\n\t_self.addEventListener('message', function(evt) {\n\t\tvar message = JSON.parse(evt.data),\n\t\t    lang = message.language,\n\t\t    code = message.code,\n\t\t    immediateClose = message.immediateClose;\n\n\t\t_self.postMessage(_.highlight(code, _.languages[lang], lang));\n\t\tif (immediateClose) {\n\t\t\t_self.close();\n\t\t}\n\t}, false);\n\n\treturn _self.Prism;\n}\n\n//Get current script and highlight\nvar script = document.currentScript || [].slice.call(document.getElementsByTagName(\"script\")).pop();\n\nif (script) {\n\t_.filename = script.src;\n\n\tif (document.addEventListener && !script.hasAttribute('data-manual')) {\n\t\tif(document.readyState !== \"loading\") {\n\t\t\tif (window.requestAnimationFrame) {\n\t\t\t\twindow.requestAnimationFrame(_.highlightAll);\n\t\t\t} else {\n\t\t\t\twindow.setTimeout(_.highlightAll, 16);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tdocument.addEventListener('DOMContentLoaded', _.highlightAll);\n\t\t}\n\t}\n}\n\nreturn _self.Prism;\n\n})();\n\nif (typeof module !== 'undefined' && module.exports) {\n\tmodule.exports = Prism;\n}\n\n// hack for components to work correctly in node.js\nif (typeof global !== 'undefined') {\n\tglobal.Prism = Prism;\n}\n;\nPrism.languages.markup = {\n\t'comment': /<!--[\\w\\W]*?-->/,\n\t'prolog': /<\\?[\\w\\W]+?\\?>/,\n\t'doctype': /<!DOCTYPE[\\w\\W]+?>/i,\n\t'cdata': /<!\\[CDATA\\[[\\w\\W]*?]]>/i,\n\t'tag': {\n\t\tpattern: /<\\/?(?!\\d)[^\\s>\\/=$<]+(?:\\s+[^\\s>\\/=]+(?:=(?:(\"|')(?:\\\\\\1|\\\\?(?!\\1)[\\w\\W])*\\1|[^\\s'\">=]+))?)*\\s*\\/?>/i,\n\t\tinside: {\n\t\t\t'tag': {\n\t\t\t\tpattern: /^<\\/?[^\\s>\\/]+/i,\n\t\t\t\tinside: {\n\t\t\t\t\t'punctuation': /^<\\/?/,\n\t\t\t\t\t'namespace': /^[^\\s>\\/:]+:/\n\t\t\t\t}\n\t\t\t},\n\t\t\t'attr-value': {\n\t\t\t\tpattern: /=(?:('|\")[\\w\\W]*?(\\1)|[^\\s>]+)/i,\n\t\t\t\tinside: {\n\t\t\t\t\t'punctuation': /[=>\"']/\n\t\t\t\t}\n\t\t\t},\n\t\t\t'punctuation': /\\/?>/,\n\t\t\t'attr-name': {\n\t\t\t\tpattern: /[^\\s>\\/]+/,\n\t\t\t\tinside: {\n\t\t\t\t\t'namespace': /^[^\\s>\\/:]+:/\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t},\n\t'entity': /&#?[\\da-z]{1,8};/i\n};\n\n// Plugin to make entity title show the real entity, idea by Roman Komarov\nPrism.hooks.add('wrap', function(env) {\n\n\tif (env.type === 'entity') {\n\t\tenv.attributes['title'] = env.content.replace(/&amp;/, '&');\n\t}\n});\n\nPrism.languages.xml = Prism.languages.markup;\nPrism.languages.html = Prism.languages.markup;\nPrism.languages.mathml = Prism.languages.markup;\nPrism.languages.svg = Prism.languages.markup;\n\nPrism.languages.css = {\n\t'comment': /\\/\\*[\\w\\W]*?\\*\\//,\n\t'atrule': {\n\t\tpattern: /@[\\w-]+?.*?(;|(?=\\s*\\{))/i,\n\t\tinside: {\n\t\t\t'rule': /@[\\w-]+/\n\t\t\t// See rest below\n\t\t}\n\t},\n\t'url': /url\\((?:([\"'])(\\\\(?:\\r\\n|[\\w\\W])|(?!\\1)[^\\\\\\r\\n])*\\1|.*?)\\)/i,\n\t'selector': /[^\\{\\}\\s][^\\{\\};]*?(?=\\s*\\{)/,\n\t'string': /(\"|')(\\\\(?:\\r\\n|[\\w\\W])|(?!\\1)[^\\\\\\r\\n])*\\1/,\n\t'property': /(\\b|\\B)[\\w-]+(?=\\s*:)/i,\n\t'important': /\\B!important\\b/i,\n\t'function': /[-a-z0-9]+(?=\\()/i,\n\t'punctuation': /[(){};:]/\n};\n\nPrism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);\n\nif (Prism.languages.markup) {\n\tPrism.languages.insertBefore('markup', 'tag', {\n\t\t'style': {\n\t\t\tpattern: /(<style[\\w\\W]*?>)[\\w\\W]*?(?=<\\/style>)/i,\n\t\t\tlookbehind: true,\n\t\t\tinside: Prism.languages.css,\n\t\t\talias: 'language-css'\n\t\t}\n\t});\n\t\n\tPrism.languages.insertBefore('inside', 'attr-value', {\n\t\t'style-attr': {\n\t\t\tpattern: /\\s*style=(\"|').*?\\1/i,\n\t\t\tinside: {\n\t\t\t\t'attr-name': {\n\t\t\t\t\tpattern: /^\\s*style/i,\n\t\t\t\t\tinside: Prism.languages.markup.tag.inside\n\t\t\t\t},\n\t\t\t\t'punctuation': /^\\s*=\\s*['\"]|['\"]\\s*$/,\n\t\t\t\t'attr-value': {\n\t\t\t\t\tpattern: /.+/i,\n\t\t\t\t\tinside: Prism.languages.css\n\t\t\t\t}\n\t\t\t},\n\t\t\talias: 'language-css'\n\t\t}\n\t}, Prism.languages.markup.tag);\n};\nPrism.languages.clike = {\n\t'comment': [\n\t\t{\n\t\t\tpattern: /(^|[^\\\\])\\/\\*[\\w\\W]*?\\*\\//,\n\t\t\tlookbehind: true\n\t\t},\n\t\t{\n\t\t\tpattern: /(^|[^\\\\:])\\/\\/.*/,\n\t\t\tlookbehind: true\n\t\t}\n\t],\n\t'string': {\n\t\tpattern: /([\"'])(\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\\\r\\n])*\\1/,\n\t\tgreedy: true\n\t},\n\t'class-name': {\n\t\tpattern: /((?:\\b(?:class|interface|extends|implements|trait|instanceof|new)\\s+)|(?:catch\\s+\\())[a-z0-9_\\.\\\\]+/i,\n\t\tlookbehind: true,\n\t\tinside: {\n\t\t\tpunctuation: /(\\.|\\\\)/\n\t\t}\n\t},\n\t'keyword': /\\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\\b/,\n\t'boolean': /\\b(true|false)\\b/,\n\t'function': /[a-z0-9_]+(?=\\()/i,\n\t'number': /\\b-?(?:0x[\\da-f]+|\\d*\\.?\\d+(?:e[+-]?\\d+)?)\\b/i,\n\t'operator': /--?|\\+\\+?|!=?=?|<=?|>=?|==?=?|&&?|\\|\\|?|\\?|\\*|\\/|~|\\^|%/,\n\t'punctuation': /[{}[\\];(),.:]/\n};\n\nPrism.languages.javascript = Prism.languages.extend('clike', {\n\t'keyword': /\\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b/,\n\t'number': /\\b-?(0x[\\dA-Fa-f]+|0b[01]+|0o[0-7]+|\\d*\\.?\\d+([Ee][+-]?\\d+)?|NaN|Infinity)\\b/,\n\t// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)\n\t'function': /[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*(?=\\()/i,\n\t'operator': /--?|\\+\\+?|!=?=?|<=?|>=?|==?=?|&&?|\\|\\|?|\\?|\\*\\*?|\\/|~|\\^|%|\\.{3}/\n});\n\nPrism.languages.insertBefore('javascript', 'keyword', {\n\t'regex': {\n\t\tpattern: /(^|[^/])\\/(?!\\/)(\\[.+?]|\\\\.|[^/\\\\\\r\\n])+\\/[gimyu]{0,5}(?=\\s*($|[\\r\\n,.;})]))/,\n\t\tlookbehind: true,\n\t\tgreedy: true\n\t}\n});\n\nPrism.languages.insertBefore('javascript', 'string', {\n\t'template-string': {\n\t\tpattern: /`(?:\\\\\\\\|\\\\?[^\\\\])*?`/,\n\t\tgreedy: true,\n\t\tinside: {\n\t\t\t'interpolation': {\n\t\t\t\tpattern: /\\$\\{[^}]+\\}/,\n\t\t\t\tinside: {\n\t\t\t\t\t'interpolation-punctuation': {\n\t\t\t\t\t\tpattern: /^\\$\\{|\\}$/,\n\t\t\t\t\t\talias: 'punctuation'\n\t\t\t\t\t},\n\t\t\t\t\trest: Prism.languages.javascript\n\t\t\t\t}\n\t\t\t},\n\t\t\t'string': /[\\s\\S]+/\n\t\t}\n\t}\n});\n\nif (Prism.languages.markup) {\n\tPrism.languages.insertBefore('markup', 'tag', {\n\t\t'script': {\n\t\t\tpattern: /(<script[\\w\\W]*?>)[\\w\\W]*?(?=<\\/script>)/i,\n\t\t\tlookbehind: true,\n\t\t\tinside: Prism.languages.javascript,\n\t\t\talias: 'language-javascript'\n\t\t}\n\t});\n}\n\nPrism.languages.js = Prism.languages.javascript;\n(function(Prism) {\n\tvar insideString = {\n\t\tvariable: [\n\t\t\t// Arithmetic Environment\n\t\t\t{\n\t\t\t\tpattern: /\\$?\\(\\([\\w\\W]+?\\)\\)/,\n\t\t\t\tinside: {\n\t\t\t\t\t// If there is a $ sign at the beginning highlight $(( and )) as variable\n\t\t\t\t\tvariable: [{\n\t\t\t\t\t\t\tpattern: /(^\\$\\(\\([\\w\\W]+)\\)\\)/,\n\t\t\t\t\t\t\tlookbehind: true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t/^\\$\\(\\(/,\n\t\t\t\t\t],\n\t\t\t\t\tnumber: /\\b-?(?:0x[\\dA-Fa-f]+|\\d*\\.?\\d+(?:[Ee]-?\\d+)?)\\b/,\n\t\t\t\t\t// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic\n\t\t\t\t\toperator: /--?|-=|\\+\\+?|\\+=|!=?|~|\\*\\*?|\\*=|\\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\\^=?|\\|\\|?|\\|=|\\?|:/,\n\t\t\t\t\t// If there is no $ sign at the beginning highlight (( and )) as punctuation\n\t\t\t\t\tpunctuation: /\\(\\(?|\\)\\)?|,|;/\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Command Substitution\n\t\t\t{\n\t\t\t\tpattern: /\\$\\([^)]+\\)|`[^`]+`/,\n\t\t\t\tinside: {\n\t\t\t\t\tvariable: /^\\$\\(|^`|\\)$|`$/\n\t\t\t\t}\n\t\t\t},\n\t\t\t/\\$(?:[a-z0-9_#\\?\\*!@]+|\\{[^}]+\\})/i\n\t\t],\n\t};\n\n\tPrism.languages.bash = {\n\t\t'shebang': {\n\t\t\tpattern: /^#!\\s*\\/bin\\/bash|^#!\\s*\\/bin\\/sh/,\n\t\t\talias: 'important'\n\t\t},\n\t\t'comment': {\n\t\t\tpattern: /(^|[^\"{\\\\])#.*/,\n\t\t\tlookbehind: true\n\t\t},\n\t\t'string': [\n\t\t\t//Support for Here-Documents https://en.wikipedia.org/wiki/Here_document\n\t\t\t{\n\t\t\t\tpattern: /((?:^|[^<])<<\\s*)(?:\"|')?(\\w+?)(?:\"|')?\\s*\\r?\\n(?:[\\s\\S])*?\\r?\\n\\2/g,\n\t\t\t\tlookbehind: true,\n\t\t\t\tgreedy: true,\n\t\t\t\tinside: insideString\n\t\t\t},\n\t\t\t{\n\t\t\t\tpattern: /([\"'])(?:\\\\\\\\|\\\\?[^\\\\])*?\\1/g,\n\t\t\t\tgreedy: true,\n\t\t\t\tinside: insideString\n\t\t\t}\n\t\t],\n\t\t'variable': insideString.variable,\n\t\t// Originally based on http://ss64.com/bash/\n\t\t'function': {\n\t\t\tpattern: /(^|\\s|;|\\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\\s|;|\\||&)/,\n\t\t\tlookbehind: true\n\t\t},\n\t\t'keyword': {\n\t\t\tpattern: /(^|\\s|;|\\||&)(?:let|:|\\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\\s|;|\\||&)/,\n\t\t\tlookbehind: true\n\t\t},\n\t\t'boolean': {\n\t\t\tpattern: /(^|\\s|;|\\||&)(?:true|false)(?=$|\\s|;|\\||&)/,\n\t\t\tlookbehind: true\n\t\t},\n\t\t'operator': /&&?|\\|\\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,\n\t\t'punctuation': /\\$?\\(\\(?|\\)\\)?|\\.\\.|[{}[\\];]/\n\t};\n\n\tvar inside = insideString.variable[1].inside;\n\tinside['function'] = Prism.languages.bash['function'];\n\tinside.keyword = Prism.languages.bash.keyword;\n\tinside.boolean = Prism.languages.bash.boolean;\n\tinside.operator = Prism.languages.bash.operator;\n\tinside.punctuation = Prism.languages.bash.punctuation;\n})(Prism);\n\nPrism.languages.json = {\n    'property': /\".*?\"(?=\\s*:)/ig,\n    'string': /\"(?!:)(\\\\?[^\"])*?\"(?!:)/g,\n    'number': /\\b-?(0x[\\dA-Fa-f]+|\\d*\\.?\\d+([Ee]-?\\d+)?)\\b/g,\n    'punctuation': /[{}[\\]);,]/g,\n    'operator': /:/g,\n    'boolean': /\\b(true|false)\\b/gi,\n    'null': /\\bnull\\b/gi,\n};\n\nPrism.languages.jsonp = Prism.languages.json;\n\n(function(Prism) {\n\nvar javascript = Prism.util.clone(Prism.languages.javascript);\n\nPrism.languages.jsx = Prism.languages.extend('markup', javascript);\nPrism.languages.jsx.tag.pattern= /<\\/?[\\w\\.:-]+\\s*(?:\\s+[\\w\\.:-]+(?:=(?:(\"|')(\\\\?[\\w\\W])*?\\1|[^\\s'\">=]+|(\\{[\\w\\W]*?\\})))?\\s*)*\\/?>/i;\n\nPrism.languages.jsx.tag.inside['attr-value'].pattern = /=[^\\{](?:('|\")[\\w\\W]*?(\\1)|[^\\s>]+)/i;\n\nvar jsxExpression = Prism.util.clone(Prism.languages.jsx);\n\ndelete jsxExpression.punctuation\n\njsxExpression = Prism.languages.insertBefore('jsx', 'operator', {\n  'punctuation': /=(?={)|[{}[\\];(),.:]/\n}, { jsx: jsxExpression });\n\nPrism.languages.insertBefore('inside', 'attr-value',{\n\t'script': {\n\t\t// Allow for one level of nesting\n\t\tpattern: /=(\\{(?:\\{[^}]*\\}|[^}])+\\})/i,\n\t\tinside: jsxExpression,\n\t\t'alias': 'language-javascript'\n\t}\n}, Prism.languages.jsx.tag);\n\n}(Prism));\n\n(function(){\n\nif (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {\n\treturn;\n}\n\nfunction $$(expr, con) {\n\treturn Array.prototype.slice.call((con || document).querySelectorAll(expr));\n}\n\nfunction hasClass(element, className) {\n  className = \" \" + className + \" \";\n  return (\" \" + element.className + \" \").replace(/[\\n\\t]/g, \" \").indexOf(className) > -1\n}\n\n// Some browsers round the line-height, others don't.\n// We need to test for it to position the elements properly.\nvar isLineHeightRounded = (function() {\n\tvar res;\n\treturn function() {\n\t\tif(typeof res === 'undefined') {\n\t\t\tvar d = document.createElement('div');\n\t\t\td.style.fontSize = '13px';\n\t\t\td.style.lineHeight = '1.5';\n\t\t\td.style.padding = 0;\n\t\t\td.style.border = 0;\n\t\t\td.innerHTML = '&nbsp;<br />&nbsp;';\n\t\t\tdocument.body.appendChild(d);\n\t\t\t// Browsers that round the line-height should have offsetHeight === 38\n\t\t\t// The others should have 39.\n\t\t\tres = d.offsetHeight === 38;\n\t\t\tdocument.body.removeChild(d);\n\t\t}\n\t\treturn res;\n\t}\n}());\n\nfunction highlightLines(pre, lines, classes) {\n\tvar ranges = lines.replace(/\\s+/g, '').split(','),\n\t    offset = +pre.getAttribute('data-line-offset') || 0;\n\n\tvar parseMethod = isLineHeightRounded() ? parseInt : parseFloat;\n\tvar lineHeight = parseMethod(getComputedStyle(pre).lineHeight);\n\n\tfor (var i=0, range; range = ranges[i++];) {\n\t\trange = range.split('-');\n\t\t\t\t\t\n\t\tvar start = +range[0],\n\t\t    end = +range[1] || start;\n\t\t\n\t\tvar line = document.createElement('div');\n\t\t\n\t\tline.textContent = Array(end - start + 2).join(' \\n');\n\t\tline.setAttribute('aria-hidden', 'true');\n\t\tline.className = (classes || '') + ' line-highlight';\n\n\t\t//if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers\n\t\tif(!hasClass(pre, 'line-numbers')) {\n\t\t\tline.setAttribute('data-start', start);\n\n\t\t\tif(end > start) {\n\t\t\t\tline.setAttribute('data-end', end);\n\t\t\t}\n\t\t}\n\n\t\tline.style.top = (start - offset - 1) * lineHeight + 'px';\n\n\t\t//allow this to play nicely with the line-numbers plugin\n\t\tif(hasClass(pre, 'line-numbers')) {\n\t\t\t//need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning\n\t\t\tpre.appendChild(line);\n\t\t} else {\n\t\t\t(pre.querySelector('code') || pre).appendChild(line);\n\t\t}\n\t}\n}\n\nfunction applyHash() {\n\tvar hash = location.hash.slice(1);\n\t\n\t// Remove pre-existing temporary lines\n\t$$('.temporary.line-highlight').forEach(function (line) {\n\t\tline.parentNode.removeChild(line);\n\t});\n\t\n\tvar range = (hash.match(/\\.([\\d,-]+)$/) || [,''])[1];\n\t\n\tif (!range || document.getElementById(hash)) {\n\t\treturn;\n\t}\n\t\n\tvar id = hash.slice(0, hash.lastIndexOf('.')),\n\t    pre = document.getElementById(id);\n\n\tif (!pre) {\n\t\treturn;\n\t}\n\t\n\tif (!pre.hasAttribute('data-line')) {\n\t\tpre.setAttribute('data-line', '');\n\t}\n\n\thighlightLines(pre, range, 'temporary ');\n\n\tdocument.querySelector('.temporary.line-highlight').scrollIntoView();\n}\n\nvar fakeTimer = 0; // Hack to limit the number of times applyHash() runs\n\nPrism.hooks.add('complete', function(env) {\n\tvar pre = env.element.parentNode;\n\tvar lines = pre && pre.getAttribute('data-line');\n\t\n\tif (!pre || !lines || !/pre/i.test(pre.nodeName)) {\n\t\treturn;\n\t}\n\t\n\tclearTimeout(fakeTimer);\n\t\n\t$$('.line-highlight', pre).forEach(function (line) {\n\t\tline.parentNode.removeChild(line);\n\t});\n\t\n\thighlightLines(pre, lines);\n\t\n\tfakeTimer = setTimeout(applyHash, 1);\n});\n\nif(window.addEventListener) {\n\twindow.addEventListener('hashchange', applyHash);\n}\n\n})();\n\n"
  },
  {
    "path": "lib/codemirror/codemirror.css",
    "content": "/* BASICS */\n\n.CodeMirror {\n  /* Set height, width, borders, and global font properties here */\n  font-family: monospace;\n  height: 300px;\n  color: black;\n}\n\n/* PADDING */\n\n.CodeMirror-lines {\n  padding: 4px 0; /* Vertical padding around content */\n}\n.CodeMirror pre {\n  padding: 0 4px; /* Horizontal padding of content */\n}\n\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n  background-color: white; /* The little square between H and V scrollbars */\n}\n\n/* GUTTER */\n\n.CodeMirror-gutters {\n  border-right: 1px solid #ddd;\n  background-color: #f7f7f7;\n  white-space: nowrap;\n}\n.CodeMirror-linenumbers {}\n.CodeMirror-linenumber {\n  padding: 0 3px 0 5px;\n  min-width: 20px;\n  text-align: right;\n  color: #999;\n  white-space: nowrap;\n}\n\n.CodeMirror-guttermarker { color: black; }\n.CodeMirror-guttermarker-subtle { color: #999; }\n\n/* CURSOR */\n\n.CodeMirror-cursor {\n  border-left: 1px solid black;\n  border-right: none;\n  width: 0;\n}\n/* Shown when moving in bi-directional text */\n.CodeMirror div.CodeMirror-secondarycursor {\n  border-left: 1px solid silver;\n}\n.cm-fat-cursor .CodeMirror-cursor {\n  width: auto;\n  border: 0 !important;\n  background: #7e7;\n}\n.cm-fat-cursor div.CodeMirror-cursors {\n  z-index: 1;\n}\n\n.cm-animate-fat-cursor {\n  width: auto;\n  border: 0;\n  -webkit-animation: blink 1.06s steps(1) infinite;\n  -moz-animation: blink 1.06s steps(1) infinite;\n  animation: blink 1.06s steps(1) infinite;\n  background-color: #7e7;\n}\n@-moz-keyframes blink {\n  0% {}\n  50% { background-color: transparent; }\n  100% {}\n}\n@-webkit-keyframes blink {\n  0% {}\n  50% { background-color: transparent; }\n  100% {}\n}\n@keyframes blink {\n  0% {}\n  50% { background-color: transparent; }\n  100% {}\n}\n\n/* Can style cursor different in overwrite (non-insert) mode */\n.CodeMirror-overwrite .CodeMirror-cursor {}\n\n.cm-tab { display: inline-block; text-decoration: inherit; }\n\n.CodeMirror-ruler {\n  border-left: 1px solid #ccc;\n  position: absolute;\n}\n\n/* DEFAULT THEME */\n\n.cm-s-default .cm-header {color: blue;}\n.cm-s-default .cm-quote {color: #090;}\n.cm-negative {color: #d44;}\n.cm-positive {color: #292;}\n.cm-header, .cm-strong {font-weight: bold;}\n.cm-em {font-style: italic;}\n.cm-link {text-decoration: underline;}\n.cm-strikethrough {text-decoration: line-through;}\n\n.cm-s-default .cm-keyword {color: #708;}\n.cm-s-default .cm-atom {color: #219;}\n.cm-s-default .cm-number {color: #164;}\n.cm-s-default .cm-def {color: #00f;}\n.cm-s-default .cm-variable,\n.cm-s-default .cm-punctuation,\n.cm-s-default .cm-property,\n.cm-s-default .cm-operator {}\n.cm-s-default .cm-variable-2 {color: #05a;}\n.cm-s-default .cm-variable-3 {color: #085;}\n.cm-s-default .cm-comment {color: #a50;}\n.cm-s-default .cm-string {color: #a11;}\n.cm-s-default .cm-string-2 {color: #f50;}\n.cm-s-default .cm-meta {color: #555;}\n.cm-s-default .cm-qualifier {color: #555;}\n.cm-s-default .cm-builtin {color: #30a;}\n.cm-s-default .cm-bracket {color: #997;}\n.cm-s-default .cm-tag {color: #170;}\n.cm-s-default .cm-attribute {color: #00c;}\n.cm-s-default .cm-hr {color: #999;}\n.cm-s-default .cm-link {color: #00c;}\n\n.cm-s-default .cm-error {color: #f00;}\n.cm-invalidchar {color: #f00;}\n\n.CodeMirror-composing { border-bottom: 2px solid; }\n\n/* Default styles for common addons */\n\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\n.CodeMirror-activeline-background {background: #e8f2ff;}\n\n/* STOP */\n\n/* The rest of this file contains styles related to the mechanics of\n   the editor. You probably shouldn't touch them. */\n\n.CodeMirror {\n  position: relative;\n  overflow: hidden;\n  background: white;\n}\n\n.CodeMirror-scroll {\n  overflow: scroll !important; /* Things will break if this is overridden */\n  /* 30px is the magic margin used to hide the element's real scrollbars */\n  /* See overflow: hidden in .CodeMirror */\n  margin-bottom: -30px; margin-right: -30px;\n  padding-bottom: 30px;\n  height: 100%;\n  outline: none; /* Prevent dragging from highlighting the element */\n  position: relative;\n}\n.CodeMirror-sizer {\n  position: relative;\n  border-right: 30px solid transparent;\n}\n\n/* The fake, visible scrollbars. Used to force redraw during scrolling\n   before actual scrolling happens, thus preventing shaking and\n   flickering artifacts. */\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n  position: absolute;\n  z-index: 6;\n  display: none;\n}\n.CodeMirror-vscrollbar {\n  right: 0; top: 0;\n  overflow-x: hidden;\n  overflow-y: scroll;\n}\n.CodeMirror-hscrollbar {\n  bottom: 0; left: 0;\n  overflow-y: hidden;\n  overflow-x: scroll;\n}\n.CodeMirror-scrollbar-filler {\n  right: 0; bottom: 0;\n}\n.CodeMirror-gutter-filler {\n  left: 0; bottom: 0;\n}\n\n.CodeMirror-gutters {\n  position: absolute; left: 0; top: 0;\n  min-height: 100%;\n  z-index: 3;\n}\n.CodeMirror-gutter {\n  white-space: normal;\n  height: 100%;\n  display: inline-block;\n  vertical-align: top;\n  margin-bottom: -30px;\n  /* Hack to make IE7 behave */\n  *zoom:1;\n  *display:inline;\n}\n.CodeMirror-gutter-wrapper {\n  position: absolute;\n  z-index: 4;\n  background: none !important;\n  border: none !important;\n}\n.CodeMirror-gutter-background {\n  position: absolute;\n  top: 0; bottom: 0;\n  z-index: 4;\n}\n.CodeMirror-gutter-elt {\n  position: absolute;\n  cursor: default;\n  z-index: 4;\n}\n.CodeMirror-gutter-wrapper {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  user-select: none;\n}\n\n.CodeMirror-lines {\n  cursor: text;\n  min-height: 1px; /* prevents collapsing before first draw */\n}\n.CodeMirror pre {\n  /* Reset some styles that the rest of the page might have set */\n  -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\n  border-width: 0;\n  background: transparent;\n  font-family: inherit;\n  font-size: inherit;\n  margin: 0;\n  white-space: pre;\n  word-wrap: normal;\n  line-height: inherit;\n  color: inherit;\n  z-index: 2;\n  position: relative;\n  overflow: visible;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-font-variant-ligatures: none;\n  font-variant-ligatures: none;\n}\n.CodeMirror-wrap pre {\n  word-wrap: break-word;\n  white-space: pre-wrap;\n  word-break: normal;\n}\n\n.CodeMirror-linebackground {\n  position: absolute;\n  left: 0; right: 0; top: 0; bottom: 0;\n  z-index: 0;\n}\n\n.CodeMirror-linewidget {\n  position: relative;\n  z-index: 2;\n  overflow: auto;\n}\n\n.CodeMirror-widget {}\n\n.CodeMirror-code {\n  outline: none;\n}\n\n/* Force content-box sizing for the elements where we expect it */\n.CodeMirror-scroll,\n.CodeMirror-sizer,\n.CodeMirror-gutter,\n.CodeMirror-gutters,\n.CodeMirror-linenumber {\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n}\n\n.CodeMirror-measure {\n  position: absolute;\n  width: 100%;\n  height: 0;\n  overflow: hidden;\n  visibility: hidden;\n}\n\n.CodeMirror-cursor { position: absolute; }\n.CodeMirror-measure pre { position: static; }\n\ndiv.CodeMirror-cursors {\n  visibility: hidden;\n  position: relative;\n  z-index: 3;\n}\ndiv.CodeMirror-dragcursors {\n  visibility: visible;\n}\n\n.CodeMirror-focused div.CodeMirror-cursors {\n  visibility: visible;\n}\n\n.CodeMirror-selected { background: #d9d9d9; }\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\n.CodeMirror-crosshair { cursor: crosshair; }\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\n\n.cm-searching {\n  background: #ffa;\n  background: rgba(255, 255, 0, .4);\n}\n\n/* IE7 hack to prevent it from returning funny offsetTops on the spans */\n.CodeMirror span { *vertical-align: text-bottom; }\n\n/* Used to force a border model for a node */\n.cm-force-border { padding-right: .1px; }\n\n@media print {\n  /* Hide the cursor when printing */\n  .CodeMirror div.CodeMirror-cursors {\n    visibility: hidden;\n  }\n}\n\n/* See issue #2901 */\n.cm-tab-wrap-hack:after { content: ''; }\n\n/* Help users use markselection to safely style text background */\nspan.CodeMirror-selectedtext { background: none; }\n"
  },
  {
    "path": "lib/codemirror/codemirror.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// This is CodeMirror (http://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function(mod) {\n  if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n    module.exports = mod();\n  else if (typeof define == \"function\" && define.amd) // AMD\n    return define([], mod);\n  else // Plain browser env\n    (this || window).CodeMirror = mod();\n})(function() {\n  \"use strict\";\n\n  // BROWSER SNIFFING\n\n  // Kludges for bugs and behavior differences that can't be feature\n  // detected are enabled based on userAgent etc sniffing.\n  var userAgent = navigator.userAgent;\n  var platform = navigator.platform;\n\n  var gecko = /gecko\\/\\d/i.test(userAgent);\n  var ie_upto10 = /MSIE \\d/.test(userAgent);\n  var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n  var ie = ie_upto10 || ie_11up;\n  var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);\n  var webkit = /WebKit\\//.test(userAgent);\n  var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n  var chrome = /Chrome\\//.test(userAgent);\n  var presto = /Opera\\//.test(userAgent);\n  var safari = /Apple Computer/.test(navigator.vendor);\n  var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n  var phantom = /PhantomJS/.test(userAgent);\n\n  var ios = /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\n  // This is woefully incomplete. Suggestions for alternative methods welcome.\n  var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n  var mac = ios || /Mac/.test(platform);\n  var chromeOS = /\\bCrOS\\b/.test(userAgent);\n  var windows = /win/i.test(platform);\n\n  var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n  if (presto_version) presto_version = Number(presto_version[1]);\n  if (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n  // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n  var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n  var captureRightClick = gecko || (ie && ie_version >= 9);\n\n  // Optimize some code when these features are not used.\n  var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n  // EDITOR CONSTRUCTOR\n\n  // A CodeMirror instance represents an editor. This is the object\n  // that user code is usually dealing with.\n\n  function CodeMirror(place, options) {\n    if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n    this.options = options = options ? copyObj(options) : {};\n    // Determine effective options based on given values and defaults.\n    copyObj(defaults, options, false);\n    setGuttersForLineNumbers(options);\n\n    var doc = options.value;\n    if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n    this.doc = doc;\n\n    var input = new CodeMirror.inputStyles[options.inputStyle](this);\n    var display = this.display = new Display(place, doc, input);\n    display.wrapper.CodeMirror = this;\n    updateGutters(this);\n    themeChanged(this);\n    if (options.lineWrapping)\n      this.display.wrapper.className += \" CodeMirror-wrap\";\n    if (options.autofocus && !mobile) display.input.focus();\n    initScrollbars(this);\n\n    this.state = {\n      keyMaps: [],  // stores maps added by addKeyMap\n      overlays: [], // highlighting overlays, as added by addOverlay\n      modeGen: 0,   // bumped when mode/overlay changes, used to invalidate highlighting info\n      overwrite: false,\n      delayingBlurEvent: false,\n      focused: false,\n      suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n      pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n      selectingText: false,\n      draggingText: false,\n      highlight: new Delayed(), // stores highlight worker timeout\n      keySeq: null,  // Unfinished key sequence\n      specialChars: null\n    };\n\n    var cm = this;\n\n    // Override magic textarea content restore that IE sometimes does\n    // on our hidden textarea on reload\n    if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n    registerEventHandlers(this);\n    ensureGlobalHandlers();\n\n    startOperation(this);\n    this.curOp.forceUpdate = true;\n    attachDoc(this, doc);\n\n    if ((options.autofocus && !mobile) || cm.hasFocus())\n      setTimeout(bind(onFocus, this), 20);\n    else\n      onBlur(this);\n\n    for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n      optionHandlers[opt](this, options[opt], Init);\n    maybeUpdateLineNumberWidth(this);\n    if (options.finishInit) options.finishInit(this);\n    for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n    endOperation(this);\n    // Suppress optimizelegibility in Webkit, since it breaks text\n    // measuring on line wrapping boundaries.\n    if (webkit && options.lineWrapping &&\n        getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n      display.lineDiv.style.textRendering = \"auto\";\n  }\n\n  // DISPLAY CONSTRUCTOR\n\n  // The display handles the DOM integration, both for input reading\n  // and content drawing. It holds references to DOM nodes and\n  // display-related state.\n\n  function Display(place, doc, input) {\n    var d = this;\n    this.input = input;\n\n    // Covers bottom-right square when both scrollbars are present.\n    d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n    d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n    // Covers bottom of gutter when coverGutterNextToScrollbar is on\n    // and h scrollbar is present.\n    d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n    d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n    // Will contain the actual code, positioned to cover the viewport.\n    d.lineDiv = elt(\"div\", null, \"CodeMirror-code\");\n    // Elements are added to these to represent selection and cursors.\n    d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n    d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n    // A visibility: hidden element used to find the size of things.\n    d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n    // When lines outside of the viewport are measured, they are drawn in this.\n    d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n    // Wraps everything that needs to exist inside the vertically-padded coordinate system\n    d.lineSpace = elt(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n                      null, \"position: relative; outline: none\");\n    // Moved around its parent to cover visible view.\n    d.mover = elt(\"div\", [elt(\"div\", [d.lineSpace], \"CodeMirror-lines\")], null, \"position: relative\");\n    // Set to the height of the document, allowing scrolling.\n    d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n    d.sizerWidth = null;\n    // Behavior of elts with overflow: auto and padding is\n    // inconsistent across browsers. This is used to ensure the\n    // scrollable area is big enough.\n    d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n    // Will contain the gutters, if any.\n    d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n    d.lineGutter = null;\n    // Actual scrollable element.\n    d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n    d.scroller.setAttribute(\"tabIndex\", \"-1\");\n    // The element in which the editor lives.\n    d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n    // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n    if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n    if (!webkit && !(gecko && mobile)) d.scroller.draggable = true;\n\n    if (place) {\n      if (place.appendChild) place.appendChild(d.wrapper);\n      else place(d.wrapper);\n    }\n\n    // Current rendered range (may be bigger than the view window).\n    d.viewFrom = d.viewTo = doc.first;\n    d.reportedViewFrom = d.reportedViewTo = doc.first;\n    // Information about the rendered lines.\n    d.view = [];\n    d.renderedView = null;\n    // Holds info about a single rendered line when it was rendered\n    // for measurement, while not in view.\n    d.externalMeasured = null;\n    // Empty space (in pixels) above the view\n    d.viewOffset = 0;\n    d.lastWrapHeight = d.lastWrapWidth = 0;\n    d.updateLineNumbers = null;\n\n    d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n    d.scrollbarsClipped = false;\n\n    // Used to only resize the line number gutter when necessary (when\n    // the amount of lines crosses a boundary that makes its width change)\n    d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n    // Set to true when a non-horizontal-scrolling line widget is\n    // added. As an optimization, line widget aligning is skipped when\n    // this is false.\n    d.alignWidgets = false;\n\n    d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n    // Tracks the maximum line length so that the horizontal scrollbar\n    // can be kept static when scrolling.\n    d.maxLine = null;\n    d.maxLineLength = 0;\n    d.maxLineChanged = false;\n\n    // Used for measuring wheel scrolling granularity\n    d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n    // True when shift is held down.\n    d.shift = false;\n\n    // Used to track whether anything happened since the context menu\n    // was opened.\n    d.selForContextMenu = null;\n\n    d.activeTouch = null;\n\n    input.init(d);\n  }\n\n  // STATE UPDATES\n\n  // Used to get the editor into a consistent state again when options change.\n\n  function loadMode(cm) {\n    cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);\n    resetModeState(cm);\n  }\n\n  function resetModeState(cm) {\n    cm.doc.iter(function(line) {\n      if (line.stateAfter) line.stateAfter = null;\n      if (line.styles) line.styles = null;\n    });\n    cm.doc.frontier = cm.doc.first;\n    startWorker(cm, 100);\n    cm.state.modeGen++;\n    if (cm.curOp) regChange(cm);\n  }\n\n  function wrappingChanged(cm) {\n    if (cm.options.lineWrapping) {\n      addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n      cm.display.sizer.style.minWidth = \"\";\n      cm.display.sizerWidth = null;\n    } else {\n      rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n      findMaxLine(cm);\n    }\n    estimateLineHeights(cm);\n    regChange(cm);\n    clearCaches(cm);\n    setTimeout(function(){updateScrollbars(cm);}, 100);\n  }\n\n  // Returns a function that estimates the height of a line, to use as\n  // first approximation until the line becomes visible (and is thus\n  // properly measurable).\n  function estimateHeight(cm) {\n    var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n    var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n    return function(line) {\n      if (lineIsHidden(cm.doc, line)) return 0;\n\n      var widgetsHeight = 0;\n      if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n        if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n      }\n\n      if (wrapping)\n        return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n      else\n        return widgetsHeight + th;\n    };\n  }\n\n  function estimateLineHeights(cm) {\n    var doc = cm.doc, est = estimateHeight(cm);\n    doc.iter(function(line) {\n      var estHeight = est(line);\n      if (estHeight != line.height) updateLineHeight(line, estHeight);\n    });\n  }\n\n  function themeChanged(cm) {\n    cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n      cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n    clearCaches(cm);\n  }\n\n  function guttersChanged(cm) {\n    updateGutters(cm);\n    regChange(cm);\n    setTimeout(function(){alignHorizontally(cm);}, 20);\n  }\n\n  // Rebuild the gutter elements, ensure the margin to the left of the\n  // code matches their width.\n  function updateGutters(cm) {\n    var gutters = cm.display.gutters, specs = cm.options.gutters;\n    removeChildren(gutters);\n    for (var i = 0; i < specs.length; ++i) {\n      var gutterClass = specs[i];\n      var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n      if (gutterClass == \"CodeMirror-linenumbers\") {\n        cm.display.lineGutter = gElt;\n        gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n      }\n    }\n    gutters.style.display = i ? \"\" : \"none\";\n    updateGutterSpace(cm);\n  }\n\n  function updateGutterSpace(cm) {\n    var width = cm.display.gutters.offsetWidth;\n    cm.display.sizer.style.marginLeft = width + \"px\";\n  }\n\n  // Compute the character length of a line, taking into account\n  // collapsed ranges (see markText) that might hide parts, and join\n  // other lines onto it.\n  function lineLength(line) {\n    if (line.height == 0) return 0;\n    var len = line.text.length, merged, cur = line;\n    while (merged = collapsedSpanAtStart(cur)) {\n      var found = merged.find(0, true);\n      cur = found.from.line;\n      len += found.from.ch - found.to.ch;\n    }\n    cur = line;\n    while (merged = collapsedSpanAtEnd(cur)) {\n      var found = merged.find(0, true);\n      len -= cur.text.length - found.from.ch;\n      cur = found.to.line;\n      len += cur.text.length - found.to.ch;\n    }\n    return len;\n  }\n\n  // Find the longest line in the document.\n  function findMaxLine(cm) {\n    var d = cm.display, doc = cm.doc;\n    d.maxLine = getLine(doc, doc.first);\n    d.maxLineLength = lineLength(d.maxLine);\n    d.maxLineChanged = true;\n    doc.iter(function(line) {\n      var len = lineLength(line);\n      if (len > d.maxLineLength) {\n        d.maxLineLength = len;\n        d.maxLine = line;\n      }\n    });\n  }\n\n  // Make sure the gutters options contains the element\n  // \"CodeMirror-linenumbers\" when the lineNumbers option is true.\n  function setGuttersForLineNumbers(options) {\n    var found = indexOf(options.gutters, \"CodeMirror-linenumbers\");\n    if (found == -1 && options.lineNumbers) {\n      options.gutters = options.gutters.concat([\"CodeMirror-linenumbers\"]);\n    } else if (found > -1 && !options.lineNumbers) {\n      options.gutters = options.gutters.slice(0);\n      options.gutters.splice(found, 1);\n    }\n  }\n\n  // SCROLLBARS\n\n  // Prepare DOM reads needed to update the scrollbars. Done in one\n  // shot to minimize update/measure roundtrips.\n  function measureForScrollbars(cm) {\n    var d = cm.display, gutterW = d.gutters.offsetWidth;\n    var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n    return {\n      clientHeight: d.scroller.clientHeight,\n      viewHeight: d.wrapper.clientHeight,\n      scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n      viewWidth: d.wrapper.clientWidth,\n      barLeft: cm.options.fixedGutter ? gutterW : 0,\n      docHeight: docH,\n      scrollHeight: docH + scrollGap(cm) + d.barHeight,\n      nativeBarWidth: d.nativeBarWidth,\n      gutterWidth: gutterW\n    };\n  }\n\n  function NativeScrollbars(place, scroll, cm) {\n    this.cm = cm;\n    var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n    var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n    place(vert); place(horiz);\n\n    on(vert, \"scroll\", function() {\n      if (vert.clientHeight) scroll(vert.scrollTop, \"vertical\");\n    });\n    on(horiz, \"scroll\", function() {\n      if (horiz.clientWidth) scroll(horiz.scrollLeft, \"horizontal\");\n    });\n\n    this.checkedZeroWidth = false;\n    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n    if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\";\n  }\n\n  NativeScrollbars.prototype = copyObj({\n    update: function(measure) {\n      var needsH = measure.scrollWidth > measure.clientWidth + 1;\n      var needsV = measure.scrollHeight > measure.clientHeight + 1;\n      var sWidth = measure.nativeBarWidth;\n\n      if (needsV) {\n        this.vert.style.display = \"block\";\n        this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n        var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n        // A bug in IE8 can cause this value to be negative, so guard it.\n        this.vert.firstChild.style.height =\n          Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n      } else {\n        this.vert.style.display = \"\";\n        this.vert.firstChild.style.height = \"0\";\n      }\n\n      if (needsH) {\n        this.horiz.style.display = \"block\";\n        this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n        this.horiz.style.left = measure.barLeft + \"px\";\n        var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n        this.horiz.firstChild.style.width =\n          (measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n      } else {\n        this.horiz.style.display = \"\";\n        this.horiz.firstChild.style.width = \"0\";\n      }\n\n      if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n        if (sWidth == 0) this.zeroWidthHack();\n        this.checkedZeroWidth = true;\n      }\n\n      return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};\n    },\n    setScrollLeft: function(pos) {\n      if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;\n      if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);\n    },\n    setScrollTop: function(pos) {\n      if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;\n      if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);\n    },\n    zeroWidthHack: function() {\n      var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n      this.horiz.style.height = this.vert.style.width = w;\n      this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n      this.disableHoriz = new Delayed;\n      this.disableVert = new Delayed;\n    },\n    enableZeroWidthBar: function(bar, delay) {\n      bar.style.pointerEvents = \"auto\";\n      function maybeDisable() {\n        // To find out whether the scrollbar is still visible, we\n        // check whether the element under the pixel in the bottom\n        // left corner of the scrollbar box is the scrollbar box\n        // itself (when the bar is still visible) or its filler child\n        // (when the bar is hidden). If it is still visible, we keep\n        // it enabled, if it's hidden, we disable pointer events.\n        var box = bar.getBoundingClientRect();\n        var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);\n        if (elt != bar) bar.style.pointerEvents = \"none\";\n        else delay.set(1000, maybeDisable);\n      }\n      delay.set(1000, maybeDisable);\n    },\n    clear: function() {\n      var parent = this.horiz.parentNode;\n      parent.removeChild(this.horiz);\n      parent.removeChild(this.vert);\n    }\n  }, NativeScrollbars.prototype);\n\n  function NullScrollbars() {}\n\n  NullScrollbars.prototype = copyObj({\n    update: function() { return {bottom: 0, right: 0}; },\n    setScrollLeft: function() {},\n    setScrollTop: function() {},\n    clear: function() {}\n  }, NullScrollbars.prototype);\n\n  CodeMirror.scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n  function initScrollbars(cm) {\n    if (cm.display.scrollbars) {\n      cm.display.scrollbars.clear();\n      if (cm.display.scrollbars.addClass)\n        rmClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n    }\n\n    cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) {\n      cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n      // Prevent clicks in the scrollbars from killing focus\n      on(node, \"mousedown\", function() {\n        if (cm.state.focused) setTimeout(function() { cm.display.input.focus(); }, 0);\n      });\n      node.setAttribute(\"cm-not-content\", \"true\");\n    }, function(pos, axis) {\n      if (axis == \"horizontal\") setScrollLeft(cm, pos);\n      else setScrollTop(cm, pos);\n    }, cm);\n    if (cm.display.scrollbars.addClass)\n      addClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n  }\n\n  function updateScrollbars(cm, measure) {\n    if (!measure) measure = measureForScrollbars(cm);\n    var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n    updateScrollbarsInner(cm, measure);\n    for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n      if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n        updateHeightsInViewport(cm);\n      updateScrollbarsInner(cm, measureForScrollbars(cm));\n      startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n    }\n  }\n\n  // Re-synchronize the fake scrollbars with the actual size of the\n  // content.\n  function updateScrollbarsInner(cm, measure) {\n    var d = cm.display;\n    var sizes = d.scrollbars.update(measure);\n\n    d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n    d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n    d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n    if (sizes.right && sizes.bottom) {\n      d.scrollbarFiller.style.display = \"block\";\n      d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n      d.scrollbarFiller.style.width = sizes.right + \"px\";\n    } else d.scrollbarFiller.style.display = \"\";\n    if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n      d.gutterFiller.style.display = \"block\";\n      d.gutterFiller.style.height = sizes.bottom + \"px\";\n      d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n    } else d.gutterFiller.style.display = \"\";\n  }\n\n  // Compute the lines that are visible in a given viewport (defaults\n  // the the current scroll position). viewport may contain top,\n  // height, and ensure (see op.scrollToPos) properties.\n  function visibleLines(display, doc, viewport) {\n    var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n    top = Math.floor(top - paddingTop(display));\n    var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n    var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n    // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n    // forces those lines into the viewport (if possible).\n    if (viewport && viewport.ensure) {\n      var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n      if (ensureFrom < from) {\n        from = ensureFrom;\n        to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n      } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n        from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n        to = ensureTo;\n      }\n    }\n    return {from: from, to: Math.max(to, from + 1)};\n  }\n\n  // LINE NUMBERS\n\n  // Re-align line numbers and gutter marks to compensate for\n  // horizontal scrolling.\n  function alignHorizontally(cm) {\n    var display = cm.display, view = display.view;\n    if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n    var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n    var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n    for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n      if (cm.options.fixedGutter && view[i].gutter)\n        view[i].gutter.style.left = left;\n      var align = view[i].alignable;\n      if (align) for (var j = 0; j < align.length; j++)\n        align[j].style.left = left;\n    }\n    if (cm.options.fixedGutter)\n      display.gutters.style.left = (comp + gutterW) + \"px\";\n  }\n\n  // Used to ensure that the line number gutter is still the right\n  // size for the current document size. Returns true when an update\n  // is needed.\n  function maybeUpdateLineNumberWidth(cm) {\n    if (!cm.options.lineNumbers) return false;\n    var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n    if (last.length != display.lineNumChars) {\n      var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n                                                 \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n      var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n      display.lineGutter.style.width = \"\";\n      display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n      display.lineNumWidth = display.lineNumInnerWidth + padding;\n      display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n      display.lineGutter.style.width = display.lineNumWidth + \"px\";\n      updateGutterSpace(cm);\n      return true;\n    }\n    return false;\n  }\n\n  function lineNumberFor(options, i) {\n    return String(options.lineNumberFormatter(i + options.firstLineNumber));\n  }\n\n  // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n  // but using getBoundingClientRect to get a sub-pixel-accurate\n  // result.\n  function compensateForHScroll(display) {\n    return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n  }\n\n  // DISPLAY DRAWING\n\n  function DisplayUpdate(cm, viewport, force) {\n    var display = cm.display;\n\n    this.viewport = viewport;\n    // Store some values that we'll need later (but don't want to force a relayout for)\n    this.visible = visibleLines(display, cm.doc, viewport);\n    this.editorIsHidden = !display.wrapper.offsetWidth;\n    this.wrapperHeight = display.wrapper.clientHeight;\n    this.wrapperWidth = display.wrapper.clientWidth;\n    this.oldDisplayWidth = displayWidth(cm);\n    this.force = force;\n    this.dims = getDimensions(cm);\n    this.events = [];\n  }\n\n  DisplayUpdate.prototype.signal = function(emitter, type) {\n    if (hasHandler(emitter, type))\n      this.events.push(arguments);\n  };\n  DisplayUpdate.prototype.finish = function() {\n    for (var i = 0; i < this.events.length; i++)\n      signal.apply(null, this.events[i]);\n  };\n\n  function maybeClipScrollbars(cm) {\n    var display = cm.display;\n    if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n      display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n      display.heightForcer.style.height = scrollGap(cm) + \"px\";\n      display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n      display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n      display.scrollbarsClipped = true;\n    }\n  }\n\n  // Does the actual updating of the line display. Bails out\n  // (returning false) when there is nothing to be done and forced is\n  // false.\n  function updateDisplayIfNeeded(cm, update) {\n    var display = cm.display, doc = cm.doc;\n\n    if (update.editorIsHidden) {\n      resetView(cm);\n      return false;\n    }\n\n    // Bail out if the visible area is already rendered and nothing changed.\n    if (!update.force &&\n        update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n        (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n        display.renderedView == display.view && countDirtyView(cm) == 0)\n      return false;\n\n    if (maybeUpdateLineNumberWidth(cm)) {\n      resetView(cm);\n      update.dims = getDimensions(cm);\n    }\n\n    // Compute a suitable new viewport (from & to)\n    var end = doc.first + doc.size;\n    var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n    var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n    if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n    if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n    if (sawCollapsedSpans) {\n      from = visualLineNo(cm.doc, from);\n      to = visualLineEndNo(cm.doc, to);\n    }\n\n    var different = from != display.viewFrom || to != display.viewTo ||\n      display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n    adjustView(cm, from, to);\n\n    display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n    // Position the mover div to align with the current scroll position\n    cm.display.mover.style.top = display.viewOffset + \"px\";\n\n    var toUpdate = countDirtyView(cm);\n    if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n        (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n      return false;\n\n    // For big changes, we hide the enclosing element during the\n    // update, since that speeds up the operations on most browsers.\n    var focused = activeElt();\n    if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n    patchDisplay(cm, display.updateLineNumbers, update.dims);\n    if (toUpdate > 4) display.lineDiv.style.display = \"\";\n    display.renderedView = display.view;\n    // There might have been a widget with a focused element that got\n    // hidden or updated, if so re-focus it.\n    if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n    // Prevent selection and cursors from interfering with the scroll\n    // width and height.\n    removeChildren(display.cursorDiv);\n    removeChildren(display.selectionDiv);\n    display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n    if (different) {\n      display.lastWrapHeight = update.wrapperHeight;\n      display.lastWrapWidth = update.wrapperWidth;\n      startWorker(cm, 400);\n    }\n\n    display.updateLineNumbers = null;\n\n    return true;\n  }\n\n  function postUpdateDisplay(cm, update) {\n    var viewport = update.viewport;\n\n    for (var first = true;; first = false) {\n      if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n        // Clip forced viewport to actual scrollable area.\n        if (viewport && viewport.top != null)\n          viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};\n        // Updated line heights might result in the drawn area not\n        // actually covering the viewport. Keep looping until it does.\n        update.visible = visibleLines(cm.display, cm.doc, viewport);\n        if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n          break;\n      }\n      if (!updateDisplayIfNeeded(cm, update)) break;\n      updateHeightsInViewport(cm);\n      var barMeasure = measureForScrollbars(cm);\n      updateSelection(cm);\n      updateScrollbars(cm, barMeasure);\n      setDocumentHeight(cm, barMeasure);\n    }\n\n    update.signal(cm, \"update\", cm);\n    if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n      update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n      cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n    }\n  }\n\n  function updateDisplaySimple(cm, viewport) {\n    var update = new DisplayUpdate(cm, viewport);\n    if (updateDisplayIfNeeded(cm, update)) {\n      updateHeightsInViewport(cm);\n      postUpdateDisplay(cm, update);\n      var barMeasure = measureForScrollbars(cm);\n      updateSelection(cm);\n      updateScrollbars(cm, barMeasure);\n      setDocumentHeight(cm, barMeasure);\n      update.finish();\n    }\n  }\n\n  function setDocumentHeight(cm, measure) {\n    cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n    cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n    cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n  }\n\n  // Read the actual heights of the rendered lines, and update their\n  // stored heights to match.\n  function updateHeightsInViewport(cm) {\n    var display = cm.display;\n    var prevBottom = display.lineDiv.offsetTop;\n    for (var i = 0; i < display.view.length; i++) {\n      var cur = display.view[i], height;\n      if (cur.hidden) continue;\n      if (ie && ie_version < 8) {\n        var bot = cur.node.offsetTop + cur.node.offsetHeight;\n        height = bot - prevBottom;\n        prevBottom = bot;\n      } else {\n        var box = cur.node.getBoundingClientRect();\n        height = box.bottom - box.top;\n      }\n      var diff = cur.line.height - height;\n      if (height < 2) height = textHeight(display);\n      if (diff > .001 || diff < -.001) {\n        updateLineHeight(cur.line, height);\n        updateWidgetHeight(cur.line);\n        if (cur.rest) for (var j = 0; j < cur.rest.length; j++)\n          updateWidgetHeight(cur.rest[j]);\n      }\n    }\n  }\n\n  // Read and store the height of line widgets associated with the\n  // given line.\n  function updateWidgetHeight(line) {\n    if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n      line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n  }\n\n  // Do a bulk-read of the DOM positions and sizes needed to draw the\n  // view, so that we don't interleave reading and writing to the DOM.\n  function getDimensions(cm) {\n    var d = cm.display, left = {}, width = {};\n    var gutterLeft = d.gutters.clientLeft;\n    for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n      left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n      width[cm.options.gutters[i]] = n.clientWidth;\n    }\n    return {fixedPos: compensateForHScroll(d),\n            gutterTotalWidth: d.gutters.offsetWidth,\n            gutterLeft: left,\n            gutterWidth: width,\n            wrapperWidth: d.wrapper.clientWidth};\n  }\n\n  // Sync the actual display DOM structure with display.view, removing\n  // nodes for lines that are no longer in view, and creating the ones\n  // that are not there yet, and updating the ones that are out of\n  // date.\n  function patchDisplay(cm, updateNumbersFrom, dims) {\n    var display = cm.display, lineNumbers = cm.options.lineNumbers;\n    var container = display.lineDiv, cur = container.firstChild;\n\n    function rm(node) {\n      var next = node.nextSibling;\n      // Works around a throw-scroll bug in OS X Webkit\n      if (webkit && mac && cm.display.currentWheelTarget == node)\n        node.style.display = \"none\";\n      else\n        node.parentNode.removeChild(node);\n      return next;\n    }\n\n    var view = display.view, lineN = display.viewFrom;\n    // Loop over the elements in the view, syncing cur (the DOM nodes\n    // in display.lineDiv) with the view as we go.\n    for (var i = 0; i < view.length; i++) {\n      var lineView = view[i];\n      if (lineView.hidden) {\n      } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n        var node = buildLineElement(cm, lineView, lineN, dims);\n        container.insertBefore(node, cur);\n      } else { // Already drawn\n        while (cur != lineView.node) cur = rm(cur);\n        var updateNumber = lineNumbers && updateNumbersFrom != null &&\n          updateNumbersFrom <= lineN && lineView.lineNumber;\n        if (lineView.changes) {\n          if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n          updateLineForChanges(cm, lineView, lineN, dims);\n        }\n        if (updateNumber) {\n          removeChildren(lineView.lineNumber);\n          lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n        }\n        cur = lineView.node.nextSibling;\n      }\n      lineN += lineView.size;\n    }\n    while (cur) cur = rm(cur);\n  }\n\n  // When an aspect of a line changes, a string is added to\n  // lineView.changes. This updates the relevant part of the line's\n  // DOM structure.\n  function updateLineForChanges(cm, lineView, lineN, dims) {\n    for (var j = 0; j < lineView.changes.length; j++) {\n      var type = lineView.changes[j];\n      if (type == \"text\") updateLineText(cm, lineView);\n      else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n      else if (type == \"class\") updateLineClasses(lineView);\n      else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n    }\n    lineView.changes = null;\n  }\n\n  // Lines with gutter elements, widgets or a background class need to\n  // be wrapped, and have the extra elements added to the wrapper div\n  function ensureLineWrapped(lineView) {\n    if (lineView.node == lineView.text) {\n      lineView.node = elt(\"div\", null, null, \"position: relative\");\n      if (lineView.text.parentNode)\n        lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n      lineView.node.appendChild(lineView.text);\n      if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n    }\n    return lineView.node;\n  }\n\n  function updateLineBackground(lineView) {\n    var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n    if (cls) cls += \" CodeMirror-linebackground\";\n    if (lineView.background) {\n      if (cls) lineView.background.className = cls;\n      else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n    } else if (cls) {\n      var wrap = ensureLineWrapped(lineView);\n      lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n    }\n  }\n\n  // Wrapper around buildLineContent which will reuse the structure\n  // in display.externalMeasured when possible.\n  function getLineContent(cm, lineView) {\n    var ext = cm.display.externalMeasured;\n    if (ext && ext.line == lineView.line) {\n      cm.display.externalMeasured = null;\n      lineView.measure = ext.measure;\n      return ext.built;\n    }\n    return buildLineContent(cm, lineView);\n  }\n\n  // Redraw the line's text. Interacts with the background and text\n  // classes because the mode may output tokens that influence these\n  // classes.\n  function updateLineText(cm, lineView) {\n    var cls = lineView.text.className;\n    var built = getLineContent(cm, lineView);\n    if (lineView.text == lineView.node) lineView.node = built.pre;\n    lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n    lineView.text = built.pre;\n    if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n      lineView.bgClass = built.bgClass;\n      lineView.textClass = built.textClass;\n      updateLineClasses(lineView);\n    } else if (cls) {\n      lineView.text.className = cls;\n    }\n  }\n\n  function updateLineClasses(lineView) {\n    updateLineBackground(lineView);\n    if (lineView.line.wrapClass)\n      ensureLineWrapped(lineView).className = lineView.line.wrapClass;\n    else if (lineView.node != lineView.text)\n      lineView.node.className = \"\";\n    var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n    lineView.text.className = textClass || \"\";\n  }\n\n  function updateLineGutter(cm, lineView, lineN, dims) {\n    if (lineView.gutter) {\n      lineView.node.removeChild(lineView.gutter);\n      lineView.gutter = null;\n    }\n    if (lineView.gutterBackground) {\n      lineView.node.removeChild(lineView.gutterBackground);\n      lineView.gutterBackground = null;\n    }\n    if (lineView.line.gutterClass) {\n      var wrap = ensureLineWrapped(lineView);\n      lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n                                      \"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +\n                                      \"px; width: \" + dims.gutterTotalWidth + \"px\");\n      wrap.insertBefore(lineView.gutterBackground, lineView.text);\n    }\n    var markers = lineView.line.gutterMarkers;\n    if (cm.options.lineNumbers || markers) {\n      var wrap = ensureLineWrapped(lineView);\n      var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", \"left: \" +\n                                             (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\");\n      cm.display.input.setUneditable(gutterWrap);\n      wrap.insertBefore(gutterWrap, lineView.text);\n      if (lineView.line.gutterClass)\n        gutterWrap.className += \" \" + lineView.line.gutterClass;\n      if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n        lineView.lineNumber = gutterWrap.appendChild(\n          elt(\"div\", lineNumberFor(cm.options, lineN),\n              \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n              \"left: \" + dims.gutterLeft[\"CodeMirror-linenumbers\"] + \"px; width: \"\n              + cm.display.lineNumInnerWidth + \"px\"));\n      if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) {\n        var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];\n        if (found)\n          gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\", \"left: \" +\n                                     dims.gutterLeft[id] + \"px; width: \" + dims.gutterWidth[id] + \"px\"));\n      }\n    }\n  }\n\n  function updateLineWidgets(cm, lineView, dims) {\n    if (lineView.alignable) lineView.alignable = null;\n    for (var node = lineView.node.firstChild, next; node; node = next) {\n      var next = node.nextSibling;\n      if (node.className == \"CodeMirror-linewidget\")\n        lineView.node.removeChild(node);\n    }\n    insertLineWidgets(cm, lineView, dims);\n  }\n\n  // Build a line's DOM representation from scratch\n  function buildLineElement(cm, lineView, lineN, dims) {\n    var built = getLineContent(cm, lineView);\n    lineView.text = lineView.node = built.pre;\n    if (built.bgClass) lineView.bgClass = built.bgClass;\n    if (built.textClass) lineView.textClass = built.textClass;\n\n    updateLineClasses(lineView);\n    updateLineGutter(cm, lineView, lineN, dims);\n    insertLineWidgets(cm, lineView, dims);\n    return lineView.node;\n  }\n\n  // A lineView may contain multiple logical lines (when merged by\n  // collapsed spans). The widgets for all of them need to be drawn.\n  function insertLineWidgets(cm, lineView, dims) {\n    insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n    if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n      insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n  }\n\n  function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n    if (!line.widgets) return;\n    var wrap = ensureLineWrapped(lineView);\n    for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n      var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\");\n      if (!widget.handleMouseEvents) node.setAttribute(\"cm-ignore-events\", \"true\");\n      positionLineWidget(widget, node, lineView, dims);\n      cm.display.input.setUneditable(node);\n      if (allowAbove && widget.above)\n        wrap.insertBefore(node, lineView.gutter || lineView.text);\n      else\n        wrap.appendChild(node);\n      signalLater(widget, \"redraw\");\n    }\n  }\n\n  function positionLineWidget(widget, node, lineView, dims) {\n    if (widget.noHScroll) {\n      (lineView.alignable || (lineView.alignable = [])).push(node);\n      var width = dims.wrapperWidth;\n      node.style.left = dims.fixedPos + \"px\";\n      if (!widget.coverGutter) {\n        width -= dims.gutterTotalWidth;\n        node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n      }\n      node.style.width = width + \"px\";\n    }\n    if (widget.coverGutter) {\n      node.style.zIndex = 5;\n      node.style.position = \"relative\";\n      if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + \"px\";\n    }\n  }\n\n  // POSITION OBJECT\n\n  // A Pos instance represents a position within the text.\n  var Pos = CodeMirror.Pos = function(line, ch) {\n    if (!(this instanceof Pos)) return new Pos(line, ch);\n    this.line = line; this.ch = ch;\n  };\n\n  // Compare two positions, return 0 if they are the same, a negative\n  // number when a is less, and a positive number otherwise.\n  var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; };\n\n  function copyPos(x) {return Pos(x.line, x.ch);}\n  function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; }\n  function minPos(a, b) { return cmp(a, b) < 0 ? a : b; }\n\n  // INPUT HANDLING\n\n  function ensureFocus(cm) {\n    if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }\n  }\n\n  // This will be set to a {lineWise: bool, text: [string]} object, so\n  // that, when pasting, we know what kind of selections the copied\n  // text was made out of.\n  var lastCopied = null;\n\n  function applyTextInput(cm, inserted, deleted, sel, origin) {\n    var doc = cm.doc;\n    cm.display.shift = false;\n    if (!sel) sel = doc.sel;\n\n    var paste = cm.state.pasteIncoming || origin == \"paste\";\n    var textLines = doc.splitLines(inserted), multiPaste = null\n    // When pasing N lines into N selections, insert one line per selection\n    if (paste && sel.ranges.length > 1) {\n      if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n        if (sel.ranges.length % lastCopied.text.length == 0) {\n          multiPaste = [];\n          for (var i = 0; i < lastCopied.text.length; i++)\n            multiPaste.push(doc.splitLines(lastCopied.text[i]));\n        }\n      } else if (textLines.length == sel.ranges.length) {\n        multiPaste = map(textLines, function(l) { return [l]; });\n      }\n    }\n\n    // Normal behavior is to insert the new text into every selection\n    for (var i = sel.ranges.length - 1; i >= 0; i--) {\n      var range = sel.ranges[i];\n      var from = range.from(), to = range.to();\n      if (range.empty()) {\n        if (deleted && deleted > 0) // Handle deletion\n          from = Pos(from.line, from.ch - deleted);\n        else if (cm.state.overwrite && !paste) // Handle overwrite\n          to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));\n        else if (lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == inserted)\n          from = to = Pos(from.line, 0)\n      }\n      var updateInput = cm.curOp.updateInput;\n      var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,\n                         origin: origin || (paste ? \"paste\" : cm.state.cutIncoming ? \"cut\" : \"+input\")};\n      makeChange(cm.doc, changeEvent);\n      signalLater(cm, \"inputRead\", cm, changeEvent);\n    }\n    if (inserted && !paste)\n      triggerElectric(cm, inserted);\n\n    ensureCursorVisible(cm);\n    cm.curOp.updateInput = updateInput;\n    cm.curOp.typing = true;\n    cm.state.pasteIncoming = cm.state.cutIncoming = false;\n  }\n\n  function handlePaste(e, cm) {\n    var pasted = e.clipboardData && e.clipboardData.getData(\"text/plain\");\n    if (pasted) {\n      e.preventDefault();\n      if (!cm.isReadOnly() && !cm.options.disableInput)\n        runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, \"paste\"); });\n      return true;\n    }\n  }\n\n  function triggerElectric(cm, inserted) {\n    // When an 'electric' character is inserted, immediately trigger a reindent\n    if (!cm.options.electricChars || !cm.options.smartIndent) return;\n    var sel = cm.doc.sel;\n\n    for (var i = sel.ranges.length - 1; i >= 0; i--) {\n      var range = sel.ranges[i];\n      if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue;\n      var mode = cm.getModeAt(range.head);\n      var indented = false;\n      if (mode.electricChars) {\n        for (var j = 0; j < mode.electricChars.length; j++)\n          if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n            indented = indentLine(cm, range.head.line, \"smart\");\n            break;\n          }\n      } else if (mode.electricInput) {\n        if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))\n          indented = indentLine(cm, range.head.line, \"smart\");\n      }\n      if (indented) signalLater(cm, \"electricInput\", cm, range.head.line);\n    }\n  }\n\n  function copyableRanges(cm) {\n    var text = [], ranges = [];\n    for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n      var line = cm.doc.sel.ranges[i].head.line;\n      var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n      ranges.push(lineRange);\n      text.push(cm.getRange(lineRange.anchor, lineRange.head));\n    }\n    return {text: text, ranges: ranges};\n  }\n\n  function disableBrowserMagic(field) {\n    field.setAttribute(\"autocorrect\", \"off\");\n    field.setAttribute(\"autocapitalize\", \"off\");\n    field.setAttribute(\"spellcheck\", \"false\");\n  }\n\n  // TEXTAREA INPUT STYLE\n\n  function TextareaInput(cm) {\n    this.cm = cm;\n    // See input.poll and input.reset\n    this.prevInput = \"\";\n\n    // Flag that indicates whether we expect input to appear real soon\n    // now (after some event like 'keypress' or 'input') and are\n    // polling intensively.\n    this.pollingFast = false;\n    // Self-resetting timeout for the poller\n    this.polling = new Delayed();\n    // Tracks when input.reset has punted to just putting a short\n    // string into the textarea instead of the full selection.\n    this.inaccurateSelection = false;\n    // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n    this.hasSelection = false;\n    this.composing = null;\n  };\n\n  function hiddenTextarea() {\n    var te = elt(\"textarea\", null, null, \"position: absolute; padding: 0; width: 1px; height: 1em; outline: none\");\n    var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n    // The textarea is kept positioned near the cursor to prevent the\n    // fact that it'll be scrolled into view on input from scrolling\n    // our fake cursor out of view. On webkit, when wrap=off, paste is\n    // very slow. So make the area wide instead.\n    if (webkit) te.style.width = \"1000px\";\n    else te.setAttribute(\"wrap\", \"off\");\n    // If border: 0; -- iOS fails to open keyboard (issue #1287)\n    if (ios) te.style.border = \"1px solid black\";\n    disableBrowserMagic(te);\n    return div;\n  }\n\n  TextareaInput.prototype = copyObj({\n    init: function(display) {\n      var input = this, cm = this.cm;\n\n      // Wraps and hides input textarea\n      var div = this.wrapper = hiddenTextarea();\n      // The semihidden textarea that is focused when the editor is\n      // focused, and receives input.\n      var te = this.textarea = div.firstChild;\n      display.wrapper.insertBefore(div, display.wrapper.firstChild);\n\n      // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n      if (ios) te.style.width = \"0px\";\n\n      on(te, \"input\", function() {\n        if (ie && ie_version >= 9 && input.hasSelection) input.hasSelection = null;\n        input.poll();\n      });\n\n      on(te, \"paste\", function(e) {\n        if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return\n\n        cm.state.pasteIncoming = true;\n        input.fastPoll();\n      });\n\n      function prepareCopyCut(e) {\n        if (signalDOMEvent(cm, e)) return\n        if (cm.somethingSelected()) {\n          lastCopied = {lineWise: false, text: cm.getSelections()};\n          if (input.inaccurateSelection) {\n            input.prevInput = \"\";\n            input.inaccurateSelection = false;\n            te.value = lastCopied.text.join(\"\\n\");\n            selectInput(te);\n          }\n        } else if (!cm.options.lineWiseCopyCut) {\n          return;\n        } else {\n          var ranges = copyableRanges(cm);\n          lastCopied = {lineWise: true, text: ranges.text};\n          if (e.type == \"cut\") {\n            cm.setSelections(ranges.ranges, null, sel_dontScroll);\n          } else {\n            input.prevInput = \"\";\n            te.value = ranges.text.join(\"\\n\");\n            selectInput(te);\n          }\n        }\n        if (e.type == \"cut\") cm.state.cutIncoming = true;\n      }\n      on(te, \"cut\", prepareCopyCut);\n      on(te, \"copy\", prepareCopyCut);\n\n      on(display.scroller, \"paste\", function(e) {\n        if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return;\n        cm.state.pasteIncoming = true;\n        input.focus();\n      });\n\n      // Prevent normal selection in the editor (we handle our own)\n      on(display.lineSpace, \"selectstart\", function(e) {\n        if (!eventInWidget(display, e)) e_preventDefault(e);\n      });\n\n      on(te, \"compositionstart\", function() {\n        var start = cm.getCursor(\"from\");\n        if (input.composing) input.composing.range.clear()\n        input.composing = {\n          start: start,\n          range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n        };\n      });\n      on(te, \"compositionend\", function() {\n        if (input.composing) {\n          input.poll();\n          input.composing.range.clear();\n          input.composing = null;\n        }\n      });\n    },\n\n    prepareSelection: function() {\n      // Redraw the selection and/or cursor\n      var cm = this.cm, display = cm.display, doc = cm.doc;\n      var result = prepareSelection(cm);\n\n      // Move the hidden textarea near the cursor to prevent scrolling artifacts\n      if (cm.options.moveInputWithCursor) {\n        var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n        var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n        result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n                                            headPos.top + lineOff.top - wrapOff.top));\n        result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n                                             headPos.left + lineOff.left - wrapOff.left));\n      }\n\n      return result;\n    },\n\n    showSelection: function(drawn) {\n      var cm = this.cm, display = cm.display;\n      removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n      removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n      if (drawn.teTop != null) {\n        this.wrapper.style.top = drawn.teTop + \"px\";\n        this.wrapper.style.left = drawn.teLeft + \"px\";\n      }\n    },\n\n    // Reset the input to correspond to the selection (or to be empty,\n    // when not typing and nothing is selected)\n    reset: function(typing) {\n      if (this.contextMenuPending) return;\n      var minimal, selected, cm = this.cm, doc = cm.doc;\n      if (cm.somethingSelected()) {\n        this.prevInput = \"\";\n        var range = doc.sel.primary();\n        minimal = hasCopyEvent &&\n          (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);\n        var content = minimal ? \"-\" : selected || cm.getSelection();\n        this.textarea.value = content;\n        if (cm.state.focused) selectInput(this.textarea);\n        if (ie && ie_version >= 9) this.hasSelection = content;\n      } else if (!typing) {\n        this.prevInput = this.textarea.value = \"\";\n        if (ie && ie_version >= 9) this.hasSelection = null;\n      }\n      this.inaccurateSelection = minimal;\n    },\n\n    getField: function() { return this.textarea; },\n\n    supportsTouch: function() { return false; },\n\n    focus: function() {\n      if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n        try { this.textarea.focus(); }\n        catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n      }\n    },\n\n    blur: function() { this.textarea.blur(); },\n\n    resetPosition: function() {\n      this.wrapper.style.top = this.wrapper.style.left = 0;\n    },\n\n    receivedFocus: function() { this.slowPoll(); },\n\n    // Poll for input changes, using the normal rate of polling. This\n    // runs as long as the editor is focused.\n    slowPoll: function() {\n      var input = this;\n      if (input.pollingFast) return;\n      input.polling.set(this.cm.options.pollInterval, function() {\n        input.poll();\n        if (input.cm.state.focused) input.slowPoll();\n      });\n    },\n\n    // When an event has just come in that is likely to add or change\n    // something in the input textarea, we poll faster, to ensure that\n    // the change appears on the screen quickly.\n    fastPoll: function() {\n      var missed = false, input = this;\n      input.pollingFast = true;\n      function p() {\n        var changed = input.poll();\n        if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n        else {input.pollingFast = false; input.slowPoll();}\n      }\n      input.polling.set(20, p);\n    },\n\n    // Read input from the textarea, and update the document to match.\n    // When something is selected, it is present in the textarea, and\n    // selected (unless it is huge, in which case a placeholder is\n    // used). When nothing is selected, the cursor sits after previously\n    // seen text (can be empty), which is stored in prevInput (we must\n    // not reset the textarea when typing, because that breaks IME).\n    poll: function() {\n      var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n      // Since this is called a *lot*, try to bail out as cheaply as\n      // possible when it is clear that nothing happened. hasSelection\n      // will be the case when there is a lot of text in the textarea,\n      // in which case reading its value would be expensive.\n      if (this.contextMenuPending || !cm.state.focused ||\n          (hasSelection(input) && !prevInput && !this.composing) ||\n          cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n        return false;\n\n      var text = input.value;\n      // If nothing changed, bail.\n      if (text == prevInput && !cm.somethingSelected()) return false;\n      // Work around nonsensical selection resetting in IE9/10, and\n      // inexplicable appearance of private area unicode characters on\n      // some key combos in Mac (#2689).\n      if (ie && ie_version >= 9 && this.hasSelection === text ||\n          mac && /[\\uf700-\\uf7ff]/.test(text)) {\n        cm.display.input.reset();\n        return false;\n      }\n\n      if (cm.doc.sel == cm.display.selForContextMenu) {\n        var first = text.charCodeAt(0);\n        if (first == 0x200b && !prevInput) prevInput = \"\\u200b\";\n        if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\"); }\n      }\n      // Find the part of the input that is actually new\n      var same = 0, l = Math.min(prevInput.length, text.length);\n      while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;\n\n      var self = this;\n      runInOp(cm, function() {\n        applyTextInput(cm, text.slice(same), prevInput.length - same,\n                       null, self.composing ? \"*compose\" : null);\n\n        // Don't leave long text in the textarea, since it makes further polling slow\n        if (text.length > 1000 || text.indexOf(\"\\n\") > -1) input.value = self.prevInput = \"\";\n        else self.prevInput = text;\n\n        if (self.composing) {\n          self.composing.range.clear();\n          self.composing.range = cm.markText(self.composing.start, cm.getCursor(\"to\"),\n                                             {className: \"CodeMirror-composing\"});\n        }\n      });\n      return true;\n    },\n\n    ensurePolled: function() {\n      if (this.pollingFast && this.poll()) this.pollingFast = false;\n    },\n\n    onKeyPress: function() {\n      if (ie && ie_version >= 9) this.hasSelection = null;\n      this.fastPoll();\n    },\n\n    onContextMenu: function(e) {\n      var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n      var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n      if (!pos || presto) return; // Opera is difficult.\n\n      // Reset the current text selection only if the click is done outside of the selection\n      // and 'resetSelectionOnContextMenu' option is true.\n      var reset = cm.options.resetSelectionOnContextMenu;\n      if (reset && cm.doc.sel.contains(pos) == -1)\n        operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n      var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n      input.wrapper.style.cssText = \"position: absolute\"\n      var wrapperBox = input.wrapper.getBoundingClientRect()\n      te.style.cssText = \"position: absolute; width: 30px; height: 30px; top: \" + (e.clientY - wrapperBox.top - 5) +\n        \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px; z-index: 1000; background: \" +\n        (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n        \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n      if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\n      display.input.focus();\n      if (webkit) window.scrollTo(null, oldScrollY);\n      display.input.reset();\n      // Adds \"Select all\" to context menu in FF\n      if (!cm.somethingSelected()) te.value = input.prevInput = \" \";\n      input.contextMenuPending = true;\n      display.selForContextMenu = cm.doc.sel;\n      clearTimeout(display.detectingSelectAll);\n\n      // Select-all will be greyed out if there's nothing to select, so\n      // this adds a zero-width space so that we can later check whether\n      // it got selected.\n      function prepareSelectAllHack() {\n        if (te.selectionStart != null) {\n          var selected = cm.somethingSelected();\n          var extval = \"\\u200b\" + (selected ? te.value : \"\");\n          te.value = \"\\u21da\"; // Used to catch context-menu undo\n          te.value = extval;\n          input.prevInput = selected ? \"\" : \"\\u200b\";\n          te.selectionStart = 1; te.selectionEnd = extval.length;\n          // Re-set this, in case some other handler touched the\n          // selection in the meantime.\n          display.selForContextMenu = cm.doc.sel;\n        }\n      }\n      function rehide() {\n        input.contextMenuPending = false;\n        input.wrapper.style.cssText = oldWrapperCSS\n        te.style.cssText = oldCSS;\n        if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);\n\n        // Try to detect the user choosing select-all\n        if (te.selectionStart != null) {\n          if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n          var i = 0, poll = function() {\n            if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n                te.selectionEnd > 0 && input.prevInput == \"\\u200b\")\n              operation(cm, commands.selectAll)(cm);\n            else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n            else display.input.reset();\n          };\n          display.detectingSelectAll = setTimeout(poll, 200);\n        }\n      }\n\n      if (ie && ie_version >= 9) prepareSelectAllHack();\n      if (captureRightClick) {\n        e_stop(e);\n        var mouseup = function() {\n          off(window, \"mouseup\", mouseup);\n          setTimeout(rehide, 20);\n        };\n        on(window, \"mouseup\", mouseup);\n      } else {\n        setTimeout(rehide, 50);\n      }\n    },\n\n    readOnlyChanged: function(val) {\n      if (!val) this.reset();\n    },\n\n    setUneditable: nothing,\n\n    needsContentAttribute: false\n  }, TextareaInput.prototype);\n\n  // CONTENTEDITABLE INPUT STYLE\n\n  function ContentEditableInput(cm) {\n    this.cm = cm;\n    this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n    this.polling = new Delayed();\n    this.gracePeriod = false;\n  }\n\n  ContentEditableInput.prototype = copyObj({\n    init: function(display) {\n      var input = this, cm = input.cm;\n      var div = input.div = display.lineDiv;\n      disableBrowserMagic(div);\n\n      on(div, \"paste\", function(e) {\n        if (!signalDOMEvent(cm, e)) handlePaste(e, cm);\n      })\n\n      on(div, \"compositionstart\", function(e) {\n        var data = e.data;\n        input.composing = {sel: cm.doc.sel, data: data, startData: data};\n        if (!data) return;\n        var prim = cm.doc.sel.primary();\n        var line = cm.getLine(prim.head.line);\n        var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length));\n        if (found > -1 && found <= prim.head.ch)\n          input.composing.sel = simpleSelection(Pos(prim.head.line, found),\n                                                Pos(prim.head.line, found + data.length));\n      });\n      on(div, \"compositionupdate\", function(e) {\n        input.composing.data = e.data;\n      });\n      on(div, \"compositionend\", function(e) {\n        var ours = input.composing;\n        if (!ours) return;\n        if (e.data != ours.startData && !/\\u200b/.test(e.data))\n          ours.data = e.data;\n        // Need a small delay to prevent other code (input event,\n        // selection polling) from doing damage when fired right after\n        // compositionend.\n        setTimeout(function() {\n          if (!ours.handled)\n            input.applyComposition(ours);\n          if (input.composing == ours)\n            input.composing = null;\n        }, 50);\n      });\n\n      on(div, \"touchstart\", function() {\n        input.forceCompositionEnd();\n      });\n\n      on(div, \"input\", function() {\n        if (input.composing) return;\n        if (cm.isReadOnly() || !input.pollContent())\n          runInOp(input.cm, function() {regChange(cm);});\n      });\n\n      function onCopyCut(e) {\n        if (signalDOMEvent(cm, e)) return\n        if (cm.somethingSelected()) {\n          lastCopied = {lineWise: false, text: cm.getSelections()};\n          if (e.type == \"cut\") cm.replaceSelection(\"\", null, \"cut\");\n        } else if (!cm.options.lineWiseCopyCut) {\n          return;\n        } else {\n          var ranges = copyableRanges(cm);\n          lastCopied = {lineWise: true, text: ranges.text};\n          if (e.type == \"cut\") {\n            cm.operation(function() {\n              cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n              cm.replaceSelection(\"\", null, \"cut\");\n            });\n          }\n        }\n        // iOS exposes the clipboard API, but seems to discard content inserted into it\n        if (e.clipboardData && !ios) {\n          e.preventDefault();\n          e.clipboardData.clearData();\n          e.clipboardData.setData(\"text/plain\", lastCopied.text.join(\"\\n\"));\n        } else {\n          // Old-fashioned briefly-focus-a-textarea hack\n          var kludge = hiddenTextarea(), te = kludge.firstChild;\n          cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n          te.value = lastCopied.text.join(\"\\n\");\n          var hadFocus = document.activeElement;\n          selectInput(te);\n          setTimeout(function() {\n            cm.display.lineSpace.removeChild(kludge);\n            hadFocus.focus();\n          }, 50);\n        }\n      }\n      on(div, \"copy\", onCopyCut);\n      on(div, \"cut\", onCopyCut);\n    },\n\n    prepareSelection: function() {\n      var result = prepareSelection(this.cm, false);\n      result.focus = this.cm.state.focused;\n      return result;\n    },\n\n    showSelection: function(info, takeFocus) {\n      if (!info || !this.cm.display.view.length) return;\n      if (info.focus || takeFocus) this.showPrimarySelection();\n      this.showMultipleSelections(info);\n    },\n\n    showPrimarySelection: function() {\n      var sel = window.getSelection(), prim = this.cm.doc.sel.primary();\n      var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);\n      var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);\n      if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n          cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&\n          cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)\n        return;\n\n      var start = posToDOM(this.cm, prim.from());\n      var end = posToDOM(this.cm, prim.to());\n      if (!start && !end) return;\n\n      var view = this.cm.display.view;\n      var old = sel.rangeCount && sel.getRangeAt(0);\n      if (!start) {\n        start = {node: view[0].measure.map[2], offset: 0};\n      } else if (!end) { // FIXME dangerously hacky\n        var measure = view[view.length - 1].measure;\n        var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n        end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};\n      }\n\n      try { var rng = range(start.node, start.offset, end.offset, end.node); }\n      catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n      if (rng) {\n        if (!gecko && this.cm.state.focused) {\n          sel.collapse(start.node, start.offset);\n          if (!rng.collapsed) sel.addRange(rng);\n        } else {\n          sel.removeAllRanges();\n          sel.addRange(rng);\n        }\n        if (old && sel.anchorNode == null) sel.addRange(old);\n        else if (gecko) this.startGracePeriod();\n      }\n      this.rememberSelection();\n    },\n\n    startGracePeriod: function() {\n      var input = this;\n      clearTimeout(this.gracePeriod);\n      this.gracePeriod = setTimeout(function() {\n        input.gracePeriod = false;\n        if (input.selectionChanged())\n          input.cm.operation(function() { input.cm.curOp.selectionChanged = true; });\n      }, 20);\n    },\n\n    showMultipleSelections: function(info) {\n      removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n      removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n    },\n\n    rememberSelection: function() {\n      var sel = window.getSelection();\n      this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n      this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n    },\n\n    selectionInEditor: function() {\n      var sel = window.getSelection();\n      if (!sel.rangeCount) return false;\n      var node = sel.getRangeAt(0).commonAncestorContainer;\n      return contains(this.div, node);\n    },\n\n    focus: function() {\n      if (this.cm.options.readOnly != \"nocursor\") this.div.focus();\n    },\n    blur: function() { this.div.blur(); },\n    getField: function() { return this.div; },\n\n    supportsTouch: function() { return true; },\n\n    receivedFocus: function() {\n      var input = this;\n      if (this.selectionInEditor())\n        this.pollSelection();\n      else\n        runInOp(this.cm, function() { input.cm.curOp.selectionChanged = true; });\n\n      function poll() {\n        if (input.cm.state.focused) {\n          input.pollSelection();\n          input.polling.set(input.cm.options.pollInterval, poll);\n        }\n      }\n      this.polling.set(this.cm.options.pollInterval, poll);\n    },\n\n    selectionChanged: function() {\n      var sel = window.getSelection();\n      return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n        sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset;\n    },\n\n    pollSelection: function() {\n      if (!this.composing && !this.gracePeriod && this.selectionChanged()) {\n        var sel = window.getSelection(), cm = this.cm;\n        this.rememberSelection();\n        var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n        var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n        if (anchor && head) runInOp(cm, function() {\n          setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n          if (anchor.bad || head.bad) cm.curOp.selectionChanged = true;\n        });\n      }\n    },\n\n    pollContent: function() {\n      var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n      var from = sel.from(), to = sel.to();\n      if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false;\n\n      var fromIndex;\n      if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n        var fromLine = lineNo(display.view[0].line);\n        var fromNode = display.view[0].node;\n      } else {\n        var fromLine = lineNo(display.view[fromIndex].line);\n        var fromNode = display.view[fromIndex - 1].node.nextSibling;\n      }\n      var toIndex = findViewIndex(cm, to.line);\n      if (toIndex == display.view.length - 1) {\n        var toLine = display.viewTo - 1;\n        var toNode = display.lineDiv.lastChild;\n      } else {\n        var toLine = lineNo(display.view[toIndex + 1].line) - 1;\n        var toNode = display.view[toIndex + 1].node.previousSibling;\n      }\n\n      var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n      var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n      while (newText.length > 1 && oldText.length > 1) {\n        if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n        else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n        else break;\n      }\n\n      var cutFront = 0, cutEnd = 0;\n      var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n      while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n        ++cutFront;\n      var newBot = lst(newText), oldBot = lst(oldText);\n      var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n                               oldBot.length - (oldText.length == 1 ? cutFront : 0));\n      while (cutEnd < maxCutEnd &&\n             newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n        ++cutEnd;\n\n      newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd);\n      newText[0] = newText[0].slice(cutFront);\n\n      var chFrom = Pos(fromLine, cutFront);\n      var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n      if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n        replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n        return true;\n      }\n    },\n\n    ensurePolled: function() {\n      this.forceCompositionEnd();\n    },\n    reset: function() {\n      this.forceCompositionEnd();\n    },\n    forceCompositionEnd: function() {\n      if (!this.composing || this.composing.handled) return;\n      this.applyComposition(this.composing);\n      this.composing.handled = true;\n      this.div.blur();\n      this.div.focus();\n    },\n    applyComposition: function(composing) {\n      if (this.cm.isReadOnly())\n        operation(this.cm, regChange)(this.cm)\n      else if (composing.data && composing.data != composing.startData)\n        operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);\n    },\n\n    setUneditable: function(node) {\n      node.contentEditable = \"false\"\n    },\n\n    onKeyPress: function(e) {\n      e.preventDefault();\n      if (!this.cm.isReadOnly())\n        operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);\n    },\n\n    readOnlyChanged: function(val) {\n      this.div.contentEditable = String(val != \"nocursor\")\n    },\n\n    onContextMenu: nothing,\n    resetPosition: nothing,\n\n    needsContentAttribute: true\n  }, ContentEditableInput.prototype);\n\n  function posToDOM(cm, pos) {\n    var view = findViewForLine(cm, pos.line);\n    if (!view || view.hidden) return null;\n    var line = getLine(cm.doc, pos.line);\n    var info = mapFromLineView(view, line, pos.line);\n\n    var order = getOrder(line), side = \"left\";\n    if (order) {\n      var partPos = getBidiPartAt(order, pos.ch);\n      side = partPos % 2 ? \"right\" : \"left\";\n    }\n    var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n    result.offset = result.collapse == \"right\" ? result.end : result.start;\n    return result;\n  }\n\n  function badPos(pos, bad) { if (bad) pos.bad = true; return pos; }\n\n  function domToPos(cm, node, offset) {\n    var lineNode;\n    if (node == cm.display.lineDiv) {\n      lineNode = cm.display.lineDiv.childNodes[offset];\n      if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true);\n      node = null; offset = 0;\n    } else {\n      for (lineNode = node;; lineNode = lineNode.parentNode) {\n        if (!lineNode || lineNode == cm.display.lineDiv) return null;\n        if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break;\n      }\n    }\n    for (var i = 0; i < cm.display.view.length; i++) {\n      var lineView = cm.display.view[i];\n      if (lineView.node == lineNode)\n        return locateNodeInLineView(lineView, node, offset);\n    }\n  }\n\n  function locateNodeInLineView(lineView, node, offset) {\n    var wrapper = lineView.text.firstChild, bad = false;\n    if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true);\n    if (node == wrapper) {\n      bad = true;\n      node = wrapper.childNodes[offset];\n      offset = 0;\n      if (!node) {\n        var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n        return badPos(Pos(lineNo(line), line.text.length), bad);\n      }\n    }\n\n    var textNode = node.nodeType == 3 ? node : null, topNode = node;\n    if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n      textNode = node.firstChild;\n      if (offset) offset = textNode.nodeValue.length;\n    }\n    while (topNode.parentNode != wrapper) topNode = topNode.parentNode;\n    var measure = lineView.measure, maps = measure.maps;\n\n    function find(textNode, topNode, offset) {\n      for (var i = -1; i < (maps ? maps.length : 0); i++) {\n        var map = i < 0 ? measure.map : maps[i];\n        for (var j = 0; j < map.length; j += 3) {\n          var curNode = map[j + 2];\n          if (curNode == textNode || curNode == topNode) {\n            var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n            var ch = map[j] + offset;\n            if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)];\n            return Pos(line, ch);\n          }\n        }\n      }\n    }\n    var found = find(textNode, topNode, offset);\n    if (found) return badPos(found, bad);\n\n    // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n    for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n      found = find(after, after.firstChild, 0);\n      if (found)\n        return badPos(Pos(found.line, found.ch - dist), bad);\n      else\n        dist += after.textContent.length;\n    }\n    for (var before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) {\n      found = find(before, before.firstChild, -1);\n      if (found)\n        return badPos(Pos(found.line, found.ch + dist), bad);\n      else\n        dist += after.textContent.length;\n    }\n  }\n\n  function domTextBetween(cm, from, to, fromLine, toLine) {\n    var text = \"\", closing = false, lineSep = cm.doc.lineSeparator();\n    function recognizeMarker(id) { return function(marker) { return marker.id == id; }; }\n    function walk(node) {\n      if (node.nodeType == 1) {\n        var cmText = node.getAttribute(\"cm-text\");\n        if (cmText != null) {\n          if (cmText == \"\") cmText = node.textContent.replace(/\\u200b/g, \"\");\n          text += cmText;\n          return;\n        }\n        var markerID = node.getAttribute(\"cm-marker\"), range;\n        if (markerID) {\n          var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n          if (found.length && (range = found[0].find()))\n            text += getBetween(cm.doc, range.from, range.to).join(lineSep);\n          return;\n        }\n        if (node.getAttribute(\"contenteditable\") == \"false\") return;\n        for (var i = 0; i < node.childNodes.length; i++)\n          walk(node.childNodes[i]);\n        if (/^(pre|div|p)$/i.test(node.nodeName))\n          closing = true;\n      } else if (node.nodeType == 3) {\n        var val = node.nodeValue;\n        if (!val) return;\n        if (closing) {\n          text += lineSep;\n          closing = false;\n        }\n        text += val;\n      }\n    }\n    for (;;) {\n      walk(from);\n      if (from == to) break;\n      from = from.nextSibling;\n    }\n    return text;\n  }\n\n  CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n  // SELECTION / CURSOR\n\n  // Selection objects are immutable. A new one is created every time\n  // the selection changes. A selection is one or more non-overlapping\n  // (and non-touching) ranges, sorted, and an integer that indicates\n  // which one is the primary selection (the one that's scrolled into\n  // view, that getCursor returns, etc).\n  function Selection(ranges, primIndex) {\n    this.ranges = ranges;\n    this.primIndex = primIndex;\n  }\n\n  Selection.prototype = {\n    primary: function() { return this.ranges[this.primIndex]; },\n    equals: function(other) {\n      if (other == this) return true;\n      if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false;\n      for (var i = 0; i < this.ranges.length; i++) {\n        var here = this.ranges[i], there = other.ranges[i];\n        if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false;\n      }\n      return true;\n    },\n    deepCopy: function() {\n      for (var out = [], i = 0; i < this.ranges.length; i++)\n        out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));\n      return new Selection(out, this.primIndex);\n    },\n    somethingSelected: function() {\n      for (var i = 0; i < this.ranges.length; i++)\n        if (!this.ranges[i].empty()) return true;\n      return false;\n    },\n    contains: function(pos, end) {\n      if (!end) end = pos;\n      for (var i = 0; i < this.ranges.length; i++) {\n        var range = this.ranges[i];\n        if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n          return i;\n      }\n      return -1;\n    }\n  };\n\n  function Range(anchor, head) {\n    this.anchor = anchor; this.head = head;\n  }\n\n  Range.prototype = {\n    from: function() { return minPos(this.anchor, this.head); },\n    to: function() { return maxPos(this.anchor, this.head); },\n    empty: function() {\n      return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;\n    }\n  };\n\n  // Take an unsorted, potentially overlapping set of ranges, and\n  // build a selection out of it. 'Consumes' ranges array (modifying\n  // it).\n  function normalizeSelection(ranges, primIndex) {\n    var prim = ranges[primIndex];\n    ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n    primIndex = indexOf(ranges, prim);\n    for (var i = 1; i < ranges.length; i++) {\n      var cur = ranges[i], prev = ranges[i - 1];\n      if (cmp(prev.to(), cur.from()) >= 0) {\n        var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n        var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n        if (i <= primIndex) --primIndex;\n        ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n      }\n    }\n    return new Selection(ranges, primIndex);\n  }\n\n  function simpleSelection(anchor, head) {\n    return new Selection([new Range(anchor, head || anchor)], 0);\n  }\n\n  // Most of the external API clips given positions to make sure they\n  // actually exist within the document.\n  function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}\n  function clipPos(doc, pos) {\n    if (pos.line < doc.first) return Pos(doc.first, 0);\n    var last = doc.first + doc.size - 1;\n    if (pos.line > last) return Pos(last, getLine(doc, last).text.length);\n    return clipToLen(pos, getLine(doc, pos.line).text.length);\n  }\n  function clipToLen(pos, linelen) {\n    var ch = pos.ch;\n    if (ch == null || ch > linelen) return Pos(pos.line, linelen);\n    else if (ch < 0) return Pos(pos.line, 0);\n    else return pos;\n  }\n  function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}\n  function clipPosArray(doc, array) {\n    for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);\n    return out;\n  }\n\n  // SELECTION UPDATES\n\n  // The 'scroll' parameter given to many of these indicated whether\n  // the new cursor position should be scrolled into view after\n  // modifying the selection.\n\n  // If shift is held or the extend flag is set, extends a range to\n  // include a given position (and optionally a second position).\n  // Otherwise, simply returns the range between the given positions.\n  // Used for cursor motion and such.\n  function extendRange(doc, range, head, other) {\n    if (doc.cm && doc.cm.display.shift || doc.extend) {\n      var anchor = range.anchor;\n      if (other) {\n        var posBefore = cmp(head, anchor) < 0;\n        if (posBefore != (cmp(other, anchor) < 0)) {\n          anchor = head;\n          head = other;\n        } else if (posBefore != (cmp(head, other) < 0)) {\n          head = other;\n        }\n      }\n      return new Range(anchor, head);\n    } else {\n      return new Range(other || head, head);\n    }\n  }\n\n  // Extend the primary selection range, discard the rest.\n  function extendSelection(doc, head, other, options) {\n    setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n  }\n\n  // Extend all selections (pos is an array of selections with length\n  // equal the number of selections)\n  function extendSelections(doc, heads, options) {\n    for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n      out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n    var newSel = normalizeSelection(out, doc.sel.primIndex);\n    setSelection(doc, newSel, options);\n  }\n\n  // Updates a single range in the selection.\n  function replaceOneSelection(doc, i, range, options) {\n    var ranges = doc.sel.ranges.slice(0);\n    ranges[i] = range;\n    setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n  }\n\n  // Reset the selection to a single range.\n  function setSimpleSelection(doc, anchor, head, options) {\n    setSelection(doc, simpleSelection(anchor, head), options);\n  }\n\n  // Give beforeSelectionChange handlers a change to influence a\n  // selection update.\n  function filterSelectionChange(doc, sel, options) {\n    var obj = {\n      ranges: sel.ranges,\n      update: function(ranges) {\n        this.ranges = [];\n        for (var i = 0; i < ranges.length; i++)\n          this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n                                     clipPos(doc, ranges[i].head));\n      },\n      origin: options && options.origin\n    };\n    signal(doc, \"beforeSelectionChange\", doc, obj);\n    if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n    if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n    else return sel;\n  }\n\n  function setSelectionReplaceHistory(doc, sel, options) {\n    var done = doc.history.done, last = lst(done);\n    if (last && last.ranges) {\n      done[done.length - 1] = sel;\n      setSelectionNoUndo(doc, sel, options);\n    } else {\n      setSelection(doc, sel, options);\n    }\n  }\n\n  // Set a new selection.\n  function setSelection(doc, sel, options) {\n    setSelectionNoUndo(doc, sel, options);\n    addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n  }\n\n  function setSelectionNoUndo(doc, sel, options) {\n    if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n      sel = filterSelectionChange(doc, sel, options);\n\n    var bias = options && options.bias ||\n      (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n    setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n    if (!(options && options.scroll === false) && doc.cm)\n      ensureCursorVisible(doc.cm);\n  }\n\n  function setSelectionInner(doc, sel) {\n    if (sel.equals(doc.sel)) return;\n\n    doc.sel = sel;\n\n    if (doc.cm) {\n      doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;\n      signalCursorActivity(doc.cm);\n    }\n    signalLater(doc, \"cursorActivity\", doc);\n  }\n\n  // Verify that the selection does not partially select any atomic\n  // marked ranges.\n  function reCheckSelection(doc) {\n    setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);\n  }\n\n  // Return a selection that does not partially select any atomic\n  // ranges.\n  function skipAtomicInSelection(doc, sel, bias, mayClear) {\n    var out;\n    for (var i = 0; i < sel.ranges.length; i++) {\n      var range = sel.ranges[i];\n      var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n      var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n      var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n      if (out || newAnchor != range.anchor || newHead != range.head) {\n        if (!out) out = sel.ranges.slice(0, i);\n        out[i] = new Range(newAnchor, newHead);\n      }\n    }\n    return out ? normalizeSelection(out, sel.primIndex) : sel;\n  }\n\n  function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n    var line = getLine(doc, pos.line);\n    if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {\n      var sp = line.markedSpans[i], m = sp.marker;\n      if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n          (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n        if (mayClear) {\n          signal(m, \"beforeCursorEnter\");\n          if (m.explicitlyCleared) {\n            if (!line.markedSpans) break;\n            else {--i; continue;}\n          }\n        }\n        if (!m.atomic) continue;\n\n        if (oldPos) {\n          var near = m.find(dir < 0 ? 1 : -1), diff;\n          if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)\n            near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null);\n          if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n            return skipAtomicInner(doc, near, pos, dir, mayClear);\n        }\n\n        var far = m.find(dir < 0 ? -1 : 1);\n        if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)\n          far = movePos(doc, far, dir, far.line == pos.line ? line : null);\n        return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;\n      }\n    }\n    return pos;\n  }\n\n  // Ensure a given position is not inside an atomic range.\n  function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n    var dir = bias || 1;\n    var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n        (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n        skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n        (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n    if (!found) {\n      doc.cantEdit = true;\n      return Pos(doc.first, 0);\n    }\n    return found;\n  }\n\n  function movePos(doc, pos, dir, line) {\n    if (dir < 0 && pos.ch == 0) {\n      if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1));\n      else return null;\n    } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n      if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0);\n      else return null;\n    } else {\n      return new Pos(pos.line, pos.ch + dir);\n    }\n  }\n\n  // SELECTION DRAWING\n\n  function updateSelection(cm) {\n    cm.display.input.showSelection(cm.display.input.prepareSelection());\n  }\n\n  function prepareSelection(cm, primary) {\n    var doc = cm.doc, result = {};\n    var curFragment = result.cursors = document.createDocumentFragment();\n    var selFragment = result.selection = document.createDocumentFragment();\n\n    for (var i = 0; i < doc.sel.ranges.length; i++) {\n      if (primary === false && i == doc.sel.primIndex) continue;\n      var range = doc.sel.ranges[i];\n      if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue;\n      var collapsed = range.empty();\n      if (collapsed || cm.options.showCursorWhenSelecting)\n        drawSelectionCursor(cm, range.head, curFragment);\n      if (!collapsed)\n        drawSelectionRange(cm, range, selFragment);\n    }\n    return result;\n  }\n\n  // Draws a cursor for the given range\n  function drawSelectionCursor(cm, head, output) {\n    var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n    var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n    cursor.style.left = pos.left + \"px\";\n    cursor.style.top = pos.top + \"px\";\n    cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n    if (pos.other) {\n      // Secondary cursor, shown when on a 'jump' in bi-directional text\n      var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n      otherCursor.style.display = \"\";\n      otherCursor.style.left = pos.other.left + \"px\";\n      otherCursor.style.top = pos.other.top + \"px\";\n      otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n    }\n  }\n\n  // Draws the given range as a highlighted selection\n  function drawSelectionRange(cm, range, output) {\n    var display = cm.display, doc = cm.doc;\n    var fragment = document.createDocumentFragment();\n    var padding = paddingH(cm.display), leftSide = padding.left;\n    var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n    function add(left, top, width, bottom) {\n      if (top < 0) top = 0;\n      top = Math.round(top);\n      bottom = Math.round(bottom);\n      fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n                               \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n                               \"px; height: \" + (bottom - top) + \"px\"));\n    }\n\n    function drawForLine(line, fromArg, toArg) {\n      var lineObj = getLine(doc, line);\n      var lineLen = lineObj.text.length;\n      var start, end;\n      function coords(ch, bias) {\n        return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n      }\n\n      iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n        var leftPos = coords(from, \"left\"), rightPos, left, right;\n        if (from == to) {\n          rightPos = leftPos;\n          left = right = leftPos.left;\n        } else {\n          rightPos = coords(to - 1, \"right\");\n          if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n          left = leftPos.left;\n          right = rightPos.right;\n        }\n        if (fromArg == null && from == 0) left = leftSide;\n        if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n          add(left, leftPos.top, null, leftPos.bottom);\n          left = leftSide;\n          if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n        }\n        if (toArg == null && to == lineLen) right = rightSide;\n        if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n          start = leftPos;\n        if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n          end = rightPos;\n        if (left < leftSide + 1) left = leftSide;\n        add(left, rightPos.top, right - left, rightPos.bottom);\n      });\n      return {start: start, end: end};\n    }\n\n    var sFrom = range.from(), sTo = range.to();\n    if (sFrom.line == sTo.line) {\n      drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n    } else {\n      var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n      var singleVLine = visualLine(fromLine) == visualLine(toLine);\n      var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n      var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n      if (singleVLine) {\n        if (leftEnd.top < rightStart.top - 2) {\n          add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n          add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n        } else {\n          add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n        }\n      }\n      if (leftEnd.bottom < rightStart.top)\n        add(leftSide, leftEnd.bottom, null, rightStart.top);\n    }\n\n    output.appendChild(fragment);\n  }\n\n  // Cursor-blinking\n  function restartBlink(cm) {\n    if (!cm.state.focused) return;\n    var display = cm.display;\n    clearInterval(display.blinker);\n    var on = true;\n    display.cursorDiv.style.visibility = \"\";\n    if (cm.options.cursorBlinkRate > 0)\n      display.blinker = setInterval(function() {\n        display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n      }, cm.options.cursorBlinkRate);\n    else if (cm.options.cursorBlinkRate < 0)\n      display.cursorDiv.style.visibility = \"hidden\";\n  }\n\n  // HIGHLIGHT WORKER\n\n  function startWorker(cm, time) {\n    if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)\n      cm.state.highlight.set(time, bind(highlightWorker, cm));\n  }\n\n  function highlightWorker(cm) {\n    var doc = cm.doc;\n    if (doc.frontier < doc.first) doc.frontier = doc.first;\n    if (doc.frontier >= cm.display.viewTo) return;\n    var end = +new Date + cm.options.workTime;\n    var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));\n    var changedLines = [];\n\n    doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {\n      if (doc.frontier >= cm.display.viewFrom) { // Visible\n        var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;\n        var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);\n        line.styles = highlighted.styles;\n        var oldCls = line.styleClasses, newCls = highlighted.classes;\n        if (newCls) line.styleClasses = newCls;\n        else if (oldCls) line.styleClasses = null;\n        var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n          oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n        for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];\n        if (ischange) changedLines.push(doc.frontier);\n        line.stateAfter = tooLong ? state : copyState(doc.mode, state);\n      } else {\n        if (line.text.length <= cm.options.maxHighlightLength)\n          processLine(cm, line.text, state);\n        line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;\n      }\n      ++doc.frontier;\n      if (+new Date > end) {\n        startWorker(cm, cm.options.workDelay);\n        return true;\n      }\n    });\n    if (changedLines.length) runInOp(cm, function() {\n      for (var i = 0; i < changedLines.length; i++)\n        regLineChange(cm, changedLines[i], \"text\");\n    });\n  }\n\n  // Finds the line to start with when starting a parse. Tries to\n  // find a line with a stateAfter, so that it can start with a\n  // valid state. If that fails, it returns the line with the\n  // smallest indentation, which tends to need the least context to\n  // parse correctly.\n  function findStartLine(cm, n, precise) {\n    var minindent, minline, doc = cm.doc;\n    var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n    for (var search = n; search > lim; --search) {\n      if (search <= doc.first) return doc.first;\n      var line = getLine(doc, search - 1);\n      if (line.stateAfter && (!precise || search <= doc.frontier)) return search;\n      var indented = countColumn(line.text, null, cm.options.tabSize);\n      if (minline == null || minindent > indented) {\n        minline = search - 1;\n        minindent = indented;\n      }\n    }\n    return minline;\n  }\n\n  function getStateBefore(cm, n, precise) {\n    var doc = cm.doc, display = cm.display;\n    if (!doc.mode.startState) return true;\n    var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;\n    if (!state) state = startState(doc.mode);\n    else state = copyState(doc.mode, state);\n    doc.iter(pos, n, function(line) {\n      processLine(cm, line.text, state);\n      var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;\n      line.stateAfter = save ? copyState(doc.mode, state) : null;\n      ++pos;\n    });\n    if (precise) doc.frontier = pos;\n    return state;\n  }\n\n  // POSITION MEASUREMENT\n\n  function paddingTop(display) {return display.lineSpace.offsetTop;}\n  function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}\n  function paddingH(display) {\n    if (display.cachedPaddingH) return display.cachedPaddingH;\n    var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\"));\n    var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n    var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n    if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data;\n    return data;\n  }\n\n  function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; }\n  function displayWidth(cm) {\n    return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth;\n  }\n  function displayHeight(cm) {\n    return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight;\n  }\n\n  // Ensure the lineView.wrapping.heights array is populated. This is\n  // an array of bottom offsets for the lines that make up a drawn\n  // line. When lineWrapping is on, there might be more than one\n  // height.\n  function ensureLineHeights(cm, lineView, rect) {\n    var wrapping = cm.options.lineWrapping;\n    var curWidth = wrapping && displayWidth(cm);\n    if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n      var heights = lineView.measure.heights = [];\n      if (wrapping) {\n        lineView.measure.width = curWidth;\n        var rects = lineView.text.firstChild.getClientRects();\n        for (var i = 0; i < rects.length - 1; i++) {\n          var cur = rects[i], next = rects[i + 1];\n          if (Math.abs(cur.bottom - next.bottom) > 2)\n            heights.push((cur.bottom + next.top) / 2 - rect.top);\n        }\n      }\n      heights.push(rect.bottom - rect.top);\n    }\n  }\n\n  // Find a line map (mapping character offsets to text nodes) and a\n  // measurement cache for the given line number. (A line view might\n  // contain multiple lines when collapsed ranges are present.)\n  function mapFromLineView(lineView, line, lineN) {\n    if (lineView.line == line)\n      return {map: lineView.measure.map, cache: lineView.measure.cache};\n    for (var i = 0; i < lineView.rest.length; i++)\n      if (lineView.rest[i] == line)\n        return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n    for (var i = 0; i < lineView.rest.length; i++)\n      if (lineNo(lineView.rest[i]) > lineN)\n        return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n  }\n\n  // Render a line into the hidden node display.externalMeasured. Used\n  // when measurement is needed for a line that's not in the viewport.\n  function updateExternalMeasurement(cm, line) {\n    line = visualLine(line);\n    var lineN = lineNo(line);\n    var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n    view.lineN = lineN;\n    var built = view.built = buildLineContent(cm, view);\n    view.text = built.pre;\n    removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n    return view;\n  }\n\n  // Get a {top, bottom, left, right} box (in line-local coordinates)\n  // for a given character.\n  function measureChar(cm, line, ch, bias) {\n    return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);\n  }\n\n  // Find a line view that corresponds to the given line number.\n  function findViewForLine(cm, lineN) {\n    if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n      return cm.display.view[findViewIndex(cm, lineN)];\n    var ext = cm.display.externalMeasured;\n    if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n      return ext;\n  }\n\n  // Measurement can be split in two steps, the set-up work that\n  // applies to the whole line, and the measurement of the actual\n  // character. Functions like coordsChar, that need to do a lot of\n  // measurements in a row, can thus ensure that the set-up work is\n  // only done once.\n  function prepareMeasureForLine(cm, line) {\n    var lineN = lineNo(line);\n    var view = findViewForLine(cm, lineN);\n    if (view && !view.text) {\n      view = null;\n    } else if (view && view.changes) {\n      updateLineForChanges(cm, view, lineN, getDimensions(cm));\n      cm.curOp.forceUpdate = true;\n    }\n    if (!view)\n      view = updateExternalMeasurement(cm, line);\n\n    var info = mapFromLineView(view, line, lineN);\n    return {\n      line: line, view: view, rect: null,\n      map: info.map, cache: info.cache, before: info.before,\n      hasHeights: false\n    };\n  }\n\n  // Given a prepared measurement object, measures the position of an\n  // actual character (or fetches it from the cache).\n  function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n    if (prepared.before) ch = -1;\n    var key = ch + (bias || \"\"), found;\n    if (prepared.cache.hasOwnProperty(key)) {\n      found = prepared.cache[key];\n    } else {\n      if (!prepared.rect)\n        prepared.rect = prepared.view.text.getBoundingClientRect();\n      if (!prepared.hasHeights) {\n        ensureLineHeights(cm, prepared.view, prepared.rect);\n        prepared.hasHeights = true;\n      }\n      found = measureCharInner(cm, prepared, ch, bias);\n      if (!found.bogus) prepared.cache[key] = found;\n    }\n    return {left: found.left, right: found.right,\n            top: varHeight ? found.rtop : found.top,\n            bottom: varHeight ? found.rbottom : found.bottom};\n  }\n\n  var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n  function nodeAndOffsetInLineMap(map, ch, bias) {\n    var node, start, end, collapse;\n    // First, search the line map for the text node corresponding to,\n    // or closest to, the target character.\n    for (var i = 0; i < map.length; i += 3) {\n      var mStart = map[i], mEnd = map[i + 1];\n      if (ch < mStart) {\n        start = 0; end = 1;\n        collapse = \"left\";\n      } else if (ch < mEnd) {\n        start = ch - mStart;\n        end = start + 1;\n      } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n        end = mEnd - mStart;\n        start = end - 1;\n        if (ch >= mEnd) collapse = \"right\";\n      }\n      if (start != null) {\n        node = map[i + 2];\n        if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n          collapse = bias;\n        if (bias == \"left\" && start == 0)\n          while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n            node = map[(i -= 3) + 2];\n            collapse = \"left\";\n          }\n        if (bias == \"right\" && start == mEnd - mStart)\n          while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n            node = map[(i += 3) + 2];\n            collapse = \"right\";\n          }\n        break;\n      }\n    }\n    return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd};\n  }\n\n  function measureCharInner(cm, prepared, ch, bias) {\n    var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n    var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n    var rect;\n    if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n      for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n        while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start;\n        while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end;\n        if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) {\n          rect = node.parentNode.getBoundingClientRect();\n        } else if (ie && cm.options.lineWrapping) {\n          var rects = range(node, start, end).getClientRects();\n          if (rects.length)\n            rect = rects[bias == \"right\" ? rects.length - 1 : 0];\n          else\n            rect = nullRect;\n        } else {\n          rect = range(node, start, end).getBoundingClientRect() || nullRect;\n        }\n        if (rect.left || rect.right || start == 0) break;\n        end = start;\n        start = start - 1;\n        collapse = \"right\";\n      }\n      if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect);\n    } else { // If it is a widget, simply get the box for the whole widget.\n      if (start > 0) collapse = bias = \"right\";\n      var rects;\n      if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n        rect = rects[bias == \"right\" ? rects.length - 1 : 0];\n      else\n        rect = node.getBoundingClientRect();\n    }\n    if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n      var rSpan = node.parentNode.getClientRects()[0];\n      if (rSpan)\n        rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom};\n      else\n        rect = nullRect;\n    }\n\n    var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n    var mid = (rtop + rbot) / 2;\n    var heights = prepared.view.measure.heights;\n    for (var i = 0; i < heights.length - 1; i++)\n      if (mid < heights[i]) break;\n    var top = i ? heights[i - 1] : 0, bot = heights[i];\n    var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n                  right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n                  top: top, bottom: bot};\n    if (!rect.left && !rect.right) result.bogus = true;\n    if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n    return result;\n  }\n\n  // Work around problem with bounding client rects on ranges being\n  // returned incorrectly when zoomed on IE10 and below.\n  function maybeUpdateRectForZooming(measure, rect) {\n    if (!window.screen || screen.logicalXDPI == null ||\n        screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n      return rect;\n    var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n    var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n    return {left: rect.left * scaleX, right: rect.right * scaleX,\n            top: rect.top * scaleY, bottom: rect.bottom * scaleY};\n  }\n\n  function clearLineMeasurementCacheFor(lineView) {\n    if (lineView.measure) {\n      lineView.measure.cache = {};\n      lineView.measure.heights = null;\n      if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n        lineView.measure.caches[i] = {};\n    }\n  }\n\n  function clearLineMeasurementCache(cm) {\n    cm.display.externalMeasure = null;\n    removeChildren(cm.display.lineMeasure);\n    for (var i = 0; i < cm.display.view.length; i++)\n      clearLineMeasurementCacheFor(cm.display.view[i]);\n  }\n\n  function clearCaches(cm) {\n    clearLineMeasurementCache(cm);\n    cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n    if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;\n    cm.display.lineNumChars = null;\n  }\n\n  function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }\n  function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }\n\n  // Converts a {top, bottom, left, right} box from line-local\n  // coordinates into another coordinate system. Context may be one of\n  // \"line\", \"div\" (display.lineDiv), \"local\"/null (editor), \"window\",\n  // or \"page\".\n  function intoCoordSystem(cm, lineObj, rect, context) {\n    if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n      var size = widgetHeight(lineObj.widgets[i]);\n      rect.top += size; rect.bottom += size;\n    }\n    if (context == \"line\") return rect;\n    if (!context) context = \"local\";\n    var yOff = heightAtLine(lineObj);\n    if (context == \"local\") yOff += paddingTop(cm.display);\n    else yOff -= cm.display.viewOffset;\n    if (context == \"page\" || context == \"window\") {\n      var lOff = cm.display.lineSpace.getBoundingClientRect();\n      yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n      var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n      rect.left += xOff; rect.right += xOff;\n    }\n    rect.top += yOff; rect.bottom += yOff;\n    return rect;\n  }\n\n  // Coverts a box from \"div\" coords to another coordinate system.\n  // Context may be \"window\", \"page\", \"div\", or \"local\"/null.\n  function fromCoordSystem(cm, coords, context) {\n    if (context == \"div\") return coords;\n    var left = coords.left, top = coords.top;\n    // First move into \"page\" coordinate system\n    if (context == \"page\") {\n      left -= pageScrollX();\n      top -= pageScrollY();\n    } else if (context == \"local\" || !context) {\n      var localBox = cm.display.sizer.getBoundingClientRect();\n      left += localBox.left;\n      top += localBox.top;\n    }\n\n    var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n    return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n  }\n\n  function charCoords(cm, pos, context, lineObj, bias) {\n    if (!lineObj) lineObj = getLine(cm.doc, pos.line);\n    return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context);\n  }\n\n  // Returns a box for a given cursor position, which may have an\n  // 'other' property containing the position of the secondary cursor\n  // on a bidi boundary.\n  function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n    lineObj = lineObj || getLine(cm.doc, pos.line);\n    if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n    function get(ch, right) {\n      var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n      if (right) m.left = m.right; else m.right = m.left;\n      return intoCoordSystem(cm, lineObj, m, context);\n    }\n    function getBidi(ch, partPos) {\n      var part = order[partPos], right = part.level % 2;\n      if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n        part = order[--partPos];\n        ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n        right = true;\n      } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n        part = order[++partPos];\n        ch = bidiLeft(part) - part.level % 2;\n        right = false;\n      }\n      if (right && ch == part.to && ch > part.from) return get(ch - 1);\n      return get(ch, right);\n    }\n    var order = getOrder(lineObj), ch = pos.ch;\n    if (!order) return get(ch);\n    var partPos = getBidiPartAt(order, ch);\n    var val = getBidi(ch, partPos);\n    if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n    return val;\n  }\n\n  // Used to cheaply estimate the coordinates for a position. Used for\n  // intermediate scroll updates.\n  function estimateCoords(cm, pos) {\n    var left = 0, pos = clipPos(cm.doc, pos);\n    if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n    var lineObj = getLine(cm.doc, pos.line);\n    var top = heightAtLine(lineObj) + paddingTop(cm.display);\n    return {left: left, right: left, top: top, bottom: top + lineObj.height};\n  }\n\n  // Positions returned by coordsChar contain some extra information.\n  // xRel is the relative x position of the input coordinates compared\n  // to the found position (so xRel > 0 means the coordinates are to\n  // the right of the character position, for example). When outside\n  // is true, that means the coordinates lie outside the line's\n  // vertical range.\n  function PosWithInfo(line, ch, outside, xRel) {\n    var pos = Pos(line, ch);\n    pos.xRel = xRel;\n    if (outside) pos.outside = true;\n    return pos;\n  }\n\n  // Compute the character position closest to the given coordinates.\n  // Input must be lineSpace-local (\"div\" coordinate system).\n  function coordsChar(cm, x, y) {\n    var doc = cm.doc;\n    y += cm.display.viewOffset;\n    if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n    var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n    if (lineN > last)\n      return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n    if (x < 0) x = 0;\n\n    var lineObj = getLine(doc, lineN);\n    for (;;) {\n      var found = coordsCharInner(cm, lineObj, lineN, x, y);\n      var merged = collapsedSpanAtEnd(lineObj);\n      var mergedPos = merged && merged.find(0, true);\n      if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n        lineN = lineNo(lineObj = mergedPos.to.line);\n      else\n        return found;\n    }\n  }\n\n  function coordsCharInner(cm, lineObj, lineNo, x, y) {\n    var innerOff = y - heightAtLine(lineObj);\n    var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;\n    var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n\n    function getX(ch) {\n      var sp = cursorCoords(cm, Pos(lineNo, ch), \"line\", lineObj, preparedMeasure);\n      wrongLine = true;\n      if (innerOff > sp.bottom) return sp.left - adjust;\n      else if (innerOff < sp.top) return sp.left + adjust;\n      else wrongLine = false;\n      return sp.left;\n    }\n\n    var bidi = getOrder(lineObj), dist = lineObj.text.length;\n    var from = lineLeft(lineObj), to = lineRight(lineObj);\n    var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;\n\n    if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);\n    // Do a binary search between these bounds.\n    for (;;) {\n      if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {\n        var ch = x < fromX || x - fromX <= toX - x ? from : to;\n        var xDiff = x - (ch == from ? fromX : toX);\n        while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;\n        var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,\n                              xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);\n        return pos;\n      }\n      var step = Math.ceil(dist / 2), middle = from + step;\n      if (bidi) {\n        middle = from;\n        for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);\n      }\n      var middleX = getX(middle);\n      if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}\n      else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}\n    }\n  }\n\n  var measureText;\n  // Compute the default text height.\n  function textHeight(display) {\n    if (display.cachedTextHeight != null) return display.cachedTextHeight;\n    if (measureText == null) {\n      measureText = elt(\"pre\");\n      // Measure a bunch of lines, for browsers that compute\n      // fractional heights.\n      for (var i = 0; i < 49; ++i) {\n        measureText.appendChild(document.createTextNode(\"x\"));\n        measureText.appendChild(elt(\"br\"));\n      }\n      measureText.appendChild(document.createTextNode(\"x\"));\n    }\n    removeChildrenAndAdd(display.measure, measureText);\n    var height = measureText.offsetHeight / 50;\n    if (height > 3) display.cachedTextHeight = height;\n    removeChildren(display.measure);\n    return height || 1;\n  }\n\n  // Compute the default character width.\n  function charWidth(display) {\n    if (display.cachedCharWidth != null) return display.cachedCharWidth;\n    var anchor = elt(\"span\", \"xxxxxxxxxx\");\n    var pre = elt(\"pre\", [anchor]);\n    removeChildrenAndAdd(display.measure, pre);\n    var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n    if (width > 2) display.cachedCharWidth = width;\n    return width || 10;\n  }\n\n  // OPERATIONS\n\n  // Operations are used to wrap a series of changes to the editor\n  // state in such a way that each change won't have to update the\n  // cursor and display (which would be awkward, slow, and\n  // error-prone). Instead, display updates are batched and then all\n  // combined and executed at once.\n\n  var operationGroup = null;\n\n  var nextOpId = 0;\n  // Start a new operation.\n  function startOperation(cm) {\n    cm.curOp = {\n      cm: cm,\n      viewChanged: false,      // Flag that indicates that lines might need to be redrawn\n      startHeight: cm.doc.height, // Used to detect need to update scrollbar\n      forceUpdate: false,      // Used to force a redraw\n      updateInput: null,       // Whether to reset the input textarea\n      typing: false,           // Whether this reset should be careful to leave existing text (for compositing)\n      changeObjs: null,        // Accumulated changes, for firing change events\n      cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n      cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n      selectionChanged: false, // Whether the selection needs to be redrawn\n      updateMaxLine: false,    // Set when the widest line needs to be determined anew\n      scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n      scrollToPos: null,       // Used to scroll to a specific position\n      focus: false,\n      id: ++nextOpId           // Unique ID\n    };\n    if (operationGroup) {\n      operationGroup.ops.push(cm.curOp);\n    } else {\n      cm.curOp.ownsGroup = operationGroup = {\n        ops: [cm.curOp],\n        delayedCallbacks: []\n      };\n    }\n  }\n\n  function fireCallbacksForOps(group) {\n    // Calls delayed callbacks and cursorActivity handlers until no\n    // new ones appear\n    var callbacks = group.delayedCallbacks, i = 0;\n    do {\n      for (; i < callbacks.length; i++)\n        callbacks[i].call(null);\n      for (var j = 0; j < group.ops.length; j++) {\n        var op = group.ops[j];\n        if (op.cursorActivityHandlers)\n          while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n            op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);\n      }\n    } while (i < callbacks.length);\n  }\n\n  // Finish an operation, updating the display and signalling delayed events\n  function endOperation(cm) {\n    var op = cm.curOp, group = op.ownsGroup;\n    if (!group) return;\n\n    try { fireCallbacksForOps(group); }\n    finally {\n      operationGroup = null;\n      for (var i = 0; i < group.ops.length; i++)\n        group.ops[i].cm.curOp = null;\n      endOperations(group);\n    }\n  }\n\n  // The DOM updates done when an operation finishes are batched so\n  // that the minimum number of relayouts are required.\n  function endOperations(group) {\n    var ops = group.ops;\n    for (var i = 0; i < ops.length; i++) // Read DOM\n      endOperation_R1(ops[i]);\n    for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n      endOperation_W1(ops[i]);\n    for (var i = 0; i < ops.length; i++) // Read DOM\n      endOperation_R2(ops[i]);\n    for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n      endOperation_W2(ops[i]);\n    for (var i = 0; i < ops.length; i++) // Read DOM\n      endOperation_finish(ops[i]);\n  }\n\n  function endOperation_R1(op) {\n    var cm = op.cm, display = cm.display;\n    maybeClipScrollbars(cm);\n    if (op.updateMaxLine) findMaxLine(cm);\n\n    op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n      op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n                         op.scrollToPos.to.line >= display.viewTo) ||\n      display.maxLineChanged && cm.options.lineWrapping;\n    op.update = op.mustUpdate &&\n      new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n  }\n\n  function endOperation_W1(op) {\n    op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n  }\n\n  function endOperation_R2(op) {\n    var cm = op.cm, display = cm.display;\n    if (op.updatedDisplay) updateHeightsInViewport(cm);\n\n    op.barMeasure = measureForScrollbars(cm);\n\n    // If the max line changed since it was last measured, measure it,\n    // and ensure the document's width matches it.\n    // updateDisplay_W2 will use these properties to do the actual resizing\n    if (display.maxLineChanged && !cm.options.lineWrapping) {\n      op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n      cm.display.sizerWidth = op.adjustWidthTo;\n      op.barMeasure.scrollWidth =\n        Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n      op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n    }\n\n    if (op.updatedDisplay || op.selectionChanged)\n      op.preparedSelection = display.input.prepareSelection(op.focus);\n  }\n\n  function endOperation_W2(op) {\n    var cm = op.cm;\n\n    if (op.adjustWidthTo != null) {\n      cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n      if (op.maxScrollLeft < cm.doc.scrollLeft)\n        setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true);\n      cm.display.maxLineChanged = false;\n    }\n\n    var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus())\n    if (op.preparedSelection)\n      cm.display.input.showSelection(op.preparedSelection, takeFocus);\n    if (op.updatedDisplay || op.startHeight != cm.doc.height)\n      updateScrollbars(cm, op.barMeasure);\n    if (op.updatedDisplay)\n      setDocumentHeight(cm, op.barMeasure);\n\n    if (op.selectionChanged) restartBlink(cm);\n\n    if (cm.state.focused && op.updateInput)\n      cm.display.input.reset(op.typing);\n    if (takeFocus) ensureFocus(op.cm);\n  }\n\n  function endOperation_finish(op) {\n    var cm = op.cm, display = cm.display, doc = cm.doc;\n\n    if (op.updatedDisplay) postUpdateDisplay(cm, op.update);\n\n    // Abort mouse wheel delta measurement, when scrolling explicitly\n    if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n      display.wheelStartX = display.wheelStartY = null;\n\n    // Propagate the scroll position to the actual DOM scroller\n    if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {\n      doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));\n      display.scrollbars.setScrollTop(doc.scrollTop);\n      display.scroller.scrollTop = doc.scrollTop;\n    }\n    if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {\n      doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));\n      display.scrollbars.setScrollLeft(doc.scrollLeft);\n      display.scroller.scrollLeft = doc.scrollLeft;\n      alignHorizontally(cm);\n    }\n    // If we need to scroll a specific position into view, do so.\n    if (op.scrollToPos) {\n      var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n                                     clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n      if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);\n    }\n\n    // Fire events for markers that are hidden/unidden by editing or\n    // undoing\n    var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n    if (hidden) for (var i = 0; i < hidden.length; ++i)\n      if (!hidden[i].lines.length) signal(hidden[i], \"hide\");\n    if (unhidden) for (var i = 0; i < unhidden.length; ++i)\n      if (unhidden[i].lines.length) signal(unhidden[i], \"unhide\");\n\n    if (display.wrapper.offsetHeight)\n      doc.scrollTop = cm.display.scroller.scrollTop;\n\n    // Fire change events, and delayed event handlers\n    if (op.changeObjs)\n      signal(cm, \"changes\", cm, op.changeObjs);\n    if (op.update)\n      op.update.finish();\n  }\n\n  // Run the given function in an operation\n  function runInOp(cm, f) {\n    if (cm.curOp) return f();\n    startOperation(cm);\n    try { return f(); }\n    finally { endOperation(cm); }\n  }\n  // Wraps a function in an operation. Returns the wrapped function.\n  function operation(cm, f) {\n    return function() {\n      if (cm.curOp) return f.apply(cm, arguments);\n      startOperation(cm);\n      try { return f.apply(cm, arguments); }\n      finally { endOperation(cm); }\n    };\n  }\n  // Used to add methods to editor and doc instances, wrapping them in\n  // operations.\n  function methodOp(f) {\n    return function() {\n      if (this.curOp) return f.apply(this, arguments);\n      startOperation(this);\n      try { return f.apply(this, arguments); }\n      finally { endOperation(this); }\n    };\n  }\n  function docMethodOp(f) {\n    return function() {\n      var cm = this.cm;\n      if (!cm || cm.curOp) return f.apply(this, arguments);\n      startOperation(cm);\n      try { return f.apply(this, arguments); }\n      finally { endOperation(cm); }\n    };\n  }\n\n  // VIEW TRACKING\n\n  // These objects are used to represent the visible (currently drawn)\n  // part of the document. A LineView may correspond to multiple\n  // logical lines, if those are connected by collapsed ranges.\n  function LineView(doc, line, lineN) {\n    // The starting line\n    this.line = line;\n    // Continuing lines, if any\n    this.rest = visualLineContinued(line);\n    // Number of logical lines in this visual line\n    this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n    this.node = this.text = null;\n    this.hidden = lineIsHidden(doc, line);\n  }\n\n  // Create a range of LineView objects for the given lines.\n  function buildViewArray(cm, from, to) {\n    var array = [], nextPos;\n    for (var pos = from; pos < to; pos = nextPos) {\n      var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n      nextPos = pos + view.size;\n      array.push(view);\n    }\n    return array;\n  }\n\n  // Updates the display.view data structure for a given change to the\n  // document. From and to are in pre-change coordinates. Lendiff is\n  // the amount of lines added or subtracted by the change. This is\n  // used for changes that span multiple lines, or change the way\n  // lines are divided into visual lines. regLineChange (below)\n  // registers single-line changes.\n  function regChange(cm, from, to, lendiff) {\n    if (from == null) from = cm.doc.first;\n    if (to == null) to = cm.doc.first + cm.doc.size;\n    if (!lendiff) lendiff = 0;\n\n    var display = cm.display;\n    if (lendiff && to < display.viewTo &&\n        (display.updateLineNumbers == null || display.updateLineNumbers > from))\n      display.updateLineNumbers = from;\n\n    cm.curOp.viewChanged = true;\n\n    if (from >= display.viewTo) { // Change after\n      if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n        resetView(cm);\n    } else if (to <= display.viewFrom) { // Change before\n      if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n        resetView(cm);\n      } else {\n        display.viewFrom += lendiff;\n        display.viewTo += lendiff;\n      }\n    } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n      resetView(cm);\n    } else if (from <= display.viewFrom) { // Top overlap\n      var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n      if (cut) {\n        display.view = display.view.slice(cut.index);\n        display.viewFrom = cut.lineN;\n        display.viewTo += lendiff;\n      } else {\n        resetView(cm);\n      }\n    } else if (to >= display.viewTo) { // Bottom overlap\n      var cut = viewCuttingPoint(cm, from, from, -1);\n      if (cut) {\n        display.view = display.view.slice(0, cut.index);\n        display.viewTo = cut.lineN;\n      } else {\n        resetView(cm);\n      }\n    } else { // Gap in the middle\n      var cutTop = viewCuttingPoint(cm, from, from, -1);\n      var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n      if (cutTop && cutBot) {\n        display.view = display.view.slice(0, cutTop.index)\n          .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n          .concat(display.view.slice(cutBot.index));\n        display.viewTo += lendiff;\n      } else {\n        resetView(cm);\n      }\n    }\n\n    var ext = display.externalMeasured;\n    if (ext) {\n      if (to < ext.lineN)\n        ext.lineN += lendiff;\n      else if (from < ext.lineN + ext.size)\n        display.externalMeasured = null;\n    }\n  }\n\n  // Register a change to a single line. Type must be one of \"text\",\n  // \"gutter\", \"class\", \"widget\"\n  function regLineChange(cm, line, type) {\n    cm.curOp.viewChanged = true;\n    var display = cm.display, ext = cm.display.externalMeasured;\n    if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n      display.externalMeasured = null;\n\n    if (line < display.viewFrom || line >= display.viewTo) return;\n    var lineView = display.view[findViewIndex(cm, line)];\n    if (lineView.node == null) return;\n    var arr = lineView.changes || (lineView.changes = []);\n    if (indexOf(arr, type) == -1) arr.push(type);\n  }\n\n  // Clear the view.\n  function resetView(cm) {\n    cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n    cm.display.view = [];\n    cm.display.viewOffset = 0;\n  }\n\n  // Find the view element corresponding to a given line. Return null\n  // when the line isn't visible.\n  function findViewIndex(cm, n) {\n    if (n >= cm.display.viewTo) return null;\n    n -= cm.display.viewFrom;\n    if (n < 0) return null;\n    var view = cm.display.view;\n    for (var i = 0; i < view.length; i++) {\n      n -= view[i].size;\n      if (n < 0) return i;\n    }\n  }\n\n  function viewCuttingPoint(cm, oldN, newN, dir) {\n    var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n    if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n      return {index: index, lineN: newN};\n    for (var i = 0, n = cm.display.viewFrom; i < index; i++)\n      n += view[i].size;\n    if (n != oldN) {\n      if (dir > 0) {\n        if (index == view.length - 1) return null;\n        diff = (n + view[index].size) - oldN;\n        index++;\n      } else {\n        diff = n - oldN;\n      }\n      oldN += diff; newN += diff;\n    }\n    while (visualLineNo(cm.doc, newN) != newN) {\n      if (index == (dir < 0 ? 0 : view.length - 1)) return null;\n      newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n      index += dir;\n    }\n    return {index: index, lineN: newN};\n  }\n\n  // Force the view to cover a given range, adding empty view element\n  // or clipping off existing ones as needed.\n  function adjustView(cm, from, to) {\n    var display = cm.display, view = display.view;\n    if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n      display.view = buildViewArray(cm, from, to);\n      display.viewFrom = from;\n    } else {\n      if (display.viewFrom > from)\n        display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n      else if (display.viewFrom < from)\n        display.view = display.view.slice(findViewIndex(cm, from));\n      display.viewFrom = from;\n      if (display.viewTo < to)\n        display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n      else if (display.viewTo > to)\n        display.view = display.view.slice(0, findViewIndex(cm, to));\n    }\n    display.viewTo = to;\n  }\n\n  // Count the number of lines in the view whose DOM representation is\n  // out of date (or nonexistent).\n  function countDirtyView(cm) {\n    var view = cm.display.view, dirty = 0;\n    for (var i = 0; i < view.length; i++) {\n      var lineView = view[i];\n      if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n    }\n    return dirty;\n  }\n\n  // EVENT HANDLERS\n\n  // Attach the necessary event handlers when initializing the editor\n  function registerEventHandlers(cm) {\n    var d = cm.display;\n    on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n    // Older IE's will not fire a second mousedown for a double click\n    if (ie && ie_version < 11)\n      on(d.scroller, \"dblclick\", operation(cm, function(e) {\n        if (signalDOMEvent(cm, e)) return;\n        var pos = posFromMouse(cm, e);\n        if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n        e_preventDefault(e);\n        var word = cm.findWordAt(pos);\n        extendSelection(cm.doc, word.anchor, word.head);\n      }));\n    else\n      on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n    // Some browsers fire contextmenu *after* opening the menu, at\n    // which point we can't mess with it anymore. Context menu is\n    // handled in onMouseDown for these browsers.\n    if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n    // Used to suppress mouse event handling when a touch happens\n    var touchFinished, prevTouch = {end: 0};\n    function finishTouch() {\n      if (d.activeTouch) {\n        touchFinished = setTimeout(function() {d.activeTouch = null;}, 1000);\n        prevTouch = d.activeTouch;\n        prevTouch.end = +new Date;\n      }\n    };\n    function isMouseLikeTouchEvent(e) {\n      if (e.touches.length != 1) return false;\n      var touch = e.touches[0];\n      return touch.radiusX <= 1 && touch.radiusY <= 1;\n    }\n    function farAway(touch, other) {\n      if (other.left == null) return true;\n      var dx = other.left - touch.left, dy = other.top - touch.top;\n      return dx * dx + dy * dy > 20 * 20;\n    }\n    on(d.scroller, \"touchstart\", function(e) {\n      if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {\n        clearTimeout(touchFinished);\n        var now = +new Date;\n        d.activeTouch = {start: now, moved: false,\n                         prev: now - prevTouch.end <= 300 ? prevTouch : null};\n        if (e.touches.length == 1) {\n          d.activeTouch.left = e.touches[0].pageX;\n          d.activeTouch.top = e.touches[0].pageY;\n        }\n      }\n    });\n    on(d.scroller, \"touchmove\", function() {\n      if (d.activeTouch) d.activeTouch.moved = true;\n    });\n    on(d.scroller, \"touchend\", function(e) {\n      var touch = d.activeTouch;\n      if (touch && !eventInWidget(d, e) && touch.left != null &&\n          !touch.moved && new Date - touch.start < 300) {\n        var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n        if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n          range = new Range(pos, pos);\n        else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n          range = cm.findWordAt(pos);\n        else // Triple tap\n          range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)));\n        cm.setSelection(range.anchor, range.head);\n        cm.focus();\n        e_preventDefault(e);\n      }\n      finishTouch();\n    });\n    on(d.scroller, \"touchcancel\", finishTouch);\n\n    // Sync scrolling between fake scrollbars and real scrollable\n    // area, ensure viewport is updated when scrolling.\n    on(d.scroller, \"scroll\", function() {\n      if (d.scroller.clientHeight) {\n        setScrollTop(cm, d.scroller.scrollTop);\n        setScrollLeft(cm, d.scroller.scrollLeft, true);\n        signal(cm, \"scroll\", cm);\n      }\n    });\n\n    // Listen to wheel events in order to try and update the viewport on time.\n    on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n    on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n    // Prevent wrapper from ever scrolling\n    on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n    d.dragFunctions = {\n      enter: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);},\n      over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n      start: function(e){onDragStart(cm, e);},\n      drop: operation(cm, onDrop),\n      leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n    };\n\n    var inp = d.input.getField();\n    on(inp, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n    on(inp, \"keydown\", operation(cm, onKeyDown));\n    on(inp, \"keypress\", operation(cm, onKeyPress));\n    on(inp, \"focus\", bind(onFocus, cm));\n    on(inp, \"blur\", bind(onBlur, cm));\n  }\n\n  function dragDropChanged(cm, value, old) {\n    var wasOn = old && old != CodeMirror.Init;\n    if (!value != !wasOn) {\n      var funcs = cm.display.dragFunctions;\n      var toggle = value ? on : off;\n      toggle(cm.display.scroller, \"dragstart\", funcs.start);\n      toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n      toggle(cm.display.scroller, \"dragover\", funcs.over);\n      toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n      toggle(cm.display.scroller, \"drop\", funcs.drop);\n    }\n  }\n\n  // Called when the window resizes\n  function onResize(cm) {\n    var d = cm.display;\n    if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n      return;\n    // Might be a text scaling operation, clear size caches.\n    d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n    d.scrollbarsClipped = false;\n    cm.setSize();\n  }\n\n  // MOUSE EVENTS\n\n  // Return true when the given mouse event happened in a widget\n  function eventInWidget(display, e) {\n    for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n      if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n          (n.parentNode == display.sizer && n != display.mover))\n        return true;\n    }\n  }\n\n  // Given a mouse event, find the corresponding position. If liberal\n  // is false, it checks whether a gutter or scrollbar was clicked,\n  // and returns null if it was. forRect is used by rectangular\n  // selections, and tries to estimate a character position even for\n  // coordinates beyond the right of the text.\n  function posFromMouse(cm, e, liberal, forRect) {\n    var display = cm.display;\n    if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n    var x, y, space = display.lineSpace.getBoundingClientRect();\n    // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n    try { x = e.clientX - space.left; y = e.clientY - space.top; }\n    catch (e) { return null; }\n    var coords = coordsChar(cm, x, y), line;\n    if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n      var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n      coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n    }\n    return coords;\n  }\n\n  // A mouse down can be a single click, double click, triple click,\n  // start of selection drag, start of text drag, new cursor\n  // (ctrl-click), rectangle drag (alt-drag), or xwin\n  // middle-click-paste. Or it might be a click on something we should\n  // not interfere with, such as a scrollbar or widget.\n  function onMouseDown(e) {\n    var cm = this, display = cm.display;\n    if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;\n    display.shift = e.shiftKey;\n\n    if (eventInWidget(display, e)) {\n      if (!webkit) {\n        // Briefly turn off draggability, to allow widgets to do\n        // normal dragging things.\n        display.scroller.draggable = false;\n        setTimeout(function(){display.scroller.draggable = true;}, 100);\n      }\n      return;\n    }\n    if (clickInGutter(cm, e)) return;\n    var start = posFromMouse(cm, e);\n    window.focus();\n\n    switch (e_button(e)) {\n    case 1:\n      // #3261: make sure, that we're not starting a second selection\n      if (cm.state.selectingText)\n        cm.state.selectingText(e);\n      else if (start)\n        leftButtonDown(cm, e, start);\n      else if (e_target(e) == display.scroller)\n        e_preventDefault(e);\n      break;\n    case 2:\n      if (webkit) cm.state.lastMiddleDown = +new Date;\n      if (start) extendSelection(cm.doc, start);\n      setTimeout(function() {display.input.focus();}, 20);\n      e_preventDefault(e);\n      break;\n    case 3:\n      if (captureRightClick) onContextMenu(cm, e);\n      else delayBlurEvent(cm);\n      break;\n    }\n  }\n\n  var lastClick, lastDoubleClick;\n  function leftButtonDown(cm, e, start) {\n    if (ie) setTimeout(bind(ensureFocus, cm), 0);\n    else cm.curOp.focus = activeElt();\n\n    var now = +new Date, type;\n    if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {\n      type = \"triple\";\n    } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {\n      type = \"double\";\n      lastDoubleClick = {time: now, pos: start};\n    } else {\n      type = \"single\";\n      lastClick = {time: now, pos: start};\n    }\n\n    var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;\n    if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n        type == \"single\" && (contained = sel.contains(start)) > -1 &&\n        (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&\n        (cmp(contained.to(), start) > 0 || start.xRel < 0))\n      leftButtonStartDrag(cm, e, start, modifier);\n    else\n      leftButtonSelect(cm, e, start, type, modifier);\n  }\n\n  // Start a text drag. When it ends, see if any dragging actually\n  // happen, and treat as a click if it didn't.\n  function leftButtonStartDrag(cm, e, start, modifier) {\n    var display = cm.display, startTime = +new Date;\n    var dragEnd = operation(cm, function(e2) {\n      if (webkit) display.scroller.draggable = false;\n      cm.state.draggingText = false;\n      off(document, \"mouseup\", dragEnd);\n      off(display.scroller, \"drop\", dragEnd);\n      if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n        e_preventDefault(e2);\n        if (!modifier && +new Date - 200 < startTime)\n          extendSelection(cm.doc, start);\n        // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n        if (webkit || ie && ie_version == 9)\n          setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n        else\n          display.input.focus();\n      }\n    });\n    // Let the drag handler handle this.\n    if (webkit) display.scroller.draggable = true;\n    cm.state.draggingText = dragEnd;\n    // IE's approach to draggable\n    if (display.scroller.dragDrop) display.scroller.dragDrop();\n    on(document, \"mouseup\", dragEnd);\n    on(display.scroller, \"drop\", dragEnd);\n  }\n\n  // Normal selection, as opposed to text dragging.\n  function leftButtonSelect(cm, e, start, type, addNew) {\n    var display = cm.display, doc = cm.doc;\n    e_preventDefault(e);\n\n    var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n    if (addNew && !e.shiftKey) {\n      ourIndex = doc.sel.contains(start);\n      if (ourIndex > -1)\n        ourRange = ranges[ourIndex];\n      else\n        ourRange = new Range(start, start);\n    } else {\n      ourRange = doc.sel.primary();\n      ourIndex = doc.sel.primIndex;\n    }\n\n    if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n      type = \"rect\";\n      if (!addNew) ourRange = new Range(start, start);\n      start = posFromMouse(cm, e, true, true);\n      ourIndex = -1;\n    } else if (type == \"double\") {\n      var word = cm.findWordAt(start);\n      if (cm.display.shift || doc.extend)\n        ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n      else\n        ourRange = word;\n    } else if (type == \"triple\") {\n      var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n      if (cm.display.shift || doc.extend)\n        ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n      else\n        ourRange = line;\n    } else {\n      ourRange = extendRange(doc, ourRange, start);\n    }\n\n    if (!addNew) {\n      ourIndex = 0;\n      setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n      startSel = doc.sel;\n    } else if (ourIndex == -1) {\n      ourIndex = ranges.length;\n      setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n                   {scroll: false, origin: \"*mouse\"});\n    } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n      setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n                   {scroll: false, origin: \"*mouse\"});\n      startSel = doc.sel;\n    } else {\n      replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n    }\n\n    var lastPos = start;\n    function extendTo(pos) {\n      if (cmp(lastPos, pos) == 0) return;\n      lastPos = pos;\n\n      if (type == \"rect\") {\n        var ranges = [], tabSize = cm.options.tabSize;\n        var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n        var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n        var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n        for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n             line <= end; line++) {\n          var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n          if (left == right)\n            ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n          else if (text.length > leftPos)\n            ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n        }\n        if (!ranges.length) ranges.push(new Range(start, start));\n        setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n                     {origin: \"*mouse\", scroll: false});\n        cm.scrollIntoView(pos);\n      } else {\n        var oldRange = ourRange;\n        var anchor = oldRange.anchor, head = pos;\n        if (type != \"single\") {\n          if (type == \"double\")\n            var range = cm.findWordAt(pos);\n          else\n            var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n          if (cmp(range.anchor, anchor) > 0) {\n            head = range.head;\n            anchor = minPos(oldRange.from(), range.anchor);\n          } else {\n            head = range.anchor;\n            anchor = maxPos(oldRange.to(), range.head);\n          }\n        }\n        var ranges = startSel.ranges.slice(0);\n        ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n        setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n      }\n    }\n\n    var editorSize = display.wrapper.getBoundingClientRect();\n    // Used to ensure timeout re-tries don't fire when another extend\n    // happened in the meantime (clearTimeout isn't reliable -- at\n    // least on Chrome, the timeouts still happen even when cleared,\n    // if the clear happens after their scheduled firing time).\n    var counter = 0;\n\n    function extend(e) {\n      var curCount = ++counter;\n      var cur = posFromMouse(cm, e, true, type == \"rect\");\n      if (!cur) return;\n      if (cmp(cur, lastPos) != 0) {\n        cm.curOp.focus = activeElt();\n        extendTo(cur);\n        var visible = visibleLines(display, doc);\n        if (cur.line >= visible.to || cur.line < visible.from)\n          setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n      } else {\n        var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n        if (outside) setTimeout(operation(cm, function() {\n          if (counter != curCount) return;\n          display.scroller.scrollTop += outside;\n          extend(e);\n        }), 50);\n      }\n    }\n\n    function done(e) {\n      cm.state.selectingText = false;\n      counter = Infinity;\n      e_preventDefault(e);\n      display.input.focus();\n      off(document, \"mousemove\", move);\n      off(document, \"mouseup\", up);\n      doc.history.lastSelOrigin = null;\n    }\n\n    var move = operation(cm, function(e) {\n      if (!e_button(e)) done(e);\n      else extend(e);\n    });\n    var up = operation(cm, done);\n    cm.state.selectingText = up;\n    on(document, \"mousemove\", move);\n    on(document, \"mouseup\", up);\n  }\n\n  // Determines whether an event happened in the gutter, and fires the\n  // handlers for the corresponding event.\n  function gutterEvent(cm, e, type, prevent) {\n    try { var mX = e.clientX, mY = e.clientY; }\n    catch(e) { return false; }\n    if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n    if (prevent) e_preventDefault(e);\n\n    var display = cm.display;\n    var lineBox = display.lineDiv.getBoundingClientRect();\n\n    if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n    mY -= lineBox.top - display.viewOffset;\n\n    for (var i = 0; i < cm.options.gutters.length; ++i) {\n      var g = display.gutters.childNodes[i];\n      if (g && g.getBoundingClientRect().right >= mX) {\n        var line = lineAtHeight(cm.doc, mY);\n        var gutter = cm.options.gutters[i];\n        signal(cm, type, cm, line, gutter, e);\n        return e_defaultPrevented(e);\n      }\n    }\n  }\n\n  function clickInGutter(cm, e) {\n    return gutterEvent(cm, e, \"gutterClick\", true);\n  }\n\n  // Kludge to work around strange IE behavior where it'll sometimes\n  // re-fire a series of drag-related events right after the drop (#1551)\n  var lastDrop = 0;\n\n  function onDrop(e) {\n    var cm = this;\n    clearDragCursor(cm);\n    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n      return;\n    e_preventDefault(e);\n    if (ie) lastDrop = +new Date;\n    var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n    if (!pos || cm.isReadOnly()) return;\n    // Might be a file drop, in which case we simply extract the text\n    // and insert it.\n    if (files && files.length && window.FileReader && window.File) {\n      var n = files.length, text = Array(n), read = 0;\n      var loadFile = function(file, i) {\n        if (cm.options.allowDropFileTypes &&\n            indexOf(cm.options.allowDropFileTypes, file.type) == -1)\n          return;\n\n        var reader = new FileReader;\n        reader.onload = operation(cm, function() {\n          var content = reader.result;\n          if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) content = \"\";\n          text[i] = content;\n          if (++read == n) {\n            pos = clipPos(cm.doc, pos);\n            var change = {from: pos, to: pos,\n                          text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),\n                          origin: \"paste\"};\n            makeChange(cm.doc, change);\n            setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));\n          }\n        });\n        reader.readAsText(file);\n      };\n      for (var i = 0; i < n; ++i) loadFile(files[i], i);\n    } else { // Normal drop\n      // Don't do a replace if the drop happened inside of the selected text.\n      if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n        cm.state.draggingText(e);\n        // Ensure the editor is re-focused\n        setTimeout(function() {cm.display.input.focus();}, 20);\n        return;\n      }\n      try {\n        var text = e.dataTransfer.getData(\"Text\");\n        if (text) {\n          if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))\n            var selected = cm.listSelections();\n          setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n          if (selected) for (var i = 0; i < selected.length; ++i)\n            replaceRange(cm.doc, \"\", selected[i].anchor, selected[i].head, \"drag\");\n          cm.replaceSelection(text, \"around\", \"paste\");\n          cm.display.input.focus();\n        }\n      }\n      catch(e){}\n    }\n  }\n\n  function onDragStart(cm, e) {\n    if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }\n    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;\n\n    e.dataTransfer.setData(\"Text\", cm.getSelection());\n    e.dataTransfer.effectAllowed = \"copyMove\"\n\n    // Use dummy image instead of default browsers image.\n    // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n    if (e.dataTransfer.setDragImage && !safari) {\n      var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n      img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n      if (presto) {\n        img.width = img.height = 1;\n        cm.display.wrapper.appendChild(img);\n        // Force a relayout, or Opera won't use our image for some obscure reason\n        img._top = img.offsetTop;\n      }\n      e.dataTransfer.setDragImage(img, 0, 0);\n      if (presto) img.parentNode.removeChild(img);\n    }\n  }\n\n  function onDragOver(cm, e) {\n    var pos = posFromMouse(cm, e);\n    if (!pos) return;\n    var frag = document.createDocumentFragment();\n    drawSelectionCursor(cm, pos, frag);\n    if (!cm.display.dragCursor) {\n      cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n      cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n    }\n    removeChildrenAndAdd(cm.display.dragCursor, frag);\n  }\n\n  function clearDragCursor(cm) {\n    if (cm.display.dragCursor) {\n      cm.display.lineSpace.removeChild(cm.display.dragCursor);\n      cm.display.dragCursor = null;\n    }\n  }\n\n  // SCROLL EVENTS\n\n  // Sync the scrollable area and scrollbars, ensure the viewport\n  // covers the visible area.\n  function setScrollTop(cm, val) {\n    if (Math.abs(cm.doc.scrollTop - val) < 2) return;\n    cm.doc.scrollTop = val;\n    if (!gecko) updateDisplaySimple(cm, {top: val});\n    if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;\n    cm.display.scrollbars.setScrollTop(val);\n    if (gecko) updateDisplaySimple(cm);\n    startWorker(cm, 100);\n  }\n  // Sync scroller and scrollbar, ensure the gutter elements are\n  // aligned.\n  function setScrollLeft(cm, val, isScroller) {\n    if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;\n    val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);\n    cm.doc.scrollLeft = val;\n    alignHorizontally(cm);\n    if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;\n    cm.display.scrollbars.setScrollLeft(val);\n  }\n\n  // Since the delta values reported on mouse wheel events are\n  // unstandardized between browsers and even browser versions, and\n  // generally horribly unpredictable, this code starts by measuring\n  // the scroll effect that the first few mouse wheel events have,\n  // and, from that, detects the way it can convert deltas to pixel\n  // offsets afterwards.\n  //\n  // The reason we want to know the amount a wheel event will scroll\n  // is that it gives us a chance to update the display before the\n  // actual scrolling happens, reducing flickering.\n\n  var wheelSamples = 0, wheelPixelsPerUnit = null;\n  // Fill in a browser-detected starting value on browsers where we\n  // know one. These don't have to be accurate -- the result of them\n  // being wrong would just be a slight flicker on the first wheel\n  // scroll (if it is large enough).\n  if (ie) wheelPixelsPerUnit = -.53;\n  else if (gecko) wheelPixelsPerUnit = 15;\n  else if (chrome) wheelPixelsPerUnit = -.7;\n  else if (safari) wheelPixelsPerUnit = -1/3;\n\n  var wheelEventDelta = function(e) {\n    var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n    if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;\n    if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;\n    else if (dy == null) dy = e.wheelDelta;\n    return {x: dx, y: dy};\n  };\n  CodeMirror.wheelEventPixels = function(e) {\n    var delta = wheelEventDelta(e);\n    delta.x *= wheelPixelsPerUnit;\n    delta.y *= wheelPixelsPerUnit;\n    return delta;\n  };\n\n  function onScrollWheel(cm, e) {\n    var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n    var display = cm.display, scroll = display.scroller;\n    // Quit if there's nothing to scroll here\n    var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n    var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n    if (!(dx && canScrollX || dy && canScrollY)) return;\n\n    // Webkit browsers on OS X abort momentum scrolls when the target\n    // of the scroll event is removed from the scrollable element.\n    // This hack (see related code in patchDisplay) makes sure the\n    // element is kept around.\n    if (dy && mac && webkit) {\n      outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n        for (var i = 0; i < view.length; i++) {\n          if (view[i].node == cur) {\n            cm.display.currentWheelTarget = cur;\n            break outer;\n          }\n        }\n      }\n    }\n\n    // On some browsers, horizontal scrolling will cause redraws to\n    // happen before the gutter has been realigned, causing it to\n    // wriggle around in a most unseemly way. When we have an\n    // estimated pixels/delta value, we just handle horizontal\n    // scrolling entirely here. It'll be slightly off from native, but\n    // better than glitching out.\n    if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n      if (dy && canScrollY)\n        setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));\n      setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));\n      // Only prevent default scrolling if vertical scrolling is\n      // actually possible. Otherwise, it causes vertical scroll\n      // jitter on OSX trackpads when deltaX is small and deltaY\n      // is large (issue #3579)\n      if (!dy || (dy && canScrollY))\n        e_preventDefault(e);\n      display.wheelStartX = null; // Abort measurement, if in progress\n      return;\n    }\n\n    // 'Project' the visible viewport to cover the area that is being\n    // scrolled into view (if we know enough to estimate it).\n    if (dy && wheelPixelsPerUnit != null) {\n      var pixels = dy * wheelPixelsPerUnit;\n      var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n      if (pixels < 0) top = Math.max(0, top + pixels - 50);\n      else bot = Math.min(cm.doc.height, bot + pixels + 50);\n      updateDisplaySimple(cm, {top: top, bottom: bot});\n    }\n\n    if (wheelSamples < 20) {\n      if (display.wheelStartX == null) {\n        display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n        display.wheelDX = dx; display.wheelDY = dy;\n        setTimeout(function() {\n          if (display.wheelStartX == null) return;\n          var movedX = scroll.scrollLeft - display.wheelStartX;\n          var movedY = scroll.scrollTop - display.wheelStartY;\n          var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n            (movedX && display.wheelDX && movedX / display.wheelDX);\n          display.wheelStartX = display.wheelStartY = null;\n          if (!sample) return;\n          wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n          ++wheelSamples;\n        }, 200);\n      } else {\n        display.wheelDX += dx; display.wheelDY += dy;\n      }\n    }\n  }\n\n  // KEY EVENTS\n\n  // Run a handler that was bound to a key.\n  function doHandleBinding(cm, bound, dropShift) {\n    if (typeof bound == \"string\") {\n      bound = commands[bound];\n      if (!bound) return false;\n    }\n    // Ensure previous input has been read, so that the handler sees a\n    // consistent view of the document\n    cm.display.input.ensurePolled();\n    var prevShift = cm.display.shift, done = false;\n    try {\n      if (cm.isReadOnly()) cm.state.suppressEdits = true;\n      if (dropShift) cm.display.shift = false;\n      done = bound(cm) != Pass;\n    } finally {\n      cm.display.shift = prevShift;\n      cm.state.suppressEdits = false;\n    }\n    return done;\n  }\n\n  function lookupKeyForEditor(cm, name, handle) {\n    for (var i = 0; i < cm.state.keyMaps.length; i++) {\n      var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n      if (result) return result;\n    }\n    return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n      || lookupKey(name, cm.options.keyMap, handle, cm);\n  }\n\n  var stopSeq = new Delayed;\n  function dispatchKey(cm, name, e, handle) {\n    var seq = cm.state.keySeq;\n    if (seq) {\n      if (isModifierKey(name)) return \"handled\";\n      stopSeq.set(50, function() {\n        if (cm.state.keySeq == seq) {\n          cm.state.keySeq = null;\n          cm.display.input.reset();\n        }\n      });\n      name = seq + \" \" + name;\n    }\n    var result = lookupKeyForEditor(cm, name, handle);\n\n    if (result == \"multi\")\n      cm.state.keySeq = name;\n    if (result == \"handled\")\n      signalLater(cm, \"keyHandled\", cm, name, e);\n\n    if (result == \"handled\" || result == \"multi\") {\n      e_preventDefault(e);\n      restartBlink(cm);\n    }\n\n    if (seq && !result && /\\'$/.test(name)) {\n      e_preventDefault(e);\n      return true;\n    }\n    return !!result;\n  }\n\n  // Handle a key from the keydown event.\n  function handleKeyBinding(cm, e) {\n    var name = keyName(e, true);\n    if (!name) return false;\n\n    if (e.shiftKey && !cm.state.keySeq) {\n      // First try to resolve full name (including 'Shift-'). Failing\n      // that, see if there is a cursor-motion command (starting with\n      // 'go') bound to the keyname without 'Shift-'.\n      return dispatchKey(cm, \"Shift-\" + name, e, function(b) {return doHandleBinding(cm, b, true);})\n          || dispatchKey(cm, name, e, function(b) {\n               if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n                 return doHandleBinding(cm, b);\n             });\n    } else {\n      return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });\n    }\n  }\n\n  // Handle a key from the keypress event\n  function handleCharBinding(cm, e, ch) {\n    return dispatchKey(cm, \"'\" + ch + \"'\", e,\n                       function(b) { return doHandleBinding(cm, b, true); });\n  }\n\n  var lastStoppedKey = null;\n  function onKeyDown(e) {\n    var cm = this;\n    cm.curOp.focus = activeElt();\n    if (signalDOMEvent(cm, e)) return;\n    // IE does strange things with escape.\n    if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false;\n    var code = e.keyCode;\n    cm.display.shift = code == 16 || e.shiftKey;\n    var handled = handleKeyBinding(cm, e);\n    if (presto) {\n      lastStoppedKey = handled ? code : null;\n      // Opera has no cut event... we try to at least catch the key combo\n      if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n        cm.replaceSelection(\"\", null, \"cut\");\n    }\n\n    // Turn mouse into crosshair when Alt is held on Mac.\n    if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n      showCrossHair(cm);\n  }\n\n  function showCrossHair(cm) {\n    var lineDiv = cm.display.lineDiv;\n    addClass(lineDiv, \"CodeMirror-crosshair\");\n\n    function up(e) {\n      if (e.keyCode == 18 || !e.altKey) {\n        rmClass(lineDiv, \"CodeMirror-crosshair\");\n        off(document, \"keyup\", up);\n        off(document, \"mouseover\", up);\n      }\n    }\n    on(document, \"keyup\", up);\n    on(document, \"mouseover\", up);\n  }\n\n  function onKeyUp(e) {\n    if (e.keyCode == 16) this.doc.sel.shift = false;\n    signalDOMEvent(this, e);\n  }\n\n  function onKeyPress(e) {\n    var cm = this;\n    if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return;\n    var keyCode = e.keyCode, charCode = e.charCode;\n    if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}\n    if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return;\n    var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n    if (handleCharBinding(cm, e, ch)) return;\n    cm.display.input.onKeyPress(e);\n  }\n\n  // FOCUS/BLUR EVENTS\n\n  function delayBlurEvent(cm) {\n    cm.state.delayingBlurEvent = true;\n    setTimeout(function() {\n      if (cm.state.delayingBlurEvent) {\n        cm.state.delayingBlurEvent = false;\n        onBlur(cm);\n      }\n    }, 100);\n  }\n\n  function onFocus(cm) {\n    if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false;\n\n    if (cm.options.readOnly == \"nocursor\") return;\n    if (!cm.state.focused) {\n      signal(cm, \"focus\", cm);\n      cm.state.focused = true;\n      addClass(cm.display.wrapper, \"CodeMirror-focused\");\n      // This test prevents this from firing when a context\n      // menu is closed (since the input reset would kill the\n      // select-all detection hack)\n      if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n        cm.display.input.reset();\n        if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730\n      }\n      cm.display.input.receivedFocus();\n    }\n    restartBlink(cm);\n  }\n  function onBlur(cm) {\n    if (cm.state.delayingBlurEvent) return;\n\n    if (cm.state.focused) {\n      signal(cm, \"blur\", cm);\n      cm.state.focused = false;\n      rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n    }\n    clearInterval(cm.display.blinker);\n    setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150);\n  }\n\n  // CONTEXT MENU HANDLING\n\n  // To make the context menu work, we need to briefly unhide the\n  // textarea (making it as unobtrusive as possible) to let the\n  // right-click take effect on it.\n  function onContextMenu(cm, e) {\n    if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n    if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n    cm.display.input.onContextMenu(e);\n  }\n\n  function contextMenuInGutter(cm, e) {\n    if (!hasHandler(cm, \"gutterContextMenu\")) return false;\n    return gutterEvent(cm, e, \"gutterContextMenu\", false);\n  }\n\n  // UPDATING\n\n  // Compute the position of the end of a change (its 'to' property\n  // refers to the pre-change end).\n  var changeEnd = CodeMirror.changeEnd = function(change) {\n    if (!change.text) return change.to;\n    return Pos(change.from.line + change.text.length - 1,\n               lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n  };\n\n  // Adjust a position to refer to the post-change position of the\n  // same text, or the end of the change if the change covers it.\n  function adjustForChange(pos, change) {\n    if (cmp(pos, change.from) < 0) return pos;\n    if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n    var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n    if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n    return Pos(line, ch);\n  }\n\n  function computeSelAfterChange(doc, change) {\n    var out = [];\n    for (var i = 0; i < doc.sel.ranges.length; i++) {\n      var range = doc.sel.ranges[i];\n      out.push(new Range(adjustForChange(range.anchor, change),\n                         adjustForChange(range.head, change)));\n    }\n    return normalizeSelection(out, doc.sel.primIndex);\n  }\n\n  function offsetPos(pos, old, nw) {\n    if (pos.line == old.line)\n      return Pos(nw.line, pos.ch - old.ch + nw.ch);\n    else\n      return Pos(nw.line + (pos.line - old.line), pos.ch);\n  }\n\n  // Used by replaceSelections to allow moving the selection to the\n  // start or around the replaced test. Hint may be \"start\" or \"around\".\n  function computeReplacedSel(doc, changes, hint) {\n    var out = [];\n    var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n    for (var i = 0; i < changes.length; i++) {\n      var change = changes[i];\n      var from = offsetPos(change.from, oldPrev, newPrev);\n      var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n      oldPrev = change.to;\n      newPrev = to;\n      if (hint == \"around\") {\n        var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n        out[i] = new Range(inv ? to : from, inv ? from : to);\n      } else {\n        out[i] = new Range(from, from);\n      }\n    }\n    return new Selection(out, doc.sel.primIndex);\n  }\n\n  // Allow \"beforeChange\" event handlers to influence a change\n  function filterChange(doc, change, update) {\n    var obj = {\n      canceled: false,\n      from: change.from,\n      to: change.to,\n      text: change.text,\n      origin: change.origin,\n      cancel: function() { this.canceled = true; }\n    };\n    if (update) obj.update = function(from, to, text, origin) {\n      if (from) this.from = clipPos(doc, from);\n      if (to) this.to = clipPos(doc, to);\n      if (text) this.text = text;\n      if (origin !== undefined) this.origin = origin;\n    };\n    signal(doc, \"beforeChange\", doc, obj);\n    if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n    if (obj.canceled) return null;\n    return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n  }\n\n  // Apply a change to a document, and add it to the document's\n  // history, and propagating it to all linked documents.\n  function makeChange(doc, change, ignoreReadOnly) {\n    if (doc.cm) {\n      if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n      if (doc.cm.state.suppressEdits) return;\n    }\n\n    if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n      change = filterChange(doc, change, true);\n      if (!change) return;\n    }\n\n    // Possibly split or suppress the update based on the presence\n    // of read-only spans in its range.\n    var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n    if (split) {\n      for (var i = split.length - 1; i >= 0; --i)\n        makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n    } else {\n      makeChangeInner(doc, change);\n    }\n  }\n\n  function makeChangeInner(doc, change) {\n    if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) return;\n    var selAfter = computeSelAfterChange(doc, change);\n    addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n    makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n    var rebased = [];\n\n    linkedDocs(doc, function(doc, sharedHist) {\n      if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n        rebaseHist(doc.history, change);\n        rebased.push(doc.history);\n      }\n      makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n    });\n  }\n\n  // Revert a change stored in a document's history.\n  function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n    if (doc.cm && doc.cm.state.suppressEdits) return;\n\n    var hist = doc.history, event, selAfter = doc.sel;\n    var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n    // Verify that there is a useable event (so that ctrl-z won't\n    // needlessly clear selection events)\n    for (var i = 0; i < source.length; i++) {\n      event = source[i];\n      if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n        break;\n    }\n    if (i == source.length) return;\n    hist.lastOrigin = hist.lastSelOrigin = null;\n\n    for (;;) {\n      event = source.pop();\n      if (event.ranges) {\n        pushSelectionToHistory(event, dest);\n        if (allowSelectionOnly && !event.equals(doc.sel)) {\n          setSelection(doc, event, {clearRedo: false});\n          return;\n        }\n        selAfter = event;\n      }\n      else break;\n    }\n\n    // Build up a reverse change object to add to the opposite history\n    // stack (redo when undoing, and vice versa).\n    var antiChanges = [];\n    pushSelectionToHistory(selAfter, dest);\n    dest.push({changes: antiChanges, generation: hist.generation});\n    hist.generation = event.generation || ++hist.maxGeneration;\n\n    var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n    for (var i = event.changes.length - 1; i >= 0; --i) {\n      var change = event.changes[i];\n      change.origin = type;\n      if (filter && !filterChange(doc, change, false)) {\n        source.length = 0;\n        return;\n      }\n\n      antiChanges.push(historyChangeFromChange(doc, change));\n\n      var after = i ? computeSelAfterChange(doc, change) : lst(source);\n      makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n      if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});\n      var rebased = [];\n\n      // Propagate to the linked documents\n      linkedDocs(doc, function(doc, sharedHist) {\n        if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n          rebaseHist(doc.history, change);\n          rebased.push(doc.history);\n        }\n        makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n      });\n    }\n  }\n\n  // Sub-views need their line numbers shifted when text is added\n  // above or below them in the parent document.\n  function shiftDoc(doc, distance) {\n    if (distance == 0) return;\n    doc.first += distance;\n    doc.sel = new Selection(map(doc.sel.ranges, function(range) {\n      return new Range(Pos(range.anchor.line + distance, range.anchor.ch),\n                       Pos(range.head.line + distance, range.head.ch));\n    }), doc.sel.primIndex);\n    if (doc.cm) {\n      regChange(doc.cm, doc.first, doc.first - distance, distance);\n      for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n        regLineChange(doc.cm, l, \"gutter\");\n    }\n  }\n\n  // More lower-level change function, handling only a single document\n  // (not linked ones).\n  function makeChangeSingleDoc(doc, change, selAfter, spans) {\n    if (doc.cm && !doc.cm.curOp)\n      return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n    if (change.to.line < doc.first) {\n      shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n      return;\n    }\n    if (change.from.line > doc.lastLine()) return;\n\n    // Clip the change to the size of this doc\n    if (change.from.line < doc.first) {\n      var shift = change.text.length - 1 - (doc.first - change.from.line);\n      shiftDoc(doc, shift);\n      change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n                text: [lst(change.text)], origin: change.origin};\n    }\n    var last = doc.lastLine();\n    if (change.to.line > last) {\n      change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n                text: [change.text[0]], origin: change.origin};\n    }\n\n    change.removed = getBetween(doc, change.from, change.to);\n\n    if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n    if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n    else updateDoc(doc, change, spans);\n    setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n  }\n\n  // Handle the interaction of a change to a document with the editor\n  // that this document is part of.\n  function makeChangeSingleDocInEditor(cm, change, spans) {\n    var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n    var recomputeMaxLength = false, checkWidthStart = from.line;\n    if (!cm.options.lineWrapping) {\n      checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n      doc.iter(checkWidthStart, to.line + 1, function(line) {\n        if (line == display.maxLine) {\n          recomputeMaxLength = true;\n          return true;\n        }\n      });\n    }\n\n    if (doc.sel.contains(change.from, change.to) > -1)\n      signalCursorActivity(cm);\n\n    updateDoc(doc, change, spans, estimateHeight(cm));\n\n    if (!cm.options.lineWrapping) {\n      doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n        var len = lineLength(line);\n        if (len > display.maxLineLength) {\n          display.maxLine = line;\n          display.maxLineLength = len;\n          display.maxLineChanged = true;\n          recomputeMaxLength = false;\n        }\n      });\n      if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n    }\n\n    // Adjust frontier, schedule worker\n    doc.frontier = Math.min(doc.frontier, from.line);\n    startWorker(cm, 400);\n\n    var lendiff = change.text.length - (to.line - from.line) - 1;\n    // Remember that these lines changed, for updating the display\n    if (change.full)\n      regChange(cm);\n    else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n      regLineChange(cm, from.line, \"text\");\n    else\n      regChange(cm, from.line, to.line + 1, lendiff);\n\n    var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n    if (changeHandler || changesHandler) {\n      var obj = {\n        from: from, to: to,\n        text: change.text,\n        removed: change.removed,\n        origin: change.origin\n      };\n      if (changeHandler) signalLater(cm, \"change\", cm, obj);\n      if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n    }\n    cm.display.selForContextMenu = null;\n  }\n\n  function replaceRange(doc, code, from, to, origin) {\n    if (!to) to = from;\n    if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }\n    if (typeof code == \"string\") code = doc.splitLines(code);\n    makeChange(doc, {from: from, to: to, text: code, origin: origin});\n  }\n\n  // SCROLLING THINGS INTO VIEW\n\n  // If an editor sits on the top or bottom of the window, partially\n  // scrolled out of view, this ensures that the cursor is visible.\n  function maybeScrollWindow(cm, coords) {\n    if (signalDOMEvent(cm, \"scrollCursorIntoView\")) return;\n\n    var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n    if (coords.top + box.top < 0) doScroll = true;\n    else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;\n    if (doScroll != null && !phantom) {\n      var scrollNode = elt(\"div\", \"\\u200b\", null, \"position: absolute; top: \" +\n                           (coords.top - display.viewOffset - paddingTop(cm.display)) + \"px; height: \" +\n                           (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + \"px; left: \" +\n                           coords.left + \"px; width: 2px;\");\n      cm.display.lineSpace.appendChild(scrollNode);\n      scrollNode.scrollIntoView(doScroll);\n      cm.display.lineSpace.removeChild(scrollNode);\n    }\n  }\n\n  // Scroll a given position into view (immediately), verifying that\n  // it actually became visible (as line heights are accurately\n  // measured, the position of something may 'drift' during drawing).\n  function scrollPosIntoView(cm, pos, end, margin) {\n    if (margin == null) margin = 0;\n    for (var limit = 0; limit < 5; limit++) {\n      var changed = false, coords = cursorCoords(cm, pos);\n      var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n      var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n                                         Math.min(coords.top, endCoords.top) - margin,\n                                         Math.max(coords.left, endCoords.left),\n                                         Math.max(coords.bottom, endCoords.bottom) + margin);\n      var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n      if (scrollPos.scrollTop != null) {\n        setScrollTop(cm, scrollPos.scrollTop);\n        if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n      }\n      if (scrollPos.scrollLeft != null) {\n        setScrollLeft(cm, scrollPos.scrollLeft);\n        if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n      }\n      if (!changed) break;\n    }\n    return coords;\n  }\n\n  // Scroll a given set of coordinates into view (immediately).\n  function scrollIntoView(cm, x1, y1, x2, y2) {\n    var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n    if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n    if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n  }\n\n  // Calculate a new scroll position needed to scroll the given\n  // rectangle into view. Returns an object with scrollTop and\n  // scrollLeft properties. When these are undefined, the\n  // vertical/horizontal position does not need to be adjusted.\n  function calculateScrollPos(cm, x1, y1, x2, y2) {\n    var display = cm.display, snapMargin = textHeight(cm.display);\n    if (y1 < 0) y1 = 0;\n    var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n    var screen = displayHeight(cm), result = {};\n    if (y2 - y1 > screen) y2 = y1 + screen;\n    var docBottom = cm.doc.height + paddingVert(display);\n    var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n    if (y1 < screentop) {\n      result.scrollTop = atTop ? 0 : y1;\n    } else if (y2 > screentop + screen) {\n      var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n      if (newTop != screentop) result.scrollTop = newTop;\n    }\n\n    var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n    var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n    var tooWide = x2 - x1 > screenw;\n    if (tooWide) x2 = x1 + screenw;\n    if (x1 < 10)\n      result.scrollLeft = 0;\n    else if (x1 < screenleft)\n      result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n    else if (x2 > screenw + screenleft - 3)\n      result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n    return result;\n  }\n\n  // Store a relative adjustment to the scroll position in the current\n  // operation (to be applied when the operation finishes).\n  function addToScrollPos(cm, left, top) {\n    if (left != null || top != null) resolveScrollToPos(cm);\n    if (left != null)\n      cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n    if (top != null)\n      cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n  }\n\n  // Make sure that at the end of the operation the current cursor is\n  // shown.\n  function ensureCursorVisible(cm) {\n    resolveScrollToPos(cm);\n    var cur = cm.getCursor(), from = cur, to = cur;\n    if (!cm.options.lineWrapping) {\n      from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n      to = Pos(cur.line, cur.ch + 1);\n    }\n    cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n  }\n\n  // When an operation has its scrollToPos property set, and another\n  // scroll action is applied before the end of the operation, this\n  // 'simulates' scrolling that position into view in a cheap way, so\n  // that the effect of intermediate scroll commands is not ignored.\n  function resolveScrollToPos(cm) {\n    var range = cm.curOp.scrollToPos;\n    if (range) {\n      cm.curOp.scrollToPos = null;\n      var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n      var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n                                    Math.min(from.top, to.top) - range.margin,\n                                    Math.max(from.right, to.right),\n                                    Math.max(from.bottom, to.bottom) + range.margin);\n      cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n    }\n  }\n\n  // API UTILITIES\n\n  // Indent the given line. The how parameter can be \"smart\",\n  // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n  // (typically set to true for forced single-line indents), empty\n  // lines are not indented, and places where the mode returns Pass\n  // are left alone.\n  function indentLine(cm, n, how, aggressive) {\n    var doc = cm.doc, state;\n    if (how == null) how = \"add\";\n    if (how == \"smart\") {\n      // Fall back to \"prev\" when the mode doesn't have an indentation\n      // method.\n      if (!doc.mode.indent) how = \"prev\";\n      else state = getStateBefore(cm, n);\n    }\n\n    var tabSize = cm.options.tabSize;\n    var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n    if (line.stateAfter) line.stateAfter = null;\n    var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n    if (!aggressive && !/\\S/.test(line.text)) {\n      indentation = 0;\n      how = \"not\";\n    } else if (how == \"smart\") {\n      indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n      if (indentation == Pass || indentation > 150) {\n        if (!aggressive) return;\n        how = \"prev\";\n      }\n    }\n    if (how == \"prev\") {\n      if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n      else indentation = 0;\n    } else if (how == \"add\") {\n      indentation = curSpace + cm.options.indentUnit;\n    } else if (how == \"subtract\") {\n      indentation = curSpace - cm.options.indentUnit;\n    } else if (typeof how == \"number\") {\n      indentation = curSpace + how;\n    }\n    indentation = Math.max(0, indentation);\n\n    var indentString = \"\", pos = 0;\n    if (cm.options.indentWithTabs)\n      for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n    if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n    if (indentString != curSpaceString) {\n      replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n      line.stateAfter = null;\n      return true;\n    } else {\n      // Ensure that, if the cursor was in the whitespace at the start\n      // of the line, it is moved to the end of that space.\n      for (var i = 0; i < doc.sel.ranges.length; i++) {\n        var range = doc.sel.ranges[i];\n        if (range.head.line == n && range.head.ch < curSpaceString.length) {\n          var pos = Pos(n, curSpaceString.length);\n          replaceOneSelection(doc, i, new Range(pos, pos));\n          break;\n        }\n      }\n    }\n  }\n\n  // Utility for applying a change to a line by handle or number,\n  // returning the number and optionally registering the line as\n  // changed.\n  function changeLine(doc, handle, changeType, op) {\n    var no = handle, line = handle;\n    if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n    else no = lineNo(handle);\n    if (no == null) return null;\n    if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n    return line;\n  }\n\n  // Helper for deleting text near the selection(s), used to implement\n  // backspace, delete, and similar functionality.\n  function deleteNearSelection(cm, compute) {\n    var ranges = cm.doc.sel.ranges, kill = [];\n    // Build up a set of ranges to kill first, merging overlapping\n    // ranges.\n    for (var i = 0; i < ranges.length; i++) {\n      var toKill = compute(ranges[i]);\n      while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n        var replaced = kill.pop();\n        if (cmp(replaced.from, toKill.from) < 0) {\n          toKill.from = replaced.from;\n          break;\n        }\n      }\n      kill.push(toKill);\n    }\n    // Next, remove those actual ranges.\n    runInOp(cm, function() {\n      for (var i = kill.length - 1; i >= 0; i--)\n        replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n      ensureCursorVisible(cm);\n    });\n  }\n\n  // Used for horizontal relative motion. Dir is -1 or 1 (left or\n  // right), unit can be \"char\", \"column\" (like char, but doesn't\n  // cross line boundaries), \"word\" (across next word), or \"group\" (to\n  // the start of next group of word or non-word-non-whitespace\n  // chars). The visually param controls whether, in right-to-left\n  // text, direction 1 means to move towards the next index in the\n  // string, or towards the character to the right of the current\n  // position. The resulting position will have a hitSide=true\n  // property if it reached the end of the document.\n  function findPosH(doc, pos, dir, unit, visually) {\n    var line = pos.line, ch = pos.ch, origDir = dir;\n    var lineObj = getLine(doc, line);\n    function findNextLine() {\n      var l = line + dir;\n      if (l < doc.first || l >= doc.first + doc.size) return false\n      line = l;\n      return lineObj = getLine(doc, l);\n    }\n    function moveOnce(boundToLine) {\n      var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n      if (next == null) {\n        if (!boundToLine && findNextLine()) {\n          if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n          else ch = dir < 0 ? lineObj.text.length : 0;\n        } else return false\n      } else ch = next;\n      return true;\n    }\n\n    if (unit == \"char\") {\n      moveOnce()\n    } else if (unit == \"column\") {\n      moveOnce(true)\n    } else if (unit == \"word\" || unit == \"group\") {\n      var sawType = null, group = unit == \"group\";\n      var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n      for (var first = true;; first = false) {\n        if (dir < 0 && !moveOnce(!first)) break;\n        var cur = lineObj.text.charAt(ch) || \"\\n\";\n        var type = isWordChar(cur, helper) ? \"w\"\n          : group && cur == \"\\n\" ? \"n\"\n          : !group || /\\s/.test(cur) ? null\n          : \"p\";\n        if (group && !first && !type) type = \"s\";\n        if (sawType && sawType != type) {\n          if (dir < 0) {dir = 1; moveOnce();}\n          break;\n        }\n\n        if (type) sawType = type;\n        if (dir > 0 && !moveOnce(!first)) break;\n      }\n    }\n    var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n    if (!cmp(pos, result)) result.hitSide = true;\n    return result;\n  }\n\n  // For relative vertical movement. Dir may be -1 or 1. Unit can be\n  // \"page\" or \"line\". The resulting position will have a hitSide=true\n  // property if it reached the end of the document.\n  function findPosV(cm, pos, dir, unit) {\n    var doc = cm.doc, x = pos.left, y;\n    if (unit == \"page\") {\n      var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n      y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n    } else if (unit == \"line\") {\n      y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n    }\n    for (;;) {\n      var target = coordsChar(cm, x, y);\n      if (!target.outside) break;\n      if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n      y += dir * 5;\n    }\n    return target;\n  }\n\n  // EDITOR METHODS\n\n  // The publicly visible API. Note that methodOp(f) means\n  // 'wrap f in an operation, performed on its `this` parameter'.\n\n  // This is not the complete set of editor methods. Most of the\n  // methods defined on the Doc type are also injected into\n  // CodeMirror.prototype, for backwards compatibility and\n  // convenience.\n\n  CodeMirror.prototype = {\n    constructor: CodeMirror,\n    focus: function(){window.focus(); this.display.input.focus();},\n\n    setOption: function(option, value) {\n      var options = this.options, old = options[option];\n      if (options[option] == value && option != \"mode\") return;\n      options[option] = value;\n      if (optionHandlers.hasOwnProperty(option))\n        operation(this, optionHandlers[option])(this, value, old);\n    },\n\n    getOption: function(option) {return this.options[option];},\n    getDoc: function() {return this.doc;},\n\n    addKeyMap: function(map, bottom) {\n      this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n    },\n    removeKeyMap: function(map) {\n      var maps = this.state.keyMaps;\n      for (var i = 0; i < maps.length; ++i)\n        if (maps[i] == map || maps[i].name == map) {\n          maps.splice(i, 1);\n          return true;\n        }\n    },\n\n    addOverlay: methodOp(function(spec, options) {\n      var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n      if (mode.startState) throw new Error(\"Overlays may not be stateful.\");\n      this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});\n      this.state.modeGen++;\n      regChange(this);\n    }),\n    removeOverlay: methodOp(function(spec) {\n      var overlays = this.state.overlays;\n      for (var i = 0; i < overlays.length; ++i) {\n        var cur = overlays[i].modeSpec;\n        if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n          overlays.splice(i, 1);\n          this.state.modeGen++;\n          regChange(this);\n          return;\n        }\n      }\n    }),\n\n    indentLine: methodOp(function(n, dir, aggressive) {\n      if (typeof dir != \"string\" && typeof dir != \"number\") {\n        if (dir == null) dir = this.options.smartIndent ? \"smart\" : \"prev\";\n        else dir = dir ? \"add\" : \"subtract\";\n      }\n      if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);\n    }),\n    indentSelection: methodOp(function(how) {\n      var ranges = this.doc.sel.ranges, end = -1;\n      for (var i = 0; i < ranges.length; i++) {\n        var range = ranges[i];\n        if (!range.empty()) {\n          var from = range.from(), to = range.to();\n          var start = Math.max(end, from.line);\n          end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n          for (var j = start; j < end; ++j)\n            indentLine(this, j, how);\n          var newRanges = this.doc.sel.ranges;\n          if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n            replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);\n        } else if (range.head.line > end) {\n          indentLine(this, range.head.line, how, true);\n          end = range.head.line;\n          if (i == this.doc.sel.primIndex) ensureCursorVisible(this);\n        }\n      }\n    }),\n\n    // Fetch the parser token for a given character. Useful for hacks\n    // that want to inspect the mode state (say, for completion).\n    getTokenAt: function(pos, precise) {\n      return takeToken(this, pos, precise);\n    },\n\n    getLineTokens: function(line, precise) {\n      return takeToken(this, Pos(line), precise, true);\n    },\n\n    getTokenTypeAt: function(pos) {\n      pos = clipPos(this.doc, pos);\n      var styles = getLineStyles(this, getLine(this.doc, pos.line));\n      var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n      var type;\n      if (ch == 0) type = styles[2];\n      else for (;;) {\n        var mid = (before + after) >> 1;\n        if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;\n        else if (styles[mid * 2 + 1] < ch) before = mid + 1;\n        else { type = styles[mid * 2 + 2]; break; }\n      }\n      var cut = type ? type.indexOf(\"cm-overlay \") : -1;\n      return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);\n    },\n\n    getModeAt: function(pos) {\n      var mode = this.doc.mode;\n      if (!mode.innerMode) return mode;\n      return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;\n    },\n\n    getHelper: function(pos, type) {\n      return this.getHelpers(pos, type)[0];\n    },\n\n    getHelpers: function(pos, type) {\n      var found = [];\n      if (!helpers.hasOwnProperty(type)) return found;\n      var help = helpers[type], mode = this.getModeAt(pos);\n      if (typeof mode[type] == \"string\") {\n        if (help[mode[type]]) found.push(help[mode[type]]);\n      } else if (mode[type]) {\n        for (var i = 0; i < mode[type].length; i++) {\n          var val = help[mode[type][i]];\n          if (val) found.push(val);\n        }\n      } else if (mode.helperType && help[mode.helperType]) {\n        found.push(help[mode.helperType]);\n      } else if (help[mode.name]) {\n        found.push(help[mode.name]);\n      }\n      for (var i = 0; i < help._global.length; i++) {\n        var cur = help._global[i];\n        if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n          found.push(cur.val);\n      }\n      return found;\n    },\n\n    getStateAfter: function(line, precise) {\n      var doc = this.doc;\n      line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n      return getStateBefore(this, line + 1, precise);\n    },\n\n    cursorCoords: function(start, mode) {\n      var pos, range = this.doc.sel.primary();\n      if (start == null) pos = range.head;\n      else if (typeof start == \"object\") pos = clipPos(this.doc, start);\n      else pos = start ? range.from() : range.to();\n      return cursorCoords(this, pos, mode || \"page\");\n    },\n\n    charCoords: function(pos, mode) {\n      return charCoords(this, clipPos(this.doc, pos), mode || \"page\");\n    },\n\n    coordsChar: function(coords, mode) {\n      coords = fromCoordSystem(this, coords, mode || \"page\");\n      return coordsChar(this, coords.left, coords.top);\n    },\n\n    lineAtHeight: function(height, mode) {\n      height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n      return lineAtHeight(this.doc, height + this.display.viewOffset);\n    },\n    heightAtLine: function(line, mode) {\n      var end = false, lineObj;\n      if (typeof line == \"number\") {\n        var last = this.doc.first + this.doc.size - 1;\n        if (line < this.doc.first) line = this.doc.first;\n        else if (line > last) { line = last; end = true; }\n        lineObj = getLine(this.doc, line);\n      } else {\n        lineObj = line;\n      }\n      return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\").top +\n        (end ? this.doc.height - heightAtLine(lineObj) : 0);\n    },\n\n    defaultTextHeight: function() { return textHeight(this.display); },\n    defaultCharWidth: function() { return charWidth(this.display); },\n\n    setGutterMarker: methodOp(function(line, gutterID, value) {\n      return changeLine(this.doc, line, \"gutter\", function(line) {\n        var markers = line.gutterMarkers || (line.gutterMarkers = {});\n        markers[gutterID] = value;\n        if (!value && isEmpty(markers)) line.gutterMarkers = null;\n        return true;\n      });\n    }),\n\n    clearGutter: methodOp(function(gutterID) {\n      var cm = this, doc = cm.doc, i = doc.first;\n      doc.iter(function(line) {\n        if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n          line.gutterMarkers[gutterID] = null;\n          regLineChange(cm, i, \"gutter\");\n          if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;\n        }\n        ++i;\n      });\n    }),\n\n    lineInfo: function(line) {\n      if (typeof line == \"number\") {\n        if (!isLine(this.doc, line)) return null;\n        var n = line;\n        line = getLine(this.doc, line);\n        if (!line) return null;\n      } else {\n        var n = lineNo(line);\n        if (n == null) return null;\n      }\n      return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n              textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n              widgets: line.widgets};\n    },\n\n    getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};},\n\n    addWidget: function(pos, node, scroll, vert, horiz) {\n      var display = this.display;\n      pos = cursorCoords(this, clipPos(this.doc, pos));\n      var top = pos.bottom, left = pos.left;\n      node.style.position = \"absolute\";\n      node.setAttribute(\"cm-ignore-events\", \"true\");\n      this.display.input.setUneditable(node);\n      display.sizer.appendChild(node);\n      if (vert == \"over\") {\n        top = pos.top;\n      } else if (vert == \"above\" || vert == \"near\") {\n        var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n        hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n        // Default to positioning above (if specified and possible); otherwise default to positioning below\n        if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n          top = pos.top - node.offsetHeight;\n        else if (pos.bottom + node.offsetHeight <= vspace)\n          top = pos.bottom;\n        if (left + node.offsetWidth > hspace)\n          left = hspace - node.offsetWidth;\n      }\n      node.style.top = top + \"px\";\n      node.style.left = node.style.right = \"\";\n      if (horiz == \"right\") {\n        left = display.sizer.clientWidth - node.offsetWidth;\n        node.style.right = \"0px\";\n      } else {\n        if (horiz == \"left\") left = 0;\n        else if (horiz == \"middle\") left = (display.sizer.clientWidth - node.offsetWidth) / 2;\n        node.style.left = left + \"px\";\n      }\n      if (scroll)\n        scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);\n    },\n\n    triggerOnKeyDown: methodOp(onKeyDown),\n    triggerOnKeyPress: methodOp(onKeyPress),\n    triggerOnKeyUp: onKeyUp,\n\n    execCommand: function(cmd) {\n      if (commands.hasOwnProperty(cmd))\n        return commands[cmd].call(null, this);\n    },\n\n    triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n    findPosH: function(from, amount, unit, visually) {\n      var dir = 1;\n      if (amount < 0) { dir = -1; amount = -amount; }\n      for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {\n        cur = findPosH(this.doc, cur, dir, unit, visually);\n        if (cur.hitSide) break;\n      }\n      return cur;\n    },\n\n    moveH: methodOp(function(dir, unit) {\n      var cm = this;\n      cm.extendSelectionsBy(function(range) {\n        if (cm.display.shift || cm.doc.extend || range.empty())\n          return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually);\n        else\n          return dir < 0 ? range.from() : range.to();\n      }, sel_move);\n    }),\n\n    deleteH: methodOp(function(dir, unit) {\n      var sel = this.doc.sel, doc = this.doc;\n      if (sel.somethingSelected())\n        doc.replaceSelection(\"\", null, \"+delete\");\n      else\n        deleteNearSelection(this, function(range) {\n          var other = findPosH(doc, range.head, dir, unit, false);\n          return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other};\n        });\n    }),\n\n    findPosV: function(from, amount, unit, goalColumn) {\n      var dir = 1, x = goalColumn;\n      if (amount < 0) { dir = -1; amount = -amount; }\n      for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {\n        var coords = cursorCoords(this, cur, \"div\");\n        if (x == null) x = coords.left;\n        else coords.left = x;\n        cur = findPosV(this, coords, dir, unit);\n        if (cur.hitSide) break;\n      }\n      return cur;\n    },\n\n    moveV: methodOp(function(dir, unit) {\n      var cm = this, doc = this.doc, goals = [];\n      var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected();\n      doc.extendSelectionsBy(function(range) {\n        if (collapse)\n          return dir < 0 ? range.from() : range.to();\n        var headPos = cursorCoords(cm, range.head, \"div\");\n        if (range.goalColumn != null) headPos.left = range.goalColumn;\n        goals.push(headPos.left);\n        var pos = findPosV(cm, headPos, dir, unit);\n        if (unit == \"page\" && range == doc.sel.primary())\n          addToScrollPos(cm, null, charCoords(cm, pos, \"div\").top - headPos.top);\n        return pos;\n      }, sel_move);\n      if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++)\n        doc.sel.ranges[i].goalColumn = goals[i];\n    }),\n\n    // Find the word at the given position (as returned by coordsChar).\n    findWordAt: function(pos) {\n      var doc = this.doc, line = getLine(doc, pos.line).text;\n      var start = pos.ch, end = pos.ch;\n      if (line) {\n        var helper = this.getHelper(pos, \"wordChars\");\n        if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;\n        var startChar = line.charAt(start);\n        var check = isWordChar(startChar, helper)\n          ? function(ch) { return isWordChar(ch, helper); }\n          : /\\s/.test(startChar) ? function(ch) {return /\\s/.test(ch);}\n          : function(ch) {return !/\\s/.test(ch) && !isWordChar(ch);};\n        while (start > 0 && check(line.charAt(start - 1))) --start;\n        while (end < line.length && check(line.charAt(end))) ++end;\n      }\n      return new Range(Pos(pos.line, start), Pos(pos.line, end));\n    },\n\n    toggleOverwrite: function(value) {\n      if (value != null && value == this.state.overwrite) return;\n      if (this.state.overwrite = !this.state.overwrite)\n        addClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n      else\n        rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n\n      signal(this, \"overwriteToggle\", this, this.state.overwrite);\n    },\n    hasFocus: function() { return this.display.input.getField() == activeElt(); },\n    isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit); },\n\n    scrollTo: methodOp(function(x, y) {\n      if (x != null || y != null) resolveScrollToPos(this);\n      if (x != null) this.curOp.scrollLeft = x;\n      if (y != null) this.curOp.scrollTop = y;\n    }),\n    getScrollInfo: function() {\n      var scroller = this.display.scroller;\n      return {left: scroller.scrollLeft, top: scroller.scrollTop,\n              height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n              width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n              clientHeight: displayHeight(this), clientWidth: displayWidth(this)};\n    },\n\n    scrollIntoView: methodOp(function(range, margin) {\n      if (range == null) {\n        range = {from: this.doc.sel.primary().head, to: null};\n        if (margin == null) margin = this.options.cursorScrollMargin;\n      } else if (typeof range == \"number\") {\n        range = {from: Pos(range, 0), to: null};\n      } else if (range.from == null) {\n        range = {from: range, to: null};\n      }\n      if (!range.to) range.to = range.from;\n      range.margin = margin || 0;\n\n      if (range.from.line != null) {\n        resolveScrollToPos(this);\n        this.curOp.scrollToPos = range;\n      } else {\n        var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),\n                                      Math.min(range.from.top, range.to.top) - range.margin,\n                                      Math.max(range.from.right, range.to.right),\n                                      Math.max(range.from.bottom, range.to.bottom) + range.margin);\n        this.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n      }\n    }),\n\n    setSize: methodOp(function(width, height) {\n      var cm = this;\n      function interpret(val) {\n        return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val;\n      }\n      if (width != null) cm.display.wrapper.style.width = interpret(width);\n      if (height != null) cm.display.wrapper.style.height = interpret(height);\n      if (cm.options.lineWrapping) clearLineMeasurementCache(this);\n      var lineNo = cm.display.viewFrom;\n      cm.doc.iter(lineNo, cm.display.viewTo, function(line) {\n        if (line.widgets) for (var i = 0; i < line.widgets.length; i++)\n          if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, \"widget\"); break; }\n        ++lineNo;\n      });\n      cm.curOp.forceUpdate = true;\n      signal(cm, \"refresh\", this);\n    }),\n\n    operation: function(f){return runInOp(this, f);},\n\n    refresh: methodOp(function() {\n      var oldHeight = this.display.cachedTextHeight;\n      regChange(this);\n      this.curOp.forceUpdate = true;\n      clearCaches(this);\n      this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);\n      updateGutterSpace(this);\n      if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n        estimateLineHeights(this);\n      signal(this, \"refresh\", this);\n    }),\n\n    swapDoc: methodOp(function(doc) {\n      var old = this.doc;\n      old.cm = null;\n      attachDoc(this, doc);\n      clearCaches(this);\n      this.display.input.reset();\n      this.scrollTo(doc.scrollLeft, doc.scrollTop);\n      this.curOp.forceScroll = true;\n      signalLater(this, \"swapDoc\", this, old);\n      return old;\n    }),\n\n    getInputField: function(){return this.display.input.getField();},\n    getWrapperElement: function(){return this.display.wrapper;},\n    getScrollerElement: function(){return this.display.scroller;},\n    getGutterElement: function(){return this.display.gutters;}\n  };\n  eventMixin(CodeMirror);\n\n  // OPTION DEFAULTS\n\n  // The default configuration options.\n  var defaults = CodeMirror.defaults = {};\n  // Functions to run when options are changed.\n  var optionHandlers = CodeMirror.optionHandlers = {};\n\n  function option(name, deflt, handle, notOnInit) {\n    CodeMirror.defaults[name] = deflt;\n    if (handle) optionHandlers[name] =\n      notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;\n  }\n\n  // Passed to option handlers when there is no old value.\n  var Init = CodeMirror.Init = {toString: function(){return \"CodeMirror.Init\";}};\n\n  // These two are, on init, called from the constructor because they\n  // have to be initialized before the editor can start at all.\n  option(\"value\", \"\", function(cm, val) {\n    cm.setValue(val);\n  }, true);\n  option(\"mode\", null, function(cm, val) {\n    cm.doc.modeOption = val;\n    loadMode(cm);\n  }, true);\n\n  option(\"indentUnit\", 2, loadMode, true);\n  option(\"indentWithTabs\", false);\n  option(\"smartIndent\", true);\n  option(\"tabSize\", 4, function(cm) {\n    resetModeState(cm);\n    clearCaches(cm);\n    regChange(cm);\n  }, true);\n  option(\"lineSeparator\", null, function(cm, val) {\n    cm.doc.lineSep = val;\n    if (!val) return;\n    var newBreaks = [], lineNo = cm.doc.first;\n    cm.doc.iter(function(line) {\n      for (var pos = 0;;) {\n        var found = line.text.indexOf(val, pos);\n        if (found == -1) break;\n        pos = found + val.length;\n        newBreaks.push(Pos(lineNo, found));\n      }\n      lineNo++;\n    });\n    for (var i = newBreaks.length - 1; i >= 0; i--)\n      replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length))\n  });\n  option(\"specialChars\", /[\\u0000-\\u001f\\u007f\\u00ad\\u200b-\\u200f\\u2028\\u2029\\ufeff]/g, function(cm, val, old) {\n    cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n    if (old != CodeMirror.Init) cm.refresh();\n  });\n  option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true);\n  option(\"electricChars\", true);\n  option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function() {\n    throw new Error(\"inputStyle can not (yet) be changed in a running editor\"); // FIXME\n  }, true);\n  option(\"rtlMoveVisually\", !windows);\n  option(\"wholeLineUpdateBefore\", true);\n\n  option(\"theme\", \"default\", function(cm) {\n    themeChanged(cm);\n    guttersChanged(cm);\n  }, true);\n  option(\"keyMap\", \"default\", function(cm, val, old) {\n    var next = getKeyMap(val);\n    var prev = old != CodeMirror.Init && getKeyMap(old);\n    if (prev && prev.detach) prev.detach(cm, next);\n    if (next.attach) next.attach(cm, prev || null);\n  });\n  option(\"extraKeys\", null);\n\n  option(\"lineWrapping\", false, wrappingChanged, true);\n  option(\"gutters\", [], function(cm) {\n    setGuttersForLineNumbers(cm.options);\n    guttersChanged(cm);\n  }, true);\n  option(\"fixedGutter\", true, function(cm, val) {\n    cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n    cm.refresh();\n  }, true);\n  option(\"coverGutterNextToScrollbar\", false, function(cm) {updateScrollbars(cm);}, true);\n  option(\"scrollbarStyle\", \"native\", function(cm) {\n    initScrollbars(cm);\n    updateScrollbars(cm);\n    cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n    cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n  }, true);\n  option(\"lineNumbers\", false, function(cm) {\n    setGuttersForLineNumbers(cm.options);\n    guttersChanged(cm);\n  }, true);\n  option(\"firstLineNumber\", 1, guttersChanged, true);\n  option(\"lineNumberFormatter\", function(integer) {return integer;}, guttersChanged, true);\n  option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n  option(\"resetSelectionOnContextMenu\", true);\n  option(\"lineWiseCopyCut\", true);\n\n  option(\"readOnly\", false, function(cm, val) {\n    if (val == \"nocursor\") {\n      onBlur(cm);\n      cm.display.input.blur();\n      cm.display.disabled = true;\n    } else {\n      cm.display.disabled = false;\n    }\n    cm.display.input.readOnlyChanged(val)\n  });\n  option(\"disableInput\", false, function(cm, val) {if (!val) cm.display.input.reset();}, true);\n  option(\"dragDrop\", true, dragDropChanged);\n  option(\"allowDropFileTypes\", null);\n\n  option(\"cursorBlinkRate\", 530);\n  option(\"cursorScrollMargin\", 0);\n  option(\"cursorHeight\", 1, updateSelection, true);\n  option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n  option(\"workTime\", 100);\n  option(\"workDelay\", 100);\n  option(\"flattenSpans\", true, resetModeState, true);\n  option(\"addModeClass\", false, resetModeState, true);\n  option(\"pollInterval\", 100);\n  option(\"undoDepth\", 200, function(cm, val){cm.doc.history.undoDepth = val;});\n  option(\"historyEventDelay\", 1250);\n  option(\"viewportMargin\", 10, function(cm){cm.refresh();}, true);\n  option(\"maxHighlightLength\", 10000, resetModeState, true);\n  option(\"moveInputWithCursor\", true, function(cm, val) {\n    if (!val) cm.display.input.resetPosition();\n  });\n\n  option(\"tabindex\", null, function(cm, val) {\n    cm.display.input.getField().tabIndex = val || \"\";\n  });\n  option(\"autofocus\", null);\n\n  // MODE DEFINITION AND QUERYING\n\n  // Known modes, by name and by MIME\n  var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};\n\n  // Extra arguments are stored as the mode's dependencies, which is\n  // used by (legacy) mechanisms like loadmode.js to automatically\n  // load a mode. (Preferred mechanism is the require/define calls.)\n  CodeMirror.defineMode = function(name, mode) {\n    if (!CodeMirror.defaults.mode && name != \"null\") CodeMirror.defaults.mode = name;\n    if (arguments.length > 2)\n      mode.dependencies = Array.prototype.slice.call(arguments, 2);\n    modes[name] = mode;\n  };\n\n  CodeMirror.defineMIME = function(mime, spec) {\n    mimeModes[mime] = spec;\n  };\n\n  // Given a MIME type, a {name, ...options} config object, or a name\n  // string, return a mode config object.\n  CodeMirror.resolveMode = function(spec) {\n    if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n      spec = mimeModes[spec];\n    } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n      var found = mimeModes[spec.name];\n      if (typeof found == \"string\") found = {name: found};\n      spec = createObj(found, spec);\n      spec.name = found.name;\n    } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n      return CodeMirror.resolveMode(\"application/xml\");\n    }\n    if (typeof spec == \"string\") return {name: spec};\n    else return spec || {name: \"null\"};\n  };\n\n  // Given a mode spec (anything that resolveMode accepts), find and\n  // initialize an actual mode object.\n  CodeMirror.getMode = function(options, spec) {\n    var spec = CodeMirror.resolveMode(spec);\n    var mfactory = modes[spec.name];\n    if (!mfactory) return CodeMirror.getMode(options, \"text/plain\");\n    var modeObj = mfactory(options, spec);\n    if (modeExtensions.hasOwnProperty(spec.name)) {\n      var exts = modeExtensions[spec.name];\n      for (var prop in exts) {\n        if (!exts.hasOwnProperty(prop)) continue;\n        if (modeObj.hasOwnProperty(prop)) modeObj[\"_\" + prop] = modeObj[prop];\n        modeObj[prop] = exts[prop];\n      }\n    }\n    modeObj.name = spec.name;\n    if (spec.helperType) modeObj.helperType = spec.helperType;\n    if (spec.modeProps) for (var prop in spec.modeProps)\n      modeObj[prop] = spec.modeProps[prop];\n\n    return modeObj;\n  };\n\n  // Minimal default mode.\n  CodeMirror.defineMode(\"null\", function() {\n    return {token: function(stream) {stream.skipToEnd();}};\n  });\n  CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n  // This can be used to attach properties to mode objects from\n  // outside the actual mode definition.\n  var modeExtensions = CodeMirror.modeExtensions = {};\n  CodeMirror.extendMode = function(mode, properties) {\n    var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n    copyObj(properties, exts);\n  };\n\n  // EXTENSIONS\n\n  CodeMirror.defineExtension = function(name, func) {\n    CodeMirror.prototype[name] = func;\n  };\n  CodeMirror.defineDocExtension = function(name, func) {\n    Doc.prototype[name] = func;\n  };\n  CodeMirror.defineOption = option;\n\n  var initHooks = [];\n  CodeMirror.defineInitHook = function(f) {initHooks.push(f);};\n\n  var helpers = CodeMirror.helpers = {};\n  CodeMirror.registerHelper = function(type, name, value) {\n    if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []};\n    helpers[type][name] = value;\n  };\n  CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n    CodeMirror.registerHelper(type, name, value);\n    helpers[type]._global.push({pred: predicate, val: value});\n  };\n\n  // MODE STATE HANDLING\n\n  // Utility functions for working with state. Exported because nested\n  // modes need to do this for their inner modes.\n\n  var copyState = CodeMirror.copyState = function(mode, state) {\n    if (state === true) return state;\n    if (mode.copyState) return mode.copyState(state);\n    var nstate = {};\n    for (var n in state) {\n      var val = state[n];\n      if (val instanceof Array) val = val.concat([]);\n      nstate[n] = val;\n    }\n    return nstate;\n  };\n\n  var startState = CodeMirror.startState = function(mode, a1, a2) {\n    return mode.startState ? mode.startState(a1, a2) : true;\n  };\n\n  // Given a mode and a state (for that mode), find the inner mode and\n  // state at the position that the state refers to.\n  CodeMirror.innerMode = function(mode, state) {\n    while (mode.innerMode) {\n      var info = mode.innerMode(state);\n      if (!info || info.mode == mode) break;\n      state = info.state;\n      mode = info.mode;\n    }\n    return info || {mode: mode, state: state};\n  };\n\n  // STANDARD COMMANDS\n\n  // Commands are parameter-less actions that can be performed on an\n  // editor, mostly used for keybindings.\n  var commands = CodeMirror.commands = {\n    selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);},\n    singleSelection: function(cm) {\n      cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll);\n    },\n    killLine: function(cm) {\n      deleteNearSelection(cm, function(range) {\n        if (range.empty()) {\n          var len = getLine(cm.doc, range.head.line).text.length;\n          if (range.head.ch == len && range.head.line < cm.lastLine())\n            return {from: range.head, to: Pos(range.head.line + 1, 0)};\n          else\n            return {from: range.head, to: Pos(range.head.line, len)};\n        } else {\n          return {from: range.from(), to: range.to()};\n        }\n      });\n    },\n    deleteLine: function(cm) {\n      deleteNearSelection(cm, function(range) {\n        return {from: Pos(range.from().line, 0),\n                to: clipPos(cm.doc, Pos(range.to().line + 1, 0))};\n      });\n    },\n    delLineLeft: function(cm) {\n      deleteNearSelection(cm, function(range) {\n        return {from: Pos(range.from().line, 0), to: range.from()};\n      });\n    },\n    delWrappedLineLeft: function(cm) {\n      deleteNearSelection(cm, function(range) {\n        var top = cm.charCoords(range.head, \"div\").top + 5;\n        var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n        return {from: leftPos, to: range.from()};\n      });\n    },\n    delWrappedLineRight: function(cm) {\n      deleteNearSelection(cm, function(range) {\n        var top = cm.charCoords(range.head, \"div\").top + 5;\n        var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n        return {from: range.from(), to: rightPos };\n      });\n    },\n    undo: function(cm) {cm.undo();},\n    redo: function(cm) {cm.redo();},\n    undoSelection: function(cm) {cm.undoSelection();},\n    redoSelection: function(cm) {cm.redoSelection();},\n    goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));},\n    goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));},\n    goLineStart: function(cm) {\n      cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); },\n                            {origin: \"+move\", bias: 1});\n    },\n    goLineStartSmart: function(cm) {\n      cm.extendSelectionsBy(function(range) {\n        return lineStartSmart(cm, range.head);\n      }, {origin: \"+move\", bias: 1});\n    },\n    goLineEnd: function(cm) {\n      cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); },\n                            {origin: \"+move\", bias: -1});\n    },\n    goLineRight: function(cm) {\n      cm.extendSelectionsBy(function(range) {\n        var top = cm.charCoords(range.head, \"div\").top + 5;\n        return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n      }, sel_move);\n    },\n    goLineLeft: function(cm) {\n      cm.extendSelectionsBy(function(range) {\n        var top = cm.charCoords(range.head, \"div\").top + 5;\n        return cm.coordsChar({left: 0, top: top}, \"div\");\n      }, sel_move);\n    },\n    goLineLeftSmart: function(cm) {\n      cm.extendSelectionsBy(function(range) {\n        var top = cm.charCoords(range.head, \"div\").top + 5;\n        var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n        if (pos.ch < cm.getLine(pos.line).search(/\\S/)) return lineStartSmart(cm, range.head);\n        return pos;\n      }, sel_move);\n    },\n    goLineUp: function(cm) {cm.moveV(-1, \"line\");},\n    goLineDown: function(cm) {cm.moveV(1, \"line\");},\n    goPageUp: function(cm) {cm.moveV(-1, \"page\");},\n    goPageDown: function(cm) {cm.moveV(1, \"page\");},\n    goCharLeft: function(cm) {cm.moveH(-1, \"char\");},\n    goCharRight: function(cm) {cm.moveH(1, \"char\");},\n    goColumnLeft: function(cm) {cm.moveH(-1, \"column\");},\n    goColumnRight: function(cm) {cm.moveH(1, \"column\");},\n    goWordLeft: function(cm) {cm.moveH(-1, \"word\");},\n    goGroupRight: function(cm) {cm.moveH(1, \"group\");},\n    goGroupLeft: function(cm) {cm.moveH(-1, \"group\");},\n    goWordRight: function(cm) {cm.moveH(1, \"word\");},\n    delCharBefore: function(cm) {cm.deleteH(-1, \"char\");},\n    delCharAfter: function(cm) {cm.deleteH(1, \"char\");},\n    delWordBefore: function(cm) {cm.deleteH(-1, \"word\");},\n    delWordAfter: function(cm) {cm.deleteH(1, \"word\");},\n    delGroupBefore: function(cm) {cm.deleteH(-1, \"group\");},\n    delGroupAfter: function(cm) {cm.deleteH(1, \"group\");},\n    indentAuto: function(cm) {cm.indentSelection(\"smart\");},\n    indentMore: function(cm) {cm.indentSelection(\"add\");},\n    indentLess: function(cm) {cm.indentSelection(\"subtract\");},\n    insertTab: function(cm) {cm.replaceSelection(\"\\t\");},\n    insertSoftTab: function(cm) {\n      var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n      for (var i = 0; i < ranges.length; i++) {\n        var pos = ranges[i].from();\n        var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n        spaces.push(spaceStr(tabSize - col % tabSize));\n      }\n      cm.replaceSelections(spaces);\n    },\n    defaultTab: function(cm) {\n      if (cm.somethingSelected()) cm.indentSelection(\"add\");\n      else cm.execCommand(\"insertTab\");\n    },\n    transposeChars: function(cm) {\n      runInOp(cm, function() {\n        var ranges = cm.listSelections(), newSel = [];\n        for (var i = 0; i < ranges.length; i++) {\n          var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n          if (line) {\n            if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1);\n            if (cur.ch > 0) {\n              cur = new Pos(cur.line, cur.ch + 1);\n              cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n                              Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n            } else if (cur.line > cm.doc.first) {\n              var prev = getLine(cm.doc, cur.line - 1).text;\n              if (prev)\n                cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n                                prev.charAt(prev.length - 1),\n                                Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), \"+transpose\");\n            }\n          }\n          newSel.push(new Range(cur, cur));\n        }\n        cm.setSelections(newSel);\n      });\n    },\n    newlineAndIndent: function(cm) {\n      runInOp(cm, function() {\n        var len = cm.listSelections().length;\n        for (var i = 0; i < len; i++) {\n          var range = cm.listSelections()[i];\n          cm.replaceRange(cm.doc.lineSeparator(), range.anchor, range.head, \"+input\");\n          cm.indentLine(range.from().line + 1, null, true);\n        }\n        ensureCursorVisible(cm);\n      });\n    },\n    openLine: function(cm) {cm.replaceSelection(\"\\n\", \"start\")},\n    toggleOverwrite: function(cm) {cm.toggleOverwrite();}\n  };\n\n\n  // STANDARD KEYMAPS\n\n  var keyMap = CodeMirror.keyMap = {};\n\n  keyMap.basic = {\n    \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n    \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n    \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n    \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n    \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n    \"Esc\": \"singleSelection\"\n  };\n  // Note that the save and find-related commands aren't defined by\n  // default. User code or addons can define them. Unknown commands\n  // are simply ignored.\n  keyMap.pcDefault = {\n    \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n    \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n    \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n    \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n    \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n    \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n    \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n    fallthrough: \"basic\"\n  };\n  // Very basic readline/emacs-style bindings, which are standard on Mac.\n  keyMap.emacsy = {\n    \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n    \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n    \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n    \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\",\n    \"Ctrl-O\": \"openLine\"\n  };\n  keyMap.macDefault = {\n    \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n    \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n    \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n    \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n    \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n    \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n    \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n    fallthrough: [\"basic\", \"emacsy\"]\n  };\n  keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n  // KEYMAP DISPATCH\n\n  function normalizeKeyName(name) {\n    var parts = name.split(/-(?!$)/), name = parts[parts.length - 1];\n    var alt, ctrl, shift, cmd;\n    for (var i = 0; i < parts.length - 1; i++) {\n      var mod = parts[i];\n      if (/^(cmd|meta|m)$/i.test(mod)) cmd = true;\n      else if (/^a(lt)?$/i.test(mod)) alt = true;\n      else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;\n      else if (/^s(hift)$/i.test(mod)) shift = true;\n      else throw new Error(\"Unrecognized modifier name: \" + mod);\n    }\n    if (alt) name = \"Alt-\" + name;\n    if (ctrl) name = \"Ctrl-\" + name;\n    if (cmd) name = \"Cmd-\" + name;\n    if (shift) name = \"Shift-\" + name;\n    return name;\n  }\n\n  // This is a kludge to keep keymaps mostly working as raw objects\n  // (backwards compatibility) while at the same time support features\n  // like normalization and multi-stroke key bindings. It compiles a\n  // new normalized keymap, and then updates the old object to reflect\n  // this.\n  CodeMirror.normalizeKeyMap = function(keymap) {\n    var copy = {};\n    for (var keyname in keymap) if (keymap.hasOwnProperty(keyname)) {\n      var value = keymap[keyname];\n      if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue;\n      if (value == \"...\") { delete keymap[keyname]; continue; }\n\n      var keys = map(keyname.split(\" \"), normalizeKeyName);\n      for (var i = 0; i < keys.length; i++) {\n        var val, name;\n        if (i == keys.length - 1) {\n          name = keys.join(\" \");\n          val = value;\n        } else {\n          name = keys.slice(0, i + 1).join(\" \");\n          val = \"...\";\n        }\n        var prev = copy[name];\n        if (!prev) copy[name] = val;\n        else if (prev != val) throw new Error(\"Inconsistent bindings for \" + name);\n      }\n      delete keymap[keyname];\n    }\n    for (var prop in copy) keymap[prop] = copy[prop];\n    return keymap;\n  };\n\n  var lookupKey = CodeMirror.lookupKey = function(key, map, handle, context) {\n    map = getKeyMap(map);\n    var found = map.call ? map.call(key, context) : map[key];\n    if (found === false) return \"nothing\";\n    if (found === \"...\") return \"multi\";\n    if (found != null && handle(found)) return \"handled\";\n\n    if (map.fallthrough) {\n      if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\")\n        return lookupKey(key, map.fallthrough, handle, context);\n      for (var i = 0; i < map.fallthrough.length; i++) {\n        var result = lookupKey(key, map.fallthrough[i], handle, context);\n        if (result) return result;\n      }\n    }\n  };\n\n  // Modifier key presses don't count as 'real' key presses for the\n  // purpose of keymap fallthrough.\n  var isModifierKey = CodeMirror.isModifierKey = function(value) {\n    var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n    return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\";\n  };\n\n  // Look up the name of a key as indicated by an event object.\n  var keyName = CodeMirror.keyName = function(event, noShift) {\n    if (presto && event.keyCode == 34 && event[\"char\"]) return false;\n    var base = keyNames[event.keyCode], name = base;\n    if (name == null || event.altGraphKey) return false;\n    if (event.altKey && base != \"Alt\") name = \"Alt-\" + name;\n    if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") name = \"Ctrl-\" + name;\n    if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") name = \"Cmd-\" + name;\n    if (!noShift && event.shiftKey && base != \"Shift\") name = \"Shift-\" + name;\n    return name;\n  };\n\n  function getKeyMap(val) {\n    return typeof val == \"string\" ? keyMap[val] : val;\n  }\n\n  // FROMTEXTAREA\n\n  CodeMirror.fromTextArea = function(textarea, options) {\n    options = options ? copyObj(options) : {};\n    options.value = textarea.value;\n    if (!options.tabindex && textarea.tabIndex)\n      options.tabindex = textarea.tabIndex;\n    if (!options.placeholder && textarea.placeholder)\n      options.placeholder = textarea.placeholder;\n    // Set autofocus to true if this textarea is focused, or if it has\n    // autofocus and no other element is focused.\n    if (options.autofocus == null) {\n      var hasFocus = activeElt();\n      options.autofocus = hasFocus == textarea ||\n        textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n    }\n\n    function save() {textarea.value = cm.getValue();}\n    if (textarea.form) {\n      on(textarea.form, \"submit\", save);\n      // Deplorable hack to make the submit method do the right thing.\n      if (!options.leaveSubmitMethodAlone) {\n        var form = textarea.form, realSubmit = form.submit;\n        try {\n          var wrappedSubmit = form.submit = function() {\n            save();\n            form.submit = realSubmit;\n            form.submit();\n            form.submit = wrappedSubmit;\n          };\n        } catch(e) {}\n      }\n    }\n\n    options.finishInit = function(cm) {\n      cm.save = save;\n      cm.getTextArea = function() { return textarea; };\n      cm.toTextArea = function() {\n        cm.toTextArea = isNaN; // Prevent this from being ran twice\n        save();\n        textarea.parentNode.removeChild(cm.getWrapperElement());\n        textarea.style.display = \"\";\n        if (textarea.form) {\n          off(textarea.form, \"submit\", save);\n          if (typeof textarea.form.submit == \"function\")\n            textarea.form.submit = realSubmit;\n        }\n      };\n    };\n\n    textarea.style.display = \"none\";\n    var cm = CodeMirror(function(node) {\n      textarea.parentNode.insertBefore(node, textarea.nextSibling);\n    }, options);\n    return cm;\n  };\n\n  // STRING STREAM\n\n  // Fed to the mode parsers, provides helper functions to make\n  // parsers more succinct.\n\n  var StringStream = CodeMirror.StringStream = function(string, tabSize) {\n    this.pos = this.start = 0;\n    this.string = string;\n    this.tabSize = tabSize || 8;\n    this.lastColumnPos = this.lastColumnValue = 0;\n    this.lineStart = 0;\n  };\n\n  StringStream.prototype = {\n    eol: function() {return this.pos >= this.string.length;},\n    sol: function() {return this.pos == this.lineStart;},\n    peek: function() {return this.string.charAt(this.pos) || undefined;},\n    next: function() {\n      if (this.pos < this.string.length)\n        return this.string.charAt(this.pos++);\n    },\n    eat: function(match) {\n      var ch = this.string.charAt(this.pos);\n      if (typeof match == \"string\") var ok = ch == match;\n      else var ok = ch && (match.test ? match.test(ch) : match(ch));\n      if (ok) {++this.pos; return ch;}\n    },\n    eatWhile: function(match) {\n      var start = this.pos;\n      while (this.eat(match)){}\n      return this.pos > start;\n    },\n    eatSpace: function() {\n      var start = this.pos;\n      while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;\n      return this.pos > start;\n    },\n    skipToEnd: function() {this.pos = this.string.length;},\n    skipTo: function(ch) {\n      var found = this.string.indexOf(ch, this.pos);\n      if (found > -1) {this.pos = found; return true;}\n    },\n    backUp: function(n) {this.pos -= n;},\n    column: function() {\n      if (this.lastColumnPos < this.start) {\n        this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n        this.lastColumnPos = this.start;\n      }\n      return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n    },\n    indentation: function() {\n      return countColumn(this.string, null, this.tabSize) -\n        (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n    },\n    match: function(pattern, consume, caseInsensitive) {\n      if (typeof pattern == \"string\") {\n        var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};\n        var substr = this.string.substr(this.pos, pattern.length);\n        if (cased(substr) == cased(pattern)) {\n          if (consume !== false) this.pos += pattern.length;\n          return true;\n        }\n      } else {\n        var match = this.string.slice(this.pos).match(pattern);\n        if (match && match.index > 0) return null;\n        if (match && consume !== false) this.pos += match[0].length;\n        return match;\n      }\n    },\n    current: function(){return this.string.slice(this.start, this.pos);},\n    hideFirstChars: function(n, inner) {\n      this.lineStart += n;\n      try { return inner(); }\n      finally { this.lineStart -= n; }\n    }\n  };\n\n  // TEXTMARKERS\n\n  // Created with markText and setBookmark methods. A TextMarker is a\n  // handle that can be used to clear or find a marked position in the\n  // document. Line objects hold arrays (markedSpans) containing\n  // {from, to, marker} object pointing to such marker objects, and\n  // indicating that such a marker is present on that line. Multiple\n  // lines may point to the same marker when it spans across lines.\n  // The spans will have null for their from/to properties when the\n  // marker continues beyond the start/end of the line. Markers have\n  // links back to the lines they currently touch.\n\n  var nextMarkerId = 0;\n\n  var TextMarker = CodeMirror.TextMarker = function(doc, type) {\n    this.lines = [];\n    this.type = type;\n    this.doc = doc;\n    this.id = ++nextMarkerId;\n  };\n  eventMixin(TextMarker);\n\n  // Clear the marker.\n  TextMarker.prototype.clear = function() {\n    if (this.explicitlyCleared) return;\n    var cm = this.doc.cm, withOp = cm && !cm.curOp;\n    if (withOp) startOperation(cm);\n    if (hasHandler(this, \"clear\")) {\n      var found = this.find();\n      if (found) signalLater(this, \"clear\", found.from, found.to);\n    }\n    var min = null, max = null;\n    for (var i = 0; i < this.lines.length; ++i) {\n      var line = this.lines[i];\n      var span = getMarkedSpanFor(line.markedSpans, this);\n      if (cm && !this.collapsed) regLineChange(cm, lineNo(line), \"text\");\n      else if (cm) {\n        if (span.to != null) max = lineNo(line);\n        if (span.from != null) min = lineNo(line);\n      }\n      line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n      if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)\n        updateLineHeight(line, textHeight(cm.display));\n    }\n    if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) {\n      var visual = visualLine(this.lines[i]), len = lineLength(visual);\n      if (len > cm.display.maxLineLength) {\n        cm.display.maxLine = visual;\n        cm.display.maxLineLength = len;\n        cm.display.maxLineChanged = true;\n      }\n    }\n\n    if (min != null && cm && this.collapsed) regChange(cm, min, max + 1);\n    this.lines.length = 0;\n    this.explicitlyCleared = true;\n    if (this.atomic && this.doc.cantEdit) {\n      this.doc.cantEdit = false;\n      if (cm) reCheckSelection(cm.doc);\n    }\n    if (cm) signalLater(cm, \"markerCleared\", cm, this);\n    if (withOp) endOperation(cm);\n    if (this.parent) this.parent.clear();\n  };\n\n  // Find the position of the marker in the document. Returns a {from,\n  // to} object by default. Side can be passed to get a specific side\n  // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n  // Pos objects returned contain a line object, rather than a line\n  // number (used to prevent looking up the same line twice).\n  TextMarker.prototype.find = function(side, lineObj) {\n    if (side == null && this.type == \"bookmark\") side = 1;\n    var from, to;\n    for (var i = 0; i < this.lines.length; ++i) {\n      var line = this.lines[i];\n      var span = getMarkedSpanFor(line.markedSpans, this);\n      if (span.from != null) {\n        from = Pos(lineObj ? line : lineNo(line), span.from);\n        if (side == -1) return from;\n      }\n      if (span.to != null) {\n        to = Pos(lineObj ? line : lineNo(line), span.to);\n        if (side == 1) return to;\n      }\n    }\n    return from && {from: from, to: to};\n  };\n\n  // Signals that the marker's widget changed, and surrounding layout\n  // should be recomputed.\n  TextMarker.prototype.changed = function() {\n    var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n    if (!pos || !cm) return;\n    runInOp(cm, function() {\n      var line = pos.line, lineN = lineNo(pos.line);\n      var view = findViewForLine(cm, lineN);\n      if (view) {\n        clearLineMeasurementCacheFor(view);\n        cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n      }\n      cm.curOp.updateMaxLine = true;\n      if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n        var oldHeight = widget.height;\n        widget.height = null;\n        var dHeight = widgetHeight(widget) - oldHeight;\n        if (dHeight)\n          updateLineHeight(line, line.height + dHeight);\n      }\n    });\n  };\n\n  TextMarker.prototype.attachLine = function(line) {\n    if (!this.lines.length && this.doc.cm) {\n      var op = this.doc.cm.curOp;\n      if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n        (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);\n    }\n    this.lines.push(line);\n  };\n  TextMarker.prototype.detachLine = function(line) {\n    this.lines.splice(indexOf(this.lines, line), 1);\n    if (!this.lines.length && this.doc.cm) {\n      var op = this.doc.cm.curOp;\n      (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n    }\n  };\n\n  // Collapsed markers have unique ids, in order to be able to order\n  // them, which is needed for uniquely determining an outer marker\n  // when they overlap (they may nest, but not partially overlap).\n  var nextMarkerId = 0;\n\n  // Create a marker, wire it up to the right lines, and\n  function markText(doc, from, to, options, type) {\n    // Shared markers (across linked documents) are handled separately\n    // (markTextShared will call out to this again, once per\n    // document).\n    if (options && options.shared) return markTextShared(doc, from, to, options, type);\n    // Ensure we are in an operation.\n    if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);\n\n    var marker = new TextMarker(doc, type), diff = cmp(from, to);\n    if (options) copyObj(options, marker, false);\n    // Don't connect empty markers unless clearWhenEmpty is false\n    if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n      return marker;\n    if (marker.replacedWith) {\n      // Showing up as a widget implies collapsed (widget replaces text)\n      marker.collapsed = true;\n      marker.widgetNode = elt(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n      if (!options.handleMouseEvents) marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\");\n      if (options.insertLeft) marker.widgetNode.insertLeft = true;\n    }\n    if (marker.collapsed) {\n      if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n          from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n        throw new Error(\"Inserting collapsed marker partially overlapping an existing one\");\n      sawCollapsedSpans = true;\n    }\n\n    if (marker.addToHistory)\n      addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN);\n\n    var curLine = from.line, cm = doc.cm, updateMaxLine;\n    doc.iter(curLine, to.line + 1, function(line) {\n      if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n        updateMaxLine = true;\n      if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0);\n      addMarkedSpan(line, new MarkedSpan(marker,\n                                         curLine == from.line ? from.ch : null,\n                                         curLine == to.line ? to.ch : null));\n      ++curLine;\n    });\n    // lineIsHidden depends on the presence of the spans, so needs a second pass\n    if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {\n      if (lineIsHidden(doc, line)) updateLineHeight(line, 0);\n    });\n\n    if (marker.clearOnEnter) on(marker, \"beforeCursorEnter\", function() { marker.clear(); });\n\n    if (marker.readOnly) {\n      sawReadOnlySpans = true;\n      if (doc.history.done.length || doc.history.undone.length)\n        doc.clearHistory();\n    }\n    if (marker.collapsed) {\n      marker.id = ++nextMarkerId;\n      marker.atomic = true;\n    }\n    if (cm) {\n      // Sync editor state\n      if (updateMaxLine) cm.curOp.updateMaxLine = true;\n      if (marker.collapsed)\n        regChange(cm, from.line, to.line + 1);\n      else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)\n        for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, \"text\");\n      if (marker.atomic) reCheckSelection(cm.doc);\n      signalLater(cm, \"markerAdded\", cm, marker);\n    }\n    return marker;\n  }\n\n  // SHARED TEXTMARKERS\n\n  // A shared marker spans multiple linked documents. It is\n  // implemented as a meta-marker-object controlling multiple normal\n  // markers.\n  var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) {\n    this.markers = markers;\n    this.primary = primary;\n    for (var i = 0; i < markers.length; ++i)\n      markers[i].parent = this;\n  };\n  eventMixin(SharedTextMarker);\n\n  SharedTextMarker.prototype.clear = function() {\n    if (this.explicitlyCleared) return;\n    this.explicitlyCleared = true;\n    for (var i = 0; i < this.markers.length; ++i)\n      this.markers[i].clear();\n    signalLater(this, \"clear\");\n  };\n  SharedTextMarker.prototype.find = function(side, lineObj) {\n    return this.primary.find(side, lineObj);\n  };\n\n  function markTextShared(doc, from, to, options, type) {\n    options = copyObj(options);\n    options.shared = false;\n    var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n    var widget = options.widgetNode;\n    linkedDocs(doc, function(doc) {\n      if (widget) options.widgetNode = widget.cloneNode(true);\n      markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n      for (var i = 0; i < doc.linked.length; ++i)\n        if (doc.linked[i].isParent) return;\n      primary = lst(markers);\n    });\n    return new SharedTextMarker(markers, primary);\n  }\n\n  function findSharedMarkers(doc) {\n    return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())),\n                         function(m) { return m.parent; });\n  }\n\n  function copySharedMarkers(doc, markers) {\n    for (var i = 0; i < markers.length; i++) {\n      var marker = markers[i], pos = marker.find();\n      var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n      if (cmp(mFrom, mTo)) {\n        var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n        marker.markers.push(subMark);\n        subMark.parent = marker;\n      }\n    }\n  }\n\n  function detachSharedMarkers(markers) {\n    for (var i = 0; i < markers.length; i++) {\n      var marker = markers[i], linked = [marker.primary.doc];;\n      linkedDocs(marker.primary.doc, function(d) { linked.push(d); });\n      for (var j = 0; j < marker.markers.length; j++) {\n        var subMarker = marker.markers[j];\n        if (indexOf(linked, subMarker.doc) == -1) {\n          subMarker.parent = null;\n          marker.markers.splice(j--, 1);\n        }\n      }\n    }\n  }\n\n  // TEXTMARKER SPANS\n\n  function MarkedSpan(marker, from, to) {\n    this.marker = marker;\n    this.from = from; this.to = to;\n  }\n\n  // Search an array of spans for a span matching the given marker.\n  function getMarkedSpanFor(spans, marker) {\n    if (spans) for (var i = 0; i < spans.length; ++i) {\n      var span = spans[i];\n      if (span.marker == marker) return span;\n    }\n  }\n  // Remove a span from an array, returning undefined if no spans are\n  // left (we don't store arrays for lines without spans).\n  function removeMarkedSpan(spans, span) {\n    for (var r, i = 0; i < spans.length; ++i)\n      if (spans[i] != span) (r || (r = [])).push(spans[i]);\n    return r;\n  }\n  // Add a span to a line.\n  function addMarkedSpan(line, span) {\n    line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n    span.marker.attachLine(line);\n  }\n\n  // Used for the algorithm that adjusts markers for a change in the\n  // document. These functions cut an array of spans at a given\n  // character position, returning an array of remaining chunks (or\n  // undefined if nothing remains).\n  function markedSpansBefore(old, startCh, isInsert) {\n    if (old) for (var i = 0, nw; i < old.length; ++i) {\n      var span = old[i], marker = span.marker;\n      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n      if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n        var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);\n        (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n      }\n    }\n    return nw;\n  }\n  function markedSpansAfter(old, endCh, isInsert) {\n    if (old) for (var i = 0, nw; i < old.length; ++i) {\n      var span = old[i], marker = span.marker;\n      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n      if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n        var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);\n        (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n                                              span.to == null ? null : span.to - endCh));\n      }\n    }\n    return nw;\n  }\n\n  // Given a change object, compute the new set of marker spans that\n  // cover the line in which the change took place. Removes spans\n  // entirely within the change, reconnects spans belonging to the\n  // same marker that appear on both sides of the change, and cuts off\n  // spans partially within the change. Returns an array of span\n  // arrays with one element for each line in (after) the change.\n  function stretchSpansOverChange(doc, change) {\n    if (change.full) return null;\n    var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n    var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n    if (!oldFirst && !oldLast) return null;\n\n    var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n    // Get the spans that 'stick out' on both sides\n    var first = markedSpansBefore(oldFirst, startCh, isInsert);\n    var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n    // Next, merge those two ends\n    var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n    if (first) {\n      // Fix up .to properties of first\n      for (var i = 0; i < first.length; ++i) {\n        var span = first[i];\n        if (span.to == null) {\n          var found = getMarkedSpanFor(last, span.marker);\n          if (!found) span.to = startCh;\n          else if (sameLine) span.to = found.to == null ? null : found.to + offset;\n        }\n      }\n    }\n    if (last) {\n      // Fix up .from in last (or move them into first in case of sameLine)\n      for (var i = 0; i < last.length; ++i) {\n        var span = last[i];\n        if (span.to != null) span.to += offset;\n        if (span.from == null) {\n          var found = getMarkedSpanFor(first, span.marker);\n          if (!found) {\n            span.from = offset;\n            if (sameLine) (first || (first = [])).push(span);\n          }\n        } else {\n          span.from += offset;\n          if (sameLine) (first || (first = [])).push(span);\n        }\n      }\n    }\n    // Make sure we didn't create any zero-length spans\n    if (first) first = clearEmptySpans(first);\n    if (last && last != first) last = clearEmptySpans(last);\n\n    var newMarkers = [first];\n    if (!sameLine) {\n      // Fill gap with whole-line-spans\n      var gap = change.text.length - 2, gapMarkers;\n      if (gap > 0 && first)\n        for (var i = 0; i < first.length; ++i)\n          if (first[i].to == null)\n            (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null));\n      for (var i = 0; i < gap; ++i)\n        newMarkers.push(gapMarkers);\n      newMarkers.push(last);\n    }\n    return newMarkers;\n  }\n\n  // Remove spans that are empty and don't have a clearWhenEmpty\n  // option of false.\n  function clearEmptySpans(spans) {\n    for (var i = 0; i < spans.length; ++i) {\n      var span = spans[i];\n      if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n        spans.splice(i--, 1);\n    }\n    if (!spans.length) return null;\n    return spans;\n  }\n\n  // Used for un/re-doing changes from the history. Combines the\n  // result of computing the existing spans with the set of spans that\n  // existed in the history (so that deleting around a span and then\n  // undoing brings back the span).\n  function mergeOldSpans(doc, change) {\n    var old = getOldSpans(doc, change);\n    var stretched = stretchSpansOverChange(doc, change);\n    if (!old) return stretched;\n    if (!stretched) return old;\n\n    for (var i = 0; i < old.length; ++i) {\n      var oldCur = old[i], stretchCur = stretched[i];\n      if (oldCur && stretchCur) {\n        spans: for (var j = 0; j < stretchCur.length; ++j) {\n          var span = stretchCur[j];\n          for (var k = 0; k < oldCur.length; ++k)\n            if (oldCur[k].marker == span.marker) continue spans;\n          oldCur.push(span);\n        }\n      } else if (stretchCur) {\n        old[i] = stretchCur;\n      }\n    }\n    return old;\n  }\n\n  // Used to 'clip' out readOnly ranges when making a change.\n  function removeReadOnlyRanges(doc, from, to) {\n    var markers = null;\n    doc.iter(from.line, to.line + 1, function(line) {\n      if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {\n        var mark = line.markedSpans[i].marker;\n        if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n          (markers || (markers = [])).push(mark);\n      }\n    });\n    if (!markers) return null;\n    var parts = [{from: from, to: to}];\n    for (var i = 0; i < markers.length; ++i) {\n      var mk = markers[i], m = mk.find(0);\n      for (var j = 0; j < parts.length; ++j) {\n        var p = parts[j];\n        if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue;\n        var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n        if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n          newParts.push({from: p.from, to: m.from});\n        if (dto > 0 || !mk.inclusiveRight && !dto)\n          newParts.push({from: m.to, to: p.to});\n        parts.splice.apply(parts, newParts);\n        j += newParts.length - 1;\n      }\n    }\n    return parts;\n  }\n\n  // Connect or disconnect spans from a line.\n  function detachMarkedSpans(line) {\n    var spans = line.markedSpans;\n    if (!spans) return;\n    for (var i = 0; i < spans.length; ++i)\n      spans[i].marker.detachLine(line);\n    line.markedSpans = null;\n  }\n  function attachMarkedSpans(line, spans) {\n    if (!spans) return;\n    for (var i = 0; i < spans.length; ++i)\n      spans[i].marker.attachLine(line);\n    line.markedSpans = spans;\n  }\n\n  // Helpers used when computing which overlapping collapsed span\n  // counts as the larger one.\n  function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; }\n  function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; }\n\n  // Returns a number indicating which of two overlapping collapsed\n  // spans is larger (and thus includes the other). Falls back to\n  // comparing ids when the spans cover exactly the same range.\n  function compareCollapsedMarkers(a, b) {\n    var lenDiff = a.lines.length - b.lines.length;\n    if (lenDiff != 0) return lenDiff;\n    var aPos = a.find(), bPos = b.find();\n    var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n    if (fromCmp) return -fromCmp;\n    var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n    if (toCmp) return toCmp;\n    return b.id - a.id;\n  }\n\n  // Find out whether a line ends or starts in a collapsed span. If\n  // so, return the marker for that span.\n  function collapsedSpanAtSide(line, start) {\n    var sps = sawCollapsedSpans && line.markedSpans, found;\n    if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n      sp = sps[i];\n      if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n          (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n        found = sp.marker;\n    }\n    return found;\n  }\n  function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); }\n  function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); }\n\n  // Test whether there exists a collapsed span that partially\n  // overlaps (covers the start or end, but not both) of a new span.\n  // Such overlap is not allowed.\n  function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n    var line = getLine(doc, lineNo);\n    var sps = sawCollapsedSpans && line.markedSpans;\n    if (sps) for (var i = 0; i < sps.length; ++i) {\n      var sp = sps[i];\n      if (!sp.marker.collapsed) continue;\n      var found = sp.marker.find(0);\n      var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n      var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n      if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;\n      if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n          fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n        return true;\n    }\n  }\n\n  // A visual line is a line as drawn on the screen. Folding, for\n  // example, can cause multiple logical lines to appear on the same\n  // visual line. This finds the start of the visual line that the\n  // given line is part of (usually that is the line itself).\n  function visualLine(line) {\n    var merged;\n    while (merged = collapsedSpanAtStart(line))\n      line = merged.find(-1, true).line;\n    return line;\n  }\n\n  // Returns an array of logical lines that continue the visual line\n  // started by the argument, or undefined if there are no such lines.\n  function visualLineContinued(line) {\n    var merged, lines;\n    while (merged = collapsedSpanAtEnd(line)) {\n      line = merged.find(1, true).line;\n      (lines || (lines = [])).push(line);\n    }\n    return lines;\n  }\n\n  // Get the line number of the start of the visual line that the\n  // given line number is part of.\n  function visualLineNo(doc, lineN) {\n    var line = getLine(doc, lineN), vis = visualLine(line);\n    if (line == vis) return lineN;\n    return lineNo(vis);\n  }\n  // Get the line number of the start of the next visual line after\n  // the given line.\n  function visualLineEndNo(doc, lineN) {\n    if (lineN > doc.lastLine()) return lineN;\n    var line = getLine(doc, lineN), merged;\n    if (!lineIsHidden(doc, line)) return lineN;\n    while (merged = collapsedSpanAtEnd(line))\n      line = merged.find(1, true).line;\n    return lineNo(line) + 1;\n  }\n\n  // Compute whether a line is hidden. Lines count as hidden when they\n  // are part of a visual line that starts with another line, or when\n  // they are entirely covered by collapsed, non-widget span.\n  function lineIsHidden(doc, line) {\n    var sps = sawCollapsedSpans && line.markedSpans;\n    if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n      sp = sps[i];\n      if (!sp.marker.collapsed) continue;\n      if (sp.from == null) return true;\n      if (sp.marker.widgetNode) continue;\n      if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n        return true;\n    }\n  }\n  function lineIsHiddenInner(doc, line, span) {\n    if (span.to == null) {\n      var end = span.marker.find(1, true);\n      return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker));\n    }\n    if (span.marker.inclusiveRight && span.to == line.text.length)\n      return true;\n    for (var sp, i = 0; i < line.markedSpans.length; ++i) {\n      sp = line.markedSpans[i];\n      if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n          (sp.to == null || sp.to != span.from) &&\n          (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n          lineIsHiddenInner(doc, line, sp)) return true;\n    }\n  }\n\n  // LINE WIDGETS\n\n  // Line widgets are block elements displayed above or below a line.\n\n  var LineWidget = CodeMirror.LineWidget = function(doc, node, options) {\n    if (options) for (var opt in options) if (options.hasOwnProperty(opt))\n      this[opt] = options[opt];\n    this.doc = doc;\n    this.node = node;\n  };\n  eventMixin(LineWidget);\n\n  function adjustScrollWhenAboveVisible(cm, line, diff) {\n    if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n      addToScrollPos(cm, null, diff);\n  }\n\n  LineWidget.prototype.clear = function() {\n    var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n    if (no == null || !ws) return;\n    for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1);\n    if (!ws.length) line.widgets = null;\n    var height = widgetHeight(this);\n    updateLineHeight(line, Math.max(0, line.height - height));\n    if (cm) runInOp(cm, function() {\n      adjustScrollWhenAboveVisible(cm, line, -height);\n      regLineChange(cm, no, \"widget\");\n    });\n  };\n  LineWidget.prototype.changed = function() {\n    var oldH = this.height, cm = this.doc.cm, line = this.line;\n    this.height = null;\n    var diff = widgetHeight(this) - oldH;\n    if (!diff) return;\n    updateLineHeight(line, line.height + diff);\n    if (cm) runInOp(cm, function() {\n      cm.curOp.forceUpdate = true;\n      adjustScrollWhenAboveVisible(cm, line, diff);\n    });\n  };\n\n  function widgetHeight(widget) {\n    if (widget.height != null) return widget.height;\n    var cm = widget.doc.cm;\n    if (!cm) return 0;\n    if (!contains(document.body, widget.node)) {\n      var parentStyle = \"position: relative;\";\n      if (widget.coverGutter)\n        parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\";\n      if (widget.noHScroll)\n        parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\";\n      removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n    }\n    return widget.height = widget.node.parentNode.offsetHeight;\n  }\n\n  function addLineWidget(doc, handle, node, options) {\n    var widget = new LineWidget(doc, node, options);\n    var cm = doc.cm;\n    if (cm && widget.noHScroll) cm.display.alignWidgets = true;\n    changeLine(doc, handle, \"widget\", function(line) {\n      var widgets = line.widgets || (line.widgets = []);\n      if (widget.insertAt == null) widgets.push(widget);\n      else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);\n      widget.line = line;\n      if (cm && !lineIsHidden(doc, line)) {\n        var aboveVisible = heightAtLine(line) < doc.scrollTop;\n        updateLineHeight(line, line.height + widgetHeight(widget));\n        if (aboveVisible) addToScrollPos(cm, null, widget.height);\n        cm.curOp.forceUpdate = true;\n      }\n      return true;\n    });\n    return widget;\n  }\n\n  // LINE DATA STRUCTURE\n\n  // Line objects. These hold state related to a line, including\n  // highlighting info (the styles array).\n  var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) {\n    this.text = text;\n    attachMarkedSpans(this, markedSpans);\n    this.height = estimateHeight ? estimateHeight(this) : 1;\n  };\n  eventMixin(Line);\n  Line.prototype.lineNo = function() { return lineNo(this); };\n\n  // Change the content (text, markers) of a line. Automatically\n  // invalidates cached information and tries to re-estimate the\n  // line's height.\n  function updateLine(line, text, markedSpans, estimateHeight) {\n    line.text = text;\n    if (line.stateAfter) line.stateAfter = null;\n    if (line.styles) line.styles = null;\n    if (line.order != null) line.order = null;\n    detachMarkedSpans(line);\n    attachMarkedSpans(line, markedSpans);\n    var estHeight = estimateHeight ? estimateHeight(line) : 1;\n    if (estHeight != line.height) updateLineHeight(line, estHeight);\n  }\n\n  // Detach a line from the document tree and its markers.\n  function cleanUpLine(line) {\n    line.parent = null;\n    detachMarkedSpans(line);\n  }\n\n  function extractLineClasses(type, output) {\n    if (type) for (;;) {\n      var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n      if (!lineClass) break;\n      type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n      var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n      if (output[prop] == null)\n        output[prop] = lineClass[2];\n      else if (!(new RegExp(\"(?:^|\\s)\" + lineClass[2] + \"(?:$|\\s)\")).test(output[prop]))\n        output[prop] += \" \" + lineClass[2];\n    }\n    return type;\n  }\n\n  function callBlankLine(mode, state) {\n    if (mode.blankLine) return mode.blankLine(state);\n    if (!mode.innerMode) return;\n    var inner = CodeMirror.innerMode(mode, state);\n    if (inner.mode.blankLine) return inner.mode.blankLine(inner.state);\n  }\n\n  function readToken(mode, stream, state, inner) {\n    for (var i = 0; i < 10; i++) {\n      if (inner) inner[0] = CodeMirror.innerMode(mode, state).mode;\n      var style = mode.token(stream, state);\n      if (stream.pos > stream.start) return style;\n    }\n    throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\");\n  }\n\n  // Utility for getTokenAt and getLineTokens\n  function takeToken(cm, pos, precise, asArray) {\n    function getObj(copy) {\n      return {start: stream.start, end: stream.pos,\n              string: stream.current(),\n              type: style || null,\n              state: copy ? copyState(doc.mode, state) : state};\n    }\n\n    var doc = cm.doc, mode = doc.mode, style;\n    pos = clipPos(doc, pos);\n    var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);\n    var stream = new StringStream(line.text, cm.options.tabSize), tokens;\n    if (asArray) tokens = [];\n    while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n      stream.start = stream.pos;\n      style = readToken(mode, stream, state);\n      if (asArray) tokens.push(getObj(true));\n    }\n    return asArray ? tokens : getObj();\n  }\n\n  // Run the given mode's parser over a line, calling f for each token.\n  function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {\n    var flattenSpans = mode.flattenSpans;\n    if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;\n    var curStart = 0, curStyle = null;\n    var stream = new StringStream(text, cm.options.tabSize), style;\n    var inner = cm.options.addModeClass && [null];\n    if (text == \"\") extractLineClasses(callBlankLine(mode, state), lineClasses);\n    while (!stream.eol()) {\n      if (stream.pos > cm.options.maxHighlightLength) {\n        flattenSpans = false;\n        if (forceToEnd) processLine(cm, text, state, stream.pos);\n        stream.pos = text.length;\n        style = null;\n      } else {\n        style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);\n      }\n      if (inner) {\n        var mName = inner[0].name;\n        if (mName) style = \"m-\" + (style ? mName + \" \" + style : mName);\n      }\n      if (!flattenSpans || curStyle != style) {\n        while (curStart < stream.start) {\n          curStart = Math.min(stream.start, curStart + 50000);\n          f(curStart, curStyle);\n        }\n        curStyle = style;\n      }\n      stream.start = stream.pos;\n    }\n    while (curStart < stream.pos) {\n      // Webkit seems to refuse to render text nodes longer than 57444 characters\n      var pos = Math.min(stream.pos, curStart + 50000);\n      f(pos, curStyle);\n      curStart = pos;\n    }\n  }\n\n  // Compute a style array (an array starting with a mode generation\n  // -- for invalidation -- followed by pairs of end positions and\n  // style strings), which is used to highlight the tokens on the\n  // line.\n  function highlightLine(cm, line, state, forceToEnd) {\n    // A styles array always starts with a number identifying the\n    // mode/overlays that it is based on (for easy invalidation).\n    var st = [cm.state.modeGen], lineClasses = {};\n    // Compute the base array of styles\n    runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n      st.push(end, style);\n    }, lineClasses, forceToEnd);\n\n    // Run overlays, adjust style array.\n    for (var o = 0; o < cm.state.overlays.length; ++o) {\n      var overlay = cm.state.overlays[o], i = 1, at = 0;\n      runMode(cm, line.text, overlay.mode, true, function(end, style) {\n        var start = i;\n        // Ensure there's a token end at the current position, and that i points at it\n        while (at < end) {\n          var i_end = st[i];\n          if (i_end > end)\n            st.splice(i, 1, end, st[i+1], i_end);\n          i += 2;\n          at = Math.min(end, i_end);\n        }\n        if (!style) return;\n        if (overlay.opaque) {\n          st.splice(start, i - start, end, \"cm-overlay \" + style);\n          i = start + 2;\n        } else {\n          for (; start < i; start += 2) {\n            var cur = st[start+1];\n            st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n          }\n        }\n      }, lineClasses);\n    }\n\n    return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n  }\n\n  function getLineStyles(cm, line, updateFrontier) {\n    if (!line.styles || line.styles[0] != cm.state.modeGen) {\n      var state = getStateBefore(cm, lineNo(line));\n      var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);\n      line.stateAfter = state;\n      line.styles = result.styles;\n      if (result.classes) line.styleClasses = result.classes;\n      else if (line.styleClasses) line.styleClasses = null;\n      if (updateFrontier === cm.doc.frontier) cm.doc.frontier++;\n    }\n    return line.styles;\n  }\n\n  // Lightweight form of highlight -- proceed over this line and\n  // update state, but don't save a style array. Used for lines that\n  // aren't currently visible.\n  function processLine(cm, text, state, startAt) {\n    var mode = cm.doc.mode;\n    var stream = new StringStream(text, cm.options.tabSize);\n    stream.start = stream.pos = startAt || 0;\n    if (text == \"\") callBlankLine(mode, state);\n    while (!stream.eol()) {\n      readToken(mode, stream, state);\n      stream.start = stream.pos;\n    }\n  }\n\n  // Convert a style as returned by a mode (either null, or a string\n  // containing one or more styles) to a CSS style. This is cached,\n  // and also looks for line-wide styles.\n  var styleToClassCache = {}, styleToClassCacheWithMode = {};\n  function interpretTokenStyle(style, options) {\n    if (!style || /^\\s*$/.test(style)) return null;\n    var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n    return cache[style] ||\n      (cache[style] = style.replace(/\\S+/g, \"cm-$&\"));\n  }\n\n  // Render the DOM representation of the text of a line. Also builds\n  // up a 'line map', which points at the DOM nodes that represent\n  // specific stretches of text, and is used by the measuring code.\n  // The returned object contains the DOM node, this map, and\n  // information about line-wide styles that were set by the mode.\n  function buildLineContent(cm, lineView) {\n    // The padding-right forces the element to have a 'border', which\n    // is needed on Webkit to be able to get line-level bounding\n    // rectangles for it (in measureChar).\n    var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n    var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n                   col: 0, pos: 0, cm: cm,\n                   splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n    lineView.measure = {};\n\n    // Iterate over the logical lines that make up this visual line.\n    for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n      var line = i ? lineView.rest[i - 1] : lineView.line, order;\n      builder.pos = 0;\n      builder.addToken = buildToken;\n      // Optionally wire in some hacks into the token-rendering\n      // algorithm, to deal with browser quirks.\n      if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n        builder.addToken = buildTokenBadBidi(builder.addToken, order);\n      builder.map = [];\n      var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n      insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n      if (line.styleClasses) {\n        if (line.styleClasses.bgClass)\n          builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n        if (line.styleClasses.textClass)\n          builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n      }\n\n      // Ensure at least a single node is present, for measuring.\n      if (builder.map.length == 0)\n        builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n      // Store the map and a cache object for the current logical line\n      if (i == 0) {\n        lineView.measure.map = builder.map;\n        lineView.measure.cache = {};\n      } else {\n        (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n        (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n      }\n    }\n\n    // See issue #2901\n    if (webkit) {\n      var last = builder.content.lastChild\n      if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n        builder.content.className = \"cm-tab-wrap-hack\";\n    }\n\n    signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n    if (builder.pre.className)\n      builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n    return builder;\n  }\n\n  function defaultSpecialCharPlaceholder(ch) {\n    var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n    token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n    token.setAttribute(\"aria-label\", token.title);\n    return token;\n  }\n\n  // Build up the DOM representation for a single token, and add it to\n  // the line map. Takes care to render special characters separately.\n  function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n    if (!text) return;\n    var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;\n    var special = builder.cm.state.specialChars, mustWrap = false;\n    if (!special.test(text)) {\n      builder.col += text.length;\n      var content = document.createTextNode(displayText);\n      builder.map.push(builder.pos, builder.pos + text.length, content);\n      if (ie && ie_version < 9) mustWrap = true;\n      builder.pos += text.length;\n    } else {\n      var content = document.createDocumentFragment(), pos = 0;\n      while (true) {\n        special.lastIndex = pos;\n        var m = special.exec(text);\n        var skipped = m ? m.index - pos : text.length - pos;\n        if (skipped) {\n          var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n          if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n          else content.appendChild(txt);\n          builder.map.push(builder.pos, builder.pos + skipped, txt);\n          builder.col += skipped;\n          builder.pos += skipped;\n        }\n        if (!m) break;\n        pos += skipped + 1;\n        if (m[0] == \"\\t\") {\n          var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n          var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n          txt.setAttribute(\"role\", \"presentation\");\n          txt.setAttribute(\"cm-text\", \"\\t\");\n          builder.col += tabWidth;\n        } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n          var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n          txt.setAttribute(\"cm-text\", m[0]);\n          builder.col += 1;\n        } else {\n          var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n          txt.setAttribute(\"cm-text\", m[0]);\n          if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n          else content.appendChild(txt);\n          builder.col += 1;\n        }\n        builder.map.push(builder.pos, builder.pos + 1, txt);\n        builder.pos++;\n      }\n    }\n    if (style || startStyle || endStyle || mustWrap || css) {\n      var fullStyle = style || \"\";\n      if (startStyle) fullStyle += startStyle;\n      if (endStyle) fullStyle += endStyle;\n      var token = elt(\"span\", [content], fullStyle, css);\n      if (title) token.title = title;\n      return builder.content.appendChild(token);\n    }\n    builder.content.appendChild(content);\n  }\n\n  function splitSpaces(old) {\n    var out = \" \";\n    for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? \" \" : \"\\u00a0\";\n    out += \" \";\n    return out;\n  }\n\n  // Work around nonsense dimensions being reported for stretches of\n  // right-to-left text.\n  function buildTokenBadBidi(inner, order) {\n    return function(builder, text, style, startStyle, endStyle, title, css) {\n      style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n      var start = builder.pos, end = start + text.length;\n      for (;;) {\n        // Find the part that overlaps with the start of this text\n        for (var i = 0; i < order.length; i++) {\n          var part = order[i];\n          if (part.to > start && part.from <= start) break;\n        }\n        if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title, css);\n        inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);\n        startStyle = null;\n        text = text.slice(part.to - start);\n        start = part.to;\n      }\n    };\n  }\n\n  function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n    var widget = !ignoreWidget && marker.widgetNode;\n    if (widget) builder.map.push(builder.pos, builder.pos + size, widget);\n    if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n      if (!widget)\n        widget = builder.content.appendChild(document.createElement(\"span\"));\n      widget.setAttribute(\"cm-marker\", marker.id);\n    }\n    if (widget) {\n      builder.cm.display.input.setUneditable(widget);\n      builder.content.appendChild(widget);\n    }\n    builder.pos += size;\n  }\n\n  // Outputs a number of spans to make up a line, taking highlighting\n  // and marked text into account.\n  function insertLineContent(line, builder, styles) {\n    var spans = line.markedSpans, allText = line.text, at = 0;\n    if (!spans) {\n      for (var i = 1; i < styles.length; i+=2)\n        builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n      return;\n    }\n\n    var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n    var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n    for (;;) {\n      if (nextChange == pos) { // Update current marker set\n        spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n        collapsed = null; nextChange = Infinity;\n        var foundBookmarks = [], endStyles\n        for (var j = 0; j < spans.length; ++j) {\n          var sp = spans[j], m = sp.marker;\n          if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n            foundBookmarks.push(m);\n          } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n            if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n              nextChange = sp.to;\n              spanEndStyle = \"\";\n            }\n            if (m.className) spanStyle += \" \" + m.className;\n            if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n            if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n            if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n            if (m.title && !title) title = m.title;\n            if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n              collapsed = sp;\n          } else if (sp.from > pos && nextChange > sp.from) {\n            nextChange = sp.from;\n          }\n        }\n        if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n          if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\n        if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n          buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n        if (collapsed && (collapsed.from || 0) == pos) {\n          buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n                             collapsed.marker, collapsed.from == null);\n          if (collapsed.to == null) return;\n          if (collapsed.to == pos) collapsed = false;\n        }\n      }\n      if (pos >= len) break;\n\n      var upto = Math.min(len, nextChange);\n      while (true) {\n        if (text) {\n          var end = pos + text.length;\n          if (!collapsed) {\n            var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n            builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n                             spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n          }\n          if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n          pos = end;\n          spanStartStyle = \"\";\n        }\n        text = allText.slice(at, at = styles[i++]);\n        style = interpretTokenStyle(styles[i++], builder.cm.options);\n      }\n    }\n  }\n\n  // DOCUMENT DATA STRUCTURE\n\n  // By default, updates that start and end at the beginning of a line\n  // are treated specially, in order to make the association of line\n  // widgets and marker elements with the text behave more intuitive.\n  function isWholeLineUpdate(doc, change) {\n    return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n      (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n  }\n\n  // Perform a change on the document data structure.\n  function updateDoc(doc, change, markedSpans, estimateHeight) {\n    function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n    function update(line, text, spans) {\n      updateLine(line, text, spans, estimateHeight);\n      signalLater(line, \"change\", line, change);\n    }\n    function linesFor(start, end) {\n      for (var i = start, result = []; i < end; ++i)\n        result.push(new Line(text[i], spansFor(i), estimateHeight));\n      return result;\n    }\n\n    var from = change.from, to = change.to, text = change.text;\n    var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n    var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n    // Adjust the line structure\n    if (change.full) {\n      doc.insert(0, linesFor(0, text.length));\n      doc.remove(text.length, doc.size - text.length);\n    } else if (isWholeLineUpdate(doc, change)) {\n      // This is a whole-line replace. Treated specially to make\n      // sure line objects move the way they are supposed to.\n      var added = linesFor(0, text.length - 1);\n      update(lastLine, lastLine.text, lastSpans);\n      if (nlines) doc.remove(from.line, nlines);\n      if (added.length) doc.insert(from.line, added);\n    } else if (firstLine == lastLine) {\n      if (text.length == 1) {\n        update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n      } else {\n        var added = linesFor(1, text.length - 1);\n        added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n        update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n        doc.insert(from.line + 1, added);\n      }\n    } else if (text.length == 1) {\n      update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n      doc.remove(from.line + 1, nlines);\n    } else {\n      update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n      update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n      var added = linesFor(1, text.length - 1);\n      if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n      doc.insert(from.line + 1, added);\n    }\n\n    signalLater(doc, \"change\", doc, change);\n  }\n\n  // The document is represented as a BTree consisting of leaves, with\n  // chunk of lines in them, and branches, with up to ten leaves or\n  // other branch nodes below them. The top node is always a branch\n  // node, and is the document object itself (meaning it has\n  // additional methods and properties).\n  //\n  // All nodes have parent links. The tree is used both to go from\n  // line numbers to line objects, and to go from objects to numbers.\n  // It also indexes by height, and is used to convert between height\n  // and line object, and to find the total height of the document.\n  //\n  // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n  function LeafChunk(lines) {\n    this.lines = lines;\n    this.parent = null;\n    for (var i = 0, height = 0; i < lines.length; ++i) {\n      lines[i].parent = this;\n      height += lines[i].height;\n    }\n    this.height = height;\n  }\n\n  LeafChunk.prototype = {\n    chunkSize: function() { return this.lines.length; },\n    // Remove the n lines at offset 'at'.\n    removeInner: function(at, n) {\n      for (var i = at, e = at + n; i < e; ++i) {\n        var line = this.lines[i];\n        this.height -= line.height;\n        cleanUpLine(line);\n        signalLater(line, \"delete\");\n      }\n      this.lines.splice(at, n);\n    },\n    // Helper used to collapse a small branch into a single leaf.\n    collapse: function(lines) {\n      lines.push.apply(lines, this.lines);\n    },\n    // Insert the given array of lines at offset 'at', count them as\n    // having the given height.\n    insertInner: function(at, lines, height) {\n      this.height += height;\n      this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n      for (var i = 0; i < lines.length; ++i) lines[i].parent = this;\n    },\n    // Used to iterate over a part of the tree.\n    iterN: function(at, n, op) {\n      for (var e = at + n; at < e; ++at)\n        if (op(this.lines[at])) return true;\n    }\n  };\n\n  function BranchChunk(children) {\n    this.children = children;\n    var size = 0, height = 0;\n    for (var i = 0; i < children.length; ++i) {\n      var ch = children[i];\n      size += ch.chunkSize(); height += ch.height;\n      ch.parent = this;\n    }\n    this.size = size;\n    this.height = height;\n    this.parent = null;\n  }\n\n  BranchChunk.prototype = {\n    chunkSize: function() { return this.size; },\n    removeInner: function(at, n) {\n      this.size -= n;\n      for (var i = 0; i < this.children.length; ++i) {\n        var child = this.children[i], sz = child.chunkSize();\n        if (at < sz) {\n          var rm = Math.min(n, sz - at), oldHeight = child.height;\n          child.removeInner(at, rm);\n          this.height -= oldHeight - child.height;\n          if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }\n          if ((n -= rm) == 0) break;\n          at = 0;\n        } else at -= sz;\n      }\n      // If the result is smaller than 25 lines, ensure that it is a\n      // single leaf node.\n      if (this.size - n < 25 &&\n          (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n        var lines = [];\n        this.collapse(lines);\n        this.children = [new LeafChunk(lines)];\n        this.children[0].parent = this;\n      }\n    },\n    collapse: function(lines) {\n      for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines);\n    },\n    insertInner: function(at, lines, height) {\n      this.size += lines.length;\n      this.height += height;\n      for (var i = 0; i < this.children.length; ++i) {\n        var child = this.children[i], sz = child.chunkSize();\n        if (at <= sz) {\n          child.insertInner(at, lines, height);\n          if (child.lines && child.lines.length > 50) {\n            // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n            // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n            var remaining = child.lines.length % 25 + 25\n            for (var pos = remaining; pos < child.lines.length;) {\n              var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n              child.height -= leaf.height;\n              this.children.splice(++i, 0, leaf);\n              leaf.parent = this;\n            }\n            child.lines = child.lines.slice(0, remaining);\n            this.maybeSpill();\n          }\n          break;\n        }\n        at -= sz;\n      }\n    },\n    // When a node has grown, check whether it should be split.\n    maybeSpill: function() {\n      if (this.children.length <= 10) return;\n      var me = this;\n      do {\n        var spilled = me.children.splice(me.children.length - 5, 5);\n        var sibling = new BranchChunk(spilled);\n        if (!me.parent) { // Become the parent node\n          var copy = new BranchChunk(me.children);\n          copy.parent = me;\n          me.children = [copy, sibling];\n          me = copy;\n       } else {\n          me.size -= sibling.size;\n          me.height -= sibling.height;\n          var myIndex = indexOf(me.parent.children, me);\n          me.parent.children.splice(myIndex + 1, 0, sibling);\n        }\n        sibling.parent = me.parent;\n      } while (me.children.length > 10);\n      me.parent.maybeSpill();\n    },\n    iterN: function(at, n, op) {\n      for (var i = 0; i < this.children.length; ++i) {\n        var child = this.children[i], sz = child.chunkSize();\n        if (at < sz) {\n          var used = Math.min(n, sz - at);\n          if (child.iterN(at, used, op)) return true;\n          if ((n -= used) == 0) break;\n          at = 0;\n        } else at -= sz;\n      }\n    }\n  };\n\n  var nextDocId = 0;\n  var Doc = CodeMirror.Doc = function(text, mode, firstLine, lineSep) {\n    if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep);\n    if (firstLine == null) firstLine = 0;\n\n    BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n    this.first = firstLine;\n    this.scrollTop = this.scrollLeft = 0;\n    this.cantEdit = false;\n    this.cleanGeneration = 1;\n    this.frontier = firstLine;\n    var start = Pos(firstLine, 0);\n    this.sel = simpleSelection(start);\n    this.history = new History(null);\n    this.id = ++nextDocId;\n    this.modeOption = mode;\n    this.lineSep = lineSep;\n    this.extend = false;\n\n    if (typeof text == \"string\") text = this.splitLines(text);\n    updateDoc(this, {from: start, to: start, text: text});\n    setSelection(this, simpleSelection(start), sel_dontScroll);\n  };\n\n  Doc.prototype = createObj(BranchChunk.prototype, {\n    constructor: Doc,\n    // Iterate over the document. Supports two forms -- with only one\n    // argument, it calls that for each line in the document. With\n    // three, it iterates over the range given by the first two (with\n    // the second being non-inclusive).\n    iter: function(from, to, op) {\n      if (op) this.iterN(from - this.first, to - from, op);\n      else this.iterN(this.first, this.first + this.size, from);\n    },\n\n    // Non-public interface for adding and removing lines.\n    insert: function(at, lines) {\n      var height = 0;\n      for (var i = 0; i < lines.length; ++i) height += lines[i].height;\n      this.insertInner(at - this.first, lines, height);\n    },\n    remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n    // From here, the methods are part of the public interface. Most\n    // are also available from CodeMirror (editor) instances.\n\n    getValue: function(lineSep) {\n      var lines = getLines(this, this.first, this.first + this.size);\n      if (lineSep === false) return lines;\n      return lines.join(lineSep || this.lineSeparator());\n    },\n    setValue: docMethodOp(function(code) {\n      var top = Pos(this.first, 0), last = this.first + this.size - 1;\n      makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n                        text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n      setSelection(this, simpleSelection(top));\n    }),\n    replaceRange: function(code, from, to, origin) {\n      from = clipPos(this, from);\n      to = to ? clipPos(this, to) : from;\n      replaceRange(this, code, from, to, origin);\n    },\n    getRange: function(from, to, lineSep) {\n      var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n      if (lineSep === false) return lines;\n      return lines.join(lineSep || this.lineSeparator());\n    },\n\n    getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},\n\n    getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);},\n    getLineNumber: function(line) {return lineNo(line);},\n\n    getLineHandleVisualStart: function(line) {\n      if (typeof line == \"number\") line = getLine(this, line);\n      return visualLine(line);\n    },\n\n    lineCount: function() {return this.size;},\n    firstLine: function() {return this.first;},\n    lastLine: function() {return this.first + this.size - 1;},\n\n    clipPos: function(pos) {return clipPos(this, pos);},\n\n    getCursor: function(start) {\n      var range = this.sel.primary(), pos;\n      if (start == null || start == \"head\") pos = range.head;\n      else if (start == \"anchor\") pos = range.anchor;\n      else if (start == \"end\" || start == \"to\" || start === false) pos = range.to();\n      else pos = range.from();\n      return pos;\n    },\n    listSelections: function() { return this.sel.ranges; },\n    somethingSelected: function() {return this.sel.somethingSelected();},\n\n    setCursor: docMethodOp(function(line, ch, options) {\n      setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n    }),\n    setSelection: docMethodOp(function(anchor, head, options) {\n      setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n    }),\n    extendSelection: docMethodOp(function(head, other, options) {\n      extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n    }),\n    extendSelections: docMethodOp(function(heads, options) {\n      extendSelections(this, clipPosArray(this, heads), options);\n    }),\n    extendSelectionsBy: docMethodOp(function(f, options) {\n      var heads = map(this.sel.ranges, f);\n      extendSelections(this, clipPosArray(this, heads), options);\n    }),\n    setSelections: docMethodOp(function(ranges, primary, options) {\n      if (!ranges.length) return;\n      for (var i = 0, out = []; i < ranges.length; i++)\n        out[i] = new Range(clipPos(this, ranges[i].anchor),\n                           clipPos(this, ranges[i].head));\n      if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex);\n      setSelection(this, normalizeSelection(out, primary), options);\n    }),\n    addSelection: docMethodOp(function(anchor, head, options) {\n      var ranges = this.sel.ranges.slice(0);\n      ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n      setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);\n    }),\n\n    getSelection: function(lineSep) {\n      var ranges = this.sel.ranges, lines;\n      for (var i = 0; i < ranges.length; i++) {\n        var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n        lines = lines ? lines.concat(sel) : sel;\n      }\n      if (lineSep === false) return lines;\n      else return lines.join(lineSep || this.lineSeparator());\n    },\n    getSelections: function(lineSep) {\n      var parts = [], ranges = this.sel.ranges;\n      for (var i = 0; i < ranges.length; i++) {\n        var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n        if (lineSep !== false) sel = sel.join(lineSep || this.lineSeparator());\n        parts[i] = sel;\n      }\n      return parts;\n    },\n    replaceSelection: function(code, collapse, origin) {\n      var dup = [];\n      for (var i = 0; i < this.sel.ranges.length; i++)\n        dup[i] = code;\n      this.replaceSelections(dup, collapse, origin || \"+input\");\n    },\n    replaceSelections: docMethodOp(function(code, collapse, origin) {\n      var changes = [], sel = this.sel;\n      for (var i = 0; i < sel.ranges.length; i++) {\n        var range = sel.ranges[i];\n        changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};\n      }\n      var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n      for (var i = changes.length - 1; i >= 0; i--)\n        makeChange(this, changes[i]);\n      if (newSel) setSelectionReplaceHistory(this, newSel);\n      else if (this.cm) ensureCursorVisible(this.cm);\n    }),\n    undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n    redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n    undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n    redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n    setExtending: function(val) {this.extend = val;},\n    getExtending: function() {return this.extend;},\n\n    historySize: function() {\n      var hist = this.history, done = 0, undone = 0;\n      for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done;\n      for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone;\n      return {undo: done, redo: undone};\n    },\n    clearHistory: function() {this.history = new History(this.history.maxGeneration);},\n\n    markClean: function() {\n      this.cleanGeneration = this.changeGeneration(true);\n    },\n    changeGeneration: function(forceSplit) {\n      if (forceSplit)\n        this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null;\n      return this.history.generation;\n    },\n    isClean: function (gen) {\n      return this.history.generation == (gen || this.cleanGeneration);\n    },\n\n    getHistory: function() {\n      return {done: copyHistoryArray(this.history.done),\n              undone: copyHistoryArray(this.history.undone)};\n    },\n    setHistory: function(histData) {\n      var hist = this.history = new History(this.history.maxGeneration);\n      hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n      hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n    },\n\n    addLineClass: docMethodOp(function(handle, where, cls) {\n      return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n        var prop = where == \"text\" ? \"textClass\"\n                 : where == \"background\" ? \"bgClass\"\n                 : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n        if (!line[prop]) line[prop] = cls;\n        else if (classTest(cls).test(line[prop])) return false;\n        else line[prop] += \" \" + cls;\n        return true;\n      });\n    }),\n    removeLineClass: docMethodOp(function(handle, where, cls) {\n      return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n        var prop = where == \"text\" ? \"textClass\"\n                 : where == \"background\" ? \"bgClass\"\n                 : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n        var cur = line[prop];\n        if (!cur) return false;\n        else if (cls == null) line[prop] = null;\n        else {\n          var found = cur.match(classTest(cls));\n          if (!found) return false;\n          var end = found.index + found[0].length;\n          line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n        }\n        return true;\n      });\n    }),\n\n    addLineWidget: docMethodOp(function(handle, node, options) {\n      return addLineWidget(this, handle, node, options);\n    }),\n    removeLineWidget: function(widget) { widget.clear(); },\n\n    markText: function(from, to, options) {\n      return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\");\n    },\n    setBookmark: function(pos, options) {\n      var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n                      insertLeft: options && options.insertLeft,\n                      clearWhenEmpty: false, shared: options && options.shared,\n                      handleMouseEvents: options && options.handleMouseEvents};\n      pos = clipPos(this, pos);\n      return markText(this, pos, pos, realOpts, \"bookmark\");\n    },\n    findMarksAt: function(pos) {\n      pos = clipPos(this, pos);\n      var markers = [], spans = getLine(this, pos.line).markedSpans;\n      if (spans) for (var i = 0; i < spans.length; ++i) {\n        var span = spans[i];\n        if ((span.from == null || span.from <= pos.ch) &&\n            (span.to == null || span.to >= pos.ch))\n          markers.push(span.marker.parent || span.marker);\n      }\n      return markers;\n    },\n    findMarks: function(from, to, filter) {\n      from = clipPos(this, from); to = clipPos(this, to);\n      var found = [], lineNo = from.line;\n      this.iter(from.line, to.line + 1, function(line) {\n        var spans = line.markedSpans;\n        if (spans) for (var i = 0; i < spans.length; i++) {\n          var span = spans[i];\n          if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||\n                span.from == null && lineNo != from.line ||\n                span.from != null && lineNo == to.line && span.from >= to.ch) &&\n              (!filter || filter(span.marker)))\n            found.push(span.marker.parent || span.marker);\n        }\n        ++lineNo;\n      });\n      return found;\n    },\n    getAllMarks: function() {\n      var markers = [];\n      this.iter(function(line) {\n        var sps = line.markedSpans;\n        if (sps) for (var i = 0; i < sps.length; ++i)\n          if (sps[i].from != null) markers.push(sps[i].marker);\n      });\n      return markers;\n    },\n\n    posFromIndex: function(off) {\n      var ch, lineNo = this.first, sepSize = this.lineSeparator().length;\n      this.iter(function(line) {\n        var sz = line.text.length + sepSize;\n        if (sz > off) { ch = off; return true; }\n        off -= sz;\n        ++lineNo;\n      });\n      return clipPos(this, Pos(lineNo, ch));\n    },\n    indexFromPos: function (coords) {\n      coords = clipPos(this, coords);\n      var index = coords.ch;\n      if (coords.line < this.first || coords.ch < 0) return 0;\n      var sepSize = this.lineSeparator().length;\n      this.iter(this.first, coords.line, function (line) {\n        index += line.text.length + sepSize;\n      });\n      return index;\n    },\n\n    copy: function(copyHistory) {\n      var doc = new Doc(getLines(this, this.first, this.first + this.size),\n                        this.modeOption, this.first, this.lineSep);\n      doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n      doc.sel = this.sel;\n      doc.extend = false;\n      if (copyHistory) {\n        doc.history.undoDepth = this.history.undoDepth;\n        doc.setHistory(this.getHistory());\n      }\n      return doc;\n    },\n\n    linkedDoc: function(options) {\n      if (!options) options = {};\n      var from = this.first, to = this.first + this.size;\n      if (options.from != null && options.from > from) from = options.from;\n      if (options.to != null && options.to < to) to = options.to;\n      var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep);\n      if (options.sharedHist) copy.history = this.history;\n      (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n      copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n      copySharedMarkers(copy, findSharedMarkers(this));\n      return copy;\n    },\n    unlinkDoc: function(other) {\n      if (other instanceof CodeMirror) other = other.doc;\n      if (this.linked) for (var i = 0; i < this.linked.length; ++i) {\n        var link = this.linked[i];\n        if (link.doc != other) continue;\n        this.linked.splice(i, 1);\n        other.unlinkDoc(this);\n        detachSharedMarkers(findSharedMarkers(this));\n        break;\n      }\n      // If the histories were shared, split them again\n      if (other.history == this.history) {\n        var splitIds = [other.id];\n        linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true);\n        other.history = new History(null);\n        other.history.done = copyHistoryArray(this.history.done, splitIds);\n        other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n      }\n    },\n    iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n    getMode: function() {return this.mode;},\n    getEditor: function() {return this.cm;},\n\n    splitLines: function(str) {\n      if (this.lineSep) return str.split(this.lineSep);\n      return splitLinesAuto(str);\n    },\n    lineSeparator: function() { return this.lineSep || \"\\n\"; }\n  });\n\n  // Public alias.\n  Doc.prototype.eachLine = Doc.prototype.iter;\n\n  // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n  var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n  for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n    CodeMirror.prototype[prop] = (function(method) {\n      return function() {return method.apply(this.doc, arguments);};\n    })(Doc.prototype[prop]);\n\n  eventMixin(Doc);\n\n  // Call f for all linked documents.\n  function linkedDocs(doc, f, sharedHistOnly) {\n    function propagate(doc, skip, sharedHist) {\n      if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n        var rel = doc.linked[i];\n        if (rel.doc == skip) continue;\n        var shared = sharedHist && rel.sharedHist;\n        if (sharedHistOnly && !shared) continue;\n        f(rel.doc, shared);\n        propagate(rel.doc, doc, shared);\n      }\n    }\n    propagate(doc, null, true);\n  }\n\n  // Attach a document to an editor.\n  function attachDoc(cm, doc) {\n    if (doc.cm) throw new Error(\"This document is already in use.\");\n    cm.doc = doc;\n    doc.cm = cm;\n    estimateLineHeights(cm);\n    loadMode(cm);\n    if (!cm.options.lineWrapping) findMaxLine(cm);\n    cm.options.mode = doc.modeOption;\n    regChange(cm);\n  }\n\n  // LINE UTILITIES\n\n  // Find the line object corresponding to the given line number.\n  function getLine(doc, n) {\n    n -= doc.first;\n    if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n    for (var chunk = doc; !chunk.lines;) {\n      for (var i = 0;; ++i) {\n        var child = chunk.children[i], sz = child.chunkSize();\n        if (n < sz) { chunk = child; break; }\n        n -= sz;\n      }\n    }\n    return chunk.lines[n];\n  }\n\n  // Get the part of a document between two positions, as an array of\n  // strings.\n  function getBetween(doc, start, end) {\n    var out = [], n = start.line;\n    doc.iter(start.line, end.line + 1, function(line) {\n      var text = line.text;\n      if (n == end.line) text = text.slice(0, end.ch);\n      if (n == start.line) text = text.slice(start.ch);\n      out.push(text);\n      ++n;\n    });\n    return out;\n  }\n  // Get the lines between from and to, as array of strings.\n  function getLines(doc, from, to) {\n    var out = [];\n    doc.iter(from, to, function(line) { out.push(line.text); });\n    return out;\n  }\n\n  // Update the height of a line, propagating the height change\n  // upwards to parent nodes.\n  function updateLineHeight(line, height) {\n    var diff = height - line.height;\n    if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n  }\n\n  // Given a line object, find its line number by walking up through\n  // its parent links.\n  function lineNo(line) {\n    if (line.parent == null) return null;\n    var cur = line.parent, no = indexOf(cur.lines, line);\n    for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n      for (var i = 0;; ++i) {\n        if (chunk.children[i] == cur) break;\n        no += chunk.children[i].chunkSize();\n      }\n    }\n    return no + cur.first;\n  }\n\n  // Find the line at the given vertical position, using the height\n  // information in the document tree.\n  function lineAtHeight(chunk, h) {\n    var n = chunk.first;\n    outer: do {\n      for (var i = 0; i < chunk.children.length; ++i) {\n        var child = chunk.children[i], ch = child.height;\n        if (h < ch) { chunk = child; continue outer; }\n        h -= ch;\n        n += child.chunkSize();\n      }\n      return n;\n    } while (!chunk.lines);\n    for (var i = 0; i < chunk.lines.length; ++i) {\n      var line = chunk.lines[i], lh = line.height;\n      if (h < lh) break;\n      h -= lh;\n    }\n    return n + i;\n  }\n\n\n  // Find the height above the given line.\n  function heightAtLine(lineObj) {\n    lineObj = visualLine(lineObj);\n\n    var h = 0, chunk = lineObj.parent;\n    for (var i = 0; i < chunk.lines.length; ++i) {\n      var line = chunk.lines[i];\n      if (line == lineObj) break;\n      else h += line.height;\n    }\n    for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n      for (var i = 0; i < p.children.length; ++i) {\n        var cur = p.children[i];\n        if (cur == chunk) break;\n        else h += cur.height;\n      }\n    }\n    return h;\n  }\n\n  // Get the bidi ordering for the given line (and cache it). Returns\n  // false for lines that are fully left-to-right, and an array of\n  // BidiSpan objects otherwise.\n  function getOrder(line) {\n    var order = line.order;\n    if (order == null) order = line.order = bidiOrdering(line.text);\n    return order;\n  }\n\n  // HISTORY\n\n  function History(startGen) {\n    // Arrays of change events and selections. Doing something adds an\n    // event to done and clears undo. Undoing moves events from done\n    // to undone, redoing moves them in the other direction.\n    this.done = []; this.undone = [];\n    this.undoDepth = Infinity;\n    // Used to track when changes can be merged into a single undo\n    // event\n    this.lastModTime = this.lastSelTime = 0;\n    this.lastOp = this.lastSelOp = null;\n    this.lastOrigin = this.lastSelOrigin = null;\n    // Used by the isClean() method\n    this.generation = this.maxGeneration = startGen || 1;\n  }\n\n  // Create a history change event from an updateDoc-style change\n  // object.\n  function historyChangeFromChange(doc, change) {\n    var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n    attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n    linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n    return histChange;\n  }\n\n  // Pop all selection events off the end of a history array. Stop at\n  // a change event.\n  function clearSelectionEvents(array) {\n    while (array.length) {\n      var last = lst(array);\n      if (last.ranges) array.pop();\n      else break;\n    }\n  }\n\n  // Find the top change event in the history. Pop off selection\n  // events that are in the way.\n  function lastChangeEvent(hist, force) {\n    if (force) {\n      clearSelectionEvents(hist.done);\n      return lst(hist.done);\n    } else if (hist.done.length && !lst(hist.done).ranges) {\n      return lst(hist.done);\n    } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n      hist.done.pop();\n      return lst(hist.done);\n    }\n  }\n\n  // Register a change in the history. Merges changes that are within\n  // a single operation, ore are close together with an origin that\n  // allows merging (starting with \"+\") into a single event.\n  function addChangeToHistory(doc, change, selAfter, opId) {\n    var hist = doc.history;\n    hist.undone.length = 0;\n    var time = +new Date, cur;\n\n    if ((hist.lastOp == opId ||\n         hist.lastOrigin == change.origin && change.origin &&\n         ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n          change.origin.charAt(0) == \"*\")) &&\n        (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n      // Merge this change into the last event\n      var last = lst(cur.changes);\n      if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n        // Optimized case for simple insertion -- don't want to add\n        // new changesets for every character typed\n        last.to = changeEnd(change);\n      } else {\n        // Add new sub-event\n        cur.changes.push(historyChangeFromChange(doc, change));\n      }\n    } else {\n      // Can not be merged, start a new event.\n      var before = lst(hist.done);\n      if (!before || !before.ranges)\n        pushSelectionToHistory(doc.sel, hist.done);\n      cur = {changes: [historyChangeFromChange(doc, change)],\n             generation: hist.generation};\n      hist.done.push(cur);\n      while (hist.done.length > hist.undoDepth) {\n        hist.done.shift();\n        if (!hist.done[0].ranges) hist.done.shift();\n      }\n    }\n    hist.done.push(selAfter);\n    hist.generation = ++hist.maxGeneration;\n    hist.lastModTime = hist.lastSelTime = time;\n    hist.lastOp = hist.lastSelOp = opId;\n    hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n    if (!last) signal(doc, \"historyAdded\");\n  }\n\n  function selectionEventCanBeMerged(doc, origin, prev, sel) {\n    var ch = origin.charAt(0);\n    return ch == \"*\" ||\n      ch == \"+\" &&\n      prev.ranges.length == sel.ranges.length &&\n      prev.somethingSelected() == sel.somethingSelected() &&\n      new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);\n  }\n\n  // Called whenever the selection changes, sets the new selection as\n  // the pending selection in the history, and pushes the old pending\n  // selection into the 'done' array when it was significantly\n  // different (in number of selected ranges, emptiness, or time).\n  function addSelectionToHistory(doc, sel, opId, options) {\n    var hist = doc.history, origin = options && options.origin;\n\n    // A new event is started when the previous origin does not match\n    // the current, or the origins don't allow matching. Origins\n    // starting with * are always merged, those starting with + are\n    // merged when similar and close together in time.\n    if (opId == hist.lastSelOp ||\n        (origin && hist.lastSelOrigin == origin &&\n         (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n          selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n      hist.done[hist.done.length - 1] = sel;\n    else\n      pushSelectionToHistory(sel, hist.done);\n\n    hist.lastSelTime = +new Date;\n    hist.lastSelOrigin = origin;\n    hist.lastSelOp = opId;\n    if (options && options.clearRedo !== false)\n      clearSelectionEvents(hist.undone);\n  }\n\n  function pushSelectionToHistory(sel, dest) {\n    var top = lst(dest);\n    if (!(top && top.ranges && top.equals(sel)))\n      dest.push(sel);\n  }\n\n  // Used to store marked span information in the history.\n  function attachLocalSpans(doc, change, from, to) {\n    var existing = change[\"spans_\" + doc.id], n = 0;\n    doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n      if (line.markedSpans)\n        (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n      ++n;\n    });\n  }\n\n  // When un/re-doing restores text containing marked spans, those\n  // that have been explicitly cleared should not be restored.\n  function removeClearedSpans(spans) {\n    if (!spans) return null;\n    for (var i = 0, out; i < spans.length; ++i) {\n      if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n      else if (out) out.push(spans[i]);\n    }\n    return !out ? spans : out.length ? out : null;\n  }\n\n  // Retrieve and filter the old marked spans stored in a change event.\n  function getOldSpans(doc, change) {\n    var found = change[\"spans_\" + doc.id];\n    if (!found) return null;\n    for (var i = 0, nw = []; i < change.text.length; ++i)\n      nw.push(removeClearedSpans(found[i]));\n    return nw;\n  }\n\n  // Used both to provide a JSON-safe object in .getHistory, and, when\n  // detaching a document, to split the history in two\n  function copyHistoryArray(events, newGroup, instantiateSel) {\n    for (var i = 0, copy = []; i < events.length; ++i) {\n      var event = events[i];\n      if (event.ranges) {\n        copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n        continue;\n      }\n      var changes = event.changes, newChanges = [];\n      copy.push({changes: newChanges});\n      for (var j = 0; j < changes.length; ++j) {\n        var change = changes[j], m;\n        newChanges.push({from: change.from, to: change.to, text: change.text});\n        if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n          if (indexOf(newGroup, Number(m[1])) > -1) {\n            lst(newChanges)[prop] = change[prop];\n            delete change[prop];\n          }\n        }\n      }\n    }\n    return copy;\n  }\n\n  // Rebasing/resetting history to deal with externally-sourced changes\n\n  function rebaseHistSelSingle(pos, from, to, diff) {\n    if (to < pos.line) {\n      pos.line += diff;\n    } else if (from < pos.line) {\n      pos.line = from;\n      pos.ch = 0;\n    }\n  }\n\n  // Tries to rebase an array of history events given a change in the\n  // document. If the change touches the same lines as the event, the\n  // event, and everything 'behind' it, is discarded. If the change is\n  // before the event, the event's positions are updated. Uses a\n  // copy-on-write scheme for the positions, to avoid having to\n  // reallocate them all on every rebase, but also avoid problems with\n  // shared position objects being unsafely updated.\n  function rebaseHistArray(array, from, to, diff) {\n    for (var i = 0; i < array.length; ++i) {\n      var sub = array[i], ok = true;\n      if (sub.ranges) {\n        if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n        for (var j = 0; j < sub.ranges.length; j++) {\n          rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n          rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n        }\n        continue;\n      }\n      for (var j = 0; j < sub.changes.length; ++j) {\n        var cur = sub.changes[j];\n        if (to < cur.from.line) {\n          cur.from = Pos(cur.from.line + diff, cur.from.ch);\n          cur.to = Pos(cur.to.line + diff, cur.to.ch);\n        } else if (from <= cur.to.line) {\n          ok = false;\n          break;\n        }\n      }\n      if (!ok) {\n        array.splice(0, i + 1);\n        i = 0;\n      }\n    }\n  }\n\n  function rebaseHist(hist, change) {\n    var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n    rebaseHistArray(hist.done, from, to, diff);\n    rebaseHistArray(hist.undone, from, to, diff);\n  }\n\n  // EVENT UTILITIES\n\n  // Due to the fact that we still support jurassic IE versions, some\n  // compatibility wrappers are needed.\n\n  var e_preventDefault = CodeMirror.e_preventDefault = function(e) {\n    if (e.preventDefault) e.preventDefault();\n    else e.returnValue = false;\n  };\n  var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) {\n    if (e.stopPropagation) e.stopPropagation();\n    else e.cancelBubble = true;\n  };\n  function e_defaultPrevented(e) {\n    return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;\n  }\n  var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);};\n\n  function e_target(e) {return e.target || e.srcElement;}\n  function e_button(e) {\n    var b = e.which;\n    if (b == null) {\n      if (e.button & 1) b = 1;\n      else if (e.button & 2) b = 3;\n      else if (e.button & 4) b = 2;\n    }\n    if (mac && e.ctrlKey && b == 1) b = 3;\n    return b;\n  }\n\n  // EVENT HANDLING\n\n  // Lightweight event framework. on/off also work on DOM nodes,\n  // registering native DOM handlers.\n\n  var on = CodeMirror.on = function(emitter, type, f) {\n    if (emitter.addEventListener)\n      emitter.addEventListener(type, f, false);\n    else if (emitter.attachEvent)\n      emitter.attachEvent(\"on\" + type, f);\n    else {\n      var map = emitter._handlers || (emitter._handlers = {});\n      var arr = map[type] || (map[type] = []);\n      arr.push(f);\n    }\n  };\n\n  var noHandlers = []\n  function getHandlers(emitter, type, copy) {\n    var arr = emitter._handlers && emitter._handlers[type]\n    if (copy) return arr && arr.length > 0 ? arr.slice() : noHandlers\n    else return arr || noHandlers\n  }\n\n  var off = CodeMirror.off = function(emitter, type, f) {\n    if (emitter.removeEventListener)\n      emitter.removeEventListener(type, f, false);\n    else if (emitter.detachEvent)\n      emitter.detachEvent(\"on\" + type, f);\n    else {\n      var handlers = getHandlers(emitter, type, false)\n      for (var i = 0; i < handlers.length; ++i)\n        if (handlers[i] == f) { handlers.splice(i, 1); break; }\n    }\n  };\n\n  var signal = CodeMirror.signal = function(emitter, type /*, values...*/) {\n    var handlers = getHandlers(emitter, type, true)\n    if (!handlers.length) return;\n    var args = Array.prototype.slice.call(arguments, 2);\n    for (var i = 0; i < handlers.length; ++i) handlers[i].apply(null, args);\n  };\n\n  var orphanDelayedCallbacks = null;\n\n  // Often, we want to signal events at a point where we are in the\n  // middle of some work, but don't want the handler to start calling\n  // other methods on the editor, which might be in an inconsistent\n  // state or simply not expect any other events to happen.\n  // signalLater looks whether there are any handlers, and schedules\n  // them to be executed when the last operation ends, or, if no\n  // operation is active, when a timeout fires.\n  function signalLater(emitter, type /*, values...*/) {\n    var arr = getHandlers(emitter, type, false)\n    if (!arr.length) return;\n    var args = Array.prototype.slice.call(arguments, 2), list;\n    if (operationGroup) {\n      list = operationGroup.delayedCallbacks;\n    } else if (orphanDelayedCallbacks) {\n      list = orphanDelayedCallbacks;\n    } else {\n      list = orphanDelayedCallbacks = [];\n      setTimeout(fireOrphanDelayed, 0);\n    }\n    function bnd(f) {return function(){f.apply(null, args);};};\n    for (var i = 0; i < arr.length; ++i)\n      list.push(bnd(arr[i]));\n  }\n\n  function fireOrphanDelayed() {\n    var delayed = orphanDelayedCallbacks;\n    orphanDelayedCallbacks = null;\n    for (var i = 0; i < delayed.length; ++i) delayed[i]();\n  }\n\n  // The DOM events that CodeMirror handles can be overridden by\n  // registering a (non-DOM) handler on the editor for the event name,\n  // and preventDefault-ing the event in that handler.\n  function signalDOMEvent(cm, e, override) {\n    if (typeof e == \"string\")\n      e = {type: e, preventDefault: function() { this.defaultPrevented = true; }};\n    signal(cm, override || e.type, cm, e);\n    return e_defaultPrevented(e) || e.codemirrorIgnore;\n  }\n\n  function signalCursorActivity(cm) {\n    var arr = cm._handlers && cm._handlers.cursorActivity;\n    if (!arr) return;\n    var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n    for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)\n      set.push(arr[i]);\n  }\n\n  function hasHandler(emitter, type) {\n    return getHandlers(emitter, type).length > 0\n  }\n\n  // Add on and off methods to a constructor's prototype, to make\n  // registering events on such objects more convenient.\n  function eventMixin(ctor) {\n    ctor.prototype.on = function(type, f) {on(this, type, f);};\n    ctor.prototype.off = function(type, f) {off(this, type, f);};\n  }\n\n  // MISC UTILITIES\n\n  // Number of pixels added to scroller and sizer to hide scrollbar\n  var scrollerGap = 30;\n\n  // Returned or thrown by various protocols to signal 'I'm not\n  // handling this'.\n  var Pass = CodeMirror.Pass = {toString: function(){return \"CodeMirror.Pass\";}};\n\n  // Reused option objects for setSelection & friends\n  var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n  function Delayed() {this.id = null;}\n  Delayed.prototype.set = function(ms, f) {\n    clearTimeout(this.id);\n    this.id = setTimeout(f, ms);\n  };\n\n  // Counts the column offset in a string, taking tabs into account.\n  // Used mostly to find indentation.\n  var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) {\n    if (end == null) {\n      end = string.search(/[^\\s\\u00a0]/);\n      if (end == -1) end = string.length;\n    }\n    for (var i = startIndex || 0, n = startValue || 0;;) {\n      var nextTab = string.indexOf(\"\\t\", i);\n      if (nextTab < 0 || nextTab >= end)\n        return n + (end - i);\n      n += nextTab - i;\n      n += tabSize - (n % tabSize);\n      i = nextTab + 1;\n    }\n  };\n\n  // The inverse of countColumn -- find the offset that corresponds to\n  // a particular column.\n  var findColumn = CodeMirror.findColumn = function(string, goal, tabSize) {\n    for (var pos = 0, col = 0;;) {\n      var nextTab = string.indexOf(\"\\t\", pos);\n      if (nextTab == -1) nextTab = string.length;\n      var skipped = nextTab - pos;\n      if (nextTab == string.length || col + skipped >= goal)\n        return pos + Math.min(skipped, goal - col);\n      col += nextTab - pos;\n      col += tabSize - (col % tabSize);\n      pos = nextTab + 1;\n      if (col >= goal) return pos;\n    }\n  }\n\n  var spaceStrs = [\"\"];\n  function spaceStr(n) {\n    while (spaceStrs.length <= n)\n      spaceStrs.push(lst(spaceStrs) + \" \");\n    return spaceStrs[n];\n  }\n\n  function lst(arr) { return arr[arr.length-1]; }\n\n  var selectInput = function(node) { node.select(); };\n  if (ios) // Mobile Safari apparently has a bug where select() is broken.\n    selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; };\n  else if (ie) // Suppress mysterious IE10 errors\n    selectInput = function(node) { try { node.select(); } catch(_e) {} };\n\n  function indexOf(array, elt) {\n    for (var i = 0; i < array.length; ++i)\n      if (array[i] == elt) return i;\n    return -1;\n  }\n  function map(array, f) {\n    var out = [];\n    for (var i = 0; i < array.length; i++) out[i] = f(array[i], i);\n    return out;\n  }\n\n  function nothing() {}\n\n  function createObj(base, props) {\n    var inst;\n    if (Object.create) {\n      inst = Object.create(base);\n    } else {\n      nothing.prototype = base;\n      inst = new nothing();\n    }\n    if (props) copyObj(props, inst);\n    return inst;\n  };\n\n  function copyObj(obj, target, overwrite) {\n    if (!target) target = {};\n    for (var prop in obj)\n      if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n        target[prop] = obj[prop];\n    return target;\n  }\n\n  function bind(f) {\n    var args = Array.prototype.slice.call(arguments, 1);\n    return function(){return f.apply(null, args);};\n  }\n\n  var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n  var isWordCharBasic = CodeMirror.isWordChar = function(ch) {\n    return /\\w/.test(ch) || ch > \"\\x80\" &&\n      (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));\n  };\n  function isWordChar(ch, helper) {\n    if (!helper) return isWordCharBasic(ch);\n    if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) return true;\n    return helper.test(ch);\n  }\n\n  function isEmpty(obj) {\n    for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;\n    return true;\n  }\n\n  // Extending unicode characters. A series of a non-extending char +\n  // any number of extending chars is treated as a single unit as far\n  // as editing and measuring is concerned. This is not fully correct,\n  // since some scripts/fonts/browsers also treat other configurations\n  // of code points as a group.\n  var extendingChars = /[\\u0300-\\u036f\\u0483-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u065e\\u0670\\u06d6-\\u06dc\\u06de-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0900-\\u0902\\u093c\\u0941-\\u0948\\u094d\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2\\u09e3\\u0a01\\u0a02\\u0a3c\\u0a41\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70\\u0a71\\u0a75\\u0a81\\u0a82\\u0abc\\u0ac1-\\u0ac5\\u0ac7\\u0ac8\\u0acd\\u0ae2\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0d3e\\u0d41-\\u0d44\\u0d4d\\u0d57\\u0d62\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86\\u0f87\\u0f90-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039\\u103a\\u103d\\u103e\\u1058\\u1059\\u105e-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108d\\u109d\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193b\\u1a17\\u1a18\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1b00-\\u1b03\\u1b34\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80\\u1b81\\u1ba2-\\u1ba5\\u1ba8\\u1ba9\\u1c2c-\\u1c33\\u1c36\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1dc0-\\u1de6\\u1dfd-\\u1dff\\u200c\\u200d\\u20d0-\\u20f0\\u2cef-\\u2cf1\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua66f-\\ua672\\ua67c\\ua67d\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua825\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc\\uaa29-\\uaa2e\\uaa31\\uaa32\\uaa35\\uaa36\\uaa43\\uaa4c\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uabe5\\uabe8\\uabed\\udc00-\\udfff\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe26\\uff9e\\uff9f]/;\n  function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); }\n\n  // DOM UTILITIES\n\n  function elt(tag, content, className, style) {\n    var e = document.createElement(tag);\n    if (className) e.className = className;\n    if (style) e.style.cssText = style;\n    if (typeof content == \"string\") e.appendChild(document.createTextNode(content));\n    else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);\n    return e;\n  }\n\n  var range;\n  if (document.createRange) range = function(node, start, end, endNode) {\n    var r = document.createRange();\n    r.setEnd(endNode || node, end);\n    r.setStart(node, start);\n    return r;\n  };\n  else range = function(node, start, end) {\n    var r = document.body.createTextRange();\n    try { r.moveToElementText(node.parentNode); }\n    catch(e) { return r; }\n    r.collapse(true);\n    r.moveEnd(\"character\", end);\n    r.moveStart(\"character\", start);\n    return r;\n  };\n\n  function removeChildren(e) {\n    for (var count = e.childNodes.length; count > 0; --count)\n      e.removeChild(e.firstChild);\n    return e;\n  }\n\n  function removeChildrenAndAdd(parent, e) {\n    return removeChildren(parent).appendChild(e);\n  }\n\n  var contains = CodeMirror.contains = function(parent, child) {\n    if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n      child = child.parentNode;\n    if (parent.contains)\n      return parent.contains(child);\n    do {\n      if (child.nodeType == 11) child = child.host;\n      if (child == parent) return true;\n    } while (child = child.parentNode);\n  };\n\n  function activeElt() {\n    var activeElement = document.activeElement;\n    while (activeElement && activeElement.root && activeElement.root.activeElement)\n      activeElement = activeElement.root.activeElement;\n    return activeElement;\n  }\n  // Older versions of IE throws unspecified error when touching\n  // document.activeElement in some cases (during loading, in iframe)\n  if (ie && ie_version < 11) activeElt = function() {\n    try { return document.activeElement; }\n    catch(e) { return document.body; }\n  };\n\n  function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\"); }\n  var rmClass = CodeMirror.rmClass = function(node, cls) {\n    var current = node.className;\n    var match = classTest(cls).exec(current);\n    if (match) {\n      var after = current.slice(match.index + match[0].length);\n      node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n    }\n  };\n  var addClass = CodeMirror.addClass = function(node, cls) {\n    var current = node.className;\n    if (!classTest(cls).test(current)) node.className += (current ? \" \" : \"\") + cls;\n  };\n  function joinClasses(a, b) {\n    var as = a.split(\" \");\n    for (var i = 0; i < as.length; i++)\n      if (as[i] && !classTest(as[i]).test(b)) b += \" \" + as[i];\n    return b;\n  }\n\n  // WINDOW-WIDE EVENTS\n\n  // These must be handled carefully, because naively registering a\n  // handler for each editor will cause the editors to never be\n  // garbage collected.\n\n  function forEachCodeMirror(f) {\n    if (!document.body.getElementsByClassName) return;\n    var byClass = document.body.getElementsByClassName(\"CodeMirror\");\n    for (var i = 0; i < byClass.length; i++) {\n      var cm = byClass[i].CodeMirror;\n      if (cm) f(cm);\n    }\n  }\n\n  var globalsRegistered = false;\n  function ensureGlobalHandlers() {\n    if (globalsRegistered) return;\n    registerGlobalHandlers();\n    globalsRegistered = true;\n  }\n  function registerGlobalHandlers() {\n    // When the window resizes, we need to refresh active editors.\n    var resizeTimer;\n    on(window, \"resize\", function() {\n      if (resizeTimer == null) resizeTimer = setTimeout(function() {\n        resizeTimer = null;\n        forEachCodeMirror(onResize);\n      }, 100);\n    });\n    // When the window loses focus, we want to show the editor as blurred\n    on(window, \"blur\", function() {\n      forEachCodeMirror(onBlur);\n    });\n  }\n\n  // FEATURE DETECTION\n\n  // Detect drag-and-drop\n  var dragAndDrop = function() {\n    // There is *some* kind of drag-and-drop support in IE6-8, but I\n    // couldn't get it to work yet.\n    if (ie && ie_version < 9) return false;\n    var div = elt('div');\n    return \"draggable\" in div || \"dragDrop\" in div;\n  }();\n\n  var zwspSupported;\n  function zeroWidthElement(measure) {\n    if (zwspSupported == null) {\n      var test = elt(\"span\", \"\\u200b\");\n      removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n      if (measure.firstChild.offsetHeight != 0)\n        zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);\n    }\n    var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n      elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n    node.setAttribute(\"cm-text\", \"\");\n    return node;\n  }\n\n  // Feature-detect IE's crummy client rect reporting for bidi text\n  var badBidiRects;\n  function hasBadBidiRects(measure) {\n    if (badBidiRects != null) return badBidiRects;\n    var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n    var r0 = range(txt, 0, 1).getBoundingClientRect();\n    if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)\n    var r1 = range(txt, 1, 2).getBoundingClientRect();\n    return badBidiRects = (r1.right - r0.right < 3);\n  }\n\n  // See if \"\".split is the broken IE version, if so, provide an\n  // alternative way to split lines.\n  var splitLinesAuto = CodeMirror.splitLines = \"\\n\\nb\".split(/\\n/).length != 3 ? function(string) {\n    var pos = 0, result = [], l = string.length;\n    while (pos <= l) {\n      var nl = string.indexOf(\"\\n\", pos);\n      if (nl == -1) nl = string.length;\n      var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n      var rt = line.indexOf(\"\\r\");\n      if (rt != -1) {\n        result.push(line.slice(0, rt));\n        pos += rt + 1;\n      } else {\n        result.push(line);\n        pos = nl + 1;\n      }\n    }\n    return result;\n  } : function(string){return string.split(/\\r\\n?|\\n/);};\n\n  var hasSelection = window.getSelection ? function(te) {\n    try { return te.selectionStart != te.selectionEnd; }\n    catch(e) { return false; }\n  } : function(te) {\n    try {var range = te.ownerDocument.selection.createRange();}\n    catch(e) {}\n    if (!range || range.parentElement() != te) return false;\n    return range.compareEndPoints(\"StartToEnd\", range) != 0;\n  };\n\n  var hasCopyEvent = (function() {\n    var e = elt(\"div\");\n    if (\"oncopy\" in e) return true;\n    e.setAttribute(\"oncopy\", \"return;\");\n    return typeof e.oncopy == \"function\";\n  })();\n\n  var badZoomedRects = null;\n  function hasBadZoomedRects(measure) {\n    if (badZoomedRects != null) return badZoomedRects;\n    var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n    var normal = node.getBoundingClientRect();\n    var fromRange = range(node, 0, 1).getBoundingClientRect();\n    return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1;\n  }\n\n  // KEY NAMES\n\n  var keyNames = CodeMirror.keyNames = {\n    3: \"Enter\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n    19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n    36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n    46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n    106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 127: \"Delete\",\n    173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n    221: \"]\", 222: \"'\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n    63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n  };\n  (function() {\n    // Number keys\n    for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i);\n    // Alphabetic keys\n    for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);\n    // Function keys\n    for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = \"F\" + i;\n  })();\n\n  // BIDI HELPERS\n\n  function iterateBidiSections(order, from, to, f) {\n    if (!order) return f(from, to, \"ltr\");\n    var found = false;\n    for (var i = 0; i < order.length; ++i) {\n      var part = order[i];\n      if (part.from < to && part.to > from || from == to && part.to == from) {\n        f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\");\n        found = true;\n      }\n    }\n    if (!found) f(from, to, \"ltr\");\n  }\n\n  function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }\n  function bidiRight(part) { return part.level % 2 ? part.from : part.to; }\n\n  function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }\n  function lineRight(line) {\n    var order = getOrder(line);\n    if (!order) return line.text.length;\n    return bidiRight(lst(order));\n  }\n\n  function lineStart(cm, lineN) {\n    var line = getLine(cm.doc, lineN);\n    var visual = visualLine(line);\n    if (visual != line) lineN = lineNo(visual);\n    var order = getOrder(visual);\n    var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);\n    return Pos(lineN, ch);\n  }\n  function lineEnd(cm, lineN) {\n    var merged, line = getLine(cm.doc, lineN);\n    while (merged = collapsedSpanAtEnd(line)) {\n      line = merged.find(1, true).line;\n      lineN = null;\n    }\n    var order = getOrder(line);\n    var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);\n    return Pos(lineN == null ? lineNo(line) : lineN, ch);\n  }\n  function lineStartSmart(cm, pos) {\n    var start = lineStart(cm, pos.line);\n    var line = getLine(cm.doc, start.line);\n    var order = getOrder(line);\n    if (!order || order[0].level == 0) {\n      var firstNonWS = Math.max(0, line.text.search(/\\S/));\n      var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n      return Pos(start.line, inWS ? 0 : firstNonWS);\n    }\n    return start;\n  }\n\n  function compareBidiLevel(order, a, b) {\n    var linedir = order[0].level;\n    if (a == linedir) return true;\n    if (b == linedir) return false;\n    return a < b;\n  }\n  var bidiOther;\n  function getBidiPartAt(order, pos) {\n    bidiOther = null;\n    for (var i = 0, found; i < order.length; ++i) {\n      var cur = order[i];\n      if (cur.from < pos && cur.to > pos) return i;\n      if ((cur.from == pos || cur.to == pos)) {\n        if (found == null) {\n          found = i;\n        } else if (compareBidiLevel(order, cur.level, order[found].level)) {\n          if (cur.from != cur.to) bidiOther = found;\n          return i;\n        } else {\n          if (cur.from != cur.to) bidiOther = i;\n          return found;\n        }\n      }\n    }\n    return found;\n  }\n\n  function moveInLine(line, pos, dir, byUnit) {\n    if (!byUnit) return pos + dir;\n    do pos += dir;\n    while (pos > 0 && isExtendingChar(line.text.charAt(pos)));\n    return pos;\n  }\n\n  // This is needed in order to move 'visually' through bi-directional\n  // text -- i.e., pressing left should make the cursor go left, even\n  // when in RTL text. The tricky part is the 'jumps', where RTL and\n  // LTR text touch each other. This often requires the cursor offset\n  // to move more than one unit, in order to visually move one unit.\n  function moveVisually(line, start, dir, byUnit) {\n    var bidi = getOrder(line);\n    if (!bidi) return moveLogically(line, start, dir, byUnit);\n    var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n    var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n    for (;;) {\n      if (target > part.from && target < part.to) return target;\n      if (target == part.from || target == part.to) {\n        if (getBidiPartAt(bidi, target) == pos) return target;\n        part = bidi[pos += dir];\n        return (dir > 0) == part.level % 2 ? part.to : part.from;\n      } else {\n        part = bidi[pos += dir];\n        if (!part) return null;\n        if ((dir > 0) == part.level % 2)\n          target = moveInLine(line, part.to, -1, byUnit);\n        else\n          target = moveInLine(line, part.from, 1, byUnit);\n      }\n    }\n  }\n\n  function moveLogically(line, start, dir, byUnit) {\n    var target = start + dir;\n    if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;\n    return target < 0 || target > line.text.length ? null : target;\n  }\n\n  // Bidirectional ordering algorithm\n  // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n  // that this (partially) implements.\n\n  // One-char codes used for character types:\n  // L (L):   Left-to-Right\n  // R (R):   Right-to-Left\n  // r (AL):  Right-to-Left Arabic\n  // 1 (EN):  European Number\n  // + (ES):  European Number Separator\n  // % (ET):  European Number Terminator\n  // n (AN):  Arabic Number\n  // , (CS):  Common Number Separator\n  // m (NSM): Non-Spacing Mark\n  // b (BN):  Boundary Neutral\n  // s (B):   Paragraph Separator\n  // t (S):   Segment Separator\n  // w (WS):  Whitespace\n  // N (ON):  Other Neutrals\n\n  // Returns null if characters are ordered as they appear\n  // (left-to-right), or an array of sections ({from, to, level}\n  // objects) in the order in which they occur visually.\n  var bidiOrdering = (function() {\n    // Character types for codepoints 0 to 0xff\n    var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n    // Character types for codepoints 0x600 to 0x6ff\n    var arabicTypes = \"rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm\";\n    function charType(code) {\n      if (code <= 0xf7) return lowTypes.charAt(code);\n      else if (0x590 <= code && code <= 0x5f4) return \"R\";\n      else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600);\n      else if (0x6ee <= code && code <= 0x8ac) return \"r\";\n      else if (0x2000 <= code && code <= 0x200b) return \"w\";\n      else if (code == 0x200c) return \"b\";\n      else return \"L\";\n    }\n\n    var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n    var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n    // Browsers seem to always treat the boundaries of block elements as being L.\n    var outerType = \"L\";\n\n    function BidiSpan(level, from, to) {\n      this.level = level;\n      this.from = from; this.to = to;\n    }\n\n    return function(str) {\n      if (!bidiRE.test(str)) return false;\n      var len = str.length, types = [];\n      for (var i = 0, type; i < len; ++i)\n        types.push(type = charType(str.charCodeAt(i)));\n\n      // W1. Examine each non-spacing mark (NSM) in the level run, and\n      // change the type of the NSM to the type of the previous\n      // character. If the NSM is at the start of the level run, it will\n      // get the type of sor.\n      for (var i = 0, prev = outerType; i < len; ++i) {\n        var type = types[i];\n        if (type == \"m\") types[i] = prev;\n        else prev = type;\n      }\n\n      // W2. Search backwards from each instance of a European number\n      // until the first strong type (R, L, AL, or sor) is found. If an\n      // AL is found, change the type of the European number to Arabic\n      // number.\n      // W3. Change all ALs to R.\n      for (var i = 0, cur = outerType; i < len; ++i) {\n        var type = types[i];\n        if (type == \"1\" && cur == \"r\") types[i] = \"n\";\n        else if (isStrong.test(type)) { cur = type; if (type == \"r\") types[i] = \"R\"; }\n      }\n\n      // W4. A single European separator between two European numbers\n      // changes to a European number. A single common separator between\n      // two numbers of the same type changes to that type.\n      for (var i = 1, prev = types[0]; i < len - 1; ++i) {\n        var type = types[i];\n        if (type == \"+\" && prev == \"1\" && types[i+1] == \"1\") types[i] = \"1\";\n        else if (type == \",\" && prev == types[i+1] &&\n                 (prev == \"1\" || prev == \"n\")) types[i] = prev;\n        prev = type;\n      }\n\n      // W5. A sequence of European terminators adjacent to European\n      // numbers changes to all European numbers.\n      // W6. Otherwise, separators and terminators change to Other\n      // Neutral.\n      for (var i = 0; i < len; ++i) {\n        var type = types[i];\n        if (type == \",\") types[i] = \"N\";\n        else if (type == \"%\") {\n          for (var end = i + 1; end < len && types[end] == \"%\"; ++end) {}\n          var replace = (i && types[i-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n          for (var j = i; j < end; ++j) types[j] = replace;\n          i = end - 1;\n        }\n      }\n\n      // W7. Search backwards from each instance of a European number\n      // until the first strong type (R, L, or sor) is found. If an L is\n      // found, then change the type of the European number to L.\n      for (var i = 0, cur = outerType; i < len; ++i) {\n        var type = types[i];\n        if (cur == \"L\" && type == \"1\") types[i] = \"L\";\n        else if (isStrong.test(type)) cur = type;\n      }\n\n      // N1. A sequence of neutrals takes the direction of the\n      // surrounding strong text if the text on both sides has the same\n      // direction. European and Arabic numbers act as if they were R in\n      // terms of their influence on neutrals. Start-of-level-run (sor)\n      // and end-of-level-run (eor) are used at level run boundaries.\n      // N2. Any remaining neutrals take the embedding direction.\n      for (var i = 0; i < len; ++i) {\n        if (isNeutral.test(types[i])) {\n          for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}\n          var before = (i ? types[i-1] : outerType) == \"L\";\n          var after = (end < len ? types[end] : outerType) == \"L\";\n          var replace = before || after ? \"L\" : \"R\";\n          for (var j = i; j < end; ++j) types[j] = replace;\n          i = end - 1;\n        }\n      }\n\n      // Here we depart from the documented algorithm, in order to avoid\n      // building up an actual levels array. Since there are only three\n      // levels (0, 1, 2) in an implementation that doesn't take\n      // explicit embedding into account, we can build up the order on\n      // the fly, without following the level-based algorithm.\n      var order = [], m;\n      for (var i = 0; i < len;) {\n        if (countsAsLeft.test(types[i])) {\n          var start = i;\n          for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}\n          order.push(new BidiSpan(0, start, i));\n        } else {\n          var pos = i, at = order.length;\n          for (++i; i < len && types[i] != \"L\"; ++i) {}\n          for (var j = pos; j < i;) {\n            if (countsAsNum.test(types[j])) {\n              if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j));\n              var nstart = j;\n              for (++j; j < i && countsAsNum.test(types[j]); ++j) {}\n              order.splice(at, 0, new BidiSpan(2, nstart, j));\n              pos = j;\n            } else ++j;\n          }\n          if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i));\n        }\n      }\n      if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n        order[0].from = m[0].length;\n        order.unshift(new BidiSpan(0, 0, m[0].length));\n      }\n      if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n        lst(order).to -= m[0].length;\n        order.push(new BidiSpan(0, len - m[0].length, len));\n      }\n      if (order[0].level == 2)\n        order.unshift(new BidiSpan(1, order[0].to, order[0].to));\n      if (order[0].level != lst(order).level)\n        order.push(new BidiSpan(order[0].level, len, len));\n\n      return order;\n    };\n  })();\n\n  // THE END\n\n  CodeMirror.version = \"5.15.2\";\n\n  return CodeMirror;\n});\n"
  },
  {
    "path": "lib/codemirror/mode/javascript/index.html",
    "content": "<!doctype html>\n\n<title>CodeMirror: JavaScript mode</title>\n<meta charset=\"utf-8\"/>\n<link rel=stylesheet href=\"../../doc/docs.css\">\n\n<link rel=\"stylesheet\" href=\"../../lib/codemirror.css\">\n<script src=\"../../lib/codemirror.js\"></script>\n<script src=\"../../addon/edit/matchbrackets.js\"></script>\n<script src=\"../../addon/comment/continuecomment.js\"></script>\n<script src=\"../../addon/comment/comment.js\"></script>\n<script src=\"javascript.js\"></script>\n<style type=\"text/css\">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>\n<div id=nav>\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../../doc/logo.png\"></a>\n\n  <ul>\n    <li><a href=\"../../index.html\">Home</a>\n    <li><a href=\"../../doc/manual.html\">Manual</a>\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\n  </ul>\n  <ul>\n    <li><a href=\"../index.html\">Language modes</a>\n    <li><a class=active href=\"#\">JavaScript</a>\n  </ul>\n</div>\n\n<article>\n<h2>JavaScript mode</h2>\n\n\n<div><textarea id=\"code\" name=\"code\">\n// Demo code (the actual new parser character stream implementation)\n\nfunction StringStream(string) {\n  this.pos = 0;\n  this.string = string;\n}\n\nStringStream.prototype = {\n  done: function() {return this.pos >= this.string.length;},\n  peek: function() {return this.string.charAt(this.pos);},\n  next: function() {\n    if (this.pos &lt; this.string.length)\n      return this.string.charAt(this.pos++);\n  },\n  eat: function(match) {\n    var ch = this.string.charAt(this.pos);\n    if (typeof match == \"string\") var ok = ch == match;\n    else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);\n    if (ok) {this.pos++; return ch;}\n  },\n  eatWhile: function(match) {\n    var start = this.pos;\n    while (this.eat(match));\n    if (this.pos > start) return this.string.slice(start, this.pos);\n  },\n  backUp: function(n) {this.pos -= n;},\n  column: function() {return this.pos;},\n  eatSpace: function() {\n    var start = this.pos;\n    while (/\\s/.test(this.string.charAt(this.pos))) this.pos++;\n    return this.pos - start;\n  },\n  match: function(pattern, consume, caseInsensitive) {\n    if (typeof pattern == \"string\") {\n      function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}\n      if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {\n        if (consume !== false) this.pos += str.length;\n        return true;\n      }\n    }\n    else {\n      var match = this.string.slice(this.pos).match(pattern);\n      if (match &amp;&amp; consume !== false) this.pos += match[0].length;\n      return match;\n    }\n  }\n};\n</textarea></div>\n\n    <script>\n      var editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n        lineNumbers: true,\n        matchBrackets: true,\n        continueComments: \"Enter\",\n        extraKeys: {\"Ctrl-Q\": \"toggleComment\"}\n      });\n    </script>\n\n    <p>\n      JavaScript mode supports several configuration options:\n      <ul>\n        <li><code>json</code> which will set the mode to expect JSON\n        data rather than a JavaScript program.</li>\n        <li><code>jsonld</code> which will set the mode to expect\n        <a href=\"http://json-ld.org\">JSON-LD</a> linked data rather\n        than a JavaScript program (<a href=\"json-ld.html\">demo</a>).</li>\n        <li><code>typescript</code> which will activate additional\n        syntax highlighting and some other things for TypeScript code\n        (<a href=\"typescript.html\">demo</a>).</li>\n        <li><code>statementIndent</code> which (given a number) will\n        determine the amount of indentation to use for statements\n        continued on a new line.</li>\n        <li><code>wordCharacters</code>, a regexp that indicates which\n        characters should be considered part of an identifier.\n        Defaults to <code>/[\\w$]/</code>, which does not handle\n        non-ASCII identifiers. Can be set to something more elaborate\n        to improve Unicode support.</li>\n      </ul>\n    </p>\n\n    <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>, <code>application/ld+json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>\n  </article>\n"
  },
  {
    "path": "lib/codemirror/mode/javascript/javascript.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// TODO actually recognize syntax of TypeScript constructs\n\n(function(mod) {\n  if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n    mod(require(\"../../lib/codemirror\"));\n  else if (typeof define == \"function\" && define.amd) // AMD\n    define([\"../../lib/codemirror\"], mod);\n  else // Plain browser env\n    mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nfunction expressionAllowed(stream, state, backUp) {\n  return /^(?:operator|sof|keyword c|case|new|[\\[{}\\(,;:]|=>)$/.test(state.lastType) ||\n    (state.lastType == \"quasi\" && /\\{\\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))\n}\n\nCodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n  var indentUnit = config.indentUnit;\n  var statementIndent = parserConfig.statementIndent;\n  var jsonldMode = parserConfig.jsonld;\n  var jsonMode = parserConfig.json || jsonldMode;\n  var isTS = parserConfig.typescript;\n  var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/;\n\n  // Tokenizer\n\n  var keywords = function(){\n    function kw(type) {return {type: type, style: \"keyword\"};}\n    var A = kw(\"keyword a\"), B = kw(\"keyword b\"), C = kw(\"keyword c\");\n    var operator = kw(\"operator\"), atom = {type: \"atom\", style: \"atom\"};\n\n    var jsKeywords = {\n      \"if\": kw(\"if\"), \"while\": A, \"with\": A, \"else\": B, \"do\": B, \"try\": B, \"finally\": B,\n      \"return\": C, \"break\": C, \"continue\": C, \"new\": kw(\"new\"), \"delete\": C, \"throw\": C, \"debugger\": C,\n      \"var\": kw(\"var\"), \"const\": kw(\"var\"), \"let\": kw(\"var\"),\n      \"function\": kw(\"function\"), \"catch\": kw(\"catch\"),\n      \"for\": kw(\"for\"), \"switch\": kw(\"switch\"), \"case\": kw(\"case\"), \"default\": kw(\"default\"),\n      \"in\": operator, \"typeof\": operator, \"instanceof\": operator,\n      \"true\": atom, \"false\": atom, \"null\": atom, \"undefined\": atom, \"NaN\": atom, \"Infinity\": atom,\n      \"this\": kw(\"this\"), \"class\": kw(\"class\"), \"super\": kw(\"atom\"),\n      \"yield\": C, \"export\": kw(\"export\"), \"import\": kw(\"import\"), \"extends\": C,\n      \"await\": C, \"async\": kw(\"async\")\n    };\n\n    // Extend the 'normal' keywords with the TypeScript language extensions\n    if (isTS) {\n      var type = {type: \"variable\", style: \"variable-3\"};\n      var tsKeywords = {\n        // object-like things\n        \"interface\": kw(\"class\"),\n        \"implements\": C,\n        \"namespace\": C,\n        \"module\": kw(\"module\"),\n        \"enum\": kw(\"module\"),\n\n        // scope modifiers\n        \"public\": kw(\"modifier\"),\n        \"private\": kw(\"modifier\"),\n        \"protected\": kw(\"modifier\"),\n        \"abstract\": kw(\"modifier\"),\n\n        // operators\n        \"as\": operator,\n\n        // types\n        \"string\": type, \"number\": type, \"boolean\": type, \"any\": type\n      };\n\n      for (var attr in tsKeywords) {\n        jsKeywords[attr] = tsKeywords[attr];\n      }\n    }\n\n    return jsKeywords;\n  }();\n\n  var isOperatorChar = /[+\\-*&%=<>!?|~^]/;\n  var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/;\n\n  function readRegexp(stream) {\n    var escaped = false, next, inSet = false;\n    while ((next = stream.next()) != null) {\n      if (!escaped) {\n        if (next == \"/\" && !inSet) return;\n        if (next == \"[\") inSet = true;\n        else if (inSet && next == \"]\") inSet = false;\n      }\n      escaped = !escaped && next == \"\\\\\";\n    }\n  }\n\n  // Used as scratch variables to communicate multiple values without\n  // consing up tons of objects.\n  var type, content;\n  function ret(tp, style, cont) {\n    type = tp; content = cont;\n    return style;\n  }\n  function tokenBase(stream, state) {\n    var ch = stream.next();\n    if (ch == '\"' || ch == \"'\") {\n      state.tokenize = tokenString(ch);\n      return state.tokenize(stream, state);\n    } else if (ch == \".\" && stream.match(/^\\d+(?:[eE][+\\-]?\\d+)?/)) {\n      return ret(\"number\", \"number\");\n    } else if (ch == \".\" && stream.match(\"..\")) {\n      return ret(\"spread\", \"meta\");\n    } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n      return ret(ch);\n    } else if (ch == \"=\" && stream.eat(\">\")) {\n      return ret(\"=>\", \"operator\");\n    } else if (ch == \"0\" && stream.eat(/x/i)) {\n      stream.eatWhile(/[\\da-f]/i);\n      return ret(\"number\", \"number\");\n    } else if (ch == \"0\" && stream.eat(/o/i)) {\n      stream.eatWhile(/[0-7]/i);\n      return ret(\"number\", \"number\");\n    } else if (ch == \"0\" && stream.eat(/b/i)) {\n      stream.eatWhile(/[01]/i);\n      return ret(\"number\", \"number\");\n    } else if (/\\d/.test(ch)) {\n      stream.match(/^\\d*(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/);\n      return ret(\"number\", \"number\");\n    } else if (ch == \"/\") {\n      if (stream.eat(\"*\")) {\n        state.tokenize = tokenComment;\n        return tokenComment(stream, state);\n      } else if (stream.eat(\"/\")) {\n        stream.skipToEnd();\n        return ret(\"comment\", \"comment\");\n      } else if (expressionAllowed(stream, state, 1)) {\n        readRegexp(stream);\n        stream.match(/^\\b(([gimyu])(?![gimyu]*\\2))+\\b/);\n        return ret(\"regexp\", \"string-2\");\n      } else {\n        stream.eatWhile(isOperatorChar);\n        return ret(\"operator\", \"operator\", stream.current());\n      }\n    } else if (ch == \"`\") {\n      state.tokenize = tokenQuasi;\n      return tokenQuasi(stream, state);\n    } else if (ch == \"#\") {\n      stream.skipToEnd();\n      return ret(\"error\", \"error\");\n    } else if (isOperatorChar.test(ch)) {\n      stream.eatWhile(isOperatorChar);\n      return ret(\"operator\", \"operator\", stream.current());\n    } else if (wordRE.test(ch)) {\n      stream.eatWhile(wordRE);\n      var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];\n      return (known && state.lastType != \".\") ? ret(known.type, known.style, word) :\n                     ret(\"variable\", \"variable\", word);\n    }\n  }\n\n  function tokenString(quote) {\n    return function(stream, state) {\n      var escaped = false, next;\n      if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)){\n        state.tokenize = tokenBase;\n        return ret(\"jsonld-keyword\", \"meta\");\n      }\n      while ((next = stream.next()) != null) {\n        if (next == quote && !escaped) break;\n        escaped = !escaped && next == \"\\\\\";\n      }\n      if (!escaped) state.tokenize = tokenBase;\n      return ret(\"string\", \"string\");\n    };\n  }\n\n  function tokenComment(stream, state) {\n    var maybeEnd = false, ch;\n    while (ch = stream.next()) {\n      if (ch == \"/\" && maybeEnd) {\n        state.tokenize = tokenBase;\n        break;\n      }\n      maybeEnd = (ch == \"*\");\n    }\n    return ret(\"comment\", \"comment\");\n  }\n\n  function tokenQuasi(stream, state) {\n    var escaped = false, next;\n    while ((next = stream.next()) != null) {\n      if (!escaped && (next == \"`\" || next == \"$\" && stream.eat(\"{\"))) {\n        state.tokenize = tokenBase;\n        break;\n      }\n      escaped = !escaped && next == \"\\\\\";\n    }\n    return ret(\"quasi\", \"string-2\", stream.current());\n  }\n\n  var brackets = \"([{}])\";\n  // This is a crude lookahead trick to try and notice that we're\n  // parsing the argument patterns for a fat-arrow function before we\n  // actually hit the arrow token. It only works if the arrow is on\n  // the same line as the arguments and there's no strange noise\n  // (comments) in between. Fallback is to only notice when we hit the\n  // arrow, and not declare the arguments as locals for the arrow\n  // body.\n  function findFatArrow(stream, state) {\n    if (state.fatArrowAt) state.fatArrowAt = null;\n    var arrow = stream.string.indexOf(\"=>\", stream.start);\n    if (arrow < 0) return;\n\n    var depth = 0, sawSomething = false;\n    for (var pos = arrow - 1; pos >= 0; --pos) {\n      var ch = stream.string.charAt(pos);\n      var bracket = brackets.indexOf(ch);\n      if (bracket >= 0 && bracket < 3) {\n        if (!depth) { ++pos; break; }\n        if (--depth == 0) break;\n      } else if (bracket >= 3 && bracket < 6) {\n        ++depth;\n      } else if (wordRE.test(ch)) {\n        sawSomething = true;\n      } else if (/[\"'\\/]/.test(ch)) {\n        return;\n      } else if (sawSomething && !depth) {\n        ++pos;\n        break;\n      }\n    }\n    if (sawSomething && !depth) state.fatArrowAt = pos;\n  }\n\n  // Parser\n\n  var atomicTypes = {\"atom\": true, \"number\": true, \"variable\": true, \"string\": true, \"regexp\": true, \"this\": true, \"jsonld-keyword\": true};\n\n  function JSLexical(indented, column, type, align, prev, info) {\n    this.indented = indented;\n    this.column = column;\n    this.type = type;\n    this.prev = prev;\n    this.info = info;\n    if (align != null) this.align = align;\n  }\n\n  function inScope(state, varname) {\n    for (var v = state.localVars; v; v = v.next)\n      if (v.name == varname) return true;\n    for (var cx = state.context; cx; cx = cx.prev) {\n      for (var v = cx.vars; v; v = v.next)\n        if (v.name == varname) return true;\n    }\n  }\n\n  function parseJS(state, style, type, content, stream) {\n    var cc = state.cc;\n    // Communicate our context to the combinators.\n    // (Less wasteful than consing up a hundred closures on every call.)\n    cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;\n\n    if (!state.lexical.hasOwnProperty(\"align\"))\n      state.lexical.align = true;\n\n    while(true) {\n      var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;\n      if (combinator(type, content)) {\n        while(cc.length && cc[cc.length - 1].lex)\n          cc.pop()();\n        if (cx.marked) return cx.marked;\n        if (type == \"variable\" && inScope(state, content)) return \"variable-2\";\n        return style;\n      }\n    }\n  }\n\n  // Combinator utils\n\n  var cx = {state: null, column: null, marked: null, cc: null};\n  function pass() {\n    for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);\n  }\n  function cont() {\n    pass.apply(null, arguments);\n    return true;\n  }\n  function register(varname) {\n    function inList(list) {\n      for (var v = list; v; v = v.next)\n        if (v.name == varname) return true;\n      return false;\n    }\n    var state = cx.state;\n    cx.marked = \"def\";\n    if (state.context) {\n      if (inList(state.localVars)) return;\n      state.localVars = {name: varname, next: state.localVars};\n    } else {\n      if (inList(state.globalVars)) return;\n      if (parserConfig.globalVars)\n        state.globalVars = {name: varname, next: state.globalVars};\n    }\n  }\n\n  // Combinators\n\n  var defaultVars = {name: \"this\", next: {name: \"arguments\"}};\n  function pushcontext() {\n    cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};\n    cx.state.localVars = defaultVars;\n  }\n  function popcontext() {\n    cx.state.localVars = cx.state.context.vars;\n    cx.state.context = cx.state.context.prev;\n  }\n  function pushlex(type, info) {\n    var result = function() {\n      var state = cx.state, indent = state.indented;\n      if (state.lexical.type == \"stat\") indent = state.lexical.indented;\n      else for (var outer = state.lexical; outer && outer.type == \")\" && outer.align; outer = outer.prev)\n        indent = outer.indented;\n      state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);\n    };\n    result.lex = true;\n    return result;\n  }\n  function poplex() {\n    var state = cx.state;\n    if (state.lexical.prev) {\n      if (state.lexical.type == \")\")\n        state.indented = state.lexical.indented;\n      state.lexical = state.lexical.prev;\n    }\n  }\n  poplex.lex = true;\n\n  function expect(wanted) {\n    function exp(type) {\n      if (type == wanted) return cont();\n      else if (wanted == \";\") return pass();\n      else return cont(exp);\n    };\n    return exp;\n  }\n\n  function statement(type, value) {\n    if (type == \"var\") return cont(pushlex(\"vardef\", value.length), vardef, expect(\";\"), poplex);\n    if (type == \"keyword a\") return cont(pushlex(\"form\"), expression, statement, poplex);\n    if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex);\n    if (type == \"{\") return cont(pushlex(\"}\"), block, poplex);\n    if (type == \";\") return cont();\n    if (type == \"if\") {\n      if (cx.state.lexical.info == \"else\" && cx.state.cc[cx.state.cc.length - 1] == poplex)\n        cx.state.cc.pop()();\n      return cont(pushlex(\"form\"), expression, statement, poplex, maybeelse);\n    }\n    if (type == \"function\") return cont(functiondef);\n    if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex);\n    if (type == \"variable\") return cont(pushlex(\"stat\"), maybelabel);\n    if (type == \"switch\") return cont(pushlex(\"form\"), expression, pushlex(\"}\", \"switch\"), expect(\"{\"),\n                                      block, poplex, poplex);\n    if (type == \"case\") return cont(expression, expect(\":\"));\n    if (type == \"default\") return cont(expect(\":\"));\n    if (type == \"catch\") return cont(pushlex(\"form\"), pushcontext, expect(\"(\"), funarg, expect(\")\"),\n                                     statement, poplex, popcontext);\n    if (type == \"class\") return cont(pushlex(\"form\"), className, poplex);\n    if (type == \"export\") return cont(pushlex(\"stat\"), afterExport, poplex);\n    if (type == \"import\") return cont(pushlex(\"stat\"), afterImport, poplex);\n    if (type == \"module\") return cont(pushlex(\"form\"), pattern, pushlex(\"}\"), expect(\"{\"), block, poplex, poplex)\n    if (type == \"async\") return cont(statement)\n    return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex);\n  }\n  function expression(type) {\n    return expressionInner(type, false);\n  }\n  function expressionNoComma(type) {\n    return expressionInner(type, true);\n  }\n  function expressionInner(type, noComma) {\n    if (cx.state.fatArrowAt == cx.stream.start) {\n      var body = noComma ? arrowBodyNoComma : arrowBody;\n      if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(pattern, \")\"), poplex, expect(\"=>\"), body, popcontext);\n      else if (type == \"variable\") return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext);\n    }\n\n    var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;\n    if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);\n    if (type == \"function\") return cont(functiondef, maybeop);\n    if (type == \"keyword c\") return cont(noComma ? maybeexpressionNoComma : maybeexpression);\n    if (type == \"(\") return cont(pushlex(\")\"), maybeexpression, comprehension, expect(\")\"), poplex, maybeop);\n    if (type == \"operator\" || type == \"spread\") return cont(noComma ? expressionNoComma : expression);\n    if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop);\n    if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop);\n    if (type == \"quasi\") return pass(quasi, maybeop);\n    if (type == \"new\") return cont(maybeTarget(noComma));\n    return cont();\n  }\n  function maybeexpression(type) {\n    if (type.match(/[;\\}\\)\\],]/)) return pass();\n    return pass(expression);\n  }\n  function maybeexpressionNoComma(type) {\n    if (type.match(/[;\\}\\)\\],]/)) return pass();\n    return pass(expressionNoComma);\n  }\n\n  function maybeoperatorComma(type, value) {\n    if (type == \",\") return cont(expression);\n    return maybeoperatorNoComma(type, value, false);\n  }\n  function maybeoperatorNoComma(type, value, noComma) {\n    var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;\n    var expr = noComma == false ? expression : expressionNoComma;\n    if (type == \"=>\") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);\n    if (type == \"operator\") {\n      if (/\\+\\+|--/.test(value)) return cont(me);\n      if (value == \"?\") return cont(expression, expect(\":\"), expr);\n      return cont(expr);\n    }\n    if (type == \"quasi\") { return pass(quasi, me); }\n    if (type == \";\") return;\n    if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me);\n    if (type == \".\") return cont(property, me);\n    if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me);\n  }\n  function quasi(type, value) {\n    if (type != \"quasi\") return pass();\n    if (value.slice(value.length - 2) != \"${\") return cont(quasi);\n    return cont(expression, continueQuasi);\n  }\n  function continueQuasi(type) {\n    if (type == \"}\") {\n      cx.marked = \"string-2\";\n      cx.state.tokenize = tokenQuasi;\n      return cont(quasi);\n    }\n  }\n  function arrowBody(type) {\n    findFatArrow(cx.stream, cx.state);\n    return pass(type == \"{\" ? statement : expression);\n  }\n  function arrowBodyNoComma(type) {\n    findFatArrow(cx.stream, cx.state);\n    return pass(type == \"{\" ? statement : expressionNoComma);\n  }\n  function maybeTarget(noComma) {\n    return function(type) {\n      if (type == \".\") return cont(noComma ? targetNoComma : target);\n      else return pass(noComma ? expressionNoComma : expression);\n    };\n  }\n  function target(_, value) {\n    if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorComma); }\n  }\n  function targetNoComma(_, value) {\n    if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorNoComma); }\n  }\n  function maybelabel(type) {\n    if (type == \":\") return cont(poplex, statement);\n    return pass(maybeoperatorComma, expect(\";\"), poplex);\n  }\n  function property(type) {\n    if (type == \"variable\") {cx.marked = \"property\"; return cont();}\n  }\n  function objprop(type, value) {\n    if (type == \"variable\" || cx.style == \"keyword\") {\n      cx.marked = \"property\";\n      if (value == \"get\" || value == \"set\") return cont(getterSetter);\n      return cont(afterprop);\n    } else if (type == \"number\" || type == \"string\") {\n      cx.marked = jsonldMode ? \"property\" : (cx.style + \" property\");\n      return cont(afterprop);\n    } else if (type == \"jsonld-keyword\") {\n      return cont(afterprop);\n    } else if (type == \"modifier\") {\n      return cont(objprop)\n    } else if (type == \"[\") {\n      return cont(expression, expect(\"]\"), afterprop);\n    } else if (type == \"spread\") {\n      return cont(expression);\n    }\n  }\n  function getterSetter(type) {\n    if (type != \"variable\") return pass(afterprop);\n    cx.marked = \"property\";\n    return cont(functiondef);\n  }\n  function afterprop(type) {\n    if (type == \":\") return cont(expressionNoComma);\n    if (type == \"(\") return pass(functiondef);\n  }\n  function commasep(what, end) {\n    function proceed(type, value) {\n      if (type == \",\") {\n        var lex = cx.state.lexical;\n        if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1;\n        return cont(what, proceed);\n      }\n      if (type == end || value == end) return cont();\n      return cont(expect(end));\n    }\n    return function(type, value) {\n      if (type == end || value == end) return cont();\n      return pass(what, proceed);\n    };\n  }\n  function contCommasep(what, end, info) {\n    for (var i = 3; i < arguments.length; i++)\n      cx.cc.push(arguments[i]);\n    return cont(pushlex(end, info), commasep(what, end), poplex);\n  }\n  function block(type) {\n    if (type == \"}\") return cont();\n    return pass(statement, block);\n  }\n  function maybetype(type) {\n    if (isTS && type == \":\") return cont(typeexpr);\n  }\n  function maybedefault(_, value) {\n    if (value == \"=\") return cont(expressionNoComma);\n  }\n  function typeexpr(type) {\n    if (type == \"variable\") {cx.marked = \"variable-3\"; return cont(afterType);}\n  }\n  function afterType(type, value) {\n    if (value == \"<\") return cont(commasep(typeexpr, \">\"), afterType)\n    if (type == \"[\") return cont(expect(\"]\"), afterType)\n  }\n  function vardef() {\n    return pass(pattern, maybetype, maybeAssign, vardefCont);\n  }\n  function pattern(type, value) {\n    if (type == \"modifier\") return cont(pattern)\n    if (type == \"variable\") { register(value); return cont(); }\n    if (type == \"spread\") return cont(pattern);\n    if (type == \"[\") return contCommasep(pattern, \"]\");\n    if (type == \"{\") return contCommasep(proppattern, \"}\");\n  }\n  function proppattern(type, value) {\n    if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n      register(value);\n      return cont(maybeAssign);\n    }\n    if (type == \"variable\") cx.marked = \"property\";\n    if (type == \"spread\") return cont(pattern);\n    if (type == \"}\") return pass();\n    return cont(expect(\":\"), pattern, maybeAssign);\n  }\n  function maybeAssign(_type, value) {\n    if (value == \"=\") return cont(expressionNoComma);\n  }\n  function vardefCont(type) {\n    if (type == \",\") return cont(vardef);\n  }\n  function maybeelse(type, value) {\n    if (type == \"keyword b\" && value == \"else\") return cont(pushlex(\"form\", \"else\"), statement, poplex);\n  }\n  function forspec(type) {\n    if (type == \"(\") return cont(pushlex(\")\"), forspec1, expect(\")\"), poplex);\n  }\n  function forspec1(type) {\n    if (type == \"var\") return cont(vardef, expect(\";\"), forspec2);\n    if (type == \";\") return cont(forspec2);\n    if (type == \"variable\") return cont(formaybeinof);\n    return pass(expression, expect(\";\"), forspec2);\n  }\n  function formaybeinof(_type, value) {\n    if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n    return cont(maybeoperatorComma, forspec2);\n  }\n  function forspec2(type, value) {\n    if (type == \";\") return cont(forspec3);\n    if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n    return pass(expression, expect(\";\"), forspec3);\n  }\n  function forspec3(type) {\n    if (type != \")\") cont(expression);\n  }\n  function functiondef(type, value) {\n    if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondef);}\n    if (type == \"variable\") {register(value); return cont(functiondef);}\n    if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, maybetype, statement, popcontext);\n  }\n  function funarg(type) {\n    if (type == \"spread\") return cont(funarg);\n    return pass(pattern, maybetype, maybedefault);\n  }\n  function className(type, value) {\n    if (type == \"variable\") {register(value); return cont(classNameAfter);}\n  }\n  function classNameAfter(type, value) {\n    if (value == \"extends\") return cont(expression, classNameAfter);\n    if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex);\n  }\n  function classBody(type, value) {\n    if (type == \"variable\" || cx.style == \"keyword\") {\n      if (value == \"static\") {\n        cx.marked = \"keyword\";\n        return cont(classBody);\n      }\n      cx.marked = \"property\";\n      if (value == \"get\" || value == \"set\") return cont(classGetterSetter, functiondef, classBody);\n      return cont(functiondef, classBody);\n    }\n    if (value == \"*\") {\n      cx.marked = \"keyword\";\n      return cont(classBody);\n    }\n    if (type == \";\") return cont(classBody);\n    if (type == \"}\") return cont();\n  }\n  function classGetterSetter(type) {\n    if (type != \"variable\") return pass();\n    cx.marked = \"property\";\n    return cont();\n  }\n  function afterExport(_type, value) {\n    if (value == \"*\") { cx.marked = \"keyword\"; return cont(maybeFrom, expect(\";\")); }\n    if (value == \"default\") { cx.marked = \"keyword\"; return cont(expression, expect(\";\")); }\n    return pass(statement);\n  }\n  function afterImport(type) {\n    if (type == \"string\") return cont();\n    return pass(importSpec, maybeFrom);\n  }\n  function importSpec(type, value) {\n    if (type == \"{\") return contCommasep(importSpec, \"}\");\n    if (type == \"variable\") register(value);\n    if (value == \"*\") cx.marked = \"keyword\";\n    return cont(maybeAs);\n  }\n  function maybeAs(_type, value) {\n    if (value == \"as\") { cx.marked = \"keyword\"; return cont(importSpec); }\n  }\n  function maybeFrom(_type, value) {\n    if (value == \"from\") { cx.marked = \"keyword\"; return cont(expression); }\n  }\n  function arrayLiteral(type) {\n    if (type == \"]\") return cont();\n    return pass(expressionNoComma, maybeArrayComprehension);\n  }\n  function maybeArrayComprehension(type) {\n    if (type == \"for\") return pass(comprehension, expect(\"]\"));\n    if (type == \",\") return cont(commasep(maybeexpressionNoComma, \"]\"));\n    return pass(commasep(expressionNoComma, \"]\"));\n  }\n  function comprehension(type) {\n    if (type == \"for\") return cont(forspec, comprehension);\n    if (type == \"if\") return cont(expression, comprehension);\n  }\n\n  function isContinuedStatement(state, textAfter) {\n    return state.lastType == \"operator\" || state.lastType == \",\" ||\n      isOperatorChar.test(textAfter.charAt(0)) ||\n      /[,.]/.test(textAfter.charAt(0));\n  }\n\n  // Interface\n\n  return {\n    startState: function(basecolumn) {\n      var state = {\n        tokenize: tokenBase,\n        lastType: \"sof\",\n        cc: [],\n        lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n        localVars: parserConfig.localVars,\n        context: parserConfig.localVars && {vars: parserConfig.localVars},\n        indented: basecolumn || 0\n      };\n      if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n        state.globalVars = parserConfig.globalVars;\n      return state;\n    },\n\n    token: function(stream, state) {\n      if (stream.sol()) {\n        if (!state.lexical.hasOwnProperty(\"align\"))\n          state.lexical.align = false;\n        state.indented = stream.indentation();\n        findFatArrow(stream, state);\n      }\n      if (state.tokenize != tokenComment && stream.eatSpace()) return null;\n      var style = state.tokenize(stream, state);\n      if (type == \"comment\") return style;\n      state.lastType = type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type;\n      return parseJS(state, style, type, content, stream);\n    },\n\n    indent: function(state, textAfter) {\n      if (state.tokenize == tokenComment) return CodeMirror.Pass;\n      if (state.tokenize != tokenBase) return 0;\n      var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;\n      // Kludge to prevent 'maybelse' from blocking lexical scope pops\n      if (!/^\\s*else\\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {\n        var c = state.cc[i];\n        if (c == poplex) lexical = lexical.prev;\n        else if (c != maybeelse) break;\n      }\n      if (lexical.type == \"stat\" && firstChar == \"}\") lexical = lexical.prev;\n      if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n        lexical = lexical.prev;\n      var type = lexical.type, closing = firstChar == type;\n\n      if (type == \"vardef\") return lexical.indented + (state.lastType == \"operator\" || state.lastType == \",\" ? lexical.info + 1 : 0);\n      else if (type == \"form\" && firstChar == \"{\") return lexical.indented;\n      else if (type == \"form\") return lexical.indented + indentUnit;\n      else if (type == \"stat\")\n        return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);\n      else if (lexical.info == \"switch\" && !closing && parserConfig.doubleIndentSwitch != false)\n        return lexical.indented + (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit);\n      else if (lexical.align) return lexical.column + (closing ? 0 : 1);\n      else return lexical.indented + (closing ? 0 : indentUnit);\n    },\n\n    electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n    blockCommentStart: jsonMode ? null : \"/*\",\n    blockCommentEnd: jsonMode ? null : \"*/\",\n    lineComment: jsonMode ? null : \"//\",\n    fold: \"brace\",\n    closeBrackets: \"()[]{}''\\\"\\\"``\",\n\n    helperType: jsonMode ? \"json\" : \"javascript\",\n    jsonldMode: jsonldMode,\n    jsonMode: jsonMode,\n\n    expressionAllowed: expressionAllowed,\n    skipExpression: function(state) {\n      var top = state.cc[state.cc.length - 1]\n      if (top == expression || top == expressionNoComma) state.cc.pop()\n    }\n  };\n});\n\nCodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/);\n\nCodeMirror.defineMIME(\"text/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"text/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/x-javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/x-json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/ld+json\", {name: \"javascript\", jsonld: true});\nCodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true });\nCodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true });\n\n});\n"
  },
  {
    "path": "lib/codemirror/mode/javascript/json-ld.html",
    "content": "<!doctype html>\n\n<title>CodeMirror: JSON-LD mode</title>\n<meta charset=\"utf-8\"/>\n<link rel=stylesheet href=\"../../doc/docs.css\">\n\n<link rel=\"stylesheet\" href=\"../../lib/codemirror.css\">\n<script src=\"../../lib/codemirror.js\"></script>\n<script src=\"../../addon/edit/matchbrackets.js\"></script>\n<script src=\"../../addon/comment/continuecomment.js\"></script>\n<script src=\"../../addon/comment/comment.js\"></script>\n<script src=\"javascript.js\"></script>\n<style type=\"text/css\">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>\n<div id=\"nav\">\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../../doc/logo.png\"/></a>\n\n  <ul>\n    <li><a href=\"../../index.html\">Home</a>\n    <li><a href=\"../../doc/manual.html\">Manual</a>\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\n  </ul>\n  <ul>\n    <li><a href=\"../index.html\">Language modes</a>\n    <li><a class=active href=\"#\">JSON-LD</a>\n  </ul>\n</div>\n\n<article>\n<h2>JSON-LD mode</h2>\n\n\n<div><textarea id=\"code\" name=\"code\">\n{\n  \"@context\": {\n    \"name\": \"http://schema.org/name\",\n    \"description\": \"http://schema.org/description\",\n    \"image\": {\n      \"@id\": \"http://schema.org/image\",\n      \"@type\": \"@id\"\n    },\n    \"geo\": \"http://schema.org/geo\",\n    \"latitude\": {\n      \"@id\": \"http://schema.org/latitude\",\n      \"@type\": \"xsd:float\"\n    },\n    \"longitude\": {\n      \"@id\": \"http://schema.org/longitude\",\n      \"@type\": \"xsd:float\"\n    },\n    \"xsd\": \"http://www.w3.org/2001/XMLSchema#\"\n  },\n  \"name\": \"The Empire State Building\",\n  \"description\": \"The Empire State Building is a 102-story landmark in New York City.\",\n  \"image\": \"http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg\",\n  \"geo\": {\n    \"latitude\": \"40.75\",\n    \"longitude\": \"73.98\"\n  }\n}\n</textarea></div>\n\n    <script>\n      var editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n        matchBrackets: true,\n        autoCloseBrackets: true,\n        mode: \"application/ld+json\",\n        lineWrapping: true\n      });\n    </script>\n    \n    <p>This is a specialization of the <a href=\"index.html\">JavaScript mode</a>.</p>\n  </article>\n"
  },
  {
    "path": "lib/codemirror/mode/javascript/test.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function() {\n  var mode = CodeMirror.getMode({indentUnit: 2}, \"javascript\");\n  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }\n\n  MT(\"locals\",\n     \"[keyword function] [def foo]([def a], [def b]) { [keyword var] [def c] [operator =] [number 10]; [keyword return] [variable-2 a] [operator +] [variable-2 c] [operator +] [variable d]; }\");\n\n  MT(\"comma-and-binop\",\n     \"[keyword function](){ [keyword var] [def x] [operator =] [number 1] [operator +] [number 2], [def y]; }\");\n\n  MT(\"destructuring\",\n     \"([keyword function]([def a], [[[def b], [def c] ]]) {\",\n     \"  [keyword let] {[def d], [property foo]: [def c][operator =][number 10], [def x]} [operator =] [variable foo]([variable-2 a]);\",\n     \"  [[[variable-2 c], [variable y] ]] [operator =] [variable-2 c];\",\n     \"})();\");\n\n  MT(\"destructure_trailing_comma\",\n    \"[keyword let] {[def a], [def b],} [operator =] [variable foo];\",\n    \"[keyword let] [def c];\"); // Parser still in good state?\n\n  MT(\"class_body\",\n     \"[keyword class] [def Foo] {\",\n     \"  [property constructor]() {}\",\n     \"  [property sayName]() {\",\n     \"    [keyword return] [string-2 `foo${][variable foo][string-2 }oo`];\",\n     \"  }\",\n     \"}\");\n\n  MT(\"class\",\n     \"[keyword class] [def Point] [keyword extends] [variable SuperThing] {\",\n     \"  [property get] [property prop]() { [keyword return] [number 24]; }\",\n     \"  [property constructor]([def x], [def y]) {\",\n     \"    [keyword super]([string 'something']);\",\n     \"    [keyword this].[property x] [operator =] [variable-2 x];\",\n     \"  }\",\n     \"}\");\n\n  MT(\"import\",\n     \"[keyword function] [def foo]() {\",\n     \"  [keyword import] [def $] [keyword from] [string 'jquery'];\",\n     \"  [keyword import] { [def encrypt], [def decrypt] } [keyword from] [string 'crypto'];\",\n     \"}\");\n\n  MT(\"const\",\n     \"[keyword function] [def f]() {\",\n     \"  [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];\",\n     \"}\");\n\n  MT(\"for/of\",\n     \"[keyword for]([keyword let] [def of] [keyword of] [variable something]) {}\");\n\n  MT(\"generator\",\n     \"[keyword function*] [def repeat]([def n]) {\",\n     \"  [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])\",\n     \"    [keyword yield] [variable-2 i];\",\n     \"}\");\n\n  MT(\"quotedStringAddition\",\n     \"[keyword let] [def f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];\");\n\n  MT(\"quotedFatArrow\",\n     \"[keyword let] [def f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];\");\n\n  MT(\"fatArrow\",\n     \"[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);\",\n     \"[variable a];\", // No longer in scope\n     \"[keyword let] [def f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];\",\n     \"[variable c];\");\n\n  MT(\"spread\",\n     \"[keyword function] [def f]([def a], [meta ...][def b]) {\",\n     \"  [variable something]([variable-2 a], [meta ...][variable-2 b]);\",\n     \"}\");\n\n  MT(\"comprehension\",\n     \"[keyword function] [def f]() {\",\n     \"  [[([variable x] [operator +] [number 1]) [keyword for] ([keyword var] [def x] [keyword in] [variable y]) [keyword if] [variable pred]([variable-2 x]) ]];\",\n     \"  ([variable u] [keyword for] ([keyword var] [def u] [keyword of] [variable generateValues]()) [keyword if] ([variable-2 u].[property color] [operator ===] [string 'blue']));\",\n     \"}\");\n\n  MT(\"quasi\",\n     \"[variable re][string-2 `fofdlakj${][variable x] [operator +] ([variable re][string-2 `foo`]) [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]\");\n\n  MT(\"quasi_no_function\",\n     \"[variable x] [operator =] [string-2 `fofdlakj${][variable x] [operator +] [string-2 `foo`] [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]\");\n\n  MT(\"indent_statement\",\n     \"[keyword var] [def x] [operator =] [number 10]\",\n     \"[variable x] [operator +=] [variable y] [operator +]\",\n     \"  [atom Infinity]\",\n     \"[keyword debugger];\");\n\n  MT(\"indent_if\",\n     \"[keyword if] ([number 1])\",\n     \"  [keyword break];\",\n     \"[keyword else] [keyword if] ([number 2])\",\n     \"  [keyword continue];\",\n     \"[keyword else]\",\n     \"  [number 10];\",\n     \"[keyword if] ([number 1]) {\",\n     \"  [keyword break];\",\n     \"} [keyword else] [keyword if] ([number 2]) {\",\n     \"  [keyword continue];\",\n     \"} [keyword else] {\",\n     \"  [number 10];\",\n     \"}\");\n\n  MT(\"indent_for\",\n     \"[keyword for] ([keyword var] [def i] [operator =] [number 0];\",\n     \"     [variable i] [operator <] [number 100];\",\n     \"     [variable i][operator ++])\",\n     \"  [variable doSomething]([variable i]);\",\n     \"[keyword debugger];\");\n\n  MT(\"indent_c_style\",\n     \"[keyword function] [def foo]()\",\n     \"{\",\n     \"  [keyword debugger];\",\n     \"}\");\n\n  MT(\"indent_else\",\n     \"[keyword for] (;;)\",\n     \"  [keyword if] ([variable foo])\",\n     \"    [keyword if] ([variable bar])\",\n     \"      [number 1];\",\n     \"    [keyword else]\",\n     \"      [number 2];\",\n     \"  [keyword else]\",\n     \"    [number 3];\");\n\n  MT(\"indent_funarg\",\n     \"[variable foo]([number 10000],\",\n     \"    [keyword function]([def a]) {\",\n     \"  [keyword debugger];\",\n     \"};\");\n\n  MT(\"indent_below_if\",\n     \"[keyword for] (;;)\",\n     \"  [keyword if] ([variable foo])\",\n     \"    [number 1];\",\n     \"[number 2];\");\n\n  MT(\"multilinestring\",\n     \"[keyword var] [def x] [operator =] [string 'foo\\\\]\",\n     \"[string bar'];\");\n\n  MT(\"scary_regexp\",\n     \"[string-2 /foo[[/]]bar/];\");\n\n  MT(\"indent_strange_array\",\n     \"[keyword var] [def x] [operator =] [[\",\n     \"  [number 1],,\",\n     \"  [number 2],\",\n     \"]];\",\n     \"[number 10];\");\n\n  MT(\"param_default\",\n     \"[keyword function] [def foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {\",\n     \"  [keyword return] [variable-2 x];\",\n     \"}\");\n\n  MT(\"new_target\",\n     \"[keyword function] [def F]([def target]) {\",\n     \"  [keyword if] ([variable-2 target] [operator &&] [keyword new].[keyword target].[property name]) {\",\n     \"    [keyword return] [keyword new]\",\n     \"      .[keyword target];\",\n     \"  }\",\n     \"}\");\n\n  var jsonld_mode = CodeMirror.getMode(\n    {indentUnit: 2},\n    {name: \"javascript\", jsonld: true}\n  );\n  function LD(name) {\n    test.mode(name, jsonld_mode, Array.prototype.slice.call(arguments, 1));\n  }\n\n  LD(\"json_ld_keywords\",\n    '{',\n    '  [meta \"@context\"]: {',\n    '    [meta \"@base\"]: [string \"http://example.com\"],',\n    '    [meta \"@vocab\"]: [string \"http://xmlns.com/foaf/0.1/\"],',\n    '    [property \"likesFlavor\"]: {',\n    '      [meta \"@container\"]: [meta \"@list\"]',\n    '      [meta \"@reverse\"]: [string \"@beFavoriteOf\"]',\n    '    },',\n    '    [property \"nick\"]: { [meta \"@container\"]: [meta \"@set\"] },',\n    '    [property \"nick\"]: { [meta \"@container\"]: [meta \"@index\"] }',\n    '  },',\n    '  [meta \"@graph\"]: [[ {',\n    '    [meta \"@id\"]: [string \"http://dbpedia.org/resource/John_Lennon\"],',\n    '    [property \"name\"]: [string \"John Lennon\"],',\n    '    [property \"modified\"]: {',\n    '      [meta \"@value\"]: [string \"2010-05-29T14:17:39+02:00\"],',\n    '      [meta \"@type\"]: [string \"http://www.w3.org/2001/XMLSchema#dateTime\"]',\n    '    }',\n    '  } ]]',\n    '}');\n\n  LD(\"json_ld_fake\",\n    '{',\n    '  [property \"@fake\"]: [string \"@fake\"],',\n    '  [property \"@contextual\"]: [string \"@identifier\"],',\n    '  [property \"user@domain.com\"]: [string \"@graphical\"],',\n    '  [property \"@ID\"]: [string \"@@ID\"]',\n    '}');\n})();\n"
  },
  {
    "path": "lib/codemirror/mode/javascript/typescript.html",
    "content": "<!doctype html>\n\n<title>CodeMirror: TypeScript mode</title>\n<meta charset=\"utf-8\"/>\n<link rel=stylesheet href=\"../../doc/docs.css\">\n\n<link rel=\"stylesheet\" href=\"../../lib/codemirror.css\">\n<script src=\"../../lib/codemirror.js\"></script>\n<script src=\"javascript.js\"></script>\n<style type=\"text/css\">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>\n<div id=nav>\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../../doc/logo.png\"></a>\n\n  <ul>\n    <li><a href=\"../../index.html\">Home</a>\n    <li><a href=\"../../doc/manual.html\">Manual</a>\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\n  </ul>\n  <ul>\n    <li><a href=\"../index.html\">Language modes</a>\n    <li><a class=active href=\"#\">TypeScript</a>\n  </ul>\n</div>\n\n<article>\n<h2>TypeScript mode</h2>\n\n\n<div><textarea id=\"code\" name=\"code\">\nclass Greeter {\n\tgreeting: string;\n\tconstructor (message: string) {\n\t\tthis.greeting = message;\n\t}\n\tgreet() {\n\t\treturn \"Hello, \" + this.greeting;\n\t}\n}   \n\nvar greeter = new Greeter(\"world\");\n\nvar button = document.createElement('button')\nbutton.innerText = \"Say Hello\"\nbutton.onclick = function() {\n\talert(greeter.greet())\n}\n\ndocument.body.appendChild(button)\n\n</textarea></div>\n\n    <script>\n      var editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n        lineNumbers: true,\n        matchBrackets: true,\n        mode: \"text/typescript\"\n      });\n    </script>\n\n    <p>This is a specialization of the <a href=\"index.html\">JavaScript mode</a>.</p>\n  </article>\n"
  },
  {
    "path": "lib/codemirror/mode/jsx/index.html",
    "content": "<!doctype html>\n\n<title>CodeMirror: JSX mode</title>\n<meta charset=\"utf-8\"/>\n<link rel=stylesheet href=\"../../doc/docs.css\">\n\n<link rel=\"stylesheet\" href=\"../../lib/codemirror.css\">\n<script src=\"../../lib/codemirror.js\"></script>\n<script src=\"../javascript/javascript.js\"></script>\n<script src=\"../xml/xml.js\"></script>\n<script src=\"jsx.js\"></script>\n<style type=\"text/css\">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>\n<div id=nav>\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../../doc/logo.png\"></a>\n\n  <ul>\n    <li><a href=\"../../index.html\">Home</a>\n    <li><a href=\"../../doc/manual.html\">Manual</a>\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\n  </ul>\n  <ul>\n    <li><a href=\"../index.html\">Language modes</a>\n    <li><a class=active href=\"#\">JSX</a>\n  </ul>\n</div>\n\n<article>\n<h2>JSX mode</h2>\n\n<div><textarea id=\"code\" name=\"code\">// Code snippets from http://facebook.github.io/react/docs/jsx-in-depth.html\n\n// Rendering HTML tags\nvar myDivElement = <div className=\"foo\" />;\nReactDOM.render(myDivElement, document.getElementById('example'));\n\n// Rendering React components\nvar MyComponent = React.createClass({/*...*/});\nvar myElement = <MyComponent someProperty={true} />;\nReactDOM.render(myElement, document.getElementById('example'));\n\n// Namespaced components\nvar Form = MyFormComponent;\n\nvar App = (\n  <Form>\n    <Form.Row>\n      <Form.Label />\n      <Form.Input />\n    </Form.Row>\n  </Form>\n);\n\n// Attribute JavaScript expressions\nvar person = <Person name={window.isLoggedIn ? window.name : ''} />;\n\n// Boolean attributes\n<input type=\"button\" disabled />;\n<input type=\"button\" disabled={true} />;\n\n// Child JavaScript expressions\nvar content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>;\n\n// Comments\nvar content = (\n  <Nav>\n    {/* child comment, put {} around */}\n    <Person\n      /* multi\n         line\n         comment */\n      name={window.isLoggedIn ? window.name : ''} // end of line comment\n    />\n  </Nav>\n);\n</textarea></div>\n\n<script>\nvar editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n  lineNumbers: true,\n  mode: \"jsx\"\n})\n</script>\n\n<p>JSX Mode for <a href=\"http://facebook.github.io/react\">React</a>'s\nJavaScript syntax extension.</p>\n\n<p><strong>MIME types defined:</strong> <code>text/jsx</code>.</p>\n\n</article>\n"
  },
  {
    "path": "lib/codemirror/mode/jsx/jsx.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n  if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n    mod(require(\"../../lib/codemirror\"), require(\"../xml/xml\"), require(\"../javascript/javascript\"))\n  else if (typeof define == \"function\" && define.amd) // AMD\n    define([\"../../lib/codemirror\", \"../xml/xml\", \"../javascript/javascript\"], mod)\n  else // Plain browser env\n    mod(CodeMirror)\n})(function(CodeMirror) {\n  \"use strict\"\n\n  // Depth means the amount of open braces in JS context, in XML\n  // context 0 means not in tag, 1 means in tag, and 2 means in tag\n  // and js block comment.\n  function Context(state, mode, depth, prev) {\n    this.state = state; this.mode = mode; this.depth = depth; this.prev = prev\n  }\n\n  function copyContext(context) {\n    return new Context(CodeMirror.copyState(context.mode, context.state),\n                       context.mode,\n                       context.depth,\n                       context.prev && copyContext(context.prev))\n  }\n\n  CodeMirror.defineMode(\"jsx\", function(config, modeConfig) {\n    var xmlMode = CodeMirror.getMode(config, {name: \"xml\", allowMissing: true, multilineTagIndentPastTag: false})\n    var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || \"javascript\")\n\n    function flatXMLIndent(state) {\n      var tagName = state.tagName\n      state.tagName = null\n      var result = xmlMode.indent(state, \"\")\n      state.tagName = tagName\n      return result\n    }\n\n    function token(stream, state) {\n      if (state.context.mode == xmlMode)\n        return xmlToken(stream, state, state.context)\n      else\n        return jsToken(stream, state, state.context)\n    }\n\n    function xmlToken(stream, state, cx) {\n      if (cx.depth == 2) { // Inside a JS /* */ comment\n        if (stream.match(/^.*?\\*\\//)) cx.depth = 1\n        else stream.skipToEnd()\n        return \"comment\"\n      }\n\n      if (stream.peek() == \"{\") {\n        xmlMode.skipAttribute(cx.state)\n\n        var indent = flatXMLIndent(cx.state), xmlContext = cx.state.context\n        // If JS starts on same line as tag\n        if (xmlContext && stream.match(/^[^>]*>\\s*$/, false)) {\n          while (xmlContext.prev && !xmlContext.startOfLine)\n            xmlContext = xmlContext.prev\n          // If tag starts the line, use XML indentation level\n          if (xmlContext.startOfLine) indent -= config.indentUnit\n          // Else use JS indentation level\n          else if (cx.prev.state.lexical) indent = cx.prev.state.lexical.indented\n        // Else if inside of tag\n        } else if (cx.depth == 1) {\n          indent += config.indentUnit\n        }\n\n        state.context = new Context(CodeMirror.startState(jsMode, indent),\n                                    jsMode, 0, state.context)\n        return null\n      }\n\n      if (cx.depth == 1) { // Inside of tag\n        if (stream.peek() == \"<\") { // Tag inside of tag\n          xmlMode.skipAttribute(cx.state)\n          state.context = new Context(CodeMirror.startState(xmlMode, flatXMLIndent(cx.state)),\n                                      xmlMode, 0, state.context)\n          return null\n        } else if (stream.match(\"//\")) {\n          stream.skipToEnd()\n          return \"comment\"\n        } else if (stream.match(\"/*\")) {\n          cx.depth = 2\n          return token(stream, state)\n        }\n      }\n\n      var style = xmlMode.token(stream, cx.state), cur = stream.current(), stop\n      if (/\\btag\\b/.test(style)) {\n        if (/>$/.test(cur)) {\n          if (cx.state.context) cx.depth = 0\n          else state.context = state.context.prev\n        } else if (/^</.test(cur)) {\n          cx.depth = 1\n        }\n      } else if (!style && (stop = cur.indexOf(\"{\")) > -1) {\n        stream.backUp(cur.length - stop)\n      }\n      return style\n    }\n\n    function jsToken(stream, state, cx) {\n      if (stream.peek() == \"<\" && jsMode.expressionAllowed(stream, cx.state)) {\n        jsMode.skipExpression(cx.state)\n        state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, \"\")),\n                                    xmlMode, 0, state.context)\n        return null\n      }\n\n      var style = jsMode.token(stream, cx.state)\n      if (!style && cx.depth != null) {\n        var cur = stream.current()\n        if (cur == \"{\") {\n          cx.depth++\n        } else if (cur == \"}\") {\n          if (--cx.depth == 0) state.context = state.context.prev\n        }\n      }\n      return style\n    }\n\n    return {\n      startState: function() {\n        return {context: new Context(CodeMirror.startState(jsMode), jsMode)}\n      },\n\n      copyState: function(state) {\n        return {context: copyContext(state.context)}\n      },\n\n      token: token,\n\n      indent: function(state, textAfter, fullLine) {\n        return state.context.mode.indent(state.context.state, textAfter, fullLine)\n      },\n\n      innerMode: function(state) {\n        return state.context\n      }\n    }\n  }, \"xml\", \"javascript\")\n\n  CodeMirror.defineMIME(\"text/jsx\", \"jsx\")\n});\n"
  },
  {
    "path": "lib/codemirror/mode/jsx/test.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function() {\n  var mode = CodeMirror.getMode({indentUnit: 2}, \"jsx\")\n  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)) }\n\n  MT(\"selfclose\",\n     \"[keyword var] [def x] [operator =] [bracket&tag <] [tag foo] [bracket&tag />] [operator +] [number 1];\")\n\n  MT(\"openclose\",\n     \"([bracket&tag <][tag foo][bracket&tag >]hello [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"attr\",\n     \"([bracket&tag <][tag foo] [attribute abc]=[string 'value'][bracket&tag >]hello [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"braced_attr\",\n     \"([bracket&tag <][tag foo] [attribute abc]={[number 10]}[bracket&tag >]hello [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"braced_text\",\n     \"([bracket&tag <][tag foo][bracket&tag >]hello {[number 10]} [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"nested_tag\",\n     \"([bracket&tag <][tag foo][bracket&tag ><][tag bar][bracket&tag ></][tag bar][bracket&tag ></][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"nested_jsx\",\n     \"[keyword return] (\",\n     \"  [bracket&tag <][tag foo][bracket&tag >]\",\n     \"    say {[number 1] [operator +] [bracket&tag <][tag bar] [attribute attr]={[number 10]}[bracket&tag />]}!\",\n     \"  [bracket&tag </][tag foo][bracket&tag >][operator ++]\",\n     \")\")\n\n  MT(\"preserve_js_context\",\n     \"[variable x] [operator =] [string-2 `quasi${][bracket&tag <][tag foo][bracket&tag />][string-2 }quoted`]\")\n\n  MT(\"line_comment\",\n     \"([bracket&tag <][tag foo] [comment // hello]\",\n     \"   [bracket&tag ></][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"line_comment_not_in_tag\",\n     \"([bracket&tag <][tag foo][bracket&tag >] // hello\",\n     \"  [bracket&tag </][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"block_comment\",\n     \"([bracket&tag <][tag foo] [comment /* hello]\",\n     \"[comment    line 2]\",\n     \"[comment    line 3 */] [bracket&tag ></][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"block_comment_not_in_tag\",\n     \"([bracket&tag <][tag foo][bracket&tag >]/* hello\",\n     \"    line 2\",\n     \"    line 3 */ [bracket&tag </][tag foo][bracket&tag >][operator ++])\")\n\n  MT(\"missing_attr\",\n     \"([bracket&tag <][tag foo] [attribute selected][bracket&tag />][operator ++])\")\n\n  MT(\"indent_js\",\n     \"([bracket&tag <][tag foo][bracket&tag >]\",\n     \"    [bracket&tag <][tag bar] [attribute baz]={[keyword function]() {\",\n     \"        [keyword return] [number 10]\",\n     \"      }}[bracket&tag />]\",\n     \"  [bracket&tag </][tag foo][bracket&tag >])\")\n\n  MT(\"spread\",\n     \"([bracket&tag <][tag foo] [attribute bar]={[meta ...][variable baz] [operator /][number 2]}[bracket&tag />])\")\n\n  MT(\"tag_attribute\",\n     \"([bracket&tag <][tag foo] [attribute bar]=[bracket&tag <][tag foo][bracket&tag />/>][operator ++])\")\n})()\n"
  },
  {
    "path": "static/localization/en.json",
    "content": "{\n  \"shoutem\": {\n    \"affiliate\": {\n      \"level\": \"level\",\n      \"numberOfPoints\": \"{{numberOfPoints}} points\",\n      \"points\": \"points\",\n      \"refreshButton\": \"REFRESH\",\n      \"shareCodeButton\": \"Share code\",\n      \"collectPointsButton\": \"Collect\"\n    },\n    \"age-restriction\": {\n      \"ageRestrictionTitle\": \"Are you at least {{requiredAge}}?\",\n      \"ageRestrictionSubtitle\": \"By agreeing and entering the app you agree to be bound by the \",\n      \"privacyPolicy\": \"Privacy Policy\",\n      \"and\": \"and\",\n      \"termsOfService\": \"Terms of service\",\n      \"privacyPolicyNavBarTitle\": \"Privacy Policy\",\n      \"termsOfServiceNavBarTitle\": \"Terms of Service\",\n      \"continueButtonTitle\": \"Yes, Continue\",\n      \"exitTheAppButtonTitle\": \"No, Exit the App\"\n    },\n    \"agora\": {\n      \"cancel\": \"Cancel\",\n      \"localUserFailsToConnectTitle\": \"Unable to establish video call\",\n      \"localUserFailsToConnectMessage\": \"Please try again later or contact the app owner.\",\n      \"missingPermissionsTitle\": \"Camera and Microphone Access Required\",\n      \"missingPermissionsMessage\": \"Please enable access to your camera and microphone in the Settings\",\n      \"missingUidErrorTitle\": \"User ID is missing\",\n      \"missingUidErrorMessage\": \"Unable to join the channel. Please try again later.\",\n      \"openSettings\": \"Go to Settings\",\n      \"userNotAuthenticatedTitle\": \"User not logged in\",\n      \"userNotAuthenticatedMessage\": \"You must be logged in to use video call feature.\",\n      \"waitingToJoinFirstPart\": \"Waiting for\",\n      \"waitingToJoinSecondPart\": \"to connect...\"\n    },\n    \"application\": {\n      \"errorTitle\": \"Error\",\n      \"preview\": {\n        \"unsupportedActionMessage\": \"This action cannot be performed in Preview.\",\n        \"pushGroupsPreviewAlertTitle\": \"Preview mode\",\n        \"pushGroupsPreviewAlertMessage\": \"Push notifications are not supported in preview mode. You can see groups, but you can't toggle subscriptions. Don't worry, everything works in the live app.\",\n        \"noContentErrorMessage\": \"Please create content and reload your app.\"\n      },\n      \"emptyCollectionErrorMessage\": \"Nothing here at this moment.\",\n      \"emptyListMessage\": \"We couldn't find anything to show...\",\n      \"emptyListTitle\": \"It's empty in here\",\n      \"unexpectedErrorMessage\": \"Unexpected error occurred.\",\n      \"tryAgainButton\": \"TRY AGAIN\",\n      \"configurationLoadErrorMessage\": \"App configuration failed to load.\",\n      \"networkErrorTitle\": \"Network error\",\n      \"networkErrorMessage\": \"No internet connection, please check your network.\",\n      \"noSubscriptionMessage\": \"This app is currently inactive. Please contact its developer for support!\",\n      \"screenUnavailableInWebMessage\": \"This screen is currently unavailable in Web Preview.\\n\\nFor a full native experience of the app you're creating, please download the Disclose app.\"\n    },\n    \"audio\": {\n      \"playbackErrorTitle\": \"Playback Error\",\n      \"playbackErrorMessage\": \"Oops! Something went wrong during audio playback. Please try again.\",\n      \"liveStreamText\": \"Live stream\",\n      \"playbackSpeedTitle\": \"Playback speed\",\n      \"playbackSpeedOption05\": \"0.5x\",\n      \"playbackSpeedOption075\": \"0.75x\",\n      \"playbackSpeedOption1\": \"1x\",\n      \"playbackSpeedOption125\": \"1.25x\",\n      \"playbackSpeedOption15\": \"1.5x\",\n      \"playbackSpeedOption175\": \"1.75x\",\n      \"playbackSpeedOption2\": \"2x\",\n      \"normalRateCaption\": \"(normal)\",\n      \"repeatModeTitle\": \"Repeat mode\",\n      \"repeatOff\": \"Repeat off\",\n      \"repeatTrack\": \"Repeat track\",\n      \"repeatQueue\": \"Repeat playlist\",\n      \"repeatCaptionOff\": \"Tracks play in order, no repeat. Stops after the last track is complete.\",\n      \"repeatCaptionTrack\": \"Loops the current track.\",\n      \"repeatCaptionQueue\": \"Tracks play in order, no repeat. Playlist starts over after the last track is complete.\",\n      \"sleepTimerToastTitle\": \"Sleep Timer Expired\",\n      \"sleepTimerToastMessage\": \"Your audio player has completed its scheduled session.\",\n      \"settingsModalTitle\": \"Settings\",\n      \"sleepTimerSettingsTitle\": \"Sleep timer\",\n      \"timerOption5\": \"5 minutes\",\n      \"timerOption10\": \"10 minutes\",\n      \"timerOption15\": \"15 minutes\",\n      \"timerOption30\": \"30 minutes\",\n      \"timerOption45\": \"45 minutes\",\n      \"timerOption60\": \"60 minutes\",\n      \"turnOffTimerText\": \"Turn off timer\",\n      \"timeLeftCaption\": {\n        \"one\": \"{{count}} minute left\",\n        \"other\": \"{{count}} minutes left\"\n      },\n      \"queueTitle\": \"Queue\",\n      \"nowPlayingTitle\": \"Now playing\",\n      \"queueFinishedToastTitle\": \"Playback status\",\n      \"queueFinishedToastMessage\": \"Playlist has finished playing.\",\n      \"failedLikeRequestToastTitle\": \"Request failed.\",\n      \"failedLikeRequestToastMessage\": \"Oops! Something went wrong. Please try again later, or reach out to our support if the issue continues.\"\n    },\n    \"auth\": {\n      \"appleAuthCanceledError\": \"The user canceled the authorization attempt.\",\n      \"appleAuthFailedError\": \"The authorization attempt failed.\",\n      \"appleAuthInvalidResponseError\": \"The authorization request received an invalid response.\",\n      \"appleAuthNotHandledError\": \"The authorization request wasn't handled.'\",\n      \"appleAuthUnknownError\": \"The authorization attempt failed for an unknown reason.\",\n      \"appleLoginPreviewMessage\": \"Apple authentication is not available in app previews\",\n      \"appleLoginPreviewTitle\": \"Not available in preview\",\n      \"chat\": \"Chat\",\n      \"consentRequiredError\": \"You need to agree to the app's terms and conditions to register\",\n      \"deleteAccountDescription\": \"Account deletion is permanent and irrevesible. If you would like to delete your account please type “DELETE” below and confirm your action.\",\n      \"deleteAccountButtonText\": \"Delete account\",\n      \"deleteAccountText\": \"Delete your account\",\n      \"deletionNavBarTitle\": \"Confirm deletion\",\n      \"doneNavBarButton\": \"Done\",\n      \"editProfileButton\": \"EDIT PROFILE\",\n      \"editProfileNavBarTitle\": \"EDIT PROFILE\",\n      \"emailPlaceholder\": \"name@domain.com\",\n      \"facebookLogInButton\": \"Sign in with Facebook\",\n      \"facebookSignUpButton\": \"Continue with Facebook\",\n      \"facebookLoginPreviewMessage\": \"Facebook authentication is not available in app previews\",\n      \"facebookLoginPreviewTitle\": \"Not available in preview\",\n      \"formNotFilledErrorMessage\": \"All form fields are required.\",\n      \"gdprConsentMessage\": \"I allow this app to collect and use my data, as described in Privacy Policy\",\n      \"emailTakenErrorMessage\": \"This email address is already registered.\",\n      \"emptyUsernameErrorMessage\": \"Username/email should not be empty\",\n      \"emptyPasswordErrorMessage\": \"Password should not be empty\",\n      \"recoverPasswordText\": \"Recover password?\",\n      \"horizontalSeparatorText\": \"OR\",\n      \"imagePickerCameraOption\": \"Take a photo\",\n      \"imagePickerGalleryOption\": \"Choose from library\",\n      \"imagePickerCancelOption\": \"Cancel\",\n      \"imageSelectErrorMessage\": \"Image selection error.\",\n      \"invalidCredentialsErrorMessage\": \"Wrong username / email or password. Please try again.\",\n      \"invalidEmailFormatErrorMessage\": \"Make sure your email format is \\\"name@domain.com\\\".\",\n      \"invalidPasswordFormatErrorMessage\": \"Password has to be at least 6 characters long.\",\n      \"invalidUsernameFormatErrorMessage\": \"Username has to have at least 3 characters, start with a letter and contain only lowercase letters, numbers and underscores.\",\n      \"manualApprovalTitle\": \"Pending approval\",\n      \"manualApprovalMessage\": \"Your registration request is being reviewed. Thank you for your patience.\",\n      \"newsletterConsentMessage\": \"I would like to receive news and event emails from this app\",\n      \"loggedInUserInfo\": \"Username: {{username}}\",\n      \"logInButton\": \"Log In\",\n      \"loginCancelErrorMessage\": \"Login was cancelled.\",\n      \"loginFailedErrorTitle\": \"Login failed\",\n      \"logInNavBarTitle\": \"LOG IN\",\n      \"noAccountSectionTitle\": \"Not a member?\",\n      \"passwordPlaceholder\": \"Enter your password\",\n      \"profileNavBarLogoutButton\": \"Logout\",\n      \"profileNavBarTitle\": \"PROFILE\",\n      \"profileUpdatingErrorMessage\": \"There was an error while updating your profile. Please try again.\",\n      \"profileUpdatingErrorTitle\": \"Update failed\",\n      \"registerButton\": \"Create Account\",\n      \"createNewAccount\": \"Create new account\",\n      \"registerNavBarTitle\": \"CREATE NEW ACCOUNT\",\n      \"registrationFailedErrorTitle\": \"Registration failed\",\n      \"signupAcknowledgement\": {\n        \"leadMessage\": \"By signing up you agree to our\",\n        \"termsOfService\": \"Terms of Service\",\n        \"conjuction\": \" and \",\n        \"privacyPolicy\": \"Privacy policy\"\n      },\n      \"socialLoginSectionTitle\": \"or sign in/sign up with your other account\",\n      \"tokenErrorMessage\": \"Access token is not valid.\",\n      \"unknownEmailErrorMessage\": \"Your username / email was not found.\",\n      \"userBioTitle\": \"Bio\",\n      \"userLocation\": \"Location\",\n      \"userNameAndSurname\": \"Name and surname\",\n      \"usernameOrEmail\": \"Username or Email\",\n      \"username\": \"Username\",\n      \"email\": \"Email\",\n      \"password\": \"Password\",\n      \"forgotPasswordText\": \"Forgot Password?\",\n      \"usernameOrEmailPlaceholder\": \"Enter your username/email\",\n      \"usernamePlaceholder\": \"Enter your username\",\n      \"usernameTakenErrorMessage\": \"That username is taken. Please choose another one or try to sign in.\",\n      \"userWebsite\": \"Website\",\n      \"videoChat\": \"Video Chat\",\n      \"passwordRecoveryNavBarTitle\": \"PASSWORD RECOVERY\",\n      \"passwordRecoveryDescription\": \"Please enter the email address you used when creating your account. We will send you an email with a link to reset your password.\",\n      \"emailInputCaption\": \"Email\",\n      \"sendEmailButtonText\": \"Send Email\",\n      \"changePasswordNavBarTitle\": \"CHANGE YOUR PASSWORD\",\n      \"changePasswordTitle\": \"Change your password\",\n      \"changePasswordDescription\": \"Verification code was sent to your email. If you didn’t receive the recovery email, please check your spam folder.\\nOnce you receive the recovery email, please enter the verification code and the new password.\",\n      \"verificationCodeInputPlaceholder\": \"Enter verification code\",\n      \"verificationCodeCaption\": \"Verification code\",\n      \"newPasswordCaption\": \"New password\",\n      \"repeatNewPasswordCaption\": \"Repeat new password\",\n      \"verificationCodeErrorText\": \"Enter verification code\",\n      \"repeatPasswordErrorText\": \"Passwords must match\",\n      \"alertSuccessTitle\": \"Success\",\n      \"alertSuccessMessage\": \"Password was successfully changed.\\nYou may now proceed to login with the new password.\",\n      \"alertConfirmButton\": \"OK\",\n      \"alertErrorTitle\": \"Error\",\n      \"alertErrorMessage\": \"Password change failed. Please try again.\",\n      \"alertTryAgainMessage\": \"Something went wrong. Please try again in few moments\",\n      \"confirmButtonText\": \"Confirm\",\n      \"typeHerePlaceholder\": \"Type here...\",\n      \"deleteText\": \"delete\"\n    },\n    \"bands-in-town\": {\n      \"noWidgetMessage\": \"Missing widget code, can't display data\"\n    },\n    \"besttime\": {\n      \"besttimeServiceUnavailable\": \"Service currently not available.\",\n      \"closed\": \"Closed\",\n      \"currentHourLabel\": \"Now\",\n      \"googlePlacesErrorSuggestion\": \"Try entering a more precise address or name\",\n      \"noDataAvailableMessage\": \"No data available for this business.\",\n      \"noForecastDataMessage\": \"Not enough data available yet for full forecast.\",\n      \"noGooglePlacesFound\": \"No places found\",\n      \"noLiveDataMessage\": \"No live data available at the moment.\",\n      \"noPlaceDetailsFoundMessage\": \"No information found, venue might be permanently closed.\",\n      \"openAllDay\": \"Open all day\",\n      \"openNow\": \"Open now:\",\n      \"searchInstructions\": \"Search for businesses\",\n      \"searchExplanation\": \"And find out the best time to visit\",\n      \"showOnMap\": \"Show on map\"\n    },\n    \"books\": {\n      \"buyButtonText\": \"BUY THIS BOOK\"\n    },\n    \"camera\": {\n      \"changePermissionsButton\": \"Change permissions\",\n      \"missingPermissionAlertTitle\": \"Missing permissions\",\n      \"permissionNotGranted\": \"Camera permission not granted.\",\n      \"codeScannedTitle\": \"QR Code scanned\",\n      \"codeScannedMessage\": \"Scanned link: {{url}}\",\n      \"codeMissingUrlMessage\": \"This code doesn't contain a valid url\",\n      \"cancelButtonLabel\": \"Cancel\",\n      \"openButtonLabel\": \"Open\"\n    },\n    \"carplay\": {\n      \"permissionAlertTitle\": \"Permission Required\",\n      \"permissionAlertMessage\": \"To be able to use your app in Android Auto, without actually starting the app manualy, we will use the Draw Over Apps permission to wake your mobile app when the content is requested. If you want this functionality, please enable the permission for this application\",\n      \"permissionRejectButtonText\": \"Reject\",\n      \"permissionGrantButtonText\": \"Grant\",\n      \"radioStationsTitle\": \"Radio stations\"\n    },\n    \"checklist\": {\n      \"checklistScreenSubmitButton\": \"Submit\",\n      \"checklistScreenHelpButton\": \"Help\",\n      \"contactButton\": \"Contact us via email\",\n      \"goBackButton\": \"Go back\",\n      \"saveProgressButton\": \"Save\",\n      \"submitAlertAccept\": \"Submit\",\n      \"submitAlertCancel\": \"Go back\",\n      \"submitAlertMessage\": \"Once you submit your progress, you will no longer be able to edit it.\\n Are you sure you want to submit?\",\n      \"submitAlertTitle\": \"Progress Submission\"\n    },\n    \"cms\": {\n      \"androidLocationPermissionTitle\": \"Location Permission\",\n      \"androidLocationPermissionMessage\": \"This app needs access to your location to display relevant data.\",\n      \"androidLocationPermissionDisabled\": \"You disabled location permissions for this application. Do you want to enable them now?\",\n      \"androidLocationPermissionEnable\": \"Enable\",\n      \"iosLocationPermissionDisabled\": \"You disabled location permissions for this application. Do you want to enable it in settings now?\",\n      \"iosLocationPermissionSettings\": \"Go to Settings\",\n      \"cancelLocationPermissions\": \"Cancel\",\n      \"locationPermissionsPrompt\": \"Grant location access\",\n      \"noLocationsProvidedErrorMessage\": \"None of your items have a location specified.\",\n      \"directionsButton\": \"Directions\",\n      \"descriptionTitle\": \"INFORMATION\",\n      \"mapTitle\": \"LOCATION\",\n      \"openHours\": \"OPEN HOURS\",\n      \"emailButton\": \"Email\",\n      \"phoneButton\": \"Phone\",\n      \"websiteButton\": \"Visit webpage\",\n      \"twitterButton\": \"Visit X (Twitter)\",\n      \"facebookButton\": \"Visit Facebook\",\n      \"instagramButton\": \"Visit Instagram\",\n      \"tiktokButton\": \"Visit TikTok\",\n      \"linkedInButton\": \"Visit LinkedIn\",\n      \"rsvpButton\": \"RSVP\",\n      \"navBarListViewButton\": \"List\",\n      \"navBarMapViewButton\": \"Map\",\n      \"noSearchResultsText\": \"No results found\",\n      \"searchPlaceholder\": \"Search\"\n    },\n    \"deals\": {\n      \"couponsRemainingMessage\": {\n        \"one\": \"{{count}} coupon left\",\n        \"other\": \"{{count}} coupons left\"\n      },\n      \"claimCouponButton\": \"CLAIM DEAL\",\n      \"redeemCouponButton\": \"REDEEM DEAL\",\n      \"redeemDealButton\": \"REDEEM DEAL\",\n      \"dealsMapButton\": \"Map\",\n      \"dealsGridButton\": \"Grid\",\n      \"dealsListButton\": \"List\",\n      \"validUntilLabelWithTime\": \"Valid until {{time}} on {{weekdayAndDate}}\",\n      \"validUntilLabelWithoutTime\": \"Valid until {{weekdayAndDate}}\",\n      \"dealDescriptionHeading\": \"Description\",\n      \"dealConditionsHeading\": \"Conditions\",\n      \"previousDealLabel\": \"PREVIOUS\",\n      \"nextDealLabel\": \"NEXT\",\n      \"visitWebsiteLabel\": \"Visit website\",\n      \"dealLocationDirections\": \"Directions\",\n      \"couponClaimedText\": \"You've claimed this deal.\",\n      \"couponRedeemTimeText\": \"Time to redeem\",\n      \"couponRedeemInstructionsTitleText\": \"How to redeem?\",\n      \"couponRedeemInstructions\": \"Let the cashier confirm the deal you've claimed. Confirming the deal yourself will render it useless.\",\n      \"dealRedeemedText\": \"You've redeemed this deal.\",\n      \"myDealsTitle\": \"My deals\",\n      \"myDealsTabText\": \"Claimed\",\n      \"myDealsAuthenticationRequiredText\": \"Sign in to view claimed deals\",\n      \"favoriteDealsTabText\": \"Favorited\"\n    },\n    \"events\": {\n      \"addToCalendarButton\": \"ADD TO CALENDAR\",\n      \"calendarPermissionsTitle\": \"Grant calendar access\",\n      \"calendarPermissionsMessage\": \"You disabled calendar access for this application. Do you want to enable it in settings now?\",\n      \"calendarPermissionsSettings\": \"Go to Settings\",\n      \"calendarPermissionsCancel\": \"Cancel\",\n      \"wheelchairFriendly\": \"WHEELCHAIR FRIENDLY\"\n    },\n    \"favorites\": {\n      \"noFavoritesMessage\": \"This screen will list your favorites once you add them.\"\n    },\n    \"geo-restrictions\": {\n      \"missingPermissionsTitle\": \"Missing Location Permission\",\n      \"missingPermissionsMessage\": \"Please enable necessary permissions in device settings to proceed.\",\n      \"invalidConfigurationTitle\": \"Error\",\n      \"emptyStateTitle\": \"Screen not available\",\n      \"emptyStateMessage\": \"Sorry, this feature is not available in your county.\"\n    },\n    \"ical-events\": {\n      \"addToCalendarButton\": \"ADD TO CALENDAR\",\n      \"calendarPermissionsTitle\": \"Grant calendar access\",\n      \"calendarPermissionsMessage\": \"You disabled calendar access for this application. Do you want to enable it in settings now?\",\n      \"calendarPermissionsSettings\": \"Go to Settings\",\n      \"calendarPermissionsCancel\": \"Cancel\",\n      \"noUrlMessage\": \"Please specify an iCal URL and reload the app.\"\n    },\n    \"in-app-purchases\": {\n      \"restoreButtonTitle\": \"Restore\",\n      \"restoreNoProductsTitle\": \"Restore complete\",\n      \"restoreNoProductsDescription\": \"We couldn't find any purchases to restore per your account\",\n      \"subscriptionTrialDuration\": \"days free trial\",\n      \"subscribeButtonPrefix\": \"Subscribe for\",\n      \"subscribeButtonDurationWeek\": \"week\",\n      \"subscribeButtonDurationMonth\": \"month\",\n      \"subscribeButtonDurationMonths\": \"months\",\n      \"termsOfService\": \"Terms of Service\",\n      \"termsAndPolicyConjuction\": \"and\",\n      \"privacyPolicy\": \"Privacy Policy\",\n      \"startExploringButton\": \"Start exploring\",\n      \"subscribeSuccessModalTitle\": \"You have successfully subscribed!\",\n      \"errorProductOwnedTitle\": \"Product already owned\",\n      \"errorProductOwnedDescription\": \"Please restore your purchases to reactivate product\",\n      \"errorDeferredPaymentTitle\": \"Purchase awaiting approval\",\n      \"errorDeferredPaymentDescription\": \"Your purchase is awaiting approval from the parental control\",\n      \"errorReceiptValidationTitle\": \"We're having trouble validating your transaction\",\n      \"errorReceiptValidationDescription\": \"Please give us some time, we'll retry to validate your transaction as soon as possible.\",\n      \"errorReceiptInvalidTitle\": \"Purchase error\",\n      \"errorReceiptInvalidDescription\": \"We were not able to process your purchase, if you've been charged please contact the support\",\n      \"errorReceiptRequestTitle\": \"We're having trouble validating your transaction\",\n      \"errorReceiptRequestDescription\": \"Please try to restore your purchases later or contact the support\",\n      \"errorGenericPurchaseTitle\": \"Purchase error\",\n      \"errorGenericPurchaseDescription\": \"We were not able to process your purchase, please try again later or contact the support\",\n      \"errorGenericRestoreTitle\": \"Restore error\",\n      \"errorGenericRestoreDescription\": \"We were not able to restore your purchases, please try again later or contact the support\"\n    },\n    \"interactive-faq\": {\n      \"backButtonTitle\": \"< Back\"\n    },\n    \"live-update\": {\n      \"newContentAlertTitle\": \"New content\",\n      \"newContentAlertMessage\": \"New content is available in the app, would you like to load it now?\",\n      \"laterButton\": \"Later\",\n      \"acceptButton\": \"Yes\"\n    },\n    \"loyalty\": {\n      \"pointsInStore\": {\n        \"one\": \"{{count}} point collected.\",\n        \"other\": \"{{count}} points collected.\",\n        \"zero\": \"No points collected.\"\n      },\n      \"pointsLabel\": \"Points\",\n      \"collectPointsButton\": \"COLLECT\",\n      \"navigationHistoryButton\": \"History\",\n      \"pointsCollected\": \"Points collected\",\n      \"noPointsCollected\": \"No points collected.\",\n      \"pointsRequiredStores\": {\n        \"one\": \"Requires {{count}} point.\",\n        \"other\": \"Requires {{count}} points.\"\n      },\n      \"pointsRequiredRewards\": {\n        \"one\": \"{{count}} point.\",\n        \"other\": \"{{count}} points.\"\n      },\n      \"noHistory\": \"No activity.\",\n      \"fullHistoryButton\": \"SHOW ENTIRE HISTORY\",\n      \"pointsHistoryTitle\": \"POINTS HISTORY\",\n      \"rewardRedeemed\": \"Reward redeemed\",\n      \"historyItemPointsGainedTitle\": \"Points gained\",\n      \"historyItemAmountSpent\": \"${{amountSpent}} spent\",\n      \"historyItemStoreVisited\": \"Store visited\",\n      \"storeRewardsListTitle\": \"REWARDS\",\n      \"noRewardsForStore\": \"Currently, there are no rewards available for this store.\",\n      \"storeDescriptionTitle\": \"LOCATION INFO\",\n      \"openHours\": \"OPEN HOURS\",\n      \"rsvp\": \"Reservation\",\n      \"websiteButton\": \"Visit webpage\",\n      \"emailButton\": \"Email\",\n      \"phoneButton\": \"Phone\",\n      \"cancelButton\": \"Cancel\",\n      \"locationPermissionsPrompt\": \"Grant location access\",\n      \"currencyPrefix\": \"$ \",\n      \"cashierPointAwardNavBarTitle\": \"ASSIGN POINTS\",\n      \"cashierPointAwardAssigningTitle\": \"ASSIGN POINTS FOR\",\n      \"cashierPointAwardReceiptSum\": \"Receipt sum\",\n      \"cashierPointAwardReceiptCode\": \"Receipt code\",\n      \"purchaseToggleButton\": \"Customer made a purchase\",\n      \"visitToggleButton\": \"Customer visited this store\",\n      \"cashierPointAwardTransactionTitle\": \"ENTER PURCHASE DETAILS\",\n      \"confirmButton\": \"CONFIRM\",\n      \"noProgramNavBarTitle\": \"LOYALTY\",\n      \"noProgramErrorMessage\": \"Turn on loyalty program in extension settings.\",\n      \"wrongPinErrorTitle\": \"Wrong PIN\",\n      \"wrongPinErrorMessage\": \"The PIN you entered was incorrect.\",\n      \"pinPlaceholder\": \"Enter your PIN\",\n      \"pinVerificationNavBarTitle\": \"CASHIER PIN\",\n      \"pinVerificationContinueButton\": \"CONTINUE\",\n      \"refreshButton\": \"REFRESH\",\n      \"myCardScreenNavBarTitle\": \"MY CARD\",\n      \"myCardScreenPointsTitle\": \"Points\",\n      \"scanQrTitle\": \"SCAN QR CODE\",\n      \"scanQrButton\": \"START SCANNER\",\n      \"scanBarcodeButton\": \"SCAN BARCODE\",\n      \"scanBarcodeNavBarTitle\": \"Scan Barcode\",\n      \"pointsEarnedNavBarTitle\": \"POINTS EARNED\",\n      \"pointsEarnedAmountSpent\": \"Your bill was ${{amountSpent}}\",\n      \"pointsEarnedCongratulations\": \"Congratulations!\",\n      \"pointsEarnedMessage\": {\n        \"one\": \"You've earned 1 point\",\n        \"other\": \"You've earned {{count}} points\"\n      },\n      \"pointsHistoryNavBarTitle\": \"POINTS HISTORY\",\n      \"redeemRewardNavBarTitle\": \"REDEEM REWARD\",\n      \"redeemLaterButton\": \"REDEEM LATER\",\n      \"redeemNowButton\": \"REDEEM NOW\",\n      \"redeemMessage\": \"Your reward can be redeemed.\",\n      \"punchCardRedeemButton\": \"REDEEM\",\n      \"punchCardStampButton\": \"STAMP CARD\",\n      \"punchCardStampingNavBarTitle\": \"STAMP CARD\",\n      \"punchCardStampingDoneButton\": \"DONE\",\n      \"punchCardStampedMessage\": {\n        \"one\": \"Your card was stamped once.\",\n        \"other\": \"Your card was stamped {{count}} times\"\n      },\n      \"rewardRedemptionMessage\": \"You have redeemed your reward\",\n      \"rewardPointRequirement\": {\n        \"one\": \"Requires {{count}} point\",\n        \"other\": \"Requires {{count}} points\"\n      },\n      \"rewardRedemptionCongratulation\": \"CONGRATULATIONS\",\n      \"rewardRedemptionContinueButton\": \"CONTINUE\",\n      \"cardStampingDoneMessage\": \"STAMP CARD\",\n      \"cashierVerificationMessage\": \"Show this screen to the Cashier.\",\n      \"usePinInstead\": \"USE PIN INSTEAD\",\n      \"numberOfRewardsInvalidErrorMessage\": \"This reward is currently out of stock.\",\n      \"authDataExpressionInvalidErrorMessage\": \"The barcode is not valid!\",\n      \"transactionExistsErrorMessage\": \"The bar code was already scanned!\",\n      \"transactionInProgress\": \"Another transaction is currently in progress, please try again a little later.\",\n      \"noPointsAwardedErrorTitle\": \"No points selected\",\n      \"noPointsAwardedErrorMessage\": \"Please select points to award or cancel\",\n      \"cardPointCountInvalid\": \"Card doesn't have enough points.\",\n      \"processing\": \"Processing...\",\n      \"qrScanErrorToastTitle\": \"Error\",\n      \"qrScanErrorToastMessage\": \"Something went wrong while trying to read QR code.\"\n    },\n    \"navigation\": {\n      \"noContentScreenName\": \"No content\",\n      \"noScreensMessage\": \"Sorry, this app doesn't have any screens to open.\",\n      \"androidExitMessage\": \"Press the back button again to exit.\"\n    },\n    \"news\": {\n      \"upNext\": \"UP NEXT\",\n      \"relatedArticlesTitle\": \"Related articles\",\n      \"likeButtonText\": \"Like\",\n      \"unlikeButtonText\": \"Unlike\",\n      \"likesCount\": {\n        \"zero\": \"\",\n        \"one\": \"{{count}} user liked this\",\n        \"other\": \"{{count}} users liked this\"\n      },\n      \"searchPlaceholder\": \"Search...\",\n      \"emptyStartSearchListMessage\": \"Enter a search term to find results.\",\n      \"emptySearchListMessage\": \"No results found. Try a different search term.\",\n      \"searchRequestFailedToastTitle\": \"Search failed\",\n      \"searchRequestFailedToastMessage\": \"We couldn't process your search request. If the issue continues, contact our support team for assistance.\"\n    },\n    \"notification-center\": {\n      \"viewNotificationButton\": \"VIEW\",\n      \"notificationListNavBarTitle\": \"Notification settings\",\n      \"pushGroupsSettingsNavBarTitle\": \"SETTINGS\",\n      \"noGroupsErrorMessage\": \"There are no push groups defined.\",\n      \"pushGroupsPreviewAlertTitle\": \"Preview mode\",\n      \"pushGroupsPreviewAlertMessage\": \"Push notifications are not supported in preview mode. You can see groups, but you can't toggle subscriptions. Don't worry, everything works in the live app.\",\n      \"notificationPermissionsAlertTitle\": \"Enable notifications\",\n      \"notificationPermissionsAlertMessage\": \"You disabled push notifications for this application. Do you want to enable them in settings now?\",\n      \"notificationPermissionsSettings\": \"Go to Settings\",\n      \"notificationPermissionsCancel\": \"Cancel\",\n      \"subscribeToPushGroups\": \"Send me push notifications for\",\n      \"reminders\": \"Reminders\",\n      \"reminderToggleTitle\": \"Remind me to use the app\",\n      \"reminderNavigationItemTitle\": \"Set a time of reminder\",\n      \"dailyMessagesSectionTitle\": \"Daily notification messages\",\n      \"dailyMessagesToggleTitle\": \"Daily notification messages\",\n      \"dailyMessagesNavigationItemTitle\": \"Set a daily notification messages settings\",\n      \"dailySettingsTitle\": \"Set a timeframe\",\n      \"dailySettingsDescription\": \"Set a timeframe in which the app will send you notification messages\",\n      \"timePickerDescription\": \"What time works for you the best?\",\n      \"confirmButtonTitle\": \"Confirm\",\n      \"beginsAt\": \"Begins at\",\n      \"endsAt\": \"Ends at\",\n      \"timeframeErrorMessage\": \"Invalid timeframe\",\n      \"reminderSettingsTitle\": \"Set a time reminder\",\n      \"reminderSettingDescription\": \"Set a time when you want to be reminded to use the app, if you haven’t that day\",\n      \"addAdditionalReminder\": \"Add additional reminder\",\n      \"dailyMessagesAlertTitle\": \"Warning\",\n      \"dailyMessagesAlertMessage\": \"Unsubscribing from daily notification messages will stop all incoming messages for today. Are you sure you want to unsubscribe?\",\n      \"alertCancelButton\": \"Cancel\",\n      \"alertConfirmButton\": \"Unsubscribe\",\n      \"pushNotificationsModuleDisabledTitle\": \"No push notifications\",\n      \"pushNotificationsModuleDisabledMessage\": \"Enabling push notifications requires an update to higher plan\",\n      \"pushNotificationsAccessRestrictedTitle\": \"Access restricted\",\n      \"pushNotificationsAccessRestrictedMessage\": \"This functionality is restricted to admin users\",\n      \"pushNotificationsDatePickerSubmit\": \"Submit\",\n      \"pushNotificationsDatePickerCancel\": \"Cancel\",\n      \"pushNotificationsAudienceDropdownPlaceholder\": \"Audience to open\",\n      \"pushNotificationsCreateNotificationButton\": \"Create new push notification\",\n      \"pushNotificationsListEmptyTitle\": \"It's empty in here\",\n      \"pushNotificationsListEmptyMessage\": \"Start sending push notifications to your users by clicking the button below!\",\n      \"pushNotificationsInputRequiredFieldError\": \"This field is required\",\n      \"pushNotificationsDatePickerCaption\": \"Delivery date and time\",\n      \"pushNotificationsShortcutPickerCaption\": \"Screen to open\",\n      \"pushNotificationsUrlPickerCaption\": \"URL to open\",\n      \"pushNotificationsCreatePushScreenTitle\": \"New push notification\",\n      \"pushNotificationsCreatePushTitleLabel\": \"Title\",\n      \"pushNotificationsCreatePushMessageLabel\": \"Message\",\n      \"pushNotificationsCreatePushSuccessToastTitle\": \"Success\",\n      \"pushNotificationsCreatePushSuccessToastMessage\": \"Notification created successfully!\",\n      \"pushNotificationsCreatePushErrorToastTitle\": \"Error\",\n      \"pushNotificationsCreatePushErrorToastMessage\": \"Something went wrong..\",\n      \"pushNotificationsCreatePushTargetTypeCaption\": \"What to open\",\n      \"pushNotificationsEditPushScreenTitle\": \"Edit push notification\",\n      \"pushNotificationsEditPushSuccessToastTitle\": \"Success\",\n      \"pushNotificationsEditPushSuccessToastMessage\": \"Notification edited successfully!\",\n      \"pushNotificationsEditPushErrorToastTitle\": \"Error\",\n      \"pushNotificationsEditPushErrorToastMessage\": \"Something went wrong..\",\n      \"pushNotificationsEditPushCancel\": \"Cancel\",\n      \"pushNotificationsEditPushSaveChanges\": \"Save changes\",\n      \"pushNotificationsViewPushScreenTitle\": \"View push notification\",\n      \"pushNotificationsViewPushScreenCloseButton\": \"Close\",\n      \"pushNotificationsSendNowType\": \"Send now\",\n      \"pushNotificationsScheduledType\": \"Scheduled\",\n      \"noNotificationSettingsMessage\": \"No settings available.\\n\\nEnable user scheduled and/or reminder notifications to manage their settings here.\",\n      \"pushPermissionScreenTitle\": \"Manage push permission\",\n      \"pushPermissionScreenHeading\": \"Stay Updated\",\n      \"pushPermissionScreenDescription\": \"We use push notifications to send you important updates, promotions, and reminders.\",\n      \"pushPermissionScreenEnableButton\": \"Enable\",\n      \"pushPermissionScreenGoToSettingsButton\": \"Go to Settings\",\n      \"pushPermissionScreenNotNowButton\": \"Not right now\",\n      \"pushPermissionScreenPermissionGrantedMessage\": \"Thank you for enabling push notifications! You will now receive important updates, promotions, and reminders.\"\n    },\n    \"onboarding\": {\n      \"getStartedLabel\": \"Get Started\",\n      \"noPagesTitle\": \"No instructions found\",\n      \"noPagesMessage\": \"Add instructions to your onboarding to help users understand the app\"\n    },\n    \"permissions\": {\n      \"cancel\": \"Cancel\",\n      \"missingPermissionsTitle\": \"Missing Permissions\",\n      \"missingPermissionsMessage\": \"Please enable necessary permissions in device settings\",\n      \"alarmPermissionRationale\": \"To schedule local notifications, the app needs alarm permission enabled in the settings. You can turn this permission on or off at any time.\",\n      \"openSettings\": \"Go to Settings\"\n    },\n    \"places\": {\n      \"dealsSectionTitle\": \"Deals\",\n      \"endsLabel\": \"Ends\",\n      \"redeemedLabel\": \"Redeemed\"\n    },\n    \"podcast\": {\n      \"actionSheetCancelOption\": \"Cancel\",\n      \"actionSheetDeleteOption\": \"Delete download\",\n      \"actionSheetDownloadOption\": \"Download\",\n      \"actionSheetDownloadInProgress\": \"Downloading...\",\n      \"actionSheetFavorite\": \"Favorite\",\n      \"actionSheetShareOption\": \"Share\",\n      \"actionSheetUnfavorite\": \"Unfavorite\",\n      \"deviceSettingsDescription\": \"To download and play offline podcast episodes, the app requires read and write access to external storage.\",\n      \"deviceSettingsTitle\": \"Go to Settings\",\n      \"fetchFailedTitle\": \"Something went wrong\",\n      \"fetchFailedMessage\": \"We couldn't process your request. Please check your internet connection and try again.\",\n      \"episodeDownloadSuccessTitle\": \"Download complete\",\n      \"episodeDownloadSuccessMessage\": \"Episode was successfully downloaded.\",\n      \"episodeDeleteTitle\": \"Episode removed\",\n      \"episodeDeleteMessage\": \"Episode was successfully removed from downloaded episodes.\"\n    },\n    \"push-notifications\": {\n      \"messageReceivedAlert\": \"Message received\",\n      \"messageReceivedAlertView\": \"View\",\n      \"messageReceivedAlertDismiss\": \"Dismiss\"\n    },\n    \"radio-player\": {\n      \"buffering\": \"Buffering...\",\n      \"missingStreamUrl\": \"Please enter a valid stream URL and reload your app.\",\n      \"moreOptionsLabel\": \"More options\",\n      \"nowPlaying\": \"Now playing\",\n      \"pressToPlay\": \"Press play to start the stream\",\n      \"shareButtonLabel\": \"Share\",\n      \"shareMessage\": \"Stream address: {{streamUrl}}\",\n      \"shareTitle\": \"Currently listening to {{streamTitle}}\",\n      \"currentNews\": \"CURRENT NEWS\",\n      \"seeAll\": \"See all\"\n    },\n    \"recombee\": {\n      \"cancelRequestAgentLabel\": \"Cancel\",\n      \"moreSuggestionsLabel\": \"More suggestions\",\n      \"moreSuggestionsMessage\": \"Give me some more suggestions\",\n      \"nextSuggestionsMessage\": \"Here you go\",\n      \"noQuestionsMessage\": \"There are no questions for the bot to ask\",\n      \"requestAgentLabel\": \"Request an agent\",\n      \"shareRecommendationsButtonText\": \"Share list\",\n      \"shareSingleRecommendationMessage\": \"Check out what I was recommended by a chatbot:\\n{{titleAndLink}}\",\n      \"shareRecommendationListMessage\": \"Check out what I was recommended by a chatbot:\\n{{titlesAndLinks}}\",\n      \"startOverLabel\": \"Start over\"\n    },\n    \"rss\": {\n      \"noUrlMessage\": \"Please specify RSS feed URL and reload the app.\",\n      \"itemNotFoundTitle\": \"Oops\",\n      \"itemNotFoundMessage\": \"That item is no longer available.\",\n      \"errorMessage\": \"Something went wrong.\",\n      \"messageReceivedAlert\": \"Message received\",\n      \"messageReceivedAlertView\": \"View\",\n      \"messageReceivedAlertDismiss\": \"Dismiss\",\n      \"noSearchResultsText\": \"No results found\"\n    },\n    \"rss-news\": {\n      \"upNext\": \"UP NEXT\"\n    },\n    \"sendbird\": {\n      \"userUnavailableMessage\": \"This user currently isn't available to chat.\",\n      \"genericErrorMessage\": \"Something went wrong. Try again in a few moments.\",\n      \"chatUnavailableErrorTitle\": \"Chat unavailable\",\n      \"chatEncryptionMessage\": \"Messages in this chat are private and encrypted.\",\n      \"chatNotConfiguredMessage\": \"Chat feature is not available due to invalid configuration.\",\n      \"chatsTitle\": \"Chats\",\n      \"otherContactsTitle\": \"Other Contacts\",\n      \"isTypingSuffix\": \" is typing...\",\n      \"textInputPlaceholder\": \"Type a message...\",\n      \"emptyChatListTitle\": \"It's empty in here\",\n      \"emptyChatListMessage\": \"You can start a conversation by looking for person you want to chat with\",\n      \"emptyChatSearchResultTitle\": \"No chats found\",\n      \"emptyChatSearchResultMessage\": \"Could not find any chats including '{{searchQuery}}'\",\n      \"newMessagesLabel\": \"NEW\",\n      \"searchBarPlaceholder\": \"Search conversations or start a new one...\",\n      \"subscriptionInvalidMessage\": \"Chat feature won't be available until this app has a valid subscription.\",\n      \"fileMessageErrorTitle\": \"Something went wrong\",\n      \"fileMessageErrorMessage\": \"We were unable to upload your file. Please try again, and if the issue continues, contact our support team for assistance.\"\n    },\n    \"shopify\": {\n      \"totalPrice\": \"Total price:\",\n      \"itemQuantity\": \"Quantity: \",\n      \"addToCartButton\": \"ADD TO CART\",\n      \"addressSearchPlaceholder\": \"Start typing to find your address\",\n      \"addressSearchCurrentLocation\": \"Use my current location\",\n      \"noItemsInCollection\": \"There are no products in this collection.\",\n      \"noItemsWithSpecificTag\": \"There are no products with tags that match: \",\n      \"itemSearchPlaceholder\": \"Search\",\n      \"cancelSearchButton\": \"Cancel\",\n      \"fetchingShopErrorMessage\": \"There was an error while fetching the shop.\\n\",\n      \"checkoutErrorTitle\": \"Error with checkout\",\n      \"checkoutEmail\": \"Email\",\n      \"checkoutFirstName\": \"First name\",\n      \"checkoutLastName\": \"Last name\",\n      \"checkoutAddress\": \"Address\",\n      \"checkoutCity\": \"City\",\n      \"checkoutProvince\": \"Province\",\n      \"checkoutPostalCode\": \"Postal code\",\n      \"checkoutCardNumber\": \"Card number\",\n      \"checkoutExpiryYear\": \"Expiry year (yy)\",\n      \"checkoutExpiryMonth\": \"Expiry month (mm)\",\n      \"checkoutSecurityCode\": \"Security code\",\n      \"countrySelectionPlaceholder\": \"Select\",\n      \"checkoutFormErrorTitle\": \"Checkout form error\",\n      \"checkoutFormErrorMessage\": \"All fields are mandatory. Check if you missed some.\",\n      \"countrySelectionTitle\": \"COUNTRY\",\n      \"checkoutNavBarTitle\": \"CHECKOUT\",\n      \"checkoutContinueButton\": \"CONTINUE\",\n      \"doneButton\": \"Done\",\n      \"addItemConfirmButton\": \"CONFIRM\",\n      \"cartItemUpdateButton\": \"UPDATE\",\n      \"cartItemRemoveButton\": \"REMOVE\",\n      \"addToCartNavBarTitle\": \"ADD TO CART\",\n      \"orderCompletedNavBarTitle\": \"ORDER COMPLETE\",\n      \"thankYouMessage\": \"Thank you {{firstNameOfBuyer}}!\",\n      \"orderConfirmationTitle\": \"YOUR ORDER IS CONFIRMED\",\n      \"orderRegistered\": \"Your order was registered with #{{orderNumber}}\",\n      \"orderConfirmationMessage\": \"We've accepted your offer and we're getting it ready. A confirmation email has been sent to \",\n      \"customerInformationTitle\": \"CUSTOMER INFORMATION\",\n      \"shippingAddress\": \"SHIPPING ADDRESS\",\n      \"billingAddress\": \"BILLING ADDRESS\",\n      \"orderSummary\": \"ORDER SUMMARY\",\n      \"returnToShopButton\": \"RETURN TO SHOP\",\n      \"paymentInfoCardNumber\": \"Card number\",\n      \"paymentInfoExpiryMonth\": \"Expiry month (mm)\",\n      \"paymentInfoExpiryYear\": \"Expiry year (yy)\",\n      \"paymentInfoCvv\": \"Security code\",\n      \"paymentInfoFirstName\": \"First name\",\n      \"paymentInfoLastName\": \"Last name\",\n      \"paymentInfoFormErrorTitle\": \"Payment information form error\",\n      \"paymentInfoFormErrorMessage\": \"All fields are mandatory. Check if you missed some.\",\n      \"completePaymentButton\": \"COMPLETE PAYMENT\",\n      \"paymentScreenNavBarTitle\": \"PAYMENT\",\n      \"paymentErrorTitle\": \"Payment\",\n      \"paymentFillAllFieldsError\": \"Please fill all fields\",\n      \"paymentExpiryMonthError\": \"Please enter a valid expiry month\",\n      \"paymentExpiryYearError\": \"Please enter a valid expiry year\",\n      \"quickBuyQuantity\": \"Quantity\",\n      \"quickBuyAddToCartButton\": \"Add to cart\",\n      \"quickAddToastTitleProductAdded\": \"PRODUCT ADDED!\",\n      \"cartScreenProductName\": \"PRODUCT NAME\",\n      \"cartScreenProductPrice\": \"PRICE\",\n      \"proceedToCheckoutButton\": \"PROCEED TO CHECKOUT\",\n      \"cartScreenNavBarTitle\": \"SHOPPING CART\",\n      \"orderDetailsNavBarTitle\": \"ORDER DETAILS\",\n      \"editAddressNavBarTitle\": \"EDIT ADDRESS\",\n      \"emptyCartMessage\": \"You haven't added any products yet.\",\n      \"selectAddressNavBarTitle\": \"Select address\",\n      \"shopTitlePlaceholder\": \"SHOP\",\n      \"outOfStockMessage\": \"Out of stock\",\n      \"updateItemScreenProductPrice\": \"Price:\",\n      \"loginError\": \"Login failed\",\n      \"ordersError\": \"There was a problem loading your orders\",\n      \"emptyOrdersMessage\": \"You haven't made any orders yet.\",\n      \"order\": \"Order\",\n      \"status\": \"Status\",\n      \"orderNumber\": \"Order number\",\n      \"orderDate\": \"Order date\",\n      \"items\": \"Items\",\n      \"subtotal\": \"Subtotal\",\n      \"shipping\": \"Shipping\",\n      \"total\": \"Order Total\",\n      \"deliveryAddress\": \"Delivery address\",\n      \"pieces\": \"pc\",\n      \"createCustomerSuccessTitle\": \"Account successfully created\",\n      \"createCustomerErrorTitle\": \"Unable to create Shopify account\",\n      \"createCustomerErrorMessage\": \"Your application account was created. Creating Shopify account failed with:\",\n      \"defaultAddress\": \"Default\",\n      \"otherAddresses\": \"Other addresses\",\n      \"editFirstNameLabel\": \"First name\",\n      \"editLastNameLabel\": \"Last name\",\n      \"saveChanges\": \"Save Changes\",\n      \"editPhoneLabel\": \"Phone\",\n      \"phonePlaceholder\": \"+___ _____\",\n      \"phoneErrorMessage\": \"Please enter valid phone number\",\n      \"editCompanyLabel\": \"Company\",\n      \"editAddressLabel\": \"Address\",\n      \"editCityLabel\": \"City\",\n      \"editCountryLabel\": \"Country/Region\",\n      \"editProvinceLabel\": \"Province\",\n      \"editZipLabel\": \"Zip\",\n      \"setAsDefaultAddress\": \"Set as default address\",\n      \"emptyAddressMessage\": \"You haven't added any addresses yet.\",\n      \"addressCreateDisabledTitle\": \"Feature currently unavailable\",\n      \"addressCreateDisabledMessage\": \"Creating addresses is currently unavailable on Android devices. However, you will still be able to complete checkout.\",\n      \"addressUpdateTitle\": \"Success!\",\n      \"addressCreateSuccess\": \"Address was created successfully\",\n      \"addressEditSuccess\": \"Address was edited successfully\",\n      \"addressDeleteSuccess\": \"Address was deleted successfully\",\n      \"addressFormIncompleteTitle\": \"Address form error\",\n      \"addressFormIncompleteMessage\": \"All fields are mandatory.\\nCheck if you missed some.\",\n      \"deleteAddressWarningTitle\": \"Delete address\",\n      \"deleteAddressWarningMessage\": \"Are you sure you want to delete this address?\",\n      \"deleteAddressCancel\": \"Cancel\",\n      \"deleteAddressConfirm\": \"Delete\",\n      \"setDefaultAddressWarningTitle\": \"Default address\",\n      \"setDefaultAddressWarningMessage\": \"Are you sure you want to set this address as default address?\",\n      \"setDefaultAddressCancel\": \"Cancel\",\n      \"setDefaultAddressConfirm\": \"Confirm\",\n      \"updateCustomerErrorTitle\": \"Unable to edit your Shopify profile\",\n      \"updateCustomerPhoneErrorMessage\": \"Phone number has to include your country calling code (prefixed with +)\",\n      \"loginTitle\": \"Shopify Login\",\n      \"loginDescription\": \"Log in using your existing Shopify store account\",\n      \"loginEmailEmpty\": \"Email should not be empty\",\n      \"loginPasswordEmpty\": \"Password should not be empty\",\n      \"loginEmail\": \"Email\",\n      \"loginPassword\": \"Password\",\n      \"loginEmailPlaceholder\": \"Enter your email\",\n      \"loginPasswordPlaceholder\": \"Enter your password\",\n      \"loginButtonTitleConnected\": \"Re-Connect\",\n      \"loginButtonTitleDisconnected\": \"Connect\",\n      \"loginStatusConnected\": \"You are connected with: %{email}\",\n      \"loginStatusDisconnected\": \"You are currently disconnected\",\n      \"loginSuccessTitle\": \"Success\",\n      \"loginErrorTitle\": \"Error\",\n      \"loginSuccessDescription\": \"Shopify account connected\",\n      \"loginErrorDescription\": \"Shopify login failed\",\n      \"searchProducts\": \"Search Products\",\n      \"viewAll\": \"View All\",\n      \"soldOut\": \"Sold Out\",\n      \"sortFeatured\": \"Featured\",\n      \"sortNewest\": \"Newest\",\n      \"sortBestSelling\": \"Best Selling\",\n      \"sortPriceLow\": \"Price: Low to High\",\n      \"sortPriceHigh\": \"Price: High to Low\",\n      \"sortButton\": \"SORT\",\n      \"sortRelevance\": \"Relevance\",\n      \"filterButton\": \"FILTER\",\n      \"applySortButton\": \"Apply\"\n    },\n    \"social\": {\n      \"commentButton\": \"COMMENT\",\n      \"cancelCommentSelectionOption\": \"Cancel\",\n      \"deleteCommentOption\": \"Delete\",\n      \"emptySearchListTitle\": \"No results found\",\n      \"emptyStartSearchListTitle\": \"\",\n      \"emptySearchListMessage\": \"Your search '{{text}}' did not match any profiles.\",\n      \"emptyStartSearchListMessage\": \"Enter a term to search or apply filters to refine your results.\",\n      \"loadingMoreComments\": \"Loading more comments...\",\n      \"noLikes\": \"No likes\",\n      \"numberOfLikes\": {\n        \"one\": \"{{count}} Like\",\n        \"other\": \"{{count}} Likes\"\n      },\n      \"attachmentSizeWarning\": \"Attachment size exceeds the maximum size of {{maxSize}}MB\",\n      \"blankPostWarning\": \"This post appears to be blank. Please write something.\",\n      \"numberOfComments\": {\n        \"one\": \"{{count}} Comment\",\n        \"other\": \"{{count}} Comments\",\n        \"zero\": \"No comments\"\n      },\n      \"postCommentButton\": \"Post\",\n      \"navBarSearchPlaceholder\": \"Search\",\n      \"searchCancelButton\": \"Cancel\",\n      \"postDetailsTitle\": \"POST DETAILS\",\n      \"newStatusTitle\": \"NEW STATUS\",\n      \"newStatusPlaceholder\": \"Share your thoughts...\",\n      \"viewStatusLikes\": \"LIKES\",\n      \"deleteStatusOption\": \"Delete\",\n      \"cancelStatusSelectionOption\": \"Cancel\",\n      \"postStatusButton\": \"Post\",\n      \"newCommentPlaceholder\": \"Add a comment\",\n      \"likeStatusButtonText\": \"Like\",\n      \"likedStatusButtonText\": \"Unlike\",\n      \"postDetailsNavBarTitle\": \"POST DETAILS\",\n      \"reportOptionSpam\": \"It's a spam\",\n      \"reportOptionInappropriate\": \"It's inappropriate\",\n      \"reportOptionAbuse\": \"It's abusive\",\n      \"reportOptionCancel\": \"Cancel\",\n      \"blockOption\": \"Block\",\n      \"reportOption\": \"Report\",\n      \"unblockOption\": \"Unblock user\",\n      \"reportPostOption\": \"Report post\",\n      \"unblockOptionCancel\": \"Cancel\",\n      \"reportActionSheetTitle\": \"Report\",\n      \"reportActionSheetMessage\": \"Why are you reporting this post? \",\n      \"reportSuccessTitle\": \"Report sent\",\n      \"reportSuccessMessage\": \"Your report has been sent to our administrators.\",\n      \"settingsScreentitle\": \"SETTINGS\",\n      \"settingsScreenSubtitle\": \"Send me a push notification for\",\n      \"commentsOnMyStatuses\": \"Comments on my statuses\",\n      \"likesOnMyStatuses\": \"Likes on my statuses\",\n      \"taggedOnStatuses\": \"Mentions\",\n      \"noPermissionsAlertTitle\": \"Limited access\",\n      \"noMediaPermissionsAlertText\": \"To choose photo to upload, you will need to grant permissions to the app\",\n      \"noCameraPermissionsAlertText\": \"To take a photo using camera, you will need to grant permissions to the app\",\n      \"openSettingsButtonLabel\": \"Open settings\",\n      \"openMentionedUserErrorTitle\": \"Invalid user\",\n      \"openMentionedUserErrorDescription\": \"We couldn't find a user with this username\",\n      \"cancelButtonLabel\": \"Cancel\",\n      \"discardStatusAlertTitle\": \"Save your status as a draft?\",\n      \"discardStatusAlertMessage\": \"You can save your status as a draft now, and finish it later. If you choose to discard, status will be lost.\",\n      \"saveAlertButtonLabel\": \"Save draft\",\n      \"discardAlertButtonLabel\": \"Discard\",\n      \"keepEditingButtonLabel\": \"Keep editing\",\n      \"cancelHeaderButtonText\": \"Cancel\",\n      \"postCommentError\": \"Failed to post a comment. Please try again later.\",\n      \"postStatusError\": \"Failed to post a status. Please try again later.\",\n      \"giphyPickerTitle\": \"Select GIF\",\n      \"giphyPickerInputPlaceholder\": \"Search GIPHY\",\n      \"fetchGifsError\": \"There was a problem loading GIFs\",\n      \"emptyBlockedUsersListMessage\": \"You haven't blocked anyone yet.\",\n      \"reloadButton\": \"Reload\",\n      \"searchScreenTitle\": \"Search user profiles\",\n      \"filtersModalTitle\": \"Filters\",\n      \"filtersModalApplyButtonTitle\": \"Apply & search\",\n      \"filtersModalCancelButtonTitle\": \"Cancel\",\n      \"mapButtonTitle\": \"Map\",\n      \"usersSearchButtonTitle\": \"Users\",\n      \"requestFailedToastTitle\": \"Request failed\",\n      \"likeStateRequestFailedMessage\": \"We couldn't process your request. If the issue continues, contact our support team for assistance.\",\n      \"likeActionRequestFailedMessage\": \"We couldn't process your like request. Please try again, and if the issue continues, contact our support team for assistance.\",\n      \"mentionListPlaceholder\": \"Start typing to search for users...\",\n      \"mentionListNoResults\": \"No users matching that tag\",\n      \"newCommentNotificationForegroundTitle\": \"New Comment\",\n      \"newLikeNotificationForegroundTitle\": \"New Like\",\n      \"newMentionNotificationForegroundTitle\": \"New Mention\",\n      \"messageReceivedAlertView\": \"View\",\n      \"messageReceivedAlertDismiss\": \"Dismiss\"\n    },\n    \"theme\": {\n      \"themeChangedAlertTitle\": \"Theme changed\",\n      \"themeChangedAlertMessage\": \"App will now be restarted to apply the newly selected theme\",\n      \"themeChangedAlertConfirmationButton\": \"Restart\"\n    },\n    \"user-profile\": {\n      \"defaultErrorMessage\": \"Something went wrong\",\n      \"deleteAccountButtonText\": \"Delete account\",\n      \"goBackToAppButton\": \"GO BACK TO APP\",\n      \"userProfileCompletedTitle\": \"Thank you for submitting your application! Your submission will be reviewed by our team.\",\n      \"userProfileCompletedDescription\": \"You will be notified once you are approved.\",\n      \"myProfileScreenTitle\": \"MY PROFILE\",\n      \"userProfileScreenTitle\": \"PROFILE\",\n      \"editUserProfileTitle\": \"Edit profile\",\n      \"editButtonText\": \"Edit\",\n      \"submissionCompletedTitle\": \"SUBMITION COMPLETED\",\n      \"editRequestButton\": \"Edit request\",\n      \"okButton\": \"OK\",\n      \"takePhoto\": \"Take a photo\",\n      \"chooseFromLibrary\": \"Choose from library\",\n      \"cancel\": \"Cancel\",\n      \"cannotAccessCameraTitle\": \"Cannot access camera\",\n      \"cannotAccessCameraMessage\": \"Please allow access in settings if you want to take photos\",\n      \"galleryPermissionErrorTitle\": \"Cannot access image library\",\n      \"galleryPermissionErrorMessage\": \"Please allow access if you want to be able to select images\",\n      \"openSettingsButtonLabel\": \"Open settings\",\n      \"errorTitle\": \"Error\",\n      \"errorMessage\": \"Something went wrong\",\n      \"addMorePhotos\": \"+ ADD MORE PHOTOS\",\n      \"removeItemTitle\": \"Remove item\",\n      \"removeItemMessage\": \"Are you sure you want to remove this item from the gallery?\",\n      \"confirm\": \"Yes\",\n      \"selectImagesToUpload\": \"Select images to upload\",\n      \"submitFormButtonTitle\": \"Save\",\n      \"typeHerePlaceholder\": \"Type here...\",\n      \"noImagesUploaded\": \"No images uploaded yet\",\n      \"chat\": \"Chat\",\n      \"video\": \"Video\",\n      \"logout\": \"Logout\",\n      \"selectLocationLabel\": \"Select location\",\n      \"locationInputPlaceholder\": \"Enter address\",\n      \"locationSelectScreenTitle\": \"Location\",\n      \"emptyPlacesListTitle\": \"\",\n      \"emptyPlacesListMessage\": \"Type something to search...\",\n      \"selectLocationButtonTitle\": \"Select {{label}}\",\n      \"invalidFormat\": \"Invalid {{variant}} format.\",\n      \"openLinkFailureTitle\": \"Something went wrong\",\n      \"openLinkFailureMessage\": \"We couldn't open link at this time.\"\n    },\n    \"web-view\": {\n      \"noUrlErrorMessage\": \"Please enter a valid URL and reload your app.\",\n      \"noUrlErrorTitle\": \"No URL\",\n      \"unsupportedLinkTitle\": \"Failed to open link\",\n      \"unsupportedLinkMessage\": \"Unsupported link type\",\n      \"downloadingPdfFileMessage\": \"Downloading PDF file\",\n      \"pdfDownloadErrorTitle\": \"Failed to download PDF file.\",\n      \"pdfDownloadErrorMessage\": \"The PDF file you're trying to preview might not exist or the URL is invalid.\"\n    },\n    \"wordpress\": {\n      \"upNext\": \"UP NEXT\"\n    }\n  }\n}\n"
  }
]