text:
Structure macros
----------------
This set of macros aims at:

- Simplifying the structure of the services implementation
- Providing guidelines as to how services should efficiently perform common tasks

Dependencies
------------
Make sure to include the following lines at the top of the service file:

    (use srfi-1)
    (use srfi-69)

    (declare (uses compare))
    (declare (uses hash))
    (declare (uses list))
    (declare (uses validation))

select-one
----------
Selects one database row.
Returns #f if the row is not found.

    ;; select the customer-row
    (select-one
      (customer-row
        customers-table-select-by-customer-id
        customer-id)

      ...)

select-one-and-validate
-----------------------
Selects one database row and validates it was found.

    ;; select and validate the customer-row
    (select-one-and-validate
      (customer-row
        customers-table-select-by-customer-id
        customer-id)
      (unknown-customer-id)

      ...)

select-many
-----------
Selects many database rows.

    ;; select the customer-rows
    (select-many
      (customer-rows
        customers-table-select-by-city
        city)

      ...)

select-many-and-hash
--------------------
Selects many database rows and hashes them for efficient referencing.

    ;; select and hash the customer-rows
    (select-many-and-hash
      (customer-rows
        customers-table-select-by-city
        city)
      (customer-rows-hash-table
        hash-with-unique-numeric-keys
        customer-row-customer-id)
      (get-customer-row
        order-row-customer-id
        #f)

      ...

      ;; get one of the customer-rows
      (let ((customer-row (get-customer-row order-row))) ...)

      ...)

select-single-value
-------------------
Selects a single value.

    ;; select the customer-rows count
    (select-single-value
      (customer-rows-count
        customers-table-select-count-by-city
        city)

      ...)

select-single-value-and-validate-zero
-------------------------------------
Selects a single value and validates it is equal to zero.

    ;; select and validate the customer-rows count
    (select-single-value-and-validate-zero
      (customer-rows-count
        customers-table-select-count-by-city
        city)
      (cannot-delete-city-with-customers)

      ...)

make-subresponses
-----------------
Makes a list of subresponses from a list of rows.
Sorts the source list in order to provide a predictable and repeatable ordering of the subresponses.

    ;; make the get-customers-by-city
    ;; customer-subresponses
    (make-subresponses
      (customer-rows
        list-sort-by-number
        customer-row-customer-id)
      (lambda (customer-row)
        (make-get-customers-by-city-customer-subresponse
          (customer-row-first-name customer-row)
          (customer-row-last-name customer-row))))

Reference implementation for a read service
-------------------------------------------

    (define (get-customers-by-status-service sql-connection get-customers-by-status-request)

      ;; validate the request
      (validate-request get-customers-request validate-get-customers-request)

      ;; select and validate the status-row
      (select-one-and-validate
        (status-row
          status-table-select-by-status-id
          (get-customers-request-status-id get-customers-request))
        (unknown-status-id)

        ;; select the customer-rows
        (select-many
          (customer-rows
            customers-table-select-by-status-id
            (get-customers-request-status-id get-customers-request))

          ;; select and hash the address-rows
          (select-many-and-hash
            (address-rows
              address-table-select-by-customer-status-id
              (get-customers-request-status-id get-customers-request))
            (address-rows-hash-table
              hash-with-shared-numeric-keys
              address-row-customer-id)
            (get-address-rows
              customer-row-customer-id
              (list))

            ;; make the get-customers-by-status-response
            (make-get-customers-by-status-response

              ;; make the get-customers-by-status
              ;; customer-subresponses
              (make-subresponses
                (customer-rows
                  list-sort-by-number
                  customer-row-customer-id)
                (lambda (customer-row)
                  (let ((address-rows (get-address-rows customer-row)))
                    (make-get-customer-by-status-customer-subresponse
                      (customer-row-first-name customer-row)
                      (customer-row-last-name customer-row)

                      ;; make the get-customers-by-status
                      ;; address-subresponses
                      (make-subresponses
                        (address-rows
                          list-sort-by-number
                          address-row-address-id)
                        (lambda (address-row)
                          (make-get-customer-by-status-address-subresponse
                            (address-row-street address-row)
                            (address-row-city address-row)
                            (address-row-country address-row)))))))))))))

validate-duplicates
-------------------
Validates that the subrequest values do not contain duplicates.

A numbered validation error is raised if duplicates are found.
The error symbols are concatenated around the invalid subrequests index.
For example: address4-address-type-id-duplicate.

    ;; validate the duplicated
    ;; address-type-id
    (validate-duplicates
      (new-customer-request-addresses
        new-customer-request
        new-customer-address-subrequest-address-type-id)
      (address
        address-type-id-duplicate))

validate-references
-------------------
Validates that the subrequest values refer to existing database rows.

A numbered validation error is raised if invalid references are found.
The error symbols are concatenated around the invalid subrequests index.
For example: address4-address-type-id-unknown.

    ;; validate the referred
    ;; address-type-ids
    (validate-references
      (new-customer-request-addresses
        new-customer-request
        new-customer-address-subrequest-address-type-id)
      (address-type-rows
        address-type-row-address-type-id)
      (address
        address-type-id-unknown))

validate-inserted-rows
----------------------
Searches subrequests for which the specified property returns #f.

Subrequests that are matched are then passed to the validation procedure.
This procedure must return #t only if inserting a new database row would be valid.

A numbered validation error is raised if invalid inserts are found.
The error symbols are concatenated around the invalid subrequests index.
For example: address4-must-be-in-home-office-country

    ;; validate the inserted address-rows
    (validate-inserted-rows
      (update-customer-request-addresses
        update-customer-request
        update-customer-address-subrequest-address-id)
      (address
        must-be-in-home-office-country)

      ;; make sure the inserted address-rows
      ;; are in the home office country
      (lambda (update-customer-address-subrequest)
        (eq?
          (update-customer-address-subrequest-country
            update-customer-address-subrequest)
          home-office-country)))

validate-updated-rows
---------------------
Matches a list of subrequests to a list of database rows.
This is done by joining both lists on their specified property.

Database rows that are matched are then passed to the validation procedure, along with their matching subrequest.
This procedure must return #t only if the update is valid.

A numbered validation error is raised if invalid updates are found.
The error symbols are concatenated around the invalid subrequests index.
For example: address4-cannot-change-country.

    ;; validate the updated address-rows
    (validate-updated-rows
      (update-customer-request-addresses
        update-customer-request
        update-customer-address-subrequest-address-id)
      (address-rows
        address-row-address-id)
      (address
        cannot-change-country)

      ;; make sure the updated address-rows
      ;; remain in the same country
      (lambda (update-customer-address-subrequest address-row)
        (eq?
          (update-customer-address-subrequest-country-id
            update-customer-address-subrequest)
          (address-row-country-id
            address-row))))

validate-deleted-rows
---------------------
Matches a list of subrequests to a list of database rows.
This is done by joining both lists on their specified property.

Database rows that cannot be matched are then passed to the validation procedure.
This procedure must return #t only if the delete is valid.

A validation error is raised if invalid deletes are found.

    ;; validate the deleted address-rows
    (validate-deleted-rows
      (update-customer-request-addresses
        update-customer-request
        update-customer-address-subrequest-address-id)
      (address-rows
        address-row-address-id)
      (address-cannot-delete-primary-address)

      ;; make sure the deleted address-rows
      ;; are not primary addresses
      (lambda (address-row)
        (not (address-row-is-primary address-row))))

update-modified-rows
--------------------
Matches a list of subrequests to a list of database rows.
This is done by joining both lists on their first specified property.

Subrequests that cannot be paired are passed to the first procedure.
This procedure must make a row that will be inserted.

The values of the other properties are then compared between the paired subrequests and rows.
Pairs with differing values are passed to the second procedure.
This procedure must make a row that will be updated.

The modified rows are then passed to the insert, update and delete procedures of the table.

    ;; update the modified address-rows
    (update-modified-rows
      (update-customer-request-addresses
        update-customer-request
        update-customer-address-subrequest-address-id
        update-customer-address-subrequest-street
        update-customer-address-subrequest-city)
      (address-rows
        address-row-address-id
        address-row-street
        address-row-city)
      (address-table)

      ;; makes a new address-row
      (lambda (update-customer-address-subrequest)
        (make-address-row
          ...))

      ;; makes an updated address-row
      (lambda (update-customer-address-subrequest address-row)
        (make-address-row
          ...))

      ...)

Reference implementation for a write service
--------------------------------------------

    (define (update-customer-addresses-service sql-connection update-customer-addresses-request)

      ;; validate the request
      (validate-request update-customer-addresses-request validate-update-customer-addresses-request)

      ;; validate there are no address-id duplicates
      (validate-duplicates
        (update-customer-addresses-request-addresses
          update-customer-addresses-request
          update-customer-addresses-address-subrequest-address-id)
        (address
          address-id-duplicate))

      ;; select and validate the customer-row
      (select-one-and-validate
        (customer-row
          customers-table-select-by-customer-id
          (update-customer-addresses-request-customer-id update-customer-addresses-request))
        (unknown-customer-id)

        ;; select the address-rows
        (select-many
          (address-rows
            address-table-select-by-customer-id
            (update-customer-addresses-request-customer-id update-customer-addresses-request))

          ;; validate the referred address-id
          (validate-references
            (update-customer-addresses-request-addresses
              update-customer-addresses-request
              update-customer-addresses-address-subrequest-address-id)
            (address-rows
              address-row-address-id)
            (address
              address-id-unknown))

            ;; update the modified address-rows
            (update-modified-rows
              (update-customer-addresses-request-addresses
                update-customer-addresses-request
                update-customer-addresses-address-subrequest-address-id
                update-customer-addresses-address-subrequest-street
                update-customer-addresses-address-subrequest-city
                update-customer-addresses-address-subrequest-country)
              (address-rows
                address-row-address-id
                address-row-street
                address-row-city
                address-row-country)
              (address-table)

              ;; makes an new address-row
              (lambda (update-customer-addresses-address-subrequest)
                (make-address-row
                  0
                  (update-customer-addresses-address-subrequest-street
                    update-customer-addresses-address-subrequest)
                  (update-customer-addresses-address-subrequest-city
                    update-customer-addresses-address-subrequest)
                  (update-customer-addresses-address-subrequest-country
                    update-customer-addresses-address-subrequest)))

              ;; makes an updated address-row
              (lambda (update-customer-addresses-address-subrequest address-row)
                (make-address-row
                  (address-row-address-id address-row)
                  (update-customer-addresses-address-subrequest-street
                    update-customer-addresses-address-subrequest)
                  (update-customer-addresses-address-subrequest-city
                    update-customer-addresses-address-subrequest)
                  (update-customer-addresses-address-subrequest-country
                    update-customer-addresses-address-subrequest)))))))


text:
<?php

namespace Barryvdh\Debugbar\DataCollector;

use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\DataCollectorInterface;
use DebugBar\DataCollector\Renderable;
use Illuminate\Contracts\Events\Dispatcher;

/**
 * Collector for Models.
 */
class ModelsCollector extends DataCollector implements DataCollectorInterface, Renderable
{
    public $models = [];
    public $count = 0;

    /**
     * @param Dispatcher $events
     */
    public function __construct(Dispatcher $events)
    {
        $events->listen('eloquent.retrieved:*', function ($event, $models) {
            foreach (array_filter($models) as $model) {
                $class = get_class($model);
                $this->models[$class] = ($this->models[$class] ?? 0) + 1;
                $this->count++;
            }
        });
    }

    public function collect()
    {
        ksort($this->models, SORT_NUMERIC);

        return ['data' => array_reverse($this->models), 'count' => $this->count];
    }

    /**
     * {@inheritDoc}
     */
    public function getName()
    {
        return 'models';
    }

    /**
     * {@inheritDoc}
     */
    public function getWidgets()
    {
        return [
            "models" => [
                "icon" => "cubes",
                "widget" => "PhpDebugBar.Widgets.HtmlVariableListWidget",
                "map" => "models.data",
                "default" => "{}"
            ],
            'models:badge' => [
                'map' => 'models.count',
                'default' => 0
            ]
        ];
    }
}

redpajama_set_name: RedPajamaGithub


text:
using UnityEngine;
using UnityEditor;
using System.IO;

public class UPASession {

	public static UPAImage CreateImage (int w, int h) {
		string path = EditorUtility.SaveFilePanel ("Create UPAImage",
		                                           "Assets/", "Pixel Image.asset", "asset");
		if (path == "") {
			return null;
		}

		path = FileUtil.GetProjectRelativePath(path);

		UPAImage img = ScriptableObject.CreateInstance<UPAImage>();
		AssetDatabase.CreateAsset (img, path);

		AssetDatabase.SaveAssets();

		img.Init(w, h);
		EditorUtility.SetDirty(img);
		UPAEditorWindow.CurrentImg = img;

		EditorPrefs.SetString ("currentImgPath", AssetDatabase.GetAssetPath (img));

		if (UPAEditorWindow.window != null)
			UPAEditorWindow.window.Repaint();
		else
			UPAEditorWindow.Init();

		img.gridSpacing = 10 - Mathf.Abs (img.width - img.height)/100f;
		return img;
	}

	public static UPAImage OpenImage () {
		string path = EditorUtility.OpenFilePanel(
			"Find an Image (.asset | .png | .jpg)",
			"Assets/",
			"Image Files;*.asset;*.jpg;*.png");

		if (path.Length != 0) {
			// Check if the loaded file is an Asset or Image
			if (path.EndsWith(".asset")) {
				path = FileUtil.GetProjectRelativePath(path);
				UPAImage img = AssetDatabase.LoadAssetAtPath(path, typeof(UPAImage)) as UPAImage;
				EditorPrefs.SetString ("currentImgPath", path);
				return img;
			}
			else
			{
				// Load Texture from file
				Texture2D tex = LoadImageFromFile(path);
				// Create a new Image with textures dimensions
				UPAImage img = CreateImage(tex.width, tex.height);
				// Set pixel colors
				img.layers[0].tex = tex;
				img.layers[0].tex.filterMode = FilterMode.Point;
				img.layers[0].tex.Apply ();
				for (int x = 0; x < img.width; x++) {
					for (int y = 0; y < img.height; y++) {
						img.layers[0].map[x + y * tex.width] = tex.GetPixel(x, tex.height - 1 - y);
					}
				}
			}
		}

		return null;
	}

	public static Texture2D LoadImageFromFile (string path) {
		Texture2D tex = null;
		byte[] fileData;
		if (File.Exists(path))     {
			fileData = File.ReadAllBytes(path);
			tex = new Texture2D(2, 2);
			tex.LoadImage(fileData); //..this will auto-resize the texture dimensions.
		}
		return tex;
	}

	public static UPAImage OpenImageByAsset (UPAImage img) {

		if (img == null) {
			Debug.LogWarning ("Image is null. Returning null.");
			EditorPrefs.SetString ("currentImgPath", "");
			return null;
		}

		string path = AssetDatabase.GetAssetPath (img);
		EditorPrefs.SetString ("currentImgPath", path);

		return img;
	}

	public static UPAImage OpenImageAtPath (string path) {
		if (path.Length != 0) {
			UPAImage img = AssetDatabase.LoadAssetAtPath(path, typeof(UPAImage)) as UPAImage;

			if (img == null) {
				EditorPrefs.SetString ("currentImgPath", "");
				return null;
			}

			EditorPrefs.SetString ("currentImgPath", path);
			return img;
		}

		return null;
	}

	public static bool ExportImage (UPAImage img, TextureType type, TextureExtension extension) {
		string path = EditorUtility.SaveFilePanel(
			"Export image as " + extension.ToString(),
			"Assets/",
			img.name + "." + extension.ToString().ToLower(),
			extension.ToString().ToLower());

		if (path.Length == 0)
			return false;

		byte[] bytes;
		if (extension == TextureExtension.PNG) {
			// Encode texture into PNG
			bytes = img.GetFinalImage(true).EncodeToPNG();
		} else {
			// Encode texture into JPG

			#if UNITY_4_2
			bytes = img.GetFinalImage(true).EncodeToPNG();
			#elif UNITY_4_3
			bytes = img.GetFinalImage(true).EncodeToPNG();
			#elif UNITY_4_5
			bytes = img.GetFinalImage(true).EncodeToJPG();
			#else
			bytes = img.GetFinalImage(true).EncodeToJPG();
			#endif
		}

		path = FileUtil.GetProjectRelativePath(path);

		//Write to a file in the project folder
		File.WriteAllBytes(path, bytes);
		AssetDatabase.Refresh();

		TextureImporter texImp = AssetImporter.GetAtPath(path) as TextureImporter;

		if (type == TextureType.texture)
			texImp.textureType = TextureImporterType.Image;
		else if (type == TextureType.sprite) {
			texImp.textureType = TextureImporterType.Sprite;

			#if UNITY_4_2
			texImp.spritePixelsToUnits = 10;
			#elif UNITY_4_3
			texImp.spritePixelsToUnits = 10;
			#elif UNITY_4_5
			texImp.spritePixelsToUnits = 10;
			#else
			texImp.spritePixelsPerUnit = 10;
			#endif
		}

		texImp.filterMode = FilterMode.Point;
		texImp.textureFormat = TextureImporterFormat.AutomaticTruecolor;

		AssetDatabase.ImportAsset(path);

		return true;
	}
}


text:
{% extends path+"/scenario_03k/_layout-case-simple.html" %}

{% block citizen_content %}

{{ data.nuggets | log }}

Back

File report: Treat as having LCW due to regular treatment

Which evidence supports your recommendation?

  <fieldset>

    <legend>
      Select evidence from the list below that you'll use to justify your recommendation.
    </legend>

      <input id="waste-type-3" name="waste-types" type="checkbox" value="waste-mines">
      Questionnaire (UC50)

      <input id="waste-type-3" name="waste-types" type="checkbox" value="waste-mines">
      Specialist letter

  </fieldset>

<form action="diagnosedConditions" method="post">

<input type="submit" class="button" value="Save and continue" id="submitButton">

      </form>

{% endblock %}

{% block page_scripts %}

{% include path+"/scenario_03i/autocomplete/_autocompletedata.html" %}

{% endblock %}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "brands".
 *
 * @property integer $BrandId
 * @property string $Name
 * @property string $Description
 * @property string $Website
 * @property string $LogoUrl
 * @property boolean $IsLogoVisible
 * @property string $Comment
 * @property integer $created_by
 * @property integer $LastUpdatedBy
 * @property integer $created_at
 * @property integer $updated_at
 * @property integer $deleted_at
 *
 * @property Suppliersbrands[] $suppliersbrands
 */
class Brands extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'brands';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['Description', 'Comment'], 'string'],
            [['IsLogoVisible'], 'boolean'],
            [['created_by', 'LastUpdatedBy', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['Name', 'Website'], 'string', 'max' => 500],
            [['LogoUrl'], 'string', 'max' => 1000]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'BrandId' => 'Brand ID',
            'Name' => 'Name',
            'Description' => 'Description',
            'Website' => 'Website',
            'LogoUrl' => 'Logo Url',
            'IsLogoVisible' => 'Is Logo Visible',
            'Comment' => 'Comment',
            'created_by' => 'Created By',
            'LastUpdatedBy' => 'Last Updated By',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'deleted_at' => 'Deleted At',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getSuppliersbrands()
    {
        return $this->hasMany(Suppliersbrands::className(), ['BrandId' => 'BrandId']);
    }
}


text:
<?php

namespace Spatie\MediaLibrary\Test\PathGenerator;

use Spatie\MediaLibrary\Conversion\ConversionCollection;
use Spatie\MediaLibrary\Test\TestCase;
use Spatie\MediaLibrary\UrlGenerator\LocalUrlGenerator;

class BasePathGeneratorTest extends TestCase
{
    protected $config;

    /**
     * @var \Spatie\MediaLibrary\Media
     */
    protected $media;

    /**
     * @var \Spatie\MediaLibrary\Conversion\Conversion
     */
    protected $conversion;

    /**
     * @var \Spatie\MediaLibrary\UrlGenerator\LocalUrlGenerator
     */
    protected $urlGenerator;

    /**
     * @var \Spatie\MediaLibrary\PathGenerator\BasePathGenerator
     */
    protected $pathGenerator;

    public function setUp()
    {
        parent::setUp();

        $this->config = app('config');

        // BaseUrlGenerator is abstract so we'll use LocalUrlGenerator to test the methods of base
        $this->urlGenerator = new LocalUrlGenerator($this->config);

        $this->pathGenerator = new CustomPathGenerator();

        $this->urlGenerator->setPathGenerator($this->pathGenerator);
    }

    /** @test */
    public function it_can_get_the_custom_path_for_media_without_conversions()
    {
        $media = $this->testModel->addMedia($this->getTestFilesDirectory('test.jpg'))->toMediaLibrary();

        $this->urlGenerator->setMedia($media);

        $pathRelativeToRoot = md5($media->id).'/'.$media->file_name;

        $this->assertEquals($pathRelativeToRoot, $this->urlGenerator->getPathRelativeToRoot());
    }

    /** @test */
    public function it_can_get_the_custom_path_for_media_with_conversions()
    {
        $media = $this->testModelWithConversion->addMedia($this->getTestFilesDirectory('test.jpg'))->toMediaLibrary();
        $conversion = ConversionCollection::createForMedia($media)->getByName('thumb');

        $this->urlGenerator
            ->setMedia($media)
            ->setConversion($conversion);

        $pathRelativeToRoot = md5($media->id).'/c/'.$conversion->getName().'.'.$conversion->getResultExtension($media->extension);

        $this->assertEquals($pathRelativeToRoot, $this->urlGenerator->getPathRelativeToRoot());
    }
}


text:
@interface StarRatingView : UIView {}

#pragma mark - Public Properties

@property (nonatomic, assign)	CGFloat	rating;

#pragma mark - Public Methods

- (instancetype)initWithRating:(CGFloat)rating;

@end


text:
#pragma once

#include "Maths/Time.hpp"

namespace acid {
/**
 * @brief Represents a driver that changes over time.
 * @tparam T The type to be driven.
 */
template<typename T>
class UiDriver {
public:
	/**
	 * Creates a new driver with a length.
	 * @param length The drivers length.
	 */
	explicit UiDriver(const Time &length) :
		length(length) {
	}

	virtual ~UiDriver() = default;

	/**
	 * Updates the driver with the passed time.
	 * @param delta The time between the last update.
	 * @return If the driver has not completed.
	 */
	bool Update(const Time &delta) {
		actualTime += delta;
		currentTime += delta;
		if (repeat)
			currentTime = Time::Seconds(std::fmod(currentTime.AsSeconds(), length.AsSeconds()));
		auto factor = static_cast<float>(currentTime / length);
		factor = std::clamp(factor, 0.0f, 1.0f);
		current = Calculate(factor);
		return factor != 1.0f && !repeat;
	}

	/**
	 * Gets the current driver value.
	 * @return The current value.
	 */
	T Get() const { return current; }

	/**
	 * Gets the length.
	 * @return The length.
	 */
	const Time &GetLength() const { return length; }
	/**
	 * Sets the length.
	 * @param length The new length.
	 */
	void SetLength(const Time &length) { this->length = length; }

protected:
	/**
	 * Calculates the new value.
	 * @param factor The time into the drivers life.
	 * @return The calculated value.
	 */
	virtual T Calculate(float factor) = 0;

	/// The most recent value calculation.
	T current{};

	Time length;
	bool repeat = true;
	Time actualTime;
	Time currentTime;
};
}


text:
// Type: Highsoft.Web.Mvc.Charts.PlotOptionsFunnel

using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Highsoft.Web.Mvc.Charts
{
    public class PlotOptionsFunnel : BaseObject
    {
        public PlotOptionsFunnel()
        {
            bool? nullable1 = new bool?(false);
            this.AllowPointSelect_DefaultValue = nullable1;
            this.AllowPointSelect = nullable1;
            double? nullable2 = new double?();
            this.AnimationLimit_DefaultValue = nullable2;
            this.AnimationLimit = nullable2;
            this.BorderColor = this.BorderColor_DefaultValue = "#ffffff";
            nullable2 = new double?(1.0);
            this.BorderWidth_DefaultValue = nullable2;
            this.BorderWidth = nullable2;
            this.Center = this.Center_DefaultValue = new string[2];
            this.ClassName = this.ClassName_DefaultValue = "";
            double? nullable3 = new double?();
            this.ColorIndex_DefaultValue = nullable3;
            this.ColorIndex = nullable3;
            this.Colors = this.Colors_DefaultValue = new List<string>();
            this.Cursor = this.Cursor_DefaultValue = PlotOptionsFunnelCursor.Null;
            this.DataLabels = this.DataLabels_DefaultValue = new PlotOptionsFunnelDataLabels();
            nullable3 = new double?(0.0);
            this.Depth_DefaultValue = nullable3;
            this.Depth = nullable3;
            this.Description = this.Description_DefaultValue = "undefined";
            nullable1 = new bool?(true);
            this.EnableMouseTracking_DefaultValue = nullable1;
            this.EnableMouseTracking = nullable1;
            this.Events = this.Events_DefaultValue = new PlotOptionsFunnelEvents();
            nullable1 = new bool?(false);
            this.GetExtremesFromAll_DefaultValue = nullable1;
            this.GetExtremesFromAll = nullable1;
            this.Height = this.Height_DefaultValue = (string) null;
            this.Keys = this.Keys_DefaultValue = new List<string>();
            this.LinkedTo = this.LinkedTo_DefaultValue = "";
            nullable3 = new double?(80.0);
            this.MinSize_DefaultValue = nullable3;
            this.MinSize = nullable3;
            this.NeckHeight = this.NeckHeight_DefaultValue = "25%";
            this.NeckWidth = this.NeckWidth_DefaultValue = "30%";
            this.Point = this.Point_DefaultValue = new PlotOptionsFunnelPoint();
            nullable1 = new bool?(false);
            this.Reversed_DefaultValue = nullable1;
            this.Reversed = nullable1;
            nullable1 = new bool?(false);
            this.Selected_DefaultValue = nullable1;
            this.Selected = nullable1;
            this.Shadow = this.Shadow_DefaultValue = new Shadow()
            {
                Enabled = false
            };
            nullable1 = new bool?(false);
            this.ShowInLegend_DefaultValue = nullable1;
            this.ShowInLegend = nullable1;
            nullable3 = new double?(10.0);
            this.SlicedOffset_DefaultValue = nullable3;
            this.SlicedOffset = nullable3;
            this.States = this.States_DefaultValue = new PlotOptionsFunnelStates();
            nullable1 = new bool?(false);
            this.StickyTracking_DefaultValue = nullable1;
            this.StickyTracking = nullable1;
            this.Tooltip = this.Tooltip_DefaultValue = new PlotOptionsFunnelTooltip();
            nullable1 = new bool?(true);
            this.Visible_DefaultValue = nullable1;
            this.Visible = nullable1;
            this.Width = this.Width_DefaultValue = "90%";
            this.ZoneAxis = this.ZoneAxis_DefaultValue = "y";
            this.Zones = this.Zones_DefaultValue = new List<PlotOptionsFunnelZone>();
        }

        public bool? AllowPointSelect { get; set; }

        private bool? AllowPointSelect_DefaultValue { get; set; }

        public double? AnimationLimit { get; set; }

        private double? AnimationLimit_DefaultValue { get; set; }

        public string BorderColor { get; set; }

        private string BorderColor_DefaultValue { get; set; }

        public double? BorderWidth { get; set; }

        private double? BorderWidth_DefaultValue { get; set; }

        public string[] Center { get; set; }

        private string[] Center_DefaultValue { get; set; }

        public string ClassName { get; set; }

        private string ClassName_DefaultValue { get; set; }

        public double? ColorIndex { get; set; }

        private double? ColorIndex_DefaultValue { get; set; }

        public List<string> Colors { get; set; }

        private List<string> Colors_DefaultValue { get; set; }

        public PlotOptionsFunnelCursor Cursor { get; set; }

        private PlotOptionsFunnelCursor Cursor_DefaultValue { get; set; }

        public PlotOptionsFunnelDataLabels DataLabels { get; set; }

        private PlotOptionsFunnelDataLabels DataLabels_DefaultValue { get; set; }

        public double? Depth { get; set; }

        private double? Depth_DefaultValue { get; set; }

        public string Description { get; set; }

        private string Description_DefaultValue { get; set; }

        public bool? EnableMouseTracking { get; set; }

        private bool? EnableMouseTracking_DefaultValue { get; set; }

        public PlotOptionsFunnelEvents Events { get; set; }

        private PlotOptionsFunnelEvents Events_DefaultValue { get; set; }

        public bool? GetExtremesFromAll { get; set; }

        private bool? GetExtremesFromAll_DefaultValue { get; set; }

        public string Height { get; set; }

        private string Height_DefaultValue { get; set; }

        public List<string> Keys { get; set; }

        private List<string> Keys_DefaultValue { get; set; }

        public string LinkedTo { get; set; }

        private string LinkedTo_DefaultValue { get; set; }

        public double? MinSize { get; set; }

        private double? MinSize_DefaultValue { get; set; }

        public string NeckHeight { get; set; }

        private string NeckHeight_DefaultValue { get; set; }

        public string NeckWidth { get; set; }

        private string NeckWidth_DefaultValue { get; set; }

        public PlotOptionsFunnelPoint Point { get; set; }

        private PlotOptionsFunnelPoint Point_DefaultValue { get; set; }

        public bool? Reversed { get; set; }

        private bool? Reversed_DefaultValue { get; set; }

        public bool? Selected { get; set; }

        private bool? Selected_DefaultValue { get; set; }

        public Shadow Shadow { get; set; }

        private Shadow Shadow_DefaultValue { get; set; }

        public bool? ShowInLegend { get; set; }

        private bool? ShowInLegend_DefaultValue { get; set; }

        public double? SlicedOffset { get; set; }

        private double? SlicedOffset_DefaultValue { get; set; }

        public PlotOptionsFunnelStates States { get; set; }

        private PlotOptionsFunnelStates States_DefaultValue { get; set; }

        public bool? StickyTracking { get; set; }

        private bool? StickyTracking_DefaultValue { get; set; }

        public PlotOptionsFunnelTooltip Tooltip { get; set; }

        private PlotOptionsFunnelTooltip Tooltip_DefaultValue { get; set; }

        public bool? Visible { get; set; }

        private bool? Visible_DefaultValue { get; set; }

        public string Width { get; set; }

        private string Width_DefaultValue { get; set; }

        public string ZoneAxis { get; set; }

        private string ZoneAxis_DefaultValue { get; set; }

        public List<PlotOptionsFunnelZone> Zones { get; set; }

        private List<PlotOptionsFunnelZone> Zones_DefaultValue { get; set; }

        internal override Hashtable ToHashtable()
        {
            Hashtable hashtable = new Hashtable();
            bool? nullable1 = this.AllowPointSelect;
            bool? nullable2 = this.AllowPointSelect_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
                hashtable.Add((object) "allowPointSelect", (object) this.AllowPointSelect);
            double? nullable3 = this.AnimationLimit;
            double? nullable4 = this.AnimationLimit_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
                hashtable.Add((object) "animationLimit", (object) this.AnimationLimit);
            if (this.BorderColor != this.BorderColor_DefaultValue)
                hashtable.Add((object) "borderColor", (object) this.BorderColor);
            nullable4 = this.BorderWidth;
            nullable3 = this.BorderWidth_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
                hashtable.Add((object) "borderWidth", (object) this.BorderWidth);
            if (this.Center != this.Center_DefaultValue)
                hashtable.Add((object) "center", (object) this.Center);
            if (this.ClassName != this.ClassName_DefaultValue)
                hashtable.Add((object) "className", (object) this.ClassName);
            nullable3 = this.ColorIndex;
            nullable4 = this.ColorIndex_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
                hashtable.Add((object) "colorIndex", (object) this.ColorIndex);
            if (this.Colors != this.Colors_DefaultValue)
                hashtable.Add((object) "colors", (object) this.Colors);
            if (this.Cursor != this.Cursor_DefaultValue)
                hashtable.Add((object) "cursor", (object) Highcharts.FirstCharacterToLower(this.Cursor.ToString()));
            if (this.DataLabels.IsDirty())
                hashtable.Add((object) "dataLabels", (object) this.DataLabels.ToHashtable());
            nullable4 = this.Depth;
            nullable3 = this.Depth_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
                hashtable.Add((object) "depth", (object) this.Depth);
            if (this.Description != this.Description_DefaultValue)
                hashtable.Add((object) "description", (object) this.Description);
            nullable2 = this.EnableMouseTracking;
            nullable1 = this.EnableMouseTracking_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
                hashtable.Add((object) "enableMouseTracking", (object) this.EnableMouseTracking);
            if (this.Events.IsDirty())
                hashtable.Add((object) "events", (object) this.Events.ToHashtable());
            nullable1 = this.GetExtremesFromAll;
            nullable2 = this.GetExtremesFromAll_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
                hashtable.Add((object) "getExtremesFromAll", (object) this.GetExtremesFromAll);
            if (this.Height != this.Height_DefaultValue)
                hashtable.Add((object) "height", (object) this.Height);
            if (this.Keys != this.Keys_DefaultValue)
                hashtable.Add((object) "keys", (object) this.Keys);
            if (this.LinkedTo != this.LinkedTo_DefaultValue)
                hashtable.Add((object) "linkedTo", (object) this.LinkedTo);
            nullable3 = this.MinSize;
            nullable4 = this.MinSize_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
                hashtable.Add((object) "minSize", (object) this.MinSize);
            if (this.NeckHeight != this.NeckHeight_DefaultValue)
                hashtable.Add((object) "neckHeight", (object) this.NeckHeight);
            if (this.NeckWidth != this.NeckWidth_DefaultValue)
                hashtable.Add((object) "neckWidth", (object) this.NeckWidth);
            if (this.Point.IsDirty())
                hashtable.Add((object) "point", (object) this.Point.ToHashtable());
            nullable2 = this.Reversed;
            nullable1 = this.Reversed_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
                hashtable.Add((object) "reversed", (object) this.Reversed);
            nullable1 = this.Selected;
            nullable2 = this.Selected_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
                hashtable.Add((object) "selected", (object) this.Selected);
            if (this.Shadow.IsDirty())
                hashtable.Add((object) "shadow", (object) this.Shadow.ToHashtable());
            nullable2 = this.ShowInLegend;
            nullable1 = this.ShowInLegend_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
                hashtable.Add((object) "showInLegend", (object) this.ShowInLegend);
            nullable4 = this.SlicedOffset;
            nullable3 = this.SlicedOffset_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
                hashtable.Add((object) "slicedOffset", (object) this.SlicedOffset);
            if (this.States.IsDirty())
                hashtable.Add((object) "states", (object) this.States.ToHashtable());
            nullable1 = this.StickyTracking;
            nullable2 = this.StickyTracking_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
                hashtable.Add((object) "stickyTracking", (object) this.StickyTracking);
            if (this.Tooltip.IsDirty())
                hashtable.Add((object) "tooltip", (object) this.Tooltip.ToHashtable());
            nullable2 = this.Visible;
            nullable1 = this.Visible_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
                hashtable.Add((object) "visible", (object) this.Visible);
            if (this.Width != this.Width_DefaultValue)
                hashtable.Add((object) "width", (object) this.Width);
            if (this.ZoneAxis != this.ZoneAxis_DefaultValue)
                hashtable.Add((object) "zoneAxis", (object) this.ZoneAxis);
            if (this.Zones != this.Zones_DefaultValue)
                hashtable.Add((object) "zones", (object) this.HashifyList((IEnumerable) this.Zones));
            return hashtable;
        }

        internal override string ToJSON()
        {
            Hashtable hashtable = this.ToHashtable();

            if (hashtable.Count > 0)
                return JsonConvert.SerializeObject((object) this.ToHashtable());
            return "";
        }

        internal override bool IsDirty()
        {
            return this.ToHashtable().Count > 0;
        }
    }
}


text:
const config = require('../../config/env');
const requestHelper = require('../helpers/request');

/**
 * Fetch candlestick data for an instrument.
 * @param req
 * @param req.instrument
 * @param res
 * @param next
 * @returns {Promise.<*>}
 */
function fetch(req, res, next) {
  const instrument = req.params.instrument;
  const apiUrl = `${config.api.url}/instruments/${instrument}/candles`;
  const reqObj = requestHelper.createGetObj(apiUrl, {});

  return requestHelper.createRequest(reqObj)
    .then(accounts => res.json(accounts))
    .catch(e => next(e));
}

module.exports = { fetch };


text:
namespace Poco {
namespace Zip {

class Zip_API Delete: public ZipOperation
	/// Delete Operation removes an entry from a Zip
{
public:
	Delete(const ZipLocalFileHeader& hdr);
		/// Creates the Delete.

	void execute(Compress& c, std::istream& input);
		/// Throws away the ZipEntry

private:
	const ZipLocalFileHeader _hdr;
};

} } // namespace Poco::Zip

#endif // Zip_Delete_INCLUDED


text:
package com.ibm.nmon.data.matcher;

import java.util.Collection;
import java.util.List;

import com.ibm.nmon.data.DataSet;

/**
 * Matches a {@link DataSet DataSets} based on hostname.
 *
 * @see DataSet#getHostname()
 */
public interface HostMatcher {
    public boolean matchesHost(DataSet data);

    public List<DataSet> getMatchingHosts(Collection<DataSet> toMatch);

    /**
     * Matches all hostnames.
     */
    public static final HostMatcher ALL = new HostMatcher() {
        @Override
        public boolean matchesHost(DataSet data) {
            return true;
        }

        @Override
        public List<DataSet> getMatchingHosts(Collection<DataSet> toMatch) {
            return new java.util.ArrayList<DataSet>(toMatch);
        }

        public String toString() {
            return "$ALL";
        };
    };
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="#ffffff"
    android:orientation="vertical"
    android:paddingTop="0dp" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:text="Current Acceleration:"
        android:textSize="20dp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:gravity="top"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.33"
            android:background="#ffffff"
            android:gravity="center"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:text="X-Axis"
                android:textSize="15dp" />

            <TextView
                android:id="@+id/currentX"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:text="0.0"
                android:textSize="15dp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.33"
            android:background="#ffffff"
            android:gravity="center"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:text="Y-Axis"
                android:textSize="15dp" />

            <TextView
                android:id="@+id/currentY"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:text="0.0"
                android:textSize="15dp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.33"
            android:background="#ffffff"
            android:gravity="center"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:text="Z-Axis"
                android:textSize="15dp" />

            <TextView
                android:id="@+id/currentZ"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:text="0.0"
                android:textSize="15dp" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>


text:
using System;
using Nancy;
using Nancy.Linker;

namespace Restall.Ichnaea.Demo.Web
{
	public class RouteLinks
	{
		private readonly NancyContext context;
		private readonly IResourceLinker linker;

		public RouteLinks(NancyContext context, IResourceLinker linker)
		{
			this.context = context;
			this.linker = linker;
		}

		public Uri Relative(string routeName, dynamic parameters = null)
		{
			return this.linker.BuildRelativeUri(this.context, routeName, parameters);
		}
	}
}


text:
package org.jboss.weld.annotated.runtime;

import static org.jboss.weld.util.reflection.Reflections.cast;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import javax.enterprise.inject.spi.AnnotatedMethod;

import org.jboss.weld.util.annotated.ForwardingAnnotatedMethod;
import org.jboss.weld.util.collections.WeldCollections;

/**
 * An implementation of {@link AnnotatedMethod} used at runtime for invoking Java methods.
 *
 * @author Jozef Hartinger
 */
public class InvokableAnnotatedMethod<T> extends ForwardingAnnotatedMethod<T> {

    public static <T> InvokableAnnotatedMethod<T> of(AnnotatedMethod<T> delegate) {
        return new InvokableAnnotatedMethod<T>(delegate);
    }

    private final AnnotatedMethod<T> annotatedMethod;
    private volatile Map<Class<?>, Method> methods;

    public InvokableAnnotatedMethod(AnnotatedMethod<T> annotatedMethod) {
        this.annotatedMethod = annotatedMethod;
        this.methods = Collections.<Class<?>, Method>singletonMap(annotatedMethod.getJavaMember().getDeclaringClass(), annotatedMethod.getJavaMember());
        SecurityActions.ensureAccessible(annotatedMethod.getJavaMember());
    }

    /**
     * Invokes the method
     *
     * @param instance   The instance to invoke
     * @param parameters The method parameters
     * @return A reference to the instance
     */
    public <X> X invoke(Object instance, Object... parameters) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
        return cast(annotatedMethod.getJavaMember().invoke(instance, parameters));
    }

    /**
     * Invokes the method on the class of the passed instance, not the declaring
     * class. Useful with proxies
     *
     * @param instance The instance to invoke
     * @param manager  The Bean manager
     * @return A reference to the instance
     */
    public <X> X invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
        final Map<Class<?>, Method> methods = this.methods;
        Method method = methods.get(instance.getClass());
        if (method == null) {
            // the same method may be written to the map twice, but that is ok
            // lookupMethod is very slow
            Method delegate = annotatedMethod.getJavaMember();
            method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes());
            SecurityActions.ensureAccessible(method);
            synchronized (this) {
                final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods);
                newMethods.put(instance.getClass(), method);
                this.methods = WeldCollections.immutableMapView(newMethods);
            }
        }
        return cast(method.invoke(instance, parameters));
    }

    @Override
    public AnnotatedMethod<T> delegate() {
        return annotatedMethod;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<info>
	<uuid>00000000000000000000</uuid>
	<name>tcpserver</name>
	<description>TCP Server component</description>
	<company>Nsynapse Inc.</company>
	<developer>Byunghun Hwang</developer>
	<email>bhhwang@nsynapse.com</email>
	<url>http://www.nsynapse.com</url>
	<license>MIT</license>
	<version>0.0.1</version>
	<category></category>
	<tags></tags>
</info>

<property>
	<port>8000</port>
</property>


text:
using System.Web.Http;

using Microsoft.Practices.Unity;
using Unity.WebApi;

using Evans.Demo.Core.Repository;
using Evans.Demo.Core.Service;
using Evans.Demo.Repository;
using Evans.Demo.Repository.EF;
using Evans.Demo.Service;

namespace Evans.Demo.Api
{
    public static class UnityConfig
    {
        #region Public Methods

        public static void RegisterComponents()
        {
            var container = new UnityContainer();

            container.RegisterType(typeof(IRepository<>), typeof(RepositoryEntityFramework<>));
            container.RegisterType<IUnitOfWork, UnitOfWorkEntityFramework>();
            //container.RegisterType(typeof(IUnitOfWork), typeof(UnitOfWork));
            container.RegisterType(typeof(IService<>), typeof(Service<>));

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }

        #endregion Public Methods
    }
}


text:
FROM node:14.8-buster-slim as base
ENV APP_DIR=/opt/app

ARG next_public_base_url=''
ENV NEXT_PUBLIC_BASE_URL=$next_public_base_url

WORKDIR ${APP_DIR}
COPY package.json yarn.lock ./
RUN yarn install

FROM base as dev
WORKDIR ${APP_DIR}
COPY --from=base ${APP_DIR} .
CMD ["yarn", "run", "next", "dev"]

FROM base as production
COPY . ${APP_DIR}
COPY --from=base ${APP_DIR} .
WORKDIR ${APP_DIR}


text:
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @param {?X|undefined} x
 * @return {!X}
 * @template X
 */
function assert(x) {
  if (x == null) throw new Error('Expected not to be null');
  return x;
}

export {
  assert,
};


text:
'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _CloseIcon = require('./CloseIcon');

var _CloseIcon2 = _interopRequireDefault(_CloseIcon);

var Step = (function (_Component) {
  _inherits(Step, _Component);

  function Step(props, context) {
    _classCallCheck(this, Step);

    _get(Object.getPrototypeOf(Step.prototype), 'constructor', this).call(this, props, context);
    this.styles = props.theme;
  }

  _createClass(Step, [{
    key: 'getPositionStyle',
    value: function getPositionStyle(interpolated) {
      var offset = this.props.data.offset;

      var position = interpolated || this.props.data.position;

      var top = 0,
          left = 0;

      if (position instanceof HTMLElement) {
        var element = position;

        do {
          if (!isNaN(element.offsetLeft)) {
            left += element.offsetLeft;
            top += element.offsetTop;
          }
        } while (element = element.offsetParent);
      } else if (typeof position === 'function') {
        return this.getPositionStyle(position());
      } else {
        top = position.top;
        left = position.left;
      }

      offset && offset.top && (top = top + offset.top);
      offset && offset.left && (left = left + offset.left);

      return {
        top: top,
        left: left,
        position: 'absolute'
      };
    }
  }, {
    key: 'renderDots',
    value: function renderDots() {
      var _this = this;

      var _props = this.props;
      var steps = _props.steps;
      var step = _props.step;
      var goTo = _props.goTo;

      return steps.map(function (data, index) {
        var active = index + 1 === step;
        var past = index + 1 < step;

        var style = undefined;

        if (active) {
          style = _this.styles['dotActive'];
        } else if (past) {
          style = _this.styles['dotPast'];
        } else {
          style = _this.styles['dot'];
        }

        return _react2['default'].createElement('div', {
          key: index,
          className: 'WalkThru-Nav-dot ' + (active ? 'active ' : '') + (past ? 'past ' : ''),
          style: style,
          onClick: function () {
            return goTo(index + 1);
          }
        });
      });
    }
  }, {
    key: 'render',
    value: function render() {
      var _props2 = this.props;
      var data = _props2.data;
      var step = _props2.step;
      var steps = _props2.steps;
      var next = _props2.next;
      var hide = _props2.hide;

      var single = steps.length === 1;
      var last = !single && steps.length === step ? true : false;

      return _react2['default'].createElement(
        'div',
        { className: 'WalkThru-Step ' + (single ? 'single ' : 'multi'), style: _extends({}, this.getPositionStyle(), this.styles['step']) },
        _react2['default'].createElement('div', { className: 'WalkThru-arrow', style: this.styles['arrow'] }),
        _react2['default'].createElement(
          'div',
          { className: 'WalkThru-Content', style: this.styles['content'] },
          _react2['default'].createElement(_CloseIcon2['default'], { style: this.styles['closeIcon'], onClick: hide }),
          data.content,
          _react2['default'].createElement(
            'div',
            { className: 'WalkThru-Footer', style: this.styles['footer'] },
            _react2['default'].createElement(
              'button',
              { onClick: next, style: single ? this.styles['fullButton'] : this.styles['button'] },
              single && 'OK Got It',
              !single && (last ? 'Done' : 'Next')
            ),
            _react2['default'].createElement(
              'div',
              { className: 'WalkThru-Nav', style: this.styles['nav'] },
              _react2['default'].createElement(
                'span',
                { className: 'WalkThru-Nav-text', style: this.styles['navText'] },
                'step ',
                step
              ),
              _react2['default'].createElement(
                'div',
                { className: 'WalkThru-Nav-dots', style: this.styles['dots'] },
                this.renderDots()
              )
            )
          )
        )
      );
    }
  }]);

  return Step;
})(_react.Component);

exports['default'] = Step;

Step.defaultProps = {
  theme: {}
};
module.exports = exports['default'];


text:
/* -*- mOde: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* GStreamer .wav encoder
 * Copyright (C) <2002> Iain Holmes <iain@prettypeople.org>
 * Copyright (C) <2006> Tim-Philipp Müller <tim centricular net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */
/**
 * SECTION:element-wavenc
 *
 * Format an audio stream into the wav format.
 *
 * <refsect2>
 * <title>Example launch line</title>
 * |[
 * gst-launch-1.0 cdparanoiasrc mode=continuous ! queue ! audioconvert ! wavenc ! filesink location=cd.wav
 * ]| Rip a whole audio CD into a single wav file, with the track table written into a CUE sheet inside the file
 * |[
 * gst-launch-1.0 cdparanoiasrc track=5 ! queue ! audioconvert ! wavenc ! filesink location=track5.wav
 * ]| Rip track 5 of an audio CD into a single wav file containing unencoded raw audio samples.
 * </refsect2>
 *
 */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <string.h>
#include "gstwavenc.h"

#include <gst/audio/audio.h>
#include <gst/riff/riff-media.h>
#include <gst/base/gstbytewriter.h>

GST_DEBUG_CATEGORY_STATIC (wavenc_debug);
#define GST_CAT_DEFAULT wavenc_debug

typedef struct
{
  /* Offset Size    Description   Value
   * 0x00   4       ID            unique identification value
   * 0x04   4       Position      play order position
   * 0x08   4       Data Chunk ID RIFF ID of corresponding data chunk
   * 0x0c   4       Chunk Start   Byte Offset of Data Chunk *
   * 0x10   4       Block Start   Byte Offset to sample of First Channel
   * 0x14   4       Sample Offset Byte Offset to sample byte of First Channel
   */
  guint32 id;
  guint32 position;
  guint8 data_chunk_id[4];
  guint32 chunk_start;
  guint32 block_start;
  guint32 sample_offset;
} GstWavEncCue;

typedef struct
{
  /* Offset Size    Description     Value
   * 0x00   4       Chunk ID        "labl" (0x6C61626C) or "note" (0x6E6F7465)
   * 0x04   4       Chunk Data Size depends on contained text
   * 0x08   4       Cue Point ID    0 - 0xFFFFFFFF
   * 0x0c           Text
   */
  guint8 chunk_id[4];
  guint32 chunk_data_size;
  guint32 cue_point_id;
  gchar *text;
} GstWavEncLabl, GstWavEncNote;

/* FIXME: mono doesn't produce correct files it seems, at least mplayer xruns */
#define SINK_CAPS \
    "audio/x-raw, "                      \
    "rate = (int) [ 1, MAX ], "          \
    "channels = (int) [ 1, 65535 ], "      \
    "format = (string) { S32LE, S24LE, S16LE, U8, F32LE, F64LE }, " \
    "layout = (string) interleaved"      \
    "; "                                 \
    "audio/x-alaw, "                     \
    "rate = (int) [ 8000, 192000 ], "    \
    "channels = (int) [ 1, 2 ]; "        \
    "audio/x-mulaw, "                    \
    "rate = (int) [ 8000, 192000 ], "    \
    "channels = (int) [ 1, 2 ]"

#define SRC_CAPS \
    "audio/x-wav; " \
    "audio/x-rf64"

static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS (SINK_CAPS)
    );

static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
    GST_PAD_SRC,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS (SRC_CAPS)
    );

#define gst_wavenc_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstWavEnc, gst_wavenc, GST_TYPE_ELEMENT,
    G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL)
    G_IMPLEMENT_INTERFACE (GST_TYPE_TOC_SETTER, NULL)
    );

static GstFlowReturn gst_wavenc_chain (GstPad * pad, GstObject * parent,
    GstBuffer * buf);
static gboolean gst_wavenc_event (GstPad * pad, GstObject * parent,
    GstEvent * event);
static GstStateChangeReturn gst_wavenc_change_state (GstElement * element,
    GstStateChange transition);
static gboolean gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps);

static void
gst_wavenc_class_init (GstWavEncClass * klass)
{
  GstElementClass *element_class;

  element_class = (GstElementClass *) klass;

  element_class->change_state = GST_DEBUG_FUNCPTR (gst_wavenc_change_state);

  gst_element_class_set_static_metadata (element_class, "WAV audio muxer",
      "Codec/Muxer/Audio",
      "Encode raw audio into WAV", "Iain Holmes <iain@prettypeople.org>");

  gst_element_class_add_static_pad_template (element_class, &src_factory);
  gst_element_class_add_static_pad_template (element_class, &sink_factory);

  GST_DEBUG_CATEGORY_INIT (wavenc_debug, "wavenc", 0, "WAV encoder element");
}

static void
gst_wavenc_init (GstWavEnc * wavenc)
{
  wavenc->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
  gst_pad_set_chain_function (wavenc->sinkpad,
      GST_DEBUG_FUNCPTR (gst_wavenc_chain));
  gst_pad_set_event_function (wavenc->sinkpad,
      GST_DEBUG_FUNCPTR (gst_wavenc_event));
  gst_pad_use_fixed_caps (wavenc->sinkpad);
  gst_element_add_pad (GST_ELEMENT (wavenc), wavenc->sinkpad);

  wavenc->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
  gst_pad_use_fixed_caps (wavenc->srcpad);
  gst_element_add_pad (GST_ELEMENT (wavenc), wavenc->srcpad);
}

#define RIFF_CHUNK_LEN    12
#define FMT_WAV_CHUNK_LEN 24
#define FMT_EXT_CHUNK_LEN 48
#define FACT_CHUNK_LEN    12
#define DATA_HEADER_LEN   8
#define DS64_CHUNK_LEN    36

static gboolean
use_format_ext (GstWavEnc * wavenc)
{
  return wavenc->channels > 2;
}

static gboolean
use_fact_chunk (GstWavEnc * wavenc)
{
  return use_format_ext (wavenc) && !wavenc->use_rf64;
}

static int
get_header_len (GstWavEnc * wavenc)
{
  int len = RIFF_CHUNK_LEN;

  if (use_format_ext (wavenc))
    len += FMT_EXT_CHUNK_LEN;
  else
    len += FMT_WAV_CHUNK_LEN;

  if (use_fact_chunk (wavenc))
    len += FACT_CHUNK_LEN;

  if (wavenc->use_rf64)
    len += DS64_CHUNK_LEN;

  return len + DATA_HEADER_LEN;
}

static guint64
gstmask_to_wavmask (guint64 gstmask, GstAudioChannelPosition * pos)
{
  const GstAudioChannelPosition valid_pos =
      GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT |
      GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT |
      GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER |
      GST_AUDIO_CHANNEL_POSITION_LFE1 |
      GST_AUDIO_CHANNEL_POSITION_REAR_LEFT |
      GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT |
      GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER |
      GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER |
      GST_AUDIO_CHANNEL_POSITION_REAR_CENTER |
      GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT |
      GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT |
      GST_AUDIO_CHANNEL_POSITION_TOP_CENTER |
      GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT |
      GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER |
      GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT |
      GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT |
      GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER |
      GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT;

  const GstAudioChannelPosition wav_pos[] = {
    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
    GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
    GST_AUDIO_CHANNEL_POSITION_LFE1,
    GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
    GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
    GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
    GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
    GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
    GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
    GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
    GST_AUDIO_CHANNEL_POSITION_TOP_CENTER,
    GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT,
    GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER,
    GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT,
    GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT,
    GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER,
    GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT,
  };
  int k;
  int chan = 0;
  guint64 ret = 0;
  guint64 mask = 1;

  if (gstmask == 0 || ((gstmask & ~valid_pos) != 0))
    return 0;

  for (k = 0; k < G_N_ELEMENTS (wav_pos); ++k) {
    if (gstmask & wav_pos[k]) {
      ret |= mask;
      pos[chan++] = wav_pos[k];
    }
    mask <<= 1;
  }

  return ret;
}

static guint8 *
write_fmt_chunk (GstWavEnc * wavenc, guint8 * header)
{
  guint16 wBlockAlign;

  wBlockAlign = (wavenc->width / 8) * wavenc->channels;

  memcpy (header, "fmt ", 4);
  /* wChannels */
  GST_WRITE_UINT16_LE (header + 10, wavenc->channels);
  /* dwSamplesPerSec */
  GST_WRITE_UINT32_LE (header + 12, wavenc->rate);
  /* dwAvgBytesPerSec */
  GST_WRITE_UINT32_LE (header + 16, wBlockAlign * wavenc->rate);
  /* wBlockAlign */
  GST_WRITE_UINT16_LE (header + 20, wBlockAlign);
  /* wBitsPerSample */
  GST_WRITE_UINT16_LE (header + 22, wavenc->width);

  if (use_format_ext (wavenc)) {
    GST_DEBUG_OBJECT (wavenc, "Using WAVE_FORMAT_EXTENSIBLE");

    GST_WRITE_UINT32_LE (header + 4, FMT_EXT_CHUNK_LEN - 8);

    /* wFormatTag */
    GST_WRITE_UINT16_LE (header + 8, 0xFFFE);
    /* cbSize */
    GST_WRITE_UINT16_LE (header + 24, 22);
    /* wValidBitsPerSample */
    GST_WRITE_UINT16_LE (header + 26, wavenc->width);
    /* dwChannelMask */
    GST_WRITE_UINT32_LE (header + 28, (guint32) wavenc->channel_mask);

    GST_WRITE_UINT16_LE (header + 32, wavenc->format);

    memcpy (header + 34,
        "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71", 14);

    header += FMT_EXT_CHUNK_LEN;

  } else {
    GST_WRITE_UINT32_LE (header + 4, FMT_WAV_CHUNK_LEN - 8);

    /* wFormatTag */
    GST_WRITE_UINT16_LE (header + 8, wavenc->format);
    header += FMT_WAV_CHUNK_LEN;
  }

  return header;
}

static guint64
get_num_frames (GstWavEnc * wavenc)
{
  if (wavenc->channels == 0 || wavenc->width == 0)
    return 0;
  return wavenc->audio_length / (wavenc->width / 8) / wavenc->channels;
}

static guint8 *
write_fact_chunk (GstWavEnc * wavenc, guint8 * header)
{
  memcpy (header, "fact", 4);
  GST_WRITE_UINT32_LE (header + 4, FACT_CHUNK_LEN - 8);
  /* compressed files are only supported up to 2 channels,
   * that means we never write a fact chunk for them */
  if (wavenc->use_rf64)
    GST_WRITE_UINT32_LE (header + 8, 0xFFFFFFFF);
  else
    GST_WRITE_UINT32_LE (header + 8, (guint32) get_num_frames (wavenc));
  return header + FACT_CHUNK_LEN;
}

static guint8 *
write_ds64_chunk (GstWavEnc * wavenc, guint64 riffLen, guint8 * header)
{
  guint64 numFrames = get_num_frames (wavenc);

  GST_DEBUG_OBJECT (wavenc, "riffLen=%" G_GUINT64_FORMAT
      ", audio length=%" G_GUINT64_FORMAT ", numFrames=%" G_GUINT64_FORMAT,
      riffLen, wavenc->audio_length, numFrames);

  memcpy (header, "ds64", 4);
  GST_WRITE_UINT32_LE (header + 4, DS64_CHUNK_LEN - 8);
  /* riffSize */
  GST_WRITE_UINT32_LE (header + 8, (guint32) (riffLen & 0xFFFFFFFF));
  GST_WRITE_UINT32_LE (header + 12, (guint32) (riffLen >> 32));
  /* dataSize */
  GST_WRITE_UINT32_LE (header + 16,
      (guint32) (wavenc->audio_length & 0xFFFFFFFF));
  GST_WRITE_UINT32_LE (header + 20, (guint32) (wavenc->audio_length >> 32));
  /* sampleCount */
  GST_WRITE_UINT32_LE (header + 24, (guint32) (numFrames & 0xFFFFFFFF));
  GST_WRITE_UINT32_LE (header + 28, (guint32) (numFrames >> 32));
  /* tableLength always zero for now */
  GST_WRITE_UINT32_LE (header + 32, 0);

  return header + DS64_CHUNK_LEN;
}

static GstBuffer *
gst_wavenc_create_header_buf (GstWavEnc * wavenc)
{
  GstBuffer *buf;
  GstMapInfo map;
  guint8 *header;
  guint64 riffLen;

  GST_DEBUG_OBJECT (wavenc, "Header size: %d", get_header_len (wavenc));
  buf = gst_buffer_new_and_alloc (get_header_len (wavenc));
  gst_buffer_map (buf, &map, GST_MAP_WRITE);
  header = map.data;
  memset (header, 0, get_header_len (wavenc));

  riffLen = wavenc->meta_length + wavenc->audio_length
      + get_header_len (wavenc) - 8;

  /* RIFF chunk */
  if (wavenc->use_rf64) {
    GST_DEBUG_OBJECT (wavenc, "Using RF64");
    memcpy (header, "RF64", 4);
    GST_WRITE_UINT32_LE (header + 4, 0xFFFFFFFF);
  } else {
    memcpy (header, "RIFF", 4);
    GST_WRITE_UINT32_LE (header + 4, (guint32) riffLen);
  }
  memcpy (header + 8, "WAVE", 4);
  header += RIFF_CHUNK_LEN;

  if (wavenc->use_rf64)
    header = write_ds64_chunk (wavenc, riffLen, header);

  header = write_fmt_chunk (wavenc, header);
  if (use_fact_chunk (wavenc))
    header = write_fact_chunk (wavenc, header);

  /* data chunk */
  memcpy (header, "data ", 4);
  if (wavenc->use_rf64)
    GST_WRITE_UINT32_LE (header + 4, 0xFFFFFFFF);
  else
    GST_WRITE_UINT32_LE (header + 4, (guint32) wavenc->audio_length);

  gst_buffer_unmap (buf, &map);

  return buf;
}

static GstFlowReturn
gst_wavenc_push_header (GstWavEnc * wavenc)
{
  GstFlowReturn ret;
  GstBuffer *outbuf;
  GstSegment segment;

  /* seek to beginning of file */
  gst_segment_init (&segment, GST_FORMAT_BYTES);
  if (!gst_pad_push_event (wavenc->srcpad, gst_event_new_segment (&segment))) {
    GST_WARNING_OBJECT (wavenc, "Seek to the beginning failed");
    return GST_FLOW_ERROR;
  }

  GST_DEBUG_OBJECT (wavenc, "writing header, meta_size=%u, audio_size=%"
      G_GUINT64_FORMAT, wavenc->meta_length, wavenc->audio_length);

  outbuf = gst_wavenc_create_header_buf (wavenc);
  GST_BUFFER_OFFSET (outbuf) = 0;

  ret = gst_pad_push (wavenc->srcpad, outbuf);

  if (ret != GST_FLOW_OK) {
    GST_WARNING_OBJECT (wavenc, "push header failed: flow = %s",
        gst_flow_get_name (ret));
  }

  return ret;
}

static gboolean
gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps)
{
  GstWavEnc *wavenc;
  GstStructure *structure;
  const gchar *name;
  gint chans, rate;
  GstCaps *ccaps;

  wavenc = GST_WAVENC (gst_pad_get_parent (pad));

  ccaps = gst_pad_get_current_caps (pad);
  if (wavenc->sent_header && ccaps && !gst_caps_can_intersect (caps, ccaps)) {
    gst_caps_unref (ccaps);
    GST_WARNING_OBJECT (wavenc, "cannot change format in middle of stream");
    goto fail;
  }
  if (ccaps)
    gst_caps_unref (ccaps);

  GST_DEBUG_OBJECT (wavenc, "got caps: %" GST_PTR_FORMAT, caps);

  structure = gst_caps_get_structure (caps, 0);
  name = gst_structure_get_name (structure);

  if (!gst_structure_get_int (structure, "channels", &chans) ||
      !gst_structure_get_int (structure, "rate", &rate)) {
    GST_WARNING_OBJECT (wavenc, "caps incomplete");
    goto fail;
  }

  wavenc->channels = chans;
  wavenc->rate = rate;
  wavenc->channel_mask = 0;

  if (strcmp (name, "audio/x-raw") == 0) {
    GstAudioInfo info;
    guint64 gstmask;

    if (!gst_audio_info_from_caps (&info, caps)) {
      GST_WARNING_OBJECT (wavenc, "Could not retrieve audio info from caps");
      goto fail;
    }
    if (gst_audio_channel_positions_to_mask (info.position, wavenc->channels,
            FALSE, &gstmask)) {
      wavenc->channel_mask = gstmask_to_wavmask (gstmask, wavenc->destPos);
      memcpy (wavenc->srcPos, info.position, sizeof (info.position));
      GST_DEBUG_OBJECT (wavenc, "Channel mask input: 0x%" G_GINT64_MODIFIER "x"
          " output: 0x%" G_GINT64_MODIFIER "x", gstmask, wavenc->channel_mask);
    }
    wavenc->audio_format = GST_AUDIO_INFO_FORMAT (&info);

    if (GST_AUDIO_INFO_IS_INTEGER (&info))
      wavenc->format = GST_RIFF_WAVE_FORMAT_PCM;
    else if (GST_AUDIO_INFO_IS_FLOAT (&info))
      wavenc->format = GST_RIFF_WAVE_FORMAT_IEEE_FLOAT;
    else
      goto fail;

    wavenc->width = GST_AUDIO_INFO_WIDTH (&info);
  } else if (strcmp (name, "audio/x-alaw") == 0) {
    wavenc->format = GST_RIFF_WAVE_FORMAT_ALAW;
    wavenc->width = 8;
  } else if (strcmp (name, "audio/x-mulaw") == 0) {
    wavenc->format = GST_RIFF_WAVE_FORMAT_MULAW;
    wavenc->width = 8;
  } else {
    GST_WARNING_OBJECT (wavenc, "Unsupported format %s", name);
    goto fail;
  }

  GST_LOG_OBJECT (wavenc,
      "accepted caps: format=0x%04x chans=%u width=%u rate=%u",
      wavenc->format, wavenc->channels, wavenc->width, wavenc->rate);

  gst_object_unref (wavenc);
  return TRUE;

fail:
  gst_object_unref (wavenc);
  return FALSE;
}

static void
gst_wavparse_tags_foreach (const GstTagList * tags, const gchar * tag,
    gpointer data)
{
  const struct
  {
    guint32 fcc;
    const gchar *tag;
  } rifftags[] = {
    {
    GST_RIFF_INFO_IARL, GST_TAG_LOCATION}, {
    GST_RIFF_INFO_IART, GST_TAG_ARTIST}, {
    GST_RIFF_INFO_ICMT, GST_TAG_COMMENT}, {
    GST_RIFF_INFO_ICOP, GST_TAG_COPYRIGHT}, {
    GST_RIFF_INFO_ICRD, GST_TAG_DATE}, {
    GST_RIFF_INFO_IGNR, GST_TAG_GENRE}, {
    GST_RIFF_INFO_IKEY, GST_TAG_KEYWORDS}, {
    GST_RIFF_INFO_INAM, GST_TAG_TITLE}, {
    GST_RIFF_INFO_IPRD, GST_TAG_ALBUM}, {
    GST_RIFF_INFO_ISBJ, GST_TAG_ALBUM_ARTIST}, {
    GST_RIFF_INFO_ISFT, GST_TAG_ENCODER}, {
    GST_RIFF_INFO_ISRC, GST_TAG_ISRC}, {
    0, NULL}
  };
  gint n;
  gchar *str = NULL;
  GstByteWriter *bw = data;
  for (n = 0; rifftags[n].fcc != 0; n++) {
    if (!strcmp (rifftags[n].tag, tag)) {
      if (rifftags[n].fcc == GST_RIFF_INFO_ICRD) {
        GDate *date;
        /* special case for the date tag */
        if (gst_tag_list_get_date (tags, tag, &date)) {
          str =
              g_strdup_printf ("%04d:%02d:%02d", g_date_get_year (date),
              g_date_get_month (date), g_date_get_day (date));
          g_date_free (date);
        }
      } else {
        gst_tag_list_get_string (tags, tag, &str);
      }
      if (str) {
        gst_byte_writer_put_uint32_le (bw, rifftags[n].fcc);
        gst_byte_writer_put_uint32_le (bw, GST_ROUND_UP_2 (strlen (str)));
        gst_byte_writer_put_string (bw, str);
        g_free (str);
        str = NULL;
        break;
      }
    }
  }

}

static GstFlowReturn
gst_wavenc_write_tags (GstWavEnc * wavenc)
{
  const GstTagList *user_tags;
  GstTagList *tags;
  guint size;
  GstBuffer *buf;
  GstByteWriter bw;

  g_return_val_if_fail (wavenc != NULL, GST_FLOW_OK);

  user_tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (wavenc));
  if ((!wavenc->tags) && (!user_tags)) {
    GST_DEBUG_OBJECT (wavenc, "have no tags");
    return GST_FLOW_OK;
  }
  tags =
      gst_tag_list_merge (user_tags, wavenc->tags,
      gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (wavenc)));

  GST_DEBUG_OBJECT (wavenc, "writing tags");

  gst_byte_writer_init_with_size (&bw, 1024, FALSE);

  /* add LIST INFO chunk */
  gst_byte_writer_put_data (&bw, (const guint8 *) "LIST", 4);
  gst_byte_writer_put_uint32_le (&bw, 0);
  gst_byte_writer_put_data (&bw, (const guint8 *) "INFO", 4);

  /* add tags */
  gst_tag_list_foreach (tags, gst_wavparse_tags_foreach, &bw);

  /* sets real size of LIST INFO chunk */
  size = gst_byte_writer_get_pos (&bw);
  gst_byte_writer_set_pos (&bw, 4);
  gst_byte_writer_put_uint32_le (&bw, size - 8);

  gst_tag_list_unref (tags);

  buf = gst_byte_writer_reset_and_get_buffer (&bw);
  wavenc->meta_length += gst_buffer_get_size (buf);
  return gst_pad_push (wavenc->srcpad, buf);
}

static gboolean
gst_wavenc_is_cue_id_unique (guint32 id, GList * list)
{
  GstWavEncCue *cue;

  while (list) {
    cue = list->data;
    if (cue->id == id)
      return FALSE;
    list = g_list_next (list);
  }

  return TRUE;
}

static gboolean
gst_wavenc_parse_cue (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry)
{
  gint64 start;
  GstWavEncCue *cue;

  g_return_val_if_fail (entry != NULL, FALSE);

  gst_toc_entry_get_start_stop_times (entry, &start, NULL);

  cue = g_new (GstWavEncCue, 1);
  cue->id = id;
  cue->position = gst_util_uint64_scale_round (start, wavenc->rate, GST_SECOND);
  memcpy (cue->data_chunk_id, "data", 4);
  cue->chunk_start = 0;
  cue->block_start = 0;
  cue->sample_offset = cue->position;
  wavenc->cues = g_list_append (wavenc->cues, cue);

  return TRUE;
}

static gboolean
gst_wavenc_parse_labl (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry)
{
  gchar *tag;
  GstTagList *tags;
  GstWavEncLabl *labl;

  g_return_val_if_fail (entry != NULL, FALSE);

  tags = gst_toc_entry_get_tags (entry);
  if (!tags) {
    GST_INFO_OBJECT (wavenc, "no tags for entry: %d", id);
    return FALSE;
  }
  if (!gst_tag_list_get_string (tags, GST_TAG_TITLE, &tag)) {
    GST_INFO_OBJECT (wavenc, "no title tag for entry: %d", id);
    return FALSE;
  }

  labl = g_new (GstWavEncLabl, 1);
  memcpy (labl->chunk_id, "labl", 4);
  labl->chunk_data_size = 4 + strlen (tag) + 1;
  labl->cue_point_id = id;
  labl->text = tag;

  GST_DEBUG_OBJECT (wavenc, "got labl: '%s'", tag);

  wavenc->labls = g_list_append (wavenc->labls, labl);

  return TRUE;
}

static gboolean
gst_wavenc_parse_note (GstWavEnc * wavenc, guint32 id, GstTocEntry * entry)
{
  gchar *tag;
  GstTagList *tags;
  GstWavEncNote *note;

  g_return_val_if_fail (entry != NULL, FALSE);
  tags = gst_toc_entry_get_tags (entry);
  if (!tags) {
    GST_INFO_OBJECT (wavenc, "no tags for entry: %d", id);
    return FALSE;
  }
  if (!gst_tag_list_get_string (tags, GST_TAG_COMMENT, &tag)) {
    GST_INFO_OBJECT (wavenc, "no comment tag for entry: %d", id);
    return FALSE;
  }

  note = g_new (GstWavEncNote, 1);
  memcpy (note->chunk_id, "note", 4);
  note->chunk_data_size = 4 + strlen (tag) + 1;
  note->cue_point_id = id;
  note->text = tag;

  GST_DEBUG_OBJECT (wavenc, "got note: '%s'", tag);

  wavenc->notes = g_list_append (wavenc->notes, note);

  return TRUE;
}

static gboolean
gst_wavenc_write_cues (guint8 ** data, GList * list)
{
  GstWavEncCue *cue;

  while (list) {
    cue = list->data;
    GST_WRITE_UINT32_LE (*data, cue->id);
    GST_WRITE_UINT32_LE (*data + 4, cue->position);
    memcpy (*data + 8, (gchar *) cue->data_chunk_id, 4);
    GST_WRITE_UINT32_LE (*data + 12, cue->chunk_start);
    GST_WRITE_UINT32_LE (*data + 16, cue->block_start);
    GST_WRITE_UINT32_LE (*data + 20, cue->sample_offset);
    *data += 24;
    list = g_list_next (list);
  }

  return TRUE;
}

static gboolean
gst_wavenc_write_labls (guint8 ** data, GList * list)
{
  GstWavEncLabl *labl;

  while (list) {
    labl = list->data;
    memcpy (*data, (gchar *) labl->chunk_id, 4);
    GST_WRITE_UINT32_LE (*data + 4, labl->chunk_data_size);
    GST_WRITE_UINT32_LE (*data + 8, labl->cue_point_id);
    memcpy (*data + 12, (gchar *) labl->text, strlen (labl->text));
    *data += 8 + GST_ROUND_UP_2 (labl->chunk_data_size);
    list = g_list_next (list);
  }

  return TRUE;
}

static gboolean
gst_wavenc_write_notes (guint8 ** data, GList * list)
{
  GstWavEncNote *note;

  while (list) {
    note = list->data;
    memcpy (*data, (gchar *) note->chunk_id, 4);
    GST_WRITE_UINT32_LE (*data + 4, note->chunk_data_size);
    GST_WRITE_UINT32_LE (*data + 8, note->cue_point_id);
    memcpy (*data + 12, (gchar *) note->text, strlen (note->text));
    *data += 8 + GST_ROUND_UP_2 (note->chunk_data_size);
    list = g_list_next (list);
  }

  return TRUE;
}

static GstFlowReturn
gst_wavenc_write_toc (GstWavEnc * wavenc)
{
  GList *list;
  GstToc *toc;
  GstTocEntry *entry, *subentry;
  GstBuffer *buf;
  GstMapInfo map;
  guint8 *data;
  guint32 ncues, size, cues_size, labls_size, notes_size;

  if (!wavenc->toc) {
    GST_DEBUG_OBJECT (wavenc, "have no toc, checking toc_setter");
    wavenc->toc = gst_toc_setter_get_toc (GST_TOC_SETTER (wavenc));
  }
  if (!wavenc->toc) {
    GST_WARNING_OBJECT (wavenc, "have no toc");
    return GST_FLOW_OK;
  }

  toc = gst_toc_ref (wavenc->toc);
  size = 0;
  cues_size = 0;
  labls_size = 0;
  notes_size = 0;

  /* check if the TOC entries is valid */
  list = gst_toc_get_entries (toc);
  entry = list->data;
  if (gst_toc_entry_is_alternative (entry)) {
    list = gst_toc_entry_get_sub_entries (entry);
    while (list) {
      subentry = list->data;
      if (!gst_toc_entry_is_sequence (subentry))
        return FALSE;
      list = g_list_next (list);
    }
    list = gst_toc_entry_get_sub_entries (entry);
  }
  if (gst_toc_entry_is_sequence (entry)) {
    while (list) {
      entry = list->data;
      if (!gst_toc_entry_is_sequence (entry))
        return FALSE;
      list = g_list_next (list);
    }
    list = gst_toc_get_entries (toc);
  }

  ncues = g_list_length (list);
  GST_DEBUG_OBJECT (wavenc, "number of cue entries: %d", ncues);

  while (list) {
    guint32 id = 0;
    gint64 id64;
    const gchar *uid;

    entry = list->data;
    uid = gst_toc_entry_get_uid (entry);
    id64 = g_ascii_strtoll (uid, NULL, 0);
    /* check if id unique compatible with guint32 else generate random */
    if (id64 >= 0 && gst_wavenc_is_cue_id_unique (id64, wavenc->cues)) {
      id = (guint32) id64;
    } else {
      do {
        id = g_random_int ();
      } while (!gst_wavenc_is_cue_id_unique (id, wavenc->cues));
    }
    gst_wavenc_parse_cue (wavenc, id, entry);
    gst_wavenc_parse_labl (wavenc, id, entry);
    gst_wavenc_parse_note (wavenc, id, entry);
    list = g_list_next (list);
  }

  /* count cues size */
  if (wavenc->cues) {
    cues_size = 24 * g_list_length (wavenc->cues);
    size += 12 + cues_size;
  } else {
    GST_WARNING_OBJECT (wavenc, "cue's not found");
    return FALSE;
  }
  /* count labls size */
  if (wavenc->labls) {
    list = wavenc->labls;
    while (list) {
      GstWavEncLabl *labl;
      labl = list->data;
      labls_size += 8 + GST_ROUND_UP_2 (labl->chunk_data_size);
      list = g_list_next (list);
    }
    size += labls_size;
  }
  /* count notes size */
  if (wavenc->notes) {
    list = wavenc->notes;
    while (list) {
      GstWavEncNote *note;
      note = list->data;
      notes_size += 8 + GST_ROUND_UP_2 (note->chunk_data_size);
      list = g_list_next (list);
    }
    size += notes_size;
  }
  if (wavenc->labls || wavenc->notes) {
    size += 12;
  }

  buf = gst_buffer_new_and_alloc (size);
  gst_buffer_map (buf, &map, GST_MAP_WRITE);
  data = map.data;
  memset (data, 0, size);

  /* write Cue Chunk */
  if (wavenc->cues) {
    memcpy (data, (gchar *) "cue ", 4);
    GST_WRITE_UINT32_LE (data + 4, 4 + cues_size);
    GST_WRITE_UINT32_LE (data + 8, ncues);
    data += 12;
    gst_wavenc_write_cues (&data, wavenc->cues);

    /* write Associated Data List Chunk */
    if (wavenc->labls || wavenc->notes) {
      memcpy (data, (gchar *) "LIST", 4);
      GST_WRITE_UINT32_LE (data + 4, 4 + labls_size + notes_size);
      memcpy (data + 8, (gchar *) "adtl", 4);
      data += 12;
      if (wavenc->labls)
        gst_wavenc_write_labls (&data, wavenc->labls);
      if (wavenc->notes)
        gst_wavenc_write_notes (&data, wavenc->notes);
    }
  }

  /* free resources */
  if (toc)
    gst_toc_unref (toc);
  if (wavenc->cues)
    g_list_free_full (wavenc->cues, g_free);
  if (wavenc->labls)
    g_list_free_full (wavenc->labls, g_free);
  if (wavenc->notes)
    g_list_free_full (wavenc->notes, g_free);

  gst_buffer_unmap (buf, &map);
  wavenc->meta_length += gst_buffer_get_size (buf);

  return gst_pad_push (wavenc->srcpad, buf);
}

static gboolean
gst_wavenc_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
  gboolean res = TRUE;
  GstWavEnc *wavenc;
  GstTagList *tags;
  GstToc *toc;

  wavenc = GST_WAVENC (parent);

  switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_CAPS:
    {
      GstCaps *caps;

      gst_event_parse_caps (event, &caps);
      gst_wavenc_sink_setcaps (pad, caps);

      /* have our own src caps */
      gst_event_unref (event);
      break;
    }
    case GST_EVENT_EOS:
    {
      GstFlowReturn flow;
      GST_DEBUG_OBJECT (wavenc, "got EOS");

      flow = gst_wavenc_write_toc (wavenc);
      if (flow != GST_FLOW_OK) {
        GST_WARNING_OBJECT (wavenc, "error pushing toc: %s",
            gst_flow_get_name (flow));
      }
      flow = gst_wavenc_write_tags (wavenc);
      if (flow != GST_FLOW_OK) {
        GST_WARNING_OBJECT (wavenc, "error pushing tags: %s",
            gst_flow_get_name (flow));
      }

      /* write header with correct length values */
      gst_wavenc_push_header (wavenc);

      /* we're done with this file */
      wavenc->finished_properly = TRUE;

      /* and forward the EOS event */
      res = gst_pad_event_default (pad, parent, event);
      break;
    }
    case GST_EVENT_SEGMENT:
      /* Just drop it, it's probably in TIME format
       * anyway. We'll send our own newsegment event */
      gst_event_unref (event);
      break;
    case GST_EVENT_TOC:
      gst_event_parse_toc (event, &toc, NULL);
      if (toc) {
        if (wavenc->toc != toc) {
          if (wavenc->toc)
            gst_toc_unref (wavenc->toc);
          wavenc->toc = toc;
        } else {
          gst_toc_unref (toc);
        }
      }
      res = gst_pad_event_default (pad, parent, event);
      break;
    case GST_EVENT_TAG:
      gst_event_parse_tag (event, &tags);
      if (tags) {
        if (wavenc->tags != tags) {
          if (wavenc->tags)
            gst_tag_list_unref (wavenc->tags);
          wavenc->tags = gst_tag_list_ref (tags);
        }
      }
      res = gst_pad_event_default (pad, parent, event);
      break;
    default:
      res = gst_pad_event_default (pad, parent, event);
      break;
  }

  return res;
}

static GstFlowReturn
gst_wavenc_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
  GstWavEnc *wavenc = GST_WAVENC (parent);
  GstFlowReturn flow = GST_FLOW_OK;

  if (wavenc->channels <= 0) {
    GST_ERROR_OBJECT (wavenc, "Got data without caps");
    return GST_FLOW_NOT_NEGOTIATED;
  }

  if (G_UNLIKELY (!wavenc->sent_header)) {
    GstStructure *s;
    GstCaps *caps = gst_pad_get_allowed_caps (wavenc->srcpad);

    GST_DEBUG_OBJECT (wavenc, "allowed src caps: %" GST_PTR_FORMAT, caps);
    if (!gst_caps_is_fixed (caps)) {
      caps = gst_caps_truncate (caps);
    }
    s = gst_caps_get_structure (caps, 0);
    wavenc->use_rf64 = gst_structure_has_name (s, "audio/x-rf64");

    gst_pad_set_caps (wavenc->srcpad, caps);
    gst_caps_unref (caps);

    /* starting a file, means we have to finish it properly */
    wavenc->finished_properly = FALSE;

    /* push initial bogus header, it will be updated on EOS */
    flow = gst_wavenc_push_header (wavenc);
    if (flow != GST_FLOW_OK) {
      GST_WARNING_OBJECT (wavenc, "error pushing header: %s",
          gst_flow_get_name (flow));
      return flow;
    }
    GST_DEBUG_OBJECT (wavenc, "wrote dummy header");
    wavenc->audio_length = 0;
    wavenc->sent_header = TRUE;
  }

  GST_LOG_OBJECT (wavenc,
      "pushing %" G_GSIZE_FORMAT " bytes raw audio, ts=%" GST_TIME_FORMAT,
      gst_buffer_get_size (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));

  buf = gst_buffer_make_writable (buf);

  GST_BUFFER_OFFSET (buf) = get_header_len (wavenc) + wavenc->audio_length;
  GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET_NONE;

  wavenc->audio_length += gst_buffer_get_size (buf);

  if (wavenc->channel_mask != 0 &&
      !gst_audio_buffer_reorder_channels (buf, wavenc->audio_format,
          wavenc->channels, wavenc->srcPos, wavenc->destPos)) {
    GST_WARNING_OBJECT (wavenc, "Could not reorder channels");
  }

  flow = gst_pad_push (wavenc->srcpad, buf);

  return flow;
}

static GstStateChangeReturn
gst_wavenc_change_state (GstElement * element, GstStateChange transition)
{
  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
  GstWavEnc *wavenc = GST_WAVENC (element);

  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      wavenc->format = 0;
      wavenc->channels = 0;
      wavenc->width = 0;
      wavenc->rate = 0;
      /* use bogus size initially, we'll write the real
       * header when we get EOS and know the exact length */
      wavenc->audio_length = 0x7FFF0000;
      wavenc->meta_length = 0;
      wavenc->sent_header = FALSE;
      /* its true because we haven't writen anything */
      wavenc->finished_properly = TRUE;
      break;
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
  if (ret != GST_STATE_CHANGE_SUCCESS)
    return ret;

  switch (transition) {
    case GST_STATE_CHANGE_PAUSED_TO_READY:
      if (!wavenc->finished_properly) {
        GST_ELEMENT_WARNING (wavenc, STREAM, MUX,
            ("Wav stream not finished properly"),
            ("Wav stream not finished properly, no EOS received "
                "before shutdown"));
      }
      break;
    case GST_STATE_CHANGE_READY_TO_NULL:
      GST_DEBUG_OBJECT (wavenc, "tags: %p", wavenc->tags);
      if (wavenc->tags) {
        gst_tag_list_unref (wavenc->tags);
        wavenc->tags = NULL;
      }
      GST_DEBUG_OBJECT (wavenc, "toc: %p", wavenc->toc);
      if (wavenc->toc) {
        gst_toc_unref (wavenc->toc);
        wavenc->toc = NULL;
      }
      gst_tag_setter_reset_tags (GST_TAG_SETTER (wavenc));
      gst_toc_setter_reset (GST_TOC_SETTER (wavenc));
      break;
    default:
      break;
  }

  return ret;
}

static gboolean
plugin_init (GstPlugin * plugin)
{
  return gst_element_register (plugin, "wavenc", GST_RANK_PRIMARY,
      GST_TYPE_WAVENC);
}

GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
    GST_VERSION_MINOR,
    wavenc,
    "Encode raw audio into WAV",
    plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)


text:
if (typeof mihaildev == "undefined" || !mihaildev) {
    var mihaildev = {};
}

mihaildev.elFinder = {
    openManager: function(options){
        var params = "menubar=no,toolbar=no,location=no,directories=no,status=no,fullscreen=no";
        if(options.width == 'auto'){
            options.width = $(window).width()/1.5;
        }

        if(options.height == 'auto'){
            options.height = $(window).height()/1.5;
        }

        params = params + ",width=" + options.width;
        params = params + ",height=" + options.height;

        console.log(params);
        var win = window.open(options.url, 'ElFinderManager' + options.id, params);
        win.focus()
    },
    functions: {},
    register: function(id, func){
        this.functions[id] = func;
    },
    callFunction: function(id, file){
        return this.functions[id](file, id);
    },
    functionReturnToInput: function(file, id){
        jQuery('#' + id).val(file.url);
        return true;
    }
};


text:
<button mat-raised-button appHttpAction class="mat-primary" [type]="buttonType" [disabled]="disabled" [title]="'Save' | translate" aria-label="Save">

  Save
</button>


text:
RSpec.describe FiniteMachine, ".new" do
  context "with block" do
    it "creates system state machine" do
      fsm = FiniteMachine.new do
        initial :green

        event :slow,  :green  => :yellow
        event :stop,  :yellow => :red
        event :ready, :red    => :yellow
        event :go,    :yellow => :green
      end

      expect(fsm.current).to eql(:green)

      fsm.slow
      expect(fsm.current).to eql(:yellow)
      fsm.stop
      expect(fsm.current).to eql(:red)
      fsm.ready
      expect(fsm.current).to eql(:yellow)
      fsm.go
      expect(fsm.current).to eql(:green)
    end
  end

  context "without block" do
    it "creates state machine" do
      called = []
      fsm = FiniteMachine.new
      fsm.initial(:green)
      fsm.event(:slow, :green => :yellow)
      fsm.event(:stop, :yellow => :red)
      fsm.event(:ready,:red    => :yellow)
      fsm.event(:go,   :yellow => :green)
      fsm.on_enter(:yellow) { |event| called << "on_enter_yellow" }
      fsm.handle(FiniteMachine::InvalidStateError) { |exception|
        called << "error_handler"
      }
      fsm.init
      expect(fsm.current).to eql(:green)
      fsm.slow
      expect(fsm.current).to eql(:yellow)
      fsm.ready
      expect(fsm.current).to eql(:yellow)
      expect(called).to match_array(["on_enter_yellow", "error_handler"])
    end
  end
end


text:
"""create users table

Revision ID: dcf2d0a5242
Revises: None
Create Date: 2015-12-17 19:22:36.977216

"""

# revision identifiers, used by Alembic.
revision = 'dcf2d0a5242'
down_revision = None

from alembic import op
import sqlalchemy as sa

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('url', sa.String(length=255), nullable=False),
    sa.Column('first_name', sa.String(length=255), nullable=True),
    sa.Column('last_name', sa.String(length=255), nullable=True),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.Column('role', sa.String(length=255), nullable=True),
    sa.Column('permission_level', sa.Integer(), nullable=True),
    sa.Column('opening_mileage', sa.Numeric(precision=10, scale=2), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('url')
    )
    ### end Alembic commands ###

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('users')
    ### end Alembic commands ###