text:
void RenderScene(void){

	glClear(GL_COLOR_BUFFER_BIT);
	glFlush();

}

void SetupRC(void){

	glClearColor(0.0f, 0.0f, 1.0f, 1.0f);

}

void main(void){

	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutCreateWindow("Simple");
	glutDisplayFunc(RenderScene);
	SetupRC();
	glutMainLoop();

}


text:
#include "fsl_lpuart_freertos.h"
#include <FreeRTOS.h>
#include <event_groups.h>
#include <semphr.h>

/* Component ID definition, used by tools. */
#ifndef FSL_COMPONENT_ID
#define FSL_COMPONENT_ID "platform.drivers.lpuart_freertos"
#endif

static void LPUART_RTOS_Callback(LPUART_Type *base, lpuart_handle_t *state, status_t status, void *param)
{
    lpuart_rtos_handle_t *handle = (lpuart_rtos_handle_t *)param;
    BaseType_t xHigherPriorityTaskWoken, xResult;

    xHigherPriorityTaskWoken = pdFALSE;
    xResult = pdFAIL;

    if (status == kStatus_LPUART_RxIdle)
    {
        xResult = xEventGroupSetBitsFromISR(handle->rxEvent, RTOS_LPUART_COMPLETE, &xHigherPriorityTaskWoken);
    }
    else if (status == kStatus_LPUART_TxIdle)
    {
        xResult = xEventGroupSetBitsFromISR(handle->txEvent, RTOS_LPUART_COMPLETE, &xHigherPriorityTaskWoken);
    }
    else if (status == kStatus_LPUART_RxRingBufferOverrun)
    {
        xResult =
            xEventGroupSetBitsFromISR(handle->rxEvent, RTOS_LPUART_RING_BUFFER_OVERRUN, &xHigherPriorityTaskWoken);
    }
    else if (status == kStatus_LPUART_RxHardwareOverrun)
    {
        /* Clear Overrun flag (OR) in LPUART STAT register */
        LPUART_ClearStatusFlags(base, kLPUART_RxOverrunFlag);
        xResult =
            xEventGroupSetBitsFromISR(handle->rxEvent, RTOS_LPUART_HARDWARE_BUFFER_OVERRUN, &xHigherPriorityTaskWoken);
    }

    if (xResult != pdFAIL)
    {
        portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
    }
}

/*FUNCTION**********************************************************************
 *
 * Function Name : LPUART_RTOS_Init
 * Description   : Initializes the LPUART instance for application
 *
 *END**************************************************************************/
int LPUART_RTOS_Init(lpuart_rtos_handle_t *handle, lpuart_handle_t *t_handle, const lpuart_rtos_config_t *cfg)
{
    lpuart_config_t defcfg;

    if (NULL == handle)
    {
        return kStatus_InvalidArgument;
    }
    if (NULL == t_handle)
    {
        return kStatus_InvalidArgument;
    }
    if (NULL == cfg)
    {
        return kStatus_InvalidArgument;
    }
    if (NULL == cfg->base)
    {
        return kStatus_InvalidArgument;
    }
    if (0 == cfg->srcclk)
    {
        return kStatus_InvalidArgument;
    }
    if (0 == cfg->baudrate)
    {
        return kStatus_InvalidArgument;
    }

    handle->base = cfg->base;
    handle->t_state = t_handle;
#if (configSUPPORT_STATIC_ALLOCATION == 1)
    handle->txSemaphore = xSemaphoreCreateMutexStatic(&handle->txSemaphoreBuffer);
#else
    handle->txSemaphore = xSemaphoreCreateMutex();
#endif
    if (NULL == handle->txSemaphore)
    {
        return kStatus_Fail;
    }
#if (configSUPPORT_STATIC_ALLOCATION == 1)
    handle->rxSemaphore = xSemaphoreCreateMutexStatic(&handle->rxSemaphoreBuffer);
#else
    handle->rxSemaphore = xSemaphoreCreateMutex();
#endif
    if (NULL == handle->rxSemaphore)
    {
        vSemaphoreDelete(handle->txSemaphore);
        return kStatus_Fail;
    }
#if (configSUPPORT_STATIC_ALLOCATION == 1)
    handle->txEvent = xEventGroupCreateStatic(&handle->txEventBuffer);
#else
    handle->txEvent = xEventGroupCreate();
#endif
    if (NULL == handle->txEvent)
    {
        vSemaphoreDelete(handle->rxSemaphore);
        vSemaphoreDelete(handle->txSemaphore);
        return kStatus_Fail;
    }
#if (configSUPPORT_STATIC_ALLOCATION == 1)
    handle->rxEvent = xEventGroupCreateStatic(&handle->rxEventBuffer);
#else
    handle->rxEvent = xEventGroupCreate();
#endif
    if (NULL == handle->rxEvent)
    {
        vEventGroupDelete(handle->txEvent);
        vSemaphoreDelete(handle->rxSemaphore);
        vSemaphoreDelete(handle->txSemaphore);
        return kStatus_Fail;
    }
    LPUART_GetDefaultConfig(&defcfg);

    defcfg.baudRate_Bps = cfg->baudrate;
    defcfg.parityMode = cfg->parity;
    defcfg.stopBitCount = cfg->stopbits;

    LPUART_Init(handle->base, &defcfg, cfg->srcclk);
    LPUART_TransferCreateHandle(handle->base, handle->t_state, LPUART_RTOS_Callback, handle);
    LPUART_TransferStartRingBuffer(handle->base, handle->t_state, cfg->buffer, cfg->buffer_size);

    LPUART_EnableTx(handle->base, true);
    LPUART_EnableRx(handle->base, true);

    return 0;
}

/*FUNCTION**********************************************************************
 *
 * Function Name : LPUART_RTOS_Deinit
 * Description   : Deinitializes the LPUART instance and frees resources
 *
 *END**************************************************************************/
int LPUART_RTOS_Deinit(lpuart_rtos_handle_t *handle)
{
    LPUART_Deinit(handle->base);

    vEventGroupDelete(handle->txEvent);
    vEventGroupDelete(handle->rxEvent);

    /* Give the semaphore. This is for functional safety */
    xSemaphoreGive(handle->txSemaphore);
    xSemaphoreGive(handle->rxSemaphore);

    vSemaphoreDelete(handle->txSemaphore);
    vSemaphoreDelete(handle->rxSemaphore);

    /* Invalidate the handle */
    handle->base = NULL;
    handle->t_state = NULL;

    return 0;
}

/*FUNCTION**********************************************************************
 *
 * Function Name : UART_RTOS_Send
 * Description   : Initializes the UART instance for application
 *
 *END**************************************************************************/
int LPUART_RTOS_Send(lpuart_rtos_handle_t *handle, const uint8_t *buffer, uint32_t length)
{
    EventBits_t ev;
    int retval = kStatus_Success;

    if (NULL == handle->base)
    {
        /* Invalid handle. */
        return kStatus_Fail;
    }
    if (0 == length)
    {
        return 0;
    }
    if (NULL == buffer)
    {
        return kStatus_InvalidArgument;
    }

    if (pdFALSE == xSemaphoreTake(handle->txSemaphore, 0))
    {
        /* We could not take the semaphore, exit with 0 data received */
        return kStatus_Fail;
    }

    handle->txTransfer.data = (uint8_t *)buffer;
    handle->txTransfer.dataSize = (uint32_t)length;

    /* Non-blocking call */
    LPUART_TransferSendNonBlocking(handle->base, handle->t_state, &handle->txTransfer);

    ev = xEventGroupWaitBits(handle->txEvent, RTOS_LPUART_COMPLETE, pdTRUE, pdFALSE, portMAX_DELAY);
    if (!(ev & RTOS_LPUART_COMPLETE))
    {
        retval = kStatus_Fail;
    }

    if (pdFALSE == xSemaphoreGive(handle->txSemaphore))
    {
        /* We could not post the semaphore, exit with error */
        retval = kStatus_Fail;
    }

    return retval;
}

/*FUNCTION**********************************************************************
 *
 * Function Name : LPUART_RTOS_Recv
 * Description   : Receives chars for the application
 *
 *END**************************************************************************/
int LPUART_RTOS_Receive(lpuart_rtos_handle_t *handle, uint8_t *buffer, uint32_t length, size_t *received)
{
    EventBits_t ev;
    size_t n = 0;
    int retval = kStatus_Fail;
    size_t local_received = 0;

    if (NULL == handle->base)
    {
        /* Invalid handle. */
        return kStatus_Fail;
    }
    if (0 == length)
    {
        if (received != NULL)
        {
            *received = n;
        }
        return 0;
    }
    if (NULL == buffer)
    {
        return kStatus_InvalidArgument;
    }

    /* New transfer can be performed only after current one is finished */
    if (pdFALSE == xSemaphoreTake(handle->rxSemaphore, portMAX_DELAY))
    {
        /* We could not take the semaphore, exit with 0 data received */
        return kStatus_Fail;
    }

    handle->rxTransfer.data = buffer;
    handle->rxTransfer.dataSize = (uint32_t)length;

    /* Non-blocking call */
    LPUART_TransferReceiveNonBlocking(handle->base, handle->t_state, &handle->rxTransfer, &n);

    ev = xEventGroupWaitBits(
        handle->rxEvent, RTOS_LPUART_COMPLETE | RTOS_LPUART_RING_BUFFER_OVERRUN | RTOS_LPUART_HARDWARE_BUFFER_OVERRUN,
        pdTRUE, pdFALSE, portMAX_DELAY);
    if (ev & RTOS_LPUART_HARDWARE_BUFFER_OVERRUN)
    {
        /* Stop data transfer to application buffer, ring buffer is still active */
        LPUART_TransferAbortReceive(handle->base, handle->t_state);
        /* Prevent false indication of successful transfer in next call of LPUART_RTOS_Receive.
           RTOS_LPUART_COMPLETE flag could be set meanwhile overrun is handled */
        xEventGroupClearBits(handle->rxEvent, RTOS_LPUART_COMPLETE);
        retval = kStatus_LPUART_RxHardwareOverrun;
        local_received = 0;
    }
    else if (ev & RTOS_LPUART_RING_BUFFER_OVERRUN)
    {
        /* Stop data transfer to application buffer, ring buffer is still active */
        LPUART_TransferAbortReceive(handle->base, handle->t_state);
        /* Prevent false indication of successful transfer in next call of LPUART_RTOS_Receive.
           RTOS_LPUART_COMPLETE flag could be set meanwhile overrun is handled */
        xEventGroupClearBits(handle->rxEvent, RTOS_LPUART_COMPLETE);
        retval = kStatus_LPUART_RxRingBufferOverrun;
        local_received = 0;
    }
    else if (ev & RTOS_LPUART_COMPLETE)
    {
        retval = kStatus_Success;
        local_received = length;
    }

    /* Prevent repetitive NULL check */
    if (received != NULL)
    {
        *received = local_received;
    }

    /* Enable next transfer. Current one is finished */
    if (pdFALSE == xSemaphoreGive(handle->rxSemaphore))
    {
        /* We could not post the semaphore, exit with error */
        retval = kStatus_Fail;
    }
    return retval;
}

redpajama_set_name: RedPajamaGithub


text:
package io.rapidpro.flows.runner;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.rapidpro.expressions.EvaluationContext;
import io.rapidpro.expressions.evaluator.Conversions;
import io.rapidpro.expressions.utils.ExpressionUtils;
import io.rapidpro.flows.definition.Flow;
import io.rapidpro.flows.definition.RuleSet;
import io.rapidpro.flows.utils.FlowUtils;
import io.rapidpro.flows.utils.JsonUtils;
import io.rapidpro.flows.utils.Jsonizable;
import org.apache.commons.lang3.StringUtils;
import org.threeten.bp.Instant;
import org.threeten.bp.LocalDate;
import org.threeten.bp.ZonedDateTime;
import org.threeten.bp.temporal.ChronoUnit;

import java.util.*;

/**
 * Represents state of a flow run after visiting one or more nodes in the flow
 */
public class RunState implements Jsonizable {

    public enum State {
        IN_PROGRESS,
        COMPLETED,
        WAIT_AUDIO,
        WAIT_MESSAGE,
        WAIT_PHOTO,
        WAIT_GPS,
        WAIT_VIDEO
    }

    protected Org m_org;

    protected List<Field> m_fields;

    protected Contact m_contact;

    protected Instant m_started;

    protected List<Step> m_steps;

    protected List<Map<String, Value>> m_values;

    protected Map<String, String> m_extra;

    protected State m_state;

    protected Map<String,Flow> m_flows;

    protected List<Flow> m_activeFlows;

    protected List<Step> m_suspendedSteps;

    protected int m_level;

    /**
     * Creates a run state for a new run by the given contact in the given flow
     * @param org the org
     * @param fields the contact fields
     * @param contact the contact
     */
    public RunState(Org org, List<Field> fields, Contact contact, Map<String,Flow> flows) {
        this.m_org = org;
        this.m_fields = fields;
        this.m_contact = contact;
        this.m_started = Instant.now();
        this.m_steps = new ArrayList<>();
        this.m_extra = new HashMap<>();
        this.m_state = State.IN_PROGRESS;
        this.m_flows = flows;
        this.m_level = 0;
        this.m_activeFlows = new ArrayList<>();
        this.m_suspendedSteps = new ArrayList<>();

        // our current level of values
        this.m_values = new ArrayList<>();
        this.m_values.add(new HashMap<String, Value>());
    }

    public static Map<String,Flow> buildFlowMap(Flow flow) {
        Map<String,Flow> flows = new HashMap<>();
        flows.put(flow.getUuid(), flow);
        return flows;
    }

    /**
     * Restores a run state from JSON
     * @param json the JSON containing a serialized run state
     * @param flows the flows the run state is for
     * @return the run state
     */
    public static RunState fromJson(String json, Map<String,Flow> flows) {
        JsonObject obj = JsonUtils.getGson().fromJson(json, JsonObject.class);
        Flow.DeserializationContext context = new Flow.DeserializationContext(flows);

        RunState run = new RunState(
                Org.fromJson(obj.get("org")),
                JsonUtils.fromJsonArray(obj.get("fields").getAsJsonArray(), null, Field.class),
                Contact.fromJson(obj.get("contact")),
                flows
        );

        // load up our active flows
        List<String> flowUuids = JsonUtils.fromJsonArray(obj.get("active_flows").getAsJsonArray(), null, String.class);
        List<Flow> activeFlows = new ArrayList<>();
        for (String flowUuid : flowUuids) {
            activeFlows.add(flows.get(flowUuid));
        }

        run.m_started = ExpressionUtils.parseJsonDate(JsonUtils.getAsString(obj, "started"));
        run.m_steps = JsonUtils.fromJsonArray(obj.get("steps").getAsJsonArray(), context, Step.class);
        run.m_values = JsonUtils.fromJsonObjectArray(obj.get("values").getAsJsonArray(), null, Value.class);
        run.m_extra = JsonUtils.fromJsonObject(obj.get("extra").getAsJsonObject(), null, String.class);
        run.m_state = State.valueOf(obj.get("state").getAsString().toUpperCase());
        run.m_level = obj.get("level").getAsInt();
        run.m_suspendedSteps = JsonUtils.fromJsonArray(obj.get("suspended_steps").getAsJsonArray(), context, Step.class);
        run.m_activeFlows = activeFlows;

        return run;
    }

    /**
     * Serializes this run state to JSON
     * @return the JSON
     */
    @Override
    public JsonElement toJson() {

        // get a list of active flow uuids
        List<String> flowUuids = new ArrayList<>();
        for (Flow flow : m_activeFlows) {
            flowUuids.add(flow.getUuid());
        }

        return JsonUtils.object(
                "org", m_org.toJson(),
                "fields", JsonUtils.toJsonArray(m_fields),
                "contact", m_contact.toJson(),
                "started", ExpressionUtils.formatJsonDate(m_started),
                "steps", JsonUtils.toJsonArray(m_steps),
                "values", toJsonObjectArray(m_values),
                "extra", JsonUtils.toJsonObject(m_extra),
                "state", m_state.name().toLowerCase(),
                "active_flows", JsonUtils.toJsonArray(flowUuids),
                "suspended_steps", JsonUtils.toJsonArray(m_suspendedSteps),
                "level", m_level
        );
    }

    /**
     * Helper to write out our list of value maps as JSON
     */
    private JsonArray toJsonObjectArray(Iterable<Map<String, Value>> values) {
        JsonArray arr = new JsonArray();
        for (Map<String, ?> item : values) {
            arr.add(JsonUtils.toJsonObject(item));
        }
        return arr;
    }

    /**
     * Serializes this run state to a JSON string
     * @return the JSON
     */
    public String toJsonString() {
        return JsonUtils.getGson().toJson(toJson());
    }

    /**
     * Sets the active flow by pushing on to our list of flows
     * @param activeFlow
     */
    public void setActiveFlow(Flow activeFlow) {
        this.m_activeFlows.add(activeFlow);
    }

    /**
     * Builds the top-level evaluation context (all variables, date information)
     * @param input the current input
     * @return the context
     */
    public EvaluationContext buildContext(Runner runner, Input input) {
        // our concept of now may be overridden by the runner
        Instant now = runner.getNow() != null ? runner.getNow() : Instant.now();

        EvaluationContext context = new EvaluationContext(new HashMap<String, Object>(), m_org.getTimezone(), m_org.getDateStyle(), now);

        Map<String, String> contactContext = m_contact.buildContext(this, context);

        if (input != null) {
            context.putVariable("step", input.buildContext(context, contactContext));
        }

        context.putVariable("date", buildDateContext(context));
        context.putVariable("contact", contactContext);
        context.putVariable("extra", m_extra);
        context.putVariable("flow", buildFlowContext(getValues(), context));

        // add the flow that was one level above us
        if (m_level > 0) {
            context.putVariable("parent", buildFlowContext(m_values.get(m_level - 1), context));
        }

        // if we have a child below us, add that context in too
        if (m_values.size() > m_level + 1) {
            context.putVariable("child", buildFlowContext(m_values.get(m_level + 1), context));
        }

        return context;
    }

    /**
     * Builds up a flow context from a set of flow values
     */
    private Map<String,Object> buildFlowContext(Map<String,Value> flowValues, EvaluationContext context) {
        Map<String, Object> flowContext = new HashMap<>();
        List<String> values = new ArrayList<>();
        for (Map.Entry<String, Value> entry : flowValues.entrySet()) {
            flowContext.put(entry.getKey(), entry.getValue().buildContext(context));
            values.add(entry.getKey() + ": " + entry.getValue().getValue());
        }
        flowContext.put("*", StringUtils.join(values, "\n"));
        return flowContext;
    }

    /**
     * Updates a value in response to a rule match
     * @param ruleSet the rule set
     * @param result the rule match result
     * @param time the time from the input
     */
    public void updateValue(RuleSet ruleSet, RuleSet.Result result, Instant time) {
        String key = ruleSet.getLabel().toLowerCase().replaceAll("[^a-z0-9]+", "_");
        getValues().put(key, new Value(result.getValue(), result.getCategory(), result.getText(), time));
    }

    /**
     * Enters a subflow. Suspends the current step and pushes the provided
     * flow on to our active flow list.
     * @param currentStep the step to suspend until completion of the subflow
     * @param flowUuid the flow start
     */
    public void enterSubflow(Step currentStep, String flowUuid) {
        m_level++;
        m_suspendedSteps.add(currentStep);

        setActiveFlow(m_flows.get(flowUuid));

        // wipe any existing values at our new level
        getValues().clear();

    }

    /**
     * Exits our current subflow, going back to the parent.
     * @return the most recently suspended step
     */
    public Step exitSubflow() {
        m_level--;
        m_activeFlows.remove(m_activeFlows.size() - 1);
        return m_suspendedSteps.remove(m_suspendedSteps.size() - 1);
    }

    /**
     * Builds the date context (i.e. @date.now, @date.today, ...)
     */
    protected static Map<String, String> buildDateContext(EvaluationContext container) {
        ZonedDateTime asDateTime = container.getNow().atZone(container.getTimezone());
        LocalDate asDate = asDateTime.toLocalDate();
        String asDateTimeStr = Conversions.toString(asDateTime, container);
        String asDateStr = Conversions.toString(asDate, container);

        Map<String, String> dateContext = new HashMap<>();
        dateContext.put("*", asDateTimeStr);
        dateContext.put("now", asDateTimeStr);
        dateContext.put("today", asDateStr);
        dateContext.put("tomorrow", Conversions.toString(asDate.plus(1, ChronoUnit.DAYS), container));
        dateContext.put("yesterday", Conversions.toString(asDate.minus(1, ChronoUnit.DAYS), container));
        return dateContext;
    }

    public Org getOrg() {
        return m_org;
    }

    public Field getOrCreateField(String key) {
        return getOrCreateField(key, null, Field.ValueType.TEXT);
    }

    public Field getOrCreateField(String key, String label) {
        return getOrCreateField(key, label, Field.ValueType.TEXT);
    }

    public Field getOrCreateField(String key, String label, Field.ValueType valueType) {
        if (key == null && label == null) {
            throw new RuntimeException("Must provide either key or label");
        }

        if (key != null) {
            // TODO get this into a map for efficiency
            for (Field field : m_fields) {
                if (field.getKey().equals(key)) {
                    return field;
                }
            }
        } else {
            key = Field.makeKey(label);
        }

        if (label == null) {
            label = FlowUtils.title(key.replaceAll("([^A-Za-z0-9- ]+)", " "));
        }

        Field field = new Field(key, label, valueType, true);
        m_fields.add(field);
        return field;
    }

    public List<Field> getCreatedFields() {
        List<Field> created = new ArrayList<>();
        for (Field field : m_fields) {
            if (field.isNew()) {
                created.add(field);
            }
        }
        return created;
    }

    public Contact getContact() {
        return m_contact;
    }

    public Flow getActiveFlow() {
        return m_activeFlows.get(m_activeFlows.size() - 1);
    }

    public Instant getStarted() {
        return m_started;
    }

    public List<Step> getSteps() {
        return m_steps;
    }

    /**
     * Gets the completed steps, i.e. those where the contact left the node or a terminal node
     * @return the completed steps
     */
    public List<Step> getCompletedSteps() {
        List<Step> completed = new ArrayList<>();
        for (Step step : m_steps) {
            if (step.isCompleted()) {
                completed.add(step);
            }
        }
        return completed;
    }

    public void clearCompletedSteps() {
        List<Step> incomplete = new ArrayList<>();
        for (Step step : m_steps) {
            if (!step.isCompleted() && m_state != State.COMPLETED) {
                incomplete.add(step);
            }
        }
        m_steps = incomplete;
    }

    /**
     * Get the values at the current flow level
     */
    public Map<String, Value> getValues() {
        while (m_values.size() <= m_level) {
            m_values.add(new HashMap<String, Value>());
        }
        return m_values.get(m_level);
    }

    public Map<String, String> getExtra() {
        return m_extra;
    }

    public State getState() {
        return m_state;
    }

    public void setState(State state) {
        m_state = state;
    }
}


text:
/*jslint browser:true, ass:true, nomen:true, bitwise:true */

/**
 * Synlight DOM module
 *
 * @version 1.0.7
 * @licence Apache Licence 2.0
 * @author  Martin Helmut Fieber <info@martin-fieber.de>
 *
 * @param {Object} window
 * @param {Object} document
 */
window.S = (function (window, document) {
    'use strict';

    // Adapted from https://gist.github.com/paulirish/1579671 which derived from
    // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
    // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
    // requestAnimationFrame polyfill by Erik Möller.
    // Fixes from Paul Irish, Tino Zijdel, Andrew Mao, Klemen Slavič, Darius Bacon
    // MIT license
    (function () {
        var vendors = ['ms', 'moz', 'webkit', 'o'],
            vp,
            lastTime,
            i = 0;
        // Get browser vendor methods
        for (i = vendors.length - 1; i >= 0 && !window.requestAnimationFrame; i -= 1) {
            vp = vendors[i];
            window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
            window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame']);
        }
        // Create polyfill
        if (!window.requestAnimationFrame || !window.cancelAnimationFrame) {
            lastTime = 0;
            window.requestAnimationFrame = function (callback) {
                var now = +new Date(),
                    nextTime = Math.max(lastTime + 16, now);
                return setTimeout(function () {
                    callback(lastTime = nextTime);
                }, nextTime - now);
            };
            window.cancelAnimationFrame = clearTimeout;
        }
    }());

    /**
     * Attach function on elements
     *
     * @param {Element|NodeList|Array} el DOM element, node list or array with elements and node lists
     * @param {Function}               fn Callback
     */
    function attachToElement(el, fn) {
        var i;
        if ((el && el.nodeName) || el === window) {
            fn(el);
        } else if (el && el instanceof Array) {
            for (i = el.length - 1; i >= 0; i -= 1) {
                attachToElement(el[i], fn);
            }
        } else if (el && el.length) {
            for (i = el.length - 1; i >= 0; i -= 1) {
                fn(el[i]);
            }
        }
    }

    /**
     * Simple Array iteration for mixed types objects
     *
     * @param {Object}   obj  Any mixed object type
     * @param {Function} fn  Function to execute on array entry
     */
    function arrayIterator(obj, fn) {
        obj = Array.isArray(obj) ? obj : [obj];
        obj.forEach(fn);
    }

    /**
     * Get a class matcher RegExp
     *
     * @param  {String} cl Class name
     * @return {RegExp}    Regular Expression to match a class name
     */
    function getClassRegExp(cl) {
        return new RegExp('(?:\\s|^)' + cl + '(?:\\s|$)');
    }

    /**
     * Check if value is executable
     *
     * @param  {Function} fn Possible function
     * @return {Boolean}     Is executable
     */
    function isExecutable(fn) {
        return !!fn && typeof fn === 'function';
    }

    // Universal syndom cache object
    var cache = {
            // DOM element
            dom: [],
            // Async script load
            require: {
                settings: {},
                defined: {}
            }
        },

        /**
         * Query selector engine
         *
         * @param  {String}           selector Selector string
         * @param  {Element|Node}     context  Context search for elements
         * @param  {Boolean}          noCache  Don't use the cache, optional, default: false
         * @return {Element|NodeList}          DOM Element or NodeList
         */
        syndom = function (selector, context, noCache) {
            var match = !/\s/.test(selector) && {
                    '#': 'getElementById'
                }[selector[0]],
                i;
            context = context || document;
            noCache = !!noCache;
            // Search for saved selector / context combination in cache
            if (noCache === false) {
                for (i = cache.dom.length - 1; i >= 0; i -= 1) {
                    if (cache.dom[i].s === selector && cache.dom[i].c === context) {
                        return cache.dom[i].e;
                    }
                }
            }
            // Save cache object and return element
            return cache.dom[cache.dom.push({
                c: context,
                s: selector,
                e: context[match || 'querySelectorAll'](match ? selector.slice(1) : selector) // result
            }) - 1].e;
        },

        /**
         * Event listener
         *
         * @param {Element|NodeList} el   DOM element or node list
         * @param {String}           type Event type
         * @param {Function}         fn   Event callback
         */
        on = function (el, type, fn) {
            arrayIterator(type, function (type) {
                attachToElement(el, function (el) {
                    el.addEventListener(type, fn, false);
                });
            });
        },

        /**
         * Ajax
         *
         * @param {Object} settings Ajax settings object
         */
        ajax = function (settings) {
            var request = new XMLHttpRequest(),
                postData = null,
                data,
                header;

            settings.type = settings.type || 'GET';

            // Create post string data
            if (!!settings.data) {
                postData = '';
                for (data in settings.data) {
                    if (settings.data.hasOwnProperty(data)) {
                        postData += encodeURIComponent(data) + '=';
                        postData += encodeURIComponent(settings.data[data]) + '&';
                    }
                }
                postData.substr(0, postData.length - 1);
            }

            request.open(settings.type, settings.url, true);

            // Set basic HTTP headers
            request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
            request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');

            // Set custom headers
            if (!!settings.headers) {
                for (header in settings.headers) {
                    if (settings.headers.hasOwnProperty(header)) {
                        request.setRequestHeader(
                            header,
                            settings.headers[header]
                        );
                    }
                }
            }

            // Set load listener
            request.addEventListener('load', function () {
                if (request.status >= 200 && request.status < 400) {
                    // Successful request
                    if (isExecutable(settings.success)) {
                        settings.success(request);
                    }
                } else if (isExecutable(settings.error)) {
                    // Error on server
                    settings.error(request);
                }
            }, false);

            // Set error listener
            if (isExecutable(settings.error)) {
                request.addEventListener('error', settings.error, false);
            }

            request.send(postData);
        },

        /**
         * Has class method
         *
         * @param  {Element} el DOM element
         * @param  {String}  cl Class name
         * @return {Boolean}    Has class status
         */
        hasClass = function (el, cl) {
            return (!!el.className && el.className.match(getClassRegExp(cl)));
        },

        /**
         * Add class method
         *
         * @param {Element|NodeList|Array} el DOM element, node list or array with elements and node lists
         * @param {String|Array}              cl Class name or array with class names
         */
        addClass = function (el, cl) {
            arrayIterator(cl, function (cl) {
                attachToElement(el, function (el) {
                    if (!hasClass(el, cl)) {
                        el.className = (el.className += ' ' + cl).trim();
                    }
                });
            });
        },

        /**
         * Remove class method
         *
         * @param {Element|NodeList|Array} el DOM element, node list or array with elements and node lists
         * @param {String|Array}              cl Class name or array with class names
         */
        removeClass = function (el, cl) {
            arrayIterator(cl, function (cl) {
                var regex = getClassRegExp(cl);
                attachToElement(el, function (el) {
                    el.className = (el.className && el.className.replace(regex, ' ')).trim();
                });
            });
        },

        /**
         * Toggle class method
         *
         * @param {Element|NodeList|Array} el DOM element, node list or array with elements and node lists
         * @param {String|Array}              cl Class name or array with class names
         */
        toggleClass = function (el, cl) {
            arrayIterator(cl, function (cl) {
                attachToElement(el, function (el) {
                    if (hasClass(el, cl)) {
                        removeClass(el, cl);
                    } else {
                        addClass(el, cl);
                    }
                });
            });
        },

        /**
         * Get or set attribute on element
         *
         * @param  {Element} el    DOM element
         * @param  {String}  attr  Attribute name
         * @param  {String}  value Attribute value to set
         * @return {String}        Actual attribute value
         */
        attr = function (el, attr, value) {
            if (!value) {
                return el.getAttribute(attr);
            }
            return el.setAttribute(attr, value.toString());
        },

        /**
         * Remove elements
         *
         * @param  {Element|NodeList} el Dom element or node list to remove
         * @return {Element|NodeList}    Last removed element or node list
         */
        remove = function (el) {
            var rm = null;
            attachToElement(el, function (el) {
                rm = el.parentNode && el.parentNode.removeChild(el);
            });
            return rm;
        },

        /**
         * Flush the internal cache
         */
        flush = function () {
            cache.dom = [];
        },

        /**
         * Animate object
         *
         * @param {Array|Object} list Object or array with setting objects
         */
        animate = function (list) {
            var item,
                duration,
                end = 0,
                node,
                /**
                 * Single animation step
                 */
                step = function () {
                    var current   = +new Date(),
                        remaining = end - current,
                        rate;
                    if (remaining < 60) {
                        if (item) {
                            node = node || item.node;
                            item.run(node, 1); // 1 = progress is at 100%
                            if (isExecutable(item.callback)) {
                                item.callback(node);
                            }
                        }
                        item = list.shift(); // get the next item
                        if (item) {
                            node = item.node || node;
                            duration = item.time;
                            end = current + duration;
                            item.run(node, 0); // 0 = progress is at 0%
                        } else {
                            return;
                        }
                    } else {
                        rate = 1 - remaining / duration;
                        item.run(node || item.node, rate);
                    }
                    window.requestAnimationFrame(step);
                };
            if (!Array.isArray(list)) {
                list = [list];
            }
            // Start the animation
            step();
        },

        /**
         * Require script async
         *
         * @param {String}   name     Module name or path
         * @param {Function} callback Optional callback to trigger after load
         */
        require = function (name, callback) {
            var script = syndom('script')[0],
                scriptToAppend = document.createElement('script');
            // Trigger callback on load
            if (isExecutable(callback)) {
                on(scriptToAppend, 'load', function () {
                    // Execute callback with module parameter if defined
                    callback(
                        cache.require.defined[name]
                    );
                });
            }
            // Set the proper src attribute
            scriptToAppend.src = (
                (
                    cache.require.settings && (
                        cache.require.settings.basePath + (
                            cache.require.settings.modules[name] || name
                        )
                    )
                )
            ) + '.js';
            // Insert script tag
            script.parentNode.insertBefore(scriptToAppend, script);
        },

        /**
         * Define external module
         *
         * @param {String}   name     Module name
         * @param {Function} callback Module function body
         */
        define = function (name, callback) {
            if (isExecutable(callback)) {
                cache.require.defined[name] = callback();
            }
        },

        /**
         * Value to integer
         *
         * @param  {Object} value Mixed value
         * @return {Number}       Integer
         */
        intType = function (value) {
            return value | 0;
        },

        /**
         * Value to float
         *
         * @param  {Object} value Mixed value
         * @return {Number}       Float
         */
        floatType = function (value) {
            return +value;
        },

        /**
         * Value to string
         *
         * @param  {Object} value Mixed value
         * @return {String}       String
         */
        stringType = function (value) {
            return String(value);
        },

        /**
         * Value to boolean
         *
         * @param  {Object}  value Mixed value
         * @return {Boolean}       Boolean
         */
        boolType = function (value) {
            return !!value;
        };

    /**
     * Require configuration setter
     *
     * @param {Object} settings Settings object
     */
    require.config = function (settings) {
        // Create default settings
        var localBasePath = (settings.basePath || '');
        if (localBasePath[0] === '/') {
            localBasePath = window.location.origin + '/' + localBasePath.substring(0);
        }
        cache.require.settings.basePath = localBasePath;
        cache.require.settings.modules = settings.modules || {};
    };

    // Set public methods
    syndom.on              = on;
    syndom.ajax            = ajax;
    syndom.hasClass        = hasClass;
    syndom.addClass        = addClass;
    syndom.removeClass     = removeClass;
    syndom.toggleClass     = toggleClass;
    syndom.attr            = attr;
    syndom.remove          = remove;
    syndom.flush           = flush;
    syndom.animate         = animate;
    syndom.require         = require;
    syndom.define          = define;
    syndom.attachToElement = attachToElement;
    syndom.arrayIterator   = arrayIterator;
    syndom.int             = intType;
    syndom.float           = floatType;
    syndom.string          = stringType;
    syndom.bool            = boolType;

    // If jQuery is not set, use $ for backwards compatibility
    if (!window.$) {
        window.$ = syndom;
    }
    return syndom;

}(window, document));


text:
import React, { useState } from 'react'
import classNames from 'classnames'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import COLORS from '../../../constants/colors-config'
import TYPOGRAPHY from '../../../constants/typography-config'
import { pxToRem, stepToRem } from '../../../helpers/utils/typography'
import { LockIcon } from '../../graphics/icons/lock-icon'

const SwitchWrapper = styled.div`
  --toggleSwitch-width: ${pxToRem(60)};
  --toggleSwitch-height: ${pxToRem(30)};
  --toggleSwitch-border: var(--border-width);
  --toggleSwitch-borderRadius: var(--border-radius-rounded);
  --toggleSwitch-duration: 0.15s;

  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: ${pxToRem(10)};

  .k-ToggleSwitch--disabled {
    cursor: not-allowed;
  }
  .k-ToggleSwitch--reverseOrder {
    flex-direction: row-reverse;
  }
  .k-ToggleSwitch--locked .k-ToggleSwitch__button {
    color: var(--toggleSwitch-disabledColor);
    border-color: currentColor;
  }

  .k-ToggleSwitch__button {
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    width: var(--toggleSwitch-width);
    height: var(--toggleSwitch-height);
    color: var(--toggleSwitch-defaultColor);
    background-color: currentColor;
    border: var(--toggleSwitch-border) solid ${COLORS.line2};
    border-radius: var(--toggleSwitch-borderRadius);
    transition: color var(--toggleSwitch-duration) ease,
      border-color var(--toggleSwitch-duration) ease,
      background-color var(--toggleSwitch-duration) ease;
    cursor: pointer;

    &:focus {
      border-color: ${COLORS.primary1};

      .k-ToggleSwitch__circle {
        border-color: ${COLORS.primary1};
      }
    }

    .k-ToggleSwitch__circle {
      position: absolute;
      box-sizing: border-box;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      left: calc(-1 * var(--toggleSwitch-border));
      top: calc(-1 * var(--toggleSwitch-border));
      width: var(--toggleSwitch-height);
      height: var(--toggleSwitch-height);
      background-color: ${COLORS.background1};
      border: var(--toggleSwitch-border) solid ${COLORS.line2};
      border-radius: var(--border-radius-rounded);
      transition: left var(--toggleSwitch-duration) ease,
        color var(--toggleSwitch-duration) ease,
        border-color var(--toggleSwitch-duration) ease,
        background-color var(--toggleSwitch-duration) ease;
    }

    &[aria-pressed='true'] {
      color: var(--toggleSwitch-checkedColor);
      border-color: currentColor;

      .k-ToggleSwitch__circle {
        left: calc(
          var(--toggleSwitch-width) - var(--toggleSwitch-height) -
            var(--toggleSwitch-border)
        );
        border-color: currentColor;
      }
    }

    &:active {
      color: var(--toggleSwitch-activeColor);
      &,
      .k-ToggleSwitch__circle {
        border-color: var(--toggleSwitch-activeColor);
      }
    }

    &[disabled] {
      cursor: not-allowed;

      .k-ToggleSwitch__circle {
        pointer-events: none;
      }
    }
  }
  .k-ToggleSwitch__label {
    padding-left: ${pxToRem(10)};
    ${TYPOGRAPHY.fontStyles['400']}
    font-size: ${stepToRem(0)};
    color: ${COLORS.font1};
    transition: color var(--toggleSwitch-duration) ease;
    cursor: pointer;

    ::selection {
      background: transparent;
    }
    ::-moz-selection {
      background: transparent;
    }
  }

  &:hover .k-ToggleSwitch__label {
    color: ${COLORS.primary1};
  }
  &:active .k-ToggleSwitch__label {
    color: ${COLORS.primary3};
  }

  & button[disabled] + .k-ToggleSwitch__label {
    color: var(--toggleSwitch-disabledColor);
    cursor: not-allowed;
  }
`

export const ToggleSwitch = ({
  activeColor,
  checkedColor,
  defaultColor,
  disabled,
  disabledColor,
  id,
  isChecked,
  isLabelVisible,
  label,
  labelProps,
  locked,
  reverseOrder,
  switchProps,
  onChange,
  style,
  ...others
}) => {
  const [isPressed, setPressedState] = useState(isChecked)

  const handleClick = () => {
    onChange && onChange(!isPressed)
    setPressedState(current => !current)
  }

  return (
    <SwitchWrapper
      className={classNames('k-ToggleSwitch', {
        'k-ToggleSwitch--disabled': disabled || locked,
        'k-ToggleSwitch--reverseOrder': reverseOrder,
        'k-ToggleSwitch--locked': locked,
      })}
      style={{
        '--toggleSwitch-activeColor': activeColor,
        '--toggleSwitch-checkedColor': checkedColor,
        '--toggleSwitch-defaultColor': defaultColor,
        '--toggleSwitch-disabledColor': disabledColor,
        ...style,
      }}
      {...others}
    >
      <button
        className={classNames('k-ToggleSwitch__button')}
        type="button"
        disabled={disabled || locked}
        aria-pressed={isPressed}
        aria-label={isLabelVisible ? null : label}
        aria-labelledby={isLabelVisible ? `${id}_label` : null}
        id={id}
        onClick={handleClick}
        {...switchProps}
      >
        <span className="k-ToggleSwitch__circle" aria-hidden="true">
          {locked && <LockIcon width="12" color={COLORS.font1} />}
        </span>
      </button>

      {isLabelVisible && (
        <label
          className={classNames('k-ToggleSwitch__label')}
          {...labelProps}
          htmlFor={id}
          id={`${id}_label`}
        >
          {label}
        </label>
      )}
    </SwitchWrapper>
  )
}

ToggleSwitch.defaultProps = {
  activeColor: COLORS.primary3,
  checkedColor: COLORS.primary1,
  defaultColor: COLORS.line1,
  disabled: false,
  disabledColor: COLORS.line2,
  isChecked: false,
  isLabelVisible: true,
  label: 'switch',
  locked: false,
  reverseOrder: false,
  onChange: () => {},
}

ToggleSwitch.propTypes = {
  activeColor: PropTypes.string,
  checkedColor: PropTypes.string,
  defaultColor: PropTypes.string,
  disabled: PropTypes.bool,
  disabledColor: PropTypes.string,
  id: PropTypes.string.isRequired,
  isChecked: PropTypes.bool,
  isLabelVisible: PropTypes.bool,
  label: PropTypes.string,
  locked: PropTypes.bool,
  reverseOrder: PropTypes.bool,
  onChange: PropTypes.func,
}


text:
/*! formstone v0.8.46 [dropdown.css] 2016-04-14 | MIT License | formstone.it */

/**
	 * @class
	 * @name .fs-dropdown-element
	 * @type element
	 * @description Target element
	 */
/**
	 * @class
	 * @name .fs-dropdown
	 * @type element
	 * @description Base widget class
	 */
/**
	 * @class
	 * @name .fs-dropdown.fs-dropdown-multiple
	 * @type modifer
	 * @description Indicates multi-selected element
	 */
/**
	 * @class
	 * @name .fs-dropdown.fs-dropdown-cover
	 * @type modifer
	 * @description Indicates cover positioning
	 */
/**
	 * @class
	 * @name .fs-dropdown.fs-dropdown-bottom
	 * @type modifer
	 * @description Indicates bottom positioning
	 */
/**
	 * @class
	 * @name .fs-dropdown.fs-dropdown-disabled
	 * @type modifer
	 * @description Indicates disabled state
	 */
/**
	 * @class
	 * @name .fs-dropdown.fs-dropdown-open
	 * @type modifer
	 * @description Indicates open state
	 */
/**
	 * @class
	 * @name .fs-dropdown.fs-dropdown-focus
	 * @type modifer
	 * @description Indicates focus state
	 */
.fs-dropdown {
  position: relative;
  z-index: 1;
  display: block;
  margin: 10px 0;
  max-width: 100%;
  /*
			@media screen and (min-width: 740px) {
				max-width: 30%;
			}
			*/
  /**
		 * @class
		 * @name .fs-dropdown-selected
		 * @type element
		 * @description Handle item
		 */
  /**
		 * @class
		 * @name .fs-dropdown-options
		 * @type element
		 * @description Options container
		 */
  /**
		 * @class
		 * @name .fs-dropdown-group
		 * @type element
		 * @description Option group label
		 */
  /**
		 * @class
		 * @name .fs-dropdown-item
		 * @type element
		 * @description Option item
		 */
}
.fs-dropdown:focus {
  box-shadow: none;
  outline: none;
}
.fs-dropdown,
.fs-dropdown:after,
.fs-dropdown:before,
.fs-dropdown *,
.fs-dropdown *:after,
.fs-dropdown *:before {
  box-sizing: border-box;
  -webkit-transition: none;
          transition: none;
  -webkit-user-select: none !important;
     -moz-user-select: none !important;
      -ms-user-select: none !important;
          user-select: none !important;
}
.fs-dropdown-element {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  opacity: 0;
  z-index: -1;
}
.fs-dropdown-element,
.fs-dropdown-element:focus {
  outline: none;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
  -webkit-tap-highlight-color: transparent;
}
.no-opacity .fs-dropdown-element {
  left: -999999px;
}
.fs-dropdown-selected {
  width: 100%;
  position: relative;
  background: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 3px;
  color: #222222;
  cursor: pointer;
  display: block;
  font-size: 14px;
  height: 40px;
  line-height: 40px;
  margin: 0;
  overflow: hidden;
  padding: 0 40px 0 15px;
  text-align: left;
  text-overflow: clip;
  z-index: 2;
}
.fs-dropdown-selected:after {
  height: 0;
  width: 0;
  position: absolute;
  top: 0;
  right: 15px;
  bottom: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #cccccc;
  content: '';
  display: block;
  margin: auto 0;
}
.no-touchevents .fs-dropdown-selected:hover {
  color: #222222;
}
.no-touchevents .fs-dropdown-disabled .fs-dropdown-selected:hover {
  color: #cccccc;
}
.fs-dropdown-options {
  width: 100%;
  max-height: 260px;
  position: absolute;
  top: 100%;
  left: 0;
  border: 1px solid #cccccc;
  border-width: 0 1px 1px;
  border-radius: 0 0 3px 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  background-color: #ffffff;
  display: none;
  margin: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 0;
  z-index: 50;
}
.fs-dropdown-options.fs-scrollbar {
  position: absolute;
}
.no-opacity .fs-dropdown-options {
  width: auto;
}
.fs-dropdown-group {
  border-bottom: 1px solid #cccccc;
  color: #999999;
  display: block;
  font-size: 11px;
  padding: 10px 15px;
  text-transform: uppercase;
}
.fs-dropdown-item {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #cccccc;
  color: #222222;
  cursor: pointer;
  display: block;
  font-size: 14px;
  margin: 0;
  height: 40px;
  line-height: 40px;
  overflow: hidden;
  padding: 0 15px;
  text-align: left;
  text-decoration: none;
  text-overflow: ellipsis;
  /**
			 * @class
			 * @name .fs-dropdown-item.fs-dropdown-item_placeholder
			 * @type modifier
			 * @description Indicates placeholder item
			 */
  /**
			 * @class
			 * @name .fs-dropdown-item.fs-dropdown-item_selected
			 * @type modifier
			 * @description Indicates selected item
			 */
  /**
			 * @class
			 * @name .fs-dropdown-item.fs-dropdown-item_disabled
			 * @type modifier
			 * @description Indicates disabled item
			 */
}
.fs-dropdown-item_placeholder {
  display: none;
}
.fs-dropdown-item_selected {
  background: #eeeeee;
}
.fs-dropdown-item_disabled {
  color: #999999;
  cursor: default;
}
.fs-dropdown-item:first-child {
  border-radius: 0;
}
.fs-dropdown-item:last-child {
  border-bottom: 0;
  border-radius: 0 0 3px 3px;
}
.no-touchevents .fs-dropdown-item:hover,
.no-touchevents .fs-dropdown-item_selected:hover {
  color: #222222;
  background-color: #dddddd;
  border-color: #cccccc;
}
.fs-dropdown-item_disabled,
.no-touchevents .fs-dropdown-item_disabled:hover {
  color: #cccccc;
  background-color: #ffffff;
  border-color: #cccccc;
}
.fs-dropdown-open {
  z-index: 3;
}
.fs-dropdown-open .fs-dropdown-options {
  display: block;
  border-radius: 0 0 3px 3px;
}
.fs-dropdown-open .fs-dropdown-selected {
  z-index: 51;
  border-radius: 3px 3px 0 0;
}
.fs-dropdown-open .fs-dropdown-selected,
.fs-dropdown-focus .fs-dropdown-selected {
  background-color: #ffffff;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
.fs-dropdown-cover.fs-dropdown-open .fs-dropdown-selected {
  z-index: 49;
}
.fs-dropdown-cover .fs-dropdown-options {
  top: 0;
  border-radius: 3px;
  border-width: 1px;
}
.fs-dropdown-cover .fs-dropdown-item:first-child {
  border-radius: 3px 3px 0 0;
}
.fs-dropdown-bottom .fs-dropdown-options {
  top: auto;
  bottom: 100%;
  border-width: 1px 1px 0;
}
.fs-dropdown-bottom .fs-dropdown-item:last-child {
  border: none;
}
.fs-dropdown-bottom.fs-dropdown-open .fs-dropdown-selected {
  border-radius: 0 0 3px 3px;
}
.fs-dropdown-bottom.fs-dropdown-open .fs-dropdown-options {
  border-radius: 3px 3px 0 0;
}
.fs-dropdown-bottom.fs-dropdown-cover .fs-dropdown-options {
  top: auto;
  bottom: 0;
}
.fs-dropdown-bottom.fs-dropdown-cover.fs-dropdown-open .fs-dropdown-selected {
  border-radius: 3px;
}
.fs-dropdown-bottom.fs-dropdown-cover.fs-dropdown-open .fs-dropdown-options {
  border-radius: 3px;
}
.fs-dropdown-multiple {
  border: 1px solid #cccccc;
  border-radius: 3px;
}
.fs-dropdown-multiple .fs-dropdown-options {
  width: 100%;
  position: static;
  border: none;
  border-radius: 3px;
  box-shadow: none;
  display: block;
}
.fs-dropdown-disabled .fs-dropdown-selected {
  background: #ffffff;
  border-color: #cccccc;
  color: #cccccc;
  cursor: default;
}
.fs-dropdown-disabled .fs-dropdown-options {
  background: #ffffff;
  border-color: #cccccc;
}
.fs-dropdown-disabled .fs-dropdown-group,
.fs-dropdown-disabled .fs-dropdown-item {
  border-color: #cccccc;
  color: #cccccc;
  cursor: default;
}
.fs-dropdown-disabled .fs-dropdown-item,
.no-touchevents .fs-dropdown-disabled .fs-dropdown-item:hover {
  color: #cccccc;
  background-color: #ffffff;
}
.fs-dropdown-disabled .fs-dropdown-item_selected,
.no-touchevents .fs-dropdown-disabled .fs-dropdown-item_selected:hover {
  background: #fafafa;
}
.fs-dropdown-options.fs-scrollbar {
  overflow: hidden;
}
.fs-dropdown-options.fs-scrollbar .fs-scrollbar-content {
  max-height: 260px;
  height: auto;
}
.fs-dropdown-options.fs-scrollbar.fs-scrollbar-active .fs-scrollbar-content {
  padding: 0;
}
.fs-dropdown-options.fs-scrollbar .fs-scrollbar-bar,
.fs-dropdown-options.fs-scrollbar .fs-scrollbar-track {
  border-radius: 0 3px 3px 0;
}


text:
/**
 * Created by sebastian.weikart on 15/04/2015.
 */

var orm = require("../../common/modelSingleton");

exports.getProducts = function (req, res) {

    // TODO add pagination and optional loading of reviews
    var getReviews = false;
    var page = req.query.page;
    var perPage = req.query.per_page ? req.query.per_page : 10;  // default page size to 10
    var Product = orm.model("products");

    if(page) {
        Product.findAll(
            {
                offset: page * perPage,
                limit: perPage,
                include: [{ all: true }]
            }
        ).then(function (products) {
            console.log("finding products...");
            console.log(JSON.stringify(products));
            res.send(products);
        });

    } else {

        Product.find( {
            limit: perPage  // limit to default page size
        }).then(function (products) {
            console.log("finding products...");
            console.log(JSON.stringify(products));
            res.send(products);
        });
    }

};

exports.createProduct = function (req, res) {

};


text:
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        Toggle navigation

      </button>

            Dashboard

            Reports

            Admin

            {{ user.name }}

              Signed in as:

              {{ user.email }}

Change Password

Logout


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--  Copyright (C) 2012 The Android Open Source Project

     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.
 -->

<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="abc_action_mode_done" msgid="4076576682505996667">"Lokið"</string>
    <string name="abc_action_bar_home_description" msgid="4600421777120114993">"Fara heim"</string>
    <string name="abc_action_bar_up_description" msgid="1594238315039666878">"Fara upp"</string>
    <string name="abc_action_menu_overflow_description" msgid="3588849162933574182">"Fleiri valkostir"</string>
    <string name="abc_toolbar_collapse_description" msgid="1603543279005712093">"Minnka"</string>
    <string name="abc_searchview_description_search" msgid="8264924765203268293">"Leita"</string>
    <string name="abc_search_hint" msgid="7723749260725869598">"Leita…"</string>
    <string name="abc_searchview_description_query" msgid="2550479030709304392">"Leitarfyrirspurn"</string>
    <string name="abc_searchview_description_clear" msgid="3691816814315814921">"Hreinsa fyrirspurn"</string>
    <string name="abc_searchview_description_submit" msgid="8928215447528550784">"Senda fyrirspurn"</string>
    <string name="abc_searchview_description_voice" msgid="893419373245838918">"Raddleit"</string>
    <string name="abc_activitychooserview_choose_application" msgid="2031811694353399454">"Veldu forrit"</string>
    <string name="abc_activity_chooser_view_see_all" msgid="7468859129482906941">"Sjá allt"</string>
    <string name="abc_shareactionprovider_share_with_application" msgid="3300176832234831527">"Deila með <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string>
    <string name="abc_shareactionprovider_share_with" msgid="3421042268587513524">"Deila með"</string>
    <string name="abc_capital_on" msgid="3405795526292276155">"KVEIKT"</string>
    <string name="abc_capital_off" msgid="121134116657445385">"SLÖKKT"</string>
    <string name="search_menu_title" msgid="146198913615257606">"Leita"</string>
</resources>


text:
local protobuf = require "protobuf"
module('BseExitGuild_pb', package.seeall)

local BSEEXITGUILD = protobuf.Descriptor();
local BSEEXITGUILD_RESULT_FIELD = protobuf.FieldDescriptor();
local BSEEXITGUILD_MESSAGE_FIELD = protobuf.FieldDescriptor();

BSEEXITGUILD_RESULT_FIELD.name = "result"
BSEEXITGUILD_RESULT_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseExitGuild.result"
BSEEXITGUILD_RESULT_FIELD.number = 1
BSEEXITGUILD_RESULT_FIELD.index = 0
BSEEXITGUILD_RESULT_FIELD.label = 1
BSEEXITGUILD_RESULT_FIELD.has_default_value = false
BSEEXITGUILD_RESULT_FIELD.default_value = 0
BSEEXITGUILD_RESULT_FIELD.type = 5
BSEEXITGUILD_RESULT_FIELD.cpp_type = 1

BSEEXITGUILD_MESSAGE_FIELD.name = "message"
BSEEXITGUILD_MESSAGE_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseExitGuild.message"
BSEEXITGUILD_MESSAGE_FIELD.number = 2
BSEEXITGUILD_MESSAGE_FIELD.index = 1
BSEEXITGUILD_MESSAGE_FIELD.label = 1
BSEEXITGUILD_MESSAGE_FIELD.has_default_value = false
BSEEXITGUILD_MESSAGE_FIELD.default_value = ""
BSEEXITGUILD_MESSAGE_FIELD.type = 9
BSEEXITGUILD_MESSAGE_FIELD.cpp_type = 9

BSEEXITGUILD.name = "BseExitGuild"
BSEEXITGUILD.full_name = ".com.xinqihd.sns.gameserver.proto.BseExitGuild"
BSEEXITGUILD.nested_types = {}
BSEEXITGUILD.enum_types = {}
BSEEXITGUILD.fields = {BSEEXITGUILD_RESULT_FIELD, BSEEXITGUILD_MESSAGE_FIELD}
BSEEXITGUILD.is_extendable = false
BSEEXITGUILD.extensions = {}

BseExitGuild = protobuf.Message(BSEEXITGUILD)
_G.BSEEXITGUILD_PB_BSEEXITGUILD = BSEEXITGUILD


text:
export type Alignment =
  'Lawful Good'
    | 'Lawful Neutral'
    | 'Lawful Evil'
    | 'Neutral Good'
    | 'True Neutral'
    | 'Neutral Evil'
    | 'Chaotic Good'
    | 'Chaotic Neutral'
    | 'Chaotic Evil';

export class Alignments {
  constructor() {
    throw new Error('Cannot instantiate enum');
  }

  public static LAWFUL_GOOD: Alignment    = 'Lawful Good';
  public static LAWFUL_NEUTRAL: Alignment = 'Lawful Neutral';
  public static LAWFUL_EVIL: Alignment    = 'Lawful Evil';
  public static NEUTRAL_GOOD: Alignment   = 'Neutral Good';
  public static TRUE_NEUTRAL: Alignment   = 'True Neutral';
  public static NEUTRAL_EVIL: Alignment   = 'Neutral Evil';
  public static CHAOTIC_GOOD: Alignment   = 'Chaotic Good';
  public static CHAOTIC_NEUTRAL: Alignment = 'Chaotic Neutral';
  public static CHAOTIC_EVIL: Alignment   = 'Chaotic Evil';

}


text:
package main

import (
	"encoding/json"
	"os"
	"path/filepath"
)

var pluginCachePath = filepath.Join(AppDir, "plugin-cache.json")

// ClearPluginCache deletes the plugin cache
func ClearPluginCache() {
	os.Remove(pluginCachePath)
}

// WritePluginCache caches the plugins to ~/.heroku/plugin-cache.json
func WritePluginCache(list []Plugin) {
	plugins := map[string]Plugin{}
	for _, plugin := range list {
		plugins[plugin.Name] = plugin
	}
	f, err := os.Create(pluginCachePath)
	if err != nil {
		panic(err)
	}
	if err := json.NewEncoder(f).Encode(plugins); err != nil {
		panic(err)
	}
}

// FetchPluginCache returns the plugins from the cache
func FetchPluginCache() map[string]*Plugin {
	var plugins map[string]*Plugin
	f, err := os.Open(pluginCachePath)
	if err != nil {
		return plugins
	}
	if err := json.NewDecoder(f).Decode(&plugins); err != nil {
		panic(err)
	}
	return plugins
}


text:
import pytest
from ..gitpub import gitpub

def test_load_gh_profile():
    """
    Tests gitpub.Profile.load_gh_profile() by
    loading details of the user `demfier`
    ------------------------------------------------------------------------------
    Parameters: None
    """

    # define the validation Profile
    correct = gitpub.Profile(username="demfier", name="Gaurav",
                             location="Kharagpur, West Bengal",
                             email=None, followers_count=14,
                             repos_url="https://api.github.com/users/Demfier/repos",
                             public_repo_count=40)

    profile = gitpub.Profile()
    # load github profile of the user
    profile.load_gh_profile('demfier')

    # validations
    assert profile.username == correct.username
    assert profile.name == correct.name
    assert profile.email == correct.email

def test_get_public_repos():
    """
    Tests gitpub.Profile.get_public_repos() by
    loading public repository details of the user `demfier`
    ----------------------------------------------------------------------------
    Parameters: None
    """

    # define the validation Profile
    correct = gitpub.Profile(username="demfier", name="Gaurav",
                             location="Kharagpur, West Bengal",
                             email="sahu.gaurav719@gmail.com",
                             followers_count=14,
                             repos_url="https://api.github.com/users/Demfier/repos",
                             public_repo_count=40)

    # get public repos for the validation Profile
    correct.get_public_repos()

    profile = gitpub.Profile()
    profile.load_gh_profile('demfier')
    profile.get_public_repos()

    # validations
    for idx, _ in enumerate(profile.public_repos):
        assert(profile.public_repos[idx].name == correct.public_repos[idx].name)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Sabio.Web.Domain
{
    public class SquadMemberStatus
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}


text:
from .. import Availability, Class, Constant, Define, Method, Parameter, Type

gx_class = Class('DGW',
                 doc="""
                 Provides access to dialog boxes for user I/O. You can
                 use this class to store to, or retrieve information from
                 the current workspace parameter block via dialog boxes
                 """,
                 notes="""
                 Setting Fonts in GX dialogs.

                 By default, "new look" GX dialogs uses the "Tahoma" font. This font can be
                 overridden by updating the application settings. This can be done programmatically
                 using the :func:`GlobalSet_SYS` function using the following parameters:

                 MONTAJ.GX_FONT="Font_name"

                 This sets the default font to "Font_name". It applies to text in all
                 components of the dialog.

                 Additional customization of individual components can be accomplished
                 using the following parameters:

                 MONTAJ.GX_CAPTION_FONT="Caption_Font": Font for the field captions (labels)
                 MONTAJ.GX_BUTTON_FONT="Button_Font"  : Font for buttons, including the "Browse" button
                 MONTAJ.GX_TITLE_FONT="Title_Font"    : Font for special titles (see :func:`SetTitle_DGW`).

                 The font used for the text in edit windows remains the default, or the
                 value specified using MONTAJ.GX_FONT.

                 Note that the "OK" button, and the Title, use "Bold" versions of the
                 specified font. If the bolded version does not exist as a normal font,
                 then the operating system may provide its own alternative which may not
                 appear the same as you expect.

                 Before version 6.2. there used to be a parameter, MONTAJ.GX_CHARSET, that
                 affected characters above ASCII 127. 6.2. introduced Unicode in the core
                 montaj engine that eliminated the need for such a setting. All strings
                 on the GX API level are encoded in :def:`UTF8` during runtime which makes it possible
                 to represent all possible characters without using character sets.
                 """)

gx_defines = [
    Define('DGW_OBJECT',
           doc="""
           Dialog object defines
           INFO TYPE   EDIT   FEDIT  LEDIT  CEDIT  EBUT
           =========   =====  =====  =====  =====  =====
           LABEL       RW     RW     RW     RW     RW          R - can use GetInfo_DGW
           TEXT        RW     RW     RW     RW     .           W - can use :func:`SetInfo_DGW`
           PATH        .      RW     .      .      .
           FILEPATH    .      RW     .      .      .
           LISTVAL     .      .      R      .      .
           LISTALIAS   .      .      RW     .      .
           """,
           constants=[
               Constant('DGW_LABEL', value='0', type=Type.INT32_T,
                        doc="The text label tied to each Dialog component."),
               Constant('DGW_TEXT', value='1', type=Type.INT32_T,
                        doc="The edit field text."),
               Constant('DGW_PATH', value='2', type=Type.INT32_T,
                        doc="The file edit path."),
               Constant('DGW_FILEPATH', value='3', type=Type.INT32_T,
                        doc="The complete file name, path included."),
               Constant('DGW_LISTVAL', value='4', type=Type.INT32_T,
                        doc="The alias value associated with the list entry."),
               Constant('DGW_LISTALIAS', value='5', type=Type.INT32_T,
                        doc="The text value associated with the list entry."),
               Constant('DGW_EXT', value='7', type=Type.INT32_T,
                        doc="The extension associated with a filename entry."),
               Constant('DGW_HIDE', value='8', type=Type.INT32_T,
                        doc='Hide the button or entry and its label, if string is not "0"')
           ])]

gx_methods = {
    'Miscellaneous': [

        Method('Create_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="""
               This method creates a Dialog window from a specified
               resource. The Resource is loaded into memory but not displayed.
               """,
               return_type="DGW",
               return_doc="Handle to the :class:`DGW` object.",
               parameters = [
                   Parameter('name', type=Type.STRING,
                             doc="Name of the Window Resource to use")
               ]),

        Method('Destroy_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="Destroys a Dialog Window.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog to Destroy")
               ]),

        Method('GetInfoMETA_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="Copies the Dialog information to a :class:`META` attribute.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('obj', type="DGW_OBJ",
                             doc="Dialog Object"),
                   Parameter('dlg_obj_type', type=Type.INT32_T,
                             doc=":def:`DGW_OBJECT`"),
                   Parameter('meta', type="META"),
                   Parameter('meta_obj', type="META_TOKEN",
                             doc="Object"),
                   Parameter('meta_attrib', type="META_TOKEN",
                             doc="Attribute")
               ]),

        Method('GetInfoSYS_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="""
               This method uses the information in a Dialog box to
               set a :class:`SYS` variable.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('id', type="DGW_OBJ",
                             doc="Dialog Object"),
                   Parameter('info', type=Type.INT32_T,
                             doc=":def:`DGW_OBJECT`"),
                   Parameter('group', type=Type.STRING,
                             doc="Group name of the Variable"),
                   Parameter('field', type=Type.STRING,
                             doc="Variable name")
               ]),

        Method('GetList_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="""
               This method retrieves the list (:class:`LST`) object associated
               with a Dialog object.
               """,
               return_type="LST",
               return_doc="The List Object",
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('id', type="DGW_OBJ",
                             doc="Dialog Object")
               ]),

        Method('GtInfo_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="""
               This method fills the specified string with the text from
               the text object specified.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('id', type="DGW_OBJ",
                             doc="Handle to the TEXT Object"),
                   Parameter('info', type=Type.INT32_T,
                             doc=":def:`DGW_OBJECT`"),
                   Parameter('buff', type=Type.STRING, is_ref=True, size_of_param='size',
                             doc="Where to place the String"),
                   Parameter('size', type=Type.INT32_T, default_length='STR_VERY_LONG',
                             doc="Size of the String")
               ]),

        Method('iRunDialogue_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="This method runs the Dialog window.",
               return_type=Type.INT32_T,
               return_doc="The Exit Code of the Dialog window.",
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog Window")
               ]),

        Method('SetInfo_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="""
               This method sets the string of a text object. If the string
               is too long it will be truncated.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('id', type="DGW_OBJ",
                             doc="Handle to the TEXT Object"),
                   Parameter('info', type=Type.INT32_T,
                             doc=":def:`DGW_OBJECT`"),
                   Parameter('buff', type=Type.STRING,
                             doc="String to set the Text To")
               ]),

        Method('SetInfoMETA_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="This sets a text object to the text found in a :class:`META` attribute.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('obj', type="DGW_OBJ",
                             doc="Dialog Object"),
                   Parameter('dlg_obj_type', type=Type.INT32_T,
                             doc=":def:`DGW_OBJECT`"),
                   Parameter('meta', type="META"),
                   Parameter('meta_obj', type="META_TOKEN",
                             doc="Object"),
                   Parameter('meta_attrib', type="META_TOKEN",
                             doc="Attribute")
               ]),

        Method('SetInfoSYS_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="""
               This sets a text object to the text found in a system
               parameter variable. If the variable has not been set,
               the text is not set.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('id', type="DGW_OBJ",
                             doc="Dialog Object"),
                   Parameter('info', type=Type.INT32_T,
                             doc=":def:`DGW_OBJECT`"),
                   Parameter('group', type=Type.STRING,
                             doc="Group name of the Variable"),
                   Parameter('field', type=Type.STRING,
                             doc="Variable name")
               ]),

        Method('SetTitle_DGW', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="Changes the title of the dialog.",
               notes="""
               A "Special", additional title can be added to a dialog by passing a title
               to :func:`SetTitle_DGW` with the following syntax:

               ``"Window Title\\nAdditional Title"``

               In the title argument, a line break character ``'\\n'`` is used to
               separate the parts.

               The window title free_appears as the title in the upper bar of the dialog.
               The additional title free_appears below this, in the main body of the
               dialog, and is separated from the rest of the fields by a horizontal
               line. It is printed in the bold version of the default font (or of the
               special font specified using the MONTAJ.GX_TITLE_FONT parameter noted
               above in "Setting Fonts in GX dialogs."
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('dlg', type="DGW",
                             doc="Dialog"),
                   Parameter('title', type=Type.STRING,
                             doc="Title to set")
               ])
    ]
}


text:
(function () {
  // Declare all known extension IDs.
  const prodExtensionId = "okpeabepajdgiepelmhkfhkjlhhmofma";
  const betaExtensionId = "igcbbdnhomedfadljgcmcfpdcoonihfe";
  const developmentExtensionIds = ["klapphmlodmhfolphohgkmimlkpcindc"]

  var manifestData = chrome.runtime.getManifest();

  // Identify what we know about the actual extension running.
  let extensionId = chrome.runtime.id;
  let extensionType;
  if (extensionId === prodExtensionId) {
    extensionType = "production";
  } else if (extensionId === betaExtensionId){
    extensionType = "beta";
  } else if (developmentExtensionIds.includes(extensionId)) {
    extensionType = "development";
  } else {
    extensionType = "unknown";
  }

  let extensionTitle = (extensionType == "production") ? ("Jabra Integration Extension " + manifestData.version_name) : ("Jabra Integration Extension (" + extensionType + ") " + manifestData.version_name);

  // Set title dynamically and clear badge - if we have been granted permission to do it.
  try {
    if (chrome.browserAction) {
      if (chrome.browserAction.setBadgeText) {
        chrome.browserAction.setBadgeText({text: ''});
      }
      if (chrome.browserAction.setBadgeBackgroundColor) {
        chrome.browserAction.setBadgeBackgroundColor({color: '#ffffff'});
      }
      if (chrome.browserAction.setTitle) {
        chrome.browserAction.setTitle({title: extensionTitle});
      }
    }
  } catch (err) {
    console.error("Could not change badge/title: " + err);
  }

  // Make logLevel variable in sync with storage (updated by options page).
  var logLevel = 2;

  // Sync log level if we have storage permission
  try {
    chrome.permissions.contains({
      permissions: ['storage']
    }, (allowed) => {
      if (allowed && chrome.storage && chrome.storage.local) {
        chrome.storage.local.get('logLevel', function(items) {
          logLevel = parseInt(items.logLevel || "2");
          chrome.storage.onChanged.addListener(function(changes, areaName) {
            for (key in changes) {
              var storageChange = changes[key];
              if (key='logLevel' && areaName === 'local' ) {
                logLevel = storageChange.newValue;
              }
            }
          });
        });
      } else {
        // console.warn("Could not access storage to read/watch log level changes");
      }
    });
  } catch (err) {
    console.error("Error during log/level listener setup " + err);
  }

  // Native messages port
  var port = null;

  // Message from native app
  function onNativeMessageReceived(response) {
    if (logLevel>=4) { // Log if Loglevel >= Trace
      console.log("Recived message from native chromehost process: " + JSON.stringify(response));
    }

    // !! Delete key code from earlier versions here that we don't want going forward
    //    but that future versions need to know about for compatability:
    //    The old code would:
    // 1) Break if response did not return a message (like an error).
    // 2) Require that an Event: Version would returned 0.5.

    sendMessageToContentScript(response);
  }

  function ensureString(obj) {
    if (obj) {
      return (typeof obj === 'string' || obj instanceof String) ? obj : obj.toString();
    } else {
      return "";
    }
  }

  // Send message to native app
  function sendMessageToNativeApp(request) {
    // Make sure all required entries are strings as expected by native app.
    let msg = JSON.parse(JSON.stringify(request));
    msg.message = ensureString(msg.message);
    msg.requestId = ensureString(msg.requestId);
    msg.apiClientId = ensureString(msg.apiClientId);

    if (logLevel>=4) { // Log if Loglevel >= Trace
      console.log("Sending request to native chromehost process: " + JSON.stringify(msg));
    }
    port.postMessage(msg);
  }

  // Messages from the content-script
  window.chrome.runtime.onMessage.addListener((request) => {
    // Try to connect to the native app, if not already connected
    if (port == null) {
      var hostName = "com.jabra.nm";
      try {
        port = window.chrome.runtime.connectNative(hostName);
        port.onDisconnect.addListener(() => {
          var err = chrome.runtime.lastError ? chrome.runtime.lastError.message : null;
          if (err === "Specified native messaging host not found.") {
            let errTxt = "You need to install the Jabra Browser Integration Host " + ((extensionType!=="production") ? "(" + extensionType + " version)" : "") + " and reload this page";
            sendErrorToContentScript(errTxt, request);
          } else if (err === "Access to the specified native messaging host is forbidden." && extensionId !== prodExtensionId) {
            sendErrorToContentScript("You are running a beta/development version of the Jabra browser extension which lacks access rights to installed native messaging host. Please upgrade your native host installation OR manually add this extension id '" + extensionId + "' to allowed_origins (in file com.jabra.nm.json in the installation directory of the native host", request);
          } else {
            sendErrorToContentScript(err, request);
          }
          port = null;
        });
        port.onMessage.addListener(onNativeMessageReceived);
      }
      catch(err) {
        sendErrorToContentScript(err);
      }
    }

    if (logLevel>=4) { // Log if Loglevel >= Trace
      console.log("Received request from content script: " + JSON.stringify(request));
    }

    sendMessageToNativeApp(request);
  });

  // Send response with message or error to content script.
  function sendMessageToContentScript(response) {
    let msg = response;

    // For install info and version commands, we need to add appropiate things only the
    // background script knows about like chrome extension version number, extensionId etc.
    if (msg.message === "Event: getinstallinfo") {
      msg.data = msg.data || {};
      msg.data.version_browserextension = manifestData.version_name;
      msg.data.browserextension_id =  extensionId;
      msg.data.browserextension_type = extensionType
    } else if (msg.message.startsWith("Event: Version")) {
      msg.data = msg.data || {};
      msg.data.version_browserextension = manifestData.version_name;

      // TODO: Full compatability check.
      let isInstallOk = (msg.data.version_chromehost && msg.data.version_nativesdk);
      if (!isInstallOk) {
        // For backwards compatability, we can't report this to the API client
        // as it expect version response first.
        console.warn("Chromehost installation incomplete / needs update");

        // Display warning about incomptability if we have persmission:
        try {
          if (chrome.browserAction) {
            if (chrome.browserAction.setBadgeText) {
              chrome.browserAction.setBadgeText({text: '!'});
            }
            if (chrome.browserAction.setBadgeBackgroundColor) {
              chrome.browserAction.setBadgeBackgroundColor({color: '#ff0000'});
            }
            if (chrome.browserAction.setTitle) {
              chrome.browserAction.setTitle({title: extensionTitle + " - incomplete / needs update"});
            }
          }
        } catch (err) {
          console.error("Could not change badge/title: " + err);
        }
      }
    }

    // Add error field if there is one:
    if (msg.error) {
      if (logLevel>=1) { // Log if Loglevel >= Error
        console.log("Sending error to content script: " + JSON.stringify(msg) );
      }
    }

    if (msg.message) {
      if (logLevel>=4) { // Log if Loglevel >= Trace
        console.log("Sending message to content script: " + JSON.stringify(msg) );
      }
    }

    window.chrome.tabs.query({
    }, function (tabs) {
      tabs.forEach(function (tab) {
        window.chrome.tabs.sendMessage(tab.id, msg);
      });
    });
  }

  function sendErrorToContentScript(errStr, request = null) {
    // Errors always forwarded because api user may needs to handle - so no filtering here.
    let msg = {
      error: errStr,
      message: 'na', // For backwards compatibility with <2.0 API that expects this to be non-null.
      requestId: request ? request.requestId : null,
      apiClientId: request ? request.apiClientId : null,
    };

    if (logLevel>=1) { // Log if Loglevel >= Error
      console.log("Sending error to content script: " + JSON.stringify(msg));
    }

    window.chrome.tabs.query({
    }, function (tabs) {
      tabs.forEach(function (tab) {
        window.chrome.tabs.sendMessage(tab.id, msg);
      });
    });
  }
})();


text:
<?php

/**
 * class to handle ActiveSync Search/Response/Store/Result elements
 *
 * @package     Syncroton
 * @subpackage  Model
 */
class Syncroton_Model_StoreResponseResult extends Syncroton_Model_AEntry
{
    protected $_xmlBaseElement = 'Result';

    protected $_properties = array(
        'AirSync' => array(
            'class'        => array('type' => 'string'),
            'collectionId' => array('type' => 'string'),
        ),
        'Search' => array(
            'longId'     => array('type' => 'string'),
            'properties' => array('type' => 'container'),
        )
    );
}


text:
package com.hazelcast.query.impl.predicates;

import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
import com.hazelcast.nio.serialization.impl.BinaryInterface;
import com.hazelcast.query.IndexAwarePredicate;
import com.hazelcast.query.Predicate;
import com.hazelcast.query.VisitablePredicate;
import com.hazelcast.query.impl.AndResultSet;
import com.hazelcast.query.impl.Indexes;
import com.hazelcast.query.impl.OrResultSet;
import com.hazelcast.query.impl.QueryContext;
import com.hazelcast.query.impl.QueryableEntry;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static com.hazelcast.internal.serialization.impl.FactoryIdHelper.PREDICATE_DS_FACTORY_ID;

/**
 * And Predicate
 */
@BinaryInterface
public final class AndPredicate
        implements IndexAwarePredicate, IdentifiedDataSerializable, VisitablePredicate, NegatablePredicate, CompoundPredicate {

    protected Predicate[] predicates;

    public AndPredicate() {
    }

    public AndPredicate(Predicate... predicates) {
        this.predicates = predicates;
    }

    @Override
    public Predicate accept(Visitor visitor, Indexes indexes) {
        Predicate[] result = VisitorUtils.acceptVisitor(predicates, visitor, indexes);
        if (result != predicates) {
            //inner predicates were modified by a visitor
            AndPredicate newPredicate = new AndPredicate(result);
            return visitor.visit(newPredicate, indexes);
        }
        return visitor.visit(this, indexes);
    }

    @Override
    public Set<QueryableEntry> filter(QueryContext queryContext) {
        Set<QueryableEntry> smallestIndexedResult = null;
        List<Set<QueryableEntry>> otherIndexedResults = new LinkedList<Set<QueryableEntry>>();
        List<Predicate> lsNoIndexPredicates = null;
        for (Predicate predicate : predicates) {
            boolean indexed = false;
            if (predicate instanceof IndexAwarePredicate) {
                IndexAwarePredicate iap = (IndexAwarePredicate) predicate;
                if (iap.isIndexed(queryContext)) {
                    indexed = true;
                    Set<QueryableEntry> s = iap.filter(queryContext);
                    if (smallestIndexedResult == null) {
                        smallestIndexedResult = s;
                    } else if (size(s) < size(smallestIndexedResult)) {
                        otherIndexedResults.add(smallestIndexedResult);
                        smallestIndexedResult = s;
                    } else {
                        otherIndexedResults.add(s);
                    }
                }
            }
            if (!indexed) {
                if (lsNoIndexPredicates == null) {
                    lsNoIndexPredicates = new LinkedList<Predicate>();
                }
                lsNoIndexPredicates.add(predicate);
            }
        }
        if (smallestIndexedResult == null) {
            return null;
        }
        return new AndResultSet(smallestIndexedResult, otherIndexedResults, lsNoIndexPredicates);
    }

    private int size(Set<QueryableEntry> result) {
        // In case of AndResultSet and OrResultSet calling size() may be very expensive so quicker estimatedSize() is used
        if (result instanceof AndResultSet) {
            return ((AndResultSet) result).estimatedSize();
        } else if (result instanceof OrResultSet) {
            return ((OrResultSet) result).estimatedSize();
        }
        return result.size();
    }

    @Override
    public boolean isIndexed(QueryContext queryContext) {
        for (Predicate predicate : predicates) {
            if (predicate instanceof IndexAwarePredicate) {
                IndexAwarePredicate iap = (IndexAwarePredicate) predicate;
                if (iap.isIndexed(queryContext)) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override
    public boolean apply(Map.Entry mapEntry) {
        for (Predicate predicate : predicates) {
            if (!predicate.apply(mapEntry)) {
                return false;
            }
        }
        return true;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append('(');
        int size = predicates.length;
        for (int i = 0; i < size; i++) {
            if (i > 0) {
                sb.append(" AND ");
            }
            sb.append(predicates[i]);
        }
        sb.append(')');
        return sb.toString();
    }

    @Override
    public void writeData(ObjectDataOutput out) throws IOException {
        out.writeInt(predicates.length);
        for (Predicate predicate : predicates) {
            out.writeObject(predicate);
        }
    }

    @Override
    public void readData(ObjectDataInput in) throws IOException {
        int size = in.readInt();
        predicates = new Predicate[size];
        for (int i = 0; i < size; i++) {
            predicates[i] = in.readObject();
        }
    }

    @Override
    public Predicate negate() {
        int size = predicates.length;
        Predicate[] inners = new Predicate[size];
        for (int i = 0; i < size; i++) {
            Predicate original = predicates[i];
            Predicate negated;
            if (original instanceof NegatablePredicate) {
                negated = ((NegatablePredicate) original).negate();
            } else {
                negated = new NotPredicate(original);
            }
            inners[i] = negated;
        }
        OrPredicate orPredicate = new OrPredicate(inners);
        return orPredicate;
    }

    @Override
    public int getFactoryId() {
        return PREDICATE_DS_FACTORY_ID;
    }

    @Override
    public int getId() {
        return PredicateDataSerializerHook.AND_PREDICATE;
    }

    /**
     * Visitable predicates are treated as effectively immutable, therefore callers should not make any changes to
     * the returned array.
     */
    @Override
    @SuppressFBWarnings("EI_EXPOSE_REP")
    public <K, V> Predicate<K, V>[] getPredicates() {
        return predicates;
    }

    /**
     * Visitable predicates are treated as effectively immutable, therefore callers should not make any changes to
     * the array passed as argument after is has been set.
     * @param predicates    the array of sub-predicates for this {@code And} operator. It is not safe to make any changes to
     *                      this array after it has been set.
     */
    @Override
    @SuppressFBWarnings("EI_EXPOSE_REP")
    public <K, V> void setPredicates(Predicate<K, V>[] predicates) {
        if (this.predicates == null) {
            this.predicates = predicates;
        } else {
            throw new IllegalStateException("Cannot reset predicates in an AndPredicate after they have been already set.");
        }
    }
}


text:
/* DO NOT EDIT THIS FILE
 * Automatically generated by generate-def-headers.xsl
 * DO NOT EDIT THIS FILE
 */

#ifndef __BFIN_DEF_ADSP_BF542_proc__
#define __BFIN_DEF_ADSP_BF542_proc__

#include "../mach-common/ADSP-EDN-core_def.h"

#include "ADSP-EDN-BF542-extended_def.h"

#define CHIPID                         0xFFC00014
#define SWRST                          0xFFC00100 /* Software Reset Register */
#define SYSCR                          0xFFC00104 /* System Configuration register */

#endif /* __BFIN_DEF_ADSP_BF542_proc__ */


text:
class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = 0);
    ~Widget();
};

#endif // WIDGET_H


text:
% train the neural net

%% Initialization
close all; clc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE
% This script requires that the data has already been loaded into global variables
% for processing.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global Xtrain;
global ytrain;

fprintf(" dimensions of Xtrain: %d x %d\n", size(Xtrain,1), size(Xtrain,2));
fprintf(" dimensions of ytrain: %d x %d\n", size(ytrain,1), size(ytrain,2));

m = size(Xtrain, 1);

%% Setup the parameters you will use for this exercise
input_layer_size  = size(Xtrain,2);  % 1 sec clip from song; sampling rate = 1000Hz
hidden_layer_size = 5;               % number of units in the hidden layer
num_labels = 2;                      % 2 labels: {1,2}

%fprintf('\nInitializing Neural Network Parameters ...\n')
initial_Theta1 = randInitializeWeights(input_layer_size, hidden_layer_size);
initial_Theta2 = randInitializeWeights(hidden_layer_size, num_labels);

% Unroll parameters
initial_nn_params = [initial_Theta1(:) ; initial_Theta2(:)];

% Turn off gradient checking when it is verified that backprop is working correctly

% Check gradients by running checkNNGradients
%fprintf('\nChecking Backpropagation... \n');
%checkNNGradients;

%  Check gradients by running checkNNGradients
%fprintf('\nChecking Backpropagation (w/ Regularization) ... \n')
%lambda = 3;
%checkNNGradients(lambda);

% Train the Neural Net
fprintf('\nTraining the neural net ... \n');

options = optimset('MaxIter', 200);
lambda=0;;

% Create "short hand" for the cost function to be minimized
costFunction = @(p) nnCostFunction(p, ...
                                   input_layer_size, ...
                                   hidden_layer_size, ...
                                   num_labels, Xtrain, ytrain, lambda);

% Now, costFunction is a function that takes in only one argument (the
% neural network parameters)
tic;
[nn_params, cost] = fmincg(costFunction, initial_nn_params, options);
timeToTrain=toc;
printf("\ntime to train: %f seconds\n", timeToTrain);

% Obtain Theta1 and Theta2 back from nn_params
Theta1 = reshape(nn_params(1:hidden_layer_size * (input_layer_size + 1)), ...
                 hidden_layer_size, (input_layer_size + 1));

Theta2 = reshape(nn_params((1 + (hidden_layer_size * (input_layer_size + 1))):end), ...
                 num_labels, (hidden_layer_size + 1));

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Persist the weights to a matlab data file.
% Example:
%   save '/Users/alexryan/alpine/git/flere-imhaso/data/matlab/experiment-weights.mat' Theta1 Theta2
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

matlabWeightsFile = fullfile(getenv("FLERE_IMSAHO"), "data/matlab", "flere-imsaho-weights.mat");
save(matlabWeightsFile, 'Theta1', 'Theta2', 'v6');
fprintf("da magical learned parameters have been saved here:\n%s\n", matlabWeightsFile);