text:
[CmdletBinding()]
Param(
    [Parameter()]
    [bool] $WaitForUpdateToFinish = $true,

    [Parameter()]
    [bool] $EnableUpdateAnywhere = $true,

    [Parameter()]
    [bool] $ForceAppShutdown = $true,

    [Parameter()]
    [bool] $UpdatePromptUser = $false,

    [Parameter()]
    [bool] $DisplayLevel = $false,

    [Parameter()]
    [string] $UpdateToVersion = $NULL,

    [Parameter()]
    [string] $LogPath = $null,

    [Parameter()]
    [string] $LogName = $null,

    [Parameter()]
    [bool] $ValidateUpdateSourceFiles = $true,

    [Parameter()]
    [bool] $UseScriptLocationAsUpdateSource = $false

)

Function GetScriptRoot() {
 process {
     [string]$scriptPath = "."

     if ($PSScriptRoot) {
       $scriptPath = $PSScriptRoot
     } else {
       $scriptPath = (Get-Item -Path ".\").FullName
     }

     return $scriptPath
 }
}

Function Update-Office365Anywhere() {
<#
.Synopsis
This function is designed to provide way for Office Click-To-Run clients to have the ability to update themselves from a managed network source
or from the Internet depending on the availability of the primary update source.

.DESCRIPTION
This function is designed to provide way for Office Click-To-Run clients to have the ability to update themselves from a managed network source
or from the Internet depending on the availability of the primary update source.  The idea behind this is if users have laptops and are mobile
they may not recieve updates if they are not able to be in the office on regular basis.  This functionality is available with this function but it's
use can be controller by the parameter -EnableUpdateAnywhere.  This function also provides a way to initiate an update and the script will wait
for the update to complete before exiting. Natively starting an update executable does not wait for the process to complete before exiting and
in certain scenarios it may be useful to have the update process wait for the update to complete.

.NOTES
Name: Update-Office365Anywhere
Version: 1.1.0
DateCreated: 2015-08-28
DateUpdated: 2015-09-03

.LINK
https://github.com/OfficeDev/Office-IT-Pro-Deployment-Scripts

.PARAMETER WaitForUpdateToFinish
If this parameter is set to $true then the function will monitor the Office update and will not exit until the update process has stopped.
If this parameter is set to $false then the script will exit right after the update process has been started.  By default this parameter is set
to $true

.PARAMETER EnableUpdateAnywhere
This parameter controls whether the UpdateAnywhere functionality is used or not. When enabled the update process will check the availbility
of the update source set for the client.  If that update source is not available then it will update the client from the Microsoft Office CDN.
When set to $false the function will only use the Update source configured on the client. By default it is set to $true.

.PARAMETER ForceAppShutdown
This specifies whether the user will be given the option to cancel out of the update. However, if this variable is set to True, then the applications will be shut down immediately and the update will proceed.

.PARAMETER UpdatePromptUser
This specifies whether or not the user will see this dialog before automatically applying the updates:

.PARAMETER DisplayLevel
This specifies whether the user will see a user interface during the update. Setting this to false will hide all update UI (including error UI that is encountered during the update scenario).

.PARAMETER UpdateToVersion
This specifies the version to which Office needs to be updated to.  This can used to install a newer or an older version than what is presently installed.

.PARAMETER ValidateUpdateSourceFiles
If this parameter is set to true then the script will ensure the update source has all the files necessary to perform the update

.EXAMPLE
Update-Office365Anywhere

Description:
Will generate the Office Deployment Tool (ODT) configuration XML based on the local computer

#>

    [CmdletBinding()]
    Param(
        [Parameter()]
        [bool] $WaitForUpdateToFinish = $true,

        [Parameter()]
        [bool] $EnableUpdateAnywhere = $true,

        [Parameter()]
        [bool] $ForceAppShutdown = $false,

        [Parameter()]
        [bool] $UpdatePromptUser = $false,

        [Parameter()]
        [bool] $DisplayLevel = $false,

        [Parameter()]
        [string] $UpdateToVersion = $NULL,

        [Parameter()]
        [string] $LogPath = $NULL,

        [Parameter()]
        [string] $LogName = $NULL,

        [Parameter()]
        [bool] $ValidateUpdateSourceFiles = $true,

        [Parameter()]
        [bool] $UseScriptLocationAsUpdateSource = $false
    )

    Process {
        try {
            $Global:UpdateAnywhereLogPath = $LogPath;
            $Global:UpdateAnywhereLogFileName = $LogName;

            $scriptPath = GetScriptRoot

            $shareFunctionsPath = "$scriptPath\SharedFunctions.ps1"
            if ($scriptPath.StartsWith("\\")) {
            } else {
              if (!(Test-Path -Path $shareFunctionsPath)) {
                 throw "Missing Dependency File SharedFunctions.ps1"
              }
            }
            . $shareFunctionsPath

            $mainRegPath = Get-OfficeCTRRegPath
            if (!($mainRegPath)) {
               throw "Office 365 ProPlus is not installed"
            }

            $configRegPath = $mainRegPath + "\Configuration"
            $GPORegPath = "HKLM:\Software\Policies\Microsoft\Office\16.0\common\officeupdate"
            $GPORegPath2 = "Software\Policies\Microsoft\Office\16.0\common\officeupdate"

            $GPOUpdateSource = $true
            $currentUpdateSource = (Get-ItemProperty $GPORegPath -Name updatepath -ErrorAction SilentlyContinue).updatepath

            if(!($currentUpdateSource)){
              $currentUpdateSource = (Get-ItemProperty HKLM:\$configRegPath -Name UpdateUrl -ErrorAction SilentlyContinue).UpdateUrl
              $GPOUpdateSource = $false
            }

            $saveUpdateSource = (Get-ItemProperty HKLM:\$configRegPath -Name SaveUpdateUrl -ErrorAction SilentlyContinue).SaveUpdateUrl
            $clientFolder = (Get-ItemProperty HKLM:\$configRegPath -Name ClientFolder -ErrorAction SilentlyContinue).ClientFolder

            $officeUpdateCDN = Get-OfficeCDNUrl

            $officeCDN = "http://officecdn.microsoft.com"
            $oc2rcFilePath = Join-Path $clientFolder "\OfficeC2RClient.exe"

            $oc2rcParams = "/update user"
            if ($ForceAppShutdown) {
              $oc2rcParams += " forceappshutdown=true"
            } else {
              $oc2rcParams += " forceappshutdown=false"
            }

            if ($UpdatePromptUser) {
              $oc2rcParams += " updatepromptuser=true"
            } else {
              $oc2rcParams += " updatepromptuser=false"
            }

            if ($DisplayLevel) {
              $oc2rcParams += " displaylevel=true"
            } else {
              $oc2rcParams += " displaylevel=false"
            }

            if ($UpdateToVersion) {
              $oc2rcParams += " updatetoversion=$UpdateToVersion"
            }

            [string]$localUpdatePath = ""
            [bool]$scriptPathIsUpdateSource = $false
            if ($UseScriptLocationAsUpdateSource) {
              if ($scriptPath) {
                  if (Test-ItemPathUNC -Path "$scriptPath\SourceFiles") {
                     $localUpdatePath = Change-UpdatePathToChannel -UpdatePath "$scriptPath\SourceFiles" -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles
                  } else {
                     $localUpdatePath = Change-UpdatePathToChannel -UpdatePath $scriptPath -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles
                  }

                  [bool]$localIsAlive = Test-UpdateSource -UpdateSource $localUpdatePath -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles

                  if ($localIsAlive) {
                      $scriptPathIsUpdateSource = $true
                      $currentUpdateSource = $localUpdatePath
                  }
              }
            }

            $UpdateSource = "http"
            if ($currentUpdateSource) {
              If ($currentUpdateSource.StartsWith("\\",1)) {
                 $UpdateSource = "UNC"
              }
            }

            if ($EnableUpdateAnywhere) {

                if ($currentUpdateSource) {
                    [bool]$isAlive = $false
                    if ($currentUpdateSource.ToLower() -eq $officeUpdateCDN.ToLower() -and ($saveUpdateSource)) {
                        if ($currentUpdateSource -ne $saveUpdateSource) {
                            $channelUpdateSource = Change-UpdatePathToChannel -UpdatePath $saveUpdateSource -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles

                            if ($channelUpdateSource -ne $saveUpdateSource) {
                                $saveUpdateSource = $channelUpdateSource
                            }

	                        $isAlive = Test-UpdateSource -UpdateSource $saveUpdateSource -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles
                            if ($isAlive) {
                               Write-Log -Message "Restoring Saved Update Source $saveUpdateSource" -severity 1 -component "Office 365 Update Anywhere"

                               if ($GPOUpdateSource) {
                                   New-ItemProperty -Path "HKLM:\$GPORegPath" -Name "updatepath" -Value $saveUpdateSource -PropertyType String -Force -ErrorAction Stop | Out-Null
                               } else {
                                   New-ItemProperty -Path "HKLM:\$configRegPath" -Name "UpdateUrl" -Value $saveUpdateSource -PropertyType String -Force -ErrorAction Stop | Out-Null
                               }
                            }
                        }
                    }
                }

                if (!($currentUpdateSource)) {
                   if ($officeUpdateCDN) {
                       Write-Log -Message "No Update source is set so defaulting to Office CDN" -severity 1 -component "Office 365 Update Anywhere"

                       if ($GPOUpdateSource) {
                           New-ItemProperty -Path "HKLM:\$GPORegPath" -Name "updatepath" -Value $officeUpdateCDN -PropertyType String -Force -ErrorAction Stop | Out-Null
                       } else {
                           New-ItemProperty -Path "HKLM:\$configRegPath" -Name "UpdateUrl" -Value $officeUpdateCDN -PropertyType String -Force -ErrorAction Stop | Out-Null
                       }

                       $currentUpdateSource = $officeUpdateCDN
                   }
                }

                if (!$isAlive) {
                    $channelUpdateSource = Change-UpdatePathToChannel -UpdatePath $currentUpdateSource -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles

                    if ($channelUpdateSource -ne $currentUpdateSource) {
                        $currentUpdateSource = $channelUpdateSource
                    }

                    $isAlive = Test-UpdateSource -UpdateSource $currentUpdateSource -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles
                    if (!($isAlive)) {
                        if ($currentUpdateSource.ToLower() -ne $officeUpdateCDN.ToLower()) {
                            Set-Reg -Hive "HKLM" -keyPath $configRegPath -ValueName "SaveUpdateUrl" -Value $currentUpdateSource -Type String
                        }

                        Write-Host "Unable to use $currentUpdateSource. Will now use $officeUpdateCDN"
                        Write-Log -Message "Unable to use $currentUpdateSource. Will now use $officeUpdateCDN" -severity 1 -component "Office 365 Update Anywhere"

                        if ($GPOUpdateSource) {
                            New-ItemProperty -Path "HKLM:\$GPORegPath" -Name "updatepath" -Value $officeUpdateCDN -PropertyType String -Force -ErrorAction Stop | Out-Null
                        } else {
                            New-ItemProperty -Path "HKLM:\$configRegPath" -Name "UpdateUrl" -Value $officeUpdateCDN -PropertyType String -Force -ErrorAction Stop | Out-Null
                        }

                        $isAlive = Test-UpdateSource -UpdateSource $officeUpdateCDN -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles
                    }
                }

            } else {
                if($currentUpdateSource -ne $null){
                    $channelUpdateSource = Change-UpdatePathToChannel -UpdatePath $currentUpdateSource -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles

                    if ($channelUpdateSource -ne $currentUpdateSource) {
                        $currentUpdateSource= $channelUpdateSource
                    }

                    $isAlive = Test-UpdateSource -UpdateSource $currentUpdateSource -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles

                }else{
                    $isAlive = Test-UpdateSource -UpdateSource $officeUpdateCDN -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles
                    $currentUpdateSource = $officeUpdateCDN;
                }
            }

            if ($isAlive) {
               if (!($scriptPathIsUpdateSource)) {
                   if ($GPOUpdateSource) {
                     $currentUpdateSource = (Get-ItemProperty $GPORegPath -Name updatepath -ErrorAction SilentlyContinue).updatepath
                   } else {
                     $currentUpdateSource = (Get-ItemProperty HKLM:\$configRegPath -Name UpdateUrl -ErrorAction SilentlyContinue).UpdateUrl
                   }
               }

               if($currentUpdateSource.ToLower().StartsWith("http")){
                   $channelUpdateSource = $currentUpdateSource
               }
               else{
                   $channelUpdateSource = Change-UpdatePathToChannel -UpdatePath $currentUpdateSource -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles
               }

               if (($channelUpdateSource -ne $currentUpdateSource) -or $scriptPathIsUpdateSource) {
                   if ($scriptPathIsUpdateSource) {
                       if ($GPOUpdateSource) {
                          New-ItemProperty -Path "HKLM:\$GPORegPath2" -Name "updatepath" -Value $localUpdatePath -PropertyType String -Force -ErrorAction Stop | Out-Null
                       } else {
                          New-ItemProperty -Path "HKLM:\$configRegPath" -Name "UpdateUrl" -Value $localUpdatePath -PropertyType String -Force -ErrorAction Stop | Out-Null
                       }
                       $channelUpdateSource = $localUpdatePath

                       Remove-ItemProperty HKLM:\$configRegPath -Name SaveUpdateUrl -Force -ErrorAction SilentlyContinue
                       $saveUpdateSource = $null
                   } elseif ($GPOUpdateSource) {
                       New-ItemProperty -Path "HKLM:\$GPORegPath2" -Name "updatepath" -Value $channelUpdateSource -PropertyType String -Force -ErrorAction Stop | Out-Null
                       $channelUpdateSource = $channelUpdateSource
                   } else {
                       New-ItemProperty -Path "HKLM:\$configRegPath" -Name "UpdateUrl" -Value $channelUpdateSource -PropertyType String -Force -ErrorAction Stop | Out-Null
                       $channelUpdateSource = $channelUpdateSource
                   }
               }

               Write-Host "Starting Update process"
               Write-Host "Update Source: $channelUpdateSource"
               Write-Log -Message "Will now execute $oc2rcFilePath $oc2rcParams with UpdateSource:$channelUpdateSource" -severity 1 -component "Office 365 Update Anywhere"

               StartProcess -execFilePath $oc2rcFilePath -execParams $oc2rcParams

               if ($WaitForUpdateToFinish) {
                    Wait-ForOfficeCTRUpadate
               }

               $saveUpdateSource = (Get-ItemProperty HKLM:\$configRegPath -Name SaveUpdateUrl -ErrorAction SilentlyContinue).SaveUpdateUrl
               if ($saveUpdateSource) {
                   if ($GPOUpdateSource) {
                       New-ItemProperty -Path "HKLM:\$GPORegPath2" -Name "updatepath" -Value $saveUpdateSource -PropertyType String -Force -ErrorAction Stop | Out-Null
                   } else {
                       New-ItemProperty -Path "HKLM:\$configRegPath" -Name "UpdateUrl" -Value $saveUpdateSource -PropertyType String -Force -ErrorAction Stop | Out-Null
                   }
                   Remove-ItemProperty HKLM:\$configRegPath -Name SaveUpdateUrl -Force -ErrorAction SilentlyContinue
               }

            } else {
               $currentUpdateSource = (Get-ItemProperty HKLM:\$configRegPath -Name UpdateUrl -ErrorAction SilentlyContinue).UpdateUrl
               Write-Host "Update Source '$currentUpdateSource' Unavailable"
               Write-Log -Message "Update Source '$currentUpdateSource' Unavailable" -severity 1 -component "Office 365 Update Anywhere"
            }

       } catch {
           Write-Log -Message $_.Exception.Message -severity 1 -component $LogFileName
           throw;
       }
    }
}

Update-Office365Anywhere -WaitForUpdateToFinish $WaitForUpdateToFinish -EnableUpdateAnywhere $EnableUpdateAnywhere -ForceAppShutdown $ForceAppShutdown -UpdatePromptUser $UpdatePromptUser -DisplayLevel $DisplayLevel -UpdateToVersion $UpdateToVersion -LogPath $LogPath -LogName $LogName -ValidateUpdateSourceFiles $ValidateUpdateSourceFiles -UseScriptLocationAsUpdateSource $UseScriptLocationAsUpdateSource


text:
[![Build Status](https://travis-ci.org/graphology/graphology-communities-louvain.svg)](https://travis-ci.org/graphology/graphology-communities-louvain)

# Graphology Communities Louvain

[Louvain method for community detection](https://arxiv.org/pdf/0803.0476v2.pdf) to be used with [`graphology`](https://graphology.github.io).

## Installation

```
npm install graphology-communities-louvain
```

## Usage

Detect the communities of the given graph using Louvain's method.

```js
import louvain from 'graphology-communities-louvain';

// To retrieve the partition
const communities = louvain(graph);

// To directly assign communities as a node attribute
louvain.assign(graph);

// If you need to customize attributes' names
louvain.assign(graph, {
  attributes: {
    weight: 'myCustomWeight',
    community: 'myCustomCommunity'
  }
});
```

*Arguments*

* **graph** *Graph*: graph to which you want to get the best partitioning.
* **options** *?object*: options:
  * **attributes** *?object*: attributes' names:
    * **weight** *?string* [`weight`]: name of the edges' weight attribute.
    * **community** *?string* [`community`]: name of the node attribute holding community information

redpajama_set_name: RedPajamaGithub


text:
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [3.0.0](https://github.com/webpack-contrib/url-loader/compare/v2.0.0...v3.0.0) (2019-11-26)

### BREAKING CHANGES

* minimum required nodejs version is `10.13.0`
* rename the `esModules` option to `esModule`
* switch to ES modules by default (the option `esModule` is `true` by default)

## [2.3.0](https://github.com/webpack-contrib/url-loader/compare/v2.2.0...v2.3.0) (2019-11-21)

### Features

* new `esModules` option to output ES modules ([0ee2b99](https://github.com/webpack-contrib/url-loader/commit/0ee2b9964f37f4d7c5dd6ea09f8526525e0fab91))

### [2.2.0](https://github.com/webpack-contrib/url-loader/compare/v2.1.0...v2.2.0) (2019-10-04)

### Features

* limit allow using `Infinity` and `Number` ([#192](https://github.com/webpack-contrib/url-loader/issues/192)) ([2bffcfd](https://github.com/webpack-contrib/url-loader/commit/2bffcfd))
* pnp support ([#195](https://github.com/webpack-contrib/url-loader/issues/195)) ([196110e](https://github.com/webpack-contrib/url-loader/commit/196110e))

## [2.1.0](https://github.com/webpack-contrib/url-loader/compare/v2.0.1...v2.1.0) (2019-07-18)

### Features

* improved validation error messages ([#187](https://github.com/webpack-contrib/url-loader/issues/187)) ([f3d4dd2](https://github.com/webpack-contrib/url-loader/commit/f3d4dd2))

### [2.0.1](https://github.com/webpack-contrib/url-loader/compare/v2.0.0...v2.0.1) (2019-06-25)

### Bug Fixes

* allow using limit as string when you use loader with query string ([#185](https://github.com/webpack-contrib/url-loader/issues/185)) ([4842f93](https://github.com/webpack-contrib/url-loader/commit/4842f93))

## [2.0.0](https://github.com/webpack-contrib/url-loader/compare/v1.1.2...v2.0.0) (2019-06-05)

### Bug Fixes

* rm unnecessary `bin` field ([#163](https://github.com/webpack-contrib/url-loader/issues/163)) ([b603665](https://github.com/webpack-contrib/url-loader/commit/b603665))
* `limit` should always be a number and 0 value handles as number ([#180](https://github.com/webpack-contrib/url-loader/issues/180)) ([d82e453](https://github.com/webpack-contrib/url-loader/commit/d82e453))
* fallback loader will be used than limit is equal or greater ([#179](https://github.com/webpack-contrib/url-loader/issues/179)) ([3c24545](https://github.com/webpack-contrib/url-loader/commit/3c24545))

### Features

* limit option can be boolean ([#181](https://github.com/webpack-contrib/url-loader/issues/181)) ([60d2cb3](https://github.com/webpack-contrib/url-loader/commit/60d2cb3))

### BREAKING CHANGES

* minimum required nodejs version is `8.9.0`
* `limit` should always be a number and 0 value handles as number
* fallback loader will be used than limit is equal or greater (before only when greater)

## [1.1.2](https://github.com/webpack-contrib/url-loader/compare/v1.1.0...v1.1.2) (2018-10-10)

### Bug Fixes

* fallback options behaviour ([#145](https://github.com/webpack-contrib/url-loader/issues/145)) ([03e631f](https://github.com/webpack-contrib/url-loader/commit/03e631f))
* **package:** add support for `webpack =< v3.0.0` (`peerDependencies`) ([#150](https://github.com/webpack-contrib/url-loader/issues/150)) ([a6860fc](https://github.com/webpack-contrib/url-loader/commit/a6860fc))
* **package:** relax `node` version range (`engines`) ([#155](https://github.com/webpack-contrib/url-loader/issues/155)) ([d37b108](https://github.com/webpack-contrib/url-loader/commit/d37b108))
* **utils/normalizeFallback:** correctly pass all `options` to the default fallback (`file-loader`) ([#139](https://github.com/webpack-contrib/url-loader/issues/139)) ([401be63](https://github.com/webpack-contrib/url-loader/commit/401be63))

## [1.1.1](https://github.com/webpack-contrib/url-loader/compare/v1.1.0...v1.1.1) (2018-08-17)

### Bug Fixes

* correctly pass all `options` to the fallback ([#143](https://github.com/webpack-contrib/url-loader/issues/143)) ([03e631f](https://github.com/webpack-contrib/url-loader/commit/03e631f))

# [1.1.0](https://github.com/webpack-contrib/url-loader/compare/v1.0.1...v1.1.0) (2018-08-13)

### Features

* support fallback loader in options.fallback ([#123](https://github.com/webpack-contrib/url-loader/issues/123)) ([017adc7](https://github.com/webpack-contrib/url-loader/commit/017adc7)), closes [#118](https://github.com/webpack-contrib/url-loader/issues/118)

## [1.0.1](https://github.com/webpack-contrib/url-loader/compare/v1.0.0...v1.0.1) (2018-03-03)

### Bug Fixes

* **index:** revert to CJS exports (`module.exports`) ([#116](https://github.com/webpack-contrib/url-loader/issues/116)) ([7b60cc2](https://github.com/webpack-contrib/url-loader/commit/7b60cc2))

# [1.0.0](https://github.com/webpack-contrib/url-loader/compare/v1.0.0-beta.0...v1.0.0) (2018-03-03)

### Bug Fixes

* **index:** use `Buffer.from` instead of deprecated `new Buffer` ([#113](https://github.com/webpack-contrib/url-loader/issues/113)) ([457618b](https://github.com/webpack-contrib/url-loader/commit/457618b))

# [1.0.0-beta.0](https://github.com/webpack-contrib/url-loader/compare/v0.6.2...v1.0.0-beta.0) (2017-12-17)

### Code Refactoring

* apply `webpack-defaults` ([#102](https://github.com/webpack-contrib/url-loader/issues/102)) ([073b588](https://github.com/webpack-contrib/url-loader/commit/073b588))

### BREAKING CHANGES

* Sets `engines` to `"node": ">= 6.9.0 || >= 8.9.0"`
* Drops support for `webpack =< v2.0.0`

## [0.6.2](https://github.com/webpack-contrib/url-loader/compare/v0.6.1...v0.6.2) (2017-10-04)

### Bug Fixes

* allow use `limit` as string ([#96](https://github.com/webpack-contrib/url-loader/issues/96)) ([b31684d](https://github.com/webpack-contrib/url-loader/commit/b31684d))

## [0.6.1](https://github.com/webpack-contrib/url-loader/compare/v0.6.0...v0.6.1) (2017-10-04)

### Bug Fixes

* **schema:** allow `additionalProperties` ([#94](https://github.com/webpack-contrib/url-loader/issues/94)) ([2b01ea2](https://github.com/webpack-contrib/url-loader/commit/2b01ea2))

# [0.6.0](https://github.com/webpack-contrib/url-loader/compare/v0.5.9...v0.6.0) (2017-10-03)

### Features

* **index:** add options validation (`schema-utils`) ([#78](https://github.com/webpack-contrib/url-loader/issues/78)) ([ced5990](https://github.com/webpack-contrib/url-loader/commit/ced5990))
* add `fallback` option ([#88](https://github.com/webpack-contrib/url-loader/issues/88)) ([636ebed](https://github.com/webpack-contrib/url-loader/commit/636ebed))

### Security

* Updates Mime pacakge due to Regex DOS security vulnerability ([#87](https://github.com/webpack-contrib/url-loader/issues/87)) ([d19ee2d](https://github.com/webpack-contrib/url-loader/commit/d19ee2d))

 - Reference issue https://nodesecurity.io/advisories/535

## [0.5.9](https://github.com/webpack/url-loader/compare/v0.5.8...v0.5.9) (2017-06-12)

### Bug Fixes

* `String` not being `base64` encoded ([#67](https://github.com/webpack/url-loader/issues/67)) ([e9496b9](https://github.com/webpack/url-loader/commit/e9496b9))
* don't default to `0` (`options.limit`) ([#74](https://github.com/webpack/url-loader/issues/74)) ([020c2a8](https://github.com/webpack/url-loader/commit/020c2a8))

# Change Log

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.


text:
<drawables>
    <!-- Größeres Launcher-Icon mit 40x33 Pixel, wegen BUILD: WARNING: The launcher icon 'LauncherIcon' (32x32) is smaller than the specified launcher icon size of the device 'square_watch' (61x43). Padding will be added to the image to center it. -->
	<!-- BUILD: ERROR: The specified icon is larger (63x43) than the allowed icon size (40x33) for vivoactive_hr_sim -->
    <bitmap id="LauncherIcon" filename="launcher_icon.png" />
</drawables>


text:
:- module(barchart, []).
:- use_module(library(pce)).
:- use_module(library(pce_template)).
:- use_module(plotter).
:- use_module(axis).

:- pce_autoload(partof_hyper, library(hyper)).
:- use_module(library(help_message)).

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
library(library(barchart))

This library defines primitives for handling   various types of (simple)
bar-charts.  The classes defines are:

        # Class bar
        Bar in a bar-chart.  A subclass of class box.

        # Class bar_stack
        Class bar_stack is a subclass of class device, defining a stack
        of bars for visualising an accumulated value.

        # Class bar_group
        Class bar_group is a subclass of bar_stack, defining a group of
        related bars. A typical usage for such bars is showing the
        values of various parameters `last year' and `now'.

        # Class bar_chart
        A subclass of class plotter for showing curves.  It displays
        an X- or Y-axis and a base-line for the bars.  Bars, bar stacks
        or bar-groups can be appended to the chart.

A message and/or drag_message may be associated with a bar, allowing the
user to modify the value of the   bar. While dragging, the current value
is displayed in the axis.

Packages used:

        # library(help_message)
        For showing the current value as a number if the pointer is
        positioned on a bar.

        # library(library(plotter))
        Generic curve plotting device

        # library(library(axis))
        Generic X/Y axis defining coordinate translations

        # library(library(hyper))
        using partof_hyper for dependency relations between bars and
        their labels.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

                 /*******************************
                 *          BAR TEMPLATE        *
                 *******************************/

:- pce_begin_class(bar_template, template,
                   "Common for bar and bar_stack").

unlink(B) :->
    "Delete from <-bars of the chart"::
    (   get(B, device, Chart),
        send(Chart, instance_of, bar_chart),
        get(Chart, bars, Bars),
        send(Bars, delete, B),
        send(Chart, request_compute, place_bars)
    ;   true
    ),
    !,
    send_super(B, unlink).

label(B, Label:bar_label) :<-
    "Find related label"::
    get(B, hypered, label, Label).

center_base(BS, Base:point) :<-
    "Return the location of the center of the base"::
    send(BS, compute),
    (   get(BS, orientation, horizontal)
    ->  get(BS, center_y, Y),
        get(BS, x, X)
    ;   get(BS, center_x, X),
        get(BS, y, Y)
    ),
    new(Base, point(X, Y)).

center_end(BS, End:point) :<-
    "Return the location of the center of the (maximal) end"::
    plotter(BS, Plotter),
    (   get(BS, orientation, horizontal)
    ->  get(BS, center_y, Y),
        get(Plotter, x_axis, XAxis),
        get(XAxis, length, Len),
        get(BS, x, X0),
        X is X0+Len
    ;   get(BS, center_x, X),
        get(Plotter, y_axis, YAxis),
        get(YAxis, length, Len),
        get(BS, y, Y0),
        Y is Y0-Len
    ),
    new(End, point(X, Y)).

:- pce_end_class.

                 /*******************************
                 *    SIMPLE (EDITABLE) BAR     *
                 *******************************/

:- pce_begin_class(bar(name, value), box, "Bar for a bar-chart").
:- use_class_template(bar_template).

class_variable(thickness, '0..', 20, "Default thickness of the bar").
class_variable(pen,       '0..', 0,  "Drawing pen for the bar").

variable(low,           real*,                  get, "Minimum value").
variable(high,          real*,                  get, "Maximum value").
variable(value,         real,                   get, "Value represented").
variable(orientation,   {horizontal,vertical},  get, "laying or standing").
variable(message,       code*,                  both, "Executed after edit").
variable(drag_message,  code*,                  both, "Executed on drags").

initialise(B,
           Name:name=name,
           Value:value=real,
           Colour:colour=[colour|image]*,
           Orientation:orientation=[{horizontal,vertical}]) :->
    default(Value, 0, TheValue),
    default(Colour, @nil, TheColour),
    default(Orientation, vertical, TheOrientation),
    get(B, thickness, W),
    send_super(B, initialise, W, W),
    send(B, name, Name),
    send(B, slot, value, TheValue),
    send(B, slot, orientation, TheOrientation),
    send(B, request_compute),
    send(B, fill_offset, point(0,0)),
    send(B, colour, TheColour).

editable(Bar) :->
    "Test if value can be edited"::
    (   get(Bar, message, Code)
    ;   get(Bar, drag_message, Code)
    ),
    Code \== @nil,
    !.

value(B, Val:real) :->
    send(B, slot, value, Val),
    send(B, request_compute).

orientation(B, O:{horizontal,vertical}) :->
    send(B, slot, orientation, O),
    send(B, request_compute).

thickness(B, W:'0..') :->
    (   get(B, orientation, horizontal)
    ->  send(B, height, W)
    ;   send(B, width, W)
    ).

range(B, Low:low=real*, High:high=real*) :->
    send(B, slot, low, Low),
    send(B, slot, high, High).

colour(B, Colour:'colour|image*') :->
    "Colour of the interior"::
    send(B, fill_pattern, Colour),
    (   Colour == @nil
    ->  send(B, pen, 1)
    ;   send(B, pen, 0)
    ).
colour(B, Colour:'colour|image*') :<-
    "Colour of the interior"::
    get(B, fill_pattern, Colour).

value_format(B, Fmt:name) :<-
    "Format for displaying values"::
    (   plotter(B, Plotter),
        get(Plotter, value_format, Fmt)
    ->  true
    ;   Fmt = '%g'
    ).

plotter(@nil, _) :-
    !,
    fail.
plotter(Plotter, Plotter) :-
    send(Plotter, instance_of, plotter),
    !.
plotter(Gr, Plotter) :-
    get(Gr, device, Dev),
    plotter(Dev, Plotter).

compute(B) :->
    "Update geometry"::
    (   plotter(B, Plotter)
    ->  get(B, value, Value),
        (   get(B, orientation, vertical)
        ->  get(Plotter, member, y, Axis),
            get(Axis, location, Value, YVal),
            get(Axis, location, Axis?low, YVal0),
            H is YVal - YVal0,
            send(B, height, H)
        ;   get(Plotter, member, x, Axis),
            get(Axis, location, Value, XVal),
            get(Axis, location, Axis?low, X0),
            W is XVal - X0,
            send(B, width, W)
        ),
        send_super(B, compute)
%       ignore(send(B, send_hyper, label, update_position))
    ;   true
    ).

:- free(@bar_recogniser).
:- pce_global(@bar_recogniser, new(bar_drag_gesture)).

event(B, Ev:event) :->
    (   send_super(B, event, Ev)
    ;   send(@bar_recogniser, event, Ev)
    ).

help_message(B, What:{tag,summary}, _Ev:[event], Msg:string) :<-
    "Return balloon while pointer is still"::
    What == tag,
    get(B, name, Name),
    get(B, value, Value),
    get(B, value_format, Format),
    atom_concat('%s = ', Format, Fmt),
    get(Name, label_name, Label),
    new(Msg, string(Fmt, Label, Value)).

displayed_cursor(B, Cursor:cursor) :<-
    "Return the cursor to display"::
    send(B, editable),
    (   get(B, orientation, horizontal)
    ->  Name = sb_h_double_arrow
    ;   Name = sb_v_double_arrow
    ),
    new(Cursor, cursor(Name)).

:- pce_end_class.

                 /*******************************
                 *             STACK            *
                 *******************************/

:- pce_begin_class(bar_stack, device, "Stacked bars").
:- use_class_template(bar_template).

variable(orientation, {horizontal,vertical}, get, "Current orientation").

initialise(BS, Name:name, Bars:bar ...) :->
    "Create from multiple bars"::
    send_super(BS, initialise),
    send(BS, name, Name),
    (   get(@pce, version, number, V), V>=50000
    ->  send_list(BS, append, Bars)
    ;   send(Bars, for_all, message(BS, append, @arg1))
    ),
    (   Bars = [FirstBar|_],
        get(FirstBar, orientation, Orientation)
    ->  true
    ;   get(@pce, version, number, V), V<50000,
        get(Bars?head, orientation, Orientation)
    ->  true
    ;   Orientation = vertical
    ),
    send(BS, slot, orientation, Orientation).

orientation(BS, Orientation:{horizontal,vertical}) :->
    "Change the orientation"::
    send(BS, slot, orientation, Orientation),
    send(BS?graphicals, for_all,
         message(@arg1, orientation, Orientation)).

thickness(BS, Thickness:'0..') :->
    "Change the thickness of member bars"::
    send(BS?graphicals, for_all,
         message(@arg1, thickness, Thickness)).

compute(BS) :->
    send(BS, place_bars),
    send_super(BS, compute).
%       ignore(send(BS, send_hyper, label, update_position)).

place_bars(BS) :->
    get_chain(BS, graphicals, Grs),
    place_stacked_bars(Grs, 0).

place_stacked_bars([], _).
place_stacked_bars([B|T], XY) :-
    send(B, compute),
    (   get(B, orientation, vertical),
        SelXY = y, SelWH = height
    ;   SelXY = x, SelWH = width
    ),
    send(B, SelXY, XY),
    get(B, SelWH, WH),
    NewXY is XY + WH,
    place_stacked_bars(T, NewXY).

append(BS, Bar:bar) :->
    "Append a bar"::
    send(BS, display, Bar),
    send(Bar, hide).

device(BS, Dev:device*) :->
    send_super(BS, device, Dev),
    send(BS?graphicals, for_all, message(@arg1, request_compute)).

:- pce_end_class.

                 /*******************************
                 *             GROUP            *
                 *******************************/

:- pce_begin_class(bar_group, bar_stack,
                   "Group of related bars").

place_bars(BS) :->
    plotter(BS, Plotter),
    get(Plotter, bar_width, BW),
    get_chain(BS, graphicals, Grs0),
    reverse(Grs0, Grs),
    length(Grs, N),
    SubBW is 2*BW/(N+1),
    place_grouped_bars(Grs, SubBW, 0).

place_grouped_bars([], _, _).
place_grouped_bars([B|T], BW, XY) :-
    send(B, compute),
    (   get(B, orientation, vertical),
        SelXY = x, SelWH = width
    ;   SelXY = y, SelWH = height
    ),
    send(B, SelXY, XY),
    Skip is BW/2,
    send(B, SelWH, BW),
    NewXY is XY + Skip,
    place_grouped_bars(T, BW, NewXY).

:- pce_end_class.

                 /*******************************
                 *             LABEL            *
                 *******************************/

:- pce_begin_class(bar_button_group, dialog_group,
                   "Set of buttons for controlling the bar").

initialise(BBG, Bar:'bar|bar_stack', Buttons:graphical ...) :->
    send_super(BBG, initialise, @default, group),
    send(BBG, gap, size(0,0)),
    send_list(BBG, append, Buttons),
    send(BBG, layout_dialog),
    new(_, partof_hyper(Bar, BBG, controller, bar)),
    send(BBG, update_position),
    send(Bar?device, display, BBG).

bar(BL, Bar:'bar|bar_stack') :<-
    "Get bar I'm related too"::
    get(BL, hypered, bar, Bar).

update_position(BBG) :->
    "Place myself at the end of the bar"::
    get(BBG, bar, Bar),
    get(Bar, center_end, point(X, Y)),
    (   get(Bar, orientation, horizontal)
    ->  send(BBG, set, X+10),
        send(BBG, center_y, Y)
    ;   send(BBG, set, @default, Y-10-BBG?height),
        send(BBG, center_x, X)
    ).

:- pce_end_class.

:- pce_begin_class(bar_label, device,
                   "Label attached to a bar").

variable(text, text, get, "Represented text object").

initialise(BL, Bar:'bar|bar_stack|graphical') :->
    send_super(BL, initialise),
    new(_, partof_hyper(Bar, BL, label, bar)),
    new(T, text(Bar?name?label_name)),
    send(BL, slot, text, T),
    send(BL, update_label),
    get(Bar, center_base, Pos),
    send(BL, position, Pos),
    send(Bar?device, display, BL).

update_label(BL) :->
    send(BL, clear),
    get(BL, text, T),
    get(BL, bar, Bar),
    (   get(Bar, orientation, horizontal),
        send(T, alignment, right),
        send(T, center_y, 0),
        get(T, width, TW),
        TX is -TW - 5,
        send(T, x, TX),
        send(BL, display, T)
    ;   new(I, image(@nil, T?width, T?height)),
        send(I, hot_spot, point(T?width+5, T?height/2)),
        send(I, draw_in, T),
        get(I, rotate, 90, I2),     % 60?
        free(I),
        get(I2, hot_spot, point(HX, HY)),
        new(BM, bitmap(I2)),
        send(BM, transparent, @on),
        send(BL, display, BM, point(-HX, -HY))
    ).

font(BL, Font:font) :->
    "Change font of the label"::
    get(BL, text, T),
    send(T, font, Font),
    send(BL, update_label).

bar(BL, Bar:'bar|bar_stack') :<-
    "Get bar I'm related too"::
    get(BL, hypered, bar, Bar).

update_position(BL) :->
    get(BL, hypered, bar, Bar),
    get(Bar, center_base, CB),
    send(BL, position, CB).

:- pce_global(@bar_label_recogniser,
              new(handler_group(click_gesture(left, '', single,
                                              message(@receiver?device,
                                                      select,
                                                      @receiver?bar)),
                                click_gesture(left, c, single,
                                              message(@receiver?device,
                                                      select,
                                                      @receiver?bar,
                                                      toggle))))).

event(BL, Ev:event) :->
    "Allow (de)select"::
    (   send_super(BL, event, Ev)
    ;   send(@bar_label_recogniser, event, Ev)
    ).

:- pce_end_class.

                 /*******************************
                 *          BAR EDITING         *
                 *******************************/

:- pce_begin_class(bar_drag_gesture, gesture, "Drag a bar lower/higher").

variable(feedback,      plot_ruler,     get, "Box shown for feedback").

initialise(G) :->
    send_super(G, initialise, left, ''),
    send(G, slot, feedback, new(plot_ruler)).

verify(_, Ev:event) :->
    get(Ev, receiver, Bar),
    send(Bar, editable).

initiate(G, Ev:event) :->
    get(Ev, receiver, Bar),
    get(G, feedback, FB),
    plotter(Bar, Plotter),
    get(Bar, absolute_position, Plotter, point(BX, BY)),
    (   get(Bar, orientation, horizontal)
    ->  get(Plotter, x_axis, Axis),
        get(Axis, y, Y),
        Len is Y-BY
    ;   get(Plotter, y_axis, Axis),
        get(Axis, x, X),
        get(Bar, width, BW),
        Len is BX+BW-X
    ),
    send(FB, attach, Axis, Bar?value, Len+5),
    send(G, drag, Ev).

drag(G, Ev:event) :->
    get(Ev, receiver, Bar),
    send(G, update_value, Ev),
    (   get(Bar, drag_message, Msg),
        Msg \== @nil
    ->  get(G, feedback, FB),
        get(FB, value, NewVal),
        send(Bar, value, NewVal),
        send(Msg, forward, NewVal)
    ).

update_value(G, Ev:event) :->
    get(Ev, receiver, Bar),
    plotter(Bar, Plotter),
    get(Bar, absolute_position, Plotter, point(BX, BY)),
    (   get(Bar, orientation, horizontal)
    ->  get(Ev, x, Plotter, PointsVal),
        get(Plotter, value_from_x, BX,        BarV0),
        get(Plotter, value_from_x, PointsVal, NewVal0)
    ;   get(Ev, y, Plotter, PointsVal),
        get(Plotter, value_from_y, BY,        BarV0),
        get(Plotter, value_from_y, PointsVal, NewVal0)
    ),
    get(Plotter, low, Low),
    get(Plotter, high, High),
    bounds(NewVal0-BarV0, Low, High, NewVal),
    get(G, feedback, FB),
    send(FB, value, NewVal).

bounds(Val0, Min, Max, Val) :-
    Val is min(max(Val0, Min), Max).

terminate(G, Ev:event) :->
    get(Ev, receiver, Bar),
    get(G, feedback, FB),
    get(FB, value, NewVal),
    send(FB, detach),
    send(Bar, value, NewVal),
    (   get(Bar, message, Msg),
        Msg \== @nil
    ->  send(Msg, forward, NewVal)
    ;   true
    ).

:- pce_end_class.

                 /*******************************
                 *           BAR-CHART          *
                 *******************************/

:- pce_begin_class(bar_chart, plotter,
                   "Display a bar-chart").

variable(orientation, {horizontal,vertical}, get, "Orientation of the bars").
variable(bar_width,   '1..',                 get, "Width of the bars").
variable(bar_gap,     int,                   get, "Distance between bars").
variable(low,         real,                  get, "Lowest value").
variable(high,        real,                  get, "Highest value").
variable(bars,        chain,                 get, "List of bars").
variable(show_labels, bool := @on,           get, "Show labels on the bars").
variable(value_format,name,                  both,"Format displayed values").

initialise(BC,
           Orientation:orientation={horizontal,vertical},
           Low:low=real, High:high=real, ScaleLength:'scale_length=[0..]',
           NBars:'nbars=[0..]',
           BarWidth:'bar_width=[0..]',
           BarGap:'bar_gap=[0..]') :->
    default(ScaleLength, 200, SL),
    default(NBars, 5, NB),
    default(BarWidth, 20, BW),
    default(BarGap, 10, BG),
    send_super(BC, initialise),
    send(BC, slot, orientation, Orientation),
    send(BC, slot, bars, new(chain)),
    send(BC, slot, bar_width, BW),
    send(BC, slot, bar_gap, BG),
    send(BC, slot, low, Low),
    send(BC, slot, high, High),
    determine_format(Low, High, Fmt),
    send(BC, slot, value_format, Fmt),
    BL is NB * (BW+BG) + BG,
    (   Orientation == vertical
    ->  send(BC, axis,
             plot_axis(y, Low, High, @default, SL, point(0, SL))),
        send(BC, display, new(L, line(0, SL, BL, SL)))
    ;   send(BC, axis,
             plot_axis(x, Low, High, @default, SL, point(0, 0))),
        send(BC, display, new(L, line(0, -BL, 0, 0)))
    ),
    send(L, name, bar_base).

determine_format(Low, High, '%d') :-
    Low  =:= integer(Low),
    High =:= integer(High),
    High - Low > 10.
determine_format(Low, High, Format) :-
    Digits is 2-round(log10(High-Low)),
    Digits > 0,
    atomic_list_concat(['%.', Digits, f], Format).
determine_format(_, _, '%g').

:- pce_group(layout).

nbars(BC, NBars:[int]) :->
    "Adjust length of the bar_base line"::
    (   NBars == @default
    ->  get(BC?bars, size, NB)
    ;   NB = NBars
    ),
    get(BC, bar_width, BW),
    get(BC, bar_gap, BG),
    BL is NB * (BW+BG) + BG,
    get(BC, member, bar_base, L),   % the base-line
    (   get(BC, orientation, vertical)
    ->  send(L, end_x, BL)
    ;   send(L, start_y, -BL)
    ),
    (   get(BC, x_axis, Xaxis)
    ->  send(Xaxis, request_compute)
    ;   true
    ),
    (   get(BC, y_axis, Yaxis)
    ->  send(Yaxis, request_compute)
    ;   true
    ).

pixel_range(BC, Dir:{x,y}, Range:tuple) :<-
    (   get_super(BC, pixel_range, Dir, Range)
    ->  true
    ;   get(BC, member, bar_base, Line),
        (   Dir == x
        ->  get(Line, start_x, Min),
            get(Line, end_x, Max)
        ;   get(Line, start_y, Min),
            get(Line, end_y, Max)
        ),
        new(Range, tuple(Min, Max))
    ).

:- pce_group(contents).

append(BC, Bar:'bar|bar_stack') :->
    "Append a bar to the chart"::
    get(BC, orientation, Orientation),
    send(Bar, orientation, Orientation),
    get(BC, bars, Bars),
    send(Bars, append, Bar),
    get(Bars, size, NBars),
    get(BC, bar_width, BW),
    get(BC, bar_gap, BG),
    get(BC, member, bar_base, BaseLine),
    (   Orientation == vertical
    ->  get(BaseLine, y, BarY),
        get(BC, y_axis, YAxis),
        get(YAxis, x, X0),
        BarX is X0+(NBars-1)*BW + NBars*BG
    ;   get(BaseLine, x, BarX),
        get(BC, x_axis, XAxis),
        get(XAxis, y, Y0),
        BarY is Y0-NBars*BW - NBars*BG
    ),
    send(Bar, thickness, BW),
    send(BC, display, Bar, point(BarX, BarY)),
    (   get(BC, show_labels, @on)
    ->  new(_, bar_label(Bar))
    ;   true
    ).

delete(BC, Bar:'member:bar|bar_stack') :->
    "Delete (named) bar of bar-stack"::
    free(Bar),
    send(BC, request_compute, place_bars).

compute(BC) :->
    "Restore the placement of the bars"::
    (   get(BC, request_compute, place_bars)
    ->  send(BC, place_bars)
    ;   true
    ),
    send_super(BC, compute).

place_bars(BC) :->
    "Restore the placing of the bars after a delete/insert/reorder"::
    get(BC, bars, Bars),
    get(Bars, size, Size),
    get(BC, bar_width, BW),
    get(BC, bar_gap, BG),
    (   get(BC, orientation, vertical)
    ->  (   get(BC, y_axis, YAxis),
            get(YAxis, x, X0),
            between(1, Size, N),
            get(Bars, nth1, N, Bar),
            BarX is X0+(N-1)*BW + N*BG,
            send(Bar, x, BarX),
            fail
        ;   true
        )
    ;   (   get(BC, x_axis, XAxis),
            get(XAxis, y, Y0),
            between(1, Size, N),
            get(Bars, nth1, N, Bar),
            BarY is Y0-N*BW - N*BG,
            send(Bar, y, BarY),
            fail
        ;   true
        )
    ),
    send(BC?graphicals, for_all,
         if(message(@arg1, has_send_method, update_position),
            message(@arg1, update_position))).

clear(BC) :->
    "Remove all bars"::
    get(BC, bars, Bars),
    send(Bars, for_all, message(@arg1, destroy)),
    send(Bars, clear).

modified_plot_axis(P, A:[plot_axis]) :->
    send_super(P, modified_plot_axis, A),
    send(P, expose_member, bar_base).

sort(BC) :->
    "Sort bars by value"::
    (   get(BC, orientation, horizontal)
    ->  send(BC?bars, sort, ?(@arg1?value, compare, @arg2?value))
    ;   send(BC?bars, sort, ?(@arg2?value, compare, @arg1?value))
    ),
    send(BC, place_bars).

:- pce_group(value).

value(BC, BarName:name, Value:real) :->
    "Set value of the named bar"::
    get(BC, member, BarName, Bar),
    send(Bar, value, Value).
value(BC, BarName:name, Value:real) :<-
    "Get value of the named bar"::
    get(BC, member, BarName, Bar),
    get(Bar, value, Value).

:- pce_group(event).

:- pce_global(@bar_chart_recogniser,
              new(click_gesture(left, '', single,
                                message(@receiver, selection, @nil)))).

event(BC, Ev:event) :->
    (   send_super(BC, event, Ev)
    ;   send(@bar_chart_recogniser, event, Ev)
    ).

:- pce_group(selection).

select(BC, What:'bar|bar_stack', How:[{toggle,set}]) :->
    "Modify selection (invokes ->selection)"::
    (   How == toggle,
        get(BC, selection, Chain)
    ->  (   send(Chain, delete, What)
        ->  true
        ;   send(Chain, append, What)
        ),
        send(BC, selection, Chain)
    ;   send(BC, selection, What)
    ).

selection(BC, Bars:chain) :<-
    "Get selected bars/bar stacks"::
    get(BC, get_super, selection, Labels),
    get(Labels, map, @arg1?bar, Bars).
selection(BC, Bars:'bar|bar_stack|chain*') :->
    "Set selected bars/bar stacks"::
    (   Bars == @nil
    ->  send_super(BC, selection, @nil)
    ;   send(Bars, instance_of, chain)
    ->  get(Bars, map, @arg1?label, Labels),
        send_super(BC, selection, Labels)
    ;   get(Bars, label, Label),
        send_super(BC, selection, Label)
    ).

:- pce_end_class.


text:
ActiveRecord::Schema.define(version: 20150131025859) do

  create_table "boards", force: :cascade do |t|
    t.integer "size"
    t.integer "max_ships"
    t.integer "alive_ships"
    t.integer "game_id"
    t.integer "user_id"
  end

  add_index "boards", ["game_id"], name: "index_boards_on_game_id"
  add_index "boards", ["user_id"], name: "index_boards_on_user_id"

  create_table "games", force: :cascade do |t|
    t.integer "user_id"
    t.integer "board_1_id"
    t.integer "board_2_id"
    t.integer "player_2_id"
    t.boolean "started"
    t.boolean "finished"
    t.integer "id_turno"
  end

  add_index "games", ["user_id"], name: "index_games_on_user_id"

  create_table "plays", force: :cascade do |t|
    t.integer "coorX"
    t.integer "coorY"
    t.integer "user_id"
    t.boolean "valid_play"
    t.integer "board_id"
  end

  create_table "ships", force: :cascade do |t|
    t.boolean "state"
    t.integer "coorX"
    t.integer "coorY"
    t.integer "board_id"
  end

  add_index "ships", ["board_id"], name: "index_ships_on_board_id"

  create_table "users", force: :cascade do |t|
    t.string "full_name"
    t.string "username"
    t.string "password"
  end

end


text:
'use strict';

var util = require('./util.js');

module.exports = function(client){
	var database = {};

	/**
	 * Expose Discogs database status constants
	 */

	database.status = { accepted: 'Accepted', draft: 'Draft', deleted: 'Deleted', rejected: 'Rejected' };

	/**
	 * Get artist data
	 * @param {(number|string)} artist - The Discogs artist ID
	 * @param {object} [options] - Show releases by the artist + paging params
	 * @param {function} [callback] - Callback function
	 */

	database.artist = function(artist, callback){
		client.get('/artists/'+artist, callback);
	};

	/**
	 * Get artist release data
	 * @param {(number|string)} artist - The Discogs artist ID
	 * @param {object} [params] - Paging params
	 * @param {function} [callback] - Callback function
	 */
	database.artistReleases = function(artist, params, callback){
		var path = '/artists/'+artist+'/releases';
		if((arguments.length === 2) && (typeof params === 'function')){
			callback = params;
		}else{
			path = util.addParams(path, params);
		}
		client.get(path, callback);
	};

	/**
	 * Get release data
	 * @param {(number|string)} release - The Discogs release ID
	 * @param {function} [callback] - Callback function
	 */

	database.release = function(release, callback){
		client.get('/releases/'+release, callback);
	};

	/**
	 * Get master release data
	 * @param {(number|string)} master - The Discogs master release ID
	 * @param {function} [callback] - Callback function
	 */

	database.master = function(master, callback){
		client.get('/masters/'+master, callback);
	};

	/**
	 * Get the release versions contained in the given master release
	 * @param {(number|string)} master - The Discogs master release ID
	 * @param {object} [params] - Paging params
	 * @param {function} [callback] - Callback function
	 */

	database.masterVersions = function(master, params, callback){
		var path = '/masters/'+master+'/versions';
		if((arguments.length === 2) && (typeof params === 'function')){
			callback = params;
		}else{
			path = util.addParams(path, params);
		}
		client.get(path, callback);
	};

	/**
	 * Get label data
	 * @param {(number|string)} label - The Discogs label ID
	 * @param {function} [callback] - Callback function
	 */

	database.label = function(label, callback){
		client.get('/labels/'+label, callback);
	};

	/**
	 * Get label release data
	 * @param {(number|string)} label - The Discogs label ID
	 * @param {object} [params] - Paging params
	 * @param {function} [callback] - Callback function
	 */

	database.labelReleases = function(label, params, callback){
		var path = '/labels/'+label+'/releases';
		if((arguments.length === 2) && (typeof params === 'function')){
			callback = params;
		}else{
			path = util.addParams(path, params);
		}
		client.get(path, callback);
	};

	/**
	 * Get an image
	 * @param {string} url - The full image url
	 * @param {function} [callback] - Callback function
	 */

	database.image = function(url, callback){
		client.get({url: url, encoding: 'binary', queue: false, json: false}, callback);
	};

	/**
	 * Search the database
	 * @param {string} query - The search query
	 * @param {object} [params] - Search parameters as defined on http://www.discogs.com/developers/#page:database,header:database-search
	 * @param {function} [callback] - Callback function
	 */

	database.search = function(query, params, callback){
		var obj = {};
		if(arguments.length <= 2){
			if(typeof params === 'function'){ callback = params; } // No extra search params, the callback is the second function param
		}else{
			obj = params;
		}
		if(query){ obj.q = query; }
		client.get({url: util.addParams('/database/search', obj), authLevel: 1}, callback);
	};

	return database;
};


text:
import React from 'react'
import ReactDOM from 'react-dom'

import Header from 'Components/Header'

ReactDOM.render(<Header />, document.querySelector('#app'))


text:
class OSMLayer : public MercatorTiledLayer {
private:

  static const std::vector<std::string> getSubdomains() {
    std::vector<std::string> result;
    result.push_back("a.");
    result.push_back("b.");
    result.push_back("c.");
    return result;
  }

protected:
  std::string getLayerType() const {
    return "OSM";
  }

  bool rawIsEquals(const Layer* that) const;

public:
  OSMLayer(const TimeInterval& timeToCache,
           const bool          readExpired  = true,
           const int           initialLevel = 2,
           const float         transparency = 1,
           LayerCondition*     condition    = NULL,
           std::vector<const Info*>*  layerInfo = new std::vector<const Info*>()) :
  MercatorTiledLayer("http://",
                     "tile.openstreetmap.org",
                     getSubdomains(),
                     "png",
                     timeToCache,
                     readExpired,
                     initialLevel,
                     18,
                     false, // isTransparent
                     transparency,
                     condition,
                     layerInfo)
  {
  }

  const std::string description() const;

  OSMLayer* copy() const;

  RenderState getRenderState();

};

#endif


text:
import Node from '../Node';

export default class SpreadProperty extends Node {
    constructor(childNodes) {
        super('SpreadProperty', childNodes);
    }

    _acceptChildren(children) {
        let argument;

        children.passToken('Punctuator', '...');
        children.skipNonCode();
        argument = children.passExpression();
        children.assertEnd();

        this.argument = argument;
    }
}


text:
namespace JsonBox {
	IndentCanceller::IndentCanceller() : afterBackSlash(false), inString(false) {
	}

	std::streambuf::int_type IndentCanceller::operator()(std::streambuf &destination,
	                                                     std::streambuf::int_type character) {
		std::streambuf::char_type tmpChar = std::streambuf::traits_type::to_char_type(character);

		// If we encounter a quotation mark.
		if (tmpChar == Structural::BEGIN_END_STRING) {
			// If we're not in a string, we change that. If we're in a string,
			// we change that only if we're not after an escape back slash.
			inString = !inString || (afterBackSlash);
		}

		// We determine if we start a backslash escape or not.
		afterBackSlash = inString && !afterBackSlash && (tmpChar == Strings::Json::Escape::BEGIN_ESCAPE);

		return (tmpChar != Whitespace::NEW_LINE && tmpChar != Whitespace::HORIZONTAL_TAB && tmpChar != Whitespace::CARRIAGE_RETURN && (inString || tmpChar != Whitespace::SPACE)) ? (destination.sputc(tmpChar)) : (0);
	}
}


text:
namespace Merchello.Examine.Providers
{
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Xml.Linq;
    using Core.Models;
    using global::Examine;
    using global::Examine.LuceneEngine;
    using global::Examine.LuceneEngine.Config;

    /// <summary>
    /// The invoice indexer.
    /// </summary>
    public class InvoiceIndexer : BaseMerchelloIndexer
    {
        /// <summary>
        /// The index field policies.
        /// </summary>
        internal static readonly List<StaticField> IndexFieldPolicies = new List<StaticField>()
            {
                new StaticField("invoiceKey", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("customerKey", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("invoiceNumberPrefix", FieldIndexTypes.NOT_ANALYZED, true, string.Empty),
                new StaticField("invoiceNumber", FieldIndexTypes.ANALYZED, true, string.Empty),
                new StaticField("prefixedInvoiceNumber", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("invoiceDate", FieldIndexTypes.ANALYZED, true, "DATETIME"),
                new StaticField("invoiceStatusKey", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("versionKey", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("billToName", FieldIndexTypes.ANALYZED, true, string.Empty),
                new StaticField("billToAddress1", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("billToAddress2", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("billToLocality", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("billToRegion", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("billToPostalCode", FieldIndexTypes.ANALYZED, true, string.Empty),
                new StaticField("billToCountryCode", FieldIndexTypes.ANALYZED, true, string.Empty),
                new StaticField("billToEmail", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("billToPhone", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("billToCompany", FieldIndexTypes.ANALYZED, true, string.Empty),
                new StaticField("currencyCode", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("poNumber", FieldIndexTypes.ANALYZED, true, string.Empty),
                new StaticField("notes", FieldIndexTypes.ANALYZED, true, string.Empty),
                new StaticField("exported", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("archived", FieldIndexTypes.ANALYZED, false, string.Empty),
                new StaticField("total", FieldIndexTypes.ANALYZED, true, "DOUBLE"),
                new StaticField("invoiceStatus", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("invoiceItems", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("currency", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
                new StaticField("createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
                new StaticField("updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
                new StaticField("allDocs", FieldIndexTypes.ANALYZED, false, string.Empty)
            };

        /// <summary>
        /// Gets the supported types.
        /// </summary>
        protected override IEnumerable<string> SupportedTypes
        {
            get { return new[] { IndexTypes.Invoice }; }
        }

        /// <summary>
        /// Rebuilds the invoice index
        /// </summary>
        public override void RebuildIndex()
        {
            DataService.LogService.AddVerboseLog(-1, "Rebuilding the invoice index");

            EnsureIndex(true);

            PerformIndexAll(IndexTypes.Invoice);
        }

        /// <summary>
        /// Adds the invoice to the index
        /// </summary>
        /// <param name="invoice">The <see cref="IInvoice"/> to be indexed</param>
        /// <remarks>For testing</remarks>
        internal void AddInvoiceToIndex(IInvoice invoice)
        {
            var nodes = new List<XElement> {invoice.SerializeToXml().Root};
            AddNodesToIndex(nodes, IndexTypes.Invoice);
        }

        /// <summary>
        /// Removes the invoice from the index
        /// </summary>
        /// <param name="invoice">The <see cref="IInvoice"/> to be removed from the index</param>
        /// <remarks>For testing</remarks>
        internal void DeleteInvoiceFromIndex(IInvoice invoice)
        {
            DeleteFromIndex(((Invoice)invoice).ExamineId.ToString(CultureInfo.InvariantCulture));
        }

        /// <summary>
        /// The perform index all.
        /// </summary>
        /// <param name="type">
        /// The type.
        /// </param>
        protected override void PerformIndexAll(string type)
        {
            if (!SupportedTypes.Contains(type)) return;

            var invoices = DataService.InvoiceDataService.GetAll();
            var invoicesArray = invoices as IInvoice[] ?? invoices.ToArray();

            if (!invoicesArray.Any()) return;
            var nodes = invoicesArray.Select(i => i.SerializeToXml().Root).ToList();

            AddNodesToIndex(nodes, IndexTypes.Invoice);
        }

        /// <summary>
        /// Creates an IIndexCriteria object based on the indexSet passed in and our DataService
        /// </summary>
        /// <param name="indexSet">
        /// The index Set.
        /// </param>
        /// <remarks>
        /// If we cannot initialize we will pass back empty indexer data since we cannot read from the database
        /// </remarks>
        /// <returns>
        /// The <see cref="IIndexCriteria"/>.
        /// </returns>
        protected override IIndexCriteria GetIndexerData(IndexSet indexSet)
        {
            return indexSet.ToIndexCriteria(DataService.InvoiceDataService.GetIndexFieldNames(), IndexFieldPolicies);
        }

        /// <summary>
        /// return the index policy for the field name passed in, if not found, return normal
        /// </summary>
        /// <param name="fieldName">
        /// The field Name.
        /// </param>
        /// <returns>
        /// The <see cref="FieldIndexTypes"/>.
        /// </returns>
        protected override FieldIndexTypes GetPolicy(string fieldName)
        {
            var def = IndexFieldPolicies.Where(x => x.Name == fieldName).ToArray();
            return def.Any() == false ? FieldIndexTypes.ANALYZED : def.Single().IndexType;
        }
    }
}


text:
using System;
using System.Diagnostics;
using System.Linq;
using org.pescuma.progressmonitor.utils;

namespace org.pescuma.progressmonitor.devel
{
    public class ComputeRelativeTimesProgressMonitor : ProgressMonitor
    {
        private readonly ProgressMonitor next;
        private readonly Action<string> writer;
        private Step[] steps;
        private int currentStep = -1;
        private DateTime start;

        public ComputeRelativeTimesProgressMonitor(ProgressMonitor next, Action<string> writer = null)
        {
            if (writer == null)
                writer = s => Debug.WriteLine(s);

            this.next = next;
            this.writer = writer;
        }

        public IDisposable ConfigureSteps(params int[] aSteps)
        {
            steps = new Step[aSteps.Length == 1 ? aSteps[0] : aSteps.Length];

            next.ConfigureSteps(aSteps);

            return new ActionDisposable(() =>
            {
                if (currentStep >= 0 && currentStep < steps.Length)
                    Finished();
            });
        }

        public void StartStep(string stepName = null, params object[] args)
        {
            if (currentStep >= 0)
                OnFinishedStep();

            next.StartStep(stepName, args);

            currentStep++;
            steps[currentStep]
                    .Name = Utils.Format(stepName ?? "", args);
            start = DateTime.Now;
        }

        public ProgressMonitor CreateSubMonitor()
        {
            return next.CreateSubMonitor();
        }

        public void Finished()
        {
            OnFinishedStep();

            next.Finished();

            DumpTimes();

            currentStep++;
        }

        private void OnFinishedStep()
        {
            steps[currentStep]
                    .Size = (int) Math.Round((DateTime.Now - start).TotalMilliseconds);
        }

        private void DumpTimes()
        {
            var max = steps.Select(s => s.Size)
                           .Aggregate(Math.Max);
            var factor = 100.0 / max;

            for (int i = 0; i < steps.Length; i++)
                steps[i]
                        .Size = (int) Math.Max(Math.Round(steps[i]
                                                                  .Size
                                                          * factor), 1);

            var gcd = steps.Select(s => s.Size)
                           .Aggregate(Utils.GetGCD);

            for (int i = 0; i < steps.Length; i++)
                steps[i]
                                .Size = steps[i]
                                                .Size
                                        / gcd;

            writer(string.Join("\n", steps.Select((s, i) => string.Format("Step {0} - {1} : {2}", i, s.Name, s.Size))));
        }

        public void Report(string message, params object[] args)
        {
            next.Report(message, args);
        }

        public void ReportDetail(string message, params object[] args)
        {
            next.ReportDetail(message, args);
        }

        public void ReportWarning(string message, params object[] args)
        {
            next.ReportWarning(message, args);
        }

        public void ReportError(string message, params object[] args)
        {
            next.ReportError(message, args);
        }

        public bool WasCanceled
        {
            get { return next.WasCanceled; }
        }

        private struct Step
        {
            public int Size;
            public string Name;
        }
    }
}


text:
package com.palantir.atlasdb.schema;

import com.palantir.atlasdb.AtlasDbConstants;
import com.palantir.atlasdb.keyvalue.api.KeyValueService;
import com.palantir.atlasdb.keyvalue.api.TableReference;
import com.palantir.atlasdb.schema.KeyValueServiceMigrator.KvsMigrationMessageLevel;
import com.palantir.atlasdb.schema.KeyValueServiceMigrator.KvsMigrationMessageProcessor;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashSet;
import java.util.Set;

public final class KeyValueServiceMigratorUtils {

    public static final String CHECKPOINT_TABLE_NAME = "tmp_migrate_progress";

    private KeyValueServiceMigratorUtils() {
        // Utility class
    }

    /**
     * Tables that are eligible for migration. Non-transactional tables and potential old checkpoint tables cannot be
     * migrated since the migrator reads and writes data transactionally, and migrating a checkpoint table would
     * interfere with the migration. We still want to drop and recreate these tables to enable manual migration.
     */
    public static Set<TableReference> getMigratableTableNames(
            KeyValueService kvs, Set<TableReference> skipTables, TableReference checkpointTable) {
        Set<TableReference> tableNames = getCreatableTables(kvs, skipTables);
        tableNames.removeAll(TargetedSweepSchema.INSTANCE
                .getLatestSchema()
                .getTableDefinitions()
                .keySet());
        tableNames.removeAll(AtlasDbConstants.HIDDEN_TABLES);
        tableNames.removeIf(tableRef -> tableRef.equals(checkpointTable));
        return tableNames;
    }

    /**
     * We must not drop and recreate atomic tables or any of the tables that should specifically be skipped. This is
     * because large internal product uses a {@link com.palantir.atlasdb.keyvalue.impl.TableSplittingKeyValueService}
     * that delegates all interactions with these tables to the source KVS as the target KVS, so dropping them would
     * cause us to drop them in the source KVS.
     */
    public static Set<TableReference> getCreatableTables(KeyValueService kvs, Set<TableReference> skipTables) {
        Set<TableReference> tableNames = new HashSet<>(kvs.getAllTableNames());
        tableNames.removeAll(AtlasDbConstants.ATOMIC_TABLES);
        tableNames.removeAll(skipTables);
        return tableNames;
    }

    public static void processMessage(
            KvsMigrationMessageProcessor messageProcessor, String string, KvsMigrationMessageLevel level) {
        messageProcessor.processMessage(string, level);
    }

    public static void processMessage(
            KvsMigrationMessageProcessor messageProcessor,
            String string,
            Throwable ex,
            KvsMigrationMessageLevel level) {
        String outputString = getThrowableMessage(string, ex);
        processMessage(messageProcessor, outputString, level);
    }

    private static String getThrowableMessage(String string, Throwable ex) {
        Writer result = new StringWriter();
        PrintWriter writer = new PrintWriter(result);
        ex.printStackTrace(writer); // (authorized)
        return string + "\n" + result.toString();
    }
}


text:
module Banregio
  class APIClient
    attr_reader :access_token

    include HTTParty
    base_uri Banregio.base_uri
    headers "Content-Type" => "application/json"
    headers "Accept" => "application/vnd.banregio-v0.0.beta1+json"

    include BankAccount
    include Transaction

    def initialize(access_token)
      @access_token = access_token
      self.class.headers "Authorization" => "Bearer #{access_token}"
    end

  end
end


text:
This are the empty textures you can use in your models in case you don't have
a detailmap for example.

See the wiki for further information.


text:
'use strict';

const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');

// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath;
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
const shouldUseRelativeAssetPaths = publicPath === './';
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);

// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env.stringified['process.env'].NODE_ENV !== '"production"') {
  throw new Error('Production builds must have NODE_ENV=production.');
}

// Note: defined here because it will be used more than once.
const cssFilename = 'css/index.css';

// ExtractTextPlugin expects the build output to be flat.
// (See https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/27)
// However, our output is structured with css, js and media folders.
// To have this structure working with relative paths, we have to use custom options.
const extractTextPluginOptions = shouldUseRelativeAssetPaths
  ? // Making sure that the publicPath goes back to to build folder.
    { publicPath: Array(cssFilename.split('/').length).join('../') }
  : {};

// This is the production configuration.
// It compiles slowly and is focused on producing a fast and minimal bundle.
// The development configuration is different and lives in a separate file.
module.exports = {
  // Don't attempt to continue if there are any errors.
  bail: true,
  // We generate sourcemaps in production. This is slow but gives good results.
  // You can exclude the *.map files from the build during deployment.
  devtool: shouldUseSourceMap ? 'source-map' : false,
  // In production, we only want to load the polyfills and the app code.
  entry: [require.resolve('./polyfills'), paths.appLibIndexJs], // CRL: library index file instead of app index
  output: {
    // CRL: Updated whole block with library specific info
    path: paths.appBuild,
    filename: 'index.js',
    libraryTarget: 'umd'
  },
  resolve: {
    // This allows you to set a fallback for where Webpack should look for modules.
    // We placed these paths second because we want `node_modules` to "win"
    // if there are any conflicts. This matches Node resolution mechanism.
    // https://github.com/facebookincubator/create-react-app/issues/253
    modules: ['node_modules', paths.appNodeModules].concat(
      // It is guaranteed to exist because we tweak it in `env.js`
      process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
    ),
    // These are the reasonable defaults supported by the Node ecosystem.
    // We also include JSX as a common component filename extension to support
    // some tools, although we do not recommend using it, see:
    // https://github.com/facebookincubator/create-react-app/issues/290
    // `web` extension prefixes have been added for better support
    // for React Native Web.
    extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
    alias: {

      // Support React Native Web
      // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
      'react-native': 'react-native-web',
    },
    plugins: [
      // Prevents users from importing files from outside of src/ (or node_modules/).
      // This often causes confusion because we only process files within src/ with babel.
      // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
      // please link the files into your node_modules/ and let module-resolution kick in.
      // Make sure your source files are compiled, as they will not be processed in any way.
      new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
    ],
  },
  module: {
    strictExportPresence: true,
    rules: [
      // TODO: Disable require.ensure as it's not a standard language feature.
      // We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176.
      // { parser: { requireEnsure: false } },

      // First, run the linter.
      // It's important to do this before Babel processes the JS.
      {
        test: /\.(js|jsx|mjs)$/,
        enforce: 'pre',
        use: [
          {
            options: {
              formatter: eslintFormatter,
              eslintPath: require.resolve('eslint'),

            },
            loader: require.resolve('eslint-loader'),
          },
        ],
        include: paths.appLibSrc, // CRL: updated with library src folder
      },
      {
        // "oneOf" will traverse all following loaders until one will
        // match the requirements. When no loader matches it will fall
        // back to the "file" loader at the end of the loader list.
        oneOf: [
          // "url" loader works just like "file" loader but it also embeds
          // assets smaller than specified size as data URLs to avoid requests.
          {
            test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
            loader: require.resolve('url-loader'),
            options: {
              limit: 10000,
              name: 'media/[name].[ext]',
            },
          },
          // Process JS with Babel.
          {
            test: /\.(js|jsx|mjs)$/,
            include: paths.appLibSrc, // CRL: updated with library src folder
            loader: require.resolve('babel-loader'),
            options: {

              compact: true,
            },
          },
          // The notation here is somewhat confusing.
          // "postcss" loader applies autoprefixer to our CSS.
          // "css" loader resolves paths in CSS and adds assets as dependencies.
          // "style" loader normally turns CSS into JS modules injecting <style>,
          // but unlike in development configuration, we do something different.
          // `ExtractTextPlugin` first applies the "postcss" and "css" loaders
          // (second argument), then grabs the result CSS and puts it into a
          // separate file in our build process. This way we actually ship
          // a single CSS file in production instead of JS code injecting <style>
          // tags. If you use code splitting, however, any async bundles will still
          // use the "style" loader inside the async code so CSS from them won't be
          // in the main CSS file.
          {
            test: /\.css$/,
            loader: ExtractTextPlugin.extract(
              Object.assign(
                {
                  fallback: {
                    loader: require.resolve('style-loader'),
                    options: {
                      hmr: false,
                    },
                  },
                  use: [
                    {
                      loader: require.resolve('css-loader'),
                      options: {
                        importLoaders: 1,
                        minimize: true,
                        sourceMap: shouldUseSourceMap,
                      },
                    },
                    {
                      loader: require.resolve('postcss-loader'),
                      options: {
                        // Necessary for external CSS imports to work
                        // https://github.com/facebookincubator/create-react-app/issues/2677
                        ident: 'postcss',
                        plugins: () => [
                          require('postcss-flexbugs-fixes'),
                          autoprefixer({
                            browsers: [
                              '>1%',
                              'last 4 versions',
                              'Firefox ESR',
                              'not ie < 9', // React doesn't support IE8 anyway
                            ],
                            flexbox: 'no-2009',
                          }),
                        ],
                      },
                    },
                  ],
                },
                extractTextPluginOptions
              )
            ),
            // Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
          },
          // "file" loader makes sure assets end up in the `build` folder.
          // When you `import` an asset, you get its filename.
          // This loader doesn't use a "test" so it will catch all modules
          // that fall through the other loaders.
          {
            loader: require.resolve('file-loader'),
            // Exclude `js` files to keep "css" loader working as it injects
            // it's runtime that would otherwise processed through "file" loader.
            // Also exclude `html` and `json` extensions so they get processed
            // by webpacks internal loaders.
            exclude: [/\.js$/, /\.html$/, /\.json$/],
            options: {
              name: 'media/[name].[ext]',
            },
          },
          // ** STOP ** Are you adding a new loader?
          // Make sure to add the new loader(s) before the "file" loader.
        ],
      },
    ],
  },
  plugins: [
    // Makes some environment variables available to the JS code, for example:
    // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
    // It is absolutely essential that NODE_ENV was set to production here.
    // Otherwise React will be compiled in the very slow development mode.
    new webpack.DefinePlugin(env.stringified),
    // Minify the code.
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
        // Disabled because of an issue with Uglify breaking seemingly valid code:
        // https://github.com/facebookincubator/create-react-app/issues/2376
        // Pending further investigation:
        // https://github.com/mishoo/UglifyJS2/issues/2011
        comparisons: false,
      },
      mangle: {
        safari10: true,
      },
      output: {
        comments: false,
        // Turned on because emoji and regex is not minified properly using default
        // https://github.com/facebookincubator/create-react-app/issues/2488
        ascii_only: true,
      },
      sourceMap: shouldUseSourceMap,
    }),
    // Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
    new ExtractTextPlugin({
      filename: cssFilename,
    }),
    // Moment.js is an extremely popular library that bundles large locale files
    // by default due to how Webpack interprets its code. This is a practical
    // solution that requires the user to opt into importing specific locales.
    // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
    // You can remove this if you don't use Moment.js:
    new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
  ],
  // CRL: added externals block for library
  externals: {
   'react': 'react',
   'react-dom': 'react-dom'
  },
  // Some libraries import Node modules but don't use them in the browser.
  // Tell Webpack to provide empty mocks for them so importing them works.
  node: {
    dgram: 'empty',
    fs: 'empty',
    net: 'empty',
    tls: 'empty',
    child_process: 'empty',
  },
};


text:
using Lucene.Net.Analysis.Ja.Util;
using Lucene.Net.Util;

namespace Lucene.Net.Analysis.Ja.TokenAttributes
{

    /// <summary>
    /// Attribute for Kuromoji reading data
    /// </summary>
    public class ReadingAttribute : Attribute, IReadingAttribute // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
    {
        private Token token;

        public virtual string GetReading()
        {
            return token?.GetReading();
        }

        public virtual string GetPronunciation()
        {
            return token?.GetPronunciation();
        }

        public virtual void SetToken(Token token)
        {
            this.token = token;
        }

        public override void Clear()
        {
            token = null;
        }

        public override void CopyTo(IAttribute target)
        {
            ReadingAttribute t = (ReadingAttribute)target;
            t.SetToken(token);
        }

        public override void ReflectWith(IAttributeReflector reflector)
        {
            string reading = GetReading();
            string readingEN = reading is null ? null : ToStringUtil.GetRomanization(reading);
            string pronunciation = GetPronunciation();
            string pronunciationEN = pronunciation is null ? null : ToStringUtil.GetRomanization(pronunciation);
            reflector.Reflect<IReadingAttribute>("reading", reading);
            reflector.Reflect<IReadingAttribute>("reading (en)", readingEN);
            reflector.Reflect<IReadingAttribute>("pronunciation", pronunciation);
            reflector.Reflect<IReadingAttribute>("pronunciation (en)", pronunciationEN);
        }
    }
}