text:
package org.apache.kerby.kerberos.kerb.server.request;

import org.apache.kerby.kerberos.kerb.KrbCodec;
import org.apache.kerby.kerberos.kerb.KrbConstant;
import org.apache.kerby.kerberos.kerb.KrbErrorCode;
import org.apache.kerby.kerberos.kerb.KrbException;
import org.apache.kerby.kerberos.kerb.common.EncryptionUtil;
import org.apache.kerby.kerberos.kerb.identity.KrbIdentity;
import org.apache.kerby.kerberos.kerb.server.KdcContext;
import org.apache.kerby.kerberos.kerb.spec.KerberosTime;
import org.apache.kerby.kerberos.kerb.spec.ap.ApOption;
import org.apache.kerby.kerberos.kerb.spec.ap.ApReq;
import org.apache.kerby.kerberos.kerb.spec.ap.Authenticator;
import org.apache.kerby.kerberos.kerb.spec.base.EncryptedData;
import org.apache.kerby.kerberos.kerb.spec.base.EncryptionKey;
import org.apache.kerby.kerberos.kerb.spec.base.EncryptionType;
import org.apache.kerby.kerberos.kerb.spec.base.HostAddresses;
import org.apache.kerby.kerberos.kerb.spec.base.KeyUsage;
import org.apache.kerby.kerberos.kerb.spec.base.KrbMessageType;
import org.apache.kerby.kerberos.kerb.spec.base.LastReq;
import org.apache.kerby.kerberos.kerb.spec.base.LastReqEntry;
import org.apache.kerby.kerberos.kerb.spec.base.LastReqType;
import org.apache.kerby.kerberos.kerb.spec.base.PrincipalName;
import org.apache.kerby.kerberos.kerb.spec.kdc.EncKdcRepPart;
import org.apache.kerby.kerberos.kerb.spec.kdc.EncTgsRepPart;
import org.apache.kerby.kerberos.kerb.spec.kdc.KdcReq;
import org.apache.kerby.kerberos.kerb.spec.kdc.TgsRep;
import org.apache.kerby.kerberos.kerb.spec.kdc.TgsReq;
import org.apache.kerby.kerberos.kerb.spec.pa.PaDataEntry;
import org.apache.kerby.kerberos.kerb.spec.ticket.EncTicketPart;
import org.apache.kerby.kerberos.kerb.spec.ticket.Ticket;
import org.apache.kerby.kerberos.kerb.spec.ticket.TicketFlag;

import java.nio.ByteBuffer;

public class TgsRequest extends KdcRequest {

    private EncryptionKey tgtSessionKey;
    private Ticket tgtTicket;

    /**
     * @param tgsReq TGS request
     * @param kdcContext kdc context
     */
    public TgsRequest(TgsReq tgsReq, KdcContext kdcContext) {
        super(tgsReq, kdcContext);

        setPreauthRequired(true);
    }

    /**
     * Get tgt session key.
     *
     * @return The tgt session key
     */
    public EncryptionKey getTgtSessionKey() {
        return tgtSessionKey;
    }

    /**
     * Set tgt session key.
     *
     * @param tgtSessionKey The tgt session key
     */
    public void setTgtSessionKey(EncryptionKey tgtSessionKey) {
        this.tgtSessionKey = tgtSessionKey;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void checkClient() throws KrbException {
        // Nothing to do at this phase because client couldn't be checked out yet.
    }

    /**
     * Get tgt ticket.
     *
     * @return The tgt ticket.
     */
    protected Ticket getTgtTicket() {
        return tgtTicket;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void issueTicket() throws KrbException {
        TicketIssuer issuer = new ServiceTicketIssuer(this);
        Ticket newTicket = issuer.issueTicket();
        setTicket(newTicket);
    }

    /**
     * Verify authenticator.
     * @throws org.apache.kerby.kerberos.kerb.KrbException e
     * @param paDataEntry preauthentication data entry
     */
    public void verifyAuthenticator(PaDataEntry paDataEntry) throws KrbException {
        ApReq apReq = KrbCodec.decode(paDataEntry.getPaDataValue(), ApReq.class);

        if (apReq.getPvno() != KrbConstant.KRB_V5) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_BADVERSION);
        }

        if (apReq.getMsgType() != KrbMessageType.AP_REQ) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_MSG_TYPE);
        }

        tgtTicket = apReq.getTicket();
        EncryptionType encType = tgtTicket.getEncryptedEncPart().getEType();
        EncryptionKey tgsKey = getTgsEntry().getKeys().get(encType);
        if (tgtTicket.getTktvno() != KrbConstant.KRB_V5) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_BADVERSION);
        }

        EncTicketPart encPart = EncryptionUtil.unseal(tgtTicket.getEncryptedEncPart(),
            tgsKey, KeyUsage.KDC_REP_TICKET, EncTicketPart.class);
        tgtTicket.setEncPart(encPart);

        EncryptionKey encKey = null;
        //if (apReq.getApOptions().isFlagSet(ApOptions.USE_SESSION_KEY)) {
        encKey = tgtTicket.getEncPart().getKey();

        if (encKey == null) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_NOKEY);
        }
        Authenticator authenticator = EncryptionUtil.unseal(apReq.getEncryptedAuthenticator(),
            encKey, KeyUsage.TGS_REQ_AUTH, Authenticator.class);

        if (!authenticator.getCname().equals(tgtTicket.getEncPart().getCname())) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_BADMATCH);
        }

        HostAddresses hostAddresses = tgtTicket.getEncPart().getClientAddresses();
        if (hostAddresses == null || hostAddresses.isEmpty()) {
            if (!getKdcContext().getConfig().isEmptyAddressesAllowed()) {
                throw new KrbException(KrbErrorCode.KRB_AP_ERR_BADADDR);
            }
        } else if (!hostAddresses.contains(getClientAddress())) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_BADADDR);
        }

        PrincipalName serverPrincipal = tgtTicket.getSname();
        serverPrincipal.setRealm(tgtTicket.getRealm());
        PrincipalName clientPrincipal = authenticator.getCname();
        clientPrincipal.setRealm(authenticator.getCrealm());
        KrbIdentity clientEntry = getEntry(clientPrincipal.getName());
        setClientEntry(clientEntry);

        if (!authenticator.getCtime().isInClockSkew(
            getKdcContext().getConfig().getAllowableClockSkew() * 1000)) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_SKEW);
        }

        KerberosTime now = KerberosTime.now();
        KerberosTime startTime = tgtTicket.getEncPart().getStartTime();
        if (startTime == null) {
            startTime = tgtTicket.getEncPart().getAuthTime();
        }
        if (!startTime.lessThan(now)) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_TKT_NYV);
        }

        KerberosTime endTime = tgtTicket.getEncPart().getEndTime();
        if (!endTime.greaterThan(now)) {
            throw new KrbException(KrbErrorCode.KRB_AP_ERR_TKT_EXPIRED);
        }

        apReq.getApOptions().setFlag(ApOption.MUTUAL_REQUIRED);

        setTgtSessionKey(tgtTicket.getEncPart().getKey());
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void makeReply() throws KrbException {
        Ticket ticket = getTicket();

        TgsRep reply = new TgsRep();

        if (getClientEntry() == null) {
            reply.setCname(ticket.getEncPart().getCname());
        } else {
            reply.setCname(getClientEntry().getPrincipal());
        }
        reply.setCrealm(getKdcContext().getKdcRealm());
        reply.setTicket(ticket);

        EncKdcRepPart encKdcRepPart = makeEncKdcRepPart();
        reply.setEncPart(encKdcRepPart);

        EncryptionKey sessionKey;
        if (getToken() != null) {
            sessionKey = getSessionKey();
        } else {
            sessionKey = getTgtSessionKey();
        }
        EncryptedData encryptedData = EncryptionUtil.seal(encKdcRepPart,
            sessionKey, KeyUsage.TGS_REP_ENCPART_SESSKEY);
        reply.setEncryptedEncPart(encryptedData);

        setReply(reply);
    }

    /**
     * Make EncKdcRepPart.
     * @return encryption kdc response part
     */
    private EncKdcRepPart makeEncKdcRepPart() {
        KdcReq request = getKdcReq();
        Ticket ticket = getTicket();

        EncKdcRepPart encKdcRepPart = new EncTgsRepPart();

        //session key
        encKdcRepPart.setKey(ticket.getEncPart().getKey());

        LastReq lastReq = new LastReq();
        LastReqEntry entry = new LastReqEntry();
        entry.setLrType(LastReqType.THE_LAST_INITIAL);
        entry.setLrValue(new KerberosTime());
        lastReq.add(entry);
        encKdcRepPart.setLastReq(lastReq);

        encKdcRepPart.setNonce(request.getReqBody().getNonce());

        encKdcRepPart.setFlags(ticket.getEncPart().getFlags());
        encKdcRepPart.setAuthTime(ticket.getEncPart().getAuthTime());
        encKdcRepPart.setStartTime(ticket.getEncPart().getStartTime());
        encKdcRepPart.setEndTime(ticket.getEncPart().getEndTime());

        if (ticket.getEncPart().getFlags().isFlagSet(TicketFlag.RENEWABLE)) {
            encKdcRepPart.setRenewTill(ticket.getEncPart().getRenewtill());
        }

        encKdcRepPart.setSname(ticket.getSname());
        encKdcRepPart.setSrealm(ticket.getRealm());
        encKdcRepPart.setCaddr(ticket.getEncPart().getClientAddresses());

        return encKdcRepPart;
    }

    /**
     * @return request body
     * @throws KrbException e
     */
    public ByteBuffer getRequestBody() throws KrbException {
        return null;
    }
}


text:
		<button type="button" class="close pull-right" ng-click="cancel()" aria-hidden="true">×</button>

Modal title

Body…

		<button class="btn btn-link" ng-click="cancel()">Cancel</button>
		<button type="button" class="btn btn-primary" ng-click="save()">Save changes</button>

redpajama_set_name: RedPajamaGithub


text:
using Microsoft.AspNetCore.Http;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace RecipeBook.Services.Data.Tests
{
    public class MockHttpContext : Mock<IHttpContextAccessor>
    {
        private const string FIRST_USER_AUTHENTICATION_TYPE = "Mock";
        private const string CUSTOM_CLAIM = "custom-claim";
        private const string CLAIM_VALUE = "claim value";

        private DefaultHttpContext context = new DefaultHttpContext();

        public void SetContextUser(string userName, string userUID, ref DefaultHttpContext context)
        {
            var user = new ClaimsPrincipal(new ClaimsIdentity(
                new Claim[]
            {
                new Claim(ClaimTypes.Name, userName),
                new Claim(ClaimTypes.NameIdentifier, userUID),
                new Claim(CUSTOM_CLAIM, CLAIM_VALUE),
            }, FIRST_USER_AUTHENTICATION_TYPE));

            context.User = user;
        }

        public void SetupMockContext(ref DefaultHttpContext context)
        {
            Setup(x => x.HttpContext).Returns(context);
        }
    }
}


text:
<?php

namespace Laasti\Lazydata\Resolvers;

use InvalidArgumentException;

/**
 * Resolves lazy loaded callables using league/container
 *
 */
class FilterResolver implements ResolverInterface
{

    /**
     * Valid filter key name regex
     */
    const KEY_REGEX = '[a-zA-Z_0-9]+';

    /**
     * Fallback Resolver
     * @var ResolverInterface
     */
    protected $fallback;

    /**
     * Separator between filter key and data
     * @var string
     */
    protected $separator;

    /**
     * Filters
     * @var array
     */
    protected $filters = [];

    /**
     * Constructor
     * @param string $separator
     * @param ResolverInterface $fallback
     */
    public function __construct($separator = ':',
            ResolverInterface $fallback = null)
    {
        $this->separator = $separator;
        $this->fallback = $fallback ? : new CallableResolver('=');
    }

    /**
     * Attempts to resolve through defined filters
     *
     * @param mixed $value
     */
    public function resolve($value, $default = 'value')
    {
        $matches = [];
        if (is_string($value) && preg_match('/^('.self::KEY_REGEX.')'.  preg_quote($this->separator).'(.*)/', $value, $matches)) {
            if (isset($this->filters[$matches[1]])) {
                return call_user_func_array($this->filters[$matches[1]], [$matches[2]]);
            } else if (function_exists($matches[1])) {
                return call_user_func_array($matches[1], [$matches[2]]);
            }
        }

        return $this->fallback->resolve($value, $default);
    }

    /**
     * Map a filter to a callable
     * @param string $key
     * @param callable $callable
     * @return FilterResolver
     * @throws InvalidArgumentException
     */
    public function setFilter($key, $callable)
    {
        if (!is_callable($callable)) {
            throw new InvalidArgumentException('Invalid callable for filter: "'.$key.'"');
        }
        if (!preg_match('/^'.self::KEY_REGEX.'$/', $key)) {
            throw new InvalidArgumentException('Invalid name for filter: "'.$key.'". The filter name can only contain alphanumeric characters and underscore.');
        }

        $this->filters[$key] = $callable;

        return $this;

    }

    /**
     * Remove filter
     * @param string $name
     * @return \Laasti\Lazydata\FilterResolver
     */
    public function removeFilter($name)
    {
        if (isset($this->filters[$name])) {
            unset($this->filters[$name]);
        }

        return $this;
    }

}


text:
var checkLogin = function() {
  if (document.getElementById("username").value.length > 0 && document.getElementById("password").value.length > 0) {
    window.location.href = "/pinewood/pages/standings";
  } else {
    sweetAlert("Oops...", "Please enter all information!", "error");
  }
};


text:
using ZyGames.Framework.Game.Command;

namespace ZyGames.Tianjiexing.BLL.GM
{
    public abstract class TjBaseCommand : BaseCommand
    {
        public const string CmdError = "[{0}]命令无效";
    }
}


text:
package auditor

import (
	"database/sql"
	"fmt"
	"time"

	"v.io/v23/context"
)

type database interface {
	Insert(ctx *context.T, entry databaseEntry) error
	Query(ctx *context.T, email string) <-chan databaseEntry
}

type databaseEntry struct {
	email              string
	caveats, blessings []byte
	timestamp          time.Time
	decodeErr          error
}

// newSQLDatabase returns a SQL implementation of the database interface.
// If the table does not exist it creates it.
func newSQLDatabase(ctx *context.T, db *sql.DB, table string) (database, error) {
	createStmt, err := db.Prepare(fmt.Sprintf("CREATE TABLE IF NOT EXISTS %s ( Email VARBINARY(256), Caveats BLOB, Timestamp DATETIME, Blessings BLOB, KEY (Email, Timestamp) );", table))
	if err != nil {
		return nil, err
	}
	if _, err = createStmt.Exec(); err != nil {
		return nil, err
	}
	insertStmt, err := db.Prepare(fmt.Sprintf("INSERT INTO %s (Email, Caveats, Timestamp, Blessings) VALUES (?, ?, ?, ?)", table))
	if err != nil {
		return nil, err
	}
	queryStmt, err := db.Prepare(fmt.Sprintf("SELECT Email, Caveats, Timestamp, Blessings FROM %s WHERE Email=? ORDER BY Timestamp DESC", table))
	return sqlDatabase{
		insertStmt: insertStmt,
		queryStmt:  queryStmt,
	}, err
}

// Table with 4 columns:
// (1) Email = string email of the Blessee.
// (2) Caveats = vom encoded caveats
// (3) Blessings = vom encoded resulting blessings.
// (4) Timestamp = time that the blessing happened.
type sqlDatabase struct {
	insertStmt, queryStmt *sql.Stmt
	ctx                   *context.T
}

func (s sqlDatabase) Insert(ctx *context.T, entry databaseEntry) error {
	_, err := s.insertStmt.Exec(entry.email, entry.caveats, entry.timestamp, entry.blessings)
	return err
}

func (s sqlDatabase) Query(ctx *context.T, email string) <-chan databaseEntry {
	c := make(chan databaseEntry)
	go s.sendDatabaseEntries(ctx, email, c)
	return c
}

func (s sqlDatabase) sendDatabaseEntries(ctx *context.T, email string, dst chan<- databaseEntry) {
	defer close(dst)
	rows, err := s.queryStmt.Query(email)
	if err != nil {
		ctx.Errorf("query failed %v", err)
		dst <- databaseEntry{decodeErr: fmt.Errorf("Failed to query for all audits: %v", err)}
		return
	}
	defer rows.Close()
	for rows.Next() {
		var dbentry databaseEntry
		if err = rows.Scan(&dbentry.email, &dbentry.caveats, &dbentry.timestamp, &dbentry.blessings); err != nil {
			ctx.Errorf("scan of row failed %v", err)
			dbentry.decodeErr = fmt.Errorf("failed to read sql row, %s", err)
		}
		dst <- dbentry
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC  "-//CL//DTD XHTML 1.0 Transitional plus Embed//EN"
  "http://www.w3.org/Graphics/xhtml1-transitional-plus-embed.dtd">

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <meta name="keywords" content="W3C SVG 1.1 2nd Edition Test Suite"/>
      <meta name="description" content="W3C SVG 1.1 2nd Edition Embedded Test Suite"/>
      <title>
SVG 1.1 2nd Edition Test (<embed>): text-align-01-b.svg
      </title>

      <link rel="prev" href="svgdom-over-01-f.html" />
      <link rel="index" href="index.html" />
      <link rel="next" href="text-align-02-b.html" />

Specification link: 10.9 Alignment properties

    svgdom-over-01-f ←
    index
    → text-align-02-b

    Tests that contain the draft-watermark are under development and may be incorrectly testing a feature.

text-align-01-b.svg

            SVG Image

            PNG Image

            <embed src="../../svg/text-align-01-b.svg" width="480" height="360"/>

      Operator Script

        Run the test. No interaction required.

    Pass Criteria

        The lines in pink, 'text-anchor:none' and 'text-anchor:start', should both start from the same horizontal position (indicated by the black circle on each line) and extend to the right.
        The green line, 'text-anchor:middle', should be centered horizontally around the black circle.
        The blue line, 'text-anchor:end', should be aligned such that the end of the text meets the black circle.

    Test Description

          Test 'text-anchor' property (horizontal).

          The three lines test the three values for property 'text-anchor': start, middle and end.

    svgdom-over-01-f ←
    index
    → text-align-02-b


text:
using System;
using System.IO;
using System.Linq;
using Microsoft.ML;
using NonToxic.Model;

namespace NonToxic.ConsoleApp
{
    class Program
    {

        static void Main(string[] args)
        {
            string utterance = "I know you listed your English as on the \"level 2\", but don't worry, you seem to be doing nicely otherwise, judging by the same page - so don't be taken aback. I just wanted to know if you were aware of what you wrote, and think it's an interesting case. : I would write that sentence simply as \"Theoretically I am an altruist, but only by word, not by my actions.\". : PS. You can reply to me on this same page, as I have it on my watchlist.  ";
            // string utterance = "How do you remember to breathe when you are that stupid?";
            // string utterance = "I have reviewed all your changes and though I don't agree with all of them, I find them generally acceptable";

            var predictionEngine = new Engine();
            var result = predictionEngine.Predict(utterance);

            Console.WriteLine($"Prediction: {result}");
        }

    }
}


text:
angular.module('iscan.annotations', [
]);


text:
namespace DesignTimeMapper.ExamplePocos
{
    public static class DtmExtensions
    {
        public static DesignTimeMapper.ExamplePocos.AddressDto MapToAddressDto(this System.Device.Location.CivicAddress civicaddress)
        {
            return new DesignTimeMapper.ExamplePocos.AddressDto()
            {AddressLine1 = civicaddress.AddressLine1, AddressLine2 = civicaddress.AddressLine2, Building = civicaddress.Building, City = civicaddress.City, PostalCode = civicaddress.PostalCode, StateProvince = civicaddress.StateProvince};
        }

        public static System.Device.Location.CivicAddress MapToCivicAddress(this DesignTimeMapper.ExamplePocos.AddressDto civicaddress)
        {
            return new System.Device.Location.CivicAddress()
            {AddressLine1 = civicaddress.AddressLine1, AddressLine2 = civicaddress.AddressLine2, Building = civicaddress.Building, City = civicaddress.City, PostalCode = civicaddress.PostalCode, StateProvince = civicaddress.StateProvince};
        }

        public static DesignTimeMapper.ExamplePocos.NestedClassDto MapToNestedClassDto(this NestedClass nestedclass)
        {
            return new DesignTimeMapper.ExamplePocos.NestedClassDto()
            {NestedProperty1 = nestedclass.Nested.Property1, NestedProperty2 = nestedclass.Nested.Property2};
        }

        public static NestedClass MapToNestedClass(this DesignTimeMapper.ExamplePocos.NestedClassDto nestedclass)
        {
            return new NestedClass()
            {Nested = new DesignTimeMapper.ExamplePocos.SimpleClass()
            {Property1 = nestedclass.NestedProperty1, Property2 = nestedclass.NestedProperty2}};
        }
    }
}


text:
package outboundbot

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// ModifyOutboundCallNumber invokes the outboundbot.ModifyOutboundCallNumber API synchronously
func (client *Client) ModifyOutboundCallNumber(request *ModifyOutboundCallNumberRequest) (response *ModifyOutboundCallNumberResponse, err error) {
	response = CreateModifyOutboundCallNumberResponse()
	err = client.DoAction(request, response)
	return
}

// ModifyOutboundCallNumberWithChan invokes the outboundbot.ModifyOutboundCallNumber API asynchronously
func (client *Client) ModifyOutboundCallNumberWithChan(request *ModifyOutboundCallNumberRequest) (<-chan *ModifyOutboundCallNumberResponse, <-chan error) {
	responseChan := make(chan *ModifyOutboundCallNumberResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.ModifyOutboundCallNumber(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// ModifyOutboundCallNumberWithCallback invokes the outboundbot.ModifyOutboundCallNumber API asynchronously
func (client *Client) ModifyOutboundCallNumberWithCallback(request *ModifyOutboundCallNumberRequest, callback func(response *ModifyOutboundCallNumberResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *ModifyOutboundCallNumberResponse
		var err error
		defer close(result)
		response, err = client.ModifyOutboundCallNumber(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// ModifyOutboundCallNumberRequest is the request struct for api ModifyOutboundCallNumber
type ModifyOutboundCallNumberRequest struct {
	*requests.RpcRequest
	OutboundCallNumberId string           `position:"Query" name:"OutboundCallNumberId"`
	RateLimitCount       requests.Integer `position:"Query" name:"RateLimitCount"`
	Number               string           `position:"Query" name:"Number"`
	InstanceId           string           `position:"Query" name:"InstanceId"`
	RateLimitPeriod      requests.Integer `position:"Query" name:"RateLimitPeriod"`
}

// ModifyOutboundCallNumberResponse is the response struct for api ModifyOutboundCallNumber
type ModifyOutboundCallNumberResponse struct {
	*responses.BaseResponse
	HttpStatusCode     int                `json:"HttpStatusCode" xml:"HttpStatusCode"`
	Code               string             `json:"Code" xml:"Code"`
	Message            string             `json:"Message" xml:"Message"`
	RequestId          string             `json:"RequestId" xml:"RequestId"`
	Success            bool               `json:"Success" xml:"Success"`
	OutboundCallNumber OutboundCallNumber `json:"OutboundCallNumber" xml:"OutboundCallNumber"`
}

// CreateModifyOutboundCallNumberRequest creates a request to invoke ModifyOutboundCallNumber API
func CreateModifyOutboundCallNumberRequest() (request *ModifyOutboundCallNumberRequest) {
	request = &ModifyOutboundCallNumberRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("OutboundBot", "2019-12-26", "ModifyOutboundCallNumber", "outboundbot", "openAPI")
	request.Method = requests.POST
	return
}

// CreateModifyOutboundCallNumberResponse creates a response to parse from ModifyOutboundCallNumber response
func CreateModifyOutboundCallNumberResponse() (response *ModifyOutboundCallNumberResponse) {
	response = &ModifyOutboundCallNumberResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
(function () {

    /**
     * an object to manage animation
     * @class
     * @extends me.Sprite
     * @memberOf me
     * @constructor
     * @param {Number} x the x coordinates of the sprite object
     * @param {Number} y the y coordinates of the sprite object
     * @param {Object} settings Contains additional parameters for the animation sheet
     * @param {Image|String} settings.image Image to use for the animation
     * @param {Number} [settings.framewidth] Width of a single frame within the spritesheet
     * @param {Number} [settings.frameheight] Height of a single frame within the spritesheet
     * @param {me.Vector2d} [settings.anchorPoint] Anchor point to draw the frame at
     * @example
     * // standalone image, with anchor in the center
     * var animationSheet = new me.AnimationSheet(0, 0, {
     *     image : "animationsheet",
     *     framewidth : 64,
     *     frameheight : 64,
     *     anchorPoint : new me.Vector2d(0.5, 0.5)
     * });
     */
    me.AnimationSheet = me.Sprite.extend(
    /** @scope me.AnimationSheet.prototype */
    {
        /** @ignore */
        init : function (x, y, settings) {

            /**
             * pause and resume animation

             * default value : false;
             * @public
             * @type Boolean
             * @name me.AnimationSheet#animationpause
             */
            this.animationpause = false;

            /**
             * animation cycling speed (delay between frame in ms)

             * default value : 100ms;
             * @public
             * @type Number
             * @name me.AnimationSheet#animationspeed
             */
            this.animationspeed = 100;

            // hold all defined animation
            this.anim = {};

            // a flag to reset animation
            this.resetAnim = null;

            // default animation sequence
            this.current = null;

            // animation frame delta
            this.dt = 0;

            // default animation speed (ms)
            this.animationspeed = 100;

            // call the constructor
            this._super(me.Sprite, "init", [ x, y, settings ]);

            // store/reset the current atlas information
            if (typeof(settings.atlas) !== "undefined") {
                this.textureAtlas = settings.atlas;
                this.atlasIndices = settings.atlasIndices;
            } else {
                // "regular" spritesheet
                this.textureAtlas = me.video.renderer.cache.get(
                    me.utils.getImage(settings.image),
                    settings
                ).getAtlas();
                this.atlasIndices = null;
            }

            // create a default animation sequence with all sprites
            this.addAnimation("default", null);

            // set as default
            this.setCurrentAnimation("default");
        },

        /**
         * add an animation

         * For fixed-sized cell sprite sheet, the index list must follow the
         * logic as per the following example :

         *
         * @name addAnimation
         * @memberOf me.AnimationSheet
         * @function
         * @param {String} name animation id
         * @param {Number[]|String[]|Object[]} index list of sprite index or name
         * defining the animation. Can also use objects to specify delay for each frame, see below
         * @param {Number} [animationspeed] cycling speed for animation in ms
         * (delay between each frame).
         * @see me.AnimationSheet#animationspeed
         * @example
         * // walking animation
         * this.addAnimation("walk", [ 0, 1, 2, 3, 4, 5 ]);
         * // eating animation
         * this.addAnimation("eat", [ 6, 6 ]);
         * // rolling animation
         * this.addAnimation("roll", [ 7, 8, 9, 10 ]);
         * // slower animation
         * this.addAnimation("roll", [ 7, 8, 9, 10 ], 200);
         * // or get more specific with delay for each frame. Good solution instead of repeating:
         * this.addAnimation("turn", [{ name: 0, delay: 200 }, { name: 1, delay: 100 }])
         * // can do this with atlas values as well:
         * this.addAnimation("turn", [{ name: "turnone", delay: 200 }, { name: "turntwo", delay: 100 }])
         * // define an dying animation that stop on the last frame
         * this.addAnimation("die", [{ name: 3, delay: 200 }, { name: 4, delay: 100 }, { name: 5, delay: Infinity }])
         */
        addAnimation : function (name, index, animationspeed) {
            this.anim[name] = {
                name : name,
                frames : [],
                idx : 0,
                length : 0
            };

            if (index == null) {
                index = [];
                // create a default animation with all frame
                Object.keys(this.textureAtlas).forEach(function (v, i) {
                    index[i] = i;
                });
            }

            // # of frames
            var counter = 0;
            // set each frame configuration (offset, size, etc..)
            for (var i = 0, len = index.length; i < len; i++) {
                var frame = index[i];
                var frameObject;
                if (typeof(frame) === "number" || typeof(frame) === "string") {
                    frameObject = {
                        name: frame,
                        delay: animationspeed || this.animationspeed
                    };
                }
                else {
                  frameObject = frame;
                }
                var frameObjectName = frameObject.name;
                if (typeof(frameObjectName) === "number") {
                    if (typeof (this.textureAtlas[frameObjectName]) !== "undefined") {
                        // TODO: adding the cache source coordinates add undefined entries in webGL mode
                        this.anim[name].frames[i] = Object.assign(
                            {},
                            this.textureAtlas[frameObjectName],
                            frameObject
                        );
                        counter++;
                    }
                } else { // string
                    if (this.atlasIndices === null) {
                        throw new me.Renderable.Error(
                            "string parameters for addAnimation are not allowed for standard spritesheet based Texture"
                        );
                    } else {
                        this.anim[name].frames[i] = Object.assign(
                            {},
                            this.textureAtlas[this.atlasIndices[frameObjectName]],
                            frameObject
                        );
                        counter++;
                    }
                }
            }
            this.anim[name].length = counter;
        },

        /**
         * set the current animation
         * this will always change the animation & set the frame to zero
         * @name setCurrentAnimation
         * @memberOf me.AnimationSheet
         * @function
         * @param {String} name animation id
         * @param {String|Function} [onComplete] animation id to switch to when
         * complete, or callback
         * @example
         * // set "walk" animation
         * this.setCurrentAnimation("walk");
         *
         * // set "walk" animation if it is not the current animation
         * if (this.isCurrentAnimation("walk")) {
         *     this.setCurrentAnimation("walk");
         * }
         *
         * // set "eat" animation, and switch to "walk" when complete
         * this.setCurrentAnimation("eat", "walk");
         *
         * // set "die" animation, and remove the object when finished
         * this.setCurrentAnimation("die", (function () {
         *    me.game.world.removeChild(this);
         *    return false; // do not reset to first frame
         * }).bind(this));
         *
         * // set "attack" animation, and pause for a short duration
         * this.setCurrentAnimation("die", (function () {
         *    this.animationpause = true;
         *
         *    // back to "standing" animation after 1 second
         *    setTimeout(function () {
         *        this.setCurrentAnimation("standing");
         *    }, 1000);
         *
         *    return false; // do not reset to first frame
         * }).bind(this));
         **/
        setCurrentAnimation : function (name, resetAnim, _preserve_dt) {
            if (this.anim[name]) {
                this.current = this.anim[name];
                this.resetAnim = resetAnim || null;
                this.setAnimationFrame(this.current.idx);
                if (!_preserve_dt) {
                    this.dt = 0;
                }
            } else {
                throw new me.Renderable.Error("animation id '" + name + "' not defined");
            }
        },

        /**
         * return true if the specified animation is the current one.
         * @name isCurrentAnimation
         * @memberOf me.AnimationSheet
         * @function
         * @param {String} name animation id
         * @return {Boolean}
         * @example
         * if (!this.isCurrentAnimation("walk")) {
         *     // do something funny...
         * }
         */
        isCurrentAnimation : function (name) {
            return this.current.name === name;
        },

        /**
         * force the current animation frame index.
         * @name setAnimationFrame
         * @memberOf me.AnimationSheet
         * @function
         * @param {Number} [index=0] animation frame index
         * @example
         * // reset the current animation to the first frame
         * this.setAnimationFrame();
         */
        setAnimationFrame : function (idx) {
            this.current.idx = (idx || 0) % this.current.length;
            var frame = this.getAnimationFrameObjectByIndex(this.current.idx);
            this.offset = frame.offset;
            this.width = frame.width;
            this.height = frame.height;
            this._sourceAngle = frame.angle;
            if (frame.anchorPoint) {
                this.anchorPoint = frame.anchorPoint;
            }
        },

        /**
         * return the current animation frame index.
         * @name getCurrentAnimationFrame
         * @memberOf me.AnimationSheet
         * @function
         * @return {Number} current animation frame index
         */
        getCurrentAnimationFrame : function () {
            return this.current.idx;
        },

        /**
         * Returns the frame object by the index.
         * @name getAnimationFrameObjectByIndex
         * @memberOf me.AnimationSheet
         * @function
         * @private
         * @return {Number} if using number indices. Returns {Object} containing frame data if using texture atlas
         */
        getAnimationFrameObjectByIndex : function (id) {
            return this.current.frames[id];
        },

        /**
         * update the animation

         * this is automatically called by the game manager {@link me.game}
         * @name update
         * @memberOf me.AnimationSheet
         * @function
         * @protected
         * @param {Number} dt time since the last update in milliseconds.
         */
        update : function (dt) {
            // Update animation if necessary
            if (this.animationpause || this.current.length <= 1) {
                return this._super(me.Sprite, "update", [ dt ]);
            }

            var duration = 0,
                result = false;

            this.dt += dt;
            duration = this.getAnimationFrameObjectByIndex(this.current.idx).delay;
            while (this.dt >= duration) {
                result = true;
                this.dt -= duration;
                this.setAnimationFrame(this.current.idx + 1);

                // Switch animation if we reach the end of the strip and a callback is defined
                if (this.current.idx === 0 && this.resetAnim)  {
                    // If string, change to the corresponding animation
                    if (typeof this.resetAnim === "string") {
                        this.setCurrentAnimation(this.resetAnim, null, true);
                    }
                    // Otherwise is must be callable
                    else if (this.resetAnim() === false) {
                        // Reset to last frame
                        this.setAnimationFrame(this.current.length - 1);

                        // Bail early without skipping any more frames.
                        this.dt %= duration;
                        break;
                    }
                }

                // Get next frame duration
                duration = this.getAnimationFrameObjectByIndex(this.current.idx).delay;
            }

            return this._super(me.Sprite, "update", [ dt ]) || result;
        }
    });
})();


text:
{{getCaption()}}

 Select all

 Unselect all

 {{item.name}}


text:
#ifndef GOOGLEMAC_IPHONE_SHARED_PPN_KRYPTON_CLASSES_PPNVPNSERVICE_H_
#define GOOGLEMAC_IPHONE_SHARED_PPN_KRYPTON_CLASSES_PPNVPNSERVICE_H_

#import <NetworkExtension/NetworkExtension.h>

#include <memory>

#include "googlemac/iPhone/Shared/PPN/Krypton/Classes/PPNDatapath.h"
#include "privacy/net/krypton/datapath/ipsec/ipsec_datapath.h"
#include "privacy/net/krypton/pal/vpn_service_interface.h"
#include "third_party/absl/base/thread_annotations.h"
#include "third_party/absl/container/flat_hash_map.h"
#include "third_party/absl/synchronization/mutex.h"

@protocol PPNUDPSessionManaging;
@protocol PPNVirtualNetworkInterfaceManaging;

namespace privacy {
namespace krypton {

class PPNVPNService : public datapath::ipsec::IpSecDatapath::IpSecVpnServiceInterface,
                      public PPNDatapath::PPNDatapathVpnServiceInterface {
 public:
  explicit PPNVPNService(id<PPNUDPSessionManaging> UDPSessionManager,
                         id<PPNVirtualNetworkInterfaceManaging> networkManager)
      : UDPSessionManager_(UDPSessionManager), networkManager_(networkManager) {}

  ~PPNVPNService() override {}

  DatapathInterface* BuildDatapath(const KryptonConfig& config, utils::LooperThread* looper,
                                   TimerManager* timer_manager) override;
  // Establishes the tunnel.
  absl::Status CreateTunnel(const TunFdData& tun_fd_data) override;
  PacketPipe* GetTunnel() override;
  NEPacketTunnelFlow* GetPacketTunnelFlow() override;
  void CloseTunnel() override;

  // Create aa udp session to a given endpoint.
  absl::StatusOr<NWUDPSession*> CreateUDPSession(const NetworkInfo& network_info,
                                                 const Endpoint& endpoint) override;

  // Creates a network side packet pipe using the `endpoint`.
  absl::StatusOr<std::unique_ptr<PacketPipe>> CreateNetworkPipe(const NetworkInfo& network_info,
                                                                const Endpoint& endpoint) override;

  // Verifies the tunnel connection is still up.
  absl::Status CheckConnection() override;

 private:
  // Objective-C function manager that is used to create a UDP session upon demand.
  //
  // `__weak` is used to break the reference cycle introduced by Objective-C's
  // ARC system.
  //
  // Tunnel provider class guarantees the UDPSessionManager_'s lifespan is at least the
  // same as this class. The graph of the reference:
  // TunnelProvider -> PPNService -> PPNKryptonService -> PPNVPNService
  //       ^                                                    |
  //       | _ _ _ _ _ _ _ _ PPNUDPSessionManaging _ _ _ _ _ _ _|
  __weak id<PPNUDPSessionManaging> UDPSessionManager_;
  __weak id<PPNVirtualNetworkInterfaceManaging> networkManager_;

  absl::Mutex mutex_;
  TunFdData tun_fd_data_ ABSL_GUARDED_BY(mutex_);
  std::unique_ptr<PacketPipe> tunnel_ ABSL_GUARDED_BY(mutex_);
};

}  // namespace krypton
}  // namespace privacy

#endif  // GOOGLEMAC_IPHONE_SHARED_PPN_KRYPTON_CLASSES_PPNVPNSERVICE_H_


text:
/*
 * Author: Jim Nasby
 * Created at: 2014-10-07 17:50:51 -0500
 *
 */

SET client_min_messages = warning;

/*
 * Extension is configured to go into the variant schema, which Postgres
 * creates for us. We just need to fix the permissions.
 */
GRANT USAGE ON SCHEMA variant TO public;
CREATE SCHEMA _variant;

CREATE OR REPLACE FUNCTION _variant.exec(
  sql text
) RETURNS void LANGUAGE plpgsql AS $f$
BEGIN
  RAISE DEBUG 'Executing SQL %s', sql;
  EXECUTE sql;
END
$f$;

CREATE TYPE variant._variant as ( original_type text, data text );

CREATE TYPE variant.variant;
CREATE OR REPLACE FUNCTION _variant._variant_in(cstring, Oid, int)
RETURNS variant.variant
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'variant_in';
CREATE OR REPLACE FUNCTION _variant._variant_typmod_in(cstring[])
RETURNS int
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'variant_typmod_in';
-- See also second definition at bottom of file
CREATE OR REPLACE FUNCTION variant.text_in(text, int)
RETURNS variant.variant
LANGUAGE c IMMUTABLE
AS '$libdir/variant', 'variant_text_in';

CREATE OR REPLACE FUNCTION _variant._variant_out(variant.variant)
RETURNS cstring
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'variant_out';
CREATE OR REPLACE FUNCTION _variant._variant_typmod_out(int)
RETURNS cstring
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'variant_typmod_out';
CREATE OR REPLACE FUNCTION variant.text_out(variant.variant)
RETURNS text
LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'variant_text_out';

CREATE TYPE variant.variant(
  INPUT = _variant._variant_in
  , OUTPUT = _variant._variant_out
  , TYPMOD_IN = _variant._variant_typmod_in
  , TYPMOD_OUT = _variant._variant_typmod_out
  , STORAGE = extended
);

-- Can only create this after type is fully created
-- See also second definition at bottom of file
CREATE OR REPLACE FUNCTION variant.text_in(text)
RETURNS variant.variant LANGUAGE sql IMMUTABLE STRICT AS $f$
SELECT variant.text_in( $1, -1 )
$f$;

CREATE OR REPLACE FUNCTION _variant.variant_hash(variant.variant)
RETURNS int LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'variant_hash';
CREATE OR REPLACE FUNCTION _variant.quote_variant_name(text)
RETURNS text LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'quote_variant_name';
CREATE OR REPLACE FUNCTION variant.original_type(variant.variant)
RETURNS regtype LANGUAGE c IMMUTABLE STRICT
AS '$libdir/variant', 'variant_type_out';

SELECT NULL = count(*) FROM ( -- Supress tons of blank lines
SELECT _variant.exec( format($$
CREATE OR REPLACE FUNCTION _variant.variant_%1$s(variant.variant, variant.variant)
  RETURNS boolean LANGUAGE c IMMUTABLE STRICT AS '$libdir/variant', 'variant_%1$s';
  $$
  , op
) )
FROM unnest(string_to_array('image_eq lt le eq ne ge gt', ' ')) AS op
) a;

CREATE OPERATOR < (
  PROCEDURE = _variant.variant_lt
  , LEFTARG = variant.variant
  , RIGHTARG = variant.variant
  , COMMUTATOR = >
  , NEGATOR = >=
);
CREATE OPERATOR <= (
  PROCEDURE = _variant.variant_le
  , LEFTARG = variant.variant
  , RIGHTARG = variant.variant
  , COMMUTATOR = >=
  , NEGATOR = >
);
CREATE OPERATOR = (
  PROCEDURE = _variant.variant_eq
  , LEFTARG = variant.variant
  , RIGHTARG = variant.variant
  , COMMUTATOR = =
  , NEGATOR = !=
);
CREATE OPERATOR != (
  PROCEDURE = _variant.variant_ne
  , LEFTARG = variant.variant
  , RIGHTARG = variant.variant
  , COMMUTATOR = !=
  , NEGATOR = =
);
CREATE OPERATOR >= (
  PROCEDURE = _variant.variant_ge
  , LEFTARG = variant.variant
  , RIGHTARG = variant.variant
  , COMMUTATOR = <=
  , NEGATOR = <
);
CREATE OPERATOR > (
  PROCEDURE = _variant.variant_gt
  , LEFTARG = variant.variant
  , RIGHTARG = variant.variant
  , COMMUTATOR = <
  , NEGATOR = <=
);
CREATE OPERATOR *= (
  PROCEDURE = _variant.variant_image_eq
  , LEFTARG = variant.variant
  , RIGHTARG = variant.variant
  , COMMUTATOR = *=
  -- TODO , NEGATOR = *!=
);

CREATE OPERATOR CLASS hash__variant_ops
  DEFAULT FOR TYPE variant.variant
  USING hash AS
    OPERATOR 1 *=
    , FUNCTION 1 _variant.variant_hash(variant.variant)
;

CREATE OR REPLACE VIEW _variant.allowed_types AS
  SELECT t.oid::regtype AS type_name
      , 'variant.variant'::regtype AS source
      , 'variant.variant'::regtype AS target
    FROM pg_catalog.pg_type t
      LEFT JOIN pg_catalog.pg_type e ON e.oid = t.typelem
    WHERE true
      AND t.typisdefined
      AND t.typtype != 'c' -- We don't currently support composite types
      AND (e.typtype IS NULL OR e.typtype != 'c' ) -- Or arrays of composite types
      AND t.typtype != 'p' -- Or pseudotypes
      AND t.typtype != 'd' -- You can't cast to or from domains :(
;

CREATE OR REPLACE VIEW _variant.casts AS
  SELECT castsource::regtype AS source, casttarget::regtype AS target
      , castfunc::regprocedure AS cast_function
      , CASE castcontext
          WHEN 'e' THEN 'explicit'
          WHEN 'a' THEN 'assignment'
          WHEN 'i' THEN 'implicit'
        END AS cast_context
      , CASE castmethod
          WHEN 'f' THEN 'function'
          WHEN 'i' THEN 'inout'
          WHEN 'b' THEN 'binary'
        END AS cast_method
    FROM pg_catalog.pg_cast c
;

CREATE OR REPLACE VIEW variant.variant_casts AS
  SELECT *
    FROM _variant.casts
    WHERE false
      OR source = 'variant.variant'::regtype
      OR target = 'variant.variant'::regtype
;

CREATE OR REPLACE VIEW _variant.missing_casts_in AS
  SELECT t.type_name AS source, target
    FROM _variant.allowed_types t
  EXCEPT
  SELECT source, target FROM variant.variant_casts
  EXCEPT
  SELECT 'variant.variant', 'variant.variant'
;

CREATE OR REPLACE VIEW _variant.missing_casts_out AS
  SELECT source, t.type_name AS target
    FROM _variant.allowed_types t
  EXCEPT
  SELECT source, target FROM variant.variant_casts
  EXCEPT
  SELECT 'variant.variant', 'variant.variant'
;

CREATE OR REPLACE VIEW variant.missing_casts AS
  SELECT *, 'IN' AS direction
    FROM _variant.missing_casts_in
  UNION ALL
  SELECT *, 'OUT' AS direction
    FROM _variant.missing_casts_out
;

CREATE OR REPLACE FUNCTION _variant.create_cast_in(
  p_source    regtype
) RETURNS void LANGUAGE plpgsql AS $f$
BEGIN
  PERFORM _variant.exec(
    format(
      $sql$CREATE OR REPLACE FUNCTION _variant.cast_in(
      i %s
      , typmod int
      , explicit boolean
    ) RETURNS variant.variant LANGUAGE c IMMUTABLE AS '$libdir/variant', 'variant_cast_in'
      $sql$
      , p_source -- i data type
    )
  );
  PERFORM _variant.exec(
    format( 'CREATE CAST( %s AS variant.variant ) WITH FUNCTION _variant.cast_in( %1$s, int, boolean ) AS %s'
      , p_source
      , CASE (SELECT typcategory FROM pg_type WHERE oid = p_source) WHEN 'A' THEN 'ASSIGNMENT' ELSE 'IMPLICIT' END
    )
  );
END
$f$;

CREATE OR REPLACE FUNCTION _variant.create_cast_out(
  p_target    regtype
) RETURNS void LANGUAGE plpgsql AS $f$
DECLARE
  v_function_name name :=
    'cast_to_'
    || regexp_replace(
          CASE WHEN p_target::text LIKE '%[]'
            THEN '_' || regexp_replace( p_target::text, '\[]$', '' )
          ELSE p_target::text
          END
          , '[\. "]' -- Replace invarid identifier characters with '_'
          , '_'
          , 'g' -- Replace globally
        )
  ;
BEGIN
  PERFORM _variant.exec(
    format(
      $sql$CREATE OR REPLACE FUNCTION _variant.%s(
      v variant.variant
    ) RETURNS %1s LANGUAGE c IMMUTABLE AS '$libdir/variant', 'variant_cast_out'
      $sql$
      , v_function_name
      , p_target
    )
  );
  PERFORM _variant.exec(
    format( 'CREATE CAST( variant.variant AS %s) WITH FUNCTION _variant.%s( variant.variant ) AS ASSIGNMENT'
      , p_target
      , v_function_name
    )
  );
END
$f$;

CREATE OR REPLACE FUNCTION variant.create_casts()
RETURNS void LANGUAGE plpgsql AS $f$
DECLARE
  r variant.missing_casts;
  sql text;
BEGIN
  FOR r IN
    SELECT * FROM variant.missing_casts
  LOOP
    IF r.direction = 'IN' THEN
      PERFORM _variant.create_cast_in( r.source );
    ELSIF r.direction = 'OUT' THEN
      PERFORM _variant.create_cast_out( r.target );
    ELSE
      RAISE EXCEPTION 'Unknown cast direction "%"', r.direction;
    END IF;
  END LOOP;
END
$f$;

-- Automagically create casts for everything we support
SELECT variant.create_casts();

CREATE TABLE _variant._registered(
  variant_typmod    SERIAL        PRIMARY KEY
      CONSTRAINT variant_typemod_minimum_value CHECK( variant_typmod >= -1 )
  , variant_name    varchar(100)  NOT NULL
  , variant_enabled boolean       NOT NULL DEFAULT true
  , storage_allowed boolean       NOT NULL DEFAULT false -- Fix variant.register() if you change the default
  , allowed_types   regtype[]     NOT NULL
    CONSTRAINT allowed_types_may_not_contain_nulls
      /*
       * Make sure there's no NULLs in allowed_types. Aside from being a good
       * idea, this is required by _variant._tg_check_type_usage.
       */
      CHECK( allowed_types = array_remove(allowed_types, NULL) )
  , CONSTRAINT storing_default_variant_not_supported
      CHECK( variant_typmod >= 0 OR NOT storage_allowed )
);
CREATE UNIQUE INDEX _registered__u_lcase_variant_name ON _variant._registered( lower( variant_name ) );
CREATE UNIQUE INDEX _registered__u_quote_variant_name ON _variant._registered( _variant.quote_variant_name( variant_name ) );

INSERT INTO _variant._registered VALUES( -1, 'DEFAULT', true, false, '{}' );

-- Necessary for internal functions to not be SECDEF
CREATE VIEW variant._registered AS SELECT * FROM _variant._registered;
GRANT SELECT ON variant._registered TO public;

CREATE VIEW variant.registered AS
  SELECT variant_typmod, _variant.quote_variant_name(variant_name), variant_enabled, storage_allowed, coalesce( array_length(allowed_types, 1), 0 ) AS types_allowed
    FROM _variant._registered
;
CREATE VIEW _variant.stored AS
  SELECT atttypmod AS variant_typmod, quote_ident(attname) AS column_name, a.*
    FROM pg_attribute a
      JOIN pg_class c ON c.oid = a.attrelid
    WHERE NOT attisdropped
      AND atttypid = 'variant.variant'::regtype
      AND c.relkind != 'v' -- Views don't have storage
      -- NOTE: We intentionally look at all temp tables, not just our own
;

CREATE VIEW variant.stored AS
  SELECT *
      , array( SELECT attrelid::regclass || '.' || column_name FROM _variant.stored WHERE variant_typmod = r.variant_typmod )
          AS columns_using_variant
    FROM variant.registered r
;
CREATE VIEW variant.stored__bad AS
  SELECT r.*, attrelid::regclass AS table_name, column_name, format_type(atttypid, variant_typmod) AS type_name
    FROM _variant.stored s
      LEFT JOIN variant.registered r USING( variant_typmod )
    WHERE
            NOT storage_allowed
            OR NOT variant_enabled
;

CREATE OR REPLACE FUNCTION _variant._tg_check_type_usage(
) RETURNS trigger LANGUAGE plpgsql AS $f$
/*
 * Verify that if we're removing a type from the list of allowed types that
 * this registered variant isn't being used in a table anywhere.
 *
 * TODO: We should have a way to verify that a table doesn't contain any rows
 * with a particular type.
 */
DECLARE
  v_columns text[];
  v_new_types _variant._registered.allowed_types%TYPE;
  v_new_storage _variant._registered.storage_allowed%TYPE;
BEGIN
  -- Special cases for DEFAULT variant
  IF OLD.variant_typmod = -1 THEN
    IF TG_OP = 'DELETE' THEN
      RAISE EXCEPTION 'Deleting DEFAULT variant is not allowed';
    END IF;

    IF EXISTS( SELECT 1 FROM _variant.stored WHERE variant_typmod = -1 ) THEN
      RAISE WARNING 'There are columns storing a DEFAULT variant. These must be changed to a registered variant immediately.'
        USING DETAIL = 'Affected columns:' || E'\n\t' || array_to_string(
            array( SELECT attrelid::regclass || '.' || column_name FROM _variant.stored WHERE variant_typmod = -1 )
            , E'\n\t'
          )
      ;
    END IF;

    IF NEW.storage_allowed THEN
      RAISE EXCEPTION 'Enabling storage of DEFAULT variant is not allowed'
        USING ERRCODE = 'invalid_parameter_value'
      ;
    END IF;
  END IF;

  IF TG_OP = 'UPDATE' THEN
    IF NEW.variant_typmod IS DISTINCT FROM OLD.variant_typmod THEN
      RAISE EXCEPTION 'Changing variant typmods is not allowed'
        USING ERRCODE = 'invalid_parameter_value'
      ;
    END IF;

    IF NEW.allowed_types @> OLD.allowed_types
      AND NEW.storage_allowed
    THEN
      -- User didn't remove any types or disable storage
      RETURN NULL;
    END IF;

    v_new_types := NEW.allowed_types;
    v_new_storage := NEW.storage_allowed;
  ELSE
    v_new_types := '{}';
  END IF;

  v_columns := columns_using_variant FROM variant.stored WHERE variant_typmod = OLD.variant_typmod;
  RAISE DEBUG 'TG_OP: %, OLD.allowed_types %, NEW.allowed_types %, OLD.storage_allowed %, NEW.storage_allowed %, v_columns %'
    , TG_WHEN
    , OLD.allowed_types
    , v_new_types
    , OLD.storage_allowed
    , v_new_storage
    , v_columns
  ;
  IF v_columns IS DISTINCT FROM '{}' THEN
    RAISE EXCEPTION 'variant "%" is still in use', OLD.variant_name
      USING ERRCODE = 'dependent_objects_still_exist'
        , DETAIL = E'in use by ' || array_to_string( v_columns, ', ' )
    ;
  END IF;

  RETURN NULL;
END
$f$;
CREATE TRIGGER check_type_usage
  AFTER UPDATE OR DELETE ON _variant._registered
  FOR EACH ROW
  EXECUTE PROCEDURE _variant._tg_check_type_usage()
;

CREATE OR REPLACE FUNCTION _variant.stored__bad(
) RETURNS text[] LANGUAGE sql AS $body$
SELECT array(
  SELECT table_name || '.' || column_name || ' ' || type_name
    FROM variant.stored__bad
)
$body$;

/*
 * WARNING: This function is called from a SECDEF trigger!
 */
CREATE OR REPLACE FUNCTION _variant._verify_storage(
  p_fix_it boolean
) RETURNS void LANGUAGE plpgsql AS $body$
DECLARE
  v_bad CONSTANT text[] := _variant.stored__bad();
BEGIN
  IF v_bad IS DISTINCT FROM '{}' THEN
    IF p_fix_it THEN
      UPDATE _variant._registered
        SET storage_allowed = true
          , variant_enabled = true
        WHERE _variant.quote_variant_name( variant_name )
          IN ( SELECT quote_variant_name FROM variant.stored__bad )
      ;
      RAISE WARNING 'Found table columns with variants that were disabled or disallowed storage'
        USING DETAIL = 'The following variants were enabled and had storage allowed:' || E'\n\t'
          || array_to_string( v_bad, E'\n\t' )
      ;
    ELSE
      RAISE EXCEPTION 'detected tables containing variants that do not allow storage'
        USING ERRCODE = 'invalid_parameter_value'
          , DETAIL = 'Bad table columns and types:' || E'\n\t'
            || array_to_string( v_bad, E'\n\t' )
          , HINT = 'Use variant.storage_allowed() to allow storage for a variant'
      ;
    END IF;
  END IF;
END
$body$;
CREATE OR REPLACE FUNCTION variant._etg_verify_storage_start(
) RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $body$
BEGIN
  PERFORM _variant._verify_storage( true );
END
$body$;
CREATE OR REPLACE FUNCTION variant._etg_verify_storage_end(
) RETURNS event_trigger SECURITY DEFINER LANGUAGE plpgsql AS $body$
BEGIN
  PERFORM _variant._verify_storage( false );
END
$body$;

CREATE OR REPLACE FUNCTION _variant._ensure_storage_check_one(
  p_warning boolean
  , p_start_end text
) RETURNS boolean LANGUAGE plpgsql AS $body$
DECLARE
  t_enable CONSTANT text := 'ALTER EVENT TRIGGER %I ENABLE';
  t_create CONSTANT text := $template$
CREATE EVENT TRIGGER variant_storage_check_%1$s
  ON ddl_command_%1$s
  WHEN tag IN ( 'ALTER DOMAIN', 'ALTER TABLE'
    , 'CREATE DOMAIN', 'CREATE TABLE', 'CREATE TABLE AS'
  )
  EXECUTE PROCEDURE variant._etg_verify_storage_%1$s()
$template$;

  v_enabled "char";
  v_name name;
BEGIN
  IF p_start_end NOT IN ( 'start', 'end' ) THEN
    RAISE 'something seriously wrong just happened';
  END IF;

  BEGIN
    SELECT evtenabled, evtname INTO STRICT v_enabled, v_name
      FROM pg_event_trigger
      WHERE evtevent = 'ddl_command_' || p_start_end
        AND evtfoid = ('variant._etg_verify_storage_' || p_start_end )::regproc
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      IF p_warning THEN
        RAISE WARNING 'No ddl_command_% event trigger to verify variant storage; re-creating', p_start_end;
      END IF;
      PERFORM _variant.exec( format(t_create, p_start_end) );
      RETURN true;
  END;

  IF v_enabled IS DISTINCT FROM 'O' THEN
    PERFORM _variant.exec( format(t_enable, evtname) );
    RETURN true;
  END IF;

  RETURN false;
END
$body$;
CREATE OR REPLACE FUNCTION _variant._ensure_storage_check(
  p_warning boolean DEFAULT true
) RETURNS void LANGUAGE plpgsql AS $body$
BEGIN
  -- NOTE: Must do it this way or the optimizer gets cute and doesn't call the function both times
  IF bool_or( _variant._ensure_storage_check_one( p_warning, a ) ) FROM unnest( array[ 'start', 'end' ] ) a
  THEN
    -- Since we were missing one or both event triggers fix anything that's now broken
    PERFORM _variant._verify_storage(true);
  END IF;
END
$body$;
SELECT _variant._ensure_storage_check( false );

CREATE OR REPLACE FUNCTION variant.register(
  p_variant_name _variant._registered.variant_name%TYPE
  , p_allowed_types _variant._registered.allowed_types%TYPE DEFAULT '{}'
  , p_storage_allowed _variant._registered.storage_allowed%TYPE DEFAULT NULL
) RETURNS _variant._registered.variant_typmod%TYPE
LANGUAGE plpgsql AS $func$
DECLARE
  c_test_table CONSTANT text := 'test_ability_to_create_table_with_just_registered_variant';

  v_storage_allowed CONSTANT _variant._registered.storage_allowed%TYPE := coalesce( p_storage_allowed, false );
  v_formatted_type text;
  ret _variant._registered.variant_typmod%TYPE;
BEGIN
  PERFORM _variant._ensure_storage_check();

  IF p_variant_name IS NULL THEN
    RAISE EXCEPTION 'variant_name may not be NULL';
  END IF;
  IF p_variant_name = '' THEN
    RAISE EXCEPTION 'variant_name may not be an empty string';
  END IF;

  INSERT INTO _variant._registered( variant_name, storage_allowed, allowed_types )
    VALUES( p_variant_name, true, p_allowed_types )
    RETURNING variant_typmod
    INTO ret
  ;
  v_formatted_type := pg_catalog.format_type( 'variant.variant'::regtype, ret );

  -- This ensures that the user can actually use the variant that they're registering
  BEGIN
    PERFORM _variant.exec(format(
        $$CREATE TEMP TABLE %I(v %s)$$
        , c_test_table
        , v_formatted_type
    ));
  EXCEPTION
    WHEN syntax_error THEN
      RAISE EXCEPTION '% is not a valid name for a variant', p_variant_name
        USING ERRCODE = 'syntax_error'
          , HINT = 'variant names must be valid type modifiers: string literals or numbers'
          , DETAIL = 'formatted type output: ' || coalesce(v_formatted_type, '<>')
      ;
  END;
  PERFORM _variant.exec(format(
      $$DROP TABLE %I$$
      , c_test_table
  ));

  -- Now disable storage, which is the default
  UPDATE _variant._registered
    SET storage_allowed = v_storage_allowed
    WHERE variant_typmod = ret
      -- Don't make a needless update
      AND storage_allowed IS DISTINCT FROM v_storage_allowed
  ;
  RETURN ret;
END
$func$;

CREATE OR REPLACE FUNCTION _variant.registered__get(
  p_variant_typmod  _variant._registered.variant_typmod%TYPE
) RETURNS _variant._registered LANGUAGE plpgsql STABLE AS $f$
DECLARE
  r_variant _variant._registered%ROWTYPE;
BEGIN
  SELECT * INTO STRICT r_variant
      FROM _variant._registered
      WHERE variant_typmod = p_variant_typmod
  ;
  RETURN r_variant;

  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      RAISE EXCEPTION 'Invalid typmod %', coalesce(p_variant_typmod::text, '<>')
        USING ERRCODE = 'invalid_parameter_value'
      ;
END
$f$;
CREATE OR REPLACE FUNCTION _variant.registered__get__variant_name__enabled(
  _variant._registered.variant_typmod%TYPE
) RETURNS TABLE(
  variant_name _variant._registered.variant_name%TYPE
  , variant_enabled _variant._registered.variant_enabled%TYPE
) LANGUAGE sql STABLE AS $f$
SELECT variant_name, variant_enabled FROM _variant.registered__get( $1 )
$f$;

-- TODO: Might want a non-locking version of this that we can mark stable
CREATE OR REPLACE FUNCTION _variant.registered__get(
  p_variant_name _variant._registered.variant_name%TYPE
  , p_lock boolean DEFAULT false
) RETURNS _variant._registered LANGUAGE plpgsql AS $f$
DECLARE
  r_variant _variant._registered%ROWTYPE;
BEGIN
  IF p_lock THEN
    SELECT * INTO STRICT r_variant
        FROM _variant._registered
        WHERE lower( variant_name ) = lower( p_variant_name )
        FOR UPDATE
    ;
  ELSE
    SELECT * INTO STRICT r_variant
        FROM _variant._registered
        WHERE lower( variant_name ) = lower( p_variant_name )
    ;
  END IF;
  RETURN r_variant;

  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      RAISE EXCEPTION 'Invalid variant type %', coalesce(p_variant_name, '<>')
        USING ERRCODE = 'invalid_parameter_value'
      ;
END
$f$;

CREATE OR REPLACE FUNCTION _variant.registered__get__typmod(
  _variant._registered.variant_name%TYPE
) RETURNS _variant._registered.variant_typmod%TYPE LANGUAGE sql STABLE AS $f$
SELECT variant_typmod FROM _variant.registered__get( $1 )
$f$;
CREATE OR REPLACE FUNCTION variant._registered__get__typmod(
  _variant._registered.variant_name%TYPE
) RETURNS _variant._registered.variant_typmod%TYPE SECURITY DEFINER LANGUAGE sql STABLE AS $f$
SELECT _variant.registered__get__typmod($1)
$f$;

CREATE OR REPLACE FUNCTION variant.text_in(text, text)
RETURNS variant.variant LANGUAGE sql IMMUTABLE STRICT AS $f$
SELECT variant.text_in( $1, variant._registered__get__typmod($2) )
$f$;

CREATE OR REPLACE FUNCTION variant.storage_allowed(
  p_variant_name _variant._registered.variant_name%TYPE
  , p_storage_allowed _variant._registered.storage_allowed%TYPE
) RETURNS void LANGUAGE plpgsql AS $body$
DECLARE
  v_typmod CONSTANT _variant._registered.variant_typmod%TYPE := _variant.registered__get__typmod( p_variant_name );
BEGIN
  PERFORM _variant._ensure_storage_check();

  IF v_typmod = -1 AND p_storage_allowed THEN
    RAISE EXCEPTION 'Enabling storage of DEFAULT variant is not allowed'
      USING ERRCODE = 'invalid_parameter_value'
    ;
  END IF;

  UPDATE _variant._registered
    SET storage_allowed = p_storage_allowed
    WHERE variant_typmod = v_typmod
      AND storage_allowed IS DISTINCT FROM p_storage_allowed
  ;
END
$body$;

CREATE OR REPLACE FUNCTION variant.allowed_types(
  p_variant_name _variant._registered.variant_name%TYPE
) RETURNS TABLE(allowed_type regtype) LANGUAGE sql STABLE AS $f$
  SELECT *
    FROM unnest(
        ( SELECT allowed_types FROM _variant.registered__get( p_variant_name ) )
      ) t(t)
    ORDER BY t::text
  ;
$f$;

CREATE OR REPLACE FUNCTION variant.add_types(
  p_variant_name _variant._registered.variant_name%TYPE
  , p_allowed_types _variant._registered.allowed_types%TYPE
) RETURNS TABLE(allowed_type regtype)
LANGUAGE plpgsql AS $f$
DECLARE
  v_new_allowed _variant._registered.allowed_types%TYPE;
  v_current record;
BEGIN
  PERFORM _variant._ensure_storage_check();

  -- Lock this record when we get it
  v_current := _variant.registered__get( p_variant_name, true );

  UPDATE _variant._registered
    -- It seems worthwhile to keep stuff unique
    SET allowed_types = array(
        SELECT * FROM unnest( v_current.allowed_types )
        UNION ALL
        SELECT * FROM unnest( p_allowed_types )
      )
    WHERE variant_typmod = v_current.variant_typmod
    RETURNING allowed_types INTO v_new_allowed
  ;
  RETURN QUERY SELECT t FROM unnest(v_new_allowed) t(t) ORDER BY t::text;
END
$f$;
CREATE OR REPLACE FUNCTION variant.add_type(
  p_variant_name _variant._registered.variant_name%TYPE
  , p_type text
) RETURNS TABLE(allowed_type regtype) LANGUAGE sql AS $f$
  SELECT * FROM variant.add_types($1,array[ $2::regtype ])
$f$;

CREATE OR REPLACE FUNCTION variant.remove_types(
  p_variant_name _variant._registered.variant_name%TYPE
  , p_removed_types _variant._registered.allowed_types%TYPE
) RETURNS TABLE(allowed_type regtype)
LANGUAGE plpgsql AS $f$
DECLARE
  v_new_allowed _variant._registered.allowed_types%TYPE;
  v_current record;
BEGIN
  PERFORM _variant._ensure_storage_check();

  -- Lock this record when we get it
  v_current := _variant.registered__get( p_variant_name, true );
  IF NOT v_current.allowed_types && p_removed_types THEN
    IF array_length(p_removed_types, 1) = 1 THEN
      RAISE NOTICE 'type %s was already not allowed in variant %s', p_removed_types[1], v_current.variant_name;
    ELSE
      RAISE NOTICE 'types %s were already not allowed in variant %s', p_removed_types, v_current.variant_name;
    END IF;
    v_new_allowed := v_current.allowed_types;
  ELSE
    UPDATE _variant._registered
      -- It seems worthwhile to keep stuff unique
      SET allowed_types = array(
          SELECT t
            FROM unnest( v_current.allowed_types ) t
            WHERE t != ANY( p_removed_types )
        )
      WHERE variant_typmod = v_current.variant_typmod
      RETURNING allowed_types INTO v_new_allowed
    ;
  END IF;

  RETURN QUERY SELECT t FROM unnest(v_new_allowed) t(t) ORDER BY t::text;
END
$f$;
CREATE OR REPLACE FUNCTION variant.remove_type(
  p_variant_name _variant._registered.variant_name%TYPE
  , p_type text
) RETURNS TABLE(allowed_type regtype) LANGUAGE sql AS $f$
  SELECT * FROM variant.remove_types($1,array[ $2::regtype ])
$f$;

-- vi: expandtab sw=2 ts=2


text:
package evemarginfinder;

/**
 *
 * @author Memcallen Kahoudi/Recursive Pineapple
 */
public class FilterPanel extends javax.swing.JPanel {

    private final FilterFrame parent;

    /**
     * Creates new form FilterPanel
     */
    public FilterPanel(FilterFrame parent) {
        initComponents();
        this.parent = parent;
    }

    public void sKey(String key){
        this.key.setText(key);
    }

    public void setVal(String val){
        this.value.setText(val);
    }

    public String key(){
        return key.getText();
    }

    public String value(){
        return value.getText();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        filler5 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 10), new java.awt.Dimension(0, 10), new java.awt.Dimension(32767, 10));
        jPanel4 = new javax.swing.JPanel();
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 32767));
        jPanel1 = new javax.swing.JPanel();
        key = new javax.swing.JTextField();
        filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 32767));
        jPanel2 = new javax.swing.JPanel();
        value = new javax.swing.JTextField();
        filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 32767));
        jPanel3 = new javax.swing.JPanel();
        exit_button = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        filler4 = new javax.swing.Box.Filler(new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 0), new java.awt.Dimension(10, 32767));
        filler6 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 5), new java.awt.Dimension(0, 5), new java.awt.Dimension(32767, 5));
        jSeparator1 = new javax.swing.JSeparator();
        jPanel5 = new javax.swing.JPanel();

        setMaximumSize(new java.awt.Dimension(2147483647, 28));
        setMinimumSize(new java.awt.Dimension(250, 42));
        setRequestFocusEnabled(false);
        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
        add(filler5);

        jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.LINE_AXIS));
        jPanel4.add(filler1);

        jPanel1.setLayout(new java.awt.BorderLayout());

        key.setText("jTextField1");
        jPanel1.add(key, java.awt.BorderLayout.NORTH);

        jPanel4.add(jPanel1);
        jPanel4.add(filler3);

        jPanel2.setLayout(new java.awt.BorderLayout());

        value.setText("jTextField2");
        jPanel2.add(value, java.awt.BorderLayout.NORTH);

        jPanel4.add(jPanel2);
        jPanel4.add(filler2);

        jPanel3.setPreferredSize(new java.awt.Dimension(13, 20));
        jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 0));

        exit_button.setText("X");
        exit_button.setMaximumSize(new java.awt.Dimension(40, 20));
        exit_button.setMinimumSize(new java.awt.Dimension(40, 20));
        exit_button.setPreferredSize(new java.awt.Dimension(40, 20));
        exit_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exit_buttonActionPerformed(evt);
            }
        });
        jPanel3.add(exit_button);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 78, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 72, Short.MAX_VALUE)
        );

        jPanel3.add(jPanel6);

        jPanel4.add(jPanel3);
        jPanel4.add(filler4);

        add(jPanel4);
        add(filler6);
        add(jSeparator1);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 250, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 10, Short.MAX_VALUE)
        );

        add(jPanel5);
    }// </editor-fold>//GEN-END:initComponents

    private void exit_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit_buttonActionPerformed
        parent.remove(this);
    }//GEN-LAST:event_exit_buttonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton exit_button;
    private javax.swing.Box.Filler filler1;
    private javax.swing.Box.Filler filler2;
    private javax.swing.Box.Filler filler3;
    private javax.swing.Box.Filler filler4;
    private javax.swing.Box.Filler filler5;
    private javax.swing.Box.Filler filler6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField key;
    private javax.swing.JTextField value;
    // End of variables declaration//GEN-END:variables
}


text:
package io.apiman.plugins.urlwhitelist;

import io.apiman.gateway.engine.beans.ApiRequest;
import io.apiman.gateway.engine.beans.PolicyFailure;
import io.apiman.gateway.engine.beans.PolicyFailureType;
import io.apiman.gateway.engine.beans.exceptions.ConfigurationParseException;
import io.apiman.gateway.engine.policies.AbstractMappedPolicy;
import io.apiman.gateway.engine.policy.IPolicyChain;
import io.apiman.gateway.engine.policy.IPolicyContext;
import io.apiman.plugins.urlwhitelist.beans.UrlWhitelistBean;
import io.apiman.plugins.urlwhitelist.beans.WhitelistEntryBean;
import io.apiman.plugins.urlwhitelist.util.Messages;

import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;

/**
 * A policy that only permits requests matching a whitelist.
 *
 * @author Pete Cornish {@literal <outofcoffee@gmail.com>}
 */
public class UrlWhitelistPolicy extends AbstractMappedPolicy<UrlWhitelistBean> {
    private static final Messages MESSAGES = new Messages("io.apiman.plugins.urlwhitelist", "UrlWhitelistPolicy"); //$NON-NLS-1$ //$NON-NLS-2$
    private static final String APIMAN_GATEWAY = "/apiman-gateway"; //$NON-NLS-1$

    /**
     * Cache of precompiled URL patterns. Note that {@link Pattern} is thread-safe.
     */
    private static final Map<String, Pattern> PATTERN_MAP = new ConcurrentHashMap<>();

    /**
     * @see io.apiman.gateway.engine.policies.AbstractMappedPolicy#getConfigurationClass()
     */
    @Override
    protected Class<UrlWhitelistBean> getConfigurationClass() {
        return UrlWhitelistBean.class;
    }

    /**
     * @see io.apiman.gateway.engine.policies.AbstractMappedPolicy#parseConfiguration(String)
     */
    @Override
    public UrlWhitelistBean parseConfiguration(String jsonConfiguration) throws ConfigurationParseException {
        final UrlWhitelistBean config = super.parseConfiguration(jsonConfiguration);

        // precompile patterns for performance
        for (WhitelistEntryBean whitelistEntry : config.getWhitelist()) {
            try {
                PATTERN_MAP.put(whitelistEntry.getRegex(), Pattern.compile(whitelistEntry.getRegex()));
            } catch (Exception e) {
                throw new ConfigurationParseException(MESSAGES.format("Error.CompilingPattern", whitelistEntry.getRegex()), e); //$NON-NLS-1$
            }
        }

        return config;
    }

    /**
     * @see io.apiman.gateway.engine.policies.AbstractMappedPolicy#doApply(io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
     */
    @Override
    protected void doApply(ApiRequest request, IPolicyContext context, UrlWhitelistBean config,
                           IPolicyChain<ApiRequest> chain) {

        // normalise, for safety
        final String normalisedPath;
        try {
            normalisedPath = getNormalisedPath(config, request);
        } catch (Exception e) {
            chain.throwError(new RuntimeException(MESSAGES.format("Error.NormalisingPath", request.getUrl()), e)); //$NON-NLS-1$
            return;
        }

        final boolean requestPermitted;
        try {
            requestPermitted = isRequestPermitted(config, normalisedPath, request.getType());
        } catch (Exception e) {
            chain.throwError(new RuntimeException(MESSAGES.format(
                    "Error.CheckingRequest", request.getType(), normalisedPath), e)); //$NON-NLS-1$
            return;
        }

        if (requestPermitted) {
            chain.doApply(request);
        } else {
            chain.doFailure(new PolicyFailure(PolicyFailureType.Authorization,
                    HttpURLConnection.HTTP_FORBIDDEN, MESSAGES.format("Failure.UrlNotPermitted", normalisedPath))); //$NON-NLS-1$
        }
    }

    /**
     * Normalise the request URL before evaluating any access control rules, for safety. Returns the path
     * component of the normalised URL.
     *
     * @param config  the policy configuration
     * @param request the incoming request
     * @return the normalised path
     * @throws URISyntaxException
     */
    private String getNormalisedPath(UrlWhitelistBean config, ApiRequest request) throws URISyntaxException {
        // normalise, for safety
        final URI normalisedUrl = new URI(request.getUrl()).normalize();

        String path = normalisedUrl.getPath();
        if (config.isRemovePathPrefix()) {
            if (path.startsWith(APIMAN_GATEWAY)) {
                path = path.substring(APIMAN_GATEWAY.length());
            }

            // remove org/API/version prefix, e.g. '/myorg/myapi/1.0'
            final String apiPrefix = String.format("/%s/%s/%s", //$NON-NLS-1$
                    request.getApiOrgId(),
                    request.getApiId(),
                    request.getApiVersion());

            path = path.substring(apiPrefix.length());
        }

        return path;
    }

    /**
     * Evaluates whether the request for the {@code normalisedPath} and {@code method} is permitted by
     * the rules in the {@code config}.
     *
     * @param config         the policy configuration
     * @param normalisedPath the normalised request path
     * @param method         the HTTP method
     * @return {@code true} if the request is permitted, otherwise {@code false}
     */
    private boolean isRequestPermitted(UrlWhitelistBean config, String normalisedPath, String method) {
        for (WhitelistEntryBean whitelistEntry : config.getWhitelist()) {
            final Pattern pattern = PATTERN_MAP.get(whitelistEntry.getRegex());
            if (null != pattern && pattern.matcher(normalisedPath).matches()) {
                return isMethodPermitted(whitelistEntry, method);
            }
        }
        return false;
    }

    /**
     * Evaluates whether the request for the {@code method} is permitted by the configuration of
     * the {@code whitelistEntry}.
     *
     * @param whitelistEntry the whitelist entry matching the request URL
     * @param method         the HTTP method
     * @return {@code true} if the method is permitted, otherwise {@code false}
     */
    private boolean isMethodPermitted(WhitelistEntryBean whitelistEntry, String method) {
        switch (method.toUpperCase()) {
            case "GET": //$NON-NLS-1$
                return whitelistEntry.isMethodGet();
            case "POST": //$NON-NLS-1$
                return whitelistEntry.isMethodPost();
            case "PUT": //$NON-NLS-1$
                return whitelistEntry.isMethodPut();
            case "PATCH": //$NON-NLS-1$
                return whitelistEntry.isMethodPatch();
            case "DELETE": //$NON-NLS-1$
                return whitelistEntry.isMethodDelete();
            case "HEAD": //$NON-NLS-1$
                return whitelistEntry.isMethodHead();
            case "OPTIONS": //$NON-NLS-1$
                return whitelistEntry.isMethodOptions();
            case "TRACE": //$NON-NLS-1$
                return whitelistEntry.isMethodTrace();

            default:
                throw new UnsupportedOperationException(MESSAGES.format("Error.MethodNotSupported", method)); //$NON-NLS-1$
        }
    }
}


text:
Rant.rb
=======

Ruby port of [Rant](https://github.com/TheBerkin/Rant).


text:
#include "Vao/OgreGL3PlusConstBufferPacked.h"
#include "Vao/OgreGL3PlusBufferInterface.h"

namespace Ogre
{
    GL3PlusConstBufferPacked::GL3PlusConstBufferPacked(
                size_t internalBufferStartBytes, size_t numElements, uint32 bytesPerElement,
                uint32 numElementsPadding, BufferType bufferType, void *initialData, bool keepAsShadow,
                VaoManager *vaoManager, BufferInterface *bufferInterface ) :
        ConstBufferPacked( internalBufferStartBytes, numElements, bytesPerElement, numElementsPadding,
                           bufferType, initialData, keepAsShadow, vaoManager, bufferInterface )
    {
    }
    //-----------------------------------------------------------------------------------
    GL3PlusConstBufferPacked::~GL3PlusConstBufferPacked()
    {
    }
    //-----------------------------------------------------------------------------------
    inline void GL3PlusConstBufferPacked::bindBuffer( uint16 slot )
    {
        assert( dynamic_cast<GL3PlusBufferInterface*>( mBufferInterface ) );

        GL3PlusBufferInterface *bufferInterface = static_cast<GL3PlusBufferInterface*>(
                                                                      mBufferInterface );

        OCGE(
          glBindBufferRange( GL_UNIFORM_BUFFER, slot, bufferInterface->getVboName(),
                             mFinalBufferStart * mBytesPerElement, mNumElements * mBytesPerElement ) );
    }
    //-----------------------------------------------------------------------------------
    void GL3PlusConstBufferPacked::bindBufferVS( uint16 slot )
    {
        bindBuffer( slot );
    }
    //-----------------------------------------------------------------------------------
    void GL3PlusConstBufferPacked::bindBufferPS( uint16 slot )
    {
        bindBuffer( slot );
    }
    //-----------------------------------------------------------------------------------
    void GL3PlusConstBufferPacked::bindBufferGS( uint16 slot )
    {
        bindBuffer( slot );
    }
    //-----------------------------------------------------------------------------------
    void GL3PlusConstBufferPacked::bindBufferHS( uint16 slot )
    {
        bindBuffer( slot );
    }
    //-----------------------------------------------------------------------------------
    void GL3PlusConstBufferPacked::bindBufferDS( uint16 slot )
    {
        bindBuffer( slot );
    }
    //-----------------------------------------------------------------------------------
    void GL3PlusConstBufferPacked::bindBufferCS( uint16 slot )
    {
        bindBuffer( slot );
    }
    //-----------------------------------------------------------------------------------
}


text:
class Retraction < StudyRelationship

end


text:
package com.codeflowcrafter.PEAA.Domain;

import com.codeflowcrafter.PEAA.Domain.Interfaces.IForeignKeyMapping;

import java.util.List;

/**
 * Created by aiko on 3/4/17.
 */

public abstract class ForeignKeyMapping<TParentEntity, TChildEntity>
        implements IForeignKeyMapping<TParentEntity, TChildEntity>
{
    public List<TChildEntity> GetChildEntities(TParentEntity parent)
    {
        return RetrieveForeignKeyEntities(parent);
    }

    public abstract List<TChildEntity> RetrieveForeignKeyEntities(TParentEntity parent);
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Laurus.Spex
{
	public interface ITestLog
	{
		void Given(string given, bool success);
		void And(string and, bool success);
		void When(string when, bool success);
		void Then(string then, bool success);
		void Error(string message);

		IList<TestStep> GetExecutedSteps();
	}
}


text:
import CsvGen from './csvGen'
const { app } = require('electron').remote
const fs = require('fs')

const configBasePath = `${app.getPath('userData')}`
fs.existsSync(configBasePath) || fs.mkdirSync(configBasePath)

export default {
  saveTmp: function (recordId, reportData) {
    const tmpPath = `${configBasePath}/${recordId}.json`
    fs.writeFileSync(tmpPath, JSON.stringify(reportData))
  },
  saveAs: function (fileName, reportData) {
    fs.writeFileSync(fileName, JSON.stringify(reportData))
  },
  saveAsCsv: function (filename, siteData, flowData, results) {
    const csv = new CsvGen(siteData, flowData, results)
    const report = csv.genReport()
    fs.writeFileSync(filename, report)
  },
  processFromMiddleOut: function (array) {
    const newArray = []
    let i = Math.ceil(array.length / 2)
    let j = i + 1

    while (i >= 0) {
      newArray.push(array[j++])
      if (i < array.length) newArray.push(array[i--])
    }
    return newArray
  },
  range: function* (begin, end, interval = 1) {
    for (let i = begin; i < end; i += interval) {
      yield i
    }
  }
}


text:
namespace libxmljs {

class XmlNamespace : public node::ObjectWrap {
public:

    xmlNs* xml_obj;

    static void Initialize(v8::Handle<v8::Object> target);
    static v8::Persistent<v8::FunctionTemplate> constructor_template;

    explicit XmlNamespace(xmlNs* ns);
    XmlNamespace(xmlNs* node, const char* prefix, const char* href);
    ~XmlNamespace();

    static v8::Handle<v8::Object> New(xmlNs* ns);

protected:

    static v8::Handle<v8::Value> New(const v8::Arguments& args);
    static v8::Handle<v8::Value> Href(const v8::Arguments& args);
    static v8::Handle<v8::Value> Prefix(const v8::Arguments& args);

    v8::Handle<v8::Value> get_href();
    v8::Handle<v8::Value> get_prefix();

    friend class Node;
};
}  // namespace libxmljs

#endif  // SRC_XML_NAMESPACE_H_


text:
package org.apache.flink.runtime.webmonitor.handlers;

import org.apache.flink.runtime.accumulators.StringifiedAccumulatorResult;
import org.apache.flink.runtime.executiongraph.AccessExecutionGraph;
import org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex;
import org.apache.flink.runtime.webmonitor.ExecutionGraphHolder;
import org.apache.flink.runtime.webmonitor.history.ArchivedJson;
import org.apache.flink.runtime.webmonitor.history.JsonArchivist;

import com.fasterxml.jackson.core.JsonGenerator;

import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Request handler that returns the accummulators for a given vertex.
 */
public class JobVertexAccumulatorsHandler extends AbstractJobVertexRequestHandler {

	private static final String JOB_VERTEX_ACCUMULATORS_REST_PATH = "/jobs/:jobid/vertices/:vertexid/accumulators";

	public JobVertexAccumulatorsHandler(ExecutionGraphHolder executionGraphHolder) {
		super(executionGraphHolder);
	}

	@Override
	public String[] getPaths() {
		return new String[]{JOB_VERTEX_ACCUMULATORS_REST_PATH};
	}

	@Override
	public String handleRequest(AccessExecutionJobVertex jobVertex, Map<String, String> params) throws Exception {
		return createVertexAccumulatorsJson(jobVertex);
	}

	/**
	 * Archivist for JobVertexAccumulatorsHandler.
	 */
	public static class JobVertexAccumulatorsJsonArchivist implements JsonArchivist {

		@Override
		public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
			List<ArchivedJson> archive = new ArrayList<>();
			for (AccessExecutionJobVertex task : graph.getAllVertices().values()) {
				String json = createVertexAccumulatorsJson(task);
				String path = JOB_VERTEX_ACCUMULATORS_REST_PATH
					.replace(":jobid", graph.getJobID().toString())
					.replace(":vertexid", task.getJobVertexId().toString());
				archive.add(new ArchivedJson(path, json));
			}
			return archive;
		}
	}

	public static String createVertexAccumulatorsJson(AccessExecutionJobVertex jobVertex) throws IOException {
		StringWriter writer = new StringWriter();
		JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer);

		StringifiedAccumulatorResult[] accs = jobVertex.getAggregatedUserAccumulatorsStringified();

		gen.writeStartObject();
		gen.writeStringField("id", jobVertex.getJobVertexId().toString());

		gen.writeArrayFieldStart("user-accumulators");
		for (StringifiedAccumulatorResult acc : accs) {
			gen.writeStartObject();
			gen.writeStringField("name", acc.getName());
			gen.writeStringField("type", acc.getType());
			gen.writeStringField("value", acc.getValue());
			gen.writeEndObject();
		}
		gen.writeEndArray();

		gen.writeEndObject();

		gen.close();
		return writer.toString();
	}
}


text:
class GURL;

namespace webkit_glue {

// HistoryItem serialization.
WEBKIT_GLUE_EXPORT std::string HistoryItemToString(
    const WebKit::WebHistoryItem& item);
WEBKIT_GLUE_EXPORT WebKit::WebHistoryItem HistoryItemFromString(
    const std::string& serialized_item);

// Reads file paths from the HTTP body and the file input elements of a
// serialized WebHistoryItem.
WEBKIT_GLUE_EXPORT std::vector<base::FilePath> FilePathsFromHistoryState(
    const std::string& content_state);

// For testing purposes only.
WEBKIT_GLUE_EXPORT void HistoryItemToVersionedString(
    const WebKit::WebHistoryItem& item,
    int version,
    std::string* serialized_item);
WEBKIT_GLUE_EXPORT int HistoryItemCurrentVersion();

// Removes form data containing passwords from the history state string
// |content_state|.
WEBKIT_GLUE_EXPORT std::string RemovePasswordDataFromHistoryState(
    const std::string& content_state);

// Removes scroll offset from the history state string |content_state|.
WEBKIT_GLUE_EXPORT std::string RemoveScrollOffsetFromHistoryState(
    const std::string& content_state);

// Creates serialized state for the specified URL. This is a variant of
// HistoryItemToString (in glue_serialize) that is used during session restore
// if the saved state is empty.
WEBKIT_GLUE_EXPORT std::string CreateHistoryStateForURL(const GURL& url);

}  // namespace webkit_glue

#endif  // #ifndef WEBKIT_GLUE_GLUE_SERIALIZE_H_


text:
package com.bestxty.ioc.bean.xml.element.parser;

import com.bestxty.ioc.bean.xml.autowire.Autowire;
import com.bestxty.ioc.bean.xml.element.LeafElement;
import com.bestxty.ioc.bean.xml.element.PropertyElement;
import org.dom4j.Element;

import java.util.List;

/**
 * @author jiangtaiyang
 * Created by jiangtaiyang on 2017/10/16.
 */
public interface BeanElementParser {

    /**
     * 判断一个bean元素是否需要延迟加载
     *
     * @param element
     * @return
     */
    public boolean isLazy(Element element);

    /**
     * 获得一个bean元素下的constructor-arg(构造方法参数)的子标签
     *
     * @param element
     * @return
     */
    public List<Element> getConstructorArgsElements(Element element);

    /**
     * 得到元素属性为name的属性值
     *
     * @param element
     * @param name
     * @return
     */
    public String getAttribute(Element element, String name);

    /**
     * 判断一个bean元素是否配置为单态
     *
     * @param element
     * @return
     */
    public boolean isSingleton(Element element);

    /**
     * 获得一个bean元素下所有property元素
     *
     * @param element
     * @return
     */
    public List<Element> getPropertyElements(Element element);

    /**
     * 返回一个bean元素对应的Autowire对象
     *
     * @param element
     * @return
     */
    public Autowire getAutowire(Element element);

    /**
     * 获取bean元素下所有constructor-arg的值(包括value和ref)
     *
     * @param element
     * @return
     */
    public List<LeafElement> getConstructorValue(Element element);

    /**
     * 获取bean元素下所有property元素的值(包括value和ref)
     *
     * @param element
     * @return
     */
    List<PropertyElement> getPropertyValue(Element element);
}


text:
$(document).ready(function () {
    $('.jcarousel').jcarousel();

    $('.jcarousel-prev')
        .on('jcarouselcontrol:active', function () {
            $(this).removeClass('inactive');
        })
        .on('jcarouselcontrol:inactive', function () {
            $(this).addClass('inactive');
        })
        .jcarouselControl({
            target: '-=3'
        });

    $('.jcarousel-next')
        .on('jcarouselcontrol:active', function () {
            $(this).removeClass('inactive');
        })
        .on('jcarouselcontrol:inactive', function () {
            $(this).addClass('inactive');
        })
        .jcarouselControl({
            target: '+=3'
        });

    $('.fancybox').fancybox({
        arrows: true
    });
});


text: DEFAULT_TRANSITION_INTERVAL = 6000


text:
import unittest
"""
Given a sorted array of integers, return the number of distinct absolute values
among the elements of the array. The input can contain duplicate values.
Input: -3 -2 0 3 4 5
Output: 5
"""

"""
Approach:
1. Initialize count as total number of elements in array.
2. There can be two types of duplicates: same value and same sign OR same value and opposite sign.
3. Have two pointers, left and right at the two ends of the array.
4. For handling first type of duplicates, keep moving the pointers till values are same.
5. For handling second type of duplicates, sum of arr[left] and arr[right] will be zero for such a pair.
"""

def absolute_distinct_count(sorted_list):

    left = 0
    right = len(sorted_list) - 1
    count = len(sorted_list)

    while left < right:
        # First type of duplicates:
        while left != right and sorted_list[left] == sorted_list[left + 1]:
            count -= 1
            left += 1
        while left != right and sorted_list[right] == sorted_list[right - 1]:
            count -= 1
            right -= 1

        # break if only one element
        if left == right:
            break

        # Second type of duplicate:
        if sorted_list[left] + sorted_list[right] == 0:
            count -= 1
            left += 1
            right -= 1
        elif sorted_list[left] + sorted_list[right] < 0:
            left += 1
        else:
            right -= 1

    return count

class TestAbsoluteDistinctCounts(unittest.TestCase):

    def test_absolute_distinct_counts(self):
        sorted_list = [-3, -2, 0, 3, 4, 5]
        self.assertEqual(absolute_distinct_count(sorted_list), 5)
        sorted_list = [-1, -1, -1, -1, 0, 1, 1, 1, 1]
        self.assertEqual(absolute_distinct_count(sorted_list), 2)
        sorted_list = [-1, -1, -1, -1, 0]
        self.assertEqual(absolute_distinct_count(sorted_list), 2)
        sorted_list = [0, 0, 0]
        self.assertEqual(absolute_distinct_count(sorted_list), 1)


text:
<!doctype html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<title>Comments</title>

<link rel="import" href="components/core-icon-button/core-icon-button.html">
<link rel="import" href="components/core-icons/core-icons.html">
<link rel="import" href="firebase-data.html">

<template is="auto-binding">

  <firebase-data id="base" location="https://comments-demo.firebaseio.com/comments" data="{{items}}" keys="{{keys}}"></firebase-data>

      Author: <input value="{{author}}">

      <textarea cols="60" rows="4" value="{{comment}}"></textarea>

      <button on-tap="{{send}}">Send</button>

      <template repeat="{{key in keys}}">
        <comment-editor key="{{key}}" item="{{items[key]}}"></comment-editor>
      </template>

</template>

<polymer-element name="comment-editor" attributes="key item" block>
<template>
  {{item.author}}:
  <textarea style="vertical-align: middle;" cols="60" rows="3" value="{{item.comment}}" on-change="{{commit}}"></textarea>
  <core-icon-button icon="close" on-tap="{{remove}}"></core-icon-button>
</template>

</polymer-element>