text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ProcessBubbleType_1 = require("../../../Enums/ProcessBubbleType");
var Utils_1 = require("../../Utils/Utils");
var HoverMode_1 = require("../../../Enums/Modes/HoverMode");
var ClickMode_1 = require("../../../Enums/Modes/ClickMode");
var Constants_1 = require("../../Utils/Constants");
var ColorUtils_1 = require("../../Utils/ColorUtils");
var Bubbler = (function () {
    function Bubbler() {
    }
    Bubbler.reset = function (particle) {
        delete particle.bubble.opacity;
        delete particle.bubble.radius;
        delete particle.bubble.color;
    };
    Bubbler.bubble = function (container) {
        var options = container.options;
        var hoverEnabled = options.interactivity.events.onHover.enable;
        var hoverMode = options.interactivity.events.onHover.mode;
        var clickEnabled = options.interactivity.events.onClick.enable;
        var clickMode = options.interactivity.events.onClick.mode;
        if (hoverEnabled && Utils_1.Utils.isInArray(HoverMode_1.HoverMode.bubble, hoverMode)) {
            this.hoverBubble(container);
        }
        else if (clickEnabled && Utils_1.Utils.isInArray(ClickMode_1.ClickMode.bubble, clickMode)) {
            this.clickBubble(container);
        }
    };
    Bubbler.process = function (container, particle, distMouse, timeSpent, data) {
        var bubbleParam = data.bubbleObj.optValue;
        if (bubbleParam === undefined) {
            return;
        }
        var options = container.options;
        var bubbleDuration = options.interactivity.modes.bubble.duration;
        var bubbleDistance = container.retina.bubbleModeDistance;
        var particlesParam = data.particlesObj.optValue;
        var pObjBubble = data.bubbleObj.value;
        var pObj = data.particlesObj.value || 0;
        var type = data.type;
        if (bubbleParam !== particlesParam) {
            if (!container.bubble.durationEnd) {
                if (distMouse <= bubbleDistance) {
                    var obj = pObjBubble !== null && pObjBubble !== void 0 ? pObjBubble : pObj;
                    if (obj !== bubbleParam) {
                        var value = pObj - (timeSpent * (pObj - bubbleParam) / bubbleDuration);
                        if (type === ProcessBubbleType_1.ProcessBubbleType.size) {
                            particle.bubble.radius = value;
                        }
                        if (type === ProcessBubbleType_1.ProcessBubbleType.opacity) {
                            particle.bubble.opacity = value;
                        }
                    }
                }
                else {
                    if (type === ProcessBubbleType_1.ProcessBubbleType.size) {
                        delete particle.bubble.radius;
                    }
                    if (type === ProcessBubbleType_1.ProcessBubbleType.opacity) {
                        delete particle.bubble.opacity;
                    }
                }
            }
            else if (pObjBubble) {
                if (type === ProcessBubbleType_1.ProcessBubbleType.size) {
                    delete particle.bubble.radius;
                }
                if (type === ProcessBubbleType_1.ProcessBubbleType.opacity) {
                    delete particle.bubble.opacity;
                }
            }
        }
    };
    Bubbler.clickBubble = function (container) {
        var _a;
        var options = container.options;
        var mouseClickPos = container.interactivity.mouse.clickPosition;
        if (mouseClickPos === undefined) {
            return;
        }
        var distance = container.retina.bubbleModeDistance;
        var query = container.particles.spatialGrid.queryRadius(mouseClickPos, distance);
        for (var _i = 0, query_1 = query; _i < query_1.length; _i++) {
            var particle = query_1[_i];
            var pos = {
                x: particle.position.x + particle.offset.x,
                y: particle.position.y + particle.offset.y,
            };
            var distMouse = Utils_1.Utils.getDistanceBetweenCoordinates(pos, mouseClickPos);
            var timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime || 0)) / 1000;
            if (container.bubble.clicking) {
                if (timeSpent > options.interactivity.modes.bubble.duration) {
                    container.bubble.durationEnd = true;
                }
                if (timeSpent > options.interactivity.modes.bubble.duration * 2) {
                    container.bubble.clicking = false;
                    container.bubble.durationEnd = false;
                }
                var sizeData = {
                    bubbleObj: {
                        optValue: container.retina.bubbleModeSize,
                        value: particle.bubble.radius,
                    },
                    particlesObj: {
                        optValue: (_a = particle.sizeValue) !== null && _a !== void 0 ? _a : container.retina.sizeValue,
                        value: particle.size.value,
                    },
                    type: ProcessBubbleType_1.ProcessBubbleType.size,
                };
                this.process(container, particle, distMouse, timeSpent, sizeData);
                var opacityData = {
                    bubbleObj: {
                        optValue: options.interactivity.modes.bubble.opacity,
                        value: particle.bubble.opacity,
                    },
                    particlesObj: {
                        optValue: particle.particlesOptions.opacity.value,
                        value: particle.opacity.value,
                    },
                    type: ProcessBubbleType_1.ProcessBubbleType.opacity,
                };
                this.process(container, particle, distMouse, timeSpent, opacityData);
                if (!container.bubble.durationEnd) {
                    if (distMouse <= container.retina.bubbleModeDistance) {
                        this.hoverBubbleColor(container, particle);
                    }
                    else {
                        delete particle.bubble.color;
                    }
                }
                else {
                    delete particle.bubble.color;
                }
            }
        }
    };
    Bubbler.hoverBubble = function (container) {
        var mousePos = container.interactivity.mouse.position;
        if (mousePos === undefined) {
            return;
        }
        var distance = container.retina.bubbleModeDistance;
        var query = container.particles.spatialGrid.queryRadiusWithDistance(mousePos, distance);
        for (var _i = 0, query_2 = query; _i < query_2.length; _i++) {
            var _a = query_2[_i], distance_1 = _a.distance, particle = _a.particle;
            var ratio = 1 - distance_1 / container.retina.bubbleModeDistance;
            if (distance_1 <= container.retina.bubbleModeDistance) {
                if (ratio >= 0 && container.interactivity.status === Constants_1.Constants.mouseMoveEvent) {
                    this.hoverBubbleSize(container, particle, ratio);
                    this.hoverBubbleOpacity(container, particle, ratio);
                    this.hoverBubbleColor(container, particle);
                }
            }
            else {
                this.reset(particle);
            }
            if (container.interactivity.status === Constants_1.Constants.mouseLeaveEvent) {
                this.reset(particle);
            }
        }
    };
    Bubbler.hoverBubbleSize = function (container, particle, ratio) {
        var _a;
        var modeSize = container.retina.bubbleModeSize;
        if (modeSize === undefined) {
            return;
        }
        var optSize = (_a = particle.sizeValue) !== null && _a !== void 0 ? _a : container.retina.sizeValue;
        var pSize = particle.size.value;
        var size = this.calculateBubbleValue(pSize, modeSize, optSize, ratio);
        if (size !== undefined) {
            particle.bubble.radius = size;
        }
    };
    Bubbler.hoverBubbleOpacity = function (container, particle, ratio) {
        var options = container.options;
        var modeOpacity = options.interactivity.modes.bubble.opacity;
        if (modeOpacity === undefined) {
            return;
        }
        var optOpacity = particle.particlesOptions.opacity.value;
        var pOpacity = particle.opacity.value;
        var opacity = this.calculateBubbleValue(pOpacity, modeOpacity, optOpacity, ratio);
        if (opacity !== undefined) {
            particle.bubble.opacity = opacity;
        }
    };
    Bubbler.calculateBubbleValue = function (particleValue, modeValue, optionsValue, ratio) {
        if (modeValue > optionsValue) {
            var size = particleValue + (modeValue - optionsValue) * ratio;
            return Utils_1.Utils.clamp(size, particleValue, modeValue);
        }
        else if (modeValue < optionsValue) {
            var size = particleValue - (optionsValue - modeValue) * ratio;
            return Utils_1.Utils.clamp(size, modeValue, particleValue);
        }
    };
    Bubbler.hoverBubbleColor = function (container, particle) {
        var options = container.options;
        if (particle.bubble.color === undefined) {
            var modeColor = options.interactivity.modes.bubble.color;
            if (modeColor === undefined) {
                return;
            }
            particle.bubble.color = ColorUtils_1.ColorUtils.colorToRgb(modeColor instanceof Array ?
                Utils_1.Utils.itemFromArray(modeColor) :
                modeColor);
        }
    };
    return Bubbler;
}());
exports.Bubbler = Bubbler;


text:
#include <chrono>
#include <cmath>
#include <future>
#include <memory>
#include <thread>

#include "tests/utils/Gtest.h"

#include "joynr/JoynrRuntime.h"
#include "joynr/Settings.h"

#include "tests/JoynrTest.h"

using namespace ::testing;
using namespace joynr;

class AsyncRuntimeBuilderTest : public ::testing::Test
{
protected:
    static std::unique_ptr<joynr::Settings> createJoynrSettings()
    {
        auto settings = std::make_unique<::joynr::Settings>(
                "test-resources/libjoynrSystemIntegration1.settings");
        Settings::merge(
                Settings{"test-resources/MqttSystemIntegrationTest1.settings"}, *settings, false);
        return settings;
    }

    template <typename Duration>
    static std::vector<Duration> createDurationSequence(const Duration& maxDuration)
    {
        assert(0 < maxDuration.count());

        std::vector<Duration> retval;
        retval.emplace_back(Duration::zero());
        const auto quotient = 1.78;
        constexpr unsigned n = 7u;
        for (auto interval = std::max(2u,
                                      unsigned(std::floor(maxDuration.count() * (quotient - 1) /
                                                          (std::pow(quotient, n) - 1))));
             interval <= maxDuration.count();
             interval *= quotient) {
            if (std::crbegin(retval)->count() != interval) {
                retval.emplace_back(Duration{interval});
            }
        }
        if (std::crbegin(retval)->count() != maxDuration.count()) {
            retval.emplace_back(maxDuration);
        }
        return retval;
    }
};

TEST_F(AsyncRuntimeBuilderTest, createRuntime)
{
    auto onSuccess = []() {};

    auto onError = [](const exceptions::JoynrRuntimeException& exception) {
        std::ignore = exception;
        FAIL();
    };

    std::shared_ptr<JoynrRuntime> runtime{JoynrRuntime::createRuntimeAsync(
            createJoynrSettings(), failOnFatalRuntimeError, onSuccess, onError)};
}

TEST_F(AsyncRuntimeBuilderTest, createRuntimeThenDelete)
{
    using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;

    std::promise<TimePoint> startupFinishedPromise;

    auto onSuccessFulfill = [&startupFinishedPromise]() {
        startupFinishedPromise.set_value(TimePoint::clock::now());
    };
    auto onSuccess = []() {};
    auto onError = [](const exceptions::JoynrRuntimeException& exception) {
        std::ignore = exception;
        FAIL();
    };

    const auto timestampStarted = TimePoint::clock::now();
    std::shared_ptr<JoynrRuntime> runtime{JoynrRuntime::createRuntimeAsync(
            createJoynrSettings(), failOnFatalRuntimeError, onSuccessFulfill, onError)};
    const auto timestampFinished = startupFinishedPromise.get_future().get();
    runtime.reset();
    const auto startupTime = std::chrono::duration_cast<std::chrono::milliseconds>(
            timestampFinished - timestampStarted);
    for (const auto& interval : createDurationSequence(startupTime)) {
        runtime = JoynrRuntime::createRuntimeAsync(
                createJoynrSettings(), failOnFatalRuntimeError, onSuccess, onError);
        std::this_thread::sleep_for(interval);
        runtime.reset();
    }
}

TEST_F(AsyncRuntimeBuilderTest, createRuntimeTemporary)
{
    auto onSuccess = []() {};

    auto onError = [](const exceptions::JoynrRuntimeException& exception) {
        std::ignore = exception;
        FAIL();
    };

    // Do not save it to local variable.
    JoynrRuntime::createRuntimeAsync(
            createJoynrSettings(), failOnFatalRuntimeError, onSuccess, onError);
}

redpajama_set_name: RedPajamaGithub


text:
Ext.define('acesure.initialization.store.InitializationStore', {
    extend: 'Ext.data.Store',
    alias:'widget.InitializationStore',
    model: 'acesure.initialization.model.InitializationModel',
    proxy:{
        type:'ajax',
        url : '/initialization/toInitialization!check.action',
        reader: {
            type: 'json',
            root: 'success'
        }
    },
    autoLoad: true
});


text:
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.

#include "Allocator.h"
#include "PsAllocator.h"

namespace physx
{

void* cloth::allocate(size_t n)
{
	return n ? physx::shdfnd::getAllocator().allocate(n, "", __FILE__, __LINE__) : 0;
}

void cloth::deallocate(void* ptr)
{
	if(ptr)
		physx::shdfnd::getAllocator().deallocate(ptr);
}

}


text:
package utils;

public class MethodUtil {
	public static String getFieldGetMethod(String field){
		char[] array = field.toCharArray();
		if(array[0] >= 'a' && array[0] <='z'){
			array[0] = (char) (array[0] - 'a' + 'A') ;
		}

		String result = "get" + new String(array);
		return result;
	}

	public static String setFieldGetMethod(String field){
		char[] array = field.toCharArray();
		if(array[0] >= 'a' && array[0] <='z'){
			array[0] = (char) (array[0] - 'a' + 'A') ;
		}

		String result = "set" + new String(array);
		return result;
	}
}


text:
[![Circle CI](https://circleci.com/gh/mikesplain/openstack-clients-cookbook.svg?style=svg)](https://circleci.com/gh/mikesplain/openstack-clients-cookbook)[![Dependency Status](https://gemnasium.com/mikesplain/openstack-clients-cookbook.svg)](https://gemnasium.com/mikesplain/openstack-clients-cookbook)

OpenStack-Clients Cookbook
==========================

This cookbook installs the Python Openstack Clients:

* [python-novaclient](https://github.com/openstack/python-novaclient)
* [python-keystoneclient](https://github.com/openstack/python-keystoneclient)
* [python-ceilometerclient](https://github.com/openstack/python-ceilometerclient)
* [python-glanceclient](https://github.com/openstack/python-glanceclient)
* [python-swiftclient](https://github.com/openstack/python-swiftclient)
* [python-neutronclient](https://github.com/openstack/python-neutronclient)
* [python-cinderclient](https://github.com/openstack/python-cinderclient)
* [python-troveclient](https://github.com/openstack/python-troveclient)
* [python-heatclient](https://github.com/openstack/python-heatclient)
* [python-barbicanclient](https://github.com/openstack/python-barbicanclient)
* [python-saharaclient](https://github.com/openstack/python-saharaclient)

Requirements
------------
### Platforms
- Debian, Ubuntu
- CentOS 6+, Red Hat 6+, Fedora

### Dependencies
- Python

Usage
------
You can include all clients easily by adding `recipe[openstack-clients]`
or you can include specific clients by calling their recipes directly `recipe[openstack-clients::nova]` or `recipe[openstack-clients::glance]`, etc.

### OpenStackRC
To use `openstack-clients::openstackrc` you can attributes to automatically configure environment variables when the script is called.  Set these attributes in a wrapper cookbook, role or environment.  In the future you will also be able to set these in a data bag.

```
default['openstack-clients']['openstackrc']['configs']['project1'] = {
  OS_AUTH_URL: 'https://identity.project1.openstack.com:5443/v2.0',
  OS_TENANT_ID: '29h8gwh0wg0h2th0',
  OS_TENANT_NAME: 'project1',
  OS_USERNAME: 'project1'
}

default['openstack-clients']['openstackrc']['configs']['project2'] = {
  OS_AUTH_URL: 'https://identity.project2.openstack.com:5443/v2.0',
  OS_TENANT_ID: 'y4j0erg0j40',
  OS_TENANT_NAME: 'project2',
  OS_USERNAME: 'project2'
}
```

Todo
-----
- [ ] Add better documentation of Dependencies
- [ ] Add better tests for each recipe
- [ ] Add Spec tests
- [ ] Add openrc.sh configs

License & Authors
-----------------
- Author: Mike Splain <mikesplain@gmail.com>


text:
print_version() {
	echo "$(basename "$0") 0.9"
	exit 0
}

# default argument values
tests=$(pwd)
results="./allure-results"
report="./allure-report"
title=""
preprocess_only="false"
environment_pairs=""

# use GNU sed if available instead of BSD sed
if gsed --version >/dev/null 2>&1 ; then
	sed="gsed"
else
	sed="sed"
fi

usage_help()
{
	echo
	echo "This script generates Allure reports."
	echo
	echo "Usage:"
	echo "  $(basename "$0") [-d tests] [-i results] [-o report] [-t title] [-p]"
	echo "  $(basename "$0") -v"
	echo "  $(basename "$0") -h"
	echo
	echo "Optional arguments:"
	echo "  -v print version of $(basename "$0")"
	echo "  -d tests directory (default is the current directory)"
	echo "  -i results directory (default is $results)"
	echo "  -o report directory (default is $report)"
	echo "  -t report title (default is \"Allure Report\")"
	echo "  -p preprocess results but do not generate report"
	echo "  -- environment pairs (key1=value1 key2=value2 ...)"
	echo "  -h help"
	echo
}

while getopts "vd:i:o:t:ph" option
do
	case $option in
		v) print_version;;
		d) d_arg="$OPTARG";;
		i) i_arg="$OPTARG";;
		o) o_arg="$OPTARG";;
		t) t_arg="$OPTARG";;
		p) p_arg="true";;
		h) usage_help; exit;;
		*) usage_help; exit;;
	esac
done

shift $((OPTIND - 1))
environment_pairs=("$@")

if [ "$d_arg" != "" ] ; then
	tests="$d_arg"
fi

if [ "$i_arg" != "" ] ; then
	mkdir -p "$i_arg"
	results="$i_arg"
fi

if [ "$o_arg" != "" ] ; then
	mkdir -p "$o_arg"
	report="$o_arg"
fi

if [ "$t_arg" != "" ] ; then
	title="$t_arg"
fi

if [ "$p_arg" != "" ] ; then
	preprocess_only="true"
fi

if [ -d "$report" ] && [ -n "$(ls -A "$report")" ] ; then
	if  [ -d "$report/data" ] && [ -d "$report/export" ] && [ -d "$report/history" ] &&
		[ -d "$report/plugins" ] && [ -d "$report/widgets" ] && [ -e "$report/app.js" ] &&
		[ -e "$report/favicon.ico" ] && [ -e "$report/index.html" ] && [ -e "$report/styles.css" ] ; then
		echo "Warning: Overriding previous report..."
	else
		echo "Error! Specified report directory is not empty and does not contain a previous"
		echo "       report. Terminating the script execution to prevent any data loss."
		exit 1
	fi
fi

# move all xunit_report.xml files found in the current directory
# and sub-directories to the $results directory; the files are
# renamed using an integer counter to avoid overwriting them
counter=0
mkdir -p "$results"
rm -f "$results"/xunit_report_*.xml
output="$(find "$tests" -name xunit_report.xml)"
while read -r file && [ "$file" != "" ]; do
	((counter++))
	mv -f "$file" "$results"/xunit_report_"$counter".xml
done <<< "$output"

if [ ${#environment_pairs[@]} -gt 0 ] ; then
	rm -f "$results"/environment.properties
	for pair in "${environment_pairs[@]}" ; do
		echo "$pair" >> "$results"/environment.properties
	done
fi

if [ "$preprocess_only" == "true" ] ; then
	exit 0
fi

# assume that the $results directory is kept between test
# runs and use a custom file to track the build order
if [ -d "$results"/history ] ; then
	current_build=$(<"$results"/history/logtalk_build_number)
else
	current_build=1
fi

# move the history from the previous report to the
# $results directory so that we can get trend graphs
if [ -d "$report"/history ] ; then
	if [ -d "$results"/history ] ; then
		rm -rf "$results"/history
	fi
	mv "$report"/history "$results"/history
	next_build=$((current_build+1))
	echo "$next_build" > "$results"/history/logtalk_build_number
else
	next_build="$current_build"
fi

# add a minimal executor.json so that trend graphs
# show build labels
executor=$(cat <<EOF
{
	"buildOrder": "$next_build",
	"buildName": "logtalk_allure_report#$next_build",
	"name": "logtalk_tester",
	"type": "logtalk_tester"
}
EOF
)
echo "$executor" > "$results"/executor.json

cd "$results/.." || exit 1
allure generate --clean --report-dir "$report" "$results"
if [ "$title" != "" ] ; then
	$sed -i "s/Allure Report/$title/" "$report"/widgets/summary.json
fi

exit 0


text:
        Liity SOS-lapsikylien viestinviejäksi!

    <form name="mInfoForm" ng-submit="submitMessenger(mInfoForm)" class="sponsor-form" role="form" novalidate>

            Etunimi
            <input type="text" required name="firstName" ng-model="firstName" placeholder="Etunimi" class="form-control">

Tämä kenttä on pakollinen

            Sukunimi
            <input type="text" name="lastName" ng-model="lastName" placeholder="Sukunimi" class="form-control" required>

Tämä kenttä on pakollinen

            Osoite
            <input type="text" name="streetAddress" ng-model="streetAddress" placeholder="Osoite" class="form-control" required>

Tämä kenttä on pakollinen

            Postinumero
            <input type="text" name="postNumber" ng-model="postNumber" placeholder="Postinumero" class="form-control" required>

 Tämä kenttä on pakollinen

            Postitoimipaikka
            <input type="text" name="postOffice" ng-model="postOffice" placeholder="Postitoimipaikka" class="form-control" required>

 Tämä kenttä on pakollinen

            Puhelinnumero
            <input type="text" name="phoneNumber" ng-model="phoneNumber" placeholder="Puhelinnumero" class="form-control">

            Sähköposti
            <input type="email" name="email" ng-model="email" placeholder="Sähköposti" class="form-control" required>

 Tämä kenttä on pakollinen

Sähköpostiosoite on jo käytössä

 Annettua osoitetta ei tunnistettu sähköpostiosoitteeksi.

            <button type="submit" class="btn btn-lg btn-custom btn-sponsor-form-submit">
                Liity viestinviejäksi
            </button>

    </form>


text:
<!DOCTYPE html>
<html lang="en">
  {% include head.html %}
  <body>
    {% include header.html %}
	  {{ content }}
    <!-- /Content type 1 -->
    {% include sponsors.html %}
    {% include footer.html %}
    {% include javascript.html %}
    {% include tracking.html %}
  </body>
</html>


text:
class CopiedImage < Image

  validates :campaign_id, presence: true

end


text:
using System;
using System.Data.Common;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Take.Elephant.Sql.Mapping;

namespace Take.Elephant.Sql
{
    public class SqlSet<T> : SqlCollectionBase<T>, ISet<T>
    {
        public SqlSet(string connectionString, ITable table, IMapper<T> mapper)
            : this(new SqlDatabaseDriver(), connectionString, table, mapper)
        {
        }

        public SqlSet(IDatabaseDriver databaseDriver, string connectionString, ITable table, IMapper<T> mapper)
            : base(databaseDriver, connectionString, table, mapper)
        {
        }

        public virtual async Task AddAsync(T value, CancellationToken cancellationToken = default)
        {
            if (value == null) throw new ArgumentNullException(nameof(value));
            var columnValues = GetColumnValues(value, true);

            var keyColumnValues = GetKeyColumnValues(value, true);
            var nonIdentityKeyColumnValues = GetKeyColumnValues(keyColumnValues, false);
            var identityKeyColumnValues = GetKeyColumnValues(GetIdentityColumnValues(keyColumnValues), true);

            using (var cancellationTokenSource = CreateCancellationTokenSource())
            {
                using (var connection = await GetConnectionAsync(cancellationTokenSource.Token).ConfigureAwait(false))
                {
                    // If there's a key, creates a merge command; otherwise:
                    //   If there's an identity column on the table, creates an insert that returns the inserted key columns; otherwise, just a regular insert.
                    DbCommand command;
                    string[] outputColumnNames = null;

                    // Merge if there's any non identity key or if there's any identity key with value that is not zero
                    if (nonIdentityKeyColumnValues.Count > 0 ||
                        (identityKeyColumnValues.Count > 0 && identityKeyColumnValues.Any(c => c.Value != null && c.Value.ToString() != "0"))) // Using string cast to avoid reflection for checking default values of short, int, long,.
                    {
                        command = connection.CreateMergeCommand(
                            DatabaseDriver,
                            Table,
                            nonIdentityKeyColumnValues,
                            columnValues,
                            identityKeyColumnValues);
                    }
                    else if (Table.Columns.Any(c => c.Value.IsIdentity))
                    {
                        // Note: We do not set non key identity columns
                        outputColumnNames =
                            Table.Columns.Where(c => c.Value.IsIdentity).Select(c => c.Key).ToArray();

                        command = connection.CreateInsertOutputCommand(
                            DatabaseDriver,
                            Table,
                            columnValues,
                            outputColumnNames);
                    }
                    else
                    {
                        command = connection.CreateInsertCommand(DatabaseDriver, Table, columnValues);
                    }

                    using (command)
                    {
                        if (outputColumnNames != null)
                        {
                            using (var reader = await command.ExecuteReaderAsync(cancellationTokenSource.Token).ConfigureAwait(false))
                            {
                                if (!await reader.ReadAsync(cancellationTokenSource.Token))
                                {
                                    throw new Exception("The database operation failed");
                                }

                                Mapper.Create(reader, outputColumnNames, value);
                            }
                        }
                        else if (await command.ExecuteNonQueryAsync(cancellationTokenSource.Token).ConfigureAwait(false) == 0)
                        {
                            throw new Exception("The database operation failed");
                        }
                    }
                    connection.Close();
                }
            }
        }

        public virtual async Task<bool> TryRemoveAsync(T value, CancellationToken cancellationToken = default)
        {
            if (value == null) throw new ArgumentNullException(nameof(value));
            var keyColumnValues = GetKeyColumnValues(value, true);
            using (var cancellationTokenSource = CreateCancellationTokenSource())
            {
                using (var connection = await GetConnectionAsync(cancellationTokenSource.Token).ConfigureAwait(false))
                {
                    return await TryRemoveAsync(keyColumnValues, connection, cancellationTokenSource.Token).ConfigureAwait(false);
                }
            }
        }

        public virtual async Task<bool> ContainsAsync(T value, CancellationToken cancellationToken = default)
        {
            if (value == null) throw new ArgumentNullException(nameof(value));
            var keyColumnValues = GetKeyColumnValues(value, true);
            using (var cancellationTokenSource = CreateCancellationTokenSource())
            {
                using (var connection = await GetConnectionAsync(cancellationTokenSource.Token).ConfigureAwait(false))
                {
                    return await ContainsAsync(keyColumnValues, connection, cancellationTokenSource.Token).ConfigureAwait(false);
                }
            }
        }

    }
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>TodoMVC example</title>
  <meta content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width" name="viewport"/>
  <link rel="stylesheet" href="TodoMVC.css">

todos

      <input class="new-todo" type="text" placeholder="What needs to be done?" autofocus>

      <input class="toggle-all" type="checkbox">

All

Active

Completed

        <button class="clear-completed">Clear completed</button>


text:
var di = require('mvcjs'), // mvcjs as node package
    Type = di.load('typejs'),
    Controller = di.load('core/controller'),
    widgetHooks = di.load('@{core}/widget-hook'),
    CoreController;

// load widget menu, as menu-hook alias and for menu-hook alias use hook method
widgetHooks.load('menu', 'menu-hook', 'hook');
/**
 * @license Mit Licence 2014
 * @since 0.0.1
 * @author Igor Ivanovic
 * @name CoreController
 *
 * @constructor
 * @description
 * Core controller , most controllers are inherited from core controller
 */
CoreController = Controller.inherit({
    locals: Type.OBJECT,
    menu: Type.ARRAY
}, {
    /**
     * @since 0.0.1
     * @author Igor Ivanovic
     * @method CoreController#_construct
     *
     * @description
     * On construct set some defaults
     */
    _construct: function() {
        this.locals = {
            scripts: [],
            brand: 'MVCJS',
            pageTitle: 'Mvcjs nodejs framework',
            pageDesc: 'Fast, TDD driven, opinionated lightweight mvc framework for Node.js , a first Node.js framework with dependency injection!'
        };
        this.menu = [];
    },
    /**
     * @since 0.0.1
     * @author Igor Ivanovic
     * @method CoreController#beforeEach
     *
     * @description
     * This is executed before each action
     * @return {object} Promise
     */
    beforeEach: function Core_beforeEach() {
        // handle hooks
        return widgetHooks.handle(['menu-hook']); // run menu alias
    },
    /**
     * @since 0.0.1
     * @author Igor Ivanovic
     * @method CoreController#action_error
     *
     * @description
     * Error handler for application
     * @return {*|string}
     */
    action_error: function Core_error(params) {
        // currently
        this.locals.pageTitle = 'Error - mvcjs nodejs framework';

        var e = "";
        if (params.exception) {
            e = params.exception.toString();
        }
        e += '\n ROUTE: ' + JSON.stringify(this.getParsedUrl(), null, '\t');
        e = e.replace(/\\n/g, '\n').replace(/\\\'/g, "'");

        if (params.exception && params.exception.code) {
            this.setStatusCode(params.exception.code);
        }

        this.locals.error = e;

        return this.renderFile('home/error', this.locals);
    }
});

module.exports = CoreController;


text:
interface I {
  A;
}

//// [parserPropertySignature1.js]


text:
'use strict';

const models = require('./index');

/**
 * Describes a data disk.
 *
 */
class DataDisk {
  /**
   * Create a DataDisk.
   * @member {number} lun Specifies the logical unit number of the data disk.
   * This value is used to identify data disks within the VM and therefore must
   * be unique for each data disk attached to a VM.
   * @member {string} [name] The disk name.
   * @member {object} [vhd] The virtual hard disk.
   * @member {string} [vhd.uri] Specifies the virtual hard disk's uri.
   * @member {object} [image] The source user image virtual hard disk. The
   * virtual hard disk will be copied before being attached to the virtual
   * machine. If SourceImage is provided, the destination virtual hard drive
   * must not exist.
   * @member {string} [image.uri] Specifies the virtual hard disk's uri.
   * @member {string} [caching] Specifies the caching requirements.

   * Possible values are:

 **None**

 **ReadOnly**

   * **ReadWrite**

 Default: **None for Standard storage. ReadOnly for
   * Premium storage**. Possible values include: 'None', 'ReadOnly',
   * 'ReadWrite'
   * @member {string} createOption Specifies how the virtual machine should be
   * created.

 Possible values are:

 **Attach** \u2013 This value
   * is used when you are using a specialized disk to create the virtual
   * machine.

 **FromImage** \u2013 This value is used when you are
   * using an image to create the virtual machine. If you are using a platform
   * image, you also use the imageReference element described above. If you are
   * using a marketplace image, you  also use the plan element previously
   * described. Possible values include: 'FromImage', 'Empty', 'Attach'
   * @member {number} [diskSizeGB] Specifies the size of an empty data disk in
   * gigabytes. This element can be used to overwrite the name of the disk in a
   * virtual machine image.

 This value cannot be larger than 1023 GB
   * @member {object} [managedDisk] The managed disk parameters.
   * @member {string} [managedDisk.storageAccountType] Specifies the storage
   * account type for the managed disk. Possible values are: Standard_LRS or
   * Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'
   */
  constructor() {
  }

  /**
   * Defines the metadata of DataDisk
   *
   * @returns {object} metadata of DataDisk
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'DataDisk',
      type: {
        name: 'Composite',
        className: 'DataDisk',
        modelProperties: {
          lun: {
            required: true,
            serializedName: 'lun',
            type: {
              name: 'Number'
            }
          },
          name: {
            required: false,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          vhd: {
            required: false,
            serializedName: 'vhd',
            type: {
              name: 'Composite',
              className: 'VirtualHardDisk'
            }
          },
          image: {
            required: false,
            serializedName: 'image',
            type: {
              name: 'Composite',
              className: 'VirtualHardDisk'
            }
          },
          caching: {
            required: false,
            serializedName: 'caching',
            type: {
              name: 'Enum',
              allowedValues: [ 'None', 'ReadOnly', 'ReadWrite' ]
            }
          },
          createOption: {
            required: true,
            serializedName: 'createOption',
            type: {
              name: 'Enum',
              allowedValues: [ 'FromImage', 'Empty', 'Attach' ]
            }
          },
          diskSizeGB: {
            required: false,
            serializedName: 'diskSizeGB',
            type: {
              name: 'Number'
            }
          },
          managedDisk: {
            required: false,
            serializedName: 'managedDisk',
            type: {
              name: 'Composite',
              className: 'ManagedDiskParameters'
            }
          }
        }
      }
    };
  }
}

module.exports = DataDisk;


text:
from AccessControl import getSecurityManager
from bda.plone.cart import CartDataProviderBase
from bda.plone.cart import CartItemStateBase
from bda.plone.cart import get_item_data_provider
from bda.plone.cart import get_item_preview
from bda.plone.cart import get_item_state
from bda.plone.cart import get_item_stock
from bda.plone.cart import remove_item_from_cart
from bda.plone.shipping.interfaces import IShippingItem
from bda.plone.shop import message_factory as _
from bda.plone.shop import permissions
from bda.plone.shop.interfaces import IBuyablePeriod
from bda.plone.shop.utils import get_shop_cart_settings
from bda.plone.shop.utils import get_shop_settings
from bda.plone.shop.utils import get_shop_shipping_settings
from datetime import datetime
from decimal import Decimal
from plone import api
from zope.component import queryAdapter
from zope.i18n import translate
import warnings

class CartItemCalculator(object):
    """Object for calculating cart item related data.
    """

    def __init__(self, context):
        msg = (
            'The use of ``CartItemCalculator`` is deprecated. '
            'Please use ``bda.plone.cart.get_data_provider`` instead. '
            'This class will be removed as of ``bda.plone.shop`` 1.0. '
        )
        warnings.warn(msg, DeprecationWarning)
        self.context = context

    @property
    def catalog(self):
        return api.portal.get_tool('portal_catalog')

    def item_net(self, item):
        """Net price of item.
        """
        uid, count, _ = item
        try:
            obj = api.content.get(UID=uid)
        except ValueError:
            return Decimal(0)
        data = get_item_data_provider(obj)
        discount_net = data.discount_net(count)
        item_net = Decimal(str(data.net)) - discount_net
        return item_net * count

    def item_vat(self, item):
        """VAT of item.
        """
        uid, count, _ = item
        try:
            obj = api.content.get(UID=uid)
        except ValueError:
            return Decimal(0)
        data = get_item_data_provider(obj)
        discount_net = data.discount_net(count)
        item_net = Decimal(str(data.net)) - discount_net
        return (item_net / Decimal(100)) * Decimal(str(data.vat)) * count

    def item_weight(self, item):
        """Weight of item.
        """
        uid, count, _ = item
        try:
            obj = api.content.get(UID=uid)
        except ValueError:
            return Decimal(0)
        shipping = IShippingItem(obj)
        item_weight = shipping.weight
        if item_weight:
            return Decimal(item_weight) * count
        return Decimal(0)

    def net(self, items):
        """Overall net of items.
        """
        net = Decimal(0)
        for uid, count, unused in items:
            try:
                obj = api.content.get(UID=uid)
            except ValueError:
                continue
            if obj is None:
                continue
            data = get_item_data_provider(obj)
            discount_net = data.discount_net(count)
            item_net = Decimal(str(data.net)) - discount_net
            net += item_net * count
        return net

    def vat(self, items):
        """Overall VAT of items.
        """
        vat = Decimal(0)
        for uid, count, unused in items:
            try:
                obj = api.content.get(UID=uid)
            except ValueError:
                continue
            if obj is None:
                continue
            data = get_item_data_provider(obj)
            discount_net = data.discount_net(count)
            item_net = Decimal(str(data.net)) - discount_net
            vat += (item_net / Decimal(100)) * Decimal(str(data.vat)) * count
        return vat

    def weight(self, items):
        """Overall weight of items.
        """
        weight = Decimal(0)
        for uid, count, unused in items:
            try:
                obj = api.content.get(UID=uid)
            except ValueError:
                continue
            if obj is None:
                continue
            shipping = IShippingItem(obj)
            item_weight = shipping.weight
            if item_weight:
                weight += Decimal(item_weight) * count
        return weight

class CartDataProvider(CartItemCalculator, CartDataProviderBase):

    def __init__(self, context, request):
        self.context = context
        self.request = request

    @property
    def currency(self):
        return get_shop_settings().currency

    @property
    def hide_cart_if_empty(self):
        return get_shop_cart_settings().hide_cart_if_empty

    @property
    def max_artice_count(self):
        return get_shop_cart_settings().max_artice_count

    @property
    def disable_max_article(self):
        return get_shop_cart_settings().disable_max_article

    @property
    def summary_total_only(self):
        return get_shop_cart_settings().summary_total_only

    @property
    def shipping_method(self):
        settings = get_shop_shipping_settings()
        # read from cookie and return if present and available
        shipping_method = self.request.cookies.get('shipping_method')
        if shipping_method:
            if shipping_method in settings.available_shipping_methods:
                return shipping_method
        # return default shipping method
        return settings.shipping_method

    @property
    def checkout_url(self):
        return '%s/@@checkout' % self.context.absolute_url()

    @property
    def cart_url(self):
        return '%s/@@cart' % self.context.absolute_url()

    @property
    def show_to_cart(self):
        return get_shop_cart_settings().show_to_cart

    @property
    def show_checkout(self):
        return get_shop_cart_settings().show_checkout

    @property
    def show_currency(self):
        return get_shop_settings().show_currency

    def validate_set(self, uid):
        try:
            buyable = api.content.get(UID=uid)
        except ValueError:
            message = _(
                u'buyable_does_not_exist',
                default=u'Buyable item with UID {uuid} does not exist.',
                        mapping={'uuid': uid})
            return {
                'success': False,
                'error': message,
                'update': True,
            }
        # check whether user can modify cart
        if not api.user.has_permission(permissions.ModifyCart, obj=buyable):
            remove_item_from_cart(self.request, uid)
            message = _(u'permission_not_granted_to_buy_item',
                        default=u'Permission to buy ${title} not granted.',
                        mapping={'title': buyable.Title()})
            message = translate(message, context=self.request)
            return {
                'success': False,
                'error': message,
                'update': True,
            }
        # check buyable period
        buyable_period = queryAdapter(buyable, IBuyablePeriod)
        if buyable_period:
            now = datetime.now()
            # effective date not reached yet
            effective = buyable_period.effective
            if effective and now < effective:
                remove_item_from_cart(self.request, uid)
                message = _('item_not_buyable_yet',
                            default=u'Item not buyable yet')
                message = translate(message, context=self.request)
                return {
                    'success': False,
                    'error': message,
                    'update': True,
                }
            # expires date exceed
            expires = buyable_period.expires
            if expires and now > expires:
                remove_item_from_cart(self.request, uid)
                message = _('item_no_longer_buyable',
                            default=u'Item no longer buyable')
                message = translate(message, context=self.request)
                return {
                    'success': False,
                    'error': message,
                    'update': True,
                }
        return {
            'success': True,
            'error': '',
        }

    def cart_items(self, items):
        ret = list()
        sm = getSecurityManager()
        for uid, count, comment in items:
            try:
                obj = api.content.get(UID=uid)
            except ValueError:
                remove_item_from_cart(self.request, uid)
                continue
            if obj is None:
                remove_item_from_cart(self.request, uid)
                continue
            if not sm.checkPermission(permissions.ModifyCart, obj):
                remove_item_from_cart(self.request, uid)
                continue
            buyable_period = queryAdapter(obj, IBuyablePeriod)
            if buyable_period:
                now = datetime.now()
                effective = buyable_period.effective
                if effective and now < effective:
                    remove_item_from_cart(self.request, uid)
                    continue
                expires = buyable_period.expires
                if expires and now > expires:
                    remove_item_from_cart(self.request, uid)
                    continue
            data = get_item_data_provider(obj)
            title = data.title
            discount_net = data.discount_net(count)
            price = (Decimal(str(data.net)) - discount_net) * count
            discount = discount_net * count
            if data.display_gross:
                price = price + price / Decimal(100) * Decimal(str(data.vat))
                discount = \
                    discount + discount / Decimal(100) * Decimal(str(data.vat))
            url = obj.absolute_url()
            description = obj.Description()
            comment_required = data.comment_required
            quantity_unit_float = data.quantity_unit_float
            quantity_unit = translate(data.quantity_unit, context=self.request)
            preview_image_url = get_item_preview(obj).url
            item_state = get_item_state(obj, self.request)
            no_longer_available = not item_state.validate_count(count)
            alert = item_state.alert(count)
            ret.append(self.item(
                uid=uid,
                title=title,
                count=count,
                price=price,
                url=url,
                comment=comment,
                description=description,
                comment_required=comment_required,
                quantity_unit_float=quantity_unit_float,
                quantity_unit=quantity_unit,
                preview_image_url=preview_image_url,
                no_longer_available=no_longer_available,
                alert=alert,
                discount=discount * Decimal(-1) if discount else Decimal(0)
            ))
        return ret

class CartItemState(CartItemStateBase):
    # XXX: cart item state needs love how to display item warnings.
    #      only display warning on effected items.

    @property
    def completely_exceeded_alert(self):
        message = _(u'alert_item_no_longer_available',
                    default=u'No longer available, please '
                            u'remove from cart')
        return translate(message, context=self.request)

    @property
    def some_reservations_alert(self):
        message = _(u'alert_item_some_reserved',
                    default=u'Partly reserved')
        return translate(message, context=self.request)

    def partly_exceeded_alert(self, exceed, quantity_unit):
        message = _(u'alert_item_number_exceed',
                    default=u'Limit exceed by ${exceed} ${quantity_unit}',
                    mapping={'exceed': exceed,
                             'quantity_unit': quantity_unit})
        return translate(message, context=self.request)

    def number_reservations_alert(self, reserved, quantity_unit):
        message = _(u'alert_item_number_reserved',
                    default=u'${reserved} ${quantity_unit} reserved',
                    mapping={'reserved': reserved,
                             'quantity_unit': quantity_unit})
        return translate(message, context=self.request)

    def alert(self, count):
        stock = get_item_stock(self.context)
        # stock not applied
        if stock is None:
            return ''
        available = stock.available
        # no limitation
        if available is None:
            return ''
        reserved = self.reserved
        exceed = self.exceed
        # no reservations and no exceed
        if not reserved and not exceed:
            # no message
            return ''
        item_data = get_item_data_provider(self.context)
        quantity_unit = item_data.quantity_unit
        quantity_unit_float = item_data.quantity_unit_float

        def display_format(num):
            if quantity_unit_float:
                return num
            return int(num)
        # exceed
        if exceed:
            remaining_available = self.remaining_available
            # partly exceeded
            if remaining_available > 0:
                return self.partly_exceeded_alert(
                    display_format(exceed), quantity_unit)
            # completely exceeded
            return self.completely_exceeded_alert
        # reservations
        if reserved:
            aggregated_count = float(self.aggregated_count)
            count = float(count)
            # some reservations message
            if aggregated_count > count:
                return self.some_reservations_alert
            # number reservations message
            else:
                return self.number_reservations_alert(
                    display_format(reserved), quantity_unit)
        return ''


text:
class StationContact {
  constructor(name, shortName, email, number, phoneNumber) {
    this.name = name;
    this.shortName = shortName;
    this.email = email;
    this.number = number;
    this.phoneNumber = phoneNumber;
  }
}

module.exports = StationContact;


text:
import * as chai from 'chai';
import URI from "./uri";

const expect = chai.expect;

before(() => {
    chai.config.showDiff = true;
    chai.config.includeStack = true;
    chai.should();
});

beforeEach(() => {
});

describe("uri", () => {

    describe("#getParent", () => {

        it("of file:///foo/bar.txt", () => {
            expect(new URI("file:///foo/bar.txt").parent.toString()).equals("file:///foo");
        });

        it("of file:///foo/", () => {
            expect(new URI("file:///foo/").parent.toString()).equals("file:///foo");
        });

        it("of file:///foo", () => {
            expect(new URI("file:///foo").parent.toString()).equals("file:///");
        });

        it("of file:///", () => {
            expect(new URI("file:///").parent.toString()).equals("file:///");
        });

        it("of file://", () => {
            expect(new URI("file://").parent.toString()).equals("file://");
        });

    });

    describe("#lastSegment", () => {

        it("of file:///foo/bar.txt", () => {
            expect(new URI("file:///foo/bar.txt").path.base).equals("bar.txt");
        });

        it("of file:///foo", () => {
            expect(new URI("file:///foo").path.base).equals("foo");
        });

        it("of file:///", () => {
            expect(new URI("file:///").path.base).equals("");
        });

        it("of file://", () => {
            expect(new URI("file://").path.base).equals("");
        });

    });

    describe("#appendPath", () => {

        it("'' to file:///foo", () => {
            const uri = new URI("file:///foo");
            expect(uri.resolve("").toString()).to.be.equal(uri.toString());
        });

        it("bar to file:///foo", () => {
            expect(new URI("file:///foo").resolve("bar").toString()).to.be.equal("file:///foo/bar");
        });

        it("bar/baz to file:///foo", () => {
            expect(new URI("file:///foo").resolve("bar/baz").toString()).to.be.equal("file:///foo/bar/baz");
        });

        it("'' to file:///", () => {
            const uri = new URI("file:///");
            expect(uri.resolve("").toString()).to.be.equal(uri.toString());
        });

        it("bar to file:///", () => {
            expect(new URI("file:///").resolve("bar").toString()).to.be.equal("file:///bar");
        });

        it("bar/baz to file:///", () => {
            expect(new URI("file:///").resolve("bar/baz").toString()).to.be.equal("file:///bar/baz");
        });

    });

    describe("#path", () => {

        it("Should return with the FS path from the URI.", () => {
            expect(new URI("file:///foo/bar/baz.txt").path.toString()).equals("/foo/bar/baz.txt");
        });

        it("Should not return the encoded path", () => {
            expect(new URI("file:///foo 3/bar 4/baz 4.txt").path.toString()).equals("/foo 3/bar 4/baz 4.txt");
        });
    });

    describe("#withFragment", () => {

        it("Should replace the fragment.", () => {
            expect(new URI("file:///foo/bar/baz.txt#345345").withFragment("foo").toString()).equals("file:///foo/bar/baz.txt#foo");
            expect(new URI("file:///foo/bar/baz.txt?foo=2#345345").withFragment("foo").toString(true)).equals("file:///foo/bar/baz.txt?foo=2#foo");
        });

        it("Should remove the fragment.", () => {
            expect(new URI("file:///foo/bar/baz.txt#345345").withFragment("").toString()).equals("file:///foo/bar/baz.txt");
        });
    });

    describe("#toString()", () => {
        it("should produce the non encoded string", () => {
            function check(uri: string): void {
                expect(new URI(uri).toString(true)).equals(uri);
            }
            check('file:///X?test=32');
            check('file:///X?test=32#345');
            check('file:///X test/ddd?test=32#345');
        });
    });

    describe("#Uri.with...()", () => {
        it("produce proper URIs", () => {
            let uri = new URI().withScheme('file').withPath('/foo/bar.txt').withQuery("x=12").withFragment("baz");
            expect(uri.toString(true)).equals("file:///foo/bar.txt?x=12#baz");

            expect(uri.withoutScheme().toString(true)).equals("/foo/bar.txt?x=12#baz");

            expect(uri.withScheme("http").toString(true)).equals("http:/foo/bar.txt?x=12#baz");

            expect(uri.withoutQuery().toString(true)).equals("file:///foo/bar.txt#baz");

            expect(uri.withoutFragment().toString(true)).equals(uri.withFragment('').toString(true));

            expect(uri.withPath("hubba-bubba").toString(true)).equals("file://hubba-bubba?x=12#baz");
        });
    });
});


text:
import { ReactNode, useEffect, useState } from 'react';

import { c } from 'ttag';

import { createBitcoinDonation, createBitcoinPayment } from '@proton/shared/lib/api/payments';
import { APPS, MIN_BITCOIN_AMOUNT } from '@proton/shared/lib/constants';
import { getKnowledgeBaseUrl } from '@proton/shared/lib/helpers/url';
import { Currency } from '@proton/shared/lib/interfaces';

import { Alert, Bordered, Button, Href, Loader, Price } from '../../components';
import { useApi, useConfig, useLoading } from '../../hooks';
import BitcoinDetails from './BitcoinDetails';
import BitcoinQRCode from './BitcoinQRCode';

interface Props {
    amount: number;
    currency: Currency;
    type: string;
}

const Bitcoin = ({ amount, currency, type }: Props) => {
    const api = useApi();
    const { APP_NAME } = useConfig();
    const [loading, withLoading] = useLoading();
    const [error, setError] = useState(false);
    const [model, setModel] = useState({ amountBitcoin: 0, address: '' });

    const request = async () => {
        setError(false);
        try {
            const { AmountBitcoin, Address } = await api(
                type === 'donation' ? createBitcoinDonation(amount, currency) : createBitcoinPayment(amount, currency)
            );
            setModel({ amountBitcoin: AmountBitcoin, address: Address });
        } catch (error) {
            setError(true);
            throw error;
        }
    };

    useEffect(() => {
        if (amount >= MIN_BITCOIN_AMOUNT) {
            withLoading(request());
        }
    }, [amount, currency]);

    if (amount < MIN_BITCOIN_AMOUNT) {
        const i18n = (amount: ReactNode) => c('Info').jt`Amount below minimum (${amount}).`;
        return (
            <Alert className="mb1" type="warning">
                {i18n(
                    <Price key="price" currency={currency}>
                        {MIN_BITCOIN_AMOUNT}
                    </Price>
                )}
            </Alert>
        );
    }

    if (loading) {
        return <Loader />;
    }

    if (error || !model.amountBitcoin || !model.address) {
        return (
            <>
                <Alert className="mb1" type="error">{c('Error').t`Error connecting to the Bitcoin API.`}</Alert>
                <Button onClick={() => withLoading(request())}>{c('Action').t`Try again`}</Button>
            </>
        );
    }

    return (
        <Bordered className="bg-weak rounded">

                <BitcoinQRCode
                    className="flex flex-align-items-center flex-column"
                    amount={model.amountBitcoin}
                    address={model.address}
                />

            <BitcoinDetails amount={model.amountBitcoin} address={model.address} />

                {type === 'invoice' ? (

{c('Info')
                        .t`Bitcoin transactions can take some time to be confirmed (up to 24 hours). Once confirmed, we will add credits to your account. After transaction confirmation, you can pay your invoice with the credits.`}

                ) : (

                        {c('Info')
                            .t`After making your Bitcoin payment, please follow the instructions below to upgrade.`}

                            <Href
                                url={
                                    APP_NAME === APPS.PROTONVPN_SETTINGS
                                        ? 'https://protonvpn.com/support/vpn-bitcoin-payments/'
                                        : getKnowledgeBaseUrl('/pay-with-bitcoin')
                                }
                            >{c('Link').t`Learn more`}</Href>

                )}

        </Bordered>
    );
};

export default Bitcoin;


text:
A Duotone Darkpool syntax theme for Atom.
This is a dark scheme based on [duotone dark theme](https://github.com/simurai/duotone-dark-syntax) by [simurai](https://github.com/simurai).

## Installation

```shell
apm install duotone-darkpool-syntax
```

## Screenshot

![duotone darkpool syntax theme screenshot](http://i.imgur.com/CuP2BZz.png)

## License

the MIT License (MIT)